From patchwork Thu Apr 2 19:13:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64075C2BA16 for ; Thu, 2 Apr 2020 19:13:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A84520737 for ; Thu, 2 Apr 2020 19:13:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jDq/750X" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731823AbgDBTND (ORCPT ); Thu, 2 Apr 2020 15:13:03 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46032 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388499AbgDBTND (ORCPT ); Thu, 2 Apr 2020 15:13:03 -0400 Received: by mail-wr1-f67.google.com with SMTP id t7so5538438wrw.12 for ; Thu, 02 Apr 2020 12:13:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=5S9qZQTMAjcrILXN8SNfaJ0AgqIsT1BdR29FTtqKpB8=; b=jDq/750X3O3gh3kIp0dHwRk3Fyi0deowUgdzPpNmcN6Q498mIkIGP/4ZiqRaIgpgW6 9WawTnBzrhh1bR+dvx3WDdIKQzi9mbDbTSpC9cuIqp9oMdz4JvKfeQXdiO6QGo3yzrpB 8B2CZ5QTAubcyNeiZP3N9c6hTQI5++MlbIh2FoTuxHuhyWubRLfBlTF4FcpqQq6k85uF upMoeg10p7qzloWhTc1YiVV9TvUsYVJEXzS0K5Ul9M2ax7Pw0zAhZkTW59ugdeJK+bSs SamRU4D9p0pywneLJVzLMr13HWN6LZJCWdSjSIJtlbjx8GqGRXbrQ2XmBeEw1L6PuGP9 9rzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5S9qZQTMAjcrILXN8SNfaJ0AgqIsT1BdR29FTtqKpB8=; b=kFHQwIv2gP/R6SLcb9Op8MY0q37jTQ46AhF4g8sDKdCG4AkgAJpO/sX1Vrw+wlf0EV WnmMV9ixVYcRsfjiAUKnn6Sp/Ih60E8rCPbWFpEIHfIFSvcDq9/5jTY4IMQDV5FTzOJo X8GITeKV2ANkX5JN5ccs6BUghnrFRR9xHdg7f0armUxM4PRnv5Tw7FbLw7IBi9hD6Rhs EWHjg92Qr3WjtRg09qOTaIf/1QFLGmSSBYh4zJEKP1wOKszKIeA69CzVzkOC7nGlcmSG nNoYQUAQeoq4Pr/TZ0c5ZRQam6dO48Pe+d53EvKit5XeAjn0UMEuBoHp5Lz4zIxb0RQF SV6g== X-Gm-Message-State: AGi0PuamhVy8JbgQb2CAXuzhSchmwrxSQDi22z+5Opt6iSwSVPChcpAU 7PtV4k2wTaQzAmkNOt++wlyfoy5SWzuToQ== X-Google-Smtp-Source: APiQypIaEV1vbLVlqbuW7Bh3LwoSnIJBYCFt9RPxBqvS7Bz5vs5DYE29Nvl1kpxLErViMlrvqcgPzw== X-Received: by 2002:adf:b258:: with SMTP id y24mr4896104wra.318.1585854781222; Thu, 02 Apr 2020 12:13:01 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:00 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 02/33] drm/msm: stop abusing dma_map/unmap for cache Date: Thu, 2 Apr 2020 20:13:22 +0100 Message-Id: <20200402191353.787836-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rob Clark [ Upstream commit 0036bc73ccbe7e600a3468bf8e8879b122252274 ] Recently splats like this started showing up: WARNING: CPU: 4 PID: 251 at drivers/iommu/dma-iommu.c:451 __iommu_dma_unmap+0xb8/0xc0 Modules linked in: ath10k_snoc ath10k_core fuse msm ath mac80211 uvcvideo cfg80211 videobuf2_vmalloc videobuf2_memops vide CPU: 4 PID: 251 Comm: kworker/u16:4 Tainted: G W 5.2.0-rc5-next-20190619+ #2317 Hardware name: LENOVO 81JL/LNVNB161216, BIOS 9UCN23WW(V1.06) 10/25/2018 Workqueue: msm msm_gem_free_work [msm] pstate: 80c00005 (Nzcv daif +PAN +UAO) pc : __iommu_dma_unmap+0xb8/0xc0 lr : __iommu_dma_unmap+0x54/0xc0 sp : ffff0000119abce0 x29: ffff0000119abce0 x28: 0000000000000000 x27: ffff8001f9946648 x26: ffff8001ec271068 x25: 0000000000000000 x24: ffff8001ea3580a8 x23: ffff8001f95ba010 x22: ffff80018e83ba88 x21: ffff8001e548f000 x20: fffffffffffff000 x19: 0000000000001000 x18: 00000000c00001fe x17: 0000000000000000 x16: 0000000000000000 x15: ffff000015b70068 x14: 0000000000000005 x13: 0003142cc1be1768 x12: 0000000000000001 x11: ffff8001f6de9100 x10: 0000000000000009 x9 : ffff000015b78000 x8 : 0000000000000000 x7 : 0000000000000001 x6 : fffffffffffff000 x5 : 0000000000000fff x4 : ffff00001065dbc8 x3 : 000000000000000d x2 : 0000000000001000 x1 : fffffffffffff000 x0 : 0000000000000000 Call trace: __iommu_dma_unmap+0xb8/0xc0 iommu_dma_unmap_sg+0x98/0xb8 put_pages+0x5c/0xf0 [msm] msm_gem_free_work+0x10c/0x150 [msm] process_one_work+0x1e0/0x330 worker_thread+0x40/0x438 kthread+0x12c/0x130 ret_from_fork+0x10/0x18 ---[ end trace afc0dc5ab81a06bf ]--- Not quite sure what triggered that, but we really shouldn't be abusing dma_{map,unmap}_sg() for cache maint. Cc: Stephen Boyd Tested-by: Stephen Boyd Reviewed-by: Jordan Crouse Signed-off-by: Rob Clark Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20190630124735.27786-1-robdclark@gmail.com Signed-off-by: Lee Jones --- drivers/gpu/drm/msm/msm_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index f2df718af370d..3a91ccd92c473 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -108,7 +108,7 @@ static struct page **get_pages(struct drm_gem_object *obj) * because display controller, GPU, etc. are not coherent: */ if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) - dma_map_sg(dev->dev, msm_obj->sgt->sgl, + dma_sync_sg_for_device(dev->dev, msm_obj->sgt->sgl, msm_obj->sgt->nents, DMA_BIDIRECTIONAL); } @@ -138,7 +138,7 @@ static void put_pages(struct drm_gem_object *obj) * GPU, etc. are not coherent: */ if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) - dma_unmap_sg(obj->dev->dev, msm_obj->sgt->sgl, + dma_sync_sg_for_cpu(obj->dev->dev, msm_obj->sgt->sgl, msm_obj->sgt->nents, DMA_BIDIRECTIONAL); From patchwork Thu Apr 2 19:13:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 267EEC2BA12 for ; Thu, 2 Apr 2020 19:13:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E913A20719 for ; Thu, 2 Apr 2020 19:13:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GxmPTkCz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389184AbgDBTNG (ORCPT ); Thu, 2 Apr 2020 15:13:06 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55665 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389167AbgDBTNG (ORCPT ); Thu, 2 Apr 2020 15:13:06 -0400 Received: by mail-wm1-f66.google.com with SMTP id r16so4613770wmg.5 for ; Thu, 02 Apr 2020 12:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=yWp18OzsOskB66rjxomLP3YHpSoLDTDv+zg5SpQOzVQ=; b=GxmPTkCzkrqVymk/wCCSj4kInjSGWOzqyTzGJWrrk9ncnSmupnWnUyCIwW9ZUscfqX QPUqPGuyUCFlojeQQZqGqHGzEpW3bmoTHMlwvu/RQ+1WQ1ae2FhlQGqqRMVJrKW5pB9E 9/q119AcINTFFVy4a2Tl1h1vs88KurW0xx45FOA61VbWEd4Xm46kUtP8HKc5EXbupdS3 7jfpMfYJD/kTMonCswYGCNHE5EwqAQ6/WiA+6T15HGINk5HTrqYj95Jq2tN4w8dq60jE f2uALWM0p9ddgfcIdOx95sT1FzRrw7mrLat6O9FPEO6ma0vl628BcfeDbVk9vkL6ovd4 WmAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yWp18OzsOskB66rjxomLP3YHpSoLDTDv+zg5SpQOzVQ=; b=ePL4RCNjzlSo4PLC78geZ1nodDlQLPUb1K7l/3Qj6dcxWI36sVu8Auw15gUp72qya+ 4aXr6YjVsAJBPkVamrrs/5ltLkZ+JBEUHiR8M0n1D7jrlvrjJjmnK05jjkqiOTnTtboZ Bvq4nux59OEbeesX7ruJhlMDOwv7L9FCjfGXU0T+l9kNmjuNwwYuoi8ekBOt4zmQAtnw yRjCED61ne0YmhoKwkQBN0QqN6Z+dUxbTGgTPJG/FPQK6Zpms2Z4k9Gul9xpXK69t42H NlUHeQQ82yTkSKMdhogK4H1w+1sREDEt2z3RbxhKB34GlaaRS+n8viqgy9izxXV+gld3 /joA== X-Gm-Message-State: AGi0PuZuewysbevBFw/ATk/RTTScIGpZFIPpxIcCZSAR0KG1Yi//taGa 8qYO5/HrO3dPiB/BTn0jOpLU03xTKTtSHg== X-Google-Smtp-Source: APiQypJkh/lJiUuymMXEQV1eo4Qo/hBxBt4+4jhUz7gPgH4XhMpuszHjS2vJWdn7UxRiVD6limDzog== X-Received: by 2002:a05:600c:3d1:: with SMTP id z17mr4904505wmd.56.1585854782315; Thu, 02 Apr 2020 12:13:02 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:01 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 03/33] arm64: Fix size of __early_cpu_boot_status Date: Thu, 2 Apr 2020 20:13:23 +0100 Message-Id: <20200402191353.787836-3-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arun KS [ Upstream commit 61cf61d81e326163ce1557ceccfca76e11d0e57c ] __early_cpu_boot_status is of type long. Use quad assembler directive to allocate proper size. Acked-by: Mark Rutland Signed-off-by: Arun KS Signed-off-by: Will Deacon Signed-off-by: Lee Jones --- arch/arm64/kernel/head.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 9c00fd2acc2a4..bd24c8aed6120 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -558,7 +558,7 @@ ENTRY(__boot_cpu_mode) * with MMU turned off. */ ENTRY(__early_cpu_boot_status) - .long 0 + .quad 0 .popsection From patchwork Thu Apr 2 19:13:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84D08C43331 for ; Thu, 2 Apr 2020 19:13:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 57D9F20719 for ; Thu, 2 Apr 2020 19:13:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hcewtn1d" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389176AbgDBTNH (ORCPT ); Thu, 2 Apr 2020 15:13:07 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:40596 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388499AbgDBTNH (ORCPT ); Thu, 2 Apr 2020 15:13:07 -0400 Received: by mail-wr1-f65.google.com with SMTP id s8so3446298wrt.7 for ; Thu, 02 Apr 2020 12:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=MfNuHxEjbU0bCTmDk+zE6vZTzkddZEYuAf50sMJGKgg=; b=hcewtn1dA6E9+AD3SaVD4EmMKP2XBXb2KK5aJeDjGTOS6BpOd6hVdieWxUEXVLVc7r /Xz6ib9tztwyKfUu23zPamFqA1GNNXiMDFxwFGVqqUY/pzsEI20qeRJkc00q+ZhlzkM8 hjlN5/jppNkM6DULq3ivFYQzNL6xvv/C7K9fMm4RUOfp+DMlxF8se1AmAoZwht3Q4ZBN 64uWuVIh8hUjdcWhoHLXy58iSfDV2xF277lYxGLBlPCpertuoYGjMmJWtWPua4IVE1u5 C2qutIF8malxX7KmyAZHCxLlkR+LZStQabUWsDnhQKJdSqTvKhkFTHsXWWc73nbOCh7S 4Ldg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MfNuHxEjbU0bCTmDk+zE6vZTzkddZEYuAf50sMJGKgg=; b=pJTic1thcHf5rUufQkJmr8n7VWWpmVPprxbm4/cPgNBO1XKvUjHB89aW2KMggzvRhg jnth4e4Epk5Yk0hYAMuKl72uHmt1986m/RG7xHK9jktMDpedY4xt+xmi0J0m6wCkSVaO IBk7tzBNNvTHMUQGaTNSLpAm3vLVMv6HDzuRtW8FKm8EEQQqV+WnfQu3SyQFTgMSrlOo XVp1yLBAS06mSZac5VQ6UNfIlrVweqVBbYkozWVIIEi+gCkywRGDFrx0kDK5NTu67j09 tNaA4t4kPZBH1Lrdi8lxTOoWEDhfVf/zy3gREkVW2rSjeIgjRU67U4oDS1+j2nrZ7Nqw 33CQ== X-Gm-Message-State: AGi0PubvNhxaNdGHDNt1IwyND7B1UOPNKngC4+K/EcEM2/s7deZFtImt Sez9fE/XhO1z/bAuJFwEl3VptRqQ5EMKKQ== X-Google-Smtp-Source: APiQypJesy2YQ5crxKa+I7EbrsHQj29e1OpEU8kbHsYvhdqMS/l9jrQsUrDHCrgFTonnZYvLffgkSA== X-Received: by 2002:adf:dfce:: with SMTP id q14mr5182942wrn.326.1585854785272; Thu, 02 Apr 2020 12:13:05 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:04 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 06/33] clk: Fix debugfs_create_*() usage Date: Thu, 2 Apr 2020 20:13:26 +0100 Message-Id: <20200402191353.787836-6-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Geert Uytterhoeven [ Upstream commit 4c8326d5ebb0de3191e98980c80ab644026728d0 ] When exposing data access through debugfs, the correct debugfs_create_*() functions must be used, matching the data types. Remove all casts from data pointers passed to debugfs_create_*() functions, as such casts prevent the compiler from flagging bugs. clk_core.rate and .accuracy are "unsigned long", hence casting their addresses to "u32 *" exposed the wrong halves on big-endian 64-bit systems. Fix this by using debugfs_create_ulong() instead. Octal permissions are preferred, as they are easier to read than symbolic permissions. Hence replace "S_IRUGO" by "0444" throughout. Signed-off-by: Geert Uytterhoeven [sboyd@codeaurora.org: Squash the octal change in too] Signed-off-by: Stephen Boyd Signed-off-by: Lee Jones --- drivers/clk/clk.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 8341a128dab1d..44b6f23cc851d 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2172,18 +2172,16 @@ static int clk_debug_create_one(struct clk_core *core, struct dentry *pdentry) core->dentry = d; - d = debugfs_create_u32("clk_rate", S_IRUGO, core->dentry, - (u32 *)&core->rate); + d = debugfs_create_ulong("clk_rate", 0444, core->dentry, &core->rate); if (!d) goto err_out; - d = debugfs_create_u32("clk_accuracy", S_IRUGO, core->dentry, - (u32 *)&core->accuracy); + d = debugfs_create_ulong("clk_accuracy", 0444, core->dentry, + &core->accuracy); if (!d) goto err_out; - d = debugfs_create_u32("clk_phase", S_IRUGO, core->dentry, - (u32 *)&core->phase); + d = debugfs_create_u32("clk_phase", 0444, core->dentry, &core->phase); if (!d) goto err_out; @@ -2192,23 +2190,23 @@ static int clk_debug_create_one(struct clk_core *core, struct dentry *pdentry) if (!d) goto err_out; - d = debugfs_create_u32("clk_prepare_count", S_IRUGO, core->dentry, - (u32 *)&core->prepare_count); + d = debugfs_create_u32("clk_prepare_count", 0444, core->dentry, + &core->prepare_count); if (!d) goto err_out; - d = debugfs_create_u32("clk_enable_count", S_IRUGO, core->dentry, - (u32 *)&core->enable_count); + d = debugfs_create_u32("clk_enable_count", 0444, core->dentry, + &core->enable_count); if (!d) goto err_out; - d = debugfs_create_u32("clk_notifier_count", S_IRUGO, core->dentry, - (u32 *)&core->notifier_count); + d = debugfs_create_u32("clk_notifier_count", 0444, core->dentry, + &core->notifier_count); if (!d) goto err_out; if (core->num_parents > 1) { - d = debugfs_create_file("clk_possible_parents", S_IRUGO, + d = debugfs_create_file("clk_possible_parents", 0444, core->dentry, core, &possible_parents_fops); if (!d) goto err_out; @@ -2304,22 +2302,22 @@ static int __init clk_debug_init(void) if (!rootdir) return -ENOMEM; - d = debugfs_create_file("clk_summary", S_IRUGO, rootdir, &all_lists, + d = debugfs_create_file("clk_summary", 0444, rootdir, &all_lists, &clk_summary_fops); if (!d) return -ENOMEM; - d = debugfs_create_file("clk_dump", S_IRUGO, rootdir, &all_lists, + d = debugfs_create_file("clk_dump", 0444, rootdir, &all_lists, &clk_dump_fops); if (!d) return -ENOMEM; - d = debugfs_create_file("clk_orphan_summary", S_IRUGO, rootdir, + d = debugfs_create_file("clk_orphan_summary", 0444, rootdir, &orphan_list, &clk_summary_fops); if (!d) return -ENOMEM; - d = debugfs_create_file("clk_orphan_dump", S_IRUGO, rootdir, + d = debugfs_create_file("clk_orphan_dump", 0444, rootdir, &orphan_list, &clk_dump_fops); if (!d) return -ENOMEM; From patchwork Thu Apr 2 19:13:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228244 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C20F4C43331 for ; Thu, 2 Apr 2020 19:13:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 967D320737 for ; Thu, 2 Apr 2020 19:13:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="G6md6BCq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389300AbgDBTNK (ORCPT ); Thu, 2 Apr 2020 15:13:10 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:54923 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388499AbgDBTNJ (ORCPT ); Thu, 2 Apr 2020 15:13:09 -0400 Received: by mail-wm1-f65.google.com with SMTP id c81so4619312wmd.4 for ; Thu, 02 Apr 2020 12:13:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=yViPn8Fbz3RmNQjEqtPLmElTrNVmdZ3e4vYeMjUnLFM=; b=G6md6BCq9I2ZYFqnxb8LDJTMKijQXQ72QMTFmXtniM4l8+q8tJCmWFZMLLAZhm2oQJ lUXyK4hxExJNFKUEQoYBMmoNSXTkh2DR7hTuiXpyhb1UR88A63N8MVxgq5wbeX1hKfNp 2qpe+2MOgbpVKnhsUpKuYmsMGWnn8CcuHwKSxfFRODfXCp7lZDKSqCXMDItz5s5olZEg V6OWr2ZMuotInabACHJcSlOxTnv0bpkyXCXw3AVcSzoZk4/PppyYq5kt9r10jPPLZYjl Wnw8a3Le5i0oP/EJFE+UoXJt3TRdrZcfUQYfyrvAHqQq49AinLxaNJ/7OPti7UEmt8iK Ze2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yViPn8Fbz3RmNQjEqtPLmElTrNVmdZ3e4vYeMjUnLFM=; b=qI4AePdAhcoq+0ixp5lfMjG0ISOMOoKEN9uaF+5pzrj2nMuguE7FZ30qkGlHZQbP45 mASrJG/3ujD+FYLhKZRMM+2kk9rbok3CNdJh3SrRHwZjnYhtwMv8m+2WhTVEa6AdxXRo ayH7lLZbsg9QCYnwwjPE36LaAl+4Gm7kH3suWcq3eg9NgTFlFKOhCwY6VVvhIlDpvSCy qq6eHUopKFk5/NfO86w7yAZTB5hQj3Q1k/Bdx7DvKIBKA09gI5wzBR8ZrJwrtvsOANo/ BBDlB+qQ5aWvL8Wf7IZaDpaXHKoX1AeRyuGGLWi13HWMF4vhR98f/ed+LpLST1SzxZJE hYcg== X-Gm-Message-State: AGi0PuYaynJ6wPdcYAT+WZxAX5oRZdK3ZEYuCs76vRsLsuvy+dmPQpeD msdx9uI0huvL5j+VJzzgpvdrbK0PMlcPTQ== X-Google-Smtp-Source: APiQypLDHE3Ei76zp52wiu9P2s+MWDlWy/OiJ/Pr43Q4eF24Uexo1XBWf9Vi6z2tZEiYZRTadmtV/g== X-Received: by 2002:a1c:6505:: with SMTP id z5mr628889wmb.28.1585854787430; Thu, 02 Apr 2020 12:13:07 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:06 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 08/33] arm64: perf: remove unsupported events for Cortex-A73 Date: Thu, 2 Apr 2020 20:13:28 +0100 Message-Id: <20200402191353.787836-8-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Xu YiPing [ Upstream commit f8ada189550984ee21f27be736042b74a7da1d68 ] bus access read/write events are not supported in A73, based on the Cortex-A73 TRM r0p2, section 11.9 Events (pages 11-457 to 11-460). Fixes: 5561b6c5e981 "arm64: perf: add support for Cortex-A73" Acked-by: Julien Thierry Signed-off-by: Xu YiPing Signed-off-by: Will Deacon Signed-off-by: Lee Jones --- arch/arm64/kernel/perf_event.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 05fdae70e9f6e..53df84b2a07f4 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -262,12 +262,6 @@ static const unsigned armv8_a73_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] [C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV8_IMPDEF_PERFCTR_L1D_CACHE_RD, [C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV8_IMPDEF_PERFCTR_L1D_CACHE_WR, - - [C(NODE)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_RD, - [C(NODE)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_WR, - - [C(NODE)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_RD, - [C(NODE)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_WR, }; static const unsigned armv8_thunder_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] From patchwork Thu Apr 2 19:13:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CF37C2BA19 for ; Thu, 2 Apr 2020 19:13:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 149C72077D for ; Thu, 2 Apr 2020 19:13:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="y0yccAGl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389214AbgDBTNL (ORCPT ); Thu, 2 Apr 2020 15:13:11 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39037 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389221AbgDBTNL (ORCPT ); Thu, 2 Apr 2020 15:13:11 -0400 Received: by mail-wr1-f65.google.com with SMTP id p10so5578621wrt.6 for ; Thu, 02 Apr 2020 12:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EHjyrMQsUuQiUgFwWgDuTXyjroZXXjWL+Ehklr4usZQ=; b=y0yccAGlYmi6Gi2tDDZNJK+hdlPLjFTjyK7Gicaos7Uy8SclbzCA1ggfwUmwi6GKvf 1WyazXPVGAjnvrcl13yikAiF52t0CATVlBLfgVljpWzVx4ICqOBKTr3YW4+DzLVlT0yI 20VgIkqPlTOVmqMjuG16YqsN1MT/JFaWQ3r5Ui/Jn7nQlVt6DQbqTh063b7XYE7k4GAP R8SHrhvE6uwndALY+oj+RyDJYenggKDmljfgzXs2ay4eq+j+hH6c8Dq2zG/r9K8bCow7 OTAMQqozJ0T4g+yp5MaEY0z9fqGUfAzgo5cQFF81LOUIs14pYS3SiXZNPfVGsL6JRYU/ so2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EHjyrMQsUuQiUgFwWgDuTXyjroZXXjWL+Ehklr4usZQ=; b=FDW2OXR9X4BjrxaYK5uJm9BhEErGEXFwdTHFJxE0JWfeUOdW5AspWIWSSqITZbCDKC NFj75CfgD1lgZcm34VElUV3FM6HjrgrVOcsf00920UlHsQmA8XpzN02hTPl5mB7FAaTs frZ9WeTcd3fwOMO2RupJ0aH3zb7u56FmLZlb2FyXoR409j+ar5tbaYtw1PNvjJhUglbT PFMUGhd2yW+/xOYsHeGojZHlNCSwByVyLeznP8LB3srWlIh77MJFTdOi2T9fQZBwjnl7 JbAL9m6MxzIM1nfs6nxeei8reXgVdmlJAWZ10DXmrDAeZhXIh89tZ6ErNlvrwTxdXDJI sftg== X-Gm-Message-State: AGi0PubQbTLscWFEffPtMFNnxPjbeS12IZ+z3JUzkeOw9V3xY5THhrqy X960Hs18QJov1lBQibfNL+tnqMPp8rsQfQ== X-Google-Smtp-Source: APiQypLWh6M0XkTcXxzfX21ikP3NUPnNeaRcC5s5QCXKKvqe4a2C9dwVFC5dAMGvajDL4iCSkDbo1Q== X-Received: by 2002:a05:6000:1090:: with SMTP id y16mr4634087wrw.281.1585854788423; Thu, 02 Apr 2020 12:13:08 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:07 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 09/33] arm64: traps: Don't print stack or raw PC/LR values in backtraces Date: Thu, 2 Apr 2020 20:13:29 +0100 Message-Id: <20200402191353.787836-9-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Will Deacon [ Upstream commit a25ffd3a6302a67814280274d8f1aa4ae2ea4b59 ] Printing raw pointer values in backtraces has potential security implications and are of questionable value anyway. This patch follows x86's lead and removes the "Exception stack:" dump from kernel backtraces, as well as converting PC/LR values to symbols such as "sysrq_handle_crash+0x20/0x30". Tested-by: Laura Abbott Signed-off-by: Will Deacon Signed-off-by: Lee Jones --- arch/arm64/kernel/process.c | 8 ++--- arch/arm64/kernel/traps.c | 65 ++----------------------------------- 2 files changed, 6 insertions(+), 67 deletions(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 243fd247d04e0..4cbf571f428cd 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -186,11 +186,9 @@ void __show_regs(struct pt_regs *regs) } show_regs_print_info(KERN_DEFAULT); - print_symbol("PC is at %s\n", instruction_pointer(regs)); - print_symbol("LR is at %s\n", lr); - printk("pc : [<%016llx>] lr : [<%016llx>] pstate: %08llx\n", - regs->pc, lr, regs->pstate); - printk("sp : %016llx\n", sp); + print_symbol("pc : %s\n", regs->pc); + print_symbol("lr : %s\n", lr); + printk("sp : %016llx pstate : %08llx\n", sp, regs->pstate); i = top_reg; diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 5ae9c86c30d1d..b30d23431fe11 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -59,55 +59,9 @@ static const char *handler[]= { int show_unhandled_signals = 0; -/* - * Dump out the contents of some kernel memory nicely... - */ -static void dump_mem(const char *lvl, const char *str, unsigned long bottom, - unsigned long top) -{ - unsigned long first; - mm_segment_t fs; - int i; - - /* - * We need to switch to kernel mode so that we can use __get_user - * to safely read from kernel space. - */ - fs = get_fs(); - set_fs(KERNEL_DS); - - printk("%s%s(0x%016lx to 0x%016lx)\n", lvl, str, bottom, top); - - for (first = bottom & ~31; first < top; first += 32) { - unsigned long p; - char str[sizeof(" 12345678") * 8 + 1]; - - memset(str, ' ', sizeof(str)); - str[sizeof(str) - 1] = '\0'; - - for (p = first, i = 0; i < (32 / 8) - && p < top; i++, p += 8) { - if (p >= bottom && p < top) { - unsigned long val; - - if (__get_user(val, (unsigned long *)p) == 0) - sprintf(str + i * 17, " %016lx", val); - else - sprintf(str + i * 17, " ????????????????"); - } - } - printk("%s%04lx:%s\n", lvl, first & 0xffff, str); - } - - set_fs(fs); -} - static void dump_backtrace_entry(unsigned long where) { - /* - * Note that 'where' can have a physical address, but it's not handled. - */ - print_ip_sym(where); + printk(" %pS\n", (void *)where); } static void __dump_instr(const char *lvl, struct pt_regs *regs) @@ -177,10 +131,7 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) #endif printk("Call trace:\n"); - while (1) { - unsigned long stack; - int ret; - + do { /* skip until specified stack frame */ if (!skip) { dump_backtrace_entry(frame.pc); @@ -195,17 +146,7 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) */ dump_backtrace_entry(regs->pc); } - ret = unwind_frame(tsk, &frame); - if (ret < 0) - break; - if (in_entry_text(frame.pc)) { - stack = frame.fp - offsetof(struct pt_regs, stackframe); - - if (on_accessible_stack(tsk, stack)) - dump_mem("", "Exception stack", stack, - stack + sizeof(struct pt_regs)); - } - } + } while (!unwind_frame(tsk, &frame)); put_task_stack(tsk); } From patchwork Thu Apr 2 19:13:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228242 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36895C2BA12 for ; Thu, 2 Apr 2020 19:13:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E42820719 for ; Thu, 2 Apr 2020 19:13:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LIGlLU5/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388499AbgDBTNN (ORCPT ); Thu, 2 Apr 2020 15:13:13 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:37917 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389221AbgDBTNN (ORCPT ); Thu, 2 Apr 2020 15:13:13 -0400 Received: by mail-wm1-f65.google.com with SMTP id f6so4942236wmj.3 for ; Thu, 02 Apr 2020 12:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=F1RxqoVym4udjkgxIj1+YF/PQS5E7Vq+xOrBZvSu6QM=; b=LIGlLU5/bAbwidCwU9l9QKk1lu4QtcDHi9MzZwv6Y2Iz6hebYuBjljRMtGMuFkhwrX WI9NRTFCQWzCnadUoDHrneHeimWEp4YUweaxSiKb1gMqgyVV8Yj2jAkPZZM9wgAwZMYS +d8F73spLu0cVQjZOvouSLakck50GSx69rr+YQW9tJo9+auwFCduC5YYrSC2fXtHH4Ud 0CLvRC3IuwVug4WX4tv2OuKteQT/mKF8QrOW0hcRst0ijmryZC7SfmnMhC+CDDPzSdNM /qou+pJV7FNr8DjzY9hDs/aZ3lG1n7i4OygO5wmmURUuQd14Z1SVI6grqU1Lr8bFFIna O2Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F1RxqoVym4udjkgxIj1+YF/PQS5E7Vq+xOrBZvSu6QM=; b=Yj3h10NxuzkuqiLPOaqPpG6PAcznRuQ9LrgvRIjwDMMVQ34WJLrL5joMY8PDrx+VjI nfxw7ZffWETBJ28IfrSIgH/brhrxbXcaVJprhkZZK6YqtzGbJVV9wmZVcxX/SZnQpB/Y VJGWp4wep9SDJgf2oRpXyV2yd9BrNEDpIUbDxbJWZruXGjG4156okBE6jtc9Rg0ik7vw 1vCrEBwkHcYbhEn/1olUD9yf2KGP+574uMlaGKJzrNIzkcys6OMBXLxp7+Y+B0wKYPbh nhTEMv21Gh2LSH2NNo59l8tTryCVbi8RW+IPSJZ9xcU4ZircL8bVqR787TlrvB7vtf/j EA4w== X-Gm-Message-State: AGi0Pub14+rNPvde4Rr9Siq2W34qivqNt4+w368yiILEyfdI30TY/LYC E9adBTMG70eXg+c18mXy19HFpjQVxhiFXg== X-Google-Smtp-Source: APiQypKnL0aCIgdgESDBh64m99RpKZfOH2E4svbhfbmmh2xBIq5sp7L8/h5WRYJqCc8LWDw2rxgsfA== X-Received: by 2002:a7b:c18c:: with SMTP id y12mr1781442wmi.56.1585854791141; Thu, 02 Apr 2020 12:13:11 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:10 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 12/33] rpmsg: glink: Remove chunk size word align warning Date: Thu, 2 Apr 2020 20:13:32 +0100 Message-Id: <20200402191353.787836-12-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chris Lew [ Upstream commit f0beb4ba9b185d497c8efe7b349363700092aee0 ] It is possible for the chunk sizes coming from the non RPM remote procs to not be word aligned. Remove the alignment warning and continue to read from the FIFO so execution is not stalled. Signed-off-by: Chris Lew Signed-off-by: Arun Kumar Neelakantam Signed-off-by: Bjorn Andersson Signed-off-by: Lee Jones --- drivers/rpmsg/qcom_glink_native.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 1e6253f1e070e..114481c9fba12 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -811,9 +811,6 @@ static int qcom_glink_rx_data(struct qcom_glink *glink, size_t avail) return -EAGAIN; } - if (WARN(chunk_size % 4, "Incoming data must be word aligned\n")) - return -EINVAL; - rcid = le16_to_cpu(hdr.msg.param1); spin_lock_irqsave(&glink->idr_lock, flags); channel = idr_find(&glink->rcids, rcid); From patchwork Thu Apr 2 19:13:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83636C2BA12 for ; Thu, 2 Apr 2020 19:13:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5BEC620719 for ; Thu, 2 Apr 2020 19:13:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sMZZg7BX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389221AbgDBTNR (ORCPT ); Thu, 2 Apr 2020 15:13:17 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36567 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388766AbgDBTNQ (ORCPT ); Thu, 2 Apr 2020 15:13:16 -0400 Received: by mail-wr1-f65.google.com with SMTP id 31so5589270wrs.3 for ; Thu, 02 Apr 2020 12:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EneAjLqhF4TNYKrJoTKfNAQVJz06xC3w0ySPcAKaU6Y=; b=sMZZg7BXMwGQQxYRCa4ES1mC7Bqv3BLzsOuQJ8lY9n2nAsBwhOdn18ZiXfe+CQq0/5 Od7KBdOAFionfMM1ceCzkNNb2ZDVApqnn/VyyZPMNKi/2VDGoMzyus1lzuiWj1gSaQuX /NTRs5b0Ao5/1bItdO6OhCM4ExCXhNZuDdSERcE81cRd0RQrje0SijujASJvi8WJo/Bo 4aJIamz22xGF3r6QjBr2kPF0Eyxn9hMfe3Gvug1G3t9AnOw8om0271rUPi5n240DU2QK w2P95tPcftkZaDUmoMJjKbJWvrGwjQnz0f5IdNa2q/jPZfz1FU9UsFAkZ1A8WB2fGW3o NPjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EneAjLqhF4TNYKrJoTKfNAQVJz06xC3w0ySPcAKaU6Y=; b=uS+dxdo7ffsCPcGStdA62X09TT2DiWvHaPBazU7R9ltXeNrXhq3aTNlgmCxyirBQGx nX2rRbE6wFmOizmEtuE03jrL56AkVEQ0w6y4IyCZoDBkVUTeG1bkUGHxBnnaD0fqU57k Al0ySE7YTIS9ofn8lIF6GxcA0zbsyihdqFOSWLv6Emna3WdOeTgdu30XUf/zWC677PHQ mA0naIBhZ34Lqot417+pmuW08qpkWGBxZCrnu49m3HqO/ixqSYvv+GH1Pmp0NGXbUdHc MaECytQMAqTAs3/haat25eNdWp9+k/KOh3E/rA/6HXKtgKIlwulfr/0g49wyhCpxqzlt DI0w== X-Gm-Message-State: AGi0PuZkF7RGC4IsTDHR3aiaSuGQfQafGhKBJv3GO4EPhdtv0+Dn7fMd eHT0k3rXA2Rfpy9BOQjfB42xeqNwnEy+pw== X-Google-Smtp-Source: APiQypLtEqYvnjMx3uurnHTYL+6Eg+FQibNJWg73CDOtIfbbulx0y1zU77xRvMRusEZ1IFv/lDbFKg== X-Received: by 2002:a5d:6a10:: with SMTP id m16mr5295222wru.371.1585854794168; Thu, 02 Apr 2020 12:13:14 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:13 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 15/33] wil6210: fix temperature debugfs Date: Thu, 2 Apr 2020 20:13:35 +0100 Message-Id: <20200402191353.787836-15-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dedy Lansky [ Upstream commit 6d9eb7ebae3d7e951bc0999235ae7028eb4cae4f ] For negative temperatures, "temp" debugfs is showing wrong values. Use signed types so proper calculations is done for sub zero temperatures. Signed-off-by: Dedy Lansky Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Lee Jones --- drivers/net/wireless/ath/wil6210/debugfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index b17ecf796ed83..feb2701280139 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -1067,7 +1067,7 @@ static const struct file_operations fops_ssid = { }; /*---------temp------------*/ -static void print_temp(struct seq_file *s, const char *prefix, u32 t) +static void print_temp(struct seq_file *s, const char *prefix, s32 t) { switch (t) { case 0: @@ -1075,7 +1075,8 @@ static void print_temp(struct seq_file *s, const char *prefix, u32 t) seq_printf(s, "%s N/A\n", prefix); break; default: - seq_printf(s, "%s %d.%03d\n", prefix, t / 1000, t % 1000); + seq_printf(s, "%s %s%d.%03d\n", prefix, (t < 0 ? "-" : ""), + abs(t / 1000), abs(t % 1000)); break; } } @@ -1083,7 +1084,7 @@ static void print_temp(struct seq_file *s, const char *prefix, u32 t) static int wil_temp_debugfs_show(struct seq_file *s, void *data) { struct wil6210_priv *wil = s->private; - u32 t_m, t_r; + s32 t_m, t_r; int rc = wmi_get_temperature(wil, &t_m, &t_r); if (rc) { From patchwork Thu Apr 2 19:13:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228240 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26E4CC2BA18 for ; Thu, 2 Apr 2020 19:13:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F392A20719 for ; Thu, 2 Apr 2020 19:13:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="IjUSqVAV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389367AbgDBTNR (ORCPT ); Thu, 2 Apr 2020 15:13:17 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:37029 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388710AbgDBTNR (ORCPT ); Thu, 2 Apr 2020 15:13:17 -0400 Received: by mail-wr1-f66.google.com with SMTP id w10so5624827wrm.4 for ; Thu, 02 Apr 2020 12:13:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=XoWmUFiAcZDOb1PivsC2LiGGC4W07FOzPfrnGgXof+U=; b=IjUSqVAVJjYsnks7ra61YrZqheeXNvmnJ/f7ow0W8jPoXOFliAVp/g5YdWVOM7xwwl tPn/2Eo5u3s1MWshRVFoD+v3LoXuLNLIplZOu0amrGr1zjjxNJaTycWpQy1kifDWA/BE F+9lJIUXlm+GfEXFon4ThF4Wvc6jQGW7Wn/wZMXFTKpJqRgTSe8kFyu+95LYi65i/QZs IPRezjvtr4LkN+HJqBcb7eRK4SicTdpv0gwbenKl50I+OFsLLb74SiQp+TOckdD0i/Dx c47cEC/K0DO0ew8+Zrxm1g9/m9Rw8YbKhURHimQTTVtfK9mQNo+N/VjSlhZp1gs1drtM EJFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XoWmUFiAcZDOb1PivsC2LiGGC4W07FOzPfrnGgXof+U=; b=aKvnkkSRSGCB841DWmk5Z9WDqbmVZ66uPhDTPXhccPgigjnVEeidNpFxxomnnIx3/V gjqUOr9QKcUQAep/stwieEH0FnbdKY4MJmibj2z+gp22VlinOOwWcQOfBmDeFp4r26E8 4wWnamEB4LMv3AAZPHHddRp9Rx7f/Ar0fQR7+J8IovxiLImqEVczAqVFlyPUkxdXSTsq BWa14Hbfvf4ViPingVqyOr1/zW1iJlEm57BhcRPMb2Sxg/dOtPYeKPqVfI8gZqBQk15A sR1m+txkDgvgV8cW78yuUtMIHX9eK02ZfGhZhGCD4atq7yF9l5khuMID4nL0mMFstyuG h5mQ== X-Gm-Message-State: AGi0PuaMRGvw8+bUAa3txozfPsK4oZvDrTFALO3VMx5ZNh6QNRWqW3zx wnhWxQGNWtnBtjy1I6wD+O+OhCy2waS5fw== X-Google-Smtp-Source: APiQypJaQON/BzEZtAksfaR78tsePpILzgjbUKKiG/ZlG8paKXCYlBzTouQOfqJTEITOsaLCl+dxvA== X-Received: by 2002:a5d:6450:: with SMTP id d16mr4910250wrw.151.1585854795145; Thu, 02 Apr 2020 12:13:15 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:14 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 16/33] scsi: ufs: make sure all interrupts are processed Date: Thu, 2 Apr 2020 20:13:36 +0100 Message-Id: <20200402191353.787836-16-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Venkat Gopalakrishnan [ Upstream commit 7f6ba4f12e6cbfdefbb95cfd8fc67ece6c15d799 ] As multiple requests are submitted to the ufs host controller in parallel there could be instances where the command completion interrupt arrives later for a request that is already processed earlier as the corresponding doorbell was cleared when handling the previous interrupt. Read the interrupt status in a loop after processing the received interrupt to catch such interrupts and handle it. Signed-off-by: Venkat Gopalakrishnan Signed-off-by: Asutosh Das Reviewed-by: Subhash Jadavani Signed-off-by: Martin K. Petersen Signed-off-by: Lee Jones --- drivers/scsi/ufs/ufshcd.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index d25082e573e0a..059ae83412068 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5363,19 +5363,30 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba) u32 intr_status, enabled_intr_status; irqreturn_t retval = IRQ_NONE; struct ufs_hba *hba = __hba; + int retries = hba->nutrs; spin_lock(hba->host->host_lock); intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); - enabled_intr_status = - intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE); - if (intr_status) - ufshcd_writel(hba, intr_status, REG_INTERRUPT_STATUS); + /* + * There could be max of hba->nutrs reqs in flight and in worst case + * if the reqs get finished 1 by 1 after the interrupt status is + * read, make sure we handle them by checking the interrupt status + * again in a loop until we process all of the reqs before returning. + */ + do { + enabled_intr_status = + intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE); + if (intr_status) + ufshcd_writel(hba, intr_status, REG_INTERRUPT_STATUS); + if (enabled_intr_status) { + ufshcd_sl_intr(hba, enabled_intr_status); + retval = IRQ_HANDLED; + } + + intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); + } while (intr_status && --retries); - if (enabled_intr_status) { - ufshcd_sl_intr(hba, enabled_intr_status); - retval = IRQ_HANDLED; - } spin_unlock(hba->host->host_lock); return retval; } From patchwork Thu Apr 2 19:13:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FB41C2BA12 for ; Thu, 2 Apr 2020 19:13:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 285D220719 for ; Thu, 2 Apr 2020 19:13:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aA3ijYEK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388766AbgDBTNT (ORCPT ); Thu, 2 Apr 2020 15:13:19 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33089 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388710AbgDBTNT (ORCPT ); Thu, 2 Apr 2020 15:13:19 -0400 Received: by mail-wr1-f67.google.com with SMTP id a25so5640963wrd.0 for ; Thu, 02 Apr 2020 12:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=aCe1QZjmaMyeP77BfjlfNyliRZWqjMuk0JjgiLARwG8=; b=aA3ijYEK4U6Ao/FzdM9nmN6VO6VO5t5L/6o867zw29MtYnzKN9iEuiXnmIoDSGRaYK NGLWZaGB7GSRuMBJ9QT8TUbBj8Drj+/x6p4mLi5V6T3s04WC+PXY9w3KcCyhDN0nBSIq vOu83AiN8OvHDInehC5apTBaHWhZ+PP0zOU9hzs1JWn51h0G9u/WiuMuCeyfbVBHY9yb mq8VFmcNTlqk/Vzf61hiTewvkN50IL0vlaVz3KISSWBOnqYzqItzz3Zn2lFrh8Nnys2L Qdtj4CDa+TrSgsxTcShNdNVvUAvan+NYWKiMO7LnR7DNiEJfe9ToEYoPy1ZZ0e/AL5OG t5qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aCe1QZjmaMyeP77BfjlfNyliRZWqjMuk0JjgiLARwG8=; b=EVMMwnGM7UC4vjA1t60zxGel+ab1c9SiaqAJlvpGHRVJ1F6Ab6sTGJo8ZEL0sLswp4 K6J3QAw5Lvo7MJtvhF6rEs9Kr19swVW6NNwZmaRT3ofFDa6xoSa2wUNVuK5t+aiMdWG1 /Endyo87yumCE7rzH4crB3xEuW4HyOOH1WUr1Mwd92y5szx9tlgjbzUw93owoQr5ZjUq CAn5ebdj55PBsUj0y2v0mx5mV4oY9gfPX07zC0kXyz7OVC9tNXoUzYBfpDXAH+ksYd5K vE61a4lyNu9dvjg9wxiCvxIRLCLKK15YKgnB7soRLIeT6BpcHBdIW6Tk2eI9hvbjdhdi G9YQ== X-Gm-Message-State: AGi0PubnPmOM7fOofktg4Kufg7DnAEcAVJv3EwJL6ifCRXQL36vlHI1s kn4k2n+1HmPfpnZuLJmz0hJ3dv5PXJINEA== X-Google-Smtp-Source: APiQypLADF0yXsWEEOynOzYJfQL0dYvFRRXFh1OUY7h3+MK4nJh6FiKTgdjmeme7Z8II489pshbHrQ== X-Received: by 2002:a5d:6605:: with SMTP id n5mr4837176wru.303.1585854797171; Thu, 02 Apr 2020 12:13:17 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:16 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 18/33] wil6210: rate limit wil_rx_refill error Date: Thu, 2 Apr 2020 20:13:38 +0100 Message-Id: <20200402191353.787836-18-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dedy Lansky [ Upstream commit 3d6b72729cc2933906de8d2c602ae05e920b2122 ] wil_err inside wil_rx_refill can flood the log buffer. Replace it with wil_err_ratelimited. Signed-off-by: Dedy Lansky Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Lee Jones --- drivers/net/wireless/ath/wil6210/txrx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c index 16750056b8b52..b483c42660971 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ b/drivers/net/wireless/ath/wil6210/txrx.c @@ -636,8 +636,8 @@ static int wil_rx_refill(struct wil6210_priv *wil, int count) v->swtail = next_tail) { rc = wil_vring_alloc_skb(wil, v, v->swtail, headroom); if (unlikely(rc)) { - wil_err(wil, "Error %d in wil_rx_refill[%d]\n", - rc, v->swtail); + wil_err_ratelimited(wil, "Error %d in rx refill[%d]\n", + rc, v->swtail); break; } } From patchwork Thu Apr 2 19:13:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228238 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5EFCC2BA16 for ; Thu, 2 Apr 2020 19:13:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8DD1F20719 for ; Thu, 2 Apr 2020 19:13:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BQDsFe9n" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388710AbgDBTNW (ORCPT ); Thu, 2 Apr 2020 15:13:22 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39079 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388892AbgDBTNV (ORCPT ); Thu, 2 Apr 2020 15:13:21 -0400 Received: by mail-wr1-f67.google.com with SMTP id p10so5579338wrt.6 for ; Thu, 02 Apr 2020 12:13:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=dJjaCdK3r6IAoOPZX6O1/KwvrCQleqNcbRzJakc7p/s=; b=BQDsFe9n5ukI4Nu4h04bWHovTQyqIxOX784kBquD7gPZJ3tFXlcxk0t/iUrMuwn9o1 kVEKSveh3kBbAKMhPXh77GNyp3qtVor4L2sl3XJwyuLNb0A3ICC5LcPId31Nx/1Pjc8y 7fY6AW5oWTUsGwelCpPghA2u7hJMdWr9YwyJMcTue2+v9B8uxZzWmvfag/TZX9J9HEZg 0awBB3Fp9QVmNg/c0AcR42IiviRuLuFxhusrxO/Gp8TT+GQ/Gp3RgI5eSY+1VZYuxzz9 JpNdILrSomsmis7Z4tfLbJvLt+3eTRyFINXhPpZk4FuUt6rNxMCObFCQUBk+Cd4MW8mr rveg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dJjaCdK3r6IAoOPZX6O1/KwvrCQleqNcbRzJakc7p/s=; b=eHBFS0dcW7R3qpP+BprjFi/G1KH/KyNOqMncyzSZG73jt5U/fbpxUO/JN1mLOyN+Au Z+C5cv6gpXlVJjbmYsdpxRBfJV68fnC1HFV7hOq7GnGKybpjHeoCmr4DV5w/WQRSzZvc ncuiOSWoLMPTDpYATrmIXnpQY04IJj4AMzVE5Tic7jbbJuQhsYsPHGULdDHEYkJBQYen KOfJKfz39FikN5eRSmqyjQbDFQD7NyMFKq4jvefEPkTV06oZY36xlCU64EdLqQtjOt1u fISnQfuS7chcYPcpQRc6ulXh07HGEFIe+iATdEs1CnQoK7CBIUIiC79hJyeflC3ov4cC WP4g== X-Gm-Message-State: AGi0PuZqhIHtx3X0TvZZ3n7wj6oGAUm6Ou5zHQ3qMDj7z023eXqM4ldd C70PPt3d1GOHdQpswzbfwy3mQRX4CcvdBA== X-Google-Smtp-Source: APiQypJhQDySB+zoVrYO8+bTkEsLguBDJE1gYYplc1zyjUYZ3eosSnK/r65pCQN/kqcbKLQiZiRh9Q== X-Received: by 2002:adf:b258:: with SMTP id y24mr4897334wra.318.1585854799896; Thu, 02 Apr 2020 12:13:19 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:19 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 21/33] net: qualcomm: rmnet: Fix casting issues Date: Thu, 2 Apr 2020 20:13:41 +0100 Message-Id: <20200402191353.787836-21-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Subash Abhinov Kasiviswanathan [ Upstream commit 6e010dd9b16b1a320bbf8312359ac294d7e1d9a8 ] Fix warnings which were reported when running with sparse (make C=1 CF=-D__CHECK_ENDIAN__) drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c:81:15: warning: cast to restricted __be16 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:271:37: warning: incorrect type in assignment (different base types) expected unsigned short [unsigned] [usertype] pkt_len got restricted __be16 [usertype] drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:287:29: warning: incorrect type in assignment (different base types) expected unsigned short [unsigned] [usertype] pkt_len got restricted __be16 [usertype] drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:310:22: warning: cast to restricted __be16 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:319:13: warning: cast to restricted __be16 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c:49:18: warning: cast to restricted __be16 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c:50:18: warning: cast to restricted __be32 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c:74:21: warning: cast to restricted __be16 Signed-off-by: Subash Abhinov Kasiviswanathan Signed-off-by: David S. Miller Signed-off-by: Lee Jones --- drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h index ce2302c25b128..41fa881e4540e 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h @@ -23,8 +23,8 @@ struct rmnet_map_control_command { struct { u16 ip_family:2; u16 reserved:14; - u16 flow_control_seq_num; - u32 qos_id; + __be16 flow_control_seq_num; + __be32 qos_id; } flow_control; u8 data[0]; }; @@ -53,7 +53,7 @@ struct rmnet_map_header { u8 reserved_bit:1; u8 cd_bit:1; u8 mux_id; - u16 pkt_len; + __be16 pkt_len; } __aligned(1); #define RMNET_MAP_GET_MUX_ID(Y) (((struct rmnet_map_header *) \ From patchwork Thu Apr 2 19:13:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228237 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB383C43331 for ; Thu, 2 Apr 2020 19:13:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B202020719 for ; Thu, 2 Apr 2020 19:13:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="y0SNIyxB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389424AbgDBTNY (ORCPT ); Thu, 2 Apr 2020 15:13:24 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:35657 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389387AbgDBTNY (ORCPT ); Thu, 2 Apr 2020 15:13:24 -0400 Received: by mail-wm1-f67.google.com with SMTP id i19so4966779wmb.0 for ; Thu, 02 Apr 2020 12:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=3E+vUdmowT/01VGwN5LYzWxwrJnBqR/xu8ape7Fl+Ag=; b=y0SNIyxBQ8OGEqWHIiyrhp5fDO073K6m7UIkI9Ad6j7yV+K2P8go4L4GJZL4y301Ax jNF3JyQM5GM5oSp8jbvoJ25vCxAzs0w/DdXhQYdjeS/fKaP3nFLDgOa78oE1JotxNQ4k hvTmc04RssKAa2oJ5K2G3gNgtOdS7m/FhXfuWRNBkVtW/rYJLjcUjXDgptFw3uoNhUUn nMVkmjCIXAA/nc1wIT5XxXUNwB3z6djLk2X8jV0JpnifWTlrmeWhInhWrPN4uvDrqpto rdnTQuoofvu7Djt2L7OXNQ9RMS5ysmyNsAwVtjOAKVT734T+WAhN670Dfx32A1PQr/7p Oi0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3E+vUdmowT/01VGwN5LYzWxwrJnBqR/xu8ape7Fl+Ag=; b=J/i6GymclyDSyawUT98Wflx1hIXrfF0HL6zUL+YAjPviD3jz9pjjWse7+e0sHwAO/l /WFyqqmdqafZPjskxJTcKw+HTuU+MRK++1Wn05lsqvnyrSeeh7sNH3okMdHVMjnSxm8p lsfan08tFO57ZlxqdrpVOwcek7T3QgdF+Mh/DrHuLj7pui2e3LPs3xDvxZAC+EDc0yog 86snVWNC57NGgCv1/v9NA7YxYW/Jq9LmgfaKty014r/1gyeQrjqVAqsVZ6g5I5oo8uzM QQSL79BBorNCkHxkpl+5v7K0pS2S7Vlp4RtdlK13SxL7nug51m4UErgBpxZBx0uV+O1n Vw0w== X-Gm-Message-State: AGi0PuY74aer2ZHYSvvyWlMzM1qTa9AALhRKwYEkbAOVD68P6sTxUzJn R9equEY/iY6S1Hc53nXanHQiWKu/84VOmw== X-Google-Smtp-Source: APiQypJEnWs4tkmzLMEQLLId3kpDGWoxUzwDMpn6GNG/++Bs8jj9GYRvBuMUS/rB4LPxPSF9+ILD3g== X-Received: by 2002:a1c:2506:: with SMTP id l6mr4665358wml.44.1585854802029; Thu, 02 Apr 2020 12:13:22 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:21 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 23/33] rpmsg: glink: smem: Ensure ordering during tx Date: Thu, 2 Apr 2020 20:13:43 +0100 Message-Id: <20200402191353.787836-23-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bjorn Andersson [ Upstream commit 9d32497361ff89d2fc8306407de6f04b2bfb2836 ] Ensure the ordering of the fifo write and the update of the write index, so that the index is not updated before the data has landed in the fifo. Acked-By: Chris Lew Reported-by: Arun Kumar Neelakantam Signed-off-by: Bjorn Andersson Signed-off-by: Lee Jones --- drivers/rpmsg/qcom_glink_smem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/rpmsg/qcom_glink_smem.c b/drivers/rpmsg/qcom_glink_smem.c index b1c15c64cdec3..c2a4467b5fcdf 100644 --- a/drivers/rpmsg/qcom_glink_smem.c +++ b/drivers/rpmsg/qcom_glink_smem.c @@ -185,6 +185,9 @@ static void glink_smem_tx_write(struct qcom_glink_pipe *glink_pipe, if (head >= pipe->native.length) head -= pipe->native.length; + /* Ensure ordering of fifo and head update */ + wmb(); + *pipe->head = cpu_to_le32(head); } From patchwork Thu Apr 2 19:13:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228236 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B49BBC43331 for ; Thu, 2 Apr 2020 19:13:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 82EC020719 for ; Thu, 2 Apr 2020 19:13:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zLA0KLLQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388892AbgDBTN0 (ORCPT ); Thu, 2 Apr 2020 15:13:26 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:44220 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389422AbgDBTNZ (ORCPT ); Thu, 2 Apr 2020 15:13:25 -0400 Received: by mail-wr1-f67.google.com with SMTP id m17so5541539wrw.11 for ; Thu, 02 Apr 2020 12:13:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1aVRqB/VAz75UKZIp52ExAu2DukK4fgEMw659Zq5hiU=; b=zLA0KLLQz4Vu2yLaK+WNl5dAfEte2iPjLD4kGg/WdsZNY6Qi+eX2aAuv/XzF7xh2BE rjoqFhmo+xSZG8rcJL69ddSqt3BAFZYqCQCQi3ksWLAEnLikJ8zSQjEEuxU+pMctE41O bVrVm1VbWQWPJEgzpzhcbJu0udMBZSz1Df92miRF5gih/0XDKq70izvNEULV4+yiB/AH yhsh1RG2xd3Z5Dve2iX29TPYaiayzNOoySi+hGXK1XEqSpBr8/u7lBJelsjN/c8+gFq8 L2sOlRBQcN467jTTBn2ofYjhDI+BmiMjI/NcImn3/15FwLYdoymnepFYgJQDMF9ov5ll +n5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1aVRqB/VAz75UKZIp52ExAu2DukK4fgEMw659Zq5hiU=; b=Tqfxa9pIAYxoECFrKWpAjMHuN7TRnXeUidCn8OkqTJkCCng1Am0EQEfPsmrAnyYZrh VH03ycFdSCHLTUKz7Nj+rBYMTYavQHKc2I2BXcM+wJLjESeWhQXzCRU+n+8yYf1Lhlnh jjrkXpzrWdrxZoLA49tndK4eOslwkgSzNtCjX76vJcstFmoQoGIRdQ0QBquKUJi/6VQE f4VmFIW2sheI0P5eMOjVmyd7ehVmILC7zqOdqeHP3cFeDM7fiyY5fxTlOBg+UAcrnn1V Pq9kGv6FPm6aChTJzZXkeDrPCW+LkIT5eAdIoQtctmadTowYmcckkQEmy7KJjniWGke6 OXDQ== X-Gm-Message-State: AGi0Puaqy+fnnBZnkswMVGnGG+Jhw7p3h5ieZ+ZxdM9HIzK305fogWFX oTpdUfP0czwf1zNd4KiaZf2/b0cqUdHiaQ== X-Google-Smtp-Source: APiQypJKWj4g5+QperZ7/uiFJzYjUgW6c2E6LxTGkLe+Ss3mCgHJ/DMc5Nex+jTNeHEd1/KvzatmjQ== X-Received: by 2002:adf:e6c8:: with SMTP id y8mr4728709wrm.279.1585854802826; Thu, 02 Apr 2020 12:13:22 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:22 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 24/33] wil6210: fix PCIe bus mastering in case of interface down Date: Thu, 2 Apr 2020 20:13:44 +0100 Message-Id: <20200402191353.787836-24-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lazar Alexei [ Upstream commit 680c242dc25e036265793edc7d755cfc15afd231 ] In case of interface down, radio is turned off but PCIe mastering is not cleared. This can cause unexpected PCIe access to the shutdown device. Fix this by clearing PCIe mastering also in case interface is down Signed-off-by: Lazar Alexei Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Lee Jones --- drivers/net/wireless/ath/wil6210/pcie_bus.c | 24 +++++++++++++-------- drivers/net/wireless/ath/wil6210/pm.c | 10 ++------- drivers/net/wireless/ath/wil6210/wil6210.h | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c index 6a3ab4bf916dd..b2c3cf6db8814 100644 --- a/drivers/net/wireless/ath/wil6210/pcie_bus.c +++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c @@ -393,6 +393,9 @@ static int wil6210_suspend(struct device *dev, bool is_runtime) int rc = 0; struct pci_dev *pdev = to_pci_dev(dev); struct wil6210_priv *wil = pci_get_drvdata(pdev); + struct net_device *ndev = wil_to_ndev(wil); + bool keep_radio_on = ndev->flags & IFF_UP && + wil->keep_radio_on_during_sleep; wil_dbg_pm(wil, "suspend: %s\n", is_runtime ? "runtime" : "system"); @@ -400,14 +403,14 @@ static int wil6210_suspend(struct device *dev, bool is_runtime) if (rc) goto out; - rc = wil_suspend(wil, is_runtime); + rc = wil_suspend(wil, is_runtime, keep_radio_on); if (!rc) { wil->suspend_stats.successful_suspends++; - /* If platform device supports keep_radio_on_during_sleep - * it will control PCIe master + /* In case radio stays on, platform device will control + * PCIe master */ - if (!wil->keep_radio_on_during_sleep) + if (!keep_radio_on) /* disable bus mastering */ pci_clear_master(pdev); } @@ -420,20 +423,23 @@ static int wil6210_resume(struct device *dev, bool is_runtime) int rc = 0; struct pci_dev *pdev = to_pci_dev(dev); struct wil6210_priv *wil = pci_get_drvdata(pdev); + struct net_device *ndev = wil_to_ndev(wil); + bool keep_radio_on = ndev->flags & IFF_UP && + wil->keep_radio_on_during_sleep; wil_dbg_pm(wil, "resume: %s\n", is_runtime ? "runtime" : "system"); - /* If platform device supports keep_radio_on_during_sleep it will - * control PCIe master + /* In case radio stays on, platform device will control + * PCIe master */ - if (!wil->keep_radio_on_during_sleep) + if (!keep_radio_on) /* allow master */ pci_set_master(pdev); - rc = wil_resume(wil, is_runtime); + rc = wil_resume(wil, is_runtime, keep_radio_on); if (rc) { wil_err(wil, "device failed to resume (%d)\n", rc); wil->suspend_stats.failed_resumes++; - if (!wil->keep_radio_on_during_sleep) + if (!keep_radio_on) pci_clear_master(pdev); } else { wil->suspend_stats.successful_resumes++; diff --git a/drivers/net/wireless/ath/wil6210/pm.c b/drivers/net/wireless/ath/wil6210/pm.c index 8f5d1b447aaa2..8378742ecd49d 100644 --- a/drivers/net/wireless/ath/wil6210/pm.c +++ b/drivers/net/wireless/ath/wil6210/pm.c @@ -279,12 +279,9 @@ static int wil_resume_radio_off(struct wil6210_priv *wil) return rc; } -int wil_suspend(struct wil6210_priv *wil, bool is_runtime) +int wil_suspend(struct wil6210_priv *wil, bool is_runtime, bool keep_radio_on) { int rc = 0; - struct net_device *ndev = wil_to_ndev(wil); - bool keep_radio_on = ndev->flags & IFF_UP && - wil->keep_radio_on_during_sleep; wil_dbg_pm(wil, "suspend: %s\n", is_runtime ? "runtime" : "system"); @@ -307,12 +304,9 @@ int wil_suspend(struct wil6210_priv *wil, bool is_runtime) return rc; } -int wil_resume(struct wil6210_priv *wil, bool is_runtime) +int wil_resume(struct wil6210_priv *wil, bool is_runtime, bool keep_radio_on) { int rc = 0; - struct net_device *ndev = wil_to_ndev(wil); - bool keep_radio_on = ndev->flags & IFF_UP && - wil->keep_radio_on_during_sleep; unsigned long long suspend_time_usec = 0; wil_dbg_pm(wil, "resume: %s\n", is_runtime ? "runtime" : "system"); diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index 315ec8b596628..c5b6b783100aa 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h @@ -1000,8 +1000,8 @@ int wil_request_firmware(struct wil6210_priv *wil, const char *name, bool wil_fw_verify_file_exists(struct wil6210_priv *wil, const char *name); int wil_can_suspend(struct wil6210_priv *wil, bool is_runtime); -int wil_suspend(struct wil6210_priv *wil, bool is_runtime); -int wil_resume(struct wil6210_priv *wil, bool is_runtime); +int wil_suspend(struct wil6210_priv *wil, bool is_runtime, bool keep_radio_on); +int wil_resume(struct wil6210_priv *wil, bool is_runtime, bool keep_radio_on); bool wil_is_wmi_idle(struct wil6210_priv *wil); int wmi_resume(struct wil6210_priv *wil); int wmi_suspend(struct wil6210_priv *wil); From patchwork Thu Apr 2 19:13:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228235 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DDE8C2BA16 for ; Thu, 2 Apr 2020 19:13:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EAC1C20737 for ; Thu, 2 Apr 2020 19:13:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dD3OE0es" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388755AbgDBTN3 (ORCPT ); Thu, 2 Apr 2020 15:13:29 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:35661 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388989AbgDBTN3 (ORCPT ); Thu, 2 Apr 2020 15:13:29 -0400 Received: by mail-wm1-f67.google.com with SMTP id i19so4966954wmb.0 for ; Thu, 02 Apr 2020 12:13:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Y2qCj2VEWLETSdDzdg9wby0Dp4VMBOBRFzvR2ZFa7wU=; b=dD3OE0esu/95ovhOagcBwUvDSUGgoSBMXKkWo6htsYmA3QuO3MJC/Ps0qQZJdo1mtu E/9eRZ+260YNvcqTfBd1uswl6eiV5hjDvWcxqrwfdQFw7RCTY7GUYLH1Ho8U8egR2K/G hg7AqEM5/6xvCcfyG65aEYQTa18bFD+FIhEFKmrIfOgqNF5drD4y9sDkIKTp6k2+8AkC t8fiUcG8Bwf1EQJixSHXvltwuFbQwNI2zZ3VNi+UxCklM2WJKtKW+tF0etoUmaW39gQJ mqx5ORra8J0La67cDQ79bjDILLrxu7evBx4aaGNWDRRZMyenGUYW1OwFME8MsDjh7R4L kWHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y2qCj2VEWLETSdDzdg9wby0Dp4VMBOBRFzvR2ZFa7wU=; b=p5mfQ0e7pE1fWKAAG5VW2nXAfeECCsUFy/5rJRqLHE/i4e5kcv0hK0xKoYrLoZRZLe MAQpZPGtjnqLGpW65O1eOGgayQYEN7BoZ5ZKaIgPaZWYbIe44AyyJew7qn08EMkv+eSZ z6W/qb0pKv09pyfjiIq9csKnu+aPYkKV6bmq7cJDw36JWHBLe0BW2M0VR7tcYYsyL+9R Cegh4Y9VBRY4zU8cg6UAwzfMJ0LJ04TVjZGbSy0kc21qdwZBA/mvh+cQpv53ecrMm9gi EugeVzJM127KvQNidcb77VP72av/YOxKtrHc2wbJVig5td5CeAK84t7ufNEhUdaEWWYj +E+w== X-Gm-Message-State: AGi0PuZ2f5jqTYfnZJprCxACfqeDCQ1AqcuPju/Mh2MlA3ehE+fBEBUn 9zjWBuJcbv9QLXJcnPQ8FZzWxDU7B6Ndnw== X-Google-Smtp-Source: APiQypLUn7kfPaneJCpsv70ZRjgNZmx/mgCFaH0kVew5fkS1fn0d8AHNe9KNly2h3OIrJDCFGY0IEA== X-Received: by 2002:a7b:c8cd:: with SMTP id f13mr4884104wml.138.1585854805277; Thu, 02 Apr 2020 12:13:25 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:24 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 26/33] wil6210: fix length check in __wmi_send Date: Thu, 2 Apr 2020 20:13:46 +0100 Message-Id: <20200402191353.787836-26-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lior David [ Upstream commit 26a6d5274865532502c682ff378ac8ebe2886238 ] The current length check: sizeof(cmd) + len > r->entry_size will allow very large values of len (> U16_MAX - sizeof(cmd)) and can cause a buffer overflow. Fix the check to cover this case. In addition, ensure the mailbox entry_size is not too small, since this can also bypass the above check. Signed-off-by: Lior David Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Lee Jones --- drivers/net/wireless/ath/wil6210/interrupt.c | 22 +++++++++++++++++++- drivers/net/wireless/ath/wil6210/wmi.c | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c index 59def4f3fcf3d..5cf341702dc11 100644 --- a/drivers/net/wireless/ath/wil6210/interrupt.c +++ b/drivers/net/wireless/ath/wil6210/interrupt.c @@ -358,6 +358,25 @@ static void wil_cache_mbox_regs(struct wil6210_priv *wil) wil_mbox_ring_le2cpus(&wil->mbox_ctl.tx); } +static bool wil_validate_mbox_regs(struct wil6210_priv *wil) +{ + size_t min_size = sizeof(struct wil6210_mbox_hdr) + + sizeof(struct wmi_cmd_hdr); + + if (wil->mbox_ctl.rx.entry_size < min_size) { + wil_err(wil, "rx mbox entry too small (%d)\n", + wil->mbox_ctl.rx.entry_size); + return false; + } + if (wil->mbox_ctl.tx.entry_size < min_size) { + wil_err(wil, "tx mbox entry too small (%d)\n", + wil->mbox_ctl.tx.entry_size); + return false; + } + + return true; +} + static irqreturn_t wil6210_irq_misc(int irq, void *cookie) { struct wil6210_priv *wil = cookie; @@ -393,7 +412,8 @@ static irqreturn_t wil6210_irq_misc(int irq, void *cookie) if (isr & ISR_MISC_FW_READY) { wil_dbg_irq(wil, "IRQ: FW ready\n"); wil_cache_mbox_regs(wil); - set_bit(wil_status_mbox_ready, wil->status); + if (wil_validate_mbox_regs(wil)) + set_bit(wil_status_mbox_ready, wil->status); /** * Actual FW ready indicated by the * WMI_FW_READY_EVENTID diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 6cfb820caa3ee..22bfa10ea8276 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c @@ -231,7 +231,7 @@ static int __wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len) uint retry; int rc = 0; - if (sizeof(cmd) + len > r->entry_size) { + if (len > r->entry_size - sizeof(cmd)) { wil_err(wil, "WMI size too large: %d bytes, max is %d\n", (int)(sizeof(cmd) + len), r->entry_size); return -ERANGE; From patchwork Thu Apr 2 19:13:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228234 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8833C43331 for ; Thu, 2 Apr 2020 19:13:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A149D20719 for ; Thu, 2 Apr 2020 19:13:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ycK9u6LP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388986AbgDBTNb (ORCPT ); Thu, 2 Apr 2020 15:13:31 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39093 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388905AbgDBTNb (ORCPT ); Thu, 2 Apr 2020 15:13:31 -0400 Received: by mail-wr1-f65.google.com with SMTP id p10so5579805wrt.6 for ; Thu, 02 Apr 2020 12:13:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Da4R2mObgWasMS/Jsu1LIg5EJg09QgEbjMnbzzaCLcM=; b=ycK9u6LPBIteLzkcnAoHj733wH90dKai/4ixwJ3xdPZ0Mq5pYnmuYgH2hSE0wgfyBM W0h5VwFkMdX+u39orAJWKTLHegypPpFUW891KO47TpEKX2/3kEvmmOZClpMeSoihoOMx BG6gp3OLI4Kz+gKba6oY9NeBewjvhGdn19HwwVqyYWfyWAGzzSvHtocGblPdl8pGQ/Td jsyn/eKgM6WYuVj4K0YzPBJph9928cc+sjQrtXOj6fSe+5tp7WS20daQhV/N9rqlfSOj fHt6ydXR+R7KUNnmLOY43v6ND1UEu80tdroAUog0P53QIm3tm1dNlda5FJRNJu1lZpo3 MzMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Da4R2mObgWasMS/Jsu1LIg5EJg09QgEbjMnbzzaCLcM=; b=UW8LNWEoqv13HU1uOnoc0lFxzRTL3R/P61hRu/E/5DoUW1E6clrky3bliDvTCMYeSI ZULP0kGySWxaByJ4qsv56H9qPTvxBmFFsPC9i3iPRIvKcZg3i1rPW2H5Bpz//ce5uoDI OPfqVfS8VVKlJ7V85DggIqthO6HhNKZOpiyAqoDqn6h3kuFIsTtPfgvqsaSpmMXD5Nrg wdKR0fNUkV/7CrHrkihO6Td/drH6pme5Zbj2nhrLXyJqsy3casFgi8yEiOD4tJ3zHne9 woFZVQPgb+2OyHDdCG1VbzTvSBkVkh16Arb8o/Rpz5c+CT7/NC3YNw+swVRYGgFwJ9VZ fOZA== X-Gm-Message-State: AGi0PubCQM6W4yr4KgvUQMzIX/6puA00C5JkuYIh45OIgD6lZ9Q/zmp6 1YMcJ3rRqY3Ai56jFG2We/mRwu4UOP7Oug== X-Google-Smtp-Source: APiQypJE4rWMOJ2u8ktNKEAOZYmx2MJUljGy/Y3gbDZ+Y3bwsCcNwDuOZ8xfzz2DRkadi9RNojoVYg== X-Received: by 2002:adf:fe87:: with SMTP id l7mr4741867wrr.377.1585854807514; Thu, 02 Apr 2020 12:13:27 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:26 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 28/33] soc: qcom: smem: Use le32_to_cpu for comparison Date: Thu, 2 Apr 2020 20:13:48 +0100 Message-Id: <20200402191353.787836-28-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chris Lew [ Upstream commit a216000f0140f415cec96129f777b5234c9d142f ] Endianness can vary in the system, add le32_to_cpu when comparing partition sizes from smem. Signed-off-by: Chris Lew Acked-by: Bjorn Andersson Signed-off-by: Andy Gross Signed-off-by: Lee Jones --- drivers/soc/qcom/smem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 18ec52f2078aa..89dd50fa404f7 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -646,7 +646,7 @@ static int qcom_smem_enumerate_partitions(struct qcom_smem *smem, return -EINVAL; } - if (header->size != entry->size) { + if (le32_to_cpu(header->size) != le32_to_cpu(entry->size)) { dev_err(smem->dev, "Partition %d has invalid size\n", i); return -EINVAL; From patchwork Thu Apr 2 19:13:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228233 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30163C2BA16 for ; Thu, 2 Apr 2020 19:13:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 05A0820719 for ; Thu, 2 Apr 2020 19:13:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AfRbKwlG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388905AbgDBTNe (ORCPT ); Thu, 2 Apr 2020 15:13:34 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:45077 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388989AbgDBTNe (ORCPT ); Thu, 2 Apr 2020 15:13:34 -0400 Received: by mail-wr1-f68.google.com with SMTP id t7so5540168wrw.12 for ; Thu, 02 Apr 2020 12:13:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=4pengcvy5Yycyp9fs4C3dUV4shvRnbagfJNMDgQf1lc=; b=AfRbKwlGHaSi6+M6Gq8BueNi6Ji6Zwg3q3E1kMdTrG6FOOWy1WSF+Bm0ORbJznbM4b JV3lymnN95eWs7bcENoKcU7MDXTfih8KU6TdShDlnSAKmJ+3LU7RYTlmp0s9y89cjWi9 9Kmz0u0PwIM3DS/K1HDUQNETqlRi//UDq+DItzxRE25nSuV+J7q7y2mtZgADdEkKFC7N 6bTDQeXqL/QUx0jmL1IHjJdziwTmuhhYQ7+wQnDKOsKJ3qh9ECfF8oYnIzbGwyZh6dqg xHC+O2pIgZ/2Y5sYyzJbu9CG5XxbuFR2tbL8cop1+WmRfykPhrIoyNLSt52wulMIRmj+ 3t+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4pengcvy5Yycyp9fs4C3dUV4shvRnbagfJNMDgQf1lc=; b=baHgB/zuTGd/8K9HPMp2X6Fi5Zk20ejh/6BUzL2p+sLgFfJK/+bZc6cClQWR3jFIiz j8KIqPy2NFpjeg5W9GV4wEIqkEjN1LoQL5PqDwFz+3N3HKIEwE/zcR4d75/nHNmeqrvr 5mNUFH1ULPa0LLJL9HYCKHDcQGXoyvw+TFxo7wmjUGqM+fpja17OAm/VbdI/CLhV2vQf NAuJUmRzT/EwZcofKiFVsCJz7Lv6OO2Q93MEh8HuXk666c0n7gCDXO9ahq53CfK+8oyE /Ncq73KQHLfoc4KdKlSfU0bDU7WU2g9UlamHQOrDSO8BoySi7OAwVN3nTo+7mhJaJ82u Y7hQ== X-Gm-Message-State: AGi0PuYeH5+dfYJ1cv/UzmG98FivRvMCXYOzJ7HmsTbll9zi5mdkak+c Jw8WxosOU+/DTFbpO2tBNn7fFYUVmLDvvg== X-Google-Smtp-Source: APiQypIZNWKjRjaayP5ODVJhOEnmn65Q0QN3CAESYgobGot2+5w5qp9uDCD+EOs4DQJ8bcisk4xHrA== X-Received: by 2002:adf:a348:: with SMTP id d8mr4970027wrb.83.1585854812084; Thu, 02 Apr 2020 12:13:32 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:31 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 30/33] perf/core: Reattach a misplaced comment Date: Thu, 2 Apr 2020 20:13:50 +0100 Message-Id: <20200402191353.787836-30-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alexander Shishkin [ Upstream commit f25d8ba9e1b204b90fbf55970ea6e68955006068 ] A comment is in a wrong place in perf_event_create_kernel_counter(). Fix that. Signed-off-by: Alexander Shishkin Signed-off-by: Peter Zijlstra (Intel) Cc: Arnaldo Carvalho de Melo Cc: David Ahern Cc: Jiri Olsa Cc: Linus Torvalds Cc: Mark Rutland Cc: Namhyung Kim Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Link: https://lkml.kernel.org/r/20191030134731.5437-2-alexander.shishkin@linux.intel.com Signed-off-by: Ingo Molnar Signed-off-by: Lee Jones --- kernel/events/core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 2ac73b4cb8a93..9d8f699f11873 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -10430,10 +10430,6 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, struct perf_event *event; int err; - /* - * Get the target context (task or percpu): - */ - event = perf_event_alloc(attr, cpu, task, NULL, NULL, overflow_handler, context, -1); if (IS_ERR(event)) { @@ -10444,6 +10440,9 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, /* Mark owner so we could distinguish it from user events. */ event->owner = TASK_TOMBSTONE; + /* + * Get the target context (task or percpu): + */ ctx = find_get_context(event->pmu, task, event); if (IS_ERR(ctx)) { err = PTR_ERR(ctx); From patchwork Thu Apr 2 19:13:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228232 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE91FC2BA12 for ; Thu, 2 Apr 2020 19:13:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B211720719 for ; Thu, 2 Apr 2020 19:13:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UT+ezZY0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388989AbgDBTNh (ORCPT ); Thu, 2 Apr 2020 15:13:37 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46768 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389223AbgDBTNh (ORCPT ); Thu, 2 Apr 2020 15:13:37 -0400 Received: by mail-wr1-f66.google.com with SMTP id j17so5512846wru.13 for ; Thu, 02 Apr 2020 12:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+EXFELOhHN3rDbwavFog4fv6o0gQhN+56+iO+SzE+uI=; b=UT+ezZY0/T5uP7nVZ/3sX2A+45n3BeDrDBaQW6UmqapoEq+PLepi/gpwFA/bNBX48O IlRim+O4G8WYnmEFOejQ1lgrLI/Z1XOz2XsZjPBxJdd9fxWTPijewhQ3Rn+gU1x+144p hDfWseAgNDeiaqUueTdZ1hzocT1y6eswXewB5Fr5s+1lIanWJuvTxAmdIxwbkFK1lz7+ RTh/s6U17ABa3Zb5aekQiXLBKlMeUc7cznmZaFSDDdMLJc43rZrgv1j/I3m3RqQl+IOL mYZBTwe2FakuWViWrjtl0Yfv8fne/AqsyIO+M5auKQruhZF4TokKS5bdb3hp8Q73YZaV sm5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+EXFELOhHN3rDbwavFog4fv6o0gQhN+56+iO+SzE+uI=; b=UqTM33naiKX5/FaOCJPrQkz5Z5i7qsfuHkcv+mhJn9zfwQOqw3LZ8hqgxoNW2O8FSz AabA+Qd173LHO0mzlCbVFGoK9yzbbM1EdSQOIkyZ01TwJHMbX1FZHXL4XgnDas1dG6gQ pIGORgfuWMCnVe+S7eU0nkVfFCSQHNkH7ndQ7YTxvr+NmascrYzdJxPSxBg3VdcW+8FW 7RSFZvG+6RnJGEAQAGLwDg146tqmj9GnPwNTmRtkA8oi2uwM+bxUEwi7GGc1OnV5gpDl aBo18PnAyZcUaBziB/J2VOeHJ9v0cQ6MyDD77N2/d20S9ezudxY8XChpq8E9EylrJdee rA3Q== X-Gm-Message-State: AGi0PubRcooc67tSEmn2JLn1smRZNhd4wcF2PJ8RJroyS3nK0eS3inCQ tD63VktZ26Ur5IMRmVE44Ul2dt6eJowKPg== X-Google-Smtp-Source: APiQypJuHi3BS7MM/nSMqj/Q3SGlABIbIdN2ZjHw/Rf88bJF2HYvUqQKBP0d8jR2L5lAWDsTfLGaBg== X-Received: by 2002:adf:dec3:: with SMTP id i3mr5215019wrn.351.1585854813175; Thu, 02 Apr 2020 12:13:33 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:32 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 31/33] mm/vmalloc.c: move 'area->pages' after if statement Date: Thu, 2 Apr 2020 20:13:51 +0100 Message-Id: <20200402191353.787836-31-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Austin Kim [ Upstream commit 7ea362427c170061b8822dd41bafaa72b3bcb9ad ] If !area->pages statement is true where memory allocation fails, area is freed. In this case 'area->pages = pages' should not executed. So move 'area->pages = pages' after if statement. [akpm@linux-foundation.org: give area->pages the same treatment] Link: http://lkml.kernel.org/r/20190830035716.GA190684@LGEARND20B15 Signed-off-by: Austin Kim Acked-by: Michal Hocko Reviewed-by: Andrew Morton Cc: Uladzislau Rezki (Sony) Cc: Roman Gushchin Cc: Roman Penyaev Cc: Rick Edgecombe Cc: Mike Rapoport Cc: Andrey Ryabinin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Lee Jones --- mm/vmalloc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 0b8852d80f440..30dc16d000ba0 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1682,7 +1682,6 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, nr_pages = get_vm_area_size(area) >> PAGE_SHIFT; array_size = (nr_pages * sizeof(struct page *)); - area->nr_pages = nr_pages; /* Please note that the recursion is strictly bounded. */ if (array_size > PAGE_SIZE) { pages = __vmalloc_node(array_size, 1, nested_gfp|highmem_mask, @@ -1690,13 +1689,16 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, } else { pages = kmalloc_node(array_size, nested_gfp, node); } - area->pages = pages; - if (!area->pages) { + + if (!pages) { remove_vm_area(area->addr); kfree(area); return NULL; } + area->pages = pages; + area->nr_pages = nr_pages; + for (i = 0; i < area->nr_pages; i++) { struct page *page;