From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CC59C32774 for ; Tue, 23 Aug 2022 08:08:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241746AbiHWIIG (ORCPT ); Tue, 23 Aug 2022 04:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240843AbiHWIHZ (ORCPT ); Tue, 23 Aug 2022 04:07:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90ECE6BD4F; Tue, 23 Aug 2022 01:05:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CFAC2B81BF8; Tue, 23 Aug 2022 08:04:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F3AEC433C1; Tue, 23 Aug 2022 08:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241879; bh=SIp3/2qwKNsjz22VYFAiU+RTlGPQ8FhL66frJQdg6Nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b0vjH0D5SR643jMJJM3LOz9BOyrChq5+2/TQ+OpAG/dohOmO74Wzfb5OiiEza3m2B s3gUBKzPwvUjhQ/Plint74lB0kukKLdzzq/xg73H7j7H+GZyqrCYHVit5/jhdkWeWm lRNqmRllqWCKzaN6ZocE4Rnvb1Vgb9NYu4Ig96tY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= , Takashi Iwai Subject: [PATCH 5.19 001/365] ALSA: info: Fix llseek return value when using callback Date: Tue, 23 Aug 2022 09:58:22 +0200 Message-Id: <20220823080118.207644633@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amadeusz S=C5=82awi=C5=84ski commit 9be080edcca330be4af06b19916c35227891e8bc upstream. When using callback there was a flow of ret =3D -EINVAL if (callback) { offset =3D callback(); goto out; } ... offset =3D some other value in case of no callback; ret =3D offset; out: return ret; which causes the snd_info_entry_llseek() to return -EINVAL when there is callback handler. Fix this by setting "ret" directly to callback return value before jumping to "out". Fixes: 73029e0ff18d ("ALSA: info - Implement common llseek for binary mode") Signed-off-by: Amadeusz S=C5=82awi=C5=84ski Cc: Link: https://lore.kernel.org/r/20220817124924.3974577-1-amadeuszx.slawinsk= i@linux.intel.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/core/info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/sound/core/info.c +++ b/sound/core/info.c @@ -111,9 +111,9 @@ static loff_t snd_info_entry_llseek(stru entry =3D data->entry; mutex_lock(&entry->access); if (entry->c.ops->llseek) { - offset =3D entry->c.ops->llseek(entry, - data->file_private_data, - file, offset, orig); + ret =3D entry->c.ops->llseek(entry, + data->file_private_data, + file, offset, orig); goto out; } =20 From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEA74C32774 for ; Tue, 23 Aug 2022 08:12:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242030AbiHWIME (ORCPT ); Tue, 23 Aug 2022 04:12:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241717AbiHWIJ3 (ORCPT ); Tue, 23 Aug 2022 04:09:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F4E04AD6E; Tue, 23 Aug 2022 01:06:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D4531B81BF8; Tue, 23 Aug 2022 08:06:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1632FC433C1; Tue, 23 Aug 2022 08:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241978; bh=+Rwqb6rD09BG0YoqpOl46wlTvzqQbc75ePuMVpQ7Ju0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0bs9q94hjQ1Krnc0mXpvIToB2dZw25/Fvs6Oc6enADtthSBzbdXGOGRgLNpFwjbSM xoybM++7LK9w+r1WYkCpjCSM4XEL0wXwmTd608z98Qk59Bv07BKlMhOnRL2UJ+Gose ULM8eYM/mgVG/PeMc+/XSaLTs/IRuplQkaAR2QGM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoffer Sandberg , Werner Sembach , Takashi Iwai Subject: [PATCH 5.19 002/365] ALSA: hda/realtek: Add quirk for Clevo NS50PU, NS70PU Date: Tue, 23 Aug 2022 09:58:23 +0200 Message-Id: <20220823080118.252729730@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoffer Sandberg commit 90d74fdbd8059bf041ac797092c9b1d461555280 upstream. Fixes headset microphone detection on Clevo NS50PU and NS70PU. Signed-off-by: Christoffer Sandberg Signed-off-by: Werner Sembach Cc: Link: https://lore.kernel.org/r/20220817135144.34103-1-wse@tuxedocomputers.= com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9352,6 +9352,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_= NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_N= O_PRESENCE), + SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_N= O_PRESENCE), SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_N= O_PRESENCE), SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_N= O_PRESENCE), SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MI= C_NO_PRESENCE), From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26176C32793 for ; Tue, 23 Aug 2022 08:07:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240138AbiHWIHe (ORCPT ); Tue, 23 Aug 2022 04:07:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241109AbiHWIHI (ORCPT ); Tue, 23 Aug 2022 04:07:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 488D16B8F7; Tue, 23 Aug 2022 01:04:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E2765B81C21; Tue, 23 Aug 2022 08:04:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29370C433D6; Tue, 23 Aug 2022 08:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241892; bh=ITNkrA9oaAdQvqvgxkbO2YmAfNEa2GRB35lOg9Xwodk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cWhht10c+VAzrKKNUit/R7D7npGxH75Ho8vJT+MEPq/cEXsv2tDtonr+eM7y9Xd8a FjMk4G058ar7+82nEFKllNJSKW6e7zeM5nqY8jxJX7VjOZYjG+4MUesuMHcNcWgD6P gvy0WF5mX7ALEJh9MBqU3C1bOqLlFIyOGSU71HC4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Maor Gottlieb , Jason Gunthorpe , Leon Romanovsky Subject: [PATCH 5.19 003/365] RDMA: Handle the return code from dma_resv_wait_timeout() properly Date: Tue, 23 Aug 2022 09:58:24 +0200 Message-Id: <20220823080118.298671452@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason Gunthorpe commit b16de8b9e7d1aae169d059c3a0dd9a881a3c0d1d upstream. ib_umem_dmabuf_map_pages() returns 0 on success and -ERRNO on failure. dma_resv_wait_timeout() uses a different scheme: * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or * greater than zero on success. This results in ib_umem_dmabuf_map_pages() being non-functional as a positive return will be understood to be an error by drivers. Fixes: f30bceab16d1 ("RDMA: use dma_resv_wait() instead of extracting the f= ence") Cc: stable@kernel.org Link: https://lore.kernel.org/r/0-v1-d8f4e1fa84c8+17-rdma_dmabuf_fix_jgg@nv= idia.com Tested-by: Maor Gottlieb Signed-off-by: Jason Gunthorpe Signed-off-by: Leon Romanovsky Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/infiniband/core/umem_dmabuf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/umem_dmabuf.c b/drivers/infiniband/cor= e/umem_dmabuf.c index fce80a4a5147..04c04e6d24c3 100644 --- a/drivers/infiniband/core/umem_dmabuf.c +++ b/drivers/infiniband/core/umem_dmabuf.c @@ -18,6 +18,7 @@ int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem_= dmabuf) struct scatterlist *sg; unsigned long start, end, cur =3D 0; unsigned int nmap =3D 0; + long ret; int i; =20 dma_resv_assert_held(umem_dmabuf->attach->dmabuf->resv); @@ -67,9 +68,14 @@ int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem= _dmabuf) * may be not up-to-date. Wait for the exporter to finish * the migration. */ - return dma_resv_wait_timeout(umem_dmabuf->attach->dmabuf->resv, + ret =3D dma_resv_wait_timeout(umem_dmabuf->attach->dmabuf->resv, DMA_RESV_USAGE_KERNEL, false, MAX_SCHEDULE_TIMEOUT); + if (ret < 0) + return ret; + if (ret =3D=3D 0) + return -ETIMEDOUT; + return 0; } EXPORT_SYMBOL(ib_umem_dmabuf_map_pages); =20 --=20 2.37.2 From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DED5C32774 for ; Tue, 23 Aug 2022 08:09:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241873AbiHWIJr (ORCPT ); Tue, 23 Aug 2022 04:09:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240165AbiHWIIj (ORCPT ); Tue, 23 Aug 2022 04:08:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86AEF40BC1; Tue, 23 Aug 2022 01:05:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 904A5B81C21; Tue, 23 Aug 2022 08:05:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1665C433C1; Tue, 23 Aug 2022 08:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241927; bh=shzhjZ2bb1Pt+2Da4GAyL7p2ZZ6kUqtw89dmd6HMbLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RhSGwUiyqRYvti5oYzodBkcP8dt4Bs0IoLZQ7LDTembUog4iruA4b46UDmyCFk5gz RDicxyKQXWysbhfgbuYtQ2maMb/myuGw7FmPrluHsP1RvkjJXKm1ZtbrIYURHsw4RM bbpmBgCu0rxYv085MRRBMH+XsxZ01BmFdBJCqfvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Matlack , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.19 004/365] KVM: Unconditionally get a ref to /dev/kvm module when creating a VM Date: Tue, 23 Aug 2022 09:58:25 +0200 Message-Id: <20220823080118.329629845@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit 405294f29faee5de8c10cb9d4a90e229c2835279 upstream. Unconditionally get a reference to the /dev/kvm module when creating a VM instead of using try_get_module(), which will fail if the module is in the process of being forcefully unloaded. The error handling when try_get_module() fails doesn't properly unwind all that has been done, e.g. doesn't call kvm_arch_pre_destroy_vm() and doesn't remove the VM from the global list. Not removing VMs from the global list tends to be fatal, e.g. leads to use-after-free explosions. The obvious alternative would be to add proper unwinding, but the justification for using try_get_module(), "rmmod --wait", is completely bogus as support for "rmmod --wait", i.e. delete_module() without O_NONBLOCK, was removed by commit 3f2b9c9cdf38 ("module: remove rmmod --wait option.") nearly a decade ago. It's still possible for try_get_module() to fail due to the module dying (more like being killed), as the module will be tagged MODULE_STATE_GOING by "rmmod --force", i.e. delete_module(..., O_TRUNC), but playing nice with forced unloading is an exercise in futility and gives a falsea sense of security. Using try_get_module() only prevents acquiring _new_ references, it doesn't magically put the references held by other VMs, and forced unloading doesn't wait, i.e. "rmmod --force" on KVM is all but guaranteed to cause spectacular fireworks; the window where KVM will fail try_get_module() is tiny compared to the window where KVM is building and running the VM with an elevated module refcount. Addressing KVM's inability to play nice with "rmmod --force" is firmly out-of-scope. Forcefully unloading any module taints kernel (for obvious reasons) _and_ requires the kernel to be built with CONFIG_MODULE_FORCE_UNLOAD=3Dy, which is off by default and comes with the amusing disclaimer that it's "mainly for kernel developers and desperate users". In other words, KVM is free to scoff at bug reports due to using "rmmod --force" while VMs may be running. Fixes: 5f6de5cbebee ("KVM: Prevent module exit until all VMs are freed") Cc: stable@vger.kernel.org Cc: David Matlack Signed-off-by: Sean Christopherson Message-Id: <20220816053937.2477106-3-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- virt/kvm/kvm_main.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1085,6 +1085,9 @@ static struct kvm *kvm_create_vm(unsigne if (!kvm) return ERR_PTR(-ENOMEM); =20 + /* KVM is pinned via open("/dev/kvm"), the fd passed to this ioctl(). */ + __module_get(kvm_chardev_ops.owner); + KVM_MMU_LOCK_INIT(kvm); mmgrab(current->mm); kvm->mm =3D current->mm; @@ -1170,16 +1173,6 @@ static struct kvm *kvm_create_vm(unsigne preempt_notifier_inc(); kvm_init_pm_notifier(kvm); =20 - /* - * When the fd passed to this ioctl() is opened it pins the module, - * but try_module_get() also prevents getting a reference if the module - * is in MODULE_STATE_GOING (e.g. if someone ran "rmmod --wait"). - */ - if (!try_module_get(kvm_chardev_ops.owner)) { - r =3D -ENODEV; - goto out_err; - } - return kvm; =20 out_err: @@ -1201,6 +1194,7 @@ out_err_no_irq_srcu: out_err_no_srcu: kvm_arch_free_vm(kvm); mmdrop(current->mm); + module_put(kvm_chardev_ops.owner); return ERR_PTR(r); } From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C95DDC32774 for ; Tue, 23 Aug 2022 08:10:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241942AbiHWIKQ (ORCPT ); Tue, 23 Aug 2022 04:10:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241798AbiHWIJM (ORCPT ); Tue, 23 Aug 2022 04:09:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAC5F4A110; Tue, 23 Aug 2022 01:05:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B705610AA; Tue, 23 Aug 2022 08:05:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90BFAC433C1; Tue, 23 Aug 2022 08:05:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241957; bh=xVV0l/Pd2MYjbdMgeA4Tm9OMCqwYPPiHSBBgogv6Dhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aj1joynrvxolbdNc94cBAG+lSPmUy5WL2Mt8ynKukFn8N22L4lttjN9i8QvJjpgre H7U8zmGFEuiPJaizE3EJKdOGOIIUSEl8rOC5VUu1FMapAApoDF8TPx3LimVrxyOfGO LNMuGJVeEKgAozNGNCWjtGOahosdhZnn+mSZ9oS4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaron Lu , stable@kernel.org, Linus Torvalds Subject: [PATCH 5.19 005/365] x86/mm: Use proper mask when setting PUD mapping Date: Tue, 23 Aug 2022 09:58:26 +0200 Message-Id: <20220823080118.379994360@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Aaron Lu commit 88e0a74902f894fbbc55ad3ad2cb23b4bfba555c upstream. Commit c164fbb40c43f("x86/mm: thread pgprot_t through init_memory_mapping()") mistakenly used __pgprot() which doesn't respect __default_kernel_pte_mask when setting PUD mapping. Fix it by only setting the one bit we actually need (PSE) and leaving the other bits (that have been properly masked) alone. Fixes: c164fbb40c43 ("x86/mm: thread pgprot_t through init_memory_mapping()= ") Signed-off-by: Aaron Lu Cc: stable@kernel.org Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/x86/mm/init_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -645,7 +645,7 @@ phys_pud_init(pud_t *pud_page, unsigned pages++; spin_lock(&init_mm.page_table_lock); =20 - prot =3D __pgprot(pgprot_val(prot) | __PAGE_KERNEL_LARGE); + prot =3D __pgprot(pgprot_val(prot) | _PAGE_PSE); =20 set_pte_init((pte_t *)pud, pfn_pte((paddr & PUD_MASK) >> PAGE_SHIFT, From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A80FAC32774 for ; Tue, 23 Aug 2022 08:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241949AbiHWIKU (ORCPT ); Tue, 23 Aug 2022 04:10:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241809AbiHWIJO (ORCPT ); Tue, 23 Aug 2022 04:09:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D191B659ED; Tue, 23 Aug 2022 01:06:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5B6DAB81C19; Tue, 23 Aug 2022 08:06:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAA09C433D6; Tue, 23 Aug 2022 08:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241960; bh=UCYycxyPUwO1hHOBKfBA1QUnk84cOVlOhcqdGlDU2ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KQ5ryCgSdJ757V5sgqtAeAiDWYQ3Co0t1gtWo+nTqzKvJ8AKD3ZyfiSk3lEN2Tb2m 0MClVyAEgMopoq+CPz6lnUU0Gy/tS5PgJIRH3C47M42kCZPkqsfv7xbVuFx3NdTOTg 6TA4iE3r230oolEQ8Kg2XORSOW4gXW43yflS2dGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , "David S. Miller" Subject: [PATCH 5.19 006/365] rds: add missing barrier to release_refill Date: Tue, 23 Aug 2022 09:58:27 +0200 Message-Id: <20220823080118.421576569@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka commit 9f414eb409daf4f778f011cf8266d36896bb930b upstream. The functions clear_bit and set_bit do not imply a memory barrier, thus it may be possible that the waitqueue_active function (which does not take any locks) is moved before clear_bit and it could miss a wakeup event. Fix this bug by adding a memory barrier after clear_bit. Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/rds/ib_recv.c | 1 + 1 file changed, 1 insertion(+) --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -363,6 +363,7 @@ static int acquire_refill(struct rds_con static void release_refill(struct rds_connection *conn) { clear_bit(RDS_RECV_REFILL, &conn->c_flags); + smp_mb__after_atomic(); =20 /* We don't use wait_on_bit()/wake_up_bit() because our waking is in a * hot path and finding waiters is very rare. We don't want to walk From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BDC1C32774 for ; Tue, 23 Aug 2022 08:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241992AbiHWIK0 (ORCPT ); Tue, 23 Aug 2022 04:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231491AbiHWIJP (ORCPT ); Tue, 23 Aug 2022 04:09:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D24411EEEB; Tue, 23 Aug 2022 01:06:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8E0776120C; Tue, 23 Aug 2022 08:06:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93F4DC433C1; Tue, 23 Aug 2022 08:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241963; bh=T6wbFxEZ0JNjVLGaAkLyy3eDIxIVf7DYXxIn42x7T0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sgLssvKhY+HyEc72wlpZxp/CJ2XScpyKQ7UrkbnIeWQmmC8yEyQgs1w1VzLzypuo8 E+5MerUqOz7bVRSIYBv9GQgQBOIgG8tpkLb82wFbkBBUz6D8RyaLVwJPvXiYAm67/y wIW90yHkVPxmdWxSc2v0I6ZSRY7QRz/EhXoenZDQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Nirmoy Das , Matthew Auld , Rodrigo Vivi Subject: [PATCH 5.19 007/365] drm/i915/gem: Remove shared locking on freeing objects Date: Tue, 23 Aug 2022 09:58:28 +0200 Message-Id: <20220823080118.462276633@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chris Wilson commit 2826d447fbd60e6a05e53d5f918bceb8c04e315c upstream. The obj->base.resv may be shared across many objects, some of which may still be live and locked, preventing objects from being freed indefintely. We could individualise the lock during the free, or rely on a freed object having no contention and being able to immediately free the pages it owns. Fixes: be7612fd6665 ("drm/i915: Require object lock when freeing pages duri= ng destruction") Fixes: 6cb12fbda1c2 ("drm/i915: Use trylock instead of blocking lock for __= i915_gem_free_objects.") Cc: # v5.17+ Signed-off-by: Chris Wilson Tested-by: Nirmoy Das Acked-by: Nirmoy Das Signed-off-by: Nirmoy Das Reviewed-by: Matthew Auld Signed-off-by: Matthew Auld Link: https://patchwork.freedesktop.org/patch/msgid/20220726144844.18429-1-= nirmoy.das@intel.com (cherry picked from commit 7dd5c56531eb03696acdb17774721de5ef481c0b) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/i915/gem/i915_gem_object.c | 16 ++++------------ drivers/gpu/drm/i915/i915_drv.h | 4 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) --- a/drivers/gpu/drm/i915/gem/i915_gem_object.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c @@ -268,7 +268,7 @@ static void __i915_gem_object_free_mmaps */ void __i915_gem_object_pages_fini(struct drm_i915_gem_object *obj) { - assert_object_held(obj); + assert_object_held_shared(obj); =20 if (!list_empty(&obj->vma.list)) { struct i915_vma *vma; @@ -331,15 +331,7 @@ static void __i915_gem_free_objects(stru continue; } =20 - if (!i915_gem_object_trylock(obj, NULL)) { - /* busy, toss it back to the pile */ - if (llist_add(&obj->freed, &i915->mm.free_list)) - queue_delayed_work(i915->wq, &i915->mm.free_work, msecs_to_jiffies(10)= ); - continue; - } - __i915_gem_object_pages_fini(obj); - i915_gem_object_unlock(obj); __i915_gem_free_object(obj); =20 /* But keep the pointer alive for RCU-protected lookups */ @@ -359,7 +351,7 @@ void i915_gem_flush_free_objects(struct static void __i915_gem_free_work(struct work_struct *work) { struct drm_i915_private *i915 =3D - container_of(work, struct drm_i915_private, mm.free_work.work); + container_of(work, struct drm_i915_private, mm.free_work); =20 i915_gem_flush_free_objects(i915); } @@ -391,7 +383,7 @@ static void i915_gem_free_object(struct */ =20 if (llist_add(&obj->freed, &i915->mm.free_list)) - queue_delayed_work(i915->wq, &i915->mm.free_work, 0); + queue_work(i915->wq, &i915->mm.free_work); } =20 void __i915_gem_object_flush_frontbuffer(struct drm_i915_gem_object *obj, @@ -719,7 +711,7 @@ bool i915_gem_object_placement_possible( =20 void i915_gem_init__objects(struct drm_i915_private *i915) { - INIT_DELAYED_WORK(&i915->mm.free_work, __i915_gem_free_work); + INIT_WORK(&i915->mm.free_work, __i915_gem_free_work); } =20 void i915_objects_module_exit(void) --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -254,7 +254,7 @@ struct i915_gem_mm { * List of objects which are pending destruction. */ struct llist_head free_list; - struct delayed_work free_work; + struct work_struct free_work; /** * Count of objects pending destructions. Used to skip needlessly * waiting on an RCU barrier if no objects are waiting to be freed. @@ -1415,7 +1415,7 @@ static inline void i915_gem_drain_freed_ * armed the work again. */ while (atomic_read(&i915->mm.free_count)) { - flush_delayed_work(&i915->mm.free_work); + flush_work(&i915->mm.free_work); flush_delayed_work(&i915->bdev.wq); rcu_barrier(); } From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93764C32774 for ; Tue, 23 Aug 2022 08:11:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241623AbiHWILo (ORCPT ); Tue, 23 Aug 2022 04:11:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241830AbiHWIJY (ORCPT ); Tue, 23 Aug 2022 04:09:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B21FC66A65; Tue, 23 Aug 2022 01:06:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F08EB81C18; Tue, 23 Aug 2022 08:06:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90AD5C433C1; Tue, 23 Aug 2022 08:06:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241966; bh=n/610ybo0Q8VX/qdPiQAgzKGu5QXTZKOJay/mqFZBEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HjnQn7h6U2A+TJNBzZBsROU1qnEbAQY5qs7KlUTA4zWfNjrTdFj/Rpm1oKeUgj0Au eYIhNFuAqQV8h7ZfLNzoVU80QnqSuAvG6zJNnRYhdd80iesfAmYitio2Jx9Sjt01V5 hEvbSnOAcUTUVD+6Dbe3ynYSOET82/ditMCPOCD8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Hector Martin , Will Deacon , Arnd Bergmann Subject: [PATCH 5.19 008/365] locking/atomic: Make test_and_*_bit() ordered on failure Date: Tue, 23 Aug 2022 09:58:29 +0200 Message-Id: <20220823080118.507275261@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hector Martin commit 415d832497098030241605c52ea83d4e2cfa7879 upstream. These operations are documented as always ordered in include/asm-generic/bitops/instrumented-atomic.h, and producer-consumer type use cases where one side needs to ensure a flag is left pending after some shared data was updated rely on this ordering, even in the failure case. This is the case with the workqueue code, which currently suffers from a reproducible ordering violation on Apple M1 platforms (which are notoriously out-of-order) that ends up causing the TTY layer to fail to deliver data to userspace properly under the right conditions. This change fixes that bug. Change the documentation to restrict the "no order on failure" story to the _lock() variant (for which it makes sense), and remove the early-exit from the generic implementation, which is what causes the missing barrier semantics in that case. Without this, the remaining atomic op is fully ordered (including on ARM64 LSE, as of recent versions of the architecture spec). Suggested-by: Linus Torvalds Cc: stable@vger.kernel.org Fixes: e986a0d6cb36 ("locking/atomics, asm-generic/bitops/atomic.h: Rewrite= using atomic_*() APIs") Fixes: 61e02392d3c7 ("locking/atomic/bitops: Document and clarify ordering = semantics for failed test_and_{}_bit()") Signed-off-by: Hector Martin Acked-by: Will Deacon Reviewed-by: Arnd Bergmann Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/atomic_bitops.txt | 2 +- include/asm-generic/bitops/atomic.h | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) --- a/Documentation/atomic_bitops.txt +++ b/Documentation/atomic_bitops.txt @@ -59,7 +59,7 @@ Like with atomic_t, the rule of thumb is - RMW operations that have a return value are fully ordered. =20 - RMW operations that are conditional are unordered on FAILURE, - otherwise the above rules apply. In the case of test_and_{}_bit() opera= tions, + otherwise the above rules apply. In the case of test_and_set_bit_lock(), if the bit in memory is unchanged by the operation then it is deemed to= have failed. =20 --- a/include/asm-generic/bitops/atomic.h +++ b/include/asm-generic/bitops/atomic.h @@ -39,9 +39,6 @@ arch_test_and_set_bit(unsigned int nr, v unsigned long mask =3D BIT_MASK(nr); =20 p +=3D BIT_WORD(nr); - if (READ_ONCE(*p) & mask) - return 1; - old =3D arch_atomic_long_fetch_or(mask, (atomic_long_t *)p); return !!(old & mask); } @@ -53,9 +50,6 @@ arch_test_and_clear_bit(unsigned int nr, unsigned long mask =3D BIT_MASK(nr); =20 p +=3D BIT_WORD(nr); - if (!(READ_ONCE(*p) & mask)) - return 0; - old =3D arch_atomic_long_fetch_andnot(mask, (atomic_long_t *)p); return !!(old & mask); } From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BBE1C32789 for ; Tue, 23 Aug 2022 08:13:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241787AbiHWILt (ORCPT ); Tue, 23 Aug 2022 04:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241834AbiHWIJY (ORCPT ); Tue, 23 Aug 2022 04:09:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2125C24BD4; Tue, 23 Aug 2022 01:06:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4C142B81C19; Tue, 23 Aug 2022 08:06:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 974EAC433D7; Tue, 23 Aug 2022 08:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241969; bh=T+DYn5Fq8FGf1pD9DE5wI13Mf79PBMKBMOI7+SrtCaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zqKplEop9y6qYbQfWqR1CfEqFvpAcoDW7FWWPPOFvDTKHcPXWBWzRjOXzWe0XT8va 32M25+laYPQy7AGFjqjYW7fufuS8uC1JT76+Rt1Ip1Bfr23FdpvaNMyx5tFumTcwdP aXcDCfEj57Xg1GezDBoh/jGjOxcdihHefqQKBxjI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Karol Herbst , Lyude Paul Subject: [PATCH 5.19 009/365] drm/nouveau: recognise GA103 Date: Tue, 23 Aug 2022 09:58:30 +0200 Message-Id: <20220823080118.557303638@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Karol Herbst commit c20ee5749a3f688d9bab83a3b09b75587153ff13 upstream. Appears to be ok with general GA10x code. Signed-off-by: Karol Herbst Cc: # v5.15+ Reviewed-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20220803142745.2679510-= 1-kherbst@redhat.com Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 22 +++++++++++++++++= +++++ 1 file changed, 22 insertions(+) --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c @@ -2606,6 +2606,27 @@ nv172_chipset =3D { }; =20 static const struct nvkm_device_chip +nv173_chipset =3D { + .name =3D "GA103", + .bar =3D { 0x00000001, tu102_bar_new }, + .bios =3D { 0x00000001, nvkm_bios_new }, + .devinit =3D { 0x00000001, ga100_devinit_new }, + .fb =3D { 0x00000001, ga102_fb_new }, + .gpio =3D { 0x00000001, ga102_gpio_new }, + .i2c =3D { 0x00000001, gm200_i2c_new }, + .imem =3D { 0x00000001, nv50_instmem_new }, + .mc =3D { 0x00000001, ga100_mc_new }, + .mmu =3D { 0x00000001, tu102_mmu_new }, + .pci =3D { 0x00000001, gp100_pci_new }, + .privring =3D { 0x00000001, gm200_privring_new }, + .timer =3D { 0x00000001, gk20a_timer_new }, + .top =3D { 0x00000001, ga100_top_new }, + .disp =3D { 0x00000001, ga102_disp_new }, + .dma =3D { 0x00000001, gv100_dma_new }, + .fifo =3D { 0x00000001, ga102_fifo_new }, +}; + +static const struct nvkm_device_chip nv174_chipset =3D { .name =3D "GA104", .bar =3D { 0x00000001, tu102_bar_new }, @@ -3092,6 +3113,7 @@ nvkm_device_ctor(const struct nvkm_devic case 0x167: device->chip =3D &nv167_chipset; break; case 0x168: device->chip =3D &nv168_chipset; break; case 0x172: device->chip =3D &nv172_chipset; break; + case 0x173: device->chip =3D &nv173_chipset; break; case 0x174: device->chip =3D &nv174_chipset; break; case 0x176: device->chip =3D &nv176_chipset; break; case 0x177: device->chip =3D &nv177_chipset; break; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33698C32774 for ; Tue, 23 Aug 2022 08:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242060AbiHWIMK (ORCPT ); Tue, 23 Aug 2022 04:12:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241855AbiHWIJ2 (ORCPT ); Tue, 23 Aug 2022 04:09:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8137867144; Tue, 23 Aug 2022 01:06:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7C5DDB81C20; Tue, 23 Aug 2022 08:06:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E73FDC433D6; Tue, 23 Aug 2022 08:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241972; bh=H3ZYcRFTg+AhHBafjzqVlm07BYtjEo1X/hnhJO7Aico=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eet9qwhwLU+BBSWOOCL2GtCaOU6q1irNJKBUNZsdurZXYeyd1uA6X8o8Yh9YTljlm iMRwz9OklNl/2xO3sXoHBzFHaxwMpXBS3GNzKlzihuOG1m2ZH4qEDoy+NEFjvIie0H yNpZIRlbnt9t1yH5lppLqYI6IX305TlAxeec+rtg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arunpravin Paneer Selvam , kernel test robot , =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [PATCH 5.19 010/365] drm/ttm: Fix dummy res NULL ptr deref bug Date: Tue, 23 Aug 2022 09:58:31 +0200 Message-Id: <20220823080118.604457173@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arunpravin Paneer Selvam commit cf4b7387c0a842d64bdd7c353e6d3298174a7740 upstream. Check the bo->resource value before accessing the resource mem_type. v2: Fix commit description unwrapped warning [ 40.191227][ T184] general protection fault, probably for non-canonical= address 0xdffffc0000000002: 0000 [#1] SMP KASAN PTI [ 40.192995][ T184] KASAN: null-ptr-deref in range [0x0000000000000010-0= x0000000000000017] [ 40.194411][ T184] CPU: 1 PID: 184 Comm: systemd-udevd Not tainted 5.19= .0-rc4-00721-gb297c22b7070 #1 [ 40.196063][ T184] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996= ), BIOS 1.16.0-debian-1.16.0-4 04/01/2014 [ 40.199605][ T184] RIP: 0010:ttm_bo_validate+0x1b3/0x240 [ttm] [ 40.200754][ T184] Code: e8 72 c5 ff ff 83 f8 b8 74 d4 85 c0 75 54 49 8= b 9e 58 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 8d 7b 10 48 89 fa 48 c1 e= a 03 <0f> b6 04 02 84 c0 74 04 3c 03 7e 44 8b 53 10 31 c0 85 d2 0f 85 58 [ 40.203685][ T184] RSP: 0018:ffffc900006df0c8 EFLAGS: 00010202 [ 40.204630][ T184] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 1ff= ff1102f4bb71b [ 40.205864][ T184] RDX: 0000000000000002 RSI: ffffc900006df208 RDI: 000= 0000000000010 [ 40.207102][ T184] RBP: 1ffff920000dbe1a R08: ffffc900006df208 R09: 000= 0000000000000 [ 40.208394][ T184] R10: ffff88817a5f0000 R11: 0000000000000001 R12: fff= fc900006df110 [ 40.209692][ T184] R13: ffffc900006df0f0 R14: ffff88817a5db800 R15: fff= fc900006df208 [ 40.210862][ T184] FS: 00007f6b1d16e8c0(0000) GS:ffff88839d700000(0000= ) knlGS:0000000000000000 [ 40.212250][ T184] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 40.213275][ T184] CR2: 000055a1001d4ff0 CR3: 00000001700f4000 CR4: 000= 00000000006e0 [ 40.214469][ T184] Call Trace: [ 40.214974][ T184] [ 40.215438][ T184] ? ttm_bo_bounce_temp_buffer+0x140/0x140 [ttm] [ 40.216572][ T184] ? mutex_spin_on_owner+0x240/0x240 [ 40.217456][ T184] ? drm_vma_offset_add+0xaa/0x100 [drm] [ 40.218457][ T184] ttm_bo_init_reserved+0x3d6/0x540 [ttm] [ 40.219410][ T184] ? shmem_get_inode+0x744/0x980 [ 40.220231][ T184] ttm_bo_init_validate+0xb1/0x200 [ttm] [ 40.221172][ T184] ? bo_driver_evict_flags+0x340/0x340 [drm_vram_helpe= r] [ 40.222530][ T184] ? ttm_bo_init_reserved+0x540/0x540 [ttm] [ 40.223643][ T184] ? __do_sys_finit_module+0x11a/0x1c0 [ 40.224654][ T184] ? __shmem_file_setup+0x102/0x280 [ 40.234764][ T184] drm_gem_vram_create+0x305/0x480 [drm_vram_helper] [ 40.235766][ T184] ? bo_driver_evict_flags+0x340/0x340 [drm_vram_helpe= r] [ 40.236846][ T184] ? __kasan_slab_free+0x108/0x180 [ 40.237650][ T184] drm_gem_vram_fill_create_dumb+0x134/0x340 [drm_vram= _helper] [ 40.238864][ T184] ? local_pci_probe+0xdf/0x180 [ 40.239674][ T184] ? drmm_vram_helper_init+0x400/0x400 [drm_vram_helpe= r] [ 40.240826][ T184] drm_client_framebuffer_create+0x19c/0x400 [drm] [ 40.241955][ T184] ? drm_client_buffer_delete+0x200/0x200 [drm] [ 40.243001][ T184] ? drm_client_pick_crtcs+0x554/0xb80 [drm] [ 40.244030][ T184] drm_fb_helper_generic_probe+0x23f/0x940 [drm_kms_he= lper] [ 40.245226][ T184] ? __cond_resched+0x1c/0xc0 [ 40.245987][ T184] ? drm_fb_helper_memory_range_to_clip+0x180/0x180 [d= rm_kms_helper] [ 40.247316][ T184] ? mutex_unlock+0x80/0x100 [ 40.248005][ T184] ? __mutex_unlock_slowpath+0x2c0/0x2c0 [ 40.249083][ T184] drm_fb_helper_single_fb_probe+0x907/0xf00 [drm_kms_= helper] [ 40.250314][ T184] ? drm_fb_helper_check_var+0x1180/0x1180 [drm_kms_he= lper] [ 40.251540][ T184] ? __cond_resched+0x1c/0xc0 [ 40.252321][ T184] ? mutex_lock+0x9f/0x100 [ 40.253062][ T184] __drm_fb_helper_initial_config_and_unlock+0xb9/0x2c= 0 [drm_kms_helper] [ 40.254394][ T184] drm_fbdev_client_hotplug+0x56f/0x840 [drm_kms_helpe= r] [ 40.255477][ T184] drm_fbdev_generic_setup+0x165/0x3c0 [drm_kms_helper] [ 40.256607][ T184] bochs_pci_probe+0x6b7/0x900 [bochs] [ 40.257515][ T184] ? _raw_spin_lock_irqsave+0x87/0x100 [ 40.258312][ T184] ? bochs_hw_init+0x480/0x480 [bochs] [ 40.259244][ T184] ? bochs_hw_init+0x480/0x480 [bochs] [ 40.260186][ T184] local_pci_probe+0xdf/0x180 [ 40.260928][ T184] pci_call_probe+0x15f/0x500 [ 40.265798][ T184] ? _raw_spin_lock+0x81/0x100 [ 40.266508][ T184] ? pci_pm_suspend_noirq+0x980/0x980 [ 40.267322][ T184] ? pci_assign_irq+0x81/0x280 [ 40.268096][ T184] ? pci_match_device+0x351/0x6c0 [ 40.268883][ T184] ? kernfs_put+0x18/0x40 [ 40.269611][ T184] pci_device_probe+0xee/0x240 [ 40.270352][ T184] really_probe+0x435/0xa80 [ 40.271021][ T184] __driver_probe_device+0x2ab/0x480 [ 40.271828][ T184] driver_probe_device+0x49/0x140 [ 40.272627][ T184] __driver_attach+0x1bd/0x4c0 [ 40.273372][ T184] ? __device_attach_driver+0x240/0x240 [ 40.274273][ T184] bus_for_each_dev+0x11e/0x1c0 [ 40.275080][ T184] ? subsys_dev_iter_exit+0x40/0x40 [ 40.275951][ T184] ? klist_add_tail+0x132/0x280 [ 40.276767][ T184] bus_add_driver+0x39b/0x580 [ 40.277574][ T184] driver_register+0x20f/0x3c0 [ 40.278281][ T184] ? 0xffffffffc04a2000 [ 40.278894][ T184] do_one_initcall+0x8a/0x300 [ 40.279642][ T184] ? trace_event_raw_event_initcall_level+0x1c0/0x1c0 [ 40.280707][ T184] ? kasan_unpoison+0x23/0x80 [ 40.281479][ T184] ? kasan_unpoison+0x23/0x80 [ 40.282197][ T184] do_init_module+0x190/0x640 [ 40.282926][ T184] load_module+0x221b/0x2780 [ 40.283611][ T184] ? layout_and_allocate+0x5c0/0x5c0 [ 40.284401][ T184] ? kernel_read_file+0x286/0x6c0 [ 40.285216][ T184] ? __x64_sys_fspick+0x2c0/0x2c0 [ 40.286043][ T184] ? mmap_region+0x4e7/0x1300 [ 40.286832][ T184] ? __do_sys_finit_module+0x11a/0x1c0 [ 40.287743][ T184] __do_sys_finit_module+0x11a/0x1c0 [ 40.288636][ T184] ? __ia32_sys_init_module+0xc0/0xc0 [ 40.289557][ T184] ? __seccomp_filter+0x15e/0xc80 [ 40.290341][ T184] ? vm_mmap_pgoff+0x185/0x240 [ 40.291060][ T184] do_syscall_64+0x3b/0xc0 [ 40.291763][ T184] entry_SYSCALL_64_after_hwframe+0x46/0xb0 [ 40.292678][ T184] RIP: 0033:0x7f6b1d6279b9 [ 40.293438][ T184] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 0= 0 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0= f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a7 54 0c 00 f7 d8 64 89 01 48 [ 40.296302][ T184] RSP: 002b:00007ffe7f51b798 EFLAGS: 00000246 ORIG_RAX= : 0000000000000139 [ 40.297633][ T184] RAX: ffffffffffffffda RBX: 00005642dcca2880 RCX: 000= 07f6b1d6279b9 [ 40.298890][ T184] RDX: 0000000000000000 RSI: 00007f6b1d7b2e2d RDI: 000= 0000000000016 [ 40.300199][ T184] RBP: 0000000000020000 R08: 0000000000000000 R09: 000= 05642dccd5530 [ 40.301547][ T184] R10: 0000000000000016 R11: 0000000000000246 R12: 000= 07f6b1d7b2e2d [ 40.302698][ T184] R13: 0000000000000000 R14: 00005642dcca4230 R15: 000= 05642dcca2880 Signed-off-by: Arunpravin Paneer Selvam Reported-by: kernel test robot Reviewed-by: Christian K=C3=B6nig Link: https://patchwork.freedesktop.org/patch/msgid/20220726162205.2778-1-A= runpravin.PaneerSelvam@amd.com Link: https://patchwork.freedesktop.org/patch/msgid/20220809095623.3569-1-A= runpravin.PaneerSelvam@amd.com Signed-off-by: Christian K=C3=B6nig CC: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/ttm/ttm_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -918,7 +918,7 @@ int ttm_bo_validate(struct ttm_buffer_ob /* * We might need to add a TTM. */ - if (bo->resource->mem_type =3D=3D TTM_PL_SYSTEM) { + if (!bo->resource || bo->resource->mem_type =3D=3D TTM_PL_SYSTEM) { ret =3D ttm_tt_create(bo, true); if (ret) return ret; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7ECD1C38159 for ; Tue, 23 Aug 2022 08:12:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242008AbiHWIL6 (ORCPT ); Tue, 23 Aug 2022 04:11:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241852AbiHWIJ2 (ORCPT ); Tue, 23 Aug 2022 04:09:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3D7265817; Tue, 23 Aug 2022 01:06:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F33506122D; Tue, 23 Aug 2022 08:06:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04A38C433C1; Tue, 23 Aug 2022 08:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241975; bh=wCsjM0Y0qINZDdkkfipcM2J/EeyQyOFc0gXcZwLfdbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ovcN/UgtweX4OROOgYFHG3FDjuve1eUL2Cnajp6orszPBZo2ekTeaq6eH2mi8P63V +8JEWcbpHKZCntVid61NDk/nxBc0LYwWGQB1WLX2+qkOyt5ngzapWiLS1fWjXzBj69 kN6omfGo1tuVY6X0FALW2M6XjKuyF9sSscZGXaJI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Deucher , Mario Limonciello Subject: [PATCH 5.19 011/365] drm/amdgpu: Only disable prefer_shadow on hawaii Date: Tue, 23 Aug 2022 09:58:32 +0200 Message-Id: <20220823080118.645851103@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Deucher commit a6250bdb6c4677ee77d699b338e077b900f94c0c upstream. We changed it for all asics due to a hibernation regression on hawaii, but the workaround breaks suspend on a polaris12. Just disable it for hawaii. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216119 Fixes: 3a4b1cc28fbd ("drm/amdgpu/display: disable prefer_shadow for generic= fb helpers") Reviewed-and-tested-by: Mario Limonciello Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 3 +-- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 3 +-- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 3 +-- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 3 +-- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 7 +++++-- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++-- 6 files changed, 14 insertions(+), 12 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c @@ -496,8 +496,7 @@ static int amdgpu_vkms_sw_init(void *han adev_to_drm(adev)->mode_config.max_height =3D YRES_MAX; =20 adev_to_drm(adev)->mode_config.preferred_depth =3D 24; - /* disable prefer shadow for now due to hibernation issues */ - adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; + adev_to_drm(adev)->mode_config.prefer_shadow =3D 1; =20 adev_to_drm(adev)->mode_config.fb_base =3D adev->gmc.aper_base; =20 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c @@ -2796,8 +2796,7 @@ static int dce_v10_0_sw_init(void *handl adev_to_drm(adev)->mode_config.max_height =3D 16384; =20 adev_to_drm(adev)->mode_config.preferred_depth =3D 24; - /* disable prefer shadow for now due to hibernation issues */ - adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; + adev_to_drm(adev)->mode_config.prefer_shadow =3D 1; =20 adev_to_drm(adev)->mode_config.fb_modifiers_not_supported =3D true; =20 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c @@ -2914,8 +2914,7 @@ static int dce_v11_0_sw_init(void *handl adev_to_drm(adev)->mode_config.max_height =3D 16384; =20 adev_to_drm(adev)->mode_config.preferred_depth =3D 24; - /* disable prefer shadow for now due to hibernation issues */ - adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; + adev_to_drm(adev)->mode_config.prefer_shadow =3D 1; =20 adev_to_drm(adev)->mode_config.fb_modifiers_not_supported =3D true; =20 --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c @@ -2673,8 +2673,7 @@ static int dce_v6_0_sw_init(void *handle adev_to_drm(adev)->mode_config.max_width =3D 16384; adev_to_drm(adev)->mode_config.max_height =3D 16384; adev_to_drm(adev)->mode_config.preferred_depth =3D 24; - /* disable prefer shadow for now due to hibernation issues */ - adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; + adev_to_drm(adev)->mode_config.prefer_shadow =3D 1; adev_to_drm(adev)->mode_config.fb_modifiers_not_supported =3D true; adev_to_drm(adev)->mode_config.fb_base =3D adev->gmc.aper_base; =20 --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c @@ -2693,8 +2693,11 @@ static int dce_v8_0_sw_init(void *handle adev_to_drm(adev)->mode_config.max_height =3D 16384; =20 adev_to_drm(adev)->mode_config.preferred_depth =3D 24; - /* disable prefer shadow for now due to hibernation issues */ - adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; + if (adev->asic_type =3D=3D CHIP_HAWAII) + /* disable prefer shadow for now due to hibernation issues */ + adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; + else + adev_to_drm(adev)->mode_config.prefer_shadow =3D 1; =20 adev_to_drm(adev)->mode_config.fb_modifiers_not_supported =3D true; =20 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3894,8 +3894,11 @@ static int amdgpu_dm_mode_config_init(st adev_to_drm(adev)->mode_config.max_height =3D 16384; =20 adev_to_drm(adev)->mode_config.preferred_depth =3D 24; - /* disable prefer shadow for now due to hibernation issues */ - adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; + if (adev->asic_type =3D=3D CHIP_HAWAII) + /* disable prefer shadow for now due to hibernation issues */ + adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; + else + adev_to_drm(adev)->mode_config.prefer_shadow =3D 1; /* indicates support for immediate flip */ adev_to_drm(adev)->mode_config.async_page_flip =3D true; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31DFCC32774 for ; Tue, 23 Aug 2022 08:08:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240959AbiHWIIb (ORCPT ); Tue, 23 Aug 2022 04:08:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241684AbiHWIIF (ORCPT ); Tue, 23 Aug 2022 04:08:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FF466BD4D; Tue, 23 Aug 2022 01:05:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AFE5AB81C24; Tue, 23 Aug 2022 08:04:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08466C433D6; Tue, 23 Aug 2022 08:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241895; bh=dNybW/HES1FgarV14AJnVL0x6T90D28LuAva8GLgRRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EbFkyEPtt6EJWcfi5P0Ig4eTy1xP+gh+WK+WcjCEArSzhn30Jv4+dOmRKQhWzUEBn TYC14DSBg1rb+WKE+og6yypsEQQXdpt0txOSlphJstcEdGhI/1WLOVrEqqyVXoasrT 6CzOUh0jrDBY16DizEHaXesq0h1Jqd/k4Y0DhwJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Chris Park , Rodrigo Siqueira , Tom Chung , Aurabindo Pillai , Daniel Wheeler , Alex Deucher Subject: [PATCH 5.19 012/365] drm/amd/display: Check correct bounds for stream encoder instances for DCN303 Date: Tue, 23 Aug 2022 09:58:33 +0200 Message-Id: <20220823080118.686423588@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Aurabindo Pillai commit 89b008222c2bf21e50219725caed31590edfd9d1 upstream. [Why & How] eng_id for DCN303 cannot be more than 1, since we have only two instances of stream encoders. Check the correct boundary condition for engine ID for DCN303 prevent the potential out of bounds access. Fixes: cd6d421e3d1a ("drm/amd/display: Initial DC support for Beige Goby") Reported-by: Dan Carpenter Cc: stable@vger.kernel.org Reviewed-by: Chris Park Reviewed-by: Rodrigo Siqueira Acked-by: Tom Chung Signed-off-by: Aurabindo Pillai Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c @@ -372,7 +372,7 @@ static struct stream_encoder *dcn303_str int afmt_inst; =20 /* Mapping of VPG, AFMT, DME register blocks to DIO block instance */ - if (eng_id <=3D ENGINE_ID_DIGE) { + if (eng_id <=3D ENGINE_ID_DIGB) { vpg_inst =3D eng_id; afmt_inst =3D eng_id; } else From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0B2AC3F6B0 for ; Tue, 23 Aug 2022 08:08:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241731AbiHWIIo (ORCPT ); Tue, 23 Aug 2022 04:08:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240692AbiHWIIT (ORCPT ); Tue, 23 Aug 2022 04:08:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 137536C749; Tue, 23 Aug 2022 01:05:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AD482B81C20; Tue, 23 Aug 2022 08:04:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11559C433D6; Tue, 23 Aug 2022 08:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241898; bh=ebnfDSkc3i9z/lwNs5Ai2x4+rScZFdUP3PM9DzhZcnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wiHVaxPdaorKR/B/6r/bCwOGdg3fkEodkKncvsYfoiYllT+G1OFJy4DIihPlTN0PY cJSsJwZl3QSCWk3mNAJKfU50CmqX1yhxwXMHBesIn2KxjLgvSNvVCZAbI8LAqIif30 qfahGZmG37Q/kIr1Yu4O1yLgD22rYgyEoBQT6iBk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harald Freudenberger , Tony Krowiak , Alexander Gordeev Subject: [PATCH 5.19 013/365] s390/ap: fix crash on older machines based on QCI info missing Date: Tue, 23 Aug 2022 09:58:34 +0200 Message-Id: <20220823080118.735404651@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Harald Freudenberger commit 0fef40be5d1f8e7af3d61e8827a63c5862cd99f7 upstream. On older z series machines (z12 and older) there is no QCI info available. The AP code took care of this and the AP bus scan then switched to simple probing via TAPQ. With commit 283915850a44 ("s390/ap: notify drivers on config changed and scan complete = callbacks") some code was introduced which silently assumed that the QCI info is always available. However, with KVM simulating an older machine (z12) the result was a kernel crash. Funnily the same crash does not happen on LPAR - maybe because NULL is a valid pointer and reading some data from address 0 also works fine. This fix now improves the code to be aware that the QCI instruction may not be available on older machines and thus the two pointers to QCI info structs may simple be NULL. However, on a machine not providing the QCI info the two callbacks to the zcrypt device drivers on_config_changed() and on_scan_complete() provide parameters which are pointers to a QCI info struct. These both callbacks are NOT served if there is no QCI info available. The only consumer of these callbacks is the vfio device driver. This driver only supports CEX4 and higher. All physical machines which are able to provide CEX4 cards have QCI support available. So there is no sense in for example fill the QCI info struct by hand with looping over cards and queues and TAPQ each APQN. Signed-off-by: Harald Freudenberger Signed-off-by: Tony Krowiak Cc: stable@vger.kernel.org Fixes: 283915850a44 ("s390/ap: notify drivers on config changed and scan co= mplete callbacks") Signed-off-by: Alexander Gordeev Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/s390/crypto/ap_bus.c | 3 +++ drivers/s390/crypto/ap_bus.h | 4 ++++ 2 files changed, 7 insertions(+) --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c @@ -2068,6 +2068,9 @@ static inline void ap_scan_adapter(int a */ static bool ap_get_configuration(void) { + if (!ap_qci_info) /* QCI not supported */ + return false; + memcpy(ap_qci_info_old, ap_qci_info, sizeof(*ap_qci_info)); ap_fetch_qci_info(ap_qci_info); =20 --- a/drivers/s390/crypto/ap_bus.h +++ b/drivers/s390/crypto/ap_bus.h @@ -148,12 +148,16 @@ struct ap_driver { /* * Called at the start of the ap bus scan function when * the crypto config information (qci) has changed. + * This callback is not invoked if there is no AP + * QCI support available. */ void (*on_config_changed)(struct ap_config_info *new_config_info, struct ap_config_info *old_config_info); /* * Called at the end of the ap bus scan function when * the crypto config information (qci) has changed. + * This callback is not invoked if there is no AP + * QCI support available. */ void (*on_scan_complete)(struct ap_config_info *new_config_info, struct ap_config_info *old_config_info); From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 356A0C32774 for ; Tue, 23 Aug 2022 08:07:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241736AbiHWIHr (ORCPT ); Tue, 23 Aug 2022 04:07:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241536AbiHWIHW (ORCPT ); Tue, 23 Aug 2022 04:07:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78ACB6BCFE; Tue, 23 Aug 2022 01:05:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E46066122D; Tue, 23 Aug 2022 08:05:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F09A5C433D6; Tue, 23 Aug 2022 08:05:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241901; bh=oPnoyrLnvcSPQog+slHYTPkPrz+FU/jYDqaLlPsJSjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hIERPHDvPAer9aLOdKid3ky3YRXnthj7/HDKFYIEpcAQMzdLIIr+PtMbSYjAEDaH6 pzTF0AzDwqJbCHZ1Ku2G7C2D9YOoTDI4b8D6VgGu+4TcsAn9zT1LbQMdy2bAfF7grj a86cxwfNDBVr+zCIytprEPWU6DC1zq8jL4ZwZsJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Damien Le Moal , Hannes Reinecke Subject: [PATCH 5.19 014/365] ata: libata-eh: Add missing command name Date: Tue, 23 Aug 2022 09:58:35 +0200 Message-Id: <20220823080118.776225344@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Damien Le Moal commit d3122bf9aa4c974f5e2c0112f799757b3a2779da upstream. Add the missing command name for ATA_CMD_NCQ_NON_DATA to ata_get_cmd_name(). Fixes: 661ce1f0c4a6 ("libata/libsas: Define ATA_CMD_NCQ_NON_DATA") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/ata/libata-eh.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -2122,6 +2122,7 @@ const char *ata_get_cmd_name(u8 command) { ATA_CMD_WRITE_QUEUED_FUA_EXT, "WRITE DMA QUEUED FUA EXT" }, { ATA_CMD_FPDMA_READ, "READ FPDMA QUEUED" }, { ATA_CMD_FPDMA_WRITE, "WRITE FPDMA QUEUED" }, + { ATA_CMD_NCQ_NON_DATA, "NCQ NON-DATA" }, { ATA_CMD_FPDMA_SEND, "SEND FPDMA QUEUED" }, { ATA_CMD_FPDMA_RECV, "RECEIVE FPDMA QUEUED" }, { ATA_CMD_PIO_READ, "READ SECTOR(S)" }, From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 727E1C32774 for ; Tue, 23 Aug 2022 08:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241045AbiHWIIu (ORCPT ); Tue, 23 Aug 2022 04:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241760AbiHWIIV (ORCPT ); Tue, 23 Aug 2022 04:08:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F4F86C762; Tue, 23 Aug 2022 01:05:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6BAD56120C; Tue, 23 Aug 2022 08:05:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 725EFC433C1; Tue, 23 Aug 2022 08:05:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241904; bh=gAdVwi5b46D9uvxjWOaMgLJiK7BOtIW4GyeExVWcIaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cdFIPSW1gimQ5NgG+fqURfYN6hTs0B76dQQesmqxPZBn5H6QMK1OXxm/AeUSsqdJa l50NuKEIcdGzKPiOJsBhovCmSjmtgoQl/vA4MxT/B0oB/TqoPaMFuyV4HcbiliuMrr Em+8V9W5bNnfrC9BzmmKYIVNjrHbUwLZoyAIoORo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Ulf Hansson Subject: [PATCH 5.19 015/365] mmc: pxamci: Fix another error handling path in pxamci_probe() Date: Tue, 23 Aug 2022 09:58:36 +0200 Message-Id: <20220823080118.811898619@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET commit b886f54c300d31c109d2e4336b22922b64e7ba7d upstream. The commit in Fixes: has introduced an new error handling without branching to the existing error handling path. Update it now and release some resources if pxamci_init_ocr() fails. Fixes: 61951fd6cb49 ("mmc: pxamci: let mmc core handle regulators") Signed-off-by: Christophe JAILLET Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/07a2dcebf8ede69b484103de8f9df043f158cffd.16= 58862932.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/mmc/host/pxamci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c @@ -672,7 +672,7 @@ static int pxamci_probe(struct platform_ =20 ret =3D pxamci_init_ocr(host); if (ret < 0) - return ret; + goto out; =20 mmc->caps =3D 0; host->cmdat =3D 0; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98152C32774 for ; Tue, 23 Aug 2022 08:09:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241780AbiHWIJC (ORCPT ); Tue, 23 Aug 2022 04:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241759AbiHWIIV (ORCPT ); Tue, 23 Aug 2022 04:08:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A69856C765; Tue, 23 Aug 2022 01:05:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 614376123D; Tue, 23 Aug 2022 08:05:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA593C433D6; Tue, 23 Aug 2022 08:05:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241908; bh=XXnsT8YnvLr5n07bfMayojz6yEaBHQq9iwO02OlXMVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c48SkWsePC5SDFot3+abi7+NQtX1ZN2y8UGoRS51fM+FkBz4z7E0qBAS405TkVx5S Ih3sdvDRHgTieFYRnIDVhxkh6haOVpW4S5fHkWWpfbx/wP398vYhBQvDs42tdZVkJ9 Ikx7UnhFFMjVfdMsnbxXs/R3rpO0jczXPZqJ65YQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Ulf Hansson Subject: [PATCH 5.19 016/365] mmc: pxamci: Fix an error handling path in pxamci_probe() Date: Tue, 23 Aug 2022 09:58:37 +0200 Message-Id: <20220823080118.861640237@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET commit 98d7c5e5792b8ce3e1352196dac7f404bb1b46ec upstream. The commit in Fixes: has moved some code around without updating gotos to the error handling path. Update it now and release some resources if pxamci_of_init() fails. Fixes: fa3a5115469c ("mmc: pxamci: call mmc_of_parse()") Signed-off-by: Christophe JAILLET Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/6d75855ad4e2470e9ed99e0df21bc30f0c925a29.16= 58862932.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/mmc/host/pxamci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c @@ -648,7 +648,7 @@ static int pxamci_probe(struct platform_ =20 ret =3D pxamci_of_init(pdev, mmc); if (ret) - return ret; + goto out; =20 host =3D mmc_priv(mmc); host->mmc =3D mmc; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3DFFC32774 for ; Tue, 23 Aug 2022 08:09:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241794AbiHWIJL (ORCPT ); Tue, 23 Aug 2022 04:09:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241459AbiHWIIZ (ORCPT ); Tue, 23 Aug 2022 04:08:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96B8B1208F; Tue, 23 Aug 2022 01:05:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6FF1C6123F; Tue, 23 Aug 2022 08:05:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AD24C433D6; Tue, 23 Aug 2022 08:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241911; bh=Q0I/PmJguM5EbQjnODE386mN8aRsJ1nboBw3Kf2fsGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rSTu9u8NZDscSVAhG5vUQ2i77J8zrm+xJCg77QjiE6zpzI0+dJnxeALAfjXRS/WmB Gfjs1NnHKMWdoN76RT++ma5imxD/e6SGNxgyNvK/H3Ah/fjsXjjSb6lp1HtlE1OpxN 2EyycM1hoNG8277XFijA2lrGfSjh4k34fct+9p4g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Ulf Hansson Subject: [PATCH 5.19 017/365] mmc: meson-gx: Fix an error handling path in meson_mmc_probe() Date: Tue, 23 Aug 2022 09:58:38 +0200 Message-Id: <20220823080118.902709249@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET commit b3e1cf31154136da855f3cb6117c17eb0b6bcfb4 upstream. The commit in Fixes has introduced a new error handling which should goto the existing error handling path. Otherwise some resources leak. Fixes: 19c6beaa064c ("mmc: meson-gx: add device reset") Signed-off-by: Christophe JAILLET Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/be4b863bacf323521ba3a02efdc4fca9cdedd1a6.16= 59855351.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/mmc/host/meson-gx-mmc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -1172,8 +1172,10 @@ static int meson_mmc_probe(struct platfo } =20 ret =3D device_reset_optional(&pdev->dev); - if (ret) - return dev_err_probe(&pdev->dev, ret, "device reset failed\n"); + if (ret) { + dev_err_probe(&pdev->dev, ret, "device reset failed\n"); + goto free_host; + } =20 res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); host->regs =3D devm_ioremap_resource(&pdev->dev, res); From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1F78C32796 for ; Tue, 23 Aug 2022 08:09:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241751AbiHWIJd (ORCPT ); Tue, 23 Aug 2022 04:09:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241741AbiHWIIa (ORCPT ); Tue, 23 Aug 2022 04:08:30 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CE6615FD5; Tue, 23 Aug 2022 01:05:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 627C9CE1B29; Tue, 23 Aug 2022 08:05:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6367AC433C1; Tue, 23 Aug 2022 08:05:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241914; bh=p5L1RJmEecqNIfPyT3QRQLYh4wl0EhjOa21pZM+hFrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=blmD1hZBE3AzsX/24YuZpnPjGCa7S0BkkMIppyf/hCHTmxO23PLQvs4XaYfRxj1Jw JcxkiVxuGmVGssiL5FiI2MMXCvy90kFmOT9xMzjdSx7GQJDkAZr4nRPCpgY2OO6cZP UMaktVlOOLDoMfIWdrj+43ECCxVb39zNdZ0MDNcI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, TOTE Robot , Sweet Tea Dorminy , Nikolay Borisov , Zixuan Fu , David Sterba Subject: [PATCH 5.19 018/365] btrfs: unset reloc control if transaction commit fails in prepare_to_relocate() Date: Tue, 23 Aug 2022 09:58:39 +0200 Message-Id: <20220823080118.950572230@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zixuan Fu commit 85f02d6c856b9f3a0acf5219de6e32f58b9778eb upstream. In btrfs_relocate_block_group(), the rc is allocated. Then btrfs_relocate_block_group() calls relocate_block_group() prepare_to_relocate() set_reloc_control() that assigns rc to the variable fs_info->reloc_ctl. When prepare_to_relocate() returns, it calls btrfs_commit_transaction() btrfs_start_dirty_block_groups() btrfs_alloc_path() kmem_cache_zalloc() which may fail for example (or other errors could happen). When the failure occurs, btrfs_relocate_block_group() detects the error and frees rc and doesn't set fs_info->reloc_ctl to NULL. After that, in btrfs_init_reloc_root(), rc is retrieved from fs_info->reloc_ctl and then used, which may cause a use-after-free bug. This possible bug can be triggered by calling btrfs_ioctl_balance() before calling btrfs_ioctl_defrag(). To fix this possible bug, in prepare_to_relocate(), check if btrfs_commit_transaction() fails. If the failure occurs, unset_reloc_control() is called to set fs_info->reloc_ctl to NULL. The error log in our fault-injection testing is shown as follows: [ 58.751070] BUG: KASAN: use-after-free in btrfs_init_reloc_root+0x7ca/= 0x920 [btrfs] ... [ 58.753577] Call Trace: ... [ 58.755800] kasan_report+0x45/0x60 [ 58.756066] btrfs_init_reloc_root+0x7ca/0x920 [btrfs] [ 58.757304] record_root_in_trans+0x792/0xa10 [btrfs] [ 58.757748] btrfs_record_root_in_trans+0x463/0x4f0 [btrfs] [ 58.758231] start_transaction+0x896/0x2950 [btrfs] [ 58.758661] btrfs_defrag_root+0x250/0xc00 [btrfs] [ 58.759083] btrfs_ioctl_defrag+0x467/0xa00 [btrfs] [ 58.759513] btrfs_ioctl+0x3c95/0x114e0 [btrfs] ... [ 58.768510] Allocated by task 23683: [ 58.768777] ____kasan_kmalloc+0xb5/0xf0 [ 58.769069] __kmalloc+0x227/0x3d0 [ 58.769325] alloc_reloc_control+0x10a/0x3d0 [btrfs] [ 58.769755] btrfs_relocate_block_group+0x7aa/0x1e20 [btrfs] [ 58.770228] btrfs_relocate_chunk+0xf1/0x760 [btrfs] [ 58.770655] __btrfs_balance+0x1326/0x1f10 [btrfs] [ 58.771071] btrfs_balance+0x3150/0x3d30 [btrfs] [ 58.771472] btrfs_ioctl_balance+0xd84/0x1410 [btrfs] [ 58.771902] btrfs_ioctl+0x4caa/0x114e0 [btrfs] ... [ 58.773337] Freed by task 23683: ... [ 58.774815] kfree+0xda/0x2b0 [ 58.775038] free_reloc_control+0x1d6/0x220 [btrfs] [ 58.775465] btrfs_relocate_block_group+0x115c/0x1e20 [btrfs] [ 58.775944] btrfs_relocate_chunk+0xf1/0x760 [btrfs] [ 58.776369] __btrfs_balance+0x1326/0x1f10 [btrfs] [ 58.776784] btrfs_balance+0x3150/0x3d30 [btrfs] [ 58.777185] btrfs_ioctl_balance+0xd84/0x1410 [btrfs] [ 58.777621] btrfs_ioctl+0x4caa/0x114e0 [btrfs] ... Reported-by: TOTE Robot CC: stable@vger.kernel.org # 5.15+ Reviewed-by: Sweet Tea Dorminy Reviewed-by: Nikolay Borisov Signed-off-by: Zixuan Fu Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/btrfs/relocation.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -3573,7 +3573,12 @@ int prepare_to_relocate(struct reloc_con */ return PTR_ERR(trans); } - return btrfs_commit_transaction(trans); + + ret =3D btrfs_commit_transaction(trans); + if (ret) + unset_reloc_control(rc); + + return ret; } =20 static noinline_for_stack int relocate_block_group(struct reloc_control *r= c) From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCBA1C38142 for ; Tue, 23 Aug 2022 08:09:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241811AbiHWIJP (ORCPT ); Tue, 23 Aug 2022 04:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241631AbiHWII1 (ORCPT ); Tue, 23 Aug 2022 04:08:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E28B56CD01; Tue, 23 Aug 2022 01:05:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8987A611DD; Tue, 23 Aug 2022 08:05:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BF20C433C1; Tue, 23 Aug 2022 08:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241918; bh=8u3wijuX4ETCv7WV+Sw2MPFZfSqAw8ruOcubsYmUVNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ufgXN2kNhqPSvt//z2dR5B/JrqNbMmTuXl5AqWJNlJKEGA6kxFQPWE5MJrMyoTDBv 1tzK4BwdB+ZOJgmvOvrO3UI95QqCdGagCEH9OM+UsnyM2E0rnZab7JZINrOAbBHsGV c8faVeIMG/ejike7GqObDaHl3jiFDA8aweO+M/IY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boris Burkov , Josef Bacik , David Sterba Subject: [PATCH 5.19 019/365] btrfs: reset RO counter on block group if we fail to relocate Date: Tue, 23 Aug 2022 09:58:40 +0200 Message-Id: <20220823080119.003247301@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josef Bacik commit 74944c873602a3ed8d16ff7af3f64af80c0f9dac upstream. With the automatic block group reclaim code we will preemptively try to mark the block group RO before we start the relocation. We do this to make sure we should actually try to relocate the block group. However if we hit an error during the actual relocation we won't clean up our RO counter and the block group will remain RO. This was observed internally with file systems reporting less space available from df when we had failed background relocations. Fix this by doing the dec_ro in the error case. Fixes: 18bb8bbf13c1 ("btrfs: zoned: automatically reclaim zones") CC: stable@vger.kernel.org # 5.15+ Reviewed-by: Boris Burkov Signed-off-by: Josef Bacik Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/btrfs/block-group.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -1640,9 +1640,11 @@ void btrfs_reclaim_bgs_work(struct work_ div64_u64(zone_unusable * 100, bg->length)); trace_btrfs_reclaim_block_group(bg); ret =3D btrfs_relocate_chunk(fs_info, bg->start); - if (ret) + if (ret) { + btrfs_dec_block_group_ro(bg); btrfs_err(fs_info, "error relocating chunk %llu", bg->start); + } =20 next: btrfs_put_block_group(bg); From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AEEBC3F6B0 for ; Tue, 23 Aug 2022 08:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241831AbiHWIJY (ORCPT ); Tue, 23 Aug 2022 04:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241717AbiHWIIa (ORCPT ); Tue, 23 Aug 2022 04:08:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B05E16CD08; Tue, 23 Aug 2022 01:05:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4B6D2B81C19; Tue, 23 Aug 2022 08:05:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97167C433C1; Tue, 23 Aug 2022 08:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241921; bh=K5ZBDr6BEUr7UZVmEwDVuU96klWoAHjgVnTdnq/iI18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hJTe8YHMgel2QJaVi39l39b+nAali4mApT9MQOZE/2PG5vbzH0ZL0zi4yzPvGakg7 7RJlTmwG8gK2bAd75Buz4IH4ECmUS0i9g82DQ6Bv+RFvisyEV/VQ6YOIzNrts97DBE VhtxG4DuAgfeh0inFjW7dVJs3JgDj8M7EYoT7lBY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , David Sterba Subject: [PATCH 5.19 020/365] btrfs: fix lost error handling when looking up extended ref on log replay Date: Tue, 23 Aug 2022 09:58:41 +0200 Message-Id: <20220823080119.053017011@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Filipe Manana commit 7a6b75b79902e47f46328b57733f2604774fa2d9 upstream. During log replay, when processing inode references, if we get an error when looking up for an extended reference at __add_inode_ref(), we ignore it and proceed, returning success (0) if no other error happens after the lookup. This is obviously wrong because in case an extended reference exists and it encodes some name not in the log, we need to unlink it, otherwise the filesystem state will not match the state it had after the last fsync. So just make __add_inode_ref() return an error it gets from the extended reference lookup. Fixes: f186373fef005c ("btrfs: extended inode refs") CC: stable@vger.kernel.org # 4.9+ Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/btrfs/tree-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -1146,7 +1146,9 @@ again: extref =3D btrfs_lookup_inode_extref(NULL, root, path, name, namelen, inode_objectid, parent_objectid, 0, 0); - if (!IS_ERR_OR_NULL(extref)) { + if (IS_ERR(extref)) { + return PTR_ERR(extref); + } else if (extref) { u32 item_size; u32 cur_offset =3D 0; unsigned long base; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD129C32774 for ; Tue, 23 Aug 2022 08:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241861AbiHWIJh (ORCPT ); Tue, 23 Aug 2022 04:09:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239247AbiHWIIb (ORCPT ); Tue, 23 Aug 2022 04:08:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58B22B865; Tue, 23 Aug 2022 01:05:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C08016125A; Tue, 23 Aug 2022 08:05:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF212C433D6; Tue, 23 Aug 2022 08:05:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241924; bh=w5L1OlnmPe1yAacwsnbfg9eGSD3IF23INkkqT0m3Q7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CK+x471BwzUaqPg5zU/oBCbPBKSozL1/ngCppUgiNaAGIPABNfTY/QczbpxggzZTL okuSlvsgX6Dow/nnQu4NKTZWeIU/PKgzPvo1GbvY8uug2OG6D2pLru3XxDtqK9VF6k HFeYoaq2de5AvT9SIyBF+/4cCoIDEEj9Vrey8TSU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , David Sterba Subject: [PATCH 5.19 021/365] btrfs: fix warning during log replay when bumping inode link count Date: Tue, 23 Aug 2022 09:58:42 +0200 Message-Id: <20220823080119.096900465@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Filipe Manana commit 769030e11847c5412270c0726ff21d3a1f0a3131 upstream. During log replay, at add_link(), we may increment the link count of another inode that has a reference that conflicts with a new reference for the inode currently being processed. During log replay, at add_link(), we may drop (unlink) a reference from some inode in the subvolume tree if that reference conflicts with a new reference found in the log for the inode we are currently processing. After the unlink, If the link count has decreased from 1 to 0, then we increment the link count to prevent the inode from being deleted if it's evicted by an iput() call, because we may have references to add to that inode later on (and we will fixup its link count later during log replay). However incrementing the link count from 0 to 1 triggers a warning: $ cat fs/inode.c (...) void inc_nlink(struct inode *inode) { if (unlikely(inode->i_nlink =3D=3D 0)) { WARN_ON(!(inode->i_state & I_LINKABLE)); atomic_long_dec(&inode->i_sb->s_remove_count); } (...) The I_LINKABLE flag is only set when creating an O_TMPFILE file, so it's never set during log replay. Most of the time, the warning isn't triggered even if we dropped the last reference of the conflicting inode, and this is because: 1) The conflicting inode was previously marked for fixup, through a call to link_to_fixup_dir(), which increments the inode's link count; 2) And the last iput() on the inode has not triggered eviction of the inode, nor was eviction triggered after the iput(). So at add_link(), even if we unlink the last reference of the inode, its link count ends up being 1 and not 0. So this means that if eviction is triggered after link_to_fixup_dir() is called, at add_link() we will read the inode back from the subvolume tree and have it with a correct link count, matching the number of references it has on the subvolume tree. So if when we are at add_link() the inode has exactly one reference only, its link count is 1, and after the unlink its link count becomes 0. So fix this by using set_nlink() instead of inc_nlink(), as the former accepts a transition from 0 to 1 and it's what we use in other similar contexts (like at link_to_fixup_dir(). Also make add_inode_ref() use set_nlink() instead of inc_nlink() to bump the link count from 0 to 1. The warning is actually harmless, but it may scare users. Josef also ran into it recently. CC: stable@vger.kernel.org # 5.1+ Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/btrfs/tree-log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -1459,7 +1459,7 @@ static int add_link(struct btrfs_trans_h * on the inode will not free it. We will fixup the link count later. */ if (other_inode->i_nlink =3D=3D 0) - inc_nlink(other_inode); + set_nlink(other_inode, 1); add_link: ret =3D btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode), name, namelen, 0, ref_index); @@ -1602,7 +1602,7 @@ static noinline int add_inode_ref(struct * free it. We will fixup the link count later. */ if (!ret && inode->i_nlink =3D=3D 0) - inc_nlink(inode); + set_nlink(inode, 1); } if (ret < 0) goto out; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1587C32793 for ; Tue, 23 Aug 2022 08:09:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241883AbiHWIJw (ORCPT ); Tue, 23 Aug 2022 04:09:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240303AbiHWIIk (ORCPT ); Tue, 23 Aug 2022 04:08:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDC116C756; Tue, 23 Aug 2022 01:05:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4FC16B81C22; Tue, 23 Aug 2022 08:05:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B44AAC433C1; Tue, 23 Aug 2022 08:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241930; bh=l1eN8wcRrSyg38twlZ0Z+rSeqA/tyusE2PZXXuhhE18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ThijvhZ8xvPyKoQWA5vrACLBeTwotd9GwcKbpVjR5dWm5LjkCUvKpSWwr1EqWQOgw 6tS7ymsqOpz8IJiq7O2gEqcS5Vc+pYpWNWohC6QWnjyoxzXd0L8KOmcDSKjgCxxYQn Gi+EGFVroUgGoGZkIXtN5rwwAVzJ9IGCZplLsu4I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Likun Gao , Hawking Zhang , Alex Deucher Subject: [PATCH 5.19 022/365] drm/amdgpu: change vram width algorithm for vram_info v3_0 Date: Tue, 23 Aug 2022 09:58:43 +0200 Message-Id: <20220823080119.139942824@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Likun Gao commit 4a0a2cf4c03ba49a4c2596c49c7daa719917d509 upstream. Update the vram width algorithm for vram_info v3_0 to align with the changes of latest IFWI. Signed-off-by: Likun Gao Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 5.19.x Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c b/drivers/gpu= /drm/amd/amdgpu/amdgpu_atomfirmware.c index fd8f3731758e..b81b77a9efa6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c @@ -314,7 +314,7 @@ amdgpu_atomfirmware_get_vram_info(struct amdgpu_device = *adev, mem_channel_number =3D vram_info->v30.channel_num; mem_channel_width =3D vram_info->v30.channel_width; if (vram_width) - *vram_width =3D mem_channel_number * mem_channel_width; + *vram_width =3D mem_channel_number * (1 << mem_channel_width); break; default: return -EINVAL; --=20 2.37.2 From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4050AC32789 for ; Tue, 23 Aug 2022 08:10:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240300AbiHWIKB (ORCPT ); Tue, 23 Aug 2022 04:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240355AbiHWIIl (ORCPT ); Tue, 23 Aug 2022 04:08:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 492906CD12; Tue, 23 Aug 2022 01:05:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D7B1D61257; Tue, 23 Aug 2022 08:05:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0940C433C1; Tue, 23 Aug 2022 08:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241933; bh=J/c8kppYkw5huAqLB5dP5Hv59OTcJ+Akjd0/dqhCAU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FSlv5v1HzYJoiN330X2CtLsdJyjm7gPaFvGK9vXg8vSHKHY0LJEc/wtBpwRBIUU6Q FceAQu69fg0CLJRCmnv7j7w1iicN8vMrAoBYBDgLbatPfIl1wfRUVpp7MoPeEE+0zB Fz0QfVWKPdUsmScT2WTyaZR7ZjqoqIYt1n7qO8bo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Fei Yang , Andi Shyti , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Tvrtko Ursulin , Mauro Carvalho Chehab , Rodrigo Vivi Subject: [PATCH 5.19 023/365] drm/i915/gt: Ignore TLB invalidations on idle engines Date: Tue, 23 Aug 2022 09:58:44 +0200 Message-Id: <20220823080119.189674334@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Wilson commit db100e28fdf026a1fc10657c5170bb1e65663805 upstream. Check if the device is powered down prior to any engine activity, as, on such cases, all the TLBs were already invalidated, so an explicit TLB invalidation is not needed, thus reducing the performance regression impact due to it. This becomes more significant with GuC, as it can only do so when the connection to the GuC is awake. Cc: stable@vger.kernel.org Fixes: 7938d61591d3 ("drm/i915: Flush TLBs before releasing backing store") Signed-off-by: Chris Wilson Cc: Fei Yang Reviewed-by: Andi Shyti Acked-by: Thomas Hellstr=C3=B6m Acked-by: Tvrtko Ursulin Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andi Shyti Link: https://patchwork.freedesktop.org/patch/msgid/278a57a672edac75683f081= 8b292e95da583a5fe.1658924372.git.mchehab@kernel.org (cherry picked from commit 4bedceaed1ae1172cfe72d3ff752b3a1d32fe4d9) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 10 ++++++---- drivers/gpu/drm/i915/gt/intel_gt.c | 17 ++++++++++------- drivers/gpu/drm/i915/gt/intel_gt_pm.h | 3 +++ 3 files changed, 19 insertions(+), 11 deletions(-) --- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c @@ -6,14 +6,15 @@ =20 #include =20 +#include "gt/intel_gt.h" +#include "gt/intel_gt_pm.h" + #include "i915_drv.h" #include "i915_gem_object.h" #include "i915_scatterlist.h" #include "i915_gem_lmem.h" #include "i915_gem_mman.h" =20 -#include "gt/intel_gt.h" - void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj, struct sg_table *pages, unsigned int sg_page_sizes) @@ -217,10 +218,11 @@ __i915_gem_object_unset_pages(struct drm =20 if (test_and_clear_bit(I915_BO_WAS_BOUND_BIT, &obj->flags)) { struct drm_i915_private *i915 =3D to_i915(obj->base.dev); + struct intel_gt *gt =3D to_gt(i915); intel_wakeref_t wakeref; =20 - with_intel_runtime_pm_if_active(&i915->runtime_pm, wakeref) - intel_gt_invalidate_tlbs(to_gt(i915)); + with_intel_gt_pm_if_awake(gt, wakeref) + intel_gt_invalidate_tlbs(gt); } =20 return pages; --- a/drivers/gpu/drm/i915/gt/intel_gt.c +++ b/drivers/gpu/drm/i915/gt/intel_gt.c @@ -11,6 +11,7 @@ =20 #include "i915_drv.h" #include "intel_context.h" +#include "intel_engine_pm.h" #include "intel_engine_regs.h" #include "intel_gt.h" #include "intel_gt_buffer_pool.h" @@ -1181,6 +1182,7 @@ void intel_gt_invalidate_tlbs(struct int struct drm_i915_private *i915 =3D gt->i915; struct intel_uncore *uncore =3D gt->uncore; struct intel_engine_cs *engine; + intel_engine_mask_t awake, tmp; enum intel_engine_id id; const i915_reg_t *regs; unsigned int num =3D 0; @@ -1204,26 +1206,31 @@ void intel_gt_invalidate_tlbs(struct int =20 GEM_TRACE("\n"); =20 - assert_rpm_wakelock_held(&i915->runtime_pm); - mutex_lock(>->tlb_invalidate_lock); intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL); =20 spin_lock_irq(&uncore->lock); /* serialise invalidate with GT reset */ =20 + awake =3D 0; for_each_engine(engine, gt, id) { struct reg_and_bit rb; =20 + if (!intel_engine_pm_is_awake(engine)) + continue; + rb =3D get_reg_and_bit(engine, regs =3D=3D gen8_regs, regs, num); if (!i915_mmio_reg_offset(rb.reg)) continue; =20 intel_uncore_write_fw(uncore, rb.reg, rb.bit); + awake |=3D engine->mask; } =20 spin_unlock_irq(&uncore->lock); =20 - for_each_engine(engine, gt, id) { + for_each_engine_masked(engine, gt, awake, tmp) { + struct reg_and_bit rb; + /* * HW architecture suggest typical invalidation time at 40us, * with pessimistic cases up to 100us and a recommendation to @@ -1231,12 +1238,8 @@ void intel_gt_invalidate_tlbs(struct int */ const unsigned int timeout_us =3D 100; const unsigned int timeout_ms =3D 4; - struct reg_and_bit rb; =20 rb =3D get_reg_and_bit(engine, regs =3D=3D gen8_regs, regs, num); - if (!i915_mmio_reg_offset(rb.reg)) - continue; - if (__intel_wait_for_register_fw(uncore, rb.reg, rb.bit, 0, timeout_us, timeout_ms, --- a/drivers/gpu/drm/i915/gt/intel_gt_pm.h +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.h @@ -55,6 +55,9 @@ static inline void intel_gt_pm_might_put for (tmp =3D 1, intel_gt_pm_get(gt); tmp; \ intel_gt_pm_put(gt), tmp =3D 0) =20 +#define with_intel_gt_pm_if_awake(gt, wf) \ + for (wf =3D intel_gt_pm_get_if_awake(gt); wf; intel_gt_pm_put_async(gt), = wf =3D 0) + static inline int intel_gt_pm_wait_for_idle(struct intel_gt *gt) { return intel_wakeref_wait_for_idle(>->wakeref); From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFD92C32796 for ; Tue, 23 Aug 2022 08:16:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242340AbiHWIQu (ORCPT ); Tue, 23 Aug 2022 04:16:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241727AbiHWIIn (ORCPT ); Tue, 23 Aug 2022 04:08:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6ED46CD15; Tue, 23 Aug 2022 01:05:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D4FF96125F; Tue, 23 Aug 2022 08:05:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCF17C433C1; Tue, 23 Aug 2022 08:05:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241936; bh=iHvtYGx2k0tmFDF8LrNw08O4l4O2vAl+C+agfuDg9n8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FGoc9jARXHkvE6mAgHAliQy8uNmKxsxf2NhpCwcQYyVhW6apATpGTSWlfZ4S/k5PV 0dVFx9LYVwmB/a9dlblg62lubnk4rllzCQWFtjFuj8B+acwobKln4DnnXiG/XWh86m Tl/yBqQFzCD9nj8YcoTaInLiYfYKzIuEyb4f59vM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Fei Yang , Andi Shyti , Tvrtko Ursulin , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Mauro Carvalho Chehab , Rodrigo Vivi Subject: [PATCH 5.19 024/365] drm/i915/gt: Invalidate TLB of the OA unit at TLB invalidations Date: Tue, 23 Aug 2022 09:58:45 +0200 Message-Id: <20220823080119.230710305@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Wilson commit 180abeb2c5032704787151135b6a38c6b71295a6 upstream. Ensure that the TLB of the OA unit is also invalidated on gen12 HW, as just invalidating the TLB of an engine is not enough. Cc: stable@vger.kernel.org Fixes: 7938d61591d3 ("drm/i915: Flush TLBs before releasing backing store") Signed-off-by: Chris Wilson Cc: Fei Yang Reviewed-by: Andi Shyti Acked-by: Tvrtko Ursulin Acked-by: Thomas Hellstr=C3=B6m Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andi Shyti Link: https://patchwork.freedesktop.org/patch/msgid/59724d9f5cf1e93b1620d01= b8332ac991555283d.1658924372.git.mchehab@kernel.org (cherry picked from commit dfc83de118ff7930acc9a4c8dfdba7c153aa44d6) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/i915/gt/intel_gt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/gpu/drm/i915/gt/intel_gt.c +++ b/drivers/gpu/drm/i915/gt/intel_gt.c @@ -10,6 +10,7 @@ #include "pxp/intel_pxp.h" =20 #include "i915_drv.h" +#include "i915_perf_oa_regs.h" #include "intel_context.h" #include "intel_engine_pm.h" #include "intel_engine_regs.h" @@ -1226,6 +1227,15 @@ void intel_gt_invalidate_tlbs(struct int awake |=3D engine->mask; } =20 + /* Wa_2207587034:tgl,dg1,rkl,adl-s,adl-p */ + if (awake && + (IS_TIGERLAKE(i915) || + IS_DG1(i915) || + IS_ROCKETLAKE(i915) || + IS_ALDERLAKE_S(i915) || + IS_ALDERLAKE_P(i915))) + intel_uncore_write_fw(uncore, GEN12_OA_TLB_INV_CR, 1); + spin_unlock_irq(&uncore->lock); =20 for_each_engine_masked(engine, gt, awake, tmp) { From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17511C32774 for ; Tue, 23 Aug 2022 08:09:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241864AbiHWIJk (ORCPT ); Tue, 23 Aug 2022 04:09:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240089AbiHWIIi (ORCPT ); Tue, 23 Aug 2022 04:08:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 867EA2F3B9; Tue, 23 Aug 2022 01:05:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64972B81C20; Tue, 23 Aug 2022 08:05:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6126C433D6; Tue, 23 Aug 2022 08:05:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241939; bh=cf9BwUvZvDQMwkdXe0mV+IKj6xyH7BXJvPveNDCzud8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vVplw9goX3xMY7LwuEN+jSjxJRgke+Mg/xmc/PjNhcGWgtEoOjGG8VWlUK2iyZci3 FHsU/ZDuHryqCt9lYr9UNJREuJZ7QaIEM8cMj/59ldp6VabrxYt+VPGS+cJuvcvCSg HpyvFyrtTELBYWrT96k8DQ+O6ki6p7pv9rwSv1ig= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Fei Yang , Tvrtko Ursulin , Andi Shyti , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Mauro Carvalho Chehab , Rodrigo Vivi Subject: [PATCH 5.19 025/365] drm/i915/gt: Skip TLB invalidations once wedged Date: Tue, 23 Aug 2022 09:58:46 +0200 Message-Id: <20220823080119.270557694@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Wilson commit e5a95c83ed1492c0f442b448b20c90c8faaf702b upstream. Skip all further TLB invalidations once the device is wedged and had been reset, as, on such cases, it can no longer process instructions on the GPU and the user no longer has access to the TLB's in each engine. So, an attempt to do a TLB cache invalidation will produce a timeout. That helps to reduce the performance regression introduced by TLB invalidate logic. Cc: stable@vger.kernel.org Fixes: 7938d61591d3 ("drm/i915: Flush TLBs before releasing backing store") Signed-off-by: Chris Wilson Cc: Fei Yang Cc: Tvrtko Ursulin Reviewed-by: Andi Shyti Acked-by: Thomas Hellstr=C3=B6m Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andi Shyti Link: https://patchwork.freedesktop.org/patch/msgid/5aa86564b9ec5fe7fe605c1= dd7de76855401ed73.1658924372.git.mchehab@kernel.org (cherry picked from commit be0366f168033374a93e4c43fdaa1a90ab905184) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/i915/gt/intel_gt.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/gpu/drm/i915/gt/intel_gt.c +++ b/drivers/gpu/drm/i915/gt/intel_gt.c @@ -1191,6 +1191,9 @@ void intel_gt_invalidate_tlbs(struct int if (I915_SELFTEST_ONLY(gt->awake =3D=3D -ENODEV)) return; =20 + if (intel_gt_is_wedged(gt)) + return; + if (GRAPHICS_VER(i915) =3D=3D 12) { regs =3D gen12_regs; num =3D ARRAY_SIZE(gen12_regs); From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2679CC32789 for ; Tue, 23 Aug 2022 08:16:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242277AbiHWIQm (ORCPT ); Tue, 23 Aug 2022 04:16:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241748AbiHWIIn (ORCPT ); Tue, 23 Aug 2022 04:08:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D0226C74B; Tue, 23 Aug 2022 01:05:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 75248B81C18; Tue, 23 Aug 2022 08:05:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 940A2C433D6; Tue, 23 Aug 2022 08:05:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241942; bh=Lds7mecDpSDg3Iwyz9JG5lbf4JiGoT1Gn2QudKzMUM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BzpWg+EDvQ9Dxh5evioohjZE8T2lpZDnFn/KhmDMeFihr34RZqKdT79ctq6KsH6KG Uz7w1xI7h3LeO2Smnu9G189LGcvIg38NvAdm3AxI0Oi+h9NQYZEP0SQNTrv5r63A/k SotcM1yCAWRQhY7PFwgX96uOb9gNjQSibh/nWqc8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tvrtko Ursulin , Chris Wilson , Fei Yang , Mauro Carvalho Chehab , Andi Shyti , Rodrigo Vivi Subject: [PATCH 5.19 026/365] drm/i915/gt: Batch TLB invalidations Date: Tue, 23 Aug 2022 09:58:47 +0200 Message-Id: <20220823080119.318528504@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chris Wilson commit 59eda6ce824e95b98c45628fe6c0adb9130c6df2 upstream. Invalidate TLB in batches, in order to reduce performance regressions. Currently, every caller performs a full barrier around a TLB invalidation, ignoring all other invalidations that may have already removed their PTEs from the cache. As this is a synchronous operation and can be quite slow, we cause multiple threads to contend on the TLB invalidate mutex blocking userspace. We only need to invalidate the TLB once after replacing our PTE to ensure that there is no possible continued access to the physical address before releasing our pages. By tracking a seqno for each full TLB invalidate we can quickly determine if one has been performed since rewriting the PTE, and only if necessary trigger one for ourselves. That helps to reduce the performance regression introduced by TLB invalidate logic. [mchehab: rebased to not require moving the code to a separate file] Cc: stable@vger.kernel.org Fixes: 7938d61591d3 ("drm/i915: Flush TLBs before releasing backing store") Suggested-by: Tvrtko Ursulin Signed-off-by: Chris Wilson Cc: Fei Yang Signed-off-by: Mauro Carvalho Chehab Acked-by: Tvrtko Ursulin Reviewed-by: Andi Shyti Signed-off-by: Andi Shyti Link: https://patchwork.freedesktop.org/patch/msgid/4e97ef5deb6739cadaaf40a= a45620547e9c4ec06.1658924372.git.mchehab@kernel.org (cherry picked from commit 5d36acb7198b0e5eb88e6b701f9ad7b9448f8df9) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/i915/gem/i915_gem_object_types.h | 3 - drivers/gpu/drm/i915/gem/i915_gem_pages.c | 21 +++++---- drivers/gpu/drm/i915/gt/intel_gt.c | 53 +++++++++++++++++-= ----- drivers/gpu/drm/i915/gt/intel_gt.h | 12 ++++- drivers/gpu/drm/i915/gt/intel_gt_types.h | 18 +++++++ drivers/gpu/drm/i915/gt/intel_ppgtt.c | 8 ++- drivers/gpu/drm/i915/i915_vma.c | 33 +++++++++++--- drivers/gpu/drm/i915/i915_vma.h | 1=20 drivers/gpu/drm/i915/i915_vma_resource.c | 5 +- drivers/gpu/drm/i915/i915_vma_resource.h | 6 ++ 10 files changed, 125 insertions(+), 35 deletions(-) --- a/drivers/gpu/drm/i915/gem/i915_gem_object_types.h +++ b/drivers/gpu/drm/i915/gem/i915_gem_object_types.h @@ -335,7 +335,6 @@ struct drm_i915_gem_object { #define I915_BO_READONLY BIT(7) #define I915_TILING_QUIRK_BIT 8 /* unknown swizzling; do not release! = */ #define I915_BO_PROTECTED BIT(9) -#define I915_BO_WAS_BOUND_BIT 10 /** * @mem_flags - Mutable placement-related flags * @@ -598,6 +597,8 @@ struct drm_i915_gem_object { * pages were last acquired. */ bool dirty:1; + + u32 tlb; } mm; =20 struct { --- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c @@ -191,6 +191,18 @@ static void unmap_object(struct drm_i915 vunmap(ptr); } =20 +static void flush_tlb_invalidate(struct drm_i915_gem_object *obj) +{ + struct drm_i915_private *i915 =3D to_i915(obj->base.dev); + struct intel_gt *gt =3D to_gt(i915); + + if (!obj->mm.tlb) + return; + + intel_gt_invalidate_tlb(gt, obj->mm.tlb); + obj->mm.tlb =3D 0; +} + struct sg_table * __i915_gem_object_unset_pages(struct drm_i915_gem_object *obj) { @@ -216,14 +228,7 @@ __i915_gem_object_unset_pages(struct drm __i915_gem_object_reset_page_iter(obj); obj->mm.page_sizes.phys =3D obj->mm.page_sizes.sg =3D 0; =20 - if (test_and_clear_bit(I915_BO_WAS_BOUND_BIT, &obj->flags)) { - struct drm_i915_private *i915 =3D to_i915(obj->base.dev); - struct intel_gt *gt =3D to_gt(i915); - intel_wakeref_t wakeref; - - with_intel_gt_pm_if_awake(gt, wakeref) - intel_gt_invalidate_tlbs(gt); - } + flush_tlb_invalidate(obj); =20 return pages; } --- a/drivers/gpu/drm/i915/gt/intel_gt.c +++ b/drivers/gpu/drm/i915/gt/intel_gt.c @@ -36,8 +36,6 @@ static void __intel_gt_init_early(struct { spin_lock_init(>->irq_lock); =20 - mutex_init(>->tlb_invalidate_lock); - INIT_LIST_HEAD(>->closed_vma); spin_lock_init(>->closed_lock); =20 @@ -48,6 +46,8 @@ static void __intel_gt_init_early(struct intel_gt_init_reset(gt); intel_gt_init_requests(gt); intel_gt_init_timelines(gt); + mutex_init(>->tlb.invalidate_lock); + seqcount_mutex_init(>->tlb.seqno, >->tlb.invalidate_lock); intel_gt_pm_init_early(gt); =20 intel_uc_init_early(>->uc); @@ -833,6 +833,7 @@ void intel_gt_driver_late_release_all(st intel_gt_fini_requests(gt); intel_gt_fini_reset(gt); intel_gt_fini_timelines(gt); + mutex_destroy(>->tlb.invalidate_lock); intel_engines_free(gt); } } @@ -1165,7 +1166,7 @@ get_reg_and_bit(const struct intel_engin return rb; } =20 -void intel_gt_invalidate_tlbs(struct intel_gt *gt) +static void mmio_invalidate_full(struct intel_gt *gt) { static const i915_reg_t gen8_regs[] =3D { [RENDER_CLASS] =3D GEN8_RTCR, @@ -1188,12 +1189,6 @@ void intel_gt_invalidate_tlbs(struct int const i915_reg_t *regs; unsigned int num =3D 0; =20 - if (I915_SELFTEST_ONLY(gt->awake =3D=3D -ENODEV)) - return; - - if (intel_gt_is_wedged(gt)) - return; - if (GRAPHICS_VER(i915) =3D=3D 12) { regs =3D gen12_regs; num =3D ARRAY_SIZE(gen12_regs); @@ -1208,9 +1203,6 @@ void intel_gt_invalidate_tlbs(struct int "Platform does not implement TLB invalidation!")) return; =20 - GEM_TRACE("\n"); - - mutex_lock(>->tlb_invalidate_lock); intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL); =20 spin_lock_irq(&uncore->lock); /* serialise invalidate with GT reset */ @@ -1230,6 +1222,8 @@ void intel_gt_invalidate_tlbs(struct int awake |=3D engine->mask; } =20 + GT_TRACE(gt, "invalidated engines %08x\n", awake); + /* Wa_2207587034:tgl,dg1,rkl,adl-s,adl-p */ if (awake && (IS_TIGERLAKE(i915) || @@ -1269,5 +1263,38 @@ void intel_gt_invalidate_tlbs(struct int * transitions. */ intel_uncore_forcewake_put_delayed(uncore, FORCEWAKE_ALL); - mutex_unlock(>->tlb_invalidate_lock); +} + +static bool tlb_seqno_passed(const struct intel_gt *gt, u32 seqno) +{ + u32 cur =3D intel_gt_tlb_seqno(gt); + + /* Only skip if a *full* TLB invalidate barrier has passed */ + return (s32)(cur - ALIGN(seqno, 2)) > 0; +} + +void intel_gt_invalidate_tlb(struct intel_gt *gt, u32 seqno) +{ + intel_wakeref_t wakeref; + + if (I915_SELFTEST_ONLY(gt->awake =3D=3D -ENODEV)) + return; + + if (intel_gt_is_wedged(gt)) + return; + + if (tlb_seqno_passed(gt, seqno)) + return; + + with_intel_gt_pm_if_awake(gt, wakeref) { + mutex_lock(>->tlb.invalidate_lock); + if (tlb_seqno_passed(gt, seqno)) + goto unlock; + + mmio_invalidate_full(gt); + + write_seqcount_invalidate(>->tlb.seqno); +unlock: + mutex_unlock(>->tlb.invalidate_lock); + } } --- a/drivers/gpu/drm/i915/gt/intel_gt.h +++ b/drivers/gpu/drm/i915/gt/intel_gt.h @@ -123,7 +123,17 @@ void intel_gt_info_print(const struct in =20 void intel_gt_watchdog_work(struct work_struct *work); =20 -void intel_gt_invalidate_tlbs(struct intel_gt *gt); +static inline u32 intel_gt_tlb_seqno(const struct intel_gt *gt) +{ + return seqprop_sequence(>->tlb.seqno); +} + +static inline u32 intel_gt_next_invalidate_tlb_full(const struct intel_gt = *gt) +{ + return intel_gt_tlb_seqno(gt) | 1; +} + +void intel_gt_invalidate_tlb(struct intel_gt *gt, u32 seqno); =20 struct resource intel_pci_resource(struct pci_dev *pdev, int bar); =20 --- a/drivers/gpu/drm/i915/gt/intel_gt_types.h +++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -76,7 +77,22 @@ struct intel_gt { struct intel_uc uc; struct intel_gsc gsc; =20 - struct mutex tlb_invalidate_lock; + struct { + /* Serialize global tlb invalidations */ + struct mutex invalidate_lock; + + /* + * Batch TLB invalidations + * + * After unbinding the PTE, we need to ensure the TLB + * are invalidated prior to releasing the physical pages. + * But we only need one such invalidation for all unbinds, + * so we track how many TLB invalidations have been + * performed since unbind the PTE and only emit an extra + * invalidate if no full barrier has been passed. + */ + seqcount_mutex_t seqno; + } tlb; =20 struct i915_wa_list wa_list; =20 --- a/drivers/gpu/drm/i915/gt/intel_ppgtt.c +++ b/drivers/gpu/drm/i915/gt/intel_ppgtt.c @@ -206,8 +206,12 @@ void ppgtt_bind_vma(struct i915_address_ void ppgtt_unbind_vma(struct i915_address_space *vm, struct i915_vma_resource *vma_res) { - if (vma_res->allocated) - vm->clear_range(vm, vma_res->start, vma_res->vma_size); + if (!vma_res->allocated) + return; + + vm->clear_range(vm, vma_res->start, vma_res->vma_size); + if (vma_res->tlb) + vma_invalidate_tlb(vm, *vma_res->tlb); } =20 static unsigned long pd_count(u64 size, int shift) --- a/drivers/gpu/drm/i915/i915_vma.c +++ b/drivers/gpu/drm/i915/i915_vma.c @@ -537,8 +537,6 @@ int i915_vma_bind(struct i915_vma *vma, bind_flags); } =20 - set_bit(I915_BO_WAS_BOUND_BIT, &vma->obj->flags); - atomic_or(bind_flags, &vma->flags); return 0; } @@ -1301,6 +1299,19 @@ err_unpin: return err; } =20 +void vma_invalidate_tlb(struct i915_address_space *vm, u32 tlb) +{ + /* + * Before we release the pages that were bound by this vma, we + * must invalidate all the TLBs that may still have a reference + * back to our physical address. It only needs to be done once, + * so after updating the PTE to point away from the pages, record + * the most recent TLB invalidation seqno, and if we have not yet + * flushed the TLBs upon release, perform a full invalidation. + */ + WRITE_ONCE(tlb, intel_gt_next_invalidate_tlb_full(vm->gt)); +} + static void __vma_put_pages(struct i915_vma *vma, unsigned int count) { /* We allocate under vma_get_pages, so beware the shrinker */ @@ -1927,7 +1938,12 @@ struct dma_fence *__i915_vma_evict(struc vma->vm->skip_pte_rewrite; trace_i915_vma_unbind(vma); =20 - unbind_fence =3D i915_vma_resource_unbind(vma_res); + if (async) + unbind_fence =3D i915_vma_resource_unbind(vma_res, + &vma->obj->mm.tlb); + else + unbind_fence =3D i915_vma_resource_unbind(vma_res, NULL); + vma->resource =3D NULL; =20 atomic_and(~(I915_VMA_BIND_MASK | I915_VMA_ERROR | I915_VMA_GGTT_WRITE), @@ -1935,10 +1951,13 @@ struct dma_fence *__i915_vma_evict(struc =20 i915_vma_detach(vma); =20 - if (!async && unbind_fence) { - dma_fence_wait(unbind_fence, false); - dma_fence_put(unbind_fence); - unbind_fence =3D NULL; + if (!async) { + if (unbind_fence) { + dma_fence_wait(unbind_fence, false); + dma_fence_put(unbind_fence); + unbind_fence =3D NULL; + } + vma_invalidate_tlb(vma->vm, vma->obj->mm.tlb); } =20 /* --- a/drivers/gpu/drm/i915/i915_vma.h +++ b/drivers/gpu/drm/i915/i915_vma.h @@ -213,6 +213,7 @@ bool i915_vma_misplaced(const struct i91 u64 size, u64 alignment, u64 flags); void __i915_vma_set_map_and_fenceable(struct i915_vma *vma); void i915_vma_revoke_mmap(struct i915_vma *vma); +void vma_invalidate_tlb(struct i915_address_space *vm, u32 tlb); struct dma_fence *__i915_vma_evict(struct i915_vma *vma, bool async); int __i915_vma_unbind(struct i915_vma *vma); int __must_check i915_vma_unbind(struct i915_vma *vma); --- a/drivers/gpu/drm/i915/i915_vma_resource.c +++ b/drivers/gpu/drm/i915/i915_vma_resource.c @@ -223,10 +223,13 @@ i915_vma_resource_fence_notify(struct i9 * Return: A refcounted pointer to a dma-fence that signals when unbinding= is * complete. */ -struct dma_fence *i915_vma_resource_unbind(struct i915_vma_resource *vma_r= es) +struct dma_fence *i915_vma_resource_unbind(struct i915_vma_resource *vma_r= es, + u32 *tlb) { struct i915_address_space *vm =3D vma_res->vm; =20 + vma_res->tlb =3D tlb; + /* Reference for the sw fence */ i915_vma_resource_get(vma_res); =20 --- a/drivers/gpu/drm/i915/i915_vma_resource.h +++ b/drivers/gpu/drm/i915/i915_vma_resource.h @@ -67,6 +67,7 @@ struct i915_page_sizes { * taken when the unbind is scheduled. * @skip_pte_rewrite: During ggtt suspend and vm takedown pte rewriting * needs to be skipped for unbind. + * @tlb: pointer for obj->mm.tlb, if async unbind. Otherwise, NULL * * The lifetime of a struct i915_vma_resource is from a binding request to * the actual possible asynchronous unbind has completed. @@ -119,6 +120,8 @@ struct i915_vma_resource { bool immediate_unbind:1; bool needs_wakeref:1; bool skip_pte_rewrite:1; + + u32 *tlb; }; =20 bool i915_vma_resource_hold(struct i915_vma_resource *vma_res, @@ -131,7 +134,8 @@ struct i915_vma_resource *i915_vma_resou =20 void i915_vma_resource_free(struct i915_vma_resource *vma_res); =20 -struct dma_fence *i915_vma_resource_unbind(struct i915_vma_resource *vma_r= es); +struct dma_fence *i915_vma_resource_unbind(struct i915_vma_resource *vma_r= es, + u32 *tlb); =20 void __i915_vma_resource_init(struct i915_vma_resource *vma_res); From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B19DAC32774 for ; Tue, 23 Aug 2022 08:09:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241891AbiHWIJz (ORCPT ); Tue, 23 Aug 2022 04:09:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241762AbiHWIIo (ORCPT ); Tue, 23 Aug 2022 04:08:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BCFD6CD1B; Tue, 23 Aug 2022 01:05:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C078C6125B; Tue, 23 Aug 2022 08:05:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C702CC433D6; Tue, 23 Aug 2022 08:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241945; bh=vPttWHwZ7d8rvMxwJVsMNnxWY2g5BGdw+mCCof3zh+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cJ00gEk+7Vk77pi+lVxxpRd7QwUkBX6I/tpmIa6z+O0MS8NB8Yeexv8idBleGPlci tozLP7T24QECVVsot+S8FM3N0bdBkda3+AdXIEdcFxJCJDGBUzdZkLoLnI+Sl/F9ax YtIBMnSn+WQnVMUwX84rqLhFibYx6ovagTykLH2g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab , Andi Shyti , Rodrigo Vivi Subject: [PATCH 5.19 027/365] drm/i915: pass a pointer for tlb seqno at vma_invalidate_tlb() Date: Tue, 23 Aug 2022 09:58:48 +0200 Message-Id: <20220823080119.367414148@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mauro Carvalho Chehab commit 9d50bff40e3e366886ec37299fc317edf84be0c9 upstream. WRITE_ONCE() should happen at the original var, not on a local copy of it. Cc: stable@vger.kernel.org Fixes: 59eda6ce824e ("drm/i915/gt: Batch TLB invalidations") Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Andi Shyti Signed-off-by: Rodrigo Vivi [added cc-stable while merging it] Link: https://patchwork.freedesktop.org/patch/msgid/f9550e6bacea10131ff40dd= 8981b69eb9251cdcd.1659598090.git.mchehab@kernel.org (cherry picked from commit 3d037d99e61a1e7a3ae3d214146d88db349dd19f) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/i915/gt/intel_ppgtt.c | 2 +- drivers/gpu/drm/i915/i915_vma.c | 6 +++--- drivers/gpu/drm/i915/i915_vma.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) --- a/drivers/gpu/drm/i915/gt/intel_ppgtt.c +++ b/drivers/gpu/drm/i915/gt/intel_ppgtt.c @@ -211,7 +211,7 @@ void ppgtt_unbind_vma(struct i915_addres =20 vm->clear_range(vm, vma_res->start, vma_res->vma_size); if (vma_res->tlb) - vma_invalidate_tlb(vm, *vma_res->tlb); + vma_invalidate_tlb(vm, vma_res->tlb); } =20 static unsigned long pd_count(u64 size, int shift) --- a/drivers/gpu/drm/i915/i915_vma.c +++ b/drivers/gpu/drm/i915/i915_vma.c @@ -1299,7 +1299,7 @@ err_unpin: return err; } =20 -void vma_invalidate_tlb(struct i915_address_space *vm, u32 tlb) +void vma_invalidate_tlb(struct i915_address_space *vm, u32 *tlb) { /* * Before we release the pages that were bound by this vma, we @@ -1309,7 +1309,7 @@ void vma_invalidate_tlb(struct i915_addr * the most recent TLB invalidation seqno, and if we have not yet * flushed the TLBs upon release, perform a full invalidation. */ - WRITE_ONCE(tlb, intel_gt_next_invalidate_tlb_full(vm->gt)); + WRITE_ONCE(*tlb, intel_gt_next_invalidate_tlb_full(vm->gt)); } =20 static void __vma_put_pages(struct i915_vma *vma, unsigned int count) @@ -1957,7 +1957,7 @@ struct dma_fence *__i915_vma_evict(struc dma_fence_put(unbind_fence); unbind_fence =3D NULL; } - vma_invalidate_tlb(vma->vm, vma->obj->mm.tlb); + vma_invalidate_tlb(vma->vm, &vma->obj->mm.tlb); } =20 /* --- a/drivers/gpu/drm/i915/i915_vma.h +++ b/drivers/gpu/drm/i915/i915_vma.h @@ -213,7 +213,7 @@ bool i915_vma_misplaced(const struct i91 u64 size, u64 alignment, u64 flags); void __i915_vma_set_map_and_fenceable(struct i915_vma *vma); void i915_vma_revoke_mmap(struct i915_vma *vma); -void vma_invalidate_tlb(struct i915_address_space *vm, u32 tlb); +void vma_invalidate_tlb(struct i915_address_space *vm, u32 *tlb); struct dma_fence *__i915_vma_evict(struct i915_vma *vma, bool async); int __i915_vma_unbind(struct i915_vma *vma); int __must_check i915_vma_unbind(struct i915_vma *vma); From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 151F5C32774 for ; Tue, 23 Aug 2022 08:10:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241925AbiHWIKJ (ORCPT ); Tue, 23 Aug 2022 04:10:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241784AbiHWIJK (ORCPT ); Tue, 23 Aug 2022 04:09:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC18B19009; Tue, 23 Aug 2022 01:05:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 854B26123D; Tue, 23 Aug 2022 08:05:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F632C433D6; Tue, 23 Aug 2022 08:05:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241947; bh=81egiymmXjie7ZfHht3gdCJoD5Cj2oCSFmSjn1h7CzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mD7lzOGZqst8fHB1ekQXgyuhzbJjlYm77FdkvdA7jp3IAaD2bYtq/JDf36s7YXMad J6GmQLzARCggrjvndDapZu/YKMDSTjBktQTDpw/LrnBoDoQ0ruN4yvdMSvfUjb0fh1 cNsXVktbRxFkPQ5wPaql82eZqF5Uo+lk8D/CYje0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shyam Prasad N , Zhang Xiaoxu , Steve French Subject: [PATCH 5.19 028/365] cifs: Fix memory leak on the deferred close Date: Tue, 23 Aug 2022 09:58:49 +0200 Message-Id: <20220823080119.402472666@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Xiaoxu commit ca08d0eac020d48a3141dbec0a3cf64fbdb17cde upstream. xfstests on smb21 report kmemleak as below: unreferenced object 0xffff8881767d6200 (size 64): comm "xfs_io", pid 1284, jiffies 4294777434 (age 20.789s) hex dump (first 32 bytes): 80 5a d0 11 81 88 ff ff 78 8a aa 63 81 88 ff ff .Z......x..c.... 00 71 99 76 81 88 ff ff 00 00 00 00 00 00 00 00 .q.v............ backtrace: [<00000000ad04e6ea>] cifs_close+0x92/0x2c0 [<0000000028b93c82>] __fput+0xff/0x3f0 [<00000000d8116851>] task_work_run+0x85/0xc0 [<0000000027e14f9e>] do_exit+0x5e5/0x1240 [<00000000fb492b95>] do_group_exit+0x58/0xe0 [<00000000129a32d9>] __x64_sys_exit_group+0x28/0x30 [<00000000e3f7d8e9>] do_syscall_64+0x35/0x80 [<00000000102e8a0b>] entry_SYSCALL_64_after_hwframe+0x46/0xb0 When cancel the deferred close work, we should also cleanup the struct cifs_deferred_close. Fixes: 9e992755be8f2 ("cifs: Call close synchronously during unlink/rename/= lease break.") Fixes: e3fc065682ebb ("cifs: Deferred close performance improvements") Cc: stable@vger.kernel.org Reviewed-by: Shyam Prasad N Signed-off-by: Zhang Xiaoxu Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/cifs/misc.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -742,6 +742,8 @@ cifs_close_deferred_file(struct cifsInod list_for_each_entry(cfile, &cifs_inode->openFileList, flist) { if (delayed_work_pending(&cfile->deferred)) { if (cancel_delayed_work(&cfile->deferred)) { + cifs_del_deferred_close(cfile); + tmp_list =3D kmalloc(sizeof(struct file_list), GFP_ATOMIC); if (tmp_list =3D=3D NULL) break; @@ -773,6 +775,8 @@ cifs_close_all_deferred_files(struct cif cfile =3D list_entry(tmp, struct cifsFileInfo, tlist); if (delayed_work_pending(&cfile->deferred)) { if (cancel_delayed_work(&cfile->deferred)) { + cifs_del_deferred_close(cfile); + tmp_list =3D kmalloc(sizeof(struct file_list), GFP_ATOMIC); if (tmp_list =3D=3D NULL) break; @@ -808,6 +812,8 @@ cifs_close_deferred_file_under_dentry(st if (strstr(full_path, path)) { if (delayed_work_pending(&cfile->deferred)) { if (cancel_delayed_work(&cfile->deferred)) { + cifs_del_deferred_close(cfile); + tmp_list =3D kmalloc(sizeof(struct file_list), GFP_ATOMIC); if (tmp_list =3D=3D NULL) break; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE774C32774 for ; Tue, 23 Aug 2022 08:10:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241631AbiHWIKD (ORCPT ); Tue, 23 Aug 2022 04:10:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241786AbiHWIJK (ORCPT ); Tue, 23 Aug 2022 04:09:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C359025297; Tue, 23 Aug 2022 01:05:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 618276120C; Tue, 23 Aug 2022 08:05:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 675C9C433D6; Tue, 23 Aug 2022 08:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241950; bh=z2eqEAy2YCsxPCM2q4yt8xA1EtQe9IzemHCCZT7Vw1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tKSRtIlxqyBpI9gLE1diyzvqf6ZgdTBEnTcOOI8IeKSVCEqCjxpSOS8sFgg4XMeWY lIAitWQtiLC+NWkTECdVxapfzRUT4JfAOUYIUlMv4q1HZ8CWGzTgpIjkbwiioCPTNL uH10a1JI+OCXD1Y292wZmXXIPFHj7N4wFprO7YC0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nadav Amit , Ingo Molnar Subject: [PATCH 5.19 029/365] x86/kprobes: Fix JNG/JNLE emulation Date: Tue, 23 Aug 2022 09:58:50 +0200 Message-Id: <20220823080119.434870980@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nadav Amit commit 8924779df820c53875abaeb10c648e9cb75b46d4 upstream. When kprobes emulates JNG/JNLE instructions on x86 it uses the wrong condition. For JNG (opcode: 0F 8E), according to Intel SDM, the jump is performed if (ZF =3D=3D 1 or SF !=3D OF). However the kernel emulation currently uses 'and' instead of 'or'. As a result, setting a kprobe on JNG/JNLE might cause the kernel to behave incorrectly whenever the kprobe is hit. Fix by changing the 'and' to 'or'. Fixes: 6256e668b7af ("x86/kprobes: Use int3 instead of debug trap for singl= e-step") Signed-off-by: Nadav Amit Signed-off-by: Ingo Molnar Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220813225943.143767-1-namit@vmware.com Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/x86/kernel/kprobes/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c @@ -505,7 +505,7 @@ static void kprobe_emulate_jcc(struct kp match =3D ((regs->flags & X86_EFLAGS_SF) >> X86_EFLAGS_SF_BIT) ^ ((regs->flags & X86_EFLAGS_OF) >> X86_EFLAGS_OF_BIT); if (p->ainsn.jcc.type >=3D 0xe) - match =3D match && (regs->flags & X86_EFLAGS_ZF); + match =3D match || (regs->flags & X86_EFLAGS_ZF); } __kprobe_emulate_jmp(p, regs, (match && !invert) || (!match && invert)); } From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DEA7C32774 for ; Tue, 23 Aug 2022 08:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241932AbiHWIKM (ORCPT ); Tue, 23 Aug 2022 04:10:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241796AbiHWIJM (ORCPT ); Tue, 23 Aug 2022 04:09:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6240399F2; Tue, 23 Aug 2022 01:05:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 382CBB81C21; Tue, 23 Aug 2022 08:05:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8237EC433D6; Tue, 23 Aug 2022 08:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241953; bh=BaRmGPtwqRsLB/YhckKVe4GwVoLQrbRKvKxeSbmy2n0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cqsyuXC7daXgUUr/RIiZJjmJFa2/Fi+p2ZH5ipL0IMtQNlD7ce2ETe89xgoggDfj4 UGLBop5ul4YCc9ghrzjLongfpL639mX7rz4vQz9qWlEMyKAixiaoUl0N6g2GTEEbYA R/cLty9gutINlWf2cHpwB5tJdWPjslMKqTvnFnkY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krister Johansen , Jiri Olsa , "Steven Rostedt (Google)" Subject: [PATCH 5.19 030/365] tracing/perf: Fix double put of trace event when init fails Date: Tue, 23 Aug 2022 09:58:51 +0200 Message-Id: <20220823080119.473574905@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit 7249921d94ff64f67b733eca0b68853a62032b3d upstream. If in perf_trace_event_init(), the perf_trace_event_open() fails, then it will call perf_trace_event_unreg() which will not only unregister the perf trace event, but will also call the put() function of the tp_event. The problem here is that the trace_event_try_get_ref() is called by the caller of perf_trace_event_init() and if perf_trace_event_init() returns a failure, it will then call trace_event_put(). But since the perf_trace_event_unreg() already called the trace_event_put() function, it triggers a WARN_ON(). WARNING: CPU: 1 PID: 30309 at kernel/trace/trace_dynevent.c:46 trace_event= _dyn_put_ref+0x15/0x20 If perf_trace_event_reg() does not call the trace_event_try_get_ref() then the perf_trace_event_unreg() should not be calling trace_event_put(). This breaks symmetry and causes bugs like these. Pull out the trace_event_put() from perf_trace_event_unreg() and call it in the locations that perf_trace_event_unreg() is called. This not only fixes this bug, but also brings back the proper symmetry of the reg/unreg vs get/put logic. Link: https://lore.kernel.org/all/cover.1660347763.git.kjlx@templeofstupid.= com/ Link: https://lkml.kernel.org/r/20220816192817.43d5e17f@gandalf.local.home Cc: stable@vger.kernel.org Fixes: 1d18538e6a092 ("tracing: Have dynamic events have a ref counter") Reported-by: Krister Johansen Reviewed-by: Krister Johansen Tested-by: Krister Johansen Acked-by: Jiri Olsa Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- kernel/trace/trace_event_perf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/kernel/trace/trace_event_perf.c +++ b/kernel/trace/trace_event_perf.c @@ -157,7 +157,7 @@ static void perf_trace_event_unreg(struc int i; =20 if (--tp_event->perf_refcount > 0) - goto out; + return; =20 tp_event->class->reg(tp_event, TRACE_REG_PERF_UNREGISTER, NULL); =20 @@ -176,8 +176,6 @@ static void perf_trace_event_unreg(struc perf_trace_buf[i] =3D NULL; } } -out: - trace_event_put_ref(tp_event); } =20 static int perf_trace_event_open(struct perf_event *p_event) @@ -241,6 +239,7 @@ void perf_trace_destroy(struct perf_even mutex_lock(&event_mutex); perf_trace_event_close(p_event); perf_trace_event_unreg(p_event); + trace_event_put_ref(p_event->tp_event); mutex_unlock(&event_mutex); } =20 @@ -292,6 +291,7 @@ void perf_kprobe_destroy(struct perf_eve mutex_lock(&event_mutex); perf_trace_event_close(p_event); perf_trace_event_unreg(p_event); + trace_event_put_ref(p_event->tp_event); mutex_unlock(&event_mutex); =20 destroy_local_trace_kprobe(p_event->tp_event); @@ -347,6 +347,7 @@ void perf_uprobe_destroy(struct perf_eve mutex_lock(&event_mutex); perf_trace_event_close(p_event); perf_trace_event_unreg(p_event); + trace_event_put_ref(p_event->tp_event); mutex_unlock(&event_mutex); destroy_local_trace_uprobe(p_event->tp_event); } From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 077A7C32774 for ; Tue, 23 Aug 2022 08:18:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242615AbiHWISR (ORCPT ); Tue, 23 Aug 2022 04:18:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242205AbiHWIM4 (ORCPT ); Tue, 23 Aug 2022 04:12:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4A116C11F; Tue, 23 Aug 2022 01:09:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 16DC96128E; Tue, 23 Aug 2022 08:09:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AA62C433D6; Tue, 23 Aug 2022 08:09:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242146; bh=v4KGrEVskcMrBDA4KqT7FNFEnwx3XEfxBHbjvZzK7pY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DAvsNNjdDmjGfrT/FaxJLxFcIR58aLrZROR9FhMMkuJAd2FFYX3Ikaiz07G/hY7pT Cq0l2/F++hiBboO3FAjZv2r4dajxMhR3l7xhkVajygo7F9967Fzf3siYLR47gK5bP7 7K4H8ENZ9l7BVm/3XxTMi9kCsJ7i2m+ZRhAkRc4Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , Tzvetomir Stoyanov , Tom Zanussi , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" Subject: [PATCH 5.19 031/365] tracing/eprobes: Do not allow eprobes to use $stack, or % for regs Date: Tue, 23 Aug 2022 09:58:52 +0200 Message-Id: <20220823080119.509826276@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit 2673c60ee67e71f2ebe34386e62d348f71edee47 upstream. While playing with event probes (eprobes), I tried to see what would happen if I attempted to retrieve the instruction pointer (%rip) knowing that event probes do not use pt_regs. The result was: BUG: kernel NULL pointer dereference, address: 0000000000000024 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 1 PID: 1847 Comm: trace-cmd Not tainted 5.19.0-rc5-test+ #309 Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v03.03 07/14/2016 RIP: 0010:get_event_field.isra.0+0x0/0x50 Code: ff 48 c7 c7 c0 8f 74 a1 e8 3d 8b f5 ff e8 88 09 f6 ff 4c 89 e7 e8 50 6a 13 00 48 89 ef 5b 5d 41 5c 41 5d e9 42 6a 13 00 66 90 <48> 63 47 24 8b 57 2c 48 01 c6 8b 47 28 83 f8 02 74 0e 83 f8 04 74 RSP: 0018:ffff916c394bbaf0 EFLAGS: 00010086 RAX: ffff916c854041d8 RBX: ffff916c8d9fbf50 RCX: ffff916c255d2000 RDX: 0000000000000000 RSI: ffff916c255d2008 RDI: 0000000000000000 RBP: 0000000000000000 R08: ffff916c3a2a0c08 R09: ffff916c394bbda8 R10: 0000000000000000 R11: 0000000000000000 R12: ffff916c854041d8 R13: ffff916c854041b0 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff916c9ea40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000024 CR3: 000000011b60a002 CR4: 00000000001706e0 Call Trace: get_eprobe_size+0xb4/0x640 ? __mod_node_page_state+0x72/0xc0 __eprobe_trace_func+0x59/0x1a0 ? __mod_lruvec_page_state+0xaa/0x1b0 ? page_remove_file_rmap+0x14/0x230 ? page_remove_rmap+0xda/0x170 event_triggers_call+0x52/0xe0 trace_event_buffer_commit+0x18f/0x240 trace_event_raw_event_sched_wakeup_template+0x7a/0xb0 try_to_wake_up+0x260/0x4c0 __wake_up_common+0x80/0x180 __wake_up_common_lock+0x7c/0xc0 do_notify_parent+0x1c9/0x2a0 exit_notify+0x1a9/0x220 do_exit+0x2ba/0x450 do_group_exit+0x2d/0x90 __x64_sys_exit_group+0x14/0x20 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Obviously this is not the desired result. Move the testing for TPARG_FL_TPOINT which is only used for event probes to the top of the "$" variable check, as all the other variables are not used for event probes. Also add a check in the register parsing "%" to fail if an event probe is used. Link: https://lkml.kernel.org/r/20220820134400.564426983@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Cc: Tzvetomir Stoyanov Cc: Tom Zanussi Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events") Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- kernel/trace/trace_probe.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -279,7 +279,14 @@ static int parse_probe_vars(char *arg, c int ret =3D 0; int len; =20 - if (strcmp(arg, "retval") =3D=3D 0) { + if (flags & TPARG_FL_TPOINT) { + if (code->data) + return -EFAULT; + code->data =3D kstrdup(arg, GFP_KERNEL); + if (!code->data) + return -ENOMEM; + code->op =3D FETCH_OP_TP_ARG; + } else if (strcmp(arg, "retval") =3D=3D 0) { if (flags & TPARG_FL_RETURN) { code->op =3D FETCH_OP_RETVAL; } else { @@ -319,13 +326,6 @@ static int parse_probe_vars(char *arg, c code->op =3D FETCH_OP_ARG; code->param =3D (unsigned int)param - 1; #endif - } else if (flags & TPARG_FL_TPOINT) { - if (code->data) - return -EFAULT; - code->data =3D kstrdup(arg, GFP_KERNEL); - if (!code->data) - return -ENOMEM; - code->op =3D FETCH_OP_TP_ARG; } else goto inval_var; =20 @@ -380,6 +380,11 @@ parse_probe_arg(char *arg, const struct break; =20 case '%': /* named register */ + if (flags & TPARG_FL_TPOINT) { + /* eprobes do not handle registers */ + trace_probe_log_err(offs, BAD_VAR); + break; + } ret =3D regs_query_register_offset(arg + 1); if (ret >=3D 0) { code->op =3D FETCH_OP_REG; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF3F6C32774 for ; Tue, 23 Aug 2022 08:12:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242018AbiHWIMR (ORCPT ); Tue, 23 Aug 2022 04:12:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241770AbiHWIJg (ORCPT ); Tue, 23 Aug 2022 04:09:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A246266A6F; Tue, 23 Aug 2022 01:06:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 093A1B81C18; Tue, 23 Aug 2022 08:06:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70150C433C1; Tue, 23 Aug 2022 08:06:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241981; bh=8JdS3sLV+wxFTBujS2gA+PG7URNVNxZCqEuDH7Q+Seo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LAobLdk/rrm08KIb+htT92xmsOlypiDPBxDZIAU+sT7z7MsjAjxeJgcXyx6nROBOz mrMKN4jEeHQCV9JYzPqpYQRYK6P8932xvZGa+4fAK3ISuL2UzRW2o8oY+LToROgN4L heW0eOv8DR/g6G3Wv4fZKLkD5QztazSty/HzHozs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , Masami Hiramatsu , Tzvetomir Stoyanov , Tom Zanussi , "Steven Rostedt (Google)" Subject: [PATCH 5.19 032/365] tracing/eprobes: Do not hardcode $comm as a string Date: Tue, 23 Aug 2022 09:58:53 +0200 Message-Id: <20220823080119.555485071@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit 02333de90e5945e2fe7fc75b15b4eb9aee187f0a upstream. The variable $comm is hard coded as a string, which is true for both kprobes and uprobes, but for event probes (eprobes) it is a field name. In most cases the "comm" field would be a string, but there's no guarantee of that fact. Do not assume that comm is a string. Not to mention, it currently forces comm fields to fault, as string processing for event probes is currently broken. Link: https://lkml.kernel.org/r/20220820134400.756152112@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Cc: Masami Hiramatsu Cc: Tzvetomir Stoyanov Cc: Tom Zanussi Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- kernel/trace/trace_probe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -618,9 +618,10 @@ static int traceprobe_parse_probe_arg_bo =20 /* * Since $comm and immediate string can not be dereferenced, - * we can find those by strcmp. + * we can find those by strcmp. But ignore for eprobes. */ - if (strcmp(arg, "$comm") =3D=3D 0 || strncmp(arg, "\\\"", 2) =3D=3D 0) { + if (!(flags & TPARG_FL_TPOINT) && + (strcmp(arg, "$comm") =3D=3D 0 || strncmp(arg, "\\\"", 2) =3D=3D 0)) { /* The type of $comm must be "string", and not an array. */ if (parg->count || (t && strcmp(t, "string"))) goto out; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4782C32774 for ; Tue, 23 Aug 2022 08:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241520AbiHWINh (ORCPT ); Tue, 23 Aug 2022 04:13:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242009AbiHWIK1 (ORCPT ); Tue, 23 Aug 2022 04:10:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC7EF2BC9; Tue, 23 Aug 2022 01:06:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0EB97611DD; Tue, 23 Aug 2022 08:06:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BE64C433D6; Tue, 23 Aug 2022 08:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242015; bh=fPU2t9eLDqNauoToSdAkjI0cyo4HWW1yisfgWfJvenU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LY9v1zzFtJvu3vtxLyrRUbsil8+7Ur0uGrORLpoFoqNBZ/X6uF5vY8G+u8TEx2yuD V2p/4LdXezI7aZLwdy6HprA/Xfu4aqkC3TsraXd9QT7DUFd7+emfRgslHRh1uM5jYM 9bu83t2Ge2w8QHr8BCDefJn2VHW2FJFSZTmIfnfY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , Tzvetomir Stoyanov , Tom Zanussi , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" Subject: [PATCH 5.19 033/365] tracing/eprobes: Fix reading of string fields Date: Tue, 23 Aug 2022 09:58:54 +0200 Message-Id: <20220823080119.596808360@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit f04dec93466a0481763f3b56cdadf8076e28bfbf upstream. Currently when an event probe (eprobe) hooks to a string field, it does not display it as a string, but instead as a number. This makes the field rather useless. Handle the different kinds of strings, dynamic, static, relational/dynamic etc. Now when a string field is used, the ":string" type can be used to display it: echo "e:sw sched/sched_switch comm=3D$next_comm:string" > dynamic_events Link: https://lkml.kernel.org/r/20220820134400.959640191@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Cc: Tzvetomir Stoyanov Cc: Tom Zanussi Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events") Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- kernel/trace/trace_eprobe.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) --- a/kernel/trace/trace_eprobe.c +++ b/kernel/trace/trace_eprobe.c @@ -310,6 +310,27 @@ static unsigned long get_event_field(str =20 addr =3D rec + field->offset; =20 + if (is_string_field(field)) { + switch (field->filter_type) { + case FILTER_DYN_STRING: + val =3D (unsigned long)(rec + (*(unsigned int *)addr & 0xffff)); + break; + case FILTER_RDYN_STRING: + val =3D (unsigned long)(addr + (*(unsigned int *)addr & 0xffff)); + break; + case FILTER_STATIC_STRING: + val =3D (unsigned long)addr; + break; + case FILTER_PTR_STRING: + val =3D (unsigned long)(*(char *)addr); + break; + default: + WARN_ON_ONCE(1); + return 0; + } + return val; + } + switch (field->size) { case 1: if (field->is_signed) From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B3F6C32774 for ; Tue, 23 Aug 2022 08:14:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242202AbiHWIOH (ORCPT ); Tue, 23 Aug 2022 04:14:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242069AbiHWIKe (ORCPT ); Tue, 23 Aug 2022 04:10:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F2F7BE31; Tue, 23 Aug 2022 01:07:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1B5916125A; Tue, 23 Aug 2022 08:07:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DA30C433C1; Tue, 23 Aug 2022 08:07:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242049; bh=KKuGSI4SgGNc1dasDJ1YuPWISY/G6x4JFnBEck3BOuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vh9idbg8qmDB+MWHkKrd1bTW+cK8+93FOs9xr8oB9WLizC/DcMEGdjOgUHbZMLwQ6 WD/8lsGe7CIDmbivtRu6X2MPBU/Nk8s+2BdHdZRS1W5NIOEmQBIqjVS/I0/PRnjJar uk1jxb3wXQpnfOqceQrBn+6iTeJuvu075X1OgjWM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , Masami Hiramatsu , Tzvetomir Stoyanov , Tom Zanussi , "Steven Rostedt (Google)" Subject: [PATCH 5.19 034/365] tracing/eprobes: Have event probes be consistent with kprobes and uprobes Date: Tue, 23 Aug 2022 09:58:55 +0200 Message-Id: <20220823080119.637084607@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit 6a832ec3d680b3a4f4fad5752672827d71bae501 upstream. Currently, if a symbol "@" is attempted to be used with an event probe (eprobes), it will cause a NULL pointer dereference crash. Both kprobes and uprobes can reference data other than the main registers. Such as immediate address, symbols and the current task name. Have eprobes do the same thing. For "comm", if "comm" is used and the event being attached to does not have the "comm" field, then make it the "$comm" that kprobes has. This is consistent to the way histograms and filters work. Link: https://lkml.kernel.org/r/20220820134401.136924220@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Cc: Masami Hiramatsu Cc: Tzvetomir Stoyanov Cc: Tom Zanussi Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- kernel/trace/trace_eprobe.c | 70 +++++++++++++++++++++++++++++++++++++++= +---- 1 file changed, 64 insertions(+), 6 deletions(-) --- a/kernel/trace/trace_eprobe.c +++ b/kernel/trace/trace_eprobe.c @@ -226,6 +226,7 @@ static int trace_eprobe_tp_arg_update(st struct probe_arg *parg =3D &ep->tp.args[i]; struct ftrace_event_field *field; struct list_head *head; + int ret =3D -ENOENT; =20 head =3D trace_get_fields(ep->event); list_for_each_entry(field, head, link) { @@ -235,9 +236,20 @@ static int trace_eprobe_tp_arg_update(st return 0; } } + + /* + * Argument not found on event. But allow for comm and COMM + * to be used to get the current->comm. + */ + if (strcmp(parg->code->data, "COMM") =3D=3D 0 || + strcmp(parg->code->data, "comm") =3D=3D 0) { + parg->code->op =3D FETCH_OP_COMM; + ret =3D 0; + } + kfree(parg->code->data); parg->code->data =3D NULL; - return -ENOENT; + return ret; } =20 static int eprobe_event_define_fields(struct trace_event_call *event_call) @@ -362,16 +374,38 @@ static unsigned long get_event_field(str =20 static int get_eprobe_size(struct trace_probe *tp, void *rec) { + struct fetch_insn *code; struct probe_arg *arg; int i, len, ret =3D 0; =20 for (i =3D 0; i < tp->nr_args; i++) { arg =3D tp->args + i; - if (unlikely(arg->dynamic)) { + if (arg->dynamic) { unsigned long val; =20 - val =3D get_event_field(arg->code, rec); - len =3D process_fetch_insn_bottom(arg->code + 1, val, NULL, NULL); + code =3D arg->code; + retry: + switch (code->op) { + case FETCH_OP_TP_ARG: + val =3D get_event_field(code, rec); + break; + case FETCH_OP_IMM: + val =3D code->immediate; + break; + case FETCH_OP_COMM: + val =3D (unsigned long)current->comm; + break; + case FETCH_OP_DATA: + val =3D (unsigned long)code->data; + break; + case FETCH_NOP_SYMBOL: /* Ignore a place holder */ + code++; + goto retry; + default: + continue; + } + code++; + len =3D process_fetch_insn_bottom(code, val, NULL, NULL); if (len > 0) ret +=3D len; } @@ -389,8 +423,28 @@ process_fetch_insn(struct fetch_insn *co { unsigned long val; =20 - val =3D get_event_field(code, rec); - return process_fetch_insn_bottom(code + 1, val, dest, base); + retry: + switch (code->op) { + case FETCH_OP_TP_ARG: + val =3D get_event_field(code, rec); + break; + case FETCH_OP_IMM: + val =3D code->immediate; + break; + case FETCH_OP_COMM: + val =3D (unsigned long)current->comm; + break; + case FETCH_OP_DATA: + val =3D (unsigned long)code->data; + break; + case FETCH_NOP_SYMBOL: /* Ignore a place holder */ + code++; + goto retry; + default: + return -EILSEQ; + } + code++; + return process_fetch_insn_bottom(code, val, dest, base); } NOKPROBE_SYMBOL(process_fetch_insn) =20 @@ -862,6 +916,10 @@ static int trace_eprobe_tp_update_arg(st if (ep->tp.args[i].code->op =3D=3D FETCH_OP_TP_ARG) ret =3D trace_eprobe_tp_arg_update(ep, i); =20 + /* Handle symbols "@" */ + if (!ret) + ret =3D traceprobe_update_arg(&ep->tp.args[i]); + return ret; } From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28BAAC32774 for ; Tue, 23 Aug 2022 08:16:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242435AbiHWIPT (ORCPT ); Tue, 23 Aug 2022 04:15:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242184AbiHWIKv (ORCPT ); Tue, 23 Aug 2022 04:10:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35E7F6A4B0; Tue, 23 Aug 2022 01:08:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CDBF3B81C19; Tue, 23 Aug 2022 08:08:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DB92C433C1; Tue, 23 Aug 2022 08:08:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242083; bh=NjBoIts4ftHS3FHOf3IvpJrjsZCLRUUI6NkDYNIikfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DKNjk5jdGeZmEEmvR9K63/w+Vk8AyJM+nVb+Aw7XeBeh+JlBPhpXdBjFbhFphIuf4 rHsRN87n+VTqsRfNMvJ7CcqFES4olUFU4/zBvdjbUHD+DYQBOCFhysrgkNMUP5+8qg cln4j+otC2MCP5tvLO2HyNnS4dTgqUYoitHYSl3g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , Tzvetomir Stoyanov , Tom Zanussi , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" Subject: [PATCH 5.19 035/365] tracing/probes: Have kprobes and uprobes use $COMM too Date: Tue, 23 Aug 2022 09:58:56 +0200 Message-Id: <20220823080119.673122069@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit ab8384442ee512fc0fc72deeb036110843d0e7ff upstream. Both $comm and $COMM can be used to get current->comm in eprobes and the filtering and histogram logic. Make kprobes and uprobes consistent in this regard and allow both $comm and $COMM as well. Currently kprobes and uprobes only handle $comm, which is inconsistent with the other utilities, and can be confusing to users. Link: https://lkml.kernel.org/r/20220820134401.317014913@goodmis.org Link: https://lore.kernel.org/all/20220820220442.776e1ddaf8836e82edb34d01@k= ernel.org/ Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Cc: Tzvetomir Stoyanov Cc: Tom Zanussi Fixes: 533059281ee5 ("tracing: probeevent: Introduce new argument fetching = code") Suggested-by: Masami Hiramatsu (Google) Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- kernel/trace/trace_probe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -310,7 +310,7 @@ static int parse_probe_vars(char *arg, c } } else goto inval_var; - } else if (strcmp(arg, "comm") =3D=3D 0) { + } else if (strcmp(arg, "comm") =3D=3D 0 || strcmp(arg, "COMM") =3D=3D 0) { code->op =3D FETCH_OP_COMM; #ifdef CONFIG_HAVE_FUNCTION_ARG_ACCESS_API } else if (((flags & TPARG_FL_MASK) =3D=3D @@ -621,7 +621,8 @@ static int traceprobe_parse_probe_arg_bo * we can find those by strcmp. But ignore for eprobes. */ if (!(flags & TPARG_FL_TPOINT) && - (strcmp(arg, "$comm") =3D=3D 0 || strncmp(arg, "\\\"", 2) =3D=3D 0)) { + (strcmp(arg, "$comm") =3D=3D 0 || strcmp(arg, "$COMM") =3D=3D 0 || + strncmp(arg, "\\\"", 2) =3D=3D 0)) { /* The type of $comm must be "string", and not an array. */ if (parg->count || (t && strcmp(t, "string"))) goto out; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 412A6C32774 for ; Tue, 23 Aug 2022 08:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242562AbiHWIR4 (ORCPT ); Tue, 23 Aug 2022 04:17:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242517AbiHWIL2 (ORCPT ); Tue, 23 Aug 2022 04:11:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED8086170A; Tue, 23 Aug 2022 01:08:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B8D06611A8; Tue, 23 Aug 2022 08:08:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD78CC433D6; Tue, 23 Aug 2022 08:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242119; bh=yXT7p9wh4HXbnK7OLAUNhB3dmPOuBMTo6K5JG9vx2iU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ssVVp2w7rKbcc6Kg38OK/17GwbmAuPpsYnYBKgn9srLdqwGi57jBfai7a3Kl7pkDg qVi30VZrE6dIelkopBc6WJfkpOFJka/bsdjX8tYRUZ8NXpIhwXTmcqQj2RGSKAESzJ YPgsGtjltEdDiKCycYlvC/EVjrwzzvwl+opiRvMY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , Tzvetomir Stoyanov , Tom Zanussi , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" Subject: [PATCH 5.19 036/365] tracing: Have filter accept "common_cpu" to be consistent Date: Tue, 23 Aug 2022 09:58:57 +0200 Message-Id: <20220823080119.705956620@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit b2380577d4fe1c0ef3fa50417f1e441c016e4cbe upstream. Make filtering consistent with histograms. As "cpu" can be a field of an event, allow for "common_cpu" to keep it from being confused with the "cpu" field of the event. Link: https://lkml.kernel.org/r/20220820134401.513062765@goodmis.org Link: https://lore.kernel.org/all/20220820220920.e42fa32b70505b1904f0a0ad@k= ernel.org/ Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Cc: Tzvetomir Stoyanov Cc: Tom Zanussi Fixes: 1e3bac71c5053 ("tracing/histogram: Rename "cpu" to "common_cpu"") Suggested-by: Masami Hiramatsu (Google) Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- kernel/trace/trace_events.c | 1 + 1 file changed, 1 insertion(+) --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -176,6 +176,7 @@ static int trace_define_generic_fields(v =20 __generic_field(int, CPU, FILTER_CPU); __generic_field(int, cpu, FILTER_CPU); + __generic_field(int, common_cpu, FILTER_CPU); __generic_field(char *, COMM, FILTER_COMM); __generic_field(char *, comm, FILTER_COMM); From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18004C32793 for ; Tue, 23 Aug 2022 08:17:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242532AbiHWIRi (ORCPT ); Tue, 23 Aug 2022 04:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241817AbiHWILu (ORCPT ); Tue, 23 Aug 2022 04:11:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF7056B16A; Tue, 23 Aug 2022 01:08:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 242126122D; Tue, 23 Aug 2022 08:08:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ED48C433D6; Tue, 23 Aug 2022 08:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242134; bh=F9SU6UtgP0gCccx4Zboydln91y1JAzmAWCxO5fihL5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=whYeu29QEkuLhQrXkjSO/LSDjE2yL52Ei0F7mn6fQP10nodCtHGXxAdnn6+AGjUY0 kZrI+yGu0GokZzyRk8A6KYGsJZ8bgs+5E5iFDtkas8wNDZ6WqL1Kbzy9LvZ5MmlpLU 52Xbid9WRlZefAHjNcg/rWxJH0jalC906dZIOAc0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.19 037/365] ALSA: usb-audio: More comprehensive mixer map for ASUS ROG Zenith II Date: Tue, 23 Aug 2022 09:58:58 +0200 Message-Id: <20220823080119.744796915@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai commit 6bc2906253e723d1ab1acc652b55b83e286bfec2 upstream. ASUS ROG Zenith II has two USB interfaces, one for the front headphone and another for the rest I/O. Currently we provided the mixer mapping for the latter but with an incomplete form. This patch corrects and provides more comprehensive mixer mapping, as well as providing the proper device names for both the front headphone and main audio. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=3D211005 Fixes: 2a48218f8e23 ("ALSA: usb-audio: Add mixer workaround for TRX40 and c= o") Link: https://lore.kernel.org/r/20220809073259.18849-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/usb/card.c | 8 ++++++++ sound/usb/mixer_maps.c | 34 +++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 9 deletions(-) --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -387,6 +387,14 @@ static const struct usb_audio_device_nam DEVICE_NAME(0x05e1, 0x0408, "Syntek", "STK1160"), DEVICE_NAME(0x05e1, 0x0480, "Hauppauge", "Woodbury"), =20 + /* ASUS ROG Zenith II: this machine has also two devices, one for + * the front headphone and another for the rest + */ + PROFILE_NAME(0x0b05, 0x1915, "ASUS", "Zenith II Front Headphone", + "Zenith-II-Front-Headphone"), + PROFILE_NAME(0x0b05, 0x1916, "ASUS", "Zenith II Main Audio", + "Zenith-II-Main-Audio"), + /* ASUS ROG Strix */ PROFILE_NAME(0x0b05, 0x1917, "Realtek", "ALC1220-VB-DT", "Realtek-ALC1220-VB-Desktop"), --- a/sound/usb/mixer_maps.c +++ b/sound/usb/mixer_maps.c @@ -374,13 +374,28 @@ static const struct usbmix_name_map cors { 0 } }; =20 -/* Some mobos shipped with a dummy HD-audio show the invalid GET_MIN/GET_M= AX - * response for Input Gain Pad (id=3D19, control=3D12) and the connector s= tatus - * for SPDIF terminal (id=3D18). Skip them. - */ -static const struct usbmix_name_map asus_rog_map[] =3D { - { 18, NULL }, /* OT, connector control */ - { 19, NULL, 12 }, /* FU, Input Gain Pad */ +/* ASUS ROG Zenith II with Realtek ALC1220-VB */ +static const struct usbmix_name_map asus_zenith_ii_map[] =3D { + { 19, NULL, 12 }, /* FU, Input Gain Pad - broken response, disabled */ + { 16, "Speaker" }, /* OT */ + { 22, "Speaker Playback" }, /* FU */ + { 7, "Line" }, /* IT */ + { 19, "Line Capture" }, /* FU */ + { 8, "Mic" }, /* IT */ + { 20, "Mic Capture" }, /* FU */ + { 9, "Front Mic" }, /* IT */ + { 21, "Front Mic Capture" }, /* FU */ + { 17, "IEC958" }, /* OT */ + { 23, "IEC958 Playback" }, /* FU */ + {} +}; + +static const struct usbmix_connector_map asus_zenith_ii_connector_map[] = =3D { + { 10, 16 }, /* (Back) Speaker */ + { 11, 17 }, /* SPDIF */ + { 13, 7 }, /* Line */ + { 14, 8 }, /* Mic */ + { 15, 9 }, /* Front Mic */ {} }; =20 @@ -611,9 +626,10 @@ static const struct usbmix_ctl_map usbmi .map =3D gigabyte_b450_map, .connector_map =3D gigabyte_b450_connector_map, }, - { /* ASUS ROG Zenith II */ + { /* ASUS ROG Zenith II (main audio) */ .id =3D USB_ID(0x0b05, 0x1916), - .map =3D asus_rog_map, + .map =3D asus_zenith_ii_map, + .connector_map =3D asus_zenith_ii_connector_map, }, { /* ASUS ROG Strix */ .id =3D USB_ID(0x0b05, 0x1917), From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3996DC32774 for ; Tue, 23 Aug 2022 08:18:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242581AbiHWISD (ORCPT ); Tue, 23 Aug 2022 04:18:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241945AbiHWILz (ORCPT ); Tue, 23 Aug 2022 04:11:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F37386B8DD; Tue, 23 Aug 2022 01:08:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0E4876122D; Tue, 23 Aug 2022 08:08:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07E53C433C1; Tue, 23 Aug 2022 08:08:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242137; bh=2bDFe3NcKWE6JLIhfhZBlJDKBAWCaKmBFXcKVPADIKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yWLxF9itBtPCBYhRb46g7lNGOpeieH1iGg6n3jnaVqH42xnlqaWBal96XLkjMmlWI iTXQ4w0BqkGJ3vf//1EIt6SkMZqadK7WM/Dg3BI/qezWTqM1TAn7A7HcKzlZIivtQz H4QrZ4Q/l0nzubKVf4TDrTTsGEW/YcJ1KbqaJ834= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mohan Kumar , Takashi Iwai Subject: [PATCH 5.19 038/365] ALSA: hda: Fix crash due to jack poll in suspend Date: Tue, 23 Aug 2022 09:58:59 +0200 Message-Id: <20220823080119.785095632@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mohan Kumar commit 636aa8807b5780b76609b40cd3d3e1b5a225471c upstream. With jackpoll_in_suspend flag set, there is a possibility that jack poll worker thread will run even after system suspend was completed. Any register access after system pm callback flow will result in kernel crash as still jack poll worker thread tries to access registers. To fix the crash issue during system flow, cancel the jack poll worker thread during system pm prepare callback and cancel the worker thread at start of runtime suspend callback and re-schedule at last to avoid any unwarranted access of register by worker thread during suspend flow. Signed-off-by: Mohan Kumar Fixes: b33115bd05af ("ALSA: hda: Jack detection poll in suspend state") Link: https://lore.kernel.org/r/20220811052704.2944-1-mkumard@nvidia.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/pci/hda/hda_codec.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -2935,8 +2935,7 @@ static int hda_codec_runtime_suspend(str if (!codec->card) return 0; =20 - if (!codec->bus->jackpoll_in_suspend) - cancel_delayed_work_sync(&codec->jackpoll_work); + cancel_delayed_work_sync(&codec->jackpoll_work); =20 state =3D hda_call_codec_suspend(codec); if (codec->link_down_at_suspend || @@ -2944,6 +2943,11 @@ static int hda_codec_runtime_suspend(str (state & AC_PWRST_CLK_STOP_OK))) snd_hdac_codec_link_down(&codec->core); snd_hda_codec_display_power(codec, false); + + if (codec->bus->jackpoll_in_suspend && + (dev->power.power_state.event !=3D PM_EVENT_SUSPEND)) + schedule_delayed_work(&codec->jackpoll_work, + codec->jackpoll_interval); return 0; } =20 @@ -2967,6 +2971,9 @@ static int hda_codec_runtime_resume(stru #ifdef CONFIG_PM_SLEEP static int hda_codec_pm_prepare(struct device *dev) { + struct hda_codec *codec =3D dev_to_hda_codec(dev); + + cancel_delayed_work_sync(&codec->jackpoll_work); dev->power.power_state =3D PMSG_SUSPEND; return pm_runtime_suspended(dev); } @@ -2986,9 +2993,6 @@ static void hda_codec_pm_complete(struct =20 static int hda_codec_pm_suspend(struct device *dev) { - struct hda_codec *codec =3D dev_to_hda_codec(dev); - - cancel_delayed_work_sync(&codec->jackpoll_work); dev->power.power_state =3D PMSG_SUSPEND; return pm_runtime_force_suspend(dev); } From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8591C32774 for ; Tue, 23 Aug 2022 08:18:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242593AbiHWISF (ORCPT ); Tue, 23 Aug 2022 04:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242005AbiHWIL5 (ORCPT ); Tue, 23 Aug 2022 04:11:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8483B6BCC9; Tue, 23 Aug 2022 01:09:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 183E76123D; Tue, 23 Aug 2022 08:09:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E386C433D6; Tue, 23 Aug 2022 08:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242140; bh=VgJzzkCQ9ia9un3yqoZht5tR5pEWEaIVtS5enA2CRTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OyRYbM10Zl9PopRDn2L01rdlg57yXhyC3YPb1rDpdb6TzjFDAl3ct3NBj+2lE+NxH kpiBiHVmFuSE3iIpxnXHQL2UUt0nYVwlq26N/BP8zVvvnjIYrChNs5yPG6K+6WIQ0U hmgksFoE6EYIraDDLq1ft1q/5kxh77E7P6C2F1LM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Krzysztof Kozlowski , Chunfeng Yun Subject: [PATCH 5.19 039/365] dt-bindings: usb: mtk-xhci: Allow wakeup interrupt-names to be optional Date: Tue, 23 Aug 2022 09:59:00 +0200 Message-Id: <20220823080119.826377801@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: N=C3=ADcolas F. R. A. Prado commit b2c510ffe29f20a5f6ff31ae28d32ffa494b8cfb upstream. Add missing "minItems: 1" to the interrupt-names property to allow the second interrupt-names, "wakeup", to be optional. Fixes: fe8e488058c4 ("dt-bindings: usb: mtk-xhci: add wakeup interrupt") Signed-off-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: Krzysztof Kozlowski Acked-by: Chunfeng Yun Link: https://lore.kernel.org/r/20220623193702.817996-2-nfraprado@collabora= .com Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml | 1 + 1 file changed, 1 insertion(+) --- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml +++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml @@ -57,6 +57,7 @@ properties: - description: optional, wakeup interrupt used to support runtime PM =20 interrupt-names: + minItems: 1 items: - const: host - const: wakeup From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07019C32774 for ; Tue, 23 Aug 2022 08:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242606AbiHWISN (ORCPT ); Tue, 23 Aug 2022 04:18:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242140AbiHWIMf (ORCPT ); Tue, 23 Aug 2022 04:12:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 142B46BD73; Tue, 23 Aug 2022 01:09:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 187026123D; Tue, 23 Aug 2022 08:09:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12749C433D6; Tue, 23 Aug 2022 08:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242143; bh=t5e8m7zUSZLlKDZ0aO+vYJnddTUtFWDaqH96W3GXM0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eat9G/JtCA4ktfCfn9LAwxsk6mrPrNXfU1h/KGWhpek/NgXlDKTPr819ephEvkTyg vVe/XpITKuzrj1hN1BxuUeEmmxoyy29rtsd2yZN3LCuihYzyfYzmxh60V3LlL4oG58 nMTV/xRDKJUDtv+3+gL/O0QEZkZ/q/GLNmeCC62c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gerhard Uttenthaler , Sebastian Haas , Marc Kleine-Budde Subject: [PATCH 5.19 040/365] can: ems_usb: fix clangs -Wunaligned-access warning Date: Tue, 23 Aug 2022 09:59:01 +0200 Message-Id: <20220823080119.870866102@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marc Kleine-Budde commit a4cb6e62ea4d36e53fb3c0f18ea4503d7b76674f upstream. clang emits a -Wunaligned-access warning on struct __packed ems_cpc_msg. The reason is that the anonymous union msg (not declared as packed) is being packed right after some non naturally aligned variables (3*8 bits + 2*32) inside a packed struct: | struct __packed ems_cpc_msg { | u8 type; /* type of message */ | u8 length; /* length of data within union 'msg' */ | u8 msgid; /* confirmation handle */ | __le32 ts_sec; /* timestamp in seconds */ | __le32 ts_nsec; /* timestamp in nano seconds */ | /* ^ not naturally aligned */ | | union { | /* ^ not declared as packed */ | u8 generic[64]; | struct cpc_can_msg can_msg; | struct cpc_can_params can_params; | struct cpc_confirm confirmation; | struct cpc_overrun overrun; | struct cpc_can_error error; | struct cpc_can_err_counter err_counter; | u8 can_state; | } msg; | }; Starting from LLVM 14, having an unpacked struct nested in a packed struct triggers a warning. c.f. [1]. Fix the warning by marking the anonymous union as packed. [1] https://github.com/llvm/llvm-project/issues/55520 Fixes: 702171adeed3 ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB i= nterface") Link: https://lore.kernel.org/all/20220802094021.959858-1-mkl@pengutronix.de Cc: Gerhard Uttenthaler Cc: Sebastian Haas Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/can/usb/ems_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c @@ -194,7 +194,7 @@ struct __packed ems_cpc_msg { __le32 ts_sec; /* timestamp in seconds */ __le32 ts_nsec; /* timestamp in nano seconds */ =20 - union { + union __packed { u8 generic[64]; struct cpc_can_msg can_msg; struct cpc_can_params can_params; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84B15C32789 for ; Tue, 23 Aug 2022 08:12:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241993AbiHWIMf (ORCPT ); Tue, 23 Aug 2022 04:12:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241880AbiHWIJs (ORCPT ); Tue, 23 Aug 2022 04:09:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76E3067C8B; Tue, 23 Aug 2022 01:06:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BB710610AA; Tue, 23 Aug 2022 08:06:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEA1CC433C1; Tue, 23 Aug 2022 08:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241988; bh=+BJTvkYDRr0aE4L6o5TNcyJvj52o/Lx/16ryarOswAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K4KEurRnMiI958y+rMC3CnOz2a4oacVPHKtDmjwrRCbGZWKYHvvCeJzMgru+gbU7v DDrQStLGNw8+XZ1fEuCsiL7defpqElnj813iTj8beOMZDi6lc7bfZKeEuw6atj16Kb QlFLtIzaL5/99+bRTN5pTAA3o4L6uEY5/tLQ5/hI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Johansen Subject: [PATCH 5.19 041/365] apparmor: fix quiet_denied for file rules Date: Tue, 23 Aug 2022 09:59:02 +0200 Message-Id: <20220823080119.910765071@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Johansen commit 68ff8540cc9e4ab557065b3f635c1ff4c96e1f1c upstream. Global quieting of denied AppArmor generated file events is not handled correctly. Unfortunately the is checking if quieting of all audit events is set instead of just denied events. Fixes: 67012e8209df ("AppArmor: basic auditing infrastructure.") Signed-off-by: John Johansen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- security/apparmor/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/security/apparmor/audit.c +++ b/security/apparmor/audit.c @@ -137,7 +137,7 @@ int aa_audit(int type, struct aa_profile } if (AUDIT_MODE(profile) =3D=3D AUDIT_QUIET || (type =3D=3D AUDIT_APPARMOR_DENIED && - AUDIT_MODE(profile) =3D=3D AUDIT_QUIET)) + AUDIT_MODE(profile) =3D=3D AUDIT_QUIET_DENIED)) return aad(sa)->error; =20 if (KILL_MODE(profile) && type =3D=3D AUDIT_APPARMOR_DENIED) From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D3D3C32793 for ; Tue, 23 Aug 2022 08:12:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242108AbiHWIMZ (ORCPT ); Tue, 23 Aug 2022 04:12:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241889AbiHWIJz (ORCPT ); Tue, 23 Aug 2022 04:09:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FD7166119; Tue, 23 Aug 2022 01:06:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 72431B81C18; Tue, 23 Aug 2022 08:06:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB3A0C433D6; Tue, 23 Aug 2022 08:06:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661241994; bh=2R7Y5R9JfnX2Fl+Ax/fCrXRtAjPJytLM6eEWo9LB3W4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oh/ueC49IXOisnFeQVk8K1d8GdUtJfXREXp39sOKo29FWXkIUa3ZVMmV9+PRocNVC awIijVVXQkO19EJEFnjrDqFd8kngpC5kRrgtsStl9SZoMjpaaKUUJ951mtJ2AzAWaN AQvubDgqwfmQH/MEfC2MvhL22RcKjtTheZ8B/bbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Casey Schaufler , John Johansen Subject: [PATCH 5.19 042/365] apparmor: fix absroot causing audited secids to begin with = Date: Tue, 23 Aug 2022 09:59:03 +0200 Message-Id: <20220823080119.940480611@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Johansen commit 511f7b5b835726e844a5fc7444c18e4b8672edfd upstream. AppArmor is prefixing secids that are converted to secctx with the =3D to indicate the secctx should only be parsed from an absolute root POV. This allows catching errors where secctx are reparsed back into internal labels. Unfortunately because audit is using secid to secctx conversion this means that subject and object labels can result in a very unfortunate =3D=3D that can break audit parsing. eg. the subj=3D=3Dunconfined term in the below audit message type=3DUSER_LOGIN msg=3Daudit(1639443365.233:160): pid=3D1633 uid=3D0 auid= =3D1000 ses=3D3 subj=3D=3Dunconfined msg=3D'op=3Dlogin id=3D1000 exe=3D"/usr/sbin/s= shd" hostname=3D192.168.122.1 addr=3D192.168.122.1 terminal=3D/dev/pts/1 res=3Ds= uccess' Fix this by switch the prepending of =3D to a _. This still works as a special character to flag this case without breaking audit. Also move this check behind debug as it should not be needed during normal operqation. Fixes: 26b7899510ae ("apparmor: add support for absolute root view based la= bels") Reported-by: Casey Schaufler Signed-off-by: John Johansen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- security/apparmor/include/lib.h | 5 +++++ security/apparmor/label.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) --- a/security/apparmor/include/lib.h +++ b/security/apparmor/include/lib.h @@ -22,6 +22,11 @@ */ =20 #define DEBUG_ON (aa_g_debug) +/* + * split individual debug cases out in preparation for finer grained + * debug controls in the future. + */ +#define AA_DEBUG_LABEL DEBUG_ON #define dbg_printk(__fmt, __args...) pr_debug(__fmt, ##__args) #define AA_DEBUG(fmt, args...) \ do { \ --- a/security/apparmor/label.c +++ b/security/apparmor/label.c @@ -1631,9 +1631,9 @@ int aa_label_snxprint(char *str, size_t AA_BUG(!str && size !=3D 0); AA_BUG(!label); =20 - if (flags & FLAG_ABS_ROOT) { + if (AA_DEBUG_LABEL && (flags & FLAG_ABS_ROOT)) { ns =3D root_ns; - len =3D snprintf(str, size, "=3D"); + len =3D snprintf(str, size, "_"); update_for_len(total, len, size, str); } else if (!ns) { ns =3D labels_ns(label); @@ -1895,7 +1895,8 @@ struct aa_label *aa_label_strn_parse(str AA_BUG(!str); =20 str =3D skipn_spaces(str, n); - if (str =3D=3D NULL || (*str =3D=3D '=3D' && base !=3D &root_ns->unconfin= ed->label)) + if (str =3D=3D NULL || (AA_DEBUG_LABEL && *str =3D=3D '_' && + base !=3D &root_ns->unconfined->label)) return ERR_PTR(-EINVAL); =20 len =3D label_count_strn_entries(str, end - str); From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81D9AC3F6B0 for ; Tue, 23 Aug 2022 08:12:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242173AbiHWIMm (ORCPT ); Tue, 23 Aug 2022 04:12:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241902AbiHWIJ7 (ORCPT ); Tue, 23 Aug 2022 04:09:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73EA766A60; Tue, 23 Aug 2022 01:06:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF05C611DD; Tue, 23 Aug 2022 08:06:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01527C433D6; Tue, 23 Aug 2022 08:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242000; bh=pq5jl0liAQqHiKcuVEOGf6QiN0IET6PLiMh34kv50FY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XGeelUshXeID6gN2scK4xCghVQ3TiTPbKTAkWxwXGVTxezsseImXFEB4whIu7ajOw bsDX2dcvH/Wj87dnQJVEfdo31o+pxl3yOWVZoyI4o0CQqhvcr5zdaqKiDh//oD5RPH 7gxEx3zNeAoWySeyd7FENKoNSaOTPtHeukofBndw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Johansen Subject: [PATCH 5.19 043/365] apparmor: Fix failed mount permission check error message Date: Tue, 23 Aug 2022 09:59:04 +0200 Message-Id: <20220823080119.976579673@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Johansen commit ec240b5905bbb09a03dccffee03062cf39e38dc2 upstream. When the mount check fails due to a permission check failure instead of explicitly at one of the subcomponent checks, AppArmor is reporting a failure in the flags match. However this is not true and AppArmor can not attribute the error at this point to any particular component, and should only indicate the mount failed due to missing permissions. Fixes: 2ea3ffb7782a ("apparmor: add mount mediation") Signed-off-by: John Johansen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- security/apparmor/mount.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/security/apparmor/mount.c +++ b/security/apparmor/mount.c @@ -229,7 +229,8 @@ static const char * const mnt_info_table "failed srcname match", "failed type match", "failed flags match", - "failed data match" + "failed data match", + "failed perms check" }; =20 /* @@ -284,8 +285,8 @@ static int do_match_mnt(struct aa_dfa *d return 0; } =20 - /* failed at end of flags match */ - return 4; + /* failed at perms check, don't confuse with flags match */ + return 6; } From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 919CCC32793 for ; Tue, 23 Aug 2022 08:13:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240601AbiHWIM5 (ORCPT ); Tue, 23 Aug 2022 04:12:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241986AbiHWIKY (ORCPT ); Tue, 23 Aug 2022 04:10:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B90C5DFB; Tue, 23 Aug 2022 01:06:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E2E52B81C19; Tue, 23 Aug 2022 08:06:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24D3AC433D6; Tue, 23 Aug 2022 08:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242006; bh=A7ts6CbMVjgBAKQlRCgmW3ymHvurmus5NqdLHCsbjTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O+Hlh3vUM7vYcVX4iD+lPPsjcWlhemHzbwp24IaW/TT/a9+FHDppq8BEHTpZfzCtG K1o9lrrBHmNimn2SXO2KU7VgmXFOesktdlrax/KHPjMMQcSL8OgQi7wSQ2VqQcY18P 9KoryVs5Ci/0yYSjotTiUoY1ACIAef9308hS+DhE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , John Johansen Subject: [PATCH 5.19 044/365] apparmor: fix aa_label_asxprint return check Date: Tue, 23 Aug 2022 09:59:05 +0200 Message-Id: <20220823080120.013258481@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tom Rix commit 3e2a3a0830a2090e766d0d887d52c67de2a6f323 upstream. Clang static analysis reports this issue label.c:1802:3: warning: 2nd function call argument is an uninitialized value pr_info("%s", str); ^~~~~~~~~~~~~~~~~~ str is set from a successful call to aa_label_asxprint(&str, ...) On failure a negative value is returned, not a -1. So change the check. Fixes: f1bd904175e8 ("apparmor: add the base fns() for domain labels") Signed-off-by: Tom Rix Signed-off-by: John Johansen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- security/apparmor/label.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/security/apparmor/label.c +++ b/security/apparmor/label.c @@ -1744,7 +1744,7 @@ void aa_label_xaudit(struct audit_buffer if (!use_label_hname(ns, label, flags) || display_mode(ns, label, flags)) { len =3D aa_label_asxprint(&name, ns, label, flags, gfp); - if (len =3D=3D -1) { + if (len < 0) { AA_DEBUG("label print error"); return; } @@ -1772,7 +1772,7 @@ void aa_label_seq_xprint(struct seq_file int len; =20 len =3D aa_label_asxprint(&str, ns, label, flags, gfp); - if (len =3D=3D -1) { + if (len < 0) { AA_DEBUG("label print error"); return; } @@ -1795,7 +1795,7 @@ void aa_label_xprintk(struct aa_ns *ns, int len; =20 len =3D aa_label_asxprint(&str, ns, label, flags, gfp); - if (len =3D=3D -1) { + if (len < 0) { AA_DEBUG("label print error"); return; } From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 158A3C32774 for ; Tue, 23 Aug 2022 08:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241986AbiHWINE (ORCPT ); Tue, 23 Aug 2022 04:13:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241984AbiHWIKY (ORCPT ); Tue, 23 Aug 2022 04:10:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30F95E0F5; Tue, 23 Aug 2022 01:06:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DC207B81C18; Tue, 23 Aug 2022 08:06:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47D88C43470; Tue, 23 Aug 2022 08:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242009; bh=BynSNA2pLc0++aOd/nVe1u0EbpDodCq+xxgBLeUp6rg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pP86Il+04/myRUji9LglaWvEqDY0jlK7pfHGUFMIyeEcgc807pxf/Ehfg06ofHoQq Cl7OEMfwoSN1moJon9fvA1WPl3I4WumPSveda/nwTC9alzh6Bakq0HZh8YWFxyro14 i5IBwuIPJDCenehJorXRLj2h3sRC5iz25PSAzvSw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Johansen Subject: [PATCH 5.19 045/365] apparmor: fix setting unconfined mode on a loaded profile Date: Tue, 23 Aug 2022 09:59:06 +0200 Message-Id: <20220823080120.059478611@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Johansen commit 3bbb7b2e9bbcd22e539e23034da753898fe3b4dc upstream. When loading a profile that is set to unconfined mode, that label flag is not set when it should be. Ensure it is set so that when used in a label the unconfined check will be applied correctly. Fixes: 038165070aa5 ("apparmor: allow setting any profile into the unconfin= ed state") Signed-off-by: John Johansen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- security/apparmor/policy_unpack.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -746,16 +746,18 @@ static struct aa_profile *unpack_profile profile->label.flags |=3D FLAG_HAT; if (!unpack_u32(e, &tmp, NULL)) goto fail; - if (tmp =3D=3D PACKED_MODE_COMPLAIN || (e->version & FORCE_COMPLAIN_FLAG)) + if (tmp =3D=3D PACKED_MODE_COMPLAIN || (e->version & FORCE_COMPLAIN_FLAG)= ) { profile->mode =3D APPARMOR_COMPLAIN; - else if (tmp =3D=3D PACKED_MODE_ENFORCE) + } else if (tmp =3D=3D PACKED_MODE_ENFORCE) { profile->mode =3D APPARMOR_ENFORCE; - else if (tmp =3D=3D PACKED_MODE_KILL) + } else if (tmp =3D=3D PACKED_MODE_KILL) { profile->mode =3D APPARMOR_KILL; - else if (tmp =3D=3D PACKED_MODE_UNCONFINED) + } else if (tmp =3D=3D PACKED_MODE_UNCONFINED) { profile->mode =3D APPARMOR_UNCONFINED; - else + profile->label.flags |=3D FLAG_UNCONFINED; + } else { goto fail; + } if (!unpack_u32(e, &tmp, NULL)) goto fail; if (tmp) From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC9FFC32774 for ; Tue, 23 Aug 2022 08:13:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242284AbiHWINm (ORCPT ); Tue, 23 Aug 2022 04:13:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242011AbiHWIK1 (ORCPT ); Tue, 23 Aug 2022 04:10:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64C27F22; Tue, 23 Aug 2022 01:06:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 00731611DD; Tue, 23 Aug 2022 08:06:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06A2FC433D6; Tue, 23 Aug 2022 08:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242018; bh=Avg86YgDdyu2v0jtz82RqyS8CWRkcNshlaeC/O9+9Gc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OjqIUux0NPxSwsj6qY2ajFXkfflhYrGik6rVUHJTpzhxMzA/Cu09blkkz2LBjbEeI W0QXGhVG3cehT4eCtelUxR8CBAMQjNoMKLGIE+RQGD09hM9IbFZhRLymCFE8KYo9gW DGAhlshLOyLATdtGwcNGz7TsTsGmZ10UwhehdisQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Johansen Subject: [PATCH 5.19 046/365] apparmor: fix overlapping attachment computation Date: Tue, 23 Aug 2022 09:59:07 +0200 Message-Id: <20220823080120.110374303@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Johansen commit 2504db207146543736e877241f3b3de005cbe056 upstream. When finding the profile via patterned attachments, the longest left match is being set to the static compile time value and not using the runtime computed value. Fix this by setting the candidate value to the greater of the precomputed value or runtime computed value. Fixes: 21f606610502 ("apparmor: improve overlapping domain attachment resol= ution") Signed-off-by: John Johansen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- security/apparmor/domain.c | 2 +- security/apparmor/include/policy.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/security/apparmor/domain.c +++ b/security/apparmor/domain.c @@ -466,7 +466,7 @@ restart: * xattrs, or a longer match */ candidate =3D profile; - candidate_len =3D profile->xmatch_len; + candidate_len =3D max(count, profile->xmatch_len); candidate_xattrs =3D ret; conflict =3D false; } --- a/security/apparmor/include/policy.h +++ b/security/apparmor/include/policy.h @@ -135,7 +135,7 @@ struct aa_profile { =20 const char *attach; struct aa_dfa *xmatch; - int xmatch_len; + unsigned int xmatch_len; enum audit_mode audit; long mode; u32 path_flags; From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14141C32774 for ; Tue, 23 Aug 2022 08:13:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242261AbiHWINa (ORCPT ); Tue, 23 Aug 2022 04:13:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242013AbiHWIK1 (ORCPT ); Tue, 23 Aug 2022 04:10:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82E2726E2; Tue, 23 Aug 2022 01:07:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1F472610AA; Tue, 23 Aug 2022 08:07:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 119ECC433D6; Tue, 23 Aug 2022 08:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242024; bh=uPEDf+H+9p9j/UybwHupxb1s2C5Sf1klNm8f8v4Kf9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EO4HxgJyQ47HBDvudo5QRRhUgSSjNNXvIkyXh7+Rkmk5Fkp5o7EUd8Zy0a3oRNKCk csrQZREEXzFlCBeUmBOHx1wB1PyZlb5WE2SsJMtKBgRRLyNAongPFDQA9B8SxVqKoX y0u3PF8ky/dxhn44g+OOJeXYZwEztDrjUMpIePAY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiyu Yang , Xin Tan , Xin Xiong , John Johansen Subject: [PATCH 5.19 047/365] apparmor: fix reference count leak in aa_pivotroot() Date: Tue, 23 Aug 2022 09:59:08 +0200 Message-Id: <20220823080120.151196726@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xin Xiong commit 11c3627ec6b56c1525013f336f41b79a983b4d46 upstream. The aa_pivotroot() function has a reference counting bug in a specific path. When aa_replace_current_label() returns on success, the function forgets to decrement the reference count of =E2=80=9Ctarget=E2=80=9D, which= is increased earlier by build_pivotroot(), causing a reference leak. Fix it by decreasing the refcount of =E2=80=9Ctarget=E2=80=9D in that path. Fixes: 2ea3ffb7782a ("apparmor: add mount mediation") Co-developed-by: Xiyu Yang Signed-off-by: Xiyu Yang Co-developed-by: Xin Tan Signed-off-by: Xin Tan Signed-off-by: Xin Xiong Signed-off-by: John Johansen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- security/apparmor/mount.c | 1 + 1 file changed, 1 insertion(+) --- a/security/apparmor/mount.c +++ b/security/apparmor/mount.c @@ -719,6 +719,7 @@ int aa_pivotroot(struct aa_label *label, aa_put_label(target); goto out; } + aa_put_label(target); } else /* already audited error */ error =3D PTR_ERR(target); From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5FE2C32774 for ; Tue, 23 Aug 2022 08:13:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242053AbiHWINe (ORCPT ); Tue, 23 Aug 2022 04:13:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242021AbiHWIK3 (ORCPT ); Tue, 23 Aug 2022 04:10:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC3FFB486; Tue, 23 Aug 2022 01:07:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A3B4611A8; Tue, 23 Aug 2022 08:07:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CB83C433D6; Tue, 23 Aug 2022 08:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242030; bh=2lB3I7+8Hem0I6Ax5aso+WvIIZirR+UtJ+Zd6sfcEwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EZ37ls95H5d2tWxsmAjFPtXSL2W5Uu/piW37u+NwHFZf7Mp3c60yf6pcV7qHPwOap UR06kovDU53DDFCY5eIKDaZ6XG1OCvQ9MXucQ0Md+z5c+b/MY4pb5pmWXrzi6ajlaf mCE8r9DzQAdN+Udy+S9cTfiwTObyuFtrpMMw5VOo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiu Jianfeng , John Johansen Subject: [PATCH 5.19 048/365] apparmor: Fix memleak in aa_simple_write_to_buffer() Date: Tue, 23 Aug 2022 09:59:09 +0200 Message-Id: <20220823080120.191326733@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiu Jianfeng commit 417ea9fe972d2654a268ad66e89c8fcae67017c3 upstream. When copy_from_user failed, the memory is freed by kvfree. however the management struct and data blob are allocated independently, so only kvfree(data) cause a memleak issue here. Use aa_put_loaddata(data) to fix this issue. Fixes: a6a52579e52b5 ("apparmor: split load data into management struct and= data blob") Signed-off-by: Xiu Jianfeng Signed-off-by: John Johansen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- security/apparmor/apparmorfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -401,7 +401,7 @@ static struct aa_loaddata *aa_simple_wri =20 data->size =3D copy_size; if (copy_from_user(data->data, userbuf, copy_size)) { - kvfree(data); + aa_put_loaddata(data); return ERR_PTR(-EFAULT); } From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76142C32774 for ; Tue, 23 Aug 2022 08:14:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242141AbiHWIN7 (ORCPT ); Tue, 23 Aug 2022 04:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242039AbiHWIKb (ORCPT ); Tue, 23 Aug 2022 04:10:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30045BCA2; Tue, 23 Aug 2022 01:07:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D10E3B81C18; Tue, 23 Aug 2022 08:07:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25831C433C1; Tue, 23 Aug 2022 08:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242036; bh=wAb9caDwUzbk7UBhI7cFlk+Z8maI1Aajsuhg8IEI720=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tYDDFkACIelWAlOq8iB8pDShaVi0OjYZgKsXKOXyLLpniy0ayYW80FdrZXyhBHRgL 8H5A+rx3LhjE7h+B78d6wElD0miiBVUNK2kns1SYdcVd93GSr3YFVxyuaLbRe95+xb x3a+jhMMeUy4y99Vn7edHADs0e+pFctzH27JGWeY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qifu Zhang , Tony Luck , "Rafael J. Wysocki" Subject: [PATCH 5.19 049/365] Documentation: ACPI: EINJ: Fix obsolete example Date: Tue, 23 Aug 2022 09:59:10 +0200 Message-Id: <20220823080120.237178456@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qifu Zhang commit 9066e151c37950af92c3be6a7270daa8e8063db9 upstream. Since commit 488dac0c9237 ("libfs: fix error cast of negative value in simple_attr_write()"), the EINJ debugfs interface no longer accepts negative values as input. Attempt to do so will result in EINVAL. Fixes: 488dac0c9237 ("libfs: fix error cast of negative value in simple_att= r_write()") Signed-off-by: Qifu Zhang Reviewed-by: Tony Luck Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/firmware-guide/acpi/apei/einj.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/Documentation/firmware-guide/acpi/apei/einj.rst +++ b/Documentation/firmware-guide/acpi/apei/einj.rst @@ -168,7 +168,7 @@ An error injection example:: 0x00000008 Memory Correctable 0x00000010 Memory Uncorrectable non-fatal # echo 0x12345000 > param1 # Set memory address for injection - # echo $((-1 << 12)) > param2 # Mask 0xfffffffffffff000 - anywhere in t= his page + # echo 0xfffffffffffff000 > param2 # Mask - anywhere in this page # echo 0x8 > error_type # Choose correctable memory error # echo 1 > error_inject # Inject now From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FEFBC32774 for ; Tue, 23 Aug 2022 08:14:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242223AbiHWIOM (ORCPT ); Tue, 23 Aug 2022 04:14:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242065AbiHWIKd (ORCPT ); Tue, 23 Aug 2022 04:10:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58A2B696ED; Tue, 23 Aug 2022 01:07:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BBA19611A8; Tue, 23 Aug 2022 08:07:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BFE9C433C1; Tue, 23 Aug 2022 08:07:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242043; bh=QNfINd91NqgJ9BUqFSr2vO2WJPc3BM8wKhR0VOZG5r4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TJSH4q6Az0TXVHESSsBBALcdckEZqwh486+SJOUt7nbX/oZ5SK+NCQHIA9G2gGUs5 OZbYu3O85LM1pwtJNW6RZLi7ctzq5kXT96kePrg9cX/eYVS7Rlka+AtC4xCKYNZYgI G/hV7zX31WsB7mNcapOK5TRIUNb0Yx2sHlzoDTYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangbin Liu , Florian Westphal , Jakub Kicinski Subject: [PATCH 5.19 050/365] netfilter: nf_tables: fix crash when nf_trace is enabled Date: Tue, 23 Aug 2022 09:59:11 +0200 Message-Id: <20220823080120.280846182@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit 399a14ec7993d605740de7b2cd5c0ce8407d12ed upstream. do not access info->pkt when info->trace is not 1. nft_traceinfo is not initialized, except when tracing is enabled. The 'nft_trace_enabled' static key cannot be used for this, we must always check info->trace first. Pass nft_pktinfo directly to avoid this. Fixes: e34b9ed96ce3 ("netfilter: nf_tables: avoid skb access on nf_stolen") Reported-by: Hangbin Liu Signed-off-by: Florian Westphal Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_tables_core.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/net/netfilter/nf_tables_core.c b/net/netfilter/nf_tables_core.c index 3ddce24ac76d..cee3e4e905ec 100644 --- a/net/netfilter/nf_tables_core.c +++ b/net/netfilter/nf_tables_core.c @@ -34,25 +34,23 @@ static noinline void __nft_trace_packet(struct nft_trac= einfo *info, nft_trace_notify(info); } =20 -static inline void nft_trace_packet(struct nft_traceinfo *info, +static inline void nft_trace_packet(const struct nft_pktinfo *pkt, + struct nft_traceinfo *info, const struct nft_chain *chain, const struct nft_rule_dp *rule, enum nft_trace_types type) { if (static_branch_unlikely(&nft_trace_enabled)) { - const struct nft_pktinfo *pkt =3D info->pkt; - info->nf_trace =3D pkt->skb->nf_trace; info->rule =3D rule; __nft_trace_packet(info, chain, type); } } =20 -static inline void nft_trace_copy_nftrace(struct nft_traceinfo *info) +static inline void nft_trace_copy_nftrace(const struct nft_pktinfo *pkt, + struct nft_traceinfo *info) { if (static_branch_unlikely(&nft_trace_enabled)) { - const struct nft_pktinfo *pkt =3D info->pkt; - if (info->trace) info->nf_trace =3D pkt->skb->nf_trace; } @@ -96,7 +94,6 @@ static noinline void __nft_trace_verdict(struct nft_trace= info *info, const struct nft_chain *chain, const struct nft_regs *regs) { - const struct nft_pktinfo *pkt =3D info->pkt; enum nft_trace_types type; =20 switch (regs->verdict.code) { @@ -110,7 +107,9 @@ static noinline void __nft_trace_verdict(struct nft_tra= ceinfo *info, break; default: type =3D NFT_TRACETYPE_RULE; - info->nf_trace =3D pkt->skb->nf_trace; + + if (info->trace) + info->nf_trace =3D info->pkt->skb->nf_trace; break; } =20 @@ -271,10 +270,10 @@ nft_do_chain(struct nft_pktinfo *pkt, void *priv) switch (regs.verdict.code) { case NFT_BREAK: regs.verdict.code =3D NFT_CONTINUE; - nft_trace_copy_nftrace(&info); + nft_trace_copy_nftrace(pkt, &info); continue; case NFT_CONTINUE: - nft_trace_packet(&info, chain, rule, + nft_trace_packet(pkt, &info, chain, rule, NFT_TRACETYPE_RULE); continue; } @@ -318,7 +317,7 @@ nft_do_chain(struct nft_pktinfo *pkt, void *priv) goto next_rule; } =20 - nft_trace_packet(&info, basechain, NULL, NFT_TRACETYPE_POLICY); + nft_trace_packet(pkt, &info, basechain, NULL, NFT_TRACETYPE_POLICY); =20 if (static_branch_unlikely(&nft_counters_enabled)) nft_update_chain_stats(basechain, pkt); --=20 2.37.2 From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5EB0C32774 for ; Tue, 23 Aug 2022 08:14:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242347AbiHWIOP (ORCPT ); Tue, 23 Aug 2022 04:14:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242076AbiHWIKf (ORCPT ); Tue, 23 Aug 2022 04:10:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4DB3696F5; Tue, 23 Aug 2022 01:07:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 61742611A8; Tue, 23 Aug 2022 08:07:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EB65C433D6; Tue, 23 Aug 2022 08:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242052; bh=h3xjcasmKH79T4Xe1CGuqxknob4/8v+qLXk+cPNXymg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CYRNaDX8qjXiFoN5DsLPZJz8f4FizKWSokAzBXomYZ0sgdNd/8oi16wl483kqV9Pr nJuJfIvcibeBAkymKNaQELkZdBZ2FNyM+83CU0r4jLP44yjMc9ZdB7WEJCYVXEQVhK oF442carRbgFkkpdl5XvnJxwa0Yd4Sgb8shsBNfE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cezar Bulinaru , Willem de Bruijn , "David S. Miller" Subject: [PATCH 5.19 051/365] net: tap: NULL pointer derefence in dev_parse_header_protocol when skb->dev is null Date: Tue, 23 Aug 2022 09:59:12 +0200 Message-Id: <20220823080120.322529519@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cezar Bulinaru commit 4f61f133f354853bc394ec7d6028adb9b02dd701 upstream. Fixes a NULL pointer derefence bug triggered from tap driver. When tap_get_user calls virtio_net_hdr_to_skb the skb->dev is null (in tap.c skb->dev is set after the call to virtio_net_hdr_to_skb) virtio_net_hdr_to_skb calls dev_parse_header_protocol which needs skb->dev field to be valid. The line that trigers the bug is in dev_parse_header_protocol (dev is at offset 0x10 from skb and is stored in RAX register) if (!dev->header_ops || !dev->header_ops->parse_protocol) 22e1: mov 0x10(%rbx),%rax 22e5: mov 0x230(%rax),%rax Setting skb->dev before the call in tap.c fixes the issue. BUG: kernel NULL pointer dereference, address: 0000000000000230 RIP: 0010:virtio_net_hdr_to_skb.constprop.0+0x335/0x410 [tap] Code: c0 0f 85 b7 fd ff ff eb d4 41 39 c6 77 cf 29 c6 48 89 df 44 01 f6 e8 = 7a 79 83 c1 48 85 c0 0f 85 d9 fd ff ff eb b7 48 8b 43 10 <48> 8b 80 30 02 0= 0 00 48 85 c0 74 55 48 8b 40 28 48 85 c0 74 4c 48 RSP: 0018:ffffc90005c27c38 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff888298f25300 RCX: 0000000000000010 RDX: 0000000000000005 RSI: ffffc90005c27cb6 RDI: ffff888298f25300 RBP: ffffc90005c27c80 R08: 00000000ffffffea R09: 00000000000007e8 R10: ffff88858ec77458 R11: 0000000000000000 R12: 0000000000000001 R13: 0000000000000014 R14: ffffc90005c27e08 R15: ffffc90005c27cb6 FS: 0000000000000000(0000) GS:ffff88858ec40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000230 CR3: 0000000281408006 CR4: 00000000003706e0 Call Trace: tap_get_user+0x3f1/0x540 [tap] tap_sendmsg+0x56/0x362 [tap] ? get_tx_bufs+0xc2/0x1e0 [vhost_net] handle_tx_copy+0x114/0x670 [vhost_net] handle_tx+0xb0/0xe0 [vhost_net] handle_tx_kick+0x15/0x20 [vhost_net] vhost_worker+0x7b/0xc0 [vhost] ? vhost_vring_call_reset+0x40/0x40 [vhost] kthread+0xfa/0x120 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 Fixes: 924a9bc362a5 ("net: check if protocol extracted by virtio_net_hdr_se= t_proto is correct") Signed-off-by: Cezar Bulinaru Reviewed-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/tap.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -716,10 +716,20 @@ static ssize_t tap_get_user(struct tap_q skb_reset_mac_header(skb); skb->protocol =3D eth_hdr(skb)->h_proto; =20 + rcu_read_lock(); + tap =3D rcu_dereference(q->tap); + if (!tap) { + kfree_skb(skb); + rcu_read_unlock(); + return total_len; + } + skb->dev =3D tap->dev; + if (vnet_hdr_len) { err =3D virtio_net_hdr_to_skb(skb, &vnet_hdr, tap_is_little_endian(q)); if (err) { + rcu_read_unlock(); drop_reason =3D SKB_DROP_REASON_DEV_HDR; goto err_kfree; } @@ -732,8 +742,6 @@ static ssize_t tap_get_user(struct tap_q __vlan_get_protocol(skb, skb->protocol, &depth) !=3D 0) skb_set_network_header(skb, depth); =20 - rcu_read_lock(); - tap =3D rcu_dereference(q->tap); /* copy skb_ubuf_info for callback when skb has no error */ if (zerocopy) { skb_zcopy_init(skb, msg_control); @@ -742,14 +750,8 @@ static ssize_t tap_get_user(struct tap_q uarg->callback(NULL, uarg, false); } =20 - if (tap) { - skb->dev =3D tap->dev; - dev_queue_xmit(skb); - } else { - kfree_skb(skb); - } + dev_queue_xmit(skb); rcu_read_unlock(); - return total_len; =20 err_kfree: From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72584C32774 for ; Tue, 23 Aug 2022 08:14:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241907AbiHWIO1 (ORCPT ); Tue, 23 Aug 2022 04:14:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242090AbiHWIKh (ORCPT ); Tue, 23 Aug 2022 04:10:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E768969F44; Tue, 23 Aug 2022 01:07:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8345961257; Tue, 23 Aug 2022 08:07:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8588EC433C1; Tue, 23 Aug 2022 08:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242058; bh=yJ5PCyL0fQDVPOpEkmsZT39aCDk+9QvIrH0ohk+OdVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kur8zxT7d33SaMRNZzFRDVBw+BXLh4rQJYnmSFaR8N9R5g2iGVmVHRJphtm4tvBLp Tnph10Ulae3G6XGXT0NxXq6yEo2TUN8nKfT43JSUYLjHq0cY31q+DG6iXH455H6C4i spQnYpr9eJE4VHhuFlIdpjD0BJx0fnuzKB/AZHHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.19 052/365] NFSv4.1: Dont decrease the value of seq_nr_highest_sent Date: Tue, 23 Aug 2022 09:59:13 +0200 Message-Id: <20220823080120.371296764@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust commit f07a5d2427fc113dc50c5c818eba8929bc27b8ca upstream. When we're trying to figure out what the server may or may not have seen in terms of request numbers, do not assume that requests with a larger number were missed, just because we saw a reply to a request with a smaller number. Fixes: 3453d5708b33 ("NFSv4.1: Avoid false retries when RPC calls are inter= rupted") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/nfs/nfs4proc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -784,10 +784,9 @@ static void nfs4_slot_sequence_record_se if ((s32)(seqnr - slot->seq_nr_highest_sent) > 0) slot->seq_nr_highest_sent =3D seqnr; } -static void nfs4_slot_sequence_acked(struct nfs4_slot *slot, - u32 seqnr) +static void nfs4_slot_sequence_acked(struct nfs4_slot *slot, u32 seqnr) { - slot->seq_nr_highest_sent =3D seqnr; + nfs4_slot_sequence_record_sent(slot, seqnr); slot->seq_nr_last_acked =3D seqnr; } From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4471FC32774 for ; Tue, 23 Aug 2022 08:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242232AbiHWIOe (ORCPT ); Tue, 23 Aug 2022 04:14:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242102AbiHWIKi (ORCPT ); Tue, 23 Aug 2022 04:10:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DBAD69F59; Tue, 23 Aug 2022 01:07:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1903CB81C19; Tue, 23 Aug 2022 08:07:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BE53C433D6; Tue, 23 Aug 2022 08:07:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242064; bh=2FtPi5InGe8zR+ZqyxViScWdsfKTn2773GtUa3NxpfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FIyGPL2NDCHX1DuxUz+E3pQ0h4lyZua2b2tvXdTOrePM4vqRQcGpbfZswWrPkKktp ppCcSF06bfhFFrNalC+KgpwmDJqAaEtovSmK0B3B48qZFeVwNGB/y+M5iq+iVUySNo odSJvh+d0BDiiHPaK1tPah294qWRyKjTy6WzhkuM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.19 053/365] NFSv4.1: Handle NFS4ERR_DELAY replies to OP_SEQUENCE correctly Date: Tue, 23 Aug 2022 09:59:14 +0200 Message-Id: <20220823080120.412492864@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust commit 7ccafd4b2b9f34e6d8185f796f151c47424e273e upstream. Don't assume that the NFS4ERR_DELAY means that the server is processing this slot id. Fixes: 3453d5708b33 ("NFSv4.1: Avoid false retries when RPC calls are inter= rupted") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/nfs/nfs4proc.c | 1 - 1 file changed, 1 deletion(-) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -853,7 +853,6 @@ static int nfs41_sequence_process(struct __func__, slot->slot_nr, slot->seq_nr); - nfs4_slot_sequence_acked(slot, slot->seq_nr); goto out_retry; case -NFS4ERR_RETRY_UNCACHED_REP: case -NFS4ERR_SEQ_FALSE_RETRY: From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30169C32774 for ; Tue, 23 Aug 2022 08:14:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242401AbiHWIOv (ORCPT ); Tue, 23 Aug 2022 04:14:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242125AbiHWIKl (ORCPT ); Tue, 23 Aug 2022 04:10:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 450CA69F4F; Tue, 23 Aug 2022 01:07:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D75B761257; Tue, 23 Aug 2022 08:07:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D427BC433D6; Tue, 23 Aug 2022 08:07:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242071; bh=+fiLNvK/jrxtzfqvF1MMl97JGRcM/wzb8f52HN2rxYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0j6A+RlsvzwOB1mxSbzo6wS7n40/OKbTI3JSe2CkW1kHLNC2XqxLDLBBV7d0Umi46 PtZ1+0WNFboEGaHuY3e26291NgZv1BHuWdlWWLDEeC5Co3LLy0oy4wDEaFGepQ+E2d B7ONxQTVOpRHHvXH1YxIKLTT2xPENQ+FQIc6M2lQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.19 054/365] NFSv4: Fix races in the legacy idmapper upcall Date: Tue, 23 Aug 2022 09:59:15 +0200 Message-Id: <20220823080120.451541368@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust commit 51fd2eb52c0ca8275a906eed81878ef50ae94eb0 upstream. nfs_idmap_instantiate() will cause the process that is waiting in request_key_with_auxdata() to wake up and exit. If there is a second process waiting for the idmap->idmap_mutex, then it may wake up and start a new call to request_key_with_auxdata(). If the call to idmap_pipe_downcall() from the first process has not yet finished calling nfs_idmap_complete_pipe_upcall_locked(), then we may end up triggering the WARN_ON_ONCE() in nfs_idmap_prepare_pipe_upcall(). The fix is to ensure that we clear idmap->idmap_upcall_data before calling nfs_idmap_instantiate(). Fixes: e9ab41b620e4 ("NFSv4: Clean up the legacy idmapper upcall") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/nfs/nfs4idmap.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) --- a/fs/nfs/nfs4idmap.c +++ b/fs/nfs/nfs4idmap.c @@ -561,22 +561,20 @@ nfs_idmap_prepare_pipe_upcall(struct idm return true; } =20 -static void -nfs_idmap_complete_pipe_upcall_locked(struct idmap *idmap, int ret) +static void nfs_idmap_complete_pipe_upcall(struct idmap_legacy_upcalldata = *data, + int ret) { - struct key *authkey =3D idmap->idmap_upcall_data->authkey; - - kfree(idmap->idmap_upcall_data); - idmap->idmap_upcall_data =3D NULL; - complete_request_key(authkey, ret); - key_put(authkey); + complete_request_key(data->authkey, ret); + key_put(data->authkey); + kfree(data); } =20 -static void -nfs_idmap_abort_pipe_upcall(struct idmap *idmap, int ret) +static void nfs_idmap_abort_pipe_upcall(struct idmap *idmap, + struct idmap_legacy_upcalldata *data, + int ret) { - if (idmap->idmap_upcall_data !=3D NULL) - nfs_idmap_complete_pipe_upcall_locked(idmap, ret); + if (cmpxchg(&idmap->idmap_upcall_data, data, NULL) =3D=3D data) + nfs_idmap_complete_pipe_upcall(data, ret); } =20 static int nfs_idmap_legacy_upcall(struct key *authkey, void *aux) @@ -613,7 +611,7 @@ static int nfs_idmap_legacy_upcall(struc =20 ret =3D rpc_queue_upcall(idmap->idmap_pipe, msg); if (ret < 0) - nfs_idmap_abort_pipe_upcall(idmap, ret); + nfs_idmap_abort_pipe_upcall(idmap, data, ret); =20 return ret; out2: @@ -669,6 +667,7 @@ idmap_pipe_downcall(struct file *filp, c struct request_key_auth *rka; struct rpc_inode *rpci =3D RPC_I(file_inode(filp)); struct idmap *idmap =3D (struct idmap *)rpci->private; + struct idmap_legacy_upcalldata *data; struct key *authkey; struct idmap_msg im; size_t namelen_in; @@ -678,10 +677,11 @@ idmap_pipe_downcall(struct file *filp, c * will have been woken up and someone else may now have used * idmap_key_cons - so after this point we may no longer touch it. */ - if (idmap->idmap_upcall_data =3D=3D NULL) + data =3D xchg(&idmap->idmap_upcall_data, NULL); + if (data =3D=3D NULL) goto out_noupcall; =20 - authkey =3D idmap->idmap_upcall_data->authkey; + authkey =3D data->authkey; rka =3D get_request_key_auth(authkey); =20 if (mlen !=3D sizeof(im)) { @@ -703,18 +703,17 @@ idmap_pipe_downcall(struct file *filp, c if (namelen_in =3D=3D 0 || namelen_in =3D=3D IDMAP_NAMESZ) { ret =3D -EINVAL; goto out; -} + } =20 - ret =3D nfs_idmap_read_and_verify_message(&im, - &idmap->idmap_upcall_data->idmap_msg, - rka->target_key, authkey); + ret =3D nfs_idmap_read_and_verify_message(&im, &data->idmap_msg, + rka->target_key, authkey); if (ret >=3D 0) { key_set_timeout(rka->target_key, nfs_idmap_cache_timeout); ret =3D mlen; } =20 out: - nfs_idmap_complete_pipe_upcall_locked(idmap, ret); + nfs_idmap_complete_pipe_upcall(data, ret); out_noupcall: return ret; } @@ -728,7 +727,7 @@ idmap_pipe_destroy_msg(struct rpc_pipe_m struct idmap *idmap =3D data->idmap; =20 if (msg->errno) - nfs_idmap_abort_pipe_upcall(idmap, msg->errno); + nfs_idmap_abort_pipe_upcall(idmap, data, msg->errno); } =20 static void @@ -736,8 +735,11 @@ idmap_release_pipe(struct inode *inode) { struct rpc_inode *rpci =3D RPC_I(inode); struct idmap *idmap =3D (struct idmap *)rpci->private; + struct idmap_legacy_upcalldata *data; =20 - nfs_idmap_abort_pipe_upcall(idmap, -EPIPE); + data =3D xchg(&idmap->idmap_upcall_data, NULL); + if (data) + nfs_idmap_complete_pipe_upcall(data, -EPIPE); } =20 int nfs_map_name_to_uid(const struct nfs_server *server, const char *name,= size_t namelen, kuid_t *uid) From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C571FC32774 for ; Tue, 23 Aug 2022 08:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242330AbiHWIPM (ORCPT ); Tue, 23 Aug 2022 04:15:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242137AbiHWIKp (ORCPT ); Tue, 23 Aug 2022 04:10:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66DFD69F79; Tue, 23 Aug 2022 01:07:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 02F7F6125A; Tue, 23 Aug 2022 08:07:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B8E5C433C1; Tue, 23 Aug 2022 08:07:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242077; bh=zW9GOKdgBwtfC4XKSkr+hf13NidY6ZR2lj8tB2nxVEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=izSQzBcydbTwZb6XqIDWFHOAeabxUiUo9KAaCjeePAeCR77gMEz/6kADTTKeHOsn3 9HEPYSLMZLdh6C7CT49rM97vWwOl95pkiwzcXDimsFN68Tt72Ack8t93uzSHjNQe0t Gl32r4c9L0rwwGG/fqxl99ICsvE5rlI6arm0gGLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Xianwei , Yi Wang , Trond Myklebust Subject: [PATCH 5.19 055/365] NFSv4.1: RECLAIM_COMPLETE must handle EACCES Date: Tue, 23 Aug 2022 09:59:16 +0200 Message-Id: <20220823080120.490852500@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Xianwei commit e35a5e782f67ed76a65ad0f23a484444a95f000f upstream. A client should be able to handle getting an EACCES error while doing a mount operation to reclaim state due to NFS4CLNT_RECLAIM_REBOOT being set. If the server returns RPC_AUTH_BADCRED because authentication failed when we execute "exportfs -au", then RECLAIM_COMPLETE will go a wrong way. After mount succeeds, all OPEN call will fail due to an NFS4ERR_GRACE error being returned. This patch is to fix it by resending a RPC request. Signed-off-by: Zhang Xianwei Signed-off-by: Yi Wang Fixes: aa5190d0ed7d ("NFSv4: Kill nfs4_async_handle_error() abuses by NFSv4= .1") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/nfs/nfs4proc.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -9475,6 +9475,9 @@ static int nfs41_reclaim_complete_handle rpc_delay(task, NFS4_POLL_RETRY_MAX); fallthrough; case -NFS4ERR_RETRY_UNCACHED_REP: + case -EACCES: + dprintk("%s: failed to reclaim complete error %d for server %s, retrying= \n", + __func__, task->tk_status, clp->cl_hostname); return -EAGAIN; case -NFS4ERR_BADSESSION: case -NFS4ERR_DEADSESSION: From nobody Thu Dec 18 12:44:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 485E5C32774 for ; Tue, 23 Aug 2022 08:17:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242464AbiHWIPX (ORCPT ); Tue, 23 Aug 2022 04:15:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242200AbiHWIKw (ORCPT ); Tue, 23 Aug 2022 04:10:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE7226AA06; Tue, 23 Aug 2022 01:08:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F224EB81BF8; Tue, 23 Aug 2022 08:08:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3806FC433D6; Tue, 23 Aug 2022 08:08:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242086; bh=lKwkWDN9Xs9hF1mi2rMPA8cEhCxWgue3cYx+0EB+8Qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QuqelLoyM56qX8AybiCpXz9NF+wVsySz1/QZMFNMnL8BrRbgTsMzWzttZCMya1A0l XrJ70wzJNwa0wNV9qRcFpJJnd4eSAskt/VtwV/yUiWzdacgrqxj16Le3ysQARHQRCS M6z+gq0usS/Ux3+ymxxy/zw7TFT1vLrAxy53N/qA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.19 056/365] NFSv4/pnfs: Fix a use-after-free bug in open Date: Tue, 23 Aug 2022 09:59:17 +0200 Message-Id: <20220823080120.521722033@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust commit 2135e5d56278ffdb1c2e6d325dc6b87f669b9dac upstream. If someone cancels the open RPC call, then we must not try to free either the open slot or the layoutget operation arguments, since they are likely still in use by the hung RPC call. Fixes: 6949493884fe ("NFSv4: Don't hold the layoutget locks across multiple= RPC calls") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/nfs/nfs4proc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3096,12 +3096,13 @@ static int _nfs4_open_and_get_state(stru } =20 out: - if (opendata->lgp) { - nfs4_lgopen_release(opendata->lgp); - opendata->lgp =3D NULL; - } - if (!opendata->cancelled) + if (!opendata->cancelled) { + if (opendata->lgp) { + nfs4_lgopen_release(opendata->lgp); + opendata->lgp =3D NULL; + } nfs4_sequence_free_slot(&opendata->o_res.seq_res); + } return ret; } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57C3EC32789 for ; Tue, 23 Aug 2022 08:16:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242534AbiHWIPa (ORCPT ); Tue, 23 Aug 2022 04:15:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242254AbiHWIK6 (ORCPT ); Tue, 23 Aug 2022 04:10:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70D482DDD; Tue, 23 Aug 2022 01:08:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A20AB81C22; Tue, 23 Aug 2022 08:08:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B890C433D7; Tue, 23 Aug 2022 08:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242093; bh=qCWJLLimkWOnuEsGie3QDabtJTu5m+R5KpFDeCyqPBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KSPwfftVO8z67GgUd9Tdp2jOe5/cuAwFkVGYGqTdj71m3gm7QHHVTGsU9KOuNbQpi fE/HfkSh9bRVf9Bg7P1/D4e4F+Zmb8ZHrmfpWNKJ8FCC1KYIVLEsnC8rtPlt7EcbQZ raNgDh1C1iuRjIzTsuvOvA4CL/RWI4Ujixi+kvDk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Olsa , Daniel Borkmann , Mat Martineau , Martin KaFai Lau Subject: [PATCH 5.19 057/365] mptcp, btf: Add struct mptcp_sock definition when CONFIG_MPTCP is disabled Date: Tue, 23 Aug 2022 09:59:18 +0200 Message-Id: <20220823080120.567931174@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiri Olsa commit f1d41f7720c89705c20e4335a807b1c518c2e7be upstream. The btf_sock_ids array needs struct mptcp_sock BTF ID for the bpf_skc_to_mptcp_sock helper. When CONFIG_MPTCP is disabled, the 'struct mptcp_sock' is not defined and resolve_btfids will complain with: [...] BTFIDS vmlinux WARN: resolve_btfids: unresolved symbol mptcp_sock [...] Add an empty definition for struct mptcp_sock when CONFIG_MPTCP is disabled. Fixes: 3bc253c2e652 ("bpf: Add bpf_skc_to_mptcp_sock_proto") Signed-off-by: Jiri Olsa Signed-off-by: Daniel Borkmann Reviewed-by: Mat Martineau Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/bpf/20220802163324.1873044-1-jolsa@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- include/net/mptcp.h | 4 ++++ 1 file changed, 4 insertions(+) --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -290,4 +290,8 @@ struct mptcp_sock *bpf_mptcp_sock_from_s static inline struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *= sk) { return NULL; } #endif =20 +#if !IS_ENABLED(CONFIG_MPTCP) +struct mptcp_sock { }; +#endif + #endif /* __NET_MPTCP_H */ From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 951BBC32796 for ; Tue, 23 Aug 2022 08:16:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242627AbiHWIPi (ORCPT ); Tue, 23 Aug 2022 04:15:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242326AbiHWILH (ORCPT ); Tue, 23 Aug 2022 04:11:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56CFDE0BD; Tue, 23 Aug 2022 01:08:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64672B81C23; Tue, 23 Aug 2022 08:08:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B193AC433C1; Tue, 23 Aug 2022 08:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242099; bh=Iz3mcDSD/CX4/0hqF9gIv3op0gD/0aLMMXcQHT087NY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M2tjh9En7en5fmFM8DS6Tm9HhhQ+BZqidFjjaX+rUQR8SXLZVlBFBvg3k8Rip6zvR 71JjVaO/U38l6Kqxoj0d8HWElVLhRM0mTvgiBUxh+wYl3T+dGJxKEZ/F+NVrdx6Wgt Vzb0LonoGJHy+LTr8myX4EcUMjBSvkTUvxqx7xLQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nguyen Dinh Phi , Mat Martineau , Paolo Abeni , "David S. Miller" Subject: [PATCH 5.19 058/365] mptcp: move subflow cleanup in mptcp_destroy_common() Date: Tue, 23 Aug 2022 09:59:19 +0200 Message-Id: <20220823080120.606301802@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paolo Abeni commit c0bf3c6aa444a5ef44acc57ef6cfa53fd4fc1c9b upstream. If the mptcp socket creation fails due to a CGROUP_INET_SOCK_CREATE eBPF program, the MPTCP protocol ends-up leaking all the subflows: the related cleanup happens in __mptcp_destroy_sock() that is not invoked in such code path. Address the issue moving the subflow sockets cleanup in the mptcp_destroy_common() helper, which is invoked in every msk cleanup path. Additionally get rid of the intermediate list_splice_init step, which is an unneeded relic from the past. The issue is present since before the reported root cause commit, but any attempt to backport the fix before that hash will require a complete rewrite. Fixes: e16163b6e2 ("mptcp: refactor shutdown and close") Reported-by: Nguyen Dinh Phi Reviewed-by: Mat Martineau Co-developed-by: Nguyen Dinh Phi Signed-off-by: Nguyen Dinh Phi Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/mptcp/protocol.c | 39 +++++++++++++++------------------------ net/mptcp/protocol.h | 2 +- net/mptcp/subflow.c | 3 ++- 3 files changed, 18 insertions(+), 26 deletions(-) --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2805,30 +2805,16 @@ static void __mptcp_wr_shutdown(struct s =20 static void __mptcp_destroy_sock(struct sock *sk) { - struct mptcp_subflow_context *subflow, *tmp; struct mptcp_sock *msk =3D mptcp_sk(sk); - LIST_HEAD(conn_list); =20 pr_debug("msk=3D%p", msk); =20 might_sleep(); =20 - /* join list will be eventually flushed (with rst) at sock lock release t= ime*/ - list_splice_init(&msk->conn_list, &conn_list); - mptcp_stop_timer(sk); sk_stop_timer(sk, &sk->sk_timer); msk->pm.status =3D 0; =20 - /* clears msk->subflow, allowing the following loop to close - * even the initial subflow - */ - mptcp_dispose_initial_subflow(msk); - list_for_each_entry_safe(subflow, tmp, &conn_list, node) { - struct sock *ssk =3D mptcp_subflow_tcp_sock(subflow); - __mptcp_close_ssk(sk, ssk, subflow, 0); - } - sk->sk_prot->destroy(sk); =20 WARN_ON_ONCE(msk->rmem_fwd_alloc); @@ -2920,24 +2906,20 @@ static void mptcp_copy_inaddrs(struct so =20 static int mptcp_disconnect(struct sock *sk, int flags) { - struct mptcp_subflow_context *subflow, *tmp; struct mptcp_sock *msk =3D mptcp_sk(sk); =20 inet_sk_state_store(sk, TCP_CLOSE); =20 - list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) { - struct sock *ssk =3D mptcp_subflow_tcp_sock(subflow); - - __mptcp_close_ssk(sk, ssk, subflow, MPTCP_CF_FASTCLOSE); - } - mptcp_stop_timer(sk); sk_stop_timer(sk, &sk->sk_timer); =20 if (mptcp_sk(sk)->token) mptcp_event(MPTCP_EVENT_CLOSED, mptcp_sk(sk), NULL, GFP_KERNEL); =20 - mptcp_destroy_common(msk); + /* msk->subflow is still intact, the following will not free the first + * subflow + */ + mptcp_destroy_common(msk, MPTCP_CF_FASTCLOSE); msk->last_snd =3D NULL; WRITE_ONCE(msk->flags, 0); msk->cb_flags =3D 0; @@ -3087,12 +3069,17 @@ out: return newsk; } =20 -void mptcp_destroy_common(struct mptcp_sock *msk) +void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags) { + struct mptcp_subflow_context *subflow, *tmp; struct sock *sk =3D (struct sock *)msk; =20 __mptcp_clear_xmit(sk); =20 + /* join list will be eventually flushed (with rst) at sock lock release t= ime */ + list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) + __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), subflow, flags); + /* move to sk_receive_queue, sk_stream_kill_queues will purge it */ mptcp_data_lock(sk); skb_queue_splice_tail_init(&msk->receive_queue, &sk->sk_receive_queue); @@ -3114,7 +3101,11 @@ static void mptcp_destroy(struct sock *s { struct mptcp_sock *msk =3D mptcp_sk(sk); =20 - mptcp_destroy_common(msk); + /* clears msk->subflow, allowing the following to close + * even the initial subflow + */ + mptcp_dispose_initial_subflow(msk); + mptcp_destroy_common(msk, 0); sk_sockets_allocated_dec(sk); } =20 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -718,7 +718,7 @@ static inline void mptcp_write_space(str } } =20 -void mptcp_destroy_common(struct mptcp_sock *msk); +void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags); =20 #define MPTCP_TOKEN_MAX_RETRIES 4 =20 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -621,7 +621,8 @@ static void mptcp_sock_destruct(struct s sock_orphan(sk); } =20 - mptcp_destroy_common(mptcp_sk(sk)); + /* We don't need to clear msk->subflow, as it's still NULL at this point = */ + mptcp_destroy_common(mptcp_sk(sk), 0); inet_sock_destruct(sk); } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFD26C32774 for ; Tue, 23 Aug 2022 08:16:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242377AbiHWIQy (ORCPT ); Tue, 23 Aug 2022 04:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242416AbiHWILQ (ORCPT ); Tue, 23 Aug 2022 04:11:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1491F2CE00; Tue, 23 Aug 2022 01:08:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3706A611DD; Tue, 23 Aug 2022 08:08:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AE56C433D6; Tue, 23 Aug 2022 08:08:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242105; bh=R9UD5iKyD4G1Gd03IBLTJ7wObvYPDR/v3tniEIsuKDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FDVbJ12vY1eCSg7JulhACGKhW2Jq3GYbgh7xqIHm2kHSFmOeWTG4Z7o0LEKvKpYZm F4nynmmvhiYaW8vJq+Yp1/N/0IaevFbqJ+bL2CYywLY+tDAIKVkgRgsaQYkSL/0EDM Q2Fb6S44uTXCiXT0NgIJzdjjr7IqeSON/3BjseEc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dipanjan Das , Mat Martineau , Paolo Abeni , "David S. Miller" Subject: [PATCH 5.19 059/365] mptcp: do not queue data on closed subflows Date: Tue, 23 Aug 2022 09:59:20 +0200 Message-Id: <20220823080120.655134886@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paolo Abeni commit c886d70286bf3ad411eb3d689328a67f7102c6ae upstream. Dipanjan reported a syzbot splat at close time: WARNING: CPU: 1 PID: 10818 at net/ipv4/af_inet.c:153 inet_sock_destruct+0x6d0/0x8e0 net/ipv4/af_inet.c:153 Modules linked in: uio_ivshmem(OE) uio(E) CPU: 1 PID: 10818 Comm: kworker/1:16 Tainted: G OE 5.19.0-rc6-g2eae0556bb9d #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Workqueue: events mptcp_worker RIP: 0010:inet_sock_destruct+0x6d0/0x8e0 net/ipv4/af_inet.c:153 Code: 21 02 00 00 41 8b 9c 24 28 02 00 00 e9 07 ff ff ff e8 34 4d 91 f9 89 ee 4c 89 e7 e8 4a 47 60 ff e9 a6 fc ff ff e8 20 4d 91 f9 <0f> 0b e9 84 fe ff ff e8 14 4d 91 f9 0f 0b e9 d4 fd ff ff e8 08 4d RSP: 0018:ffffc9001b35fa78 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 00000000002879d0 RCX: ffff8881326f3b00 RDX: 0000000000000000 RSI: ffff8881326f3b00 RDI: 0000000000000002 RBP: ffff888179662674 R08: ffffffff87e983a0 R09: 0000000000000000 R10: 0000000000000005 R11: 00000000000004ea R12: ffff888179662400 R13: ffff888179662428 R14: 0000000000000001 R15: ffff88817e38e258 FS: 0000000000000000(0000) GS:ffff8881f5f00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020007bc0 CR3: 0000000179592000 CR4: 0000000000150ee0 Call Trace: __sk_destruct+0x4f/0x8e0 net/core/sock.c:2067 sk_destruct+0xbd/0xe0 net/core/sock.c:2112 __sk_free+0xef/0x3d0 net/core/sock.c:2123 sk_free+0x78/0xa0 net/core/sock.c:2134 sock_put include/net/sock.h:1927 [inline] __mptcp_close_ssk+0x50f/0x780 net/mptcp/protocol.c:2351 __mptcp_destroy_sock+0x332/0x760 net/mptcp/protocol.c:2828 mptcp_worker+0x5d2/0xc90 net/mptcp/protocol.c:2586 process_one_work+0x9cc/0x1650 kernel/workqueue.c:2289 worker_thread+0x623/0x1070 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302 The root cause of the problem is that an mptcp-level (re)transmit can race with mptcp_close() and the packet scheduler checks the subflow state before acquiring the socket lock: we can try to (re)transmit on an already closed ssk. Fix the issue checking again the subflow socket status under the subflow socket lock protection. Additionally add the missing check for the fallback-to-tcp case. Fixes: d5f49190def6 ("mptcp: allow picking different xmit subflows") Reported-by: Dipanjan Das Reviewed-by: Mat Martineau Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/mptcp/protocol.c | 8 +++++++- net/mptcp/protocol.h | 11 +++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1276,6 +1276,9 @@ static int mptcp_sendmsg_frag(struct soc info->limit > dfrag->data_len)) return 0; =20 + if (unlikely(!__tcp_can_send(ssk))) + return -EAGAIN; + /* compute send limit */ info->mss_now =3D tcp_send_mss(ssk, &info->size_goal, info->flags); copy =3D info->size_goal; @@ -1449,7 +1452,8 @@ static struct sock *mptcp_subflow_get_se if (__mptcp_check_fallback(msk)) { if (!msk->first) return NULL; - return sk_stream_memory_free(msk->first) ? msk->first : NULL; + return __tcp_can_send(msk->first) && + sk_stream_memory_free(msk->first) ? msk->first : NULL; } =20 /* re-use last subflow, if the burst allow that */ @@ -1600,6 +1604,8 @@ void __mptcp_push_pending(struct sock *s =20 ret =3D mptcp_sendmsg_frag(sk, ssk, dfrag, &info); if (ret <=3D 0) { + if (ret =3D=3D -EAGAIN) + continue; mptcp_push_release(ssk, &info); goto out; } --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -625,16 +625,19 @@ void mptcp_info2sockaddr(const struct mp struct sockaddr_storage *addr, unsigned short family); =20 -static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *su= bflow) +static inline bool __tcp_can_send(const struct sock *ssk) { - struct sock *ssk =3D mptcp_subflow_tcp_sock(subflow); + /* only send if our side has not closed yet */ + return ((1 << inet_sk_state_load(ssk)) & (TCPF_ESTABLISHED | TCPF_CLOSE_W= AIT)); +} =20 +static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *su= bflow) +{ /* can't send if JOIN hasn't completed yet (i.e. is usable for mptcp) */ if (subflow->request_join && !subflow->fully_established) return false; =20 - /* only send if our side has not closed yet */ - return ((1 << ssk->sk_state) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)); + return __tcp_can_send(mptcp_subflow_tcp_sock(subflow)); } =20 void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEB8AC32789 for ; Tue, 23 Aug 2022 08:17:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242463AbiHWIRV (ORCPT ); Tue, 23 Aug 2022 04:17:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242474AbiHWILV (ORCPT ); Tue, 23 Aug 2022 04:11:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D4E04DB23; Tue, 23 Aug 2022 01:08:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 83940B81BF8; Tue, 23 Aug 2022 08:08:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB61EC433C1; Tue, 23 Aug 2022 08:08:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242112; bh=/4kHocZ4fRwT5Rs9tihjUYOuPoQZ/ZAaNCXwJv/VS10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OCpeF4PUhlCq3a7yE3vlpxDH18MmlELAIcEyTwFRleXMHobSCzzcKDcGyM72GKn8H UFAE0ztud2a8uPR8y5HpvVWwWOERrO13o138nl44p2R4KF9Bvvpd7pcNJSPwvXAuma kDg014JzN0z+XAW+tSZru3uzeXPmz7WiL7hhk3KU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiumei Mu , Mat Martineau , Florian Westphal , "David S. Miller" Subject: [PATCH 5.19 060/365] selftests: mptcp: make sendfile selftest work Date: Tue, 23 Aug 2022 09:59:21 +0200 Message-Id: <20220823080120.704317819@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit df9e03aec3b14970df05b72d54f8ac9da3ab29e1 upstream. When the selftest got added, sendfile() on mptcp sockets returned -EOPNOTSUPP, so running 'mptcp_connect.sh -m sendfile' failed immediately. This is no longer the case, but the script fails anyway due to timeout. Let the receiver know once the sender has sent all data, just like with '-m mmap' mode. v2: need to respect cfg_wait too, as pm_userspace.sh relied on -m sendfile to keep the connection open (Mat Martineau) Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp") Reported-by: Xiumei Mu Reviewed-by: Mat Martineau Signed-off-by: Florian Westphal Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- tools/testing/selftests/net/mptcp/mptcp_connect.c | 26 ++++++++++++++---= ----- 1 file changed, 17 insertions(+), 9 deletions(-) --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c @@ -553,6 +553,18 @@ static void set_nonblock(int fd, bool no fcntl(fd, F_SETFL, flags & ~O_NONBLOCK); } =20 +static void shut_wr(int fd) +{ + /* Close our write side, ev. give some time + * for address notification and/or checking + * the current status + */ + if (cfg_wait) + usleep(cfg_wait); + + shutdown(fd, SHUT_WR); +} + static int copyfd_io_poll(int infd, int peerfd, int outfd, bool *in_closed= _after_out) { struct pollfd fds =3D { @@ -630,14 +642,7 @@ static int copyfd_io_poll(int infd, int /* ... and peer also closed already */ break; =20 - /* ... but we still receive. - * Close our write side, ev. give some time - * for address notification and/or checking - * the current status - */ - if (cfg_wait) - usleep(cfg_wait); - shutdown(peerfd, SHUT_WR); + shut_wr(peerfd); } else { if (errno =3D=3D EINTR) continue; @@ -767,7 +772,7 @@ static int copyfd_io_mmap(int infd, int if (err) return err; =20 - shutdown(peerfd, SHUT_WR); + shut_wr(peerfd); =20 err =3D do_recvfile(peerfd, outfd); *in_closed_after_out =3D true; @@ -791,6 +796,9 @@ static int copyfd_io_sendfile(int infd, err =3D do_sendfile(infd, peerfd, size); if (err) return err; + + shut_wr(peerfd); + err =3D do_recvfile(peerfd, outfd); *in_closed_after_out =3D true; } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 657C3C32774 for ; Tue, 23 Aug 2022 08:18:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242571AbiHWISB (ORCPT ); Tue, 23 Aug 2022 04:18:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242525AbiHWILa (ORCPT ); Tue, 23 Aug 2022 04:11:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73D33BC06; Tue, 23 Aug 2022 01:08:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6C6D9B81C23; Tue, 23 Aug 2022 08:08:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE0F9C433C1; Tue, 23 Aug 2022 08:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242122; bh=EeylkUgLCn4p9ZrpESSHP7DYVKpbp0rW7nVla7+NLN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=keDDQyp9S/udh6HHjzzVJnmiDyB3ztUCkVIkQUSPmBAG++ZZF8KhcVWAEHab5dnQ0 xiEkolW/01AdYS2VScy3cVe7mjYlIDiU2PHHtpiLf4f/eDmyxdrnf1KuVsuUvazpKb AK2jVylPzS03JvYqEwGpMiWYeb9Ua7Ay4HU7E34M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jinghao Jia , Yonghong Song , Alexei Starovoitov Subject: [PATCH 5.19 061/365] BPF: Fix potential bad pointer dereference in bpf_sys_bpf() Date: Tue, 23 Aug 2022 09:59:22 +0200 Message-Id: <20220823080120.752009880@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jinghao Jia commit e2dcac2f58f5a95ab092d1da237ffdc0da1832cf upstream. The bpf_sys_bpf() helper function allows an eBPF program to load another eBPF program from within the kernel. In this case the argument union bpf_attr pointer (as well as the insns and license pointers inside) is a kernel address instead of a userspace address (which is the case of a usual bpf() syscall). To make the memory copying process in the syscall work in both cases, bpfptr_t was introduced to wrap around the pointer and distinguish its origin. Specifically, when copying memory contents from a bpfptr_t, a copy_from_user() is performed in case of a userspace address and a memcpy() is performed for a kernel address. This can lead to problems because the in-kernel pointer is never checked for validity. The problem happens when an eBPF syscall program tries to call bpf_sys_bpf() to load a program but provides a bad insns pointer -- say 0xdeadbeef -- in the bpf_attr union. The helper calls __sys_bpf() which would then call bpf_prog_load() to load the program. bpf_prog_load() is responsible for copying the eBPF instructions to the newly allocated memory for the program; it creates a kernel bpfptr_t for insns and invokes copy_from_bpfptr(). Internally, all bpfptr_t operations are backed by the corresponding sockptr_t operations, which performs direct memcpy() on kernel pointers for copy_from/strncpy_from operations. Therefore, the code is always happy to dereference the bad pointer to trigger a un-handle-able page fault and in turn an oops. However, this is not supposed to happen because at that point the eBPF program is already verified and should not cause a memory error. Sample KASAN trace: [ 25.685056][ T228] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ 25.685680][ T228] BUG: KASAN: user-memory-access in copy_from_bpfptr+0= x21/0x30 [ 25.686210][ T228] Read of size 80 at addr 00000000deadbeef by task poc= /228 [ 25.686732][ T228] [ 25.686893][ T228] CPU: 3 PID: 228 Comm: poc Not tainted 5.19.0-rc7 #7 [ 25.687375][ T228] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996= ), BIOS d55cb5a 04/01/2014 [ 25.687991][ T228] Call Trace: [ 25.688223][ T228] [ 25.688429][ T228] dump_stack_lvl+0x73/0x9e [ 25.688747][ T228] print_report+0xea/0x200 [ 25.689061][ T228] ? copy_from_bpfptr+0x21/0x30 [ 25.689401][ T228] ? _printk+0x54/0x6e [ 25.689693][ T228] ? _raw_spin_lock_irqsave+0x70/0xd0 [ 25.690071][ T228] ? copy_from_bpfptr+0x21/0x30 [ 25.690412][ T228] kasan_report+0xb5/0xe0 [ 25.690716][ T228] ? copy_from_bpfptr+0x21/0x30 [ 25.691059][ T228] kasan_check_range+0x2bd/0x2e0 [ 25.691405][ T228] ? copy_from_bpfptr+0x21/0x30 [ 25.691734][ T228] memcpy+0x25/0x60 [ 25.692000][ T228] copy_from_bpfptr+0x21/0x30 [ 25.692328][ T228] bpf_prog_load+0x604/0x9e0 [ 25.692653][ T228] ? cap_capable+0xb4/0xe0 [ 25.692956][ T228] ? security_capable+0x4f/0x70 [ 25.693324][ T228] __sys_bpf+0x3af/0x580 [ 25.693635][ T228] bpf_sys_bpf+0x45/0x240 [ 25.693937][ T228] bpf_prog_f0ec79a5a3caca46_bpf_func1+0xa2/0xbd [ 25.694394][ T228] bpf_prog_run_pin_on_cpu+0x2f/0xb0 [ 25.694756][ T228] bpf_prog_test_run_syscall+0x146/0x1c0 [ 25.695144][ T228] bpf_prog_test_run+0x172/0x190 [ 25.695487][ T228] __sys_bpf+0x2c5/0x580 [ 25.695776][ T228] __x64_sys_bpf+0x3a/0x50 [ 25.696084][ T228] do_syscall_64+0x60/0x90 [ 25.696393][ T228] ? fpregs_assert_state_consistent+0x50/0x60 [ 25.696815][ T228] ? exit_to_user_mode_prepare+0x36/0xa0 [ 25.697202][ T228] ? syscall_exit_to_user_mode+0x20/0x40 [ 25.697586][ T228] ? do_syscall_64+0x6e/0x90 [ 25.697899][ T228] entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 25.698312][ T228] RIP: 0033:0x7f6d543fb759 [ 25.698624][ T228] Code: 08 5b 89 e8 5d c3 66 2e 0f 1f 84 00 00 00 00 0= 0 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0= f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 97 a6 0e 00 f7 d8 64 89 01 48 [ 25.699946][ T228] RSP: 002b:00007ffc3df78468 EFLAGS: 00000287 ORIG_RAX= : 0000000000000141 [ 25.700526][ T228] RAX: ffffffffffffffda RBX: 00007ffc3df78628 RCX: 000= 07f6d543fb759 [ 25.701071][ T228] RDX: 0000000000000090 RSI: 00007ffc3df78478 RDI: 000= 000000000000a [ 25.701636][ T228] RBP: 00007ffc3df78510 R08: 0000000000000000 R09: 000= 0000000300000 [ 25.702191][ T228] R10: 0000000000000005 R11: 0000000000000287 R12: 000= 0000000000000 [ 25.702736][ T228] R13: 00007ffc3df78638 R14: 000055a1584aca68 R15: 000= 07f6d5456a000 [ 25.703282][ T228] [ 25.703490][ T228] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ 25.704050][ T228] Disabling lock debugging due to kernel taint Update copy_from_bpfptr() and strncpy_from_bpfptr() so that: - for a kernel pointer, it uses the safe copy_from_kernel_nofault() and strncpy_from_kernel_nofault() functions. - for a userspace pointer, it performs copy_from_user() and strncpy_from_user(). Fixes: af2ac3e13e45 ("bpf: Prepare bpf syscall to be used from kernel and u= ser space.") Link: https://lore.kernel.org/bpf/20220727132905.45166-1-jinghao@linux.ibm.= com/ Signed-off-by: Jinghao Jia Acked-by: Yonghong Song Link: https://lore.kernel.org/r/20220729201713.88688-1-jinghao@linux.ibm.com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- include/linux/bpfptr.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/include/linux/bpfptr.h +++ b/include/linux/bpfptr.h @@ -49,7 +49,9 @@ static inline void bpfptr_add(bpfptr_t * static inline int copy_from_bpfptr_offset(void *dst, bpfptr_t src, size_t offset, size_t size) { - return copy_from_sockptr_offset(dst, (sockptr_t) src, offset, size); + if (!bpfptr_is_kernel(src)) + return copy_from_user(dst, src.user + offset, size); + return copy_from_kernel_nofault(dst, src.kernel + offset, size); } =20 static inline int copy_from_bpfptr(void *dst, bpfptr_t src, size_t size) @@ -78,7 +80,9 @@ static inline void *kvmemdup_bpfptr(bpfp =20 static inline long strncpy_from_bpfptr(char *dst, bpfptr_t src, size_t cou= nt) { - return strncpy_from_sockptr(dst, (sockptr_t) src, count); + if (bpfptr_is_kernel(src)) + return strncpy_from_kernel_nofault(dst, src.kernel, count); + return strncpy_from_user(dst, src.user, count); } =20 #endif /* _LINUX_BPFPTR_H */ From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80E53C32793 for ; Tue, 23 Aug 2022 08:17:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242355AbiHWIRb (ORCPT ); Tue, 23 Aug 2022 04:17:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242560AbiHWILd (ORCPT ); Tue, 23 Aug 2022 04:11:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C2AE6B152; Tue, 23 Aug 2022 01:08:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 145A96123D; Tue, 23 Aug 2022 08:08:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CB33C433D6; Tue, 23 Aug 2022 08:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242128; bh=rhyB6i+Er1SWoPwFIMMk0wov/QnS/fbCmU1KUM1Bc58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ROtxdsLKadMENzUphZRo7gTZ1fsgFbV/Wq3hBNZuADosxmeTCx0Gloc1DtEpH4T/f 1D01zIgg8s3aqenmU4Z1HJPuYqZY/XGwyXH8LrAAh8w9mhrnMOcLokcoTN7ghG5ZZV J0ihVU5Er/cQht+mL6KmiqvhR5ftwD9sHT8zIAHA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YiFei Zhu , Alexei Starovoitov Subject: [PATCH 5.19 062/365] bpf: Disallow bpf programs call prog_run command. Date: Tue, 23 Aug 2022 09:59:23 +0200 Message-Id: <20220823080120.784563663@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexei Starovoitov commit 86f44fcec22ce2979507742bc53db8400e454f46 upstream. The verifier cannot perform sufficient validation of bpf_attr->test.ctx_in pointer, therefore bpf programs should not be allowed to call BPF_PROG_RUN command from within the program. To fix this issue split bpf_sys_bpf() bpf helper into normal kern_sys_bpf() kernel function that can only be used by the kernel light skeleton directly. Reported-by: YiFei Zhu Fixes: b1d18a7574d0 ("bpf: Extend sys_bpf commands for bpf_syscall programs= .") Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- kernel/bpf/syscall.c | 20 ++++++++++++++------ tools/lib/bpf/skel_internal.h | 4 ++-- 2 files changed, 16 insertions(+), 8 deletions(-) --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -5035,9 +5035,6 @@ static bool syscall_prog_is_valid_access =20 BPF_CALL_3(bpf_sys_bpf, int, cmd, union bpf_attr *, attr, u32, attr_size) { - struct bpf_prog * __maybe_unused prog; - struct bpf_tramp_run_ctx __maybe_unused run_ctx; - switch (cmd) { case BPF_MAP_CREATE: case BPF_MAP_UPDATE_ELEM: @@ -5047,6 +5044,18 @@ BPF_CALL_3(bpf_sys_bpf, int, cmd, union case BPF_LINK_CREATE: case BPF_RAW_TRACEPOINT_OPEN: break; + default: + return -EINVAL; + } + return __sys_bpf(cmd, KERNEL_BPFPTR(attr), attr_size); +} + +int kern_sys_bpf(int cmd, union bpf_attr *attr, unsigned int size) +{ + struct bpf_prog * __maybe_unused prog; + struct bpf_tramp_run_ctx __maybe_unused run_ctx; + + switch (cmd) { #ifdef CONFIG_BPF_JIT /* __bpf_prog_enter_sleepable used by trampoline and= JIT */ case BPF_PROG_TEST_RUN: if (attr->test.data_in || attr->test.data_out || @@ -5077,11 +5086,10 @@ BPF_CALL_3(bpf_sys_bpf, int, cmd, union return 0; #endif default: - return -EINVAL; + return ____bpf_sys_bpf(cmd, attr, size); } - return __sys_bpf(cmd, KERNEL_BPFPTR(attr), attr_size); } -EXPORT_SYMBOL(bpf_sys_bpf); +EXPORT_SYMBOL(kern_sys_bpf); =20 static const struct bpf_func_proto bpf_sys_bpf_proto =3D { .func =3D bpf_sys_bpf, --- a/tools/lib/bpf/skel_internal.h +++ b/tools/lib/bpf/skel_internal.h @@ -66,13 +66,13 @@ struct bpf_load_and_run_opts { const char *errstr; }; =20 -long bpf_sys_bpf(__u32 cmd, void *attr, __u32 attr_size); +long kern_sys_bpf(__u32 cmd, void *attr, __u32 attr_size); =20 static inline int skel_sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr, unsigned int size) { #ifdef __KERNEL__ - return bpf_sys_bpf(cmd, attr, size); + return kern_sys_bpf(cmd, attr, size); #else return syscall(__NR_bpf, cmd, attr, size); #endif From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B4B6C32772 for ; Tue, 23 Aug 2022 08:25:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243414AbiHWIZH (ORCPT ); Tue, 23 Aug 2022 04:25:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243431AbiHWIVJ (ORCPT ); Tue, 23 Aug 2022 04:21:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48E3B6EF30; Tue, 23 Aug 2022 01:12:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0F84EB81C3B; Tue, 23 Aug 2022 08:12:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 634CEC433D6; Tue, 23 Aug 2022 08:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242342; bh=z+CGCDyFSMPbd/EN3DNknlU9RDhJkyHosZULARlSM94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TPUN3aFZXheTy8L+51Vm+bKgM7oCOoM5UuuYJUOk8/DY5IfkeomfFmdxWaoJYIkxs oiLPPnmKqenYDXibY9XV8yA8SZYldOrQpTi7MhkBDOeB5YlIHdsDEENyezCqXgzLD2 i1qS8y2L5rAuQYt5uCAwwsXqh7bFwg3KB/LWsjuE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yonghong Song , Kumar Kartikeya Dwivedi , Martin KaFai Lau , Alexei Starovoitov Subject: [PATCH 5.19 063/365] bpf: Dont reinit map value in prealloc_lru_pop Date: Tue, 23 Aug 2022 09:59:24 +0200 Message-Id: <20220823080120.831080541@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kumar Kartikeya Dwivedi commit 275c30bcee66a27d1aa97a215d607ad6d49804cb upstream. The LRU map that is preallocated may have its elements reused while another program holds a pointer to it from bpf_map_lookup_elem. Hence, only check_and_free_fields is appropriate when the element is being deleted, as it ensures proper synchronization against concurrent access of the map value. After that, we cannot call check_and_init_map_value again as it may rewrite bpf_spin_lock, bpf_timer, and kptr fields while they can be concurrently accessed from a BPF program. This is safe to do as when the map entry is deleted, concurrent access is protected against by check_and_free_fields, i.e. an existing timer would be freed, and any existing kptr will be released by it. The program can create further timers and kptrs after check_and_free_fields, but they will eventually be released once the preallocated items are freed on map destruction, even if the item is never reused again. Hence, the deleted item sitting in the free list can still have resources attached to it, and they would never leak. With spin_lock, we never touch the field at all on delete or update, as we may end up modifying the state of the lock. Since the verifier ensures that a bpf_spin_lock call is always paired with bpf_spin_unlock call, the program will eventually release the lock so that on reuse the new user of the value can take the lock. Essentially, for the preallocated case, we must assume that the map value may always be in use by the program, even when it is sitting in the freelist, and handle things accordingly, i.e. use proper synchronization inside check_and_free_fields, and never reinitialize the special fields when it is reused on update. Fixes: 68134668c17f ("bpf: Add map side support for bpf timers.") Acked-by: Yonghong Song Signed-off-by: Kumar Kartikeya Dwivedi Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/r/20220809213033.24147-3-memxor@gmail.com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- kernel/bpf/hashtab.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -311,12 +311,8 @@ static struct htab_elem *prealloc_lru_po struct htab_elem *l; =20 if (node) { - u32 key_size =3D htab->map.key_size; - l =3D container_of(node, struct htab_elem, lru_node); - memcpy(l->key, key, key_size); - check_and_init_map_value(&htab->map, - l->key + round_up(key_size, 8)); + memcpy(l->key, key, htab->map.key_size); return l; } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 468BAC32774 for ; Tue, 23 Aug 2022 08:18:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242630AbiHWISU (ORCPT ); Tue, 23 Aug 2022 04:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242229AbiHWINJ (ORCPT ); Tue, 23 Aug 2022 04:13:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29B2E6C13E; Tue, 23 Aug 2022 01:09:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AAFEB6123D; Tue, 23 Aug 2022 08:09:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65144C433D6; Tue, 23 Aug 2022 08:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242151; bh=gyk0DIlacszwxhUgLMZ0yJZSzHV8SnJZoaqZaniVh88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oc72Y6XsoRwU1v/sVhCT2QSY9BVv83xHt69dDSmuslfqXcAjF1ZDaMNtSnjpNNiqi /lU1v3+RJBiCXN8yeDB4eRx/TJLFTd77BvNeL6J5ac/DJCTl6rbVY8PHvzmj+moFJR Wbrf/vFKBl3O5AVdiHrQFrEGQGUtp+0YAvrY0T7Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Yonghong Song , Alexei Starovoitov Subject: [PATCH 5.19 064/365] bpf: Acquire map uref in .init_seq_private for array map iterator Date: Tue, 23 Aug 2022 09:59:25 +0200 Message-Id: <20220823080120.882381491@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hou Tao commit f76fa6b338055054f80c72b29c97fb95c1becadc upstream. bpf_iter_attach_map() acquires a map uref, and the uref may be released before or in the middle of iterating map elements. For example, the uref could be released in bpf_iter_detach_map() as part of bpf_link_release(), or could be released in bpf_map_put_with_uref() as part of bpf_map_release(). Alternative fix is acquiring an extra bpf_link reference just like a pinned map iterator does, but it introduces unnecessary dependency on bpf_link instead of bpf_map. So choose another fix: acquiring an extra map uref in .init_seq_private for array map iterator. Fixes: d3cc2ab546ad ("bpf: Implement bpf iterator for array maps") Signed-off-by: Hou Tao Acked-by: Yonghong Song Link: https://lore.kernel.org/r/20220810080538.1845898-2-houtao@huaweicloud= .com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- kernel/bpf/arraymap.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/kernel/bpf/arraymap.c +++ b/kernel/bpf/arraymap.c @@ -649,6 +649,11 @@ static int bpf_iter_init_array_map(void seq_info->percpu_value_buf =3D value_buf; } =20 + /* bpf_iter_attach_map() acquires a map uref, and the uref may be + * released before or in the middle of iterating map elements, so + * acquire an extra map uref for iterator. + */ + bpf_map_inc_with_uref(map); seq_info->map =3D map; return 0; } @@ -657,6 +662,7 @@ static void bpf_iter_fini_array_map(void { struct bpf_iter_seq_array_map_info *seq_info =3D priv_data; =20 + bpf_map_put_with_uref(seq_info->map); kfree(seq_info->percpu_value_buf); } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44051C32774 for ; Tue, 23 Aug 2022 08:19:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242818AbiHWITH (ORCPT ); Tue, 23 Aug 2022 04:19:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242371AbiHWIOX (ORCPT ); Tue, 23 Aug 2022 04:14:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BE74275ED; Tue, 23 Aug 2022 01:09:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7456FB81C23; Tue, 23 Aug 2022 08:09:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 876F5C433D7; Tue, 23 Aug 2022 08:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242186; bh=DaN9Va7Ic0V+aXbPJGXb1aaLtyi0S0ejmM7VpShT7R0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f6tiBdwADb3EccjsYoYn7szA0DF+v9JR3KJTDIJmjt9vdk0hYYg7L8U5fTAzctDkn e9qcKJJHyyAb1fvSj86dZiM0uJjAJ6/+LIK1P9+Sb0pyWWFTrDxGMIrbj1fMufuy6G eD26ZvLvkWvv/O52SOoihVNjrNeKFo7uOLmaw+Co= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Yonghong Song , Alexei Starovoitov Subject: [PATCH 5.19 065/365] bpf: Acquire map uref in .init_seq_private for hash map iterator Date: Tue, 23 Aug 2022 09:59:26 +0200 Message-Id: <20220823080120.930953637@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hou Tao commit ef1e93d2eeb58a1f08c37b22a2314b94bc045f15 upstream. bpf_iter_attach_map() acquires a map uref, and the uref may be released before or in the middle of iterating map elements. For example, the uref could be released in bpf_iter_detach_map() as part of bpf_link_release(), or could be released in bpf_map_put_with_uref() as part of bpf_map_release(). So acquiring an extra map uref in bpf_iter_init_hash_map() and releasing it in bpf_iter_fini_hash_map(). Fixes: d6c4503cc296 ("bpf: Implement bpf iterator for hash maps") Signed-off-by: Hou Tao Acked-by: Yonghong Song Link: https://lore.kernel.org/r/20220810080538.1845898-3-houtao@huaweicloud= .com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- kernel/bpf/hashtab.c | 2 ++ 1 file changed, 2 insertions(+) --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -2060,6 +2060,7 @@ static int bpf_iter_init_hash_map(void * seq_info->percpu_value_buf =3D value_buf; } =20 + bpf_map_inc_with_uref(map); seq_info->map =3D map; seq_info->htab =3D container_of(map, struct bpf_htab, map); return 0; @@ -2069,6 +2070,7 @@ static void bpf_iter_fini_hash_map(void { struct bpf_iter_seq_hash_map_info *seq_info =3D priv_data; =20 + bpf_map_put_with_uref(seq_info->map); kfree(seq_info->percpu_value_buf); } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31264C32774 for ; Tue, 23 Aug 2022 08:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243227AbiHWIXy (ORCPT ); Tue, 23 Aug 2022 04:23:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243044AbiHWIQb (ORCPT ); Tue, 23 Aug 2022 04:16:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B667E26E2; Tue, 23 Aug 2022 01:10:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 79071B81C22; Tue, 23 Aug 2022 08:10:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD585C433C1; Tue, 23 Aug 2022 08:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242253; bh=wE1MWHXt1CfxolFIPiBMUvia5BDn8Ipk8H0X6Ivmhrs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Soc+v4OGNdRFSB8O3hmRvr/kY9bIjtVyKvAyUzpFA9M0vUSBTteR0dQyALasRlxRp NQBegfRMkjrYKat7NKSuXkj2H3X+VhZ0GaopSFKWlM8FJXWxuBBkmPwFY4auYNUCN1 /gPqZ2eONifcghmrEwcIdpYAnoo6NkQ6k3qyhlqc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Yonghong Song , Martin KaFai Lau , Alexei Starovoitov Subject: [PATCH 5.19 066/365] bpf: Acquire map uref in .init_seq_private for sock local storage map iterator Date: Tue, 23 Aug 2022 09:59:27 +0200 Message-Id: <20220823080120.970254399@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hou Tao commit 3c5f6e698b5c538bbb23cd453b22e1e4922cffd8 upstream. bpf_iter_attach_map() acquires a map uref, and the uref may be released before or in the middle of iterating map elements. For example, the uref could be released in bpf_iter_detach_map() as part of bpf_link_release(), or could be released in bpf_map_put_with_uref() as part of bpf_map_release(). So acquiring an extra map uref in bpf_iter_init_sk_storage_map() and releasing it in bpf_iter_fini_sk_storage_map(). Fixes: 5ce6e77c7edf ("bpf: Implement bpf iterator for sock local storage ma= p") Signed-off-by: Hou Tao Acked-by: Yonghong Song Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/r/20220810080538.1845898-4-houtao@huaweicloud= .com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/core/bpf_sk_storage.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/net/core/bpf_sk_storage.c +++ b/net/core/bpf_sk_storage.c @@ -875,10 +875,18 @@ static int bpf_iter_init_sk_storage_map( { struct bpf_iter_seq_sk_storage_map_info *seq_info =3D priv_data; =20 + bpf_map_inc_with_uref(aux->map); seq_info->map =3D aux->map; return 0; } =20 +static void bpf_iter_fini_sk_storage_map(void *priv_data) +{ + struct bpf_iter_seq_sk_storage_map_info *seq_info =3D priv_data; + + bpf_map_put_with_uref(seq_info->map); +} + static int bpf_iter_attach_map(struct bpf_prog *prog, union bpf_iter_link_info *linfo, struct bpf_iter_aux_info *aux) @@ -924,7 +932,7 @@ static const struct seq_operations bpf_s static const struct bpf_iter_seq_info iter_seq_info =3D { .seq_ops =3D &bpf_sk_storage_map_seq_ops, .init_seq_private =3D bpf_iter_init_sk_storage_map, - .fini_seq_private =3D NULL, + .fini_seq_private =3D bpf_iter_fini_sk_storage_map, .seq_priv_size =3D sizeof(struct bpf_iter_seq_sk_storage_map_info), }; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02B6BC32774 for ; Tue, 23 Aug 2022 08:24:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243344AbiHWIYj (ORCPT ); Tue, 23 Aug 2022 04:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243120AbiHWIUb (ORCPT ); Tue, 23 Aug 2022 04:20:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 582A26DFBC; Tue, 23 Aug 2022 01:12:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A12CBB81C26; Tue, 23 Aug 2022 08:12:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9220C433C1; Tue, 23 Aug 2022 08:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242321; bh=fntl2AQxwEntjTVQ0NGLc7DF/QeTA1ol4XdWPwNNzW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RGkTgze5jBRPKWl4kfqzYEXaB6l4h9JCDR4BuZKOx5xwhGGDZCBj164MwYDYfmLFe MqNvQ5uGgMpMWLNv9EL55zL103L18OVvnFQ24ZUvscW2u/9NlZvXNzu2oCUuRqgdRw ySuGa4Myiav5KM7h3CA24CRLoD84MbGZgNz+4IMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Yonghong Song , Alexei Starovoitov Subject: [PATCH 5.19 067/365] bpf: Acquire map uref in .init_seq_private for sock{map,hash} iterator Date: Tue, 23 Aug 2022 09:59:28 +0200 Message-Id: <20220823080121.015734563@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hou Tao commit f0d2b2716d71778d0b0c8eaa433c073287d69d93 upstream. sock_map_iter_attach_target() acquires a map uref, and the uref may be released before or in the middle of iterating map elements. For example, the uref could be released in sock_map_iter_detach_target() as part of bpf_link_release(), or could be released in bpf_map_put_with_uref() as part of bpf_map_release(). Fixing it by acquiring an extra map uref in .init_seq_private and releasing it in .fini_seq_private. Fixes: 0365351524d7 ("net: Allow iterating sockmap and sockhash") Signed-off-by: Hou Tao Acked-by: Yonghong Song Link: https://lore.kernel.org/r/20220810080538.1845898-5-houtao@huaweicloud= .com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/core/sock_map.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) --- a/net/core/sock_map.c +++ b/net/core/sock_map.c @@ -783,13 +783,22 @@ static int sock_map_init_seq_private(voi { struct sock_map_seq_info *info =3D priv_data; =20 + bpf_map_inc_with_uref(aux->map); info->map =3D aux->map; return 0; } =20 +static void sock_map_fini_seq_private(void *priv_data) +{ + struct sock_map_seq_info *info =3D priv_data; + + bpf_map_put_with_uref(info->map); +} + static const struct bpf_iter_seq_info sock_map_iter_seq_info =3D { .seq_ops =3D &sock_map_seq_ops, .init_seq_private =3D sock_map_init_seq_private, + .fini_seq_private =3D sock_map_fini_seq_private, .seq_priv_size =3D sizeof(struct sock_map_seq_info), }; =20 @@ -1369,18 +1378,27 @@ static const struct seq_operations sock_ }; =20 static int sock_hash_init_seq_private(void *priv_data, - struct bpf_iter_aux_info *aux) + struct bpf_iter_aux_info *aux) { struct sock_hash_seq_info *info =3D priv_data; =20 + bpf_map_inc_with_uref(aux->map); info->map =3D aux->map; info->htab =3D container_of(aux->map, struct bpf_shtab, map); return 0; } =20 +static void sock_hash_fini_seq_private(void *priv_data) +{ + struct sock_hash_seq_info *info =3D priv_data; + + bpf_map_put_with_uref(info->map); +} + static const struct bpf_iter_seq_info sock_hash_iter_seq_info =3D { .seq_ops =3D &sock_hash_seq_ops, .init_seq_private =3D sock_hash_init_seq_private, + .fini_seq_private =3D sock_hash_fini_seq_private, .seq_priv_size =3D sizeof(struct sock_hash_seq_info), }; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D42A9C3F6B0 for ; Tue, 23 Aug 2022 08:27:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243447AbiHWIZ0 (ORCPT ); Tue, 23 Aug 2022 04:25:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243497AbiHWIVQ (ORCPT ); Tue, 23 Aug 2022 04:21:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9E4A6F55F; Tue, 23 Aug 2022 01:12:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3EEC361257; Tue, 23 Aug 2022 08:12:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48289C433C1; Tue, 23 Aug 2022 08:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242336; bh=xBh8UqDVC3/QWFz4NeXBp4L2MScpVpT/UdXoPniLsIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wLU9UE4zqHYaQw0zij6qyufFX6+jVg2lhnjUwmj7QqAbAp01rmL1pGKevLtn5OxxQ xHHICxMBNhkrEptmws35qlY6zOFm04N6HmcoHENb570ITWYdEg9fNfowAykUGQ8l9f rD+3UjkCWZJE25Gk5Fn0cR1f9M5+gKB+RITzcRGE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Yonghong Song , Martin KaFai Lau , Alexei Starovoitov Subject: [PATCH 5.19 068/365] bpf: Check the validity of max_rdwr_access for sock local storage map iterator Date: Tue, 23 Aug 2022 09:59:29 +0200 Message-Id: <20220823080121.051257568@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hou Tao commit 52bd05eb7c88e1ad8541a48873188ccebca9da26 upstream. The value of sock local storage map is writable in map iterator, so check max_rdwr_access instead of max_rdonly_access. Fixes: 5ce6e77c7edf ("bpf: Implement bpf iterator for sock local storage ma= p") Signed-off-by: Hou Tao Acked-by: Yonghong Song Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/r/20220810080538.1845898-6-houtao@huaweicloud= .com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/core/bpf_sk_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/bpf_sk_storage.c +++ b/net/core/bpf_sk_storage.c @@ -904,7 +904,7 @@ static int bpf_iter_attach_map(struct bp if (map->map_type !=3D BPF_MAP_TYPE_SK_STORAGE) goto put_map; =20 - if (prog->aux->max_rdonly_access > map->value_size) { + if (prog->aux->max_rdwr_access > map->value_size) { err =3D -EACCES; goto put_map; } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 097D6C32774 for ; Tue, 23 Aug 2022 08:18:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242651AbiHWIS3 (ORCPT ); Tue, 23 Aug 2022 04:18:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242059AbiHWINh (ORCPT ); Tue, 23 Aug 2022 04:13:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20F4E6C76B; Tue, 23 Aug 2022 01:09:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CFF48B81C21; Tue, 23 Aug 2022 08:09:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FE9BC433D7; Tue, 23 Aug 2022 08:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242157; bh=9PtLNoj5lxQyc/Pnr6PffGlLMufsvKsor8UnqpQN13M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qNMMqXBsZighwVjgeNMj18Gqh5jUEqFXyHGrjRX6NFTAYE/0NNUnRghSYJapB8gTM EpMJ+c0+HRC7ApfK1UU7TmftVpGQAcmOMqDCNRCbi2hvga0zxF54tNUQSvsg0yQ3Y3 qiadXnP87qT/xSl3TmynGQX5UhNDCdcSwPQKZlMs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Sebastian=20W=C3=BCrl?= , Marc Kleine-Budde Subject: [PATCH 5.19 069/365] can: mcp251x: Fix race condition on receive interrupt Date: Tue, 23 Aug 2022 09:59:30 +0200 Message-Id: <20220823080121.086548355@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastian W=C3=BCrl commit d80d60b0db6ff3dd2e29247cc2a5166d7e9ae37e upstream. The mcp251x driver uses both receiving mailboxes of the CAN controller chips. For retrieving the CAN frames from the controller via SPI, it checks once per interrupt which mailboxes have been filled and will retrieve the messages accordingly. This introduces a race condition, as another CAN frame can enter mailbox 1 while mailbox 0 is emptied. If now another CAN frame enters mailbox 0 until the interrupt handler is called next, mailbox 0 is emptied before mailbox 1, leading to out-of-order CAN frames in the network device. This is fixed by checking the interrupt flags once again after freeing mailbox 0, to correctly also empty mailbox 1 before leaving the handler. For reproducing the bug I created the following setup: - Two CAN devices, one Raspberry Pi with MCP2515, the other can be any. - Setup CAN to 1 MHz - Spam bursts of 5 CAN-messages with increasing CAN-ids - Continue sending the bursts while sleeping a second between the bursts - Check on the RPi whether the received messages have increasing CAN-ids - Without this patch, every burst of messages will contain a flipped pair v3: https://lore.kernel.org/all/20220804075914.67569-1-sebastian.wuerl@oror= atech.com v2: https://lore.kernel.org/all/20220804064803.63157-1-sebastian.wuerl@oror= atech.com v1: https://lore.kernel.org/all/20220803153300.58732-1-sebastian.wuerl@oror= atech.com Fixes: bf66f3736a94 ("can: mcp251x: Move to threaded interrupts instead of = workqueues.") Signed-off-by: Sebastian W=C3=BCrl Link: https://lore.kernel.org/all/20220804081411.68567-1-sebastian.wuerl@or= oratech.com [mkl: reduce scope of intf1, eflag1] Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/can/spi/mcp251x.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) --- a/drivers/net/can/spi/mcp251x.c +++ b/drivers/net/can/spi/mcp251x.c @@ -1069,9 +1069,6 @@ static irqreturn_t mcp251x_can_ist(int i =20 mcp251x_read_2regs(spi, CANINTF, &intf, &eflag); =20 - /* mask out flags we don't care about */ - intf &=3D CANINTF_RX | CANINTF_TX | CANINTF_ERR; - /* receive buffer 0 */ if (intf & CANINTF_RX0IF) { mcp251x_hw_rx(spi, 0); @@ -1081,6 +1078,18 @@ static irqreturn_t mcp251x_can_ist(int i if (mcp251x_is_2510(spi)) mcp251x_write_bits(spi, CANINTF, CANINTF_RX0IF, 0x00); + + /* check if buffer 1 is already known to be full, no need to re-read */ + if (!(intf & CANINTF_RX1IF)) { + u8 intf1, eflag1; + + /* intf needs to be read again to avoid a race condition */ + mcp251x_read_2regs(spi, CANINTF, &intf1, &eflag1); + + /* combine flags from both operations for error handling */ + intf |=3D intf1; + eflag |=3D eflag1; + } } =20 /* receive buffer 1 */ @@ -1091,6 +1100,9 @@ static irqreturn_t mcp251x_can_ist(int i clear_intf |=3D CANINTF_RX1IF; } =20 + /* mask out flags we don't care about */ + intf &=3D CANINTF_RX | CANINTF_TX | CANINTF_ERR; + /* any error or tx interrupt we need to clear? */ if (intf & (CANINTF_ERR | CANINTF_TX)) clear_intf |=3D intf & (CANINTF_ERR | CANINTF_TX); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24172C32774 for ; Tue, 23 Aug 2022 08:18:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242771AbiHWISq (ORCPT ); Tue, 23 Aug 2022 04:18:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242134AbiHWINv (ORCPT ); Tue, 23 Aug 2022 04:13:51 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24E456C770; Tue, 23 Aug 2022 01:09:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 8506DCE1B34; Tue, 23 Aug 2022 08:09:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84FE8C433C1; Tue, 23 Aug 2022 08:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242164; bh=6RUbOO660W57gg9vcDPO2ChUAqzUiVW0WI9kwpLZkTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uDWVEAqp25v+VSPfuFTr//4hUzicjdHSqWpSrG/iNF0flAiZJceTDJel+vvyGUtGI aT7j0FRHyR+weJJMNJE/dsnqkD6kGaSyW7uFJ4tGONfxYe/jzYFfsRQ691wBOaKil3 HzSjHPxgTv/4/MlnXwyTzMDJEYMamjOp6+7lAQvk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksij Rempel , Fedor Pchelkin , Alexey Khoroshilov , Marc Kleine-Budde Subject: [PATCH 5.19 070/365] can: j1939: j1939_session_destroy(): fix memory leak of skbs Date: Tue, 23 Aug 2022 09:59:31 +0200 Message-Id: <20220823080121.115741318@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fedor Pchelkin commit 8c21c54a53ab21842f5050fa090f26b03c0313d6 upstream. We need to drop skb references taken in j1939_session_skb_queue() when destroying a session in j1939_session_destroy(). Otherwise those skbs would be lost. Link to Syzkaller info and repro: https://forge.ispras.ru/issues/11743. Found by Linux Verification Center (linuxtesting.org) with Syzkaller. V1: https://lore.kernel.org/all/20220708175949.539064-1-pchelkin@ispras.ru Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol") Suggested-by: Oleksij Rempel Signed-off-by: Fedor Pchelkin Signed-off-by: Alexey Khoroshilov Acked-by: Oleksij Rempel Link: https://lore.kernel.org/all/20220805150216.66313-1-pchelkin@ispras.ru Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/can/j1939/transport.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/net/can/j1939/transport.c +++ b/net/can/j1939/transport.c @@ -260,6 +260,8 @@ static void __j1939_session_drop(struct =20 static void j1939_session_destroy(struct j1939_session *session) { + struct sk_buff *skb; + if (session->transmission) { if (session->err) j1939_sk_errqueue(session, J1939_ERRQUEUE_TX_ABORT); @@ -274,7 +276,11 @@ static void j1939_session_destroy(struct WARN_ON_ONCE(!list_empty(&session->sk_session_queue_entry)); WARN_ON_ONCE(!list_empty(&session->active_session_list_entry)); =20 - skb_queue_purge(&session->skb_queue); + while ((skb =3D skb_dequeue(&session->skb_queue)) !=3D NULL) { + /* drop ref taken in j1939_session_skb_queue() */ + skb_unref(skb); + kfree_skb(skb); + } __j1939_session_drop(session); j1939_priv_put(session->priv); kfree(session); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE6C9C32774 for ; Tue, 23 Aug 2022 08:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242788AbiHWISy (ORCPT ); Tue, 23 Aug 2022 04:18:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242321AbiHWIOH (ORCPT ); Tue, 23 Aug 2022 04:14:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CFEE6CD15; Tue, 23 Aug 2022 01:09:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1250E6123D; Tue, 23 Aug 2022 08:09:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2699C433D6; Tue, 23 Aug 2022 08:09:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242170; bh=zjmr6neCiFuwjeP/Muhm6zQ44AF2WoXz10x0IeQreJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b552BISAR2W6qkrax9VyOhWi+1zThYc+seeUZY6QRnCx3b3l82LNFU6JVWDouTwCs MpgDuBngpNIYMh4y2132fDmxPg51Sir1uefchjWmmnQg2P37/uvN1Skte1Dqy7be26 nAEFtTnlevjpx+gtHt5AXLN6PanFLOy4I3UPSiFI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Chia-Lin Kao (AceLan)" , Sudarsana Reddy Kalluru , Jakub Kicinski Subject: [PATCH 5.19 071/365] net: atlantic: fix aq_vec index out of range error Date: Tue, 23 Aug 2022 09:59:32 +0200 Message-Id: <20220823080121.165131350@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chia-Lin Kao (AceLan) commit 2ba5e47fb75fbb8fab45f5c1bc8d5c33d8834bd3 upstream. The final update statement of the for loop exceeds the array range, the dereference of self->aq_vec[i] is not checked and then leads to the index out of range error. Also fixed this kind of coding style in other for loop. [ 97.937604] UBSAN: array-index-out-of-bounds in drivers/net/ethernet/aqu= antia/atlantic/aq_nic.c:1404:48 [ 97.937607] index 8 is out of range for type 'aq_vec_s *[8]' [ 97.937608] CPU: 38 PID: 3767 Comm: kworker/u256:18 Not tainted 5.19.0+ = #2 [ 97.937610] Hardware name: Dell Inc. Precision 7865 Tower/, BIOS 1.0.0 0= 6/12/2022 [ 97.937611] Workqueue: events_unbound async_run_entry_fn [ 97.937616] Call Trace: [ 97.937617] [ 97.937619] dump_stack_lvl+0x49/0x63 [ 97.937624] dump_stack+0x10/0x16 [ 97.937626] ubsan_epilogue+0x9/0x3f [ 97.937627] __ubsan_handle_out_of_bounds.cold+0x44/0x49 [ 97.937629] ? __scm_send+0x348/0x440 [ 97.937632] ? aq_vec_stop+0x72/0x80 [atlantic] [ 97.937639] aq_nic_stop+0x1b6/0x1c0 [atlantic] [ 97.937644] aq_suspend_common+0x88/0x90 [atlantic] [ 97.937648] aq_pm_suspend_poweroff+0xe/0x20 [atlantic] [ 97.937653] pci_pm_suspend+0x7e/0x1a0 [ 97.937655] ? pci_pm_suspend_noirq+0x2b0/0x2b0 [ 97.937657] dpm_run_callback+0x54/0x190 [ 97.937660] __device_suspend+0x14c/0x4d0 [ 97.937661] async_suspend+0x23/0x70 [ 97.937663] async_run_entry_fn+0x33/0x120 [ 97.937664] process_one_work+0x21f/0x3f0 [ 97.937666] worker_thread+0x4a/0x3c0 [ 97.937668] ? process_one_work+0x3f0/0x3f0 [ 97.937669] kthread+0xf0/0x120 [ 97.937671] ? kthread_complete_and_exit+0x20/0x20 [ 97.937672] ret_from_fork+0x22/0x30 [ 97.937676] v2. fixed "warning: variable 'aq_vec' set but not used" v3. simplified a for loop Fixes: 97bde5c4f909 ("net: ethernet: aquantia: Support for NIC-specific cod= e") Signed-off-by: Chia-Lin Kao (AceLan) Acked-by: Sudarsana Reddy Kalluru Link: https://lore.kernel.org/r/20220808081845.42005-1-acelan.kao@canonical= .com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 21 ++++++++-----------= -- 1 file changed, 8 insertions(+), 13 deletions(-) --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c @@ -265,12 +265,10 @@ static void aq_nic_service_timer_cb(stru static void aq_nic_polling_timer_cb(struct timer_list *t) { struct aq_nic_s *self =3D from_timer(self, t, polling_timer); - struct aq_vec_s *aq_vec =3D NULL; unsigned int i =3D 0U; =20 - for (i =3D 0U, aq_vec =3D self->aq_vec[0]; - self->aq_vecs > i; ++i, aq_vec =3D self->aq_vec[i]) - aq_vec_isr(i, (void *)aq_vec); + for (i =3D 0U; self->aq_vecs > i; ++i) + aq_vec_isr(i, (void *)self->aq_vec[i]); =20 mod_timer(&self->polling_timer, jiffies + AQ_CFG_POLLING_TIMER_INTERVAL); @@ -1014,7 +1012,6 @@ int aq_nic_get_regs_count(struct aq_nic_ =20 u64 *aq_nic_get_stats(struct aq_nic_s *self, u64 *data) { - struct aq_vec_s *aq_vec =3D NULL; struct aq_stats_s *stats; unsigned int count =3D 0U; unsigned int i =3D 0U; @@ -1064,11 +1061,11 @@ u64 *aq_nic_get_stats(struct aq_nic_s *s data +=3D i; =20 for (tc =3D 0U; tc < self->aq_nic_cfg.tcs; tc++) { - for (i =3D 0U, aq_vec =3D self->aq_vec[0]; - aq_vec && self->aq_vecs > i; - ++i, aq_vec =3D self->aq_vec[i]) { + for (i =3D 0U; self->aq_vecs > i; ++i) { + if (!self->aq_vec[i]) + break; data +=3D count; - count =3D aq_vec_get_sw_stats(aq_vec, tc, data); + count =3D aq_vec_get_sw_stats(self->aq_vec[i], tc, data); } } =20 @@ -1382,7 +1379,6 @@ int aq_nic_set_loopback(struct aq_nic_s =20 int aq_nic_stop(struct aq_nic_s *self) { - struct aq_vec_s *aq_vec =3D NULL; unsigned int i =3D 0U; =20 netif_tx_disable(self->ndev); @@ -1400,9 +1396,8 @@ int aq_nic_stop(struct aq_nic_s *self) =20 aq_ptp_irq_free(self); =20 - for (i =3D 0U, aq_vec =3D self->aq_vec[0]; - self->aq_vecs > i; ++i, aq_vec =3D self->aq_vec[i]) - aq_vec_stop(aq_vec); + for (i =3D 0U; self->aq_vecs > i; ++i) + aq_vec_stop(self->aq_vec[i]); =20 aq_ptp_ring_stop(self); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8141CC32789 for ; Tue, 23 Aug 2022 08:22:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242682AbiHWIWI (ORCPT ); Tue, 23 Aug 2022 04:22:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242353AbiHWIOT (ORCPT ); Tue, 23 Aug 2022 04:14:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 154256CD05; Tue, 23 Aug 2022 01:09:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 59638612A0; Tue, 23 Aug 2022 08:09:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61FD4C43151; Tue, 23 Aug 2022 08:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242176; bh=fzEwDqQnyvof+zgJDXrldKEzkZj1Amf9g0JJlC0VsSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gof6QOYNa7JsQBRExzWTywuiE+1IiSAFVVyQFQt4u+NY0D97ltyAvUFPV8HkBHCSa M5HNAm1FCgkzlJbvwuCg+y0l+M9L28Z1tMRHuGIzt+UmfbaMM8NPaW32SY75Enfe6W JHl6uKGhYLuYZK101WC67l2U6WEV5KTW5XUyKyPo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Greg Ungerer , Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org, uclinux-dev@uclinux.org, Angelo Dureghello Subject: [PATCH 5.19 072/365] m68k: coldfire/device.c: protect FLEXCAN blocks Date: Tue, 23 Aug 2022 09:59:33 +0200 Message-Id: <20220823080121.207289114@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap commit 3c2bf173501652fced1d058834e9c983d295b126 upstream. When CAN_FLEXCAN=3Dy and M5441x is not set/enabled, there are build errors in coldfire/device.c: ../arch/m68k/coldfire/device.c:595:26: error: 'MCFFLEXCAN_BASE0' undeclared= here (not in a function); did you mean 'MCFDMA_BASE0'? 595 | .start =3D MCFFLEXCAN_BASE0, ../arch/m68k/coldfire/device.c:596:43: error: 'MCFFLEXCAN_SIZE' undeclared = here (not in a function) 596 | .end =3D MCFFLEXCAN_BASE0 + MCFFLEXCAN_SIZE, ../arch/m68k/coldfire/device.c:600:26: error: 'MCF_IRQ_IFL0' undeclared her= e (not in a function); did you mean 'MCF_IRQ_I2C0'? 600 | .start =3D MCF_IRQ_IFL0, ../arch/m68k/coldfire/device.c:605:26: error: 'MCF_IRQ_BOFF0' undeclared he= re (not in a function); did you mean 'MCF_IRQ_I2C0'? 605 | .start =3D MCF_IRQ_BOFF0, ../arch/m68k/coldfire/device.c:610:26: error: 'MCF_IRQ_ERR0' undeclared her= e (not in a function); did you mean 'MCF_IRQ_I2C0'? 610 | .start =3D MCF_IRQ_ERR0, Protect the FLEXCAN code blocks by checking if MCFFLEXCAN_SIZE is defined. Fixes: 35a9f9363a89 ("m68k: m5441x: add flexcan support") Signed-off-by: Randy Dunlap Cc: Greg Ungerer Cc: Geert Uytterhoeven Cc: linux-m68k@lists.linux-m68k.org Cc: uclinux-dev@uclinux.org Cc: Angelo Dureghello Signed-off-by: Greg Ungerer Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/m68k/coldfire/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/arch/m68k/coldfire/device.c +++ b/arch/m68k/coldfire/device.c @@ -581,7 +581,7 @@ static struct platform_device mcf_esdhc }; #endif /* MCFSDHC_BASE */ =20 -#if IS_ENABLED(CONFIG_CAN_FLEXCAN) +#ifdef MCFFLEXCAN_SIZE =20 #include =20 @@ -620,7 +620,7 @@ static struct platform_device mcf_flexca .resource =3D mcf5441x_flexcan0_resource, .dev.platform_data =3D &mcf5441x_flexcan_info, }; -#endif /* IS_ENABLED(CONFIG_CAN_FLEXCAN) */ +#endif /* MCFFLEXCAN_SIZE */ =20 static struct platform_device *mcf_devices[] __initdata =3D { &mcf_uart, @@ -657,7 +657,7 @@ static struct platform_device *mcf_devic #ifdef MCFSDHC_BASE &mcf_esdhc, #endif -#if IS_ENABLED(CONFIG_CAN_FLEXCAN) +#ifdef MCFFLEXCAN_SIZE &mcf_flexcan0, #endif }; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EEAFC32774 for ; Tue, 23 Aug 2022 08:19:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242505AbiHWITD (ORCPT ); Tue, 23 Aug 2022 04:19:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242365AbiHWIOW (ORCPT ); Tue, 23 Aug 2022 04:14:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9948C6CD0D; Tue, 23 Aug 2022 01:09:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 194C3B81C22; Tue, 23 Aug 2022 08:09:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 633A9C433D7; Tue, 23 Aug 2022 08:09:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242182; bh=qbghJcHm0gVRjNPJv+owcXxInm53demoP6ZbyBNgN08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DaxuLn9MC5nx7Ydy5xc0dQEPWP4FeaEb1hyDgLMEu8foU5XGSMlWziZ1k4xHXf/m9 LQXMXUnzWRf75gQqKbu4d4+KA4MH+DlwTPxaQZE0nuFmkLyaBSdW6Qj9lwL23Kccmc Nbp5ByrQTMoNgRZ9/CW3pOPQ1gOkfEb5w4HGDxD4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Aloni , Trond Myklebust Subject: [PATCH 5.19 073/365] sunrpc: fix expiry of auth creds Date: Tue, 23 Aug 2022 09:59:34 +0200 Message-Id: <20220823080121.239680148@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Aloni commit f1bafa7375c01ff71fb7cb97c06caadfcfe815f3 upstream. Before this commit, with a large enough LRU of expired items (100), the loop skipped all the expired items and was entirely ineffectual in trimming the LRU list. Fixes: 95cd623250ad ('SUNRPC: Clean up the AUTH cache code') Signed-off-by: Dan Aloni Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/sunrpc/auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c @@ -445,7 +445,7 @@ rpcauth_prune_expired(struct list_head * * Enforce a 60 second garbage collection moratorium * Note that the cred_unused list must be time-ordered. */ - if (!time_in_range(cred->cr_expire, expired, jiffies)) + if (time_in_range(cred->cr_expire, expired, jiffies)) continue; if (!rpcauth_unhash_cred(cred)) continue; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 169FCC32774 for ; Tue, 23 Aug 2022 08:19:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242847AbiHWITQ (ORCPT ); Tue, 23 Aug 2022 04:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242395AbiHWIOn (ORCPT ); Tue, 23 Aug 2022 04:14:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D84AD6CF64; Tue, 23 Aug 2022 01:09:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AE7D8B81C23; Tue, 23 Aug 2022 08:09:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11A63C433D6; Tue, 23 Aug 2022 08:09:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242192; bh=POaUdY32srVyb9CUvSK2Zuip7368nevwRVmjMokMMmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xtbl1vRz8vT/BxHJQv3MppLbKnH79JgHBaw1rD+ijQ/JBnbTzrEkxeQcN+984/LlZ EWXHZhM/F4iaVvP9uT9C2xFKGVcbb+MD9FMqG978utDn//hafxT9YPumHaunMeUEAS zKkm+chBGpMVYk4joCf/VRr2hoOoLfzlaoeQRGw0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Jeff Layton Subject: [PATCH 5.19 074/365] SUNRPC: Fix xdr_encode_bool() Date: Tue, 23 Aug 2022 09:59:35 +0200 Message-Id: <20220823080121.269533997@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chuck Lever commit c770f31d8f580ed4b965c64f924ec1cc50e41734 upstream. I discovered that xdr_encode_bool() was returning the same address that was passed in the @p parameter. The documenting comment states that the intent is to return the address of the next buffer location, just like the other "xdr_encode_*" helpers. The result was the encoded results of NFSv3 PATHCONF operations were not formed correctly. Fixes: ded04a587f6c ("NFSD: Update the NFSv3 PATHCONF3res encoder to use st= ruct xdr_stream") Signed-off-by: Chuck Lever Reviewed-by: Jeff Layton Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- include/linux/sunrpc/xdr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h @@ -419,8 +419,8 @@ static inline int xdr_stream_encode_item */ static inline __be32 *xdr_encode_bool(__be32 *p, u32 n) { - *p =3D n ? xdr_one : xdr_zero; - return p++; + *p++ =3D n ? xdr_one : xdr_zero; + return p; } =20 /** From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B02AAC32774 for ; Tue, 23 Aug 2022 08:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242868AbiHWIT1 (ORCPT ); Tue, 23 Aug 2022 04:19:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242047AbiHWIPC (ORCPT ); Tue, 23 Aug 2022 04:15:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5445725E8F; Tue, 23 Aug 2022 01:10:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 48FB46129B; Tue, 23 Aug 2022 08:09:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54794C433C1; Tue, 23 Aug 2022 08:09:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242198; bh=Ar0Ri1pXQ2u5TEvE1oM8+Sx9bnNlWLzCZzLjllN8NEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MDd4EXmU4egIHV3U0GAMvL2CGgo4KJV6jWh9YQNnGBEAhpGjkAiHKi8Ex6V2093kp HTSQDRxFn+DNlr56E1Kcl+Ywi8w7x6QasuR6f4V1YGoxfw6qJJeZ3tbxANodzV6fzj ZVBpYbzSCgc+FwtyNrLjxDjqExBISg4hIfRjbX+E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.19 075/365] SUNRPC: Reinitialise the backchannel request buffers before reuse Date: Tue, 23 Aug 2022 09:59:36 +0200 Message-Id: <20220823080121.306598432@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust commit 6622e3a73112fc336c1c2c582428fb5ef18e456a upstream. When we're reusing the backchannel requests instead of freeing them, then we should reinitialise any values of the send/receive xdr_bufs so that they reflect the available space. Fixes: 0d2a970d0ae5 ("SUNRPC: Fix a backchannel race") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/sunrpc/backchannel_rqst.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- a/net/sunrpc/backchannel_rqst.c +++ b/net/sunrpc/backchannel_rqst.c @@ -64,6 +64,17 @@ static void xprt_free_allocation(struct kfree(req); } =20 +static void xprt_bc_reinit_xdr_buf(struct xdr_buf *buf) +{ + buf->head[0].iov_len =3D PAGE_SIZE; + buf->tail[0].iov_len =3D 0; + buf->pages =3D NULL; + buf->page_len =3D 0; + buf->flags =3D 0; + buf->len =3D 0; + buf->buflen =3D PAGE_SIZE; +} + static int xprt_alloc_xdr_buf(struct xdr_buf *buf, gfp_t gfp_flags) { struct page *page; @@ -292,6 +303,9 @@ void xprt_free_bc_rqst(struct rpc_rqst * */ spin_lock_bh(&xprt->bc_pa_lock); if (xprt_need_to_requeue(xprt)) { + xprt_bc_reinit_xdr_buf(&req->rq_snd_buf); + xprt_bc_reinit_xdr_buf(&req->rq_rcv_buf); + req->rq_rcv_buf.len =3D PAGE_SIZE; list_add_tail(&req->rq_bc_pa_list, &xprt->bc_pa_list); xprt->bc_alloc_count++; atomic_inc(&xprt->bc_slot_count); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BA04C32774 for ; Tue, 23 Aug 2022 08:19:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242671AbiHWITe (ORCPT ); Tue, 23 Aug 2022 04:19:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242453AbiHWIPV (ORCPT ); Tue, 23 Aug 2022 04:15:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 923686D549; Tue, 23 Aug 2022 01:10:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A9749611DD; Tue, 23 Aug 2022 08:10:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B322AC433D6; Tue, 23 Aug 2022 08:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242205; bh=Rlf/zyX8NPwzyZUHc+x5tXVEWl4HgHAxexgD2KZSQOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a2y5ZD72SfY/eWuK1zqErGhG40Wei1n7IDup6btDPiTXC5XT7go7NLaNEf51pV5xc RUlfWAB8cEJ4dGJHGV7nvRTZ1ZsMSOxTMS0gSmSSiEt+8wvzA9wlRLn14a3KEpB6iV eSrzaJyHT3K9IfHDHS0IZAiKvrnqvvEJoaoORJEk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.19 076/365] SUNRPC: Dont reuse bvec on retransmission of the request Date: Tue, 23 Aug 2022 09:59:37 +0200 Message-Id: <20220823080121.356816589@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust commit 72691a269f0baad6d5f4aa7af97c29081b86d70f upstream. If a request is re-encoded and then retransmitted, we need to make sure that we also re-encode the bvec, in case the page lists have changed. Fixes: ff053dbbaffe ("SUNRPC: Move the call to xprt_send_pagedata() out of = xprt_sock_sendmsg()") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- include/linux/sunrpc/xprt.h | 3 ++- net/sunrpc/clnt.c | 1 - net/sunrpc/xprt.c | 27 ++++++++++++++++++--------- net/sunrpc/xprtsock.c | 12 ++---------- 4 files changed, 22 insertions(+), 21 deletions(-) --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -144,7 +144,8 @@ struct rpc_xprt_ops { unsigned short (*get_srcport)(struct rpc_xprt *xprt); int (*buf_alloc)(struct rpc_task *task); void (*buf_free)(struct rpc_task *task); - int (*prepare_request)(struct rpc_rqst *req); + int (*prepare_request)(struct rpc_rqst *req, + struct xdr_buf *buf); int (*send_request)(struct rpc_rqst *req); void (*wait_for_reply_request)(struct rpc_task *task); void (*timer)(struct rpc_xprt *xprt, struct rpc_task *task); --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -1856,7 +1856,6 @@ rpc_xdr_encode(struct rpc_task *task) req->rq_snd_buf.head[0].iov_len =3D 0; xdr_init_encode(&xdr, &req->rq_snd_buf, req->rq_snd_buf.head[0].iov_base, req); - xdr_free_bvec(&req->rq_snd_buf); if (rpc_encode_header(task, &xdr)) return; =20 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -73,7 +73,7 @@ static void xprt_init(struct rpc_xprt *x static __be32 xprt_alloc_xid(struct rpc_xprt *xprt); static void xprt_destroy(struct rpc_xprt *xprt); static void xprt_request_init(struct rpc_task *task); -static int xprt_request_prepare(struct rpc_rqst *req); +static int xprt_request_prepare(struct rpc_rqst *req, struct xdr_buf *buf); =20 static DEFINE_SPINLOCK(xprt_list_lock); static LIST_HEAD(xprt_list); @@ -1149,7 +1149,7 @@ xprt_request_enqueue_receive(struct rpc_ if (!xprt_request_need_enqueue_receive(task, req)) return 0; =20 - ret =3D xprt_request_prepare(task->tk_rqstp); + ret =3D xprt_request_prepare(task->tk_rqstp, &req->rq_rcv_buf); if (ret) return ret; spin_lock(&xprt->queue_lock); @@ -1179,8 +1179,11 @@ xprt_request_dequeue_receive_locked(stru { struct rpc_rqst *req =3D task->tk_rqstp; =20 - if (test_and_clear_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) + if (test_and_clear_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) { xprt_request_rb_remove(req->rq_xprt, req); + xdr_free_bvec(&req->rq_rcv_buf); + req->rq_private_buf.bvec =3D NULL; + } } =20 /** @@ -1336,8 +1339,14 @@ xprt_request_enqueue_transmit(struct rpc { struct rpc_rqst *pos, *req =3D task->tk_rqstp; struct rpc_xprt *xprt =3D req->rq_xprt; + int ret; =20 if (xprt_request_need_enqueue_transmit(task, req)) { + ret =3D xprt_request_prepare(task->tk_rqstp, &req->rq_snd_buf); + if (ret) { + task->tk_status =3D ret; + return; + } req->rq_bytes_sent =3D 0; spin_lock(&xprt->queue_lock); /* @@ -1397,6 +1406,7 @@ xprt_request_dequeue_transmit_locked(str } else list_del(&req->rq_xmit2); atomic_long_dec(&req->rq_xprt->xmit_queuelen); + xdr_free_bvec(&req->rq_snd_buf); } =20 /** @@ -1433,8 +1443,6 @@ xprt_request_dequeue_xprt(struct rpc_tas test_bit(RPC_TASK_NEED_RECV, &task->tk_runstate) || xprt_is_pinned_rqst(req)) { spin_lock(&xprt->queue_lock); - xprt_request_dequeue_transmit_locked(task); - xprt_request_dequeue_receive_locked(task); while (xprt_is_pinned_rqst(req)) { set_bit(RPC_TASK_MSG_PIN_WAIT, &task->tk_runstate); spin_unlock(&xprt->queue_lock); @@ -1442,6 +1450,8 @@ xprt_request_dequeue_xprt(struct rpc_tas spin_lock(&xprt->queue_lock); clear_bit(RPC_TASK_MSG_PIN_WAIT, &task->tk_runstate); } + xprt_request_dequeue_transmit_locked(task); + xprt_request_dequeue_receive_locked(task); spin_unlock(&xprt->queue_lock); } } @@ -1449,18 +1459,19 @@ xprt_request_dequeue_xprt(struct rpc_tas /** * xprt_request_prepare - prepare an encoded request for transport * @req: pointer to rpc_rqst + * @buf: pointer to send/rcv xdr_buf * * Calls into the transport layer to do whatever is needed to prepare * the request for transmission or receive. * Returns error, or zero. */ static int -xprt_request_prepare(struct rpc_rqst *req) +xprt_request_prepare(struct rpc_rqst *req, struct xdr_buf *buf) { struct rpc_xprt *xprt =3D req->rq_xprt; =20 if (xprt->ops->prepare_request) - return xprt->ops->prepare_request(req); + return xprt->ops->prepare_request(req, buf); return 0; } =20 @@ -1961,8 +1972,6 @@ void xprt_release(struct rpc_task *task) spin_unlock(&xprt->transport_lock); if (req->rq_buffer) xprt->ops->buf_free(task); - xdr_free_bvec(&req->rq_rcv_buf); - xdr_free_bvec(&req->rq_snd_buf); if (req->rq_cred !=3D NULL) put_rpccred(req->rq_cred); if (req->rq_release_snd_buf) --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -822,17 +822,9 @@ static int xs_stream_nospace(struct rpc_ return ret; } =20 -static int -xs_stream_prepare_request(struct rpc_rqst *req) +static int xs_stream_prepare_request(struct rpc_rqst *req, struct xdr_buf = *buf) { - gfp_t gfp =3D rpc_task_gfp_mask(); - int ret; - - ret =3D xdr_alloc_bvec(&req->rq_snd_buf, gfp); - if (ret < 0) - return ret; - xdr_free_bvec(&req->rq_rcv_buf); - return xdr_alloc_bvec(&req->rq_rcv_buf, gfp); + return xdr_alloc_bvec(buf, rpc_task_gfp_mask()); } =20 /* From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F8D3C32774 for ; Tue, 23 Aug 2022 08:19:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242691AbiHWITl (ORCPT ); Tue, 23 Aug 2022 04:19:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242522AbiHWIP2 (ORCPT ); Tue, 23 Aug 2022 04:15:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1908D6D57D; Tue, 23 Aug 2022 01:10:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 14F5DB81C23; Tue, 23 Aug 2022 08:10:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E8F6C433D6; Tue, 23 Aug 2022 08:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242210; bh=pjkEizbC1JCRLj2o9AxXBiGOjqN01mRAxYEHVJUGgas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dn3J0zKcPUAoxf2JhdZKNgXdCwONYiXl7ye5JUKOC6ghmBFCiHx8B+uOE8TanAMxW MI+M25iyO1gSKXtBnswe4JLiKnToWRckn50Geyvk2dEpFiQgpH/48IsQdn0SIe/0Fe coTg8U0abGhrPNznw8HMajkw4ocF81gAiTulzaI4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivasa Rao Mandadapu , Srinivas Kandagatla , Mark Brown Subject: [PATCH 5.19 077/365] ASoC: qdsp6: q6apm-dai: unprepare stream if its already prepared Date: Tue, 23 Aug 2022 09:59:38 +0200 Message-Id: <20220823080121.409659939@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla commit 6548c884a595391fab172faeae39e2b329b848f3 upstream. prepare callback can be called multiple times, so unprepare the stream if its already prepared. Without this DSP is not happy to setting the params on a already prepared graph. Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support") Reported-by: Srinivasa Rao Mandadapu Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220610144818.511797-1-srinivas.kandagatla= @linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/qcom/qdsp6/q6apm-dai.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -153,6 +153,12 @@ static int q6apm_dai_prepare(struct snd_ q6apm_unmap_memory_regions(prtd->graph, substream->stream); } =20 + if (prtd->state) { + /* clear the previous setup if any */ + q6apm_graph_stop(prtd->graph); + q6apm_unmap_memory_regions(prtd->graph, substream->stream); + } + prtd->pcm_count =3D snd_pcm_lib_period_bytes(substream); prtd->pos =3D 0; /* rate and channels are sent to audio driver */ From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5588C32774 for ; Tue, 23 Aug 2022 08:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242736AbiHWIT4 (ORCPT ); Tue, 23 Aug 2022 04:19:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242644AbiHWIPj (ORCPT ); Tue, 23 Aug 2022 04:15:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57BED6D9F8; Tue, 23 Aug 2022 01:10:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D12E3B81C25; Tue, 23 Aug 2022 08:10:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16606C433D6; Tue, 23 Aug 2022 08:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242216; bh=GfvLHcQKa8EEuB0oS8LRPAOzkCWK28/qDxLgIRgfctY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/SrVawcKMwVN7OfBIBL4magzQ3jAgX2JNoMLkX3UlilR/b9CKApyUaTiMVW/vnnh FHIppJ4S50saA+nsQRTFFxJt+FNWxZSq7Q6Bi88EC9HpAj1Ur754YQwuue1JXq8By/ oaD3dLvAQAagN538i6AP0E5DfMeyNUno7KFieKRg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason Wang" , "Michael S. Tsirkin" Subject: [PATCH 5.19 078/365] virtio: VIRTIO_HARDEN_NOTIFICATION is broken Date: Tue, 23 Aug 2022 09:59:39 +0200 Message-Id: <20220823080121.453005696@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael S. Tsirkin commit ebe797f25f68f28581f46a9cb9c1997ac15c39a0 upstream. This option doesn't really work and breaks too many drivers. Not yet sure what's the right thing to do, for now let's make sure randconfig isn't broken by this. Fixes: c346dae4f3fb ("virtio: disable notification hardening by default") Cc: "Jason Wang" Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/virtio/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/virtio/Kconfig +++ b/drivers/virtio/Kconfig @@ -35,11 +35,12 @@ if VIRTIO_MENU =20 config VIRTIO_HARDEN_NOTIFICATION bool "Harden virtio notification" + depends on BROKEN help Enable this to harden the device notifications and suppress those that happen at a time where notifications are illegal. =20 - Experimental: Note that several drivers still have bugs that + Experimental: Note that several drivers still have issues that may cause crashes or hangs when correct handling of notifications is enforced; depending on the subset of drivers and devices you use, this may or may not work. From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5FCDC32793 for ; Tue, 23 Aug 2022 08:20:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242960AbiHWIUE (ORCPT ); Tue, 23 Aug 2022 04:20:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242776AbiHWIP4 (ORCPT ); Tue, 23 Aug 2022 04:15:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA908659E0; Tue, 23 Aug 2022 01:10:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B422FB81C22; Tue, 23 Aug 2022 08:10:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28571C433C1; Tue, 23 Aug 2022 08:10:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242225; bh=4qdvcd67QF/mJhsoNiRGkFq5X907E8Eoc35qTDH2SdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PV0efZQGtdFA9U85euEBOE3YsimN/z8zc86DsSUgyWc6n8ZggJP9B+4XvDkafAT8X uSbRMdtUSsSPU2yTpF0HGgRdiSdHX36c/UuJRy7pPtvaU9uRB6u6Gr3al9JTkz2WcH /ItTdDWdwYlZoaONO3sGWIGdywxx9IVHuzaq5Wj8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xuan Zhuo , Jason Wang , "David S. Miller" Subject: [PATCH 5.19 079/365] virtio_net: fix memory leak inside XPD_TX with mergeable Date: Tue, 23 Aug 2022 09:59:40 +0200 Message-Id: <20220823080121.493871888@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xuan Zhuo commit 7a542bee27c6a57e45c33cbbdc963325fd6493af upstream. When we call xdp_convert_buff_to_frame() to get xdpf, if it returns NULL, we should check if xdp_page was allocated by xdp_linearize_page(). If it is newly allocated, it should be freed here alone. Just like any other "goto err_xdp". Fixes: 44fa2dbd4759 ("xdp: transition into using xdp_frame for ndo_xdp_xmit= ") Signed-off-by: Xuan Zhuo Acked-by: Jason Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -1057,8 +1057,11 @@ static struct sk_buff *receive_mergeable case XDP_TX: stats->xdp_tx++; xdpf =3D xdp_convert_buff_to_frame(&xdp); - if (unlikely(!xdpf)) + if (unlikely(!xdpf)) { + if (unlikely(xdp_page !=3D page)) + put_page(xdp_page); goto err_xdp; + } err =3D virtnet_xdp_xmit(dev, 1, &xdpf, 0); if (unlikely(!err)) { xdp_return_frame_rx_napi(xdpf); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF1B7C32774 for ; Tue, 23 Aug 2022 08:21:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242988AbiHWIUR (ORCPT ); Tue, 23 Aug 2022 04:20:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242853AbiHWIQD (ORCPT ); Tue, 23 Aug 2022 04:16:03 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E387F4CA26; Tue, 23 Aug 2022 01:10:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 331D7CE1B34; Tue, 23 Aug 2022 08:10:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48EBDC433D7; Tue, 23 Aug 2022 08:10:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242231; bh=e9/obfON0SGjLdk8YP68PwFGB6cUPYEn5IAuShp4TRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JB8rQH5fnLAkEUbPAxyTS+vOr5tanSH5LSx3i3mWj2/Z87I3OJkuKE4jIMO0Y128I wN2+p9tb5+uTpvokxbNdxpzWsT2ye8awlUYcqFaKydUbq99HLVa8EAUYJInwQT0Hsv Rd44NZO1yCEW2esiJKbKZIrhYOW2KufGWOuuB0V4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Suwan Kim" , Shigeru Yoshida , "Michael S. Tsirkin" Subject: [PATCH 5.19 080/365] virtio-blk: Avoid use-after-free on suspend/resume Date: Tue, 23 Aug 2022 09:59:41 +0200 Message-Id: <20220823080121.539401933@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shigeru Yoshida commit 8d12ec10292877751ee4463b11a63bd850bc09b5 upstream. hctx->user_data is set to vq in virtblk_init_hctx(). However, vq is freed on suspend and reallocated on resume. So, hctx->user_data is invalid after resume, and it will cause use-after-free accessing which will result in the kernel crash something like below: [ 22.428391] Call Trace: [ 22.428899] [ 22.429339] virtqueue_add_split+0x3eb/0x620 [ 22.430035] ? __blk_mq_alloc_requests+0x17f/0x2d0 [ 22.430789] ? kvm_clock_get_cycles+0x14/0x30 [ 22.431496] virtqueue_add_sgs+0xad/0xd0 [ 22.432108] virtblk_add_req+0xe8/0x150 [ 22.432692] virtio_queue_rqs+0xeb/0x210 [ 22.433330] blk_mq_flush_plug_list+0x1b8/0x280 [ 22.434059] __blk_flush_plug+0xe1/0x140 [ 22.434853] blk_finish_plug+0x20/0x40 [ 22.435512] read_pages+0x20a/0x2e0 [ 22.436063] ? folio_add_lru+0x62/0xa0 [ 22.436652] page_cache_ra_unbounded+0x112/0x160 [ 22.437365] filemap_get_pages+0xe1/0x5b0 [ 22.437964] ? context_to_sid+0x70/0x100 [ 22.438580] ? sidtab_context_to_sid+0x32/0x400 [ 22.439979] filemap_read+0xcd/0x3d0 [ 22.440917] xfs_file_buffered_read+0x4a/0xc0 [ 22.441984] xfs_file_read_iter+0x65/0xd0 [ 22.442970] __kernel_read+0x160/0x2e0 [ 22.443921] bprm_execve+0x21b/0x640 [ 22.444809] do_execveat_common.isra.0+0x1a8/0x220 [ 22.446008] __x64_sys_execve+0x2d/0x40 [ 22.446920] do_syscall_64+0x37/0x90 [ 22.447773] entry_SYSCALL_64_after_hwframe+0x63/0xcd This patch fixes this issue by getting vq from vblk, and removes virtblk_init_hctx(). Fixes: 4e0400525691 ("virtio-blk: support polling I/O") Cc: "Suwan Kim" Signed-off-by: Shigeru Yoshida Message-Id: <20220810160948.959781-1-syoshida@redhat.com> Signed-off-by: Michael S. Tsirkin Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/block/virtio_blk.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 6fc7850c2b0a..d756423e0059 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -101,6 +101,14 @@ static inline blk_status_t virtblk_result(struct virtb= lk_req *vbr) } } =20 +static inline struct virtio_blk_vq *get_virtio_blk_vq(struct blk_mq_hw_ctx= *hctx) +{ + struct virtio_blk *vblk =3D hctx->queue->queuedata; + struct virtio_blk_vq *vq =3D &vblk->vqs[hctx->queue_num]; + + return vq; +} + static int virtblk_add_req(struct virtqueue *vq, struct virtblk_req *vbr) { struct scatterlist hdr, status, *sgs[3]; @@ -416,7 +424,7 @@ static void virtio_queue_rqs(struct request **rqlist) struct request *requeue_list =3D NULL; =20 rq_list_for_each_safe(rqlist, req, next) { - struct virtio_blk_vq *vq =3D req->mq_hctx->driver_data; + struct virtio_blk_vq *vq =3D get_virtio_blk_vq(req->mq_hctx); bool kick; =20 if (!virtblk_prep_rq_batch(req)) { @@ -837,7 +845,7 @@ static void virtblk_complete_batch(struct io_comp_batch= *iob) static int virtblk_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *= iob) { struct virtio_blk *vblk =3D hctx->queue->queuedata; - struct virtio_blk_vq *vq =3D hctx->driver_data; + struct virtio_blk_vq *vq =3D get_virtio_blk_vq(hctx); struct virtblk_req *vbr; unsigned long flags; unsigned int len; @@ -862,22 +870,10 @@ static int virtblk_poll(struct blk_mq_hw_ctx *hctx, s= truct io_comp_batch *iob) return found; } =20 -static int virtblk_init_hctx(struct blk_mq_hw_ctx *hctx, void *data, - unsigned int hctx_idx) -{ - struct virtio_blk *vblk =3D data; - struct virtio_blk_vq *vq =3D &vblk->vqs[hctx_idx]; - - WARN_ON(vblk->tag_set.tags[hctx_idx] !=3D hctx->tags); - hctx->driver_data =3D vq; - return 0; -} - static const struct blk_mq_ops virtio_mq_ops =3D { .queue_rq =3D virtio_queue_rq, .queue_rqs =3D virtio_queue_rqs, .commit_rqs =3D virtio_commit_rqs, - .init_hctx =3D virtblk_init_hctx, .complete =3D virtblk_request_done, .map_queues =3D virtblk_map_queues, .poll =3D virtblk_poll, --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64DD7C3F6B0 for ; Tue, 23 Aug 2022 08:22:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243024AbiHWIUZ (ORCPT ); Tue, 23 Aug 2022 04:20:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242890AbiHWIQG (ORCPT ); Tue, 23 Aug 2022 04:16:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06D8167477; Tue, 23 Aug 2022 01:10:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EA645B81C22; Tue, 23 Aug 2022 08:10:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51EEDC433C1; Tue, 23 Aug 2022 08:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242237; bh=MOhTH0quh9EdEM1uMx2W4WbcH4+nwmhT1nm92vb4wWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N5eA9lUed6/ucyDAc4B5T0cujQjmcbDPAVUzMptbSWtiD8hXufJxtzPVpqKFEp1di AC7o4bulnlNWZT6w1XiMUN4OAiEpv0dvCJr0u+cxL7b51uMr/Y00cLArAhCET08Nyh mJZ9CObOBRtWw6941oQorMkw2nKd7ins51cs6uK8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ido Schimmel , Jiri Pirko , "David S. Miller" Subject: [PATCH 5.19 081/365] devlink: Fix use-after-free after a failed reload Date: Tue, 23 Aug 2022 09:59:42 +0200 Message-Id: <20220823080121.581205970@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ido Schimmel commit 6b4db2e528f650c7fb712961aac36455468d5902 upstream. After a failed devlink reload, devlink parameters are still registered, which means user space can set and get their values. In the case of the mlxsw "acl_region_rehash_interval" parameter, these operations will trigger a use-after-free [1]. Fix this by rejecting set and get operations while in the failed state. Return the "-EOPNOTSUPP" error code which does not abort the parameters dump, but instead causes it to skip over the problematic parameter. Another possible fix is to perform these checks in the mlxsw parameter callbacks, but other drivers might be affected by the same problem and I am not aware of scenarios where these stricter checks will cause a regression. [1] mlxsw_spectrum3 0000:00:10.0: Port 125: Failed to register netdev mlxsw_spectrum3 0000:00:10.0: Failed to create ports =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BUG: KASAN: use-after-free in mlxsw_sp_acl_tcam_vregion_rehash_intrvl_get+0= xbd/0xd0 drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c:904 Read of size 4 at addr ffff8880099dcfd8 by task kworker/u4:4/777 CPU: 1 PID: 777 Comm: kworker/u4:4 Not tainted 5.19.0-rc7-custom-126601-gfe= 26f28c586d #1 Hardware name: QEMU MSN4700, BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.= org 04/01/2014 Workqueue: netns cleanup_net Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x92/0xbd lib/dump_stack.c:106 print_address_description mm/kasan/report.c:313 [inline] print_report.cold+0x5e/0x5cf mm/kasan/report.c:429 kasan_report+0xb9/0xf0 mm/kasan/report.c:491 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:306 mlxsw_sp_acl_tcam_vregion_rehash_intrvl_get+0xbd/0xd0 drivers/net/ethernet= /mellanox/mlxsw/spectrum_acl_tcam.c:904 mlxsw_sp_acl_region_rehash_intrvl_get+0x49/0x60 drivers/net/ethernet/mella= nox/mlxsw/spectrum_acl.c:1106 mlxsw_sp_params_acl_region_rehash_intrvl_get+0x33/0x80 drivers/net/etherne= t/mellanox/mlxsw/spectrum.c:3854 devlink_param_get net/core/devlink.c:4981 [inline] devlink_nl_param_fill+0x238/0x12d0 net/core/devlink.c:5089 devlink_param_notify+0xe5/0x230 net/core/devlink.c:5168 devlink_ns_change_notify net/core/devlink.c:4417 [inline] devlink_ns_change_notify net/core/devlink.c:4396 [inline] devlink_reload+0x15f/0x700 net/core/devlink.c:4507 devlink_pernet_pre_exit+0x112/0x1d0 net/core/devlink.c:12272 ops_pre_exit_list net/core/net_namespace.c:152 [inline] cleanup_net+0x494/0xc00 net/core/net_namespace.c:582 process_one_work+0x9fc/0x1710 kernel/workqueue.c:2289 worker_thread+0x675/0x10b0 kernel/workqueue.c:2436 kthread+0x30c/0x3d0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 The buggy address belongs to the physical page: page:ffffea0000267700 refcount:0 mapcount:0 mapping:0000000000000000 index:= 0x0 pfn:0x99dc flags: 0x100000000000000(node=3D0|zone=3D1) raw: 0100000000000000 0000000000000000 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880099dce80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880099dcf00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8880099dcf80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880099dd000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880099dd080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Fixes: 98bbf70c1c41 ("mlxsw: spectrum: add "acl_region_rehash_interval" dev= link param") Signed-off-by: Ido Schimmel Reviewed-by: Jiri Pirko Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/core/devlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -4943,7 +4943,7 @@ static int devlink_param_get(struct devl const struct devlink_param *param, struct devlink_param_gset_ctx *ctx) { - if (!param->get) + if (!param->get || devlink->reload_failed) return -EOPNOTSUPP; return param->get(devlink, param->id, ctx); } @@ -4952,7 +4952,7 @@ static int devlink_param_set(struct devl const struct devlink_param *param, struct devlink_param_gset_ctx *ctx) { - if (!param->set) + if (!param->set || devlink->reload_failed) return -EOPNOTSUPP; return param->set(devlink, param->id, ctx); } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB823C38142 for ; Tue, 23 Aug 2022 08:22:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243938AbiHWIWA (ORCPT ); Tue, 23 Aug 2022 04:22:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242955AbiHWIQO (ORCPT ); Tue, 23 Aug 2022 04:16:14 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 248CF6DAEB; Tue, 23 Aug 2022 01:10:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id DF17CCE1B33; Tue, 23 Aug 2022 08:10:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02B5DC433C1; Tue, 23 Aug 2022 08:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242243; bh=v77QCxN5t03rhG0kqNnJMBJDGOVrO597SCcFenWO9j8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FulNmzwtJKf7A4m3BxYwsleI3dAomCqGxsg6Uyy9b6LTPjGpSvOKpmHmwKnxl6SHA R3e1sN3FdfmFhIwUvmumY4aj4HUHd4txdfh6o42G/XN0I1ssYQrQQ/T3r06v9Nvg2C 2d4cXytHtV6jiC/LNVDwinu3Jf0Y4bropdyiazCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Jakub Kicinski Subject: [PATCH 5.19 082/365] net: phy: Warn about incorrect mdio_bus_phy_resume() state Date: Tue, 23 Aug 2022 09:59:43 +0200 Message-Id: <20220823080121.623932701@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Fainelli commit 744d23c71af39c7dc77ac7c3cac87ae86a181a85 upstream. Calling mdio_bus_phy_resume() with neither the PHY state machine set to PHY_HALTED nor phydev->mac_managed_pm set to true is a good indication that we can produce a race condition looking like this: CPU0 CPU1 bcmgenet_resume -> phy_resume -> phy_init_hw -> phy_start -> phy_resume phy_start_aneg() mdio_bus_phy_resume -> phy_resume -> phy_write(..., BMCR_RESET) -> usleep() -> phy_read() with the phy_resume() function triggering a PHY behavior that might have to be worked around with (see bf8bfc4336f7 ("net: phy: broadcom: Fix brcm_fet_config_init()") for instance) that ultimately leads to an error reading from the PHY. Fixes: fba863b81604 ("net: phy: make PHY PM ops a no-op if MAC driver manag= es PHY PM") Signed-off-by: Florian Fainelli Link: https://lore.kernel.org/r/20220801233403.258871-1-f.fainelli@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/phy/phy_device.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -316,6 +316,12 @@ static __maybe_unused int mdio_bus_phy_r =20 phydev->suspended_by_mdio_bus =3D 0; =20 + /* If we managed to get here with the PHY state machine in a state other + * than PHY_HALTED this is an indication that something went wrong and + * we should most likely be using MAC managed PM and we are not. + */ + WARN_ON(phydev->state !=3D PHY_HALTED && !phydev->mac_managed_pm); + ret =3D phy_init_hw(phydev); if (ret < 0) return ret; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 125A7C32774 for ; Tue, 23 Aug 2022 08:22:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242494AbiHWIWE (ORCPT ); Tue, 23 Aug 2022 04:22:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242964AbiHWIQP (ORCPT ); Tue, 23 Aug 2022 04:16:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A33E54E614; Tue, 23 Aug 2022 01:10:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 32D776128D; Tue, 23 Aug 2022 08:10:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FA3AC433D6; Tue, 23 Aug 2022 08:10:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242249; bh=6mxxRCHil7BriKiwGC+xNzPurzC8Acc2JNZN7S7i1AQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rCshTyijpqwKWMynlTsGF4J797lGsK3Uq+lS1CTIHKZF3VNHozpP0ln7ev+nkn/vQ UN4AQVp3aR2lwEmJgucFi1kbzCXHkOsmi7ciktnkqgtfR6+iBKqa4qx7ZQpGVxTJ+j WFeAt7DI0kTEJbIEBsnfPqMrS9hn5DqsP/6QzmsI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Jakub Kicinski Subject: [PATCH 5.19 083/365] net: bcmgenet: Indicate MAC is in charge of PHY PM Date: Tue, 23 Aug 2022 09:59:44 +0200 Message-Id: <20220823080121.665495529@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Fainelli commit bc3410f250219660a7be032c01c954a53b2c26ab upstream. Avoid the PHY library call unnecessarily into the suspend/resume functions = by setting phydev->mac_managed_pm to true. The GENET driver essentially does exactly what mdio_bus_phy_resume() does by calling phy_init_hw() plus phy_resume(). Fixes: fba863b81604 ("net: phy: make PHY PM ops a no-op if MAC driver manag= es PHY PM") Signed-off-by: Florian Fainelli Link: https://lore.kernel.org/r/20220804173605.1266574-1-f.fainelli@gmail.c= om Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/broadcom/genet/bcmmii.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c @@ -393,6 +393,9 @@ int bcmgenet_mii_probe(struct net_device if (priv->internal_phy && !GENET_IS_V5(priv)) dev->phydev->irq =3D PHY_MAC_INTERRUPT; =20 + /* Indicate that the MAC is responsible for PHY PM */ + dev->phydev->mac_managed_pm =3D true; + return 0; } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E167C32774 for ; Tue, 23 Aug 2022 08:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243186AbiHWIXg (ORCPT ); Tue, 23 Aug 2022 04:23:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243050AbiHWIQb (ORCPT ); Tue, 23 Aug 2022 04:16:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCA2E67CBE; Tue, 23 Aug 2022 01:11:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 92D1FB81C25; Tue, 23 Aug 2022 08:11:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D58C1C433D6; Tue, 23 Aug 2022 08:10:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242259; bh=QJpX0XKokoMZBk/Tl7oumqJUQg482sDWrAlMoLsvadk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pzXqpkOYmk4pxehX7V/Nv4ITuuHGGdVJRvWZ55COPlVaYc7uy6D+WDmMIdVcWzrKJ +BQZL/ue9VSawd+JQ8c+SYR1bTHfFfcnz8MR4nL13bksdOx14Dx0q8W+/px9LKReFy Ar9vB0ZLpZuOVv/NdDD1Cn3XrAVt/zG54JYjwpxA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksij Rempel , Andrew Lunn , Jakub Kicinski Subject: [PATCH 5.19 084/365] net: phy: c45 baset1: do not skip aneg configuration if clock role is not specified Date: Tue, 23 Aug 2022 09:59:45 +0200 Message-Id: <20220823080121.697047439@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oleksij Rempel commit 3702e4041cfda50bc697363d29511ce8f6b24795 upstream. In case master/slave clock role is not specified (which is default), the aneg registers will not be written. The visible impact of this is missing pause advertisement. So, rework genphy_c45_baset1_an_config_aneg() to be able to write advertisement registers even if clock role is unknown. Fixes: 3da8ffd8545f ("net: phy: Add 10BASE-T1L support in phy-c45") Signed-off-by: Oleksij Rempel Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220805073159.908643-1-o.rempel@pengutroni= x.de Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/phy/phy-c45.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c @@ -190,44 +190,42 @@ EXPORT_SYMBOL_GPL(genphy_c45_pma_setup_f */ static int genphy_c45_baset1_an_config_aneg(struct phy_device *phydev) { + u16 adv_l_mask, adv_l =3D 0; + u16 adv_m_mask, adv_m =3D 0; int changed =3D 0; - u16 adv_l =3D 0; - u16 adv_m =3D 0; int ret; =20 + adv_l_mask =3D MDIO_AN_T1_ADV_L_FORCE_MS | MDIO_AN_T1_ADV_L_PAUSE_CAP | + MDIO_AN_T1_ADV_L_PAUSE_ASYM; + adv_m_mask =3D MDIO_AN_T1_ADV_M_MST | MDIO_AN_T1_ADV_M_B10L; + switch (phydev->master_slave_set) { case MASTER_SLAVE_CFG_MASTER_FORCE: + adv_m |=3D MDIO_AN_T1_ADV_M_MST; + fallthrough; case MASTER_SLAVE_CFG_SLAVE_FORCE: adv_l |=3D MDIO_AN_T1_ADV_L_FORCE_MS; break; case MASTER_SLAVE_CFG_MASTER_PREFERRED: + adv_m |=3D MDIO_AN_T1_ADV_M_MST; + fallthrough; case MASTER_SLAVE_CFG_SLAVE_PREFERRED: break; case MASTER_SLAVE_CFG_UNKNOWN: case MASTER_SLAVE_CFG_UNSUPPORTED: - return 0; + /* if master/slave role is not specified, do not overwrite it */ + adv_l_mask &=3D ~MDIO_AN_T1_ADV_L_FORCE_MS; + adv_m_mask &=3D ~MDIO_AN_T1_ADV_M_MST; + break; default: phydev_warn(phydev, "Unsupported Master/Slave mode\n"); return -EOPNOTSUPP; } =20 - switch (phydev->master_slave_set) { - case MASTER_SLAVE_CFG_MASTER_FORCE: - case MASTER_SLAVE_CFG_MASTER_PREFERRED: - adv_m |=3D MDIO_AN_T1_ADV_M_MST; - break; - case MASTER_SLAVE_CFG_SLAVE_FORCE: - case MASTER_SLAVE_CFG_SLAVE_PREFERRED: - break; - default: - break; - } - adv_l |=3D linkmode_adv_to_mii_t1_adv_l_t(phydev->advertising); =20 ret =3D phy_modify_mmd_changed(phydev, MDIO_MMD_AN, MDIO_AN_T1_ADV_L, - (MDIO_AN_T1_ADV_L_FORCE_MS | MDIO_AN_T1_ADV_L_PAUSE_CAP - | MDIO_AN_T1_ADV_L_PAUSE_ASYM), adv_l); + adv_l_mask, adv_l); if (ret < 0) return ret; if (ret > 0) @@ -236,7 +234,7 @@ static int genphy_c45_baset1_an_config_a adv_m |=3D linkmode_adv_to_mii_t1_adv_m_t(phydev->advertising); =20 ret =3D phy_modify_mmd_changed(phydev, MDIO_MMD_AN, MDIO_AN_T1_ADV_M, - MDIO_AN_T1_ADV_M_MST | MDIO_AN_T1_ADV_M_B10L, adv_m); + adv_m_mask, adv_m); if (ret < 0) return ret; if (ret > 0) From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 177BFC32774 for ; Tue, 23 Aug 2022 08:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243208AbiHWIXs (ORCPT ); Tue, 23 Aug 2022 04:23:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243053AbiHWIQb (ORCPT ); Tue, 23 Aug 2022 04:16:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1EE869F4B; Tue, 23 Aug 2022 01:11:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 13F4461257; Tue, 23 Aug 2022 08:11:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F9F5C433C1; Tue, 23 Aug 2022 08:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242265; bh=X64jWE4sYmXdajzHGjPAcpzNUpOWDxH6QKW+V8PUFBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kyo9z05no06eVUUDySlDZIoHHoG7Zq/+379K/6Q5wQB8rgtEI3RjmxkB9S6hT01+i REqaNbZB8BuUEFNay7Ob/AfRYppn40xX+L5X5x2bMj7HzUoc4klLPIF5HZ6vJ0tKy4 h3bTe9aWZVeHQHiKtqrRj/6yxgsiWNpo5dQSc+qc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Florian Fainelli , Jakub Kicinski Subject: [PATCH 5.19 085/365] net: dsa: felix: suppress non-changes to the tagging protocol Date: Tue, 23 Aug 2022 09:59:46 +0200 Message-Id: <20220823080121.746982636@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean commit 4c46bb49460ee14c69629e813640d8b929e88941 upstream. The way in which dsa_tree_change_tag_proto() works is that when dsa_tree_notify() fails, it doesn't know whether the operation failed mid way in a multi-switch tree, or it failed for a single-switch tree. So even though drivers need to fail cleanly in ds->ops->change_tag_protocol(), DSA will still call dsa_tree_notify() again, to restore the old tag protocol for potential switches in the tree where the change did succeeed (before failing for others). This means for the felix driver that if we report an error in felix_change_tag_protocol(), we'll get another call where proto_ops =3D=3D old_proto_ops. If we proceed to act upon that, we may do unexpected things. For example, we will call dsa_tag_8021q_register() twice in a row, without any dsa_tag_8021q_unregister() in between. Then we will actually call dsa_tag_8021q_unregister() via old_proto_ops->teardown, which (if it manages to run at all, after walking through corrupted data structures) will leave the ports inoperational anyway. The bug can be readily reproduced if we force an error while in tag_8021q mode; this crashes the kernel. echo ocelot-8021q > /sys/class/net/eno2/dsa/tagging echo edsa > /sys/class/net/eno2/dsa/tagging # -EPROTONOSUPPORT Unable to handle kernel NULL pointer dereference at virtual address 0000000= 000000014 Call trace: vcap_entry_get+0x24/0x124 ocelot_vcap_filter_del+0x198/0x270 felix_tag_8021q_vlan_del+0xd4/0x21c dsa_switch_tag_8021q_vlan_del+0x168/0x2cc dsa_switch_event+0x68/0x1170 dsa_tree_notify+0x14/0x34 dsa_port_tag_8021q_vlan_del+0x84/0x110 dsa_tag_8021q_unregister+0x15c/0x1c0 felix_tag_8021q_teardown+0x16c/0x180 felix_change_tag_protocol+0x1bc/0x230 dsa_switch_event+0x14c/0x1170 dsa_tree_change_tag_proto+0x118/0x1c0 Fixes: 7a29d220f4c0 ("net: dsa: felix: reimplement tagging protocol change = with function pointers") Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Link: https://lore.kernel.org/r/20220808125127.3344094-1-vladimir.oltean@nx= p.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/dsa/ocelot/felix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 859196898a7d..aadb0bd7c24f 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -610,6 +610,9 @@ static int felix_change_tag_protocol(struct dsa_switch = *ds, =20 old_proto_ops =3D felix->tag_proto_ops; =20 + if (proto_ops =3D=3D old_proto_ops) + return 0; + err =3D proto_ops->setup(ds); if (err) goto setup_failed; --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0103C32774 for ; Tue, 23 Aug 2022 08:23:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243127AbiHWIXE (ORCPT ); Tue, 23 Aug 2022 04:23:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243074AbiHWIQd (ORCPT ); Tue, 23 Aug 2022 04:16:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08EDEC06; Tue, 23 Aug 2022 01:11:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E6B1612D8; Tue, 23 Aug 2022 08:11:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A4E5C433C1; Tue, 23 Aug 2022 08:11:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242271; bh=I1xhZSiC9DRvT8rxyQAW4Nh+0v4H2XNl/oVbjpuEVrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GIsp5bDGrka/7kTMNZFq4vbNlp+3ZTGoYiJKqvc7gCxd2jt1I2cJlSCLdNRqUopWM 1T3ucJEHM7ijM0HC6muejccz+kO7C6vEVZPhIub2xKX6t3G4iuFAnCaDiMT9kpUJ87 5FRvlbly4J+RaLk8d4jqBmupQ3kmcKxbF6gbZEIQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sandor Bodo-Merle , Florian Fainelli , Jakub Kicinski Subject: [PATCH 5.19 086/365] net: bgmac: Fix a BUG triggered by wrong bytes_compl Date: Tue, 23 Aug 2022 09:59:47 +0200 Message-Id: <20220823080121.788256867@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sandor Bodo-Merle commit 1b7680c6c1f6de9904f1d9b05c952f0c64a03350 upstream. On one of our machines we got: kernel BUG at lib/dynamic_queue_limits.c:27! Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM CPU: 0 PID: 1166 Comm: irq/41-bgmac Tainted: G W O 4.14.275-rt13= 2 #1 Hardware name: BRCM XGS iProc task: ee3415c0 task.stack: ee32a000 PC is at dql_completed+0x168/0x178 LR is at bgmac_poll+0x18c/0x6d8 pc : [] lr : [] psr: 800a0313 sp : ee32be14 ip : 000005ea fp : 00000bd4 r10: ee558500 r9 : c0116298 r8 : 00000002 r7 : 00000000 r6 : ef128810 r5 : 01993267 r4 : 01993851 r3 : ee558000 r2 : 000070e1 r1 : 00000bd4 r0 : ee52c180 Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none Control: 12c5387d Table: 8e88c04a DAC: 00000051 Process irq/41-bgmac (pid: 1166, stack limit =3D 0xee32a210) Stack: (0xee32be14 to 0xee32c000) be00: ee558520 ee52c100 ef1288= 10 be20: 00000000 00000002 c0116298 c04b5a18 00000000 c0a0c8c4 c0951780 000000= 40 be40: c0701780 ee558500 ee55d520 ef05b340 ef6f9780 ee558520 00000001 000000= 40 be60: ffffe000 c0a56878 ef6fa040 c0952040 0000012c c0528744 ef6f97b0 fffcfb= 6a be80: c0a04104 2eda8000 c0a0c4ec c0a0d368 ee32bf44 c0153534 ee32be98 ee32be= 98 bea0: ee32bea0 ee32bea0 ee32bea8 ee32bea8 00000000 c01462e4 ffffe000 ef6f22= a8 bec0: ffffe000 00000008 ee32bee4 c0147430 ffffe000 c094a2a8 00000003 ffffe0= 00 bee0: c0a54528 00208040 0000000c c0a0c8c4 c0a65980 c0124d3c 00000008 ee5585= 20 bf00: c094a23c c0a02080 00000000 c07a9910 ef136970 ef136970 ee30a440 ef1369= 00 bf20: ee30a440 00000001 ef136900 ee30a440 c016d990 00000000 c0108db0 c01250= 0c bf40: ef136900 c016da14 ee30a464 ffffe000 00000001 c016dd14 00000000 c016db= 28 bf60: ffffe000 ee21a080 ee30a400 00000000 ee32a000 ee30a440 c016dbfc ee25fd= 70 bf80: ee21a09c c013edcc ee32a000 ee30a400 c013ec7c 00000000 00000000 000000= 00 bfa0: 00000000 00000000 00000000 c0108470 00000000 00000000 00000000 000000= 00 bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000= 00 bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 000000= 00 [] (dql_completed) from [] (bgmac_poll+0x18c/0x6d8) [] (bgmac_poll) from [] (net_rx_action+0x1c4/0x494) [] (net_rx_action) from [] (do_current_softirqs+0x1ec/0= x43c) [] (do_current_softirqs) from [] (__local_bh_enable+0x8= 0/0x98) [] (__local_bh_enable) from [] (irq_forced_thread_fn+0x= 84/0x98) [] (irq_forced_thread_fn) from [] (irq_thread+0x118/0x1= c0) [] (irq_thread) from [] (kthread+0x150/0x158) [] (kthread) from [] (ret_from_fork+0x14/0x24) Code: a83f15e0 0200001a 0630a0e1 c3ffffea (f201f0e7) The issue seems similar to commit 90b3b339364c ("net: hisilicon: Fix a BUG trigered by wrong bytes_compl") and potentially introduced by commit b38c83dd0866 ("bgmac: simplify tx ring index handling"). If there is an RX interrupt between setting ring->end and netdev_sent_queue() we can hit the BUG_ON as bgmac_dma_tx_free() can miscalculate the queue size while called from bgmac_poll(). The machine which triggered the BUG runs a v4.14 RT kernel - but the issue seems present in mainline too. Fixes: b38c83dd0866 ("bgmac: simplify tx ring index handling") Signed-off-by: Sandor Bodo-Merle Reviewed-by: Florian Fainelli Link: https://lore.kernel.org/r/20220808173939.193804-1-sbodomerle@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/broadcom/bgmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c @@ -189,8 +189,8 @@ static netdev_tx_t bgmac_dma_tx_add(stru } =20 slot->skb =3D skb; - ring->end +=3D nr_frags + 1; netdev_sent_queue(net_dev, skb->len); + ring->end +=3D nr_frags + 1; =20 wmb(); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D07AC32774 for ; Tue, 23 Aug 2022 08:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243069AbiHWIWx (ORCPT ); Tue, 23 Aug 2022 04:22:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243086AbiHWIQe (ORCPT ); Tue, 23 Aug 2022 04:16:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37D25CD0; Tue, 23 Aug 2022 01:11:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DFCF3B81C26; Tue, 23 Aug 2022 08:11:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13732C433C1; Tue, 23 Aug 2022 08:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242278; bh=kEu+tVAAMz7l6eaSkXFjJcQXu+RSWjRkIomwdhEVcyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yMNTQXJpZgYmVXylz9tPVTEMtDQ69gLia4yVWHXSUdmI0VpFgs3BezdnNRBWiq+uk wX5u8ojJG778OCPF8N0FvS3bA61vCbjeGRanEeyqeMZNaBy/CJ9SjV72ZKunFQu7fS cETMKP86KacJHk6Q8u1uhJRw9wlz3bmyioHzzIxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby , Jakub Kicinski Subject: [PATCH 5.19 087/365] net: atm: bring back zatm uAPI Date: Tue, 23 Aug 2022 09:59:48 +0200 Message-Id: <20220823080121.829262938@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jakub Kicinski commit c2e75634cbe368065f140dd30bf8b1a0355158fd upstream. Jiri reports that linux-atm does not build without this header. Bring it back. It's completely dead code but we can't break the build for user space :( Reported-by: Jiri Slaby Fixes: 052e1f01bfae ("net: atm: remove support for ZeitNet ZN122x ATM devic= es") Link: https://lore.kernel.org/all/8576aef3-37e4-8bae-bab5-08f82a78efd3@kern= el.org/ Link: https://lore.kernel.org/r/20220810164547.484378-1-kuba@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- include/uapi/linux/atm_zatm.h | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 include/uapi/linux/atm_zatm.h diff --git a/include/uapi/linux/atm_zatm.h b/include/uapi/linux/atm_zatm.h new file mode 100644 index 000000000000..5135027b93c1 --- /dev/null +++ b/include/uapi/linux/atm_zatm.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* atm_zatm.h - Driver-specific declarations of the ZATM driver (for use by + driver-specific utilities) */ + +/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ + + +#ifndef LINUX_ATM_ZATM_H +#define LINUX_ATM_ZATM_H + +/* + * Note: non-kernel programs including this file must also include + * sys/types.h for struct timeval + */ + +#include +#include + +#define ZATM_GETPOOL _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc) + /* get pool statistics */ +#define ZATM_GETPOOLZ _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc) + /* get statistics and zero */ +#define ZATM_SETPOOL _IOW('a',ATMIOC_SARPRV+3,struct atmif_sioc) + /* set pool parameters */ + +struct zatm_pool_info { + int ref_count; /* free buffer pool usage counters */ + int low_water,high_water; /* refill parameters */ + int rqa_count,rqu_count; /* queue condition counters */ + int offset,next_off; /* alignment optimizations: offset */ + int next_cnt,next_thres; /* repetition counter and threshold */ +}; + +struct zatm_pool_req { + int pool_num; /* pool number */ + struct zatm_pool_info info; /* actual information */ +}; + +#define ZATM_OAM_POOL 0 /* free buffer pool for OAM cells */ +#define ZATM_AAL0_POOL 1 /* free buffer pool for AAL0 cells */ +#define ZATM_AAL5_POOL_BASE 2 /* first AAL5 free buffer pool */ +#define ZATM_LAST_POOL ZATM_AAL5_POOL_BASE+10 /* max. 64 kB */ + +#define ZATM_TIMER_HISTORY_SIZE 16 /* number of timer adjustments to + record; must be 2^n */ + +#endif --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37378C32774 for ; Tue, 23 Aug 2022 08:23:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243171AbiHWIX0 (ORCPT ); Tue, 23 Aug 2022 04:23:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243091AbiHWIQf (ORCPT ); Tue, 23 Aug 2022 04:16:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C101D26E9; Tue, 23 Aug 2022 01:11:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5234F612D7; Tue, 23 Aug 2022 08:11:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BD84C433D6; Tue, 23 Aug 2022 08:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242284; bh=xzFXTcj5rZlnFvpKISIdjBybio5fBX5Hp895vlOgAWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hs1PYo6pvHoKjs9bt9MV+Y+3UuhW+Wry5J4VCvCNzlu6CPbCCadxY6ALB6LcYJQVP pI8mxVso8UzTfpHJyiCxVpF7wELwLyk9al8QaGHrexGkbVmr2PftV0VBKQSR44ifls agGUV3nVwuUmGThRZTx4/qPeoD5QTklF7GgPAlqM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ivan Vecera , Ido Schimmel , Amit Cohen , Jakub Kicinski Subject: [PATCH 5.19 088/365] selftests: forwarding: Fix failing tests with old libnet Date: Tue, 23 Aug 2022 09:59:49 +0200 Message-Id: <20220823080121.870034612@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ido Schimmel commit 8bcfb4ae4d970b9a9724ddfbac26c387934e0e94 upstream. The custom multipath hash tests use mausezahn in order to test how changes in various packet fields affect the packet distribution across the available nexthops. The tool uses the libnet library for various low-level packet construction and injection. The library started using the "SO_BINDTODEVICE" socket option for IPv6 sockets in version 1.1.6 and for IPv4 sockets in version 1.2. When the option is not set, packets are not routed according to the table associated with the VRF master device and tests fail. Fix this by prefixing the command with "ip vrf exec", which will cause the route lookup to occur in the VRF routing table. This makes the tests pass regardless of the libnet library version. Fixes: 511e8db54036 ("selftests: forwarding: Add test for custom multipath = hash") Fixes: 185b0c190bb6 ("selftests: forwarding: Add test for custom multipath = hash with IPv4 GRE") Fixes: b7715acba4d3 ("selftests: forwarding: Add test for custom multipath = hash with IPv6 GRE") Reported-by: Ivan Vecera Tested-by: Ivan Vecera Signed-off-by: Ido Schimmel Reviewed-by: Amit Cohen Link: https://lore.kernel.org/r/20220809113320.751413-1-idosch@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- tools/testing/selftests/net/forwarding/custom_multipath_hash.sh | = 24 ++++++---- tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh | = 24 ++++++---- tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh | = 24 ++++++---- 3 files changed, 48 insertions(+), 24 deletions(-) --- a/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh +++ b/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh @@ -181,37 +181,43 @@ ping_ipv6() =20 send_src_ipv4() { - $MZ $h1 -q -p 64 -A "198.51.100.2-198.51.100.253" -B 203.0.113.2 \ + ip vrf exec v$h1 $MZ $h1 -q -p 64 \ + -A "198.51.100.2-198.51.100.253" -B 203.0.113.2 \ -d 1msec -c 50 -t udp "sp=3D20000,dp=3D30000" } =20 send_dst_ipv4() { - $MZ $h1 -q -p 64 -A 198.51.100.2 -B "203.0.113.2-203.0.113.253" \ + ip vrf exec v$h1 $MZ $h1 -q -p 64 \ + -A 198.51.100.2 -B "203.0.113.2-203.0.113.253" \ -d 1msec -c 50 -t udp "sp=3D20000,dp=3D30000" } =20 send_src_udp4() { - $MZ $h1 -q -p 64 -A 198.51.100.2 -B 203.0.113.2 \ + ip vrf exec v$h1 $MZ $h1 -q -p 64 \ + -A 198.51.100.2 -B 203.0.113.2 \ -d 1msec -t udp "sp=3D0-32768,dp=3D30000" } =20 send_dst_udp4() { - $MZ $h1 -q -p 64 -A 198.51.100.2 -B 203.0.113.2 \ + ip vrf exec v$h1 $MZ $h1 -q -p 64 \ + -A 198.51.100.2 -B 203.0.113.2 \ -d 1msec -t udp "sp=3D20000,dp=3D0-32768" } =20 send_src_ipv6() { - $MZ -6 $h1 -q -p 64 -A "2001:db8:1::2-2001:db8:1::fd" -B 2001:db8:4::2 \ + ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ + -A "2001:db8:1::2-2001:db8:1::fd" -B 2001:db8:4::2 \ -d 1msec -c 50 -t udp "sp=3D20000,dp=3D30000" } =20 send_dst_ipv6() { - $MZ -6 $h1 -q -p 64 -A 2001:db8:1::2 -B "2001:db8:4::2-2001:db8:4::fd" \ + ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ + -A 2001:db8:1::2 -B "2001:db8:4::2-2001:db8:4::fd" \ -d 1msec -c 50 -t udp "sp=3D20000,dp=3D30000" } =20 @@ -226,13 +232,15 @@ send_flowlabel() =20 send_src_udp6() { - $MZ -6 $h1 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:4::2 \ + ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ + -A 2001:db8:1::2 -B 2001:db8:4::2 \ -d 1msec -t udp "sp=3D0-32768,dp=3D30000" } =20 send_dst_udp6() { - $MZ -6 $h1 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:4::2 \ + ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ + -A 2001:db8:1::2 -B 2001:db8:4::2 \ -d 1msec -t udp "sp=3D20000,dp=3D0-32768" } =20 --- a/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh +++ b/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh @@ -276,37 +276,43 @@ ping_ipv6() =20 send_src_ipv4() { - $MZ $h1 -q -p 64 -A "198.51.100.2-198.51.100.253" -B 203.0.113.2 \ + ip vrf exec v$h1 $MZ $h1 -q -p 64 \ + -A "198.51.100.2-198.51.100.253" -B 203.0.113.2 \ -d 1msec -c 50 -t udp "sp=3D20000,dp=3D30000" } =20 send_dst_ipv4() { - $MZ $h1 -q -p 64 -A 198.51.100.2 -B "203.0.113.2-203.0.113.253" \ + ip vrf exec v$h1 $MZ $h1 -q -p 64 \ + -A 198.51.100.2 -B "203.0.113.2-203.0.113.253" \ -d 1msec -c 50 -t udp "sp=3D20000,dp=3D30000" } =20 send_src_udp4() { - $MZ $h1 -q -p 64 -A 198.51.100.2 -B 203.0.113.2 \ + ip vrf exec v$h1 $MZ $h1 -q -p 64 \ + -A 198.51.100.2 -B 203.0.113.2 \ -d 1msec -t udp "sp=3D0-32768,dp=3D30000" } =20 send_dst_udp4() { - $MZ $h1 -q -p 64 -A 198.51.100.2 -B 203.0.113.2 \ + ip vrf exec v$h1 $MZ $h1 -q -p 64 \ + -A 198.51.100.2 -B 203.0.113.2 \ -d 1msec -t udp "sp=3D20000,dp=3D0-32768" } =20 send_src_ipv6() { - $MZ -6 $h1 -q -p 64 -A "2001:db8:1::2-2001:db8:1::fd" -B 2001:db8:2::2 \ + ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ + -A "2001:db8:1::2-2001:db8:1::fd" -B 2001:db8:2::2 \ -d 1msec -c 50 -t udp "sp=3D20000,dp=3D30000" } =20 send_dst_ipv6() { - $MZ -6 $h1 -q -p 64 -A 2001:db8:1::2 -B "2001:db8:2::2-2001:db8:2::fd" \ + ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ + -A 2001:db8:1::2 -B "2001:db8:2::2-2001:db8:2::fd" \ -d 1msec -c 50 -t udp "sp=3D20000,dp=3D30000" } =20 @@ -321,13 +327,15 @@ send_flowlabel() =20 send_src_udp6() { - $MZ -6 $h1 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:2::2 \ + ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ + -A 2001:db8:1::2 -B 2001:db8:2::2 \ -d 1msec -t udp "sp=3D0-32768,dp=3D30000" } =20 send_dst_udp6() { - $MZ -6 $h1 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:2::2 \ + ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ + -A 2001:db8:1::2 -B 2001:db8:2::2 \ -d 1msec -t udp "sp=3D20000,dp=3D0-32768" } =20 --- a/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh +++ b/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh @@ -278,37 +278,43 @@ ping_ipv6() =20 send_src_ipv4() { - $MZ $h1 -q -p 64 -A "198.51.100.2-198.51.100.253" -B 203.0.113.2 \ + ip vrf exec v$h1 $MZ $h1 -q -p 64 \ + -A "198.51.100.2-198.51.100.253" -B 203.0.113.2 \ -d 1msec -c 50 -t udp "sp=3D20000,dp=3D30000" } =20 send_dst_ipv4() { - $MZ $h1 -q -p 64 -A 198.51.100.2 -B "203.0.113.2-203.0.113.253" \ + ip vrf exec v$h1 $MZ $h1 -q -p 64 \ + -A 198.51.100.2 -B "203.0.113.2-203.0.113.253" \ -d 1msec -c 50 -t udp "sp=3D20000,dp=3D30000" } =20 send_src_udp4() { - $MZ $h1 -q -p 64 -A 198.51.100.2 -B 203.0.113.2 \ + ip vrf exec v$h1 $MZ $h1 -q -p 64 \ + -A 198.51.100.2 -B 203.0.113.2 \ -d 1msec -t udp "sp=3D0-32768,dp=3D30000" } =20 send_dst_udp4() { - $MZ $h1 -q -p 64 -A 198.51.100.2 -B 203.0.113.2 \ + ip vrf exec v$h1 $MZ $h1 -q -p 64 \ + -A 198.51.100.2 -B 203.0.113.2 \ -d 1msec -t udp "sp=3D20000,dp=3D0-32768" } =20 send_src_ipv6() { - $MZ -6 $h1 -q -p 64 -A "2001:db8:1::2-2001:db8:1::fd" -B 2001:db8:2::2 \ + ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ + -A "2001:db8:1::2-2001:db8:1::fd" -B 2001:db8:2::2 \ -d 1msec -c 50 -t udp "sp=3D20000,dp=3D30000" } =20 send_dst_ipv6() { - $MZ -6 $h1 -q -p 64 -A 2001:db8:1::2 -B "2001:db8:2::2-2001:db8:2::fd" \ + ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ + -A 2001:db8:1::2 -B "2001:db8:2::2-2001:db8:2::fd" \ -d 1msec -c 50 -t udp "sp=3D20000,dp=3D30000" } =20 @@ -323,13 +329,15 @@ send_flowlabel() =20 send_src_udp6() { - $MZ -6 $h1 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:2::2 \ + ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ + -A 2001:db8:1::2 -B 2001:db8:2::2 \ -d 1msec -t udp "sp=3D0-32768,dp=3D30000" } =20 send_dst_udp6() { - $MZ -6 $h1 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:2::2 \ + ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ + -A 2001:db8:1::2 -B 2001:db8:2::2 \ -d 1msec -t udp "sp=3D20000,dp=3D0-32768" } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 880DAC32774 for ; Tue, 23 Aug 2022 08:23:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243153AbiHWIXO (ORCPT ); Tue, 23 Aug 2022 04:23:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243103AbiHWIQg (ORCPT ); Tue, 23 Aug 2022 04:16:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AE067646; Tue, 23 Aug 2022 01:11:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B3F4D6122D; Tue, 23 Aug 2022 08:11:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A87CCC433D7; Tue, 23 Aug 2022 08:11:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242294; bh=2QoUdqntMSIGnko29k9Mv6PoCJqWaulAFQaGzvw9jnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MEQVks5yqmddpmlXf7olCrwSxbd9q2j10MEzhXJPQZ8XEkOcQx7p9RL6E4dAGTY0l AAasiPqiDSqIq2l5YsLT1LPFun5/uCPInhGpPvBs41Pksdmnc38+xjL9Xrli/4FVq4 QMnzytdPWdYgkdQg4Tn5MQv9jedTvGW2Ip3c1Pqk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Stephan Gerhold , Bjorn Andersson Subject: [PATCH 5.19 089/365] dt-bindings: arm: qcom: fix Alcatel OneTouch Idol 3 compatibles Date: Tue, 23 Aug 2022 09:59:50 +0200 Message-Id: <20220823080121.917673113@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski commit 944de5182f0269e72ffe0a8880c8dbeb30f473d8 upstream. The MSM8916 Alcatel OneTouch Idol 3 does not use MTP fallbacks in compatibles: msm8916-alcatel-idol347.dtb: /: compatible: 'oneOf' conditional failed, o= ne must be fixed: ['alcatel,idol347', 'qcom,msm8916'] is too short Reported-by: Rob Herring Fixes: e9dd2f7204ed ("dt-bindings: arm: qcom: Document alcatel,idol347 boar= d") Signed-off-by: Krzysztof Kozlowski Acked-by: Rob Herring Reviewed-by: Stephan Gerhold Link: https://lore.kernel.org/r/20220520123252.365762-1-krzysztof.kozlowski= @linaro.org Signed-off-by: Bjorn Andersson Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/arm/qcom.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/Documentation/devicetree/bindings/arm/qcom.yaml +++ b/Documentation/devicetree/bindings/arm/qcom.yaml @@ -153,14 +153,13 @@ properties: - const: qcom,msm8974 =20 - items: - - enum: - - alcatel,idol347 - const: qcom,msm8916-mtp/1 - const: qcom,msm8916-mtp - const: qcom,msm8916 =20 - items: - enum: + - alcatel,idol347 - longcheer,l8150 - samsung,a3u-eur - samsung,a5u-eur From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD7A2C32774 for ; Tue, 23 Aug 2022 08:24:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242830AbiHWIYL (ORCPT ); Tue, 23 Aug 2022 04:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242652AbiHWIS3 (ORCPT ); Tue, 23 Aug 2022 04:18:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EC9F2AC63; Tue, 23 Aug 2022 01:11:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AAAC5B81C21; Tue, 23 Aug 2022 08:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A4AEC433D6; Tue, 23 Aug 2022 08:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242300; bh=yOZYWLwreTFv4WZO0UKvJlQU6N/VIyV/FKO/k1B6alI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nJQdfkxZGdcOEw59Seb0n0YrS5Lq6SfR59ilwMyd+DAKZvzEr1H3kt2lv2C7bc0z5 tNyrbJ9fXWpU6lYnee2d/IjTYVHBfmxMSYVT6qSlgUZpUlu9aqP1omCAIkwUJRh9cu +gWgK70w+KthGFml1dB3K5IMRoh1Dl71dKrU4td4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Edworthy , Lad Prabhakar , Geert Uytterhoeven Subject: [PATCH 5.19 090/365] pinctrl: renesas: rzg2l: Return -EINVAL for pins which have input disabled Date: Tue, 23 Aug 2022 09:59:51 +0200 Message-Id: <20220823080121.953400787@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar commit 5223c511eb4f919e6b423b2f66e02674e97e77e3 upstream. Pin status reported by pinconf-pins file always reported pin status as "input enabled" even for pins which had input disabled. Fix this by returning -EINVAL for the pins which have input disabled. Fixes: c4c4637eb57f2 ("pinctrl: renesas: Add RZ/G2L pin and gpio controller= driver") Reported-by: Phil Edworthy Signed-off-by: Lad Prabhakar Reviewed-by: Phil Edworthy Link: https://lore.kernel.org/r/20220511094057.3151-1-prabhakar.mahadev-lad= .rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -517,6 +517,8 @@ static int rzg2l_pinctrl_pinconf_get(str if (!(cfg & PIN_CFG_IEN)) return -EINVAL; arg =3D rzg2l_read_pin_config(pctrl, IEN(port_offset), bit, IEN_MASK); + if (!arg) + return -EINVAL; break; =20 case PIN_CONFIG_POWER_SOURCE: { From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40D67C32774 for ; Tue, 23 Aug 2022 08:24:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243282AbiHWIYP (ORCPT ); Tue, 23 Aug 2022 04:24:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242701AbiHWISd (ORCPT ); Tue, 23 Aug 2022 04:18:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 517514BD1F; Tue, 23 Aug 2022 01:11:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 12F8E6122D; Tue, 23 Aug 2022 08:11:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 142EFC4347C; Tue, 23 Aug 2022 08:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242306; bh=xkWl90o4FNBFi2kme+ygWNDzwS7vgwbfm84csV+hDvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nBVfOLKNQeGzJwWKhk/85mxYgW8eZX7l4Zc9adm7QZcugd/dD9g3SIRp0NktHysg/ XNraNVNkiVOnf/D65S87+R1Fs3jtvNqs0yVxUCD2fV5cd0HyMvh/SETZHwvzjrdQbc NWZVIEBGUw4m0Py00q1JtH959ZzJmnjEE9k3nQBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , AngeloGioacchino Del Regno , Rob Herring , Linus Walleij Subject: [PATCH 5.19 091/365] dt-bindings: pinctrl: mt8192: Add drive-strength-microamp Date: Tue, 23 Aug 2022 09:59:52 +0200 Message-Id: <20220823080121.995818240@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: N=C3=ADcolas F. R. A. Prado commit b52e695324bb44728053a414f17d25a5959ecb9d upstream. Commit e5fabbe43f3f ("pinctrl: mediatek: paris: Support generic PIN_CONFIG_DRIVE_STRENGTH_UA") added support for using drive-strength-microamp instead of mediatek,drive-strength-adv. Since there aren't any users of mediatek,drive-strength-adv on mt8192 yet, remove this property and add drive-strength-microamp in its place, which has a clearer meaning. Fixes: 4ac68333ff6d ("dt-bindings: pinctrl: mt8192: Add mediatek,drive-stre= ngth-adv property") Signed-off-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20220525155714.1837360-2-nfraprado@collabor= a.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- .../bindings/pinctrl/pinctrl-mt8192.yaml | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml = b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml index c90a132fbc79..8ede8b750237 100644 --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml @@ -80,31 +80,8 @@ patternProperties: dt-bindings/pinctrl/mt65xx.h. It can only support 2/4/6/8/10= /12/14/16mA in mt8192. enum: [2, 4, 6, 8, 10, 12, 14, 16] =20 - mediatek,drive-strength-adv: - description: | - Describe the specific driving setup property. - For I2C pins, the existing generic driving setup can only su= pport - 2/4/6/8/10/12/14/16mA driving. But in specific driving setup= , they - can support 0.125/0.25/0.5/1mA adjustment. If we enable spec= ific - driving setup, the existing generic setup will be disabled. - The specific driving setup is controlled by E1E0EN. - When E1=3D0/E0=3D0, the strength is 0.125mA. - When E1=3D0/E0=3D1, the strength is 0.25mA. - When E1=3D1/E0=3D0, the strength is 0.5mA. - When E1=3D1/E0=3D1, the strength is 1mA. - EN is used to enable or disable the specific driving setup. - Valid arguments are described as below: - 0: (E1, E0, EN) =3D (0, 0, 0) - 1: (E1, E0, EN) =3D (0, 0, 1) - 2: (E1, E0, EN) =3D (0, 1, 0) - 3: (E1, E0, EN) =3D (0, 1, 1) - 4: (E1, E0, EN) =3D (1, 0, 0) - 5: (E1, E0, EN) =3D (1, 0, 1) - 6: (E1, E0, EN) =3D (1, 1, 0) - 7: (E1, E0, EN) =3D (1, 1, 1) - So the valid arguments are from 0 to 7. - $ref: /schemas/types.yaml#/definitions/uint32 - enum: [0, 1, 2, 3, 4, 5, 6, 7] + drive-strength-microamp: + enum: [125, 250, 500, 1000] =20 mediatek,pull-up-adv: description: | --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FE3BC32774 for ; Tue, 23 Aug 2022 08:24:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243326AbiHWIY2 (ORCPT ); Tue, 23 Aug 2022 04:24:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242910AbiHWITi (ORCPT ); Tue, 23 Aug 2022 04:19:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCDE069F66; Tue, 23 Aug 2022 01:11:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B29BAB81C21; Tue, 23 Aug 2022 08:11:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DC84C433C1; Tue, 23 Aug 2022 08:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242312; bh=TaQ55Cpe6WmiczsBCjgMoH8Z7IIbshHed9o2mIVH6mE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XHmQgMOXVfbKdy75gSvvoJLMbYZL1o+T92+fjEYDdN1W+CRE2DTgsgJPOjU22GOxZ cv39uhkA1G4BrNqTen1Ik/ePtQ9gg7dkbgMun+ELJcGG24PGaKYuowRkqx8Gp905XS 6s5jzmX99myJ8HCZPUmGDdoS0+67jR4t0F9WeD04= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , AngeloGioacchino Del Regno , Rob Herring , Linus Walleij Subject: [PATCH 5.19 092/365] dt-bindings: pinctrl: mt8192: Use generic bias instead of pull-*-adv Date: Tue, 23 Aug 2022 09:59:53 +0200 Message-Id: <20220823080122.037550047@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: N=C3=ADcolas F. R. A. Prado commit 353d2ef77f2be4c1b9b3c70f1637a9986f07b997 upstream. Commit cafe19db7751 ("pinctrl: mediatek: Backward compatible to previous Mediatek's bias-pull usage") allowed the bias-pull-up and bias-pull-down properties to be used for setting PUPD/R1/R0 type bias on mtk-paris based SoC's, which was previously only supported by the custom mediatek,pull-up-adv and mediatek,pull-down-adv properties. Since the bias-pull-{up,down} properties already have defines associated thus being more descriptive and is more universal on MediaTek platforms, and given that there are no mediatek,pull-{up,down}-adv users on mt8192 yet, remove the custom adv properties in favor of the generic ones. Note that only mediatek,pull-up-adv was merged in the binding, but not its down counterpart. Fixes: edbacb36ea50 ("dt-bindings: pinctrl: mt8192: Add mediatek,pull-up-ad= v property") Signed-off-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20220525155714.1837360-3-nfraprado@collabor= a.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- .../bindings/pinctrl/pinctrl-mt8192.yaml | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml = b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml index 8ede8b750237..e39f5893bf16 100644 --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml @@ -83,20 +83,21 @@ patternProperties: drive-strength-microamp: enum: [125, 250, 500, 1000] =20 - mediatek,pull-up-adv: - description: | - Pull up settings for 2 pull resistors, R0 and R1. User can - configure those special pins. Valid arguments are described = as below: - 0: (R1, R0) =3D (0, 0) which means R1 disabled and R0 disabl= ed. - 1: (R1, R0) =3D (0, 1) which means R1 disabled and R0 enable= d. - 2: (R1, R0) =3D (1, 0) which means R1 enabled and R0 disable= d. - 3: (R1, R0) =3D (1, 1) which means R1 enabled and R0 enabled. - $ref: /schemas/types.yaml#/definitions/uint32 - enum: [0, 1, 2, 3] - - bias-pull-down: true - - bias-pull-up: true + bias-pull-down: + oneOf: + - type: boolean + description: normal pull down. + - enum: [100, 101, 102, 103] + description: PUPD/R1/R0 pull down type. See MTK_PUPD_SET_R= 1R0_ + defines in dt-bindings/pinctrl/mt65xx.h. + + bias-pull-up: + oneOf: + - type: boolean + description: normal pull up. + - enum: [100, 101, 102, 103] + description: PUPD/R1/R0 pull up type. See MTK_PUPD_SET_R1R= 0_ + defines in dt-bindings/pinctrl/mt65xx.h. =20 bias-disable: true =20 --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 631C5C32793 for ; Tue, 23 Aug 2022 08:24:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243027AbiHWIYf (ORCPT ); Tue, 23 Aug 2022 04:24:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242795AbiHWIUL (ORCPT ); Tue, 23 Aug 2022 04:20:11 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1614D6A4BA; Tue, 23 Aug 2022 01:12:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id EDA64CE1B32; Tue, 23 Aug 2022 08:11:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA51CC433D7; Tue, 23 Aug 2022 08:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242318; bh=8x8a63ntKhqkoOD+w91XE3oumOK0E4SykLQt4bVGTB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gRQe0z2kERRBljSxarmKzk85STfc+bcVEEUjHya6eV41EO4LJxeWJHAV5ILxngjo6 uftpoMybpVCScqXDJWmJjNOG2zHwkbzYIDxNtR/u3WNd2fsUeF4lohP0Id6PPvMj/8 C5M66nEyYg7Jbioqak7dCn903/NVfijGPiaQNzjg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij Subject: [PATCH 5.19 093/365] pinctrl: nomadik: Fix refcount leak in nmk_pinctrl_dt_subnode_to_map Date: Tue, 23 Aug 2022 09:59:54 +0200 Message-Id: <20220823080122.086568010@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin commit 4b32e054335ea0ce50967f63a7bfd4db058b14b9 upstream. of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak." Fixes: c2f6d059abfc ("pinctrl: nomadik: refactor DT parser to take two path= s") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220607111602.57355-1-linmq006@gmail.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c @@ -1421,8 +1421,10 @@ static int nmk_pinctrl_dt_subnode_to_map =20 has_config =3D nmk_pinctrl_dt_get_config(np, &configs); np_config =3D of_parse_phandle(np, "ste,config", 0); - if (np_config) + if (np_config) { has_config |=3D nmk_pinctrl_dt_get_config(np_config, &configs); + of_node_put(np_config); + } if (has_config) { const char *gpio_name; const char *pin; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACEB1C32774 for ; Tue, 23 Aug 2022 08:24:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243367AbiHWIYs (ORCPT ); Tue, 23 Aug 2022 04:24:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243321AbiHWIUz (ORCPT ); Tue, 23 Aug 2022 04:20:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 720936E8AE; Tue, 23 Aug 2022 01:12:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 31BC06122D; Tue, 23 Aug 2022 08:12:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A0B4C433C1; Tue, 23 Aug 2022 08:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242327; bh=8CmxgCYmN7CuAnJkg+oksYBTsGEpAazn0mrXZaAWCg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=usjwSNsMdcHJG3+KohAGgnleyo/YdaX4DPrmIcrwisM36UqlhrE1MDfHK1jRBmnYi FMPDq3TXHBQtaW98VjemWP/Xu1GUsy9bNzaJqja4YzUSrRuxJacCXeFcTO7thOleMl 56m4MgOQ9/YwqJLTZafX62UVT1CyJmEuWB3ID02Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikita Travkin , Linus Walleij Subject: [PATCH 5.19 094/365] pinctrl: qcom: msm8916: Allow CAMSS GP clocks to be muxed Date: Tue, 23 Aug 2022 09:59:55 +0200 Message-Id: <20220823080122.133442346@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nikita Travkin commit 44339391c666e46cba522d19c65a6ad1071c68b7 upstream. GPIO 31, 32 can be muxed to GCC_CAMSS_GP(1,2)_CLK respectively but the function was never assigned to the pingroup (even though the function exists already). Add this mode to the related pins. Fixes: 5373a2c5abb6 ("pinctrl: qcom: Add msm8916 pinctrl driver") Signed-off-by: Nikita Travkin Link: https://lore.kernel.org/r/20220612145955.385787-4-nikita@trvn.ru Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/pinctrl/qcom/pinctrl-msm8916.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/pinctrl/qcom/pinctrl-msm8916.c +++ b/drivers/pinctrl/qcom/pinctrl-msm8916.c @@ -844,8 +844,8 @@ static const struct msm_pingroup msm8916 PINGROUP(28, pwr_modem_enabled_a, NA, NA, NA, NA, NA, qdss_tracedata_b, N= A, atest_combodac), PINGROUP(29, cci_i2c, NA, NA, NA, NA, NA, qdss_tracedata_b, NA, atest_com= bodac), PINGROUP(30, cci_i2c, NA, NA, NA, NA, NA, NA, NA, qdss_tracedata_b), - PINGROUP(31, cci_timer0, NA, NA, NA, NA, NA, NA, NA, NA), - PINGROUP(32, cci_timer1, NA, NA, NA, NA, NA, NA, NA, NA), + PINGROUP(31, cci_timer0, flash_strobe, NA, NA, NA, NA, NA, NA, NA), + PINGROUP(32, cci_timer1, flash_strobe, NA, NA, NA, NA, NA, NA, NA), PINGROUP(33, cci_async, NA, NA, NA, NA, NA, NA, NA, qdss_tracedata_b), PINGROUP(34, pwr_nav_enabled_a, NA, NA, NA, NA, NA, NA, NA, qdss_tracedat= a_b), PINGROUP(35, pwr_crypto_enabled_a, NA, NA, NA, NA, NA, NA, NA, qdss_trace= data_b), From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B26DC32772 for ; Tue, 23 Aug 2022 08:34:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245651AbiHWIes (ORCPT ); Tue, 23 Aug 2022 04:34:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346658AbiHWIcB (ORCPT ); Tue, 23 Aug 2022 04:32:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 880CE75395; Tue, 23 Aug 2022 01:16:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2551AB81C36; Tue, 23 Aug 2022 08:15:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57937C433D6; Tue, 23 Aug 2022 08:15:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242535; bh=ltKp9QJbSrWAxxaLf+/4NsJM5vY9Mmh2DjSF4VsNcB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KqbRGNx55mCNq/kKequVC0Iw/fowoaXZ+a57fn+RWEryeCnNb4FtPsMzHOimUn5SW w88LdBqlbmtUrXnzo44vMNBHYQH+okPK/kn3Kx+O/tbjaLE70zEp07Q4qA5Q+raPaI mugVHXkbd6ZLWI5ZM9o4ruzr159YQ/EMBjMo2ybg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , Basavaraj Natikar , Linus Walleij Subject: [PATCH 5.19 095/365] pinctrl: amd: Dont save/restore interrupt status and wake status bits Date: Tue, 23 Aug 2022 09:59:56 +0200 Message-Id: <20220823080122.183742602@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Basavaraj Natikar commit b8c824a869f220c6b46df724f85794349bafbf23 upstream. Saving/restoring interrupt and wake status bits across suspend can cause the suspend to fail if an IRQ is serviced across the suspend cycle. Signed-off-by: Mario Limonciello Signed-off-by: Basavaraj Natikar Fixes: 79d2c8bede2c ("pinctrl/amd: save pin registers over suspend/resume") Link: https://lore.kernel.org/r/20220613064127.220416-3-Basavaraj.Natikar@a= md.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/pinctrl/pinctrl-amd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/drivers/pinctrl/pinctrl-amd.c +++ b/drivers/pinctrl/pinctrl-amd.c @@ -917,6 +917,7 @@ static int amd_gpio_suspend(struct devic { struct amd_gpio *gpio_dev =3D dev_get_drvdata(dev); struct pinctrl_desc *desc =3D gpio_dev->pctrl->desc; + unsigned long flags; int i; =20 for (i =3D 0; i < desc->npins; i++) { @@ -925,7 +926,9 @@ static int amd_gpio_suspend(struct devic if (!amd_gpio_should_save(gpio_dev, pin)) continue; =20 - gpio_dev->saved_regs[i] =3D readl(gpio_dev->base + pin*4); + raw_spin_lock_irqsave(&gpio_dev->lock, flags); + gpio_dev->saved_regs[i] =3D readl(gpio_dev->base + pin * 4) & ~PIN_IRQ_P= ENDING; + raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); } =20 return 0; @@ -935,6 +938,7 @@ static int amd_gpio_resume(struct device { struct amd_gpio *gpio_dev =3D dev_get_drvdata(dev); struct pinctrl_desc *desc =3D gpio_dev->pctrl->desc; + unsigned long flags; int i; =20 for (i =3D 0; i < desc->npins; i++) { @@ -943,7 +947,10 @@ static int amd_gpio_resume(struct device if (!amd_gpio_should_save(gpio_dev, pin)) continue; =20 - writel(gpio_dev->saved_regs[i], gpio_dev->base + pin*4); + raw_spin_lock_irqsave(&gpio_dev->lock, flags); + gpio_dev->saved_regs[i] |=3D readl(gpio_dev->base + pin * 4) & PIN_IRQ_P= ENDING; + writel(gpio_dev->saved_regs[i], gpio_dev->base + pin * 4); + raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); } =20 return 0; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89175C32772 for ; Tue, 23 Aug 2022 08:27:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243540AbiHWIZf (ORCPT ); Tue, 23 Aug 2022 04:25:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243651AbiHWIVa (ORCPT ); Tue, 23 Aug 2022 04:21:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98DD570E44; Tue, 23 Aug 2022 01:12:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 11AA8B81C3A; Tue, 23 Aug 2022 08:12:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B63BC43153; Tue, 23 Aug 2022 08:12:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242345; bh=1bcfY/F8tx9w3nXmNGlKoSMN7ZhIswwyXnG8I1zgTGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x64Y1xYC1JKeTXfF0Z6Opn22+v7mgb0ySx4B2YdVFS8j6viRUuGGNsxfpOqY4zh5S 7vv7c8qsUAUD6DNPJyzfB2ZUyvknNSTEkZ2FvmK7/b7hxoma9L3222RDxcDQxgsS5A 2u19XaNbGcvUlP2Q8xBVgCTwuxOowE4gzGVhuw94= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Rob Herring , Linus Walleij Subject: [PATCH 5.19 096/365] dt-bindings: pinctrl: mt8195: Fix name for mediatek,rsel-resistance-in-si-unit Date: Tue, 23 Aug 2022 09:59:57 +0200 Message-Id: <20220823080122.223668540@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: AngeloGioacchino Del Regno commit 11bd0ffd165fce7aff1a2ed15c04c088239f3d42 upstream. When this property was introduced, it contained underscores, but the actual code wants dashes. Change it from mediatek,rsel_resistance_in_si_unit to mediatek,rsel-resistance-in-si-unit. Fixes: 91e7edceda96 ("dt-bindings: pinctrl: mt8195: change pull up/down des= cription") Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20220630122334.216903-1-angelogioacchino.de= lregno@collabora.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/pinctrl/pinctrl-mt8195.yaml | 10 +++++= ----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8195.yaml +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8195.yaml @@ -49,7 +49,7 @@ properties: description: The interrupt outputs to sysirq. maxItems: 1 =20 - mediatek,rsel_resistance_in_si_unit: + mediatek,rsel-resistance-in-si-unit: type: boolean description: | Identifying i2c pins pull up/down type which is RSEL. It can support @@ -142,7 +142,7 @@ patternProperties: "MTK_PUPD_SET_R1R0_11" define in mt8195. For pull down type is RSEL, it can add RSEL define & resista= nce value(ohm) to set different resistance by identifying proper= ty - "mediatek,rsel_resistance_in_si_unit". + "mediatek,rsel-resistance-in-si-unit". It can support "MTK_PULL_SET_RSEL_000" & "MTK_PULL_SET_RSEL_= 001" & "MTK_PULL_SET_RSEL_010" & "MTK_PULL_SET_RSEL_011" & "MTK_PULL_SET_RSEL_100" & "MTK_PULL_SET_RSEL_101" @@ -161,7 +161,7 @@ patternProperties: }; An example of using si unit resistance value(ohm): &pio { - mediatek,rsel_resistance_in_si_unit; + mediatek,rsel-resistance-in-si-unit; } pincontroller { i2c0_pin { @@ -190,7 +190,7 @@ patternProperties: "MTK_PUPD_SET_R1R0_11" define in mt8195. For pull up type is RSEL, it can add RSEL define & resistance value(ohm) to set different resistance by identifying proper= ty - "mediatek,rsel_resistance_in_si_unit". + "mediatek,rsel-resistance-in-si-unit". It can support "MTK_PULL_SET_RSEL_000" & "MTK_PULL_SET_RSEL_= 001" & "MTK_PULL_SET_RSEL_010" & "MTK_PULL_SET_RSEL_011" & "MTK_PULL_SET_RSEL_100" & "MTK_PULL_SET_RSEL_101" @@ -209,7 +209,7 @@ patternProperties: }; An example of using si unit resistance value(ohm): &pio { - mediatek,rsel_resistance_in_si_unit; + mediatek,rsel-resistance-in-si-unit; } pincontroller { i2c0-pins { From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CED9CC32772 for ; Tue, 23 Aug 2022 08:28:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243581AbiHWI2i (ORCPT ); Tue, 23 Aug 2022 04:28:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243336AbiHWIYa (ORCPT ); Tue, 23 Aug 2022 04:24:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 247BF23D; Tue, 23 Aug 2022 01:13:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 72757B81C36; Tue, 23 Aug 2022 08:13:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C059DC433C1; Tue, 23 Aug 2022 08:12:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242379; bh=YKpS4Mu6LeeKYPwDXTeHt6aFS9MfVXJBGaFLo3EJw9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j7HR4zXHxuONWsTf3O8HgiXRCWVnb8UqzLwfy24qhzirwswbW6gbSa2EgKKZ/M7zc mLrRF2Gb4LYtLkrOY36cAthoq3NVNzrq2DUGR40gXRbaivB7TaI7dHOvdMoH3Qjt9Q HyVc6IQYha4sF92fcreqyIekmqC9XNzg5YyYLvjU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Rob Herring , Linus Walleij Subject: [PATCH 5.19 097/365] dt-bindings: pinctrl: mt8195: Add and use drive-strength-microamp Date: Tue, 23 Aug 2022 09:59:58 +0200 Message-Id: <20220823080122.262553045@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: AngeloGioacchino Del Regno commit 1b3ab63e56f0c30193b6787b083be4f4071b7fc6 upstream. As was already done for MT8192 in commit b52e695324bb ("dt-bindings: pinctrl: mt8192: Add drive-strength-microamp"), replace the custom mediatek,drive-strength-adv property with the standardized pinconf 'drive-strength-microamp' one. Similarly to the mt8192 counterpart, there's no user of property 'mediatek,drive-strength-adv', hence removing it is safe. Fixes: 69c3d58dc187 ("dt-bindings: pinctrl: mt8195: Add mediatek,drive-stre= ngth-adv property") Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20220630131543.225554-1-angelogioacchino.de= lregno@collabora.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- .../bindings/pinctrl/pinctrl-mt8195.yaml | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8195.yaml = b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8195.yaml index bb40398bb047..3d8afb3d5695 100644 --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8195.yaml +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8195.yaml @@ -98,31 +98,8 @@ patternProperties: drive-strength: enum: [2, 4, 6, 8, 10, 12, 14, 16] =20 - mediatek,drive-strength-adv: - description: | - Describe the specific driving setup property. - For I2C pins, the existing generic driving setup can only su= pport - 2/4/6/8/10/12/14/16mA driving. But in specific driving setup= , they - can support 0.125/0.25/0.5/1mA adjustment. If we enable spec= ific - driving setup, the existing generic setup will be disabled. - The specific driving setup is controlled by E1E0EN. - When E1=3D0/E0=3D0, the strength is 0.125mA. - When E1=3D0/E0=3D1, the strength is 0.25mA. - When E1=3D1/E0=3D0, the strength is 0.5mA. - When E1=3D1/E0=3D1, the strength is 1mA. - EN is used to enable or disable the specific driving setup. - Valid arguments are described as below: - 0: (E1, E0, EN) =3D (0, 0, 0) - 1: (E1, E0, EN) =3D (0, 0, 1) - 2: (E1, E0, EN) =3D (0, 1, 0) - 3: (E1, E0, EN) =3D (0, 1, 1) - 4: (E1, E0, EN) =3D (1, 0, 0) - 5: (E1, E0, EN) =3D (1, 0, 1) - 6: (E1, E0, EN) =3D (1, 1, 0) - 7: (E1, E0, EN) =3D (1, 1, 1) - So the valid arguments are from 0 to 7. - $ref: /schemas/types.yaml#/definitions/uint32 - enum: [0, 1, 2, 3, 4, 5, 6, 7] + drive-strength-microamp: + enum: [125, 250, 500, 1000] =20 bias-pull-down: oneOf: --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13228C32772 for ; Tue, 23 Aug 2022 08:29:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243781AbiHWI3s (ORCPT ); Tue, 23 Aug 2022 04:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243793AbiHWIZ7 (ORCPT ); Tue, 23 Aug 2022 04:25:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 222B27287D; Tue, 23 Aug 2022 01:14:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 09CD66132D; Tue, 23 Aug 2022 08:13:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B330C433C1; Tue, 23 Aug 2022 08:13:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242413; bh=yMB+nDLTD/CtAiCCGvVNDEAEOnYChjmtyxH/gkHlNcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=euY9V/DV2othFdOXHCmAbDWXZWIpc/vqyWCxI67j3CE0w8raEBuuTfnyb1DtKhXWI EJ5C6PCW3Qj4BYsIkgqYA9yt1AP+4GU0jEJ7hahaHMhpzdVBinib+D3iL+lNXBrBwS Wy7RxbniHWdSzxV01h3klvBbmTQjm6Be7Zo8668o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Heiko Stuebner , Samuel Holland , Linus Walleij Subject: [PATCH 5.19 098/365] pinctrl: sunxi: Add I/O bias setting for H6 R-PIO Date: Tue, 23 Aug 2022 09:59:59 +0200 Message-Id: <20220823080122.301567818@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland commit fc153c8f283bf5925615195fc9d4056414d7b168 upstream. H6 requires I/O bias configuration on both of its PIO devices. Previously it was only done for the main PIO. The setting for Port L is at bit 0, so the bank calculation needs to account for the pin base. Otherwise the wrong bit is used. Fixes: cc62383fcebe ("pinctrl: sunxi: Support I/O bias voltage setting on H= 6") Reviewed-by: Jernej Skrabec Tested-by: Heiko Stuebner Signed-off-by: Samuel Holland Link: https://lore.kernel.org/r/20220713025233.27248-3-samuel@sholland.org Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/pinctrl/sunxi/pinctrl-sun50i-h6-r.c | 1 + drivers/pinctrl/sunxi/pinctrl-sunxi.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) --- a/drivers/pinctrl/sunxi/pinctrl-sun50i-h6-r.c +++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-h6-r.c @@ -107,6 +107,7 @@ static const struct sunxi_pinctrl_desc s .npins =3D ARRAY_SIZE(sun50i_h6_r_pins), .pin_base =3D PL_BASE, .irq_banks =3D 2, + .io_bias_cfg_variant =3D BIAS_VOLTAGE_PIO_POW_MODE_SEL, }; =20 static int sun50i_h6_r_pinctrl_probe(struct platform_device *pdev) --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -624,7 +624,7 @@ static int sunxi_pinctrl_set_io_bias_cfg unsigned pin, struct regulator *supply) { - unsigned short bank =3D pin / PINS_PER_BANK; + unsigned short bank; unsigned long flags; u32 val, reg; int uV; @@ -640,6 +640,9 @@ static int sunxi_pinctrl_set_io_bias_cfg if (uV =3D=3D 0) return 0; =20 + pin -=3D pctl->desc->pin_base; + bank =3D pin / PINS_PER_BANK; + switch (pctl->desc->io_bias_cfg_variant) { case BIAS_VOLTAGE_GRP_CONFIG: /* @@ -657,8 +660,6 @@ static int sunxi_pinctrl_set_io_bias_cfg else val =3D 0xD; /* 3.3V */ =20 - pin -=3D pctl->desc->pin_base; - reg =3D readl(pctl->membase + sunxi_grp_config_reg(pin)); reg &=3D ~IO_BIAS_MASK; writel(reg | val, pctl->membase + sunxi_grp_config_reg(pin)); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60CECC32772 for ; Tue, 23 Aug 2022 08:33:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243982AbiHWIdH (ORCPT ); Tue, 23 Aug 2022 04:33:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244240AbiHWIat (ORCPT ); Tue, 23 Aug 2022 04:30:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E05BF74E17; Tue, 23 Aug 2022 01:15:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 458C661228; Tue, 23 Aug 2022 08:14:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49B69C433C1; Tue, 23 Aug 2022 08:14:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242480; bh=xe+hnbiAgN4P59gttLQ1kDXxo0brOCP+J++ZTZE/A38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G/dPVKxQ5rLAyILGLSyr8gSCfUWt20koy6rs0Yf2v6LWrgdfDVs64HoFnA/hjLwOY OhOKIBobtrwCwcb1NGCBt6+5Sf/PYzZi5rObTHlugfxoILAYk0pXGed3sSghttwO0P 9cbPR9Egc2bkjYGq86CHvv6mVOwV3hd6PotwwuU0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Allen-KH Cheng , AngeloGioacchino Del Regno , Rob Herring , Linus Walleij Subject: [PATCH 5.19 099/365] dt-bindings: pinctrl: mt8186: Add and use drive-strength-microamp Date: Tue, 23 Aug 2022 10:00:00 +0200 Message-Id: <20220823080122.343379586@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Allen-KH Cheng commit f4526ae80dbdef7078ab2aae30dfc70bbc0098c6 upstream. Commit e5fabbe43f3f ("pinctrl: mediatek: paris: Support generic PIN_CONFIG_DRIVE_STRENGTH_UA") added support for using drive-strength-microamp instead of mediatek,drive-strength-adv. Similarly to the mt8192 and mt8195, there's no user of property 'mediatek,drive-strength-adv', hence removing it is safe. Fixes: 338e953f1bd1 ("dt-bindings: pinctrl: mt8186: add pinctrl file and bi= nding document") Signed-off-by: Allen-KH Cheng Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20220725110702.11362-3-allen-kh.cheng@media= tek.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/pinctrl/pinctrl-mt8186.yaml | 29 +----= ----- 1 file changed, 3 insertions(+), 26 deletions(-) --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8186.yaml +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8186.yaml @@ -105,31 +105,8 @@ patternProperties: drive-strength: enum: [2, 4, 6, 8, 10, 12, 14, 16] =20 - mediatek,drive-strength-adv: - description: | - Describe the specific driving setup property. - For I2C pins, the existing generic driving setup can only su= pport - 2/4/6/8/10/12/14/16mA driving. But in specific driving setup= , they - can support 0.125/0.25/0.5/1mA adjustment. If we enable spec= ific - driving setup, the existing generic setup will be disabled. - The specific driving setup is controlled by E1E0EN. - When E1=3D0/E0=3D0, the strength is 0.125mA. - When E1=3D0/E0=3D1, the strength is 0.25mA. - When E1=3D1/E0=3D0, the strength is 0.5mA. - When E1=3D1/E0=3D1, the strength is 1mA. - EN is used to enable or disable the specific driving setup. - Valid arguments are described as below: - 0: (E1, E0, EN) =3D (0, 0, 0) - 1: (E1, E0, EN) =3D (0, 0, 1) - 2: (E1, E0, EN) =3D (0, 1, 0) - 3: (E1, E0, EN) =3D (0, 1, 1) - 4: (E1, E0, EN) =3D (1, 0, 0) - 5: (E1, E0, EN) =3D (1, 0, 1) - 6: (E1, E0, EN) =3D (1, 1, 0) - 7: (E1, E0, EN) =3D (1, 1, 1) - So the valid arguments are from 0 to 7. - $ref: /schemas/types.yaml#/definitions/uint32 - enum: [0, 1, 2, 3, 4, 5, 6, 7] + drive-strength-microamp: + enum: [125, 250, 500, 1000] =20 bias-pull-down: oneOf: @@ -291,7 +268,7 @@ examples: pinmux =3D , ; bias-pull-up =3D ; - mediatek,drive-strength-adv =3D <7>; + drive-strength-microamp =3D <1000>; }; }; }; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52D6FC32772 for ; Tue, 23 Aug 2022 08:34:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245273AbiHWIeW (ORCPT ); Tue, 23 Aug 2022 04:34:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346211AbiHWIbv (ORCPT ); Tue, 23 Aug 2022 04:31:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 830B37539D; Tue, 23 Aug 2022 01:16:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 11D20B81C20; Tue, 23 Aug 2022 08:15:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56B19C433D6; Tue, 23 Aug 2022 08:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242526; bh=1uZf0x+togNFly4eR+qOBeUyoGt1699gwYKKUkpYrlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rzXPkm6k0Kb/dxsiaKSLZhTkcEEBuCbiKIP8qGaRj+DSG3hd6auRrOIvQFum8hrGu C7gIS9cUneGaqtzVrJL1M31M07wkXxqxt4EPeTgdCTUbqHWC5G7xWTONJ9YQe9seZL FS5i2K4+2hiFLvqA1jS3J+DCqYRzV26pKQ3cgAUE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianhua Lu , Konrad Dybcio , Linus Walleij Subject: [PATCH 5.19 100/365] pinctrl: qcom: sm8250: Fix PDC map Date: Tue, 23 Aug 2022 10:00:01 +0200 Message-Id: <20220823080122.375616930@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jianhua Lu commit 4b759ca15a4914f96ea204ea9200ceeb01d70666 upstream. Fix the PDC mapping for SM8250, gpio39 is mapped to irq73(not irq37). Fixes: b41efeed507a("pinctrl: qcom: sm8250: Specify PDC map.") Signed-off-by: Jianhua Lu Reviewed-by: Konrad Dybcio Link: https://lore.kernel.org/r/20220803015645.22388-1-lujianhua000@gmail.c= om Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/pinctrl/qcom/pinctrl-sm8250.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/pinctrl/qcom/pinctrl-sm8250.c +++ b/drivers/pinctrl/qcom/pinctrl-sm8250.c @@ -1316,7 +1316,7 @@ static const struct msm_pingroup sm8250_ static const struct msm_gpio_wakeirq_map sm8250_pdc_map[] =3D { { 0, 79 }, { 1, 84 }, { 2, 80 }, { 3, 82 }, { 4, 107 }, { 7, 43 }, { 11, 42 }, { 14, 44 }, { 15, 52 }, { 19, 67 }, { 23, 68 }, { 24, 105 }, - { 27, 92 }, { 28, 106 }, { 31, 69 }, { 35, 70 }, { 39, 37 }, + { 27, 92 }, { 28, 106 }, { 31, 69 }, { 35, 70 }, { 39, 73 }, { 40, 108 }, { 43, 71 }, { 45, 72 }, { 47, 83 }, { 51, 74 }, { 55, 77 }, { 59, 78 }, { 63, 75 }, { 64, 81 }, { 65, 87 }, { 66, 88 }, { 67, 89 }, { 68, 54 }, { 70, 85 }, { 77, 46 }, { 80, 90 }, { 81, 91 }, { 83, 97 }, From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC315C32772 for ; Tue, 23 Aug 2022 08:34:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245192AbiHWIeS (ORCPT ); Tue, 23 Aug 2022 04:34:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346018AbiHWIbr (ORCPT ); Tue, 23 Aug 2022 04:31:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12DA66DAE1; Tue, 23 Aug 2022 01:16:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5056F61238; Tue, 23 Aug 2022 08:15:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 504D7C433D6; Tue, 23 Aug 2022 08:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242532; bh=kuYKk88RSu7FYIAyVvO8z2+iR0hHyGGdWODZnXNj8zk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1vXXPvMHE+npdAC/RN4Z1+bk/raK/fquuLMnHWzbe93PEu8dqB3HFXwHoWU6zfZyk HcCXuNx4XC45F/XUkP6oMusoNqtVBGvLvjQJSVF2KTSINmwjTW31RjoZXZq8gjqU9+ BVN0iLGzLs3jhwSeJgNKHPIItsAnrspMxhYGJqV8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeng Jingxiang , Viresh Kumar , Alexandre Belloni Subject: [PATCH 5.19 101/365] rtc: spear: set range max Date: Tue, 23 Aug 2022 10:00:02 +0200 Message-Id: <20220823080122.421683701@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zeng Jingxiang commit 03c4cd6f89e074a51e289eb9129ac646f0f2bd29 upstream. In the commit f395e1d3b28d7c2c67b73bd467c4fb79523e1c65 ("rtc: spear: set range"), the value of RTC_TIMESTAMP_END_9999 was incorrectly set to range_min. 390 config->rtc->range_min =3D RTC_TIMESTAMP_BEGIN_0000; 391 config->rtc->range_max =3D RTC_TIMESTAMP_END_9999; Fixes: f395e1d3b28d ("rtc: spear: set range") Signed-off-by: Zeng Jingxiang Acked-by: Viresh Kumar Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20220728100101.1906801-1-zengjx95@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/rtc/rtc-spear.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c index d4777b01ab22..736fe535cd45 100644 --- a/drivers/rtc/rtc-spear.c +++ b/drivers/rtc/rtc-spear.c @@ -388,7 +388,7 @@ static int spear_rtc_probe(struct platform_device *pdev) =20 config->rtc->ops =3D &spear_rtc_ops; config->rtc->range_min =3D RTC_TIMESTAMP_BEGIN_0000; - config->rtc->range_min =3D RTC_TIMESTAMP_END_9999; + config->rtc->range_max =3D RTC_TIMESTAMP_END_9999; =20 status =3D devm_rtc_register_device(config->rtc); if (status) --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 285CDC32796 for ; Tue, 23 Aug 2022 08:27:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243499AbiHWIZc (ORCPT ); Tue, 23 Aug 2022 04:25:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243564AbiHWIVW (ORCPT ); Tue, 23 Aug 2022 04:21:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 576BB6FA07; Tue, 23 Aug 2022 01:12:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64BC0B81C38; Tue, 23 Aug 2022 08:12:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B77ECC433C1; Tue, 23 Aug 2022 08:12:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242352; bh=DR1snfRLybVmdH1tOb3/8khLmueGUFR93/TihdxZuYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXDTyLk/X/Tzzcr6NSYuOede184p2iFK4n3xMHHymw0WqoANCLM+XGKvpecDIC25v Twr+UiPl31xW4/1TkGaH3ku272ESgkbycgWhlia+Ee2zt0aGik/pyh7XkyDkAc63v8 LlJ4J0cCEZwipuu+yYoOrtCAw5DdEEsRxuHoM4X4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Dmitry Torokhov Subject: [PATCH 5.19 102/365] Input: exc3000 - fix return value check of wait_for_completion_timeout Date: Tue, 23 Aug 2022 10:00:03 +0200 Message-Id: <20220823080122.468747566@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin commit 6bb7144c3fa16a5efb54a8e2aff1817b4168018e upstream. wait_for_completion_timeout() returns unsigned long not int. It returns 0 if timed out, and positive if completed. The check for <=3D 0 is ambiguous and should be =3D=3D 0 here indicating timeout which is the only error case. Fixes: 102feb1ddfd0 ("Input: exc3000 - factor out vendor data request") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220411105828.22140-1-linmq006@gmail.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/input/touchscreen/exc3000.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/input/touchscreen/exc3000.c +++ b/drivers/input/touchscreen/exc3000.c @@ -220,6 +220,7 @@ static int exc3000_vendor_data_request(s { u8 buf[EXC3000_LEN_VENDOR_REQUEST] =3D { 0x67, 0x00, 0x42, 0x00, 0x03 }; int ret; + unsigned long time_left; =20 mutex_lock(&data->query_lock); =20 @@ -233,9 +234,9 @@ static int exc3000_vendor_data_request(s goto out_unlock; =20 if (response) { - ret =3D wait_for_completion_timeout(&data->wait_event, - timeout * HZ); - if (ret <=3D 0) { + time_left =3D wait_for_completion_timeout(&data->wait_event, + timeout * HZ); + if (time_left =3D=3D 0) { ret =3D -ETIMEDOUT; goto out_unlock; } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E76B5C32772 for ; Tue, 23 Aug 2022 08:27:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243396AbiHWI1c (ORCPT ); Tue, 23 Aug 2022 04:27:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242890AbiHWIV6 (ORCPT ); Tue, 23 Aug 2022 04:21:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7443E6B66F; Tue, 23 Aug 2022 01:13:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AAF22612DA; Tue, 23 Aug 2022 08:12:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8D98C43142; Tue, 23 Aug 2022 08:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242358; bh=70zht3iXI+nD4lhGJ7awU9z0EeMuRPW/A6oszaYsjeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GTc+raHFE4y2rc97//cnIvmAw1TMnw7Ek3RRWMF1FfIDmdZT5P2HuFxYn1dfZcA9R 93JZE1+TMLRx1O2KF9ch0841FaexxTgOqIC0qJS1bilwZsRHStveoH239NW4E9TB4A UAVH5UUnWQ8Go/TaNpl/ADW79OKl33qG6h8MocKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabien Parent , Mattijs Korpershoek , Dmitry Torokhov Subject: [PATCH 5.19 103/365] Input: mt6779-keypad - match hardware matrix organization Date: Tue, 23 Aug 2022 10:00:04 +0200 Message-Id: <20220823080122.513731633@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mattijs Korpershoek commit d6ed52583034f9d2e39dead7c18e03380fd4edf2 upstream. The MediaTek keypad has a set of bits representing keys, from KEY0 to KEY77, arranged in 5 chunks of 15 bits split into 5 32-bit registers. In our implementation, we simply decided to use register number as row and offset in the register as column when encoding our "matrix". Because of this, we can have a 5x32 matrix which does not match the hardware at all, which is confusing. Change the row/column calculation to match the hardware. Fixes: f28af984e771 ("Input: mt6779-keypad - add MediaTek keypad driver") Co-developed-by: Fabien Parent Signed-off-by: Fabien Parent Signed-off-by: Mattijs Korpershoek Link: https://lore.kernel.org/r/20220707075236.126631-2-mkorpershoek@baylib= re.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/input/keyboard/mt6779-keypad.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/input/keyboard/mt6779-keypad.c b/drivers/input/keyboar= d/mt6779-keypad.c index 2e7c9187c10f..bd86cb95bde3 100644 --- a/drivers/input/keyboard/mt6779-keypad.c +++ b/drivers/input/keyboard/mt6779-keypad.c @@ -42,7 +42,7 @@ static irqreturn_t mt6779_keypad_irq_handler(int irq, voi= d *dev_id) const unsigned short *keycode =3D keypad->input_dev->keycode; DECLARE_BITMAP(new_state, MTK_KPD_NUM_BITS); DECLARE_BITMAP(change, MTK_KPD_NUM_BITS); - unsigned int bit_nr; + unsigned int bit_nr, key; unsigned int row, col; unsigned int scancode; unsigned int row_shift =3D get_count_order(keypad->n_cols); @@ -61,8 +61,10 @@ static irqreturn_t mt6779_keypad_irq_handler(int irq, vo= id *dev_id) if (bit_nr % 32 >=3D 16) continue; =20 - row =3D bit_nr / 32; - col =3D bit_nr % 32; + key =3D bit_nr / 32 * 16 + bit_nr % 32; + row =3D key / 9; + col =3D key % 9; + scancode =3D MATRIX_SCAN_CODE(row, col, row_shift); /* 1: not pressed, 0: pressed */ pressed =3D !test_bit(bit_nr, new_state); --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ADC6C38147 for ; Tue, 23 Aug 2022 08:27:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243594AbiHWIZk (ORCPT ); Tue, 23 Aug 2022 04:25:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243662AbiHWIVb (ORCPT ); Tue, 23 Aug 2022 04:21:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCA576FA2D; Tue, 23 Aug 2022 01:12:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F2EFB81C34; Tue, 23 Aug 2022 08:12:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BF4EC433D6; Tue, 23 Aug 2022 08:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242363; bh=5fGGGCUByUMANmzZki7jrEJzyO17MPcManh7jS7dckI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y85rH6ZO8L+5joR9nx/768CUzr2NvQ74D2UFmYGy/3K/Nc+ZCEkLWNwRMVGq5g8IA Qgy5v+mwvFEL+qgUSDVDUtPBz3yNdCJ23OeqQ8NZMAAa4OyyPmXYtN2k+cnGYB2IJU IyavSKdFUqCh2LO0UTIPpBZV3IUhkNCVqm/pIJVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff LaBundy , Dmitry Torokhov Subject: [PATCH 5.19 104/365] Input: iqs7222 - correct slider event disable logic Date: Tue, 23 Aug 2022 10:00:05 +0200 Message-Id: <20220823080122.546894052@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff LaBundy commit 56a0c54c4c2bdb6c0952de90dd690020a703b50e upstream. If a positive swipe/flick gesture is defined but the corresponding negative gesture is not, the former is inadvertently disabled. Fix this by gently refactoring the logic responsible for disabling all gestures by default. As part of this change, make the code a bit simpler by eliminating a superfluous conditional check. If a slider event does not define an enable control, the second term of the bitwise AND operation is simply 0xFFFF. Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Link: https://lore.kernel.org/r/20220626072412.475211-2-jeff@labundy.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/input/misc/iqs7222.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index 6b4138771a3f..53df74f3a982 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -2081,17 +2081,19 @@ static int iqs7222_parse_sldr(struct iqs7222_privat= e *iqs7222, int sldr_index) sldr_setup[0] |=3D dev_desc->wheel_enable; } =20 + /* + * The absence of a register offset makes it safe to assume the device + * supports gestures, each of which is first disabled until explicitly + * enabled. + */ + if (!reg_offset) + for (i =3D 0; i < ARRAY_SIZE(iqs7222_sl_events); i++) + sldr_setup[9] &=3D ~iqs7222_sl_events[i].enable; + for (i =3D 0; i < ARRAY_SIZE(iqs7222_sl_events); i++) { const char *event_name =3D iqs7222_sl_events[i].name; struct fwnode_handle *event_node; =20 - /* - * The absence of a register offset means the remaining fields - * in the group represent gesture settings. - */ - if (iqs7222_sl_events[i].enable && !reg_offset) - sldr_setup[9] &=3D ~iqs7222_sl_events[i].enable; - event_node =3D fwnode_get_named_child_node(sldr_node, event_name); if (!event_node) continue; --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51B46C32793 for ; Tue, 23 Aug 2022 08:27:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243316AbiHWI1I (ORCPT ); Tue, 23 Aug 2022 04:27:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243727AbiHWIVh (ORCPT ); Tue, 23 Aug 2022 04:21:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16C1C6B64B; Tue, 23 Aug 2022 01:12:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2B7A0B81C21; Tue, 23 Aug 2022 08:12:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BBD8C433C1; Tue, 23 Aug 2022 08:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242369; bh=Sp/PKn2N+G/yihFkstUdpOykzSfSeZinpiz0MriimTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U+sy+wgXLgkQZg6Dfc+KT17iBuptV8TOWbKn9ylw3wWpY4zoKcqzp1UqkjHDxx6qQ h05lPSDKd5K5yguJjkRrZaAsxUQe9bHBCpO/kuJegBtJocS8XSwePj17o0i/RxgtO3 rN+dy1Eo/llb+CflBNxpDHblNbU/J2SLd3pZmKow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff LaBundy , Dmitry Torokhov Subject: [PATCH 5.19 105/365] Input: iqs7222 - fortify slider event reporting Date: Tue, 23 Aug 2022 10:00:06 +0200 Message-Id: <20220823080122.584732753@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff LaBundy commit 95215d3d19c5b47b8ccef8cb61c9dcd17ac7a669 upstream. The release cycle of any key mapped to a slider gesture relies upon trailing interrupts generated by other unmasked sources, the timing and presence of which are inconsistent. To solve this problem, explicitly report a release cycle to emulate a full keystroke. Also, unmask touch interrupts if the slider press event is defined; this ensures the device reports a final interrupt with coordinate =3D 0xFFFF once the finger is lifted. As a result of how the logic has been refactored, the press/release event can now be mapped to a GPIO. This is more convenient than the previous solution, which required each channel within the slider to specify the same GPIO. As part of this change, use the device's resolution rather than its number of interrupt status registers to more safely determine if it is capable of reporting gestures. Last but not least, make the code a bit simpler by eliminating some unnecessarily complex conditional statements and a macro that could be derived using information that is already available. Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Link: https://lore.kernel.org/r/20220626072412.475211-3-jeff@labundy.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/input/misc/iqs7222.c | 96 ++++++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 38 deletions(-) diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index 53df74f3a982..57616a7ebeae 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -40,7 +40,6 @@ #define IQS7222_SLDR_SETUP_2_RES_MASK GENMASK(15, 8) #define IQS7222_SLDR_SETUP_2_RES_SHIFT 8 #define IQS7222_SLDR_SETUP_2_TOP_SPEED_MASK GENMASK(7, 0) -#define IQS7222_SLDR_SETUP_3_CHAN_SEL_MASK GENMASK(9, 0) =20 #define IQS7222_GPIO_SETUP_0_GPIO_EN BIT(0) =20 @@ -54,6 +53,9 @@ #define IQS7222_SYS_SETUP_ACK_RESET BIT(0) =20 #define IQS7222_EVENT_MASK_ATI BIT(12) +#define IQS7222_EVENT_MASK_SLDR BIT(10) +#define IQS7222_EVENT_MASK_TOUCH BIT(1) +#define IQS7222_EVENT_MASK_PROX BIT(0) =20 #define IQS7222_COMMS_HOLD BIT(0) #define IQS7222_COMMS_ERROR 0xEEEE @@ -135,12 +137,12 @@ struct iqs7222_event_desc { static const struct iqs7222_event_desc iqs7222_kp_events[] =3D { { .name =3D "event-prox", - .enable =3D BIT(0), + .enable =3D IQS7222_EVENT_MASK_PROX, .reg_key =3D IQS7222_REG_KEY_PROX, }, { .name =3D "event-touch", - .enable =3D BIT(1), + .enable =3D IQS7222_EVENT_MASK_TOUCH, .reg_key =3D IQS7222_REG_KEY_TOUCH, }, }; @@ -1957,8 +1959,8 @@ static int iqs7222_parse_sldr(struct iqs7222_private = *iqs7222, int sldr_index) int num_chan =3D dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; int ext_chan =3D rounddown(num_chan, 10); int count, error, reg_offset, i; + u16 *event_mask =3D &iqs7222->sys_setup[dev_desc->event_offset]; u16 *sldr_setup =3D iqs7222->sldr_setup[sldr_index]; - u16 *sys_setup =3D iqs7222->sys_setup; unsigned int chan_sel[4], val; =20 error =3D iqs7222_parse_props(iqs7222, &sldr_node, sldr_index, @@ -2003,7 +2005,7 @@ static int iqs7222_parse_sldr(struct iqs7222_private = *iqs7222, int sldr_index) reg_offset =3D dev_desc->sldr_res < U16_MAX ? 0 : 1; =20 sldr_setup[0] |=3D count; - sldr_setup[3 + reg_offset] &=3D ~IQS7222_SLDR_SETUP_3_CHAN_SEL_MASK; + sldr_setup[3 + reg_offset] &=3D ~GENMASK(ext_chan - 1, 0); =20 for (i =3D 0; i < ARRAY_SIZE(chan_sel); i++) { sldr_setup[5 + reg_offset + i] =3D 0; @@ -2106,6 +2108,22 @@ static int iqs7222_parse_sldr(struct iqs7222_private= *iqs7222, int sldr_index) if (error) return error; =20 + /* + * The press/release event does not expose a direct GPIO link, + * but one can be emulated by tying each of the participating + * channels to the same GPIO. + */ + error =3D iqs7222_gpio_select(iqs7222, event_node, + i ? iqs7222_sl_events[i].enable + : sldr_setup[3 + reg_offset], + i ? 1568 + sldr_index * 30 + : sldr_setup[4 + reg_offset]); + if (error) + return error; + + if (!reg_offset) + sldr_setup[9] |=3D iqs7222_sl_events[i].enable; + error =3D fwnode_property_read_u32(event_node, "linux,code", &val); if (error) { @@ -2117,26 +2135,20 @@ static int iqs7222_parse_sldr(struct iqs7222_privat= e *iqs7222, int sldr_index) iqs7222->sl_code[sldr_index][i] =3D val; input_set_capability(iqs7222->keypad, EV_KEY, val); =20 - /* - * The press/release event is determined based on whether the - * coordinate field reports 0xFFFF and has no explicit enable - * control. - */ - if (!iqs7222_sl_events[i].enable || reg_offset) - continue; - - sldr_setup[9] |=3D iqs7222_sl_events[i].enable; - - error =3D iqs7222_gpio_select(iqs7222, event_node, - iqs7222_sl_events[i].enable, - 1568 + sldr_index * 30); - if (error) - return error; - if (!dev_desc->event_offset) continue; =20 - sys_setup[dev_desc->event_offset] |=3D BIT(10 + sldr_index); + /* + * The press/release event is determined based on whether the + * coordinate field reports 0xFFFF and solely relies on touch + * or proximity interrupts to be unmasked. + */ + if (i && !reg_offset) + *event_mask |=3D (IQS7222_EVENT_MASK_SLDR << sldr_index); + else if (sldr_setup[4 + reg_offset] =3D=3D dev_desc->touch_link) + *event_mask |=3D IQS7222_EVENT_MASK_TOUCH; + else + *event_mask |=3D IQS7222_EVENT_MASK_PROX; } =20 /* @@ -2301,29 +2313,37 @@ static int iqs7222_report(struct iqs7222_private *i= qs7222) input_report_abs(iqs7222->keypad, iqs7222->sl_axis[i], sldr_pos); =20 - for (j =3D 0; j < ARRAY_SIZE(iqs7222_sl_events); j++) { - u16 mask =3D iqs7222_sl_events[j].mask; - u16 val =3D iqs7222_sl_events[j].val; + input_report_key(iqs7222->keypad, iqs7222->sl_code[i][0], + sldr_pos < dev_desc->sldr_res); =20 - if (!iqs7222_sl_events[j].enable) { - input_report_key(iqs7222->keypad, - iqs7222->sl_code[i][j], - sldr_pos < dev_desc->sldr_res); - continue; - } + /* + * A maximum resolution indicates the device does not support + * gestures, in which case the remaining fields are ignored. + */ + if (dev_desc->sldr_res =3D=3D U16_MAX) + continue; =20 - /* - * The remaining offsets represent gesture state, and - * are discarded in the case of IQS7222C because only - * absolute position is reported. - */ - if (num_stat < IQS7222_MAX_COLS_STAT) - continue; + if (!(le16_to_cpu(status[1]) & IQS7222_EVENT_MASK_SLDR << i)) + continue; + + /* + * Skip the press/release event, as it does not have separate + * status fields and is handled separately. + */ + for (j =3D 1; j < ARRAY_SIZE(iqs7222_sl_events); j++) { + u16 mask =3D iqs7222_sl_events[j].mask; + u16 val =3D iqs7222_sl_events[j].val; =20 input_report_key(iqs7222->keypad, iqs7222->sl_code[i][j], (state & mask) =3D=3D val); } + + input_sync(iqs7222->keypad); + + for (j =3D 1; j < ARRAY_SIZE(iqs7222_sl_events); j++) + input_report_key(iqs7222->keypad, + iqs7222->sl_code[i][j], 0); } =20 input_sync(iqs7222->keypad); --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 872EDC32772 for ; Tue, 23 Aug 2022 08:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243266AbiHWI1T (ORCPT ); Tue, 23 Aug 2022 04:27:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243815AbiHWIVp (ORCPT ); Tue, 23 Aug 2022 04:21:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 142C571710; Tue, 23 Aug 2022 01:12:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A7D4D61257; Tue, 23 Aug 2022 08:12:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 958B7C433C1; Tue, 23 Aug 2022 08:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242376; bh=GFnhoxaTGoTm1J3lmH2NGiDtxJLMkYd3wy08OGGiKXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R1t7+qWbtVosd55pTWR9kXtw6aenYmzsUU2gTLrlomRLOE17PFxAjIbmPW2XJ1NyH aUpokut1SYKtqn22YA1g3sGvA4ILzv0g/PX4IyKYV/gjgF4JPtEMBjbEyAx2qORHrX Fa/ZMry+EB6Ekg/rpF0TJ7UQ4x2beOng80ujQSik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff LaBundy , Dmitry Torokhov Subject: [PATCH 5.19 106/365] Input: iqs7222 - protect volatile registers Date: Tue, 23 Aug 2022 10:00:07 +0200 Message-Id: <20220823080122.627203716@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff LaBundy commit 1e4189d8af2749e2db406f92bdc4abccbab63138 upstream. Select variants of silicon silently mirror part of the event mask register to the system setup register (0xD0), and vice versa. For the following sequence: 1. Read registers 0xD0 onward and store their contents. 2. Modify the contents, including event mask fields. 3. Write registers 0xD0 onward with the modified contents. 4. Write register 0xD0 on its own again later, using the contents from step 1 to populate any reserved fields. ...the event mask register (e.g. address 0xDA) has been corrupted by writing register 0xD0 with contents that were made stale after step 3. To solve this problem, read register 0xD0 once more between steps 3 and 4. When register 0xD0 is written during step 4, the portion which is mirrored to the event mask register already matches what was written in step 3. Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Link: https://lore.kernel.org/r/20220626072412.475211-4-jeff@labundy.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/input/misc/iqs7222.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index 57616a7ebeae..c46d3c8f0230 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -1274,9 +1274,22 @@ static int iqs7222_ati_trigger(struct iqs7222_privat= e *iqs7222) struct i2c_client *client =3D iqs7222->client; ktime_t ati_timeout; u16 sys_status =3D 0; - u16 sys_setup =3D iqs7222->sys_setup[0] & ~IQS7222_SYS_SETUP_ACK_RESET; + u16 sys_setup; int error, i; =20 + /* + * The reserved fields of the system setup register may have changed + * as a result of other registers having been written. As such, read + * the register's latest value to avoid unexpected behavior when the + * register is written in the loop that follows. + */ + error =3D iqs7222_read_word(iqs7222, IQS7222_SYS_SETUP, &sys_setup); + if (error) + return error; + + sys_setup &=3D ~IQS7222_SYS_SETUP_INTF_MODE_MASK; + sys_setup &=3D ~IQS7222_SYS_SETUP_PWR_MODE_MASK; + for (i =3D 0; i < IQS7222_NUM_RETRIES; i++) { /* * Trigger ATI from streaming and normal-power modes so that @@ -2241,9 +2254,6 @@ static int iqs7222_parse_all(struct iqs7222_private *= iqs7222) return error; } =20 - sys_setup[0] &=3D ~IQS7222_SYS_SETUP_INTF_MODE_MASK; - sys_setup[0] &=3D ~IQS7222_SYS_SETUP_PWR_MODE_MASK; - sys_setup[0] |=3D IQS7222_SYS_SETUP_ACK_RESET; =20 return iqs7222_parse_props(iqs7222, NULL, 0, IQS7222_REG_GRP_SYS, --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41B29C32772 for ; Tue, 23 Aug 2022 08:30:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243849AbiHWIaO (ORCPT ); Tue, 23 Aug 2022 04:30:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243412AbiHWIY6 (ORCPT ); Tue, 23 Aug 2022 04:24:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FBDF5142D; Tue, 23 Aug 2022 01:13:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A0AABB81C26; Tue, 23 Aug 2022 08:13:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3ECDC433D6; Tue, 23 Aug 2022 08:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242385; bh=/xqVVv9eJQPMGS9O/t5wJKYPFNFQbguJKEdKTDljefE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yD46+Kc/7jveCdOcF0uD+2T5aGP4xQvQnSDj9uLH7/I8pmMQK3NECAdeAhLcEHcgd PcQnsNGlGKcyyhqgAwf8YxIZAZe+sOC+yyLcPfnmOKS6Pb28b+mSKVPCkEdtV5Lcl+ OOq+r7JULsvEGz1v0FDnb5NwTyPUVOsTE4Byrpas= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff LaBundy , Dmitry Torokhov Subject: [PATCH 5.19 107/365] Input: iqs7222 - acknowledge reset before writing registers Date: Tue, 23 Aug 2022 10:00:08 +0200 Message-Id: <20220823080122.666363089@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff LaBundy commit 2e70ef525b7309287b2d4dd24e7c9c038a006328 upstream. If the device suffers a spurious reset while reacting to a previous spurious reset, the second reset interrupt is preempted because the ACK_RESET bit is written last. To solve this problem, write the ACK_RESET bit prior to writing any other registers. This ensures that any registers written before the second spurious reset will be rewritten. Last but not least, the order in which the ACK_RESET bit is written relative to the second filter beta register is important for select variants of silicon. Enforce the correct order so as to not clobber the system status register. Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Link: https://lore.kernel.org/r/20220626072412.475211-5-jeff@labundy.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/input/misc/iqs7222.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index c46d3c8f0230..aa46f2cd4d34 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -94,11 +94,11 @@ enum iqs7222_reg_key_id { =20 enum iqs7222_reg_grp_id { IQS7222_REG_GRP_STAT, + IQS7222_REG_GRP_FILT, IQS7222_REG_GRP_CYCLE, IQS7222_REG_GRP_GLBL, IQS7222_REG_GRP_BTN, IQS7222_REG_GRP_CHAN, - IQS7222_REG_GRP_FILT, IQS7222_REG_GRP_SLDR, IQS7222_REG_GRP_GPIO, IQS7222_REG_GRP_SYS, @@ -1348,6 +1348,34 @@ static int iqs7222_dev_init(struct iqs7222_private *= iqs7222, int dir) int comms_offset =3D dev_desc->comms_offset; int error, i, j, k; =20 + /* + * Acknowledge reset before writing any registers in case the device + * suffers a spurious reset during initialization. Because this step + * may change the reserved fields of the second filter beta register, + * its cache must be updated. + * + * Writing the second filter beta register, in turn, may clobber the + * system status register. As such, the filter beta register pair is + * written first to protect against this hazard. + */ + if (dir =3D=3D WRITE) { + u16 reg =3D dev_desc->reg_grps[IQS7222_REG_GRP_FILT].base + 1; + u16 filt_setup; + + error =3D iqs7222_write_word(iqs7222, IQS7222_SYS_SETUP, + iqs7222->sys_setup[0] | + IQS7222_SYS_SETUP_ACK_RESET); + if (error) + return error; + + error =3D iqs7222_read_word(iqs7222, reg, &filt_setup); + if (error) + return error; + + iqs7222->filt_setup[1] &=3D GENMASK(7, 0); + iqs7222->filt_setup[1] |=3D (filt_setup & ~GENMASK(7, 0)); + } + /* * Take advantage of the stop-bit disable function, if available, to * save the trouble of having to reopen a communication window after @@ -2254,8 +2282,6 @@ static int iqs7222_parse_all(struct iqs7222_private *= iqs7222) return error; } =20 - sys_setup[0] |=3D IQS7222_SYS_SETUP_ACK_RESET; - return iqs7222_parse_props(iqs7222, NULL, 0, IQS7222_REG_GRP_SYS, IQS7222_REG_KEY_NONE); } --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A75AEC32772 for ; Tue, 23 Aug 2022 08:27:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243503AbiHWI1p (ORCPT ); Tue, 23 Aug 2022 04:27:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243076AbiHWIWz (ORCPT ); Tue, 23 Aug 2022 04:22:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C03A719AD; Tue, 23 Aug 2022 01:13:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AFC7B61238; Tue, 23 Aug 2022 08:13:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB957C433D6; Tue, 23 Aug 2022 08:13:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242391; bh=38S++nijNcpJ8tbAFDQxNdFyX10pEPM5Z89mcFblEh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MAn59yQ/hnCRQdKBQCvgKPiIwVmjItI9aAHca88nix4/nZ/DHCeR4oJTg6f4TCsBh c3/XMhYQNfwxa3d6AaITM8xpeaX1ARDqodXlhhysH3tLLKqScNUGDERVSsdzOUYyYl to99PEXL3gCDdw11k514dtTBuxKf5jEJzS0g1e3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff LaBundy , Dmitry Torokhov Subject: [PATCH 5.19 108/365] Input: iqs7222 - handle reset during ATI Date: Tue, 23 Aug 2022 10:00:09 +0200 Message-Id: <20220823080122.709568867@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff LaBundy commit 8635c68891c6d786d644747d599c41bdf512fbbf upstream. If the device suffers a spurious reset during ATI, there is no point in enduring any further retries. Instead, simply return successfully from the polling loop. In this case, the interrupt handler will intervene and recognize the device has been reset. It then proceeds to initialize the device and trigger ATI once more. As part of this change, swap the order of status field evaluation to match that of the interrupt handler, and correct a nearby off-by-one error that causes an error message to suggest the final attempt will be retried. Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Link: https://lore.kernel.org/r/20220626072412.475211-6-jeff@labundy.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/input/misc/iqs7222.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index aa46f2cd4d34..e65260d290cc 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -1314,12 +1314,15 @@ static int iqs7222_ati_trigger(struct iqs7222_priva= te *iqs7222) if (error) return error; =20 - if (sys_status & IQS7222_SYS_STATUS_ATI_ACTIVE) - continue; + if (sys_status & IQS7222_SYS_STATUS_RESET) + return 0; =20 if (sys_status & IQS7222_SYS_STATUS_ATI_ERROR) break; =20 + if (sys_status & IQS7222_SYS_STATUS_ATI_ACTIVE) + continue; + /* * Use stream-in-touch mode if either slider reports * absolute position. @@ -1336,7 +1339,7 @@ static int iqs7222_ati_trigger(struct iqs7222_private= *iqs7222) dev_err(&client->dev, "ATI attempt %d of %d failed with status 0x%02X, %s\n", i + 1, IQS7222_NUM_RETRIES, (u8)sys_status, - i < IQS7222_NUM_RETRIES ? "retrying..." : "stopping"); + i + 1 < IQS7222_NUM_RETRIES ? "retrying" : "stopping"); } =20 return -ETIMEDOUT; --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2D8EC32772 for ; Tue, 23 Aug 2022 08:29:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243325AbiHWI3K (ORCPT ); Tue, 23 Aug 2022 04:29:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243628AbiHWIZn (ORCPT ); Tue, 23 Aug 2022 04:25:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7E426FA3E; Tue, 23 Aug 2022 01:13:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D0F56129A; Tue, 23 Aug 2022 08:13:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6FCCC433D7; Tue, 23 Aug 2022 08:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242397; bh=mLBY6Fsf6WZ2u0NsCDFnW8EU6G375hSpNr7EVGFAr1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Okg3i6g0mxpnReqEbzhLb2dmMg5iG+qw9kc+AqO+u1uk71gs5ZLILKX4TCJ8/ZU2f /lF1jbm9r+ViLZA6vtHEuXAyC30JWn61ABWJhPL5yZ7JZRm/39MHeEM9yzZrXRj20A GH8/bI+jwjXhOWd8CYKl5EWE+GEip6cpNpincS9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff LaBundy , Dmitry Torokhov Subject: [PATCH 5.19 109/365] Input: iqs7222 - remove support for RF filter Date: Tue, 23 Aug 2022 10:00:10 +0200 Message-Id: <20220823080122.758836359@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff LaBundy commit 381932cf61d52bde656c8596c0cb8f46bed53dc0 upstream. The vendor has marked the RF filter enable control as reserved in the datasheet; remove it from the driver. Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Link: https://lore.kernel.org/r/20220626072412.475211-7-jeff@labundy.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/input/misc/iqs7222.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index e65260d290cc..b2e8097a2e6d 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -557,13 +557,6 @@ static const struct iqs7222_prop_desc iqs7222_props[] = =3D { .reg_width =3D 4, .label =3D "current reference trim", }, - { - .name =3D "azoteq,rf-filt-enable", - .reg_grp =3D IQS7222_REG_GRP_GLBL, - .reg_offset =3D 0, - .reg_shift =3D 15, - .reg_width =3D 1, - }, { .name =3D "azoteq,max-counts", .reg_grp =3D IQS7222_REG_GRP_GLBL, --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85D46C32772 for ; Tue, 23 Aug 2022 08:29:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243722AbiHWI3T (ORCPT ); Tue, 23 Aug 2022 04:29:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243698AbiHWIZs (ORCPT ); Tue, 23 Aug 2022 04:25:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0043D71BE0; Tue, 23 Aug 2022 01:13:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A4B7561228; Tue, 23 Aug 2022 08:13:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE34EC433D6; Tue, 23 Aug 2022 08:13:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242404; bh=/9L/V64GOfJegWqVypiLB77vzs67y2ykCnPES2HTip8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FRwExk4jQikcDcuO87VCUQGe9ZFek3LZem2uisc4DRWiuERW89WY7cBPyEFY/VzzM hrLlMNek5vGbmoULm7CeXFfHIv8m9dwgBd11y+I6qLHfGr0j0noaIBAAG+uNJJYi/D S7LUDJgw+M0JjzNz8WvYI+Tcq6WTEWkRMcoYciCQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff LaBundy , Dmitry Torokhov Subject: [PATCH 5.19 110/365] dt-bindings: input: iqs7222: Remove support for RF filter Date: Tue, 23 Aug 2022 10:00:11 +0200 Message-Id: <20220823080122.807189406@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff LaBundy commit f5d2c1ed72c26152e6883ed67dc3004a39165098 upstream. The vendor has marked the RF filter enable control as reserved in the datasheet; remove it from the binding. Fixes: 44dc42d254bf ("dt-bindings: input: Add bindings for Azoteq IQS7222A/= B/C") Signed-off-by: Jeff LaBundy Link: https://lore.kernel.org/r/20220626072412.475211-8-jeff@labundy.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml b/= Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml index a3a1e5a65306..6180f7ee2284 100644 --- a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +++ b/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml @@ -37,10 +37,6 @@ properties: device is temporarily held in hardware reset prior to initialization= if this property is present. =20 - azoteq,rf-filt-enable: - type: boolean - description: Enables the device's internal RF filter. - azoteq,max-counts: $ref: /schemas/types.yaml#/definitions/uint32 enum: [0, 1, 2, 3] --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A577EC32772 for ; Tue, 23 Aug 2022 08:29:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243638AbiHWI3A (ORCPT ); Tue, 23 Aug 2022 04:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243559AbiHWIZg (ORCPT ); Tue, 23 Aug 2022 04:25:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D5E24D161; Tue, 23 Aug 2022 01:13:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B20E5B81C25; Tue, 23 Aug 2022 08:13:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06128C433C1; Tue, 23 Aug 2022 08:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242410; bh=JOA4S2elR+67zlKZpWHgnhh6ZM27y/vCwFmhxSo3GtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lLXtNOCcbzwGoSQ9LlaltaQ59ukGNiWrouGFFLc37TNtWhF4uu8ajKwBQAN1+IR7Y 4uzi7BTgHaFSbMuRmC1Yb2KfABtzdm2iwU6N9aZJWhCYFL7VsR5AT4VFpAXHssxa+l ONMpOd8Fo6uMqXugiXlkiGopbsL8KRSu4HLXUyXg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff LaBundy , Dmitry Torokhov Subject: [PATCH 5.19 111/365] dt-bindings: input: iqs7222: Correct bottom speed step size Date: Tue, 23 Aug 2022 10:00:12 +0200 Message-Id: <20220823080122.847534631@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff LaBundy commit 6cfb357851bd3ef0a48e14bccfb5ca6b8104ea61 upstream. The bottom speed property is specified in steps of 1, not 4. Fixes: 44dc42d254bf ("dt-bindings: input: Add bindings for Azoteq IQS7222A/= B/C") Signed-off-by: Jeff LaBundy Link: https://lore.kernel.org/r/20220626072412.475211-9-jeff@labundy.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml b/= Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml index 6180f7ee2284..c9c3a1e9bcae 100644 --- a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +++ b/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml @@ -533,9 +533,8 @@ patternProperties: =20 azoteq,bottom-speed: $ref: /schemas/types.yaml#/definitions/uint32 - multipleOf: 4 minimum: 0 - maximum: 1020 + maximum: 255 description: Specifies the speed of movement after which coordinate filtering= is linearly reduced. --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24681C32772 for ; Tue, 23 Aug 2022 08:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243298AbiHWI3P (ORCPT ); Tue, 23 Aug 2022 04:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243657AbiHWIZp (ORCPT ); Tue, 23 Aug 2022 04:25:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9938B6B169; Tue, 23 Aug 2022 01:13:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 21970B81C29; Tue, 23 Aug 2022 08:13:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 743D4C433D7; Tue, 23 Aug 2022 08:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242419; bh=ckMBl119NctqlvjDKtx+0nKMG/fB7D6nQeW4nRBcDOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J3K3MAOmN/waxmPQAkaoTmVrLU8wyxZokPXSY2qA9sNmHPLfPi3EB/1s2kxMUuDOk yAIpM6oGwrSXrTbB+9QwhwNAu9Ib1G8z7BdHpekaDkelpXXbIyUm+UId+S5JnXPRCw VBam0vf58qKDKdqC5AU0csvNxQNDM9QHr6ozZBwQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff LaBundy , Dmitry Torokhov Subject: [PATCH 5.19 112/365] dt-bindings: input: iqs7222: Extend slider-mapped GPIO to IQS7222C Date: Tue, 23 Aug 2022 10:00:13 +0200 Message-Id: <20220823080122.897868947@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff LaBundy commit f0ea452715d72bc365d2b401ceb458f5ae82eeec upstream. Although the IQS7222C does not offer slider gesture support, the press/release event can still be mapped to any of the IQS7222C's three GPIO pins. Update the binding to reflect this relationship. Fixes: 44dc42d254bf ("dt-bindings: input: Add bindings for Azoteq IQS7222A/= B/C") Signed-off-by: Jeff LaBundy Link: https://lore.kernel.org/r/20220626072412.475211-10-jeff@labundy.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- .../bindings/input/azoteq,iqs7222.yaml | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml b/= Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml index c9c3a1e9bcae..32d0d5190334 100644 --- a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +++ b/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml @@ -611,16 +611,15 @@ patternProperties: azoteq,gpio-select: $ref: /schemas/types.yaml#/definitions/uint32-array minItems: 1 - maxItems: 1 + maxItems: 3 items: minimum: 0 - maximum: 0 + maximum: 2 description: | - Specifies an individual GPIO mapped to a tap, swipe or flick - gesture as follows: + Specifies one or more GPIO mapped to the event as follows: 0: GPIO0 - 1: GPIO3 (reserved) - 2: GPIO4 (reserved) + 1: GPIO3 (IQS7222C only) + 2: GPIO4 (IQS7222C only) =20 Note that although multiple events can be mapped to a single GPIO, they must all be of the same type (proximity, touch or @@ -705,6 +704,14 @@ allOf: multipleOf: 4 maximum: 1020 =20 + patternProperties: + "^event-(press|tap|(swipe|flick)-(pos|neg))$": + properties: + azoteq,gpio-select: + maxItems: 1 + items: + maximum: 0 + else: patternProperties: "^channel-([0-9]|1[0-9])$": @@ -721,8 +728,6 @@ allOf: =20 azoteq,gesture-dist: false =20 - azoteq,gpio-select: false - required: - compatible - reg --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2BD1C32772 for ; Tue, 23 Aug 2022 08:29:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243740AbiHWI3a (ORCPT ); Tue, 23 Aug 2022 04:29:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243715AbiHWIZu (ORCPT ); Tue, 23 Aug 2022 04:25:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 268D871BFD; Tue, 23 Aug 2022 01:13:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D940461324; Tue, 23 Aug 2022 08:13:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E62D1C433B5; Tue, 23 Aug 2022 08:13:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242425; bh=mWzM5TMrwuksgZqLJpC/Uv/KW7zVtYjKYra4nX9Cxis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F8dH16AzI4tda/DmR4j2wj2BHkQYqBktDqpb3VXKG2kRza1BZ8HqPI2aVckhSWJ1W ldW+P6A1RPwzAbDebf2pHuzXd/sciP+lJscIWpIRACNSPneKqywo7TVFjWNDkvF00T oQn58uSynPLxyOcc/XhyRtCEEXSyweT6uoJYtGD4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Richard Weinberger Subject: [PATCH 5.19 113/365] um: Add missing apply_returns() Date: Tue, 23 Aug 2022 10:00:14 +0200 Message-Id: <20220823080122.931986610@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra commit 637285e7f8d6da70a70c64e7895cb0672357a1f7 upstream. Implement apply_returns() stub for UM, just like all the other patching routines. Fixes: 15e67227c49a ("x86: Undo return-thunk damage") Reported-by: Randy Dunlap Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/um/kernel/um_arch.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -444,6 +444,10 @@ void apply_returns(s32 *start, s32 *end) { } =20 +void apply_returns(s32 *start, s32 *end) +{ +} + void apply_alternatives(struct alt_instr *start, struct alt_instr *end) { } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 216F3C32772 for ; Tue, 23 Aug 2022 08:29:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243757AbiHWI3k (ORCPT ); Tue, 23 Aug 2022 04:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243765AbiHWIZ5 (ORCPT ); Tue, 23 Aug 2022 04:25:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08198726B4; Tue, 23 Aug 2022 01:13:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 742E6612DA; Tue, 23 Aug 2022 08:13:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36455C433D6; Tue, 23 Aug 2022 08:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242431; bh=JQEUw8tP4VU//I0a12Xo3QRH2ouVlQAfOCMHgm0J5a0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pLIu7q0crvDsWeCKCQ4LIvTRHPHYzb2qhsScJVYF9VjqU7k4Rdp8pqH7VB6jm1dcx qFEAulxacFqctloI5Y25D5flNgFTd92iFLX3WQfzSIheCmhAUgdAT5o39dQ5BMSo2+ atIR1ka06LxpLkRU2qSsiH0mE+h4cLqXGNELHSno= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naveen Mamindlapalli , Sunil Kovvuri Goutham , Jakub Kicinski Subject: [PATCH 5.19 114/365] octeontx2-pf: Fix NIX_AF_TL3_TL2X_LINKX_CFG register configuration Date: Tue, 23 Aug 2022 10:00:15 +0200 Message-Id: <20220823080122.980341348@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naveen Mamindlapalli commit 13c9f4dc102f2856e80b92486c41841e25e23772 upstream. For packets scheduled to RPM and LBK, NIX_AF_PSE_CHANNEL_LEVEL[BP_LEVEL] selects the TL3 or TL2 scheduling level as the one used for link/channel selection and backpressure. For each scheduling queue at the selected level: Setting NIX_AF_TL3_TL2(0..255)_LINK(0..12)_CFG[ENA] =3D 1 allows the TL3/TL2 queue to schedule packets to a specified RPM or LBK link and channel. There is an issue in the code where NIX_AF_PSE_CHANNEL_LEVEL[BP_LEVEL] is set to TL3 where as the NIX_AF_TL3_TL2(0..255)_LINK(0..12)_CFG is configured for TL2 queue in some cases. As a result packets will not transmit on that link/channel. This patch fixes the issue by configuring the NIX_AF_TL3_TL2(0..255)_LINK(0..12)_CFG register depending on the NIX_AF_PSE_CHANNEL_LEVEL[BP_LEVEL] value. Fixes: caa2da34fd25a ("octeontx2-pf: Initialize and config queues") Signed-off-by: Naveen Mamindlapalli Signed-off-by: Sunil Kovvuri Goutham Link: https://lore.kernel.org/r/20220802142813.25031-1-naveenm@marvell.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 19 ++++++++++= +---- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 1=20 2 files changed, 15 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c @@ -632,6 +632,12 @@ int otx2_txschq_config(struct otx2_nic * req->num_regs++; req->reg[1] =3D NIX_AF_TL3X_SCHEDULE(schq); req->regval[1] =3D dwrr_val; + if (lvl =3D=3D hw->txschq_link_cfg_lvl) { + req->num_regs++; + req->reg[2] =3D NIX_AF_TL3_TL2X_LINKX_CFG(schq, hw->tx_link); + /* Enable this queue and backpressure */ + req->regval[2] =3D BIT_ULL(13) | BIT_ULL(12); + } } else if (lvl =3D=3D NIX_TXSCH_LVL_TL2) { parent =3D hw->txschq_list[NIX_TXSCH_LVL_TL1][0]; req->reg[0] =3D NIX_AF_TL2X_PARENT(schq); @@ -641,11 +647,12 @@ int otx2_txschq_config(struct otx2_nic * req->reg[1] =3D NIX_AF_TL2X_SCHEDULE(schq); req->regval[1] =3D TXSCH_TL1_DFLT_RR_PRIO << 24 | dwrr_val; =20 - req->num_regs++; - req->reg[2] =3D NIX_AF_TL3_TL2X_LINKX_CFG(schq, hw->tx_link); - /* Enable this queue and backpressure */ - req->regval[2] =3D BIT_ULL(13) | BIT_ULL(12); - + if (lvl =3D=3D hw->txschq_link_cfg_lvl) { + req->num_regs++; + req->reg[2] =3D NIX_AF_TL3_TL2X_LINKX_CFG(schq, hw->tx_link); + /* Enable this queue and backpressure */ + req->regval[2] =3D BIT_ULL(13) | BIT_ULL(12); + } } else if (lvl =3D=3D NIX_TXSCH_LVL_TL1) { /* Default config for TL1. * For VF this is always ignored. @@ -1591,6 +1598,8 @@ void mbox_handler_nix_txsch_alloc(struct for (schq =3D 0; schq < rsp->schq[lvl]; schq++) pf->hw.txschq_list[lvl][schq] =3D rsp->schq_list[lvl][schq]; + + pf->hw.txschq_link_cfg_lvl =3D rsp->link_cfg_lvl; } EXPORT_SYMBOL(mbox_handler_nix_txsch_alloc); =20 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h @@ -195,6 +195,7 @@ struct otx2_hw { u16 sqb_size; =20 /* NIX */ + u8 txschq_link_cfg_lvl; u16 txschq_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC]; u16 matchall_ipolicer; u32 dwrr_mtu; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F650C32772 for ; Tue, 23 Aug 2022 08:30:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243834AbiHWIaL (ORCPT ); Tue, 23 Aug 2022 04:30:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245598AbiHWI0q (ORCPT ); Tue, 23 Aug 2022 04:26:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AF5174363; Tue, 23 Aug 2022 01:14:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6706DB81C35; Tue, 23 Aug 2022 08:13:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBCE2C433D7; Tue, 23 Aug 2022 08:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242438; bh=cx2ysTK87stMeHPikefVBj+1WkzeP9H1M67m6Mj+Bvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O2DaQmzjMmxulWANS0qE+HfdpURdv201L5U4segHBZVP+9wGZmKB+i+t8urBEAcQv xxIAk5+wrS9AeNcLrEGy5GMWwB0dgneb9c4XOoUrFYDfGviKttNX+DZdnJgsBh6Grk pVB30e3JGJuSdHM13P2O42rtY78+Nr5dwRE21xtY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanislaw Kardach , Subbaraya Sundeep , Sunil Goutham , Jakub Kicinski Subject: [PATCH 5.19 115/365] octeontx2-af: Apply tx nibble fixup always Date: Tue, 23 Aug 2022 10:00:16 +0200 Message-Id: <20220823080123.019511691@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stanislaw Kardach commit dd1d1a8a6b29b6b472fd0d449b29eb806c411dd2 upstream. NPC_PARSE_NIBBLE for TX interface has to be equal to the RX one for some silicon revisions. Mistakenly this fixup was only applied to the default MKEX profile while it should also be applied to any loaded profile. Fixes: 1c1935c9945d ("octeontx2-af: Add NIX1 interfaces to NPC") Signed-off-by: Stanislaw Kardach Signed-off-by: Subbaraya Sundeep Signed-off-by: Sunil Goutham Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c @@ -1915,6 +1915,7 @@ static void rvu_npc_hw_init(struct rvu * =20 static void rvu_npc_setup_interfaces(struct rvu *rvu, int blkaddr) { + struct npc_mcam_kex *mkex =3D rvu->kpu.mkex; struct npc_mcam *mcam =3D &rvu->hw->mcam; struct rvu_hwinfo *hw =3D rvu->hw; u64 nibble_ena, rx_kex, tx_kex; @@ -1927,15 +1928,15 @@ static void rvu_npc_setup_interfaces(str mcam->counters.max--; mcam->rx_miss_act_cntr =3D mcam->counters.max; =20 - rx_kex =3D npc_mkex_default.keyx_cfg[NIX_INTF_RX]; - tx_kex =3D npc_mkex_default.keyx_cfg[NIX_INTF_TX]; + rx_kex =3D mkex->keyx_cfg[NIX_INTF_RX]; + tx_kex =3D mkex->keyx_cfg[NIX_INTF_TX]; nibble_ena =3D FIELD_GET(NPC_PARSE_NIBBLE, rx_kex); =20 nibble_ena =3D rvu_npc_get_tx_nibble_cfg(rvu, nibble_ena); if (nibble_ena) { tx_kex &=3D ~NPC_PARSE_NIBBLE; tx_kex |=3D FIELD_PREP(NPC_PARSE_NIBBLE, nibble_ena); - npc_mkex_default.keyx_cfg[NIX_INTF_TX] =3D tx_kex; + mkex->keyx_cfg[NIX_INTF_TX] =3D tx_kex; } =20 /* Configure RX interfaces */ From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEF9BC32792 for ; Tue, 23 Aug 2022 08:32:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243997AbiHWIao (ORCPT ); Tue, 23 Aug 2022 04:30:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344833AbiHWI1D (ORCPT ); Tue, 23 Aug 2022 04:27:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E609074BAA; Tue, 23 Aug 2022 01:14:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 86FCBB81C21; Tue, 23 Aug 2022 08:14:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB72BC433D7; Tue, 23 Aug 2022 08:14:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242444; bh=v72sCb1UKg/hUfqN4kpl6JgOnAKHwuo/rcMINgfYefU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SYTeQJRKG9ybpQlvs5rwoZBa5zwW5kB+ehrwCCYCfoo7arHBxuwgIjMAXWmqObhl2 kSmTu+SedQTQhJ/FMINAa9yHUhm+iaxJ5PNZguPu8kKBrTCikjeS+BZdLIJGbZuOPY cSFjCFNaVmUWMApP1OYl4ouyp2OvFLW6qehuSHLE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harman Kalra , Subbaraya Sundeep , Sunil Goutham , Jakub Kicinski Subject: [PATCH 5.19 116/365] octeontx2-af: suppress external profile loading warning Date: Tue, 23 Aug 2022 10:00:17 +0200 Message-Id: <20220823080123.060484442@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Harman Kalra commit cf2437626502b5271d19686b03dea306efe17ea0 upstream. The packet parser profile supplied as firmware may not be present all the time and default profile is used mostly. Hence suppress firmware loading warning from kernel due to absence of firmware in kernel image. Fixes: 3a7244152f9c ("octeontx2-af: add support for custom KPU entries") Signed-off-by: Harman Kalra Signed-off-by: Subbaraya Sundeep Signed-off-by: Sunil Goutham Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c @@ -1650,7 +1650,7 @@ static void npc_load_kpu_profile(struct * Firmware database method. * Default KPU profile. */ - if (!request_firmware(&fw, kpu_profile, rvu->dev)) { + if (!request_firmware_direct(&fw, kpu_profile, rvu->dev)) { dev_info(rvu->dev, "Loading KPU profile from firmware: %s\n", kpu_profile); rvu->kpu_fwdata =3D kzalloc(fw->size, GFP_KERNEL); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68577C32772 for ; Tue, 23 Aug 2022 08:30:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243825AbiHWIaG (ORCPT ); Tue, 23 Aug 2022 04:30:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244293AbiHWI0b (ORCPT ); Tue, 23 Aug 2022 04:26:31 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16FCE72FFB; Tue, 23 Aug 2022 01:14:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C5167CE1B35; Tue, 23 Aug 2022 08:14:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCFA3C433C1; Tue, 23 Aug 2022 08:14:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242453; bh=71pQm5UX7KUdV3OYns4yypzPi12FmpAs/Vlutlh9J9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FC2nS6fjQhptsuZbmhQYUXNumaLWcE7xU9F3yOOYZfOx1bhaVWwEqnjSegdt71cdd X1KjgJJR9MVKxF5hGbOkpE26mZhEQCwJoYWuO5Nu2EeJV6P/RfsPMb2e1AAVmtj6Dn frX3ZY1F2zooNo976NEo2JIvs853X6GLVhQxrZ9A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Subbaraya Sundeep , Sunil Goutham , Jakub Kicinski Subject: [PATCH 5.19 117/365] octeontx2-af: Fix mcam entry resource leak Date: Tue, 23 Aug 2022 10:00:18 +0200 Message-Id: <20220823080123.101243885@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Subbaraya Sundeep commit 3f8fe40ab7730cf8eb6f8b8ff412012f7f6f8f48 upstream. The teardown sequence in FLR handler returns if no NIX LF is attached to PF/VF because it indicates that graceful shutdown of resources already happened. But there is a chance of all allocated MCAM entries not being freed by PF/VF. Hence free mcam entries even in case of detached LF. Fixes: c554f9c1574e ("octeontx2-af: Teardown NPA, NIX LF upon receiving FLR= ") Signed-off-by: Subbaraya Sundeep Signed-off-by: Sunil Goutham Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 6 ++++++ drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 6 ++++++ 2 files changed, 12 insertions(+) --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c @@ -2564,6 +2564,12 @@ static void __rvu_flr_handler(struct rvu rvu_blklf_teardown(rvu, pcifunc, BLKADDR_NPA); rvu_reset_lmt_map_tbl(rvu, pcifunc); rvu_detach_rsrcs(rvu, NULL, pcifunc); + /* In scenarios where PF/VF drivers detach NIXLF without freeing MCAM + * entries, check and free the MCAM entries explicitly to avoid leak. + * Since LF is detached use LF number as -1. + */ + rvu_npc_free_mcam_entries(rvu, pcifunc, -1); + mutex_unlock(&rvu->flr_lock); } =20 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c @@ -1096,6 +1096,9 @@ static void npc_enadis_default_entries(s =20 void rvu_npc_disable_default_entries(struct rvu *rvu, u16 pcifunc, int nix= lf) { + if (nixlf < 0) + return; + npc_enadis_default_entries(rvu, pcifunc, nixlf, false); =20 /* Delete multicast and promisc MCAM entries */ @@ -1107,6 +1110,9 @@ void rvu_npc_disable_default_entries(str =20 void rvu_npc_enable_default_entries(struct rvu *rvu, u16 pcifunc, int nixl= f) { + if (nixlf < 0) + return; + /* Enables only broadcast match entry. Promisc/Allmulti are enabled * in set_rx_mode mbox handler. */ From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56DB9C32774 for ; Tue, 23 Aug 2022 08:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243496AbiHWIca (ORCPT ); Tue, 23 Aug 2022 04:32:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243649AbiHWI3D (ORCPT ); Tue, 23 Aug 2022 04:29:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DB6274CD0; Tue, 23 Aug 2022 01:15:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CAAECB81C3B; Tue, 23 Aug 2022 08:14:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEAFBC433D6; Tue, 23 Aug 2022 08:14:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242459; bh=AOk+oevlxIEWe26QrP0aZwFVPDWgUz50rIsB56MoIl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JoVZBKugIZrh/ZPMuUOFX1eP3exfuXbmCqPjB47uZ4VBrgJrzL05xKlyijhXsij/9 315rr3tJqoaX3ZH5JAnkX3feOsx5OTC/2e1mu2AOFyMkxrsia/snF3U+9TYnSRCWQe t1D4BE8yJkQoiothRZgkdt/HgYsuAHZA1p0eEquE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Subbaraya Sundeep , Sunil Goutham , Jakub Kicinski Subject: [PATCH 5.19 118/365] octeontx2-af: Fix key checking for source mac Date: Tue, 23 Aug 2022 10:00:19 +0200 Message-Id: <20220823080123.141532991@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Subbaraya Sundeep commit c3c290276927a3ae79342a4e17ec0500c138c63a upstream. Given a field with its location/offset in input packet, the key checking logic verifies whether extracting the field can be supported or not based on the mkex profile loaded in hardware. This logic is wrong wrt source mac and this patch fixes that. Fixes: 9b179a960a96 ("octeontx2-af: Generate key field bit mask from KEX pr= ofile") Signed-off-by: Subbaraya Sundeep Signed-off-by: Sunil Goutham Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c @@ -445,7 +445,8 @@ do { \ NPC_SCAN_HDR(NPC_VLAN_TAG1, NPC_LID_LB, NPC_LT_LB_CTAG, 2, 2); NPC_SCAN_HDR(NPC_VLAN_TAG2, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 2, 2); NPC_SCAN_HDR(NPC_DMAC, NPC_LID_LA, la_ltype, la_start, 6); - NPC_SCAN_HDR(NPC_SMAC, NPC_LID_LA, la_ltype, la_start, 6); + /* SMAC follows the DMAC(which is 6 bytes) */ + NPC_SCAN_HDR(NPC_SMAC, NPC_LID_LA, la_ltype, la_start + 6, 6); /* PF_FUNC is 2 bytes at 0th byte of NPC_LT_LA_IH_NIX_ETHER */ NPC_SCAN_HDR(NPC_PF_FUNC, NPC_LID_LA, NPC_LT_LA_IH_NIX_ETHER, 0, 2); } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 326BAC32772 for ; Tue, 23 Aug 2022 08:32:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243664AbiHWIcg (ORCPT ); Tue, 23 Aug 2022 04:32:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243031AbiHWI3J (ORCPT ); Tue, 23 Aug 2022 04:29:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50DE07392F; Tue, 23 Aug 2022 01:15:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 487EE61338; Tue, 23 Aug 2022 08:14:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33756C433D6; Tue, 23 Aug 2022 08:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242465; bh=sZA4j3WfRODB02016YMFjVMHgF4nnVisj24HWC5yEA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nP1YcKdQk2xQYYczAAbp2FngtkMlrN1+yy/Q6t8pSgeAqHdHoxnAnKBYQ6NlNEBWe 7zzH7UELKKK9jy8mxtD3F7tLDW/S0745cLdLpLLxa+Ka9usPFafYKHTp3E57ffltOf 7vbojNkjIt9Mtz1jB9fPFCdXxP1UImhMGNtwAPD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sakari Ailus , Andy Shevchenko , "Rafael J. Wysocki" Subject: [PATCH 5.19 119/365] ACPI: property: Return type of acpi_add_nondev_subnodes() should be bool Date: Tue, 23 Aug 2022 10:00:20 +0200 Message-Id: <20220823080123.173129219@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sakari Ailus commit 85140ef275f577f64e8a2c5789447222dfc14fc4 upstream. The value acpi_add_nondev_subnodes() returns is bool so change the return type of the function to match that. Fixes: 445b0eb058f5 ("ACPI / property: Add support for data-only subnodes") Signed-off-by: Sakari Ailus Reviewed-by: Andy Shevchenko Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/acpi/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -155,10 +155,10 @@ static bool acpi_nondev_subnode_ok(acpi_ return acpi_nondev_subnode_data_ok(handle, link, list, parent); } =20 -static int acpi_add_nondev_subnodes(acpi_handle scope, - const union acpi_object *links, - struct list_head *list, - struct fwnode_handle *parent) +static bool acpi_add_nondev_subnodes(acpi_handle scope, + const union acpi_object *links, + struct list_head *list, + struct fwnode_handle *parent) { bool ret =3D false; int i; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84142C3F6B0 for ; Tue, 23 Aug 2022 08:32:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243698AbiHWIcq (ORCPT ); Tue, 23 Aug 2022 04:32:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243751AbiHWI3g (ORCPT ); Tue, 23 Aug 2022 04:29:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F050674366; Tue, 23 Aug 2022 01:15:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2A3A6B81C3E; Tue, 23 Aug 2022 08:14:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FA41C433D7; Tue, 23 Aug 2022 08:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242471; bh=Lw6+OHZALDDUo+C/EBstKYdK92NMO1shHUb3tm6rKQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A4CzQ6aYhBLU3jR2bzo6e7cojVeSF5TvoeqEGNtZxT2kPKigp0lr31SDlm6e1xte0 4DLRyX8bnME+VPe1BIf7gr+vo1vtxv7GiGz1UTHMQ8vAgXXkgQFGjhHIvbCOA5ulqv D3XmGqFOk2qx+UZejZxr2T+baEzac/t5w4l5Zn6Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Matthias May , Jakub Kicinski Subject: [PATCH 5.19 120/365] geneve: do not use RT_TOS for IPv6 flowlabel Date: Tue, 23 Aug 2022 10:00:21 +0200 Message-Id: <20220823080123.212222973@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matthias May commit ca2bb69514a8bc7f83914122f0d596371352416c upstream. According to Guillaume Nault RT_TOS should never be used for IPv6. Quote: RT_TOS() is an old macro used to interprete IPv4 TOS as described in the obsolete RFC 1349. It's conceptually wrong to use it even in IPv4 code, although, given the current state of the code, most of the existing calls have no consequence. But using RT_TOS() in IPv6 code is always a bug: IPv6 never had a "TOS" field to be interpreted the RFC 1349 way. There's no historical compatibility to worry about. Fixes: 3a56f86f1be6 ("geneve: handle ipv6 priority like ipv4 tos") Acked-by: Guillaume Nault Signed-off-by: Matthias May Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/geneve.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -876,8 +876,7 @@ static struct dst_entry *geneve_get_v6_d use_cache =3D false; } =20 - fl6->flowlabel =3D ip6_make_flowinfo(RT_TOS(prio), - info->key.label); + fl6->flowlabel =3D ip6_make_flowinfo(prio, info->key.label); dst_cache =3D (struct dst_cache *)&info->dst_cache; if (use_cache) { dst =3D dst_cache_get_ip6(dst_cache, &fl6->saddr); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9B19C32793 for ; Tue, 23 Aug 2022 08:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243841AbiHWIc4 (ORCPT ); Tue, 23 Aug 2022 04:32:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243948AbiHWIam (ORCPT ); Tue, 23 Aug 2022 04:30:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B98724A110; Tue, 23 Aug 2022 01:15:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 574096135D; Tue, 23 Aug 2022 08:14:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60AA1C433D6; Tue, 23 Aug 2022 08:14:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242477; bh=A/aPAFq7veYWuIg6AGp1rPtrhNGsvacQvE4A2a/OP3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CKZ8y5ooogQIqSbDxDk9g8cCQ0BNDoDol2SJjmnyiwZ+zW34qlIwYP1viFll0XoCe n+4tjhYjtU+46ciewOQbGWhqW8wJOlg+KyT7/Z9wexCzJEL+MEOzm/QZL7/ixuM3AB 7l7GJ9FlaFq9h/7laeR+OzsKLPopu3aCRZPLmmtg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Matthias May , Jakub Kicinski Subject: [PATCH 5.19 121/365] vxlan: do not use RT_TOS for IPv6 flowlabel Date: Tue, 23 Aug 2022 10:00:22 +0200 Message-Id: <20220823080123.248049136@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matthias May commit e488d4f5d6e4cd1e728ba4ddbdcd7ef5f4d13a21 upstream. According to Guillaume Nault RT_TOS should never be used for IPv6. Quote: RT_TOS() is an old macro used to interprete IPv4 TOS as described in the obsolete RFC 1349. It's conceptually wrong to use it even in IPv4 code, although, given the current state of the code, most of the existing calls have no consequence. But using RT_TOS() in IPv6 code is always a bug: IPv6 never had a "TOS" field to be interpreted the RFC 1349 way. There's no historical compatibility to worry about. Fixes: 1400615d64cf ("vxlan: allow setting ipv6 traffic class") Acked-by: Guillaume Nault Signed-off-by: Matthias May Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/vxlan/vxlan_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -2321,7 +2321,7 @@ static struct dst_entry *vxlan6_get_rout fl6.flowi6_oif =3D oif; fl6.daddr =3D *daddr; fl6.saddr =3D *saddr; - fl6.flowlabel =3D ip6_make_flowinfo(RT_TOS(tos), label); + fl6.flowlabel =3D ip6_make_flowinfo(tos, label); fl6.flowi6_mark =3D skb->mark; fl6.flowi6_proto =3D IPPROTO_UDP; fl6.fl6_dport =3D dport; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20E61C32793 for ; Tue, 23 Aug 2022 08:33:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243921AbiHWIdD (ORCPT ); Tue, 23 Aug 2022 04:33:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244052AbiHWIaq (ORCPT ); Tue, 23 Aug 2022 04:30:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50B922C105; Tue, 23 Aug 2022 01:15:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB26D61347; Tue, 23 Aug 2022 08:14:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD105C433C1; Tue, 23 Aug 2022 08:14:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242487; bh=ybewNcAyiMT2IKRPezU22xC7+zcYjaE58rdzZyjjN+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x/SVChI57QKowY6BeG18fbTkHdjVoo64R3ThEYcOKprD+/+Ln+YbViYcQ3hVhbC0J MB9baPuCNbrIW75bDdGUTAy7btt6qaT4CgI6BM3Po3jC/AP4SicKpJjO/mbBYMhlHk ciZaPkL3IOF5NpCZJ3HnbWNMP1OALT+G8zHUNqkY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Matthias May , Jakub Kicinski Subject: [PATCH 5.19 122/365] mlx5: do not use RT_TOS for IPv6 flowlabel Date: Tue, 23 Aug 2022 10:00:23 +0200 Message-Id: <20220823080123.293782169@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matthias May commit bcb0da7fffee9464073998b267ce5543da2356d2 upstream. According to Guillaume Nault RT_TOS should never be used for IPv6. Quote: RT_TOS() is an old macro used to interprete IPv4 TOS as described in the obsolete RFC 1349. It's conceptually wrong to use it even in IPv4 code, although, given the current state of the code, most of the existing calls have no consequence. But using RT_TOS() in IPv6 code is always a bug: IPv6 never had a "TOS" field to be interpreted the RFC 1349 way. There's no historical compatibility to worry about. Fixes: ce99f6b97fcd ("net/mlx5e: Support SRIOV TC encapsulation offloads fo= r IPv6 tunnels") Acked-by: Guillaume Nault Signed-off-by: Matthias May Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c @@ -506,7 +506,7 @@ int mlx5e_tc_tun_create_header_ipv6(stru int err; =20 attr.ttl =3D tun_key->ttl; - attr.fl.fl6.flowlabel =3D ip6_make_flowinfo(RT_TOS(tun_key->tos), tun_key= ->label); + attr.fl.fl6.flowlabel =3D ip6_make_flowinfo(tun_key->tos, tun_key->label); attr.fl.fl6.daddr =3D tun_key->u.ipv6.dst; attr.fl.fl6.saddr =3D tun_key->u.ipv6.src; =20 @@ -620,7 +620,7 @@ int mlx5e_tc_tun_update_header_ipv6(stru =20 attr.ttl =3D tun_key->ttl; =20 - attr.fl.fl6.flowlabel =3D ip6_make_flowinfo(RT_TOS(tun_key->tos), tun_key= ->label); + attr.fl.fl6.flowlabel =3D ip6_make_flowinfo(tun_key->tos, tun_key->label); attr.fl.fl6.daddr =3D tun_key->u.ipv6.dst; attr.fl.fl6.saddr =3D tun_key->u.ipv6.src; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DDA4C32772 for ; Tue, 23 Aug 2022 08:33:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244685AbiHWIdt (ORCPT ); Tue, 23 Aug 2022 04:33:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343753AbiHWIbR (ORCPT ); Tue, 23 Aug 2022 04:31:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2817074E2F; Tue, 23 Aug 2022 01:15:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 01B9F6129A; Tue, 23 Aug 2022 08:14:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0070CC433C1; Tue, 23 Aug 2022 08:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242493; bh=Rfq4sGxkv7PUq84xlx59lHyoBQyqRqYH7SkfBniubrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u7uVWiKy3VeDe/1qpGMsUob6025P/vx3FEJ97U6u9uElFnHjrXdoItC7K5Slkvwgc rsCrqopN5YYosjq1hP20fPDhPWVnlwEAVJuYHcvkor1EEveIrTxnKpOZcIQtiNALoB WOJ9IEWMAwK8Ftp+9QhSTlNxsvoLxOmN3/8jyzkE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Matthias May , Jakub Kicinski Subject: [PATCH 5.19 123/365] ipv6: do not use RT_TOS for IPv6 flowlabel Date: Tue, 23 Aug 2022 10:00:24 +0200 Message-Id: <20220823080123.340298617@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matthias May commit ab7e2e0dfa5d37540ab1dc5376e9a2cb9188925d upstream. According to Guillaume Nault RT_TOS should never be used for IPv6. Quote: RT_TOS() is an old macro used to interprete IPv4 TOS as described in the obsolete RFC 1349. It's conceptually wrong to use it even in IPv4 code, although, given the current state of the code, most of the existing calls have no consequence. But using RT_TOS() in IPv6 code is always a bug: IPv6 never had a "TOS" field to be interpreted the RFC 1349 way. There's no historical compatibility to worry about. Fixes: 571912c69f0e ("net: UDP tunnel encapsulation module for tunnelling d= ifferent protocols like MPLS, IP, NSH etc.") Acked-by: Guillaume Nault Signed-off-by: Matthias May Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/ipv6/ip6_output.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1311,8 +1311,7 @@ struct dst_entry *ip6_dst_lookup_tunnel( fl6.daddr =3D info->key.u.ipv6.dst; fl6.saddr =3D info->key.u.ipv6.src; prio =3D info->key.tos; - fl6.flowlabel =3D ip6_make_flowinfo(RT_TOS(prio), - info->key.label); + fl6.flowlabel =3D ip6_make_flowinfo(prio, info->key.label); =20 dst =3D ipv6_stub->ipv6_dst_lookup_flow(net, sock->sk, &fl6, NULL); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95A7AC32772 for ; Tue, 23 Aug 2022 08:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240871AbiHWIeN (ORCPT ); Tue, 23 Aug 2022 04:34:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345953AbiHWIbq (ORCPT ); Tue, 23 Aug 2022 04:31:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AC596D57A; Tue, 23 Aug 2022 01:15:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 197B3B81C3A; Tue, 23 Aug 2022 08:15:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69446C433C1; Tue, 23 Aug 2022 08:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242499; bh=5b2KOXIlNhpiLODn1vjNTLwHdqHZGoh1tLrygHJOIf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wdxsxFElTIHKhg1c32bLtBKgraBjKwTE8a2guwHLve+0RtCLx5OjmDMtmkFYunXXn HYvbzIdEuNKY06xqIy0vweXIL7uyH7Vz8TXGjYiOcpFm38afWuL6Deo23CUASN52d2 mPDO413U5w9KwnOvAwhwJ7ZW9p7Qy7Nig+O7xUDU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Florian Westphal , Jakub Kicinski Subject: [PATCH 5.19 124/365] plip: avoid rcu debug splat Date: Tue, 23 Aug 2022 10:00:25 +0200 Message-Id: <20220823080123.378364257@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit bc3c8fe3c79bcdae4d90e3726054fac5cca8ac32 upstream. WARNING: suspicious RCU usage 5.2.0-rc2-00605-g2638eb8b50cfc #1 Not tainted drivers/net/plip/plip.c:1110 suspicious rcu_dereference_check() usage! plip_open is called with RTNL held, switch to the correct helper. Fixes: 2638eb8b50cf ("net: ipv4: provide __rcu annotation for ifa_list") Reported-by: kernel test robot Signed-off-by: Florian Westphal Link: https://lore.kernel.org/r/20220807115304.13257-1-fw@strlen.de Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/plip/plip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/plip/plip.c +++ b/drivers/net/plip/plip.c @@ -1111,7 +1111,7 @@ plip_open(struct net_device *dev) /* Any address will do - we take the first. We already have the first two bytes filled with 0xfc, from plip_init_dev(). */ - const struct in_ifaddr *ifa =3D rcu_dereference(in_dev->ifa_list); + const struct in_ifaddr *ifa =3D rtnl_dereference(in_dev->ifa_list); if (ifa !=3D NULL) { dev_addr_mod(dev, 2, &ifa->ifa_local, 4); } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E91C2C32774 for ; Tue, 23 Aug 2022 08:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244240AbiHWIdd (ORCPT ); Tue, 23 Aug 2022 04:33:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245500AbiHWIbG (ORCPT ); Tue, 23 Aug 2022 04:31:06 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3E9575383; Tue, 23 Aug 2022 01:15:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 7074ECE1B37; Tue, 23 Aug 2022 08:15:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A7D9C433D6; Tue, 23 Aug 2022 08:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242505; bh=V2tD/FU6SUhbbyIUilduP1Sj7dQKZMB2lIwzlx3vz6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jBr3aPFVnItpWwWeW75u8IJSJCwgUPi62/ty6dIcOM8xWxoZ7D6AWbLdz3DWJAkPd k9fRVvUYqvp3VOm9iyBJ/Ele/vgxmAlddeqizh8Ag65ObYxUTBTf60RheFjcFGhOsF S2zV4vO9i4TBDXiSfgB0CIrFdi7LmoDKgrAPPSBM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefano Garzarella , Peilin Ye , "David S. Miller" , syzbot+b03f55bf128f9a38f064@syzkaller.appspotmail.com Subject: [PATCH 5.19 125/365] vsock: Fix memory leak in vsock_connect() Date: Tue, 23 Aug 2022 10:00:26 +0200 Message-Id: <20220823080123.412152002@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peilin Ye commit 7e97cfed9929eaabc41829c395eb0d1350fccb9d upstream. An O_NONBLOCK vsock_connect() request may try to reschedule @connect_work. Imagine the following sequence of vsock_connect() requests: 1. The 1st, non-blocking request schedules @connect_work, which will expire after 200 jiffies. Socket state is now SS_CONNECTING; 2. Later, the 2nd, blocking request gets interrupted by a signal after a few jiffies while waiting for the connection to be established. Socket state is back to SS_UNCONNECTED, but @connect_work is still pending, and will expire after 100 jiffies. 3. Now, the 3rd, non-blocking request tries to schedule @connect_work again. Since @connect_work is already scheduled, schedule_delayed_work() silently returns. sock_hold() is called twice, but sock_put() will only be called once in vsock_connect_timeout(), causing a memory leak reported by syzbot: BUG: memory leak unreferenced object 0xffff88810ea56a40 (size 1232): comm "syz-executor756", pid 3604, jiffies 4294947681 (age 12.350s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 28 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00 (..@............ backtrace: [] sk_prot_alloc+0x3e/0x1b0 net/core/sock.c:1930 [] sk_alloc+0x32/0x2e0 net/core/sock.c:1989 [] __vsock_create.constprop.0+0x38/0x320 net/vmw_vs= ock/af_vsock.c:734 [] vsock_create+0xc1/0x2d0 net/vmw_vsock/af_vsock.c= :2203 [] __sock_create+0x1ab/0x2b0 net/socket.c:1468 [] sock_create net/socket.c:1519 [inline] [] __sys_socket+0x6f/0x140 net/socket.c:1561 [] __do_sys_socket net/socket.c:1570 [inline] [] __se_sys_socket net/socket.c:1568 [inline] [] __x64_sys_socket+0x1a/0x20 net/socket.c:1568 [] do_syscall_x64 arch/x86/entry/common.c:50 [inlin= e] [] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:= 80 [] entry_SYSCALL_64_after_hwframe+0x44/0xae <...> Use mod_delayed_work() instead: if @connect_work is already scheduled, reschedule it, and undo sock_hold() to keep the reference count balanced. Reported-and-tested-by: syzbot+b03f55bf128f9a38f064@syzkaller.appspotmail.c= om Fixes: d021c344051a ("VSOCK: Introduce VM Sockets") Co-developed-by: Stefano Garzarella Signed-off-by: Stefano Garzarella Reviewed-by: Stefano Garzarella Signed-off-by: Peilin Ye Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/vmw_vsock/af_vsock.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -1391,7 +1391,14 @@ static int vsock_connect(struct socket * * timeout fires. */ sock_hold(sk); - schedule_delayed_work(&vsk->connect_work, timeout); + + /* If the timeout function is already scheduled, + * reschedule it, then ungrab the socket refcount to + * keep it balanced. + */ + if (mod_delayed_work(system_wq, &vsk->connect_work, + timeout)) + sock_put(sk); =20 /* Skip ahead to preserve error code set above. */ goto out_wait; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B494C32792 for ; Tue, 23 Aug 2022 08:33:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244570AbiHWIdo (ORCPT ); Tue, 23 Aug 2022 04:33:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344157AbiHWIb0 (ORCPT ); Tue, 23 Aug 2022 04:31:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1ECE66A44; Tue, 23 Aug 2022 01:15:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 12427B81C4A; Tue, 23 Aug 2022 08:15:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59313C433D7; Tue, 23 Aug 2022 08:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242511; bh=cxO9xjSZDQUeRiS2q8YwS5yaRpm8BDG2uREKH4M2LC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BOl5aDxmKnhfEgx+g6BftKBNGjq1I0dv15XdmpRTqKGtmFC3ggoJ8MKScZ+gcCGYT KEKRD5UhD19Nkt2XIxNwEA8DI+EDPNq7FpYLxLfawweZms7AGDLN6Mbwkfzo+I01nv E0kiKPgqsqjCfOnOW/qPWLyscGbmPdr2Lo7cq0U8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefano Garzarella , Peilin Ye , "David S. Miller" Subject: [PATCH 5.19 126/365] vsock: Set socket state back to SS_UNCONNECTED in vsock_connect_timeout() Date: Tue, 23 Aug 2022 10:00:27 +0200 Message-Id: <20220823080123.460404019@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peilin Ye commit a3e7b29e30854ed67be0d17687e744ad0c769c4b upstream. Imagine two non-blocking vsock_connect() requests on the same socket. The first request schedules @connect_work, and after it times out, vsock_connect_timeout() sets *sock* state back to TCP_CLOSE, but keeps *socket* state as SS_CONNECTING. Later, the second request returns -EALREADY, meaning the socket "already has a pending connection in progress", even though the first request has already timed out. As suggested by Stefano, fix it by setting *socket* state back to SS_UNCONNECTED, so that the second request will return -ETIMEDOUT. Suggested-by: Stefano Garzarella Fixes: d021c344051a ("VSOCK: Introduce VM Sockets") Reviewed-by: Stefano Garzarella Signed-off-by: Peilin Ye Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/vmw_vsock/af_vsock.c | 1 + 1 file changed, 1 insertion(+) --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -1286,6 +1286,7 @@ static void vsock_connect_timeout(struct if (sk->sk_state =3D=3D TCP_SYN_SENT && (sk->sk_shutdown !=3D SHUTDOWN_MASK)) { sk->sk_state =3D TCP_CLOSE; + sk->sk_socket->state =3D SS_UNCONNECTED; sk->sk_err =3D ETIMEDOUT; sk_error_report(sk); vsock_transport_cancel_pkt(vsk); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66451C32772 for ; Tue, 23 Aug 2022 08:34:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245087AbiHWIeG (ORCPT ); Tue, 23 Aug 2022 04:34:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345836AbiHWIbp (ORCPT ); Tue, 23 Aug 2022 04:31:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C5156DACA; Tue, 23 Aug 2022 01:16:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4282B61257; Tue, 23 Aug 2022 08:15:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E70BC433C1; Tue, 23 Aug 2022 08:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242520; bh=PX1rVlTP9XiSlxzx1tlMrdNJnm5AgcQTAqpO/vplSCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FEHJdSNwQ1hcam0ucJ9UJpedtTZeVyV96xas8+lKfK0LMuQLa+HFv1X5cAmCzqnHZ oPeKjdptcn9vwN3ZVzR3OV2DXq7llpXzYZ4ZEFHADFsL6WT0PbtvrbHEJpdC2aI5wW /liN4d7q+cPfFmvab6GQ2JBuGgBbzn59bhArvr1E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Simek , Linus Walleij , Rob Herring , Michal Simek Subject: [PATCH 5.19 127/365] dt-bindings: gpio: zynq: Add missing compatible strings Date: Tue, 23 Aug 2022 10:00:28 +0200 Message-Id: <20220823080123.499639601@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Simek commit 7668048e5c697a9493ffc0e6001c322b2efe90ae upstream. "xlnx,zynqmp-gpio-1.0", "xlnx,versal-gpio-1.0" and "xlnx,pmc-gpio-1.0" compatible strings were not moved to yaml format. But they were in origin text file. Fixes: 45ca16072b70 ("dt-bindings: gpio: zynq: convert bindings to YAML") Signed-off-by: Michal Simek Reviewed-by: Linus Walleij Acked-by: Rob Herring Link: https://lore.kernel.org/r/72c973da5670b5ae81d050c582948894ee4174f8.16= 34206453.git.michal.simek@xilinx.com Signed-off-by: Michal Simek Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/gpio/gpio-zynq.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/Documentation/devicetree/bindings/gpio/gpio-zynq.yaml +++ b/Documentation/devicetree/bindings/gpio/gpio-zynq.yaml @@ -11,7 +11,11 @@ maintainers: =20 properties: compatible: - const: xlnx,zynq-gpio-1.0 + enum: + - xlnx,zynq-gpio-1.0 + - xlnx,zynqmp-gpio-1.0 + - xlnx,versal-gpio-1.0 + - xlnx,pmc-gpio-1.0 =20 reg: maxItems: 1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00965C32792 for ; Tue, 23 Aug 2022 09:00:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241143AbiHWJAF (ORCPT ); Tue, 23 Aug 2022 05:00:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242738AbiHWI7e (ORCPT ); Tue, 23 Aug 2022 04:59:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F08481695; Tue, 23 Aug 2022 01:27:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5E93761257; Tue, 23 Aug 2022 08:18:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54FFBC433C1; Tue, 23 Aug 2022 08:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242691; bh=xe8Uq66NVrhkE+7JA/3WsA5acKqjJEYJNQKoATvDWGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zi4LR1VGx87R70o3De9mvGIvwQ86SRktMXEDXdKNGKid6Qf2f49YUFkpKrptHtXOb GRPb4vJGqC/2lejLcBFJLIEMYSLpfwuSyvXHjpNcvzu5h5VEpWCPNjWlnJzfaJABCD 7FdWNN5CQdH/GBuJn8SyTs5LFcYa74eskqiCoK6k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Rob Herring , Stephan Gerhold , Bjorn Andersson Subject: [PATCH 5.19 128/365] dt-bindings: arm: qcom: fix Longcheer L8150 compatibles Date: Tue, 23 Aug 2022 10:00:29 +0200 Message-Id: <20220823080123.538422696@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski commit 25d203d0751ca191301bc578ba5d59fa401f1fbf upstream. The MSM8916 Longcheer L8150 uses a fallback in compatible: msm8916-longcheer-l8150.dtb: /: compatible: 'oneOf' conditional failed, o= ne must be fixed: ['longcheer,l8150', 'qcom,msm8916-v1-qrd/9-v1', 'qcom,msm8916'] is too = long Fixes: b72160fa886d ("dt-bindings: qcom: Document bindings for new MSM8916 = devices") Signed-off-by: Krzysztof Kozlowski Acked-by: Rob Herring Reviewed-by: Stephan Gerhold Link: https://lore.kernel.org/r/20220520123252.365762-2-krzysztof.kozlowski= @linaro.org Signed-off-by: Bjorn Andersson Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/arm/qcom.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/Documentation/devicetree/bindings/arm/qcom.yaml +++ b/Documentation/devicetree/bindings/arm/qcom.yaml @@ -160,12 +160,16 @@ properties: - items: - enum: - alcatel,idol347 - - longcheer,l8150 - samsung,a3u-eur - samsung,a5u-eur - const: qcom,msm8916 =20 - items: + - const: longcheer,l8150 + - const: qcom,msm8916-v1-qrd/9-v1 + - const: qcom,msm8916 + + - items: - enum: - sony,karin_windy - sony,karin-row From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FB4EC32772 for ; Tue, 23 Aug 2022 08:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245015AbiHWId6 (ORCPT ); Tue, 23 Aug 2022 04:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345867AbiHWIbp (ORCPT ); Tue, 23 Aug 2022 04:31:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D7456DAF3; Tue, 23 Aug 2022 01:16:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6AAC4B81C3D; Tue, 23 Aug 2022 08:15:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABD39C433C1; Tue, 23 Aug 2022 08:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242539; bh=zk2dULJ+W4QawmqQd7hzcR/l8fhxjz2Y6CWAsUSiqL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZbTLSWsRsKQ912QC09csIO2mpT7vHpubYOpjsNijMDSFFQy1q+5bm0OvTvwYz2UfI bsD6DfdLlRK4QybLTAZmBhzADDttlOJW71OdGm+yjIk2xdMCVLBaLYqcINJQk/3pKn HqOXxBVwlL/ZpEzldnMBZI2xezxeOBZI39OqqmvQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Rob Herring , Bjorn Andersson Subject: [PATCH 5.19 129/365] dt-bindings: arm: qcom: fix MSM8916 MTP compatibles Date: Tue, 23 Aug 2022 10:00:30 +0200 Message-Id: <20220823080123.582193751@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski commit bb35fe1efbae4114bd288fae0f56070f563adcfc upstream. The order of compatibles for MSM8916 MTP board is different: msm8916-mtp.dtb: /: compatible: 'oneOf' conditional failed, one must be f= ixed: ['qcom,msm8916-mtp', 'qcom,msm8916-mtp/1', 'qcom,msm8916'] is too long Fixes: 9d3ef77fe568 ("dt-bindings: arm: Convert QCom board/soc bindings to = json-schema") Signed-off-by: Krzysztof Kozlowski Acked-by: Rob Herring Link: https://lore.kernel.org/r/20220520123252.365762-3-krzysztof.kozlowski= @linaro.org Signed-off-by: Bjorn Andersson Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/arm/qcom.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/Documentation/devicetree/bindings/arm/qcom.yaml +++ b/Documentation/devicetree/bindings/arm/qcom.yaml @@ -153,8 +153,8 @@ properties: - const: qcom,msm8974 =20 - items: - - const: qcom,msm8916-mtp/1 - const: qcom,msm8916-mtp + - const: qcom,msm8916-mtp/1 - const: qcom,msm8916 =20 - items: From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88939C32792 for ; Tue, 23 Aug 2022 08:37:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244219AbiHWIhB (ORCPT ); Tue, 23 Aug 2022 04:37:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244287AbiHWIde (ORCPT ); Tue, 23 Aug 2022 04:33:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C50B067C91; Tue, 23 Aug 2022 01:16:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D97CDB81C3E; Tue, 23 Aug 2022 08:16:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E8E4C433C1; Tue, 23 Aug 2022 08:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242572; bh=zaPYx1qAP/nUxRrxTuez+HrXGL97eJXktPJNjE8RN2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xiXon9YsqtPGq7NnYY7L24QGD2N3Baj8RpFkqMQSlO7rejEXelNdn/iNefBNH6/i9 gt4oBLk10AM/Tmi+sWx8vVzODRc7kiVYIINkFmd5rcICTJnDUxQ+5punhNDpeHIf1B 60gaNgPGc6sPh+hcahYy3RjVZ0wSCZLIoE92y300= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Rob Herring , Bjorn Andersson Subject: [PATCH 5.19 130/365] dt-bindings: arm: qcom: fix MSM8994 boards compatibles Date: Tue, 23 Aug 2022 10:00:31 +0200 Message-Id: <20220823080123.624388026@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski commit c704bd373f58a84193eebe40bd271d6b73c138b0 upstream. The compatibles for APQ8094/MSM8994 boards are different than specified in bindings. None of them use fallback to other SoC variant. Fixes: 9ad3c08f6f1b ("dt-bindings: arm: qcom: Document sony boards for apq8= 094") Signed-off-by: Krzysztof Kozlowski Acked-by: Rob Herring Link: https://lore.kernel.org/r/20220520123252.365762-4-krzysztof.kozlowski= @linaro.org Signed-off-by: Bjorn Andersson Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/arm/qcom.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/Documentation/devicetree/bindings/arm/qcom.yaml +++ b/Documentation/devicetree/bindings/arm/qcom.yaml @@ -172,12 +172,15 @@ properties: - items: - enum: - sony,karin_windy + - const: qcom,apq8094 + + - items: + - enum: - sony,karin-row - sony,satsuki-row - sony,sumire-row - sony,suzuran-row - - qcom,msm8994 - - const: qcom,apq8094 + - const: qcom,msm8994 =20 - items: - enum: From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81FFEC32772 for ; Tue, 23 Aug 2022 08:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343549AbiHWIi2 (ORCPT ); Tue, 23 Aug 2022 04:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347785AbiHWIgr (ORCPT ); Tue, 23 Aug 2022 04:36:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A2C876752; Tue, 23 Aug 2022 01:17:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 22BAD61257; Tue, 23 Aug 2022 08:17:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28E8FC433D7; Tue, 23 Aug 2022 08:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242639; bh=/8UyoVEL/6prq7euy3iXui/QYxwtGVXrnVvgQbV3Lk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hxlAUA+Ov/Lu93r9VF9S1wh2smigquzLSH8+mx2JQHfIGDYeVlhvr058EZdDoHSff WKa8KGaB80xID0OE5Ccd2Unt5W9pCJQNsc8wt2wTrC07HF2g/gN+OTEs68D/CLWlDi UPn2Y5/lEK5JZ1ZEhXYLGvhS6kVTUOkTgi2wRr9s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Krzysztof Kozlowski , Bjorn Andersson Subject: [PATCH 5.19 131/365] dt-bindings: clock: qcom,gcc-msm8996: add more GCC clock sources Date: Tue, 23 Aug 2022 10:00:32 +0200 Message-Id: <20220823080123.671733279@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Baryshkov commit 2b4e75a7a7c8d3531a40ebb103b92f88ff693f79 upstream. Add additional GCC clock sources. This includes PCIe and USB PIPE and UFS symbol clocks. Fixes: 2a8aa18c1131 ("dt-bindings: clk: qcom: Fix self-validation, split, a= nd clean cruft") Signed-off-by: Dmitry Baryshkov Reviewed-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220620071936.1558906-2-dmitry.baryshkov@l= inaro.org Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/clock/qcom,gcc-msm8996.yaml | 16 +++++= +++++ 1 file changed, 16 insertions(+) --- a/Documentation/devicetree/bindings/clock/qcom,gcc-msm8996.yaml +++ b/Documentation/devicetree/bindings/clock/qcom,gcc-msm8996.yaml @@ -22,16 +22,32 @@ properties: const: qcom,gcc-msm8996 =20 clocks: + minItems: 3 items: - description: XO source - description: Second XO source - description: Sleep clock source + - description: PCIe 0 PIPE clock (optional) + - description: PCIe 1 PIPE clock (optional) + - description: PCIe 2 PIPE clock (optional) + - description: USB3 PIPE clock (optional) + - description: UFS RX symbol 0 clock (optional) + - description: UFS RX symbol 1 clock (optional) + - description: UFS TX symbol 0 clock (optional) =20 clock-names: + minItems: 3 items: - const: cxo - const: cxo2 - const: sleep_clk + - const: pcie_0_pipe_clk_src + - const: pcie_1_pipe_clk_src + - const: pcie_2_pipe_clk_src + - const: usb3_phy_pipe_clk_src + - const: ufs_rx_symbol_0_clk_src + - const: ufs_rx_symbol_1_clk_src + - const: ufs_tx_symbol_0_clk_src =20 '#clock-cells': const: 1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7628C32774 for ; Tue, 23 Aug 2022 08:42:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235429AbiHWImV (ORCPT ); Tue, 23 Aug 2022 04:42:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346862AbiHWIke (ORCPT ); Tue, 23 Aug 2022 04:40:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D17162F2; Tue, 23 Aug 2022 01:19:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AAC28B81C3B; Tue, 23 Aug 2022 08:18:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F699C433C1; Tue, 23 Aug 2022 08:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242679; bh=kW2S8xCrLDEx2d8pxNykwfLvUvyQbrQDVm4ZPgPweHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yc+gwZdt2srALXZxD513z3JOpNi5ETG5/YBlLpcZ0uvIypCb+CzXEAtPPfbZE1o2N QfJytlR+GVj9Tp1F+dPN2lVaLHyNUoSu855O8KxwBtE5yG7819hvF6NcOVEXmdYR7A tIjjMXUeoL5/yjoQQMg0Pp4uMu2TymdnfEaIarww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Bjorn Helgaas , Manivannan Sadhasivam , Dmitry Baryshkov , Krzysztof Kozlowski Subject: [PATCH 5.19 132/365] dt-bindings: PCI: qcom: Fix reset conditional Date: Tue, 23 Aug 2022 10:00:33 +0200 Message-Id: <20220823080123.717948488@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit 839fbdee4c080eb95567cbcf6366072a56d3a3cc upstream. Fix the reset conditional which always evaluated to true due to a misspelled property name ("compatibles" in plural). Fixes: 6700a9b00f0a ("dt-bindings: PCI: qcom: Do not require resets on msm8= 996 platforms") Link: https://lore.kernel.org/r/20220629141000.18111-2-johan+linaro@kernel.= org Signed-off-by: Johan Hovold Signed-off-by: Bjorn Helgaas Reviewed-by: Manivannan Sadhasivam Reviewed-by: Dmitry Baryshkov Acked-by: Krzysztof Kozlowski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/pci/qcom,pcie.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.yaml b/Documen= tation/devicetree/bindings/pci/qcom,pcie.yaml index c40ba753707c..92402f1d3fda 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.yaml +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.yaml @@ -614,7 +614,7 @@ allOf: - if: not: properties: - compatibles: + compatible: contains: enum: - qcom,pcie-msm8996 --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EEB7C32772 for ; Tue, 23 Aug 2022 08:43:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346943AbiHWIm6 (ORCPT ); Tue, 23 Aug 2022 04:42:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347040AbiHWIkh (ORCPT ); Tue, 23 Aug 2022 04:40:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6818778235; Tue, 23 Aug 2022 01:19:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 26051B81C3D; Tue, 23 Aug 2022 08:18:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 658F3C433D7; Tue, 23 Aug 2022 08:18:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242685; bh=/carbxVV3VvTz4u1LFowtEwvPwCtkus8sQIzpgS3zJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=doDimdvGBft8EOv7hceLZuzNlDEPajNzr2uEwvc9O2xm5mAre/gAmOFBPNnfNWpoX fsRGHT5Fx8L5s5FblfOq+iCOIGvtpjHSNqjgUx73zhstyBY7NahIaYBiO0mCI6D4Yy fJ0BZDIUjTgKaPq84Jh6qSTtiRJ8R6BB67VgILn4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Michal Simek , Mark Brown Subject: [PATCH 5.19 133/365] spi: dt-bindings: cadence: add missing required Date: Tue, 23 Aug 2022 10:00:34 +0200 Message-Id: <20220823080123.753330405@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski commit 6eee27c598fde65988723b785a9c9192d5ffb93a upstream. During the conversion the bindings lost list of required properties. Fixes: aa7968682a2b ("spi: convert Cadence SPI bindings to YAML") Signed-off-by: Krzysztof Kozlowski Reviewed-by: Michal Simek Link: https://lore.kernel.org/r/20220704130618.199231-1-krzysztof.kozlowski= @linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/spi/spi-cadence.yaml | 7 +++++++ 1 file changed, 7 insertions(+) --- a/Documentation/devicetree/bindings/spi/spi-cadence.yaml +++ b/Documentation/devicetree/bindings/spi/spi-cadence.yaml @@ -49,6 +49,13 @@ properties: enum: [ 0, 1 ] default: 0 =20 +required: + - compatible + - reg + - interrupts + - clock-names + - clocks + unevaluatedProperties: false =20 examples: From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D18EC32772 for ; Tue, 23 Aug 2022 08:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245349AbiHWIe3 (ORCPT ); Tue, 23 Aug 2022 04:34:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346222AbiHWIbv (ORCPT ); Tue, 23 Aug 2022 04:31:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D19F6DAE6; Tue, 23 Aug 2022 01:16:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F5156131B; Tue, 23 Aug 2022 08:15:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CF5CC433D7; Tue, 23 Aug 2022 08:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242542; bh=gZYsygsulZRaUQQNEd00HqGuo0mFJXCegFja3ncqvFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P/gk+O7OZnAaPfQkWaflVw2D19xkpj8RYMw+7VfzjYNF7OzenTFNsWhsnpd3vn1dq W5PwTBxECRfZ00/k6eA53DQMTs5d/+R7hA+5rFcUXzfFAmcWgxsCx2LsVEFuA2DwDV hHYcR140WsY1h0ap26qT8eTKUWkQLFl7UgzmFtQE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Michal Simek , Mark Brown Subject: [PATCH 5.19 134/365] spi: dt-bindings: zynqmp-qspi: add missing required Date: Tue, 23 Aug 2022 10:00:35 +0200 Message-Id: <20220823080123.797522157@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski commit acfc34f008c3e66bbcb7b9162c80c8327b6e800f upstream. During the conversion the bindings lost list of required properties. Fixes: c58db2abb19f ("spi: convert Xilinx Zynq UltraScale+ MPSoC GQSPI bind= ings to YAML") Signed-off-by: Krzysztof Kozlowski Reviewed-by: Michal Simek Link: https://lore.kernel.org/r/20220704130618.199231-2-krzysztof.kozlowski= @linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml | 7 +++++++ 1 file changed, 7 insertions(+) --- a/Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml +++ b/Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml @@ -30,6 +30,13 @@ properties: clocks: maxItems: 2 =20 +required: + - compatible + - reg + - interrupts + - clock-names + - clocks + unevaluatedProperties: false =20 examples: From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC703C32793 for ; Tue, 23 Aug 2022 08:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345500AbiHWIfp (ORCPT ); Tue, 23 Aug 2022 04:35:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344319AbiHWIcY (ORCPT ); Tue, 23 Aug 2022 04:32:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C50167175; Tue, 23 Aug 2022 01:16:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A26361228; Tue, 23 Aug 2022 08:15:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86DBEC433D6; Tue, 23 Aug 2022 08:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242547; bh=NoLqcpS0ng+Lbg3o1rbtMkbo2kGPL0fu1NrGMr0k/Mk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OGSg/mWYz5OgZM1cBgjQF9rXh2JteRQrGUL9euce9MfVQcJ7TnKTMWWyCx5B5sqA3 dk5toUCpO/rjIkscaVTsDJEXCwC7F6RiYl20Lci3ofQPrUg1uleP8J1na1QQx1IGKC +M3x7LyLCNHIl2KQa/tatee6HMNP23T+aFGoYHco= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Viresh Kumar Subject: [PATCH 5.19 135/365] dt-bindings: opp: opp-v2-kryo-cpu: Fix example binding checks Date: Tue, 23 Aug 2022 10:00:36 +0200 Message-Id: <20220823080123.850327587@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bryan O'Donoghue commit 3b4916a6e422394aa129fe9b204f4d489ae484a6 upstream. Adding missing compat entries to the cpufreq node Documentation/devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml shows up a dt_binding_check in this file. opp-v2-kryo-cpu.example.dtb: /: cpus:cpu@0: 'power-domains' is a required p= roperty opp-v2-kryo-cpu.example.dtb: /: cpus:cpu@0: 'power-domain-names' is a requi= red property opp-v2-kryo-cpu.example.dtb: /: opp-table-0:opp-307200000: 'required-opps' = is a required property Fixes: ec24d1d55469 ("dt-bindings: opp: Convert qcom-nvmem-cpufreq to DT sc= hema") Signed-off-by: Bryan O'Donoghue Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- .../devicetree/bindings/opp/opp-v2-kryo-cpu.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml b/D= ocumentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml index 30f7b596d609..59663e897dae 100644 --- a/Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml +++ b/Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml @@ -98,6 +98,8 @@ examples: capacity-dmips-mhz =3D <1024>; clocks =3D <&kryocc 0>; operating-points-v2 =3D <&cluster0_opp>; + power-domains =3D <&cpr>; + power-domain-names =3D "cpr"; #cooling-cells =3D <2>; next-level-cache =3D <&L2_0>; L2_0: l2-cache { @@ -115,6 +117,8 @@ examples: capacity-dmips-mhz =3D <1024>; clocks =3D <&kryocc 0>; operating-points-v2 =3D <&cluster0_opp>; + power-domains =3D <&cpr>; + power-domain-names =3D "cpr"; #cooling-cells =3D <2>; next-level-cache =3D <&L2_0>; }; @@ -128,6 +132,8 @@ examples: capacity-dmips-mhz =3D <1024>; clocks =3D <&kryocc 1>; operating-points-v2 =3D <&cluster1_opp>; + power-domains =3D <&cpr>; + power-domain-names =3D "cpr"; #cooling-cells =3D <2>; next-level-cache =3D <&L2_1>; L2_1: l2-cache { @@ -145,6 +151,8 @@ examples: capacity-dmips-mhz =3D <1024>; clocks =3D <&kryocc 1>; operating-points-v2 =3D <&cluster1_opp>; + power-domains =3D <&cpr>; + power-domain-names =3D "cpr"; #cooling-cells =3D <2>; next-level-cache =3D <&L2_1>; }; @@ -182,18 +190,21 @@ examples: opp-microvolt =3D <905000 905000 1140000>; opp-supported-hw =3D <0x7>; clock-latency-ns =3D <200000>; + required-opps =3D <&cpr_opp1>; }; opp-1401600000 { opp-hz =3D /bits/ 64 <1401600000>; opp-microvolt =3D <1140000 905000 1140000>; opp-supported-hw =3D <0x5>; clock-latency-ns =3D <200000>; + required-opps =3D <&cpr_opp2>; }; opp-1593600000 { opp-hz =3D /bits/ 64 <1593600000>; opp-microvolt =3D <1140000 905000 1140000>; opp-supported-hw =3D <0x1>; clock-latency-ns =3D <200000>; + required-opps =3D <&cpr_opp3>; }; }; =20 @@ -207,24 +218,28 @@ examples: opp-microvolt =3D <905000 905000 1140000>; opp-supported-hw =3D <0x7>; clock-latency-ns =3D <200000>; + required-opps =3D <&cpr_opp1>; }; opp-1804800000 { opp-hz =3D /bits/ 64 <1804800000>; opp-microvolt =3D <1140000 905000 1140000>; opp-supported-hw =3D <0x6>; clock-latency-ns =3D <200000>; + required-opps =3D <&cpr_opp4>; }; opp-1900800000 { opp-hz =3D /bits/ 64 <1900800000>; opp-microvolt =3D <1140000 905000 1140000>; opp-supported-hw =3D <0x4>; clock-latency-ns =3D <200000>; + required-opps =3D <&cpr_opp5>; }; opp-2150400000 { opp-hz =3D /bits/ 64 <2150400000>; opp-microvolt =3D <1140000 905000 1140000>; opp-supported-hw =3D <0x1>; clock-latency-ns =3D <200000>; + required-opps =3D <&cpr_opp6>; }; }; =20 --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48815C32774 for ; Tue, 23 Aug 2022 08:35:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243948AbiHWIfF (ORCPT ); Tue, 23 Aug 2022 04:35:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346713AbiHWIcB (ORCPT ); Tue, 23 Aug 2022 04:32:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6256974E24; Tue, 23 Aug 2022 01:16:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D1673B81C26; Tue, 23 Aug 2022 08:15:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C641C433C1; Tue, 23 Aug 2022 08:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242553; bh=wMfmtxxz9zvJ7nqIQOgkriWDmiFeSoXT5t0MUPSakxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u78JXLQpM1s88kEZWZpAkKT8KWAj2rYJwGf3rsjHxHtUaUxTGa8KZB/rQhRZBvRVP cDAvJLjC74kdiFn6bSPGgzl37Q4XQ6qPUhLRrJNwhN9lLVeO2klUrqn9llyQ1v6i5a Ht5QfETeNNgCLyYEFbtVeeDa3fHh8JVQRa4Mf0Wk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Rob Herring , Mark Brown Subject: [PATCH 5.19 136/365] spi: dt-bindings: qcom,spi-geni-qcom: allow three interconnects Date: Tue, 23 Aug 2022 10:00:37 +0200 Message-Id: <20220823080123.893483715@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski commit ee912312db5a5e877120b9f519a034fc34315c9b upstream. Recent Qualcomm Geni SPI nodes, e.g. on SM8450, come also with three interconnects. This fixes dtbs_check warnings like: sm8450-qrd.dtb: spi@a98000: interconnects: [[46, 1, 0, 46, 4, 0], [47, 2,= 0, 48, 12, 0], [49, 1, 0, 50, 1, 0]] is too long sm8450-qrd.dtb: spi@a98000: interconnect-names: ['qup-core', 'qup-config'= , 'qup-memory'] is too long Fixes: 5bdcae1fe1c5 ("spi: dt-bindings: qcom,spi-geni-qcom: convert to dtsc= hema") Signed-off-by: Krzysztof Kozlowski Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20220720163841.7283-1-krzysztof.kozlowski@l= inaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- .../devicetree/bindings/spi/qcom,spi-geni-qcom.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/qcom,spi-geni-qcom.yaml = b/Documentation/devicetree/bindings/spi/qcom,spi-geni-qcom.yaml index e2c7b934c50d..47e1b3ee8b1b 100644 --- a/Documentation/devicetree/bindings/spi/qcom,spi-geni-qcom.yaml +++ b/Documentation/devicetree/bindings/spi/qcom,spi-geni-qcom.yaml @@ -45,12 +45,15 @@ properties: - const: rx =20 interconnects: - maxItems: 2 + minItems: 2 + maxItems: 3 =20 interconnect-names: + minItems: 2 items: - const: qup-core - const: qup-config + - const: qup-memory =20 interrupts: maxItems: 1 --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA517C32772 for ; Tue, 23 Aug 2022 08:34:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243869AbiHWIev (ORCPT ); Tue, 23 Aug 2022 04:34:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346772AbiHWIcD (ORCPT ); Tue, 23 Aug 2022 04:32:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 114DF753A2; Tue, 23 Aug 2022 01:16:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ECDE2B81C3B; Tue, 23 Aug 2022 08:16:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D5EFC433C1; Tue, 23 Aug 2022 08:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242559; bh=yqioFLrizC8M8c2foLHq0k3WOiVIEJzln4BUfFhPahY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x0BAJAEN/vFXHCuKhgKIZhRfYABcsW0ur5fCO06TY6LA5xPZZguTgKzYuLX//OHTY 4YsnAO7FmHFIqGjG0QEHuO01iGH2Z1tG9sQcMh2EU5B0zpRr0GCBJlWBqivumkioKM xBqkjBv9LZpjDEkYXMHsBPdlaFjhieeDTxr2fEj0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Lu=C3=ADs=20Henriques?= , Jeff Layton , Xiubo Li , Ilya Dryomov Subject: [PATCH 5.19 137/365] ceph: use correct index when encoding client supported features Date: Tue, 23 Aug 2022 10:00:38 +0200 Message-Id: <20220823080123.937414439@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lu=C3=ADs Henriques commit fea013e020e6ecc7be75bea0d61697b7e916b44d upstream. Feature bits have to be encoded into the correct locations. This hasn't been an issue so far because the only hole in the feature bits was in bit 10 (CEPHFS_FEATURE_RECLAIM_CLIENT), which is located in the 2nd byte. When adding more bits that go beyond the this 2nd byte, the bug will show up. [xiubli: remove incorrect comment for CEPHFS_FEATURES_CLIENT_SUPPORTED] Fixes: 9ba1e224538a ("ceph: allocate the correct amount of extra bytes for = the session features") Signed-off-by: Lu=C3=ADs Henriques Reviewed-by: Jeff Layton Signed-off-by: Xiubo Li Signed-off-by: Ilya Dryomov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/ceph/mds_client.c | 7 +++++-- fs/ceph/mds_client.h | 6 ------ 2 files changed, 5 insertions(+), 8 deletions(-) --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -1220,14 +1220,17 @@ static int encode_supported_features(voi if (count > 0) { size_t i; size_t size =3D FEATURE_BYTES(count); + unsigned long bit; =20 if (WARN_ON_ONCE(*p + 4 + size > end)) return -ERANGE; =20 ceph_encode_32(p, size); memset(*p, 0, size); - for (i =3D 0; i < count; i++) - ((unsigned char*)(*p))[i / 8] |=3D BIT(feature_bits[i] % 8); + for (i =3D 0; i < count; i++) { + bit =3D feature_bits[i]; + ((unsigned char *)(*p))[bit / 8] |=3D BIT(bit % 8); + } *p +=3D size; } else { if (WARN_ON_ONCE(*p + 4 > end)) --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h @@ -33,10 +33,6 @@ enum ceph_feature_type { CEPHFS_FEATURE_MAX =3D CEPHFS_FEATURE_METRIC_COLLECT, }; =20 -/* - * This will always have the highest feature bit value - * as the last element of the array. - */ #define CEPHFS_FEATURES_CLIENT_SUPPORTED { \ 0, 1, 2, 3, 4, 5, 6, 7, \ CEPHFS_FEATURE_MIMIC, \ @@ -45,8 +41,6 @@ enum ceph_feature_type { CEPHFS_FEATURE_MULTI_RECONNECT, \ CEPHFS_FEATURE_DELEG_INO, \ CEPHFS_FEATURE_METRIC_COLLECT, \ - \ - CEPHFS_FEATURE_MAX, \ } #define CEPHFS_FEATURES_CLIENT_REQUIRED {} =20 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9219FC32774 for ; Tue, 23 Aug 2022 08:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344566AbiHWIfb (ORCPT ); Tue, 23 Aug 2022 04:35:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237737AbiHWIcV (ORCPT ); Tue, 23 Aug 2022 04:32:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55E8FF72; Tue, 23 Aug 2022 01:16:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1A76A6129A; Tue, 23 Aug 2022 08:16:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 133C9C433D6; Tue, 23 Aug 2022 08:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242566; bh=/eYVGXAuKL4bcGDnI5yMXcniIu7V/yBLApdzeAGaCAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GYUH1k+PRQuQrclGFKKk0XJUzIusvtJ5HmND0l/tNxF8P6y21dQsEvr7g9WIU8PtP GL4ZcAdgOQUOHSAGWM2LO1JOi+nCKnZ4kVb951G6VGtXEN8iQ/WGbjvvukHgUDcMuo d6psQmtofzdoFNPS273Idg+EYP2vuS8De3HjUmGQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Dan Williams Subject: [PATCH 5.19 138/365] tools/testing/cxl: Fix decoder default state Date: Tue, 23 Aug 2022 10:00:39 +0200 Message-Id: <20220823080123.987647295@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Williams commit 08f8d040a11d539481b9aee7b482430561281a28 upstream. The 'enabled' state is reserved for committed decoders. By default, cxl_test decoders are uncommitted at init time. Fixes: 7c7d68db0254 ("tools/testing/cxl: Enumerate mock decoders") Reviewed-by: Jonathan Cameron Link: https://lore.kernel.org/r/165603888091.551046.6312322707378021172.stg= it@dwillia2-xfh Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- tools/testing/cxl/test/cxl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c index 91444279f9a2..6e086fbc5c5b 100644 --- a/tools/testing/cxl/test/cxl.c +++ b/tools/testing/cxl/test/cxl.c @@ -466,7 +466,6 @@ static int mock_cxl_enumerate_decoders(struct cxl_hdm *= cxlhdm) .end =3D -1, }; =20 - cxld->flags =3D CXL_DECODER_F_ENABLE; cxld->interleave_ways =3D min_not_zero(target_count, 1); cxld->interleave_granularity =3D SZ_4K; cxld->target_type =3D CXL_DECODER_EXPANDER; --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7945C32772 for ; Tue, 23 Aug 2022 08:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243931AbiHWIe5 (ORCPT ); Tue, 23 Aug 2022 04:34:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346749AbiHWIcB (ORCPT ); Tue, 23 Aug 2022 04:32:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6264F75393; Tue, 23 Aug 2022 01:16:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0FAA66135D; Tue, 23 Aug 2022 08:16:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16AA2C433C1; Tue, 23 Aug 2022 08:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242575; bh=tZSJGZcu29hov5KyLe01/mQJdshxtNc7fhWtD6BhF4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LWrxE6BYzwwQGcw3JmHqTRSwDaTEyq+jC+B1SamQlUMWxHkB74DpBYeAPIaTOTY8i iPD00QEwy2rfyL+6/oJAcRxqZhfABDBWyaVtSwIql+vFVSiqqS7HYdPRTHB+jt6knA qvO3VcHRiyqSKlaFIOUqNTM9gdTWBhZgS4t2i5ak= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yuanzheng Song , "Tobin C. Harding" , Andrew Morton Subject: [PATCH 5.19 139/365] tools/vm/slabinfo: use alphabetic order when two values are equal Date: Tue, 23 Aug 2022 10:00:40 +0200 Message-Id: <20220823080124.027367515@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yuanzheng Song commit 4f5ceb8851f0081af54313abbf56de1615911faf upstream. When the number of partial slabs in each cache is the same (e.g., the value are 0), the results of the `slabinfo -X -N5` and `slabinfo -P -N5` are different. / # slabinfo -X -N5 ... Slabs sorted by number of partial slabs Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --------------------------------------- Name Objects Objsize Space Slabs/Part/Cpu O/S = O %Fr %Ef Flg inode_cache 15180 392 6217728 758/0/1 20 = 1 0 95 a kernfs_node_cache 22494 88 2002944 488/0/1 46 = 0 0 98 shmem_inode_cache 663 464 319488 38/0/1 17 = 1 0 96 biovec-max 50 3072 163840 4/0/1 10 = 3 0 93 A dentry 19050 136 2600960 633/0/2 30 = 0 0 99 a / # slabinfo -P -N5 Name Objects Objsize Space Slabs/Part/Cpu O/S = O %Fr %Ef Flg bdev_cache 32 984 32.7K 1/0/1 16 = 2 0 96 Aa ext4_inode_cache 42 752 32.7K 1/0/1 21 = 2 0 96 a dentry 19050 136 2.6M 633/0/2 30 = 0 0 99 a TCPv6 17 1840 32.7K 0/0/1 17 = 3 0 95 A RAWv6 18 856 16.3K 0/0/1 18 = 2 0 94 A This problem is caused by the sort_slabs(). So let's use alphabetic order when two values are equal in the sort_slabs(). By the way, the content of the `slabinfo -h` is not aligned because the `-P|--partial Sort by number of partial slabs` uses tabs instead of spaces. So let's use spaces instead of tabs to fix it. Link: https://lkml.kernel.org/r/20220528063117.935158-1-songyuanzheng@huawe= i.com Fixes: 1106b205a3fe ("tools/vm/slabinfo: add partial slab listing to -X") Signed-off-by: Yuanzheng Song Cc: "Tobin C. Harding" Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- tools/vm/slabinfo.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) --- a/tools/vm/slabinfo.c +++ b/tools/vm/slabinfo.c @@ -125,7 +125,7 @@ static void usage(void) "-n|--numa Show NUMA information\n" "-N|--lines=3DK Show the first K slabs\n" "-o|--ops Show kmem_cache_ops\n" - "-P|--partial Sort by number of partial slabs\n" + "-P|--partial Sort by number of partial slabs\n" "-r|--report Detailed report on single slabs\n" "-s|--shrink Shrink slabs\n" "-S|--Size Sort by size\n" @@ -1067,15 +1067,27 @@ static void sort_slabs(void) for (s2 =3D s1 + 1; s2 < slabinfo + slabs; s2++) { int result; =20 - if (sort_size) - result =3D slab_size(s1) < slab_size(s2); - else if (sort_active) - result =3D slab_activity(s1) < slab_activity(s2); - else if (sort_loss) - result =3D slab_waste(s1) < slab_waste(s2); - else if (sort_partial) - result =3D s1->partial < s2->partial; - else + if (sort_size) { + if (slab_size(s1) =3D=3D slab_size(s2)) + result =3D strcasecmp(s1->name, s2->name); + else + result =3D slab_size(s1) < slab_size(s2); + } else if (sort_active) { + if (slab_activity(s1) =3D=3D slab_activity(s2)) + result =3D strcasecmp(s1->name, s2->name); + else + result =3D slab_activity(s1) < slab_activity(s2); + } else if (sort_loss) { + if (slab_waste(s1) =3D=3D slab_waste(s2)) + result =3D strcasecmp(s1->name, s2->name); + else + result =3D slab_waste(s1) < slab_waste(s2); + } else if (sort_partial) { + if (s1->partial =3D=3D s2->partial) + result =3D strcasecmp(s1->name, s2->name); + else + result =3D s1->partial < s2->partial; + } else result =3D strcasecmp(s1->name, s2->name); =20 if (show_inverted) From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABA28C32772 for ; Tue, 23 Aug 2022 08:35:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344237AbiHWIfS (ORCPT ); Tue, 23 Aug 2022 04:35:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346992AbiHWIcK (ORCPT ); Tue, 23 Aug 2022 04:32:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 337C374E23; Tue, 23 Aug 2022 01:16:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4CA5661238; Tue, 23 Aug 2022 08:16:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3950CC433D6; Tue, 23 Aug 2022 08:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242581; bh=2cnvJBgNQeP6YaccfYEAUaqtV2LiY3X/dI5JdqXJ8wg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zrNftSmdBrA1CMyT/AtlPjCXCt3aB9jixH8LfdZC8Qho5k3PCqJWuccGBAaho/p4D KvbpghxthJWGfRMftJmY4spTP1dQGTyh8tfTL/8Usb2VxGsznRvF/tinwB4Rc2610Q j2jccqHnxfX29fYu/TP6Q6qG7+UL5uuJqF6Mx378= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , =?UTF-8?q?Lu=C3=ADs=20Henriques?= , Ilya Dryomov Subject: [PATCH 5.19 140/365] ceph: dont leak snap_rwsem in handle_cap_grant Date: Tue, 23 Aug 2022 10:00:41 +0200 Message-Id: <20220823080124.073498675@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeff Layton commit 58dd4385577ed7969b80cdc9e2a31575aba6c712 upstream. When handle_cap_grant is called on an IMPORT op, then the snap_rwsem is held and the function is expected to release it before returning. It currently fails to do that in all cases which could lead to a deadlock. Fixes: 6f05b30ea063 ("ceph: reset i_requested_max_size if file write is not= wanted") Link: https://tracker.ceph.com/issues/55857 Signed-off-by: Jeff Layton Reviewed-by: Lu=C3=ADs Henriques Signed-off-by: Ilya Dryomov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/ceph/caps.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -3578,24 +3578,23 @@ static void handle_cap_grant(struct inod fill_inline =3D true; } =20 - if (ci->i_auth_cap =3D=3D cap && - le32_to_cpu(grant->op) =3D=3D CEPH_CAP_OP_IMPORT) { - if (newcaps & ~extra_info->issued) - wake =3D true; + if (le32_to_cpu(grant->op) =3D=3D CEPH_CAP_OP_IMPORT) { + if (ci->i_auth_cap =3D=3D cap) { + if (newcaps & ~extra_info->issued) + wake =3D true; =20 - if (ci->i_requested_max_size > max_size || - !(le32_to_cpu(grant->wanted) & CEPH_CAP_ANY_FILE_WR)) { - /* re-request max_size if necessary */ - ci->i_requested_max_size =3D 0; - wake =3D true; - } + if (ci->i_requested_max_size > max_size || + !(le32_to_cpu(grant->wanted) & CEPH_CAP_ANY_FILE_WR)) { + /* re-request max_size if necessary */ + ci->i_requested_max_size =3D 0; + wake =3D true; + } =20 - ceph_kick_flushing_inode_caps(session, ci); - spin_unlock(&ci->i_ceph_lock); + ceph_kick_flushing_inode_caps(session, ci); + } up_read(&session->s_mdsc->snap_rwsem); - } else { - spin_unlock(&ci->i_ceph_lock); } + spin_unlock(&ci->i_ceph_lock); =20 if (fill_inline) ceph_fill_inline_data(inode, NULL, extra_info->inline_data, From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D072AC32772 for ; Tue, 23 Aug 2022 08:37:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345215AbiHWIhk (ORCPT ); Tue, 23 Aug 2022 04:37:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345385AbiHWIfk (ORCPT ); Tue, 23 Aug 2022 04:35:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22FBE75FC1; Tue, 23 Aug 2022 01:16:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4117A611DD; Tue, 23 Aug 2022 08:16:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B27BC433C1; Tue, 23 Aug 2022 08:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242587; bh=1e9KjvU5ZaXcqUBiFyeUVgiokV8izTmy6Xit8Plxk3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gM+ddHL5cqH9CtBH9nBV/0oUKT+0kndozH0Ftf+z0NFXpe9VPNiGStB6jiZ0boXMF vPhBBz/cJGtkNeEo5L05Wc5yniLBpxi86tHEOgxAY9w6sMerg9f/ZghE7mKzd+gUFA rq0AoVDA4LaqAvynV0VAPhx1ELasfYD74VNEnvyQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacky Bai , Peng Fan , Abel Vesa Subject: [PATCH 5.19 141/365] clk: imx93: Correct the edma1s parent clock Date: Tue, 23 Aug 2022 10:00:42 +0200 Message-Id: <20220823080124.126432044@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jacky Bai commit ebb4f1eb9360036be5ea70de82c5703ca0e64d43 upstream. For EDMA1 in AONMIX, its parent clock should be from cm33_root, so Correct it. Fixes: 24defbe194b65("clk: imx: add i.MX93 clk") Signed-off-by: Jacky Bai Signed-off-by: Peng Fan Reviewed-by: Peng Fan Reviewed-by: Abel Vesa Link: https://lore.kernel.org/r/20220609132902.3504651-4-peng.fan@oss.nxp.c= om Signed-off-by: Abel Vesa Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/clk/imx/clk-imx93.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c index 26885bd3971c..f5c9fa40491c 100644 --- a/drivers/clk/imx/clk-imx93.c +++ b/drivers/clk/imx/clk-imx93.c @@ -160,7 +160,7 @@ static const struct imx93_clk_ccgr { { IMX93_CLK_SEMA2_GATE, "sema2", "bus_wakeup_root", 0x8480, }, { IMX93_CLK_MU_A_GATE, "mu_a", "bus_aon_root", 0x84c0, }, { IMX93_CLK_MU_B_GATE, "mu_b", "bus_aon_root", 0x8500, }, - { IMX93_CLK_EDMA1_GATE, "edma1", "wakeup_axi_root", 0x8540, }, + { IMX93_CLK_EDMA1_GATE, "edma1", "m33_root", 0x8540, }, { IMX93_CLK_EDMA2_GATE, "edma2", "wakeup_axi_root", 0x8580, }, { IMX93_CLK_FLEXSPI1_GATE, "flexspi", "flexspi_root", 0x8640, }, { IMX93_CLK_GPIO1_GATE, "gpio1", "m33_root", 0x8880, }, --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAB90C32792 for ; Tue, 23 Aug 2022 08:37:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244700AbiHWIhZ (ORCPT ); Tue, 23 Aug 2022 04:37:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344716AbiHWIfc (ORCPT ); Tue, 23 Aug 2022 04:35:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 533F975FE9; Tue, 23 Aug 2022 01:16:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A4CE761284; Tue, 23 Aug 2022 08:16:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A9B2C433C1; Tue, 23 Aug 2022 08:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242594; bh=QcPnvmwlxRsZIKwLbUmsHT7NWb9WNl57reREAKOTIlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Idmy6mVx2g9bbT+jvDt19o0YlSrbBwfZDI4Wb6VXpWDMSX+lznWzvHKPIRfNu9hLu sCUmDhQ8DK2lYmkA/K14I/BY40+VIhroHSVHkblOeeysO2RRqf9/TtBAf91dq+MQh1 vV9AeORNYk4wVmGv8Frm+3CKxVeTMskoQfwGxTHk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, gautam.dawar@xilinx.com, Stefano Garzarella , "Michael S. Tsirkin" , =?UTF-8?q?Eugenio=20P=C3=A9rez?= Subject: [PATCH 5.19 142/365] vdpa_sim: use max_iotlb_entries as a limit in vhost_iotlb_init Date: Tue, 23 Aug 2022 10:00:43 +0200 Message-Id: <20220823080124.177818092@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefano Garzarella commit 67f8f10c0bd78c4a0f0e983e050ab90da015323b upstream. Commit bda324fd037a ("vdpasim: control virtqueue support") changed the allocation of iotlbs calling vhost_iotlb_init() for each address space, instead of vhost_iotlb_alloc(). With this change we forgot to use the limit we had introduced with the `max_iotlb_entries` module parameter. Fixes: bda324fd037a ("vdpasim: control virtqueue support") Cc: gautam.dawar@xilinx.com Signed-off-by: Stefano Garzarella Message-Id: <20220621151208.189959-1-sgarzare@redhat.com> Signed-off-by: Michael S. Tsirkin Acked-by: Eugenio P=C3=A9rez Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_= sim.c index 0f2865899647..3e81532c01cb 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -33,7 +33,7 @@ MODULE_PARM_DESC(batch_mapping, "Batched mapping 1 -Enabl= e; 0 - Disable"); static int max_iotlb_entries =3D 2048; module_param(max_iotlb_entries, int, 0444); MODULE_PARM_DESC(max_iotlb_entries, - "Maximum number of iotlb entries. 0 means unlimited. (default: 2048)"); + "Maximum number of iotlb entries for each address space. 0 means unlimi= ted. (default: 2048)"); =20 #define VDPASIM_QUEUE_ALIGN PAGE_SIZE #define VDPASIM_QUEUE_MAX 256 @@ -291,7 +291,7 @@ struct vdpasim *vdpasim_create(struct vdpasim_dev_attr = *dev_attr) goto err_iommu; =20 for (i =3D 0; i < vdpasim->dev_attr.nas; i++) - vhost_iotlb_init(&vdpasim->iommu[i], 0, 0); + vhost_iotlb_init(&vdpasim->iommu[i], max_iotlb_entries, 0); =20 vdpasim->buffer =3D kvmalloc(dev_attr->buffer_size, GFP_KERNEL); if (!vdpasim->buffer) --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87286C32772 for ; Tue, 23 Aug 2022 08:37:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245696AbiHWIhJ (ORCPT ); Tue, 23 Aug 2022 04:37:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243861AbiHWIeu (ORCPT ); Tue, 23 Aug 2022 04:34:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9400A75CC9; Tue, 23 Aug 2022 01:16:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C138961344; Tue, 23 Aug 2022 08:16:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA2E3C433C1; Tue, 23 Aug 2022 08:16:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242600; bh=3LxpO6UANFpzcH7sgn+B4QCjOOt7xt8SeRhvBqmqGg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xf/q/vXISXBnlvHXyQV9StakO9oUjFQHcwAcQsdcgqP4TuWsw0nYa/cJsqjmhIePE uezhEbZH1Ifgy0o25txG42kq+nnmxAru+hUICZfmONQ/GnVWDd/Oqs/LFq4NJ+dfBd fN5Xj2xn+M4+bUxB2QuS3ujt2JvzqtUc2VkmiG3E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, gautam.dawar@xilinx.com, Stefano Garzarella , "Michael S. Tsirkin" , =?UTF-8?q?Eugenio=20P=C3=A9rez?= Subject: [PATCH 5.19 143/365] vdpa_sim_blk: set number of address spaces and virtqueue groups Date: Tue, 23 Aug 2022 10:00:44 +0200 Message-Id: <20220823080124.214187072@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefano Garzarella commit 19cd4a5471b8eaa4bd161b0fdb4567f2fc88d809 upstream. Commit bda324fd037a ("vdpasim: control virtqueue support") added two new fields (nas, ngroups) to vdpasim_dev_attr, but we forgot to initialize them for vdpa_sim_blk. When creating a new vdpa_sim_blk device this causes the kernel to panic in this way: =C2=A0 =C2=A0$ vdpa dev add mgmtdev vdpasim_blk name blk0 =C2=A0 =C2=A0BUG: kernel NULL pointer dereference, address: 00000000000000= 30 =C2=A0 =C2=A0... =C2=A0 =C2=A0RIP: 0010:vhost_iotlb_add_range_ctx+0x41/0x220 [vhost_iotlb] =C2=A0 =C2=A0... =C2=A0 =C2=A0Call Trace: =C2=A0 =C2=A0 =C2=A0 =C2=A0 vhost_iotlb_add_range+0x11/0x800 [vhost_iotlb] =C2=A0 =C2=A0 vdpasim_map_range+0x91/0xd0 [vdpa_sim] =C2=A0 =C2=A0 vdpasim_alloc_coherent+0x56/0x90 [vdpa_sim] =C2=A0 =C2=A0 ... This happens because vdpasim->iommu[0] is not initialized when dev_attr.nas is 0. Let's fix this issue by initializing both (nas, ngroups) to 1 for vdpa_sim_blk. Fixes: bda324fd037a ("vdpasim: control virtqueue support") Cc: gautam.dawar@xilinx.com Signed-off-by: Stefano Garzarella Message-Id: <20220621151323.190431-1-sgarzare@redhat.com> Signed-off-by: Michael S. Tsirkin Acked-by: Eugenio P=C3=A9rez Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c @@ -34,7 +34,11 @@ #define VDPASIM_BLK_CAPACITY 0x40000 #define VDPASIM_BLK_SIZE_MAX 0x1000 #define VDPASIM_BLK_SEG_MAX 32 + +/* 1 virtqueue, 1 address space, 1 virtqueue group */ #define VDPASIM_BLK_VQ_NUM 1 +#define VDPASIM_BLK_AS_NUM 1 +#define VDPASIM_BLK_GROUP_NUM 1 =20 static char vdpasim_blk_id[VIRTIO_BLK_ID_BYTES] =3D "vdpa_blk_sim"; =20 @@ -260,6 +264,8 @@ static int vdpasim_blk_dev_add(struct vd dev_attr.id =3D VIRTIO_ID_BLOCK; dev_attr.supported_features =3D VDPASIM_BLK_FEATURES; dev_attr.nvqs =3D VDPASIM_BLK_VQ_NUM; + dev_attr.ngroups =3D VDPASIM_BLK_GROUP_NUM; + dev_attr.nas =3D VDPASIM_BLK_AS_NUM; dev_attr.config_size =3D sizeof(struct virtio_blk_config); dev_attr.get_config =3D vdpasim_blk_get_config; dev_attr.work_fn =3D vdpasim_blk_work; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FA66C32772 for ; Tue, 23 Aug 2022 08:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345448AbiHWIho (ORCPT ); Tue, 23 Aug 2022 04:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345531AbiHWIfp (ORCPT ); Tue, 23 Aug 2022 04:35:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B207B5FD5; Tue, 23 Aug 2022 01:16:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 152BD61238; Tue, 23 Aug 2022 08:16:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47994C433D6; Tue, 23 Aug 2022 08:16:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242609; bh=6cr4M4z5xfYkh3alHhyViMwcrjvTki6YRE8U0y4xRyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wk6TE89zhZQyl5pSrwl/oK8/VBzG/4rcBuMZA+O6L0L/Us7CGHFF88q1+2E9Bm7tF 8/bc5yIWuK/X6HVwJpgnfzDNhpA6Pmm+5jqNdbkaLVwRtgwb64dO7l4eFJpyWthIIt ygvGI9C0xgQcruD60EPzSk0mZrKkIJQwQqUiyr9s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Adam Manzanares , Dan Williams Subject: [PATCH 5.19 144/365] tools/testing/cxl: Fix cxl_hdm_decode_init() calling convention Date: Tue, 23 Aug 2022 10:00:45 +0200 Message-Id: <20220823080124.254773216@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Williams commit 863fdccdc5ed1e187a30a4a103340be4569904c8 upstream. This failing signature: [ 8.392669] cxl_bus_probe: cxl_port endpoint2: probe: 970997760 [ 8.392670] cxl_port: probe of endpoint2 failed with error 970997760 [ 8.392719] create_endpoint: cxl_mem mem0: add: endpoint2 [ 8.392721] cxl_mem mem0: endpoint2 failed probe [ 8.392725] cxl_bus_probe: cxl_mem mem0: probe: -6 ...shows cxl_hdm_decode_init() resulting in a return code ("970997760") that looks like stack corruption. The problem goes away if cxl_hdm_decode_init() is not mocked via __wrap_cxl_hdm_decode_init(). The corruption results from the mismatch that the calling convention for cxl_hdm_decode_init() is: int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, struct cxl_hdm *cxlhdm) ...and __wrap_cxl_hdm_decode_init() is: bool __wrap_cxl_hdm_decode_init(struct cxl_dev_state *cxlds, struct cxl_hdm= *cxlhdm) ...i.e. an int is expected but __wrap_hdm_decode_init() returns bool. Fix the convention and cleanup the organization to match __wrap_cxl_await_media_ready() as the difference was a red herring that distracted from finding the bug. Fixes: 92804edb11f0 ("cxl/pci: Drop @info argument to cxl_hdm_decode_init()= ") Reviewed-by: Jonathan Cameron Reviewed-by: Adam Manzanares Link: https://lore.kernel.org/r/165603870776.551046.8709990108936497723.stg= it@dwillia2-xfh Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- tools/testing/cxl/test/mock.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/testing/cxl/test/mock.c b/tools/testing/cxl/test/mock.c index f1f8c40948c5..bce6a21df0d5 100644 --- a/tools/testing/cxl/test/mock.c +++ b/tools/testing/cxl/test/mock.c @@ -208,13 +208,15 @@ int __wrap_cxl_await_media_ready(struct cxl_dev_state= *cxlds) } EXPORT_SYMBOL_NS_GPL(__wrap_cxl_await_media_ready, CXL); =20 -bool __wrap_cxl_hdm_decode_init(struct cxl_dev_state *cxlds, - struct cxl_hdm *cxlhdm) +int __wrap_cxl_hdm_decode_init(struct cxl_dev_state *cxlds, + struct cxl_hdm *cxlhdm) { int rc =3D 0, index; struct cxl_mock_ops *ops =3D get_cxl_mock_ops(&index); =20 - if (!ops || !ops->is_mock_dev(cxlds->dev)) + if (ops && ops->is_mock_dev(cxlds->dev)) + rc =3D 0; + else rc =3D cxl_hdm_decode_init(cxlds, cxlhdm); put_cxl_mock_ops(index); =20 --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1AB4C32772 for ; Tue, 23 Aug 2022 08:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240923AbiHWIjG (ORCPT ); Tue, 23 Aug 2022 04:39:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344284AbiHWIhP (ORCPT ); Tue, 23 Aug 2022 04:37:15 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05CA577EB5; Tue, 23 Aug 2022 01:17:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C53BCCE1B34; Tue, 23 Aug 2022 08:16:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C87EDC433C1; Tue, 23 Aug 2022 08:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242615; bh=epO8K098BtRj6Sc5ipRdBeNNa94m9Yx6xf3h4PdWRFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xhJFL6nhxQEmCq8NbRpC4ENDNTtLzV5BWoujyXM1KcepPHwSPbpBMxVqfaWXzfMKs wiNXs03rq8N0b3fQRZci+Hf18zx/Qn07zJQ3yUm5vMsGIBaQ2qLbtSa0Nt8QOjEbfp sGYHvp0bX6n7wOFFKqP/8ma/09Xf98RBP4NkwC1Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ondrej Mosnacek , Masahiro Yamada Subject: [PATCH 5.19 145/365] kbuild: dummy-tools: avoid tmpdir leak in dummy gcc Date: Tue, 23 Aug 2022 10:00:46 +0200 Message-Id: <20220823080124.294570326@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ondrej Mosnacek commit aac289653fa5adf9e9985e4912c1d24a3e8cbab2 upstream. When passed -print-file-name=3Dplugin, the dummy gcc script creates a temporary directory that is never cleaned up. To avoid cluttering $TMPDIR, instead use a static directory included in the source tree. Fixes: 76426e238834 ("kbuild: add dummy toolchains to enable all cc-option = etc. in Kconfig") Signed-off-by: Ondrej Mosnacek Signed-off-by: Masahiro Yamada Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- .../dummy-tools/dummy-plugin-dir/include/plugin-version.h | 0 scripts/dummy-tools/gcc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) create mode 100644 scripts/dummy-tools/dummy-plugin-dir/include/plugin-ver= sion.h --- a/scripts/dummy-tools/gcc +++ b/scripts/dummy-tools/gcc @@ -96,12 +96,8 @@ fi =20 # To set GCC_PLUGINS if arg_contain -print-file-name=3Dplugin "$@"; then - plugin_dir=3D$(mktemp -d) - - mkdir -p $plugin_dir/include - touch $plugin_dir/include/plugin-version.h - - echo $plugin_dir + # Use $0 to find the in-tree dummy directory + echo "$(dirname "$(readlink -f "$0")")/dummy-plugin-dir" exit 0 fi From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC102C32772 for ; Tue, 23 Aug 2022 08:37:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244432AbiHWIh5 (ORCPT ); Tue, 23 Aug 2022 04:37:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346206AbiHWIgA (ORCPT ); Tue, 23 Aug 2022 04:36:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 395DB760EE; Tue, 23 Aug 2022 01:17:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C6C4961377; Tue, 23 Aug 2022 08:17:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BF52C433C1; Tue, 23 Aug 2022 08:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242621; bh=69ovCRcumfGslh/oGLivZ4DIr8oJgQGwFuXGEqHGW5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1lmfjeY/1AZ4u1HjGhSbikYr0nxZa869OIglx555miOeaIEiXk95EbOhe0Qt+tkA6 Z2pv2Qy5uSVbPuj84DP3SZbAmJn9VY9b7BBux8hxotUzGuURNcQ/c9HHqfZP0D9jqy j9ovD0QVIkg/o8/fb0tjth2HvNQtl0grvqjk4ucU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roberto Sassu , Alexei Starovoitov , Andrii Nakryiko , bpf@vger.kernel.org, Daniel Borkmann , Ingo Molnar , John Fastabend , KP Singh , llvm@lists.linux.dev, Martin KaFai Lau , Nathan Chancellor , Nick Desaulniers , Nick Terrell , Peter Zijlstra , Quentin Monnet , Song Liu , Stanislav Fomichev , Arnaldo Carvalho de Melo Subject: [PATCH 5.19 146/365] tools build: Switch to new openssl API for test-libcrypto Date: Tue, 23 Aug 2022 10:00:47 +0200 Message-Id: <20220823080124.334423074@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Roberto Sassu commit 5b245985a6de5ac18b5088c37068816d413fb8ed upstream. Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an error when it encounters the deprecated function MD5_Init() and the others. The error would be interpreted as missing libcrypto, while in reality it is not. Fixes: 6e8ccb4f624a73c5 ("tools/bpf: properly account for libbfd variations= ") Signed-off-by: Roberto Sassu Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: bpf@vger.kernel.org Cc: Daniel Borkmann Cc: Ingo Molnar Cc: John Fastabend Cc: KP Singh Cc: llvm@lists.linux.dev Cc: Martin KaFai Lau Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: Nick Terrell Cc: Peter Zijlstra Cc: Quentin Monnet Cc: Song Liu Cc: Stanislav Fomichev Link: https://lore.kernel.org/r/20220719170555.2576993-4-roberto.sassu@huaw= ei.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- tools/build/feature/test-libcrypto.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) --- a/tools/build/feature/test-libcrypto.c +++ b/tools/build/feature/test-libcrypto.c @@ -1,16 +1,23 @@ // SPDX-License-Identifier: GPL-2.0 +#include #include #include =20 int main(void) { - MD5_CTX context; + EVP_MD_CTX *mdctx; unsigned char md[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH]; unsigned char dat[] =3D "12345"; + unsigned int digest_len; =20 - MD5_Init(&context); - MD5_Update(&context, &dat[0], sizeof(dat)); - MD5_Final(&md[0], &context); + mdctx =3D EVP_MD_CTX_new(); + if (!mdctx) + return 0; + + EVP_DigestInit_ex(mdctx, EVP_md5(), NULL); + EVP_DigestUpdate(mdctx, &dat[0], sizeof(dat)); + EVP_DigestFinal_ex(mdctx, &md[0], &digest_len); + EVP_MD_CTX_free(mdctx); =20 SHA1(&dat[0], sizeof(dat), &md[0]); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA569C32792 for ; Tue, 23 Aug 2022 08:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345319AbiHWIj5 (ORCPT ); Tue, 23 Aug 2022 04:39:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344922AbiHWIjR (ORCPT ); Tue, 23 Aug 2022 04:39:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1A4A636F; Tue, 23 Aug 2022 01:18:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7648EB81C29; Tue, 23 Aug 2022 08:17:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC99FC433C1; Tue, 23 Aug 2022 08:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242627; bh=UfA2D+Yn9Vkzxi9TLQAdixu5obpAF7LAI9CvtDbERPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NA97XWWXyydbDhhW+lCf1ejAfhoKo5ypaes5ng8cccyZs4uxMTmarr2nXTyWf9Ysv 4gJJrgTGHp7pjSjT6CK5CuRsJMPMzAOOmoRN7SvBhKypqLfobSa+y9JqQJSpKHsQWx iY1Uhs/giwVcEJKJ/z6Qpn0xsWFwXNK7AyZ/hfdE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Jon Mason Subject: [PATCH 5.19 147/365] NTB: ntb_tool: uninitialized heap data in tool_fn_write() Date: Tue, 23 Aug 2022 10:00:48 +0200 Message-Id: <20220823080124.365784424@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter commit 45e1058b77feade4e36402828bfe3e0d3363177b upstream. The call to: ret =3D simple_write_to_buffer(buf, size, offp, ubuf, size); will return success if it is able to write even one byte to "buf". The value of "*offp" controls which byte. This could result in reading uninitialized data when we do the sscanf() on the next line. This code is not really desigined to handle partial writes where *offp is non-zero and the "buf" is preserved and re-used between writes. Just ban partial writes and replace the simple_write_to_buffer() with copy_from_user(). Fixes: 578b881ba9c4 ("NTB: Add tool test client") Signed-off-by: Dan Carpenter Signed-off-by: Jon Mason Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/ntb/test/ntb_tool.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/ntb/test/ntb_tool.c +++ b/drivers/ntb/test/ntb_tool.c @@ -367,14 +367,16 @@ static ssize_t tool_fn_write(struct tool u64 bits; int n; =20 + if (*offp) + return 0; + buf =3D kmalloc(size + 1, GFP_KERNEL); if (!buf) return -ENOMEM; =20 - ret =3D simple_write_to_buffer(buf, size, offp, ubuf, size); - if (ret < 0) { + if (copy_from_user(buf, ubuf, size)) { kfree(buf); - return ret; + return -EFAULT; } =20 buf[size] =3D 0; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 517DCC32792 for ; Tue, 23 Aug 2022 08:50:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347241AbiHWIuE (ORCPT ); Tue, 23 Aug 2022 04:50:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347018AbiHWIt3 (ORCPT ); Tue, 23 Aug 2022 04:49:29 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6BA77C337; Tue, 23 Aug 2022 01:22:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id EFD16CE1B39; Tue, 23 Aug 2022 08:17:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDAE4C433D6; Tue, 23 Aug 2022 08:17:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242630; bh=yp8FAvLDJNDsj4jRUbxa7J/2sW+6J1jRQ0jGvMPpTno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zKdKLBI90eZrOqESnpUPSfiIBJeyJ1vy1Wy2iLrkoMky+dcjPrem5EW5PUynR1h+L W4+gDSBB3jJS+WRAUang61rf21L70F3bfy5z6ZwebbGvB035v6AjdJ863IxHyGNYnr G1wX2oTJoOo4Y6tc/Cxt3A3N57NQup/x1zh8sSxw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Louis Peens , Yu Xiao , Simon Horman , Jakub Kicinski Subject: [PATCH 5.19 148/365] nfp: ethtool: fix the display error of `ethtool -m DEVNAME` Date: Tue, 23 Aug 2022 10:00:49 +0200 Message-Id: <20220823080124.407732769@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yu Xiao commit 4ae97cae07e15d41e5c0ebabba64c6eefdeb0bbe upstream. The port flag isn't set to `NFP_PORT_CHANGED` when using `ethtool -m DEVNAME` before, so the port state (e.g. interface) cannot be updated. Therefore, it caused that `ethtool -m DEVNAME` sometimes cannot read the correct information. E.g. `ethtool -m DEVNAME` cannot work when load driver before plug in optical module, as the port interface is still NONE without port update. Now update the port state before sending info to NIC to ensure that port interface is correct (latest state). Fixes: 61f7c6f44870 ("nfp: implement ethtool get module EEPROM") Reviewed-by: Louis Peens Signed-off-by: Yu Xiao Signed-off-by: Simon Horman Link: https://lore.kernel.org/r/20220802093355.69065-1-simon.horman@corigin= e.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c @@ -1230,6 +1230,8 @@ nfp_port_get_module_info(struct net_devi u8 data; =20 port =3D nfp_port_from_netdev(netdev); + /* update port state to get latest interface */ + set_bit(NFP_PORT_CHANGED, &port->flags); eth_port =3D nfp_port_get_eth_port(port); if (!eth_port) return -EOPNOTSUPP; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA561C32772 for ; Tue, 23 Aug 2022 08:38:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345666AbiHWIiH (ORCPT ); Tue, 23 Aug 2022 04:38:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347090AbiHWIgT (ORCPT ); Tue, 23 Aug 2022 04:36:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4205176940; Tue, 23 Aug 2022 01:17:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0AEC061284; Tue, 23 Aug 2022 08:17:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1525BC433C1; Tue, 23 Aug 2022 08:17:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242633; bh=w0p436ssZfj/lQdy31bDOBkJyI06WCHkjyGiFQ8EqOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qhQUzDCSI8NHgikEqAPOxpK4HJ/ntaP0z4EvBo+DtcoI8AmNrJFManzBtL+hzjmTj kNEx/eqcYI8olIG+j7IcNBDAXmYWIiRwfzn2Ucx1k0aDZ3c1geaXp2WRBwcg148xwT tNFPITBNfCuSZImdheQ47AcAA230BQDK92XpGAD8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Oleksandr Tyshchenko , Juergen Gross Subject: [PATCH 5.19 149/365] xen/xenbus: fix return type in xenbus_file_read() Date: Tue, 23 Aug 2022 10:00:50 +0200 Message-Id: <20220823080124.456944321@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter commit 32ad11127b95236dfc52375f3707853194a7f4b4 upstream. This code tries to store -EFAULT in an unsigned int. The xenbus_file_read() function returns type ssize_t so the negative value is returned as a positive value to the user. This change forces another change to the min() macro. Originally, the min() macro used "unsigned" type which checkpatch complains about. Also unsigned type would break if "len" were not capped at MAX_RW_COUNT. Use size_t for the min(). (No effect on runtime for the min_t() change). Fixes: 2fb3683e7b16 ("xen: Add xenbus device driver") Signed-off-by: Dan Carpenter Reviewed-by: Oleksandr Tyshchenko Link: https://lore.kernel.org/r/YutxJUaUYRG/VLVc@kili Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/xen/xenbus/xenbus_dev_frontend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c @@ -128,7 +128,7 @@ static ssize_t xenbus_file_read(struct f { struct xenbus_file_priv *u =3D filp->private_data; struct read_buffer *rb; - unsigned i; + ssize_t i; int ret; =20 mutex_lock(&u->reply_mutex); @@ -148,7 +148,7 @@ again: rb =3D list_entry(u->read_buffers.next, struct read_buffer, list); i =3D 0; while (i < len) { - unsigned sz =3D min((unsigned)len - i, rb->len - rb->cons); + size_t sz =3D min_t(size_t, len - i, rb->len - rb->cons); =20 ret =3D copy_to_user(ubuf + i, &rb->msg[rb->cons], sz); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8681C32772 for ; Tue, 23 Aug 2022 08:38:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345964AbiHWIiP (ORCPT ); Tue, 23 Aug 2022 04:38:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347504AbiHWIga (ORCPT ); Tue, 23 Aug 2022 04:36:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E50C977543; Tue, 23 Aug 2022 01:17:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A8952B81BF8; Tue, 23 Aug 2022 08:17:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0441EC433D6; Tue, 23 Aug 2022 08:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242636; bh=5fy4IkzWjl1hfPLwkmTOIHwX1kHx3B1rb3uQ4pKYwEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TlmPiX+M3fiMMfcs8P2CwxPtvb1WNYqLiLBj9oxm8r7gEhNGNmMOZxdsg5AFKHVSI foPUfSip99r8sU+EsYbnVgWBG5r2a4EhaiCKZaF4r8V+Ltge6ulvE/RyHpNGREP6YP hcHPnlWDvIveYxy79FEVUUKpH3mWEARMgkQmHBbk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gerhard Engleder , Jakub Kicinski Subject: [PATCH 5.19 150/365] tsnep: Fix tsnep_tx_unmap() error path usage Date: Tue, 23 Aug 2022 10:00:51 +0200 Message-Id: <20220823080124.506387071@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gerhard Engleder commit b3bb8628bf64440065976c71e4ab09186c393597 upstream. If tsnep_tx_map() fails, then tsnep_tx_unmap() shall start at the write index like tsnep_tx_map(). This is different to the normal operation. Thus, add an additional parameter to tsnep_tx_unmap() to enable start at different positions for successful TX and failed TX. Fixes: 403f69bbdbad ("tsnep: Add TSN endpoint Ethernet MAC driver") Signed-off-by: Gerhard Engleder Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/engleder/tsnep_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ether= net/engleder/tsnep_main.c index d98199f3414b..a5f7152a1716 100644 --- a/drivers/net/ethernet/engleder/tsnep_main.c +++ b/drivers/net/ethernet/engleder/tsnep_main.c @@ -340,14 +340,14 @@ static int tsnep_tx_map(struct sk_buff *skb, struct t= snep_tx *tx, int count) return 0; } =20 -static void tsnep_tx_unmap(struct tsnep_tx *tx, int count) +static void tsnep_tx_unmap(struct tsnep_tx *tx, int index, int count) { struct device *dmadev =3D tx->adapter->dmadev; struct tsnep_tx_entry *entry; int i; =20 for (i =3D 0; i < count; i++) { - entry =3D &tx->entry[(tx->read + i) % TSNEP_RING_SIZE]; + entry =3D &tx->entry[(index + i) % TSNEP_RING_SIZE]; =20 if (entry->len) { if (i =3D=3D 0) @@ -395,7 +395,7 @@ static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff= *skb, =20 retval =3D tsnep_tx_map(skb, tx, count); if (retval !=3D 0) { - tsnep_tx_unmap(tx, count); + tsnep_tx_unmap(tx, tx->write, count); dev_kfree_skb_any(entry->skb); entry->skb =3D NULL; =20 @@ -464,7 +464,7 @@ static bool tsnep_tx_poll(struct tsnep_tx *tx, int napi= _budget) if (skb_shinfo(entry->skb)->nr_frags > 0) count +=3D skb_shinfo(entry->skb)->nr_frags; =20 - tsnep_tx_unmap(tx, count); + tsnep_tx_unmap(tx, tx->read, count); =20 if ((skb_shinfo(entry->skb)->tx_flags & SKBTX_IN_PROGRESS) && (__le32_to_cpu(entry->desc_wb->properties) & --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B207C32792 for ; Tue, 23 Aug 2022 08:44:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346296AbiHWIoY (ORCPT ); Tue, 23 Aug 2022 04:44:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242061AbiHWIkI (ORCPT ); Tue, 23 Aug 2022 04:40:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB1D44BD06; Tue, 23 Aug 2022 01:18:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E6B32B81C26; Tue, 23 Aug 2022 08:17:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A874C433C1; Tue, 23 Aug 2022 08:17:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242642; bh=MmA8+czNp1+q5KyrKW/oAit6SlhxwV+dRrfMMv9Mlwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mfTpyFDaRvfVz4m4mUS7AzQHSgLGYeBtwMIOEUsRLV/AIlfIS6lUt53C2iKTGGPgv TzDttE/gCTwMvuuZVqbxSk9kZOLGLkCtEm/exYxRMt2DaKpyDB6RmdfTj4PKVhc+3i PqIuUnE84BzBWXxlRndsG1+p8d6v0xSNxoUaf2xc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duoming Zhou , Jakub Kicinski Subject: [PATCH 5.19 151/365] atm: idt77252: fix use-after-free bugs caused by tst_timer Date: Tue, 23 Aug 2022 10:00:52 +0200 Message-Id: <20220823080124.546175111@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Duoming Zhou commit 3f4093e2bf4673f218c0bf17d8362337c400e77b upstream. There are use-after-free bugs caused by tst_timer. The root cause is that there are no functions to stop tst_timer in idt77252_exit(). One of the possible race conditions is shown below: (thread 1) | (thread 2) | idt77252_init_one | init_card | fill_tst | mod_timer(&card->tst_timer, ...) idt77252_exit | (wait a time) | tst_timer | | ... kfree(card) // FREE | | card->soft_tst[e] // USE The idt77252_dev is deallocated in idt77252_exit() and used in timer handler. This patch adds del_timer_sync() in idt77252_exit() in order that the timer handler could be stopped before the idt77252_dev is deallocated. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Duoming Zhou Link: https://lore.kernel.org/r/20220805070008.18007-1-duoming@zju.edu.cn Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/atm/idt77252.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c @@ -3752,6 +3752,7 @@ static void __exit idt77252_exit(void) card =3D idt77252_chain; dev =3D card->atmdev; idt77252_chain =3D card->next; + del_timer_sync(&card->tst_timer); =20 if (dev->phy->stop) dev->phy->stop(dev); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D856C32772 for ; Tue, 23 Aug 2022 08:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231167AbiHWIoF (ORCPT ); Tue, 23 Aug 2022 04:44:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346705AbiHWIk3 (ORCPT ); Tue, 23 Aug 2022 04:40:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E1785F23F; Tue, 23 Aug 2022 01:18:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F22161321; Tue, 23 Aug 2022 08:17:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1ABFCC433C1; Tue, 23 Aug 2022 08:17:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242645; bh=GOO6yS8sqZfWknrUvzaIwJRwSqyMq+57shxE+fO7O2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mHs0RuaFD73IhUymSU4FpXwCBmPlN8B4ESMLOPvyLlais20CycC2UrVqA4XN3AZvL dJd8h/J+GxanPbPe0KFFwt/GPe4KDKYKzaH74w71xEpV8ulkUrf793SIE/OVbdA90K OBcP8s4E6a0kYdTs7P5su//a4jytK+tmrvtO21Kw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Jeff Layton Subject: [PATCH 5.19 152/365] fscache: dont leak cookie access refs if invalidation is in progress or failed Date: Tue, 23 Aug 2022 10:00:53 +0200 Message-Id: <20220823080124.585754011@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff Layton commit fb24771faf72a2fd62b3b6287af3c610c3ec9cf1 upstream. It's possible for a request to invalidate a fscache_cookie will come in while we're already processing an invalidation. If that happens we currently take an extra access reference that will leak. Only call __fscache_begin_cookie_access if the FSCACHE_COOKIE_DO_INVALIDATE bit was previously clear. Also, ensure that we attempt to clear the bit when the cookie is "FAILED" and put the reference to avoid an access leak. Fixes: 85e4ea1049c7 ("fscache: Fix invalidation/lookup race") Suggested-by: David Howells Signed-off-by: Jeff Layton Signed-off-by: David Howells Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/fscache/cookie.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c index 74920826d8f6..26a6d395737a 100644 --- a/fs/fscache/cookie.c +++ b/fs/fscache/cookie.c @@ -739,6 +739,9 @@ static void fscache_cookie_state_machine(struct fscache= _cookie *cookie) fallthrough; =20 case FSCACHE_COOKIE_STATE_FAILED: + if (test_and_clear_bit(FSCACHE_COOKIE_DO_INVALIDATE, &cookie->flags)) + fscache_end_cookie_access(cookie, fscache_access_invalidate_cookie_end); + if (atomic_read(&cookie->n_accesses) !=3D 0) break; if (test_bit(FSCACHE_COOKIE_DO_RELINQUISH, &cookie->flags)) { @@ -1063,8 +1066,8 @@ void __fscache_invalidate(struct fscache_cookie *cook= ie, return; =20 case FSCACHE_COOKIE_STATE_LOOKING_UP: - __fscache_begin_cookie_access(cookie, fscache_access_invalidate_cookie); - set_bit(FSCACHE_COOKIE_DO_INVALIDATE, &cookie->flags); + if (!test_and_set_bit(FSCACHE_COOKIE_DO_INVALIDATE, &cookie->flags)) + __fscache_begin_cookie_access(cookie, fscache_access_invalidate_cookie); fallthrough; case FSCACHE_COOKIE_STATE_CREATING: spin_unlock(&cookie->lock); --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C35B8C32772 for ; Tue, 23 Aug 2022 08:43:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237982AbiHWInq (ORCPT ); Tue, 23 Aug 2022 04:43:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346964AbiHWIkg (ORCPT ); Tue, 23 Aug 2022 04:40:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A255242ADD; Tue, 23 Aug 2022 01:18:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 752D26132D; Tue, 23 Aug 2022 08:17:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 637C0C4347C; Tue, 23 Aug 2022 08:17:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242648; bh=+5grhzWxnc1TKl7dza1qwlywolTWQBQKx7cAp1Gda70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z+9OBNHnQg7SVYQNfvqTodiMAuKCyZxQtPCMY59JKSCrUsVnZTMCwvifSCPwj6owV h/TrSCW921dz1x4wFHsU1FAVK525B93hHHjPoRNJEgTr/woikTpUDHxuR6OzivZY7i p3/DUSMOEFNE7wVWK3Fo8epXM7nRSnckaGglyXKE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias May , Guillaume Nault , Jakub Kicinski Subject: [PATCH 5.19 153/365] geneve: fix TOS inheriting for ipv4 Date: Tue, 23 Aug 2022 10:00:54 +0200 Message-Id: <20220823080124.625166031@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matthias May commit b4ab94d6adaa5cf842b68bd28f4b50bc774496bd upstream. The current code retrieves the TOS field after the lookup on the ipv4 routing table. The routing process currently only allows routing based on the original 3 TOS bits, and not on the full 6 DSCP bits. As a result the retrieved TOS is cut to the 3 bits. However for inheriting purposes the full 6 bits should be used. Extract the full 6 bits before the route lookup and use that instead of the cut off 3 TOS bits. Fixes: e305ac6cf5a1 ("geneve: Add support to collect tunnel metadata.") Signed-off-by: Matthias May Acked-by: Guillaume Nault Link: https://lore.kernel.org/r/20220805190006.8078-1-matthias.may@westermo= .com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/geneve.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -797,7 +797,8 @@ static struct rtable *geneve_get_v4_rt(s struct geneve_sock *gs4, struct flowi4 *fl4, const struct ip_tunnel_info *info, - __be16 dport, __be16 sport) + __be16 dport, __be16 sport, + __u8 *full_tos) { bool use_cache =3D ip_tunnel_dst_cache_usable(skb, info); struct geneve_dev *geneve =3D netdev_priv(dev); @@ -823,6 +824,8 @@ static struct rtable *geneve_get_v4_rt(s use_cache =3D false; } fl4->flowi4_tos =3D RT_TOS(tos); + if (full_tos) + *full_tos =3D tos; =20 dst_cache =3D (struct dst_cache *)&info->dst_cache; if (use_cache) { @@ -910,6 +913,7 @@ static int geneve_xmit_skb(struct sk_buf const struct ip_tunnel_key *key =3D &info->key; struct rtable *rt; struct flowi4 fl4; + __u8 full_tos; __u8 tos, ttl; __be16 df =3D 0; __be16 sport; @@ -920,7 +924,7 @@ static int geneve_xmit_skb(struct sk_buf =20 sport =3D udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); rt =3D geneve_get_v4_rt(skb, dev, gs4, &fl4, info, - geneve->cfg.info.key.tp_dst, sport); + geneve->cfg.info.key.tp_dst, sport, &full_tos); if (IS_ERR(rt)) return PTR_ERR(rt); =20 @@ -964,7 +968,7 @@ static int geneve_xmit_skb(struct sk_buf =20 df =3D key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0; } else { - tos =3D ip_tunnel_ecn_encap(fl4.flowi4_tos, ip_hdr(skb), skb); + tos =3D ip_tunnel_ecn_encap(full_tos, ip_hdr(skb), skb); if (geneve->cfg.ttl_inherit) ttl =3D ip_tunnel_get_ttl(ip_hdr(skb), skb); else @@ -1148,7 +1152,7 @@ static int geneve_fill_metadata_dst(stru 1, USHRT_MAX, true); =20 rt =3D geneve_get_v4_rt(skb, dev, gs4, &fl4, info, - geneve->cfg.info.key.tp_dst, sport); + geneve->cfg.info.key.tp_dst, sport, NULL); if (IS_ERR(rt)) return PTR_ERR(rt); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1345AC32772 for ; Tue, 23 Aug 2022 09:54:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241997AbiHWJye (ORCPT ); Tue, 23 Aug 2022 05:54:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352284AbiHWJv3 (ORCPT ); Tue, 23 Aug 2022 05:51:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBEE89F0EA; Tue, 23 Aug 2022 01:45:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 224AEB81C39; Tue, 23 Aug 2022 08:17:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75668C433C1; Tue, 23 Aug 2022 08:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242651; bh=VjhgaeQuIzUr58TJv2AShtXaQvD2k3yhALj3E6r+uoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y0UiCzsoCUYkF+2JN9VOaXzDq6zsdvFS/Ivwt9iUvaef/Wfci57YRDAVabn1obLOP s2Ae/eWPJNXbTb7z71J6eLtTkNjYtz8LwMgSQtUPANmiG8pJKbqAwm/g3I41lz++UK G2wC14ZHKnx2vCwU2q/3HAAJKNufa6g5hknrOOdg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Chaitanya Kulkarni , "Ewan D. Milne" , James Smart , Muneendra Kumar M Subject: [PATCH 5.19 154/365] nvme-fc: fix the fc_appid_store return value Date: Tue, 23 Aug 2022 10:00:55 +0200 Message-Id: <20220823080124.671691940@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig commit 9317d0014499182c77a03cd095e83bcfb0f53750 upstream. "nvme-fc: fold t fc_update_appid into fc_appid_store" accidentally changed the userspace interface for the appid attribute, because the code that decrements "count" to remove a trailing '\n' in the parsing results in the decremented value being incorrectly be returned from the sysfs write. Fix this by keeping an orig_count variable for the full length of the write. Fixes: c814153c83a8 ("nvme-fc: fold t fc_update_appid into fc_appid_store") Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Reviewed-by: Ewan D. Milne Reviewed-by: James Smart Tested-by: Muneendra Kumar M Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/nvme/host/fc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 8d14df8eeab8..127abaf9ba5d 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -3880,6 +3880,7 @@ static int fc_parse_cgrpid(const char *buf, u64 *id) static ssize_t fc_appid_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { + size_t orig_count =3D count; u64 cgrp_id; int appid_len =3D 0; int cgrpid_len =3D 0; @@ -3904,7 +3905,7 @@ static ssize_t fc_appid_store(struct device *dev, ret =3D blkcg_set_fc_appid(app_id, cgrp_id, sizeof(app_id)); if (ret < 0) return ret; - return count; + return orig_count; } static DEVICE_ATTR(appid_store, 0200, NULL, fc_appid_store); #endif /* CONFIG_BLK_CGROUP_FC_APPID */ --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89B51C32772 for ; Tue, 23 Aug 2022 09:54:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242821AbiHWJyn (ORCPT ); Tue, 23 Aug 2022 05:54:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352299AbiHWJva (ORCPT ); Tue, 23 Aug 2022 05:51:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B596C9F0E7; Tue, 23 Aug 2022 01:45:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1DC8DB81C3A; Tue, 23 Aug 2022 08:17:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56D1AC433D6; Tue, 23 Aug 2022 08:17:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242654; bh=OiF9Vciiallwzx+M+oH/zhtKHR7aGt/6vvnZGDtF6Fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=puEF5OblHnDjNgbEYeyoerQyQMQAfozr9ze7RFUOvt82CNvm7nrHNO9ukOSDcTZdz JZejbjQRPQ4CXE0OElFtPViwGRPPTmpXQlTCbpgmo53JBGV6AA2dM0ywOOW+KIh+ok aMH3HPL5p3sXrdOx+UWvo+HE2bjZWPz93sYNC22Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Masami Hiramatsu , Alexander Shishkin , Ingo Molnar , Jiri Olsa , kernel-janitors@vger.kernel.org, Mark Rutland , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 5.19 155/365] perf probe: Fix an error handling path in parse_perf_probe_command() Date: Tue, 23 Aug 2022 10:00:56 +0200 Message-Id: <20220823080124.707978080@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET commit 4bf6dcaa93bcd083a13c278a91418fe10e6d23a0 upstream. If a memory allocation fail, we should branch to the error handling path in order to free some resources allocated a few lines above. Fixes: 15354d54698648e2 ("perf probe: Generate event name with line number") Signed-off-by: Christophe JAILLET Acked-by: Masami Hiramatsu Cc: Alexander Shishkin Cc: Ingo Molnar Cc: Jiri Olsa Cc: kernel-janitors@vger.kernel.org Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: https://lore.kernel.org/r/b71bcb01fa0c7b9778647235c3ab490f699ba278.16= 59797452.git.christophe.jaillet@wanadoo.fr Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- tools/perf/util/probe-event.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -1775,8 +1775,10 @@ int parse_perf_probe_command(const char if (!pev->event && pev->point.function && pev->point.line && !pev->point.lazy_line && !pev->point.offset) { if (asprintf(&pev->event, "%s_L%d", pev->point.function, - pev->point.line) < 0) - return -ENOMEM; + pev->point.line) < 0) { + ret =3D -ENOMEM; + goto out; + } } =20 /* Copy arguments and ensure return probe has no C argument */ From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6746EC32792 for ; Tue, 23 Aug 2022 08:52:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347222AbiHWIwS (ORCPT ); Tue, 23 Aug 2022 04:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348409AbiHWIv1 (ORCPT ); Tue, 23 Aug 2022 04:51:27 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E354A7D1CF; Tue, 23 Aug 2022 01:23:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6A148CE1B35; Tue, 23 Aug 2022 08:17:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78F69C433D6; Tue, 23 Aug 2022 08:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242657; bh=efGEspcF5pNJAi8jGCXqCYNzKEOJZR9M4Z6Xin4Qk84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NL0oyUMTEEto/3pzDJII0/HUV9OV3RULYHPHJe7/TxfZUwkaD6gVZ0hWJjf+M8aeh bxK9iLhk43ltP5cHvtUoVUhRizxABSamebcbE0vCar3hG8wqrPGmHDQV8Pg630Theo fG1LNgZS+4q4IYlmTOJV838kedmMogVnClnwJqKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Reckmann , Luca Weiss , Caleb Connolly , Konrad Dybcio , Wolfram Sang Subject: [PATCH 5.19 156/365] i2c: qcom-geni: Fix GPI DMA buffer sync-back Date: Tue, 23 Aug 2022 10:00:57 +0200 Message-Id: <20220823080124.756891054@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robin Reckmann commit 8689b80b22dbf1f5e993233370fe57f08731b14d upstream. Fix i2c transfers using GPI DMA mode for all message types that do not set the I2C_M_DMA_SAFE flag (e.g. SMBus "read byte"). In this case a bounce buffer is returned by i2c_get_dma_safe_msg_buf(), and it has to synced back to the message after the transfer is done. Add missing assignment of dma buffer in geni_i2c_gpi(). Set xferred in i2c_put_dma_safe_msg_buf() to true in case of no error to ensure the sync-back of this dma buffer to the message. Fixes: d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA") Signed-off-by: Robin Reckmann Tested-by: Luca Weiss Tested-by: Caleb Connolly Reviewed-by: Konrad Dybcio Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-qcom-geni.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -484,12 +484,12 @@ static void geni_i2c_gpi_unmap(struct ge { if (tx_buf) { dma_unmap_single(gi2c->se.dev->parent, tx_addr, msg->len, DMA_TO_DEVICE); - i2c_put_dma_safe_msg_buf(tx_buf, msg, false); + i2c_put_dma_safe_msg_buf(tx_buf, msg, !gi2c->err); } =20 if (rx_buf) { dma_unmap_single(gi2c->se.dev->parent, rx_addr, msg->len, DMA_FROM_DEVIC= E); - i2c_put_dma_safe_msg_buf(rx_buf, msg, false); + i2c_put_dma_safe_msg_buf(rx_buf, msg, !gi2c->err); } } =20 @@ -553,6 +553,7 @@ static int geni_i2c_gpi(struct geni_i2c_ desc->callback_param =3D gi2c; =20 dmaengine_submit(desc); + *buf =3D dma_buf; *dma_addr_p =3D addr; =20 return 0; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB8AFC32772 for ; Tue, 23 Aug 2022 08:40:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346178AbiHWIkU (ORCPT ); Tue, 23 Aug 2022 04:40:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345873AbiHWIjo (ORCPT ); Tue, 23 Aug 2022 04:39:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3977F14016; Tue, 23 Aug 2022 01:18:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 46C40B81C48; Tue, 23 Aug 2022 08:17:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87CBFC4314D; Tue, 23 Aug 2022 08:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242660; bh=lzzDnu9ep7+cqxHP4yyCabn1tT37/GrAU7qmCUqISIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f2LkzkHXrGXZxBXQb68qY4KuUBx5v04Ruih/UQyZL3bCysHYSw90++Apz97MWtBBn nh1vmW7dyFKrkkTMRO3/v51JFZ/3EYH5CLbW9a/lD13IOWfAEWLEgdkh4BjCimOjV0 7XWsSrmBzq3vkOmo8hDhRFu/QtImWfrhscJVNShg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Ian Rogers , Jin Yao , Jiri Olsa , Namhyung Kim , Arnaldo Carvalho de Melo Subject: [PATCH 5.19 157/365] perf parse-events: Fix segfault when event parser gets an error Date: Tue, 23 Aug 2022 10:00:58 +0200 Message-Id: <20220823080124.797045620@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adrian Hunter commit 2e828582b81f5bc76a4fe8e7812df259ab208302 upstream. parse_events() is often called with parse_events_error set to NULL. Make parse_events_error__handle() not segfault in that case. A subsequent patch changes to avoid passing NULL in the first place. Fixes: 43eb05d066795bdf ("perf tests: Support 'Track with sched_switch' tes= t for hybrid") Signed-off-by: Adrian Hunter Cc: Ian Rogers Cc: Jin Yao Cc: Jiri Olsa Cc: Namhyung Kim Link: https://lore.kernel.org/r/20220809080702.6921-2-adrian.hunter@intel.c= om Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- tools/perf/util/parse-events.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -2391,9 +2391,12 @@ void parse_events_error__exit(struct par void parse_events_error__handle(struct parse_events_error *err, int idx, char *str, char *help) { - if (WARN(!str, "WARNING: failed to provide error string\n")) { - free(help); - return; + if (WARN(!str, "WARNING: failed to provide error string\n")) + goto out_free; + if (!err) { + /* Assume caller does not want message printed */ + pr_debug("event syntax error: %s\n", str); + goto out_free; } switch (err->num_errors) { case 0: @@ -2419,6 +2422,11 @@ void parse_events_error__handle(struct p break; } err->num_errors++; + return; + +out_free: + free(str); + free(help); } =20 #define MAX_WIDTH 1000 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2CBBC32772 for ; Tue, 23 Aug 2022 08:40:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346591AbiHWIkX (ORCPT ); Tue, 23 Aug 2022 04:40:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345931AbiHWIjp (ORCPT ); Tue, 23 Aug 2022 04:39:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 396921400C; Tue, 23 Aug 2022 01:18:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A9ECD61242; Tue, 23 Aug 2022 08:17:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2DDBC433D6; Tue, 23 Aug 2022 08:17:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242664; bh=/vddohBAtiuE49XccEW6KW7TVaa7sg2giPocq9caIVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VuQWzv5rMu99LLg4icHEnYTNtB6L+FVqlJ8lJTzMF/OScso4MR6+IF20Ko4Js9BjA yogGVxK+W4GnJFqVDOG44jGxWam19hJYSc+NFWTrg39tvTobeujNCuEChJhgeluY8/ U9jp09eurCKzdbu25+ouXWX0IAw7L+dtiN6vGKZA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Ian Rogers , Jin Yao , Jiri Olsa , Namhyung Kim , Arnaldo Carvalho de Melo Subject: [PATCH 5.19 158/365] perf tests: Fix Track with sched_switch test for hybrid case Date: Tue, 23 Aug 2022 10:00:59 +0200 Message-Id: <20220823080124.840728405@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adrian Hunter commit 1da1d60774014137d776d0400fdf2f1779d8d4d5 upstream. If cpu_core PMU event fails to parse, try also cpu_atom PMU event when parsing cycles event. Fixes: 43eb05d066795bdf ("perf tests: Support 'Track with sched_switch' tes= t for hybrid") Signed-off-by: Adrian Hunter Cc: Ian Rogers Cc: Jin Yao Cc: Jiri Olsa Cc: Namhyung Kim Link: https://lore.kernel.org/r/20220809080702.6921-3-adrian.hunter@intel.c= om Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- tools/perf/tests/switch-tracking.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) --- a/tools/perf/tests/switch-tracking.c +++ b/tools/perf/tests/switch-tracking.c @@ -324,6 +324,7 @@ out_free_nodes: static int test__switch_tracking(struct test_suite *test __maybe_unused, i= nt subtest __maybe_unused) { const char *sched_switch =3D "sched:sched_switch"; + const char *cycles =3D "cycles:u"; struct switch_tracking switch_tracking =3D { .tids =3D NULL, }; struct record_opts opts =3D { .mmap_pages =3D UINT_MAX, @@ -372,12 +373,19 @@ static int test__switch_tracking(struct cpu_clocks_evsel =3D evlist__last(evlist); =20 /* Second event */ - if (perf_pmu__has_hybrid()) - err =3D parse_events(evlist, "cpu_core/cycles/u", NULL); - else - err =3D parse_events(evlist, "cycles:u", NULL); + if (perf_pmu__has_hybrid()) { + cycles =3D "cpu_core/cycles/u"; + err =3D parse_events(evlist, cycles, NULL); + if (err) { + cycles =3D "cpu_atom/cycles/u"; + pr_debug("Trying %s\n", cycles); + err =3D parse_events(evlist, cycles, NULL); + } + } else { + err =3D parse_events(evlist, cycles, NULL); + } if (err) { - pr_debug("Failed to parse event cycles:u\n"); + pr_debug("Failed to parse event %s\n", cycles); goto out_err; } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 334FDC32772 for ; Tue, 23 Aug 2022 08:39:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345192AbiHWIjb (ORCPT ); Tue, 23 Aug 2022 04:39:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345248AbiHWIhl (ORCPT ); Tue, 23 Aug 2022 04:37:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 362DC77EA1; Tue, 23 Aug 2022 01:17:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D76E961344; Tue, 23 Aug 2022 08:17:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD524C433D6; Tue, 23 Aug 2022 08:17:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242667; bh=t0Sc8RZxa/pZqGq0aB0vjxLJ2hWzF2qUPy/sMJKfolU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZjrQ3Z/E3FP7RILuFEnQF3kmYRC1RajdcEG88dUvWjhpaycKXgHtj2s8Oqth9Sm+N E/Ru0pIgf7vokQHJYyTyuVZyTu9GoJHE9zcsWXA2vj4J614HojJYqLhAhHV+eiT2ko th6ceVRfyGYJibH70fSamjQjjY4i57oZakgbJpWo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Lin , Ioana Ciornei , Jakub Kicinski Subject: [PATCH 5.19 159/365] dpaa2-eth: trace the allocated address instead of page struct Date: Tue, 23 Aug 2022 10:01:00 +0200 Message-Id: <20220823080124.878068449@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chen Lin commit e34f49348f8b7a53205b6f77707a3a6a40cf420b upstream. We should trace the allocated address instead of page struct. Fixes: 27c874867c4e ("dpaa2-eth: Use a single page per Rx buffer") Signed-off-by: Chen Lin Reviewed-by: Ioana Ciornei Link: https://lore.kernel.org/r/20220811151651.3327-1-chen45464546@163.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -1660,8 +1660,8 @@ static int dpaa2_eth_add_bufs(struct dpa buf_array[i] =3D addr; =20 /* tracing point */ - trace_dpaa2_eth_buf_seed(priv->net_dev, - page, DPAA2_ETH_RX_BUF_RAW_SIZE, + trace_dpaa2_eth_buf_seed(priv->net_dev, page_address(page), + DPAA2_ETH_RX_BUF_RAW_SIZE, addr, priv->rx_buf_size, bpid); } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30ADBC32772 for ; Tue, 23 Aug 2022 08:44:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347194AbiHWIn7 (ORCPT ); Tue, 23 Aug 2022 04:43:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347604AbiHWIlA (ORCPT ); Tue, 23 Aug 2022 04:41:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E9B15F234; Tue, 23 Aug 2022 01:19:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2930661360; Tue, 23 Aug 2022 08:17:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D8A3C433D6; Tue, 23 Aug 2022 08:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242670; bh=Rb8RqMWonuLosEt81hl+n3DDIYofEdVxfe5kXGS+gVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OYT7Djebl8/ySjAl7YMKNXWh7UvmaPlL4DVuK55d6HLL2Ft9obw55m+mIXkLuxCvC 6QDWkqD9WAqaZv92EaQjmw5OTCVfO1fcKgjKvIRm+SG9L8VuO0yqI/n0+CIhBO+Eq8 zj39QPTEOxgF+UWfdo2THaCevitfzhsbGB6YZCbg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yan Lei , Konstantin Komarov Subject: [PATCH 5.19 160/365] fs/ntfs3: Fix using uninitialized value n when calling indx_read Date: Tue, 23 Aug 2022 10:01:01 +0200 Message-Id: <20220823080124.909853406@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yan Lei commit ae5a4e46916fc307288227b64c1d062352eb93b7 upstream. This value is checked in indx_read, so it must be initialized Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Yan Lei Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/ntfs3/index.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -1994,7 +1994,7 @@ static int indx_free_children(struct ntf const struct NTFS_DE *e, bool trim) { int err; - struct indx_node *n; + struct indx_node *n =3D NULL; struct INDEX_HDR *hdr; CLST vbn =3D de_get_vbn(e); size_t i; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BA47C32792 for ; Tue, 23 Aug 2022 08:43:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343540AbiHWInG (ORCPT ); Tue, 23 Aug 2022 04:43:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346629AbiHWIk1 (ORCPT ); Tue, 23 Aug 2022 04:40:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64D115F9BD; Tue, 23 Aug 2022 01:18:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1476061367; Tue, 23 Aug 2022 08:17:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EBDFC433C1; Tue, 23 Aug 2022 08:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242676; bh=g0ljEhDQMy0x7RlhJ7S6O9duSphc00Lp5+QaDZm3Jek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CiooeHt8h8MixqlG/UtXqhVo8im7C792c1uAshkvUXOeMlotT2ppsQnR0ckY+HqsW nQ5Pnn8Ak+EhlF4z0HB70G/4Znb2qu1zZptFb05YToWF2kkqzMdkSIPNA9HZH+jXON PK4oQpcxjD6gqntR/GT9ULBDoUA7Ucxe8KhFCs5A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Konstantin Komarov , syzbot+c95173762127ad76a824@syzkaller.appspotmail.com Subject: [PATCH 5.19 161/365] fs/ntfs3: Fix NULL deref in ntfs_update_mftmirr Date: Tue, 23 Aug 2022 10:01:02 +0200 Message-Id: <20220823080124.951238235@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Skripkin commit 321460ca3b55f48b3ba6008248264ab2bd6407d9 upstream. If ntfs_fill_super() wasn't called then sbi->sb will be equal to NULL. Code should check this ptr before dereferencing. Syzbot hit this issue via passing wrong mount param as can be seen from log below Fail log: ntfs3: Unknown parameter 'iochvrset' general protection fault, probably for non-canonical address 0xdffffc000000= 0003: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f] CPU: 1 PID: 3589 Comm: syz-executor210 Not tainted 5.18.0-rc3-syzkaller-000= 16-gb253435746d9 #0 ... Call Trace: put_ntfs+0x1ed/0x2a0 fs/ntfs3/super.c:463 ntfs_fs_free+0x6a/0xe0 fs/ntfs3/super.c:1363 put_fs_context+0x119/0x7a0 fs/fs_context.c:469 do_new_mount+0x2b4/0xad0 fs/namespace.c:3044 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Reported-and-tested-by: syzbot+c95173762127ad76a824@syzkaller.appspotmail.c= om Signed-off-by: Pavel Skripkin Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/ntfs3/fsntfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -831,10 +831,15 @@ int ntfs_update_mftmirr(struct ntfs_sb_i { int err; struct super_block *sb =3D sbi->sb; - u32 blocksize =3D sb->s_blocksize; + u32 blocksize; sector_t block1, block2; u32 bytes; =20 + if (!sb) + return -EINVAL; + + blocksize =3D sb->s_blocksize; + if (!(sbi->flags & NTFS_FLAGS_MFTMIRR)) return 0; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E97AC32772 for ; Tue, 23 Aug 2022 08:44:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346771AbiHWIog (ORCPT ); Tue, 23 Aug 2022 04:44:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348895AbiHWIl7 (ORCPT ); Tue, 23 Aug 2022 04:41:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEB8A7AC10; Tue, 23 Aug 2022 01:20:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 619CF612FE; Tue, 23 Aug 2022 08:20:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D39CEC433C1; Tue, 23 Aug 2022 08:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242804; bh=hG3JMbhdNDO2gZbIp193qOzFN0q0GOPDtuYxgu3A/pg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S4tk9VYtKUXF4dqZORrAzF7QrCbsNgRjbOp+a/5DcxPs38gK8t0HW+5X4qleH4eJD 4d8dbp56HmqyilGTtDr4zmx8W/m+BAj8TrV+bAovkApCffXBBs763YSrO/HRtMdIYe 0A9T1PfltjDOVSwDAJcEQwnsW8nbeW/tHBG8S5tA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Namjae Jeon , Konstantin Komarov Subject: [PATCH 5.19 162/365] fs/ntfs3: Dont clear upper bits accidentally in log_replay() Date: Tue, 23 Aug 2022 10:01:03 +0200 Message-Id: <20220823080124.991671071@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter commit 926034353d3c67db1ffeab47dcb7f6bdac02a263 upstream. The "vcn" variable is a 64 bit. The "log->clst_per_page" variable is a u32. This means that the mask accidentally clears out the high 32 bits when it was only supposed to clear some low bits. Fix this by adding a cast to u64. Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal") Signed-off-by: Dan Carpenter Reviewed-by: Namjae Jeon Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/ntfs3/fslog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -5057,7 +5057,7 @@ undo_action_next: goto add_allocated_vcns; =20 vcn =3D le64_to_cpu(lrh->target_vcn); - vcn &=3D ~(log->clst_per_page - 1); + vcn &=3D ~(u64)(log->clst_per_page - 1); =20 add_allocated_vcns: for (i =3D 0, vcn =3D le64_to_cpu(lrh->target_vcn), From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18FE1C32772 for ; Tue, 23 Aug 2022 08:39:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346258AbiHWIju (ORCPT ); Tue, 23 Aug 2022 04:39:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344526AbiHWIjJ (ORCPT ); Tue, 23 Aug 2022 04:39:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD5BC263D; Tue, 23 Aug 2022 01:18:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4176E61344; Tue, 23 Aug 2022 08:18:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4558BC433C1; Tue, 23 Aug 2022 08:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242694; bh=irptwIDxqF2pKji92Dk04MOvhgeuIDxlQ8Rc8roUWe8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pl6XJIo0KsjbGmuwVD4FNVtUUCgcnzabNOFEfs4LEvenfE4en1oX6T7tMF/oNTLw3 rLHr4WdtUmGlhM9bl7js7CZV3H364DgiEtATG9r4GWZrMRxSplPbBp330M85MeyL6x LgiXUqPG/ks9GvNDI884s22lhAOrYvOSFfeMOMgA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Komarov Subject: [PATCH 5.19 163/365] fs/ntfs3: Fix double free on remount Date: Tue, 23 Aug 2022 10:01:04 +0200 Message-Id: <20220823080125.031762428@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konstantin Komarov commit cd39981fb92adf0cc736112f87e3e61602baa415 upstream. Pointer to options was freed twice on remount Fixes xfstest generic/361 Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/ntfs3/super.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -390,7 +391,7 @@ static int ntfs_fs_reconfigure(struct fs return -EINVAL; } =20 - memcpy(sbi->options, new_opts, sizeof(*new_opts)); + swap(sbi->options, fc->fs_private); =20 return 0; } @@ -900,6 +901,8 @@ static int ntfs_fill_super(struct super_ ref.high =3D 0; =20 sbi->sb =3D sb; + sbi->options =3D fc->fs_private; + fc->fs_private =3D NULL; sb->s_flags |=3D SB_NODIRATIME; sb->s_magic =3D 0x7366746e; // "ntfs" sb->s_op =3D &ntfs_sops; @@ -1262,8 +1265,6 @@ load_root: goto put_inode_out; } =20 - fc->fs_private =3D NULL; - return 0; =20 put_inode_out: @@ -1416,7 +1417,6 @@ static int ntfs_init_fs_context(struct f mutex_init(&sbi->compress.mtx_lzx); #endif =20 - sbi->options =3D opts; fc->s_fs_info =3D sbi; ok: fc->fs_private =3D opts; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F6A5C32793 for ; Tue, 23 Aug 2022 08:42:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346824AbiHWIml (ORCPT ); Tue, 23 Aug 2022 04:42:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346666AbiHWIk3 (ORCPT ); Tue, 23 Aug 2022 04:40:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCE555F9B0; Tue, 23 Aug 2022 01:18:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 35087B81C35; Tue, 23 Aug 2022 08:18:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81493C433C1; Tue, 23 Aug 2022 08:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242727; bh=kKw0EQi2ulodqozznFOd8OGQqbXzsUcSA+YuSD2WhII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bC/JhT1/C3VVC8ZoWknpxpDgJpbei8XwIDpGfCxl2+ktuxb1X0haKxgzmHSe4/gwT thODX4uBai2yZNnPSFbbRGXzkziYEgpo+saesRKsBvuEOQ/Mn54z+jRDqrG8qt2KKj Sbv4gQ9cB0GgFLBqpONR3SFxfCcCvGp95WVQPujQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Komarov Subject: [PATCH 5.19 164/365] fs/ntfs3: Do not change mode if ntfs_set_ea failed Date: Tue, 23 Aug 2022 10:01:05 +0200 Message-Id: <20220823080125.075969620@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konstantin Komarov commit 460bbf2990b3fdc597601c2cf669a3371c069242 upstream. ntfs_set_ea can fail with NOSPC, so we don't need to change mode in this situation. Fixes xfstest generic/449 Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations") Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/ntfs3/xattr.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -547,28 +547,23 @@ static noinline int ntfs_set_acl_ex(stru { const char *name; size_t size, name_len; - void *value =3D NULL; - int err =3D 0; + void *value; + int err; int flags; + umode_t mode; =20 if (S_ISLNK(inode->i_mode)) return -EOPNOTSUPP; =20 + mode =3D inode->i_mode; switch (type) { case ACL_TYPE_ACCESS: /* Do not change i_mode if we are in init_acl */ if (acl && !init_acl) { - umode_t mode; - err =3D posix_acl_update_mode(mnt_userns, inode, &mode, &acl); if (err) goto out; - - if (inode->i_mode !=3D mode) { - inode->i_mode =3D mode; - mark_inode_dirty(inode); - } } name =3D XATTR_NAME_POSIX_ACL_ACCESS; name_len =3D sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1; @@ -604,8 +599,13 @@ static noinline int ntfs_set_acl_ex(stru err =3D ntfs_set_ea(inode, name, name_len, value, size, flags, 0); if (err =3D=3D -ENODATA && !size) err =3D 0; /* Removing non existed xattr. */ - if (!err) + if (!err) { set_cached_acl(inode, type, acl); + if (inode->i_mode !=3D mode) { + inode->i_mode =3D mode; + mark_inode_dirty(inode); + } + } =20 out: kfree(value); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91540C32772 for ; Tue, 23 Aug 2022 08:57:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233635AbiHWI5r (ORCPT ); Tue, 23 Aug 2022 04:57:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241016AbiHWI5W (ORCPT ); Tue, 23 Aug 2022 04:57:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC1888049F; Tue, 23 Aug 2022 01:25:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8131AB81C50; Tue, 23 Aug 2022 08:19:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D44F2C433D7; Tue, 23 Aug 2022 08:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242762; bh=2MjMmv1DWYOrh+U1u+hL4AFpZ83wNRy9AWvFn4o+AHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fB/K8e4F+E5apPYoT25Mr2yoltJBFxF/71B3Fh54uVsayYdR/W/3mmAo5jrQYBKP+ /i0mrJS7/OG+C6fQJts+t6TXoLeOAu5nbOdFdhTbFv4jk6e9Vq2YVId7+2oKMZtDcT GS9szMeiTe4Nk0VBlckA6z5WikTSKIZeBv8kSZAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liangbin Lian , Konstantin Komarov Subject: [PATCH 5.19 165/365] fs/ntfs3: Fix missing i_op in ntfs_read_mft Date: Tue, 23 Aug 2022 10:01:06 +0200 Message-Id: <20220823080125.115283591@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konstantin Komarov commit 37a530bfe56ca9a0d3129598803f2794c7428aae upstream. There is null pointer dereference because i_op =3D=3D NULL. The bug happens because we don't initialize i_op for records in $Extend. Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Reported-by: Liangbin Lian Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/ntfs3/inode.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -430,6 +430,7 @@ end_enum: } else if (fname && fname->home.low =3D=3D cpu_to_le32(MFT_REC_EXTEND) && fname->home.seq =3D=3D cpu_to_le16(MFT_REC_EXTEND)) { /* Records in $Extend are not a files or general directories. */ + inode->i_op =3D &ntfs_file_inode_operations; } else { err =3D -EINVAL; goto out; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78F13C32772 for ; Tue, 23 Aug 2022 09:27:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349837AbiHWJ1p (ORCPT ); Tue, 23 Aug 2022 05:27:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349942AbiHWJY4 (ORCPT ); Tue, 23 Aug 2022 05:24:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AEA175CD5; Tue, 23 Aug 2022 01:35:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D2188B81C28; Tue, 23 Aug 2022 08:19:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F7ADC433D7; Tue, 23 Aug 2022 08:19:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242785; bh=FiKJFq3p3hNMNAz/G+j1Jr63XmO/Uxj1ECLA2jSv+YM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fUi48zzweYQf3y0Kmo/gNVCbvpt4EJDqtg1PNwaPoFweQ+rQvw+ePTdWqC4lTXg7P YUKwUNrLPn/hyHzezZXRdMONL7Gi/GfrL4O3q654O31+uvihp97MPzZV4GwW8sxc9a jPkpId8lTJYljugZnl+ff+fOtrLusEB+MEfnF9jU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Dinh Nguyen Subject: [PATCH 5.19 166/365] nios2: page fault et.al. are *not* restartable syscalls... Date: Tue, 23 Aug 2022 10:01:07 +0200 Message-Id: <20220823080125.155578187@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro commit 8535c239ac674f7ead0f2652932d35c52c4123b2 upstream. make sure that ->orig_r2 is negative for everything except the syscalls. Fixes: 82ed08dd1b0e ("nios2: Exception handling") Signed-off-by: Al Viro Signed-off-by: Dinh Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/nios2/include/asm/entry.h | 3 ++- arch/nios2/kernel/entry.S | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) --- a/arch/nios2/include/asm/entry.h +++ b/arch/nios2/include/asm/entry.h @@ -50,7 +50,8 @@ stw r13, PT_R13(sp) stw r14, PT_R14(sp) stw r15, PT_R15(sp) - stw r2, PT_ORIG_R2(sp) + movi r24, -1 + stw r24, PT_ORIG_R2(sp) stw r7, PT_ORIG_R7(sp) =20 stw ra, PT_RA(sp) --- a/arch/nios2/kernel/entry.S +++ b/arch/nios2/kernel/entry.S @@ -185,6 +185,7 @@ ENTRY(handle_system_call) ldw r5, PT_R5(sp) =20 local_restart: + stw r2, PT_ORIG_R2(sp) /* Check that the requested system call is within limits */ movui r1, __NR_syscalls bgeu r2, r1, ret_invsyscall @@ -336,9 +337,6 @@ external_interrupt: /* skip if no interrupt is pending */ beq r12, r0, ret_from_interrupt =20 - movi r24, -1 - stw r24, PT_ORIG_R2(sp) - /* * Process an external hardware interrupt. */ From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78FFBC32772 for ; Tue, 23 Aug 2022 08:45:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240545AbiHWIpP (ORCPT ); Tue, 23 Aug 2022 04:45:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347018AbiHWInR (ORCPT ); Tue, 23 Aug 2022 04:43:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A14F37B28D; Tue, 23 Aug 2022 01:20:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2FDDE61347; Tue, 23 Aug 2022 08:19:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FC14C433D6; Tue, 23 Aug 2022 08:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242788; bh=EkgEL8VNg3xEP7YC4/zdUsjn0OhSMPb/3b8UAiUZx84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=byYYsYGCHVyOg33WUQSBzZmpLgFDbrD0ReTMaXvj4KvcZDlDyIeKF8v9L0YRZYHCe C6Iv1eaO+QbkmF0MQtwrDp8udsXyw4rR7/ePbl2sPGcOxJ18PKia6jO/SWiAS+w3Zk Y6hxU+yP0OM1uruX/QhY4lMv5N34YoAai7fBLBbw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Dinh Nguyen Subject: [PATCH 5.19 167/365] nios2: dont leave NULLs in sys_call_table[] Date: Tue, 23 Aug 2022 10:01:08 +0200 Message-Id: <20220823080125.196317360@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro commit 45ec746c65097c25e77d24eae8fee0def5b6cc5d upstream. fill the gaps in there with sys_ni_syscall, as everyone does... Fixes: 82ed08dd1b0e ("nios2: Exception handling") Signed-off-by: Al Viro Signed-off-by: Dinh Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/nios2/kernel/entry.S | 1 - arch/nios2/kernel/syscall_table.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) --- a/arch/nios2/kernel/entry.S +++ b/arch/nios2/kernel/entry.S @@ -193,7 +193,6 @@ local_restart: movhi r11, %hiadj(sys_call_table) add r1, r1, r11 ldw r1, %lo(sys_call_table)(r1) - beq r1, r0, ret_invsyscall =20 /* Check if we are being traced */ GET_THREAD_INFO r11 --- a/arch/nios2/kernel/syscall_table.c +++ b/arch/nios2/kernel/syscall_table.c @@ -13,5 +13,6 @@ #define __SYSCALL(nr, call) [nr] =3D (call), =20 void *sys_call_table[__NR_syscalls] =3D { + [0 ... __NR_syscalls-1] =3D sys_ni_syscall, #include }; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9D60C32772 for ; Tue, 23 Aug 2022 08:59:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242753AbiHWI7u (ORCPT ); Tue, 23 Aug 2022 04:59:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240927AbiHWI73 (ORCPT ); Tue, 23 Aug 2022 04:59:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F07A180B66; Tue, 23 Aug 2022 01:26:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1B27161360; Tue, 23 Aug 2022 08:19:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24C1CC433C1; Tue, 23 Aug 2022 08:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242791; bh=fxlNh0LwhOpWUkF19exROe077tMNe7vdcr/NJnAVD5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oAuCcV10qcmtI3bqAlMvDjqK7MSK5Hnzj1oN5+8A3CCUcG/5Cvd5PvnoUeubj451y R74hFoBTm3vWapuc3LRQtf0NQiE3tG+ncQ7S/YLWj92yllrfUx9e/S3JB+UelUzaTs ELYFsYbBR2WIs7r1nQpgbWX2rE6sxwW89E8xnT+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Dinh Nguyen Subject: [PATCH 5.19 168/365] nios2: traced syscall does need to check the syscall number Date: Tue, 23 Aug 2022 10:01:09 +0200 Message-Id: <20220823080125.245315943@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro commit 25ba820ef36bdbaf9884adeac69b6e1821a7df76 upstream. all checks done before letting the tracer modify the register state are worthless... Fixes: 82ed08dd1b0e ("nios2: Exception handling") Signed-off-by: Al Viro Signed-off-by: Dinh Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/nios2/kernel/entry.S | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/arch/nios2/kernel/entry.S +++ b/arch/nios2/kernel/entry.S @@ -255,9 +255,9 @@ traced_system_call: ldw r6, PT_R6(sp) ldw r7, PT_R7(sp) =20 - /* Fetch the syscall function, we don't need to check the boundaries - * since this is already done. - */ + /* Fetch the syscall function. */ + movui r1, __NR_syscalls + bgeu r2, r1, traced_invsyscall slli r1, r2, 2 movhi r11,%hiadj(sys_call_table) add r1, r1, r11 @@ -287,6 +287,11 @@ end_translate_rc_and_ret2: RESTORE_SWITCH_STACK br ret_from_exception =20 + /* If the syscall number was invalid return ENOSYS */ +traced_invsyscall: + movi r2, -ENOSYS + br translate_rc_and_ret2 + Luser_return: GET_THREAD_INFO r11 /* get thread_info pointer */ ldw r10, TI_FLAGS(r11) /* get thread_info->flags */ From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF6B0C32772 for ; Tue, 23 Aug 2022 08:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237106AbiHWIrI (ORCPT ); Tue, 23 Aug 2022 04:47:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347314AbiHWIoU (ORCPT ); Tue, 23 Aug 2022 04:44:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAB6E6B145; Tue, 23 Aug 2022 01:20:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E8AC8B81C20; Tue, 23 Aug 2022 08:19:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 595E8C433D7; Tue, 23 Aug 2022 08:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242794; bh=c6C804I79hfM6elqVFd462FubGbxEZh/S4AomCrJqhU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T4bpaJNZPwT+Dr10KR2NunMQJ08FlGwny/KxRRkx2flgbIDJ32plxUeKbj2xLaVTO aw9JFcwDZsxtnn9wBN0QHCVvYdapXk8RW20kwi8qyiOnptYVUZFlUwSmNhvtpixi3/ Iqf5H6T1St5Tu0M82OyXivcosyvuHDT1M+IXBfM4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Dinh Nguyen Subject: [PATCH 5.19 169/365] nios2: fix syscall restart checks Date: Tue, 23 Aug 2022 10:01:10 +0200 Message-Id: <20220823080125.293740190@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro commit 2d631bd58fe0ea3e3350212e23c9aba1fb606514 upstream. sys_foo() returns -512 (aka -ERESTARTSYS) =3D> do_signal() sees 512 in r2 and 1 in r1. sys_foo() returns 512 =3D> do_signal() sees 512 in r2 and 0 in r1. The former is restart-worthy; the latter obviously isn't. Fixes: b53e906d255d ("nios2: Signal handling support") Signed-off-by: Al Viro Signed-off-by: Dinh Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/nios2/kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/nios2/kernel/signal.c +++ b/arch/nios2/kernel/signal.c @@ -242,7 +242,7 @@ static int do_signal(struct pt_regs *reg /* * If we were from a system call, check for system call restarting... */ - if (regs->orig_r2 >=3D 0) { + if (regs->orig_r2 >=3D 0 && regs->r1) { continue_addr =3D regs->ea; restart_addr =3D continue_addr - 4; retval =3D regs->r2; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF7ADC38145 for ; Tue, 23 Aug 2022 09:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348895AbiHWJN2 (ORCPT ); Tue, 23 Aug 2022 05:13:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348818AbiHWJKy (ORCPT ); Tue, 23 Aug 2022 05:10:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 455AC86B6F; Tue, 23 Aug 2022 01:31:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1BC0F61446; Tue, 23 Aug 2022 08:19:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24EE7C433C1; Tue, 23 Aug 2022 08:19:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242797; bh=P8ClimO+H2U7s8xsr2RV/hjyQfg0HAP3IMy45wBgbco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kgl/0oItTYINb5LezDrpt+wP1Rf+Fg+/Cwax7JlJan72J7Uv9py0m8R/65zsGP2wc HYwx+ZNAE3Np/Dhfhxj7A6MK2dfOZJHT2rJ+5iEU6MachknOxmQxKmm2/FQ3DNy0nA JWDEUCPi2CYNqv/caqRbwFj+LbrHiSiiZGwBCu8s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Dinh Nguyen Subject: [PATCH 5.19 170/365] nios2: restarts apply only to the first sigframe we build... Date: Tue, 23 Aug 2022 10:01:11 +0200 Message-Id: <20220823080125.334084245@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro commit 411a76b7219555c55867466c82d70ce928d6c9e1 upstream. Fixes: b53e906d255d ("nios2: Signal handling support") Signed-off-by: Al Viro Signed-off-by: Dinh Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/nios2/kernel/signal.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/nios2/kernel/signal.c +++ b/arch/nios2/kernel/signal.c @@ -264,6 +264,7 @@ static int do_signal(struct pt_regs *reg regs->ea =3D restart_addr; break; } + regs->orig_r2 =3D -1; } =20 if (get_signal(&ksig)) { From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EBDEC32772 for ; Tue, 23 Aug 2022 08:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347275AbiHWIpU (ORCPT ); Tue, 23 Aug 2022 04:45:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344922AbiHWInX (ORCPT ); Tue, 23 Aug 2022 04:43:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 785DB6E2C2; Tue, 23 Aug 2022 01:20:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EE65261367; Tue, 23 Aug 2022 08:20:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED536C433C1; Tue, 23 Aug 2022 08:19:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242800; bh=UlzcKidXqLG4HmGSEd5gPKAWOKksFX8ym+DBmzhofjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1kbk+onfIiZY/cWbb194lOiE6bhDKsq3DowCYlgHGSFGcAIgMPz2v5v2gFxfEpkeD Y9QhEGn8nBIf61hzpOu0b/BPVhO33+sZ3h+oXEvIAjdqw/v+xfTGch1GftYe3k7XVA D8InHKGdkdqxp8Scf+r/kJ+ENVf6tmqQE5WxNcmQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Dinh Nguyen Subject: [PATCH 5.19 171/365] nios2: add force_successful_syscall_return() Date: Tue, 23 Aug 2022 10:01:12 +0200 Message-Id: <20220823080125.368529246@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro commit fd0c153daad135d0ec1a53c5dbe6936a724d6ae1 upstream. If we use the ancient SysV syscall ABI, we'd better have tell the kernel how to claim that a negative return value is a success. Use ->orig_r2 for that - it's inaccessible via ptrace, so it's a fair game for changes and it's normally[*] non-negative on return from syscall. Set to -1; syscall is not going to be restart-worthy by definition, so we won't interfere with that use either. [*] the only exception is rt_sigreturn(), where we skip the entire messing with r1/r2 anyway. Fixes: 82ed08dd1b0e ("nios2: Exception handling") Signed-off-by: Al Viro Signed-off-by: Dinh Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/nios2/include/asm/ptrace.h | 2 ++ arch/nios2/kernel/entry.S | 6 ++++++ 2 files changed, 8 insertions(+) --- a/arch/nios2/include/asm/ptrace.h +++ b/arch/nios2/include/asm/ptrace.h @@ -74,6 +74,8 @@ extern void show_regs(struct pt_regs *); ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE)\ - 1) =20 +#define force_successful_syscall_return() (current_pt_regs()->orig_r2 =3D = -1) + int do_syscall_trace_enter(void); void do_syscall_trace_exit(void); #endif /* __ASSEMBLY__ */ --- a/arch/nios2/kernel/entry.S +++ b/arch/nios2/kernel/entry.S @@ -213,6 +213,9 @@ local_restart: translate_rc_and_ret: movi r1, 0 bge r2, zero, 3f + ldw r1, PT_ORIG_R2(sp) + addi r1, r1, 1 + beq r1, zero, 3f sub r2, zero, r2 movi r1, 1 3: @@ -276,6 +279,9 @@ traced_system_call: translate_rc_and_ret2: movi r1, 0 bge r2, zero, 4f + ldw r1, PT_ORIG_R2(sp) + addi r1, r1, 1 + beq r1, zero, 4f sub r2, zero, r2 movi r1, 1 4: From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58BD0C32772 for ; Tue, 23 Aug 2022 08:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347168AbiHWIny (ORCPT ); Tue, 23 Aug 2022 04:43:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348223AbiHWIlY (ORCPT ); Tue, 23 Aug 2022 04:41:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F34F40BE1; Tue, 23 Aug 2022 01:19:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 625E76135D; Tue, 23 Aug 2022 08:18:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61061C43470; Tue, 23 Aug 2022 08:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242697; bh=X6jgYWZ4Mu4BRn1XVD+JQfc78HmS4SDy8hx0sB+nn/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=moqOTMh9KaV8bJAre+F84omy0uPGRK1mKU+rM3OVlCWHGXWNuzE8fupn24himOk/s qin33wZsTgLt9D6HIKUQ8iimE13fJT97QQwhhzSlWY6tn17ZgPPYCDDswTJQGDe4Vx hWBB++00jxIi+PGpdSwj2MR6kOGgqdyn5WFGZ65k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Przemyslaw Patynowski , Jedrzej Jagielski , Marek Szlosek , Tony Nguyen Subject: [PATCH 5.19 172/365] iavf: Fix adminq error handling Date: Tue, 23 Aug 2022 10:01:13 +0200 Message-Id: <20220823080125.404036511@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Przemyslaw Patynowski commit 419831617ed349992c84344dbd9e627f9e68f842 upstream. iavf_alloc_asq_bufs/iavf_alloc_arq_bufs allocates with dma_alloc_coherent memory for VF mailbox. Free DMA regions for both ASQ and ARQ in case error happens during configuration of ASQ/ARQ registers. Without this change it is possible to see when unloading interface: 74626.583369: dma_debug_device_change: device driver has pending DMA alloca= tions while released from device [count=3D32] One of leaked entries details: [device address=3D0x0000000b27ff9000] [size= =3D4096 bytes] [mapped with DMA_BIDIRECTIONAL] [mapped as coherent] Fixes: d358aa9a7a2d ("i40evf: init code and hardware support") Signed-off-by: Przemyslaw Patynowski Signed-off-by: Jedrzej Jagielski Tested-by: Marek Szlosek Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/iavf/iavf_adminq.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/intel/iavf/iavf_adminq.c +++ b/drivers/net/ethernet/intel/iavf/iavf_adminq.c @@ -324,6 +324,7 @@ static enum iavf_status iavf_config_arq_ static enum iavf_status iavf_init_asq(struct iavf_hw *hw) { enum iavf_status ret_code =3D 0; + int i; =20 if (hw->aq.asq.count > 0) { /* queue already initialized */ @@ -354,12 +355,17 @@ static enum iavf_status iavf_init_asq(st /* initialize base registers */ ret_code =3D iavf_config_asq_regs(hw); if (ret_code) - goto init_adminq_free_rings; + goto init_free_asq_bufs; =20 /* success! */ hw->aq.asq.count =3D hw->aq.num_asq_entries; goto init_adminq_exit; =20 +init_free_asq_bufs: + for (i =3D 0; i < hw->aq.num_asq_entries; i++) + iavf_free_dma_mem(hw, &hw->aq.asq.r.asq_bi[i]); + iavf_free_virt_mem(hw, &hw->aq.asq.dma_head); + init_adminq_free_rings: iavf_free_adminq_asq(hw); =20 @@ -383,6 +389,7 @@ init_adminq_exit: static enum iavf_status iavf_init_arq(struct iavf_hw *hw) { enum iavf_status ret_code =3D 0; + int i; =20 if (hw->aq.arq.count > 0) { /* queue already initialized */ @@ -413,12 +420,16 @@ static enum iavf_status iavf_init_arq(st /* initialize base registers */ ret_code =3D iavf_config_arq_regs(hw); if (ret_code) - goto init_adminq_free_rings; + goto init_free_arq_bufs; =20 /* success! */ hw->aq.arq.count =3D hw->aq.num_arq_entries; goto init_adminq_exit; =20 +init_free_arq_bufs: + for (i =3D 0; i < hw->aq.num_arq_entries; i++) + iavf_free_dma_mem(hw, &hw->aq.arq.r.arq_bi[i]); + iavf_free_virt_mem(hw, &hw->aq.arq.dma_head); init_adminq_free_rings: iavf_free_adminq_arq(hw); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32D7BC32772 for ; Tue, 23 Aug 2022 08:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345013AbiHWImO (ORCPT ); Tue, 23 Aug 2022 04:42:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348401AbiHWIlb (ORCPT ); Tue, 23 Aug 2022 04:41:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6135C402FA; Tue, 23 Aug 2022 01:19:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 927B06131B; Tue, 23 Aug 2022 08:18:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 824CDC43149; Tue, 23 Aug 2022 08:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242701; bh=acLe5DXS9NaEYMWr9Sd3FnKRDqErCiu6J6u7Yzt7SvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oXzRGee8XVf0wDfkAUsnO+2SznMySMvUcthaQH4h+lkGcl+lcicutTGjZl1gZltXK 2dDqRs74oxbt0hzTEgtuCCYsTJ7drTi8DQ5Bgs8cBUpTkWLyjezn+zDU4i7xWLkuA3 Z/WX9wN67qFbxL3nHLfcZdcbNZ8rB7VtStB1R93Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Przemyslaw Patynowski , Jedrzej Jagielski , Marek Szlosek , Tony Nguyen Subject: [PATCH 5.19 173/365] iavf: Fix NULL pointer dereference in iavf_get_link_ksettings Date: Tue, 23 Aug 2022 10:01:14 +0200 Message-Id: <20220823080125.449181817@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Przemyslaw Patynowski commit 541a1af451b0cb3779e915d48d08efb17915207b upstream. Fix possible NULL pointer dereference, due to freeing of adapter->vf_res in iavf_init_get_resources. Previous commit introduced a regression, where receiving IAVF_ERR_ADMIN_QUEUE_NO_WORK from iavf_get_vf_config would free adapter->vf_res. However, netdev is still registered, so ethtool_ops can be called. Calling iavf_get_link_ksettings with no vf_res, will result with: [ 9385.242676] BUG: kernel NULL pointer dereference, address: 0000000000000= 008 [ 9385.242683] #PF: supervisor read access in kernel mode [ 9385.242686] #PF: error_code(0x0000) - not-present page [ 9385.242690] PGD 0 P4D 0 [ 9385.242696] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC PTI [ 9385.242701] CPU: 6 PID: 3217 Comm: pmdalinux Kdump: loaded Tainted: G S = E 5.18.0-04958-ga54ce3703613-dirty #1 [ 9385.242708] Hardware name: Dell Inc. PowerEdge R730/0WCJNT, BIOS 2.11.0 = 11/02/2019 [ 9385.242710] RIP: 0010:iavf_get_link_ksettings+0x29/0xd0 [iavf] [ 9385.242745] Code: 00 0f 1f 44 00 00 b8 01 ef ff ff 48 c7 46 30 00 00 00 = 00 48 c7 46 38 00 00 00 00 c6 46 0b 00 66 89 46 08 48 8b 87 68 0e 00 00 40 08 80 75 50 8b 87 5c 0e 00 00 83 f8 08 74 7a 76 1d 83 f8 20 [ 9385.242749] RSP: 0018:ffffc0560ec7fbd0 EFLAGS: 00010246 [ 9385.242755] RAX: 0000000000000000 RBX: ffffc0560ec7fc08 RCX: 00000000000= 00000 [ 9385.242759] RDX: ffffffffc0ad4550 RSI: ffffc0560ec7fc08 RDI: ffffa0fc666= 74000 [ 9385.242762] RBP: 00007ffd1fb2bf50 R08: b6a2d54b892363ee R09: ffffa101dc1= 4fb00 [ 9385.242765] R10: 0000000000000000 R11: 0000000000000004 R12: ffffa0fc666= 74000 [ 9385.242768] R13: 0000000000000000 R14: ffffa0fc66674000 R15: 00000000fff= fffa1 [ 9385.242771] FS: 00007f93711a2980(0000) GS:ffffa0fad72c0000(0000) knlGS:= 0000000000000000 [ 9385.242775] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 9385.242778] CR2: 0000000000000008 CR3: 0000000a8e61c003 CR4: 00000000003= 706e0 [ 9385.242781] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 00000000000= 00000 [ 9385.242784] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 00000000000= 00400 [ 9385.242787] Call Trace: [ 9385.242791] [ 9385.242793] ethtool_get_settings+0x71/0x1a0 [ 9385.242814] __dev_ethtool+0x426/0x2f40 [ 9385.242823] ? slab_post_alloc_hook+0x4f/0x280 [ 9385.242836] ? kmem_cache_alloc_trace+0x15d/0x2f0 [ 9385.242841] ? dev_ethtool+0x59/0x170 [ 9385.242848] dev_ethtool+0xa7/0x170 [ 9385.242856] dev_ioctl+0xc3/0x520 [ 9385.242866] sock_do_ioctl+0xa0/0xe0 [ 9385.242877] sock_ioctl+0x22f/0x320 [ 9385.242885] __x64_sys_ioctl+0x84/0xc0 [ 9385.242896] do_syscall_64+0x3a/0x80 [ 9385.242904] entry_SYSCALL_64_after_hwframe+0x46/0xb0 [ 9385.242918] RIP: 0033:0x7f93702396db [ 9385.242923] Code: 73 01 c3 48 8b 0d ad 57 38 00 f7 d8 64 89 01 48 83 c8 = ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 10 00 00 00 0f 05 <48= > 3d 01 f0 ff ff 73 01 c3 48 8b 0d 7d 57 38 00 f7 d8 64 89 01 48 [ 9385.242927] RSP: 002b:00007ffd1fb2bf18 EFLAGS: 00000246 ORIG_RAX: 000000= 0000000010 [ 9385.242932] RAX: ffffffffffffffda RBX: 000055671b1d2fe0 RCX: 00007f93702= 396db [ 9385.242935] RDX: 00007ffd1fb2bf20 RSI: 0000000000008946 RDI: 00000000000= 00007 [ 9385.242937] RBP: 00007ffd1fb2bf20 R08: 0000000000000003 R09: 00307630663= 07330 [ 9385.242940] R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffd1fb= 2bf80 [ 9385.242942] R13: 0000000000000007 R14: 0000556719f6de90 R15: 00007ffd1fb= 2c1b0 [ 9385.242948] [ 9385.242949] Modules linked in: iavf(E) xt_CHECKSUM xt_MASQUERADE xt_conn= track ipt_REJECT nft_compat nf_nat_tftp nft_objref nf_conntrack_tftp bridge= stp llc nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_= reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntr= ack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nf_tables rfkill nfnetlink vfat fa= t irdma ib_uverbs ib_core intel_rapl_msr intel_rapl_common sb_edac x86_pkg_= temp_thermal intel_powerclamp coretemp kvm_intel kvm iTCO_wdt iTCO_vendor_s= upport ice irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel rapl= i40e pcspkr intel_cstate joydev mei_me intel_uncore mxm_wmi mei ipmi_ssif = lpc_ich ipmi_si acpi_power_meter xfs libcrc32c mgag200 i2c_algo_bit drm_shm= em_helper drm_kms_helper sd_mod t10_pi crc64_rocksoft crc64 syscopyarea sg = sysfillrect sysimgblt fb_sys_fops drm ixgbe ahci libahci libata crc32c_inte= l mdio dca wmi dm_mirror dm_region_hash dm_log dm_mod ipmi_devintf ipmi_msg= handler fuse [ 9385.243065] [last unloaded: iavf] Dereference happens in if (ADV_LINK_SUPPORT(adapter)) statement Fixes: 209f2f9c7181 ("iavf: Add support for VIRTCHNL_VF_OFFLOAD_VLAN_V2 neg= otiation") Signed-off-by: Przemyslaw Patynowski Signed-off-by: Jedrzej Jagielski Tested-by: Marek Szlosek Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -2281,7 +2281,7 @@ static void iavf_init_get_resources(stru err =3D iavf_get_vf_config(adapter); if (err =3D=3D -EALREADY) { err =3D iavf_send_vf_config_msg(adapter); - goto err_alloc; + goto err; } else if (err =3D=3D -EINVAL) { /* We only get -EINVAL if the device is in a very bad * state or if we've been disabled for previous bad From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52616C32774 for ; Tue, 23 Aug 2022 09:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351191AbiHWJgv (ORCPT ); Tue, 23 Aug 2022 05:36:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351335AbiHWJf2 (ORCPT ); Tue, 23 Aug 2022 05:35:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9214396FD3; Tue, 23 Aug 2022 01:39:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3B16DB81C4A; Tue, 23 Aug 2022 08:18:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C612C433C1; Tue, 23 Aug 2022 08:18:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242703; bh=F5vRVgkLbGhcuVsIbIHpjZEGgUqsHRcnYDVsI2aUkUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tZQ/5Ii0FmXIEJizZO4nlwuzh8ioD6ekmYI5Yy6mfGfdW5HOSFQM0tktgvgfezXt8 +vHa96L1jRLNq5PGR1s7feiqIRtBD/kPrvGpMjMm4bh2xibMqy0tOJSGR1WfJb2auZ nDrhfVovMiC4sASDwoKK90ESorpf5swfC+Ds6Vus= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Przemyslaw Patynowski , Jedrzej Jagielski , Marek Szlosek , Tony Nguyen Subject: [PATCH 5.19 174/365] iavf: Fix reset error handling Date: Tue, 23 Aug 2022 10:01:15 +0200 Message-Id: <20220823080125.488748567@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Przemyslaw Patynowski commit 31071173771e079f7bc08dacd61e0db913262fbf upstream. Do not call iavf_close in iavf_reset_task error handling. Doing so can lead to double call of napi_disable, which can lead to deadlock there. Removing VF would lead to iavf_remove task being stuck, because it requires crit_lock, which is held by iavf_close. Call iavf_disable_vf if reset fail, so that driver will clean up remaining invalid resources. During rapid VF resets, HW can fail to setup VF mailbox. Wrong error handling can lead to iavf_remove being stuck with: [ 5218.999087] iavf 0000:82:01.0: Failed to init adminq: -53 ... [ 5267.189211] INFO: task repro.sh:11219 blocked for more than 30 seconds. [ 5267.189520] Tainted: G S E 5.18.0-04958-ga54ce3703613= -dirty #1 [ 5267.189764] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables = this message. [ 5267.190062] task:repro.sh state:D stack: 0 pid:11219 ppid: 81= 62 flags:0x00000000 [ 5267.190347] Call Trace: [ 5267.190647] [ 5267.190927] __schedule+0x460/0x9f0 [ 5267.191264] schedule+0x44/0xb0 [ 5267.191563] schedule_preempt_disabled+0x14/0x20 [ 5267.191890] __mutex_lock.isra.12+0x6e3/0xac0 [ 5267.192237] ? iavf_remove+0xf9/0x6c0 [iavf] [ 5267.192565] iavf_remove+0x12a/0x6c0 [iavf] [ 5267.192911] ? _raw_spin_unlock_irqrestore+0x1e/0x40 [ 5267.193285] pci_device_remove+0x36/0xb0 [ 5267.193619] device_release_driver_internal+0xc1/0x150 [ 5267.193974] pci_stop_bus_device+0x69/0x90 [ 5267.194361] pci_stop_and_remove_bus_device+0xe/0x20 [ 5267.194735] pci_iov_remove_virtfn+0xba/0x120 [ 5267.195130] sriov_disable+0x2f/0xe0 [ 5267.195506] ice_free_vfs+0x7d/0x2f0 [ice] [ 5267.196056] ? pci_get_device+0x4f/0x70 [ 5267.196496] ice_sriov_configure+0x78/0x1a0 [ice] [ 5267.196995] sriov_numvfs_store+0xfe/0x140 [ 5267.197466] kernfs_fop_write_iter+0x12e/0x1c0 [ 5267.197918] new_sync_write+0x10c/0x190 [ 5267.198404] vfs_write+0x24e/0x2d0 [ 5267.198886] ksys_write+0x5c/0xd0 [ 5267.199367] do_syscall_64+0x3a/0x80 [ 5267.199827] entry_SYSCALL_64_after_hwframe+0x46/0xb0 [ 5267.200317] RIP: 0033:0x7f5b381205c8 [ 5267.200814] RSP: 002b:00007fff8c7e8c78 EFLAGS: 00000246 ORIG_RAX: 000000= 0000000001 [ 5267.201981] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f5b381= 205c8 [ 5267.202620] RDX: 0000000000000002 RSI: 00005569420ee900 RDI: 00000000000= 00001 [ 5267.203426] RBP: 00005569420ee900 R08: 000000000000000a R09: 00007f5b381= 80820 [ 5267.204327] R10: 000000000000000a R11: 0000000000000246 R12: 00007f5b383= c06e0 [ 5267.205193] R13: 0000000000000002 R14: 00007f5b383bb880 R15: 00000000000= 00002 [ 5267.206041] [ 5267.206970] Kernel panic - not syncing: hung_task: blocked tasks [ 5267.207809] CPU: 48 PID: 551 Comm: khungtaskd Kdump: loaded Tainted: G S= E 5.18.0-04958-ga54ce3703613-dirty #1 [ 5267.208726] Hardware name: Dell Inc. PowerEdge R730/0WCJNT, BIOS 2.11.0 = 11/02/2019 [ 5267.209623] Call Trace: [ 5267.210569] [ 5267.211480] dump_stack_lvl+0x33/0x42 [ 5267.212472] panic+0x107/0x294 [ 5267.213467] watchdog.cold.8+0xc/0xbb [ 5267.214413] ? proc_dohung_task_timeout_secs+0x30/0x30 [ 5267.215511] kthread+0xf4/0x120 [ 5267.216459] ? kthread_complete_and_exit+0x20/0x20 [ 5267.217505] ret_from_fork+0x22/0x30 [ 5267.218459] Fixes: f0db78928783 ("i40evf: use netdev variable in reset task") Signed-off-by: Przemyslaw Patynowski Signed-off-by: Jedrzej Jagielski Tested-by: Marek Szlosek Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/iavf/iavf_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -2998,12 +2998,15 @@ continue_reset: =20 return; reset_err: + if (running) { + set_bit(__IAVF_VSI_DOWN, adapter->vsi.state); + iavf_free_traffic_irqs(adapter); + } + iavf_disable_vf(adapter); + mutex_unlock(&adapter->client_lock); mutex_unlock(&adapter->crit_lock); - if (running) - iavf_change_state(adapter, __IAVF_RUNNING); dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\= n"); - iavf_close(netdev); } =20 /** From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51DF5C32772 for ; Tue, 23 Aug 2022 08:42:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346910AbiHWImz (ORCPT ); Tue, 23 Aug 2022 04:42:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347783AbiHWIlF (ORCPT ); Tue, 23 Aug 2022 04:41:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FD6B792E6; Tue, 23 Aug 2022 01:19:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 40619B81C4D; Tue, 23 Aug 2022 08:18:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BE52C433C1; Tue, 23 Aug 2022 08:18:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242707; bh=xd9pSX2o4PEovPzwScjsz4aIA2Eq9p7JoyzIc20i9rQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qF4ZO91nB18E9CbYLnipxMoJ3hSZzVMJwT+HjqIVrHiD3D6IKq2mHEQwrY9loB0Xe xOAHGVd1c0yiHeR2EwmXM4LiGvLZJ/Y5QNXhZNbQ24UqbBrXAPFTXO4gy17hRS92ST BKPrd/IjmeK65XWsLKgsDaA2j3qEffop3CHyGcIo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ivan Vecera , Konrad Jankowski , Tony Nguyen Subject: [PATCH 5.19 175/365] iavf: Fix deadlock in initialization Date: Tue, 23 Aug 2022 10:01:16 +0200 Message-Id: <20220823080125.533399037@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ivan Vecera commit cbe9e51126305832cf407ee6bb556ce831488ffe upstream. Fix deadlock that occurs when iavf interface is a part of failover configuration. 1. Mutex crit_lock is taken at the beginning of iavf_watchdog_task() 2. Function iavf_init_config_adapter() is called when adapter state is __IAVF_INIT_CONFIG_ADAPTER 3. iavf_init_config_adapter() calls register_netdevice() that emits NETDEV_REGISTER event 4. Notifier function failover_event() then calls net_failover_slave_register() that calls dev_open() 5. dev_open() calls iavf_open() that tries to take crit_lock in end-less loop Stack trace: ... [ 790.251876] usleep_range_state+0x5b/0x80 [ 790.252547] iavf_open+0x37/0x1d0 [iavf] [ 790.253139] __dev_open+0xcd/0x160 [ 790.253699] dev_open+0x47/0x90 [ 790.254323] net_failover_slave_register+0x122/0x220 [net_failover] [ 790.255213] failover_slave_register.part.7+0xd2/0x180 [failover] [ 790.256050] failover_event+0x122/0x1ab [failover] [ 790.256821] notifier_call_chain+0x47/0x70 [ 790.257510] register_netdevice+0x20f/0x550 [ 790.258263] iavf_watchdog_task+0x7c8/0xea0 [iavf] [ 790.259009] process_one_work+0x1a7/0x360 [ 790.259705] worker_thread+0x30/0x390 To fix the situation we should check the current adapter state after first unsuccessful mutex_trylock() and return with -EBUSY if it is __IAVF_INIT_CONFIG_ADAPTER. Fixes: 226d528512cf ("iavf: fix locking of critical sections") Signed-off-by: Ivan Vecera Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/iavf/iavf_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -3989,8 +3989,17 @@ static int iavf_open(struct net_device * return -EIO; } =20 - while (!mutex_trylock(&adapter->crit_lock)) + while (!mutex_trylock(&adapter->crit_lock)) { + /* If we are in __IAVF_INIT_CONFIG_ADAPTER state the crit_lock + * is already taken and iavf_open is called from an upper + * device's notifier reacting on NETDEV_REGISTER event. + * We have to leave here to avoid dead lock. + */ + if (adapter->state =3D=3D __IAVF_INIT_CONFIG_ADAPTER) + return -EBUSY; + usleep_range(500, 1000); + } =20 if (adapter->state !=3D __IAVF_DOWN) { err =3D -EBUSY; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99FC9C32774 for ; Tue, 23 Aug 2022 08:40:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345848AbiHWIkQ (ORCPT ); Tue, 23 Aug 2022 04:40:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344741AbiHWIjn (ORCPT ); Tue, 23 Aug 2022 04:39:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3999B1401D; Tue, 23 Aug 2022 01:18:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3E830B81C4B; Tue, 23 Aug 2022 08:18:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9717AC433D6; Tue, 23 Aug 2022 08:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242710; bh=Ifo1c328SdBt/vUETtDn0Qt+M/Wj0wNycavFs6K4Gsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OZ6WmJ9mb5UBfWG52VubvB8BUJa1mWYplOre6htbpzUj5LomEnexdazW5q9pBrpgx svuDw3H9E32aahlcRroL/0SSOIUlW3QQYyi0AuLG4wh2hFbgyQPvbcxMc0tFisqJfl 20AF0MN1c70USZE+ZCKR4VhA9PcoFyasv7V5GVQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Cezary Rojewski , Mark Brown Subject: [PATCH 5.19 176/365] ASoC: Intel: avs: Fix potential buffer overflow by snprintf() Date: Tue, 23 Aug 2022 10:01:17 +0200 Message-Id: <20220823080125.576859163@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai commit ca3b7b9dc9bc1fa552f4697b7cccfa0258a44d00 upstream. snprintf() returns the would-be-filled size when the string overflows the given buffer size, hence using this value may result in a buffer overflow (although it's unrealistic). This patch replaces it with a safer version, scnprintf() for papering over such a potential issue. Fixes: f1b3b320bd65 ("ASoC: Intel: avs: Generic soc component driver") Signed-off-by: Takashi Iwai Acked-by: Cezary Rojewski Link: https://lore.kernel.org/r/20220801165420.25978-2-tiwai@suse.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/intel/avs/pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/sound/soc/intel/avs/pcm.c +++ b/sound/soc/intel/avs/pcm.c @@ -636,8 +636,8 @@ static ssize_t topology_name_read(struct char buf[64]; size_t len; =20 - len =3D snprintf(buf, sizeof(buf), "%s/%s\n", component->driver->topology= _name_prefix, - mach->tplg_filename); + len =3D scnprintf(buf, sizeof(buf), "%s/%s\n", component->driver->topolog= y_name_prefix, + mach->tplg_filename); =20 return simple_read_from_buffer(user_buf, count, ppos, buf, len); } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5721C32772 for ; Tue, 23 Aug 2022 08:43:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344374AbiHWInQ (ORCPT ); Tue, 23 Aug 2022 04:43:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348619AbiHWIln (ORCPT ); Tue, 23 Aug 2022 04:41:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05EF67A76F; Tue, 23 Aug 2022 01:20:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F6A861388; Tue, 23 Aug 2022 08:18:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEDC0C433D6; Tue, 23 Aug 2022 08:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242713; bh=P2NEBc2H85qsMBFTU4JMsHFgSL2p2zn/OeqE9orNI9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xAEnkw2UqIFg4BI044cT0DN1y36YCvyNR0/4FnhwC14sH4I3ozT2BQWZRNYTw62SY C8Q6+aO5npw5id+X3uqtdZzWcRt3vumZmPLta4ITOwHpBpZ0GAQYYeyAvM9obdtcIH bWOwFtQS2fHBARRgFiAe6HglWauZKaDFpnm7RZWE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Mark Brown Subject: [PATCH 5.19 177/365] ASoC: SOF: debug: Fix potential buffer overflow by snprintf() Date: Tue, 23 Aug 2022 10:01:18 +0200 Message-Id: <20220823080125.626228574@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai commit 1eb123ce985e6cf302ac6e3f19862d132d86fa8f upstream. snprintf() returns the would-be-filled size when the string overflows the given buffer size, hence using this value may result in the buffer overflow (although it's unrealistic). This patch replaces with a safer version, scnprintf() for papering over such a potential issue. Fixes: 5b10b6298921 ("ASoC: SOF: Add `memory_info` file to debugfs") Signed-off-by: Takashi Iwai Link: https://lore.kernel.org/r/20220801165420.25978-3-tiwai@suse.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/sof/debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/sound/soc/sof/debug.c +++ b/sound/soc/sof/debug.c @@ -252,9 +252,9 @@ static int memory_info_update(struct snd } =20 for (i =3D 0, len =3D 0; i < reply->num_elems; i++) { - ret =3D snprintf(buf + len, buff_size - len, "zone %d.%d used %#8x free = %#8x\n", - reply->elems[i].zone, reply->elems[i].id, - reply->elems[i].used, reply->elems[i].free); + ret =3D scnprintf(buf + len, buff_size - len, "zone %d.%d used %#8x free= %#8x\n", + reply->elems[i].zone, reply->elems[i].id, + reply->elems[i].used, reply->elems[i].free); if (ret < 0) goto error; len +=3D ret; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EFB0C32772 for ; Tue, 23 Aug 2022 09:25:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350090AbiHWJZW (ORCPT ); Tue, 23 Aug 2022 05:25:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349781AbiHWJY2 (ORCPT ); Tue, 23 Aug 2022 05:24:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C474490805; Tue, 23 Aug 2022 01:35:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4123BB81C4F; Tue, 23 Aug 2022 08:18:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC131C433C1; Tue, 23 Aug 2022 08:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242716; bh=+Z2c0OxS9hfS3VZxv8oMBN/X8wfE6XIeSWU42oMqx5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DnvO1XDR/pMEl79/YFpUmiXmcx0Sm36gvoNb8rbDnB4OnWCc/V2eJtCUZ69EfkfiQ Is5mHwKMCowINxnCmWHoZreVJcRWVTS9iL4ie+2ViT+gj7KZ05LL/fSHNh+n/H9FKV vhcy2kR4s1gCghVzhl3ZLjHCRP/6OER8hZ9Pls00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Mark Brown Subject: [PATCH 5.19 178/365] ASoC: SOF: Intel: hda: Fix potential buffer overflow by snprintf() Date: Tue, 23 Aug 2022 10:01:19 +0200 Message-Id: <20220823080125.671237572@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai commit 94c1ceb043c1a002de9649bb630c8e8347645982 upstream. snprintf() returns the would-be-filled size when the string overflows the given buffer size, hence using this value may result in the buffer overflow (although it's unrealistic). This patch replaces with a safer version, scnprintf() for papering over such a potential issue. Fixes: 29c8e4398f02 ("ASoC: SOF: Intel: hda: add extended rom status dump t= o error log") Signed-off-by: Takashi Iwai Link: https://lore.kernel.org/r/20220801165420.25978-4-tiwai@suse.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/sof/intel/hda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -467,7 +467,7 @@ static void hda_dsp_dump_ext_rom_status( chip =3D get_chip_info(sdev->pdata); for (i =3D 0; i < HDA_EXT_ROM_STATUS_SIZE; i++) { value =3D snd_sof_dsp_read(sdev, HDA_DSP_BAR, chip->rom_status_reg + i *= 0x4); - len +=3D snprintf(msg + len, sizeof(msg) - len, " 0x%x", value); + len +=3D scnprintf(msg + len, sizeof(msg) - len, " 0x%x", value); } =20 dev_printk(level, sdev->dev, "extended rom status: %s", msg); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9739DC32774 for ; Tue, 23 Aug 2022 08:42:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346877AbiHWImw (ORCPT ); Tue, 23 Aug 2022 04:42:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345619AbiHWIkH (ORCPT ); Tue, 23 Aug 2022 04:40:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 148FB32ABB; Tue, 23 Aug 2022 01:18:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 76C60B81BF8; Tue, 23 Aug 2022 08:18:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA6F2C433D6; Tue, 23 Aug 2022 08:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242719; bh=4dsBFVq/EY4Vczb4n0x3cAK3E7FUpiE5oSunj5mN74A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m9PE/qoGqpmnrjviWhO6XPE9QpdxEDfuwrqtY7q1Y5djMHLqyu93sti8cIxP7ozH5 PRpPV49jO6o8wdhrt6re6hkC/wr2iCyYB0EAP/fT44j7/YCaZkRc8k5sPyDbWUtlsH 5mH4ibCi/CepkNEzi9spss/UDYVawjpsl8aolGc0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Natalsson , Pierre-Louis Bossart , =?UTF-8?q?P=C3=A9ter=20Ujfalusi?= , Takashi Iwai , Mark Brown Subject: [PATCH 5.19 179/365] ASoC: DPCM: Dont pick up BE without substream Date: Tue, 23 Aug 2022 10:01:20 +0200 Message-Id: <20220823080125.709580979@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai commit 754590651ccbbcc74a7c20907be4bb15d642bde3 upstream. When DPCM tries to add valid BE connections at dpcm_add_paths(), it doesn't check whether the picked BE actually supports for the given stream direction. Due to that, when an asymmetric BE stream is present, it picks up wrongly and this may result in a NULL dereference at a later point where the code assumes the existence of a corresponding BE substream. This patch adds the check for the presence of the substream for the target BE for avoiding the problem above. Note that we have already some fix for non-existing BE substream at commit 6246f283d5e0 ("ASoC: dpcm: skip missing substream while applying symmetry"). But the code path we've hit recently is rather happening before the previous fix. So this patch tries to fix at picking up a BE instead of parsing BE lists. Fixes: bbf7d3b1c4f4 ("ASoC: soc-pcm: align BE 'atomicity' with that of the = FE") Reported-by: Alex Natalsson Cc: Pierre-Louis Bossart Cc: P=C3=A9ter Ujfalusi Link: https://lore.kernel.org/r/CADs9LoPZH_D+eJ9qjTxSLE5jGyhKsjMN7g2NighZ16= biVxsyKw@mail.gmail.com Signed-off-by: Takashi Iwai Link: https://lore.kernel.org/r/20220801170510.26582-1-tiwai@suse.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/soc-pcm.c | 3 +++ 1 file changed, 3 insertions(+) --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1318,6 +1318,9 @@ static struct snd_soc_pcm_runtime *dpcm_ if (!be->dai_link->no_pcm) continue; =20 + if (!snd_soc_dpcm_get_substream(be, stream)) + continue; + for_each_rtd_dais(be, i, dai) { w =3D snd_soc_dai_get_widget(dai, stream); =20 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98F72C32792 for ; Tue, 23 Aug 2022 08:42:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241960AbiHWImq (ORCPT ); Tue, 23 Aug 2022 04:42:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243935AbiHWIkL (ORCPT ); Tue, 23 Aug 2022 04:40:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6526B42AEA; Tue, 23 Aug 2022 01:18:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A45F611DD; Tue, 23 Aug 2022 08:18:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2B8EC433C1; Tue, 23 Aug 2022 08:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242722; bh=mTvSXMU+FqVYUEjrCpZyNd5/4xWQ8kzPmC4oXbY4SGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gpcYe5nKb/jDeJl4ECx/IejBEemH1z90kBvfAbdqUPFV8hBxlRWWyMZtyifQ86MZJ 9aRdWapK066XwEK7ELPG1JY0GScLE5b39eadjQhLYDAWacG69BsvgLRnTNPIQo5mnh IatMGEB6ZqfzVk07rUGVStrnBxmNBIpdP/zsT3UI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown Subject: [PATCH 5.19 180/365] ASoC: tas2770: Set correct FSYNC polarity Date: Tue, 23 Aug 2022 10:01:21 +0200 Message-Id: <20220823080125.757707186@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Povi=C5=A1er commit e9ac31f0a5d0e246b046c20348954519f91a297f upstream. Fix setting of FSYNC polarity for DAI formats other than I2S. Also add support for polarity inversion. Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220808141246.5749-2-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/codecs/tas2770.c | 20 +++++++++++++++++++- sound/soc/codecs/tas2770.h | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -337,7 +337,7 @@ static int tas2770_set_fmt(struct snd_so struct snd_soc_component *component =3D dai->component; struct tas2770_priv *tas2770 =3D snd_soc_component_get_drvdata(component); - u8 tdm_rx_start_slot =3D 0, asi_cfg_1 =3D 0; + u8 tdm_rx_start_slot =3D 0, invert_fpol =3D 0, fpol_preinv =3D 0, asi_cfg= _1 =3D 0; int ret; =20 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -349,9 +349,15 @@ static int tas2770_set_fmt(struct snd_so } =20 switch (fmt & SND_SOC_DAIFMT_INV_MASK) { + case SND_SOC_DAIFMT_NB_IF: + invert_fpol =3D 1; + fallthrough; case SND_SOC_DAIFMT_NB_NF: asi_cfg_1 |=3D TAS2770_TDM_CFG_REG1_RX_RSING; break; + case SND_SOC_DAIFMT_IB_IF: + invert_fpol =3D 1; + fallthrough; case SND_SOC_DAIFMT_IB_NF: asi_cfg_1 |=3D TAS2770_TDM_CFG_REG1_RX_FALING; break; @@ -369,15 +375,19 @@ static int tas2770_set_fmt(struct snd_so switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: tdm_rx_start_slot =3D 1; + fpol_preinv =3D 0; break; case SND_SOC_DAIFMT_DSP_A: tdm_rx_start_slot =3D 0; + fpol_preinv =3D 1; break; case SND_SOC_DAIFMT_DSP_B: tdm_rx_start_slot =3D 1; + fpol_preinv =3D 1; break; case SND_SOC_DAIFMT_LEFT_J: tdm_rx_start_slot =3D 0; + fpol_preinv =3D 1; break; default: dev_err(tas2770->dev, @@ -391,6 +401,14 @@ static int tas2770_set_fmt(struct snd_so if (ret < 0) return ret; =20 + ret =3D snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG0, + TAS2770_TDM_CFG_REG0_FPOL_MASK, + (fpol_preinv ^ invert_fpol) + ? TAS2770_TDM_CFG_REG0_FPOL_RSING + : TAS2770_TDM_CFG_REG0_FPOL_FALING); + if (ret < 0) + return ret; + return 0; } =20 --- a/sound/soc/codecs/tas2770.h +++ b/sound/soc/codecs/tas2770.h @@ -41,6 +41,9 @@ #define TAS2770_TDM_CFG_REG0_31_44_1_48KHZ 0x6 #define TAS2770_TDM_CFG_REG0_31_88_2_96KHZ 0x8 #define TAS2770_TDM_CFG_REG0_31_176_4_192KHZ 0xa +#define TAS2770_TDM_CFG_REG0_FPOL_MASK BIT(0) +#define TAS2770_TDM_CFG_REG0_FPOL_RSING 0 +#define TAS2770_TDM_CFG_REG0_FPOL_FALING 1 /* TDM Configuration Reg1 */ #define TAS2770_TDM_CFG_REG1 TAS2770_REG(0X0, 0x0B) #define TAS2770_TDM_CFG_REG1_MASK GENMASK(5, 1) From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3F2DC32772 for ; Tue, 23 Aug 2022 08:44:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346831AbiHWIom (ORCPT ); Tue, 23 Aug 2022 04:44:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239922AbiHWImF (ORCPT ); Tue, 23 Aug 2022 04:42:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3B9E7AC3F; Tue, 23 Aug 2022 01:20:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 44844B81C48; Tue, 23 Aug 2022 08:18:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F580C433D6; Tue, 23 Aug 2022 08:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242725; bh=0RH08DlYaBDEIvYoq52VEKqDG4diNbNpOF8jgqGa704=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K8IFQvrpBq1N+8PqvP/kbWoNncu5SLZfnaacRxUJi895YqT5rKKRuMMyuxkR0KAML 5sNjn+bdxOIwDNB+66u1u0wZ1sVOcO+wKF0sljrqNt8087/qNPlTu0YXMBrHMGozSA x26O+JV1GGZV3IU48M5gM6WtswISh7ZTQq9z7bu8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown Subject: [PATCH 5.19 181/365] ASoC: tas2770: Allow mono streams Date: Tue, 23 Aug 2022 10:01:22 +0200 Message-Id: <20220823080125.799694042@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Povi=C5=A1er commit bf54d97a835dfe62d4d29e245e170c63d0089be7 upstream. The part is a mono speaker amp, but it can do downmix and switch between left and right channel, so the right channel range is 1 to 2. Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220808141246.5749-3-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/codecs/tas2770.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -507,7 +507,7 @@ static struct snd_soc_dai_driver tas2770 .id =3D 0, .playback =3D { .stream_name =3D "ASI1 Playback", - .channels_min =3D 2, + .channels_min =3D 1, .channels_max =3D 2, .rates =3D TAS2770_RATES, .formats =3D TAS2770_FORMATS, From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DF26C32774 for ; Tue, 23 Aug 2022 08:43:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344683AbiHWInU (ORCPT ); Tue, 23 Aug 2022 04:43:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348405AbiHWIlb (ORCPT ); Tue, 23 Aug 2022 04:41:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73D0A7960C; Tue, 23 Aug 2022 01:19:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5F02DB81C20; Tue, 23 Aug 2022 08:18:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BAF5C433D7; Tue, 23 Aug 2022 08:18:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242731; bh=HWPvRsRbImhp+mxkyDgXuQ+z0w/UFpkDqwsXmE51S2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lQweAUfoYfJ63VYNn+4vju/YisrI0HHq6EFeHO58lu+UmDD+C1ChsffhLbIzZYqHc LarFPRwD+slAfpSyV3Imi2vI8HZdShQoORyOiLeVidFczFbI2Dn2FwxicpVa89do2r 8wsNDYo0XQfZ3P6oay1QdYXYGmHesfPLESraSITM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown Subject: [PATCH 5.19 182/365] ASoC: tas2770: Drop conflicting set_bias_level power setting Date: Tue, 23 Aug 2022 10:01:23 +0200 Message-Id: <20220823080125.843427007@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Povi=C5=A1er commit 482c23fbc7e9bf5a7a74defd0735d5346215db58 upstream. The driver is setting the PWR_CTRL field in both the set_bias_level callback and on DAPM events of the DAC widget (and also in the mute_stream method). Drop the set_bias_level callback altogether as the power setting it does is in conflict with the other code paths. Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220808141246.5749-4-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/codecs/tas2770.c | 33 --------------------------------- 1 file changed, 33 deletions(-) --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -46,38 +46,6 @@ static void tas2770_reset(struct tas2770 usleep_range(1000, 2000); } =20 -static int tas2770_set_bias_level(struct snd_soc_component *component, - enum snd_soc_bias_level level) -{ - struct tas2770_priv *tas2770 =3D - snd_soc_component_get_drvdata(component); - - switch (level) { - case SND_SOC_BIAS_ON: - snd_soc_component_update_bits(component, TAS2770_PWR_CTRL, - TAS2770_PWR_CTRL_MASK, - TAS2770_PWR_CTRL_ACTIVE); - break; - case SND_SOC_BIAS_STANDBY: - case SND_SOC_BIAS_PREPARE: - snd_soc_component_update_bits(component, TAS2770_PWR_CTRL, - TAS2770_PWR_CTRL_MASK, - TAS2770_PWR_CTRL_MUTE); - break; - case SND_SOC_BIAS_OFF: - snd_soc_component_update_bits(component, TAS2770_PWR_CTRL, - TAS2770_PWR_CTRL_MASK, - TAS2770_PWR_CTRL_SHUTDOWN); - break; - - default: - dev_err(tas2770->dev, "wrong power level setting %d\n", level); - return -EINVAL; - } - - return 0; -} - #ifdef CONFIG_PM static int tas2770_codec_suspend(struct snd_soc_component *component) { @@ -555,7 +523,6 @@ static const struct snd_soc_component_dr .probe =3D tas2770_codec_probe, .suspend =3D tas2770_codec_suspend, .resume =3D tas2770_codec_resume, - .set_bias_level =3D tas2770_set_bias_level, .controls =3D tas2770_snd_controls, .num_controls =3D ARRAY_SIZE(tas2770_snd_controls), .dapm_widgets =3D tas2770_dapm_widgets, From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AF6BC32774 for ; Tue, 23 Aug 2022 08:44:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345463AbiHWIoK (ORCPT ); Tue, 23 Aug 2022 04:44:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347385AbiHWIky (ORCPT ); Tue, 23 Aug 2022 04:40:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2CE24AD4B; Tue, 23 Aug 2022 01:18:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 24B02B81C4E; Tue, 23 Aug 2022 08:18:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 896EFC433C1; Tue, 23 Aug 2022 08:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242733; bh=4jrCeDH5htUTAKRPY4r395KdKhET1ApCrWau5EWtYyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UCKQ13PlR9/DsTvyZMdgmQbLQXlyWD47kAuj5Lxgf6kaN8ZM+3cmzMdj56ltFCZN5 zQj2kTVA1wKAAYCxKoQIQTRFB6UhWaASf/0zniEZ8oL69V0dCQepP83hXCBnNdjVYt IZ/sLfcH9sImkgqjS6Mkr2h6SSOZUz02QQqXXCQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown Subject: [PATCH 5.19 183/365] ASoC: tas2770: Fix handling of mute/unmute Date: Tue, 23 Aug 2022 10:01:24 +0200 Message-Id: <20220823080125.881354758@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Povi=C5=A1er commit 1e5907bcb3a3b569be0a03ebe668bba2ed320a50 upstream. Because the PWR_CTRL field is modeled as the power state of the DAC widget, and at the same time it is used to implement mute/unmute, we need some additional book-keeping to have the right end result no matter the sequence of calls. Without this fix, one can mute an ongoing stream by toggling a speaker pin control. Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220808141246.5749-5-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/codecs/tas2770.c | 57 +++++++++++++++++++++++-----------------= ----- sound/soc/codecs/tas2770.h | 2 + 2 files changed, 32 insertions(+), 27 deletions(-) --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -46,6 +46,26 @@ static void tas2770_reset(struct tas2770 usleep_range(1000, 2000); } =20 +static int tas2770_update_pwr_ctrl(struct tas2770_priv *tas2770) +{ + struct snd_soc_component *component =3D tas2770->component; + unsigned int val; + int ret; + + if (tas2770->dac_powered) + val =3D tas2770->unmuted ? + TAS2770_PWR_CTRL_ACTIVE : TAS2770_PWR_CTRL_MUTE; + else + val =3D TAS2770_PWR_CTRL_SHUTDOWN; + + ret =3D snd_soc_component_update_bits(component, TAS2770_PWR_CTRL, + TAS2770_PWR_CTRL_MASK, val); + if (ret < 0) + return ret; + + return 0; +} + #ifdef CONFIG_PM static int tas2770_codec_suspend(struct snd_soc_component *component) { @@ -82,9 +102,7 @@ static int tas2770_codec_resume(struct s gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); usleep_range(1000, 2000); } else { - ret =3D snd_soc_component_update_bits(component, TAS2770_PWR_CTRL, - TAS2770_PWR_CTRL_MASK, - TAS2770_PWR_CTRL_ACTIVE); + ret =3D tas2770_update_pwr_ctrl(tas2770); if (ret < 0) return ret; } @@ -120,24 +138,19 @@ static int tas2770_dac_event(struct snd_ =20 switch (event) { case SND_SOC_DAPM_POST_PMU: - ret =3D snd_soc_component_update_bits(component, TAS2770_PWR_CTRL, - TAS2770_PWR_CTRL_MASK, - TAS2770_PWR_CTRL_MUTE); + tas2770->dac_powered =3D 1; + ret =3D tas2770_update_pwr_ctrl(tas2770); break; case SND_SOC_DAPM_PRE_PMD: - ret =3D snd_soc_component_update_bits(component, TAS2770_PWR_CTRL, - TAS2770_PWR_CTRL_MASK, - TAS2770_PWR_CTRL_SHUTDOWN); + tas2770->dac_powered =3D 0; + ret =3D tas2770_update_pwr_ctrl(tas2770); break; default: dev_err(tas2770->dev, "Not supported evevt\n"); return -EINVAL; } =20 - if (ret < 0) - return ret; - - return 0; + return ret; } =20 static const struct snd_kcontrol_new isense_switch =3D @@ -171,21 +184,11 @@ static const struct snd_soc_dapm_route t static int tas2770_mute(struct snd_soc_dai *dai, int mute, int direction) { struct snd_soc_component *component =3D dai->component; - int ret; - - if (mute) - ret =3D snd_soc_component_update_bits(component, TAS2770_PWR_CTRL, - TAS2770_PWR_CTRL_MASK, - TAS2770_PWR_CTRL_MUTE); - else - ret =3D snd_soc_component_update_bits(component, TAS2770_PWR_CTRL, - TAS2770_PWR_CTRL_MASK, - TAS2770_PWR_CTRL_ACTIVE); - - if (ret < 0) - return ret; + struct tas2770_priv *tas2770 =3D + snd_soc_component_get_drvdata(component); =20 - return 0; + tas2770->unmuted =3D !mute; + return tas2770_update_pwr_ctrl(tas2770); } =20 static int tas2770_set_bitwidth(struct tas2770_priv *tas2770, int bitwidth) --- a/sound/soc/codecs/tas2770.h +++ b/sound/soc/codecs/tas2770.h @@ -138,6 +138,8 @@ struct tas2770_priv { struct device *dev; int v_sense_slot; int i_sense_slot; + bool dac_powered; + bool unmuted; }; =20 #endif /* __TAS2770__ */ From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BEA6C3F6B0 for ; Tue, 23 Aug 2022 09:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348539AbiHWJMR (ORCPT ); Tue, 23 Aug 2022 05:12:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348263AbiHWJKD (ORCPT ); Tue, 23 Aug 2022 05:10:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F016674E0C; Tue, 23 Aug 2022 01:31:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 47597B81C3E; Tue, 23 Aug 2022 08:18:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E1BEC433B5; Tue, 23 Aug 2022 08:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242737; bh=v5/YKtomldikhe/i3h6gjddah5wV/t0Qwoy5NR3BAPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qj3HGkjwGSyeVQ0S2U3jJuo01kGAvwwwyJpuRx+Xm/gT2bD1P1GSH6yBeY3fZsFSF Fc+zhCZyDWnFTed93V0lKYrskH7XTn+vOqRjpr6YSSGILDsWAFz6t625NpsZkH9cep pX9TIw4fJmM+gvfN/Qs0KoQtwl2z6CvF8A9Fg+vc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philipp Zabel , Mark Brown Subject: [PATCH 5.19 184/365] ASoC: codec: tlv320aic32x4: fix mono playback via I2S Date: Tue, 23 Aug 2022 10:01:25 +0200 Message-Id: <20220823080125.922323509@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Philipp Zabel commit b4b5f29a076e52181f63e45a2ad1bc88593072e3 upstream. The two commits referenced below break mono playback via I2S DAI because they set BCLK to half the required speed. For PCM transport over I2S, the number of transmitted channels is always 2, even for mono playback. Fixes: dcd79364bff3 ("ASoC: codec: tlv3204: Enable 24 bit audio support") Fixes: 40b37136287b ("ASoC: tlv320aic32x4: Fix bdiv clock rate derivation") Signed-off-by: Philipp Zabel Link: https://lore.kernel.org/r/20220810104156.665452-1-p.zabel@pengutronix= .de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/codecs/tlv320aic32x4.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c @@ -49,6 +49,8 @@ struct aic32x4_priv { struct aic32x4_setup_data *setup; struct device *dev; enum aic32x4_type type; + + unsigned int fmt; }; =20 static int aic32x4_reset_adc(struct snd_soc_dapm_widget *w, @@ -611,6 +613,7 @@ static int aic32x4_set_dai_sysclk(struct static int aic32x4_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int= fmt) { struct snd_soc_component *component =3D codec_dai->component; + struct aic32x4_priv *aic32x4 =3D snd_soc_component_get_drvdata(component); u8 iface_reg_1 =3D 0; u8 iface_reg_2 =3D 0; u8 iface_reg_3 =3D 0; @@ -654,6 +657,8 @@ static int aic32x4_set_dai_fmt(struct sn return -EINVAL; } =20 + aic32x4->fmt =3D fmt; + snd_soc_component_update_bits(component, AIC32X4_IFACE1, AIC32X4_IFACE1_DATATYPE_MASK | AIC32X4_IFACE1_MASTER_MASK, iface_reg_1); @@ -758,6 +763,10 @@ static int aic32x4_setup_clocks(struct s return -EINVAL; } =20 + /* PCM over I2S is always 2-channel */ + if ((aic32x4->fmt & SND_SOC_DAIFMT_FORMAT_MASK) =3D=3D SND_SOC_DAIFMT_I2S) + channels =3D 2; + madc =3D DIV_ROUND_UP((32 * adc_resource_class), aosr); max_dosr =3D (AIC32X4_MAX_DOSR_FREQ / sample_rate / dosr_increment) * dosr_increment; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4093C32772 for ; Tue, 23 Aug 2022 08:44:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346410AbiHWIo1 (ORCPT ); Tue, 23 Aug 2022 04:44:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238953AbiHWIlu (ORCPT ); Tue, 23 Aug 2022 04:41:50 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 461777A752; Tue, 23 Aug 2022 01:19:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 872ACCE1B37; Tue, 23 Aug 2022 08:19:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 869E9C433D6; Tue, 23 Aug 2022 08:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242740; bh=25cqBIIziV/XcfFoMUqaT4vBZAn3Vln87Mt8tEYrRsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CEVzZGKrOC1fPL1DJfZlhp58rgpZFnnrNsJZ0Qvm7ZtoZ8ojmaasTzKqqMonTl4/C oA9fZcqUTBRuiv3aRJflHFHeCgxTpwNXogXO99vxXPbhzfMCX6nGHoqbyQKq4LDIHK 5VjubVuEhvgY7RTTkYbolULgs9kK3VNfKBTKOB98= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Gorenko , Max Gurtovoy , Leon Romanovsky Subject: [PATCH 5.19 185/365] IB/iser: Fix login with authentication Date: Tue, 23 Aug 2022 10:01:26 +0200 Message-Id: <20220823080125.955814036@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergey Gorenko commit d6d142cb7f79bec6051c5ecf744b7a5309c5a0ee upstream. The iSER Initiator uses two types of receive buffers: - one big login buffer posted by iser_post_recvl(); - several small message buffers posted by iser_post_recvm(). The login buffer is used at the login phase and full feature phase in the discovery session. It may take a few requests and responses to complete the login phase. The message buffers are only used in the normal operational session at the full feature phase. After the commit referred in the fixes line, the login operation fails if the authentication is enabled. That happens because the Initiator posts a small receive buffer after the first response from Target. So, the next send operation fails because Target's second response does not fit into the small receive buffer. This commit adds additional checks to prevent posting small receive buffers until the full feature phase. Fixes: 39b169ea0d36 ("IB/iser: Fix RNR errors") Link: https://lore.kernel.org/r/20220805060135.18493-1-sergeygo@nvidia.com Signed-off-by: Sergey Gorenko Reviewed-by: Max Gurtovoy Signed-off-by: Leon Romanovsky Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/infiniband/ulp/iser/iser_initiator.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c @@ -537,6 +537,7 @@ void iser_login_rsp(struct ib_cq *cq, st struct iscsi_hdr *hdr; char *data; int length; + bool full_feature_phase; =20 if (unlikely(wc->status !=3D IB_WC_SUCCESS)) { iser_err_comp(wc, "login_rsp"); @@ -550,6 +551,9 @@ void iser_login_rsp(struct ib_cq *cq, st hdr =3D desc->rsp + sizeof(struct iser_ctrl); data =3D desc->rsp + ISER_HEADERS_LEN; length =3D wc->byte_len - ISER_HEADERS_LEN; + full_feature_phase =3D ((hdr->flags & ISCSI_FULL_FEATURE_PHASE) =3D=3D + ISCSI_FULL_FEATURE_PHASE) && + (hdr->flags & ISCSI_FLAG_CMD_FINAL); =20 iser_dbg("op 0x%x itt 0x%x dlen %d\n", hdr->opcode, hdr->itt, length); @@ -560,7 +564,8 @@ void iser_login_rsp(struct ib_cq *cq, st desc->rsp_dma, ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE); =20 - if (iser_conn->iscsi_conn->session->discovery_sess) + if (!full_feature_phase || + iser_conn->iscsi_conn->session->discovery_sess) return; =20 /* Post the first RX buffer that is skipped in iser_post_rx_bufs() */ From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A40B0C32772 for ; Tue, 23 Aug 2022 08:44:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241448AbiHWIor (ORCPT ); Tue, 23 Aug 2022 04:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348940AbiHWImG (ORCPT ); Tue, 23 Aug 2022 04:42:06 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8651279A56; Tue, 23 Aug 2022 01:20:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 80480CE1B3B; Tue, 23 Aug 2022 08:19:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CE45C433C1; Tue, 23 Aug 2022 08:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242743; bh=7wVN8IvfazuS84SzkZjlK5R+FeYjsoVJzWDg/BbbF1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i/OEkvk8NObS7kCq0txdgr5pq/cCmFYFCStWggwRmQqCVY+poK6qFGmMLWCdlADHj jrhxxlE6vIpJolyNE8TUTTC2AETbH4xCQou2yZfHQTBGKITIGF3UT/F6leY3xy3H+E DS8BRXYT1SEySzRl+WnXJH+u5VA2at0Z8x6eRRbg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Bloch , Leon Romanovsky Subject: [PATCH 5.19 186/365] RDMA/mlx5: Use the proper number of ports Date: Tue, 23 Aug 2022 10:01:27 +0200 Message-Id: <20220823080126.002460213@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Bloch commit 4b83c3caf289b80acecc539c79f10a6937cc42dd upstream. The cited commit allowed the driver to operate over HCAs that have 4 physical ports. Use the number of ports of the RDMA device in the for loop instead of using the struct size. Fixes: 4cd14d44b11d ("net/mlx5: Support devices with more than 2 ports") Link: https://lore.kernel.org/r/a54a56c2ede16044a29d119209b35189c662ac72.16= 59944855.git.leonro@nvidia.com Signed-off-by: Mark Bloch Signed-off-by: Leon Romanovsky Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/infiniband/hw/mlx5/main.c | 34 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5= /main.c index a174a0eee8dc..fc94a1b25485 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -2738,26 +2738,24 @@ static int set_has_smi_cap(struct mlx5_ib_dev *dev) int err; int port; =20 - for (port =3D 1; port <=3D ARRAY_SIZE(dev->port_caps); port++) { - dev->port_caps[port - 1].has_smi =3D false; - if (MLX5_CAP_GEN(dev->mdev, port_type) =3D=3D - MLX5_CAP_PORT_TYPE_IB) { - if (MLX5_CAP_GEN(dev->mdev, ib_virt)) { - err =3D mlx5_query_hca_vport_context(dev->mdev, 0, - port, 0, - &vport_ctx); - if (err) { - mlx5_ib_err(dev, "query_hca_vport_context for port=3D%d failed %d\n", - port, err); - return err; - } - dev->port_caps[port - 1].has_smi =3D - vport_ctx.has_smi; - } else { - dev->port_caps[port - 1].has_smi =3D true; - } + if (MLX5_CAP_GEN(dev->mdev, port_type) !=3D MLX5_CAP_PORT_TYPE_IB) + return 0; + + for (port =3D 1; port <=3D dev->num_ports; port++) { + if (!MLX5_CAP_GEN(dev->mdev, ib_virt)) { + dev->port_caps[port - 1].has_smi =3D true; + continue; } + err =3D mlx5_query_hca_vport_context(dev->mdev, 0, port, 0, + &vport_ctx); + if (err) { + mlx5_ib_err(dev, "query_hca_vport_context for port=3D%d failed %d\n", + port, err); + return err; + } + dev->port_caps[port - 1].has_smi =3D vport_ctx.has_smi; } + return 0; } =20 --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5EE5C32772 for ; Tue, 23 Aug 2022 08:43:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347103AbiHWIn2 (ORCPT ); Tue, 23 Aug 2022 04:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347175AbiHWIkq (ORCPT ); Tue, 23 Aug 2022 04:40:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25855785AF; Tue, 23 Aug 2022 01:19:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C4A14612FE; Tue, 23 Aug 2022 08:19:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8976C433D6; Tue, 23 Aug 2022 08:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242746; bh=nKU8y2dvnO/CDH+Ggz7JkTDok6mbH9SjMtG+BKseyec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qc+2YOIdnD96U/rKkhQRqnzLcIOtNXyCn3L6btanHdg3hhOxOxoDjfuP2fOzjSs0B qD8JuslSo6T5tJSCPxGqpu0wcpki23/om6loIQNZzlw4CHPCEdpIf5gy364hjemZhI VIrB3IlPMJEYiZwS2VNX0nWLjAJiDWLMskd2J5TY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Potnuri Bharat Teja , Rahul Lakkireddy , Kees Cook , Leon Romanovsky Subject: [PATCH 5.19 187/365] RDMA/cxgb4: fix accept failure due to increased cpl_t5_pass_accept_rpl size Date: Tue, 23 Aug 2022 10:01:28 +0200 Message-Id: <20220823080126.041595996@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Potnuri Bharat Teja commit ef0162298abf46b881e4a4d0c604d1a066228647 upstream. Commit 'c2ed5611afd7' has increased the cpl_t5_pass_accept_rpl{} structure size by 8B to avoid roundup. cpl_t5_pass_accept_rpl{} is a HW specific structure and increasing its size will lead to unwanted adapter errors. Current commit reverts the cpl_t5_pass_accept_rpl{} back to its original and allocates zeroed skb buffer there by avoiding the memset for iss field. Reorder code to minimize chip type checks. Fixes: c2ed5611afd7 ("iw_cxgb4: Use memset_startat() for cpl_t5_pass_accept= _rpl") Link: https://lore.kernel.org/r/20220809184118.2029-1-rahul.lakkireddy@chel= sio.com Signed-off-by: Potnuri Bharat Teja Signed-off-by: Rahul Lakkireddy Reviewed-by: Kees Cook Signed-off-by: Leon Romanovsky Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/infiniband/hw/cxgb4/cm.c | 25 ++++++++------------- drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 2 +- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4= /cm.c index c16017f6e8db..14392c942f49 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c @@ -2468,31 +2468,24 @@ static int accept_cr(struct c4iw_ep *ep, struct sk_= buff *skb, opt2 |=3D CCTRL_ECN_V(1); } =20 - skb_get(skb); - rpl =3D cplhdr(skb); if (!is_t4(adapter_type)) { - BUILD_BUG_ON(sizeof(*rpl5) !=3D roundup(sizeof(*rpl5), 16)); - skb_trim(skb, sizeof(*rpl5)); - rpl5 =3D (void *)rpl; - INIT_TP_WR(rpl5, ep->hwtid); - } else { - skb_trim(skb, sizeof(*rpl)); - INIT_TP_WR(rpl, ep->hwtid); - } - OPCODE_TID(rpl) =3D cpu_to_be32(MK_OPCODE_TID(CPL_PASS_ACCEPT_RPL, - ep->hwtid)); - - if (CHELSIO_CHIP_VERSION(adapter_type) > CHELSIO_T4) { u32 isn =3D (prandom_u32() & ~7UL) - 1; + + skb =3D get_skb(skb, roundup(sizeof(*rpl5), 16), GFP_KERNEL); + rpl5 =3D __skb_put_zero(skb, roundup(sizeof(*rpl5), 16)); + rpl =3D (void *)rpl5; + INIT_TP_WR_CPL(rpl5, CPL_PASS_ACCEPT_RPL, ep->hwtid); opt2 |=3D T5_OPT_2_VALID_F; opt2 |=3D CONG_CNTRL_V(CONG_ALG_TAHOE); opt2 |=3D T5_ISS_F; - rpl5 =3D (void *)rpl; - memset_after(rpl5, 0, iss); if (peer2peer) isn +=3D 4; rpl5->iss =3D cpu_to_be32(isn); pr_debug("iss %u\n", be32_to_cpu(rpl5->iss)); + } else { + skb =3D get_skb(skb, sizeof(*rpl), GFP_KERNEL); + rpl =3D __skb_put_zero(skb, sizeof(*rpl)); + INIT_TP_WR_CPL(rpl, CPL_PASS_ACCEPT_RPL, ep->hwtid); } =20 rpl->opt0 =3D cpu_to_be64(opt0); diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h b/drivers/net/ethe= rnet/chelsio/cxgb4/t4_msg.h index 26433a62d7f0..fed5f93bf620 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h @@ -497,7 +497,7 @@ struct cpl_t5_pass_accept_rpl { __be32 opt2; __be64 opt0; __be32 iss; - __be32 rsvd[3]; + __be32 rsvd; }; =20 struct cpl_act_open_req { --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85793C32772 for ; Tue, 23 Aug 2022 08:43:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240813AbiHWInf (ORCPT ); Tue, 23 Aug 2022 04:43:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347540AbiHWIk6 (ORCPT ); Tue, 23 Aug 2022 04:40:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B9B778BC2; Tue, 23 Aug 2022 01:19:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C47FB612FE; Tue, 23 Aug 2022 08:19:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B98A3C433D6; Tue, 23 Aug 2022 08:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242749; bh=8S/L+ko8PXRVOng3sXlH05A8J8sOawPha2jooEBcrs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=00FyDqoRLlOqdoOgfzVtfU4MjoOJQhBZ5jNud2bgWLXQv2hZuu5SuuxBfCON9oW3r EGlKEdobpoDwNoVWqBk30y9TQWhxZsMBZBhBKyzWZgPCzU1lvanYzLyfdwX4fsl6/V DobmzqDj4MYqRXAWFB250yq4VK45bDpVKxKTS45U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yi Chen , Florian Westphal Subject: [PATCH 5.19 188/365] netfilter: nfnetlink: re-enable conntrack expectation events Date: Tue, 23 Aug 2022 10:01:29 +0200 Message-Id: <20220823080126.092950775@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit 0b2f3212b551a87fe936701fa0813032861a3308 upstream. To avoid allocation of the conntrack extension area when possible, the default behaviour was changed to only allocate the event extension if a userspace program is subscribed to a notification group. Problem is that while 'conntrack -E' does enable the event allocation behind the scenes, 'conntrack -E expect' does not: no expectation events are delivered unless user sets "net.netfilter.nf_conntrack_events" back to 1 (always on). Fix the autodetection to also consider EXP type group. We need to track the 6 event groups (3+3, new/update/destroy for events and for expectations each) independently, else we'd disable events again if an expectation group becomes empty while there is still an active event group. Fixes: 2794cdb0b97b ("netfilter: nfnetlink: allow to detect if ctnetlink li= steners exist") Reported-by: Yi Chen Signed-off-by: Florian Westphal Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- include/net/netns/conntrack.h | 2 - net/netfilter/nfnetlink.c | 83 +++++++++++++++++++++++++++++++++++--= ----- 2 files changed, 72 insertions(+), 13 deletions(-) --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h @@ -95,7 +95,7 @@ struct nf_ip_net { =20 struct netns_ct { #ifdef CONFIG_NF_CONNTRACK_EVENTS - bool ctnetlink_has_listener; + u8 ctnetlink_has_listener; bool ecache_dwork_pending; #endif u8 sysctl_log_invalid; /* Log invalid packets */ --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c @@ -44,6 +44,10 @@ MODULE_DESCRIPTION("Netfilter messages v =20 static unsigned int nfnetlink_pernet_id __read_mostly; =20 +#ifdef CONFIG_NF_CONNTRACK_EVENTS +static DEFINE_SPINLOCK(nfnl_grp_active_lock); +#endif + struct nfnl_net { struct sock *nfnl; }; @@ -654,6 +658,44 @@ static void nfnetlink_rcv(struct sk_buff netlink_rcv_skb(skb, nfnetlink_rcv_msg); } =20 +static void nfnetlink_bind_event(struct net *net, unsigned int group) +{ +#ifdef CONFIG_NF_CONNTRACK_EVENTS + int type, group_bit; + u8 v; + + /* All NFNLGRP_CONNTRACK_* group bits fit into u8. + * The other groups are not relevant and can be ignored. + */ + if (group >=3D 8) + return; + + type =3D nfnl_group2type[group]; + + switch (type) { + case NFNL_SUBSYS_CTNETLINK: + break; + case NFNL_SUBSYS_CTNETLINK_EXP: + break; + default: + return; + } + + group_bit =3D (1 << group); + + spin_lock(&nfnl_grp_active_lock); + v =3D READ_ONCE(net->ct.ctnetlink_has_listener); + if ((v & group_bit) =3D=3D 0) { + v |=3D group_bit; + + /* read concurrently without nfnl_grp_active_lock held. */ + WRITE_ONCE(net->ct.ctnetlink_has_listener, v); + } + + spin_unlock(&nfnl_grp_active_lock); +#endif +} + static int nfnetlink_bind(struct net *net, int group) { const struct nfnetlink_subsystem *ss; @@ -670,28 +712,45 @@ static int nfnetlink_bind(struct net *ne if (!ss) request_module_nowait("nfnetlink-subsys-%d", type); =20 -#ifdef CONFIG_NF_CONNTRACK_EVENTS - if (type =3D=3D NFNL_SUBSYS_CTNETLINK) { - nfnl_lock(NFNL_SUBSYS_CTNETLINK); - WRITE_ONCE(net->ct.ctnetlink_has_listener, true); - nfnl_unlock(NFNL_SUBSYS_CTNETLINK); - } -#endif + nfnetlink_bind_event(net, group); return 0; } =20 static void nfnetlink_unbind(struct net *net, int group) { #ifdef CONFIG_NF_CONNTRACK_EVENTS + int type, group_bit; + if (group <=3D NFNLGRP_NONE || group > NFNLGRP_MAX) return; =20 - if (nfnl_group2type[group] =3D=3D NFNL_SUBSYS_CTNETLINK) { - nfnl_lock(NFNL_SUBSYS_CTNETLINK); - if (!nfnetlink_has_listeners(net, group)) - WRITE_ONCE(net->ct.ctnetlink_has_listener, false); - nfnl_unlock(NFNL_SUBSYS_CTNETLINK); + type =3D nfnl_group2type[group]; + + switch (type) { + case NFNL_SUBSYS_CTNETLINK: + break; + case NFNL_SUBSYS_CTNETLINK_EXP: + break; + default: + return; + } + + /* ctnetlink_has_listener is u8 */ + if (group >=3D 8) + return; + + group_bit =3D (1 << group); + + spin_lock(&nfnl_grp_active_lock); + if (!nfnetlink_has_listeners(net, group)) { + u8 v =3D READ_ONCE(net->ct.ctnetlink_has_listener); + + v &=3D ~group_bit; + + /* read concurrently without nfnl_grp_active_lock held. */ + WRITE_ONCE(net->ct.ctnetlink_has_listener, v); } + spin_unlock(&nfnl_grp_active_lock); #endif } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3EA6C32772 for ; Tue, 23 Aug 2022 09:00:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345696AbiHWJAI (ORCPT ); Tue, 23 Aug 2022 05:00:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241411AbiHWI7g (ORCPT ); Tue, 23 Aug 2022 04:59:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A123872861; Tue, 23 Aug 2022 01:26:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0726761326; Tue, 23 Aug 2022 08:19:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE79AC433C1; Tue, 23 Aug 2022 08:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242752; bh=Y6ANw5KX4DbdM59Da3Kv2+eYubJ10ZRx8yC/Z07q1iU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CdXpHORVMWKYER3eghs0Z/SK8NAHKYdx+TOy6RzTBpMbQ2hVa8eLVeGPOM06fNley LAxE/3gu8nL8X5Ee7+1st6gar3PxhN9ZbA6lc/uFxPbrOmekU2AnDGFhnuvQc7pCUK +AU4SHk8Z6/rka9tHqlqjlRC7nepfJ0FjKvEzSrM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso Subject: [PATCH 5.19 189/365] netfilter: nf_tables: use READ_ONCE and WRITE_ONCE for shared generation id access Date: Tue, 23 Aug 2022 10:01:30 +0200 Message-Id: <20220823080126.128862257@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso commit 3400278328285a8c2f121904496aff5e7b610a01 upstream. The generation ID is bumped from the commit path while holding the mutex, however, netlink dump operations rely on RCU. This patch also adds missing cb->base_eq initialization in nf_tables_dump_set(). Fixes: 38e029f14a97 ("netfilter: nf_tables: set NLM_F_DUMP_INTR if netlink = dumping is stale") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -889,7 +889,7 @@ static int nf_tables_dump_tables(struct =20 rcu_read_lock(); nft_net =3D nft_pernet(net); - cb->seq =3D nft_net->base_seq; + cb->seq =3D READ_ONCE(nft_net->base_seq); =20 list_for_each_entry_rcu(table, &nft_net->tables, list) { if (family !=3D NFPROTO_UNSPEC && family !=3D table->family) @@ -1705,7 +1705,7 @@ static int nf_tables_dump_chains(struct =20 rcu_read_lock(); nft_net =3D nft_pernet(net); - cb->seq =3D nft_net->base_seq; + cb->seq =3D READ_ONCE(nft_net->base_seq); =20 list_for_each_entry_rcu(table, &nft_net->tables, list) { if (family !=3D NFPROTO_UNSPEC && family !=3D table->family) @@ -3149,7 +3149,7 @@ static int nf_tables_dump_rules(struct s =20 rcu_read_lock(); nft_net =3D nft_pernet(net); - cb->seq =3D nft_net->base_seq; + cb->seq =3D READ_ONCE(nft_net->base_seq); =20 list_for_each_entry_rcu(table, &nft_net->tables, list) { if (family !=3D NFPROTO_UNSPEC && family !=3D table->family) @@ -4133,7 +4133,7 @@ static int nf_tables_dump_sets(struct sk =20 rcu_read_lock(); nft_net =3D nft_pernet(net); - cb->seq =3D nft_net->base_seq; + cb->seq =3D READ_ONCE(nft_net->base_seq); =20 list_for_each_entry_rcu(table, &nft_net->tables, list) { if (ctx->family !=3D NFPROTO_UNSPEC && @@ -5061,6 +5061,8 @@ static int nf_tables_dump_set(struct sk_ =20 rcu_read_lock(); nft_net =3D nft_pernet(net); + cb->seq =3D READ_ONCE(nft_net->base_seq); + list_for_each_entry_rcu(table, &nft_net->tables, list) { if (dump_ctx->ctx.family !=3D NFPROTO_UNSPEC && dump_ctx->ctx.family !=3D table->family) @@ -6887,7 +6889,7 @@ static int nf_tables_dump_obj(struct sk_ =20 rcu_read_lock(); nft_net =3D nft_pernet(net); - cb->seq =3D nft_net->base_seq; + cb->seq =3D READ_ONCE(nft_net->base_seq); =20 list_for_each_entry_rcu(table, &nft_net->tables, list) { if (family !=3D NFPROTO_UNSPEC && family !=3D table->family) @@ -7819,7 +7821,7 @@ static int nf_tables_dump_flowtable(stru =20 rcu_read_lock(); nft_net =3D nft_pernet(net); - cb->seq =3D nft_net->base_seq; + cb->seq =3D READ_ONCE(nft_net->base_seq); =20 list_for_each_entry_rcu(table, &nft_net->tables, list) { if (family !=3D NFPROTO_UNSPEC && family !=3D table->family) @@ -8752,6 +8754,7 @@ static int nf_tables_commit(struct net * struct nft_trans_elem *te; struct nft_chain *chain; struct nft_table *table; + unsigned int base_seq; LIST_HEAD(adl); int err; =20 @@ -8801,9 +8804,12 @@ static int nf_tables_commit(struct net * * Bump generation counter, invalidate any dump in progress. * Cannot fail after this point. */ - while (++nft_net->base_seq =3D=3D 0) + base_seq =3D READ_ONCE(nft_net->base_seq); + while (++base_seq =3D=3D 0) ; =20 + WRITE_ONCE(nft_net->base_seq, base_seq); + /* step 3. Start new generation, rules_gen_X now in use. */ net->nft.gencursor =3D nft_gencursor_next(net); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93CD1C32772 for ; Tue, 23 Aug 2022 08:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346879AbiHWIou (ORCPT ); Tue, 23 Aug 2022 04:44:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237106AbiHWImI (ORCPT ); Tue, 23 Aug 2022 04:42:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 491ED7AC37; Tue, 23 Aug 2022 01:20:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A6572B81C29; Tue, 23 Aug 2022 08:19:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B110C43146; Tue, 23 Aug 2022 08:19:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242755; bh=h1N/HoQ8SFj1jwD/J82TZXKjDUAy/w3HkBlEkMlSijw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YadK4ieeImcfB2mpp6851h7QvvqZCfCNg2MgJoIwWVG/AEKWkTtMpjaUsHElg9KUT UBUYYqMl2B2sEoOdMtKqyxvOXfBTw6Y5ExSzy/fZIH3VaFDtbV8bv6/24hHDmFeoC8 eo6bSRSRAT4+GNR+SoCOho7l0dcJfBWrJRnhAeRg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Konstantin Komarov Subject: [PATCH 5.19 190/365] fs/ntfs3: uninitialized variable in ntfs_set_acl_ex() Date: Tue, 23 Aug 2022 10:01:31 +0200 Message-Id: <20220823080126.174240101@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter commit d4073595d0c61463ec3a87411b19e2a90f76d3f8 upstream. The goto out calls kfree(value) on an uninitialized pointer. Just return directly as the other error paths do. Fixes: 460bbf2990b3 ("fs/ntfs3: Do not change mode if ntfs_set_ea failed") Signed-off-by: Dan Carpenter Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/ntfs3/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -563,7 +563,7 @@ static noinline int ntfs_set_acl_ex(stru err =3D posix_acl_update_mode(mnt_userns, inode, &mode, &acl); if (err) - goto out; + return err; } name =3D XATTR_NAME_POSIX_ACL_ACCESS; name_len =3D sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D359C32772 for ; Tue, 23 Aug 2022 09:13:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348872AbiHWJNR (ORCPT ); Tue, 23 Aug 2022 05:13:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348571AbiHWJKc (ORCPT ); Tue, 23 Aug 2022 05:10:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C9C86D558; Tue, 23 Aug 2022 01:31:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 615B6B81C3B; Tue, 23 Aug 2022 08:19:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90F55C433D6; Tue, 23 Aug 2022 08:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242759; bh=vHPGp8AEhZpZ/FwWx4QLugFFEi7ycBigP5bAFx4OfiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQuo9d7xnRiIb5Ewwsd4H7m5CQid4fGBpyU9a+53okIAOxjMwVfXG1lhforGrbzp3 iFjRl5NQsLpVwczifhymKGus4WrTikDgJsM0T0ZheYI/Fmrnd5NyjVp1ib1iv8P5HP tKk/ZMz1l79WPbFgEOBqgQP/tZiNz/ssCs+d3ldg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso Subject: [PATCH 5.19 191/365] netfilter: nf_tables: disallow NFTA_SET_ELEM_KEY_END with NFT_SET_ELEM_INTERVAL_END flag Date: Tue, 23 Aug 2022 10:01:32 +0200 Message-Id: <20220823080126.208106436@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso commit 4963674c2e71fc062f8f089f0f58ffbb5533060b upstream. These are mutually exclusive, actually NFTA_SET_ELEM_KEY_END replaces the flag notation. Fixes: 7b225d0b5c6d ("netfilter: nf_tables: add NFTA_SET_ELEM_KEY_END attri= bute") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 1 + 1 file changed, 1 insertion(+) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -5855,6 +5855,7 @@ static int nft_add_set_elem(struct nft_c nla[NFTA_SET_ELEM_EXPIRATION] || nla[NFTA_SET_ELEM_USERDATA] || nla[NFTA_SET_ELEM_EXPR] || + nla[NFTA_SET_ELEM_KEY_END] || nla[NFTA_SET_ELEM_EXPRESSIONS])) return -EINVAL; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0CF8C32772 for ; Tue, 23 Aug 2022 08:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242483AbiHWI6H (ORCPT ); Tue, 23 Aug 2022 04:58:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241913AbiHWI53 (ORCPT ); Tue, 23 Aug 2022 04:57:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A49A273D; Tue, 23 Aug 2022 01:25:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 41C30B81C35; Tue, 23 Aug 2022 08:19:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60102C433D6; Tue, 23 Aug 2022 08:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242765; bh=3i6GooLD+noA1xpLFKw3PE5BYzonfRGzFl/PfYbHbik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ok5X8OvzScKMd8PymB31gRcDzWB+P9HLgE+q6lyreXFIACGENn5EDTygOVauMvJVS A6lHWFZ1nthDN2Nt300gkG44kwAcC5ZU1TOFd5T6PNUcu+C+foDwxImvEbFflGKOl/ kd3IgsJGzrHxD5XoAfurpnAAsPHXY+6H3vE/dFzQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 5.19 192/365] netfilter: nf_ct_sane: remove pseudo skb linearization Date: Tue, 23 Aug 2022 10:01:33 +0200 Message-Id: <20220823080126.246929890@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit a664375da76c6da8f83dc7997e43c568e1eb9a6a upstream. For historical reason this code performs pseudo linearization of skbs via skb_header_pointer and a global 64k buffer. With arrival of BIG TCP, packets generated by TCP stack can exceed 64kb. Rewrite this to only extract the needed header data. This also allows to get rid of the locking. Fixes: 7c4e983c4f3c ("net: allow gso_max_size to exceed 65536") Fixes: 0fe79f28bfaf ("net: allow gro_max_size to exceed 65536") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_conntrack_sane.c | 68 ++++++++++++++++-----------------= ----- 1 file changed, 30 insertions(+), 38 deletions(-) --- a/net/netfilter/nf_conntrack_sane.c +++ b/net/netfilter/nf_conntrack_sane.c @@ -34,10 +34,6 @@ MODULE_AUTHOR("Michal Schmidt len - dataoff; - - spin_lock_bh(&nf_sane_lock); - sb_ptr =3D skb_header_pointer(skb, dataoff, datalen, sane_buffer); - if (!sb_ptr) { - spin_unlock_bh(&nf_sane_lock); - return NF_ACCEPT; - } - if (dir =3D=3D IP_CT_DIR_ORIGINAL) { + const struct sane_request *req; + if (datalen !=3D sizeof(struct sane_request)) - goto out; + return NF_ACCEPT; + + req =3D skb_header_pointer(skb, dataoff, datalen, &buf.req); + if (!req) + return NF_ACCEPT; =20 - req =3D sb_ptr; if (req->RPC_code !=3D htonl(SANE_NET_START)) { /* Not an interesting command */ - ct_sane_info->state =3D SANE_STATE_NORMAL; - goto out; + WRITE_ONCE(ct_sane_info->state, SANE_STATE_NORMAL); + return NF_ACCEPT; } =20 /* We're interested in the next reply */ - ct_sane_info->state =3D SANE_STATE_START_REQUESTED; - goto out; + WRITE_ONCE(ct_sane_info->state, SANE_STATE_START_REQUESTED); + return NF_ACCEPT; } =20 + /* IP_CT_DIR_REPLY */ + /* Is it a reply to an uninteresting command? */ - if (ct_sane_info->state !=3D SANE_STATE_START_REQUESTED) - goto out; + if (READ_ONCE(ct_sane_info->state) !=3D SANE_STATE_START_REQUESTED) + return NF_ACCEPT; =20 /* It's a reply to SANE_NET_START. */ - ct_sane_info->state =3D SANE_STATE_NORMAL; + WRITE_ONCE(ct_sane_info->state, SANE_STATE_NORMAL); =20 if (datalen < sizeof(struct sane_reply_net_start)) { pr_debug("NET_START reply too short\n"); - goto out; + return NF_ACCEPT; } =20 - reply =3D sb_ptr; + datalen =3D sizeof(struct sane_reply_net_start); + + reply =3D skb_header_pointer(skb, dataoff, datalen, &buf.repl); + if (!reply) + return NF_ACCEPT; + if (reply->status !=3D htonl(SANE_STATUS_SUCCESS)) { /* saned refused the command */ pr_debug("unsuccessful SANE_STATUS =3D %u\n", ntohl(reply->status)); - goto out; + return NF_ACCEPT; } =20 /* Invalid saned reply? Ignore it. */ if (reply->zero !=3D 0) - goto out; + return NF_ACCEPT; =20 exp =3D nf_ct_expect_alloc(ct); if (exp =3D=3D NULL) { nf_ct_helper_log(skb, ct, "cannot alloc expectation"); - ret =3D NF_DROP; - goto out; + return NF_DROP; } =20 tuple =3D &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple; @@ -162,9 +163,6 @@ static int help(struct sk_buff *skb, } =20 nf_ct_expect_put(exp); - -out: - spin_unlock_bh(&nf_sane_lock); return ret; } =20 @@ -178,7 +176,6 @@ static const struct nf_conntrack_expect_ static void __exit nf_conntrack_sane_fini(void) { nf_conntrack_helpers_unregister(sane, ports_c * 2); - kfree(sane_buffer); } =20 static int __init nf_conntrack_sane_init(void) @@ -187,10 +184,6 @@ static int __init nf_conntrack_sane_init =20 NF_CT_HELPER_BUILD_BUG_ON(sizeof(struct nf_ct_sane_master)); =20 - sane_buffer =3D kmalloc(65536, GFP_KERNEL); - if (!sane_buffer) - return -ENOMEM; - if (ports_c =3D=3D 0) ports[ports_c++] =3D SANE_PORT; =20 @@ -210,7 +203,6 @@ static int __init nf_conntrack_sane_init ret =3D nf_conntrack_helpers_register(sane, ports_c * 2); if (ret < 0) { pr_err("failed to register helpers\n"); - kfree(sane_buffer); return ret; } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 525A0C32772 for ; Tue, 23 Aug 2022 08:44:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347303AbiHWIoU (ORCPT ); Tue, 23 Aug 2022 04:44:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348162AbiHWIlW (ORCPT ); Tue, 23 Aug 2022 04:41:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FC19796B2; Tue, 23 Aug 2022 01:19:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B03C0B81C4E; Tue, 23 Aug 2022 08:19:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09869C433C1; Tue, 23 Aug 2022 08:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242769; bh=foCti0Sh9RxG6Ky8jlJd3/eKJ1pUg06/w3XLziQgKGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OwGgKbWQwhGaKziucVxbee36vr6cSX9GTCWflw8eBZZ3LGyM2QOql4+HjAkODJORI SXTRSaSUNJy568wl4pPAlYgOK9CNyBapfsTPhPiYONooN1m5InHsuq7wF8YTUMzYRf n2aGfUZVCs6Zke7EkWIKirJ9Ln8NHmcDYFcIIGSQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 5.19 193/365] netfilter: nf_ct_h323: cap packet size at 64k Date: Tue, 23 Aug 2022 10:01:34 +0200 Message-Id: <20220823080126.293138101@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit f3e124c36f70d5ffcdd4e8bdbe7bb28a98a715c0 upstream. With BIG TCP, packets generated by tcp stack may exceed 64kb. Cap datalen at 64kb. The internal message format uses 16bit fields, so no embedded message can exceed 64k size. Multiple h323 messages in a single superpacket may now result in a message to get treated as incomplete/truncated, but thats better than scribbling past h323_buffer. Another alternative suitable for net tree would be a switch to skb_linearize(). Fixes: 7c4e983c4f3c ("net: allow gso_max_size to exceed 65536") Fixes: 0fe79f28bfaf ("net: allow gro_max_size to exceed 65536") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_conntrack_h323_main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/net/netfilter/nf_conntrack_h323_main.c +++ b/net/netfilter/nf_conntrack_h323_main.c @@ -34,6 +34,8 @@ #include #include =20 +#define H323_MAX_SIZE 65535 + /* Parameters */ static unsigned int default_rrq_ttl __read_mostly =3D 300; module_param(default_rrq_ttl, uint, 0600); @@ -142,6 +144,9 @@ static int get_tpkt_data(struct sk_buff if (tcpdatalen <=3D 0) /* No TCP data */ goto clear_out; =20 + if (tcpdatalen > H323_MAX_SIZE) + tcpdatalen =3D H323_MAX_SIZE; + if (*data =3D=3D NULL) { /* first TPKT */ /* Get first TPKT pointer */ tpkt =3D skb_header_pointer(skb, tcpdataoff, tcpdatalen, @@ -1220,6 +1225,9 @@ static unsigned char *get_udp_data(struc if (dataoff >=3D skb->len) return NULL; *datalen =3D skb->len - dataoff; + if (*datalen > H323_MAX_SIZE) + *datalen =3D H323_MAX_SIZE; + return skb_header_pointer(skb, dataoff, *datalen, h323_buffer); } =20 @@ -1821,7 +1829,7 @@ static int __init nf_conntrack_h323_init =20 NF_CT_HELPER_BUILD_BUG_ON(sizeof(struct nf_ct_h323_master)); =20 - h323_buffer =3D kmalloc(65536, GFP_KERNEL); + h323_buffer =3D kmalloc(H323_MAX_SIZE + 1, GFP_KERNEL); if (!h323_buffer) return -ENOMEM; ret =3D h323_helper_init(); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECB3FC32772 for ; Tue, 23 Aug 2022 08:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241394AbiHWI5w (ORCPT ); Tue, 23 Aug 2022 04:57:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241489AbiHWI52 (ORCPT ); Tue, 23 Aug 2022 04:57:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74E5F10550; Tue, 23 Aug 2022 01:25:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3E6ACB81C4C; Tue, 23 Aug 2022 08:19:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FAECC433D7; Tue, 23 Aug 2022 08:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242773; bh=keD4PPoxYhzM6PyquEBtEeIYUAl7WnMlu51eH/WuM1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMKtjQ+D6b4XdxhkALtiUV6BCN9Z0PsrIvA2ljJaANLY+lj/uhuRqjUlkgv2BqE81 QnVqbsSIIGZGvXo5KJfzxfGYiYPpftv25H76KiXB2scEm34QINac4vVSPQZLXFqf90 bj+oyJHMkbuAhiRbH45oq1ET3eCYBxVH958Lm9Pw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 5.19 194/365] netfilter: nf_ct_ftp: prefer skb_linearize Date: Tue, 23 Aug 2022 10:01:35 +0200 Message-Id: <20220823080126.336978835@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit c783a29c7e5934eabac2b760571489ad83bf4fd1 upstream. This uses a pseudo-linearization scheme with a 64k global buffer, but BIG TCP arrival means IPv6 TCP stack can generate skbs that exceed this size. Use skb_linearize. It should be possible to rewrite this to properly deal with segmented skbs (i.e., only do small chunk-wise accesses), but this is going to be a lot more intrusive than this because every helper function needs to get the sk_buff instead of a pointer to a raw data buffer. In practice, provided we're really looking at FTP control channel packets, there should never be a case where we deal with huge packets. Fixes: 7c4e983c4f3c ("net: allow gso_max_size to exceed 65536") Fixes: 0fe79f28bfaf ("net: allow gro_max_size to exceed 65536") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_conntrack_ftp.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_= ftp.c index a414274338cf..0d9332e9cf71 100644 --- a/net/netfilter/nf_conntrack_ftp.c +++ b/net/netfilter/nf_conntrack_ftp.c @@ -34,11 +34,6 @@ MODULE_DESCRIPTION("ftp connection tracking helper"); MODULE_ALIAS("ip_conntrack_ftp"); MODULE_ALIAS_NFCT_HELPER(HELPER_NAME); =20 -/* This is slow, but it's simple. --RR */ -static char *ftp_buffer; - -static DEFINE_SPINLOCK(nf_ftp_lock); - #define MAX_PORTS 8 static u_int16_t ports[MAX_PORTS]; static unsigned int ports_c; @@ -398,6 +393,9 @@ static int help(struct sk_buff *skb, return NF_ACCEPT; } =20 + if (unlikely(skb_linearize(skb))) + return NF_DROP; + th =3D skb_header_pointer(skb, protoff, sizeof(_tcph), &_tcph); if (th =3D=3D NULL) return NF_ACCEPT; @@ -411,12 +409,8 @@ static int help(struct sk_buff *skb, } datalen =3D skb->len - dataoff; =20 - spin_lock_bh(&nf_ftp_lock); - fb_ptr =3D skb_header_pointer(skb, dataoff, datalen, ftp_buffer); - if (!fb_ptr) { - spin_unlock_bh(&nf_ftp_lock); - return NF_ACCEPT; - } + spin_lock_bh(&ct->lock); + fb_ptr =3D skb->data + dataoff; =20 ends_in_nl =3D (fb_ptr[datalen - 1] =3D=3D '\n'); seq =3D ntohl(th->seq) + datalen; @@ -544,7 +538,7 @@ static int help(struct sk_buff *skb, if (ends_in_nl) update_nl_seq(ct, seq, ct_ftp_info, dir, skb); out: - spin_unlock_bh(&nf_ftp_lock); + spin_unlock_bh(&ct->lock); return ret; } =20 @@ -571,7 +565,6 @@ static const struct nf_conntrack_expect_policy ftp_exp_= policy =3D { static void __exit nf_conntrack_ftp_fini(void) { nf_conntrack_helpers_unregister(ftp, ports_c * 2); - kfree(ftp_buffer); } =20 static int __init nf_conntrack_ftp_init(void) @@ -580,10 +573,6 @@ static int __init nf_conntrack_ftp_init(void) =20 NF_CT_HELPER_BUILD_BUG_ON(sizeof(struct nf_ct_ftp_master)); =20 - ftp_buffer =3D kmalloc(65536, GFP_KERNEL); - if (!ftp_buffer) - return -ENOMEM; - if (ports_c =3D=3D 0) ports[ports_c++] =3D FTP_PORT; =20 @@ -603,7 +592,6 @@ static int __init nf_conntrack_ftp_init(void) ret =3D nf_conntrack_helpers_register(ftp, ports_c * 2); if (ret < 0) { pr_err("failed to register helpers\n"); - kfree(ftp_buffer); return ret; } =20 --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE22DC32772 for ; Tue, 23 Aug 2022 08:45:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243313AbiHWIo6 (ORCPT ); Tue, 23 Aug 2022 04:44:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345004AbiHWImN (ORCPT ); Tue, 23 Aug 2022 04:42:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09D0161722; Tue, 23 Aug 2022 01:20:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5C27C61212; Tue, 23 Aug 2022 08:19:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C3DCC433C1; Tue, 23 Aug 2022 08:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242776; bh=KUI2cN9pa6NkqKzcH5G8VxQkrWLwmBFwrdOxH167Smo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ifXsTVpBdqOD/x62nbeL59BfCRuDBOmCMDdJLXNzz7H4Y+sAA9rhTfPsdpnGDzusF GMr0glUW7Sh2N6lasBHL3dKmYtGHN6/UDlFVYBwZaD0/9+7gvvvayJIZNfYh6hC57N UoMPI+5HbPoTwTPhdqZc9LJDcshZQ8AA/D5AmhJQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 5.19 195/365] netfilter: nf_ct_irc: cap packet search space to 4k Date: Tue, 23 Aug 2022 10:01:36 +0200 Message-Id: <20220823080126.378613262@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit 976bf59c69cd2e2c17f0ab20a14c0e700cba0f15 upstream. This uses a pseudo-linearization scheme with a 64k global buffer, but BIG TCP arrival means IPv6 TCP stack can generate skbs that exceed this size. In practice, IRC commands are not expected to exceed 512 bytes, plus this is interactive protocol, so we should not see large packets in practice. Given most IRC connections nowadays use TLS so this helper could also be removed in the near future. Fixes: 7c4e983c4f3c ("net: allow gso_max_size to exceed 65536") Fixes: 0fe79f28bfaf ("net: allow gro_max_size to exceed 65536") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_conntrack_irc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/net/netfilter/nf_conntrack_irc.c b/net/netfilter/nf_conntrack_= irc.c index 08ee4e760a3d..1796c456ac98 100644 --- a/net/netfilter/nf_conntrack_irc.c +++ b/net/netfilter/nf_conntrack_irc.c @@ -39,6 +39,7 @@ unsigned int (*nf_nat_irc_hook)(struct sk_buff *skb, EXPORT_SYMBOL_GPL(nf_nat_irc_hook); =20 #define HELPER_NAME "irc" +#define MAX_SEARCH_SIZE 4095 =20 MODULE_AUTHOR("Harald Welte "); MODULE_DESCRIPTION("IRC (DCC) connection tracking helper"); @@ -121,6 +122,7 @@ static int help(struct sk_buff *skb, unsigned int proto= ff, int i, ret =3D NF_ACCEPT; char *addr_beg_p, *addr_end_p; typeof(nf_nat_irc_hook) nf_nat_irc; + unsigned int datalen; =20 /* If packet is coming from IRC server */ if (dir =3D=3D IP_CT_DIR_REPLY) @@ -140,8 +142,12 @@ static int help(struct sk_buff *skb, unsigned int prot= off, if (dataoff >=3D skb->len) return NF_ACCEPT; =20 + datalen =3D skb->len - dataoff; + if (datalen > MAX_SEARCH_SIZE) + datalen =3D MAX_SEARCH_SIZE; + spin_lock_bh(&irc_buffer_lock); - ib_ptr =3D skb_header_pointer(skb, dataoff, skb->len - dataoff, + ib_ptr =3D skb_header_pointer(skb, dataoff, datalen, irc_buffer); if (!ib_ptr) { spin_unlock_bh(&irc_buffer_lock); @@ -149,7 +155,7 @@ static int help(struct sk_buff *skb, unsigned int proto= ff, } =20 data =3D ib_ptr; - data_limit =3D ib_ptr + skb->len - dataoff; + data_limit =3D ib_ptr + datalen; =20 /* strlen("\1DCC SENT t AAAAAAAA P\1\n")=3D24 * 5+MINMATCHLEN+strlen("t AAAAAAAA P\1\n")=3D14 */ @@ -251,7 +257,7 @@ static int __init nf_conntrack_irc_init(void) irc_exp_policy.max_expected =3D max_dcc_channels; irc_exp_policy.timeout =3D dcc_timeout; =20 - irc_buffer =3D kmalloc(65536, GFP_KERNEL); + irc_buffer =3D kmalloc(MAX_SEARCH_SIZE + 1, GFP_KERNEL); if (!irc_buffer) return -ENOMEM; =20 --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 128F2C32792 for ; Tue, 23 Aug 2022 08:59:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241304AbiHWI7z (ORCPT ); Tue, 23 Aug 2022 04:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242382AbiHWI7a (ORCPT ); Tue, 23 Aug 2022 04:59:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 091D47390D; Tue, 23 Aug 2022 01:26:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8F9FE6132D; Tue, 23 Aug 2022 08:19:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9620EC433C1; Tue, 23 Aug 2022 08:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242780; bh=XlMZgAVmfzFK13clljcDaBlkofv50XjrF8t/pOrnWB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=02JmD+6zlWbV8ucyrKGnxopIWxMIOa3Eu92BjLeo8jDw/l5+kBtSRbnpMCv4ap8BG YKEaswPB+NkA8eS6dcPBgOIdY9VmMDzkSuMr5ml8ojl/Idfk/ekgGFKe8m6ofv17GQ Re84frg140FpQNhXjRlhbyDzH40m6TOwLIz1isg4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso Subject: [PATCH 5.19 196/365] netfilter: nf_tables: possible module reference underflow in error path Date: Tue, 23 Aug 2022 10:01:37 +0200 Message-Id: <20220823080126.432710514@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso commit c485c35ff6783ccd12c160fcac6a0e504e83e0bf upstream. dst->ops is set on when nft_expr_clone() fails, but module refcount has not been bumped yet, therefore nft_expr_destroy() leads to module reference underflow. Fixes: 8cfd9b0f8515 ("netfilter: nftables: generalize set expressions suppo= rt") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -5566,7 +5566,7 @@ int nft_set_elem_expr_clone(const struct =20 err =3D nft_expr_clone(expr, set->exprs[i]); if (err < 0) { - nft_expr_destroy(ctx, expr); + kfree(expr); goto err_expr; } expr_array[i] =3D expr; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DF5BC32772 for ; Tue, 23 Aug 2022 08:47:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240734AbiHWIrP (ORCPT ); Tue, 23 Aug 2022 04:47:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347241AbiHWIpO (ORCPT ); Tue, 23 Aug 2022 04:45:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FACB6AA0C; Tue, 23 Aug 2022 01:21:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4AB7361344; Tue, 23 Aug 2022 08:19:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53A74C433B5; Tue, 23 Aug 2022 08:19:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242782; bh=E0HKijj/aYKxcTXDI4Rk1LFkMA9lUuelgim1kwX1ZEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2hvnzZursvPNkPuFgte1iMJPLmOBW4Rtvb0TEmYeejdJ4OORqTXgTDEmIrvbUjWj5 d94qk4nGNiYVaegtNAQocY5V9z6HxZCjqUBWIzvA113+rb0VltBGFBP5QBJpxKM3KN Oqku4reJcFpZutS6TJgI5COtpzhItl5w3SorW9E0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso Subject: [PATCH 5.19 197/365] netfilter: nf_tables: really skip inactive sets when allocating name Date: Tue, 23 Aug 2022 10:01:38 +0200 Message-Id: <20220823080126.472216495@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso commit 271c5ca826e0c3c53e0eb4032f8eaedea1ee391c upstream. While looping to build the bitmap of used anonymous set names, check the current set in the iteration, instead of the one that is being created. Fixes: 37a9cc525525 ("netfilter: nf_tables: add generation mask to sets") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3907,7 +3907,7 @@ cont: list_for_each_entry(i, &ctx->table->sets, list) { int tmp; =20 - if (!nft_is_active_next(ctx->net, set)) + if (!nft_is_active_next(ctx->net, i)) continue; if (!sscanf(i->name, name, &tmp)) continue; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C28CC32772 for ; Tue, 23 Aug 2022 09:03:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242214AbiHWJD2 (ORCPT ); Tue, 23 Aug 2022 05:03:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347592AbiHWJCZ (ORCPT ); Tue, 23 Aug 2022 05:02:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A99261401E; Tue, 23 Aug 2022 01:28:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CDB63B81C50; Tue, 23 Aug 2022 08:28:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 307CEC433D6; Tue, 23 Aug 2022 08:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243316; bh=fqNDSaCK4HPU8qg6GanO+klTFgDMUje6BBch7RkMJSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JdpqhKmse9y0sJz1R8E9+aweaS83y9IhaxgeTp7/yPz0e8R8cA5QE1AdtnhEbUj99 r+qU04GUwJ3bXhu4EfSy+sgMYdvnG39TGEy8XvL5m/uufpCUmMe3acMvvSNFEYRvOD 4QOf1OMptsvTiNuYAZ21jWBKrc6K1tA/KVtOEDf0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 5.19 198/365] netfilter: nf_tables: fix scheduling-while-atomic splat Date: Tue, 23 Aug 2022 10:01:39 +0200 Message-Id: <20220823080126.512557000@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit 2024439bd5ceb145eeeb428b2a59e9b905153ac3 upstream. nf_tables_check_loops() can be called from rhashtable list walk so cond_resched() cannot be used here. Fixes: 81ea01066741 ("netfilter: nf_tables: add rescheduling points during = loop detection walks") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 4 ---- 1 file changed, 4 deletions(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -9372,13 +9372,9 @@ static int nf_tables_check_loops(const s break; } } - - cond_resched(); } =20 list_for_each_entry(set, &ctx->table->sets, list) { - cond_resched(); - if (!nft_is_active_next(ctx->net, set)) continue; if (!(set->flags & NFT_SET_MAP) || From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 897F3C32772 for ; Tue, 23 Aug 2022 09:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239882AbiHWJBG (ORCPT ); Tue, 23 Aug 2022 05:01:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347443AbiHWJA2 (ORCPT ); Tue, 23 Aug 2022 05:00:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8277F7330F; Tue, 23 Aug 2022 01:27:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 50E9461488; Tue, 23 Aug 2022 08:26:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D35FDC433D6; Tue, 23 Aug 2022 08:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243217; bh=TmWiTKgfzoKoGyNX5HZwo3WU9A42IVlNd++im0xVLXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZxhdBitsTGTcMbXSL0W/O4I8Q3A5dRxqc+F9tM/48gknpUoUHBtD6YWmbAFe8GD9q SDDE92bMh/VDaizGiDgBz4q/Xeem5s4yCfie05CMlyMjDNE/LHMNsDYWPYGWkgaXLm u8IOI276zp/0N+/48+Ki1OUUI4AkljSyYYfmDb8A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso Subject: [PATCH 5.19 199/365] netfilter: nf_tables: validate NFTA_SET_ELEM_OBJREF based on NFT_SET_OBJECT flag Date: Tue, 23 Aug 2022 10:01:40 +0200 Message-Id: <20220823080126.553163524@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso commit 5a2f3dc31811e93be15522d9eb13ed61460b76c8 upstream. If the NFTA_SET_ELEM_OBJREF netlink attribute is present and NFT_SET_OBJECT flag is set on, report EINVAL. Move existing sanity check earlier to validate that NFT_SET_OBJECT requires NFTA_SET_ELEM_OBJREF. Fixes: 8aeff920dcc9 ("netfilter: nf_tables: add stateful object reference t= o set elements") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -5848,6 +5848,15 @@ static int nft_add_set_elem(struct nft_c return -EINVAL; } =20 + if (set->flags & NFT_SET_OBJECT) { + if (!nla[NFTA_SET_ELEM_OBJREF] && + !(flags & NFT_SET_ELEM_INTERVAL_END)) + return -EINVAL; + } else { + if (nla[NFTA_SET_ELEM_OBJREF]) + return -EINVAL; + } + if ((flags & NFT_SET_ELEM_INTERVAL_END) && (nla[NFTA_SET_ELEM_DATA] || nla[NFTA_SET_ELEM_OBJREF] || @@ -5986,10 +5995,6 @@ static int nft_add_set_elem(struct nft_c } =20 if (nla[NFTA_SET_ELEM_OBJREF] !=3D NULL) { - if (!(set->flags & NFT_SET_OBJECT)) { - err =3D -EINVAL; - goto err_parse_key_end; - } obj =3D nft_obj_lookup(ctx->net, ctx->table, nla[NFTA_SET_ELEM_OBJREF], set->objtype, genmask); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E17CC32772 for ; Tue, 23 Aug 2022 09:04:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241308AbiHWJEY (ORCPT ); Tue, 23 Aug 2022 05:04:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242903AbiHWJDG (ORCPT ); Tue, 23 Aug 2022 05:03:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44ED032DBE; Tue, 23 Aug 2022 01:28:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1139FB81C4E; Tue, 23 Aug 2022 08:27:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AB30C433D6; Tue, 23 Aug 2022 08:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243252; bh=lrFmMLhDMSrDB8SJBrwArASfOdoFYOFqUPb7iQbSHgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GwThltINac+hXcMnplD2BNqSjTRY2QS5bKym8w9uUdxOoxf097ybPaNG08Ov1sfTp +alED1/l+h5O1O6+mitVGUT2hEXdrKFVBu34HaXVLp22woQgIMfWwFbWyMDAAZQQVv A5pT4Yf4JO/0eZ8pyV6QslUBrNw3+Rn1gpmHj9k0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso Subject: [PATCH 5.19 200/365] netfilter: nf_tables: NFTA_SET_ELEM_KEY_END requires concat and interval flags Date: Tue, 23 Aug 2022 10:01:41 +0200 Message-Id: <20220823080126.588213521@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso commit 88cccd908d51397f9754f89a937cd13fa59dee37 upstream. If the NFT_SET_CONCAT|NFT_SET_INTERVAL flags are set on, then the netlink attribute NFTA_SET_ELEM_KEY_END must be specified. Otherwise, NFTA_SET_ELEM_KEY_END should not be present. For catch-all element, NFTA_SET_ELEM_KEY_END should not be present. The NFT_SET_ELEM_INTERVAL_END is never used with this set flags combination. Fixes: 7b225d0b5c6d ("netfilter: nf_tables: add NFTA_SET_ELEM_KEY_END attri= bute") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -5798,6 +5798,24 @@ static void nft_setelem_remove(const str set->ops->remove(net, set, elem); } =20 +static bool nft_setelem_valid_key_end(const struct nft_set *set, + struct nlattr **nla, u32 flags) +{ + if ((set->flags & (NFT_SET_CONCAT | NFT_SET_INTERVAL)) =3D=3D + (NFT_SET_CONCAT | NFT_SET_INTERVAL)) { + if (flags & NFT_SET_ELEM_INTERVAL_END) + return false; + if (!nla[NFTA_SET_ELEM_KEY_END] && + !(flags & NFT_SET_ELEM_CATCHALL)) + return false; + } else { + if (nla[NFTA_SET_ELEM_KEY_END]) + return false; + } + + return true; +} + static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, const struct nlattr *attr, u32 nlmsg_flags) { @@ -5857,6 +5875,9 @@ static int nft_add_set_elem(struct nft_c return -EINVAL; } =20 + if (!nft_setelem_valid_key_end(set, nla, flags)) + return -EINVAL; + if ((flags & NFT_SET_ELEM_INTERVAL_END) && (nla[NFTA_SET_ELEM_DATA] || nla[NFTA_SET_ELEM_OBJREF] || @@ -6281,6 +6302,9 @@ static int nft_del_setelem(struct nft_ct if (!nla[NFTA_SET_ELEM_KEY] && !(flags & NFT_SET_ELEM_CATCHALL)) return -EINVAL; =20 + if (!nft_setelem_valid_key_end(set, nla, flags)) + return -EINVAL; + nft_set_ext_prepare(&tmpl); =20 if (flags !=3D 0) { From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D78DDC32772 for ; Tue, 23 Aug 2022 09:06:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241151AbiHWJGH (ORCPT ); Tue, 23 Aug 2022 05:06:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243417AbiHWJFI (ORCPT ); Tue, 23 Aug 2022 05:05:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3554074B8F; Tue, 23 Aug 2022 01:29:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 07BF8B81C48; Tue, 23 Aug 2022 08:28:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68CDDC433D6; Tue, 23 Aug 2022 08:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243285; bh=0kRc/kQ7IVCbJ2ZgeyLpv5oI5kf4VZzx/zouu/0Opm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZCj642yJQMEfTDgTiQ+I0WG8rZPEPs/K7Q+6TqGZr0ILYZscnzFbn/I9aY7Q7Nlef JGy92gTASqFk5E1d57VwEWL5qJHXoQlbAXtiH2gEGbULI2dxTWOLoWX3DLxP6dmHbo PeKE8EFphC3Ourzc4TW2CJx5hV5t20k+WHKRn4T0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso Subject: [PATCH 5.19 201/365] netfilter: nf_tables: disallow NFT_SET_ELEM_CATCHALL and NFT_SET_ELEM_INTERVAL_END Date: Tue, 23 Aug 2022 10:01:42 +0200 Message-Id: <20220823080126.628524897@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso commit fc0ae524b5fd2938c94d56da3f749f11eb3273d5 upstream. These flags are mutually exclusive, report EINVAL in this case. Fixes: aaa31047a6d2 ("netfilter: nftables: add catch-all set element suppor= t") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -5198,6 +5198,9 @@ static int nft_setelem_parse_flags(const if (!(set->flags & NFT_SET_INTERVAL) && *flags & NFT_SET_ELEM_INTERVAL_END) return -EINVAL; + if ((*flags & (NFT_SET_ELEM_INTERVAL_END | NFT_SET_ELEM_CATCHALL)) =3D=3D + (NFT_SET_ELEM_INTERVAL_END | NFT_SET_ELEM_CATCHALL)) + return -EINVAL; =20 return 0; } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A913C32792 for ; Tue, 23 Aug 2022 09:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242271AbiHWJFz (ORCPT ); Tue, 23 Aug 2022 05:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239780AbiHWJEp (ORCPT ); Tue, 23 Aug 2022 05:04:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E964A844F5; Tue, 23 Aug 2022 01:29:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4C5DCB81C56; Tue, 23 Aug 2022 08:28:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8136CC433D6; Tue, 23 Aug 2022 08:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243298; bh=ZkGlN9afaf+S8OZYrv31ANxjGxSlJNGR2VacqwOjGP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pLa9tzd+W/XTh8m7gazwNXxhvCqCOeec3CyWo9FosXAv/b2zoHa97Yu1p75ovcWlv 0rKQNkDHjP4YTjPPGUP7tOyMJ9+5mirChPe7/nyUMK4lwLjMZGXJu/qA2OmJUJVam4 mqFIXfMwrtE91JwxYqIBmvITtFqvBV6sD7/KefBY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso Subject: [PATCH 5.19 202/365] netfilter: nf_tables: check NFT_SET_CONCAT flag if field_count is specified Date: Tue, 23 Aug 2022 10:01:43 +0200 Message-Id: <20220823080126.677720458@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso commit 1b6345d4160ecd3d04bd8cd75df90c67811e8cc9 upstream. Since f3a2181e16f1 ("netfilter: nf_tables: Support for sets with multiple ranged fields"), it possible to combine intervals and concatenations. Later on, ef516e8625dd ("netfilter: nf_tables: reintroduce the NFT_SET_CONCAT flag") provides the NFT_SET_CONCAT flag for userspace to report that the set stores a concatenation. Make sure NFT_SET_CONCAT is set on if field_count is specified for consistency. Otherwise, if NFT_SET_CONCAT is specified with no field_count, bail out with EINVAL. Fixes: ef516e8625dd ("netfilter: nf_tables: reintroduce the NFT_SET_CONCAT = flag") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -4451,6 +4451,11 @@ static int nf_tables_newset(struct sk_bu err =3D nf_tables_set_desc_parse(&desc, nla[NFTA_SET_DESC]); if (err < 0) return err; + + if (desc.field_count > 1 && !(flags & NFT_SET_CONCAT)) + return -EINVAL; + } else if (flags & NFT_SET_CONCAT) { + return -EINVAL; } =20 if (nla[NFTA_SET_EXPR] || nla[NFTA_SET_EXPRESSIONS]) From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E09C9C32772 for ; Tue, 23 Aug 2022 09:06:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347828AbiHWJGx (ORCPT ); Tue, 23 Aug 2022 05:06:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348112AbiHWJFr (ORCPT ); Tue, 23 Aug 2022 05:05:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA9A685AA3; Tue, 23 Aug 2022 01:29:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF0A061484; Tue, 23 Aug 2022 08:28:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C516AC433D7; Tue, 23 Aug 2022 08:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243301; bh=JUNb4crmTtug/p7cqIm18MA46f2ZGlje8nkEmYEvpfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=katzGMdzFTBtSR8Xfddtmwx+DWuZZvfIJyT0hRDDMhp6ivKlfJ12HwTonGfmdbXa0 e1Vk/CD4xjv7RaDZZjJ6ZcGAZge3X/Qti3WqYsBJMKCM/0dqPrvn+8oys84PScVxy/ DvReq6qnl/XBx88xi+8iwfnxhGBCCIGJ1bCQzt3s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Michael Ellerman Subject: [PATCH 5.19 203/365] powerpc/pci: Fix get_phb_number() locking Date: Tue, 23 Aug 2022 10:01:44 +0200 Message-Id: <20220823080126.718264222@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Ellerman commit 8d48562a2729742f767b0fdd994d6b2a56a49c63 upstream. The recent change to get_phb_number() causes a DEBUG_ATOMIC_SLEEP warning on some systems: BUG: sleeping function called from invalid context at kernel/locking/mute= x.c:580 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 1 lock held by swapper/1: #0: c157efb0 (hose_spinlock){+.+.}-{2:2}, at: pcibios_alloc_controller+0= x64/0x220 Preemption disabled at: [<00000000>] 0x0 CPU: 0 PID: 1 Comm: swapper Not tainted 5.19.0-yocto-standard+ #1 Call Trace: [d101dc90] [c073b264] dump_stack_lvl+0x50/0x8c (unreliable) [d101dcb0] [c0093b70] __might_resched+0x258/0x2a8 [d101dcd0] [c0d3e634] __mutex_lock+0x6c/0x6ec [d101dd50] [c0a84174] of_alias_get_id+0x50/0xf4 [d101dd80] [c002ec78] pcibios_alloc_controller+0x1b8/0x220 [d101ddd0] [c140c9dc] pmac_pci_init+0x198/0x784 [d101de50] [c140852c] discover_phbs+0x30/0x4c [d101de60] [c0007fd4] do_one_initcall+0x94/0x344 [d101ded0] [c1403b40] kernel_init_freeable+0x1a8/0x22c [d101df10] [c00086e0] kernel_init+0x34/0x160 [d101df30] [c001b334] ret_from_kernel_thread+0x5c/0x64 This is because pcibios_alloc_controller() holds hose_spinlock but of_alias_get_id() takes of_mutex which can sleep. The hose_spinlock protects the phb_bitmap, and also the hose_list, but it doesn't need to be held while get_phb_number() calls the OF routines, because those are only looking up information in the device tree. So fix it by having get_phb_number() take the hose_spinlock itself, only where required, and then dropping the lock before returning. pcibios_alloc_controller() then needs to take the lock again before the list_add() but that's safe, the order of the list is not important. Fixes: 0fe1e96fef0a ("powerpc/pci: Prefer PCI domain assignment via DT 'lin= ux,pci-domain' and alias") Reported-by: Guenter Roeck Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220815065550.1303620-1-mpe@ellerman.id.au Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/powerpc/kernel/pci-common.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -67,10 +67,6 @@ void __init set_pci_dma_ops(const struct pci_dma_ops =3D dma_ops; } =20 -/* - * This function should run under locking protection, specifically - * hose_spinlock. - */ static int get_phb_number(struct device_node *dn) { int ret, phb_id =3D -1; @@ -107,15 +103,20 @@ static int get_phb_number(struct device_ if (!ret) phb_id =3D (int)(prop & (MAX_PHBS - 1)); =20 + spin_lock(&hose_spinlock); + /* We need to be sure to not use the same PHB number twice. */ if ((phb_id >=3D 0) && !test_and_set_bit(phb_id, phb_bitmap)) - return phb_id; + goto out_unlock; =20 /* If everything fails then fallback to dynamic PHB numbering. */ phb_id =3D find_first_zero_bit(phb_bitmap, MAX_PHBS); BUG_ON(phb_id >=3D MAX_PHBS); set_bit(phb_id, phb_bitmap); =20 +out_unlock: + spin_unlock(&hose_spinlock); + return phb_id; } =20 @@ -126,10 +127,13 @@ struct pci_controller *pcibios_alloc_con phb =3D zalloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL); if (phb =3D=3D NULL) return NULL; - spin_lock(&hose_spinlock); + phb->global_number =3D get_phb_number(dev); + + spin_lock(&hose_spinlock); list_add_tail(&phb->list_node, &hose_list); spin_unlock(&hose_spinlock); + phb->dn =3D dev; phb->is_dynamic =3D slab_is_available(); #ifdef CONFIG_PPC64 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ABCDC32772 for ; Tue, 23 Aug 2022 09:02:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242792AbiHWJCs (ORCPT ); Tue, 23 Aug 2022 05:02:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242749AbiHWJCG (ORCPT ); Tue, 23 Aug 2022 05:02:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09D835FF7; Tue, 23 Aug 2022 01:28:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BCA90B81C50; Tue, 23 Aug 2022 08:28:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 154B2C433D6; Tue, 23 Aug 2022 08:28:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243304; bh=AIm+iPxsLuS8cHO7rgsgO4mYB1yWFzEMV0ofdqrskFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=suxCqeebq+ztD9oz17tzvUF4emlPuXIQ6TqZ6fbIGjE19x/FruN4WAK2qX33/DX2c 1a4SzNlb2WXuFSergfmp4EScXOMNYru33CU+PxoWdzk0vchubwVk2s29dyCcLhTHBm hOFmcGiz9G7QWlcW6PxFGn6LE9qjjiLGo60vXX50= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Da Xue , Neil Armstrong , Mark Brown Subject: [PATCH 5.19 204/365] spi: meson-spicc: add local pow2 clock ops to preserve rate between messages Date: Tue, 23 Aug 2022 10:01:45 +0200 Message-Id: <20220823080126.748489089@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Neil Armstrong commit 09992025dacd258c823f50e82db09d7ef06cdac4 upstream. At the end of a message, the HW gets a reset in meson_spicc_unprepare_trans= fer(), this resets the SPICC_CONREG register and notably the value set by the Common Clock Framework. This is problematic because: - the register value CCF can be different from the corresponding CCF cached= rate - CCF is allowed to change the clock rate whenever the HW state This introduces: - local pow2 clock ops checking the HW state before allowing a clock operat= ion - separation of legacy pow2 clock patch and new enhanced clock path - SPICC_CONREG datarate value is now value kepts across messages It has been checked that: - SPICC_CONREG datarate value is kept across messages - CCF is only allowed to change the SPICC_CONREG datarate value when busy - SPICC_CONREG datarate value is correct for each transfer This didn't appear before commit 3e0cf4d3fc29 ("spi: meson-spicc: add a lin= ear clock divider support") because we recalculated and wrote the rate for each xfer. Fixes: 3e0cf4d3fc29 ("spi: meson-spicc: add a linear clock divider support") Reported-by: Da Xue Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20220811134445.678446-1-narmstrong@baylibre= .com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/spi/spi-meson-spicc.c | 129 ++++++++++++++++++++++++++++++++-----= ----- 1 file changed, 101 insertions(+), 28 deletions(-) --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -156,6 +156,7 @@ struct meson_spicc_device { void __iomem *base; struct clk *core; struct clk *pclk; + struct clk_divider pow2_div; struct clk *clk; struct spi_message *message; struct spi_transfer *xfer; @@ -168,6 +169,8 @@ struct meson_spicc_device { unsigned long xfer_remain; }; =20 +#define pow2_clk_to_spicc(_div) container_of(_div, struct meson_spicc_devi= ce, pow2_div) + static void meson_spicc_oen_enable(struct meson_spicc_device *spicc) { u32 conf; @@ -421,7 +424,7 @@ static int meson_spicc_prepare_message(s { struct meson_spicc_device *spicc =3D spi_master_get_devdata(master); struct spi_device *spi =3D message->spi; - u32 conf =3D 0; + u32 conf =3D readl_relaxed(spicc->base + SPICC_CONREG) & SPICC_DATARATE_M= ASK; =20 /* Store current message */ spicc->message =3D message; @@ -458,8 +461,6 @@ static int meson_spicc_prepare_message(s /* Select CS */ conf |=3D FIELD_PREP(SPICC_CS_MASK, spi->chip_select); =20 - /* Default Clock rate core/4 */ - /* Default 8bit word */ conf |=3D FIELD_PREP(SPICC_BITLENGTH_MASK, 8 - 1); =20 @@ -476,12 +477,16 @@ static int meson_spicc_prepare_message(s static int meson_spicc_unprepare_transfer(struct spi_master *master) { struct meson_spicc_device *spicc =3D spi_master_get_devdata(master); + u32 conf =3D readl_relaxed(spicc->base + SPICC_CONREG) & SPICC_DATARATE_M= ASK; =20 /* Disable all IRQs */ writel(0, spicc->base + SPICC_INTREG); =20 device_reset_optional(&spicc->pdev->dev); =20 + /* Set default configuration, keeping datarate field */ + writel_relaxed(conf, spicc->base + SPICC_CONREG); + return 0; } =20 @@ -518,14 +523,60 @@ static void meson_spicc_cleanup(struct s * Clk path for G12A series: * pclk -> pow2 fixed div -> pow2 div -> mux -> out * pclk -> enh fixed div -> enh div -> mux -> out + * + * The pow2 divider is tied to the controller HW state, and the + * divider is only valid when the controller is initialized. + * + * A set of clock ops is added to make sure we don't read/set this + * clock rate while the controller is in an unknown state. */ =20 -static int meson_spicc_clk_init(struct meson_spicc_device *spicc) +static unsigned long meson_spicc_pow2_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct clk_divider *divider =3D to_clk_divider(hw); + struct meson_spicc_device *spicc =3D pow2_clk_to_spicc(divider); + + if (!spicc->master->cur_msg || !spicc->master->busy) + return 0; + + return clk_divider_ops.recalc_rate(hw, parent_rate); +} + +static int meson_spicc_pow2_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) +{ + struct clk_divider *divider =3D to_clk_divider(hw); + struct meson_spicc_device *spicc =3D pow2_clk_to_spicc(divider); + + if (!spicc->master->cur_msg || !spicc->master->busy) + return -EINVAL; + + return clk_divider_ops.determine_rate(hw, req); +} + +static int meson_spicc_pow2_set_rate(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) +{ + struct clk_divider *divider =3D to_clk_divider(hw); + struct meson_spicc_device *spicc =3D pow2_clk_to_spicc(divider); + + if (!spicc->master->cur_msg || !spicc->master->busy) + return -EINVAL; + + return clk_divider_ops.set_rate(hw, rate, parent_rate); +} + +const struct clk_ops meson_spicc_pow2_clk_ops =3D { + .recalc_rate =3D meson_spicc_pow2_recalc_rate, + .determine_rate =3D meson_spicc_pow2_determine_rate, + .set_rate =3D meson_spicc_pow2_set_rate, +}; + +static int meson_spicc_pow2_clk_init(struct meson_spicc_device *spicc) { struct device *dev =3D &spicc->pdev->dev; - struct clk_fixed_factor *pow2_fixed_div, *enh_fixed_div; - struct clk_divider *pow2_div, *enh_div; - struct clk_mux *mux; + struct clk_fixed_factor *pow2_fixed_div; struct clk_init_data init; struct clk *clk; struct clk_parent_data parent_data[2]; @@ -560,31 +611,45 @@ static int meson_spicc_clk_init(struct m if (WARN_ON(IS_ERR(clk))) return PTR_ERR(clk); =20 - pow2_div =3D devm_kzalloc(dev, sizeof(*pow2_div), GFP_KERNEL); - if (!pow2_div) - return -ENOMEM; - snprintf(name, sizeof(name), "%s#pow2_div", dev_name(dev)); init.name =3D name; - init.ops =3D &clk_divider_ops; - init.flags =3D CLK_SET_RATE_PARENT; + init.ops =3D &meson_spicc_pow2_clk_ops; + /* + * Set NOCACHE here to make sure we read the actual HW value + * since we reset the HW after each transfer. + */ + init.flags =3D CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE; parent_data[0].hw =3D &pow2_fixed_div->hw; init.num_parents =3D 1; =20 - pow2_div->shift =3D 16, - pow2_div->width =3D 3, - pow2_div->flags =3D CLK_DIVIDER_POWER_OF_TWO, - pow2_div->reg =3D spicc->base + SPICC_CONREG; - pow2_div->hw.init =3D &init; + spicc->pow2_div.shift =3D 16, + spicc->pow2_div.width =3D 3, + spicc->pow2_div.flags =3D CLK_DIVIDER_POWER_OF_TWO, + spicc->pow2_div.reg =3D spicc->base + SPICC_CONREG; + spicc->pow2_div.hw.init =3D &init; =20 - clk =3D devm_clk_register(dev, &pow2_div->hw); - if (WARN_ON(IS_ERR(clk))) - return PTR_ERR(clk); + spicc->clk =3D devm_clk_register(dev, &spicc->pow2_div.hw); + if (WARN_ON(IS_ERR(spicc->clk))) + return PTR_ERR(spicc->clk); =20 - if (!spicc->data->has_enhance_clk_div) { - spicc->clk =3D clk; - return 0; - } + return 0; +} + +static int meson_spicc_enh_clk_init(struct meson_spicc_device *spicc) +{ + struct device *dev =3D &spicc->pdev->dev; + struct clk_fixed_factor *enh_fixed_div; + struct clk_divider *enh_div; + struct clk_mux *mux; + struct clk_init_data init; + struct clk *clk; + struct clk_parent_data parent_data[2]; + char name[64]; + + memset(&init, 0, sizeof(init)); + memset(&parent_data, 0, sizeof(parent_data)); + + init.parent_data =3D parent_data; =20 /* algorithm for enh div: rate =3D freq / 2 / (N + 1) */ =20 @@ -637,7 +702,7 @@ static int meson_spicc_clk_init(struct m snprintf(name, sizeof(name), "%s#sel", dev_name(dev)); init.name =3D name; init.ops =3D &clk_mux_ops; - parent_data[0].hw =3D &pow2_div->hw; + parent_data[0].hw =3D &spicc->pow2_div.hw; parent_data[1].hw =3D &enh_div->hw; init.num_parents =3D 2; init.flags =3D CLK_SET_RATE_PARENT; @@ -754,12 +819,20 @@ static int meson_spicc_probe(struct plat =20 meson_spicc_oen_enable(spicc); =20 - ret =3D meson_spicc_clk_init(spicc); + ret =3D meson_spicc_pow2_clk_init(spicc); if (ret) { - dev_err(&pdev->dev, "clock registration failed\n"); + dev_err(&pdev->dev, "pow2 clock registration failed\n"); goto out_clk; } =20 + if (spicc->data->has_enhance_clk_div) { + ret =3D meson_spicc_enh_clk_init(spicc); + if (ret) { + dev_err(&pdev->dev, "clock registration failed\n"); + goto out_clk; + } + } + ret =3D devm_spi_register_master(&pdev->dev, master); if (ret) { dev_err(&pdev->dev, "spi master registration failed\n"); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 965D9C32772 for ; Tue, 23 Aug 2022 09:06:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347929AbiHWJG5 (ORCPT ); Tue, 23 Aug 2022 05:06:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348118AbiHWJFs (ORCPT ); Tue, 23 Aug 2022 05:05:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD05E85F9E; Tue, 23 Aug 2022 01:29:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1932161257; Tue, 23 Aug 2022 08:28:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F624C433D7; Tue, 23 Aug 2022 08:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243307; bh=/0xUtoBD7lVWZLLkImr4H5x1++n8+L53UF+qUa8F/D0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OnipR9Gdr1LQKXmpZpu90OVVNu0W75NDjtCAw4pHyy1FDVRjaKKIJH5w9ZOB5F1l7 JIy4Gbx8R7DEQLda8pB4hF7gijDTKDn8TN8YSmgmfIrUGfG86AlFHXbxKpyWlo0DmF XByY9sUvBzVSR0CMBcOjJGRkzPw2LdQ14mVwZqr8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Xiong , Xin Tan , "David S. Miller" Subject: [PATCH 5.19 205/365] net/sunrpc: fix potential memory leaks in rpc_sysfs_xprt_state_change() Date: Tue, 23 Aug 2022 10:01:46 +0200 Message-Id: <20220823080126.779775500@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xin Xiong commit bfc48f1b0505ffcb03a6d749139b7577d6b81ae0 upstream. The issue happens on some error handling paths. When the function fails to grab the object `xprt`, it simply returns 0, forgetting to decrease the reference count of another object `xps`, which is increased by rpc_sysfs_xprt_kobj_get_xprt_switch(), causing refcount leaks. Also, the function forgets to check whether `xps` is valid before using it, which may result in NULL-dereferencing issues. Fix it by adding proper error handling code when either `xprt` or `xps` is NULL. Fixes: 5b7eb78486cd ("SUNRPC: take a xprt offline using sysfs") Signed-off-by: Xin Xiong Signed-off-by: Xin Tan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/sunrpc/sysfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/sunrpc/sysfs.c +++ b/net/sunrpc/sysfs.c @@ -291,8 +291,10 @@ static ssize_t rpc_sysfs_xprt_state_chan int offline =3D 0, online =3D 0, remove =3D 0; struct rpc_xprt_switch *xps =3D rpc_sysfs_xprt_kobj_get_xprt_switch(kobj); =20 - if (!xprt) - return 0; + if (!xprt || !xps) { + count =3D 0; + goto out_put; + } =20 if (!strncmp(buf, "offline", 7)) offline =3D 1; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6409C32772 for ; Tue, 23 Aug 2022 09:07:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242352AbiHWJHf (ORCPT ); Tue, 23 Aug 2022 05:07:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241613AbiHWJGa (ORCPT ); Tue, 23 Aug 2022 05:06:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BACED85FB8; Tue, 23 Aug 2022 01:29:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 088D161475; Tue, 23 Aug 2022 08:28:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1059FC433C1; Tue, 23 Aug 2022 08:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243310; bh=RVt6G3W9mdbfkIy7nW8MAcnxPBPOKSh1h3YBa/FUnjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TuSHLBBDoAxUXEUGETPMTwTCEJrE9bn6lZlkPHRkqSbdAecO3sgGg2TMgXQ9u5N/g RTOp50UXmeIMt2gCOD7pGdc2BeuOaoue6KqhzGNrvYYKGlY0+MFLc4peF7stMGn+Hw +SNP4im8UJt/X37wrSqEeEcTK5OoFn2IxACiPYBQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vivien Didelot , Florian Fainelli , Sergei Antonov , Vladimir Oltean , Jakub Kicinski Subject: [PATCH 5.19 206/365] net: dsa: mv88e6060: prevent crash on an unused port Date: Tue, 23 Aug 2022 10:01:47 +0200 Message-Id: <20220823080126.818158646@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergei Antonov commit 246bbf2f977ea36aaf41f5d24370fef433250728 upstream. If the port isn't a CPU port nor a user port, 'cpu_dp' is a null pointer and a crash happened on dereferencing it in mv88e6060_setup_port(): [ 9.575872] Unable to handle kernel NULL pointer dereference at virtual = address 00000014 ... [ 9.942216] mv88e6060_setup from dsa_register_switch+0x814/0xe84 [ 9.948616] dsa_register_switch from mdio_probe+0x2c/0x54 [ 9.954433] mdio_probe from really_probe.part.0+0x98/0x2a0 [ 9.960375] really_probe.part.0 from driver_probe_device+0x30/0x10c [ 9.967029] driver_probe_device from __device_attach_driver+0xb8/0x13c [ 9.973946] __device_attach_driver from bus_for_each_drv+0x90/0xe0 [ 9.980509] bus_for_each_drv from __device_attach+0x110/0x184 [ 9.986632] __device_attach from bus_probe_device+0x8c/0x94 [ 9.992577] bus_probe_device from deferred_probe_work_func+0x78/0xa8 [ 9.999311] deferred_probe_work_func from process_one_work+0x290/0x73c [ 10.006292] process_one_work from worker_thread+0x30/0x4b8 [ 10.012155] worker_thread from kthread+0xd4/0x10c [ 10.017238] kthread from ret_from_fork+0x14/0x3c Fixes: 0abfd494deef ("net: dsa: use dedicated CPU port") CC: Vivien Didelot CC: Florian Fainelli Signed-off-by: Sergei Antonov Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220811070939.1717146-1-saproj@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/dsa/mv88e6060.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/dsa/mv88e6060.c +++ b/drivers/net/dsa/mv88e6060.c @@ -118,6 +118,9 @@ static int mv88e6060_setup_port(struct m int addr =3D REG_PORT(p); int ret; =20 + if (dsa_is_unused_port(priv->ds, p)) + return 0; + /* Do not force flow control, disable Ingress and Egress * Header tagging, disable VLAN tunneling, and set the port * state to Forwarding. Additionally, if this is the CPU From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 248D4C32772 for ; Tue, 23 Aug 2022 09:08:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348058AbiHWJH7 (ORCPT ); Tue, 23 Aug 2022 05:07:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347750AbiHWJGo (ORCPT ); Tue, 23 Aug 2022 05:06:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C8C285FFE; Tue, 23 Aug 2022 01:29:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0AD7F61326; Tue, 23 Aug 2022 08:28:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03452C4314C; Tue, 23 Aug 2022 08:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243313; bh=9vjKezl3dOytaASgrXKh7da9oZaZWQxs9UU973wrK9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WjyeJAcc8zQA4for3QIc9Gwn6514e6AfrPM6yCe55DBpW5ntZO3bBqpHeTku+E0AQ sM7bIY+e4PcDvM/bSP4jQxmsJW3q7zjT8MAH0Et5R52lxf8kHjohb6384yf9/KV4xE nZ+aphSzNY/paoxzdiOY1nxr7VPFDlNSUt5EauDQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Kochetkov , Hemant Kumar , Manivannan Sadhasivam , Loic Poulain , "David S. Miller" Subject: [PATCH 5.19 207/365] net: qrtr: start MHI channel after endpoit creation Date: Tue, 23 Aug 2022 10:01:48 +0200 Message-Id: <20220823080126.857789357@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxim Kochetkov commit 68a838b84effb7b57ba7d50b1863fc6ae35a54ce upstream. MHI channel may generates event/interrupt right after enabling. It may leads to 2 race conditions issues. 1) Such event may be dropped by qcom_mhi_qrtr_dl_callback() at check: if (!qdev || mhi_res->transaction_status) return; Because dev_set_drvdata(&mhi_dev->dev, qdev) may be not performed at this moment. In this situation qrtr-ns will be unable to enumerate services in device. Reviewed-by: Hemant Kumar Reviewed-by: Loic Poulain Reviewed-by: Manivannan Sadhasivam Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --------------------------------------------------------------- 2) Such event may come at the moment after dev_set_drvdata() and before qrtr_endpoint_register(). In this case kernel will panic with accessing wrong pointer at qcom_mhi_qrtr_dl_callback(): rc =3D qrtr_endpoint_post(&qdev->ep, mhi_res->buf_addr, mhi_res->bytes_xferd); Because endpoint is not created yet. -------------------------------------------------------------- So move mhi_prepare_for_transfer_autoqueue after endpoint creation to fix it. Fixes: a2e2cc0dbb11 ("net: qrtr: Start MHI channels during init") Signed-off-by: Maxim Kochetkov Reviewed-by: Hemant Kumar Reviewed-by: Manivannan Sadhasivam Reviewed-by: Loic Poulain Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/qrtr/mhi.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/net/qrtr/mhi.c +++ b/net/qrtr/mhi.c @@ -78,11 +78,6 @@ static int qcom_mhi_qrtr_probe(struct mh struct qrtr_mhi_dev *qdev; int rc; =20 - /* start channels */ - rc =3D mhi_prepare_for_transfer_autoqueue(mhi_dev); - if (rc) - return rc; - qdev =3D devm_kzalloc(&mhi_dev->dev, sizeof(*qdev), GFP_KERNEL); if (!qdev) return -ENOMEM; @@ -96,6 +91,13 @@ static int qcom_mhi_qrtr_probe(struct mh if (rc) return rc; =20 + /* start channels */ + rc =3D mhi_prepare_for_transfer_autoqueue(mhi_dev); + if (rc) { + qrtr_endpoint_unregister(&qdev->ep); + return rc; + } + dev_dbg(qdev->dev, "Qualcomm MHI QRTR driver probed\n"); =20 return 0; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F9C2C32772 for ; Tue, 23 Aug 2022 09:01:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240937AbiHWJBn (ORCPT ); Tue, 23 Aug 2022 05:01:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346279AbiHWJBE (ORCPT ); Tue, 23 Aug 2022 05:01:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0F6882D39; Tue, 23 Aug 2022 01:27:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F1AC6B81C4C; Tue, 23 Aug 2022 08:27:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48251C433C1; Tue, 23 Aug 2022 08:27:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243220; bh=EmE0b3BipqP22CZ2IeSNrPTaSB0nxrFpOHiVxEnYbMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ehLQZlrHLbd37bFeD7Rncd0IrGN4/WkLNBOkGbHdMRN3hTwTVDlAUr4UV9vZqG0B/ uzpJqK4zqBBUtcSr50SEcHIhKYHG232vDL+ow42f3gaEjCtTLQp7zUlCW4YqviiNJj FOoFX+q+RdPDF6Hyitqc/nuHomnZD25F+sxEgT+I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Andrew Melnychenko" , "Michael S. Tsirkin" , "David S. Miller" Subject: [PATCH 5.19 208/365] virtio_net: fix endian-ness for RSS Date: Tue, 23 Aug 2022 10:01:49 +0200 Message-Id: <20220823080126.892343887@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael S. Tsirkin commit 95bb633048fab742230eb2cdf20b8e2676240a54 upstream. Using native endian-ness for device supplied fields is wrong on BE platforms. Sparse warns about this. Fixes: 91f41f01d219 ("drivers/net/virtio_net: Added RSS hash report.") Cc: "Andrew Melnychenko" Signed-off-by: Michael S. Tsirkin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/virtio_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 3b3eebad3977..d4e0a775b1ba 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -1199,7 +1199,7 @@ static void virtio_skb_set_hash(const struct virtio_n= et_hdr_v1_hash *hdr_hash, if (!hdr_hash || !skb) return; =20 - switch ((int)hdr_hash->hash_report) { + switch (__le16_to_cpu(hdr_hash->hash_report)) { case VIRTIO_NET_HASH_REPORT_TCPv4: case VIRTIO_NET_HASH_REPORT_UDPv4: case VIRTIO_NET_HASH_REPORT_TCPv6: @@ -1217,7 +1217,7 @@ static void virtio_skb_set_hash(const struct virtio_n= et_hdr_v1_hash *hdr_hash, default: rss_hash_type =3D PKT_HASH_TYPE_NONE; } - skb_set_hash(skb, (unsigned int)hdr_hash->hash_value, rss_hash_type); + skb_set_hash(skb, __le32_to_cpu(hdr_hash->hash_value), rss_hash_type); } =20 static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq, --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B0BFC32772 for ; Tue, 23 Aug 2022 09:01:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241537AbiHWJBs (ORCPT ); Tue, 23 Aug 2022 05:01:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241104AbiHWJBH (ORCPT ); Tue, 23 Aug 2022 05:01:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4F3E82876; Tue, 23 Aug 2022 01:27:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0A5CBB81C48; Tue, 23 Aug 2022 08:27:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 422EFC433D6; Tue, 23 Aug 2022 08:27:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243223; bh=XqrLsuMQD7WWEuspC3uWOb0vRFo3OKEJ+OYxw17qHtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oEwUN44leMxMTSHFRzJSeWYjtTyG3798at4nFKsKFszNZxsKgyl5Fg0+KLwVAqUy0 vgk0GHr/BIDGj+WgJbNzYPVs1tpK+5NCniOmVotYrMcm4CcIfqMv+fsckrW4SbiGBd GPPFZ+N51RHE0SiTaoC9jHntF954tfK0RxybIgfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amit Cohen , Ido Schimmel , Petr Machata , "David S. Miller" Subject: [PATCH 5.19 209/365] mlxsw: spectrum: Clear PTP configuration after unregistering the netdevice Date: Tue, 23 Aug 2022 10:01:50 +0200 Message-Id: <20220823080126.937910740@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Amit Cohen commit a159e986ad26d3f35c0157ac92760ba5e44e6785 upstream. Currently as part of removing port, PTP API is called to clear the existing configuration and set the 'rx_filter' and 'tx_type' to zero. The clearing is done before unregistering the netdevice, which means that there is a window of time in which the user can reconfigure PTP in the port, and this configuration will not be cleared. Reorder the operations, clear PTP configuration after unregistering the netdevice. Fixes: 8748642751ede ("mlxsw: spectrum: PTP: Support SIOCGHWTSTAMP, SIOCSHW= TSTAMP ioctls") Signed-off-by: Amit Cohen Signed-off-by: Ido Schimmel Signed-off-by: Petr Machata Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -1822,9 +1822,9 @@ static void mlxsw_sp_port_remove(struct =20 cancel_delayed_work_sync(&mlxsw_sp_port->periodic_hw_stats.update_dw); cancel_delayed_work_sync(&mlxsw_sp_port->ptp.shaper_dw); - mlxsw_sp_port_ptp_clear(mlxsw_sp_port); mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp); unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */ + mlxsw_sp_port_ptp_clear(mlxsw_sp_port); mlxsw_sp_port_vlan_classification_set(mlxsw_sp_port, true, true); mlxsw_sp->ports[local_port] =3D NULL; mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C56AC32772 for ; Tue, 23 Aug 2022 09:01:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242382AbiHWJBO (ORCPT ); Tue, 23 Aug 2022 05:01:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347528AbiHWJAh (ORCPT ); Tue, 23 Aug 2022 05:00:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8854281B00; Tue, 23 Aug 2022 01:27:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3B35AB81C51; Tue, 23 Aug 2022 08:27:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96D07C4314F; Tue, 23 Aug 2022 08:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243227; bh=ADkFv/zaUyh6dKNv1NNmSV5iAz1hx6hB7vMUJariuSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UpmffvTXtS/yA9EsnmD+ZVcO9jUMf52l/Aca2M6BViqrHhACijI+INYkxL6DctVPp Al89UyZeWoIr3rud30hYGdA/wHJdSI6hlR16qAGIK3hJpcqBAAGwCSbMzSGaCtgFLv atUHDQ20E/rOIIgj/nzQJTjh2j3lESF88vy7BhN4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergei Antonov , Andrew Lunn , Jakub Kicinski Subject: [PATCH 5.19 210/365] net: moxa: pass pdev instead of ndev to DMA functions Date: Tue, 23 Aug 2022 10:01:51 +0200 Message-Id: <20220823080126.981301498@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergei Antonov commit 3a12df22a8f68954a4ba48435c06b3d1791c87c4 upstream. dma_map_single() calls fail in moxart_mac_setup_desc_ring() and moxart_mac_start_xmit() which leads to an incessant output of this: [ 16.043925] moxart-ethernet 92000000.mac eth0: DMA mapping error [ 16.050957] moxart-ethernet 92000000.mac eth0: DMA mapping error [ 16.058229] moxart-ethernet 92000000.mac eth0: DMA mapping error Passing pdev to DMA is a common approach among net drivers. Fixes: 6c821bd9edc9 ("net: Add MOXA ART SoCs ethernet driver") Signed-off-by: Sergei Antonov Suggested-by: Andrew Lunn Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220812171339.2271788-1-saproj@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/moxa/moxart_ether.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c @@ -77,7 +77,7 @@ static void moxart_mac_free_memory(struc int i; =20 for (i =3D 0; i < RX_DESC_NUM; i++) - dma_unmap_single(&ndev->dev, priv->rx_mapping[i], + dma_unmap_single(&priv->pdev->dev, priv->rx_mapping[i], priv->rx_buf_size, DMA_FROM_DEVICE); =20 if (priv->tx_desc_base) @@ -147,11 +147,11 @@ static void moxart_mac_setup_desc_ring(s desc + RX_REG_OFFSET_DESC1); =20 priv->rx_buf[i] =3D priv->rx_buf_base + priv->rx_buf_size * i; - priv->rx_mapping[i] =3D dma_map_single(&ndev->dev, + priv->rx_mapping[i] =3D dma_map_single(&priv->pdev->dev, priv->rx_buf[i], priv->rx_buf_size, DMA_FROM_DEVICE); - if (dma_mapping_error(&ndev->dev, priv->rx_mapping[i])) + if (dma_mapping_error(&priv->pdev->dev, priv->rx_mapping[i])) netdev_err(ndev, "DMA mapping error\n"); =20 moxart_desc_write(priv->rx_mapping[i], @@ -240,7 +240,7 @@ static int moxart_rx_poll(struct napi_st if (len > RX_BUF_SIZE) len =3D RX_BUF_SIZE; =20 - dma_sync_single_for_cpu(&ndev->dev, + dma_sync_single_for_cpu(&priv->pdev->dev, priv->rx_mapping[rx_head], priv->rx_buf_size, DMA_FROM_DEVICE); skb =3D netdev_alloc_skb_ip_align(ndev, len); @@ -294,7 +294,7 @@ static void moxart_tx_finished(struct ne unsigned int tx_tail =3D priv->tx_tail; =20 while (tx_tail !=3D tx_head) { - dma_unmap_single(&ndev->dev, priv->tx_mapping[tx_tail], + dma_unmap_single(&priv->pdev->dev, priv->tx_mapping[tx_tail], priv->tx_len[tx_tail], DMA_TO_DEVICE); =20 ndev->stats.tx_packets++; @@ -358,9 +358,9 @@ static netdev_tx_t moxart_mac_start_xmit =20 len =3D skb->len > TX_BUF_SIZE ? TX_BUF_SIZE : skb->len; =20 - priv->tx_mapping[tx_head] =3D dma_map_single(&ndev->dev, skb->data, + priv->tx_mapping[tx_head] =3D dma_map_single(&priv->pdev->dev, skb->data, len, DMA_TO_DEVICE); - if (dma_mapping_error(&ndev->dev, priv->tx_mapping[tx_head])) { + if (dma_mapping_error(&priv->pdev->dev, priv->tx_mapping[tx_head])) { netdev_err(ndev, "DMA mapping error\n"); goto out_unlock; } @@ -379,7 +379,7 @@ static netdev_tx_t moxart_mac_start_xmit len =3D ETH_ZLEN; } =20 - dma_sync_single_for_device(&ndev->dev, priv->tx_mapping[tx_head], + dma_sync_single_for_device(&priv->pdev->dev, priv->tx_mapping[tx_head], priv->tx_buf_size, DMA_TO_DEVICE); =20 txdes1 =3D TX_DESC1_LTS | TX_DESC1_FTS | (len & TX_DESC1_BUF_SIZE_MASK); @@ -493,7 +493,7 @@ static int moxart_mac_probe(struct platf priv->tx_buf_size =3D TX_BUF_SIZE; priv->rx_buf_size =3D RX_BUF_SIZE; =20 - priv->tx_desc_base =3D dma_alloc_coherent(&pdev->dev, TX_REG_DESC_SIZE * + priv->tx_desc_base =3D dma_alloc_coherent(p_dev, TX_REG_DESC_SIZE * TX_DESC_NUM, &priv->tx_base, GFP_DMA | GFP_KERNEL); if (!priv->tx_desc_base) { @@ -501,7 +501,7 @@ static int moxart_mac_probe(struct platf goto init_fail; } =20 - priv->rx_desc_base =3D dma_alloc_coherent(&pdev->dev, RX_REG_DESC_SIZE * + priv->rx_desc_base =3D dma_alloc_coherent(p_dev, RX_REG_DESC_SIZE * RX_DESC_NUM, &priv->rx_base, GFP_DMA | GFP_KERNEL); if (!priv->rx_desc_base) { From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D009DC32772 for ; Tue, 23 Aug 2022 09:00:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235570AbiHWJAz (ORCPT ); Tue, 23 Aug 2022 05:00:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346082AbiHWJAS (ORCPT ); Tue, 23 Aug 2022 05:00:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 887E081B07; Tue, 23 Aug 2022 01:27:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C4BB96148B; Tue, 23 Aug 2022 08:27:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4C65C433D6; Tue, 23 Aug 2022 08:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243230; bh=Fc/ptDfLjFPxNpv7wJK9pnk9GeqBK66W9EGqSZq/lbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x8iHAHYMRx4okq1GrzA/hO3IvWyj+JH2I+mp6eyfzjc0AB0tiVO5d8od0VEcoD23x IPh8QgElPX6tBAv+WnnUz8CSuCSrWn3kFZ8dA4/zr/NLbHel0LjaLhW+YQfpdUeHc8 5cPmLZGiE9vawbeuxpShIMXJJ0qOLq8NhjDr/2dQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Xiong , Xin Tan , "David S. Miller" Subject: [PATCH 5.19 211/365] net: fix potential refcount leak in ndisc_router_discovery() Date: Tue, 23 Aug 2022 10:01:52 +0200 Message-Id: <20220823080127.025493750@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xin Xiong commit 7396ba87f1edf549284869451665c7c4e74ecd4f upstream. The issue happens on specific paths in the function. After both the object `rt` and `neigh` are grabbed successfully, when `lifetime` is nonzero but the metric needs change, the function just deletes the route and set `rt` to NULL. Then, it may try grabbing `rt` and `neigh` again if above conditions hold. The function simply overwrite `neigh` if succeeds or returns if fails, without decreasing the reference count of previous `neigh`. This may result in memory leaks. Fix it by decrementing the reference count of `neigh` in place. Fixes: 6b2e04bc240f ("net: allow user to set metric on default route learne= d via Router Advertisement") Signed-off-by: Xin Xiong Signed-off-by: Xin Tan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/ipv6/ndisc.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1358,6 +1358,9 @@ static void ndisc_router_discovery(struc if (!rt && lifetime) { ND_PRINTK(3, info, "RA: adding default router\n"); =20 + if (neigh) + neigh_release(neigh); + rt =3D rt6_add_dflt_router(net, &ipv6_hdr(skb)->saddr, skb->dev, pref, defrtr_usr_metric); if (!rt) { From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9702EC32772 for ; Tue, 23 Aug 2022 09:02:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347334AbiHWJCR (ORCPT ); Tue, 23 Aug 2022 05:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240444AbiHWJBn (ORCPT ); Tue, 23 Aug 2022 05:01:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA8D383054; Tue, 23 Aug 2022 01:28:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2C2F361494; Tue, 23 Aug 2022 08:27:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF6D1C433C1; Tue, 23 Aug 2022 08:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243233; bh=PTSYZ9FApOOBJKtWbi9ijKt7DTtB+H8+ux8d997unJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LMVgb3pmmyU449SVqw4vMLqnBwy4N8fzyfacpxoJPVkPKUpcnT9Cyu2m14SIDFWz4 m5l99GuDD9guNRVUDXaY8wIJaDQgDUBPF5HmELwyHfW8LxPmzvV9bqGjNGhdPtmMaM KWEqewzTNkVClF4vAywVomBdDS2fAf8n84F7JfpE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengchao Shao , Nikolay Aleksandrov , Jakub Kicinski Subject: [PATCH 5.19 212/365] net: rtnetlink: fix module reference count leak issue in rtnetlink_rcv_msg Date: Tue, 23 Aug 2022 10:01:53 +0200 Message-Id: <20220823080127.075499596@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhengchao Shao commit 5b22f62724a0a09e00d301abf5b57b0c12be8a16 upstream. When bulk delete command is received in the rtnetlink_rcv_msg function, if bulk delete is not supported, module_put is not called to release the reference counting. As a result, module reference count is leaked. Fixes: a6cec0bcd342 ("net: rtnetlink: add bulk delete support flag") Signed-off-by: Zhengchao Shao Acked-by: Nikolay Aleksandrov Link: https://lore.kernel.org/r/20220815024629.240367-1-shaozhengchao@huawe= i.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/core/rtnetlink.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index ac45328607f7..4b5b15c684ed 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -6070,6 +6070,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, str= uct nlmsghdr *nlh, if (kind =3D=3D RTNL_KIND_DEL && (nlh->nlmsg_flags & NLM_F_BULK) && !(flags & RTNL_FLAG_BULK_DEL_SUPPORTED)) { NL_SET_ERR_MSG(extack, "Bulk delete is not supported"); + module_put(owner); goto err_unlock; } =20 --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 416A7C32772 for ; Tue, 23 Aug 2022 09:02:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240812AbiHWJCZ (ORCPT ); Tue, 23 Aug 2022 05:02:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241632AbiHWJBv (ORCPT ); Tue, 23 Aug 2022 05:01:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6077E233; Tue, 23 Aug 2022 01:28:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3C29D61326; Tue, 23 Aug 2022 08:27:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 305CAC433D7; Tue, 23 Aug 2022 08:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243236; bh=gFrB6xe1KXgTAI+7ObVJ1Fp1IKo64uT9FKvA9uEdWR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=obk91VtWGTwE/3sfnlOD/ZS+mtx4agY5M2nX/ptsDJcWUKyb/1Z9L3hfiJA2A316t 7eEICRcmDnAYFTSVg/yjwUemY04ur/hfSztWknw3E/b0mtYdGavTE389o9kBiovxWs 8g8eGeQ+kF2jJefPrKObzRbw9ZalzwLI2UL1p0xk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengchao Shao , Jakub Kicinski Subject: [PATCH 5.19 213/365] net: sched: fix misuse of qcpu->backlog in gnet_stats_add_queue_cpu Date: Tue, 23 Aug 2022 10:01:54 +0200 Message-Id: <20220823080127.120619852@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhengchao Shao commit de64b6b6fb6f369840d171b7c5a9baf31b8b2630 upstream. In the gnet_stats_add_queue_cpu function, the qstats->qlen statistics are incorrectly set to qcpu->backlog. Fixes: 448e163f8b9b ("gen_stats: Add gnet_stats_add_queue()") Signed-off-by: Zhengchao Shao Link: https://lore.kernel.org/r/20220815030848.276746-1-shaozhengchao@huawe= i.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/core/gen_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/gen_stats.c +++ b/net/core/gen_stats.c @@ -345,7 +345,7 @@ static void gnet_stats_add_queue_cpu(str for_each_possible_cpu(i) { const struct gnet_stats_queue *qcpu =3D per_cpu_ptr(q, i); =20 - qstats->qlen +=3D qcpu->backlog; + qstats->qlen +=3D qcpu->qlen; qstats->backlog +=3D qcpu->backlog; qstats->drops +=3D qcpu->drops; qstats->requeues +=3D qcpu->requeues; From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC53FC32772 for ; Tue, 23 Aug 2022 09:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242299AbiHWJDh (ORCPT ); Tue, 23 Aug 2022 05:03:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240826AbiHWJCZ (ORCPT ); Tue, 23 Aug 2022 05:02:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F26E228E2A; Tue, 23 Aug 2022 01:28:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CDE576148F; Tue, 23 Aug 2022 08:27:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F770C433C1; Tue, 23 Aug 2022 08:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243240; bh=IFaID+CQU1LWumGJBq/pb2DyzIiBuMz6+s+qtnvsl/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DnghjkmoT99KFqdTC/EhdaZhbh9AxGYytKMghKSS+MG3x8k/dK2G5/G6SxT+cXOKs 9JksQxdGDdKd2Bp9iW8FdoBGBa5EFnnL2k42Pv0klxOKAT68qI4udWWzj64bXs0dW4 bHsB0MUF7s4PhairOfmUY0B5FKtzossDhAeYGrt0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Ramadoss , Vladimir Oltean , Jakub Kicinski Subject: [PATCH 5.19 214/365] net: dsa: microchip: ksz9477: fix fdb_dump last invalid entry Date: Tue, 23 Aug 2022 10:01:55 +0200 Message-Id: <20220823080127.159146679@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Ramadoss commit 36c0d935015766bf20d621c18313f17691bda5e3 upstream. In the ksz9477_fdb_dump function it reads the ALU control register and exit from the timeout loop if there is valid entry or search is complete. After exiting the loop, it reads the alu entry and report to the user space irrespective of entry is valid. It works till the valid entry. If the loop exited when search is complete, it reads the alu table. The table returns all ones and it is reported to user space. So bridge fdb show gives ff:ff:ff:ff:ff:ff as last entry for every port. To fix it, after exiting the loop the entry is reported only if it is valid one. Fixes: b987e98e50ab ("dsa: add DSA switch driver for Microchip KSZ9477") Signed-off-by: Arun Ramadoss Reviewed-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220816105516.18350-1-arun.ramadoss@microc= hip.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/dsa/microchip/ksz9477.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -658,6 +658,9 @@ static int ksz9477_port_fdb_dump(struct goto exit; } =20 + if (!(ksz_data & ALU_VALID)) + continue; + /* read ALU table */ ksz9477_read_table(dev, alu_table); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6FC6C32772 for ; Tue, 23 Aug 2022 09:01:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240949AbiHWJBK (ORCPT ); Tue, 23 Aug 2022 05:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347510AbiHWJAe (ORCPT ); Tue, 23 Aug 2022 05:00:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1B418276C; Tue, 23 Aug 2022 01:27:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1D1486132D; Tue, 23 Aug 2022 08:27:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CB86C433C1; Tue, 23 Aug 2022 08:27:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243243; bh=I7mToTYrlG00p7FiW4DaYlyEvxUMSTtAGzBRGbiFV+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cbz3CEqxWzH5bD0e5pOMCcm84LpTjBtjPuJfO3cTZqre7lEOg2fbA/C130ErRhCne STZJ3bitoWfoNglrg1tG4vv+ksTeNaPB5mOnS+7sIPl7F95rHRtK83dRoOZNxirv3c b2fY0Z2NY/9em5cqpBC/ndGBSoeliN/pCoFoJVVs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski Subject: [PATCH 5.19 215/365] net: dsa: felix: fix ethtool 256-511 and 512-1023 TX packet counters Date: Tue, 23 Aug 2022 10:01:56 +0200 Message-Id: <20220823080127.190879077@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean commit 40d21c4565bce064c73a03b79a157a3493c518b9 upstream. What the driver actually reports as 256-511 is in fact 512-1023, and the TX packets in the 256-511 bucket are not reported. Fix that. Fixes: 56051948773e ("net: dsa: ocelot: add driver for Felix switch family") Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/dsa/ocelot/felix_vsc9959.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -601,7 +601,8 @@ static const struct ocelot_stat_layout v { .offset =3D 0x87, .name =3D "tx_frames_below_65_octets", }, { .offset =3D 0x88, .name =3D "tx_frames_65_to_127_octets", }, { .offset =3D 0x89, .name =3D "tx_frames_128_255_octets", }, - { .offset =3D 0x8B, .name =3D "tx_frames_256_511_octets", }, + { .offset =3D 0x8A, .name =3D "tx_frames_256_511_octets", }, + { .offset =3D 0x8B, .name =3D "tx_frames_512_1023_octets", }, { .offset =3D 0x8C, .name =3D "tx_frames_1024_1526_octets", }, { .offset =3D 0x8D, .name =3D "tx_frames_over_1526_octets", }, { .offset =3D 0x8E, .name =3D "tx_yellow_prio_0", }, From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBBFCC32772 for ; Tue, 23 Aug 2022 09:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242427AbiHWJFR (ORCPT ); Tue, 23 Aug 2022 05:05:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347708AbiHWJEE (ORCPT ); Tue, 23 Aug 2022 05:04:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B766C832DB; Tue, 23 Aug 2022 01:28:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F2CE7B81C4B; Tue, 23 Aug 2022 08:27:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25914C433C1; Tue, 23 Aug 2022 08:27:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243246; bh=VxIzgje0bAkA5nU6x14VUAf4lFgpCDT5esVGWY5nUig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LHeqy3MwGbcAkSXnFbie1A82BTAIKYeIOOZ7bylkYRYGg5asoHxVg28hLJ7+V/EG/ eZtXsjxSXe23T/1BVbcCsNpwTEexn/QjQexSf63/pVnEgraBYBF7lPsCyxEMumCZD6 r7Y8Ov7eicMd4RMMHcXqPY6cBHfKFUZcdc6pNU70= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski Subject: [PATCH 5.19 216/365] net: mscc: ocelot: fix incorrect ndo_get_stats64 packet counters Date: Tue, 23 Aug 2022 10:01:57 +0200 Message-Id: <20220823080127.233437508@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean commit 5152de7b79ab0be150f5966481b0c8f996192531 upstream. Reading stats using the SYS_COUNT_* register definitions is only used by ocelot_get_stats64() from the ocelot switchdev driver, however, currently the bucket definitions are incorrect. Separately, on both RX and TX, we have the following problems: - a 256-1023 bucket which actually tracks the 256-511 packets - the 1024-1526 bucket actually tracks the 512-1023 packets - the 1527-max bucket actually tracks the 1024-1526 packets =3D> nobody tracks the packets from the real 1527-max bucket Additionally, the RX_PAUSE, RX_CONTROL, RX_LONGS and RX_CLASSIFIED_DROPS all track the wrong thing. However this doesn't seem to have any consequence, since ocelot_get_stats64() doesn't use these. Even though this problem only manifests itself for the switchdev driver, we cannot split the fix for ocelot and for DSA, since it requires fixing the bucket definitions from enum ocelot_reg, which makes us necessarily adapt the structures from felix and seville as well. Fixes: 84705fc16552 ("net: dsa: felix: introduce support for Seville VSC995= 3 switch") Fixes: 56051948773e ("net: dsa: ocelot: add driver for Felix switch family") Fixes: a556c76adc05 ("net: mscc: Add initial Ocelot switch support") Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/dsa/ocelot/felix_vsc9959.c | 20 ++++++++++++-------- drivers/net/dsa/ocelot/seville_vsc9953.c | 16 +++++++++------- drivers/net/ethernet/mscc/ocelot_net.c | 6 ++++-- drivers/net/ethernet/mscc/vsc7514_regs.c | 24 +++++++++++++----------- include/soc/mscc/ocelot.h | 6 ++++-- 5 files changed, 42 insertions(+), 30 deletions(-) --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -280,19 +280,23 @@ static const u32 vsc9959_sys_regmap[] =3D REG(SYS_COUNT_RX_64, 0x000024), REG(SYS_COUNT_RX_65_127, 0x000028), REG(SYS_COUNT_RX_128_255, 0x00002c), - REG(SYS_COUNT_RX_256_1023, 0x000030), - REG(SYS_COUNT_RX_1024_1526, 0x000034), - REG(SYS_COUNT_RX_1527_MAX, 0x000038), - REG(SYS_COUNT_RX_LONGS, 0x000044), + REG(SYS_COUNT_RX_256_511, 0x000030), + REG(SYS_COUNT_RX_512_1023, 0x000034), + REG(SYS_COUNT_RX_1024_1526, 0x000038), + REG(SYS_COUNT_RX_1527_MAX, 0x00003c), + REG(SYS_COUNT_RX_PAUSE, 0x000040), + REG(SYS_COUNT_RX_CONTROL, 0x000044), + REG(SYS_COUNT_RX_LONGS, 0x000048), REG(SYS_COUNT_TX_OCTETS, 0x000200), REG(SYS_COUNT_TX_COLLISION, 0x000210), REG(SYS_COUNT_TX_DROPS, 0x000214), REG(SYS_COUNT_TX_64, 0x00021c), REG(SYS_COUNT_TX_65_127, 0x000220), - REG(SYS_COUNT_TX_128_511, 0x000224), - REG(SYS_COUNT_TX_512_1023, 0x000228), - REG(SYS_COUNT_TX_1024_1526, 0x00022c), - REG(SYS_COUNT_TX_1527_MAX, 0x000230), + REG(SYS_COUNT_TX_128_255, 0x000224), + REG(SYS_COUNT_TX_256_511, 0x000228), + REG(SYS_COUNT_TX_512_1023, 0x00022c), + REG(SYS_COUNT_TX_1024_1526, 0x000230), + REG(SYS_COUNT_TX_1527_MAX, 0x000234), REG(SYS_COUNT_TX_AGING, 0x000278), REG(SYS_RESET_CFG, 0x000e00), REG(SYS_SR_ETYPE_CFG, 0x000e04), --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -277,19 +277,21 @@ static const u32 vsc9953_sys_regmap[] =3D REG(SYS_COUNT_RX_64, 0x000024), REG(SYS_COUNT_RX_65_127, 0x000028), REG(SYS_COUNT_RX_128_255, 0x00002c), - REG(SYS_COUNT_RX_256_1023, 0x000030), - REG(SYS_COUNT_RX_1024_1526, 0x000034), - REG(SYS_COUNT_RX_1527_MAX, 0x000038), + REG(SYS_COUNT_RX_256_511, 0x000030), + REG(SYS_COUNT_RX_512_1023, 0x000034), + REG(SYS_COUNT_RX_1024_1526, 0x000038), + REG(SYS_COUNT_RX_1527_MAX, 0x00003c), REG(SYS_COUNT_RX_LONGS, 0x000048), REG(SYS_COUNT_TX_OCTETS, 0x000100), REG(SYS_COUNT_TX_COLLISION, 0x000110), REG(SYS_COUNT_TX_DROPS, 0x000114), REG(SYS_COUNT_TX_64, 0x00011c), REG(SYS_COUNT_TX_65_127, 0x000120), - REG(SYS_COUNT_TX_128_511, 0x000124), - REG(SYS_COUNT_TX_512_1023, 0x000128), - REG(SYS_COUNT_TX_1024_1526, 0x00012c), - REG(SYS_COUNT_TX_1527_MAX, 0x000130), + REG(SYS_COUNT_TX_128_255, 0x000124), + REG(SYS_COUNT_TX_256_511, 0x000128), + REG(SYS_COUNT_TX_512_1023, 0x00012c), + REG(SYS_COUNT_TX_1024_1526, 0x000130), + REG(SYS_COUNT_TX_1527_MAX, 0x000134), REG(SYS_COUNT_TX_AGING, 0x000178), REG(SYS_RESET_CFG, 0x000318), REG_RESERVED(SYS_SR_ETYPE_CFG), --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -739,7 +739,8 @@ static void ocelot_get_stats64(struct ne ocelot_read(ocelot, SYS_COUNT_RX_64) + ocelot_read(ocelot, SYS_COUNT_RX_65_127) + ocelot_read(ocelot, SYS_COUNT_RX_128_255) + - ocelot_read(ocelot, SYS_COUNT_RX_256_1023) + + ocelot_read(ocelot, SYS_COUNT_RX_256_511) + + ocelot_read(ocelot, SYS_COUNT_RX_512_1023) + ocelot_read(ocelot, SYS_COUNT_RX_1024_1526) + ocelot_read(ocelot, SYS_COUNT_RX_1527_MAX); stats->multicast =3D ocelot_read(ocelot, SYS_COUNT_RX_MULTICAST); @@ -749,7 +750,8 @@ static void ocelot_get_stats64(struct ne stats->tx_bytes =3D ocelot_read(ocelot, SYS_COUNT_TX_OCTETS); stats->tx_packets =3D ocelot_read(ocelot, SYS_COUNT_TX_64) + ocelot_read(ocelot, SYS_COUNT_TX_65_127) + - ocelot_read(ocelot, SYS_COUNT_TX_128_511) + + ocelot_read(ocelot, SYS_COUNT_TX_128_255) + + ocelot_read(ocelot, SYS_COUNT_TX_256_511) + ocelot_read(ocelot, SYS_COUNT_TX_512_1023) + ocelot_read(ocelot, SYS_COUNT_TX_1024_1526) + ocelot_read(ocelot, SYS_COUNT_TX_1527_MAX); --- a/drivers/net/ethernet/mscc/vsc7514_regs.c +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -180,13 +180,14 @@ const u32 vsc7514_sys_regmap[] =3D { REG(SYS_COUNT_RX_64, 0x000024), REG(SYS_COUNT_RX_65_127, 0x000028), REG(SYS_COUNT_RX_128_255, 0x00002c), - REG(SYS_COUNT_RX_256_1023, 0x000030), - REG(SYS_COUNT_RX_1024_1526, 0x000034), - REG(SYS_COUNT_RX_1527_MAX, 0x000038), - REG(SYS_COUNT_RX_PAUSE, 0x00003c), - REG(SYS_COUNT_RX_CONTROL, 0x000040), - REG(SYS_COUNT_RX_LONGS, 0x000044), - REG(SYS_COUNT_RX_CLASSIFIED_DROPS, 0x000048), + REG(SYS_COUNT_RX_256_511, 0x000030), + REG(SYS_COUNT_RX_512_1023, 0x000034), + REG(SYS_COUNT_RX_1024_1526, 0x000038), + REG(SYS_COUNT_RX_1527_MAX, 0x00003c), + REG(SYS_COUNT_RX_PAUSE, 0x000040), + REG(SYS_COUNT_RX_CONTROL, 0x000044), + REG(SYS_COUNT_RX_LONGS, 0x000048), + REG(SYS_COUNT_RX_CLASSIFIED_DROPS, 0x00004c), REG(SYS_COUNT_TX_OCTETS, 0x000100), REG(SYS_COUNT_TX_UNICAST, 0x000104), REG(SYS_COUNT_TX_MULTICAST, 0x000108), @@ -196,10 +197,11 @@ const u32 vsc7514_sys_regmap[] =3D { REG(SYS_COUNT_TX_PAUSE, 0x000118), REG(SYS_COUNT_TX_64, 0x00011c), REG(SYS_COUNT_TX_65_127, 0x000120), - REG(SYS_COUNT_TX_128_511, 0x000124), - REG(SYS_COUNT_TX_512_1023, 0x000128), - REG(SYS_COUNT_TX_1024_1526, 0x00012c), - REG(SYS_COUNT_TX_1527_MAX, 0x000130), + REG(SYS_COUNT_TX_128_255, 0x000124), + REG(SYS_COUNT_TX_256_511, 0x000128), + REG(SYS_COUNT_TX_512_1023, 0x00012c), + REG(SYS_COUNT_TX_1024_1526, 0x000130), + REG(SYS_COUNT_TX_1527_MAX, 0x000134), REG(SYS_COUNT_TX_AGING, 0x000170), REG(SYS_RESET_CFG, 0x000508), REG(SYS_CMID, 0x00050c), --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -335,7 +335,8 @@ enum ocelot_reg { SYS_COUNT_RX_64, SYS_COUNT_RX_65_127, SYS_COUNT_RX_128_255, - SYS_COUNT_RX_256_1023, + SYS_COUNT_RX_256_511, + SYS_COUNT_RX_512_1023, SYS_COUNT_RX_1024_1526, SYS_COUNT_RX_1527_MAX, SYS_COUNT_RX_PAUSE, @@ -351,7 +352,8 @@ enum ocelot_reg { SYS_COUNT_TX_PAUSE, SYS_COUNT_TX_64, SYS_COUNT_TX_65_127, - SYS_COUNT_TX_128_511, + SYS_COUNT_TX_128_255, + SYS_COUNT_TX_256_511, SYS_COUNT_TX_512_1023, SYS_COUNT_TX_1024_1526, SYS_COUNT_TX_1527_MAX, From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45EAAC32772 for ; Tue, 23 Aug 2022 09:01:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242361AbiHWJBd (ORCPT ); Tue, 23 Aug 2022 05:01:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242299AbiHWJAz (ORCPT ); Tue, 23 Aug 2022 05:00:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8816E82847; Tue, 23 Aug 2022 01:27:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 61FD46148B; Tue, 23 Aug 2022 08:27:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54FDEC433C1; Tue, 23 Aug 2022 08:27:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243249; bh=345bHoukE6/6gcTgtuzxsrdukBDfqb0aeEMIu5LhdZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SHCByOblcUEBxeX9f8eW569cL4C+4MYLJorvyv/xwQ1rHrd2R/gwiZddYXLDMUE+D 66GxSE40G5Sww0aBFTdUgSOWYTYBgLJXxE4uMOzZwJVbFHF01yOqFnJXNuHI24NJG5 LPvmKOqjbLyhvk/01A/kPoRQmrNwrxUWFCxY/i9o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski Subject: [PATCH 5.19 217/365] net: mscc: ocelot: fix address of SYS_COUNT_TX_AGING counter Date: Tue, 23 Aug 2022 10:01:58 +0200 Message-Id: <20220823080127.275379834@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean commit 173ca86618d751bd183456c9cdbb69952ba283c8 upstream. This register, used as part of stats->tx_dropped in ocelot_get_stats64(), has a wrong address. At the address currently given, there is actually the c_tx_green_prio_6 counter. Fixes: a556c76adc05 ("net: mscc: Add initial Ocelot switch support") Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/mscc/vsc7514_regs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/mscc/vsc7514_regs.c +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -202,7 +202,7 @@ const u32 vsc7514_sys_regmap[] =3D { REG(SYS_COUNT_TX_512_1023, 0x00012c), REG(SYS_COUNT_TX_1024_1526, 0x000130), REG(SYS_COUNT_TX_1527_MAX, 0x000134), - REG(SYS_COUNT_TX_AGING, 0x000170), + REG(SYS_COUNT_TX_AGING, 0x000178), REG(SYS_RESET_CFG, 0x000508), REG(SYS_CMID, 0x00050c), REG(SYS_VLAN_ETYPE_CFG, 0x000510), From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B74AC32792 for ; Tue, 23 Aug 2022 09:04:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242746AbiHWJEp (ORCPT ); Tue, 23 Aug 2022 05:04:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242765AbiHWJD5 (ORCPT ); Tue, 23 Aug 2022 05:03:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FF861C107; Tue, 23 Aug 2022 01:28:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6F5986132D; Tue, 23 Aug 2022 08:27:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80F8CC433D6; Tue, 23 Aug 2022 08:27:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243255; bh=f6OXRID0uCEqVUMBcp3Ki0tg3pVmjI2z9M8ylE8p0OY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EYfLJNgECBwzL955JzDH34ZdKWYXmFIjyycW7GXJcIw8vVXHr94dgwxa7zPuiny0F FABfIqga23h2HDr1ox1soHprfdpM6RH4Ety0iBA+N+oYtoD6gmaj5WEUlVIKAYUlcW pB5/bdRxETVDmfttMOzYslXU/81ezE7qdTBaii5w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+dc54d9ba8153b216cae0@syzkaller.appspotmail.com, Jakub Kicinski Subject: [PATCH 5.19 218/365] net: genl: fix error path memory leak in policy dumping Date: Tue, 23 Aug 2022 10:01:59 +0200 Message-Id: <20220823080127.307948327@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jakub Kicinski commit 249801360db3dec4f73768c502192020bfddeacc upstream. If construction of the array of policies fails when recording non-first policy we need to unwind. netlink_policy_dump_add_policy() itself also needs fixing as it currently gives up on error without recording the allocated pointer in the pstate pointer. Reported-by: syzbot+dc54d9ba8153b216cae0@syzkaller.appspotmail.com Fixes: 50a896cf2d6f ("genetlink: properly support per-op policy dumping") Link: https://lore.kernel.org/r/20220816161939.577583-1-kuba@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/netlink/genetlink.c | 6 +++++- net/netlink/policy.c | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -1174,13 +1174,17 @@ static int ctrl_dumppolicy_start(struct op.policy, op.maxattr); if (err) - return err; + goto err_free_state; } } =20 if (!ctx->state) return -ENODATA; return 0; + +err_free_state: + netlink_policy_dump_free(ctx->state); + return err; } =20 static void *ctrl_dumppolicy_prep(struct sk_buff *skb, --- a/net/netlink/policy.c +++ b/net/netlink/policy.c @@ -144,7 +144,7 @@ int netlink_policy_dump_add_policy(struc =20 err =3D add_policy(&state, policy, maxtype); if (err) - return err; + goto err_try_undo; =20 for (policy_idx =3D 0; policy_idx < state->n_alloc && state->policies[policy_idx].policy; @@ -164,7 +164,7 @@ int netlink_policy_dump_add_policy(struc policy[type].nested_policy, policy[type].len); if (err) - return err; + goto err_try_undo; break; default: break; @@ -174,6 +174,16 @@ int netlink_policy_dump_add_policy(struc =20 *pstate =3D state; return 0; + +err_try_undo: + /* Try to preserve reasonable unwind semantics - if we're starting from + * scratch clean up fully, otherwise record what we got and caller will. + */ + if (!*pstate) + netlink_policy_dump_free(state); + else + *pstate =3D state; + return err; } =20 static bool From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEF8BC32772 for ; Tue, 23 Aug 2022 09:04:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346959AbiHWJEP (ORCPT ); Tue, 23 Aug 2022 05:04:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242773AbiHWJCn (ORCPT ); Tue, 23 Aug 2022 05:02:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3013B2AC4A; Tue, 23 Aug 2022 01:28:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6146C6148C; Tue, 23 Aug 2022 08:27:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 689B2C433C1; Tue, 23 Aug 2022 08:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243258; bh=mvmEQi8G1j5geB8LqT0jAv7O9847yojaKS1VuX8fESg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cq+4eZHMFjAsPkTqv8U94rF1Or7GQLibZg76jrm1Y58refDIbs8D92d3lDaqDkRQv ziloQAbwf8J3Kd+m+hrHWpJbC9JM2nc+QIPTuracDi21JEuHw7NwksUy8/rPGWXqql Xiiq26g5CKKuJ9gx/2z6OC5//qYi/g/cqGJQgiO8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergei Antonov , Vladimir Oltean , Jakub Kicinski Subject: [PATCH 5.19 219/365] net: dsa: dont warn in dsa_port_set_state_now() when driver doesnt support it Date: Tue, 23 Aug 2022 10:02:00 +0200 Message-Id: <20220823080127.343140803@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean commit 211987f3ac734000ea1548784b2a4539a974fbc8 upstream. ds->ops->port_stp_state_set() is, like most DSA methods, optional, and if absent, the port is supposed to remain in the forwarding state (as standalone). Such is the case with the mv88e6060 driver, which does not offload the bridge layer. DSA warns that the STP state can't be changed to FORWARDING as part of dsa_port_enable_rt(), when in fact it should not. The error message is also not up to modern standards, so take the opportunity to make it more descriptive. Fixes: fd3645413197 ("net: dsa: change scope of STP state setter") Reported-by: Sergei Antonov Signed-off-by: Vladimir Oltean Reviewed-by: Sergei Antonov Link: https://lore.kernel.org/r/20220816201445.1809483-1-vladimir.oltean@nx= p.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/dsa/port.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -145,11 +145,14 @@ int dsa_port_set_state(struct dsa_port * static void dsa_port_set_state_now(struct dsa_port *dp, u8 state, bool do_fast_age) { + struct dsa_switch *ds =3D dp->ds; int err; =20 err =3D dsa_port_set_state(dp, state, do_fast_age); - if (err) - pr_err("DSA: failed to set STP state %u (%d)\n", state, err); + if (err && err !=3D -EOPNOTSUPP) { + dev_err(ds->dev, "port %d failed to set STP state %u: %pe\n", + dp->index, state, ERR_PTR(err)); + } } =20 int dsa_port_set_mst_state(struct dsa_port *dp, From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F132EC32792 for ; Tue, 23 Aug 2022 09:04:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241093AbiHWJEH (ORCPT ); Tue, 23 Aug 2022 05:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240492AbiHWJCw (ORCPT ); Tue, 23 Aug 2022 05:02:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4A796CF49; Tue, 23 Aug 2022 01:28:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1359B81C35; Tue, 23 Aug 2022 08:27:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 368B3C433D6; Tue, 23 Aug 2022 08:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243261; bh=3agTiGGPSeveg7MES/sVEGH2c78Dw29TGthGj9XVZyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d1I/IlwyiWsNRT69Lz+GcnSoR4ewM2DulbNkmv8PlPB1Kjk9Jq2gJFn/xvsk4Nj4t hjyTDWNVi8+ZUPjHLipjH+wyrV3OW0mW/uqIpt3NqrFQIIOD1diy/KctnQ9H/hEA/G rr5Q1NSSbv8Kwa4S0783itwE2737UOJB4g57k34Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rustam Subkhankulov , Jakub Kicinski Subject: [PATCH 5.19 220/365] net: dsa: sja1105: fix buffer overflow in sja1105_setup_devlink_regions() Date: Tue, 23 Aug 2022 10:02:01 +0200 Message-Id: <20220823080127.381447830@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rustam Subkhankulov commit fd8e899cdb5ecaf8e8ee73854a99e10807eef1de upstream. If an error occurs in dsa_devlink_region_create(), then 'priv->regions' array will be accessed by negative index '-1'. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Rustam Subkhankulov Fixes: bf425b82059e ("net: dsa: sja1105: expose static config as devlink re= gion") Link: https://lore.kernel.org/r/20220817003845.389644-1-subkhankulov@ispras= .ru Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/dsa/sja1105/sja1105_devlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/dsa/sja1105/sja1105_devlink.c +++ b/drivers/net/dsa/sja1105/sja1105_devlink.c @@ -93,7 +93,7 @@ static int sja1105_setup_devlink_regions =20 region =3D dsa_devlink_region_create(ds, ops, 1, size); if (IS_ERR(region)) { - while (i-- >=3D 0) + while (--i >=3D 0) dsa_devlink_region_destroy(priv->regions[i]); return PTR_ERR(region); } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77CD2C32774 for ; Tue, 23 Aug 2022 09:02:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241104AbiHWJCU (ORCPT ); Tue, 23 Aug 2022 05:02:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347260AbiHWJBo (ORCPT ); Tue, 23 Aug 2022 05:01:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B393865D5; Tue, 23 Aug 2022 01:28:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 91242B81C50; Tue, 23 Aug 2022 08:27:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00DA8C433D6; Tue, 23 Aug 2022 08:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243264; bh=eva9J/HnGNK4Hs9Yy6N/uH0vPgm9Li4iFFPXZNd2K3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nxkypWfcISAjEuJ8j+HQmQ515vKXvdwTCuMThdRs/jON7hIo7cH7J8hqAdE+Opd6S Eq9kCB6MUmy3abWgPywD37kvDadrYVTAgRlHpY3lSKAC9Q/pB5RmmttQNUQogHiSF6 WYFl0jaioAr/l+FHpCaxiTSpb31V1J6nWzjQgyIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Mikailenko , Marek Szlosek , Tony Nguyen Subject: [PATCH 5.19 221/365] ice: Fix VSI rebuild WARN_ON check for VF Date: Tue, 23 Aug 2022 10:02:02 +0200 Message-Id: <20220823080127.431744065@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Mikailenko commit 7fe05e125d5f730bd2d0fc53985bee77b6c762f0 upstream. In commit b03d519d3460 ("ice: store VF pointer instead of VF ID") WARN_ON checks were added to validate the vsi->vf pointer and catch programming errors. However, one check to vsi->vf was missed. This caused a call trace when resetting VFs. Fix ice_vsi_rebuild by encompassing VF pointer in WARN_ON check. Fixes: b03d519d3460 ("ice: store VF pointer instead of VF ID") Signed-off-by: Benjamin Mikailenko Tested-by: Marek Szlosek Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/ice/ice_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -3178,7 +3178,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, =20 pf =3D vsi->back; vtype =3D vsi->type; - if (WARN_ON(vtype =3D=3D ICE_VSI_VF) && !vsi->vf) + if (WARN_ON(vtype =3D=3D ICE_VSI_VF && !vsi->vf)) return -EINVAL; =20 ice_vsi_init_vlan_ops(vsi); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F244C32792 for ; Tue, 23 Aug 2022 09:03:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242036AbiHWJDP (ORCPT ); Tue, 23 Aug 2022 05:03:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240927AbiHWJCN (ORCPT ); Tue, 23 Aug 2022 05:02:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1CC1DED9; Tue, 23 Aug 2022 01:28:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 065C56148E; Tue, 23 Aug 2022 08:27:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 124F9C433D6; Tue, 23 Aug 2022 08:27:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243267; bh=MhizXNpL4VcuzsMZtnmSWcWpYssi5M1HpMEr4zPcaUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yO0uk7znrzqkIadCQ4wG4CIj2rgaRdf7GEMpfkTOOtL6PqpLqreU4mghDZkpMVPfS MnPt4ap6hGmyFOoTGI72iqzYwVGzrysAEJIhEIoMxI3SowzrirLrKJ2tv6VK9xC6B/ WStW57Arb3bk620ko0mzluSJ5mSeQ/thqSf84m+U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Jaron , Jedrzej Jagielski , Marek Szlosek , Tony Nguyen Subject: [PATCH 5.19 222/365] ice: Fix call trace with null VSI during VF reset Date: Tue, 23 Aug 2022 10:02:03 +0200 Message-Id: <20220823080127.480889287@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Jaron commit cf90b74341eecc32ceef0c136954a1668e43b1e7 upstream. During stress test with attaching and detaching VF from KVM and simultaneously changing VFs spoofcheck and trust there was a call trace in ice_reset_vf that VF's VSI is null. [145237.352797] WARNING: CPU: 46 PID: 840629 at drivers/net/ethernet/intel/= ice/ice_vf_lib.c:508 ice_reset_vf+0x3d6/0x410 [ice] [145237.352851] Modules linked in: ice(E) vfio_pci vfio_pci_core vfio_virqf= d vfio_iommu_type1 vfio iavf dm_mod xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 nft_compat nft_chain_nat nf_nat nf_c= onntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnetlink tun bridge stp llc sunrpc intel_rapl_msr intel_rapl_common sb_edac x86_pkg_tem= p_thermal intel_powerclamp coretemp kvm_intel kvm iTCO_wdt iTC O_vendor_support irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_inte= l rapl ipmi_si intel_cstate ipmi_devintf joydev intel_uncore m ei_me ipmi_msghandler i2c_i801 pcspkr mei lpc_ich ioatdma i2c_smbus acpi_pa= d acpi_power_meter ip_tables xfs libcrc32c i2c_algo_bit drm_sh mem_helper drm_kms_helper sd_mod t10_pi crc64_rocksoft syscopyarea crc64 sy= sfillrect sg sysimgblt fb_sys_fops drm i40e ixgbe ahci libahci libata crc32c_intel mdio dca wmi fuse [last unloaded: ice] [145237.352917] CPU: 46 PID: 840629 Comm: kworker/46:2 Tainted: G S W = I E 5.19.0-rc6+ #24 [145237.352921] Hardware name: Intel Corporation S2600WTT/S2600WTT, BIOS SE= 5C610.86B.01.01.0008.021120151325 02/11/2015 [145237.352923] Workqueue: ice ice_service_task [ice] [145237.352948] RIP: 0010:ice_reset_vf+0x3d6/0x410 [ice] [145237.352984] Code: 30 ec f3 cc e9 28 fd ff ff 0f b7 4b 50 48 c7 c2 48 19= 9c c0 4c 89 ee 48 c7 c7 30 fe 9e c0 e8 d1 21 9d cc 31 c0 e9 a 9 fe ff ff <0f> 0b b8 ea ff ff ff e9 c1 fc ff ff 0f 0b b8 fb ff ff ff e9 91= fe [145237.352987] RSP: 0018:ffffb453e257fdb8 EFLAGS: 00010246 [145237.352990] RAX: ffff8bd0040181c0 RBX: ffff8be68db8f800 RCX: 0000000000= 000000 [145237.352991] RDX: 000000000000ffff RSI: 0000000000000000 RDI: ffff8be68d= b8f800 [145237.352993] RBP: ffff8bd0040181c0 R08: 0000000000001000 R09: ffff8bcfd5= 20e000 [145237.352995] R10: 0000000000000000 R11: 00008417b5ab0bc0 R12: 0000000000= 000005 [145237.352996] R13: ffff8bcee061c0d0 R14: ffff8bd004019640 R15: 0000000000= 000000 [145237.352998] FS: 0000000000000000(0000) GS:ffff8be5dfb00000(0000) knlGS= :0000000000000000 [145237.353000] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [145237.353002] CR2: 00007fd81f651d68 CR3: 0000001a0fe10001 CR4: 0000000000= 1726e0 [145237.353003] Call Trace: [145237.353008] [145237.353011] ice_process_vflr_event+0x8d/0xb0 [ice] [145237.353049] ice_service_task+0x79f/0xef0 [ice] [145237.353074] process_one_work+0x1c8/0x390 [145237.353081] ? process_one_work+0x390/0x390 [145237.353084] worker_thread+0x30/0x360 [145237.353087] ? process_one_work+0x390/0x390 [145237.353090] kthread+0xe8/0x110 [145237.353094] ? kthread_complete_and_exit+0x20/0x20 [145237.353097] ret_from_fork+0x22/0x30 [145237.353103] Remove WARN_ON() from check if VSI is null in ice_reset_vf. Add "VF is already removed\n" in dev_dbg(). This WARN_ON() is unnecessary and causes call trace, despite that call trace, driver still works. There is no need for this warn because this piece of code is responsible for disabling VF's Tx/Rx queues when VF is disabled, but when VF is already removed there is no need to do reset or disable queues. Fixes: efe41860008e ("ice: Fix memory corruption in VF driver") Signed-off-by: Michal Jaron Signed-off-by: Jedrzej Jagielski Tested-by: Marek Szlosek Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c @@ -505,8 +505,10 @@ int ice_reset_vf(struct ice_vf *vf, u32 =20 if (ice_is_vf_disabled(vf)) { vsi =3D ice_get_vf_vsi(vf); - if (WARN_ON(!vsi)) + if (!vsi) { + dev_dbg(dev, "VF is already removed\n"); return -EINVAL; + } ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, vf->vf_id); ice_vsi_stop_all_rx_rings(vsi); dev_dbg(dev, "VF is already disabled, there is no need for resetting it,= telling VM, all is fine %d\n", From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EEA6C32796 for ; Tue, 23 Aug 2022 09:04:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347671AbiHWJEA (ORCPT ); Tue, 23 Aug 2022 05:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347638AbiHWJCm (ORCPT ); Tue, 23 Aug 2022 05:02:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98A622AE39; Tue, 23 Aug 2022 01:28:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4218361496; Tue, 23 Aug 2022 08:27:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AF5AC433C1; Tue, 23 Aug 2022 08:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243270; bh=hmBBC3rXmDgnAJTGGbM1FP0s6fS3OG2Gq1iLirJXgSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZAr98klI0YjJ+k+Cpfv42BtstAe0QPHKUB169wiIdBb5okqTPP7z9AqPhAooFi/FE kIWLsUO0gfYRQL36Va+gplwNmxLL3Hem2XdymTAF+yrcs8Gi6VpSynfsB2f6ycTfQ1 AeE0rOQn1sWvPeWXS8B1jrWlK/eCNPXa3q+uhRnQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sylwester Dziedziuch , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen Subject: [PATCH 5.19 223/365] ice: Fix VF not able to send tagged traffic with no VLAN filters Date: Tue, 23 Aug 2022 10:02:04 +0200 Message-Id: <20220823080127.530680795@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sylwester Dziedziuch commit 664d4646184ed986f8195df684cc4660563fb02a upstream. VF was not able to send tagged traffic when it didn't have any VLAN interfaces and VLAN anti-spoofing was enabled. Fix this by allowing VFs with no VLAN filters to send tagged traffic. After VF adds a VLAN interface it will be able to send tagged traffic matching VLAN filters only. Testing hints: 1. Spawn VF 2. Send tagged packet from a VF 3. The packet should be sent out and not dropped 4. Add a VLAN interface on VF 5. Send tagged packet on that VLAN interface 6. Packet should be sent out and not dropped 7. Send tagged packet with id different than VLAN interface 8. Packet should be dropped Fixes: daf4dd16438b ("ice: Refactor spoofcheck configuration functions") Signed-off-by: Sylwester Dziedziuch Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 11 +++-- drivers/net/ethernet/intel/ice/ice_virtchnl.c | 57 +++++++++++++++++++++= +---- 2 files changed, 57 insertions(+), 11 deletions(-) --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c @@ -707,13 +707,16 @@ static int ice_cfg_mac_antispoof(struct static int ice_vsi_ena_spoofchk(struct ice_vsi *vsi) { struct ice_vsi_vlan_ops *vlan_ops; - int err; + int err =3D 0; =20 vlan_ops =3D ice_get_compat_vsi_vlan_ops(vsi); =20 - err =3D vlan_ops->ena_tx_filtering(vsi); - if (err) - return err; + /* Allow VF with VLAN 0 only to send all tagged traffic */ + if (vsi->type !=3D ICE_VSI_VF || ice_vsi_has_non_zero_vlans(vsi)) { + err =3D vlan_ops->ena_tx_filtering(vsi); + if (err) + return err; + } =20 return ice_cfg_mac_antispoof(vsi, true); } --- a/drivers/net/ethernet/intel/ice/ice_virtchnl.c +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl.c @@ -2264,6 +2264,15 @@ static int ice_vc_process_vlan_msg(struc =20 /* Enable VLAN filtering on first non-zero VLAN */ if (!vlan_promisc && vid && !ice_is_dvm_ena(&pf->hw)) { + if (vf->spoofchk) { + status =3D vsi->inner_vlan_ops.ena_tx_filtering(vsi); + if (status) { + v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; + dev_err(dev, "Enable VLAN anti-spoofing on VLAN ID: %d failed error-= %d\n", + vid, status); + goto error_param; + } + } if (vsi->inner_vlan_ops.ena_rx_filtering(vsi)) { v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; dev_err(dev, "Enable VLAN pruning on VLAN ID: %d failed error-%d\n", @@ -2309,8 +2318,10 @@ static int ice_vc_process_vlan_msg(struc } =20 /* Disable VLAN filtering when only VLAN 0 is left */ - if (!ice_vsi_has_non_zero_vlans(vsi)) + if (!ice_vsi_has_non_zero_vlans(vsi)) { + vsi->inner_vlan_ops.dis_tx_filtering(vsi); vsi->inner_vlan_ops.dis_rx_filtering(vsi); + } =20 if (vlan_promisc) ice_vf_dis_vlan_promisc(vsi, &vlan); @@ -2814,6 +2825,13 @@ ice_vc_del_vlans(struct ice_vf *vf, stru =20 if (vlan_promisc) ice_vf_dis_vlan_promisc(vsi, &vlan); + + /* Disable VLAN filtering when only VLAN 0 is left */ + if (!ice_vsi_has_non_zero_vlans(vsi) && ice_is_dvm_ena(&vsi->back->hw))= { + err =3D vsi->outer_vlan_ops.dis_tx_filtering(vsi); + if (err) + return err; + } } =20 vc_vlan =3D &vlan_fltr->inner; @@ -2829,8 +2847,17 @@ ice_vc_del_vlans(struct ice_vf *vf, stru /* no support for VLAN promiscuous on inner VLAN unless * we are in Single VLAN Mode (SVM) */ - if (!ice_is_dvm_ena(&vsi->back->hw) && vlan_promisc) - ice_vf_dis_vlan_promisc(vsi, &vlan); + if (!ice_is_dvm_ena(&vsi->back->hw)) { + if (vlan_promisc) + ice_vf_dis_vlan_promisc(vsi, &vlan); + + /* Disable VLAN filtering when only VLAN 0 is left */ + if (!ice_vsi_has_non_zero_vlans(vsi)) { + err =3D vsi->inner_vlan_ops.dis_tx_filtering(vsi); + if (err) + return err; + } + } } } =20 @@ -2907,6 +2934,13 @@ ice_vc_add_vlans(struct ice_vf *vf, stru if (err) return err; } + + /* Enable VLAN filtering on first non-zero VLAN */ + if (vf->spoofchk && vlan.vid && ice_is_dvm_ena(&vsi->back->hw)) { + err =3D vsi->outer_vlan_ops.ena_tx_filtering(vsi); + if (err) + return err; + } } =20 vc_vlan =3D &vlan_fltr->inner; @@ -2922,10 +2956,19 @@ ice_vc_add_vlans(struct ice_vf *vf, stru /* no support for VLAN promiscuous on inner VLAN unless * we are in Single VLAN Mode (SVM) */ - if (!ice_is_dvm_ena(&vsi->back->hw) && vlan_promisc) { - err =3D ice_vf_ena_vlan_promisc(vsi, &vlan); - if (err) - return err; + if (!ice_is_dvm_ena(&vsi->back->hw)) { + if (vlan_promisc) { + err =3D ice_vf_ena_vlan_promisc(vsi, &vlan); + if (err) + return err; + } + + /* Enable VLAN filtering on first non-zero VLAN */ + if (vf->spoofchk && vlan.vid) { + err =3D vsi->inner_vlan_ops.ena_tx_filtering(vsi); + if (err) + return err; + } } } } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3FB1C32772 for ; Tue, 23 Aug 2022 09:06:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241251AbiHWJGL (ORCPT ); Tue, 23 Aug 2022 05:06:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347712AbiHWJFU (ORCPT ); Tue, 23 Aug 2022 05:05:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10BEC84EC0; Tue, 23 Aug 2022 01:29:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 43ABD61499; Tue, 23 Aug 2022 08:27:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41CFEC433D6; Tue, 23 Aug 2022 08:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243273; bh=JzwUZcD7jNCJYY/ChR+2ByndPEgmimdsvcQdGqDEtNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pe9tmdIfDYuQpEtX503QJwywUU5kChivFghzWonYBEeD63b7FZ8PxuI6wGXyngwJc Pl6DuQMqOLJxpo2/nYDVDK63oZEq7K2ngAGXWu0mSClKfdJ3uYeCHGcFohIQMdgE9z 4LJzr7Qayxu2fTFHElk2wbModkkr6JeSzO7QN9WM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Grzegorz Siwik , Jaroslav Pulchart , Igor Raits , Tony Nguyen , Gurucharan Subject: [PATCH 5.19 224/365] ice: Fix double VLAN error when entering promisc mode Date: Tue, 23 Aug 2022 10:02:05 +0200 Message-Id: <20220823080127.569797517@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Grzegorz Siwik commit ffa9ed86522f1c08d4face4e0a4ebf366037bf19 upstream. Avoid enabling or disabling VLAN 0 when trying to set promiscuous VLAN mode if double VLAN mode is enabled. This fix is needed because the driver tries to add the VLAN 0 filter twice (once for inner and once for outer) when double VLAN mode is enabled. The filter program is rejected by the firmware when double VLAN is enabled, because the promiscuous filter only needs to be set once. This issue was missed in the initial implementation of double VLAN mode. Fixes: 5eda8afd6bcc ("ice: Add support for PF/VF promiscuous mode") Signed-off-by: Grzegorz Siwik Link: https://lore.kernel.org/all/CAK8fFZ7m-KR57M_rYX6xZN39K89O=3DLGooYkKsu= 6HKt0Bs+x6xQ@mail.gmail.com/ Tested-by: Jaroslav Pulchart Tested-by: Igor Raits Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/ice/ice_switch.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -4414,6 +4414,13 @@ ice_set_vlan_vsi_promisc(struct ice_hw * goto free_fltr_list; =20 list_for_each_entry(list_itr, &vsi_list_head, list_entry) { + /* Avoid enabling or disabling VLAN zero twice when in double + * VLAN mode + */ + if (ice_is_dvm_ena(hw) && + list_itr->fltr_info.l_data.vlan.tpid =3D=3D 0) + continue; + vlan_id =3D list_itr->fltr_info.l_data.vlan.vlan_id; if (rm_vlan_promisc) status =3D ice_clear_vsi_promisc(hw, vsi_handle, From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34B81C32772 for ; Tue, 23 Aug 2022 09:06:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347787AbiHWJGs (ORCPT ); Tue, 23 Aug 2022 05:06:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348073AbiHWJFq (ORCPT ); Tue, 23 Aug 2022 05:05:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25D8284EF1; Tue, 23 Aug 2022 01:29:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 497E561490; Tue, 23 Aug 2022 08:27:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F635C433C1; Tue, 23 Aug 2022 08:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243276; bh=1c39BiNd7SQ5EjNVpwpii3C/c76JTx3O9Q0M7TYzoc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BBaFj+cIXSDkWNHY/2k9Ymlg4+jyIAv65YkKRg8ByyV2EMD+PT2/CrGAjg2q8fjUz M4Qra9vUFkhmExxdZ2ZvvpR8ZrZv74QnJU7J4piSRxJt1Upx1t3slXzNsK0M69pGcn YsDHzNBMlxdmJhFnJZWRwDNxJ7AUxG1J/gCippVY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Grzegorz Siwik , Jaroslav Pulchart , Igor Raits , Tony Nguyen , Gurucharan Subject: [PATCH 5.19 225/365] ice: Ignore EEXIST when setting promisc mode Date: Tue, 23 Aug 2022 10:02:06 +0200 Message-Id: <20220823080127.610838708@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Grzegorz Siwik commit 11e551a2efa4481bd4f616ab75374a2710b480e9 upstream. Ignore EEXIST error when setting promiscuous mode. This fix is needed because the driver could set promiscuous mode when it still has not cleared properly. Promiscuous mode could be set only once, so setting it second time will be rejected. Fixes: 5eda8afd6bcc ("ice: Add support for PF/VF promiscuous mode") Signed-off-by: Grzegorz Siwik Link: https://lore.kernel.org/all/CAK8fFZ7m-KR57M_rYX6xZN39K89O=3DLGooYkKsu= 6HKt0Bs+x6xQ@mail.gmail.com/ Tested-by: Jaroslav Pulchart Tested-by: Igor Raits Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/ice/ice_switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -4428,7 +4428,7 @@ ice_set_vlan_vsi_promisc(struct ice_hw * else status =3D ice_set_vsi_promisc(hw, vsi_handle, promisc_mask, vlan_id); - if (status) + if (status && status !=3D -EEXIST) break; } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93796C32792 for ; Tue, 23 Aug 2022 09:06:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347746AbiHWJGm (ORCPT ); Tue, 23 Aug 2022 05:06:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348047AbiHWJFp (ORCPT ); Tue, 23 Aug 2022 05:05:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E41E74DD7; Tue, 23 Aug 2022 01:29:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E86CFB81C52; Tue, 23 Aug 2022 08:28:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55E10C433D6; Tue, 23 Aug 2022 08:27:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243279; bh=06rDHVyj14to00b6+dc3sf8vZFtqHsM2kx3cr8PLbb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E09IpiJMPkCxsJwO8pGpl2/xyRmAJJZSvBrkODijK+fRY4ITwT9PXEfTNsNmp0UWc /rZRrf0e7Kv7YgLa/rw3kprDVPwy++9dRm95Fxy29mN7/YFHAhYWdglN5xQ4EoVZBZ R/Itdhuo2Gi1MjJAaQE8snWufEdLoa9+3WbvDhbc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesse Brandeburg , Grzegorz Siwik , Jaroslav Pulchart , Igor Raits , Tony Nguyen , Gurucharan Subject: [PATCH 5.19 226/365] ice: Fix clearing of promisc mode with bridge over bond Date: Tue, 23 Aug 2022 10:02:07 +0200 Message-Id: <20220823080127.653236561@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Grzegorz Siwik commit abddafd4585cc825d454da3cf308ad1226f6c554 upstream. When at least two interfaces are bonded and a bridge is enabled on the bond, an error can occur when the bridge is removed and re-added. The reason for the error is because promiscuous mode was not fully cleared from the VLAN VSI in the hardware. With this change, promiscuous mode is properly removed when the bridge disconnects from bonding. [ 1033.676359] bond1: link status definitely down for interface enp95s0f0, = disabling it [ 1033.676366] bond1: making interface enp175s0f0 the new active one [ 1033.676369] device enp95s0f0 left promiscuous mode [ 1033.676522] device enp175s0f0 entered promiscuous mode [ 1033.676901] ice 0000:af:00.0 enp175s0f0: Error setting Multicast promisc= uous mode on VSI 6 [ 1041.795662] ice 0000:af:00.0 enp175s0f0: Error setting Multicast promisc= uous mode on VSI 6 [ 1041.944826] bond1: link status definitely down for interface enp175s0f0,= disabling it [ 1041.944874] device enp175s0f0 left promiscuous mode [ 1041.944918] bond1: now running without any active interface! Fixes: c31af68a1b94 ("ice: Add outer_vlan_ops and VSI specific VLAN ops imp= lementations") Co-developed-by: Jesse Brandeburg Signed-off-by: Jesse Brandeburg Signed-off-by: Grzegorz Siwik Link: https://lore.kernel.org/all/CAK8fFZ7m-KR57M_rYX6xZN39K89O=3DLGooYkKsu= 6HKt0Bs+x6xQ@mail.gmail.com/ Tested-by: Jaroslav Pulchart Tested-by: Igor Raits Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/ice/ice_lib.c | 6 +++++- drivers/net/ethernet/intel/ice/ice_main.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -4078,7 +4078,11 @@ int ice_vsi_del_vlan_zero(struct ice_vsi if (err && err !=3D -EEXIST) return err; =20 - return 0; + /* when deleting the last VLAN filter, make sure to disable the VLAN + * promisc mode so the filter isn't left by accident + */ + return ice_clear_vsi_promisc(&vsi->back->hw, vsi->idx, + ICE_MCAST_VLAN_PROMISC_BITS, 0); } =20 /** --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -267,8 +267,10 @@ static int ice_set_promisc(struct ice_vs status =3D ice_fltr_set_vsi_promisc(&vsi->back->hw, vsi->idx, promisc_m, 0); } + if (status && status !=3D -EEXIST) + return status; =20 - return status; + return 0; } =20 /** @@ -3572,6 +3574,14 @@ ice_vlan_rx_kill_vid(struct net_device * while (test_and_set_bit(ICE_CFG_BUSY, vsi->state)) usleep_range(1000, 2000); =20 + ret =3D ice_clear_vsi_promisc(&vsi->back->hw, vsi->idx, + ICE_MCAST_VLAN_PROMISC_BITS, vid); + if (ret) { + netdev_err(netdev, "Error clearing multicast promiscuous mode on VSI %i\= n", + vsi->vsi_num); + vsi->current_netdev_flags |=3D IFF_ALLMULTI; + } + vlan_ops =3D ice_get_compat_vsi_vlan_ops(vsi); =20 /* Make sure VLAN delete is successful before updating VLAN From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B49E1C32774 for ; Tue, 23 Aug 2022 09:05:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347665AbiHWJFM (ORCPT ); Tue, 23 Aug 2022 05:05:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347706AbiHWJEE (ORCPT ); Tue, 23 Aug 2022 05:04:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EE3974CF5; Tue, 23 Aug 2022 01:29:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4F367614C7; Tue, 23 Aug 2022 08:28:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50D59C433D6; Tue, 23 Aug 2022 08:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243282; bh=c8L+CHRO4m50NwSdiBKH0thAerkwii/5twQy5EFqNbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kRWAH4rBZFhe3pVAdN2b1SWkxTVzNbgcpg3lrX84fFYVwbsNmie+3NqXclZkyDw5R hWsFQhja36GY0IF/bPn1lM2WEe7NbqE3Oe/B0l08KJk8hi+UQ4iUHh/cMngON3drKi WakhAIZy/coNqDmIALD/gZ6cUU8SdcpABxBPm++k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Mikailenko , Grzegorz Siwik , Tony Nguyen , Gurucharan Subject: [PATCH 5.19 227/365] ice: Ignore error message when setting same promiscuous mode Date: Tue, 23 Aug 2022 10:02:08 +0200 Message-Id: <20220823080127.691956406@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Mikailenko commit 79956b83ed4281c35561c39254558092d96a9ed1 upstream. Commit 1273f89578f2 ("ice: Fix broken IFF_ALLMULTI handling") introduced new checks when setting/clearing promiscuous mode. But if the requested promiscuous mode setting already exists, an -EEXIST error message would be printed. This is incorrect because promiscuous mode is either on/off and shouldn't print an error when the requested configuration is already set. This can happen when removing a bridge with two bonded interfaces and promiscuous most isn't fully cleared from VLAN VSI in hardware. Fix this by ignoring cases where requested promiscuous mode exists. Fixes: 1273f89578f2 ("ice: Fix broken IFF_ALLMULTI handling") Signed-off-by: Benjamin Mikailenko Signed-off-by: Grzegorz Siwik Link: https://lore.kernel.org/all/CAK8fFZ7m-KR57M_rYX6xZN39K89O=3DLGooYkKsu= 6HKt0Bs+x6xQ@mail.gmail.com/ Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/ice/ice_fltr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/intel/ice/ice_fltr.c +++ b/drivers/net/ethernet/intel/ice/ice_fltr.c @@ -62,7 +62,7 @@ ice_fltr_set_vlan_vsi_promisc(struct ice int result; =20 result =3D ice_set_vlan_vsi_promisc(hw, vsi->idx, promisc_mask, false); - if (result) + if (result && result !=3D -EEXIST) dev_err(ice_pf_to_dev(pf), "Error setting promisc mode on VSI %i (rc=3D%d)\n", vsi->vsi_num, result); @@ -86,7 +86,7 @@ ice_fltr_clear_vlan_vsi_promisc(struct i int result; =20 result =3D ice_set_vlan_vsi_promisc(hw, vsi->idx, promisc_mask, true); - if (result) + if (result && result !=3D -EEXIST) dev_err(ice_pf_to_dev(pf), "Error clearing promisc mode on VSI %i (rc=3D%d)\n", vsi->vsi_num, result); @@ -109,7 +109,7 @@ ice_fltr_clear_vsi_promisc(struct ice_hw int result; =20 result =3D ice_clear_vsi_promisc(hw, vsi_handle, promisc_mask, vid); - if (result) + if (result && result !=3D -EEXIST) dev_err(ice_pf_to_dev(pf), "Error clearing promisc mode on VSI %i for VID %u (rc=3D%d)\n", ice_get_hw_vsi_num(hw, vsi_handle), vid, result); @@ -132,7 +132,7 @@ ice_fltr_set_vsi_promisc(struct ice_hw * int result; =20 result =3D ice_set_vsi_promisc(hw, vsi_handle, promisc_mask, vid); - if (result) + if (result && result !=3D -EEXIST) dev_err(ice_pf_to_dev(pf), "Error setting promisc mode on VSI %i for VID %u (rc=3D%d)\n", ice_get_hw_vsi_num(hw, vsi_handle), vid, result); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8BE4C3F6B0 for ; Tue, 23 Aug 2022 09:06:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241015AbiHWJGB (ORCPT ); Tue, 23 Aug 2022 05:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242352AbiHWJEo (ORCPT ); Tue, 23 Aug 2022 05:04:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D959D83F2E; Tue, 23 Aug 2022 01:29:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 24FAD61360; Tue, 23 Aug 2022 08:28:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DA51C433C1; Tue, 23 Aug 2022 08:28:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243288; bh=8Jm9YYqLw/pElrVNBlgxZpV/Wi6IBZMDszQgvh2y7wA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cLY15dk6CmQSeOdKgvaQDLe2D296n7xHFbuvrXWz+zV7J/pOpy8Gf+cugtvPhDaul 4NFH/DeN7Iiwzt7t2ozzpX1dAAIlHv/an6qdC/DK/jjyHfIcZpmxVhGQ3HZZrg3V/A BUzOeSNGhpno9b9ohMzZmR9S50r6QgqaTaOBSzEw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, matoro , Masahiro Yamada Subject: [PATCH 5.19 228/365] modpost: fix module versioning when a symbol lacks valid CRC Date: Tue, 23 Aug 2022 10:02:09 +0200 Message-Id: <20220823080127.738695343@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Masahiro Yamada commit 5b8a9a8fd1f0c3d55d407cf759d54ca68798d9ad upstream. Since commit 7b4537199a4a ("kbuild: link symbol CRCs at final link, removing CONFIG_MODULE_REL_CRCS"), module versioning is broken on some architectures. Loading a module fails with "disagrees about version of symbol module_layout". On such architectures (e.g. ARCH=3Dsparc build with sparc64_defconfig), modpost shows a warning, like follows: WARNING: modpost: EXPORT symbol "_mcount" [vmlinux] version generation fa= iled, symbol will not be versioned. Is "_mcount" prototyped in ? Previously, it was a harmless warning (CRC check was just skipped), but now wrong CRCs are used for comparison because invalid CRCs are just skipped. $ sparc64-linux-gnu-nm -n vmlinux [snip] 0000000000c2cea0 r __ksymtab__kstrtol 0000000000c2ceb8 r __ksymtab__kstrtoul 0000000000c2ced0 r __ksymtab__local_bh_enable 0000000000c2cee8 r __ksymtab__mcount 0000000000c2cf00 r __ksymtab__printk 0000000000c2cf18 r __ksymtab__raw_read_lock 0000000000c2cf30 r __ksymtab__raw_read_lock_bh [snip] 0000000000c53b34 D __crc__kstrtol 0000000000c53b38 D __crc__kstrtoul 0000000000c53b3c D __crc__local_bh_enable 0000000000c53b40 D __crc__printk 0000000000c53b44 D __crc__raw_read_lock 0000000000c53b48 D __crc__raw_read_lock_bh Please notice __crc__mcount is missing here. When the module subsystem looks up a CRC that comes after, it results in reading out a wrong address. For example, when __crc__printk is needed, the module subsystem reads 0xc53b44 instead of 0xc53b40. All CRC entries must be output for correct index accessing. Invalid CRCs will be unused, but are needed to keep the one-to-one mapping between __ksymtab_* and __crc_*. The best is to fix all modpost warnings, but several warnings are still remaining on less popular architectures. Fixes: 7b4537199a4a ("kbuild: link symbol CRCs at final link, removing CONF= IG_MODULE_REL_CRCS") Reported-by: matoro Signed-off-by: Masahiro Yamada Tested-by: matoro Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- scripts/mod/modpost.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -2203,13 +2203,11 @@ static void add_exported_symbols(struct /* record CRCs for exported symbols */ buf_printf(buf, "\n"); list_for_each_entry(sym, &mod->exported_symbols, list) { - if (!sym->crc_valid) { + if (!sym->crc_valid) warn("EXPORT symbol \"%s\" [%s%s] version generation failed, symbol wil= l not be versioned.\n" "Is \"%s\" prototyped in ?\n", sym->name, mod->name, mod->is_vmlinux ? "" : ".ko", sym->name); - continue; - } =20 buf_printf(buf, "SYMBOL_CRC(%s, 0x%08x, \"%s\");\n", sym->name, sym->crc, sym->is_gpl_only ? "_gpl" : ""); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 861DBC32793 for ; Tue, 23 Aug 2022 09:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240817AbiHWJF6 (ORCPT ); Tue, 23 Aug 2022 05:05:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243457AbiHWJFI (ORCPT ); Tue, 23 Aug 2022 05:05:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25C24844D7; Tue, 23 Aug 2022 01:29:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 08F57B81C54; Tue, 23 Aug 2022 08:28:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 534FBC433C1; Tue, 23 Aug 2022 08:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243291; bh=ZFjxRbiSTCcpDSWigsu2rT70OLmGRjEoFzUdbveCR54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tbAalBBabyavGiPT756JXSNRUjfTqMGER3tURX/vXoIL4PlJHOM455Kh/73AL5PQz vyP8W5/f8hVehYgUXMSXdU8SWXihIBBL+ghoSSj4U2KB0nr0GRNmwD6oYvzVdWxoQX /9Je85SS2wri6fjkYIPTwSO8NjxIzTS4dyJxsaNc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Oleksij Rempel , Wolfram Sang Subject: [PATCH 5.19 229/365] i2c: imx: Make sure to unregister adapter on remove() Date: Tue, 23 Aug 2022 10:02:10 +0200 Message-Id: <20220823080127.791052445@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig commit d98bdd3a5b50446d8e010be5b04ce81c4eabf728 upstream. If for whatever reasons pm_runtime_resume_and_get() fails and .remove() is exited early, the i2c adapter stays around and the irq still calls its handler, while the driver data and the register mapping go away. So if later the i2c adapter is accessed or the irq triggers this results in havoc accessing freed memory and unmapped registers. So unregister the software resources even if resume failed, and only skip the hardware access in that case. Fixes: 588eb93ea49f ("i2c: imx: add runtime pm support to improve the perfo= rmance") Signed-off-by: Uwe Kleine-K=C3=B6nig Acked-by: Oleksij Rempel Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-imx.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1572,9 +1572,7 @@ static int i2c_imx_remove(struct platfor struct imx_i2c_struct *i2c_imx =3D platform_get_drvdata(pdev); int irq, ret; =20 - ret =3D pm_runtime_resume_and_get(&pdev->dev); - if (ret < 0) - return ret; + ret =3D pm_runtime_get_sync(&pdev->dev); =20 hrtimer_cancel(&i2c_imx->slave_timer); =20 @@ -1585,17 +1583,21 @@ static int i2c_imx_remove(struct platfor if (i2c_imx->dma) i2c_imx_dma_free(i2c_imx); =20 - /* setup chip registers to defaults */ - imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR); - imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR); - imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2CR); - imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2SR); + if (ret =3D=3D 0) { + /* setup chip registers to defaults */ + imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR); + imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR); + imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2CR); + imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2SR); + clk_disable(i2c_imx->clk); + } =20 clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb); irq =3D platform_get_irq(pdev, 0); if (irq >=3D 0) free_irq(irq, i2c_imx); - clk_disable_unprepare(i2c_imx->clk); + + clk_unprepare(i2c_imx->clk); =20 pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A65EC32772 for ; Tue, 23 Aug 2022 09:07:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347951AbiHWJHG (ORCPT ); Tue, 23 Aug 2022 05:07:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348119AbiHWJFs (ORCPT ); Tue, 23 Aug 2022 05:05:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD819844EB; Tue, 23 Aug 2022 01:29:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 30860B81C53; Tue, 23 Aug 2022 08:28:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 630F8C433C1; Tue, 23 Aug 2022 08:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243294; bh=kBIJUnYoiF4hvWbezr8bvwVph0x8Ae5+cW9bccerPLw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X6VVkbPBAyigqFonlavrZ+3lM60kb/gXzg6QDkAtd7+neTC7uEEpNrDw67CmLLxLu mkGyxk1KWGMM4aMeGnf2im5r8gUFn/Z5Nk1nXsv8BgnQen0+sGftlXUlBRjXUFuyPJ 2/lFP7ZuWBAQBk2qVq9yuojNoMNOKt2BSvg4Qd4s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Przemyslaw Patynowski , Mateusz Palczewski , Marek Szlosek , Tony Nguyen Subject: [PATCH 5.19 230/365] i40e: Fix tunnel checksum offload with fragmented traffic Date: Tue, 23 Aug 2022 10:02:11 +0200 Message-Id: <20220823080127.841289110@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Przemyslaw Patynowski commit 2c6482091f01ba104cf8ee549aa5c717e80d43ea upstream. Fix checksum offload on VXLAN tunnels. In case, when mpls protocol is not used, set l4 header to transport header of skb. This fixes case, when user tries to offload checksums of VXLAN tunneled traffic. Steps for reproduction (requires link partner with tunnels): ip l s enp130s0f0 up ip a f enp130s0f0 ip a a 10.10.110.2/24 dev enp130s0f0 ip l s enp130s0f0 mtu 1600 ip link add vxlan12_sut type vxlan id 12 group 238.168.100.100 dev \ enp130s0f0 dstport 4789 ip l s vxlan12_sut up ip a a 20.10.110.2/24 dev vxlan12_sut iperf3 -c 20.10.110.1 #should connect Without this patch, TX descriptor was using wrong data, due to l4 header pointing wrong address. NIC would then drop those packets internally, due to incorrect TX descriptor data, which increased GLV_TEPC register. Fixes: b4fb2d33514a ("i40e: Add support for MPLS + TSO") Signed-off-by: Przemyslaw Patynowski Signed-off-by: Mateusz Palczewski Tested-by: Marek Szlosek Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -3204,11 +3204,13 @@ static int i40e_tx_enable_csum(struct sk =20 protocol =3D vlan_get_protocol(skb); =20 - if (eth_p_mpls(protocol)) + if (eth_p_mpls(protocol)) { ip.hdr =3D skb_inner_network_header(skb); - else + l4.hdr =3D skb_checksum_start(skb); + } else { ip.hdr =3D skb_network_header(skb); - l4.hdr =3D skb_checksum_start(skb); + l4.hdr =3D skb_transport_header(skb); + } =20 /* set the tx_flags to indicate the IP protocol type. this is * required so that checksum header computation below is accurate. From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D797EC32772 for ; Tue, 23 Aug 2022 09:09:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348328AbiHWJJZ (ORCPT ); Tue, 23 Aug 2022 05:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347662AbiHWJHy (ORCPT ); Tue, 23 Aug 2022 05:07:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81B448670D; Tue, 23 Aug 2022 01:30:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 12D48B81C5A; Tue, 23 Aug 2022 08:30:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64A4AC4314A; Tue, 23 Aug 2022 08:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243419; bh=vYopN2OvdoOaGtVHd9gj1WN5klnOVbI44044XMYR80o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=soGOp/FktAgVgHl+XV67bzIhMuaKqosY5Vgkbr+2+zLz7ycTHkEmLSpzW7u6pQrj1 wisw+BtIkAGw0WGRF8Wyzwyoo8maCIYY2sya0aS4s83ikYdsYbm0DMaZSput6y2n5e eGmEjMsfCXVXNhZ1j0ePlffb44wJqvxKVCqGWA08= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Frieder Schrempf Subject: [PATCH 5.19 231/365] regulator: pca9450: Remove restrictions for regulator-name Date: Tue, 23 Aug 2022 10:02:12 +0200 Message-Id: <20220823080127.885654541@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frieder Schrempf commit b0de7fa706506bf0591037908376351beda8c5d6 upstream. The device bindings shouldn't put any constraints on the regulator-name property specified in the generic bindings. This allows using arbitrary and descriptive names for the regulators. Suggested-by: Mark Brown Fixes: 7ae9e3a6bf3f ("dt-bindings: regulator: add pca9450 regulator yaml") Signed-off-by: Frieder Schrempf Link: https://lore.kernel.org/r/20220802064335.8481-1-frieder@fris.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml | = 11 ---------- 1 file changed, 11 deletions(-) --- a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml +++ b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml @@ -47,12 +47,6 @@ properties: description: Properties for single LDO regulator. =20 - properties: - regulator-name: - pattern: "^LDO[1-5]$" - description: - should be "LDO1", ..., "LDO5" - unevaluatedProperties: false =20 "^BUCK[1-6]$": @@ -62,11 +56,6 @@ properties: Properties for single BUCK regulator. =20 properties: - regulator-name: - pattern: "^BUCK[1-6]$" - description: - should be "BUCK1", ..., "BUCK6" - nxp,dvs-run-voltage: $ref: "/schemas/types.yaml#/definitions/uint32" minimum: 600000 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FE86C32772 for ; Tue, 23 Aug 2022 09:08:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348111AbiHWJIF (ORCPT ); Tue, 23 Aug 2022 05:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347824AbiHWJGu (ORCPT ); Tue, 23 Aug 2022 05:06:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68D0F861C6; Tue, 23 Aug 2022 01:30:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1CCF861488; Tue, 23 Aug 2022 08:28:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22D33C433C1; Tue, 23 Aug 2022 08:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243319; bh=43xzfGfQI0B76DhRYGDXitfPVbsJYhLVBLfkISk7KpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JmseJjB+MrgmX81Ir4y9UC5ioL/svE4yfSaI+94uSkfJAd3G1xJCjWOctakW7wQzu vcla9Yk0I1o7bKsZNmR8VWC74iI8TnMk4FvbBA2hJUg6Q33PXVcmTk1kZAiTiYc5Aa b0KBvtmwxw7bfLojju6VWMVkS3zXjIl8vSil9+IU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Brady , Mateusz Palczewski , Tony Nguyen , Gurucharan Subject: [PATCH 5.19 232/365] i40e: Fix to stop tx_timeout recovery if GLOBR fails Date: Tue, 23 Aug 2022 10:02:13 +0200 Message-Id: <20220823080127.937168909@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alan Brady commit 57c942bc3bef0970f0b21f8e0998e76a900ea80d upstream. When a tx_timeout fires, the PF attempts to recover by incrementally resetting. First we try a PFR, then CORER and finally a GLOBR. If the GLOBR fails, then we keep hitting the tx_timeout and incrementing the recovery level and issuing dmesgs, which is both annoying to the user and accomplishes nothing. If the GLOBR fails, then we're pretty much totally hosed, and there's not much else we can do to recover, so this makes it such that we just kill the VSI and stop hitting the tx_timeout in such a case. Fixes: 41c445ff0f48 ("i40e: main driver core") Signed-off-by: Alan Brady Signed-off-by: Mateusz Palczewski Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -384,7 +384,9 @@ static void i40e_tx_timeout(struct net_d set_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state); break; default: - netdev_err(netdev, "tx_timeout recovery unsuccessful\n"); + netdev_err(netdev, "tx_timeout recovery unsuccessful, device is in non-r= ecoverable state.\n"); + set_bit(__I40E_DOWN_REQUESTED, pf->state); + set_bit(__I40E_VSI_DOWN_REQUESTED, vsi->state); break; } From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1298EC32774 for ; Tue, 23 Aug 2022 09:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348436AbiHWJKA (ORCPT ); Tue, 23 Aug 2022 05:10:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347950AbiHWJIc (ORCPT ); Tue, 23 Aug 2022 05:08:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 812E585FDA; Tue, 23 Aug 2022 01:30:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89B6A6148E; Tue, 23 Aug 2022 08:29:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87CB4C433B5; Tue, 23 Aug 2022 08:29:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243354; bh=9a8VWOB3kHtWZih/DNfyhw7RMpOevoUeaUMm2JCDfYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dWgw/VAWW4OWC8KkB/IvltvKg6+hF7kwc1tLcfRBokMUGmzss3tZ1JjEl18Yz45NL /9Ng+IN6+I4R76adl4y0QUCBetj4SYHP6qXEWKlwjM1CS9Ufn8gqai7ay9QRd40IM4 UXA2f4NP6DMwB44/e1/WQCxDfgWTTMwFzMiCVpxk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yufen Yu , Ming Lei , Jens Axboe Subject: [PATCH 5.19 233/365] blk-mq: run queue no matter whether the request is the last request Date: Tue, 23 Aug 2022 10:02:14 +0200 Message-Id: <20220823080127.972131997@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yufen Yu commit d3b38596875dbc709b4e721a5873f4663d8a9ea2 upstream. We do test on a virtio scsi device (/dev/sda) and the default mq scheduler is 'none'. We found a IO hung as following: blk_finish_plug blk_mq_plug_issue_direct scsi_mq_get_budget //get budget_token fail and sdev->restarts=3D1 scsi_end_request scsi_run_queue_async //sdev->restart=3D0 and run queue blk_mq_request_bypass_insert //add request to hctx->dispatch list //continue to dispath plug list blk_mq_dispatch_plug_list blk_mq_try_issue_list_directly //success issue all requests from plug list After .get_budget fail, scsi_mq_get_budget will increase 'restarts'. Normally, it will run hw queue when io complete and set 'restarts' as 0. But if we run queue before adding request to the dispatch list and blk_mq_dispatch_plug_list also success issue all requests, then on one will run queue, and the request will be stall in the dispatch list and cannot complete forever. It is wrong to use last request of plug list to decide if run queue is needed since all the remained requests in plug list may be from other hctxs. To fix the bug, pass run_queue as true always to blk_mq_request_bypass_insert(). Fix-suggested-by: Ming Lei Signed-off-by: Yufen Yu Reviewed-by: Ming Lei Fixes: dc5fc361d891 ("block: attempt direct issue of plug list") Link: https://lore.kernel.org/r/20220803023355.3687360-1-yuyufen@huaweiclou= d.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2568,7 +2568,7 @@ static void blk_mq_plug_issue_direct(str break; case BLK_STS_RESOURCE: case BLK_STS_DEV_RESOURCE: - blk_mq_request_bypass_insert(rq, false, last); + blk_mq_request_bypass_insert(rq, false, true); blk_mq_commit_rqs(hctx, &queued, from_schedule); return; default: From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DFF8C32774 for ; Tue, 23 Aug 2022 09:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348552AbiHWJKb (ORCPT ); Tue, 23 Aug 2022 05:10:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348009AbiHWJJS (ORCPT ); Tue, 23 Aug 2022 05:09:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83405868A1; Tue, 23 Aug 2022 01:30:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3A2F761338; Tue, 23 Aug 2022 08:29:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26467C433C1; Tue, 23 Aug 2022 08:29:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243388; bh=bpP3v+DcvV2AxMnSmPB9/sNRdImi4ZKRLo9adOSSbiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YhvolnvbPIzW7ZlSt/ikqR6/PqDz1HLG+KSsvvDDo7AyIz0mLtPdiv++4am1+vngq cHZW06OEj1FkyUC+8daB0bcPWC5Uo74Dox1TPYILxhC5dXz94a+nt8pkA0Ulo288EV 8L5Gg+KTJF2FOK+UhKHqf9/TUIftE16bJ+CPpY9c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Hutchings , Daniel Bristot de Oliveira , "Steven Rostedt (Google)" Subject: [PATCH 5.19 234/365] tools/rtla: Fix command symlinks Date: Tue, 23 Aug 2022 10:02:15 +0200 Message-Id: <20220823080128.020429824@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ben Hutchings commit ff5a55dcdb343e3db9b9fb08795b78544b032773 upstream. "ln -s" stores the next argument directly as the symlink target, so it needs to be a relative path. In this case, just "rtla". Link: https://lore.kernel.org/linux-trace-devel/YtLBXMI6Ui4HLIF1@decadent.o= rg.uk Fixes: 0605bf009f18 ("rtla: Add osnoise tool") Fixes: a828cd18bc4a ("rtla: Add timerlat tool and timelart top mode") Signed-off-by: Ben Hutchings Acked-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- tools/tracing/rtla/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile index 1bea2d16d4c1..b8fe10d941ce 100644 --- a/tools/tracing/rtla/Makefile +++ b/tools/tracing/rtla/Makefile @@ -108,9 +108,9 @@ install: doc_install $(INSTALL) rtla -m 755 $(DESTDIR)$(BINDIR) $(STRIP) $(DESTDIR)$(BINDIR)/rtla @test ! -f $(DESTDIR)$(BINDIR)/osnoise || rm $(DESTDIR)$(BINDIR)/osnoise - ln -s $(DESTDIR)$(BINDIR)/rtla $(DESTDIR)$(BINDIR)/osnoise + ln -s rtla $(DESTDIR)$(BINDIR)/osnoise @test ! -f $(DESTDIR)$(BINDIR)/timerlat || rm $(DESTDIR)$(BINDIR)/timerlat - ln -s $(DESTDIR)$(BINDIR)/rtla $(DESTDIR)$(BINDIR)/timerlat + ln -s rtla $(DESTDIR)$(BINDIR)/timerlat =20 .PHONY: clean tarball clean: doc_clean --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9047C32774 for ; Tue, 23 Aug 2022 09:13:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348968AbiHWJNs (ORCPT ); Tue, 23 Aug 2022 05:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348829AbiHWJKy (ORCPT ); Tue, 23 Aug 2022 05:10:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AF866CF45; Tue, 23 Aug 2022 01:30:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 80324B81C55; Tue, 23 Aug 2022 08:30:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF467C433C1; Tue, 23 Aug 2022 08:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243401; bh=igjXdeTIh2J1dyo+c5h+Sq4//E/O3Py4lY+Fsmj/teA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uEuoz5sb+YLAn/z+hb3hz5ed75twLpXXuRJQh8vcWNtMBHdxmpTaN2tv+QrR2SC5c ihT37oPkdynPjj7NQ0V3z11XwMEobR/OfRYjLjRKDH/NhVCrxkQpIba/eNhXSh67mw Ag35KfCo3sY2qJZWBiUwK1PHJ3J5he1Cp8D7dUgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Cs=C3=B3k=C3=A1s=20Bence?= , Jakub Kicinski Subject: [PATCH 5.19 235/365] fec: Fix timer capture timing in `fec_ptp_enable_pps()` Date: Tue, 23 Aug 2022 10:02:16 +0200 Message-Id: <20220823080128.069830194@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cs=C3=B3k=C3=A1s Bence commit 61d5e2a251fb20c2c5e998c3f1d52ed6d5360319 upstream. Code reimplements functionality already in `fec_ptp_read()`, but misses check for FEC_QUIRK_BUG_CAPTURE. Replace with function call. Fixes: 28b5f058cf1d ("net: fec: ptp: fix convergence issue to support Linux= PTP stack") Signed-off-by: Cs=C3=B3k=C3=A1s Bence Link: https://lore.kernel.org/r/20220811101348.13755-1-csokas.bence@prolan.= hu Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/freescale/fec_ptp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -135,11 +135,7 @@ static int fec_ptp_enable_pps(struct fec * NSEC_PER_SEC - ts.tv_nsec. Add the remaining nanoseconds * to current timer would be next second. */ - tempval =3D readl(fep->hwp + FEC_ATIME_CTRL); - tempval |=3D FEC_T_CTRL_CAPTURE; - writel(tempval, fep->hwp + FEC_ATIME_CTRL); - - tempval =3D readl(fep->hwp + FEC_ATIME); + tempval =3D fep->cc.read(&fep->cc); /* Convert the ptp local counter to 1588 timestamp */ ns =3D timecounter_cyc2time(&fep->tc, tempval); ts =3D ns_to_timespec64(ns); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51DDFC32772 for ; Tue, 23 Aug 2022 09:08:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348197AbiHWJI2 (ORCPT ); Tue, 23 Aug 2022 05:08:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347950AbiHWJHF (ORCPT ); Tue, 23 Aug 2022 05:07:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F5BC8606E; Tue, 23 Aug 2022 01:30:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F0426614BC; Tue, 23 Aug 2022 08:30:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05FFEC433C1; Tue, 23 Aug 2022 08:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243404; bh=tOxOsK6iWiCcwAk/an/4W+NYxsrfjp2xKkg+Fes1HWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e2YNm4UZCBfTZmyu82jivPXApSFFjXCOzlcv8LP0nDC22XH+EOAi2JxKi7HdebtWx JLyY+x4cHwBNWBl+UrUVCq0vJTnWn2rYI0O1KFnXuDXo9cw4RDVPB/OlXE49W6DMCA NMzyuwORV5iBk/XZsHm4dfocaUK+K8019/6XasME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Holland , Krzysztof Kozlowski , Maxime Ripard Subject: [PATCH 5.19 236/365] dt-bindings: display: sun4i: Add D1 TCONs to conditionals Date: Tue, 23 Aug 2022 10:02:17 +0200 Message-Id: <20220823080128.110651267@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland commit 2a29f80e155a9cf40ca8b6648bcdc8422db4c4e4 upstream. When adding the D1 TCON bindings, I missed the conditional blocks that restrict the binding for TCON LCD vs TCON TV hardware. Add the D1 TCON variants to the appropriate blocks for DE2 TCON LCDs and TCON TVs. Fixes: ae5a5d26c15c ("dt-bindings: display: Add D1 display engine compatibl= es") Signed-off-by: Samuel Holland Acked-by: Krzysztof Kozlowski Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/20220812073702.57618-1-samuel@sholland.org Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- .../devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-= tcon.yaml b/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-t= con.yaml index 4a92a4c7dcd7..f8168986a0a9 100644 --- a/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.ya= ml +++ b/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.ya= ml @@ -233,6 +233,7 @@ allOf: - allwinner,sun8i-a83t-tcon-lcd - allwinner,sun8i-v3s-tcon - allwinner,sun9i-a80-tcon-lcd + - allwinner,sun20i-d1-tcon-lcd =20 then: properties: @@ -252,6 +253,7 @@ allOf: - allwinner,sun8i-a83t-tcon-tv - allwinner,sun8i-r40-tcon-tv - allwinner,sun9i-a80-tcon-tv + - allwinner,sun20i-d1-tcon-tv =20 then: properties: @@ -278,6 +280,7 @@ allOf: - allwinner,sun9i-a80-tcon-lcd - allwinner,sun4i-a10-tcon - allwinner,sun8i-a83t-tcon-lcd + - allwinner,sun20i-d1-tcon-lcd =20 then: required: @@ -294,6 +297,7 @@ allOf: - allwinner,sun8i-a23-tcon - allwinner,sun8i-a33-tcon - allwinner,sun8i-a83t-tcon-lcd + - allwinner,sun20i-d1-tcon-lcd =20 then: properties: --=20 2.37.2 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9946DC38147 for ; Tue, 23 Aug 2022 09:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349460AbiHWJMZ (ORCPT ); Tue, 23 Aug 2022 05:12:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348451AbiHWJKF (ORCPT ); Tue, 23 Aug 2022 05:10:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE92027CD3; Tue, 23 Aug 2022 01:30:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A4F4DB81C59; Tue, 23 Aug 2022 08:30:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13D17C433D7; Tue, 23 Aug 2022 08:30:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243407; bh=Ivg1RtIfWpntWqpOEmsfcxyH9dZBFGT8p91JPEwm8JI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AJFrLPCEN4RTCkHHHHEAIn2vBino/fV9pjD+aGM3go1zjZx8hM5WKO9jn+/PsFUhc 0X1SSU/EncmTgXuiMyZKS0leQmJqvO4kqzMAM2HwA7fbpcSSHHMfo6xImjq3vfxpX6 4jHpLy3XcuBd6QamJAO1KDuz0pdMcIskbrsRC+70= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Andy Shevchenko , Jakub Kicinski Subject: [PATCH 5.19 237/365] stmmac: intel: Add a missing clk_disable_unprepare() call in intel_eth_pci_remove() Date: Tue, 23 Aug 2022 10:02:18 +0200 Message-Id: <20220823080128.152003986@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET commit 5c23d6b717e4e956376f3852b90f58e262946b50 upstream. Commit 09f012e64e4b ("stmmac: intel: Fix clock handling on error and remove paths") removed this clk_disable_unprepare() This was partly revert by commit ac322f86b56c ("net: stmmac: Fix clock handling on remove path") which removed this clk_disable_unprepare() because: " While unloading the dwmac-intel driver, clk_disable_unprepare() is being called twice in stmmac_dvr_remove() and intel_eth_pci_remove(). This causes kernel panic on the second call. " However later on, commit 5ec55823438e8 ("net: stmmac: add clocks management for gmac driver") has updated stmmac_dvr_remove() which do not call clk_disable_unprepare() anymore. So this call should now be called from intel_eth_pci_remove(). Fixes: 5ec55823438e8 ("net: stmmac: add clocks management for gmac driver") Signed-off-by: Christophe JAILLET Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/d7c8c1dadf40df3a7c9e643f76ffadd0ccc1ad1b.16= 60659689.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -1104,6 +1104,7 @@ static void intel_eth_pci_remove(struct =20 stmmac_dvr_remove(&pdev->dev); =20 + clk_disable_unprepare(priv->plat->stmmac_clk); clk_unregister_fixed_rate(priv->plat->stmmac_clk); =20 pcim_iounmap_regions(pdev, BIT(0)); From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B285C32772 for ; Tue, 23 Aug 2022 09:09:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348275AbiHWJJG (ORCPT ); Tue, 23 Aug 2022 05:09:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241141AbiHWJH0 (ORCPT ); Tue, 23 Aug 2022 05:07:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA62885AA6; Tue, 23 Aug 2022 01:30:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 548DB61475; Tue, 23 Aug 2022 08:30:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 503F2C433C1; Tue, 23 Aug 2022 08:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243410; bh=n+BPvUXVGcOTdQkyt06QT3mIsOQqk3T3tkWc03etIM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FKzBfhGLsLGf7q7/w9AS+3DmLOC9jz43NSpaY1ub+1/i3yMGhrMyp4BSH452VxJIB qwQw7Y/thM/RoPndrmqtGKr3fIb0gWWvF54Z1xuR6L8WeuBtI1DJlBKdi7E8mXRHXq BGPXQpaQxYFNmgq3IqL7BrK3fv92sw/wGXFNEcT8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Ma , Konrad Jankowski , Tony Nguyen , Jakub Kicinski Subject: [PATCH 5.19 238/365] igb: Add lock to avoid data race Date: Tue, 23 Aug 2022 10:02:19 +0200 Message-Id: <20220823080128.191087768@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lin Ma commit 6faee3d4ee8be0f0367d0c3d826afb3571b7a5e0 upstream. The commit c23d92b80e0b ("igb: Teardown SR-IOV before unregister_netdev()") places the unregister_netdev() call after the igb_disable_sriov() call to avoid functionality issue. However, it introduces several race conditions when detaching a device. For example, when .remove() is called, the below interleaving leads to use-after-free. (FREE from device detaching) | (USE from netdev core) igb_remove | igb_ndo_get_vf_config igb_disable_sriov | vf >=3D adapter->vfs_allocated_count? kfree(adapter->vf_data) | adapter->vfs_allocated_count =3D 0 | | memcpy(... adapter->vf_data[vf] Moreover, the igb_disable_sriov() also suffers from data race with the requests from VF driver. (FREE from device detaching) | (USE from requests) igb_remove | igb_msix_other igb_disable_sriov | igb_msg_task kfree(adapter->vf_data) | vf < adapter->vfs_allocated_count adapter->vfs_allocated_count =3D 0 | To this end, this commit first eliminates the data races from netdev core by using rtnl_lock (similar to commit 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")). And then adds a spinlock to eliminate races from driver requests. (similar to commit 1e53834ce541 ("ixgbe: Add locking to prevent panic when setting sriov_numvfs to zero") Fixes: c23d92b80e0b ("igb: Teardown SR-IOV before unregister_netdev()") Signed-off-by: Lin Ma Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Link: https://lore.kernel.org/r/20220817184921.735244-1-anthony.l.nguyen@in= tel.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/intel/igb/igb.h | 2 ++ drivers/net/ethernet/intel/igb/igb_main.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h @@ -664,6 +664,8 @@ struct igb_adapter { struct igb_mac_addr *mac_table; struct vf_mac_filter vf_macs; struct vf_mac_filter *vf_mac_list; + /* lock for VF resources */ + spinlock_t vfs_lock; }; =20 /* flags controlling PTP/1588 function */ --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -3637,6 +3637,7 @@ static int igb_disable_sriov(struct pci_ struct net_device *netdev =3D pci_get_drvdata(pdev); struct igb_adapter *adapter =3D netdev_priv(netdev); struct e1000_hw *hw =3D &adapter->hw; + unsigned long flags; =20 /* reclaim resources allocated to VFs */ if (adapter->vf_data) { @@ -3649,12 +3650,13 @@ static int igb_disable_sriov(struct pci_ pci_disable_sriov(pdev); msleep(500); } - + spin_lock_irqsave(&adapter->vfs_lock, flags); kfree(adapter->vf_mac_list); adapter->vf_mac_list =3D NULL; kfree(adapter->vf_data); adapter->vf_data =3D NULL; adapter->vfs_allocated_count =3D 0; + spin_unlock_irqrestore(&adapter->vfs_lock, flags); wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ); wrfl(); msleep(100); @@ -3814,7 +3816,9 @@ static void igb_remove(struct pci_dev *p igb_release_hw_control(adapter); =20 #ifdef CONFIG_PCI_IOV + rtnl_lock(); igb_disable_sriov(pdev); + rtnl_unlock(); #endif =20 unregister_netdev(netdev); @@ -3974,6 +3978,9 @@ static int igb_sw_init(struct igb_adapte =20 spin_lock_init(&adapter->nfc_lock); spin_lock_init(&adapter->stats64_lock); + + /* init spinlock to avoid concurrency of VF resources */ + spin_lock_init(&adapter->vfs_lock); #ifdef CONFIG_PCI_IOV switch (hw->mac.type) { case e1000_82576: @@ -7924,8 +7931,10 @@ unlock: static void igb_msg_task(struct igb_adapter *adapter) { struct e1000_hw *hw =3D &adapter->hw; + unsigned long flags; u32 vf; =20 + spin_lock_irqsave(&adapter->vfs_lock, flags); for (vf =3D 0; vf < adapter->vfs_allocated_count; vf++) { /* process any reset requests */ if (!igb_check_for_rst(hw, vf)) @@ -7939,6 +7948,7 @@ static void igb_msg_task(struct igb_adap if (!igb_check_for_ack(hw, vf)) igb_rcv_ack_from_vf(adapter, vf); } + spin_unlock_irqrestore(&adapter->vfs_lock, flags); } =20 /** From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADA8CC32772 for ; Tue, 23 Aug 2022 09:29:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350256AbiHWJ3L (ORCPT ); Tue, 23 Aug 2022 05:29:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350817AbiHWJ0X (ORCPT ); Tue, 23 Aug 2022 05:26:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF26C760DB; Tue, 23 Aug 2022 01:36:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0600CB81C53; Tue, 23 Aug 2022 08:30:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ACCEC433D6; Tue, 23 Aug 2022 08:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243413; bh=gpZlTkMgtQZhjdaTnXjvpPHUJqnBmdmQfvXUs6qO6OE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QcZidmmsrMychWtAdN86heOZaWGnMraMLhG/FZxDE7W4cF65y3vL0QC79+jw7w4Kp pLwn0XQYJokSbpVrrP/wRwGtrDPtsJDFcBah/5azFcudTCtE5e6logtR6C51I/VODG WgZOZSZzMnTeL4SapwhdfyzGp+DafSdrFvgeklyY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada Subject: [PATCH 5.19 239/365] kbuild: fix the modules order between drivers and libs Date: Tue, 23 Aug 2022 10:02:20 +0200 Message-Id: <20220823080128.240505129@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Masahiro Yamada commit 113147510b48e764e624e3d0e6707a1e48bc05a9 upstream. Commit b2c885549122 ("kbuild: update modules.order only when contained modules are updated") accidentally changed the modules order. Prior to that commit, the modules order was determined based on vmlinux-dirs, which lists core-y/m, drivers-y/m, libs-y/m, in this order. Now, subdir-modorder lists them in a different order: core-y/m, libs-y/m, drivers-y/m. Presumably, there was no practical issue because the modules in drivers and libs are orthogonal, but there is no reason to have this distortion. Get back to the original order. Fixes: b2c885549122 ("kbuild: update modules.order only when contained modu= les are updated") Signed-off-by: Masahiro Yamada Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/Makefile +++ b/Makefile @@ -1112,13 +1112,11 @@ vmlinux-alldirs :=3D $(sort $(vmlinux-dirs $(patsubst %/,%,$(filter %/, $(core-) \ $(drivers-) $(libs-)))) =20 -subdir-modorder :=3D $(addsuffix modules.order,$(filter %/, \ - $(core-y) $(core-m) $(libs-y) $(libs-m) \ - $(drivers-y) $(drivers-m))) - build-dirs :=3D $(vmlinux-dirs) clean-dirs :=3D $(vmlinux-alldirs) =20 +subdir-modorder :=3D $(addsuffix /modules.order, $(build-dirs)) + # Externally visible symbols (used by link-vmlinux.sh) KBUILD_VMLINUX_OBJS :=3D $(head-y) $(patsubst %/,%/built-in.a, $(core-y)) KBUILD_VMLINUX_OBJS +=3D $(addsuffix built-in.a, $(filter %/, $(libs-y))) From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E315CC32772 for ; Tue, 23 Aug 2022 09:14:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349028AbiHWJOB (ORCPT ); Tue, 23 Aug 2022 05:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348898AbiHWJK6 (ORCPT ); Tue, 23 Aug 2022 05:10:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDA9E86B43; Tue, 23 Aug 2022 01:31:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 57F2761326; Tue, 23 Aug 2022 08:30:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58274C4314D; Tue, 23 Aug 2022 08:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243416; bh=Qw+d+/VKR/3tf8cGqOyLTcfDcvAdxqWIDNIFMCNbGE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rrwWPNcdLXELGSFESNQDCoqOPEWaaqC3/hQKoeHe80lJRPEYO8L4W/cPD9Ehd6cNy Is9jVyyQCqsq9qZWXppzL/LudWkl1JTuEKw8sPfs3LNKWvg2tAWLYNOZlyTawiDqW3 oXglYfn9NjzHHBmHtO9z45mziVCspkmxULoUMNI8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yury Norov , Erhard Furtner , Andrew Donnellan , Kees Cook Subject: [PATCH 5.19 240/365] gcc-plugins: Undefine LATENT_ENTROPY_PLUGIN when plugin disabled for a file Date: Tue, 23 Aug 2022 10:02:21 +0200 Message-Id: <20220823080128.283615356@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrew Donnellan commit 012e8d2034f1bda8863435cd589636e618d6a659 upstream. Commit 36d4b36b6959 ("lib/nodemask: inline next_node_in() and node_random()") refactored some code by moving node_random() from lib/nodemask.c to include/linux/nodemask.h, thus requiring nodemask.h to include random.h, which conditionally defines add_latent_entropy() depending on whether the macro LATENT_ENTROPY_PLUGIN is defined. This broke the build on powerpc, where nodemask.h is indirectly included in arch/powerpc/kernel/prom_init.c, part of the early boot machinery that is excluded from the latent entropy plugin using DISABLE_LATENT_ENTROPY_PLUGIN. It turns out that while we add a gcc flag to disable the actual plugin, we don't undefine LATENT_ENTROPY_PLUGIN. This leads to the following: CC arch/powerpc/kernel/prom_init.o In file included from ./include/linux/nodemask.h:97, from ./include/linux/mmzone.h:17, from ./include/linux/gfp.h:7, from ./include/linux/xarray.h:15, from ./include/linux/radix-tree.h:21, from ./include/linux/idr.h:15, from ./include/linux/kernfs.h:12, from ./include/linux/sysfs.h:16, from ./include/linux/kobject.h:20, from ./include/linux/pci.h:35, from arch/powerpc/kernel/prom_init.c:24: ./include/linux/random.h: In function 'add_latent_entropy': ./include/linux/random.h:25:46: error: 'latent_entropy' undeclared (first= use in this function); did you mean 'add_latent_entropy'? 25 | add_device_randomness((const void *)&latent_entropy, size= of(latent_entropy)); | ^~~~~~~~~~~~~~ | add_latent_entropy ./include/linux/random.h:25:46: note: each undeclared identifier is repor= ted only once for each function it appears in make[2]: *** [scripts/Makefile.build:249: arch/powerpc/kernel/prom_init.o= ] Fehler 1 make[1]: *** [scripts/Makefile.build:465: arch/powerpc/kernel] Fehler 2 make: *** [Makefile:1855: arch/powerpc] Error 2 Change the DISABLE_LATENT_ENTROPY_PLUGIN flags to undefine LATENT_ENTROPY_PLUGIN for files where the plugin is disabled. Cc: Yury Norov Fixes: 38addce8b600 ("gcc-plugins: Add latent_entropy plugin") Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216367 Link: https://lore.kernel.org/linuxppc-dev/alpine.DEB.2.22.394.220815200632= 0.289321@ramsan.of.borg/ Reported-by: Erhard Furtner Signed-off-by: Andrew Donnellan Reviewed-by: Yury Norov Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220816051720.44108-1-ajd@linux.ibm.com Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- scripts/Makefile.gcc-plugins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/scripts/Makefile.gcc-plugins +++ b/scripts/Makefile.gcc-plugins @@ -4,7 +4,7 @@ gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_EN gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) \ +=3D -DLATENT_ENTROPY_PLUGIN ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY - DISABLE_LATENT_ENTROPY_PLUGIN +=3D -fplugin-arg-latent_entropy_plugin-= disable + DISABLE_LATENT_ENTROPY_PLUGIN +=3D -fplugin-arg-latent_entropy_plugin-= disable -ULATENT_ENTROPY_PLUGIN endif export DISABLE_LATENT_ENTROPY_PLUGIN From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEFFDC32772 for ; Tue, 23 Aug 2022 09:08:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240725AbiHWJIU (ORCPT ); Tue, 23 Aug 2022 05:08:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347930AbiHWJG5 (ORCPT ); Tue, 23 Aug 2022 05:06:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 457BB83F1C; Tue, 23 Aug 2022 01:30:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C07D8B81C4D; Tue, 23 Aug 2022 08:28:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 234CAC433D6; Tue, 23 Aug 2022 08:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243322; bh=ou72801z8mN71VTlq2a6SZCJ4zfndl7r4LyeKMh+suU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0vYkN+9ES34B8KQE21bpiZ04ONYTuAharV2cJVAHq4JyXreOkWHNjmPcSaDRZKole Apds4kGt8rz2EimGUg4wi2H5zbfM8J+KUV/dnl77bKxeSthkorN6whkRN+vk/+Hk13 vwLQpZj6Ezjd/aDa0W0lrDHpQs8s9reEKKZOkr7g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fedor Pchelkin , Alexey Khoroshilov , Oleksij Rempel , Marc Kleine-Budde Subject: [PATCH 5.19 241/365] can: j1939: j1939_sk_queue_activate_next_locked(): replace WARN_ON_ONCE with netdev_warn_once() Date: Tue, 23 Aug 2022 10:02:22 +0200 Message-Id: <20220823080128.319300150@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fedor Pchelkin commit 8ef49f7f8244424adcf4a546dba4cbbeb0b09c09 upstream. We should warn user-space that it is doing something wrong when trying to activate sessions with identical parameters but WARN_ON_ONCE macro can not be used here as it serves a different purpose. So it would be good to replace it with netdev_warn_once() message. Found by Linux Verification Center (linuxtesting.org) with Syzkaller. Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol") Signed-off-by: Fedor Pchelkin Signed-off-by: Alexey Khoroshilov Acked-by: Oleksij Rempel Link: https://lore.kernel.org/all/20220729143655.1108297-1-pchelkin@ispras.= ru [mkl: fix indention] Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- net/can/j1939/socket.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/net/can/j1939/socket.c +++ b/net/can/j1939/socket.c @@ -178,7 +178,10 @@ activate_next: if (!first) return; =20 - if (WARN_ON_ONCE(j1939_session_activate(first))) { + if (j1939_session_activate(first)) { + netdev_warn_once(first->priv->ndev, + "%s: 0x%p: Identical session is already activated.\n", + __func__, first); first->err =3D -EBUSY; goto activate_next; } else { From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E803BC32772 for ; Tue, 23 Aug 2022 09:06:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347260AbiHWJGf (ORCPT ); Tue, 23 Aug 2022 05:06:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347967AbiHWJFe (ORCPT ); Tue, 23 Aug 2022 05:05:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E52385ABB; Tue, 23 Aug 2022 01:29:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3B99E6148F; Tue, 23 Aug 2022 08:28:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45250C433D6; Tue, 23 Aug 2022 08:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243325; bh=mfXabLGDY9gETB+b3ZUJCxSsB/UQoJhhDwkWQHOl0eE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HMb7UOJgHW5hnszlSjkSP1gty1Mu0OL2TtrHmA4xRi/qM6iGoq8X8/KwpSXL2Gz9V 7JTkDbU94yQ+HzHTtBEz8vSkLzJ5APqeWASm21KXS4l/lJNn2mY21ThWDJsmq6Mi62 QlH5eShxHLdbmi9UxxHwe6LSYYZ5nCGKOac0hHUM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurentiu Palcu , Laurent Pinchart , Sasha Levin Subject: [PATCH 5.19 242/365] drm/imx/dcss: get rid of HPD warning message Date: Tue, 23 Aug 2022 10:02:23 +0200 Message-Id: <20220823080128.356688743@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Laurentiu Palcu [ Upstream commit 30bdc36b8c776cd4fce5de2a96ff28b37f96942f ] When DCSS + MIPI_DSI is used, and the last bridge in the chain supports HPD, we can see a "Hot plug detection already enabled" warning stack trace dump that's thrown when DCSS is initialized. The problem appeared when HPD was enabled by default in the bridge_connector initialization, which made the drm_bridge_connector_enable_hpd() call, in DCSS init path, redundant. So, let's remove that call. Fixes: 09077bc311658 ("drm/bridge_connector: enable HPD by default if suppo= rted") Signed-off-by: Laurentiu Palcu Reviewed-by: Laurent Pinchart Link: https://patchwork.freedesktop.org/patch/msgid/20220721120912.6639-1-l= aurentiu.palcu@oss.nxp.com Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/imx/dcss/dcss-kms.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/imx/dcss/dcss-kms.c b/drivers/gpu/drm/imx/dcss= /dcss-kms.c index 9b84df34a6a1..8cf3352d8858 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-kms.c +++ b/drivers/gpu/drm/imx/dcss/dcss-kms.c @@ -142,8 +142,6 @@ struct dcss_kms_dev *dcss_kms_attach(struct dcss_dev *d= css) =20 drm_kms_helper_poll_init(drm); =20 - drm_bridge_connector_enable_hpd(kms->connector); - ret =3D drm_dev_register(drm, 0); if (ret) goto cleanup_crtc; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8ECF3C32792 for ; Tue, 23 Aug 2022 09:07:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241067AbiHWJHY (ORCPT ); Tue, 23 Aug 2022 05:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240664AbiHWJGB (ORCPT ); Tue, 23 Aug 2022 05:06:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCF6885F83; Tue, 23 Aug 2022 01:29:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E5042B81C55; Tue, 23 Aug 2022 08:28:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52295C433D6; Tue, 23 Aug 2022 08:28:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243328; bh=K7ahQAN1O3DYTL9J9OrKOMX8MgIAfw6ui3rxdDEwoMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qcNwR7KMhVgi9bQg89hKUo46GlDe9ZWAuhKlot2AgtZ5tnpwXYkkdDWO5EBvLMcjh zXaWllFuq27xLiDgM2NwFf6ap3UROE1Pr+FN1avAFnACHwpgG/g95bcRNanKAxQbrx cnM4Bnn4KGROI1yBgMpcq/Pqkugi7vkWAfwEhhvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.19 243/365] drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors() Date: Tue, 23 Aug 2022 10:02:24 +0200 Message-Id: <20220823080128.399413304@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 91b3c8dbe898df158fd2a84675f3a284ff6666f7 ] In this function, there are two refcount leak bugs: (1) when breaking out of for_each_endpoint_of_node(), we need call the of_node_put() for the 'ep'; (2) we should call of_node_put() for the reference returned by of_graph_get_remote_port() when it is not used anymore. Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller= ") Signed-off-by: Liang He Acked-by: Martin Blumenstingl Acked-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220726010722.1319416-= 1-windhl@126.com Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/meson/meson_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meso= n_drv.c index 1b70938cfd2c..bd4ca11d3ff5 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -115,8 +115,11 @@ static bool meson_vpu_has_available_connectors(struct = device *dev) for_each_endpoint_of_node(dev->of_node, ep) { /* If the endpoint node exists, consider it enabled */ remote =3D of_graph_get_remote_port(ep); - if (remote) + if (remote) { + of_node_put(remote); + of_node_put(ep); return true; + } } =20 return false; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F2BCC32772 for ; Tue, 23 Aug 2022 09:48:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236033AbiHWJsl (ORCPT ); Tue, 23 Aug 2022 05:48:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352245AbiHWJqG (ORCPT ); Tue, 23 Aug 2022 05:46:06 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D0E86050A; Tue, 23 Aug 2022 01:43:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 96C79CE1B41; Tue, 23 Aug 2022 08:28:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B33A0C433D6; Tue, 23 Aug 2022 08:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243332; bh=j1xQ+IIYNGAXrtO8PnOzFliezrN84TmBv/RgoyfbKOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I03ve2DhgVglL7mwGz0DlcrplVEzpozn0C6ObDpiYyOd/UM75hGhXetivz95wyRuN HMNV8kZGkWzIsmWF9hAUuCry1C+qjLh7rRSVno2aEgs5gLnH3fQ4XzqnyWXLMJPsKW bKOWUQDVtovFHjXAsiOx/CY1ETkEyX/VVHQ9wzoo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Auld , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Ramalingam C , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.19 244/365] drm/i915/ttm: dont leak the ccs state Date: Tue, 23 Aug 2022 10:02:25 +0200 Message-Id: <20220823080128.429516312@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Auld [ Upstream commit 232d150fa15606e96c0e01e5c7a2d4e03f621787 ] The kernel only manages the ccs state with lmem-only objects, however the kernel should still take care not to leak the CCS state from the previous user. Fixes: 48760ffe923a ("drm/i915/gt: Clear compress metadata for Flat-ccs obj= ects") Signed-off-by: Matthew Auld Cc: Thomas Hellstr=C3=B6m Cc: Ramalingam C Reviewed-by: Ramalingam C Link: https://patchwork.freedesktop.org/patch/msgid/20220727164346.282407-1= -matthew.auld@intel.com (cherry picked from commit 353819d85f87be46aeb9c1dd929d445a006fc6ec) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/i915/gt/intel_migrate.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c b/drivers/gpu/drm/i915= /gt/intel_migrate.c index 2c35324b5f68..2b10b96b17b5 100644 --- a/drivers/gpu/drm/i915/gt/intel_migrate.c +++ b/drivers/gpu/drm/i915/gt/intel_migrate.c @@ -708,7 +708,7 @@ intel_context_migrate_copy(struct intel_context *ce, u8 src_access, dst_access; struct i915_request *rq; int src_sz, dst_sz; - bool ccs_is_src; + bool ccs_is_src, overwrite_ccs; int err; =20 GEM_BUG_ON(ce->vm !=3D ce->engine->gt->migrate.context->vm); @@ -749,6 +749,8 @@ intel_context_migrate_copy(struct intel_context *ce, get_ccs_sg_sgt(&it_ccs, bytes_to_cpy); } =20 + overwrite_ccs =3D HAS_FLAT_CCS(i915) && !ccs_bytes_to_cpy && dst_is_lmem; + src_offset =3D 0; dst_offset =3D CHUNK_SZ; if (HAS_64K_PAGES(ce->engine->i915)) { @@ -852,6 +854,25 @@ intel_context_migrate_copy(struct intel_context *ce, if (err) goto out_rq; ccs_bytes_to_cpy -=3D ccs_sz; + } else if (overwrite_ccs) { + err =3D rq->engine->emit_flush(rq, EMIT_INVALIDATE); + if (err) + goto out_rq; + + /* + * While we can't always restore/manage the CCS state, + * we still need to ensure we don't leak the CCS state + * from the previous user, so make sure we overwrite it + * with something. + */ + err =3D emit_copy_ccs(rq, dst_offset, INDIRECT_ACCESS, + dst_offset, DIRECT_ACCESS, len); + if (err) + goto out_rq; + + err =3D rq->engine->emit_flush(rq, EMIT_INVALIDATE); + if (err) + goto out_rq; } =20 /* Arbitration is re-enabled between requests. */ --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BC8DC32772 for ; Tue, 23 Aug 2022 09:08:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348254AbiHWJIo (ORCPT ); Tue, 23 Aug 2022 05:08:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240955AbiHWJHZ (ORCPT ); Tue, 23 Aug 2022 05:07:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F04E0861CF; Tue, 23 Aug 2022 01:30:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C8113B81C57; Tue, 23 Aug 2022 08:28:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2347DC433B5; Tue, 23 Aug 2022 08:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243335; bh=HoReviJIiaDBHeMOZIQuLCNx7ec42U1K2fgXMEpQAJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U2DlweHaW+6laPOoM5SRVZ4xH8IjS2KR4jVjN/UbHgk/6sez4XrxCeO5S8Y7DaVD+ 78tDeGJKbwQVJTRyaVQcTtbSFN7RWxHRPfmo19kl+f6IFnL+neZsMXFafF45FDNdmO dT0A7yQDX+tqYNI5smt2bwNDjGXNSbbXZS9cqa5k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lijo Lazar , Hawking Zhang , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 245/365] drm/amdgpu: Avoid another list of reset devices Date: Tue, 23 Aug 2022 10:02:26 +0200 Message-Id: <20220823080128.470688262@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lijo Lazar [ Upstream commit 0a83bb35d8a6ff3d18c2772afe616780c23293a6 ] A list of devices to be reset is already created in amdgpu_device_gpu_recover function. Creating another list with the same nodes is incorrect and not supported in list_head. Instead, pass the device list as part of reset context. Fixes: 9e08564727fc (drm/amdgpu: Refactor mode2 reset logic for v13.0.2) Signed-off-by: Lijo Lazar Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/aldebaran.c | 45 +++++++--------------- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h | 1 + 3 files changed, 17 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/aldebaran.c b/drivers/gpu/drm/amd/a= mdgpu/aldebaran.c index c6cc493a5486..2b97b8a96fb4 100644 --- a/drivers/gpu/drm/amd/amdgpu/aldebaran.c +++ b/drivers/gpu/drm/amd/amdgpu/aldebaran.c @@ -148,30 +148,22 @@ aldebaran_mode2_perform_reset(struct amdgpu_reset_con= trol *reset_ctl, struct amdgpu_reset_context *reset_context) { struct amdgpu_device *adev =3D (struct amdgpu_device *)reset_ctl->handle; + struct list_head *reset_device_list =3D reset_context->reset_device_list; struct amdgpu_device *tmp_adev =3D NULL; - struct list_head reset_device_list; int r =3D 0; =20 dev_dbg(adev->dev, "aldebaran perform hw reset\n"); + + if (reset_device_list =3D=3D NULL) + return -EINVAL; + if (adev->ip_versions[MP1_HWIP][0] =3D=3D IP_VERSION(13, 0, 2) && reset_context->hive =3D=3D NULL) { /* Wrong context, return error */ return -EINVAL; } =20 - INIT_LIST_HEAD(&reset_device_list); - if (reset_context->hive) { - list_for_each_entry (tmp_adev, - &reset_context->hive->device_list, - gmc.xgmi.head) - list_add_tail(&tmp_adev->reset_list, - &reset_device_list); - } else { - list_add_tail(&reset_context->reset_req_dev->reset_list, - &reset_device_list); - } - - list_for_each_entry (tmp_adev, &reset_device_list, reset_list) { + list_for_each_entry(tmp_adev, reset_device_list, reset_list) { mutex_lock(&tmp_adev->reset_cntl->reset_lock); tmp_adev->reset_cntl->active_reset =3D AMD_RESET_METHOD_MODE2; } @@ -179,7 +171,7 @@ aldebaran_mode2_perform_reset(struct amdgpu_reset_contr= ol *reset_ctl, * Mode2 reset doesn't need any sync between nodes in XGMI hive, instead = launch * them together so that they can be completed asynchronously on multiple= nodes */ - list_for_each_entry (tmp_adev, &reset_device_list, reset_list) { + list_for_each_entry(tmp_adev, reset_device_list, reset_list) { /* For XGMI run all resets in parallel to speed up the process */ if (tmp_adev->gmc.xgmi.num_physical_nodes > 1) { if (!queue_work(system_unbound_wq, @@ -197,7 +189,7 @@ aldebaran_mode2_perform_reset(struct amdgpu_reset_contr= ol *reset_ctl, =20 /* For XGMI wait for all resets to complete before proceed */ if (!r) { - list_for_each_entry (tmp_adev, &reset_device_list, reset_list) { + list_for_each_entry(tmp_adev, reset_device_list, reset_list) { if (tmp_adev->gmc.xgmi.num_physical_nodes > 1) { flush_work(&tmp_adev->reset_cntl->reset_work); r =3D tmp_adev->asic_reset_res; @@ -207,7 +199,7 @@ aldebaran_mode2_perform_reset(struct amdgpu_reset_contr= ol *reset_ctl, } } =20 - list_for_each_entry (tmp_adev, &reset_device_list, reset_list) { + list_for_each_entry(tmp_adev, reset_device_list, reset_list) { mutex_unlock(&tmp_adev->reset_cntl->reset_lock); tmp_adev->reset_cntl->active_reset =3D AMD_RESET_METHOD_NONE; } @@ -339,10 +331,13 @@ static int aldebaran_mode2_restore_hwcontext(struct amdgpu_reset_control *reset_ctl, struct amdgpu_reset_context *reset_context) { + struct list_head *reset_device_list =3D reset_context->reset_device_list; struct amdgpu_device *tmp_adev =3D NULL; - struct list_head reset_device_list; int r; =20 + if (reset_device_list =3D=3D NULL) + return -EINVAL; + if (reset_context->reset_req_dev->ip_versions[MP1_HWIP][0] =3D=3D IP_VERSION(13, 0, 2) && reset_context->hive =3D=3D NULL) { @@ -350,19 +345,7 @@ aldebaran_mode2_restore_hwcontext(struct amdgpu_reset_= control *reset_ctl, return -EINVAL; } =20 - INIT_LIST_HEAD(&reset_device_list); - if (reset_context->hive) { - list_for_each_entry (tmp_adev, - &reset_context->hive->device_list, - gmc.xgmi.head) - list_add_tail(&tmp_adev->reset_list, - &reset_device_list); - } else { - list_add_tail(&reset_context->reset_req_dev->reset_list, - &reset_device_list); - } - - list_for_each_entry (tmp_adev, &reset_device_list, reset_list) { + list_for_each_entry(tmp_adev, reset_device_list, reset_list) { dev_info(tmp_adev->dev, "GPU reset succeeded, trying to resume\n"); r =3D aldebaran_mode2_restore_ip(tmp_adev); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/a= md/amdgpu/amdgpu_device.c index 58df107e3beb..3adebb63680e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -4746,6 +4746,8 @@ int amdgpu_do_asic_reset(struct list_head *device_lis= t_handle, tmp_adev =3D list_first_entry(device_list_handle, struct amdgpu_device, reset_list); amdgpu_reset_reg_dumps(tmp_adev); + + reset_context->reset_device_list =3D device_list_handle; r =3D amdgpu_reset_perform_reset(tmp_adev, reset_context); /* If reset handler not implemented, continue; otherwise return */ if (r =3D=3D -ENOSYS) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h b/drivers/gpu/drm/am= d/amdgpu/amdgpu_reset.h index 1949dbe28a86..0c3ad85d84a4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h @@ -37,6 +37,7 @@ struct amdgpu_reset_context { struct amdgpu_device *reset_req_dev; struct amdgpu_job *job; struct amdgpu_hive_info *hive; + struct list_head *reset_device_list; unsigned long flags; }; =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58ED4C32792 for ; Tue, 23 Aug 2022 09:07:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347670AbiHWJHz (ORCPT ); Tue, 23 Aug 2022 05:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346279AbiHWJGf (ORCPT ); Tue, 23 Aug 2022 05:06:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC93185F9B; Tue, 23 Aug 2022 01:29:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D33BE614C2; Tue, 23 Aug 2022 08:28:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8C2CC433D6; Tue, 23 Aug 2022 08:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243338; bh=P3egnqUA6ktWyvgwGA+OKZtXZmA0Wg8B7BsVUmsHoUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0sqMs1IWECNXUVTNltDtq3Yq9aA0N75+Cis2sYghkAGYi3yVmGig3SNqpX58ux9f5 VcFk6nH1oQVf4iONanwANwM4SrHlhTCsKGKfKwsfBt9DMsnR9MJbcEk8g8wmGZ5EEe 8bSBADDFeyajfCHhXx8EUAAWDINUx6MU6MkEJUpg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Laurent Pinchart , Sam Ravnborg , Neil Armstrong , Sasha Levin Subject: [PATCH 5.19 246/365] drm/bridge: lvds-codec: Fix error checking of drm_of_lvds_get_data_mapping() Date: Tue, 23 Aug 2022 10:02:27 +0200 Message-Id: <20220823080128.500334591@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marek Vasut [ Upstream commit 2bba782002c5dab6ca8d608b778b386fb912adff ] The drm_of_lvds_get_data_mapping() returns either negative value on error or MEDIA_BUS_FMT_* otherwise. The check for 'ret' would also catch the positive case of MEDIA_BUS_FMT_* and lead to probe failure every time 'data-mapping' DT property is specified. Fixes: 7c4dd0a266527 ("drm: of: Add drm_of_lvds_get_data_mapping") Signed-off-by: Marek Vasut Cc: Laurent Pinchart Cc: Sam Ravnborg To: dri-devel@lists.freedesktop.org Reviewed-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220801125419.167562-1= -marex@denx.de Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/lvds-codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lvds-codec.c b/drivers/gpu/drm/bridge/l= vds-codec.c index 702ea803a743..39e7004de720 100644 --- a/drivers/gpu/drm/bridge/lvds-codec.c +++ b/drivers/gpu/drm/bridge/lvds-codec.c @@ -180,7 +180,7 @@ static int lvds_codec_probe(struct platform_device *pde= v) of_node_put(bus_node); if (ret =3D=3D -ENODEV) { dev_warn(dev, "missing 'data-mapping' DT property\n"); - } else if (ret) { + } else if (ret < 0) { dev_err(dev, "invalid 'data-mapping' DT property\n"); return ret; } else { --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 673D6C32772 for ; Tue, 23 Aug 2022 09:07:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240553AbiHWJHb (ORCPT ); Tue, 23 Aug 2022 05:07:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240382AbiHWJGN (ORCPT ); Tue, 23 Aug 2022 05:06:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C466185FE1; Tue, 23 Aug 2022 01:29:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B977FB81C58; Tue, 23 Aug 2022 08:29:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C82CC433D6; Tue, 23 Aug 2022 08:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243341; bh=BkWQsObRD0qHdiFNBqOcDLLUMiSRZ6gAZkju3pfvCZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JIuSCHcy9xkaEOYAgYkhuHnDug6Wx8v/TTtki0OciE2vDkkRcVgwjUgoaXl7b+ED+ l8DStnsE1d1YbsretWzuD2AAi7XRDaYPY9itLP5qaNdSOpE/5nEVtLqXbqBOrCDSXn FXcJTMj37Xq3oK8dMRn0dNYMG8I21KmY5lmZwDqo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Holland , Jernej Skrabec , Maxime Ripard , Sasha Levin Subject: [PATCH 5.19 247/365] drm/sun4i: dsi: Prevent underflow when computing packet sizes Date: Tue, 23 Aug 2022 10:02:28 +0200 Message-Id: <20220823080128.539277076@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit 82a1356a933d8443139f8886f11b63c974a09a67 ] Currently, the packet overhead is subtracted using unsigned arithmetic. With a short sync pulse, this could underflow and wrap around to near the maximal u16 value. Fix this by using signed subtraction. The call to max() will correctly handle any negative numbers that are produced. Apply the same fix to the other timings, even though those subtractions are less likely to underflow. Fixes: 133add5b5ad4 ("drm/sun4i: Add Allwinner A31 MIPI-DSI controller supp= ort") Signed-off-by: Samuel Holland Reviewed-by: Jernej Skrabec Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/20220812031623.34057-1-samuel@sholland.org Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i= /sun6i_mipi_dsi.c index b4dfa166eccd..34234a144e87 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -531,7 +531,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *d= si, struct drm_display_mode *mode) { struct mipi_dsi_device *device =3D dsi->device; - unsigned int Bpp =3D mipi_dsi_pixel_format_to_bpp(device->format) / 8; + int Bpp =3D mipi_dsi_pixel_format_to_bpp(device->format) / 8; u16 hbp =3D 0, hfp =3D 0, hsa =3D 0, hblk =3D 0, vblk =3D 0; u32 basic_ctl =3D 0; size_t bytes; @@ -555,7 +555,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *d= si, * (4 bytes). Its minimal size is therefore 10 bytes */ #define HSA_PACKET_OVERHEAD 10 - hsa =3D max((unsigned int)HSA_PACKET_OVERHEAD, + hsa =3D max(HSA_PACKET_OVERHEAD, (mode->hsync_end - mode->hsync_start) * Bpp - HSA_PACKET_OVERHEAD); =20 /* @@ -564,7 +564,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *d= si, * therefore 6 bytes */ #define HBP_PACKET_OVERHEAD 6 - hbp =3D max((unsigned int)HBP_PACKET_OVERHEAD, + hbp =3D max(HBP_PACKET_OVERHEAD, (mode->htotal - mode->hsync_end) * Bpp - HBP_PACKET_OVERHEAD); =20 /* @@ -574,7 +574,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *d= si, * 16 bytes */ #define HFP_PACKET_OVERHEAD 16 - hfp =3D max((unsigned int)HFP_PACKET_OVERHEAD, + hfp =3D max(HFP_PACKET_OVERHEAD, (mode->hsync_start - mode->hdisplay) * Bpp - HFP_PACKET_OVERHEAD); =20 /* @@ -583,7 +583,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *d= si, * bytes). Its minimal size is therefore 10 bytes. */ #define HBLK_PACKET_OVERHEAD 10 - hblk =3D max((unsigned int)HBLK_PACKET_OVERHEAD, + hblk =3D max(HBLK_PACKET_OVERHEAD, (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp - HBLK_PACKET_OVERHEAD); =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBD4EC32792 for ; Tue, 23 Aug 2022 09:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243720AbiHWJMq (ORCPT ); Tue, 23 Aug 2022 05:12:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348525AbiHWJKa (ORCPT ); Tue, 23 Aug 2022 05:10:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E22D86CF51; Tue, 23 Aug 2022 01:30:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F58E614C5; Tue, 23 Aug 2022 08:29:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E016C433D6; Tue, 23 Aug 2022 08:29:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243344; bh=+u7StSxrYGzH7Cn/hxGYZHiedHN3GtCGunx154eqRKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1euO1UfI8W/n4/AJK15B30Ex7MWYhK2VIyZ97x3bDuKgk5SeZTXzVrB4XNsyfvLzv OqG4HkOqsPaxU4QPgWn23qN2d3GV6kJxyQzD+B93KHiimkTXMGJSVmMl9wzsz9rmQB MBx27R91wu/MoQxlUj9H2fV22mv0kO9dsJPw47oc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikhail Gavrilov , =?UTF-8?q?Christian=20K=C3=B6nig?= , Melissa Wen , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 248/365] drm/amdgpu: Fix use-after-free on amdgpu_bo_list mutex Date: Tue, 23 Aug 2022 10:02:29 +0200 Message-Id: <20220823080128.578248859@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ma=C3=ADra Canal [ Upstream commit bbca24d0a3c11193bafb9e174f89f52a379006e3 ] If amdgpu_cs_vm_handling returns r !=3D 0, then it will unlock the bo_list_mutex inside the function amdgpu_cs_vm_handling and again on amdgpu_cs_parser_fini. This problem results in the following use-after-free problem: [ 220.280990] ------------[ cut here ]------------ [ 220.281000] refcount_t: underflow; use-after-free. [ 220.281019] WARNING: CPU: 1 PID: 3746 at lib/refcount.c:28 refcount_warn_= saturate+0xba/0x110 [ 220.281029] ------------[ cut here ]------------ [ 220.281415] CPU: 1 PID: 3746 Comm: chrome:cs0 Tainted: G W L ------- --- = 5.20.0-0.rc0.20220812git7ebfc85e2cd7.10.fc38.x86_64 #1 [ 220.281421] Hardware name: System manufacturer System Product Name/ROG ST= RIX X570-I GAMING, BIOS 4403 04/27/2022 [ 220.281426] RIP: 0010:refcount_warn_saturate+0xba/0x110 [ 220.281431] Code: 01 01 e8 79 4a 6f 00 0f 0b e9 42 47 a5 00 80 3d de 7e be 01 00 75 85 48 c7 c7 f8 98 8e 98 c6 05 ce 7e be 01 01 e8 56 4a 6f 00 <0f> 0b e9 1f 47 a5 00 80 3d b9 7e be 01 00 0f 85 5e ff ff ff 48 c7 [ 220.281437] RSP: 0018:ffffb4b0d18d7a80 EFLAGS: 00010282 [ 220.281443] RAX: 0000000000000026 RBX: 0000000000000003 RCX: 000000000000= 0000 [ 220.281448] RDX: 0000000000000001 RSI: ffffffff988d06dc RDI: 00000000ffff= ffff [ 220.281452] RBP: 00000000ffffffff R08: 0000000000000000 R09: ffffb4b0d18d= 7930 [ 220.281457] R10: 0000000000000003 R11: ffffa0672e2fffe8 R12: ffffa058ca36= 0400 [ 220.281461] R13: ffffa05846c50a18 R14: 00000000fffffe00 R15: 000000000000= 0003 [ 220.281465] FS: 00007f82683e06c0(0000) GS:ffffa066e2e00000(0000) knlGS:00= 00000000000000 [ 220.281470] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 220.281475] CR2: 00003590005cc000 CR3: 00000001fca46000 CR4: 000000000035= 0ee0 [ 220.281480] Call Trace: [ 220.281485] [ 220.281490] amdgpu_cs_ioctl+0x4e2/0x2070 [amdgpu] [ 220.281806] ? amdgpu_cs_find_mapping+0xe0/0xe0 [amdgpu] [ 220.282028] drm_ioctl_kernel+0xa4/0x150 [ 220.282043] drm_ioctl+0x21f/0x420 [ 220.282053] ? amdgpu_cs_find_mapping+0xe0/0xe0 [amdgpu] [ 220.282275] ? lock_release+0x14f/0x460 [ 220.282282] ? _raw_spin_unlock_irqrestore+0x30/0x60 [ 220.282290] ? _raw_spin_unlock_irqrestore+0x30/0x60 [ 220.282297] ? lockdep_hardirqs_on+0x7d/0x100 [ 220.282305] ? _raw_spin_unlock_irqrestore+0x40/0x60 [ 220.282317] amdgpu_drm_ioctl+0x4a/0x80 [amdgpu] [ 220.282534] __x64_sys_ioctl+0x90/0xd0 [ 220.282545] do_syscall_64+0x5b/0x80 [ 220.282551] ? futex_wake+0x6c/0x150 [ 220.282568] ? lock_is_held_type+0xe8/0x140 [ 220.282580] ? do_syscall_64+0x67/0x80 [ 220.282585] ? lockdep_hardirqs_on+0x7d/0x100 [ 220.282592] ? do_syscall_64+0x67/0x80 [ 220.282597] ? do_syscall_64+0x67/0x80 [ 220.282602] ? lockdep_hardirqs_on+0x7d/0x100 [ 220.282609] entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 220.282616] RIP: 0033:0x7f8282a4f8bf [ 220.282639] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 18 48 8b 44 24 18 64 48 2b 04 25 28 00 00 [ 220.282644] RSP: 002b:00007f82683df410 EFLAGS: 00000246 ORIG_RAX: 0000000= 000000010 [ 220.282651] RAX: ffffffffffffffda RBX: 00007f82683df588 RCX: 00007f8282a4= f8bf [ 220.282655] RDX: 00007f82683df4d0 RSI: 00000000c0186444 RDI: 000000000000= 0018 [ 220.282659] RBP: 00007f82683df4d0 R08: 00007f82683df5e0 R09: 00007f82683d= f4b0 [ 220.282663] R10: 00001d04000a0600 R11: 0000000000000246 R12: 00000000c018= 6444 [ 220.282667] R13: 0000000000000018 R14: 00007f82683df588 R15: 000000000000= 0003 [ 220.282689] [ 220.282693] irq event stamp: 6232311 [ 220.282697] hardirqs last enabled at (6232319): [] __up= _console_sem+0x5e/0x70 [ 220.282704] hardirqs last disabled at (6232326): [] __u= p_console_sem+0x43/0x70 [ 220.282709] softirqs last enabled at (6232072): [] __ir= q_exit_rcu+0xf9/0x170 [ 220.282716] softirqs last disabled at (6232061): [] __i= rq_exit_rcu+0xf9/0x170 [ 220.282722] ---[ end trace 0000000000000000 ]--- Therefore, remove the mutex_unlock from the amdgpu_cs_vm_handling function, so that amdgpu_cs_submit and amdgpu_cs_parser_fini can handle the unlock. Fixes: 90af0ca047f3 ("drm/amdgpu: Protect the amdgpu_bo_list list with a mu= tex v2") Reported-by: Mikhail Gavrilov Reviewed-by: Christian K=C3=B6nig Reviewed-by: Melissa Wen Signed-off-by: Ma=C3=ADra Canal Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/a= mdgpu/amdgpu_cs.c index d8f1335bc68f..b7bae833c804 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -837,16 +837,12 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_par= ser *p) continue; =20 r =3D amdgpu_vm_bo_update(adev, bo_va, false); - if (r) { - mutex_unlock(&p->bo_list->bo_list_mutex); + if (r) return r; - } =20 r =3D amdgpu_sync_fence(&p->job->sync, bo_va->last_pt_update); - if (r) { - mutex_unlock(&p->bo_list->bo_list_mutex); + if (r) return r; - } } =20 r =3D amdgpu_vm_handle_moved(adev, vm); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC3E8C32772 for ; Tue, 23 Aug 2022 09:09:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348390AbiHWJJm (ORCPT ); Tue, 23 Aug 2022 05:09:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347940AbiHWJIS (ORCPT ); Tue, 23 Aug 2022 05:08:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06D918670C; Tue, 23 Aug 2022 01:30:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0C272B81C5C; Tue, 23 Aug 2022 08:29:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 492FBC433D6; Tue, 23 Aug 2022 08:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243347; bh=TI0UbaW7/8QW7VrTlNHKdtAt6eyn/rO/fXGq4LAa7hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ks6Fh0wk4LCojkhybjxoPXpDAjJe7k3CAi+NHWAqVy+Ac5RCcrcmGkbJWbkmqPZz9 jwt21GJ3SuL2grDwGlKRzJ/5kMi7W4zaj/f3xFIzm/BoFHWRUmhe6UVXO4E71L/yg/ KZmFxXdNu0vTzEC4p4aBcY+NJWorkTW+slqCHGig= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Upton , Marc Zyngier , Sasha Levin Subject: [PATCH 5.19 249/365] KVM: arm64: Treat PMCR_EL1.LC as RES1 on asymmetric systems Date: Tue, 23 Aug 2022 10:02:30 +0200 Message-Id: <20220823080128.610558623@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oliver Upton [ Upstream commit f3c6efc72f3b20ec23566e768979802f0a398f04 ] KVM does not support AArch32 on asymmetric systems. To that end, enforce AArch64-only behavior on PMCR_EL1.LC when on an asymmetric system. Fixes: 2122a833316f ("arm64: Allow mismatched 32-bit EL0 support") Signed-off-by: Oliver Upton Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220816192554.1455559-2-oliver.upton@linux= .dev Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/arm64/include/asm/kvm_host.h | 4 ++++ arch/arm64/kvm/arm.c | 3 +-- arch/arm64/kvm/sys_regs.c | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm= _host.h index de32152cea04..7aaf75577096 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -838,6 +838,10 @@ bool kvm_arm_vcpu_is_finalized(struct kvm_vcpu *vcpu); (system_supports_mte() && \ test_bit(KVM_ARCH_FLAG_MTE_ENABLED, &(kvm)->arch.flags)) =20 +#define kvm_supports_32bit_el0() \ + (system_supports_32bit_el0() && \ + !static_branch_unlikely(&arm64_mismatched_32bit_el0)) + int kvm_trng_call(struct kvm_vcpu *vcpu); #ifdef CONFIG_KVM extern phys_addr_t hyp_mem_base; diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 83a7f61354d3..e21b24574118 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -751,8 +751,7 @@ static bool vcpu_mode_is_bad_32bit(struct kvm_vcpu *vcp= u) if (likely(!vcpu_mode_is_32bit(vcpu))) return false; =20 - return !system_supports_32bit_el0() || - static_branch_unlikely(&arm64_mismatched_32bit_el0); + return !kvm_supports_32bit_el0(); } =20 /** diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index c06c0477fab5..be7edd21537f 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -692,7 +692,7 @@ static void reset_pmcr(struct kvm_vcpu *vcpu, const str= uct sys_reg_desc *r) */ val =3D ((pmcr & ~ARMV8_PMU_PMCR_MASK) | (ARMV8_PMU_PMCR_MASK & 0xdecafbad)) & (~ARMV8_PMU_PMCR_E); - if (!system_supports_32bit_el0()) + if (!kvm_supports_32bit_el0()) val |=3D ARMV8_PMU_PMCR_LC; __vcpu_sys_reg(vcpu, r->reg) =3D val; } @@ -741,7 +741,7 @@ static bool access_pmcr(struct kvm_vcpu *vcpu, struct s= ys_reg_params *p, val =3D __vcpu_sys_reg(vcpu, PMCR_EL0); val &=3D ~ARMV8_PMU_PMCR_MASK; val |=3D p->regval & ARMV8_PMU_PMCR_MASK; - if (!system_supports_32bit_el0()) + if (!kvm_supports_32bit_el0()) val |=3D ARMV8_PMU_PMCR_LC; __vcpu_sys_reg(vcpu, PMCR_EL0) =3D val; kvm_pmu_handle_pmcr(vcpu, val); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A29BC32792 for ; Tue, 23 Aug 2022 09:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348496AbiHWJK2 (ORCPT ); Tue, 23 Aug 2022 05:10:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240382AbiHWJJP (ORCPT ); Tue, 23 Aug 2022 05:09:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB87E86890; Tue, 23 Aug 2022 01:30:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 22BBEB81C35; Tue, 23 Aug 2022 08:29:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 688B3C433D6; Tue, 23 Aug 2022 08:29:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243350; bh=XZXeOQ3dfzBQRzr9znYm6A/X4LWQ1Y7x+rJXgcRbj20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yPU8LGtc6e7pNSZZEroWwKz6U2N2Oye3CSUGhbkwe3iMgrVlJ3+jFV5/LoCHVJibi Fw1uOeWnEJ7kyAKlyo2e3LdByIwcAIBSxHisYum7PXU0hJwawZJlbQbHy7DxOaY5N7 jqCZTtlCzasR5+CLIhd2f88fadBQ30qFC3gjYAdk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Upton , Marc Zyngier , Sasha Levin Subject: [PATCH 5.19 250/365] KVM: arm64: Reject 32bit user PSTATE on asymmetric systems Date: Tue, 23 Aug 2022 10:02:31 +0200 Message-Id: <20220823080128.650304002@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oliver Upton [ Upstream commit b10d86fb8e46cc812171728bcd326df2f34e9ed5 ] KVM does not support AArch32 EL0 on asymmetric systems. To that end, prevent userspace from configuring a vCPU in such a state through setting PSTATE. It is already ABI that KVM rejects such a write on a system where AArch32 EL0 is unsupported. Though the kernel's definition of a 32bit system changed in commit 2122a833316f ("arm64: Allow mismatched 32-bit EL0 support"), KVM's did not. Fixes: 2122a833316f ("arm64: Allow mismatched 32-bit EL0 support") Signed-off-by: Oliver Upton Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220816192554.1455559-3-oliver.upton@linux= .dev Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/arm64/kvm/guest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 8c607199cad1..f802a3b3f8db 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -242,7 +242,7 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const st= ruct kvm_one_reg *reg) u64 mode =3D (*(u64 *)valp) & PSR_AA32_MODE_MASK; switch (mode) { case PSR_AA32_MODE_USR: - if (!system_supports_32bit_el0()) + if (!kvm_supports_32bit_el0()) return -EINVAL; break; case PSR_AA32_MODE_FIQ: --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 569E6C3F6B0 for ; Tue, 23 Aug 2022 09:13:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347940AbiHWJLo (ORCPT ); Tue, 23 Aug 2022 05:11:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348324AbiHWJJZ (ORCPT ); Tue, 23 Aug 2022 05:09:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 011C7868B9; Tue, 23 Aug 2022 01:30:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 461A7B81C4B; Tue, 23 Aug 2022 08:29:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A092DC433C1; Tue, 23 Aug 2022 08:29:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243357; bh=8xUMIArOW/4IiPvkqpo2CnRg7A2HIRsEk0ozSnmCl/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qLXQ0mEeMU74Hu3hc91UYYkXuy5Ybia++e4Pp+ZldXB8W7ndcdODSjb1QZSVjJ4y8 wxM9H1HO8Lu1fS/BQWZ03emAzoDypdFagxnCbEnsCJwKbbLEfa6+Apn2l3PbKPJ/GE hS13+YL+nMqv6P2J/I7NTyBHj48f7p54+Wpzk1aE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 251/365] net: mscc: ocelot: turn stats_lock into a spinlock Date: Tue, 23 Aug 2022 10:02:32 +0200 Message-Id: <20220823080128.688845638@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 22d842e3efe56402c33b5e6e303bb71ce9bf9334 ] ocelot_get_stats64() currently runs unlocked and therefore may collide with ocelot_port_update_stats() which indirectly accesses the same counters. However, ocelot_get_stats64() runs in atomic context, and we cannot simply take the sleepable ocelot->stats_lock mutex. We need to convert it to an atomic spinlock first. Do that as a preparatory change. Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/dsa/ocelot/felix_vsc9959.c | 4 ++-- drivers/net/ethernet/mscc/ocelot.c | 11 +++++------ include/soc/mscc/ocelot.h | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelo= t/felix_vsc9959.c index 61b1bf4399c4..601fae886b26 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2177,7 +2177,7 @@ static void vsc9959_psfp_sgi_table_del(struct ocelot = *ocelot, static void vsc9959_psfp_counters_get(struct ocelot *ocelot, u32 index, struct felix_stream_filter_counters *counters) { - mutex_lock(&ocelot->stats_lock); + spin_lock(&ocelot->stats_lock); =20 ocelot_rmw(ocelot, SYS_STAT_CFG_STAT_VIEW(index), SYS_STAT_CFG_STAT_VIEW_M, @@ -2194,7 +2194,7 @@ static void vsc9959_psfp_counters_get(struct ocelot *= ocelot, u32 index, SYS_STAT_CFG_STAT_CLEAR_SHOT(0x10), SYS_STAT_CFG); =20 - mutex_unlock(&ocelot->stats_lock); + spin_unlock(&ocelot->stats_lock); } =20 static int vsc9959_psfp_filter_add(struct ocelot *ocelot, int port, diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc= /ocelot.c index d4649e4ee0e7..c67f162f8ab5 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1906,13 +1906,13 @@ static void ocelot_check_stats_work(struct work_str= uct *work) stats_work); int i, err; =20 - mutex_lock(&ocelot->stats_lock); + spin_lock(&ocelot->stats_lock); for (i =3D 0; i < ocelot->num_phys_ports; i++) { err =3D ocelot_port_update_stats(ocelot, i); if (err) break; } - mutex_unlock(&ocelot->stats_lock); + spin_unlock(&ocelot->stats_lock); =20 if (err) dev_err(ocelot->dev, "Error %d updating ethtool stats\n", err); @@ -1925,7 +1925,7 @@ void ocelot_get_ethtool_stats(struct ocelot *ocelot, = int port, u64 *data) { int i, err; =20 - mutex_lock(&ocelot->stats_lock); + spin_lock(&ocelot->stats_lock); =20 /* check and update now */ err =3D ocelot_port_update_stats(ocelot, port); @@ -1934,7 +1934,7 @@ void ocelot_get_ethtool_stats(struct ocelot *ocelot, = int port, u64 *data) for (i =3D 0; i < ocelot->num_stats; i++) *data++ =3D ocelot->stats[port * ocelot->num_stats + i]; =20 - mutex_unlock(&ocelot->stats_lock); + spin_unlock(&ocelot->stats_lock); =20 if (err) dev_err(ocelot->dev, "Error %d updating ethtool stats\n", err); @@ -3363,7 +3363,7 @@ int ocelot_init(struct ocelot *ocelot) if (!ocelot->stats) return -ENOMEM; =20 - mutex_init(&ocelot->stats_lock); + spin_lock_init(&ocelot->stats_lock); mutex_init(&ocelot->ptp_lock); mutex_init(&ocelot->mact_lock); mutex_init(&ocelot->fwd_domain_lock); @@ -3511,7 +3511,6 @@ void ocelot_deinit(struct ocelot *ocelot) cancel_delayed_work(&ocelot->stats_work); destroy_workqueue(ocelot->stats_queue); destroy_workqueue(ocelot->owq); - mutex_destroy(&ocelot->stats_lock); } EXPORT_SYMBOL(ocelot_deinit); =20 diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index e7e5b06deb2d..72b9474391da 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -752,7 +752,7 @@ struct ocelot { struct ocelot_psfp_list psfp; =20 /* Workqueue to check statistics for overflow with its lock */ - struct mutex stats_lock; + spinlock_t stats_lock; u64 *stats; struct delayed_work stats_work; struct workqueue_struct *stats_queue; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B5F7C32772 for ; Tue, 23 Aug 2022 09:13:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348339AbiHWJLr (ORCPT ); Tue, 23 Aug 2022 05:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348017AbiHWJJX (ORCPT ); Tue, 23 Aug 2022 05:09:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAE8386040; Tue, 23 Aug 2022 01:30:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CD3AC6132D; Tue, 23 Aug 2022 08:29:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0A46C433C1; Tue, 23 Aug 2022 08:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243360; bh=3vRw/BXbTpCY3pAOH5G0TmoFZPMnb7qpDQLIiyyHYBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hGOLD5lkdNG8dD57ye2Tea8uLD5Vl2TB9ESXIlkryG+NLQ/rn24puih4JD8mObYJd X1/tqNmgdzUnww3h4Xtbh0cET+g7v/EQ2HNOegm9VA8fenFWHwFM7ml8DXubmP9Ewj wf8+CFAXgC6yZzqw/engf/SuJYtBLQKGoz9LIt1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 252/365] net: mscc: ocelot: fix race between ndo_get_stats64 and ocelot_check_stats_work Date: Tue, 23 Aug 2022 10:02:33 +0200 Message-Id: <20220823080128.729548690@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 18d8e67df184081bc6ce6220a2dd965cfd3d7e6b ] The 2 methods can run concurrently, and one will change the window of counters (SYS_STAT_CFG_STAT_VIEW) that the other sees. The fix is similar to what commit 7fbf6795d127 ("net: mscc: ocelot: fix mutex lock error during ethtool stats read") has done for ethtool -S. Fixes: a556c76adc05 ("net: mscc: Add initial Ocelot switch support") Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/mscc/ocelot_net.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/= mscc/ocelot_net.c index 9d8cea16245e..6b9d37138844 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -726,6 +726,8 @@ static void ocelot_get_stats64(struct net_device *dev, struct ocelot *ocelot =3D priv->port.ocelot; int port =3D priv->port.index; =20 + spin_lock(&ocelot->stats_lock); + /* Configure the port to read the stats from */ ocelot_write(ocelot, SYS_STAT_CFG_STAT_VIEW(port), SYS_STAT_CFG); @@ -758,6 +760,8 @@ static void ocelot_get_stats64(struct net_device *dev, stats->tx_dropped =3D ocelot_read(ocelot, SYS_COUNT_TX_DROPS) + ocelot_read(ocelot, SYS_COUNT_TX_AGING); stats->collisions =3D ocelot_read(ocelot, SYS_COUNT_TX_COLLISION); + + spin_unlock(&ocelot->stats_lock); } =20 static int ocelot_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86440C32772 for ; Tue, 23 Aug 2022 09:08:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348223AbiHWJIf (ORCPT ); Tue, 23 Aug 2022 05:08:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347959AbiHWJHX (ORCPT ); Tue, 23 Aug 2022 05:07:23 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DB0C861F7; Tue, 23 Aug 2022 01:30:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 77D0FCE1B40; Tue, 23 Aug 2022 08:29:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C977C433C1; Tue, 23 Aug 2022 08:29:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243363; bh=HrtdRP3M5t5rCJ+EvLj3UpIdzU7gplhRQ6l4rCEq1CY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=va2m+Eunn9FkS3VQzir4BRXcuPt8ObVGOEylbbF8Y1Bj3tSh2N/t9kRTGoXjcZXQh Nl/qdjz6Nr3hxeYgnrsRWYqmTgRcIQIl67M5pjUkLYQwxMzoUFbIO27gh71tgam1qJ 9rw0KE3IwFvotWJop3Pn5jLOhh2/G/mQTG3cF2vo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 253/365] net: mscc: ocelot: make struct ocelot_stat_layout array indexable Date: Tue, 23 Aug 2022 10:02:34 +0200 Message-Id: <20220823080128.778682232@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 9190460084ddd0e9235f55eab0fdd5456b5f2fd5 ] The ocelot counters are 32-bit and require periodic reading, every 2 seconds, by ocelot_port_update_stats(), so that wraparounds are detected. Currently, the counters reported by ocelot_get_stats64() come from the 32-bit hardware counters directly, rather than from the 64-bit accumulated ocelot->stats, and this is a problem for their integrity. The strategy is to make ocelot_get_stats64() able to cherry-pick individual stats from ocelot->stats the way in which it currently reads them out from SYS_COUNT_* registers. But currently it can't, because ocelot->stats is an opaque u64 array that's used only to feed data into ethtool -S. To solve that problem, we need to make ocelot->stats indexable, and associate each element with an element of struct ocelot_stat_layout used by ethtool -S. This makes ocelot_stat_layout a fat (and possibly sparse) array, so we need to change the way in which we access it. We no longer need OCELOT_STAT_END as a sentinel, because we know the array's size (OCELOT_NUM_STATS). We just need to skip the array elements that were left unpopulated for the switch revision (ocelot, felix, seville). Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/dsa/ocelot/felix_vsc9959.c | 468 ++++++++++++++++----- drivers/net/dsa/ocelot/seville_vsc9953.c | 468 ++++++++++++++++----- drivers/net/ethernet/mscc/ocelot.c | 40 +- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 468 ++++++++++++++++----- include/soc/mscc/ocelot.h | 105 ++++- 5 files changed, 1243 insertions(+), 306 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelo= t/felix_vsc9959.c index 601fae886b26..6439b56f381f 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -550,101 +550,379 @@ static const struct reg_field vsc9959_regfields[REG= FIELD_MAX] =3D { [SYS_PAUSE_CFG_PAUSE_ENA] =3D REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 7, 4), }; =20 -static const struct ocelot_stat_layout vsc9959_stats_layout[] =3D { - { .offset =3D 0x00, .name =3D "rx_octets", }, - { .offset =3D 0x01, .name =3D "rx_unicast", }, - { .offset =3D 0x02, .name =3D "rx_multicast", }, - { .offset =3D 0x03, .name =3D "rx_broadcast", }, - { .offset =3D 0x04, .name =3D "rx_shorts", }, - { .offset =3D 0x05, .name =3D "rx_fragments", }, - { .offset =3D 0x06, .name =3D "rx_jabbers", }, - { .offset =3D 0x07, .name =3D "rx_crc_align_errs", }, - { .offset =3D 0x08, .name =3D "rx_sym_errs", }, - { .offset =3D 0x09, .name =3D "rx_frames_below_65_octets", }, - { .offset =3D 0x0A, .name =3D "rx_frames_65_to_127_octets", }, - { .offset =3D 0x0B, .name =3D "rx_frames_128_to_255_octets", }, - { .offset =3D 0x0C, .name =3D "rx_frames_256_to_511_octets", }, - { .offset =3D 0x0D, .name =3D "rx_frames_512_to_1023_octets", }, - { .offset =3D 0x0E, .name =3D "rx_frames_1024_to_1526_octets", }, - { .offset =3D 0x0F, .name =3D "rx_frames_over_1526_octets", }, - { .offset =3D 0x10, .name =3D "rx_pause", }, - { .offset =3D 0x11, .name =3D "rx_control", }, - { .offset =3D 0x12, .name =3D "rx_longs", }, - { .offset =3D 0x13, .name =3D "rx_classified_drops", }, - { .offset =3D 0x14, .name =3D "rx_red_prio_0", }, - { .offset =3D 0x15, .name =3D "rx_red_prio_1", }, - { .offset =3D 0x16, .name =3D "rx_red_prio_2", }, - { .offset =3D 0x17, .name =3D "rx_red_prio_3", }, - { .offset =3D 0x18, .name =3D "rx_red_prio_4", }, - { .offset =3D 0x19, .name =3D "rx_red_prio_5", }, - { .offset =3D 0x1A, .name =3D "rx_red_prio_6", }, - { .offset =3D 0x1B, .name =3D "rx_red_prio_7", }, - { .offset =3D 0x1C, .name =3D "rx_yellow_prio_0", }, - { .offset =3D 0x1D, .name =3D "rx_yellow_prio_1", }, - { .offset =3D 0x1E, .name =3D "rx_yellow_prio_2", }, - { .offset =3D 0x1F, .name =3D "rx_yellow_prio_3", }, - { .offset =3D 0x20, .name =3D "rx_yellow_prio_4", }, - { .offset =3D 0x21, .name =3D "rx_yellow_prio_5", }, - { .offset =3D 0x22, .name =3D "rx_yellow_prio_6", }, - { .offset =3D 0x23, .name =3D "rx_yellow_prio_7", }, - { .offset =3D 0x24, .name =3D "rx_green_prio_0", }, - { .offset =3D 0x25, .name =3D "rx_green_prio_1", }, - { .offset =3D 0x26, .name =3D "rx_green_prio_2", }, - { .offset =3D 0x27, .name =3D "rx_green_prio_3", }, - { .offset =3D 0x28, .name =3D "rx_green_prio_4", }, - { .offset =3D 0x29, .name =3D "rx_green_prio_5", }, - { .offset =3D 0x2A, .name =3D "rx_green_prio_6", }, - { .offset =3D 0x2B, .name =3D "rx_green_prio_7", }, - { .offset =3D 0x80, .name =3D "tx_octets", }, - { .offset =3D 0x81, .name =3D "tx_unicast", }, - { .offset =3D 0x82, .name =3D "tx_multicast", }, - { .offset =3D 0x83, .name =3D "tx_broadcast", }, - { .offset =3D 0x84, .name =3D "tx_collision", }, - { .offset =3D 0x85, .name =3D "tx_drops", }, - { .offset =3D 0x86, .name =3D "tx_pause", }, - { .offset =3D 0x87, .name =3D "tx_frames_below_65_octets", }, - { .offset =3D 0x88, .name =3D "tx_frames_65_to_127_octets", }, - { .offset =3D 0x89, .name =3D "tx_frames_128_255_octets", }, - { .offset =3D 0x8A, .name =3D "tx_frames_256_511_octets", }, - { .offset =3D 0x8B, .name =3D "tx_frames_512_1023_octets", }, - { .offset =3D 0x8C, .name =3D "tx_frames_1024_1526_octets", }, - { .offset =3D 0x8D, .name =3D "tx_frames_over_1526_octets", }, - { .offset =3D 0x8E, .name =3D "tx_yellow_prio_0", }, - { .offset =3D 0x8F, .name =3D "tx_yellow_prio_1", }, - { .offset =3D 0x90, .name =3D "tx_yellow_prio_2", }, - { .offset =3D 0x91, .name =3D "tx_yellow_prio_3", }, - { .offset =3D 0x92, .name =3D "tx_yellow_prio_4", }, - { .offset =3D 0x93, .name =3D "tx_yellow_prio_5", }, - { .offset =3D 0x94, .name =3D "tx_yellow_prio_6", }, - { .offset =3D 0x95, .name =3D "tx_yellow_prio_7", }, - { .offset =3D 0x96, .name =3D "tx_green_prio_0", }, - { .offset =3D 0x97, .name =3D "tx_green_prio_1", }, - { .offset =3D 0x98, .name =3D "tx_green_prio_2", }, - { .offset =3D 0x99, .name =3D "tx_green_prio_3", }, - { .offset =3D 0x9A, .name =3D "tx_green_prio_4", }, - { .offset =3D 0x9B, .name =3D "tx_green_prio_5", }, - { .offset =3D 0x9C, .name =3D "tx_green_prio_6", }, - { .offset =3D 0x9D, .name =3D "tx_green_prio_7", }, - { .offset =3D 0x9E, .name =3D "tx_aged", }, - { .offset =3D 0x100, .name =3D "drop_local", }, - { .offset =3D 0x101, .name =3D "drop_tail", }, - { .offset =3D 0x102, .name =3D "drop_yellow_prio_0", }, - { .offset =3D 0x103, .name =3D "drop_yellow_prio_1", }, - { .offset =3D 0x104, .name =3D "drop_yellow_prio_2", }, - { .offset =3D 0x105, .name =3D "drop_yellow_prio_3", }, - { .offset =3D 0x106, .name =3D "drop_yellow_prio_4", }, - { .offset =3D 0x107, .name =3D "drop_yellow_prio_5", }, - { .offset =3D 0x108, .name =3D "drop_yellow_prio_6", }, - { .offset =3D 0x109, .name =3D "drop_yellow_prio_7", }, - { .offset =3D 0x10A, .name =3D "drop_green_prio_0", }, - { .offset =3D 0x10B, .name =3D "drop_green_prio_1", }, - { .offset =3D 0x10C, .name =3D "drop_green_prio_2", }, - { .offset =3D 0x10D, .name =3D "drop_green_prio_3", }, - { .offset =3D 0x10E, .name =3D "drop_green_prio_4", }, - { .offset =3D 0x10F, .name =3D "drop_green_prio_5", }, - { .offset =3D 0x110, .name =3D "drop_green_prio_6", }, - { .offset =3D 0x111, .name =3D "drop_green_prio_7", }, - OCELOT_STAT_END +static const struct ocelot_stat_layout vsc9959_stats_layout[OCELOT_NUM_STA= TS] =3D { + [OCELOT_STAT_RX_OCTETS] =3D { + .name =3D "rx_octets", + .offset =3D 0x00, + }, + [OCELOT_STAT_RX_UNICAST] =3D { + .name =3D "rx_unicast", + .offset =3D 0x01, + }, + [OCELOT_STAT_RX_MULTICAST] =3D { + .name =3D "rx_multicast", + .offset =3D 0x02, + }, + [OCELOT_STAT_RX_BROADCAST] =3D { + .name =3D "rx_broadcast", + .offset =3D 0x03, + }, + [OCELOT_STAT_RX_SHORTS] =3D { + .name =3D "rx_shorts", + .offset =3D 0x04, + }, + [OCELOT_STAT_RX_FRAGMENTS] =3D { + .name =3D "rx_fragments", + .offset =3D 0x05, + }, + [OCELOT_STAT_RX_JABBERS] =3D { + .name =3D "rx_jabbers", + .offset =3D 0x06, + }, + [OCELOT_STAT_RX_CRC_ALIGN_ERRS] =3D { + .name =3D "rx_crc_align_errs", + .offset =3D 0x07, + }, + [OCELOT_STAT_RX_SYM_ERRS] =3D { + .name =3D "rx_sym_errs", + .offset =3D 0x08, + }, + [OCELOT_STAT_RX_64] =3D { + .name =3D "rx_frames_below_65_octets", + .offset =3D 0x09, + }, + [OCELOT_STAT_RX_65_127] =3D { + .name =3D "rx_frames_65_to_127_octets", + .offset =3D 0x0A, + }, + [OCELOT_STAT_RX_128_255] =3D { + .name =3D "rx_frames_128_to_255_octets", + .offset =3D 0x0B, + }, + [OCELOT_STAT_RX_256_511] =3D { + .name =3D "rx_frames_256_to_511_octets", + .offset =3D 0x0C, + }, + [OCELOT_STAT_RX_512_1023] =3D { + .name =3D "rx_frames_512_to_1023_octets", + .offset =3D 0x0D, + }, + [OCELOT_STAT_RX_1024_1526] =3D { + .name =3D "rx_frames_1024_to_1526_octets", + .offset =3D 0x0E, + }, + [OCELOT_STAT_RX_1527_MAX] =3D { + .name =3D "rx_frames_over_1526_octets", + .offset =3D 0x0F, + }, + [OCELOT_STAT_RX_PAUSE] =3D { + .name =3D "rx_pause", + .offset =3D 0x10, + }, + [OCELOT_STAT_RX_CONTROL] =3D { + .name =3D "rx_control", + .offset =3D 0x11, + }, + [OCELOT_STAT_RX_LONGS] =3D { + .name =3D "rx_longs", + .offset =3D 0x12, + }, + [OCELOT_STAT_RX_CLASSIFIED_DROPS] =3D { + .name =3D "rx_classified_drops", + .offset =3D 0x13, + }, + [OCELOT_STAT_RX_RED_PRIO_0] =3D { + .name =3D "rx_red_prio_0", + .offset =3D 0x14, + }, + [OCELOT_STAT_RX_RED_PRIO_1] =3D { + .name =3D "rx_red_prio_1", + .offset =3D 0x15, + }, + [OCELOT_STAT_RX_RED_PRIO_2] =3D { + .name =3D "rx_red_prio_2", + .offset =3D 0x16, + }, + [OCELOT_STAT_RX_RED_PRIO_3] =3D { + .name =3D "rx_red_prio_3", + .offset =3D 0x17, + }, + [OCELOT_STAT_RX_RED_PRIO_4] =3D { + .name =3D "rx_red_prio_4", + .offset =3D 0x18, + }, + [OCELOT_STAT_RX_RED_PRIO_5] =3D { + .name =3D "rx_red_prio_5", + .offset =3D 0x19, + }, + [OCELOT_STAT_RX_RED_PRIO_6] =3D { + .name =3D "rx_red_prio_6", + .offset =3D 0x1A, + }, + [OCELOT_STAT_RX_RED_PRIO_7] =3D { + .name =3D "rx_red_prio_7", + .offset =3D 0x1B, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_0] =3D { + .name =3D "rx_yellow_prio_0", + .offset =3D 0x1C, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_1] =3D { + .name =3D "rx_yellow_prio_1", + .offset =3D 0x1D, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_2] =3D { + .name =3D "rx_yellow_prio_2", + .offset =3D 0x1E, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_3] =3D { + .name =3D "rx_yellow_prio_3", + .offset =3D 0x1F, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_4] =3D { + .name =3D "rx_yellow_prio_4", + .offset =3D 0x20, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_5] =3D { + .name =3D "rx_yellow_prio_5", + .offset =3D 0x21, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_6] =3D { + .name =3D "rx_yellow_prio_6", + .offset =3D 0x22, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_7] =3D { + .name =3D "rx_yellow_prio_7", + .offset =3D 0x23, + }, + [OCELOT_STAT_RX_GREEN_PRIO_0] =3D { + .name =3D "rx_green_prio_0", + .offset =3D 0x24, + }, + [OCELOT_STAT_RX_GREEN_PRIO_1] =3D { + .name =3D "rx_green_prio_1", + .offset =3D 0x25, + }, + [OCELOT_STAT_RX_GREEN_PRIO_2] =3D { + .name =3D "rx_green_prio_2", + .offset =3D 0x26, + }, + [OCELOT_STAT_RX_GREEN_PRIO_3] =3D { + .name =3D "rx_green_prio_3", + .offset =3D 0x27, + }, + [OCELOT_STAT_RX_GREEN_PRIO_4] =3D { + .name =3D "rx_green_prio_4", + .offset =3D 0x28, + }, + [OCELOT_STAT_RX_GREEN_PRIO_5] =3D { + .name =3D "rx_green_prio_5", + .offset =3D 0x29, + }, + [OCELOT_STAT_RX_GREEN_PRIO_6] =3D { + .name =3D "rx_green_prio_6", + .offset =3D 0x2A, + }, + [OCELOT_STAT_RX_GREEN_PRIO_7] =3D { + .name =3D "rx_green_prio_7", + .offset =3D 0x2B, + }, + [OCELOT_STAT_TX_OCTETS] =3D { + .name =3D "tx_octets", + .offset =3D 0x80, + }, + [OCELOT_STAT_TX_UNICAST] =3D { + .name =3D "tx_unicast", + .offset =3D 0x81, + }, + [OCELOT_STAT_TX_MULTICAST] =3D { + .name =3D "tx_multicast", + .offset =3D 0x82, + }, + [OCELOT_STAT_TX_BROADCAST] =3D { + .name =3D "tx_broadcast", + .offset =3D 0x83, + }, + [OCELOT_STAT_TX_COLLISION] =3D { + .name =3D "tx_collision", + .offset =3D 0x84, + }, + [OCELOT_STAT_TX_DROPS] =3D { + .name =3D "tx_drops", + .offset =3D 0x85, + }, + [OCELOT_STAT_TX_PAUSE] =3D { + .name =3D "tx_pause", + .offset =3D 0x86, + }, + [OCELOT_STAT_TX_64] =3D { + .name =3D "tx_frames_below_65_octets", + .offset =3D 0x87, + }, + [OCELOT_STAT_TX_65_127] =3D { + .name =3D "tx_frames_65_to_127_octets", + .offset =3D 0x88, + }, + [OCELOT_STAT_TX_128_255] =3D { + .name =3D "tx_frames_128_255_octets", + .offset =3D 0x89, + }, + [OCELOT_STAT_TX_256_511] =3D { + .name =3D "tx_frames_256_511_octets", + .offset =3D 0x8A, + }, + [OCELOT_STAT_TX_512_1023] =3D { + .name =3D "tx_frames_512_1023_octets", + .offset =3D 0x8B, + }, + [OCELOT_STAT_TX_1024_1526] =3D { + .name =3D "tx_frames_1024_1526_octets", + .offset =3D 0x8C, + }, + [OCELOT_STAT_TX_1527_MAX] =3D { + .name =3D "tx_frames_over_1526_octets", + .offset =3D 0x8D, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_0] =3D { + .name =3D "tx_yellow_prio_0", + .offset =3D 0x8E, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_1] =3D { + .name =3D "tx_yellow_prio_1", + .offset =3D 0x8F, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_2] =3D { + .name =3D "tx_yellow_prio_2", + .offset =3D 0x90, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_3] =3D { + .name =3D "tx_yellow_prio_3", + .offset =3D 0x91, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_4] =3D { + .name =3D "tx_yellow_prio_4", + .offset =3D 0x92, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_5] =3D { + .name =3D "tx_yellow_prio_5", + .offset =3D 0x93, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_6] =3D { + .name =3D "tx_yellow_prio_6", + .offset =3D 0x94, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_7] =3D { + .name =3D "tx_yellow_prio_7", + .offset =3D 0x95, + }, + [OCELOT_STAT_TX_GREEN_PRIO_0] =3D { + .name =3D "tx_green_prio_0", + .offset =3D 0x96, + }, + [OCELOT_STAT_TX_GREEN_PRIO_1] =3D { + .name =3D "tx_green_prio_1", + .offset =3D 0x97, + }, + [OCELOT_STAT_TX_GREEN_PRIO_2] =3D { + .name =3D "tx_green_prio_2", + .offset =3D 0x98, + }, + [OCELOT_STAT_TX_GREEN_PRIO_3] =3D { + .name =3D "tx_green_prio_3", + .offset =3D 0x99, + }, + [OCELOT_STAT_TX_GREEN_PRIO_4] =3D { + .name =3D "tx_green_prio_4", + .offset =3D 0x9A, + }, + [OCELOT_STAT_TX_GREEN_PRIO_5] =3D { + .name =3D "tx_green_prio_5", + .offset =3D 0x9B, + }, + [OCELOT_STAT_TX_GREEN_PRIO_6] =3D { + .name =3D "tx_green_prio_6", + .offset =3D 0x9C, + }, + [OCELOT_STAT_TX_GREEN_PRIO_7] =3D { + .name =3D "tx_green_prio_7", + .offset =3D 0x9D, + }, + [OCELOT_STAT_TX_AGED] =3D { + .name =3D "tx_aged", + .offset =3D 0x9E, + }, + [OCELOT_STAT_DROP_LOCAL] =3D { + .name =3D "drop_local", + .offset =3D 0x100, + }, + [OCELOT_STAT_DROP_TAIL] =3D { + .name =3D "drop_tail", + .offset =3D 0x101, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_0] =3D { + .name =3D "drop_yellow_prio_0", + .offset =3D 0x102, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_1] =3D { + .name =3D "drop_yellow_prio_1", + .offset =3D 0x103, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_2] =3D { + .name =3D "drop_yellow_prio_2", + .offset =3D 0x104, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_3] =3D { + .name =3D "drop_yellow_prio_3", + .offset =3D 0x105, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_4] =3D { + .name =3D "drop_yellow_prio_4", + .offset =3D 0x106, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_5] =3D { + .name =3D "drop_yellow_prio_5", + .offset =3D 0x107, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_6] =3D { + .name =3D "drop_yellow_prio_6", + .offset =3D 0x108, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_7] =3D { + .name =3D "drop_yellow_prio_7", + .offset =3D 0x109, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_0] =3D { + .name =3D "drop_green_prio_0", + .offset =3D 0x10A, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_1] =3D { + .name =3D "drop_green_prio_1", + .offset =3D 0x10B, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_2] =3D { + .name =3D "drop_green_prio_2", + .offset =3D 0x10C, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_3] =3D { + .name =3D "drop_green_prio_3", + .offset =3D 0x10D, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_4] =3D { + .name =3D "drop_green_prio_4", + .offset =3D 0x10E, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_5] =3D { + .name =3D "drop_green_prio_5", + .offset =3D 0x10F, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_6] =3D { + .name =3D "drop_green_prio_6", + .offset =3D 0x110, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_7] =3D { + .name =3D "drop_green_prio_7", + .offset =3D 0x111, + }, }; =20 static const struct vcap_field vsc9959_vcap_es0_keys[] =3D { diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/oce= lot/seville_vsc9953.c index ebe9ddbbe2b7..fe5d4642d0bc 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -545,101 +545,379 @@ static const struct reg_field vsc9953_regfields[REG= FIELD_MAX] =3D { [SYS_PAUSE_CFG_PAUSE_ENA] =3D REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 11, 4), }; =20 -static const struct ocelot_stat_layout vsc9953_stats_layout[] =3D { - { .offset =3D 0x00, .name =3D "rx_octets", }, - { .offset =3D 0x01, .name =3D "rx_unicast", }, - { .offset =3D 0x02, .name =3D "rx_multicast", }, - { .offset =3D 0x03, .name =3D "rx_broadcast", }, - { .offset =3D 0x04, .name =3D "rx_shorts", }, - { .offset =3D 0x05, .name =3D "rx_fragments", }, - { .offset =3D 0x06, .name =3D "rx_jabbers", }, - { .offset =3D 0x07, .name =3D "rx_crc_align_errs", }, - { .offset =3D 0x08, .name =3D "rx_sym_errs", }, - { .offset =3D 0x09, .name =3D "rx_frames_below_65_octets", }, - { .offset =3D 0x0A, .name =3D "rx_frames_65_to_127_octets", }, - { .offset =3D 0x0B, .name =3D "rx_frames_128_to_255_octets", }, - { .offset =3D 0x0C, .name =3D "rx_frames_256_to_511_octets", }, - { .offset =3D 0x0D, .name =3D "rx_frames_512_to_1023_octets", }, - { .offset =3D 0x0E, .name =3D "rx_frames_1024_to_1526_octets", }, - { .offset =3D 0x0F, .name =3D "rx_frames_over_1526_octets", }, - { .offset =3D 0x10, .name =3D "rx_pause", }, - { .offset =3D 0x11, .name =3D "rx_control", }, - { .offset =3D 0x12, .name =3D "rx_longs", }, - { .offset =3D 0x13, .name =3D "rx_classified_drops", }, - { .offset =3D 0x14, .name =3D "rx_red_prio_0", }, - { .offset =3D 0x15, .name =3D "rx_red_prio_1", }, - { .offset =3D 0x16, .name =3D "rx_red_prio_2", }, - { .offset =3D 0x17, .name =3D "rx_red_prio_3", }, - { .offset =3D 0x18, .name =3D "rx_red_prio_4", }, - { .offset =3D 0x19, .name =3D "rx_red_prio_5", }, - { .offset =3D 0x1A, .name =3D "rx_red_prio_6", }, - { .offset =3D 0x1B, .name =3D "rx_red_prio_7", }, - { .offset =3D 0x1C, .name =3D "rx_yellow_prio_0", }, - { .offset =3D 0x1D, .name =3D "rx_yellow_prio_1", }, - { .offset =3D 0x1E, .name =3D "rx_yellow_prio_2", }, - { .offset =3D 0x1F, .name =3D "rx_yellow_prio_3", }, - { .offset =3D 0x20, .name =3D "rx_yellow_prio_4", }, - { .offset =3D 0x21, .name =3D "rx_yellow_prio_5", }, - { .offset =3D 0x22, .name =3D "rx_yellow_prio_6", }, - { .offset =3D 0x23, .name =3D "rx_yellow_prio_7", }, - { .offset =3D 0x24, .name =3D "rx_green_prio_0", }, - { .offset =3D 0x25, .name =3D "rx_green_prio_1", }, - { .offset =3D 0x26, .name =3D "rx_green_prio_2", }, - { .offset =3D 0x27, .name =3D "rx_green_prio_3", }, - { .offset =3D 0x28, .name =3D "rx_green_prio_4", }, - { .offset =3D 0x29, .name =3D "rx_green_prio_5", }, - { .offset =3D 0x2A, .name =3D "rx_green_prio_6", }, - { .offset =3D 0x2B, .name =3D "rx_green_prio_7", }, - { .offset =3D 0x40, .name =3D "tx_octets", }, - { .offset =3D 0x41, .name =3D "tx_unicast", }, - { .offset =3D 0x42, .name =3D "tx_multicast", }, - { .offset =3D 0x43, .name =3D "tx_broadcast", }, - { .offset =3D 0x44, .name =3D "tx_collision", }, - { .offset =3D 0x45, .name =3D "tx_drops", }, - { .offset =3D 0x46, .name =3D "tx_pause", }, - { .offset =3D 0x47, .name =3D "tx_frames_below_65_octets", }, - { .offset =3D 0x48, .name =3D "tx_frames_65_to_127_octets", }, - { .offset =3D 0x49, .name =3D "tx_frames_128_255_octets", }, - { .offset =3D 0x4A, .name =3D "tx_frames_256_511_octets", }, - { .offset =3D 0x4B, .name =3D "tx_frames_512_1023_octets", }, - { .offset =3D 0x4C, .name =3D "tx_frames_1024_1526_octets", }, - { .offset =3D 0x4D, .name =3D "tx_frames_over_1526_octets", }, - { .offset =3D 0x4E, .name =3D "tx_yellow_prio_0", }, - { .offset =3D 0x4F, .name =3D "tx_yellow_prio_1", }, - { .offset =3D 0x50, .name =3D "tx_yellow_prio_2", }, - { .offset =3D 0x51, .name =3D "tx_yellow_prio_3", }, - { .offset =3D 0x52, .name =3D "tx_yellow_prio_4", }, - { .offset =3D 0x53, .name =3D "tx_yellow_prio_5", }, - { .offset =3D 0x54, .name =3D "tx_yellow_prio_6", }, - { .offset =3D 0x55, .name =3D "tx_yellow_prio_7", }, - { .offset =3D 0x56, .name =3D "tx_green_prio_0", }, - { .offset =3D 0x57, .name =3D "tx_green_prio_1", }, - { .offset =3D 0x58, .name =3D "tx_green_prio_2", }, - { .offset =3D 0x59, .name =3D "tx_green_prio_3", }, - { .offset =3D 0x5A, .name =3D "tx_green_prio_4", }, - { .offset =3D 0x5B, .name =3D "tx_green_prio_5", }, - { .offset =3D 0x5C, .name =3D "tx_green_prio_6", }, - { .offset =3D 0x5D, .name =3D "tx_green_prio_7", }, - { .offset =3D 0x5E, .name =3D "tx_aged", }, - { .offset =3D 0x80, .name =3D "drop_local", }, - { .offset =3D 0x81, .name =3D "drop_tail", }, - { .offset =3D 0x82, .name =3D "drop_yellow_prio_0", }, - { .offset =3D 0x83, .name =3D "drop_yellow_prio_1", }, - { .offset =3D 0x84, .name =3D "drop_yellow_prio_2", }, - { .offset =3D 0x85, .name =3D "drop_yellow_prio_3", }, - { .offset =3D 0x86, .name =3D "drop_yellow_prio_4", }, - { .offset =3D 0x87, .name =3D "drop_yellow_prio_5", }, - { .offset =3D 0x88, .name =3D "drop_yellow_prio_6", }, - { .offset =3D 0x89, .name =3D "drop_yellow_prio_7", }, - { .offset =3D 0x8A, .name =3D "drop_green_prio_0", }, - { .offset =3D 0x8B, .name =3D "drop_green_prio_1", }, - { .offset =3D 0x8C, .name =3D "drop_green_prio_2", }, - { .offset =3D 0x8D, .name =3D "drop_green_prio_3", }, - { .offset =3D 0x8E, .name =3D "drop_green_prio_4", }, - { .offset =3D 0x8F, .name =3D "drop_green_prio_5", }, - { .offset =3D 0x90, .name =3D "drop_green_prio_6", }, - { .offset =3D 0x91, .name =3D "drop_green_prio_7", }, - OCELOT_STAT_END +static const struct ocelot_stat_layout vsc9953_stats_layout[OCELOT_NUM_STA= TS] =3D { + [OCELOT_STAT_RX_OCTETS] =3D { + .name =3D "rx_octets", + .offset =3D 0x00, + }, + [OCELOT_STAT_RX_UNICAST] =3D { + .name =3D "rx_unicast", + .offset =3D 0x01, + }, + [OCELOT_STAT_RX_MULTICAST] =3D { + .name =3D "rx_multicast", + .offset =3D 0x02, + }, + [OCELOT_STAT_RX_BROADCAST] =3D { + .name =3D "rx_broadcast", + .offset =3D 0x03, + }, + [OCELOT_STAT_RX_SHORTS] =3D { + .name =3D "rx_shorts", + .offset =3D 0x04, + }, + [OCELOT_STAT_RX_FRAGMENTS] =3D { + .name =3D "rx_fragments", + .offset =3D 0x05, + }, + [OCELOT_STAT_RX_JABBERS] =3D { + .name =3D "rx_jabbers", + .offset =3D 0x06, + }, + [OCELOT_STAT_RX_CRC_ALIGN_ERRS] =3D { + .name =3D "rx_crc_align_errs", + .offset =3D 0x07, + }, + [OCELOT_STAT_RX_SYM_ERRS] =3D { + .name =3D "rx_sym_errs", + .offset =3D 0x08, + }, + [OCELOT_STAT_RX_64] =3D { + .name =3D "rx_frames_below_65_octets", + .offset =3D 0x09, + }, + [OCELOT_STAT_RX_65_127] =3D { + .name =3D "rx_frames_65_to_127_octets", + .offset =3D 0x0A, + }, + [OCELOT_STAT_RX_128_255] =3D { + .name =3D "rx_frames_128_to_255_octets", + .offset =3D 0x0B, + }, + [OCELOT_STAT_RX_256_511] =3D { + .name =3D "rx_frames_256_to_511_octets", + .offset =3D 0x0C, + }, + [OCELOT_STAT_RX_512_1023] =3D { + .name =3D "rx_frames_512_to_1023_octets", + .offset =3D 0x0D, + }, + [OCELOT_STAT_RX_1024_1526] =3D { + .name =3D "rx_frames_1024_to_1526_octets", + .offset =3D 0x0E, + }, + [OCELOT_STAT_RX_1527_MAX] =3D { + .name =3D "rx_frames_over_1526_octets", + .offset =3D 0x0F, + }, + [OCELOT_STAT_RX_PAUSE] =3D { + .name =3D "rx_pause", + .offset =3D 0x10, + }, + [OCELOT_STAT_RX_CONTROL] =3D { + .name =3D "rx_control", + .offset =3D 0x11, + }, + [OCELOT_STAT_RX_LONGS] =3D { + .name =3D "rx_longs", + .offset =3D 0x12, + }, + [OCELOT_STAT_RX_CLASSIFIED_DROPS] =3D { + .name =3D "rx_classified_drops", + .offset =3D 0x13, + }, + [OCELOT_STAT_RX_RED_PRIO_0] =3D { + .name =3D "rx_red_prio_0", + .offset =3D 0x14, + }, + [OCELOT_STAT_RX_RED_PRIO_1] =3D { + .name =3D "rx_red_prio_1", + .offset =3D 0x15, + }, + [OCELOT_STAT_RX_RED_PRIO_2] =3D { + .name =3D "rx_red_prio_2", + .offset =3D 0x16, + }, + [OCELOT_STAT_RX_RED_PRIO_3] =3D { + .name =3D "rx_red_prio_3", + .offset =3D 0x17, + }, + [OCELOT_STAT_RX_RED_PRIO_4] =3D { + .name =3D "rx_red_prio_4", + .offset =3D 0x18, + }, + [OCELOT_STAT_RX_RED_PRIO_5] =3D { + .name =3D "rx_red_prio_5", + .offset =3D 0x19, + }, + [OCELOT_STAT_RX_RED_PRIO_6] =3D { + .name =3D "rx_red_prio_6", + .offset =3D 0x1A, + }, + [OCELOT_STAT_RX_RED_PRIO_7] =3D { + .name =3D "rx_red_prio_7", + .offset =3D 0x1B, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_0] =3D { + .name =3D "rx_yellow_prio_0", + .offset =3D 0x1C, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_1] =3D { + .name =3D "rx_yellow_prio_1", + .offset =3D 0x1D, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_2] =3D { + .name =3D "rx_yellow_prio_2", + .offset =3D 0x1E, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_3] =3D { + .name =3D "rx_yellow_prio_3", + .offset =3D 0x1F, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_4] =3D { + .name =3D "rx_yellow_prio_4", + .offset =3D 0x20, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_5] =3D { + .name =3D "rx_yellow_prio_5", + .offset =3D 0x21, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_6] =3D { + .name =3D "rx_yellow_prio_6", + .offset =3D 0x22, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_7] =3D { + .name =3D "rx_yellow_prio_7", + .offset =3D 0x23, + }, + [OCELOT_STAT_RX_GREEN_PRIO_0] =3D { + .name =3D "rx_green_prio_0", + .offset =3D 0x24, + }, + [OCELOT_STAT_RX_GREEN_PRIO_1] =3D { + .name =3D "rx_green_prio_1", + .offset =3D 0x25, + }, + [OCELOT_STAT_RX_GREEN_PRIO_2] =3D { + .name =3D "rx_green_prio_2", + .offset =3D 0x26, + }, + [OCELOT_STAT_RX_GREEN_PRIO_3] =3D { + .name =3D "rx_green_prio_3", + .offset =3D 0x27, + }, + [OCELOT_STAT_RX_GREEN_PRIO_4] =3D { + .name =3D "rx_green_prio_4", + .offset =3D 0x28, + }, + [OCELOT_STAT_RX_GREEN_PRIO_5] =3D { + .name =3D "rx_green_prio_5", + .offset =3D 0x29, + }, + [OCELOT_STAT_RX_GREEN_PRIO_6] =3D { + .name =3D "rx_green_prio_6", + .offset =3D 0x2A, + }, + [OCELOT_STAT_RX_GREEN_PRIO_7] =3D { + .name =3D "rx_green_prio_7", + .offset =3D 0x2B, + }, + [OCELOT_STAT_TX_OCTETS] =3D { + .name =3D "tx_octets", + .offset =3D 0x40, + }, + [OCELOT_STAT_TX_UNICAST] =3D { + .name =3D "tx_unicast", + .offset =3D 0x41, + }, + [OCELOT_STAT_TX_MULTICAST] =3D { + .name =3D "tx_multicast", + .offset =3D 0x42, + }, + [OCELOT_STAT_TX_BROADCAST] =3D { + .name =3D "tx_broadcast", + .offset =3D 0x43, + }, + [OCELOT_STAT_TX_COLLISION] =3D { + .name =3D "tx_collision", + .offset =3D 0x44, + }, + [OCELOT_STAT_TX_DROPS] =3D { + .name =3D "tx_drops", + .offset =3D 0x45, + }, + [OCELOT_STAT_TX_PAUSE] =3D { + .name =3D "tx_pause", + .offset =3D 0x46, + }, + [OCELOT_STAT_TX_64] =3D { + .name =3D "tx_frames_below_65_octets", + .offset =3D 0x47, + }, + [OCELOT_STAT_TX_65_127] =3D { + .name =3D "tx_frames_65_to_127_octets", + .offset =3D 0x48, + }, + [OCELOT_STAT_TX_128_255] =3D { + .name =3D "tx_frames_128_255_octets", + .offset =3D 0x49, + }, + [OCELOT_STAT_TX_256_511] =3D { + .name =3D "tx_frames_256_511_octets", + .offset =3D 0x4A, + }, + [OCELOT_STAT_TX_512_1023] =3D { + .name =3D "tx_frames_512_1023_octets", + .offset =3D 0x4B, + }, + [OCELOT_STAT_TX_1024_1526] =3D { + .name =3D "tx_frames_1024_1526_octets", + .offset =3D 0x4C, + }, + [OCELOT_STAT_TX_1527_MAX] =3D { + .name =3D "tx_frames_over_1526_octets", + .offset =3D 0x4D, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_0] =3D { + .name =3D "tx_yellow_prio_0", + .offset =3D 0x4E, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_1] =3D { + .name =3D "tx_yellow_prio_1", + .offset =3D 0x4F, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_2] =3D { + .name =3D "tx_yellow_prio_2", + .offset =3D 0x50, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_3] =3D { + .name =3D "tx_yellow_prio_3", + .offset =3D 0x51, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_4] =3D { + .name =3D "tx_yellow_prio_4", + .offset =3D 0x52, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_5] =3D { + .name =3D "tx_yellow_prio_5", + .offset =3D 0x53, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_6] =3D { + .name =3D "tx_yellow_prio_6", + .offset =3D 0x54, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_7] =3D { + .name =3D "tx_yellow_prio_7", + .offset =3D 0x55, + }, + [OCELOT_STAT_TX_GREEN_PRIO_0] =3D { + .name =3D "tx_green_prio_0", + .offset =3D 0x56, + }, + [OCELOT_STAT_TX_GREEN_PRIO_1] =3D { + .name =3D "tx_green_prio_1", + .offset =3D 0x57, + }, + [OCELOT_STAT_TX_GREEN_PRIO_2] =3D { + .name =3D "tx_green_prio_2", + .offset =3D 0x58, + }, + [OCELOT_STAT_TX_GREEN_PRIO_3] =3D { + .name =3D "tx_green_prio_3", + .offset =3D 0x59, + }, + [OCELOT_STAT_TX_GREEN_PRIO_4] =3D { + .name =3D "tx_green_prio_4", + .offset =3D 0x5A, + }, + [OCELOT_STAT_TX_GREEN_PRIO_5] =3D { + .name =3D "tx_green_prio_5", + .offset =3D 0x5B, + }, + [OCELOT_STAT_TX_GREEN_PRIO_6] =3D { + .name =3D "tx_green_prio_6", + .offset =3D 0x5C, + }, + [OCELOT_STAT_TX_GREEN_PRIO_7] =3D { + .name =3D "tx_green_prio_7", + .offset =3D 0x5D, + }, + [OCELOT_STAT_TX_AGED] =3D { + .name =3D "tx_aged", + .offset =3D 0x5E, + }, + [OCELOT_STAT_DROP_LOCAL] =3D { + .name =3D "drop_local", + .offset =3D 0x80, + }, + [OCELOT_STAT_DROP_TAIL] =3D { + .name =3D "drop_tail", + .offset =3D 0x81, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_0] =3D { + .name =3D "drop_yellow_prio_0", + .offset =3D 0x82, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_1] =3D { + .name =3D "drop_yellow_prio_1", + .offset =3D 0x83, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_2] =3D { + .name =3D "drop_yellow_prio_2", + .offset =3D 0x84, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_3] =3D { + .name =3D "drop_yellow_prio_3", + .offset =3D 0x85, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_4] =3D { + .name =3D "drop_yellow_prio_4", + .offset =3D 0x86, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_5] =3D { + .name =3D "drop_yellow_prio_5", + .offset =3D 0x87, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_6] =3D { + .name =3D "drop_yellow_prio_6", + .offset =3D 0x88, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_7] =3D { + .name =3D "drop_yellow_prio_7", + .offset =3D 0x89, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_0] =3D { + .name =3D "drop_green_prio_0", + .offset =3D 0x8A, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_1] =3D { + .name =3D "drop_green_prio_1", + .offset =3D 0x8B, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_2] =3D { + .name =3D "drop_green_prio_2", + .offset =3D 0x8C, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_3] =3D { + .name =3D "drop_green_prio_3", + .offset =3D 0x8D, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_4] =3D { + .name =3D "drop_green_prio_4", + .offset =3D 0x8E, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_5] =3D { + .name =3D "drop_green_prio_5", + .offset =3D 0x8F, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_6] =3D { + .name =3D "drop_green_prio_6", + .offset =3D 0x90, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_7] =3D { + .name =3D "drop_green_prio_7", + .offset =3D 0x91, + }, }; =20 static const struct vcap_field vsc9953_vcap_es0_keys[] =3D { diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc= /ocelot.c index c67f162f8ab5..68991b021c56 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1860,16 +1860,20 @@ void ocelot_get_strings(struct ocelot *ocelot, int = port, u32 sset, u8 *data) if (sset !=3D ETH_SS_STATS) return; =20 - for (i =3D 0; i < ocelot->num_stats; i++) + for (i =3D 0; i < OCELOT_NUM_STATS; i++) { + if (ocelot->stats_layout[i].name[0] =3D=3D '\0') + continue; + memcpy(data + i * ETH_GSTRING_LEN, ocelot->stats_layout[i].name, ETH_GSTRING_LEN); + } } EXPORT_SYMBOL(ocelot_get_strings); =20 /* Caller must hold &ocelot->stats_lock */ static int ocelot_port_update_stats(struct ocelot *ocelot, int port) { - unsigned int idx =3D port * ocelot->num_stats; + unsigned int idx =3D port * OCELOT_NUM_STATS; struct ocelot_stats_region *region; int err, j; =20 @@ -1930,9 +1934,15 @@ void ocelot_get_ethtool_stats(struct ocelot *ocelot,= int port, u64 *data) /* check and update now */ err =3D ocelot_port_update_stats(ocelot, port); =20 - /* Copy all counters */ - for (i =3D 0; i < ocelot->num_stats; i++) - *data++ =3D ocelot->stats[port * ocelot->num_stats + i]; + /* Copy all supported counters */ + for (i =3D 0; i < OCELOT_NUM_STATS; i++) { + int index =3D port * OCELOT_NUM_STATS + i; + + if (ocelot->stats_layout[i].name[0] =3D=3D '\0') + continue; + + *data++ =3D ocelot->stats[index]; + } =20 spin_unlock(&ocelot->stats_lock); =20 @@ -1943,10 +1953,16 @@ EXPORT_SYMBOL(ocelot_get_ethtool_stats); =20 int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset) { + int i, num_stats =3D 0; + if (sset !=3D ETH_SS_STATS) return -EOPNOTSUPP; =20 - return ocelot->num_stats; + for (i =3D 0; i < OCELOT_NUM_STATS; i++) + if (ocelot->stats_layout[i].name[0] !=3D '\0') + num_stats++; + + return num_stats; } EXPORT_SYMBOL(ocelot_get_sset_count); =20 @@ -1958,7 +1974,10 @@ static int ocelot_prepare_stats_regions(struct ocelo= t *ocelot) =20 INIT_LIST_HEAD(&ocelot->stats_regions); =20 - for (i =3D 0; i < ocelot->num_stats; i++) { + for (i =3D 0; i < OCELOT_NUM_STATS; i++) { + if (ocelot->stats_layout[i].name[0] =3D=3D '\0') + continue; + if (region && ocelot->stats_layout[i].offset =3D=3D last + 1) { region->count++; } else { @@ -3340,7 +3359,6 @@ static void ocelot_detect_features(struct ocelot *oce= lot) =20 int ocelot_init(struct ocelot *ocelot) { - const struct ocelot_stat_layout *stat; char queue_name[32]; int i, ret; u32 port; @@ -3353,12 +3371,8 @@ int ocelot_init(struct ocelot *ocelot) } } =20 - ocelot->num_stats =3D 0; - for_each_stat(ocelot, stat) - ocelot->num_stats++; - ocelot->stats =3D devm_kcalloc(ocelot->dev, - ocelot->num_phys_ports * ocelot->num_stats, + ocelot->num_phys_ports * OCELOT_NUM_STATS, sizeof(u64), GFP_KERNEL); if (!ocelot->stats) return -ENOMEM; diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ether= net/mscc/ocelot_vsc7514.c index 961f803aca19..9ff910560043 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -96,101 +96,379 @@ static const struct reg_field ocelot_regfields[REGFIE= LD_MAX] =3D { [SYS_PAUSE_CFG_PAUSE_ENA] =3D REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 12, 4), }; =20 -static const struct ocelot_stat_layout ocelot_stats_layout[] =3D { - { .name =3D "rx_octets", .offset =3D 0x00, }, - { .name =3D "rx_unicast", .offset =3D 0x01, }, - { .name =3D "rx_multicast", .offset =3D 0x02, }, - { .name =3D "rx_broadcast", .offset =3D 0x03, }, - { .name =3D "rx_shorts", .offset =3D 0x04, }, - { .name =3D "rx_fragments", .offset =3D 0x05, }, - { .name =3D "rx_jabbers", .offset =3D 0x06, }, - { .name =3D "rx_crc_align_errs", .offset =3D 0x07, }, - { .name =3D "rx_sym_errs", .offset =3D 0x08, }, - { .name =3D "rx_frames_below_65_octets", .offset =3D 0x09, }, - { .name =3D "rx_frames_65_to_127_octets", .offset =3D 0x0A, }, - { .name =3D "rx_frames_128_to_255_octets", .offset =3D 0x0B, }, - { .name =3D "rx_frames_256_to_511_octets", .offset =3D 0x0C, }, - { .name =3D "rx_frames_512_to_1023_octets", .offset =3D 0x0D, }, - { .name =3D "rx_frames_1024_to_1526_octets", .offset =3D 0x0E, }, - { .name =3D "rx_frames_over_1526_octets", .offset =3D 0x0F, }, - { .name =3D "rx_pause", .offset =3D 0x10, }, - { .name =3D "rx_control", .offset =3D 0x11, }, - { .name =3D "rx_longs", .offset =3D 0x12, }, - { .name =3D "rx_classified_drops", .offset =3D 0x13, }, - { .name =3D "rx_red_prio_0", .offset =3D 0x14, }, - { .name =3D "rx_red_prio_1", .offset =3D 0x15, }, - { .name =3D "rx_red_prio_2", .offset =3D 0x16, }, - { .name =3D "rx_red_prio_3", .offset =3D 0x17, }, - { .name =3D "rx_red_prio_4", .offset =3D 0x18, }, - { .name =3D "rx_red_prio_5", .offset =3D 0x19, }, - { .name =3D "rx_red_prio_6", .offset =3D 0x1A, }, - { .name =3D "rx_red_prio_7", .offset =3D 0x1B, }, - { .name =3D "rx_yellow_prio_0", .offset =3D 0x1C, }, - { .name =3D "rx_yellow_prio_1", .offset =3D 0x1D, }, - { .name =3D "rx_yellow_prio_2", .offset =3D 0x1E, }, - { .name =3D "rx_yellow_prio_3", .offset =3D 0x1F, }, - { .name =3D "rx_yellow_prio_4", .offset =3D 0x20, }, - { .name =3D "rx_yellow_prio_5", .offset =3D 0x21, }, - { .name =3D "rx_yellow_prio_6", .offset =3D 0x22, }, - { .name =3D "rx_yellow_prio_7", .offset =3D 0x23, }, - { .name =3D "rx_green_prio_0", .offset =3D 0x24, }, - { .name =3D "rx_green_prio_1", .offset =3D 0x25, }, - { .name =3D "rx_green_prio_2", .offset =3D 0x26, }, - { .name =3D "rx_green_prio_3", .offset =3D 0x27, }, - { .name =3D "rx_green_prio_4", .offset =3D 0x28, }, - { .name =3D "rx_green_prio_5", .offset =3D 0x29, }, - { .name =3D "rx_green_prio_6", .offset =3D 0x2A, }, - { .name =3D "rx_green_prio_7", .offset =3D 0x2B, }, - { .name =3D "tx_octets", .offset =3D 0x40, }, - { .name =3D "tx_unicast", .offset =3D 0x41, }, - { .name =3D "tx_multicast", .offset =3D 0x42, }, - { .name =3D "tx_broadcast", .offset =3D 0x43, }, - { .name =3D "tx_collision", .offset =3D 0x44, }, - { .name =3D "tx_drops", .offset =3D 0x45, }, - { .name =3D "tx_pause", .offset =3D 0x46, }, - { .name =3D "tx_frames_below_65_octets", .offset =3D 0x47, }, - { .name =3D "tx_frames_65_to_127_octets", .offset =3D 0x48, }, - { .name =3D "tx_frames_128_255_octets", .offset =3D 0x49, }, - { .name =3D "tx_frames_256_511_octets", .offset =3D 0x4A, }, - { .name =3D "tx_frames_512_1023_octets", .offset =3D 0x4B, }, - { .name =3D "tx_frames_1024_1526_octets", .offset =3D 0x4C, }, - { .name =3D "tx_frames_over_1526_octets", .offset =3D 0x4D, }, - { .name =3D "tx_yellow_prio_0", .offset =3D 0x4E, }, - { .name =3D "tx_yellow_prio_1", .offset =3D 0x4F, }, - { .name =3D "tx_yellow_prio_2", .offset =3D 0x50, }, - { .name =3D "tx_yellow_prio_3", .offset =3D 0x51, }, - { .name =3D "tx_yellow_prio_4", .offset =3D 0x52, }, - { .name =3D "tx_yellow_prio_5", .offset =3D 0x53, }, - { .name =3D "tx_yellow_prio_6", .offset =3D 0x54, }, - { .name =3D "tx_yellow_prio_7", .offset =3D 0x55, }, - { .name =3D "tx_green_prio_0", .offset =3D 0x56, }, - { .name =3D "tx_green_prio_1", .offset =3D 0x57, }, - { .name =3D "tx_green_prio_2", .offset =3D 0x58, }, - { .name =3D "tx_green_prio_3", .offset =3D 0x59, }, - { .name =3D "tx_green_prio_4", .offset =3D 0x5A, }, - { .name =3D "tx_green_prio_5", .offset =3D 0x5B, }, - { .name =3D "tx_green_prio_6", .offset =3D 0x5C, }, - { .name =3D "tx_green_prio_7", .offset =3D 0x5D, }, - { .name =3D "tx_aged", .offset =3D 0x5E, }, - { .name =3D "drop_local", .offset =3D 0x80, }, - { .name =3D "drop_tail", .offset =3D 0x81, }, - { .name =3D "drop_yellow_prio_0", .offset =3D 0x82, }, - { .name =3D "drop_yellow_prio_1", .offset =3D 0x83, }, - { .name =3D "drop_yellow_prio_2", .offset =3D 0x84, }, - { .name =3D "drop_yellow_prio_3", .offset =3D 0x85, }, - { .name =3D "drop_yellow_prio_4", .offset =3D 0x86, }, - { .name =3D "drop_yellow_prio_5", .offset =3D 0x87, }, - { .name =3D "drop_yellow_prio_6", .offset =3D 0x88, }, - { .name =3D "drop_yellow_prio_7", .offset =3D 0x89, }, - { .name =3D "drop_green_prio_0", .offset =3D 0x8A, }, - { .name =3D "drop_green_prio_1", .offset =3D 0x8B, }, - { .name =3D "drop_green_prio_2", .offset =3D 0x8C, }, - { .name =3D "drop_green_prio_3", .offset =3D 0x8D, }, - { .name =3D "drop_green_prio_4", .offset =3D 0x8E, }, - { .name =3D "drop_green_prio_5", .offset =3D 0x8F, }, - { .name =3D "drop_green_prio_6", .offset =3D 0x90, }, - { .name =3D "drop_green_prio_7", .offset =3D 0x91, }, - OCELOT_STAT_END +static const struct ocelot_stat_layout ocelot_stats_layout[OCELOT_NUM_STAT= S] =3D { + [OCELOT_STAT_RX_OCTETS] =3D { + .name =3D "rx_octets", + .offset =3D 0x00, + }, + [OCELOT_STAT_RX_UNICAST] =3D { + .name =3D "rx_unicast", + .offset =3D 0x01, + }, + [OCELOT_STAT_RX_MULTICAST] =3D { + .name =3D "rx_multicast", + .offset =3D 0x02, + }, + [OCELOT_STAT_RX_BROADCAST] =3D { + .name =3D "rx_broadcast", + .offset =3D 0x03, + }, + [OCELOT_STAT_RX_SHORTS] =3D { + .name =3D "rx_shorts", + .offset =3D 0x04, + }, + [OCELOT_STAT_RX_FRAGMENTS] =3D { + .name =3D "rx_fragments", + .offset =3D 0x05, + }, + [OCELOT_STAT_RX_JABBERS] =3D { + .name =3D "rx_jabbers", + .offset =3D 0x06, + }, + [OCELOT_STAT_RX_CRC_ALIGN_ERRS] =3D { + .name =3D "rx_crc_align_errs", + .offset =3D 0x07, + }, + [OCELOT_STAT_RX_SYM_ERRS] =3D { + .name =3D "rx_sym_errs", + .offset =3D 0x08, + }, + [OCELOT_STAT_RX_64] =3D { + .name =3D "rx_frames_below_65_octets", + .offset =3D 0x09, + }, + [OCELOT_STAT_RX_65_127] =3D { + .name =3D "rx_frames_65_to_127_octets", + .offset =3D 0x0A, + }, + [OCELOT_STAT_RX_128_255] =3D { + .name =3D "rx_frames_128_to_255_octets", + .offset =3D 0x0B, + }, + [OCELOT_STAT_RX_256_511] =3D { + .name =3D "rx_frames_256_to_511_octets", + .offset =3D 0x0C, + }, + [OCELOT_STAT_RX_512_1023] =3D { + .name =3D "rx_frames_512_to_1023_octets", + .offset =3D 0x0D, + }, + [OCELOT_STAT_RX_1024_1526] =3D { + .name =3D "rx_frames_1024_to_1526_octets", + .offset =3D 0x0E, + }, + [OCELOT_STAT_RX_1527_MAX] =3D { + .name =3D "rx_frames_over_1526_octets", + .offset =3D 0x0F, + }, + [OCELOT_STAT_RX_PAUSE] =3D { + .name =3D "rx_pause", + .offset =3D 0x10, + }, + [OCELOT_STAT_RX_CONTROL] =3D { + .name =3D "rx_control", + .offset =3D 0x11, + }, + [OCELOT_STAT_RX_LONGS] =3D { + .name =3D "rx_longs", + .offset =3D 0x12, + }, + [OCELOT_STAT_RX_CLASSIFIED_DROPS] =3D { + .name =3D "rx_classified_drops", + .offset =3D 0x13, + }, + [OCELOT_STAT_RX_RED_PRIO_0] =3D { + .name =3D "rx_red_prio_0", + .offset =3D 0x14, + }, + [OCELOT_STAT_RX_RED_PRIO_1] =3D { + .name =3D "rx_red_prio_1", + .offset =3D 0x15, + }, + [OCELOT_STAT_RX_RED_PRIO_2] =3D { + .name =3D "rx_red_prio_2", + .offset =3D 0x16, + }, + [OCELOT_STAT_RX_RED_PRIO_3] =3D { + .name =3D "rx_red_prio_3", + .offset =3D 0x17, + }, + [OCELOT_STAT_RX_RED_PRIO_4] =3D { + .name =3D "rx_red_prio_4", + .offset =3D 0x18, + }, + [OCELOT_STAT_RX_RED_PRIO_5] =3D { + .name =3D "rx_red_prio_5", + .offset =3D 0x19, + }, + [OCELOT_STAT_RX_RED_PRIO_6] =3D { + .name =3D "rx_red_prio_6", + .offset =3D 0x1A, + }, + [OCELOT_STAT_RX_RED_PRIO_7] =3D { + .name =3D "rx_red_prio_7", + .offset =3D 0x1B, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_0] =3D { + .name =3D "rx_yellow_prio_0", + .offset =3D 0x1C, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_1] =3D { + .name =3D "rx_yellow_prio_1", + .offset =3D 0x1D, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_2] =3D { + .name =3D "rx_yellow_prio_2", + .offset =3D 0x1E, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_3] =3D { + .name =3D "rx_yellow_prio_3", + .offset =3D 0x1F, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_4] =3D { + .name =3D "rx_yellow_prio_4", + .offset =3D 0x20, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_5] =3D { + .name =3D "rx_yellow_prio_5", + .offset =3D 0x21, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_6] =3D { + .name =3D "rx_yellow_prio_6", + .offset =3D 0x22, + }, + [OCELOT_STAT_RX_YELLOW_PRIO_7] =3D { + .name =3D "rx_yellow_prio_7", + .offset =3D 0x23, + }, + [OCELOT_STAT_RX_GREEN_PRIO_0] =3D { + .name =3D "rx_green_prio_0", + .offset =3D 0x24, + }, + [OCELOT_STAT_RX_GREEN_PRIO_1] =3D { + .name =3D "rx_green_prio_1", + .offset =3D 0x25, + }, + [OCELOT_STAT_RX_GREEN_PRIO_2] =3D { + .name =3D "rx_green_prio_2", + .offset =3D 0x26, + }, + [OCELOT_STAT_RX_GREEN_PRIO_3] =3D { + .name =3D "rx_green_prio_3", + .offset =3D 0x27, + }, + [OCELOT_STAT_RX_GREEN_PRIO_4] =3D { + .name =3D "rx_green_prio_4", + .offset =3D 0x28, + }, + [OCELOT_STAT_RX_GREEN_PRIO_5] =3D { + .name =3D "rx_green_prio_5", + .offset =3D 0x29, + }, + [OCELOT_STAT_RX_GREEN_PRIO_6] =3D { + .name =3D "rx_green_prio_6", + .offset =3D 0x2A, + }, + [OCELOT_STAT_RX_GREEN_PRIO_7] =3D { + .name =3D "rx_green_prio_7", + .offset =3D 0x2B, + }, + [OCELOT_STAT_TX_OCTETS] =3D { + .name =3D "tx_octets", + .offset =3D 0x40, + }, + [OCELOT_STAT_TX_UNICAST] =3D { + .name =3D "tx_unicast", + .offset =3D 0x41, + }, + [OCELOT_STAT_TX_MULTICAST] =3D { + .name =3D "tx_multicast", + .offset =3D 0x42, + }, + [OCELOT_STAT_TX_BROADCAST] =3D { + .name =3D "tx_broadcast", + .offset =3D 0x43, + }, + [OCELOT_STAT_TX_COLLISION] =3D { + .name =3D "tx_collision", + .offset =3D 0x44, + }, + [OCELOT_STAT_TX_DROPS] =3D { + .name =3D "tx_drops", + .offset =3D 0x45, + }, + [OCELOT_STAT_TX_PAUSE] =3D { + .name =3D "tx_pause", + .offset =3D 0x46, + }, + [OCELOT_STAT_TX_64] =3D { + .name =3D "tx_frames_below_65_octets", + .offset =3D 0x47, + }, + [OCELOT_STAT_TX_65_127] =3D { + .name =3D "tx_frames_65_to_127_octets", + .offset =3D 0x48, + }, + [OCELOT_STAT_TX_128_255] =3D { + .name =3D "tx_frames_128_255_octets", + .offset =3D 0x49, + }, + [OCELOT_STAT_TX_256_511] =3D { + .name =3D "tx_frames_256_511_octets", + .offset =3D 0x4A, + }, + [OCELOT_STAT_TX_512_1023] =3D { + .name =3D "tx_frames_512_1023_octets", + .offset =3D 0x4B, + }, + [OCELOT_STAT_TX_1024_1526] =3D { + .name =3D "tx_frames_1024_1526_octets", + .offset =3D 0x4C, + }, + [OCELOT_STAT_TX_1527_MAX] =3D { + .name =3D "tx_frames_over_1526_octets", + .offset =3D 0x4D, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_0] =3D { + .name =3D "tx_yellow_prio_0", + .offset =3D 0x4E, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_1] =3D { + .name =3D "tx_yellow_prio_1", + .offset =3D 0x4F, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_2] =3D { + .name =3D "tx_yellow_prio_2", + .offset =3D 0x50, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_3] =3D { + .name =3D "tx_yellow_prio_3", + .offset =3D 0x51, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_4] =3D { + .name =3D "tx_yellow_prio_4", + .offset =3D 0x52, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_5] =3D { + .name =3D "tx_yellow_prio_5", + .offset =3D 0x53, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_6] =3D { + .name =3D "tx_yellow_prio_6", + .offset =3D 0x54, + }, + [OCELOT_STAT_TX_YELLOW_PRIO_7] =3D { + .name =3D "tx_yellow_prio_7", + .offset =3D 0x55, + }, + [OCELOT_STAT_TX_GREEN_PRIO_0] =3D { + .name =3D "tx_green_prio_0", + .offset =3D 0x56, + }, + [OCELOT_STAT_TX_GREEN_PRIO_1] =3D { + .name =3D "tx_green_prio_1", + .offset =3D 0x57, + }, + [OCELOT_STAT_TX_GREEN_PRIO_2] =3D { + .name =3D "tx_green_prio_2", + .offset =3D 0x58, + }, + [OCELOT_STAT_TX_GREEN_PRIO_3] =3D { + .name =3D "tx_green_prio_3", + .offset =3D 0x59, + }, + [OCELOT_STAT_TX_GREEN_PRIO_4] =3D { + .name =3D "tx_green_prio_4", + .offset =3D 0x5A, + }, + [OCELOT_STAT_TX_GREEN_PRIO_5] =3D { + .name =3D "tx_green_prio_5", + .offset =3D 0x5B, + }, + [OCELOT_STAT_TX_GREEN_PRIO_6] =3D { + .name =3D "tx_green_prio_6", + .offset =3D 0x5C, + }, + [OCELOT_STAT_TX_GREEN_PRIO_7] =3D { + .name =3D "tx_green_prio_7", + .offset =3D 0x5D, + }, + [OCELOT_STAT_TX_AGED] =3D { + .name =3D "tx_aged", + .offset =3D 0x5E, + }, + [OCELOT_STAT_DROP_LOCAL] =3D { + .name =3D "drop_local", + .offset =3D 0x80, + }, + [OCELOT_STAT_DROP_TAIL] =3D { + .name =3D "drop_tail", + .offset =3D 0x81, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_0] =3D { + .name =3D "drop_yellow_prio_0", + .offset =3D 0x82, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_1] =3D { + .name =3D "drop_yellow_prio_1", + .offset =3D 0x83, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_2] =3D { + .name =3D "drop_yellow_prio_2", + .offset =3D 0x84, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_3] =3D { + .name =3D "drop_yellow_prio_3", + .offset =3D 0x85, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_4] =3D { + .name =3D "drop_yellow_prio_4", + .offset =3D 0x86, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_5] =3D { + .name =3D "drop_yellow_prio_5", + .offset =3D 0x87, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_6] =3D { + .name =3D "drop_yellow_prio_6", + .offset =3D 0x88, + }, + [OCELOT_STAT_DROP_YELLOW_PRIO_7] =3D { + .name =3D "drop_yellow_prio_7", + .offset =3D 0x89, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_0] =3D { + .name =3D "drop_green_prio_0", + .offset =3D 0x8A, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_1] =3D { + .name =3D "drop_green_prio_1", + .offset =3D 0x8B, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_2] =3D { + .name =3D "drop_green_prio_2", + .offset =3D 0x8C, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_3] =3D { + .name =3D "drop_green_prio_3", + .offset =3D 0x8D, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_4] =3D { + .name =3D "drop_green_prio_4", + .offset =3D 0x8E, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_5] =3D { + .name =3D "drop_green_prio_5", + .offset =3D 0x8F, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_6] =3D { + .name =3D "drop_green_prio_6", + .offset =3D 0x90, + }, + [OCELOT_STAT_DROP_GREEN_PRIO_7] =3D { + .name =3D "drop_green_prio_7", + .offset =3D 0x91, + }, }; =20 static void ocelot_pll5_init(struct ocelot *ocelot) diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 72b9474391da..2428bc64cb1d 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -105,11 +105,6 @@ #define REG_RESERVED_ADDR 0xffffffff #define REG_RESERVED(reg) REG(reg, REG_RESERVED_ADDR) =20 -#define for_each_stat(ocelot, stat) \ - for ((stat) =3D (ocelot)->stats_layout; \ - ((stat)->name[0] !=3D '\0'); \ - (stat)++) - enum ocelot_target { ANA =3D 1, QS, @@ -540,13 +535,108 @@ enum ocelot_ptp_pins { TOD_ACC_PIN }; =20 +enum ocelot_stat { + OCELOT_STAT_RX_OCTETS, + OCELOT_STAT_RX_UNICAST, + OCELOT_STAT_RX_MULTICAST, + OCELOT_STAT_RX_BROADCAST, + OCELOT_STAT_RX_SHORTS, + OCELOT_STAT_RX_FRAGMENTS, + OCELOT_STAT_RX_JABBERS, + OCELOT_STAT_RX_CRC_ALIGN_ERRS, + OCELOT_STAT_RX_SYM_ERRS, + OCELOT_STAT_RX_64, + OCELOT_STAT_RX_65_127, + OCELOT_STAT_RX_128_255, + OCELOT_STAT_RX_256_511, + OCELOT_STAT_RX_512_1023, + OCELOT_STAT_RX_1024_1526, + OCELOT_STAT_RX_1527_MAX, + OCELOT_STAT_RX_PAUSE, + OCELOT_STAT_RX_CONTROL, + OCELOT_STAT_RX_LONGS, + OCELOT_STAT_RX_CLASSIFIED_DROPS, + OCELOT_STAT_RX_RED_PRIO_0, + OCELOT_STAT_RX_RED_PRIO_1, + OCELOT_STAT_RX_RED_PRIO_2, + OCELOT_STAT_RX_RED_PRIO_3, + OCELOT_STAT_RX_RED_PRIO_4, + OCELOT_STAT_RX_RED_PRIO_5, + OCELOT_STAT_RX_RED_PRIO_6, + OCELOT_STAT_RX_RED_PRIO_7, + OCELOT_STAT_RX_YELLOW_PRIO_0, + OCELOT_STAT_RX_YELLOW_PRIO_1, + OCELOT_STAT_RX_YELLOW_PRIO_2, + OCELOT_STAT_RX_YELLOW_PRIO_3, + OCELOT_STAT_RX_YELLOW_PRIO_4, + OCELOT_STAT_RX_YELLOW_PRIO_5, + OCELOT_STAT_RX_YELLOW_PRIO_6, + OCELOT_STAT_RX_YELLOW_PRIO_7, + OCELOT_STAT_RX_GREEN_PRIO_0, + OCELOT_STAT_RX_GREEN_PRIO_1, + OCELOT_STAT_RX_GREEN_PRIO_2, + OCELOT_STAT_RX_GREEN_PRIO_3, + OCELOT_STAT_RX_GREEN_PRIO_4, + OCELOT_STAT_RX_GREEN_PRIO_5, + OCELOT_STAT_RX_GREEN_PRIO_6, + OCELOT_STAT_RX_GREEN_PRIO_7, + OCELOT_STAT_TX_OCTETS, + OCELOT_STAT_TX_UNICAST, + OCELOT_STAT_TX_MULTICAST, + OCELOT_STAT_TX_BROADCAST, + OCELOT_STAT_TX_COLLISION, + OCELOT_STAT_TX_DROPS, + OCELOT_STAT_TX_PAUSE, + OCELOT_STAT_TX_64, + OCELOT_STAT_TX_65_127, + OCELOT_STAT_TX_128_255, + OCELOT_STAT_TX_256_511, + OCELOT_STAT_TX_512_1023, + OCELOT_STAT_TX_1024_1526, + OCELOT_STAT_TX_1527_MAX, + OCELOT_STAT_TX_YELLOW_PRIO_0, + OCELOT_STAT_TX_YELLOW_PRIO_1, + OCELOT_STAT_TX_YELLOW_PRIO_2, + OCELOT_STAT_TX_YELLOW_PRIO_3, + OCELOT_STAT_TX_YELLOW_PRIO_4, + OCELOT_STAT_TX_YELLOW_PRIO_5, + OCELOT_STAT_TX_YELLOW_PRIO_6, + OCELOT_STAT_TX_YELLOW_PRIO_7, + OCELOT_STAT_TX_GREEN_PRIO_0, + OCELOT_STAT_TX_GREEN_PRIO_1, + OCELOT_STAT_TX_GREEN_PRIO_2, + OCELOT_STAT_TX_GREEN_PRIO_3, + OCELOT_STAT_TX_GREEN_PRIO_4, + OCELOT_STAT_TX_GREEN_PRIO_5, + OCELOT_STAT_TX_GREEN_PRIO_6, + OCELOT_STAT_TX_GREEN_PRIO_7, + OCELOT_STAT_TX_AGED, + OCELOT_STAT_DROP_LOCAL, + OCELOT_STAT_DROP_TAIL, + OCELOT_STAT_DROP_YELLOW_PRIO_0, + OCELOT_STAT_DROP_YELLOW_PRIO_1, + OCELOT_STAT_DROP_YELLOW_PRIO_2, + OCELOT_STAT_DROP_YELLOW_PRIO_3, + OCELOT_STAT_DROP_YELLOW_PRIO_4, + OCELOT_STAT_DROP_YELLOW_PRIO_5, + OCELOT_STAT_DROP_YELLOW_PRIO_6, + OCELOT_STAT_DROP_YELLOW_PRIO_7, + OCELOT_STAT_DROP_GREEN_PRIO_0, + OCELOT_STAT_DROP_GREEN_PRIO_1, + OCELOT_STAT_DROP_GREEN_PRIO_2, + OCELOT_STAT_DROP_GREEN_PRIO_3, + OCELOT_STAT_DROP_GREEN_PRIO_4, + OCELOT_STAT_DROP_GREEN_PRIO_5, + OCELOT_STAT_DROP_GREEN_PRIO_6, + OCELOT_STAT_DROP_GREEN_PRIO_7, + OCELOT_NUM_STATS, +}; + struct ocelot_stat_layout { u32 offset; char name[ETH_GSTRING_LEN]; }; =20 -#define OCELOT_STAT_END { .name =3D "" } - struct ocelot_stats_region { struct list_head node; u32 offset; @@ -709,7 +799,6 @@ struct ocelot { const u32 *const *map; const struct ocelot_stat_layout *stats_layout; struct list_head stats_regions; - unsigned int num_stats; =20 u32 pool_size[OCELOT_SB_NUM][OCELOT_SB_POOL_NUM]; int packet_buffer_size; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F41EC32774 for ; Tue, 23 Aug 2022 09:13:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347335AbiHWJL4 (ORCPT ); Tue, 23 Aug 2022 05:11:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348206AbiHWJJ5 (ORCPT ); Tue, 23 Aug 2022 05:09:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DC8B74DD6; Tue, 23 Aug 2022 01:30:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AC5D8614CA; Tue, 23 Aug 2022 08:29:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B60ADC433B5; Tue, 23 Aug 2022 08:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243367; bh=TwqLt3hNn9yFWoN1IQ77dG1SLU8ADuZswLmHKbLb61w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gVKNRmVHoQYeCVWeHwmWYI9CPl2hVG9TcfCrBrmtIQJ/RziwEY26enWN4Zgs3uzpd dsKKh077qRDRiqR+hdvMrs7etBY07XMQLbmGFlR60Kn5m7nzY3GdDCH74jsrUt7dbx C7kcBra7r2jKDBfAXepoRFa/DUWenHti/mK3t5C4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 254/365] net: mscc: ocelot: report ndo_get_stats64 from the wraparound-resistant ocelot->stats Date: Tue, 23 Aug 2022 10:02:35 +0200 Message-Id: <20220823080128.824469865@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit e780e3193e889fd8358b862f7cd18ec5a4901caf ] Rather than reading the stats64 counters directly from the 32-bit hardware, it's better to rely on the output produced by the periodic ocelot_port_update_stats(). It would be even better to call ocelot_port_update_stats() right from ocelot_get_stats64() to make sure we report the current values rather than the ones from 2 seconds ago. But we need to export ocelot_port_update_stats() from the switch lib towards the switchdev driver for that, and future work will largely undo that. There are more ocelot-based drivers waiting to be introduced, an example of which is the SPI-controlled VSC7512. In that driver's case, it will be impossible to call ocelot_port_update_stats() from ndo_get_stats64 context, since the latter is atomic, and reading the stats over SPI is sleepable. So the compromise taken here, which will also hold going forward, is to report 64-bit counters to stats64, which are not 100% up to date. Fixes: a556c76adc05 ("net: mscc: Add initial Ocelot switch support") Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/net/ethernet/mscc/ocelot_net.c | 53 +++++++++++++------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/= mscc/ocelot_net.c index 6b9d37138844..330d30841cdc 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -725,41 +725,40 @@ static void ocelot_get_stats64(struct net_device *dev, struct ocelot_port_private *priv =3D netdev_priv(dev); struct ocelot *ocelot =3D priv->port.ocelot; int port =3D priv->port.index; + u64 *s; =20 spin_lock(&ocelot->stats_lock); =20 - /* Configure the port to read the stats from */ - ocelot_write(ocelot, SYS_STAT_CFG_STAT_VIEW(port), - SYS_STAT_CFG); + s =3D &ocelot->stats[port * OCELOT_NUM_STATS]; =20 /* Get Rx stats */ - stats->rx_bytes =3D ocelot_read(ocelot, SYS_COUNT_RX_OCTETS); - stats->rx_packets =3D ocelot_read(ocelot, SYS_COUNT_RX_SHORTS) + - ocelot_read(ocelot, SYS_COUNT_RX_FRAGMENTS) + - ocelot_read(ocelot, SYS_COUNT_RX_JABBERS) + - ocelot_read(ocelot, SYS_COUNT_RX_LONGS) + - ocelot_read(ocelot, SYS_COUNT_RX_64) + - ocelot_read(ocelot, SYS_COUNT_RX_65_127) + - ocelot_read(ocelot, SYS_COUNT_RX_128_255) + - ocelot_read(ocelot, SYS_COUNT_RX_256_511) + - ocelot_read(ocelot, SYS_COUNT_RX_512_1023) + - ocelot_read(ocelot, SYS_COUNT_RX_1024_1526) + - ocelot_read(ocelot, SYS_COUNT_RX_1527_MAX); - stats->multicast =3D ocelot_read(ocelot, SYS_COUNT_RX_MULTICAST); + stats->rx_bytes =3D s[OCELOT_STAT_RX_OCTETS]; + stats->rx_packets =3D s[OCELOT_STAT_RX_SHORTS] + + s[OCELOT_STAT_RX_FRAGMENTS] + + s[OCELOT_STAT_RX_JABBERS] + + s[OCELOT_STAT_RX_LONGS] + + s[OCELOT_STAT_RX_64] + + s[OCELOT_STAT_RX_65_127] + + s[OCELOT_STAT_RX_128_255] + + s[OCELOT_STAT_RX_256_511] + + s[OCELOT_STAT_RX_512_1023] + + s[OCELOT_STAT_RX_1024_1526] + + s[OCELOT_STAT_RX_1527_MAX]; + stats->multicast =3D s[OCELOT_STAT_RX_MULTICAST]; stats->rx_dropped =3D dev->stats.rx_dropped; =20 /* Get Tx stats */ - stats->tx_bytes =3D ocelot_read(ocelot, SYS_COUNT_TX_OCTETS); - stats->tx_packets =3D ocelot_read(ocelot, SYS_COUNT_TX_64) + - ocelot_read(ocelot, SYS_COUNT_TX_65_127) + - ocelot_read(ocelot, SYS_COUNT_TX_128_255) + - ocelot_read(ocelot, SYS_COUNT_TX_256_511) + - ocelot_read(ocelot, SYS_COUNT_TX_512_1023) + - ocelot_read(ocelot, SYS_COUNT_TX_1024_1526) + - ocelot_read(ocelot, SYS_COUNT_TX_1527_MAX); - stats->tx_dropped =3D ocelot_read(ocelot, SYS_COUNT_TX_DROPS) + - ocelot_read(ocelot, SYS_COUNT_TX_AGING); - stats->collisions =3D ocelot_read(ocelot, SYS_COUNT_TX_COLLISION); + stats->tx_bytes =3D s[OCELOT_STAT_TX_OCTETS]; + stats->tx_packets =3D s[OCELOT_STAT_TX_64] + + s[OCELOT_STAT_TX_65_127] + + s[OCELOT_STAT_TX_128_255] + + s[OCELOT_STAT_TX_256_511] + + s[OCELOT_STAT_TX_512_1023] + + s[OCELOT_STAT_TX_1024_1526] + + s[OCELOT_STAT_TX_1527_MAX]; + stats->tx_dropped =3D s[OCELOT_STAT_TX_DROPS] + + s[OCELOT_STAT_TX_AGED]; + stats->collisions =3D s[OCELOT_STAT_TX_COLLISION]; =20 spin_unlock(&ocelot->stats_lock); } --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90852C32772 for ; Tue, 23 Aug 2022 09:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348548AbiHWJNA (ORCPT ); Tue, 23 Aug 2022 05:13:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348541AbiHWJKb (ORCPT ); Tue, 23 Aug 2022 05:10:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3322A86B50; Tue, 23 Aug 2022 01:31:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D5A2461360; Tue, 23 Aug 2022 08:29:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA772C433D6; Tue, 23 Aug 2022 08:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243370; bh=1BYEHRjVREcdMBhA1wsIgbziwPW+7xcj9xwgN5GfgxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yh2VrytR7Rzph++QiFko1yOytd48rk6zxHoA2xATrelJZ4qg/ARrFsXEHSPym9PVX tcVdBd5UUH8G57DPRpYgvMTAKWoePrxBuFlbBkoDNZ92EFA/IMrSE2oUj6AEtsINKD yOCAxjcLdSsJhBr/Hgv2YcJbJeSrpfk3mJlnjEP8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Poimboeuf , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.19 255/365] x86/ibt, objtool: Add IBT_NOSEAL() Date: Tue, 23 Aug 2022 10:02:36 +0200 Message-Id: <20220823080128.867380224@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josh Poimboeuf [ Upstream commit e27e5bea956ce4d3eb15112de5fa5a3b77c2f488 ] Add a macro which prevents a function from getting sealed if there are no compile-time references to it. Signed-off-by: Josh Poimboeuf Message-Id: <20220818213927.e44fmxkoq4yj6ybn@treble> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/x86/include/asm/ibt.h | 11 +++++++++++ tools/objtool/check.c | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/ibt.h b/arch/x86/include/asm/ibt.h index 689880eca9ba..9b08082a5d9f 100644 --- a/arch/x86/include/asm/ibt.h +++ b/arch/x86/include/asm/ibt.h @@ -31,6 +31,16 @@ =20 #define __noendbr __attribute__((nocf_check)) =20 +/* + * Create a dummy function pointer reference to prevent objtool from marki= ng + * the function as needing to be "sealed" (i.e. ENDBR converted to NOP by + * apply_ibt_endbr()). + */ +#define IBT_NOSEAL(fname) \ + ".pushsection .discard.ibt_endbr_noseal\n\t" \ + _ASM_PTR fname "\n\t" \ + ".popsection\n\t" + static inline __attribute_const__ u32 gen_endbr(void) { u32 endbr; @@ -84,6 +94,7 @@ extern __noendbr void ibt_restore(u64 save); #ifndef __ASSEMBLY__ =20 #define ASM_ENDBR +#define IBT_NOSEAL(name) =20 #define __noendbr =20 diff --git a/tools/objtool/check.c b/tools/objtool/check.c index b341f8a8c7c5..31c719f99f66 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4096,7 +4096,8 @@ static int validate_ibt(struct objtool_file *file) * These sections can reference text addresses, but not with * the intent to indirect branch to them. */ - if (!strncmp(sec->name, ".discard", 8) || + if ((!strncmp(sec->name, ".discard", 8) && + strcmp(sec->name, ".discard.ibt_endbr_noseal")) || !strncmp(sec->name, ".debug", 6) || !strcmp(sec->name, ".altinstructions") || !strcmp(sec->name, ".ibt_endbr_seal") || --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AD1FC32793 for ; Tue, 23 Aug 2022 09:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348437AbiHWJMG (ORCPT ); Tue, 23 Aug 2022 05:12:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348267AbiHWJKC (ORCPT ); Tue, 23 Aug 2022 05:10:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AC7D6CF44; Tue, 23 Aug 2022 01:30:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D358F614D3; Tue, 23 Aug 2022 08:29:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5BFBC433D7; Tue, 23 Aug 2022 08:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243373; bh=g/+coOW5lUeirePAEayAtHU5SKrm1HBE7FI5NENdJmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bZF5FqSXLCedANdPfH/PPxNcspqY3s4+xYRiUAOHx48f+Ip04H5UrPs01FmcntBNy WPznE1aUKmLGygBgAtiW0C4qoGiRqOzt/xkj0pu7ewcFkVvFHzn4u0kxkTWOtXhSqB OeRGaWYZ0n9Clw1lpkxKwYf0UHdJwNSCC5m3y2Cg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pengfei Xu , Josh Poimboeuf , Paolo Bonzini , Sasha Levin , Peter Zijlstra Subject: [PATCH 5.19 256/365] x86/kvm: Fix "missing ENDBR" BUG for fastop functions Date: Tue, 23 Aug 2022 10:02:37 +0200 Message-Id: <20220823080128.907850538@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josh Poimboeuf [ Upstream commit 3d9606b0e0f3aed4dfb61d0853ebf432fead7bba ] The following BUG was reported: traps: Missing ENDBR: andw_ax_dx+0x0/0x10 [kvm] ------------[ cut here ]------------ kernel BUG at arch/x86/kernel/traps.c:253! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI asm_exc_control_protection+0x2b/0x30 RIP: 0010:andw_ax_dx+0x0/0x10 [kvm] Code: c3 cc cc cc cc 0f 1f 44 00 00 66 0f 1f 00 48 19 d0 c3 cc cc cc cc 0f 1f 40 00 f3 0f 1e fa 20 d0 c3 cc cc cc cc 0f 1f 44 00 00 <66> 0f 1f 00 66 21 d0 c3 cc cc cc cc 0f 1f 40 00 66 0f 1f 00 21 d0 ? andb_al_dl+0x10/0x10 [kvm] ? fastop+0x5d/0xa0 [kvm] x86_emulate_insn+0x822/0x1060 [kvm] x86_emulate_instruction+0x46f/0x750 [kvm] complete_emulated_mmio+0x216/0x2c0 [kvm] kvm_arch_vcpu_ioctl_run+0x604/0x650 [kvm] kvm_vcpu_ioctl+0x2f4/0x6b0 [kvm] ? wake_up_q+0xa0/0xa0 The BUG occurred because the ENDBR in the andw_ax_dx() fastop function had been incorrectly "sealed" (converted to a NOP) by apply_ibt_endbr(). Objtool marked it to be sealed because KVM has no compile-time references to the function. Instead KVM calculates its address at runtime. Prevent objtool from annotating fastop functions as sealable by creating throwaway dummy compile-time references to the functions. Fixes: 6649fa876da4 ("x86/ibt,kvm: Add ENDBR to fastops") Reported-by: Pengfei Xu Debugged-by: Peter Zijlstra Signed-off-by: Josh Poimboeuf Message-Id: <0d4116f90e9d0c1b754bb90c585e6f0415a1c508.1660837839.git.jpoimb= oe@kernel.org> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/x86/kvm/emulate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index aa907cec0918..09fa8a94807b 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -316,7 +316,8 @@ static int fastop(struct x86_emulate_ctxt *ctxt, fastop= _t fop); ".align " __stringify(FASTOP_SIZE) " \n\t" \ ".type " name ", @function \n\t" \ name ":\n\t" \ - ASM_ENDBR + ASM_ENDBR \ + IBT_NOSEAL(name) =20 #define FOP_FUNC(name) \ __FOP_FUNC(#name) --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97B13C32772 for ; Tue, 23 Aug 2022 09:12:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243295AbiHWJMa (ORCPT ); Tue, 23 Aug 2022 05:12:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348448AbiHWJKE (ORCPT ); Tue, 23 Aug 2022 05:10:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60DEF74DFA; Tue, 23 Aug 2022 01:30:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A791B81C48; Tue, 23 Aug 2022 08:29:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5F18C433C1; Tue, 23 Aug 2022 08:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243376; bh=ebo6kPnfZ6o+Q1fsjAA8jeQY9HT8MUugEfOa0/b02xE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VkZaIoRMmjUMK/JN87Wl8jcjS2Jgx8Aqrb8Em0EM20fpK5I3xeIAdcCDzGP8Jkzm0 r3CPDaoG1yF+wYzkEtl+7Pn7+YguL8pQvWkBx5wijqRnp+ha+uUzsVJpyuc+CHY/0P F92xqy9yRYZ5Ax4Vf5ciKu1Ub/1uPYT3EGmXLfB4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gil Fine , Mika Westerberg , Sasha Levin Subject: [PATCH 5.19 257/365] thunderbolt: Change downstream routers TMU rate in both TMU uni/bidir mode Date: Tue, 23 Aug 2022 10:02:38 +0200 Message-Id: <20220823080128.954306927@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gil Fine [ Upstream commit 5fd6b9a5cbe63fea4c490fee8af34144a139a266 ] In case of uni-directional time sync, TMU handshake is initiated by upstream router. In case of bi-directional time sync, TMU handshake is initiated by downstream router. In order to handle correctly the case of uni-directional mode, we avoid changing the upstream router's rate to off, because it might have another downstream router plugged that is set to uni-directional mode (and we don't want to change its mode). Instead, we always change downstream router's rate. Signed-off-by: Gil Fine Signed-off-by: Mika Westerberg Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/thunderbolt/tmu.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/thunderbolt/tmu.c b/drivers/thunderbolt/tmu.c index e4a07a26f693..93ba1d00335b 100644 --- a/drivers/thunderbolt/tmu.c +++ b/drivers/thunderbolt/tmu.c @@ -359,13 +359,14 @@ int tb_switch_tmu_disable(struct tb_switch *sw) * In case of uni-directional time sync, TMU handshake is * initiated by upstream router. In case of bi-directional * time sync, TMU handshake is initiated by downstream router. - * Therefore, we change the rate to off in the respective - * router. + * We change downstream router's rate to off for both uni/bidir + * cases although it is needed only for the bi-directional mode. + * We avoid changing upstream router's mode since it might + * have another downstream router plugged, that is set to + * uni-directional mode and we don't want to change it's TMU + * mode. */ - if (unidirectional) - tb_switch_tmu_rate_write(parent, TB_SWITCH_TMU_RATE_OFF); - else - tb_switch_tmu_rate_write(sw, TB_SWITCH_TMU_RATE_OFF); + tb_switch_tmu_rate_write(sw, TB_SWITCH_TMU_RATE_OFF); =20 tb_port_tmu_time_sync_disable(up); ret =3D tb_port_tmu_time_sync_disable(down); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAD14C32774 for ; Tue, 23 Aug 2022 09:12:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348118AbiHWJMk (ORCPT ); Tue, 23 Aug 2022 05:12:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348481AbiHWJKW (ORCPT ); Tue, 23 Aug 2022 05:10:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB8648671C; Tue, 23 Aug 2022 01:31:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 90E0BB81C51; Tue, 23 Aug 2022 08:29:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4695C433C1; Tue, 23 Aug 2022 08:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243379; bh=opRpwBXuIqKfJEKdV/gdL/Q2qqUENx7dxO38eYQHJZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bIi76YAUa3T+ZwIGlHjnA080NTSGyRaQL2dJ3dMKIH7CBTeQaTI+VtrPZ+sr1FhO6 AAdgWCs+5pNc2vaIJfqY7t82sQL3P0rp4y2SlLuRyYEksdD18HIaAO3ayOjAhUjWDT 5aTV3jQiWq50sYMNT6zljO3FaV0/1sFy0Efg8dTM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tao Jin , Jiri Kosina , Sasha Levin Subject: [PATCH 5.19 258/365] HID: multitouch: new device class fix Lenovo X12 trackpad sticky Date: Tue, 23 Aug 2022 10:02:39 +0200 Message-Id: <20220823080128.992617054@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tao Jin [ Upstream commit 54eed5c7b938dc4ef6b14d4ee048bbdafdbce352 ] The trackpad of the given device sends continuous report of pointers status as per wxn8 spec. However, the spec did not clarify when the fingers are lifted so fast that between the interval of two report frames fingers on pad reduced from >=3D2 to 0. The second last report contains >=3D2 fingers with tip state 1 and the last report contains only 1 finger with tip state 0. Although this can happen unfrequently, a quick fix will be improve the consistency to 100%. A quick fix is to disable MT_QUIRK_ALWAYS_VALID and enable MT_QUIRK_NOT_SEEN_MEANS_UP. Test for hid-tools is added in [1] In addition to this, I2C device 04CA:00B1 may also need similar class but with MT_QUIRK_FORCE_MULTI_INPUT disabled (but it does not harm to enable it on non-multi-input device either). The respective owner has been notified and a patch may coming soon after test. [1]: https://gitlab.freedesktop.org/libevdev/hid-tools/-/merge_requests/130 Signed-off-by: Tao Jin Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/hid/hid-multitouch.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 6bb3890b0f2c..2e72922e36f5 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -194,6 +194,7 @@ static void mt_post_parse(struct mt_device *td, struct = mt_application *app); #define MT_CLS_WIN_8_FORCE_MULTI_INPUT 0x0015 #define MT_CLS_WIN_8_DISABLE_WAKEUP 0x0016 #define MT_CLS_WIN_8_NO_STICKY_FINGERS 0x0017 +#define MT_CLS_WIN_8_FORCE_MULTI_INPUT_NSMU 0x0018 =20 /* vendor specific classes */ #define MT_CLS_3M 0x0101 @@ -286,6 +287,15 @@ static const struct mt_class mt_classes[] =3D { MT_QUIRK_WIN8_PTP_BUTTONS | MT_QUIRK_FORCE_MULTI_INPUT, .export_all_inputs =3D true }, + { .name =3D MT_CLS_WIN_8_FORCE_MULTI_INPUT_NSMU, + .quirks =3D MT_QUIRK_IGNORE_DUPLICATES | + MT_QUIRK_HOVERING | + MT_QUIRK_CONTACT_CNT_ACCURATE | + MT_QUIRK_STICKY_FINGERS | + MT_QUIRK_WIN8_PTP_BUTTONS | + MT_QUIRK_FORCE_MULTI_INPUT | + MT_QUIRK_NOT_SEEN_MEANS_UP, + .export_all_inputs =3D true }, { .name =3D MT_CLS_WIN_8_DISABLE_WAKEUP, .quirks =3D MT_QUIRK_ALWAYS_VALID | MT_QUIRK_IGNORE_DUPLICATES | @@ -783,6 +793,7 @@ static int mt_touch_input_mapping(struct hid_device *hd= ev, struct hid_input *hi, case HID_DG_CONFIDENCE: if ((cls->name =3D=3D MT_CLS_WIN_8 || cls->name =3D=3D MT_CLS_WIN_8_FORCE_MULTI_INPUT || + cls->name =3D=3D MT_CLS_WIN_8_FORCE_MULTI_INPUT_NSMU || cls->name =3D=3D MT_CLS_WIN_8_DISABLE_WAKEUP) && (field->application =3D=3D HID_DG_TOUCHPAD || field->application =3D=3D HID_DG_TOUCHSCREEN)) @@ -2035,7 +2046,7 @@ static const struct hid_device_id mt_devices[] =3D { USB_DEVICE_ID_LENOVO_X1_TAB3) }, =20 /* Lenovo X12 TAB Gen 1 */ - { .driver_data =3D MT_CLS_WIN_8_FORCE_MULTI_INPUT, + { .driver_data =3D MT_CLS_WIN_8_FORCE_MULTI_INPUT_NSMU, HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8, USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X12_TAB) }, --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89E00C32772 for ; Tue, 23 Aug 2022 09:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348155AbiHWJJg (ORCPT ); Tue, 23 Aug 2022 05:09:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347750AbiHWJIB (ORCPT ); Tue, 23 Aug 2022 05:08:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6E06861F9; Tue, 23 Aug 2022 01:30:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 10DBB612D8; Tue, 23 Aug 2022 08:29:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA06CC433C1; Tue, 23 Aug 2022 08:29:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243382; bh=XoTiZoUVZX4pd9WYhnysuZkslFJxFicRZdPAq2tGTyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AuMlSnIh0tTKuTmiFyG2xz4VXbb1VU6nwWhzLRnukHxGmCzGUXDj5Ulq0svjcBAJR Ru5gQiOasp6qsXFp5t0QK+IwDNIjVacsxBl2NHf+wOFuSfKk14+fD7VZMNwhE+bBbV tQzipcgdWVkdVnERYXJEjstWJDXMmiOoaaHhP7PI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavan Chebbi , Michael Chan , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.19 259/365] PCI: Add ACS quirk for Broadcom BCM5750x NICs Date: Tue, 23 Aug 2022 10:02:40 +0200 Message-Id: <20220823080129.032890080@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavan Chebbi [ Upstream commit afd306a65cedb9589564bdb23a0c368abc4215fd ] The Broadcom BCM5750x NICs may be multi-function devices. They do not advertise ACS capability. Peer-to-peer transactions are not possible between the individual functions, so it is safe to treat them as fully isolated. Add an ACS quirk for these devices so the functions can be in independent IOMMU groups and attached individually to userspace applications using VFIO. Link: https://lore.kernel.org/r/1654796507-28610-1-git-send-email-michael.c= han@broadcom.com Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/pci/quirks.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 41aeaa235132..2e68f50bc7ae 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4924,6 +4924,9 @@ static const struct pci_dev_acs_enabled { { PCI_VENDOR_ID_AMPERE, 0xE00C, pci_quirk_xgene_acs }, /* Broadcom multi-function device */ { PCI_VENDOR_ID_BROADCOM, 0x16D7, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1750, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1751, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1752, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs }, /* Amazon Annapurna Labs */ { PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs }, --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54B78C32772 for ; Tue, 23 Aug 2022 09:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241701AbiHWJKJ (ORCPT ); Tue, 23 Aug 2022 05:10:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241064AbiHWJIj (ORCPT ); Tue, 23 Aug 2022 05:08:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D1BC8607C; Tue, 23 Aug 2022 01:30:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A9712B81C29; Tue, 23 Aug 2022 08:29:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7398C433C1; Tue, 23 Aug 2022 08:29:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243385; bh=yE9fWldw1A/yimWhEY3mbNJSVwSaV5h/oFBu3KOkY9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EFHMcusghHRYpQ8PlW/kZqe4iYYUxqhwf8yjFihzvVEYBMTf8OA5SxIpJCJPbiLB2 ElVMsD4Om7rRuhxOT9avKuvQdF3sNK6GRgER4ssPBZWbIiS7P+LKw/h4JINuSFg9Eb tBrw9nskUoPs+KIW6J4tN7xSaIKaznSLe7xofUYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Tzung-Bi Shih , Sasha Levin Subject: [PATCH 5.19 260/365] platform/chrome: cros_ec_proto: dont show MKBP version if unsupported Date: Tue, 23 Aug 2022 10:02:41 +0200 Message-Id: <20220823080129.076152818@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tzung-Bi Shih [ Upstream commit b36f0643ff14a2fb281b105418e4e73c9d7c11d0 ] It wrongly showed the following message when it doesn't support MKBP: "MKBP support version 4294967295". Fix it. Reviewed-by: Guenter Roeck Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220609084957.3684698-14-tzungbi@kernel.org Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/platform/chrome/cros_ec_proto.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chr= ome/cros_ec_proto.c index ff767dccdf0f..40dc048d18ad 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -509,13 +509,13 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev) ret =3D cros_ec_get_host_command_version_mask(ec_dev, EC_CMD_GET_NEXT_EVENT, &ver_mask); - if (ret < 0 || ver_mask =3D=3D 0) + if (ret < 0 || ver_mask =3D=3D 0) { ec_dev->mkbp_event_supported =3D 0; - else + } else { ec_dev->mkbp_event_supported =3D fls(ver_mask); =20 - dev_dbg(ec_dev->dev, "MKBP support version %u\n", - ec_dev->mkbp_event_supported - 1); + dev_dbg(ec_dev->dev, "MKBP support version %u\n", ec_dev->mkbp_event_sup= ported - 1); + } =20 /* Probe if host sleep v1 is supported for S0ix failure detection. */ ret =3D cros_ec_get_host_command_version_mask(ec_dev, --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F5C2C32772 for ; Tue, 23 Aug 2022 09:11:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241695AbiHWJKX (ORCPT ); Tue, 23 Aug 2022 05:10:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241299AbiHWJJO (ORCPT ); Tue, 23 Aug 2022 05:09:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C069A8672E; Tue, 23 Aug 2022 01:30:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6B7B661257; Tue, 23 Aug 2022 08:29:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36F8AC433D7; Tue, 23 Aug 2022 08:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243391; bh=eoAcdUpLKeCISkGYlqjLCUUj2MIbRJd6YzDFcu8T0r0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZlGM/TNqFON6JCZImx17C8rsPPinhcu5kTSlkHlmpJc5FMLU4iihLSuuvcSlqKjmd hSIZ80UfoX3wUiaBDlzDq/uSf6E7NAJdjdos4/Oz1oIQMVH6GRGfnic+G1bVsBgXLc e9yex/Xs3HmFv5f2zDFrJnPUmzgd+ToVpSd99fno= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Sasha Levin Subject: [PATCH 5.19 261/365] staging: r8188eu: add error handling of rtw_read8 Date: Tue, 23 Aug 2022 10:02:42 +0200 Message-Id: <20220823080129.107624496@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Skripkin [ Upstream commit 857fe9e5efc09833fe1110e99d8baba954a86abb ] rtw_read8() reads data from device via USB API which may fail. In case of any failure previous code returned stack data to callers, which is wrong. Fix it by changing rtw_read8() prototype and prevent caller from touching random stack data Signed-off-by: Pavel Skripkin Link: https://lore.kernel.org/r/c8f8ef4f14db3ba2478a87d5be6eb768a093dfaf.16= 54629778.git.paskripkin@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/staging/r8188eu/core/rtw_efuse.c | 13 +- drivers/staging/r8188eu/core/rtw_fw.c | 56 ++++-- drivers/staging/r8188eu/core/rtw_led.c | 16 +- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 48 ++++- drivers/staging/r8188eu/core/rtw_wlan_util.c | 20 +- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 18 +- drivers/staging/r8188eu/hal/HalPwrSeqCmd.c | 9 +- drivers/staging/r8188eu/hal/hal_com.c | 27 ++- drivers/staging/r8188eu/hal/rtl8188e_cmd.c | 37 +++- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 6 +- .../staging/r8188eu/hal/rtl8188e_hal_init.c | 69 +++++-- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 10 +- drivers/staging/r8188eu/hal/usb_halinit.c | 171 +++++++++++++++--- drivers/staging/r8188eu/hal/usb_ops_linux.c | 7 +- drivers/staging/r8188eu/include/rtw_io.h | 2 +- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 11 +- 16 files changed, 418 insertions(+), 102 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_efuse.c b/drivers/staging/r81= 88eu/core/rtw_efuse.c index 0e0e60638880..a2691c7f96f6 100644 --- a/drivers/staging/r8188eu/core/rtw_efuse.c +++ b/drivers/staging/r8188eu/core/rtw_efuse.c @@ -28,14 +28,21 @@ ReadEFuseByte( u32 value32; u8 readbyte; u16 retry; + int res; =20 /* Write Address */ rtw_write8(Adapter, EFUSE_CTRL + 1, (_offset & 0xff)); - readbyte =3D rtw_read8(Adapter, EFUSE_CTRL + 2); + res =3D rtw_read8(Adapter, EFUSE_CTRL + 2, &readbyte); + if (res) + return; + rtw_write8(Adapter, EFUSE_CTRL + 2, ((_offset >> 8) & 0x03) | (readbyte &= 0xfc)); =20 /* Write bit 32 0 */ - readbyte =3D rtw_read8(Adapter, EFUSE_CTRL + 3); + res =3D rtw_read8(Adapter, EFUSE_CTRL + 3, &readbyte); + if (res) + return; + rtw_write8(Adapter, EFUSE_CTRL + 3, (readbyte & 0x7f)); =20 /* Check bit 32 read-ready */ @@ -54,6 +61,8 @@ ReadEFuseByte( value32 =3D rtw_read32(Adapter, EFUSE_CTRL); =20 *pbuf =3D (u8)(value32 & 0xff); + + /* FIXME: return an error to caller */ } =20 /*------------------------------------------------------------------------= ----- diff --git a/drivers/staging/r8188eu/core/rtw_fw.c b/drivers/staging/r8188e= u/core/rtw_fw.c index 0451e5177644..7cf8525595c6 100644 --- a/drivers/staging/r8188eu/core/rtw_fw.c +++ b/drivers/staging/r8188eu/core/rtw_fw.c @@ -44,18 +44,28 @@ static_assert(sizeof(struct rt_firmware_hdr) =3D=3D 32); static void fw_download_enable(struct adapter *padapter, bool enable) { u8 tmp; + int res; =20 if (enable) { /* MCU firmware download enable. */ - tmp =3D rtw_read8(padapter, REG_MCUFWDL); + res =3D rtw_read8(padapter, REG_MCUFWDL, &tmp); + if (res) + return; + rtw_write8(padapter, REG_MCUFWDL, tmp | 0x01); =20 /* 8051 reset */ - tmp =3D rtw_read8(padapter, REG_MCUFWDL + 2); + res =3D rtw_read8(padapter, REG_MCUFWDL + 2, &tmp); + if (res) + return; + rtw_write8(padapter, REG_MCUFWDL + 2, tmp & 0xf7); } else { /* MCU firmware download disable. */ - tmp =3D rtw_read8(padapter, REG_MCUFWDL); + res =3D rtw_read8(padapter, REG_MCUFWDL, &tmp); + if (res) + return; + rtw_write8(padapter, REG_MCUFWDL, tmp & 0xfe); =20 /* Reserved for fw extension. */ @@ -125,8 +135,13 @@ static int page_write(struct adapter *padapter, u32 pa= ge, u8 *buffer, u32 size) { u8 value8; u8 u8Page =3D (u8)(page & 0x07); + int res; + + res =3D rtw_read8(padapter, REG_MCUFWDL + 2, &value8); + if (res) + return _FAIL; =20 - value8 =3D (rtw_read8(padapter, REG_MCUFWDL + 2) & 0xF8) | u8Page; + value8 =3D (value8 & 0xF8) | u8Page; rtw_write8(padapter, REG_MCUFWDL + 2, value8); =20 return block_write(padapter, buffer, size); @@ -165,8 +180,12 @@ static int write_fw(struct adapter *padapter, u8 *buff= er, u32 size) void rtw_reset_8051(struct adapter *padapter) { u8 val8; + int res; + + res =3D rtw_read8(padapter, REG_SYS_FUNC_EN + 1, &val8); + if (res) + return; =20 - val8 =3D rtw_read8(padapter, REG_SYS_FUNC_EN + 1); rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val8 & (~BIT(2))); rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val8 | (BIT(2))); } @@ -239,7 +258,7 @@ static int load_firmware(struct rt_firmware *rtfw, stru= ct device *device) int rtl8188e_firmware_download(struct adapter *padapter) { int ret =3D _SUCCESS; - u8 write_fw_retry =3D 0; + u8 reg; unsigned long fwdl_timeout; struct dvobj_priv *dvobj =3D adapter_to_dvobj(padapter); struct device *device =3D dvobj_to_dev(dvobj); @@ -269,23 +288,34 @@ int rtl8188e_firmware_download(struct adapter *padapt= er) =20 /* Suggested by Filen. If 8051 is running in RAM code, driver should inf= orm Fw to reset by itself, */ /* or it will cause download Fw fail. 2010.02.01. by tynli. */ - if (rtw_read8(padapter, REG_MCUFWDL) & RAM_DL_SEL) { /* 8051 RAM code */ + ret =3D rtw_read8(padapter, REG_MCUFWDL, ®); + if (ret) { + ret =3D _FAIL; + goto exit; + } + + if (reg & RAM_DL_SEL) { /* 8051 RAM code */ rtw_write8(padapter, REG_MCUFWDL, 0x00); rtw_reset_8051(padapter); } =20 fw_download_enable(padapter, true); fwdl_timeout =3D jiffies + msecs_to_jiffies(500); - while (1) { + do { /* reset the FWDL chksum */ - rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL) | FWD= L_CHKSUM_RPT); + ret =3D rtw_read8(padapter, REG_MCUFWDL, ®); + if (ret) { + ret =3D _FAIL; + continue; + } =20 - ret =3D write_fw(padapter, fw_data, fw_size); + rtw_write8(padapter, REG_MCUFWDL, reg | FWDL_CHKSUM_RPT); =20 - if (ret =3D=3D _SUCCESS || - (time_after(jiffies, fwdl_timeout) && write_fw_retry++ >=3D 3)) + ret =3D write_fw(padapter, fw_data, fw_size); + if (ret =3D=3D _SUCCESS) break; - } + } while (!time_after(jiffies, fwdl_timeout)); + fw_download_enable(padapter, false); if (ret !=3D _SUCCESS) goto exit; diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188= eu/core/rtw_led.c index 2f3000428af7..25989acf5259 100644 --- a/drivers/staging/r8188eu/core/rtw_led.c +++ b/drivers/staging/r8188eu/core/rtw_led.c @@ -35,11 +35,15 @@ static void ResetLedStatus(struct LED_871x *pLed) static void SwLedOn(struct adapter *padapter, struct LED_871x *pLed) { u8 LedCfg; + int res; =20 if (padapter->bSurpriseRemoved || padapter->bDriverStopped) return; =20 - LedCfg =3D rtw_read8(padapter, REG_LEDCFG2); + res =3D rtw_read8(padapter, REG_LEDCFG2, &LedCfg); + if (res) + return; + rtw_write8(padapter, REG_LEDCFG2, (LedCfg & 0xf0) | BIT(5) | BIT(6)); /* = SW control led0 on. */ pLed->bLedOn =3D true; } @@ -47,15 +51,21 @@ static void SwLedOn(struct adapter *padapter, struct LE= D_871x *pLed) static void SwLedOff(struct adapter *padapter, struct LED_871x *pLed) { u8 LedCfg; + int res; =20 if (padapter->bSurpriseRemoved || padapter->bDriverStopped) goto exit; =20 - LedCfg =3D rtw_read8(padapter, REG_LEDCFG2);/* 0x4E */ + res =3D rtw_read8(padapter, REG_LEDCFG2, &LedCfg);/* 0x4E */ + if (res) + goto exit; =20 LedCfg &=3D 0x90; /* Set to software control. */ rtw_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3))); - LedCfg =3D rtw_read8(padapter, REG_MAC_PINMUX_CFG); + res =3D rtw_read8(padapter, REG_MAC_PINMUX_CFG, &LedCfg); + if (res) + goto exit; + LedCfg &=3D 0xFE; rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg); exit: diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index faf23fc950c5..fdb5a8cb9d69 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -5667,14 +5667,28 @@ unsigned int send_beacon(struct adapter *padapter) =20 bool get_beacon_valid_bit(struct adapter *adapter) { + int res; + u8 reg; + + res =3D rtw_read8(adapter, REG_TDECTRL + 2, ®); + if (res) + return false; + /* BIT(16) of REG_TDECTRL =3D BIT(0) of REG_TDECTRL+2 */ - return BIT(0) & rtw_read8(adapter, REG_TDECTRL + 2); + return BIT(0) & reg; } =20 void clear_beacon_valid_bit(struct adapter *adapter) { + int res; + u8 reg; + + res =3D rtw_read8(adapter, REG_TDECTRL + 2, ®); + if (res) + return; + /* BIT(16) of REG_TDECTRL =3D BIT(0) of REG_TDECTRL+2, write 1 to clear, = Clear by sw */ - rtw_write8(adapter, REG_TDECTRL + 2, rtw_read8(adapter, REG_TDECTRL + 2) = | BIT(0)); + rtw_write8(adapter, REG_TDECTRL + 2, reg | BIT(0)); } =20 /*************************************************************************= *** @@ -6002,7 +6016,8 @@ static void rtw_set_bssid(struct adapter *adapter, u8= *bssid) static void mlme_join(struct adapter *adapter, int type) { struct mlme_priv *mlmepriv =3D &adapter->mlmepriv; - u8 retry_limit =3D 0x30; + u8 retry_limit =3D 0x30, reg; + int res; =20 switch (type) { case 0: @@ -6027,7 +6042,11 @@ static void mlme_join(struct adapter *adapter, int t= ype) case 2: /* sta add event call back */ /* enable update TSF */ - rtw_write8(adapter, REG_BCN_CTRL, rtw_read8(adapter, REG_BCN_CTRL) & (~B= IT(4))); + res =3D rtw_read8(adapter, REG_BCN_CTRL, ®); + if (res) + return; + + rtw_write8(adapter, REG_BCN_CTRL, reg & (~BIT(4))); =20 if (check_fwstate(mlmepriv, WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE)) retry_limit =3D 0x7; @@ -6748,6 +6767,9 @@ void mlmeext_sta_add_event_callback(struct adapter *p= adapter, struct sta_info *p =20 static void mlme_disconnect(struct adapter *adapter) { + int res; + u8 reg; + /* Set RCR to not to receive data frame when NO LINK state */ /* reject all data frames */ rtw_write16(adapter, REG_RXFLTMAP2, 0x00); @@ -6756,7 +6778,12 @@ static void mlme_disconnect(struct adapter *adapter) rtw_write8(adapter, REG_DUAL_TSF_RST, (BIT(0) | BIT(1))); =20 /* disable update TSF */ - rtw_write8(adapter, REG_BCN_CTRL, rtw_read8(adapter, REG_BCN_CTRL) | BIT(= 4)); + + res =3D rtw_read8(adapter, REG_BCN_CTRL, ®); + if (res) + return; + + rtw_write8(adapter, REG_BCN_CTRL, reg | BIT(4)); } =20 void mlmeext_sta_del_event_callback(struct adapter *padapter) @@ -6810,14 +6837,15 @@ static u8 chk_ap_is_alive(struct sta_info *psta) return ret; } =20 -static void rtl8188e_sreset_linked_status_check(struct adapter *padapter) +static int rtl8188e_sreset_linked_status_check(struct adapter *padapter) { u32 rx_dma_status =3D rtw_read32(padapter, REG_RXDMA_STATUS); + u8 reg; =20 if (rx_dma_status !=3D 0x00) rtw_write32(padapter, REG_RXDMA_STATUS, rx_dma_status); =20 - rtw_read8(padapter, REG_FMETHR); + return rtw_read8(padapter, REG_FMETHR, ®); } =20 void linked_status_chk(struct adapter *padapter) @@ -7219,6 +7247,7 @@ u8 disconnect_hdl(struct adapter *padapter, unsigned = char *pbuf) struct mlme_ext_info *pmlmeinfo =3D &pmlmeext->mlmext_info; struct wlan_bssid_ex *pnetwork =3D (struct wlan_bssid_ex *)(&pmlmeinfo->n= etwork); u8 val8; + int res; =20 if (is_client_associated_to_ap(padapter)) issue_deauth_ex(padapter, pnetwork->MacAddress, WLAN_REASON_DEAUTH_LEAVI= NG, param->deauth_timeout_ms / 100, 100); @@ -7231,7 +7260,10 @@ u8 disconnect_hdl(struct adapter *padapter, unsigned= char *pbuf) =20 if (((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_ADHOC_STATE) || ((pmlmeinfo= ->state & 0x03) =3D=3D WIFI_FW_AP_STATE)) { /* Stop BCN */ - val8 =3D rtw_read8(padapter, REG_BCN_CTRL); + res =3D rtw_read8(padapter, REG_BCN_CTRL, &val8); + if (res) + return H2C_DROPPED; + rtw_write8(padapter, REG_BCN_CTRL, val8 & (~(EN_BCN_FUNCTION | EN_TXBCN_= RPT))); } =20 diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging= /r8188eu/core/rtw_wlan_util.c index 392a65783f32..9bd059b86d0c 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -279,8 +279,13 @@ void Restore_DM_Func_Flag(struct adapter *padapter) void Set_MSR(struct adapter *padapter, u8 type) { u8 val8; + int res; =20 - val8 =3D rtw_read8(padapter, MSR) & 0x0c; + res =3D rtw_read8(padapter, MSR, &val8); + if (res) + return; + + val8 &=3D 0x0c; val8 |=3D type; rtw_write8(padapter, MSR, val8); } @@ -505,7 +510,11 @@ int WMM_param_handler(struct adapter *padapter, struct= ndis_802_11_var_ie *pIE) =20 static void set_acm_ctrl(struct adapter *adapter, u8 acm_mask) { - u8 acmctrl =3D rtw_read8(adapter, REG_ACMHWCTRL); + u8 acmctrl; + int res =3D rtw_read8(adapter, REG_ACMHWCTRL, &acmctrl); + + if (res) + return; =20 if (acm_mask > 1) acmctrl =3D acmctrl | 0x1; @@ -765,6 +774,7 @@ void HT_info_handler(struct adapter *padapter, struct n= dis_802_11_var_ie *pIE) static void set_min_ampdu_spacing(struct adapter *adapter, u8 spacing) { u8 sec_spacing; + int res; =20 if (spacing <=3D 7) { switch (adapter->securitypriv.dot11PrivacyAlgrthm) { @@ -786,8 +796,12 @@ static void set_min_ampdu_spacing(struct adapter *adap= ter, u8 spacing) if (spacing < sec_spacing) spacing =3D sec_spacing; =20 + res =3D rtw_read8(adapter, REG_AMPDU_MIN_SPACE, &sec_spacing); + if (res) + return; + rtw_write8(adapter, REG_AMPDU_MIN_SPACE, - (rtw_read8(adapter, REG_AMPDU_MIN_SPACE) & 0xf8) | spacing); + (sec_spacing & 0xf8) | spacing); } } =20 diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging= /r8188eu/hal/HalPhyRf_8188e.c index b944c8071a3b..a5b7980dfcee 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -463,6 +463,7 @@ void _PHY_SaveADDARegisters(struct adapter *adapt, u32 = *ADDAReg, u32 *ADDABackup } } =20 +/* FIXME: return an error to caller */ static void _PHY_SaveMACRegisters( struct adapter *adapt, u32 *MACReg, @@ -470,9 +471,17 @@ static void _PHY_SaveMACRegisters( ) { u32 i; + int res; =20 - for (i =3D 0; i < (IQK_MAC_REG_NUM - 1); i++) - MACBackup[i] =3D rtw_read8(adapt, MACReg[i]); + for (i =3D 0; i < (IQK_MAC_REG_NUM - 1); i++) { + u8 reg; + + res =3D rtw_read8(adapt, MACReg[i], ®); + if (res) + return; + + MACBackup[i] =3D reg; + } =20 MACBackup[i] =3D rtw_read32(adapt, MACReg[i]); } @@ -739,9 +748,12 @@ static void phy_LCCalibrate_8188E(struct adapter *adap= t) { u8 tmpreg; u32 RF_Amode =3D 0, LC_Cal; + int res; =20 /* Check continuous TX and Packet TX */ - tmpreg =3D rtw_read8(adapt, 0xd03); + res =3D rtw_read8(adapt, 0xd03, &tmpreg); + if (res) + return; =20 if ((tmpreg & 0x70) !=3D 0) /* Deal with contisuous TX case */ rtw_write8(adapt, 0xd03, tmpreg & 0x8F); /* disable all continuous TX */ diff --git a/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c b/drivers/staging/r= 8188eu/hal/HalPwrSeqCmd.c index 150ea380c39e..4a4563b900b3 100644 --- a/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c +++ b/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c @@ -12,6 +12,7 @@ u8 HalPwrSeqCmdParsing(struct adapter *padapter, struct w= l_pwr_cfg pwrseqcmd[]) u32 offset =3D 0; u32 poll_count =3D 0; /* polling autoload done. */ u32 max_poll_count =3D 5000; + int res; =20 do { pwrcfgcmd =3D pwrseqcmd[aryidx]; @@ -21,7 +22,9 @@ u8 HalPwrSeqCmdParsing(struct adapter *padapter, struct w= l_pwr_cfg pwrseqcmd[]) offset =3D GET_PWR_CFG_OFFSET(pwrcfgcmd); =20 /* Read the value from system register */ - value =3D rtw_read8(padapter, offset); + res =3D rtw_read8(padapter, offset, &value); + if (res) + return false; =20 value &=3D ~(GET_PWR_CFG_MASK(pwrcfgcmd)); value |=3D (GET_PWR_CFG_VALUE(pwrcfgcmd) & GET_PWR_CFG_MASK(pwrcfgcmd)); @@ -33,7 +36,9 @@ u8 HalPwrSeqCmdParsing(struct adapter *padapter, struct w= l_pwr_cfg pwrseqcmd[]) poll_bit =3D false; offset =3D GET_PWR_CFG_OFFSET(pwrcfgcmd); do { - value =3D rtw_read8(padapter, offset); + res =3D rtw_read8(padapter, offset, &value); + if (res) + return false; =20 value &=3D GET_PWR_CFG_MASK(pwrcfgcmd); if (value =3D=3D (GET_PWR_CFG_VALUE(pwrcfgcmd) & GET_PWR_CFG_MASK(pwrc= fgcmd))) diff --git a/drivers/staging/r8188eu/hal/hal_com.c b/drivers/staging/r8188e= u/hal/hal_com.c index 910cc07f656c..e9a32dd84a8e 100644 --- a/drivers/staging/r8188eu/hal/hal_com.c +++ b/drivers/staging/r8188eu/hal/hal_com.c @@ -303,7 +303,9 @@ s32 c2h_evt_read(struct adapter *adapter, u8 *buf) if (!buf) goto exit; =20 - trigger =3D rtw_read8(adapter, REG_C2HEVT_CLEAR); + ret =3D rtw_read8(adapter, REG_C2HEVT_CLEAR, &trigger); + if (ret) + return _FAIL; =20 if (trigger =3D=3D C2H_EVT_HOST_CLOSE) goto exit; /* Not ready */ @@ -314,13 +316,26 @@ s32 c2h_evt_read(struct adapter *adapter, u8 *buf) =20 memset(c2h_evt, 0, 16); =20 - *buf =3D rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL); - *(buf + 1) =3D rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL + 1); + ret =3D rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL, buf); + if (ret) { + ret =3D _FAIL; + goto clear_evt; + } =20 + ret =3D rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL + 1, buf + 1); + if (ret) { + ret =3D _FAIL; + goto clear_evt; + } /* Read the content */ - for (i =3D 0; i < c2h_evt->plen; i++) - c2h_evt->payload[i] =3D rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL + - sizeof(*c2h_evt) + i); + for (i =3D 0; i < c2h_evt->plen; i++) { + ret =3D rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL + + sizeof(*c2h_evt) + i, c2h_evt->payload + i); + if (ret) { + ret =3D _FAIL; + goto clear_evt; + } + } =20 ret =3D _SUCCESS; =20 diff --git a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c b/drivers/staging/r= 8188eu/hal/rtl8188e_cmd.c index 475650dc7301..b01ee1695fee 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c @@ -18,13 +18,18 @@ =20 static u8 _is_fw_read_cmd_down(struct adapter *adapt, u8 msgbox_num) { - u8 read_down =3D false; + u8 read_down =3D false, reg; int retry_cnts =3D 100; + int res; =20 u8 valid; =20 do { - valid =3D rtw_read8(adapt, REG_HMETFR) & BIT(msgbox_num); + res =3D rtw_read8(adapt, REG_HMETFR, ®); + if (res) + continue; + + valid =3D reg & BIT(msgbox_num); if (0 =3D=3D valid) read_down =3D true; } while ((!read_down) && (retry_cnts--)); @@ -533,6 +538,8 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *a= dapt, u8 mstatus) bool bcn_valid =3D false; u8 DLBcnCount =3D 0; u32 poll =3D 0; + u8 reg; + int res; =20 if (mstatus =3D=3D 1) { /* We should set AID, correct TSF, HW seq enable before set JoinBssRepo= rt to Fw in 88/92C. */ @@ -547,8 +554,17 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *= adapt, u8 mstatus) /* Disable Hw protection for a time which revserd for Hw sending beacon= . */ /* Fix download reserved page packet fail that access collision with th= e protection time. */ /* 2010.05.11. Added by tynli. */ - rtw_write8(adapt, REG_BCN_CTRL, rtw_read8(adapt, REG_BCN_CTRL) & (~BIT(3= ))); - rtw_write8(adapt, REG_BCN_CTRL, rtw_read8(adapt, REG_BCN_CTRL) | BIT(4)); + res =3D rtw_read8(adapt, REG_BCN_CTRL, ®); + if (res) + return; + + rtw_write8(adapt, REG_BCN_CTRL, reg & (~BIT(3))); + + res =3D rtw_read8(adapt, REG_BCN_CTRL, ®); + if (res) + return; + + rtw_write8(adapt, REG_BCN_CTRL, reg | BIT(4)); =20 if (haldata->RegFwHwTxQCtrl & BIT(6)) bSendBeacon =3D true; @@ -581,8 +597,17 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *= adapt, u8 mstatus) /* */ =20 /* Enable Bcn */ - rtw_write8(adapt, REG_BCN_CTRL, rtw_read8(adapt, REG_BCN_CTRL) | BIT(3)); - rtw_write8(adapt, REG_BCN_CTRL, rtw_read8(adapt, REG_BCN_CTRL) & (~BIT(4= ))); + res =3D rtw_read8(adapt, REG_BCN_CTRL, ®); + if (res) + return; + + rtw_write8(adapt, REG_BCN_CTRL, reg | BIT(3)); + + res =3D rtw_read8(adapt, REG_BCN_CTRL, ®); + if (res) + return; + + rtw_write8(adapt, REG_BCN_CTRL, reg & (~BIT(4))); =20 /* To make sure that if there exists an adapter which would like to sen= d beacon. */ /* If exists, the origianl value of 0x422[6] will be 1, we should check= this to */ diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8= 188eu/hal/rtl8188e_dm.c index 6d28e3dc0d26..0399872c4546 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c @@ -12,8 +12,12 @@ static void dm_InitGPIOSetting(struct adapter *Adapter) { u8 tmp1byte; + int res; + + res =3D rtw_read8(Adapter, REG_GPIO_MUXCFG, &tmp1byte); + if (res) + return; =20 - tmp1byte =3D rtw_read8(Adapter, REG_GPIO_MUXCFG); tmp1byte &=3D (GPIOSEL_GPIO | ~GPIOSEL_ENBT); =20 rtw_write8(Adapter, REG_GPIO_MUXCFG, tmp1byte); diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/stag= ing/r8188eu/hal/rtl8188e_hal_init.c index e17375a74f17..e67ecbd1ba79 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -13,10 +13,14 @@ static void iol_mode_enable(struct adapter *padapter, u8 enable) { u8 reg_0xf0 =3D 0; + int res; =20 if (enable) { /* Enable initial offload */ - reg_0xf0 =3D rtw_read8(padapter, REG_SYS_CFG); + res =3D rtw_read8(padapter, REG_SYS_CFG, ®_0xf0); + if (res) + return; + rtw_write8(padapter, REG_SYS_CFG, reg_0xf0 | SW_OFFLOAD_EN); =20 if (!padapter->bFWReady) @@ -24,7 +28,10 @@ static void iol_mode_enable(struct adapter *padapter, u8= enable) =20 } else { /* disable initial offload */ - reg_0xf0 =3D rtw_read8(padapter, REG_SYS_CFG); + res =3D rtw_read8(padapter, REG_SYS_CFG, ®_0xf0); + if (res) + return; + rtw_write8(padapter, REG_SYS_CFG, reg_0xf0 & ~SW_OFFLOAD_EN); } } @@ -34,17 +41,31 @@ static s32 iol_execute(struct adapter *padapter, u8 con= trol) s32 status =3D _FAIL; u8 reg_0x88 =3D 0; unsigned long timeout; + int res; =20 control =3D control & 0x0f; - reg_0x88 =3D rtw_read8(padapter, REG_HMEBOX_E0); + res =3D rtw_read8(padapter, REG_HMEBOX_E0, ®_0x88); + if (res) + return _FAIL; + rtw_write8(padapter, REG_HMEBOX_E0, reg_0x88 | control); =20 timeout =3D jiffies + msecs_to_jiffies(1000); - while ((reg_0x88 =3D rtw_read8(padapter, REG_HMEBOX_E0)) & control && - time_before(jiffies, timeout)) - ; =20 - reg_0x88 =3D rtw_read8(padapter, REG_HMEBOX_E0); + do { + res =3D rtw_read8(padapter, REG_HMEBOX_E0, ®_0x88); + if (res) + continue; + + if (!(reg_0x88 & control)) + break; + + } while (time_before(jiffies, timeout)); + + res =3D rtw_read8(padapter, REG_HMEBOX_E0, ®_0x88); + if (res) + return _FAIL; + status =3D (reg_0x88 & control) ? _FAIL : _SUCCESS; if (reg_0x88 & control << 4) status =3D _FAIL; @@ -190,13 +211,18 @@ static void efuse_read_phymap_from_txpktbuf( u16 dbg_addr =3D 0; __le32 lo32 =3D 0, hi32 =3D 0; u16 len =3D 0, count =3D 0; - int i =3D 0; + int i =3D 0, res; u16 limit =3D *size; - + u8 reg; u8 *pos =3D content; =20 - if (bcnhead < 0) /* if not valid */ - bcnhead =3D rtw_read8(adapter, REG_TDECTRL + 1); + if (bcnhead < 0) { /* if not valid */ + res =3D rtw_read8(adapter, REG_TDECTRL + 1, ®); + if (res) + return; + + bcnhead =3D reg; + } =20 rtw_write8(adapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT); =20 @@ -207,8 +233,16 @@ static void efuse_read_phymap_from_txpktbuf( =20 rtw_write8(adapter, REG_TXPKTBUF_DBG, 0); timeout =3D jiffies + msecs_to_jiffies(1000); - while (!rtw_read8(adapter, REG_TXPKTBUF_DBG) && time_before(jiffies, tim= eout)) + do { + res =3D rtw_read8(adapter, REG_TXPKTBUF_DBG, ®); + if (res) + continue; + + if (reg) + break; + rtw_usleep_os(100); + } while (time_before(jiffies, timeout)); =20 /* data from EEPROM needs to be in LE */ lo32 =3D cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_L)); @@ -525,10 +559,17 @@ void rtl8188e_SetHalODMVar(struct adapter *Adapter, v= oid *pValue1, bool bSet) =20 void hal_notch_filter_8188e(struct adapter *adapter, bool enable) { + int res; + u8 reg; + + res =3D rtw_read8(adapter, rOFDM0_RxDSP + 1, ®); + if (res) + return; + if (enable) - rtw_write8(adapter, rOFDM0_RxDSP + 1, rtw_read8(adapter, rOFDM0_RxDSP + = 1) | BIT(1)); + rtw_write8(adapter, rOFDM0_RxDSP + 1, reg | BIT(1)); else - rtw_write8(adapter, rOFDM0_RxDSP + 1, rtw_read8(adapter, rOFDM0_RxDSP + = 1) & ~BIT(1)); + rtw_write8(adapter, rOFDM0_RxDSP + 1, reg & ~BIT(1)); } =20 /* */ diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/stagin= g/r8188eu/hal/rtl8188e_phycfg.c index 4864dafd887b..985339a974fc 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -594,6 +594,7 @@ _PHY_SetBWMode92C( struct hal_data_8188e *pHalData =3D &Adapter->haldata; u8 regBwOpMode; u8 regRRSR_RSC; + int res; =20 if (Adapter->bDriverStopped) return; @@ -602,8 +603,13 @@ _PHY_SetBWMode92C( /* 3<1>Set MAC register */ /* 3 */ =20 - regBwOpMode =3D rtw_read8(Adapter, REG_BWOPMODE); - regRRSR_RSC =3D rtw_read8(Adapter, REG_RRSR + 2); + res =3D rtw_read8(Adapter, REG_BWOPMODE, ®BwOpMode); + if (res) + return; + + res =3D rtw_read8(Adapter, REG_RRSR + 2, ®RRSR_RSC); + if (res) + return; =20 switch (pHalData->CurrentChannelBW) { case HT_CHANNEL_WIDTH_20: diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8= 188eu/hal/usb_halinit.c index a217272a07f8..01422d548748 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -81,6 +81,7 @@ static void _InitInterrupt(struct adapter *Adapter) { u32 imr, imr_ex; u8 usb_opt; + int res; =20 /* HISR write one to clear */ rtw_write32(Adapter, REG_HISR_88E, 0xFFFFFFFF); @@ -94,7 +95,9 @@ static void _InitInterrupt(struct adapter *Adapter) /* REG_USB_SPECIAL_OPTION - BIT(4) */ /* 0; Use interrupt endpoint to upload interrupt pkt */ /* 1; Use bulk endpoint to upload interrupt pkt, */ - usb_opt =3D rtw_read8(Adapter, REG_USB_SPECIAL_OPTION); + res =3D rtw_read8(Adapter, REG_USB_SPECIAL_OPTION, &usb_opt); + if (res) + return; =20 if (adapter_to_dvobj(Adapter)->pusbdev->speed =3D=3D USB_SPEED_HIGH) usb_opt =3D usb_opt | (INT_BULK_SEL); @@ -363,8 +366,12 @@ static void _InitEDCA(struct adapter *Adapter) static void _InitRetryFunction(struct adapter *Adapter) { u8 value8; + int res; + + res =3D rtw_read8(Adapter, REG_FWHW_TXQ_CTRL, &value8); + if (res) + return; =20 - value8 =3D rtw_read8(Adapter, REG_FWHW_TXQ_CTRL); value8 |=3D EN_AMPDU_RTY_NEW; rtw_write8(Adapter, REG_FWHW_TXQ_CTRL, value8); =20 @@ -423,9 +430,15 @@ usb_AggSettingRxUpdate( { u8 valueDMA; u8 valueUSB; + int res; =20 - valueDMA =3D rtw_read8(Adapter, REG_TRXDMA_CTRL); - valueUSB =3D rtw_read8(Adapter, REG_USB_SPECIAL_OPTION); + res =3D rtw_read8(Adapter, REG_TRXDMA_CTRL, &valueDMA); + if (res) + return; + + res =3D rtw_read8(Adapter, REG_USB_SPECIAL_OPTION, &valueUSB); + if (res) + return; =20 valueDMA |=3D RXDMA_AGG_EN; valueUSB &=3D ~USB_AGG_EN; @@ -446,9 +459,11 @@ static void InitUsbAggregationSetting(struct adapter *= Adapter) usb_AggSettingRxUpdate(Adapter); } =20 -static void _InitBeaconParameters(struct adapter *Adapter) +/* FIXME: add error handling in callers */ +static int _InitBeaconParameters(struct adapter *Adapter) { struct hal_data_8188e *haldata =3D &Adapter->haldata; + int res; =20 rtw_write16(Adapter, REG_BCN_CTRL, 0x1010); =20 @@ -461,9 +476,19 @@ static void _InitBeaconParameters(struct adapter *Adap= ter) /* beacause test chip does not contension before sending beacon. by tynl= i. 2009.11.03 */ rtw_write16(Adapter, REG_BCNTCFG, 0x660F); =20 - haldata->RegFwHwTxQCtrl =3D rtw_read8(Adapter, REG_FWHW_TXQ_CTRL + 2); - haldata->RegReg542 =3D rtw_read8(Adapter, REG_TBTT_PROHIBIT + 2); - haldata->RegCR_1 =3D rtw_read8(Adapter, REG_CR + 1); + res =3D rtw_read8(Adapter, REG_FWHW_TXQ_CTRL + 2, &haldata->RegFwHwTxQCtr= l); + if (res) + return res; + + res =3D rtw_read8(Adapter, REG_TBTT_PROHIBIT + 2, &haldata->RegReg542); + if (res) + return res; + + res =3D rtw_read8(Adapter, REG_CR + 1, &haldata->RegCR_1); + if (res) + return res; + + return 0; } =20 static void _BeaconFunctionEnable(struct adapter *Adapter, @@ -514,6 +539,7 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) u16 value16; u8 txpktbuf_bndy; u32 status =3D _SUCCESS; + int res; struct hal_data_8188e *haldata =3D &Adapter->haldata; struct pwrctrl_priv *pwrctrlpriv =3D &Adapter->pwrctrlpriv; struct registry_priv *pregistrypriv =3D &Adapter->registrypriv; @@ -620,7 +646,10 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) =20 /* Enable TX Report */ /* Enable Tx Report Timer */ - value8 =3D rtw_read8(Adapter, REG_TX_RPT_CTRL); + res =3D rtw_read8(Adapter, REG_TX_RPT_CTRL, &value8); + if (res) + return _FAIL; + rtw_write8(Adapter, REG_TX_RPT_CTRL, (value8 | BIT(1) | BIT(0))); /* Set MAX RPT MACID */ rtw_write8(Adapter, REG_TX_RPT_CTRL + 1, 2);/* FOR sta mode ,0: bc/mc ,1= :AP */ @@ -714,9 +743,13 @@ static void CardDisableRTL8188EU(struct adapter *Adapt= er) { u8 val8; struct hal_data_8188e *haldata =3D &Adapter->haldata; + int res; =20 /* Stop Tx Report Timer. 0x4EC[Bit1]=3Db'0 */ - val8 =3D rtw_read8(Adapter, REG_TX_RPT_CTRL); + res =3D rtw_read8(Adapter, REG_TX_RPT_CTRL, &val8); + if (res) + return; + rtw_write8(Adapter, REG_TX_RPT_CTRL, val8 & (~BIT(1))); =20 /* stop rx */ @@ -727,10 +760,16 @@ static void CardDisableRTL8188EU(struct adapter *Adap= ter) =20 /* 2. 0x1F[7:0] =3D 0 turn off RF */ =20 - val8 =3D rtw_read8(Adapter, REG_MCUFWDL); + res =3D rtw_read8(Adapter, REG_MCUFWDL, &val8); + if (res) + return; + if ((val8 & RAM_DL_SEL) && Adapter->bFWReady) { /* 8051 RAM code */ /* Reset MCU 0x2[10]=3D0. */ - val8 =3D rtw_read8(Adapter, REG_SYS_FUNC_EN + 1); + res =3D rtw_read8(Adapter, REG_SYS_FUNC_EN + 1, &val8); + if (res) + return; + val8 &=3D ~BIT(2); /* 0x2[10], FEN_CPUEN */ rtw_write8(Adapter, REG_SYS_FUNC_EN + 1, val8); } @@ -740,26 +779,45 @@ static void CardDisableRTL8188EU(struct adapter *Adap= ter) =20 /* YJ,add,111212 */ /* Disable 32k */ - val8 =3D rtw_read8(Adapter, REG_32K_CTRL); + res =3D rtw_read8(Adapter, REG_32K_CTRL, &val8); + if (res) + return; + rtw_write8(Adapter, REG_32K_CTRL, val8 & (~BIT(0))); =20 /* Card disable power action flow */ HalPwrSeqCmdParsing(Adapter, Rtl8188E_NIC_DISABLE_FLOW); =20 /* Reset MCU IO Wrapper */ - val8 =3D rtw_read8(Adapter, REG_RSV_CTRL + 1); + res =3D rtw_read8(Adapter, REG_RSV_CTRL + 1, &val8); + if (res) + return; + rtw_write8(Adapter, REG_RSV_CTRL + 1, (val8 & (~BIT(3)))); - val8 =3D rtw_read8(Adapter, REG_RSV_CTRL + 1); + + res =3D rtw_read8(Adapter, REG_RSV_CTRL + 1, &val8); + if (res) + return; + rtw_write8(Adapter, REG_RSV_CTRL + 1, val8 | BIT(3)); =20 /* YJ,test add, 111207. For Power Consumption. */ - val8 =3D rtw_read8(Adapter, GPIO_IN); + res =3D rtw_read8(Adapter, GPIO_IN, &val8); + if (res) + return; + rtw_write8(Adapter, GPIO_OUT, val8); rtw_write8(Adapter, GPIO_IO_SEL, 0xFF);/* Reg0x46 */ =20 - val8 =3D rtw_read8(Adapter, REG_GPIO_IO_SEL); + res =3D rtw_read8(Adapter, REG_GPIO_IO_SEL, &val8); + if (res) + return; + rtw_write8(Adapter, REG_GPIO_IO_SEL, (val8 << 4)); - val8 =3D rtw_read8(Adapter, REG_GPIO_IO_SEL + 1); + res =3D rtw_read8(Adapter, REG_GPIO_IO_SEL + 1, &val8); + if (res) + return; + rtw_write8(Adapter, REG_GPIO_IO_SEL + 1, val8 | 0x0F);/* Reg0x43 */ rtw_write32(Adapter, REG_BB_PAD_CTRL, 0x00080808);/* set LNA ,TRSW,EX_PA = Pin to output mode */ haldata->bMacPwrCtrlOn =3D false; @@ -830,9 +888,13 @@ void ReadAdapterInfo8188EU(struct adapter *Adapter) struct eeprom_priv *eeprom =3D &Adapter->eeprompriv; struct led_priv *ledpriv =3D &Adapter->ledpriv; u8 eeValue; + int res; =20 /* check system boot selection */ - eeValue =3D rtw_read8(Adapter, REG_9346CR); + res =3D rtw_read8(Adapter, REG_9346CR, &eeValue); + if (res) + return; + eeprom->EepromOrEfuse =3D (eeValue & BOOT_FROM_EEPROM); eeprom->bautoload_fail_flag =3D !(eeValue & EEPROM_EN); =20 @@ -887,12 +949,21 @@ static void hw_var_set_opmode(struct adapter *Adapter= , u8 *val) { u8 val8; u8 mode =3D *((u8 *)val); + int res; =20 /* disable Port0 TSF update */ - rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL) | BIT(= 4)); + res =3D rtw_read8(Adapter, REG_BCN_CTRL, &val8); + if (res) + return; + + rtw_write8(Adapter, REG_BCN_CTRL, val8 | BIT(4)); =20 /* set net_type */ - val8 =3D rtw_read8(Adapter, MSR) & 0x0c; + res =3D rtw_read8(Adapter, MSR, &val8); + if (res) + return; + + val8 &=3D 0x0c; val8 |=3D mode; rtw_write8(Adapter, MSR, val8); =20 @@ -927,14 +998,22 @@ static void hw_var_set_opmode(struct adapter *Adapter= , u8 *val) rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(0)); =20 /* BIT(3) - If set 0, hw will clr bcnq when tx becon ok/fail or port 0 */ - rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM) | BIT= (3) | BIT(4)); + res =3D rtw_read8(Adapter, REG_MBID_NUM, &val8); + if (res) + return; + + rtw_write8(Adapter, REG_MBID_NUM, val8 | BIT(3) | BIT(4)); =20 /* enable BCN0 Function for if1 */ /* don't enable update TSF0 for if1 (due to TSF update when beacon/probe= rsp are received) */ rtw_write8(Adapter, REG_BCN_CTRL, (DIS_TSF_UDT0_NORMAL_CHIP | EN_BCN_FUN= CTION | BIT(1))); =20 /* dis BCN1 ATIM WND if if2 is station */ - rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1) |= BIT(0)); + res =3D rtw_read8(Adapter, REG_BCN_CTRL_1, &val8); + if (res) + return; + + rtw_write8(Adapter, REG_BCN_CTRL_1, val8 | BIT(0)); } } =20 @@ -943,6 +1022,8 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variab= le, u8 *val) struct hal_data_8188e *haldata =3D &Adapter->haldata; struct dm_priv *pdmpriv =3D &haldata->dmpriv; struct odm_dm_struct *podmpriv =3D &haldata->odmpriv; + u8 reg; + int res; =20 switch (variable) { case HW_VAR_SET_OPMODE: @@ -970,7 +1051,11 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 varia= ble, u8 *val) /* Set RRSR rate table. */ rtw_write8(Adapter, REG_RRSR, BrateCfg & 0xff); rtw_write8(Adapter, REG_RRSR + 1, (BrateCfg >> 8) & 0xff); - rtw_write8(Adapter, REG_RRSR + 2, rtw_read8(Adapter, REG_RRSR + 2) & 0x= f0); + res =3D rtw_read8(Adapter, REG_RRSR + 2, ®); + if (res) + return; + + rtw_write8(Adapter, REG_RRSR + 2, reg & 0xf0); =20 /* Set RTS initial rate */ while (BrateCfg > 0x1) { @@ -994,13 +1079,21 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 vari= able, u8 *val) StopTxBeacon(Adapter); =20 /* disable related TSF function */ - rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL) & (~= BIT(3))); + res =3D rtw_read8(Adapter, REG_BCN_CTRL, ®); + if (res) + return; + + rtw_write8(Adapter, REG_BCN_CTRL, reg & (~BIT(3))); =20 rtw_write32(Adapter, REG_TSFTR, tsf); rtw_write32(Adapter, REG_TSFTR + 4, tsf >> 32); =20 /* enable related TSF function */ - rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL) | BI= T(3)); + res =3D rtw_read8(Adapter, REG_BCN_CTRL, ®); + if (res) + return; + + rtw_write8(Adapter, REG_BCN_CTRL, reg | BIT(3)); =20 if (((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_ADHOC_STATE) || ((pmlmein= fo->state & 0x03) =3D=3D WIFI_FW_AP_STATE)) ResumeTxBeacon(Adapter); @@ -1016,7 +1109,11 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 vari= able, u8 *val) rtw_write16(Adapter, REG_RXFLTMAP2, 0x00); =20 /* disable update TSF */ - rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL) | BI= T(4)); + res =3D rtw_read8(Adapter, REG_BCN_CTRL, ®); + if (res) + return; + + rtw_write8(Adapter, REG_BCN_CTRL, reg | BIT(4)); } else { /* sitesurvey done */ struct mlme_ext_priv *pmlmeext =3D &Adapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo =3D &pmlmeext->mlmext_info; @@ -1027,11 +1124,19 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 var= iable, u8 *val) rtw_write16(Adapter, REG_RXFLTMAP2, 0xFFFF); =20 /* enable update TSF */ - rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL) & (= ~BIT(4))); + res =3D rtw_read8(Adapter, REG_BCN_CTRL, ®); + if (res) + return; + + rtw_write8(Adapter, REG_BCN_CTRL, reg & (~BIT(4))); } else if ((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_AP_STATE) { rtw_write16(Adapter, REG_RXFLTMAP2, 0xFFFF); /* enable update TSF */ - rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL) & (= ~BIT(4))); + res =3D rtw_read8(Adapter, REG_BCN_CTRL, ®); + if (res) + return; + + rtw_write8(Adapter, REG_BCN_CTRL, reg & (~BIT(4))); } rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR) | RCR_CBSSID= _BCN); } @@ -1190,6 +1295,8 @@ void SetBeaconRelatedRegisters8188EUsb(struct adapter= *adapt) struct mlme_ext_priv *pmlmeext =3D &adapt->mlmeextpriv; struct mlme_ext_info *pmlmeinfo =3D &pmlmeext->mlmext_info; u32 bcn_ctrl_reg =3D REG_BCN_CTRL; + int res; + u8 reg; /* reset TSF, enable update TSF, correcting TSF On Beacon */ =20 /* BCN interval */ @@ -1215,7 +1322,11 @@ void SetBeaconRelatedRegisters8188EUsb(struct adapte= r *adapt) =20 ResumeTxBeacon(adapt); =20 - rtw_write8(adapt, bcn_ctrl_reg, rtw_read8(adapt, bcn_ctrl_reg) | BIT(1)); + res =3D rtw_read8(adapt, bcn_ctrl_reg, ®); + if (res) + return; + + rtw_write8(adapt, bcn_ctrl_reg, reg | BIT(1)); } =20 void rtl8188eu_init_default_value(struct adapter *adapt) diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/= r8188eu/hal/usb_ops_linux.c index d5e674542a78..f399a7fd8b97 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -94,16 +94,13 @@ static int usb_write(struct intf_hdl *intf, u16 value, = void *data, u8 size) return status; } =20 -u8 rtw_read8(struct adapter *adapter, u32 addr) +int __must_check rtw_read8(struct adapter *adapter, u32 addr, u8 *data) { struct io_priv *io_priv =3D &adapter->iopriv; struct intf_hdl *intf =3D &io_priv->intf; u16 value =3D addr & 0xffff; - u8 data; =20 - usb_read(intf, value, &data, 1); - - return data; + return usb_read(intf, value, data, 1); } =20 u16 rtw_read16(struct adapter *adapter, u32 addr) diff --git a/drivers/staging/r8188eu/include/rtw_io.h b/drivers/staging/r81= 88eu/include/rtw_io.h index 6910e2b430e2..1198d3850a6d 100644 --- a/drivers/staging/r8188eu/include/rtw_io.h +++ b/drivers/staging/r8188eu/include/rtw_io.h @@ -220,7 +220,7 @@ void unregister_intf_hdl(struct intf_hdl *pintfhdl); void _rtw_attrib_read(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem= ); void _rtw_attrib_write(struct adapter *adapter, u32 addr, u32 cnt, u8 *pme= m); =20 -u8 rtw_read8(struct adapter *adapter, u32 addr); +int __must_check rtw_read8(struct adapter *adapter, u32 addr, u8 *data); u16 rtw_read16(struct adapter *adapter, u32 addr); u32 rtw_read32(struct adapter *adapter, u32 addr); void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem); diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging= /r8188eu/os_dep/ioctl_linux.c index 8dd280e2739a..19a60d47f7c0 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -3178,6 +3178,7 @@ static void rtw_set_dynamic_functions(struct adapter = *adapter, u8 dm_func) { struct hal_data_8188e *haldata =3D &adapter->haldata; struct odm_dm_struct *odmpriv =3D &haldata->odmpriv; + int res; =20 switch (dm_func) { case 0: @@ -3193,7 +3194,9 @@ static void rtw_set_dynamic_functions(struct adapter = *adapter, u8 dm_func) if (!(odmpriv->SupportAbility & DYNAMIC_BB_DIG)) { struct rtw_dig *digtable =3D &odmpriv->DM_DigTable; =20 - digtable->CurIGValue =3D rtw_read8(adapter, 0xc50); + res =3D rtw_read8(adapter, 0xc50, &digtable->CurIGValue); + (void)res; + /* FIXME: return an error to caller */ } odmpriv->SupportAbility =3D DYNAMIC_ALL_FUNC_ENABLE; break; @@ -3329,8 +3332,9 @@ static int rtw_dbg_port(struct net_device *dev, u16 reg =3D arg; u16 start_value =3D 0; u32 write_num =3D extra_arg; - int i; + int i, res; struct xmit_frame *xmit_frame; + u8 val8; =20 xmit_frame =3D rtw_IOL_accquire_xmit_frame(padapter); if (!xmit_frame) { @@ -3343,7 +3347,8 @@ static int rtw_dbg_port(struct net_device *dev, if (rtl8188e_IOL_exec_cmds_sync(padapter, xmit_frame, 5000, 0) !=3D _SU= CCESS) ret =3D -EPERM; =20 - rtw_read8(padapter, reg); + /* FIXME: is this read necessary? */ + res =3D rtw_read8(padapter, reg, &val8); } break; =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56045C32793 for ; Tue, 23 Aug 2022 09:13:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348721AbiHWJNN (ORCPT ); Tue, 23 Aug 2022 05:13:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348588AbiHWJKd (ORCPT ); Tue, 23 Aug 2022 05:10:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CA0986B4B; Tue, 23 Aug 2022 01:31:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7259A6148F; Tue, 23 Aug 2022 08:29:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D97AC433D6; Tue, 23 Aug 2022 08:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243394; bh=XkQgWCzn7F/KFfaIqhB0CsQBqeftRjnek4mk+lcM3Yk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sAG2GrQbZS/hPXQJ+vz+QnEQ+AaoYS1kgRN+nGSQQVSs4iBPs+X5XM8ffefSyQ4Ti y9Gx4qFlO4Ouo9b8rQfSq2Oet2Nfm1yoG98rip+kg5h4uu+HztsmhClFmHI//kc1Ej 5LaKvAd8CJ8AU5tuodORoZgbgREE/8FSjwd3K/0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Sasha Levin Subject: [PATCH 5.19 262/365] staging: r8188eu: add error handling of rtw_read16 Date: Tue, 23 Aug 2022 10:02:43 +0200 Message-Id: <20220823080129.153629877@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Skripkin [ Upstream commit fed9e604eeb6150847d9757f6b056c12912d468b ] rtw_read16() reads data from device via USB API which may fail. In case of any failure previous code returned stack data to callers, which is wrong. Fix it by changing rtw_read16() prototype and prevent caller from touching random stack data Signed-off-by: Pavel Skripkin Link: https://lore.kernel.org/r/06b45afda048d0aeddeed983c2318680fe6265f5.16= 54629778.git.paskripkin@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- .../staging/r8188eu/hal/rtl8188e_hal_init.c | 29 +++++++++++++++---- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 8 +++-- drivers/staging/r8188eu/hal/usb_halinit.c | 27 ++++++++++++++--- drivers/staging/r8188eu/hal/usb_ops_linux.c | 13 ++++++--- drivers/staging/r8188eu/include/rtw_io.h | 2 +- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 9 ++++-- drivers/staging/r8188eu/os_dep/os_intfs.c | 6 +++- 7 files changed, 73 insertions(+), 21 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/stag= ing/r8188eu/hal/rtl8188e_hal_init.c index e67ecbd1ba79..8215ed8b506d 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -200,7 +200,8 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _s= ize_byte, u8 *pbuf) kfree(eFuseWord); } =20 -static void efuse_read_phymap_from_txpktbuf( +/* FIXME: add error handling in callers */ +static int efuse_read_phymap_from_txpktbuf( struct adapter *adapter, int bcnhead, /* beacon head, where FW store len(2-byte) and efuse physica= l map. */ u8 *content, /* buffer to store efuse physical map */ @@ -219,7 +220,7 @@ static void efuse_read_phymap_from_txpktbuf( if (bcnhead < 0) { /* if not valid */ res =3D rtw_read8(adapter, REG_TDECTRL + 1, ®); if (res) - return; + return res; =20 bcnhead =3D reg; } @@ -249,11 +250,15 @@ static void efuse_read_phymap_from_txpktbuf( hi32 =3D cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_H)); =20 if (i =3D=3D 0) { + u16 reg; + /* Although lenc is only used in a debug statement, * do not remove it as the rtw_read16() call consumes * 2 bytes from the EEPROM source. */ - rtw_read16(adapter, REG_PKTBUF_DBG_DATA_L); + res =3D rtw_read16(adapter, REG_PKTBUF_DBG_DATA_L, ®); + if (res) + return res; =20 len =3D le32_to_cpu(lo32) & 0x0000ffff; =20 @@ -280,6 +285,8 @@ static void efuse_read_phymap_from_txpktbuf( } rtw_write8(adapter, REG_PKT_BUFF_ACCESS_CTRL, DISABLE_TRXPKT_BUF_ACCESS); *size =3D count; + + return 0; } =20 static s32 iol_read_efuse(struct adapter *padapter, u8 txpktbuf_bndy, u16 = offset, u16 size_byte, u8 *logical_map) @@ -355,25 +362,35 @@ int rtl8188e_IOL_exec_cmds_sync(struct adapter *adapt= er, struct xmit_frame *xmit void rtl8188e_EfusePowerSwitch(struct adapter *pAdapter, u8 PwrState) { u16 tmpV16; + int res; =20 if (PwrState) { rtw_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON); =20 /* 1.2V Power: From VDDON with Power Cut(0x0000h[15]), defualt valid */ - tmpV16 =3D rtw_read16(pAdapter, REG_SYS_ISO_CTRL); + res =3D rtw_read16(pAdapter, REG_SYS_ISO_CTRL, &tmpV16); + if (res) + return; + if (!(tmpV16 & PWC_EV12V)) { tmpV16 |=3D PWC_EV12V; rtw_write16(pAdapter, REG_SYS_ISO_CTRL, tmpV16); } /* Reset: 0x0000h[28], default valid */ - tmpV16 =3D rtw_read16(pAdapter, REG_SYS_FUNC_EN); + res =3D rtw_read16(pAdapter, REG_SYS_FUNC_EN, &tmpV16); + if (res) + return; + if (!(tmpV16 & FEN_ELDR)) { tmpV16 |=3D FEN_ELDR; rtw_write16(pAdapter, REG_SYS_FUNC_EN, tmpV16); } =20 /* Clock: Gated(0x0008h[5]) 8M(0x0008h[1]) clock from ANA, default vali= d */ - tmpV16 =3D rtw_read16(pAdapter, REG_SYS_CLKR); + res =3D rtw_read16(pAdapter, REG_SYS_CLKR, &tmpV16); + if (res) + return; + if ((!(tmpV16 & LOADER_CLK_EN)) || (!(tmpV16 & ANA8M))) { tmpV16 |=3D (LOADER_CLK_EN | ANA8M); rtw_write16(pAdapter, REG_SYS_CLKR, tmpV16); diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/stagin= g/r8188eu/hal/rtl8188e_phycfg.c index 985339a974fc..298c3d9bc7be 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -484,13 +484,17 @@ PHY_BBConfig8188E( { int rtStatus =3D _SUCCESS; struct hal_data_8188e *pHalData =3D &Adapter->haldata; - u32 RegVal; + u16 RegVal; u8 CrystalCap; + int res; =20 phy_InitBBRFRegisterDefinition(Adapter); =20 /* Enable BB and RF */ - RegVal =3D rtw_read16(Adapter, REG_SYS_FUNC_EN); + res =3D rtw_read16(Adapter, REG_SYS_FUNC_EN, &RegVal); + if (res) + return _FAIL; + rtw_write16(Adapter, REG_SYS_FUNC_EN, (u16)(RegVal | BIT(13) | BIT(0) | B= IT(1))); =20 /* 20090923 Joseph: Advised by Steven and Jenyu. Power sequence before i= nit RF. */ diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8= 188eu/hal/usb_halinit.c index 01422d548748..e7b51b427e8f 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -52,6 +52,8 @@ void rtl8188eu_interface_configure(struct adapter *adapt) u32 rtl8188eu_InitPowerOn(struct adapter *adapt) { u16 value16; + int res; + /* HW Power on sequence */ struct hal_data_8188e *haldata =3D &adapt->haldata; if (haldata->bMacPwrCtrlOn) @@ -65,7 +67,10 @@ u32 rtl8188eu_InitPowerOn(struct adapter *adapt) rtw_write16(adapt, REG_CR, 0x00); /* suggseted by zhouzhou, by page, 201= 11230 */ =20 /* Enable MAC DMA/WMAC/SCHEDULE/SEC block */ - value16 =3D rtw_read16(adapt, REG_CR); + res =3D rtw_read16(adapt, REG_CR, &value16); + if (res) + return _FAIL; + value16 |=3D (HCI_TXDMA_EN | HCI_RXDMA_EN | TXDMA_EN | RXDMA_EN | PROTOCOL_EN | SCHEDULE_EN | ENSEC | CALTMR_EN); /* for SDIO - Set CR bit10 to enable 32k calibration. Suggested by SD1 G= immy. Added by tynli. 2011.08.31. */ @@ -166,7 +171,14 @@ static void _InitNormalChipRegPriority(struct adapter = *Adapter, u16 beQ, u16 bkQ, u16 viQ, u16 voQ, u16 mgtQ, u16 hiQ) { - u16 value16 =3D (rtw_read16(Adapter, REG_TRXDMA_CTRL) & 0x7); + u16 value16; + int res; + + res =3D rtw_read16(Adapter, REG_TRXDMA_CTRL, &value16); + if (res) + return; + + value16 &=3D 0x7; =20 value16 |=3D _TXDMA_BEQ_MAP(beQ) | _TXDMA_BKQ_MAP(bkQ) | _TXDMA_VIQ_MAP(viQ) | _TXDMA_VOQ_MAP(voQ) | @@ -640,7 +652,10 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) /* Hw bug which Hw initials RxFF boundary size to a value which is large= r than the real Rx buffer size in 88E. */ /* */ /* Enable MACTXEN/MACRXEN block */ - value16 =3D rtw_read16(Adapter, REG_CR); + res =3D rtw_read16(Adapter, REG_CR, &value16); + if (res) + return _FAIL; + value16 |=3D (MACTXEN | MACRXEN); rtw_write8(Adapter, REG_CR, value16); =20 @@ -713,7 +728,11 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) rtw_write16(Adapter, REG_TX_RPT_TIME, 0x3DF0); =20 /* enable tx DMA to drop the redundate data of packet */ - rtw_write16(Adapter, REG_TXDMA_OFFSET_CHK, (rtw_read16(Adapter, REG_TXDMA= _OFFSET_CHK) | DROP_DATA_EN)); + res =3D rtw_read16(Adapter, REG_TXDMA_OFFSET_CHK, &value16); + if (res) + return _FAIL; + + rtw_write16(Adapter, REG_TXDMA_OFFSET_CHK, (value16 | DROP_DATA_EN)); =20 /* 2010/08/26 MH Merge from 8192CE. */ if (pwrctrlpriv->rf_pwrstate =3D=3D rf_on) { diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/= r8188eu/hal/usb_ops_linux.c index f399a7fd8b97..7d62f1f3d26e 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -103,16 +103,21 @@ int __must_check rtw_read8(struct adapter *adapter, u= 32 addr, u8 *data) return usb_read(intf, value, data, 1); } =20 -u16 rtw_read16(struct adapter *adapter, u32 addr) +int __must_check rtw_read16(struct adapter *adapter, u32 addr, u16 *data) { struct io_priv *io_priv =3D &adapter->iopriv; struct intf_hdl *intf =3D &io_priv->intf; u16 value =3D addr & 0xffff; - __le16 data; + __le16 le_data; + int res; =20 - usb_read(intf, value, &data, 2); + res =3D usb_read(intf, value, &le_data, 2); + if (res) + return res; =20 - return le16_to_cpu(data); + *data =3D le16_to_cpu(le_data); + + return 0; } =20 u32 rtw_read32(struct adapter *adapter, u32 addr) diff --git a/drivers/staging/r8188eu/include/rtw_io.h b/drivers/staging/r81= 88eu/include/rtw_io.h index 1198d3850a6d..ce3369e33d66 100644 --- a/drivers/staging/r8188eu/include/rtw_io.h +++ b/drivers/staging/r8188eu/include/rtw_io.h @@ -221,7 +221,7 @@ void _rtw_attrib_read(struct adapter *adapter, u32 addr= , u32 cnt, u8 *pmem); void _rtw_attrib_write(struct adapter *adapter, u32 addr, u32 cnt, u8 *pme= m); =20 int __must_check rtw_read8(struct adapter *adapter, u32 addr, u8 *data); -u16 rtw_read16(struct adapter *adapter, u32 addr); +int __must_check rtw_read16(struct adapter *adapter, u32 addr, u16 *data); u32 rtw_read32(struct adapter *adapter, u32 addr); void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem); u32 rtw_read_port(struct adapter *adapter, u8 *pmem); diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging= /r8188eu/os_dep/ioctl_linux.c index 19a60d47f7c0..7ec363089ae0 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -3349,6 +3349,7 @@ static int rtw_dbg_port(struct net_device *dev, =20 /* FIXME: is this read necessary? */ res =3D rtw_read8(padapter, reg, &val8); + (void)res; } break; =20 @@ -3357,8 +3358,8 @@ static int rtw_dbg_port(struct net_device *dev, u16 reg =3D arg; u16 start_value =3D 200; u32 write_num =3D extra_arg; - - int i; + u16 val16; + int i, res; struct xmit_frame *xmit_frame; =20 xmit_frame =3D rtw_IOL_accquire_xmit_frame(padapter); @@ -3372,7 +3373,9 @@ static int rtw_dbg_port(struct net_device *dev, if (rtl8188e_IOL_exec_cmds_sync(padapter, xmit_frame, 5000, 0) !=3D _SU= CCESS) ret =3D -EPERM; =20 - rtw_read16(padapter, reg); + /* FIXME: is this read necessary? */ + res =3D rtw_read16(padapter, reg, &val16); + (void)res; } break; case 0x08: /* continuous write dword test */ diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8= 188eu/os_dep/os_intfs.c index 891c85b088ca..d9325ef6ac28 100644 --- a/drivers/staging/r8188eu/os_dep/os_intfs.c +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c @@ -740,12 +740,16 @@ static void rtw_fifo_cleanup(struct adapter *adapter) { struct pwrctrl_priv *pwrpriv =3D &adapter->pwrctrlpriv; u8 trycnt =3D 100; + int res; =20 /* pause tx */ rtw_write8(adapter, REG_TXPAUSE, 0xff); =20 /* keep sn */ - adapter->xmitpriv.nqos_ssn =3D rtw_read16(adapter, REG_NQOS_SEQ); + /* FIXME: return an error to caller */ + res =3D rtw_read16(adapter, REG_NQOS_SEQ, &adapter->xmitpriv.nqos_ssn); + if (res) + return; =20 if (!pwrpriv->bkeepfwalive) { /* RX DMA stop */ --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A57AAC32792 for ; Tue, 23 Aug 2022 09:08:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347920AbiHWJIS (ORCPT ); Tue, 23 Aug 2022 05:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347853AbiHWJGz (ORCPT ); Tue, 23 Aug 2022 05:06:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80B6485FA0; Tue, 23 Aug 2022 01:30:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9E11EB81C53; Tue, 23 Aug 2022 08:29:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A51D8C433C1; Tue, 23 Aug 2022 08:29:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243398; bh=iY9qqjm22WO0N4xaF6uRhgesbdMTjscGPIG+GsL7NKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VzHBD3C+zwjbIxeniVTqDKtVfPCOCTdrOIV3hNjJaWz/eJ1CUELWZxBYRRwcZbPZm ZPgTLrEjNZGK8mCvZQ4wwYOSVi+i7SvoGdV+0NDqa+cWW03ZF7qIZZgEs/bUwB108C kyLdXchM99Lpelp8uN8jvpqjegcuOgkeL3eAPd2Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Sasha Levin Subject: [PATCH 5.19 263/365] staging: r8188eu: add error handling of rtw_read32 Date: Tue, 23 Aug 2022 10:02:44 +0200 Message-Id: <20220823080129.188025708@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Skripkin [ Upstream commit b9c5e272062708680d47df433bfbfe5299ad1a63 ] rtw_read32() reads data from device via USB API which may fail. In case of any failure previous code returned stack data to callers, which is wrong. Fix it by changing rtw_read32() prototype and prevent caller from touching random stack data Signed-off-by: Pavel Skripkin Link: https://lore.kernel.org/r/583c3d21c46066275e4fc8da5ba4fd0e3679335b.16= 54629778.git.paskripkin@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/staging/r8188eu/core/rtw_cmd.c | 15 +++++- drivers/staging/r8188eu/core/rtw_efuse.c | 20 ++++--- drivers/staging/r8188eu/core/rtw_fw.c | 16 ++++-- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 14 ++++- drivers/staging/r8188eu/core/rtw_pwrctrl.c | 9 +++- .../r8188eu/hal/Hal8188ERateAdaptive.c | 21 ++++++-- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 3 +- .../staging/r8188eu/hal/rtl8188e_hal_init.c | 40 +++++++++----- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 12 ++++- drivers/staging/r8188eu/hal/usb_halinit.c | 53 ++++++++++++++++--- drivers/staging/r8188eu/hal/usb_ops_linux.c | 13 +++-- drivers/staging/r8188eu/include/rtw_io.h | 2 +- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 27 ++++++++-- drivers/staging/r8188eu/os_dep/os_intfs.c | 13 ++++- 14 files changed, 202 insertions(+), 56 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188= eu/core/rtw_cmd.c index 06523d91939a..5b6a891b5d67 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -898,8 +898,12 @@ static void traffic_status_watchdog(struct adapter *pa= dapter) static void rtl8188e_sreset_xmit_status_check(struct adapter *padapter) { u32 txdma_status; + int res; + + res =3D rtw_read32(padapter, REG_TXDMA_STATUS, &txdma_status); + if (res) + return; =20 - txdma_status =3D rtw_read32(padapter, REG_TXDMA_STATUS); if (txdma_status !=3D 0x00) rtw_write32(padapter, REG_TXDMA_STATUS, txdma_status); /* total xmit irp =3D 4 */ @@ -1177,7 +1181,14 @@ u8 rtw_ps_cmd(struct adapter *padapter) =20 static bool rtw_is_hi_queue_empty(struct adapter *adapter) { - return (rtw_read32(adapter, REG_HGQ_INFORMATION) & 0x0000ff00) =3D=3D 0; + int res; + u32 reg; + + res =3D rtw_read32(adapter, REG_HGQ_INFORMATION, ®); + if (res) + return false; + + return (reg & 0x0000ff00) =3D=3D 0; } =20 static void rtw_chk_hi_queue_hdl(struct adapter *padapter) diff --git a/drivers/staging/r8188eu/core/rtw_efuse.c b/drivers/staging/r81= 88eu/core/rtw_efuse.c index a2691c7f96f6..8005ed8d3a20 100644 --- a/drivers/staging/r8188eu/core/rtw_efuse.c +++ b/drivers/staging/r8188eu/core/rtw_efuse.c @@ -46,11 +46,17 @@ ReadEFuseByte( rtw_write8(Adapter, EFUSE_CTRL + 3, (readbyte & 0x7f)); =20 /* Check bit 32 read-ready */ - retry =3D 0; - value32 =3D rtw_read32(Adapter, EFUSE_CTRL); - while (!(((value32 >> 24) & 0xff) & 0x80) && (retry < 10000)) { - value32 =3D rtw_read32(Adapter, EFUSE_CTRL); - retry++; + res =3D rtw_read32(Adapter, EFUSE_CTRL, &value32); + if (res) + return; + + for (retry =3D 0; retry < 10000; retry++) { + res =3D rtw_read32(Adapter, EFUSE_CTRL, &value32); + if (res) + continue; + + if (((value32 >> 24) & 0xff) & 0x80) + break; } =20 /* 20100205 Joseph: Add delay suggested by SD1 Victor. */ @@ -58,7 +64,9 @@ ReadEFuseByte( /* Designer says that there shall be some delay after ready bit is set, = or the */ /* result will always stay on last data we read. */ udelay(50); - value32 =3D rtw_read32(Adapter, EFUSE_CTRL); + res =3D rtw_read32(Adapter, EFUSE_CTRL, &value32); + if (res) + return; =20 *pbuf =3D (u8)(value32 & 0xff); =20 diff --git a/drivers/staging/r8188eu/core/rtw_fw.c b/drivers/staging/r8188e= u/core/rtw_fw.c index 7cf8525595c6..04f25e0b3bca 100644 --- a/drivers/staging/r8188eu/core/rtw_fw.c +++ b/drivers/staging/r8188eu/core/rtw_fw.c @@ -194,10 +194,14 @@ static int fw_free_to_go(struct adapter *padapter) { u32 counter =3D 0; u32 value32; + int res; =20 /* polling CheckSum report */ do { - value32 =3D rtw_read32(padapter, REG_MCUFWDL); + res =3D rtw_read32(padapter, REG_MCUFWDL, &value32); + if (res) + continue; + if (value32 & FWDL_CHKSUM_RPT) break; } while (counter++ < POLLING_READY_TIMEOUT_COUNT); @@ -205,7 +209,10 @@ static int fw_free_to_go(struct adapter *padapter) if (counter >=3D POLLING_READY_TIMEOUT_COUNT) return _FAIL; =20 - value32 =3D rtw_read32(padapter, REG_MCUFWDL); + res =3D rtw_read32(padapter, REG_MCUFWDL, &value32); + if (res) + return _FAIL; + value32 |=3D MCUFWDL_RDY; value32 &=3D ~WINTINI_RDY; rtw_write32(padapter, REG_MCUFWDL, value32); @@ -215,9 +222,10 @@ static int fw_free_to_go(struct adapter *padapter) /* polling for FW ready */ counter =3D 0; do { - value32 =3D rtw_read32(padapter, REG_MCUFWDL); - if (value32 & WINTINI_RDY) + res =3D rtw_read32(padapter, REG_MCUFWDL, &value32); + if (!res && value32 & WINTINI_RDY) return _SUCCESS; + udelay(5); } while (counter++ < POLLING_READY_TIMEOUT_COUNT); =20 diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index fdb5a8cb9d69..88a4953d31d8 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -6017,6 +6017,7 @@ static void mlme_join(struct adapter *adapter, int ty= pe) { struct mlme_priv *mlmepriv =3D &adapter->mlmepriv; u8 retry_limit =3D 0x30, reg; + u32 reg32; int res; =20 switch (type) { @@ -6025,8 +6026,12 @@ static void mlme_join(struct adapter *adapter, int t= ype) /* enable to rx data frame, accept all data frame */ rtw_write16(adapter, REG_RXFLTMAP2, 0xFFFF); =20 + res =3D rtw_read32(adapter, REG_RCR, ®32); + if (res) + return; + rtw_write32(adapter, REG_RCR, - rtw_read32(adapter, REG_RCR) | RCR_CBSSID_DATA | RCR_CBSSID_BCN); + reg32 | RCR_CBSSID_DATA | RCR_CBSSID_BCN); =20 if (check_fwstate(mlmepriv, WIFI_STATION_STATE)) { retry_limit =3D 48; @@ -6839,9 +6844,14 @@ static u8 chk_ap_is_alive(struct sta_info *psta) =20 static int rtl8188e_sreset_linked_status_check(struct adapter *padapter) { - u32 rx_dma_status =3D rtw_read32(padapter, REG_RXDMA_STATUS); + u32 rx_dma_status; + int res; u8 reg; =20 + res =3D rtw_read32(padapter, REG_RXDMA_STATUS, &rx_dma_status); + if (res) + return res; + if (rx_dma_status !=3D 0x00) rtw_write32(padapter, REG_RXDMA_STATUS, rx_dma_status); =20 diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r= 8188eu/core/rtw_pwrctrl.c index 7b816b824947..45e85b593665 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -229,6 +229,9 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mo= de, u8 smart_ps, u8 bcn_a =20 static bool lps_rf_on(struct adapter *adapter) { + int res; + u32 reg; + /* When we halt NIC, we should check if FW LPS is leave. */ if (adapter->pwrctrlpriv.rf_pwrstate =3D=3D rf_off) { /* If it is in HW/SW Radio OFF or IPS state, we do not check Fw LPS Lea= ve, */ @@ -236,7 +239,11 @@ static bool lps_rf_on(struct adapter *adapter) return true; } =20 - if (rtw_read32(adapter, REG_RCR) & 0x00070000) + res =3D rtw_read32(adapter, REG_RCR, ®); + if (res) + return false; + + if (reg & 0x00070000) return false; =20 return true; diff --git a/drivers/staging/r8188eu/hal/Hal8188ERateAdaptive.c b/drivers/s= taging/r8188eu/hal/Hal8188ERateAdaptive.c index 57e8f5573846..3cefdf90d6e0 100644 --- a/drivers/staging/r8188eu/hal/Hal8188ERateAdaptive.c +++ b/drivers/staging/r8188eu/hal/Hal8188ERateAdaptive.c @@ -279,6 +279,7 @@ static int odm_ARFBRefresh_8188E(struct odm_dm_struct *= dm_odm, struct odm_ra_inf { /* Wilson 2011/10/26 */ u32 MaskFromReg; s8 i; + int res; =20 switch (pRaInfo->RateID) { case RATR_INX_WIRELESS_NGB: @@ -303,19 +304,31 @@ static int odm_ARFBRefresh_8188E(struct odm_dm_struct= *dm_odm, struct odm_ra_inf pRaInfo->RAUseRate =3D (pRaInfo->RateMask) & 0x0000000d; break; case 12: - MaskFromReg =3D rtw_read32(dm_odm->Adapter, REG_ARFR0); + res =3D rtw_read32(dm_odm->Adapter, REG_ARFR0, &MaskFromReg); + if (res) + return res; + pRaInfo->RAUseRate =3D (pRaInfo->RateMask) & MaskFromReg; break; case 13: - MaskFromReg =3D rtw_read32(dm_odm->Adapter, REG_ARFR1); + res =3D rtw_read32(dm_odm->Adapter, REG_ARFR1, &MaskFromReg); + if (res) + return res; + pRaInfo->RAUseRate =3D (pRaInfo->RateMask) & MaskFromReg; break; case 14: - MaskFromReg =3D rtw_read32(dm_odm->Adapter, REG_ARFR2); + res =3D rtw_read32(dm_odm->Adapter, REG_ARFR2, &MaskFromReg); + if (res) + return res; + pRaInfo->RAUseRate =3D (pRaInfo->RateMask) & MaskFromReg; break; case 15: - MaskFromReg =3D rtw_read32(dm_odm->Adapter, REG_ARFR3); + res =3D rtw_read32(dm_odm->Adapter, REG_ARFR3, &MaskFromReg); + if (res) + return res; + pRaInfo->RAUseRate =3D (pRaInfo->RateMask) & MaskFromReg; break; default: diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging= /r8188eu/hal/HalPhyRf_8188e.c index a5b7980dfcee..525deab10820 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -483,7 +483,8 @@ static void _PHY_SaveMACRegisters( MACBackup[i] =3D reg; } =20 - MACBackup[i] =3D rtw_read32(adapt, MACReg[i]); + res =3D rtw_read32(adapt, MACReg[i], MACBackup + i); + (void)res; } =20 static void reload_adda_reg(struct adapter *adapt, u32 *ADDAReg, u32 *ADDA= Backup, u32 RegiesterNum) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/stag= ing/r8188eu/hal/rtl8188e_hal_init.c index 8215ed8b506d..5549e7be334a 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -216,6 +216,7 @@ static int efuse_read_phymap_from_txpktbuf( u16 limit =3D *size; u8 reg; u8 *pos =3D content; + u32 reg32; =20 if (bcnhead < 0) { /* if not valid */ res =3D rtw_read8(adapter, REG_TDECTRL + 1, ®); @@ -246,8 +247,17 @@ static int efuse_read_phymap_from_txpktbuf( } while (time_before(jiffies, timeout)); =20 /* data from EEPROM needs to be in LE */ - lo32 =3D cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_L)); - hi32 =3D cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_H)); + res =3D rtw_read32(adapter, REG_PKTBUF_DBG_DATA_L, ®32); + if (res) + return res; + + lo32 =3D cpu_to_le32(reg32); + + res =3D rtw_read32(adapter, REG_PKTBUF_DBG_DATA_H, ®32); + if (res) + return res; + + hi32 =3D cpu_to_le32(reg32); =20 if (i =3D=3D 0) { u16 reg; @@ -548,8 +558,12 @@ void rtl8188e_read_chip_version(struct adapter *padapt= er) u32 value32; struct HAL_VERSION ChipVersion; struct hal_data_8188e *pHalData =3D &padapter->haldata; + int res; + + res =3D rtw_read32(padapter, REG_SYS_CFG, &value32); + if (res) + return; =20 - value32 =3D rtw_read32(padapter, REG_SYS_CFG); ChipVersion.ChipType =3D ((value32 & RTL_ID) ? TEST_CHIP : NORMAL_CHIP); =20 ChipVersion.VendorType =3D ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : CHI= P_VENDOR_TSMC); @@ -596,26 +610,24 @@ void hal_notch_filter_8188e(struct adapter *adapter, = bool enable) /* */ static s32 _LLTWrite(struct adapter *padapter, u32 address, u32 data) { - s32 status =3D _SUCCESS; - s32 count =3D 0; + s32 count; u32 value =3D _LLT_INIT_ADDR(address) | _LLT_INIT_DATA(data) | _LLT_OP(_L= LT_WRITE_ACCESS); u16 LLTReg =3D REG_LLT_INIT; + int res; =20 rtw_write32(padapter, LLTReg, value); =20 /* polling */ - do { - value =3D rtw_read32(padapter, LLTReg); - if (_LLT_NO_ACTIVE =3D=3D _LLT_OP_VALUE(value)) - break; + for (count =3D 0; count <=3D POLLING_LLT_THRESHOLD; count++) { + res =3D rtw_read32(padapter, LLTReg, &value); + if (res) + continue; =20 - if (count > POLLING_LLT_THRESHOLD) { - status =3D _FAIL; + if (_LLT_NO_ACTIVE =3D=3D _LLT_OP_VALUE(value)) break; - } - } while (count++); + } =20 - return status; + return count > POLLING_LLT_THRESHOLD ? _FAIL : _SUCCESS; } =20 s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/stagin= g/r8188eu/hal/rtl8188e_phycfg.c index 298c3d9bc7be..dea6d915a1f4 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -56,8 +56,12 @@ rtl8188e_PHY_QueryBBReg( ) { u32 ReturnValue =3D 0, OriginalValue, BitShift; + int res; + + res =3D rtw_read32(Adapter, RegAddr, &OriginalValue); + if (res) + return 0; =20 - OriginalValue =3D rtw_read32(Adapter, RegAddr); BitShift =3D phy_CalculateBitShift(BitMask); ReturnValue =3D (OriginalValue & BitMask) >> BitShift; return ReturnValue; @@ -84,9 +88,13 @@ rtl8188e_PHY_QueryBBReg( void rtl8188e_PHY_SetBBReg(struct adapter *Adapter, u32 RegAddr, u32 BitMa= sk, u32 Data) { u32 OriginalValue, BitShift; + int res; =20 if (BitMask !=3D bMaskDWord) { /* if not "double word" write */ - OriginalValue =3D rtw_read32(Adapter, RegAddr); + res =3D rtw_read32(Adapter, RegAddr, &OriginalValue); + if (res) + return; + BitShift =3D phy_CalculateBitShift(BitMask); Data =3D ((OriginalValue & (~BitMask)) | (Data << BitShift)); } diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8= 188eu/hal/usb_halinit.c index e7b51b427e8f..0afde5038b3f 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -297,8 +297,12 @@ static void _InitQueuePriority(struct adapter *Adapter) static void _InitNetworkType(struct adapter *Adapter) { u32 value32; + int res; + + res =3D rtw_read32(Adapter, REG_CR, &value32); + if (res) + return; =20 - value32 =3D rtw_read32(Adapter, REG_CR); /* TODO: use the other function to set network type */ value32 =3D (value32 & ~MASK_NETTYPE) | _NETTYPE(NT_LINK_AP); =20 @@ -338,9 +342,13 @@ static void _InitAdaptiveCtrl(struct adapter *Adapter) { u16 value16; u32 value32; + int res; =20 /* Response Rate Set */ - value32 =3D rtw_read32(Adapter, REG_RRSR); + res =3D rtw_read32(Adapter, REG_RRSR, &value32); + if (res) + return; + value32 &=3D ~RATE_BITMAP_ALL; value32 |=3D RATE_RRSR_CCK_ONLY_1M; rtw_write32(Adapter, REG_RRSR, value32); @@ -409,11 +417,15 @@ static void _InitRetryFunction(struct adapter *Adapte= r) static void usb_AggSettingTxUpdate(struct adapter *Adapter) { u32 value32; + int res; =20 if (Adapter->registrypriv.wifi_spec) return; =20 - value32 =3D rtw_read32(Adapter, REG_TDECTRL); + res =3D rtw_read32(Adapter, REG_TDECTRL, &value32); + if (res) + return; + value32 =3D value32 & ~(BLK_DESC_NUM_MASK << BLK_DESC_NUM_SHIFT); value32 |=3D ((USB_TXAGG_DESC_NUM & BLK_DESC_NUM_MASK) << BLK_DESC_NUM_SH= IFT); =20 @@ -521,11 +533,17 @@ static void _BBTurnOnBlock(struct adapter *Adapter) static void _InitAntenna_Selection(struct adapter *Adapter) { struct hal_data_8188e *haldata =3D &Adapter->haldata; + int res; + u32 reg; =20 if (haldata->AntDivCfg =3D=3D 0) return; =20 - rtw_write32(Adapter, REG_LEDCFG0, rtw_read32(Adapter, REG_LEDCFG0) | BIT(= 23)); + res =3D rtw_read32(Adapter, REG_LEDCFG0, ®); + if (res) + return; + + rtw_write32(Adapter, REG_LEDCFG0, reg | BIT(23)); rtl8188e_PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, BIT(13), 0x01); =20 if (rtl8188e_PHY_QueryBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300) =3D= =3D Antenna_A) @@ -555,6 +573,7 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) struct hal_data_8188e *haldata =3D &Adapter->haldata; struct pwrctrl_priv *pwrctrlpriv =3D &Adapter->pwrctrlpriv; struct registry_priv *pregistrypriv =3D &Adapter->registrypriv; + u32 reg; =20 if (Adapter->pwrctrlpriv.bkeepfwalive) { if (haldata->odmpriv.RFCalibrateInfo.bIQKInitialized) { @@ -752,7 +771,11 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) rtw_write8(Adapter, REG_USB_HRPWM, 0); =20 /* ack for xmit mgmt frames. */ - rtw_write32(Adapter, REG_FWHW_TXQ_CTRL, rtw_read32(Adapter, REG_FWHW_TXQ_= CTRL) | BIT(12)); + res =3D rtw_read32(Adapter, REG_FWHW_TXQ_CTRL, ®); + if (res) + return _FAIL; + + rtw_write32(Adapter, REG_FWHW_TXQ_CTRL, reg | BIT(12)); =20 exit: return status; @@ -1121,7 +1144,12 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 vari= able, u8 *val) case HW_VAR_MLME_SITESURVEY: if (*((u8 *)val)) { /* under sitesurvey */ /* config RCR to receive different BSSID & not to receive data frame */ - u32 v =3D rtw_read32(Adapter, REG_RCR); + u32 v; + + res =3D rtw_read32(Adapter, REG_RCR, &v); + if (res) + return; + v &=3D ~(RCR_CBSSID_BCN); rtw_write32(Adapter, REG_RCR, v); /* reject all data frame */ @@ -1136,6 +1164,7 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 varia= ble, u8 *val) } else { /* sitesurvey done */ struct mlme_ext_priv *pmlmeext =3D &Adapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo =3D &pmlmeext->mlmext_info; + u32 reg32; =20 if ((is_client_associated_to_ap(Adapter)) || ((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_ADHOC_STATE)) { @@ -1157,7 +1186,12 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 vari= able, u8 *val) =20 rtw_write8(Adapter, REG_BCN_CTRL, reg & (~BIT(4))); } - rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR) | RCR_CBSSID= _BCN); + + res =3D rtw_read32(Adapter, REG_RCR, ®32); + if (res) + return; + + rtw_write32(Adapter, REG_RCR, reg32 | RCR_CBSSID_BCN); } break; case HW_VAR_SLOT_TIME: @@ -1326,7 +1360,10 @@ void SetBeaconRelatedRegisters8188EUsb(struct adapte= r *adapt) =20 rtw_write8(adapt, REG_SLOT, 0x09); =20 - value32 =3D rtw_read32(adapt, REG_TCR); + res =3D rtw_read32(adapt, REG_TCR, &value32); + if (res) + return; + value32 &=3D ~TSFRST; rtw_write32(adapt, REG_TCR, value32); =20 diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/= r8188eu/hal/usb_ops_linux.c index 7d62f1f3d26e..c1a4d023f627 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -120,16 +120,21 @@ int __must_check rtw_read16(struct adapter *adapter, = u32 addr, u16 *data) return 0; } =20 -u32 rtw_read32(struct adapter *adapter, u32 addr) +int __must_check rtw_read32(struct adapter *adapter, u32 addr, u32 *data) { struct io_priv *io_priv =3D &adapter->iopriv; struct intf_hdl *intf =3D &io_priv->intf; u16 value =3D addr & 0xffff; - __le32 data; + __le32 le_data; + int res; =20 - usb_read(intf, value, &data, 4); + res =3D usb_read(intf, value, &le_data, 4); + if (res) + return res; =20 - return le32_to_cpu(data); + *data =3D le32_to_cpu(le_data); + + return 0; } =20 int rtw_write8(struct adapter *adapter, u32 addr, u8 val) diff --git a/drivers/staging/r8188eu/include/rtw_io.h b/drivers/staging/r81= 88eu/include/rtw_io.h index ce3369e33d66..1c6097367a67 100644 --- a/drivers/staging/r8188eu/include/rtw_io.h +++ b/drivers/staging/r8188eu/include/rtw_io.h @@ -222,7 +222,7 @@ void _rtw_attrib_write(struct adapter *adapter, u32 add= r, u32 cnt, u8 *pmem); =20 int __must_check rtw_read8(struct adapter *adapter, u32 addr, u8 *data); int __must_check rtw_read16(struct adapter *adapter, u32 addr, u16 *data); -u32 rtw_read32(struct adapter *adapter, u32 addr); +int __must_check rtw_read32(struct adapter *adapter, u32 addr, u32 *data); void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem); u32 rtw_read_port(struct adapter *adapter, u8 *pmem); void rtw_read_port_cancel(struct adapter *adapter); diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging= /r8188eu/os_dep/ioctl_linux.c index 7ec363089ae0..f486870965ac 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -3126,18 +3126,29 @@ static int rtw_rereg_nd_name(struct net_device *dev, static void mac_reg_dump(struct adapter *padapter) { int i, j =3D 1; + u32 reg; + int res; + pr_info("\n =3D=3D=3D=3D=3D=3D=3D MAC REG =3D=3D=3D=3D=3D=3D=3D\n"); for (i =3D 0x0; i < 0x300; i +=3D 4) { if (j % 4 =3D=3D 1) pr_info("0x%02x", i); - pr_info(" 0x%08x ", rtw_read32(padapter, i)); + + res =3D rtw_read32(padapter, i, ®); + if (!res) + pr_info(" 0x%08x ", reg); + if ((j++) % 4 =3D=3D 0) pr_info("\n"); } for (i =3D 0x400; i < 0x800; i +=3D 4) { if (j % 4 =3D=3D 1) pr_info("0x%02x", i); - pr_info(" 0x%08x ", rtw_read32(padapter, i)); + + res =3D rtw_read32(padapter, i, ®); + if (!res) + pr_info(" 0x%08x ", reg); + if ((j++) % 4 =3D=3D 0) pr_info("\n"); } @@ -3145,13 +3156,18 @@ static void mac_reg_dump(struct adapter *padapter) =20 static void bb_reg_dump(struct adapter *padapter) { - int i, j =3D 1; + int i, j =3D 1, res; + u32 reg; + pr_info("\n =3D=3D=3D=3D=3D=3D=3D BB REG =3D=3D=3D=3D=3D=3D=3D\n"); for (i =3D 0x800; i < 0x1000; i +=3D 4) { if (j % 4 =3D=3D 1) pr_info("0x%02x", i); =20 - pr_info(" 0x%08x ", rtw_read32(padapter, i)); + res =3D rtw_read32(padapter, i, ®); + if (!res) + pr_info(" 0x%08x ", reg); + if ((j++) % 4 =3D=3D 0) pr_info("\n"); } @@ -3398,7 +3414,8 @@ static int rtw_dbg_port(struct net_device *dev, if (rtl8188e_IOL_exec_cmds_sync(padapter, xmit_frame, 5000, 0) !=3D _SU= CCESS) ret =3D -EPERM; =20 - rtw_read32(padapter, reg); + /* FIXME: is this read necessary? */ + ret =3D rtw_read32(padapter, reg, &write_num); } break; } diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8= 188eu/os_dep/os_intfs.c index d9325ef6ac28..cac9553666e6 100644 --- a/drivers/staging/r8188eu/os_dep/os_intfs.c +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c @@ -741,6 +741,7 @@ static void rtw_fifo_cleanup(struct adapter *adapter) struct pwrctrl_priv *pwrpriv =3D &adapter->pwrctrlpriv; u8 trycnt =3D 100; int res; + u32 reg; =20 /* pause tx */ rtw_write8(adapter, REG_TXPAUSE, 0xff); @@ -753,10 +754,18 @@ static void rtw_fifo_cleanup(struct adapter *adapter) =20 if (!pwrpriv->bkeepfwalive) { /* RX DMA stop */ + res =3D rtw_read32(adapter, REG_RXPKT_NUM, ®); + if (res) + return; + rtw_write32(adapter, REG_RXPKT_NUM, - (rtw_read32(adapter, REG_RXPKT_NUM) | RW_RELEASE_EN)); + (reg | RW_RELEASE_EN)); do { - if (!(rtw_read32(adapter, REG_RXPKT_NUM) & RXDMA_IDLE)) + res =3D rtw_read32(adapter, REG_RXPKT_NUM, ®); + if (res) + continue; + + if (!(reg & RXDMA_IDLE)) break; } while (trycnt--); =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCE05C32772 for ; Tue, 23 Aug 2022 09:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349167AbiHWJRq (ORCPT ); Tue, 23 Aug 2022 05:17:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349256AbiHWJO7 (ORCPT ); Tue, 23 Aug 2022 05:14:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F27E6CD30; Tue, 23 Aug 2022 01:32:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DC010B81C48; Tue, 23 Aug 2022 08:32:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 406BEC433C1; Tue, 23 Aug 2022 08:32:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243524; bh=p8YLk0fXbdEGd5ts6snZ/bCE06HJyPgd8xx/jdf47A4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NIU1UaD5miu96wYN/E6OkhN22hmh3Lc7+0vHVXQOgEhzCU3kB7xtr3pSPT2fSONmg roKTaK0J8mCW0KpQkWafniwGBYEzqi9NniqcHtM28kiil/CfkEdwNh6mBDHrJnzf85 Fi5M6jZ2Yhihc7QFaxaGUWlsiVvLyk5k5FHBHihg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Li , Faqiang Zhu , Sasha Levin Subject: [PATCH 5.19 264/365] usb: cdns3 fix use-after-free at workaround 2 Date: Tue, 23 Aug 2022 10:02:45 +0200 Message-Id: <20220823080129.222428320@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frank Li [ Upstream commit 7d602f30149a117eea260208b1661bc404c21dfd ] BUG: KFENCE: use-after-free read in __list_del_entry_valid+0x10/0xac cdns3_wa2_remove_old_request() { ... kfree(priv_req->request.buf); cdns3_gadget_ep_free_request(&priv_ep->endpoint, &priv_req->request); list_del_init(&priv_req->list); ^^^ use after free ... } cdns3_gadget_ep_free_request() free the space pointed by priv_req, but priv_req is used in the following list_del_init(). This patch move list_del_init() before cdns3_gadget_ep_free_request(). Signed-off-by: Frank Li Signed-off-by: Faqiang Zhu Link: https://lore.kernel.org/r/20220608190430.2814358-1-Frank.Li@nxp.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/usb/cdns3/cdns3-gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gad= get.c index 87cfa91a758d..d21b69997e75 100644 --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -625,9 +625,9 @@ static void cdns3_wa2_remove_old_request(struct cdns3_e= ndpoint *priv_ep) trace_cdns3_wa2(priv_ep, "removes eldest request"); =20 kfree(priv_req->request.buf); + list_del_init(&priv_req->list); cdns3_gadget_ep_free_request(&priv_ep->endpoint, &priv_req->request); - list_del_init(&priv_req->list); --priv_ep->wa2_counter; =20 if (!chain) --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7A87C32772 for ; Tue, 23 Aug 2022 09:09:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348122AbiHWJJ1 (ORCPT ); Tue, 23 Aug 2022 05:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347706AbiHWJHy (ORCPT ); Tue, 23 Aug 2022 05:07:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 052A185A9B; Tue, 23 Aug 2022 01:30:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8436D61475; Tue, 23 Aug 2022 08:30:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CECAC433C1; Tue, 23 Aug 2022 08:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243422; bh=x+inPP9lpVSclSuJHHc1IGDwhLIHcBfFqLoOpXMbt/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uqcTgx0vSxFjEeULFGK8QVMIKQ+GZdhz6vtPyOZmKnaVDEMlmiEFzdZiEqXzp4ijN lRidbGSKjw1p1vNlaz/2iyGzQ1Udza4bJuAkmCEsaskStR2Gy6bq7iV4czYELrZ8qp JI9mqKBNntE7LCY+gkrdPKcmgQLM/2nOamDZ+rwU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Vacura , Michael Grzeschik , Sasha Levin Subject: [PATCH 5.19 265/365] usb: gadget: uvc: calculate the number of request depending on framesize Date: Tue, 23 Aug 2022 10:02:46 +0200 Message-Id: <20220823080129.262270738@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Grzeschik [ Upstream commit 87d76b5f1d8eeb49efa16e2018e188864cbb9401 ] The current limitation of possible number of requests being handled is dependent on the gadget speed. It makes more sense to depend on the typical frame size when calculating the number of requests. This patch is changing this and is using the previous limits as boundaries for reasonable minimum and maximum number of requests. For a 1080p jpeg encoded video stream with a maximum imagesize of e.g. 800kB with a maxburst of 8 and an multiplier of 1 the resulting number of requests is calculated to 49. 800768 1 nreqs =3D ------ * -------------- ~=3D 49 2 (1024 * 8 * 1) Tested-by: Dan Vacura Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20220529223848.105914-2-m.grzeschik@pengutr= onix.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/usb/gadget/function/uvc_queue.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/f= unction/uvc_queue.c index 951934aa4454..ec500ee499ee 100644 --- a/drivers/usb/gadget/function/uvc_queue.c +++ b/drivers/usb/gadget/function/uvc_queue.c @@ -44,7 +44,8 @@ static int uvc_queue_setup(struct vb2_queue *vq, { struct uvc_video_queue *queue =3D vb2_get_drv_priv(vq); struct uvc_video *video =3D container_of(queue, struct uvc_video, queue); - struct usb_composite_dev *cdev =3D video->uvc->func.config->cdev; + unsigned int req_size; + unsigned int nreq; =20 if (*nbuffers > UVC_MAX_VIDEO_BUFFERS) *nbuffers =3D UVC_MAX_VIDEO_BUFFERS; @@ -53,10 +54,16 @@ static int uvc_queue_setup(struct vb2_queue *vq, =20 sizes[0] =3D video->imagesize; =20 - if (cdev->gadget->speed < USB_SPEED_SUPER) - video->uvc_num_requests =3D 4; - else - video->uvc_num_requests =3D 64; + req_size =3D video->ep->maxpacket + * max_t(unsigned int, video->ep->maxburst, 1) + * (video->ep->mult); + + /* We divide by two, to increase the chance to run + * into fewer requests for smaller framesizes. + */ + nreq =3D DIV_ROUND_UP(DIV_ROUND_UP(sizes[0], 2), req_size); + nreq =3D clamp(nreq, 4U, 64U); + video->uvc_num_requests =3D nreq; =20 return 0; } --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C075C32796 for ; Tue, 23 Aug 2022 09:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236782AbiHWJMW (ORCPT ); Tue, 23 Aug 2022 05:12:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348272AbiHWJKD (ORCPT ); Tue, 23 Aug 2022 05:10:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D82AD3C8F9; Tue, 23 Aug 2022 01:30:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 841456147B; Tue, 23 Aug 2022 08:30:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 836E7C433C1; Tue, 23 Aug 2022 08:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243456; bh=+i4OAVjsezCjpE4qAdcOFuVqKcJU3N0nC8AZ8789inQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cl68uBwdvY1wuaiS2+P1j9t8QD4OZ4JD8coL4GhsFJE8G2zQeeENYwX5VNhC7LhjW rnOOqy0DBdxLnQmJCVayIrfHCKtYGCpbMo1zRWyapLpJLYtQvmRVHNtCVBHVpId6mD SrbyCymq4fW+nReW7RDQ3hy5AwYKrDstHFfg3Dt0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Pinchart , Michael Grzeschik , Sasha Levin Subject: [PATCH 5.19 266/365] usb: gadget: uvc: call uvc uvcg_warn on completed status instead of uvcg_info Date: Tue, 23 Aug 2022 10:02:47 +0200 Message-Id: <20220823080129.306009002@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Grzeschik [ Upstream commit a725d0f6dfc5d3739d6499f30ec865305ba3544d ] Likewise to the uvcvideo hostside driver, this patch is changing the usb_request message of an non zero completion handler call from dev_info to dev_warn. Reviewed-by: Laurent Pinchart Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20220529223848.105914-4-m.grzeschik@pengutr= onix.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/usb/gadget/function/uvc_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/f= unction/uvc_video.c index ce421d9cc241..c00ce0e91f5d 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c @@ -261,7 +261,7 @@ uvc_video_complete(struct usb_ep *ep, struct usb_reques= t *req) break; =20 default: - uvcg_info(&video->uvc->func, + uvcg_warn(&video->uvc->func, "VS request completed with status %d.\n", req->status); uvcg_queue_cancel(queue, 0); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 390D4C32772 for ; Tue, 23 Aug 2022 09:15:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348790AbiHWJOn (ORCPT ); Tue, 23 Aug 2022 05:14:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243264AbiHWJLs (ORCPT ); Tue, 23 Aug 2022 05:11:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B00646D546; Tue, 23 Aug 2022 01:31:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 69F1C61446; Tue, 23 Aug 2022 08:31:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73115C433D7; Tue, 23 Aug 2022 08:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243491; bh=5GyLM1CyVv10Ove+YIIf3oMlmnKfA55OKySxx0jDfxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2e5dBniPRzaeLNIQZWm4IECGo5A6fHMoL6FniSrwqIN8V6lrDJwxcDChr9zjWV6sz 3HHtHUSFrZfX9/WEjWO82lY/ZDuWoRWGpeBpmTTXMdGJRzukcnKYMpBEu/BOoiziPV 8Jxhkgss2QpRcdkEqJ71Wv+/BJQ8xGYV6e0JWFWU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.19 267/365] PCI: aardvark: Fix reporting Slot capabilities on emulated bridge Date: Tue, 23 Aug 2022 10:02:48 +0200 Message-Id: <20220823080129.356964313@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Roh=C3=A1r [ Upstream commit bcdb6fd4f3e9ac1097698c8d8f56b70853b49873 ] Slot capabilities are currently not reported because emulated bridge does not report the PCI_EXP_FLAGS_SLOT flag. Set PCI_EXP_FLAGS_SLOT to let the kernel know that PCI_EXP_SLT* registers are supported. Move setting of PCI_EXP_SLTCTL register from "dynamic" pcie_conf_read function to static buffer as it is only statically filled the PCI_EXP_SLTSTA_PDS flag and dynamic read callback is not needed for this register. Set Presence State Bit to 1 since there is no support for unplugging the card and there is currently no platform able to detect presence of a card - in such a case the bit needs to be set to 1. Finally correctly set Physical Slot Number to 1 since there is only one port and zero value is reserved for ports within the same silicon as Root Port which is not our case for Aardvark HW. Link: https://lore.kernel.org/r/20220524132827.8837-3-kabel@kernel.org Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Marek Beh=C3=BAn Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/pci/controller/pci-aardvark.c | 33 +++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller= /pci-aardvark.c index ffec82c8a523..62db476a8651 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -8,6 +8,7 @@ * Author: Hezi Shahmoon */ =20 +#include #include #include #include @@ -857,14 +858,11 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge= _emul *bridge, =20 =20 switch (reg) { - case PCI_EXP_SLTCTL: - *value =3D PCI_EXP_SLTSTA_PDS << 16; - return PCI_BRIDGE_EMUL_HANDLED; - /* - * PCI_EXP_RTCTL and PCI_EXP_RTSTA are also supported, but do not need - * to be handled here, because their values are stored in emulated - * config space buffer, and we read them from there when needed. + * PCI_EXP_SLTCAP, PCI_EXP_SLTCTL, PCI_EXP_RTCTL and PCI_EXP_RTSTA are + * also supported, but do not need to be handled here, because their + * values are stored in emulated config space buffer, and we read them + * from there when needed. */ =20 case PCI_EXP_LNKCAP: { @@ -977,8 +975,25 @@ static int advk_sw_pci_bridge_init(struct advk_pcie *p= cie) /* Support interrupt A for MSI feature */ bridge->conf.intpin =3D PCI_INTERRUPT_INTA; =20 - /* Aardvark HW provides PCIe Capability structure in version 2 */ - bridge->pcie_conf.cap =3D cpu_to_le16(2); + /* + * Aardvark HW provides PCIe Capability structure in version 2 and + * indicate slot support, which is emulated. + */ + bridge->pcie_conf.cap =3D cpu_to_le16(2 | PCI_EXP_FLAGS_SLOT); + + /* + * Set Presence Detect State bit permanently since there is no support + * for unplugging the card nor detecting whether it is plugged. (If a + * platform exists in the future that supports it, via a GPIO for + * example, it should be implemented via this bit.) + * + * Set physical slot number to 1 since there is only one port and zero + * value is reserved for ports within the same silicon as Root Port + * which is not our case. + */ + bridge->pcie_conf.slotcap =3D cpu_to_le32(FIELD_PREP(PCI_EXP_SLTCAP_PSN, + 1)); + bridge->pcie_conf.slotsta =3D cpu_to_le16(PCI_EXP_SLTSTA_PDS); =20 /* Indicates supports for Completion Retry Status */ bridge->pcie_conf.rootcap =3D cpu_to_le16(PCI_EXP_RTCAP_CRSVIS); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3737C32774 for ; Tue, 23 Aug 2022 09:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348943AbiHWJRS (ORCPT ); Tue, 23 Aug 2022 05:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349099AbiHWJOQ (ORCPT ); Tue, 23 Aug 2022 05:14:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F30186C2E; Tue, 23 Aug 2022 01:32:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5BE23614C5; Tue, 23 Aug 2022 08:31:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AAA7C433C1; Tue, 23 Aug 2022 08:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243505; bh=wvUJ88hrV5QL9tWRPmCuYWJ//YbsY8jZCc5Y1rHvmxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tNGxalzqUB7ASopjNxrQs/EkO/F01E5MlaGZQ8YavBMbVNPelC1J6aRYzzRBHA/xZ KX1+IPhYVvkqYDgBIE7iiMg8tYHOoi6UgsXMyfB/3Y5WYq8O/r4AoN4WipkhZwOfSr 0FN7ScaNm/tD6/mZ7in95PJyv5RdpqHo10REkkcU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 268/365] scsi: ufs: core: Add UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS Date: Tue, 23 Aug 2022 10:02:49 +0200 Message-Id: <20220823080129.392779806@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yoshihiro Shimoda [ Upstream commit 6554400d6f66b9494a0c0f07712ab0a9d307eb01 ] Add UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS for host controllers which do not support 64-bit addressing. Link: https://lore.kernel.org/r/20220603110524.1997825-3-yoshihiro.shimoda.= uh@renesas.com Signed-off-by: Yoshihiro Shimoda Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/ufs/core/ufshcd.c | 2 ++ include/ufs/ufshcd.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 8d91be0fd1a4..141fff01a662 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2227,6 +2227,8 @@ static inline int ufshcd_hba_capabilities(struct ufs_= hba *hba) int err; =20 hba->capabilities =3D ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES); + if (hba->quirks & UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS) + hba->capabilities &=3D ~MASK_64_ADDRESSING_SUPPORT; =20 /* nutrs and nutmrs are 0 based values */ hba->nutrs =3D (hba->capabilities & MASK_TRANSFER_REQUESTS_SLOTS) + 1; diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index a92271421718..795c8951341d 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -577,6 +577,12 @@ enum ufshcd_quirks { * support physical host configuration. */ UFSHCD_QUIRK_SKIP_PH_CONFIGURATION =3D 1 << 16, + + /* + * This quirk needs to be enabled if the host controller has + * 64-bit addressing supported capability but it doesn't work. + */ + UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS =3D 1 << 17, }; =20 enum ufshcd_caps { --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29654C32774 for ; Tue, 23 Aug 2022 09:16:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349268AbiHWJPC (ORCPT ); Tue, 23 Aug 2022 05:15:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234244AbiHWJL5 (ORCPT ); Tue, 23 Aug 2022 05:11:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 552E986FCC; Tue, 23 Aug 2022 01:31:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 176B16132D; Tue, 23 Aug 2022 08:31:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25677C433C1; Tue, 23 Aug 2022 08:31:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243508; bh=K8+HU82cIH/0qwDMa0Dv+OBDT+wFIxbdQiqvPEXazeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LCu6WYT13YGrhhy1+CTp3sDfXbl7ZozQr3np6kzAgVi6/6kLLh3u4HzR0IPAf6KbJ EuQQDxwwPu9ZRVtG0HyGVZwaH19b8lN3zTxMF1KoV9/+vEruZasdd99GEZE0kMjeqr ZTDO2PhW9/IFBBueTx7144mpRwyJ1IsXO19MYtGk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 269/365] scsi: ufs: core: Add UFSHCD_QUIRK_HIBERN_FASTAUTO Date: Tue, 23 Aug 2022 10:02:50 +0200 Message-Id: <20220823080129.437569823@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yoshihiro Shimoda [ Upstream commit 2f11bbc2c7f37e3a6151ac548b1c0679cc90ea83 ] Add UFSHCD_QUIRK_HIBERN_FASTAUTO quirk for host controllers which supports auto-hibernate the capability but only FASTAUTO mode. Link: https://lore.kernel.org/r/20220603110524.1997825-4-yoshihiro.shimoda.= uh@renesas.com Signed-off-by: Yoshihiro Shimoda Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/ufs/core/ufshcd.c | 9 +++++++-- include/ufs/ufshcd.h | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 141fff01a662..a51ca56a0ebe 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -4292,8 +4292,13 @@ static int ufshcd_get_max_pwr_mode(struct ufs_hba *h= ba) if (hba->max_pwr_info.is_valid) return 0; =20 - pwr_info->pwr_tx =3D FAST_MODE; - pwr_info->pwr_rx =3D FAST_MODE; + if (hba->quirks & UFSHCD_QUIRK_HIBERN_FASTAUTO) { + pwr_info->pwr_tx =3D FASTAUTO_MODE; + pwr_info->pwr_rx =3D FASTAUTO_MODE; + } else { + pwr_info->pwr_tx =3D FAST_MODE; + pwr_info->pwr_rx =3D FAST_MODE; + } pwr_info->hs_rate =3D PA_HS_MODE_B; =20 /* Get the connected lane count */ diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 795c8951341d..991aea081ec7 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -583,6 +583,12 @@ enum ufshcd_quirks { * 64-bit addressing supported capability but it doesn't work. */ UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS =3D 1 << 17, + + /* + * This quirk needs to be enabled if the host controller has + * auto-hibernate capability but it's FASTAUTO only. + */ + UFSHCD_QUIRK_HIBERN_FASTAUTO =3D 1 << 18, }; =20 enum ufshcd_caps { --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D377C32792 for ; Tue, 23 Aug 2022 09:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243036AbiHWJRA (ORCPT ); Tue, 23 Aug 2022 05:17:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348937AbiHWJNh (ORCPT ); Tue, 23 Aug 2022 05:13:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59DF66D9CF; Tue, 23 Aug 2022 01:31:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 02A4061257; Tue, 23 Aug 2022 08:31:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A29BC433D6; Tue, 23 Aug 2022 08:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243511; bh=hRPBfczdm15C8/gZO/F3YClMCpGorCXgOhAyyTX1B+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qh6DvLMB6e2BI6MgVL9qMgI2KqwLa3zZp6xVfGm9jNh9fBRzWixGtIZvvnJJrlAH8 ytzGHHlMQR2/dCGCMczfoqNHhMG6iOI1NAuUsDA40B3XasITqDBnRt/09aO+Ro4bxt zjQZoAB2NABzZ4DRtio/y9oDK4kEz5820pklYxDc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Sai Prakash Ranjan , Arnd Bergmann , Sasha Levin Subject: [PATCH 5.19 270/365] irqchip/tegra: Fix overflow implicit truncation warnings Date: Tue, 23 Aug 2022 10:02:51 +0200 Message-Id: <20220823080129.470780022@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sai Prakash Ranjan [ Upstream commit 443685992bda9bb4f8b17fc02c9f6c60e62b1461 ] Fix -Woverflow warnings for tegra irqchip driver which is a result of moving arm64 custom MMIO accessor macros to asm-generic function implementations giving a bonus type-checking now and uncovering these overflow warnings. drivers/irqchip/irq-tegra.c: In function =E2=80=98tegra_ictlr_suspend=E2=80= =99: drivers/irqchip/irq-tegra.c:151:18: warning: large integer implicitly trunc= ated to unsigned type [-Woverflow] writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR); ^ Suggested-by: Marc Zyngier Signed-off-by: Sai Prakash Ranjan Reviewed-by: Arnd Bergmann Cc: Marc Zyngier Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/irqchip/irq-tegra.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-tegra.c b/drivers/irqchip/irq-tegra.c index e1f771c72fc4..ad3e2c1b3c87 100644 --- a/drivers/irqchip/irq-tegra.c +++ b/drivers/irqchip/irq-tegra.c @@ -148,10 +148,10 @@ static int tegra_ictlr_suspend(void) lic->cop_iep[i] =3D readl_relaxed(ictlr + ICTLR_COP_IEP_CLASS); =20 /* Disable COP interrupts */ - writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR); + writel_relaxed(GENMASK(31, 0), ictlr + ICTLR_COP_IER_CLR); =20 /* Disable CPU interrupts */ - writel_relaxed(~0ul, ictlr + ICTLR_CPU_IER_CLR); + writel_relaxed(GENMASK(31, 0), ictlr + ICTLR_CPU_IER_CLR); =20 /* Enable the wakeup sources of ictlr */ writel_relaxed(lic->ictlr_wake_mask[i], ictlr + ICTLR_CPU_IER_SET); @@ -172,12 +172,12 @@ static void tegra_ictlr_resume(void) =20 writel_relaxed(lic->cpu_iep[i], ictlr + ICTLR_CPU_IEP_CLASS); - writel_relaxed(~0ul, ictlr + ICTLR_CPU_IER_CLR); + writel_relaxed(GENMASK(31, 0), ictlr + ICTLR_CPU_IER_CLR); writel_relaxed(lic->cpu_ier[i], ictlr + ICTLR_CPU_IER_SET); writel_relaxed(lic->cop_iep[i], ictlr + ICTLR_COP_IEP_CLASS); - writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR); + writel_relaxed(GENMASK(31, 0), ictlr + ICTLR_COP_IER_CLR); writel_relaxed(lic->cop_ier[i], ictlr + ICTLR_COP_IER_SET); } @@ -312,7 +312,7 @@ static int __init tegra_ictlr_init(struct device_node *= node, lic->base[i] =3D base; =20 /* Disable all interrupts */ - writel_relaxed(~0UL, base + ICTLR_CPU_IER_CLR); + writel_relaxed(GENMASK(31, 0), base + ICTLR_CPU_IER_CLR); /* All interrupts target IRQ */ writel_relaxed(0, base + ICTLR_CPU_IEP_CLASS); =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76017C3814E for ; Tue, 23 Aug 2022 09:17:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344835AbiHWJRH (ORCPT ); Tue, 23 Aug 2022 05:17:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348949AbiHWJNh (ORCPT ); Tue, 23 Aug 2022 05:13:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B8E56D574; Tue, 23 Aug 2022 01:31:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DC81B61360; Tue, 23 Aug 2022 08:31:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3EA9C433D6; Tue, 23 Aug 2022 08:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243514; bh=YA7qGjAoZ0w68jbN59Y8bWwXYBlkSuhDhVnrXYHcvq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YnHrqg8jfIThdZ8EQOpb+IlCuFJ5p5/mBxIhHrYAZGI6g7QknJ/CvXNr2MY59zo49 hX47iiTadTe7SNPIQpsXoZJiO4FJtG3fQwx1bhP/aEoar9CFEK1JZgieC47lv/E5u2 j4NnZ19eOIzO4NRenTRlgKDHPwLDshPcOOwp2pEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Sai Prakash Ranjan , Arnd Bergmann , Neil Armstrong , Sasha Levin Subject: [PATCH 5.19 271/365] drm/meson: Fix overflow implicit truncation warnings Date: Tue, 23 Aug 2022 10:02:52 +0200 Message-Id: <20220823080129.509616916@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sai Prakash Ranjan [ Upstream commit 98692f52c588225034cbff458622c2c06dfcb544 ] Fix -Woverflow warnings for drm/meson driver which is a result of moving arm64 custom MMIO accessor macros to asm-generic function implementations giving a bonus type-checking now and uncovering these overflow warnings. drivers/gpu/drm/meson/meson_viu.c: In function =E2=80=98meson_viu_init=E2= =80=99: drivers/gpu/drm/meson/meson_registers.h:1826:48: error: large integer impli= citly truncated to unsigned type [-Werror=3Doverflow] #define VIU_OSD_BLEND_REORDER(dest, src) ((src) << (dest * 4)) ^ drivers/gpu/drm/meson/meson_viu.c:472:18: note: in expansion of macro =E2= =80=98VIU_OSD_BLEND_REORDER=E2=80=99 writel_relaxed(VIU_OSD_BLEND_REORDER(0, 1) | ^~~~~~~~~~~~~~~~~~~~~ Reported-by: kernel test robot Signed-off-by: Sai Prakash Ranjan Reviewed-by: Arnd Bergmann Cc: Arnd Bergmann Cc: Neil Armstrong Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/gpu/drm/meson/meson_viu.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meso= n_viu.c index 259f3e6bec90..bb7e109534de 100644 --- a/drivers/gpu/drm/meson/meson_viu.c +++ b/drivers/gpu/drm/meson/meson_viu.c @@ -469,17 +469,17 @@ void meson_viu_init(struct meson_drm *priv) priv->io_base + _REG(VD2_IF0_LUMA_FIFO_SIZE)); =20 if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) { - writel_relaxed(VIU_OSD_BLEND_REORDER(0, 1) | - VIU_OSD_BLEND_REORDER(1, 0) | - VIU_OSD_BLEND_REORDER(2, 0) | - VIU_OSD_BLEND_REORDER(3, 0) | - VIU_OSD_BLEND_DIN_EN(1) | - VIU_OSD_BLEND1_DIN3_BYPASS_TO_DOUT1 | - VIU_OSD_BLEND1_DOUT_BYPASS_TO_BLEND2 | - VIU_OSD_BLEND_DIN0_BYPASS_TO_DOUT0 | - VIU_OSD_BLEND_BLEN2_PREMULT_EN(1) | - VIU_OSD_BLEND_HOLD_LINES(4), - priv->io_base + _REG(VIU_OSD_BLEND_CTRL)); + u32 val =3D (u32)VIU_OSD_BLEND_REORDER(0, 1) | + (u32)VIU_OSD_BLEND_REORDER(1, 0) | + (u32)VIU_OSD_BLEND_REORDER(2, 0) | + (u32)VIU_OSD_BLEND_REORDER(3, 0) | + (u32)VIU_OSD_BLEND_DIN_EN(1) | + (u32)VIU_OSD_BLEND1_DIN3_BYPASS_TO_DOUT1 | + (u32)VIU_OSD_BLEND1_DOUT_BYPASS_TO_BLEND2 | + (u32)VIU_OSD_BLEND_DIN0_BYPASS_TO_DOUT0 | + (u32)VIU_OSD_BLEND_BLEN2_PREMULT_EN(1) | + (u32)VIU_OSD_BLEND_HOLD_LINES(4); + writel_relaxed(val, priv->io_base + _REG(VIU_OSD_BLEND_CTRL)); =20 writel_relaxed(OSD_BLEND_PATH_SEL_ENABLE, priv->io_base + _REG(OSD1_BLEND_SRC_CTRL)); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33CEDC32772 for ; Tue, 23 Aug 2022 09:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349088AbiHWJRg (ORCPT ); Tue, 23 Aug 2022 05:17:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348305AbiHWJOn (ORCPT ); Tue, 23 Aug 2022 05:14:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FC4886FF9; Tue, 23 Aug 2022 01:32:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B96B7B81C35; Tue, 23 Aug 2022 08:31:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA6F4C433C1; Tue, 23 Aug 2022 08:31:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243517; bh=oOazxn9uOIeeULy3xFLCdFRAGjrwMz6aIQQcYwFNT4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vWhftixQOr2PEqGWZTBYQk44N/74pM9dHU4luIiymYlIntjmDURPIZghhBiyViaYK d6HHYeIoKimXVnSd3qEKMzLsJlLBOhs2b1CV6jivkmLDONS3FBC7gUK145RZABtUrI aiw2p+b+1Y/Gp8j4aPd0OQBVkCjhn1cOsTSAX+mU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-clk@vger.kernel.org, Stephen Boyd , Tero Kristo , Tony Lindgren , Sasha Levin Subject: [PATCH 5.19 272/365] clk: ti: Stop using legacy clkctrl names for omap4 and 5 Date: Tue, 23 Aug 2022 10:02:53 +0200 Message-Id: <20220823080129.555791196@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tony Lindgren [ Upstream commit 255584b138343d4a28c6d25bd82d04b09460d672 ] With the addition of clock-output-names, we can now unify the internal clock naming for omap4 and 5 to follow the other TI SoCs. We are still using legacy clkctrl names for omap4 and 5 based on the clock manager name which is wrong. Instead, we want to use the clkctrl clock based naming. We must now also drop the legacy TI_CLK_CLKCTRL_COMPAT quirk for the clkctrl clock. This change will allow further devicetree warning cleanup as already done for am3/4 and dra7. Cc: linux-clk@vger.kernel.org Cc: Stephen Boyd Cc: Tero Kristo Signed-off-by: Tony Lindgren Link: https://lore.kernel.org/r/20220615064306.22254-1-tony@atomide.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/clk/ti/clk-44xx.c | 210 +++++++++++++++++++------------------- drivers/clk/ti/clk-54xx.c | 160 ++++++++++++++--------------- drivers/clk/ti/clkctrl.c | 4 - 3 files changed, 185 insertions(+), 189 deletions(-) diff --git a/drivers/clk/ti/clk-44xx.c b/drivers/clk/ti/clk-44xx.c index d078e5d73ed9..868bc7af21b0 100644 --- a/drivers/clk/ti/clk-44xx.c +++ b/drivers/clk/ti/clk-44xx.c @@ -56,7 +56,7 @@ static const struct omap_clkctrl_bit_data omap4_aess_bit_= data[] __initconst =3D { }; =20 static const char * const omap4_func_dmic_abe_gfclk_parents[] __initconst = =3D { - "abe_cm:clk:0018:26", + "abe-clkctrl:0018:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -76,7 +76,7 @@ static const struct omap_clkctrl_bit_data omap4_dmic_bit_= data[] __initconst =3D { }; =20 static const char * const omap4_func_mcasp_abe_gfclk_parents[] __initconst= =3D { - "abe_cm:clk:0020:26", + "abe-clkctrl:0020:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -89,7 +89,7 @@ static const struct omap_clkctrl_bit_data omap4_mcasp_bit= _data[] __initconst =3D { }; =20 static const char * const omap4_func_mcbsp1_gfclk_parents[] __initconst = =3D { - "abe_cm:clk:0028:26", + "abe-clkctrl:0028:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -102,7 +102,7 @@ static const struct omap_clkctrl_bit_data omap4_mcbsp1_= bit_data[] __initconst =3D }; =20 static const char * const omap4_func_mcbsp2_gfclk_parents[] __initconst = =3D { - "abe_cm:clk:0030:26", + "abe-clkctrl:0030:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -115,7 +115,7 @@ static const struct omap_clkctrl_bit_data omap4_mcbsp2_= bit_data[] __initconst =3D }; =20 static const char * const omap4_func_mcbsp3_gfclk_parents[] __initconst = =3D { - "abe_cm:clk:0038:26", + "abe-clkctrl:0038:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -183,18 +183,18 @@ static const struct omap_clkctrl_bit_data omap4_timer= 8_bit_data[] __initconst =3D =20 static const struct omap_clkctrl_reg_data omap4_abe_clkctrl_regs[] __initc= onst =3D { { OMAP4_L4_ABE_CLKCTRL, NULL, 0, "ocp_abe_iclk" }, - { OMAP4_AESS_CLKCTRL, omap4_aess_bit_data, CLKF_SW_SUP, "abe_cm:clk:0008:= 24" }, + { OMAP4_AESS_CLKCTRL, omap4_aess_bit_data, CLKF_SW_SUP, "abe-clkctrl:0008= :24" }, { OMAP4_MCPDM_CLKCTRL, NULL, CLKF_SW_SUP, "pad_clks_ck" }, - { OMAP4_DMIC_CLKCTRL, omap4_dmic_bit_data, CLKF_SW_SUP, "abe_cm:clk:0018:= 24" }, - { OMAP4_MCASP_CLKCTRL, omap4_mcasp_bit_data, CLKF_SW_SUP, "abe_cm:clk:002= 0:24" }, - { OMAP4_MCBSP1_CLKCTRL, omap4_mcbsp1_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 028:24" }, - { OMAP4_MCBSP2_CLKCTRL, omap4_mcbsp2_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 030:24" }, - { OMAP4_MCBSP3_CLKCTRL, omap4_mcbsp3_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 038:24" }, - { OMAP4_SLIMBUS1_CLKCTRL, omap4_slimbus1_bit_data, CLKF_SW_SUP, "abe_cm:c= lk:0040:8" }, - { OMAP4_TIMER5_CLKCTRL, omap4_timer5_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 048:24" }, - { OMAP4_TIMER6_CLKCTRL, omap4_timer6_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 050:24" }, - { OMAP4_TIMER7_CLKCTRL, omap4_timer7_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 058:24" }, - { OMAP4_TIMER8_CLKCTRL, omap4_timer8_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 060:24" }, + { OMAP4_DMIC_CLKCTRL, omap4_dmic_bit_data, CLKF_SW_SUP, "abe-clkctrl:0018= :24" }, + { OMAP4_MCASP_CLKCTRL, omap4_mcasp_bit_data, CLKF_SW_SUP, "abe-clkctrl:00= 20:24" }, + { OMAP4_MCBSP1_CLKCTRL, omap4_mcbsp1_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0028:24" }, + { OMAP4_MCBSP2_CLKCTRL, omap4_mcbsp2_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0030:24" }, + { OMAP4_MCBSP3_CLKCTRL, omap4_mcbsp3_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0038:24" }, + { OMAP4_SLIMBUS1_CLKCTRL, omap4_slimbus1_bit_data, CLKF_SW_SUP, "abe-clkc= trl:0040:8" }, + { OMAP4_TIMER5_CLKCTRL, omap4_timer5_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0048:24" }, + { OMAP4_TIMER6_CLKCTRL, omap4_timer6_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0050:24" }, + { OMAP4_TIMER7_CLKCTRL, omap4_timer7_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0058:24" }, + { OMAP4_TIMER8_CLKCTRL, omap4_timer8_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0060:24" }, { OMAP4_WD_TIMER3_CLKCTRL, NULL, CLKF_SW_SUP, "sys_32k_ck" }, { 0 }, }; @@ -287,7 +287,7 @@ static const struct omap_clkctrl_bit_data omap4_fdif_bi= t_data[] __initconst =3D { =20 static const struct omap_clkctrl_reg_data omap4_iss_clkctrl_regs[] __initc= onst =3D { { OMAP4_ISS_CLKCTRL, omap4_iss_bit_data, CLKF_SW_SUP, "ducati_clk_mux_ck"= }, - { OMAP4_FDIF_CLKCTRL, omap4_fdif_bit_data, CLKF_SW_SUP, "iss_cm:clk:0008:= 24" }, + { OMAP4_FDIF_CLKCTRL, omap4_fdif_bit_data, CLKF_SW_SUP, "iss-clkctrl:0008= :24" }, { 0 }, }; =20 @@ -320,7 +320,7 @@ static const struct omap_clkctrl_bit_data omap4_dss_cor= e_bit_data[] __initconst }; =20 static const struct omap_clkctrl_reg_data omap4_l3_dss_clkctrl_regs[] __in= itconst =3D { - { OMAP4_DSS_CORE_CLKCTRL, omap4_dss_core_bit_data, CLKF_SW_SUP, "l3_dss_c= m:clk:0000:8" }, + { OMAP4_DSS_CORE_CLKCTRL, omap4_dss_core_bit_data, CLKF_SW_SUP, "l3-dss-c= lkctrl:0000:8" }, { 0 }, }; =20 @@ -336,7 +336,7 @@ static const struct omap_clkctrl_bit_data omap4_gpu_bit= _data[] __initconst =3D { }; =20 static const struct omap_clkctrl_reg_data omap4_l3_gfx_clkctrl_regs[] __in= itconst =3D { - { OMAP4_GPU_CLKCTRL, omap4_gpu_bit_data, CLKF_SW_SUP, "l3_gfx_cm:clk:0000= :24" }, + { OMAP4_GPU_CLKCTRL, omap4_gpu_bit_data, CLKF_SW_SUP, "l3-gfx-clkctrl:000= 0:24" }, { 0 }, }; =20 @@ -372,12 +372,12 @@ static const struct omap_clkctrl_bit_data omap4_hsi_b= it_data[] __initconst =3D { }; =20 static const char * const omap4_usb_host_hs_utmi_p1_clk_parents[] __initco= nst =3D { - "l3_init_cm:clk:0038:24", + "l3-init-clkctrl:0038:24", NULL, }; =20 static const char * const omap4_usb_host_hs_utmi_p2_clk_parents[] __initco= nst =3D { - "l3_init_cm:clk:0038:25", + "l3-init-clkctrl:0038:25", NULL, }; =20 @@ -418,7 +418,7 @@ static const struct omap_clkctrl_bit_data omap4_usb_hos= t_hs_bit_data[] __initcon }; =20 static const char * const omap4_usb_otg_hs_xclk_parents[] __initconst =3D { - "l3_init_cm:clk:0040:24", + "l3-init-clkctrl:0040:24", NULL, }; =20 @@ -452,14 +452,14 @@ static const struct omap_clkctrl_bit_data omap4_ocp2s= cp_usb_phy_bit_data[] __ini }; =20 static const struct omap_clkctrl_reg_data omap4_l3_init_clkctrl_regs[] __i= nitconst =3D { - { OMAP4_MMC1_CLKCTRL, omap4_mmc1_bit_data, CLKF_SW_SUP, "l3_init_cm:clk:0= 008:24" }, - { OMAP4_MMC2_CLKCTRL, omap4_mmc2_bit_data, CLKF_SW_SUP, "l3_init_cm:clk:0= 010:24" }, - { OMAP4_HSI_CLKCTRL, omap4_hsi_bit_data, CLKF_HW_SUP, "l3_init_cm:clk:001= 8:24" }, + { OMAP4_MMC1_CLKCTRL, omap4_mmc1_bit_data, CLKF_SW_SUP, "l3-init-clkctrl:= 0008:24" }, + { OMAP4_MMC2_CLKCTRL, omap4_mmc2_bit_data, CLKF_SW_SUP, "l3-init-clkctrl:= 0010:24" }, + { OMAP4_HSI_CLKCTRL, omap4_hsi_bit_data, CLKF_HW_SUP, "l3-init-clkctrl:00= 18:24" }, { OMAP4_USB_HOST_HS_CLKCTRL, omap4_usb_host_hs_bit_data, CLKF_SW_SUP, "in= it_60m_fclk" }, { OMAP4_USB_OTG_HS_CLKCTRL, omap4_usb_otg_hs_bit_data, CLKF_HW_SUP, "l3_d= iv_ck" }, { OMAP4_USB_TLL_HS_CLKCTRL, omap4_usb_tll_hs_bit_data, CLKF_HW_SUP, "l4_d= iv_ck" }, { OMAP4_USB_HOST_FS_CLKCTRL, NULL, CLKF_SW_SUP, "func_48mc_fclk" }, - { OMAP4_OCP2SCP_USB_PHY_CLKCTRL, omap4_ocp2scp_usb_phy_bit_data, CLKF_HW_= SUP, "l3_init_cm:clk:00c0:8" }, + { OMAP4_OCP2SCP_USB_PHY_CLKCTRL, omap4_ocp2scp_usb_phy_bit_data, CLKF_HW_= SUP, "l3-init-clkctrl:00c0:8" }, { 0 }, }; =20 @@ -530,7 +530,7 @@ static const struct omap_clkctrl_bit_data omap4_gpio6_b= it_data[] __initconst =3D { }; =20 static const char * const omap4_per_mcbsp4_gfclk_parents[] __initconst =3D= { - "l4_per_cm:clk:00c0:26", + "l4-per-clkctrl:00c0:26", "pad_clks_ck", NULL, }; @@ -570,12 +570,12 @@ static const struct omap_clkctrl_bit_data omap4_slimb= us2_bit_data[] __initconst }; =20 static const struct omap_clkctrl_reg_data omap4_l4_per_clkctrl_regs[] __in= itconst =3D { - { OMAP4_TIMER10_CLKCTRL, omap4_timer10_bit_data, CLKF_SW_SUP, "l4_per_cm:= clk:0008:24" }, - { OMAP4_TIMER11_CLKCTRL, omap4_timer11_bit_data, CLKF_SW_SUP, "l4_per_cm:= clk:0010:24" }, - { OMAP4_TIMER2_CLKCTRL, omap4_timer2_bit_data, CLKF_SW_SUP, "l4_per_cm:cl= k:0018:24" }, - { OMAP4_TIMER3_CLKCTRL, omap4_timer3_bit_data, CLKF_SW_SUP, "l4_per_cm:cl= k:0020:24" }, - { OMAP4_TIMER4_CLKCTRL, omap4_timer4_bit_data, CLKF_SW_SUP, "l4_per_cm:cl= k:0028:24" }, - { OMAP4_TIMER9_CLKCTRL, omap4_timer9_bit_data, CLKF_SW_SUP, "l4_per_cm:cl= k:0030:24" }, + { OMAP4_TIMER10_CLKCTRL, omap4_timer10_bit_data, CLKF_SW_SUP, "l4-per-clk= ctrl:0008:24" }, + { OMAP4_TIMER11_CLKCTRL, omap4_timer11_bit_data, CLKF_SW_SUP, "l4-per-clk= ctrl:0010:24" }, + { OMAP4_TIMER2_CLKCTRL, omap4_timer2_bit_data, CLKF_SW_SUP, "l4-per-clkct= rl:0018:24" }, + { OMAP4_TIMER3_CLKCTRL, omap4_timer3_bit_data, CLKF_SW_SUP, "l4-per-clkct= rl:0020:24" }, + { OMAP4_TIMER4_CLKCTRL, omap4_timer4_bit_data, CLKF_SW_SUP, "l4-per-clkct= rl:0028:24" }, + { OMAP4_TIMER9_CLKCTRL, omap4_timer9_bit_data, CLKF_SW_SUP, "l4-per-clkct= rl:0030:24" }, { OMAP4_ELM_CLKCTRL, NULL, 0, "l4_div_ck" }, { OMAP4_GPIO2_CLKCTRL, omap4_gpio2_bit_data, CLKF_HW_SUP, "l4_div_ck" }, { OMAP4_GPIO3_CLKCTRL, omap4_gpio3_bit_data, CLKF_HW_SUP, "l4_div_ck" }, @@ -588,14 +588,14 @@ static const struct omap_clkctrl_reg_data omap4_l4_pe= r_clkctrl_regs[] __initcons { OMAP4_I2C3_CLKCTRL, NULL, CLKF_SW_SUP, "func_96m_fclk" }, { OMAP4_I2C4_CLKCTRL, NULL, CLKF_SW_SUP, "func_96m_fclk" }, { OMAP4_L4_PER_CLKCTRL, NULL, 0, "l4_div_ck" }, - { OMAP4_MCBSP4_CLKCTRL, omap4_mcbsp4_bit_data, CLKF_SW_SUP, "l4_per_cm:cl= k:00c0:24" }, + { OMAP4_MCBSP4_CLKCTRL, omap4_mcbsp4_bit_data, CLKF_SW_SUP, "l4-per-clkct= rl:00c0:24" }, { OMAP4_MCSPI1_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MCSPI2_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MCSPI3_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MCSPI4_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MMC3_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MMC4_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, - { OMAP4_SLIMBUS2_CLKCTRL, omap4_slimbus2_bit_data, CLKF_SW_SUP, "l4_per_c= m:clk:0118:8" }, + { OMAP4_SLIMBUS2_CLKCTRL, omap4_slimbus2_bit_data, CLKF_SW_SUP, "l4-per-c= lkctrl:0118:8" }, { OMAP4_UART1_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_UART2_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_UART3_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, @@ -630,7 +630,7 @@ static const struct omap_clkctrl_reg_data omap4_l4_wkup= _clkctrl_regs[] __initcon { OMAP4_L4_WKUP_CLKCTRL, NULL, 0, "l4_wkup_clk_mux_ck" }, { OMAP4_WD_TIMER2_CLKCTRL, NULL, CLKF_SW_SUP, "sys_32k_ck" }, { OMAP4_GPIO1_CLKCTRL, omap4_gpio1_bit_data, CLKF_HW_SUP, "l4_wkup_clk_mu= x_ck" }, - { OMAP4_TIMER1_CLKCTRL, omap4_timer1_bit_data, CLKF_SW_SUP, "l4_wkup_cm:c= lk:0020:24" }, + { OMAP4_TIMER1_CLKCTRL, omap4_timer1_bit_data, CLKF_SW_SUP, "l4-wkup-clkc= trl:0020:24" }, { OMAP4_COUNTER_32K_CLKCTRL, NULL, 0, "sys_32k_ck" }, { OMAP4_KBD_CLKCTRL, NULL, CLKF_SW_SUP, "sys_32k_ck" }, { 0 }, @@ -644,7 +644,7 @@ static const char * const omap4_pmd_stm_clock_mux_ck_pa= rents[] __initconst =3D { }; =20 static const char * const omap4_trace_clk_div_div_ck_parents[] __initconst= =3D { - "emu_sys_cm:clk:0000:22", + "emu-sys-clkctrl:0000:22", NULL, }; =20 @@ -662,7 +662,7 @@ static const struct omap_clkctrl_div_data omap4_trace_c= lk_div_div_ck_data __init }; =20 static const char * const omap4_stm_clk_div_ck_parents[] __initconst =3D { - "emu_sys_cm:clk:0000:20", + "emu-sys-clkctrl:0000:20", NULL, }; =20 @@ -716,73 +716,73 @@ static struct ti_dt_clk omap44xx_clks[] =3D { * hwmod support. Once hwmod is removed, these can be removed * also. */ - DT_CLK(NULL, "aess_fclk", "abe_cm:0008:24"), - DT_CLK(NULL, "cm2_dm10_mux", "l4_per_cm:0008:24"), - DT_CLK(NULL, "cm2_dm11_mux", "l4_per_cm:0010:24"), - DT_CLK(NULL, "cm2_dm2_mux", "l4_per_cm:0018:24"), - DT_CLK(NULL, "cm2_dm3_mux", "l4_per_cm:0020:24"), - DT_CLK(NULL, "cm2_dm4_mux", "l4_per_cm:0028:24"), - DT_CLK(NULL, "cm2_dm9_mux", "l4_per_cm:0030:24"), - DT_CLK(NULL, "dmic_sync_mux_ck", "abe_cm:0018:26"), - DT_CLK(NULL, "dmt1_clk_mux", "l4_wkup_cm:0020:24"), - DT_CLK(NULL, "dss_48mhz_clk", "l3_dss_cm:0000:9"), - DT_CLK(NULL, "dss_dss_clk", "l3_dss_cm:0000:8"), - DT_CLK(NULL, "dss_sys_clk", "l3_dss_cm:0000:10"), - DT_CLK(NULL, "dss_tv_clk", "l3_dss_cm:0000:11"), - DT_CLK(NULL, "fdif_fck", "iss_cm:0008:24"), - DT_CLK(NULL, "func_dmic_abe_gfclk", "abe_cm:0018:24"), - DT_CLK(NULL, "func_mcasp_abe_gfclk", "abe_cm:0020:24"), - DT_CLK(NULL, "func_mcbsp1_gfclk", "abe_cm:0028:24"), - DT_CLK(NULL, "func_mcbsp2_gfclk", "abe_cm:0030:24"), - DT_CLK(NULL, "func_mcbsp3_gfclk", "abe_cm:0038:24"), - DT_CLK(NULL, "gpio1_dbclk", "l4_wkup_cm:0018:8"), - DT_CLK(NULL, "gpio2_dbclk", "l4_per_cm:0040:8"), - DT_CLK(NULL, "gpio3_dbclk", "l4_per_cm:0048:8"), - DT_CLK(NULL, "gpio4_dbclk", "l4_per_cm:0050:8"), - DT_CLK(NULL, "gpio5_dbclk", "l4_per_cm:0058:8"), - DT_CLK(NULL, "gpio6_dbclk", "l4_per_cm:0060:8"), - DT_CLK(NULL, "hsi_fck", "l3_init_cm:0018:24"), - DT_CLK(NULL, "hsmmc1_fclk", "l3_init_cm:0008:24"), - DT_CLK(NULL, "hsmmc2_fclk", "l3_init_cm:0010:24"), - DT_CLK(NULL, "iss_ctrlclk", "iss_cm:0000:8"), - DT_CLK(NULL, "mcasp_sync_mux_ck", "abe_cm:0020:26"), - DT_CLK(NULL, "mcbsp1_sync_mux_ck", "abe_cm:0028:26"), - DT_CLK(NULL, "mcbsp2_sync_mux_ck", "abe_cm:0030:26"), - DT_CLK(NULL, "mcbsp3_sync_mux_ck", "abe_cm:0038:26"), - DT_CLK(NULL, "mcbsp4_sync_mux_ck", "l4_per_cm:00c0:26"), - DT_CLK(NULL, "ocp2scp_usb_phy_phy_48m", "l3_init_cm:00c0:8"), - DT_CLK(NULL, "otg_60m_gfclk", "l3_init_cm:0040:24"), - DT_CLK(NULL, "per_mcbsp4_gfclk", "l4_per_cm:00c0:24"), - DT_CLK(NULL, "pmd_stm_clock_mux_ck", "emu_sys_cm:0000:20"), - DT_CLK(NULL, "pmd_trace_clk_mux_ck", "emu_sys_cm:0000:22"), - DT_CLK(NULL, "sgx_clk_mux", "l3_gfx_cm:0000:24"), - DT_CLK(NULL, "slimbus1_fclk_0", "abe_cm:0040:8"), - DT_CLK(NULL, "slimbus1_fclk_1", "abe_cm:0040:9"), - DT_CLK(NULL, "slimbus1_fclk_2", "abe_cm:0040:10"), - DT_CLK(NULL, "slimbus1_slimbus_clk", "abe_cm:0040:11"), - DT_CLK(NULL, "slimbus2_fclk_0", "l4_per_cm:0118:8"), - DT_CLK(NULL, "slimbus2_fclk_1", "l4_per_cm:0118:9"), - DT_CLK(NULL, "slimbus2_slimbus_clk", "l4_per_cm:0118:10"), - DT_CLK(NULL, "stm_clk_div_ck", "emu_sys_cm:0000:27"), - DT_CLK(NULL, "timer5_sync_mux", "abe_cm:0048:24"), - DT_CLK(NULL, "timer6_sync_mux", "abe_cm:0050:24"), - DT_CLK(NULL, "timer7_sync_mux", "abe_cm:0058:24"), - DT_CLK(NULL, "timer8_sync_mux", "abe_cm:0060:24"), - DT_CLK(NULL, "trace_clk_div_div_ck", "emu_sys_cm:0000:24"), - DT_CLK(NULL, "usb_host_hs_func48mclk", "l3_init_cm:0038:15"), - DT_CLK(NULL, "usb_host_hs_hsic480m_p1_clk", "l3_init_cm:0038:13"), - DT_CLK(NULL, "usb_host_hs_hsic480m_p2_clk", "l3_init_cm:0038:14"), - DT_CLK(NULL, "usb_host_hs_hsic60m_p1_clk", "l3_init_cm:0038:11"), - DT_CLK(NULL, "usb_host_hs_hsic60m_p2_clk", "l3_init_cm:0038:12"), - DT_CLK(NULL, "usb_host_hs_utmi_p1_clk", "l3_init_cm:0038:8"), - DT_CLK(NULL, "usb_host_hs_utmi_p2_clk", "l3_init_cm:0038:9"), - DT_CLK(NULL, "usb_host_hs_utmi_p3_clk", "l3_init_cm:0038:10"), - DT_CLK(NULL, "usb_otg_hs_xclk", "l3_init_cm:0040:8"), - DT_CLK(NULL, "usb_tll_hs_usb_ch0_clk", "l3_init_cm:0048:8"), - DT_CLK(NULL, "usb_tll_hs_usb_ch1_clk", "l3_init_cm:0048:9"), - DT_CLK(NULL, "usb_tll_hs_usb_ch2_clk", "l3_init_cm:0048:10"), - DT_CLK(NULL, "utmi_p1_gfclk", "l3_init_cm:0038:24"), - DT_CLK(NULL, "utmi_p2_gfclk", "l3_init_cm:0038:25"), + DT_CLK(NULL, "aess_fclk", "abe-clkctrl:0008:24"), + DT_CLK(NULL, "cm2_dm10_mux", "l4-per-clkctrl:0008:24"), + DT_CLK(NULL, "cm2_dm11_mux", "l4-per-clkctrl:0010:24"), + DT_CLK(NULL, "cm2_dm2_mux", "l4-per-clkctrl:0018:24"), + DT_CLK(NULL, "cm2_dm3_mux", "l4-per-clkctrl:0020:24"), + DT_CLK(NULL, "cm2_dm4_mux", "l4-per-clkctrl:0028:24"), + DT_CLK(NULL, "cm2_dm9_mux", "l4-per-clkctrl:0030:24"), + DT_CLK(NULL, "dmic_sync_mux_ck", "abe-clkctrl:0018:26"), + DT_CLK(NULL, "dmt1_clk_mux", "l4-wkup-clkctrl:0020:24"), + DT_CLK(NULL, "dss_48mhz_clk", "l3-dss-clkctrl:0000:9"), + DT_CLK(NULL, "dss_dss_clk", "l3-dss-clkctrl:0000:8"), + DT_CLK(NULL, "dss_sys_clk", "l3-dss-clkctrl:0000:10"), + DT_CLK(NULL, "dss_tv_clk", "l3-dss-clkctrl:0000:11"), + DT_CLK(NULL, "fdif_fck", "iss-clkctrl:0008:24"), + DT_CLK(NULL, "func_dmic_abe_gfclk", "abe-clkctrl:0018:24"), + DT_CLK(NULL, "func_mcasp_abe_gfclk", "abe-clkctrl:0020:24"), + DT_CLK(NULL, "func_mcbsp1_gfclk", "abe-clkctrl:0028:24"), + DT_CLK(NULL, "func_mcbsp2_gfclk", "abe-clkctrl:0030:24"), + DT_CLK(NULL, "func_mcbsp3_gfclk", "abe-clkctrl:0038:24"), + DT_CLK(NULL, "gpio1_dbclk", "l4-wkup-clkctrl:0018:8"), + DT_CLK(NULL, "gpio2_dbclk", "l4-per-clkctrl:0040:8"), + DT_CLK(NULL, "gpio3_dbclk", "l4-per-clkctrl:0048:8"), + DT_CLK(NULL, "gpio4_dbclk", "l4-per-clkctrl:0050:8"), + DT_CLK(NULL, "gpio5_dbclk", "l4-per-clkctrl:0058:8"), + DT_CLK(NULL, "gpio6_dbclk", "l4-per-clkctrl:0060:8"), + DT_CLK(NULL, "hsi_fck", "l3-init-clkctrl:0018:24"), + DT_CLK(NULL, "hsmmc1_fclk", "l3-init-clkctrl:0008:24"), + DT_CLK(NULL, "hsmmc2_fclk", "l3-init-clkctrl:0010:24"), + DT_CLK(NULL, "iss_ctrlclk", "iss-clkctrl:0000:8"), + DT_CLK(NULL, "mcasp_sync_mux_ck", "abe-clkctrl:0020:26"), + DT_CLK(NULL, "mcbsp1_sync_mux_ck", "abe-clkctrl:0028:26"), + DT_CLK(NULL, "mcbsp2_sync_mux_ck", "abe-clkctrl:0030:26"), + DT_CLK(NULL, "mcbsp3_sync_mux_ck", "abe-clkctrl:0038:26"), + DT_CLK(NULL, "mcbsp4_sync_mux_ck", "l4-per-clkctrl:00c0:26"), + DT_CLK(NULL, "ocp2scp_usb_phy_phy_48m", "l3-init-clkctrl:00c0:8"), + DT_CLK(NULL, "otg_60m_gfclk", "l3-init-clkctrl:0040:24"), + DT_CLK(NULL, "per_mcbsp4_gfclk", "l4-per-clkctrl:00c0:24"), + DT_CLK(NULL, "pmd_stm_clock_mux_ck", "emu-sys-clkctrl:0000:20"), + DT_CLK(NULL, "pmd_trace_clk_mux_ck", "emu-sys-clkctrl:0000:22"), + DT_CLK(NULL, "sgx_clk_mux", "l3-gfx-clkctrl:0000:24"), + DT_CLK(NULL, "slimbus1_fclk_0", "abe-clkctrl:0040:8"), + DT_CLK(NULL, "slimbus1_fclk_1", "abe-clkctrl:0040:9"), + DT_CLK(NULL, "slimbus1_fclk_2", "abe-clkctrl:0040:10"), + DT_CLK(NULL, "slimbus1_slimbus_clk", "abe-clkctrl:0040:11"), + DT_CLK(NULL, "slimbus2_fclk_0", "l4-per-clkctrl:0118:8"), + DT_CLK(NULL, "slimbus2_fclk_1", "l4-per-clkctrl:0118:9"), + DT_CLK(NULL, "slimbus2_slimbus_clk", "l4-per-clkctrl:0118:10"), + DT_CLK(NULL, "stm_clk_div_ck", "emu-sys-clkctrl:0000:27"), + DT_CLK(NULL, "timer5_sync_mux", "abe-clkctrl:0048:24"), + DT_CLK(NULL, "timer6_sync_mux", "abe-clkctrl:0050:24"), + DT_CLK(NULL, "timer7_sync_mux", "abe-clkctrl:0058:24"), + DT_CLK(NULL, "timer8_sync_mux", "abe-clkctrl:0060:24"), + DT_CLK(NULL, "trace_clk_div_div_ck", "emu-sys-clkctrl:0000:24"), + DT_CLK(NULL, "usb_host_hs_func48mclk", "l3-init-clkctrl:0038:15"), + DT_CLK(NULL, "usb_host_hs_hsic480m_p1_clk", "l3-init-clkctrl:0038:13"), + DT_CLK(NULL, "usb_host_hs_hsic480m_p2_clk", "l3-init-clkctrl:0038:14"), + DT_CLK(NULL, "usb_host_hs_hsic60m_p1_clk", "l3-init-clkctrl:0038:11"), + DT_CLK(NULL, "usb_host_hs_hsic60m_p2_clk", "l3-init-clkctrl:0038:12"), + DT_CLK(NULL, "usb_host_hs_utmi_p1_clk", "l3-init-clkctrl:0038:8"), + DT_CLK(NULL, "usb_host_hs_utmi_p2_clk", "l3-init-clkctrl:0038:9"), + DT_CLK(NULL, "usb_host_hs_utmi_p3_clk", "l3_init-clkctrl:0038:10"), + DT_CLK(NULL, "usb_otg_hs_xclk", "l3-init-clkctrl:0040:8"), + DT_CLK(NULL, "usb_tll_hs_usb_ch0_clk", "l3-init-clkctrl:0048:8"), + DT_CLK(NULL, "usb_tll_hs_usb_ch1_clk", "l3-init-clkctrl:0048:9"), + DT_CLK(NULL, "usb_tll_hs_usb_ch2_clk", "l3-init-clkctrl:0048:10"), + DT_CLK(NULL, "utmi_p1_gfclk", "l3-init-clkctrl:0038:24"), + DT_CLK(NULL, "utmi_p2_gfclk", "l3-init-clkctrl:0038:25"), { .node_name =3D NULL }, }; =20 diff --git a/drivers/clk/ti/clk-54xx.c b/drivers/clk/ti/clk-54xx.c index 90e0a9ea6351..b4aff76eb373 100644 --- a/drivers/clk/ti/clk-54xx.c +++ b/drivers/clk/ti/clk-54xx.c @@ -50,7 +50,7 @@ static const struct omap_clkctrl_bit_data omap5_aess_bit_= data[] __initconst =3D { }; =20 static const char * const omap5_dmic_gfclk_parents[] __initconst =3D { - "abe_cm:clk:0018:26", + "abe-clkctrl:0018:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -70,7 +70,7 @@ static const struct omap_clkctrl_bit_data omap5_dmic_bit_= data[] __initconst =3D { }; =20 static const char * const omap5_mcbsp1_gfclk_parents[] __initconst =3D { - "abe_cm:clk:0028:26", + "abe-clkctrl:0028:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -83,7 +83,7 @@ static const struct omap_clkctrl_bit_data omap5_mcbsp1_bi= t_data[] __initconst =3D }; =20 static const char * const omap5_mcbsp2_gfclk_parents[] __initconst =3D { - "abe_cm:clk:0030:26", + "abe-clkctrl:0030:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -96,7 +96,7 @@ static const struct omap_clkctrl_bit_data omap5_mcbsp2_bi= t_data[] __initconst =3D }; =20 static const char * const omap5_mcbsp3_gfclk_parents[] __initconst =3D { - "abe_cm:clk:0038:26", + "abe-clkctrl:0038:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -136,16 +136,16 @@ static const struct omap_clkctrl_bit_data omap5_timer= 8_bit_data[] __initconst =3D =20 static const struct omap_clkctrl_reg_data omap5_abe_clkctrl_regs[] __initc= onst =3D { { OMAP5_L4_ABE_CLKCTRL, NULL, 0, "abe_iclk" }, - { OMAP5_AESS_CLKCTRL, omap5_aess_bit_data, CLKF_SW_SUP, "abe_cm:clk:0008:= 24" }, + { OMAP5_AESS_CLKCTRL, omap5_aess_bit_data, CLKF_SW_SUP, "abe-clkctrl:0008= :24" }, { OMAP5_MCPDM_CLKCTRL, NULL, CLKF_SW_SUP, "pad_clks_ck" }, - { OMAP5_DMIC_CLKCTRL, omap5_dmic_bit_data, CLKF_SW_SUP, "abe_cm:clk:0018:= 24" }, - { OMAP5_MCBSP1_CLKCTRL, omap5_mcbsp1_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 028:24" }, - { OMAP5_MCBSP2_CLKCTRL, omap5_mcbsp2_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 030:24" }, - { OMAP5_MCBSP3_CLKCTRL, omap5_mcbsp3_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 038:24" }, - { OMAP5_TIMER5_CLKCTRL, omap5_timer5_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 048:24" }, - { OMAP5_TIMER6_CLKCTRL, omap5_timer6_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 050:24" }, - { OMAP5_TIMER7_CLKCTRL, omap5_timer7_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 058:24" }, - { OMAP5_TIMER8_CLKCTRL, omap5_timer8_bit_data, CLKF_SW_SUP, "abe_cm:clk:0= 060:24" }, + { OMAP5_DMIC_CLKCTRL, omap5_dmic_bit_data, CLKF_SW_SUP, "abe-clkctrl:0018= :24" }, + { OMAP5_MCBSP1_CLKCTRL, omap5_mcbsp1_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0028:24" }, + { OMAP5_MCBSP2_CLKCTRL, omap5_mcbsp2_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0030:24" }, + { OMAP5_MCBSP3_CLKCTRL, omap5_mcbsp3_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0038:24" }, + { OMAP5_TIMER5_CLKCTRL, omap5_timer5_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0048:24" }, + { OMAP5_TIMER6_CLKCTRL, omap5_timer6_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0050:24" }, + { OMAP5_TIMER7_CLKCTRL, omap5_timer7_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0058:24" }, + { OMAP5_TIMER8_CLKCTRL, omap5_timer8_bit_data, CLKF_SW_SUP, "abe-clkctrl:= 0060:24" }, { 0 }, }; =20 @@ -268,12 +268,12 @@ static const struct omap_clkctrl_bit_data omap5_gpio8= _bit_data[] __initconst =3D { }; =20 static const struct omap_clkctrl_reg_data omap5_l4per_clkctrl_regs[] __ini= tconst =3D { - { OMAP5_TIMER10_CLKCTRL, omap5_timer10_bit_data, CLKF_SW_SUP, "l4per_cm:c= lk:0008:24" }, - { OMAP5_TIMER11_CLKCTRL, omap5_timer11_bit_data, CLKF_SW_SUP, "l4per_cm:c= lk:0010:24" }, - { OMAP5_TIMER2_CLKCTRL, omap5_timer2_bit_data, CLKF_SW_SUP, "l4per_cm:clk= :0018:24" }, - { OMAP5_TIMER3_CLKCTRL, omap5_timer3_bit_data, CLKF_SW_SUP, "l4per_cm:clk= :0020:24" }, - { OMAP5_TIMER4_CLKCTRL, omap5_timer4_bit_data, CLKF_SW_SUP, "l4per_cm:clk= :0028:24" }, - { OMAP5_TIMER9_CLKCTRL, omap5_timer9_bit_data, CLKF_SW_SUP, "l4per_cm:clk= :0030:24" }, + { OMAP5_TIMER10_CLKCTRL, omap5_timer10_bit_data, CLKF_SW_SUP, "l4per-clkc= trl:0008:24" }, + { OMAP5_TIMER11_CLKCTRL, omap5_timer11_bit_data, CLKF_SW_SUP, "l4per-clkc= trl:0010:24" }, + { OMAP5_TIMER2_CLKCTRL, omap5_timer2_bit_data, CLKF_SW_SUP, "l4per-clkctr= l:0018:24" }, + { OMAP5_TIMER3_CLKCTRL, omap5_timer3_bit_data, CLKF_SW_SUP, "l4per-clkctr= l:0020:24" }, + { OMAP5_TIMER4_CLKCTRL, omap5_timer4_bit_data, CLKF_SW_SUP, "l4per-clkctr= l:0028:24" }, + { OMAP5_TIMER9_CLKCTRL, omap5_timer9_bit_data, CLKF_SW_SUP, "l4per-clkctr= l:0030:24" }, { OMAP5_GPIO2_CLKCTRL, omap5_gpio2_bit_data, CLKF_HW_SUP, "l4_root_clk_di= v" }, { OMAP5_GPIO3_CLKCTRL, omap5_gpio3_bit_data, CLKF_HW_SUP, "l4_root_clk_di= v" }, { OMAP5_GPIO4_CLKCTRL, omap5_gpio4_bit_data, CLKF_HW_SUP, "l4_root_clk_di= v" }, @@ -345,7 +345,7 @@ static const struct omap_clkctrl_bit_data omap5_dss_cor= e_bit_data[] __initconst }; =20 static const struct omap_clkctrl_reg_data omap5_dss_clkctrl_regs[] __initc= onst =3D { - { OMAP5_DSS_CORE_CLKCTRL, omap5_dss_core_bit_data, CLKF_SW_SUP, "dss_cm:c= lk:0000:8" }, + { OMAP5_DSS_CORE_CLKCTRL, omap5_dss_core_bit_data, CLKF_SW_SUP, "dss-clkc= trl:0000:8" }, { 0 }, }; =20 @@ -378,7 +378,7 @@ static const struct omap_clkctrl_bit_data omap5_gpu_cor= e_bit_data[] __initconst }; =20 static const struct omap_clkctrl_reg_data omap5_gpu_clkctrl_regs[] __initc= onst =3D { - { OMAP5_GPU_CLKCTRL, omap5_gpu_core_bit_data, CLKF_SW_SUP, "gpu_cm:clk:00= 00:24" }, + { OMAP5_GPU_CLKCTRL, omap5_gpu_core_bit_data, CLKF_SW_SUP, "gpu-clkctrl:0= 000:24" }, { 0 }, }; =20 @@ -389,7 +389,7 @@ static const char * const omap5_mmc1_fclk_mux_parents[]= __initconst =3D { }; =20 static const char * const omap5_mmc1_fclk_parents[] __initconst =3D { - "l3init_cm:clk:0008:24", + "l3init-clkctrl:0008:24", NULL, }; =20 @@ -405,7 +405,7 @@ static const struct omap_clkctrl_bit_data omap5_mmc1_bi= t_data[] __initconst =3D { }; =20 static const char * const omap5_mmc2_fclk_parents[] __initconst =3D { - "l3init_cm:clk:0010:24", + "l3init-clkctrl:0010:24", NULL, }; =20 @@ -430,12 +430,12 @@ static const char * const omap5_usb_host_hs_hsic480m_= p3_clk_parents[] __initcons }; =20 static const char * const omap5_usb_host_hs_utmi_p1_clk_parents[] __initco= nst =3D { - "l3init_cm:clk:0038:24", + "l3init-clkctrl:0038:24", NULL, }; =20 static const char * const omap5_usb_host_hs_utmi_p2_clk_parents[] __initco= nst =3D { - "l3init_cm:clk:0038:25", + "l3init-clkctrl:0038:25", NULL, }; =20 @@ -494,8 +494,8 @@ static const struct omap_clkctrl_bit_data omap5_usb_otg= _ss_bit_data[] __initcons }; =20 static const struct omap_clkctrl_reg_data omap5_l3init_clkctrl_regs[] __in= itconst =3D { - { OMAP5_MMC1_CLKCTRL, omap5_mmc1_bit_data, CLKF_SW_SUP, "l3init_cm:clk:00= 08:25" }, - { OMAP5_MMC2_CLKCTRL, omap5_mmc2_bit_data, CLKF_SW_SUP, "l3init_cm:clk:00= 10:25" }, + { OMAP5_MMC1_CLKCTRL, omap5_mmc1_bit_data, CLKF_SW_SUP, "l3init-clkctrl:0= 008:25" }, + { OMAP5_MMC2_CLKCTRL, omap5_mmc2_bit_data, CLKF_SW_SUP, "l3init-clkctrl:0= 010:25" }, { OMAP5_USB_HOST_HS_CLKCTRL, omap5_usb_host_hs_bit_data, CLKF_SW_SUP, "l3= init_60m_fclk" }, { OMAP5_USB_TLL_HS_CLKCTRL, omap5_usb_tll_hs_bit_data, CLKF_HW_SUP, "l4_r= oot_clk_div" }, { OMAP5_SATA_CLKCTRL, omap5_sata_bit_data, CLKF_SW_SUP, "func_48m_fclk" }, @@ -519,7 +519,7 @@ static const struct omap_clkctrl_reg_data omap5_wkupaon= _clkctrl_regs[] __initcon { OMAP5_L4_WKUP_CLKCTRL, NULL, 0, "wkupaon_iclk_mux" }, { OMAP5_WD_TIMER2_CLKCTRL, NULL, CLKF_SW_SUP, "sys_32k_ck" }, { OMAP5_GPIO1_CLKCTRL, omap5_gpio1_bit_data, CLKF_HW_SUP, "wkupaon_iclk_m= ux" }, - { OMAP5_TIMER1_CLKCTRL, omap5_timer1_bit_data, CLKF_SW_SUP, "wkupaon_cm:c= lk:0020:24" }, + { OMAP5_TIMER1_CLKCTRL, omap5_timer1_bit_data, CLKF_SW_SUP, "wkupaon-clkc= trl:0020:24" }, { OMAP5_COUNTER_32K_CLKCTRL, NULL, 0, "wkupaon_iclk_mux" }, { OMAP5_KBD_CLKCTRL, NULL, CLKF_SW_SUP, "sys_32k_ck" }, { 0 }, @@ -549,58 +549,58 @@ const struct omap_clkctrl_data omap5_clkctrl_data[] _= _initconst =3D { static struct ti_dt_clk omap54xx_clks[] =3D { DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"), DT_CLK(NULL, "sys_clkin_ck", "sys_clkin"), - DT_CLK(NULL, "dmic_gfclk", "abe_cm:0018:24"), - DT_CLK(NULL, "dmic_sync_mux_ck", "abe_cm:0018:26"), - DT_CLK(NULL, "dss_32khz_clk", "dss_cm:0000:11"), - DT_CLK(NULL, "dss_48mhz_clk", "dss_cm:0000:9"), - DT_CLK(NULL, "dss_dss_clk", "dss_cm:0000:8"), - DT_CLK(NULL, "dss_sys_clk", "dss_cm:0000:10"), - DT_CLK(NULL, "gpio1_dbclk", "wkupaon_cm:0018:8"), - DT_CLK(NULL, "gpio2_dbclk", "l4per_cm:0040:8"), - DT_CLK(NULL, "gpio3_dbclk", "l4per_cm:0048:8"), - DT_CLK(NULL, "gpio4_dbclk", "l4per_cm:0050:8"), - DT_CLK(NULL, "gpio5_dbclk", "l4per_cm:0058:8"), - DT_CLK(NULL, "gpio6_dbclk", "l4per_cm:0060:8"), - DT_CLK(NULL, "gpio7_dbclk", "l4per_cm:00f0:8"), - DT_CLK(NULL, "gpio8_dbclk", "l4per_cm:00f8:8"), - DT_CLK(NULL, "mcbsp1_gfclk", "abe_cm:0028:24"), - DT_CLK(NULL, "mcbsp1_sync_mux_ck", "abe_cm:0028:26"), - DT_CLK(NULL, "mcbsp2_gfclk", "abe_cm:0030:24"), - DT_CLK(NULL, "mcbsp2_sync_mux_ck", "abe_cm:0030:26"), - DT_CLK(NULL, "mcbsp3_gfclk", "abe_cm:0038:24"), - DT_CLK(NULL, "mcbsp3_sync_mux_ck", "abe_cm:0038:26"), - DT_CLK(NULL, "mmc1_32khz_clk", "l3init_cm:0008:8"), - DT_CLK(NULL, "mmc1_fclk", "l3init_cm:0008:25"), - DT_CLK(NULL, "mmc1_fclk_mux", "l3init_cm:0008:24"), - DT_CLK(NULL, "mmc2_fclk", "l3init_cm:0010:25"), - DT_CLK(NULL, "mmc2_fclk_mux", "l3init_cm:0010:24"), - DT_CLK(NULL, "sata_ref_clk", "l3init_cm:0068:8"), - DT_CLK(NULL, "timer10_gfclk_mux", "l4per_cm:0008:24"), - DT_CLK(NULL, "timer11_gfclk_mux", "l4per_cm:0010:24"), - DT_CLK(NULL, "timer1_gfclk_mux", "wkupaon_cm:0020:24"), - DT_CLK(NULL, "timer2_gfclk_mux", "l4per_cm:0018:24"), - DT_CLK(NULL, "timer3_gfclk_mux", "l4per_cm:0020:24"), - DT_CLK(NULL, "timer4_gfclk_mux", "l4per_cm:0028:24"), - DT_CLK(NULL, "timer5_gfclk_mux", "abe_cm:0048:24"), - DT_CLK(NULL, "timer6_gfclk_mux", "abe_cm:0050:24"), - DT_CLK(NULL, "timer7_gfclk_mux", "abe_cm:0058:24"), - DT_CLK(NULL, "timer8_gfclk_mux", "abe_cm:0060:24"), - DT_CLK(NULL, "timer9_gfclk_mux", "l4per_cm:0030:24"), - DT_CLK(NULL, "usb_host_hs_hsic480m_p1_clk", "l3init_cm:0038:13"), - DT_CLK(NULL, "usb_host_hs_hsic480m_p2_clk", "l3init_cm:0038:14"), - DT_CLK(NULL, "usb_host_hs_hsic480m_p3_clk", "l3init_cm:0038:7"), - DT_CLK(NULL, "usb_host_hs_hsic60m_p1_clk", "l3init_cm:0038:11"), - DT_CLK(NULL, "usb_host_hs_hsic60m_p2_clk", "l3init_cm:0038:12"), - DT_CLK(NULL, "usb_host_hs_hsic60m_p3_clk", "l3init_cm:0038:6"), - DT_CLK(NULL, "usb_host_hs_utmi_p1_clk", "l3init_cm:0038:8"), - DT_CLK(NULL, "usb_host_hs_utmi_p2_clk", "l3init_cm:0038:9"), - DT_CLK(NULL, "usb_host_hs_utmi_p3_clk", "l3init_cm:0038:10"), - DT_CLK(NULL, "usb_otg_ss_refclk960m", "l3init_cm:00d0:8"), - DT_CLK(NULL, "usb_tll_hs_usb_ch0_clk", "l3init_cm:0048:8"), - DT_CLK(NULL, "usb_tll_hs_usb_ch1_clk", "l3init_cm:0048:9"), - DT_CLK(NULL, "usb_tll_hs_usb_ch2_clk", "l3init_cm:0048:10"), - DT_CLK(NULL, "utmi_p1_gfclk", "l3init_cm:0038:24"), - DT_CLK(NULL, "utmi_p2_gfclk", "l3init_cm:0038:25"), + DT_CLK(NULL, "dmic_gfclk", "abe-clkctrl:0018:24"), + DT_CLK(NULL, "dmic_sync_mux_ck", "abe-clkctrl:0018:26"), + DT_CLK(NULL, "dss_32khz_clk", "dss-clkctrl:0000:11"), + DT_CLK(NULL, "dss_48mhz_clk", "dss-clkctrl:0000:9"), + DT_CLK(NULL, "dss_dss_clk", "dss-clkctrl:0000:8"), + DT_CLK(NULL, "dss_sys_clk", "dss-clkctrl:0000:10"), + DT_CLK(NULL, "gpio1_dbclk", "wkupaon-clkctrl:0018:8"), + DT_CLK(NULL, "gpio2_dbclk", "l4per-clkctrl:0040:8"), + DT_CLK(NULL, "gpio3_dbclk", "l4per-clkctrl:0048:8"), + DT_CLK(NULL, "gpio4_dbclk", "l4per-clkctrl:0050:8"), + DT_CLK(NULL, "gpio5_dbclk", "l4per-clkctrl:0058:8"), + DT_CLK(NULL, "gpio6_dbclk", "l4per-clkctrl:0060:8"), + DT_CLK(NULL, "gpio7_dbclk", "l4per-clkctrl:00f0:8"), + DT_CLK(NULL, "gpio8_dbclk", "l4per-clkctrl:00f8:8"), + DT_CLK(NULL, "mcbsp1_gfclk", "abe-clkctrl:0028:24"), + DT_CLK(NULL, "mcbsp1_sync_mux_ck", "abe-clkctrl:0028:26"), + DT_CLK(NULL, "mcbsp2_gfclk", "abe-clkctrl:0030:24"), + DT_CLK(NULL, "mcbsp2_sync_mux_ck", "abe-clkctrl:0030:26"), + DT_CLK(NULL, "mcbsp3_gfclk", "abe-clkctrl:0038:24"), + DT_CLK(NULL, "mcbsp3_sync_mux_ck", "abe-clkctrl:0038:26"), + DT_CLK(NULL, "mmc1_32khz_clk", "l3init-clkctrl:0008:8"), + DT_CLK(NULL, "mmc1_fclk", "l3init-clkctrl:0008:25"), + DT_CLK(NULL, "mmc1_fclk_mux", "l3init-clkctrl:0008:24"), + DT_CLK(NULL, "mmc2_fclk", "l3init-clkctrl:0010:25"), + DT_CLK(NULL, "mmc2_fclk_mux", "l3init-clkctrl:0010:24"), + DT_CLK(NULL, "sata_ref_clk", "l3init-clkctrl:0068:8"), + DT_CLK(NULL, "timer10_gfclk_mux", "l4per-clkctrl:0008:24"), + DT_CLK(NULL, "timer11_gfclk_mux", "l4per-clkctrl:0010:24"), + DT_CLK(NULL, "timer1_gfclk_mux", "wkupaon-clkctrl:0020:24"), + DT_CLK(NULL, "timer2_gfclk_mux", "l4per-clkctrl:0018:24"), + DT_CLK(NULL, "timer3_gfclk_mux", "l4per-clkctrl:0020:24"), + DT_CLK(NULL, "timer4_gfclk_mux", "l4per-clkctrl:0028:24"), + DT_CLK(NULL, "timer5_gfclk_mux", "abe-clkctrl:0048:24"), + DT_CLK(NULL, "timer6_gfclk_mux", "abe-clkctrl:0050:24"), + DT_CLK(NULL, "timer7_gfclk_mux", "abe-clkctrl:0058:24"), + DT_CLK(NULL, "timer8_gfclk_mux", "abe-clkctrl:0060:24"), + DT_CLK(NULL, "timer9_gfclk_mux", "l4per-clkctrl:0030:24"), + DT_CLK(NULL, "usb_host_hs_hsic480m_p1_clk", "l3init-clkctrl:0038:13"), + DT_CLK(NULL, "usb_host_hs_hsic480m_p2_clk", "l3init-clkctrl:0038:14"), + DT_CLK(NULL, "usb_host_hs_hsic480m_p3_clk", "l3init-clkctrl:0038:7"), + DT_CLK(NULL, "usb_host_hs_hsic60m_p1_clk", "l3init-clkctrl:0038:11"), + DT_CLK(NULL, "usb_host_hs_hsic60m_p2_clk", "l3init-clkctrl:0038:12"), + DT_CLK(NULL, "usb_host_hs_hsic60m_p3_clk", "l3init-clkctrl:0038:6"), + DT_CLK(NULL, "usb_host_hs_utmi_p1_clk", "l3init-clkctrl:0038:8"), + DT_CLK(NULL, "usb_host_hs_utmi_p2_clk", "l3init-clkctrl:0038:9"), + DT_CLK(NULL, "usb_host_hs_utmi_p3_clk", "l3init-clkctrl:0038:10"), + DT_CLK(NULL, "usb_otg_ss_refclk960m", "l3init-clkctrl:00d0:8"), + DT_CLK(NULL, "usb_tll_hs_usb_ch0_clk", "l3init-clkctrl:0048:8"), + DT_CLK(NULL, "usb_tll_hs_usb_ch1_clk", "l3init-clkctrl:0048:9"), + DT_CLK(NULL, "usb_tll_hs_usb_ch2_clk", "l3init-clkctrl:0048:10"), + DT_CLK(NULL, "utmi_p1_gfclk", "l3init-clkctrl:0038:24"), + DT_CLK(NULL, "utmi_p2_gfclk", "l3init-clkctrl:0038:25"), { .node_name =3D NULL }, }; =20 diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c index 617360e20d86..e23bf0458632 100644 --- a/drivers/clk/ti/clkctrl.c +++ b/drivers/clk/ti/clkctrl.c @@ -528,10 +528,6 @@ static void __init _ti_omap4_clkctrl_setup(struct devi= ce_node *node) char *c; u16 soc_mask =3D 0; =20 - if (!(ti_clk_get_features()->flags & TI_CLK_CLKCTRL_COMPAT) && - of_node_name_eq(node, "clk")) - ti_clk_features.flags |=3D TI_CLK_CLKCTRL_COMPAT; - addrp =3D of_get_address(node, 0, NULL, NULL); addr =3D (u32)of_translate_address(node, addrp); =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F27C9C32792 for ; Tue, 23 Aug 2022 09:17:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349068AbiHWJRa (ORCPT ); Tue, 23 Aug 2022 05:17:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349194AbiHWJOx (ORCPT ); Tue, 23 Aug 2022 05:14:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2AC88708F; Tue, 23 Aug 2022 01:32:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2428D6123D; Tue, 23 Aug 2022 08:32:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C612C433C1; Tue, 23 Aug 2022 08:31:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243520; bh=a4/LmbqCcfw4a/dBf+i02Qljn4gGGMGLZNQ7He7NoVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uvGfXknMSeNPKQqNPdUGSU+uLd/UHLQOTK6oYdilTZpepxCSb49b4D5gdiL3ogct/ soKtnzli9+Jt+dtZyKo1p0mzFMI/SWgIKXTL++wMnV0t+27mYvObsRw/oz2tiHZO72 tXBdC/sc5StGDGPWf0fzIAHK/rIa88bmicShJ6r4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanley Chu , Po-Wen Kao , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 273/365] scsi: ufs: ufs-mediatek: Fix the timing of configuring device regulators Date: Tue, 23 Aug 2022 10:02:54 +0200 Message-Id: <20220823080129.592036136@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Po-Wen Kao [ Upstream commit 3fd23b8dfb54d9b74eba6dfdd3225db3ac116785 ] Currently the LPM configurations of device regulators may not work since VCC is not disabled yet while ufs_mtk_vreg_set_lpm() is executed. Fix this by changing the timing of invoking ufs_mtk_vreg_set_lpm(). Link: https://lore.kernel.org/r/20220616053725.5681-5-stanley.chu@mediatek.= com Reviewed-by: Stanley Chu Signed-off-by: Po-Wen Kao Signed-off-by: Stanley Chu Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/ufs/host/ufs-mediatek.c | 58 ++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediate= k.c index beabc3ccd30b..8b9daa281cc4 100644 --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -1026,7 +1026,6 @@ static int ufs_mtk_suspend(struct ufs_hba *hba, enum = ufs_pm_op pm_op, * ufshcd_suspend() re-enabling regulators while vreg is still * in low-power mode. */ - ufs_mtk_vreg_set_lpm(hba, true); err =3D ufs_mtk_mphy_power_on(hba, false); if (err) goto fail; @@ -1050,12 +1049,13 @@ static int ufs_mtk_resume(struct ufs_hba *hba, enum= ufs_pm_op pm_op) { int err; =20 + if (hba->ufshcd_state !=3D UFSHCD_STATE_OPERATIONAL) + ufs_mtk_vreg_set_lpm(hba, false); + err =3D ufs_mtk_mphy_power_on(hba, true); if (err) goto fail; =20 - ufs_mtk_vreg_set_lpm(hba, false); - if (ufshcd_is_link_hibern8(hba)) { err =3D ufs_mtk_link_set_hpm(hba); if (err) @@ -1220,9 +1220,57 @@ static int ufs_mtk_remove(struct platform_device *pd= ev) return 0; } =20 +int ufs_mtk_system_suspend(struct device *dev) +{ + struct ufs_hba *hba =3D dev_get_drvdata(dev); + int ret; + + ret =3D ufshcd_system_suspend(dev); + if (ret) + return ret; + + ufs_mtk_vreg_set_lpm(hba, true); + + return 0; +} + +int ufs_mtk_system_resume(struct device *dev) +{ + struct ufs_hba *hba =3D dev_get_drvdata(dev); + + ufs_mtk_vreg_set_lpm(hba, false); + + return ufshcd_system_resume(dev); +} + +int ufs_mtk_runtime_suspend(struct device *dev) +{ + struct ufs_hba *hba =3D dev_get_drvdata(dev); + int ret =3D 0; + + ret =3D ufshcd_runtime_suspend(dev); + if (ret) + return ret; + + ufs_mtk_vreg_set_lpm(hba, true); + + return 0; +} + +int ufs_mtk_runtime_resume(struct device *dev) +{ + struct ufs_hba *hba =3D dev_get_drvdata(dev); + + ufs_mtk_vreg_set_lpm(hba, false); + + return ufshcd_runtime_resume(dev); +} + static const struct dev_pm_ops ufs_mtk_pm_ops =3D { - SET_SYSTEM_SLEEP_PM_OPS(ufshcd_system_suspend, ufshcd_system_resume) - SET_RUNTIME_PM_OPS(ufshcd_runtime_suspend, ufshcd_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(ufs_mtk_system_suspend, + ufs_mtk_system_resume) + SET_RUNTIME_PM_OPS(ufs_mtk_runtime_suspend, + ufs_mtk_runtime_resume, NULL) .prepare =3D ufshcd_suspend_prepare, .complete =3D ufshcd_resume_complete, }; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90757C32792 for ; Tue, 23 Aug 2022 09:13:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349011AbiHWJNx (ORCPT ); Tue, 23 Aug 2022 05:13:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348822AbiHWJKy (ORCPT ); Tue, 23 Aug 2022 05:10:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB0F574E18; Tue, 23 Aug 2022 01:31:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 30FB4B81C20; Tue, 23 Aug 2022 08:30:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82C7CC433C1; Tue, 23 Aug 2022 08:30:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243425; bh=9yq06iy7wO79sD8w+W4l8pQHAI+xo3r+nkuC6o1BkqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QtFRCMhxHx/B8OCV10ZeAN4vQ7Kz1JBg+816tXQGTs/nF0Dhaqv9Uif44AY6damim w3cQfAwXUFlq4qG0a1OXKry2pgU+kUP6A1bh+pATnYGyp8suFzsbte9uYtNepUiUSm evLGsLgDJjNO5J6Y8u33pyMq9pJmPQqSS4e6PRIA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Heikki Krogerus , AngeloGioacchino Del Regno , Prashant Malani , Sasha Levin Subject: [PATCH 5.19 274/365] usb: typec: mux: Add CONFIG guards for functions Date: Tue, 23 Aug 2022 10:02:55 +0200 Message-Id: <20220823080129.624882306@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Prashant Malani [ Upstream commit a37599ebfb656c2af4ca119de556eba29b6926d6 ] There are some drivers that can use the Type C mux API, but don't have to. Introduce CONFIG guards for the mux functions so that drivers can include the header file and not run into compilation errors on systems which don't have CONFIG_TYPEC enabled. When CONFIG_TYPEC is not enabled, the Type C mux functions will be stub versions of the original calls. Reported-by: kernel test robot Reviewed-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: Heikki Krogerus Reviewed-by: AngeloGioacchino Del Regno Tested-by: N=C3=ADcolas F. R. A. Prado Signed-off-by: Prashant Malani Link: https://lore.kernel.org/r/20220615172129.1314056-3-pmalani@chromium.o= rg Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- include/linux/usb/typec_mux.h | 44 ++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h index ee57781dcf28..9292f0e07846 100644 --- a/include/linux/usb/typec_mux.h +++ b/include/linux/usb/typec_mux.h @@ -58,17 +58,13 @@ struct typec_mux_desc { void *drvdata; }; =20 +#if IS_ENABLED(CONFIG_TYPEC) + struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode, const struct typec_altmode_desc *desc); void typec_mux_put(struct typec_mux *mux); int typec_mux_set(struct typec_mux *mux, struct typec_mux_state *state); =20 -static inline struct typec_mux * -typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc) -{ - return fwnode_typec_mux_get(dev_fwnode(dev), desc); -} - struct typec_mux_dev * typec_mux_register(struct device *parent, const struct typec_mux_desc *des= c); void typec_mux_unregister(struct typec_mux_dev *mux); @@ -76,4 +72,40 @@ void typec_mux_unregister(struct typec_mux_dev *mux); void typec_mux_set_drvdata(struct typec_mux_dev *mux, void *data); void *typec_mux_get_drvdata(struct typec_mux_dev *mux); =20 +#else + +static inline struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle = *fwnode, + const struct typec_altmode_desc *desc) +{ + return NULL; +} + +static inline void typec_mux_put(struct typec_mux *mux) {} + +static inline int typec_mux_set(struct typec_mux *mux, struct typec_mux_st= ate *state) +{ + return 0; +} + +static inline struct typec_mux_dev * +typec_mux_register(struct device *parent, const struct typec_mux_desc *des= c) +{ + return ERR_PTR(-EOPNOTSUPP); +} +static inline void typec_mux_unregister(struct typec_mux_dev *mux) {} + +static inline void typec_mux_set_drvdata(struct typec_mux_dev *mux, void *= data) {} +static inline void *typec_mux_get_drvdata(struct typec_mux_dev *mux) +{ + return ERR_PTR(-EOPNOTSUPP); +} + +#endif /* CONFIG_TYPEC */ + +static inline struct typec_mux * +typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc) +{ + return fwnode_typec_mux_get(dev_fwnode(dev), desc); +} + #endif /* __USB_TYPEC_MUX */ --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB1CEC32772 for ; Tue, 23 Aug 2022 09:13:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348854AbiHWJNY (ORCPT ); Tue, 23 Aug 2022 05:13:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348692AbiHWJKg (ORCPT ); Tue, 23 Aug 2022 05:10:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA64686B72; Tue, 23 Aug 2022 01:31:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 496ECB81C54; Tue, 23 Aug 2022 08:30:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0C69C433D6; Tue, 23 Aug 2022 08:30:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243429; bh=GuOmZLylmuX6irrw0+j0dIRNspABPterYfA45dueXJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sy3qWYjlNs+EvObnPY5LoQgxJIAIo/lj/QxeNCNJIoHx4vsrxtuybL1f57dtUwWqR WMHR+LvUp8nMfS+F9PqsOQzhx6TNTRwBByiGM1tZ7ZRuIujAir1sjdrZoDCSY0kJgR OotV4th3wNE1vg3Fgc4xSx6JFRdxIR90O5BPyJc0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Liang He , Sasha Levin Subject: [PATCH 5.19 275/365] usb: host: ohci-ppc-of: Fix refcount leak bug Date: Tue, 23 Aug 2022 10:02:56 +0200 Message-Id: <20220823080129.669683655@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 40a959d7042bb7711e404ad2318b30e9f92c6b9b ] In ohci_hcd_ppc_of_probe(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore. Acked-by: Alan Stern Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220617034637.4003115-1-windhl@126.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/usb/host/ohci-ppc-of.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c index 1960b8dfdba5..591f675cc930 100644 --- a/drivers/usb/host/ohci-ppc-of.c +++ b/drivers/usb/host/ohci-ppc-of.c @@ -166,6 +166,7 @@ static int ohci_hcd_ppc_of_probe(struct platform_device= *op) release_mem_region(res.start, 0x4); } else pr_debug("%s: cannot get ehci offset from fdt\n", __FILE__); + of_node_put(np); } =20 irq_dispose_mapping(irq); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20EE3C32772 for ; Tue, 23 Aug 2022 09:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348462AbiHWJKR (ORCPT ); Tue, 23 Aug 2022 05:10:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241164AbiHWJIj (ORCPT ); Tue, 23 Aug 2022 05:08:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1F17861E4; Tue, 23 Aug 2022 01:30:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3BB8AB81BF8; Tue, 23 Aug 2022 08:30:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FE88C433C1; Tue, 23 Aug 2022 08:30:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243432; bh=9krYIMZkWByFYm0Z2MCMjTdo/cKY77hHZASSi3Elm3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bqjDWb8fUcJXTT4aiSbg8EciVWp3h7UohDURdcm8vRcK8iqz4mvK8+BQXkV4Balih Bqr5Wk4fIpLa6LynU7gRz0Q3KWNDR5j5/MavRgs0B01HsvHw+Jsi+Ln0i+VhdFRc0+ 9rS27Ggc9/ZuKRAVomTo+mtdN6tnlPOunv07wo4g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Sasha Levin Subject: [PATCH 5.19 276/365] usb: renesas: Fix refcount leak bug Date: Tue, 23 Aug 2022 10:02:57 +0200 Message-Id: <20220823080129.707182177@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 9d6d5303c39b8bc182475b22f45504106a07f086 ] In usbhs_rza1_hardware_init(), of_find_node_by_name() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore. Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220618023205.4056548-1-windhl@126.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/usb/renesas_usbhs/rza.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/renesas_usbhs/rza.c b/drivers/usb/renesas_usbhs/rz= a.c index 24de64edb674..2d77edefb4b3 100644 --- a/drivers/usb/renesas_usbhs/rza.c +++ b/drivers/usb/renesas_usbhs/rza.c @@ -23,6 +23,10 @@ static int usbhs_rza1_hardware_init(struct platform_devi= ce *pdev) extal_clk =3D of_find_node_by_name(NULL, "extal"); of_property_read_u32(usb_x1_clk, "clock-frequency", &freq_usb); of_property_read_u32(extal_clk, "clock-frequency", &freq_extal); + + of_node_put(usb_x1_clk); + of_node_put(extal_clk); + if (freq_usb =3D=3D 0) { if (freq_extal =3D=3D 12000000) { /* Select 12MHz XTAL */ --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A663AC32774 for ; Tue, 23 Aug 2022 10:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353998AbiHWKT3 (ORCPT ); Tue, 23 Aug 2022 06:19:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352715AbiHWKIf (ORCPT ); Tue, 23 Aug 2022 06:08:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0D696DFA0; Tue, 23 Aug 2022 01:54:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 30426B81C52; Tue, 23 Aug 2022 08:30:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94FD6C433C1; Tue, 23 Aug 2022 08:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243435; bh=GeThJzFrqkRHTkXVI2SvRYQqWDZBlcG4+458WQ8cWxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hncDgs3baYvmwJud0bd57IZ+efjGFk8HeSxa+Ab2Erxvm85WWRz1psl14zfavv5Yg fQaQrl0Y5XphZdEwmADZ5rBboy2EsGyNM465hvzD1/FYSDWQuqOXRBpWPe/pmgFvWb MFDZvHQ6YxOh2ITJVurAHelHBKabr2EojhzSCbQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nilesh Javali , Lee Duncan , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 277/365] scsi: iscsi: Fix HW conn removal use after free Date: Tue, 23 Aug 2022 10:02:58 +0200 Message-Id: <20220823080129.750454635@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Christie [ Upstream commit c577ab7ba5f3bf9062db8a58b6e89d4fe370447e ] If qla4xxx doesn't remove the connection before the session, the iSCSI class tries to remove the connection for it. We were doing a iscsi_put_conn() in the iter function which is not needed and will result in a use after free because iscsi_remove_conn() will free the connection. Link: https://lore.kernel.org/r/20220616222738.5722-2-michael.christie@orac= le.com Tested-by: Nilesh Javali Reviewed-by: Lee Duncan Reviewed-by: Nilesh Javali Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/scsi/scsi_transport_iscsi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transp= ort_iscsi.c index 2a38cd2d24ef..02899e8849dd 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2143,8 +2143,6 @@ static int iscsi_iter_destroy_conn_fn(struct device *= dev, void *data) return 0; =20 iscsi_remove_conn(iscsi_dev_to_conn(dev)); - iscsi_put_conn(iscsi_dev_to_conn(dev)); - return 0; } =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 281ECC3F6B0 for ; Tue, 23 Aug 2022 09:11:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348626AbiHWJKf (ORCPT ); Tue, 23 Aug 2022 05:10:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240882AbiHWJJU (ORCPT ); Tue, 23 Aug 2022 05:09:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04A0C868AE; Tue, 23 Aug 2022 01:30:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5E05AB81C57; Tue, 23 Aug 2022 08:30:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9762EC433D7; Tue, 23 Aug 2022 08:30:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243438; bh=j2KoHzmv7mNAD0mAEpA0x+P63+btGz4TXSLAu6PoG78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=suDVOI6txxvCQSzwg1TUqBJ6rUENr70AJ6kCsGqtv7DO0OUxVXqOWNbpAIam9xrc8 GEFfP8urpQ/ixjuOzmroMhNfdkQSVZX3yAyv+qKpviLdGlDe1ypp8j1TO7yv5IpXMr AKXWTO4kKHzf4DmkXUyhoMRabO4vqowRsDpcmBBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Minas Harutyunyan , Amelie Delaunay , Fabrice Gasnier , Sasha Levin Subject: [PATCH 5.19 278/365] usb: dwc2: gadget: remove D+ pull-up while no vbus with usb-role-switch Date: Tue, 23 Aug 2022 10:02:59 +0200 Message-Id: <20220823080129.796689734@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Amelie Delaunay [ Upstream commit db638c6500abaffb8f7770b2a69c40d003d54ae1 ] When using usb-role-switch, D+ pull-up is set as soon as DTCL_SFTDISCON is cleared, whatever the vbus valid signal state is. The pull-up should not be set when vbus isn't present (this is determined by the drd controller). This patch ensures that B-Session (so Peripheral role + vbus valid signal) is valid before clearing the DCTL_SFTDISCON bit when role switch is used. Keep original behavior when usb-role-switch isn't used. Acked-by: Minas Harutyunyan Signed-off-by: Amelie Delaunay Signed-off-by: Fabrice Gasnier Link: https://lore.kernel.org/r/20220622160717.314580-1-fabrice.gasnier@fos= s.st.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/usb/dwc2/gadget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index fe2a58c75861..8b15742d9e8a 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3594,7 +3594,8 @@ void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hs= otg) void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg) { /* remove the soft-disconnect and let's go */ - dwc2_clear_bit(hsotg, DCTL, DCTL_SFTDISCON); + if (!hsotg->role_sw || (dwc2_readl(hsotg, GOTGCTL) & GOTGCTL_BSESVLD)) + dwc2_clear_bit(hsotg, DCTL, DCTL_SFTDISCON); } =20 /** --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 406B3C32772 for ; Tue, 23 Aug 2022 09:13:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239207AbiHWJLj (ORCPT ); Tue, 23 Aug 2022 05:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347573AbiHWJJW (ORCPT ); Tue, 23 Aug 2022 05:09:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F0D074DE7; Tue, 23 Aug 2022 01:30:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D22EC6148E; Tue, 23 Aug 2022 08:30:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0D11C433D6; Tue, 23 Aug 2022 08:30:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243441; bh=zuynUB4qvXHwuhHt93KM7PDIxN+C9d44hf1QyZClopY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b0MQ4AEURpDx6h5I3+0r/tPnlPrhJ6Kp7RLYSOV7jn2URfysZ5/vNc6RnFurksURb b6IgMNRlvefYJZELsGLncetxYdc8wfgCxr9S9ycj10ZLOXHmN9XinhTSN1xQzfGZgL 6HEfcQ+bj9taXEcRF2jsdp4eyum2P+QH8pC2TQcg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Pascal Terjan , Sasha Levin Subject: [PATCH 5.19 279/365] vboxguest: Do not use devm for irq Date: Tue, 23 Aug 2022 10:03:00 +0200 Message-Id: <20220823080129.845516787@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pascal Terjan [ Upstream commit 6169525b76764acb81918aa387ac168fb9a55575 ] When relying on devm it doesn't get freed early enough which causes the following warning when unloading the module: [249348.837181] remove_proc_entry: removing non-empty directory 'irq/20', l= eaking at least 'vboxguest' [249348.837219] WARNING: CPU: 0 PID: 6708 at fs/proc/generic.c:715 remove_p= roc_entry+0x119/0x140 [249348.837379] Call Trace: [249348.837385] unregister_irq_proc+0xbd/0xe0 [249348.837392] free_desc+0x23/0x60 [249348.837396] irq_free_descs+0x4a/0x70 [249348.837401] irq_domain_free_irqs+0x160/0x1a0 [249348.837452] mp_unmap_irq+0x5c/0x60 [249348.837458] acpi_unregister_gsi_ioapic+0x29/0x40 [249348.837463] acpi_unregister_gsi+0x17/0x30 [249348.837467] acpi_pci_irq_disable+0xbf/0xe0 [249348.837473] pcibios_disable_device+0x20/0x30 [249348.837478] pci_disable_device+0xef/0x120 [249348.837482] vbg_pci_remove+0x6c/0x70 [vboxguest] Reviewed-by: Hans de Goede Signed-off-by: Pascal Terjan Link: https://lore.kernel.org/r/20220612133744.4030602-1-pterjan@google.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/virt/vboxguest/vboxguest_linux.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/virt/vboxguest/vboxguest_linux.c b/drivers/virt/vboxgu= est/vboxguest_linux.c index 73eb34849eab..4ccfd30c2a30 100644 --- a/drivers/virt/vboxguest/vboxguest_linux.c +++ b/drivers/virt/vboxguest/vboxguest_linux.c @@ -356,8 +356,8 @@ static int vbg_pci_probe(struct pci_dev *pci, const str= uct pci_device_id *id) goto err_vbg_core_exit; } =20 - ret =3D devm_request_irq(dev, pci->irq, vbg_core_isr, IRQF_SHARED, - DEVICE_NAME, gdev); + ret =3D request_irq(pci->irq, vbg_core_isr, IRQF_SHARED, DEVICE_NAME, + gdev); if (ret) { vbg_err("vboxguest: Error requesting irq: %d\n", ret); goto err_vbg_core_exit; @@ -367,7 +367,7 @@ static int vbg_pci_probe(struct pci_dev *pci, const str= uct pci_device_id *id) if (ret) { vbg_err("vboxguest: Error misc_register %s failed: %d\n", DEVICE_NAME, ret); - goto err_vbg_core_exit; + goto err_free_irq; } =20 ret =3D misc_register(&gdev->misc_device_user); @@ -403,6 +403,8 @@ static int vbg_pci_probe(struct pci_dev *pci, const str= uct pci_device_id *id) misc_deregister(&gdev->misc_device_user); err_unregister_misc_device: misc_deregister(&gdev->misc_device); +err_free_irq: + free_irq(pci->irq, gdev); err_vbg_core_exit: vbg_core_exit(gdev); err_disable_pcidev: @@ -419,6 +421,7 @@ static void vbg_pci_remove(struct pci_dev *pci) vbg_gdev =3D NULL; mutex_unlock(&vbg_gdev_mutex); =20 + free_irq(pci->irq, gdev); device_remove_file(gdev->dev, &dev_attr_host_features); device_remove_file(gdev->dev, &dev_attr_host_version); misc_deregister(&gdev->misc_device_user); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F2B9C32792 for ; Tue, 23 Aug 2022 09:13:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349363AbiHWJLw (ORCPT ); Tue, 23 Aug 2022 05:11:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348119AbiHWJJ1 (ORCPT ); Tue, 23 Aug 2022 05:09:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8B17868B5; Tue, 23 Aug 2022 01:30:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1835B61488; Tue, 23 Aug 2022 08:30:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1003FC433D6; Tue, 23 Aug 2022 08:30:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243444; bh=0SRfYvpbI5vP3rsuSx3MCV1WVj9+zFGLzEe2YE+I6kY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CnLT4qy1MOYyUifs9mC/+EiSkVp7WM+NvsCgV46INoDhUBQf5IA1qw2NQ5KJSwK7B syLJxfbME47Y0bPs8ug/u5Ivx5vkssmGqvQx4wzVlZ2H0d9ChK1ZkJO9jmxgDeAI7e Gzhk5FBqFLHXLTc40ENeK0U9Hg7bkgRpvDZt5Ptg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.19 280/365] clk: qcom: ipq8074: dont disable gcc_sleep_clk_src Date: Tue, 23 Aug 2022 10:03:01 +0200 Message-Id: <20220823080129.889393111@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Marko [ Upstream commit 1bf7305e79aab095196131bdc87a97796e0e3fac ] Once the usb sleep clocks are disabled, clock framework is trying to disable the sleep clock source also. However, it seems that it cannot be disabled and trying to do so produces: [ 245.436390] ------------[ cut here ]------------ [ 245.441233] gcc_sleep_clk_src status stuck at 'on' [ 245.441254] WARNING: CPU: 2 PID: 223 at clk_branch_wait+0x130/0x140 [ 245.450435] Modules linked in: xhci_plat_hcd xhci_hcd dwc3 dwc3_qcom led= s_gpio [ 245.456601] CPU: 2 PID: 223 Comm: sh Not tainted 5.18.0-rc4 #215 [ 245.463889] Hardware name: Xiaomi AX9000 (DT) [ 245.470050] pstate: 204000c5 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE= =3D--) [ 245.474307] pc : clk_branch_wait+0x130/0x140 [ 245.481073] lr : clk_branch_wait+0x130/0x140 [ 245.485588] sp : ffffffc009f2bad0 [ 245.489838] x29: ffffffc009f2bad0 x28: ffffff8003e6c800 x27: 00000000000= 00000 [ 245.493057] x26: 0000000000000000 x25: 0000000000000000 x24: ffffff80022= 6ef20 [ 245.500175] x23: ffffffc0089ff550 x22: 0000000000000000 x21: ffffffc0084= 76ad0 [ 245.507294] x20: 0000000000000000 x19: ffffffc00965ac70 x18: fffffffffff= c51a7 [ 245.514413] x17: 68702e3030303837 x16: 3a6d726f6674616c x15: ffffffc089f= 2b777 [ 245.521531] x14: ffffffc0095c9d18 x13: 0000000000000129 x12: 00000000000= 00129 [ 245.528649] x11: 00000000ffffffea x10: ffffffc009621d18 x9 : 00000000000= 00001 [ 245.535767] x8 : 0000000000000001 x7 : 0000000000017fe8 x6 : 00000000000= 00001 [ 245.542885] x5 : ffffff803fdca6d8 x4 : 0000000000000000 x3 : 00000000000= 00027 [ 245.550002] x2 : 0000000000000027 x1 : 0000000000000023 x0 : 00000000000= 00026 [ 245.557122] Call trace: [ 245.564229] clk_branch_wait+0x130/0x140 [ 245.566490] clk_branch2_disable+0x2c/0x40 [ 245.570656] clk_core_disable+0x60/0xb0 [ 245.574561] clk_core_disable+0x68/0xb0 [ 245.578293] clk_disable+0x30/0x50 [ 245.582113] dwc3_qcom_remove+0x60/0xc0 [dwc3_qcom] [ 245.585588] platform_remove+0x28/0x60 [ 245.590361] device_remove+0x4c/0x80 [ 245.594179] device_release_driver_internal+0x1dc/0x230 [ 245.597914] device_driver_detach+0x18/0x30 [ 245.602861] unbind_store+0xec/0x110 [ 245.607027] drv_attr_store+0x24/0x40 [ 245.610847] sysfs_kf_write+0x44/0x60 [ 245.614405] kernfs_fop_write_iter+0x128/0x1c0 [ 245.618052] new_sync_write+0xc0/0x130 [ 245.622391] vfs_write+0x1d4/0x2a0 [ 245.626123] ksys_write+0x58/0xe0 [ 245.629508] __arm64_sys_write+0x1c/0x30 [ 245.632895] invoke_syscall.constprop.0+0x5c/0x110 [ 245.636890] do_el0_svc+0xa0/0x150 [ 245.641488] el0_svc+0x18/0x60 [ 245.644872] el0t_64_sync_handler+0xa4/0x130 [ 245.647914] el0t_64_sync+0x174/0x178 [ 245.652340] ---[ end trace 0000000000000000 ]--- So, add CLK_IS_CRITICAL flag to the clock so that the kernel won't try to disable the sleep clock. Signed-off-by: Robert Marko Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220515210048.483898-10-robimarko@gmail.com Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-ipq8074.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c index 2c2ecfc5e61f..d6d5defb82c9 100644 --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c @@ -662,6 +662,7 @@ static struct clk_branch gcc_sleep_clk_src =3D { }, .num_parents =3D 1, .ops =3D &clk_branch2_ops, + .flags =3D CLK_IS_CRITICAL, }, }, }; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E6A2C32772 for ; Tue, 23 Aug 2022 09:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244784AbiHWJOc (ORCPT ); Tue, 23 Aug 2022 05:14:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345521AbiHWJLj (ORCPT ); Tue, 23 Aug 2022 05:11:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9482B74E38; Tue, 23 Aug 2022 01:31:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6A00361257; Tue, 23 Aug 2022 08:30:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D94FC433D6; Tue, 23 Aug 2022 08:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243447; bh=3xZlcqcY7As5SwP5sXERZGwcOsecnXQsdVdV8Xder8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hqDdaCSqWybKIHnyy169JjWjSbVqjaFRiy/cRkdDoj8mxyz03gDEQFtld8ApYk9fw +/mwKaBTGS8ytt3EGnhc4tfbereSfd54O+ytRwEF1FuA69xFqelm9iaNuEq3Zoqr6l V7l1f/clxkfijtlfpza2WkhiYkyj6odBFOe+Fe8I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Shen , Zhangfei Gao , Jean-Philippe Brucker , Sasha Levin Subject: [PATCH 5.19 281/365] uacce: Handle parent device removal or parent driver module rmmod Date: Tue, 23 Aug 2022 10:03:02 +0200 Message-Id: <20220823080129.929430788@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jean-Philippe Brucker [ Upstream commit 80fc671bcc0173836e9032b0c698ea74c13b9d7c ] The uacce driver must deal with a possible removal of the parent device or parent driver module rmmod at any time. Although uacce_remove(), called on device removal and on driver unbind, prevents future use of the uacce fops by removing the cdev, fops that were called before that point may still be running. Serialize uacce_fops_open() and uacce_remove() with uacce->mutex. Serialize other fops against uacce_remove() with q->mutex. Since we need to protect uacce_fops_poll() which gets called on the fast path, replace uacce->queues_lock with q->mutex to improve scalability. The other fops are only used during setup. uacce_queue_is_valid(), checked under q->mutex or uacce->mutex, denotes whether uacce_remove() has disabled all queues. If that is the case, don't go any further since the parent device is being removed and uacce->ops should not be called anymore. Reported-by: Yang Shen Signed-off-by: Zhangfei Gao Signed-off-by: Jean-Philippe Brucker Link: https://lore.kernel.org/r/20220701034843.7502-1-zhangfei.gao@linaro.o= rg Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/misc/uacce/uacce.c | 133 ++++++++++++++++++++++++------------- include/linux/uacce.h | 6 +- 2 files changed, 91 insertions(+), 48 deletions(-) diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c index 281c54003edc..b70a013139c7 100644 --- a/drivers/misc/uacce/uacce.c +++ b/drivers/misc/uacce/uacce.c @@ -9,43 +9,38 @@ =20 static struct class *uacce_class; static dev_t uacce_devt; -static DEFINE_MUTEX(uacce_mutex); static DEFINE_XARRAY_ALLOC(uacce_xa); =20 -static int uacce_start_queue(struct uacce_queue *q) +/* + * If the parent driver or the device disappears, the queue state is inval= id and + * ops are not usable anymore. + */ +static bool uacce_queue_is_valid(struct uacce_queue *q) { - int ret =3D 0; + return q->state =3D=3D UACCE_Q_INIT || q->state =3D=3D UACCE_Q_STARTED; +} =20 - mutex_lock(&uacce_mutex); +static int uacce_start_queue(struct uacce_queue *q) +{ + int ret; =20 - if (q->state !=3D UACCE_Q_INIT) { - ret =3D -EINVAL; - goto out_with_lock; - } + if (q->state !=3D UACCE_Q_INIT) + return -EINVAL; =20 if (q->uacce->ops->start_queue) { ret =3D q->uacce->ops->start_queue(q); if (ret < 0) - goto out_with_lock; + return ret; } =20 q->state =3D UACCE_Q_STARTED; - -out_with_lock: - mutex_unlock(&uacce_mutex); - - return ret; + return 0; } =20 static int uacce_put_queue(struct uacce_queue *q) { struct uacce_device *uacce =3D q->uacce; =20 - mutex_lock(&uacce_mutex); - - if (q->state =3D=3D UACCE_Q_ZOMBIE) - goto out; - if ((q->state =3D=3D UACCE_Q_STARTED) && uacce->ops->stop_queue) uacce->ops->stop_queue(q); =20 @@ -54,8 +49,6 @@ static int uacce_put_queue(struct uacce_queue *q) uacce->ops->put_queue(q); =20 q->state =3D UACCE_Q_ZOMBIE; -out: - mutex_unlock(&uacce_mutex); =20 return 0; } @@ -65,20 +58,36 @@ static long uacce_fops_unl_ioctl(struct file *filep, { struct uacce_queue *q =3D filep->private_data; struct uacce_device *uacce =3D q->uacce; + long ret =3D -ENXIO; + + /* + * uacce->ops->ioctl() may take the mmap_lock when copying arg to/from + * user. Avoid a circular lock dependency with uacce_fops_mmap(), which + * gets called with mmap_lock held, by taking uacce->mutex instead of + * q->mutex. Doing this in uacce_fops_mmap() is not possible because + * uacce_fops_open() calls iommu_sva_bind_device(), which takes + * mmap_lock, while holding uacce->mutex. + */ + mutex_lock(&uacce->mutex); + if (!uacce_queue_is_valid(q)) + goto out_unlock; =20 switch (cmd) { case UACCE_CMD_START_Q: - return uacce_start_queue(q); - + ret =3D uacce_start_queue(q); + break; case UACCE_CMD_PUT_Q: - return uacce_put_queue(q); - + ret =3D uacce_put_queue(q); + break; default: - if (!uacce->ops->ioctl) - return -EINVAL; - - return uacce->ops->ioctl(q, cmd, arg); + if (uacce->ops->ioctl) + ret =3D uacce->ops->ioctl(q, cmd, arg); + else + ret =3D -EINVAL; } +out_unlock: + mutex_unlock(&uacce->mutex); + return ret; } =20 #ifdef CONFIG_COMPAT @@ -136,6 +145,13 @@ static int uacce_fops_open(struct inode *inode, struct= file *filep) if (!q) return -ENOMEM; =20 + mutex_lock(&uacce->mutex); + + if (!uacce->parent) { + ret =3D -EINVAL; + goto out_with_mem; + } + ret =3D uacce_bind_queue(uacce, q); if (ret) goto out_with_mem; @@ -152,10 +168,9 @@ static int uacce_fops_open(struct inode *inode, struct= file *filep) filep->private_data =3D q; uacce->inode =3D inode; q->state =3D UACCE_Q_INIT; - - mutex_lock(&uacce->queues_lock); + mutex_init(&q->mutex); list_add(&q->list, &uacce->queues); - mutex_unlock(&uacce->queues_lock); + mutex_unlock(&uacce->mutex); =20 return 0; =20 @@ -163,18 +178,20 @@ static int uacce_fops_open(struct inode *inode, struc= t file *filep) uacce_unbind_queue(q); out_with_mem: kfree(q); + mutex_unlock(&uacce->mutex); return ret; } =20 static int uacce_fops_release(struct inode *inode, struct file *filep) { struct uacce_queue *q =3D filep->private_data; + struct uacce_device *uacce =3D q->uacce; =20 - mutex_lock(&q->uacce->queues_lock); - list_del(&q->list); - mutex_unlock(&q->uacce->queues_lock); + mutex_lock(&uacce->mutex); uacce_put_queue(q); uacce_unbind_queue(q); + list_del(&q->list); + mutex_unlock(&uacce->mutex); kfree(q); =20 return 0; @@ -217,10 +234,9 @@ static int uacce_fops_mmap(struct file *filep, struct = vm_area_struct *vma) vma->vm_private_data =3D q; qfr->type =3D type; =20 - mutex_lock(&uacce_mutex); - - if (q->state !=3D UACCE_Q_INIT && q->state !=3D UACCE_Q_STARTED) { - ret =3D -EINVAL; + mutex_lock(&q->mutex); + if (!uacce_queue_is_valid(q)) { + ret =3D -ENXIO; goto out_with_lock; } =20 @@ -248,12 +264,12 @@ static int uacce_fops_mmap(struct file *filep, struct= vm_area_struct *vma) } =20 q->qfrs[type] =3D qfr; - mutex_unlock(&uacce_mutex); + mutex_unlock(&q->mutex); =20 return ret; =20 out_with_lock: - mutex_unlock(&uacce_mutex); + mutex_unlock(&q->mutex); kfree(qfr); return ret; } @@ -262,12 +278,20 @@ static __poll_t uacce_fops_poll(struct file *file, po= ll_table *wait) { struct uacce_queue *q =3D file->private_data; struct uacce_device *uacce =3D q->uacce; + __poll_t ret =3D 0; + + mutex_lock(&q->mutex); + if (!uacce_queue_is_valid(q)) + goto out_unlock; =20 poll_wait(file, &q->wait, wait); + if (uacce->ops->is_q_updated && uacce->ops->is_q_updated(q)) - return EPOLLIN | EPOLLRDNORM; + ret =3D EPOLLIN | EPOLLRDNORM; =20 - return 0; +out_unlock: + mutex_unlock(&q->mutex); + return ret; } =20 static const struct file_operations uacce_fops =3D { @@ -450,7 +474,7 @@ struct uacce_device *uacce_alloc(struct device *parent, goto err_with_uacce; =20 INIT_LIST_HEAD(&uacce->queues); - mutex_init(&uacce->queues_lock); + mutex_init(&uacce->mutex); device_initialize(&uacce->dev); uacce->dev.devt =3D MKDEV(MAJOR(uacce_devt), uacce->dev_id); uacce->dev.class =3D uacce_class; @@ -507,13 +531,23 @@ void uacce_remove(struct uacce_device *uacce) if (uacce->inode) unmap_mapping_range(uacce->inode->i_mapping, 0, 0, 1); =20 + /* + * uacce_fops_open() may be running concurrently, even after we remove + * the cdev. Holding uacce->mutex ensures that open() does not obtain a + * removed uacce device. + */ + mutex_lock(&uacce->mutex); /* ensure no open queue remains */ - mutex_lock(&uacce->queues_lock); list_for_each_entry_safe(q, next_q, &uacce->queues, list) { + /* + * Taking q->mutex ensures that fops do not use the defunct + * uacce->ops after the queue is disabled. + */ + mutex_lock(&q->mutex); uacce_put_queue(q); + mutex_unlock(&q->mutex); uacce_unbind_queue(q); } - mutex_unlock(&uacce->queues_lock); =20 /* disable sva now since no opened queues */ uacce_disable_sva(uacce); @@ -521,6 +555,13 @@ void uacce_remove(struct uacce_device *uacce) if (uacce->cdev) cdev_device_del(uacce->cdev, &uacce->dev); xa_erase(&uacce_xa, uacce->dev_id); + /* + * uacce exists as long as there are open fds, but ops will be freed + * now. Ensure that bugs cause NULL deref rather than use-after-free. + */ + uacce->ops =3D NULL; + uacce->parent =3D NULL; + mutex_unlock(&uacce->mutex); put_device(&uacce->dev); } EXPORT_SYMBOL_GPL(uacce_remove); diff --git a/include/linux/uacce.h b/include/linux/uacce.h index 48e319f40275..9ce88c28b0a8 100644 --- a/include/linux/uacce.h +++ b/include/linux/uacce.h @@ -70,6 +70,7 @@ enum uacce_q_state { * @wait: wait queue head * @list: index into uacce queues list * @qfrs: pointer of qfr regions + * @mutex: protects queue state * @state: queue state machine * @pasid: pasid associated to the mm * @handle: iommu_sva handle returned by iommu_sva_bind_device() @@ -80,6 +81,7 @@ struct uacce_queue { wait_queue_head_t wait; struct list_head list; struct uacce_qfile_region *qfrs[UACCE_MAX_REGION]; + struct mutex mutex; enum uacce_q_state state; u32 pasid; struct iommu_sva *handle; @@ -97,9 +99,9 @@ struct uacce_queue { * @dev_id: id of the uacce device * @cdev: cdev of the uacce * @dev: dev of the uacce + * @mutex: protects uacce operation * @priv: private pointer of the uacce * @queues: list of queues - * @queues_lock: lock for queues list * @inode: core vfs */ struct uacce_device { @@ -113,9 +115,9 @@ struct uacce_device { u32 dev_id; struct cdev *cdev; struct device dev; + struct mutex mutex; void *priv; struct list_head queues; - struct mutex queues_lock; struct inode *inode; }; =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A46BC32772 for ; Tue, 23 Aug 2022 09:16:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349231AbiHWJO6 (ORCPT ); Tue, 23 Aug 2022 05:14:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349149AbiHWJLR (ORCPT ); Tue, 23 Aug 2022 05:11:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB41C66A6E; Tue, 23 Aug 2022 01:31:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 976FF61338; Tue, 23 Aug 2022 08:30:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C710C433C1; Tue, 23 Aug 2022 08:30:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243451; bh=g8DqRUnEJ1CxvVsgj9EkQ/vTlZZXVk/+ZnUNVFzMwU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0zOcLC8YOu/RS3e1yUSccPXXYzCr07bG3VtAbQoJLOP6e9g5bBGFKossxNlO+n+HB fw4nS+2Nx70onNBDu9YwyXPvag7Erqp6GmUnUcCpKb36d+ZDoJejQFhfw4qrx/HvWa jhtEAidDqNrwAkjMT2EnY6pug9UNWDYsuKMgItSA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Senozhatsky , Minchan Kim , Nitin Gupta , Andrew Morton , Sasha Levin Subject: [PATCH 5.19 282/365] zram: do not lookup algorithm in backends table Date: Tue, 23 Aug 2022 10:03:03 +0200 Message-Id: <20220823080129.969722274@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergey Senozhatsky [ Upstream commit dc89997264de565999a1cb55db3f295d3a8e457b ] Always use crypto_has_comp() so that crypto can lookup module, call usermodhelper to load the modules, wait for usermodhelper to finish and so on. Otherwise crypto will do all of these steps under CPU hot-plug lock and this looks like too much stuff to handle under the CPU hot-plug lock. Besides this can end up in a deadlock when usermodhelper triggers a code path that attempts to lock the CPU hot-plug lock, that zram already holds. An example of such deadlock: - path A. zram grabs CPU hot-plug lock, execs /sbin/modprobe from crypto and waits for modprobe to finish disksize_store zcomp_create __cpuhp_state_add_instance __cpuhp_state_add_instance_cpuslocked zcomp_cpu_up_prepare crypto_alloc_base crypto_alg_mod_lookup call_usermodehelper_exec wait_for_completion_killable do_wait_for_common schedule - path B. async work kthread that brings in scsi device. It wants to register CPUHP states at some point, and it needs the CPU hot-plug lock for that, which is owned by zram. async_run_entry_fn scsi_probe_and_add_lun scsi_mq_alloc_queue blk_mq_init_queue blk_mq_init_allocated_queue blk_mq_realloc_hw_ctxs __cpuhp_state_add_instance __cpuhp_state_add_instance_cpuslocked mutex_lock schedule - path C. modprobe sleeps, waiting for all aync works to finish. load_module do_init_module async_synchronize_full async_synchronize_cookie_domain schedule [senozhatsky@chromium.org: add comment] Link: https://lkml.kernel.org/r/20220624060606.1014474-1-senozhatsky@chro= mium.org Link: https://lkml.kernel.org/r/20220622023501.517125-1-senozhatsky@chromiu= m.org Signed-off-by: Sergey Senozhatsky Cc: Minchan Kim Cc: Nitin Gupta Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/block/zram/zcomp.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c index 052aa3f65514..0916de952e09 100644 --- a/drivers/block/zram/zcomp.c +++ b/drivers/block/zram/zcomp.c @@ -63,12 +63,6 @@ static int zcomp_strm_init(struct zcomp_strm *zstrm, str= uct zcomp *comp) =20 bool zcomp_available_algorithm(const char *comp) { - int i; - - i =3D sysfs_match_string(backends, comp); - if (i >=3D 0) - return true; - /* * Crypto does not ignore a trailing new line symbol, * so make sure you don't supply a string containing @@ -217,6 +211,11 @@ struct zcomp *zcomp_create(const char *compress) struct zcomp *comp; int error; =20 + /* + * Crypto API will execute /sbin/modprobe if the compression module + * is not loaded yet. We must do it here, otherwise we are about to + * call /sbin/modprobe under CPU hot-plug lock. + */ if (!zcomp_available_algorithm(compress)) return ERR_PTR(-EINVAL); =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B76E5C32772 for ; Tue, 23 Aug 2022 09:16:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349191AbiHWJOu (ORCPT ); Tue, 23 Aug 2022 05:14:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349061AbiHWJLJ (ORCPT ); Tue, 23 Aug 2022 05:11:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1A8974E10; Tue, 23 Aug 2022 01:31:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 93A6D6148E; Tue, 23 Aug 2022 08:30:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C17CC433C1; Tue, 23 Aug 2022 08:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243454; bh=G2K9/tvgzYCsdb49HzRkvEhTlNWWJDNeuDTwoROSywg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X3wc+hB08ue3tH/ZJFTojNt4XKLsWwa82dlRAAVLUnU8J/EeB2bOKQGM0Ep8MhCmq L55DLDYG0e8ItmrecMyXOqMEQZ2/XUN8hQbcbyT4+lDoE70EvVbdQVL1jrlj7WZhqi JRZ/9uJEaPsAqNbmYR2utW0elNARlTu9+VdILNqo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Boyd , Vinod Koul , Vladimir Zapolskiy , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.19 283/365] clk: qcom: clk-alpha-pll: fix clk_trion_pll_configure description Date: Tue, 23 Aug 2022 10:03:04 +0200 Message-Id: <20220823080130.010599436@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Zapolskiy [ Upstream commit 94bed9bb05c7850ff5d80b87cc29004901f37956 ] After merging lucid and trion pll functions in commit 0b01489475c6 ("clk: qcom: clk-alpha-pll: same regs and ops for trion and lucid") the function clk_trion_pll_configure() is left with an old description header, which results in a W=3D2 compile time warning, fix it. Acked-by: Stephen Boyd Reviewed-by: Vinod Koul Signed-off-by: Vladimir Zapolskiy Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220701062711.2757855-1-vladimir.zapolskiy= @linaro.org Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/clk/qcom/clk-alpha-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-= pll.c index 4406cf609aae..288692f0ea39 100644 --- a/drivers/clk/qcom/clk-alpha-pll.c +++ b/drivers/clk/qcom/clk-alpha-pll.c @@ -1439,7 +1439,7 @@ const struct clk_ops clk_alpha_pll_postdiv_fabia_ops = =3D { EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_fabia_ops); =20 /** - * clk_lucid_pll_configure - configure the lucid pll + * clk_trion_pll_configure - configure the trion pll * * @pll: clk alpha pll * @regmap: register map --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BAF8C32772 for ; Tue, 23 Aug 2022 09:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348616AbiHWJOX (ORCPT ); Tue, 23 Aug 2022 05:14:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349098AbiHWJLL (ORCPT ); Tue, 23 Aug 2022 05:11:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40B17286D5; Tue, 23 Aug 2022 01:31:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E4EC6132D; Tue, 23 Aug 2022 08:31:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8281FC433D6; Tue, 23 Aug 2022 08:30:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243459; bh=cFQps2UgGzKfxxucgJAhHcyTCzeTMbAGguhyK1OacKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWF1Z9nhrRlE6ZAXegC8VGI0H8NWto1hBTRZV/TIZMNltDrWskq9wuxAGEgMg+Mcn w/wNCxJaVBdcv+6CkmIlD+p151jLkIbtxBdB/CyQ6GyBlCGop3dhq6I5w+r2rHbZyr ELljfYUD62v/s/MbEumOMBiTvipS6XLKLI7pE77M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 284/365] scsi: lpfc: Prevent buffer overflow crashes in debugfs with malformed user input Date: Tue, 23 Aug 2022 10:03:05 +0200 Message-Id: <20220823080130.060142264@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit f8191d40aa612981ce897e66cda6a88db8df17bb ] Malformed user input to debugfs results in buffer overflow crashes. Adapt input string lengths to fit within internal buffers, leaving space for NULL terminators. Link: https://lore.kernel.org/r/20220701211425.2708-3-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/scsi/lpfc/lpfc_debugfs.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debu= gfs.c index 7b24c932e812..25deacc92b02 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -2607,8 +2607,8 @@ lpfc_debugfs_multixripools_write(struct file *file, c= onst char __user *buf, struct lpfc_sli4_hdw_queue *qp; struct lpfc_multixri_pool *multixri_pool; =20 - if (nbytes > 64) - nbytes =3D 64; + if (nbytes > sizeof(mybuf) - 1) + nbytes =3D sizeof(mybuf) - 1; =20 memset(mybuf, 0, sizeof(mybuf)); =20 @@ -2688,8 +2688,8 @@ lpfc_debugfs_nvmestat_write(struct file *file, const = char __user *buf, if (!phba->targetport) return -ENXIO; =20 - if (nbytes > 64) - nbytes =3D 64; + if (nbytes > sizeof(mybuf) - 1) + nbytes =3D sizeof(mybuf) - 1; =20 memset(mybuf, 0, sizeof(mybuf)); =20 @@ -2826,8 +2826,8 @@ lpfc_debugfs_ioktime_write(struct file *file, const c= har __user *buf, char mybuf[64]; char *pbuf; =20 - if (nbytes > 64) - nbytes =3D 64; + if (nbytes > sizeof(mybuf) - 1) + nbytes =3D sizeof(mybuf) - 1; =20 memset(mybuf, 0, sizeof(mybuf)); =20 @@ -2954,8 +2954,8 @@ lpfc_debugfs_nvmeio_trc_write(struct file *file, cons= t char __user *buf, char mybuf[64]; char *pbuf; =20 - if (nbytes > 63) - nbytes =3D 63; + if (nbytes > sizeof(mybuf) - 1) + nbytes =3D sizeof(mybuf) - 1; =20 memset(mybuf, 0, sizeof(mybuf)); =20 @@ -3060,8 +3060,8 @@ lpfc_debugfs_hdwqstat_write(struct file *file, const = char __user *buf, char *pbuf; int i; =20 - if (nbytes > 64) - nbytes =3D 64; + if (nbytes > sizeof(mybuf) - 1) + nbytes =3D sizeof(mybuf) - 1; =20 memset(mybuf, 0, sizeof(mybuf)); =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25DF0C32772 for ; Tue, 23 Aug 2022 09:12:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243882AbiHWJMv (ORCPT ); Tue, 23 Aug 2022 05:12:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348501AbiHWJK2 (ORCPT ); Tue, 23 Aug 2022 05:10:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4D2574DEE; Tue, 23 Aug 2022 01:31:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89870614BC; Tue, 23 Aug 2022 08:31:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 795DFC433D6; Tue, 23 Aug 2022 08:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243463; bh=tOAIb5zAvN93JR+nNiVB/+65aJaN03Crd3NKqy/DKvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i0ArgVrC6F7ZwBNeCjSt2fbg2Sew6RhiBLH8ZnzZ7saWG9DN4NCbTc/2tia6IS1t1 JHEZp+IBFGXafZ8UqQr6aGizXmePXQZeDXZ4dOMGAL6vblfOyxuNN/qwn5evOCdKoM GGRV3LEe3hF1l1ziF2q/80ztfTGLapEVvNiupEUg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 285/365] scsi: lpfc: Fix possible memory leak when failing to issue CMF WQE Date: Tue, 23 Aug 2022 10:03:06 +0200 Message-Id: <20220823080130.108694170@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit 2f67dc7970bce3529edce93a0a14234d88b3fcd5 ] There is no corresponding free routine if lpfc_sli4_issue_wqe fails to issue the CMF WQE in lpfc_issue_cmf_sync_wqe. If ret_val is non-zero, then free the iocbq request structure. Link: https://lore.kernel.org/r/20220701211425.2708-6-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/scsi/lpfc/lpfc_sli.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 80ac3a051c19..e2127e85ff32 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -2003,10 +2003,12 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 = ms, u64 total) =20 sync_buf->cmd_flag |=3D LPFC_IO_CMF; ret_val =3D lpfc_sli4_issue_wqe(phba, &phba->sli4_hba.hdwq[0], sync_buf); - if (ret_val) + if (ret_val) { lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, "6214 Cannot issue CMF_SYNC_WQE: x%x\n", ret_val); + __lpfc_sli_release_iocbq(phba, sync_buf); + } out_unlock: spin_unlock_irqrestore(&phba->hbalock, iflags); return ret_val; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67121C32792 for ; Tue, 23 Aug 2022 09:12:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243359AbiHWJMf (ORCPT ); Tue, 23 Aug 2022 05:12:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348468AbiHWJKU (ORCPT ); Tue, 23 Aug 2022 05:10:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45A096CD3B; Tue, 23 Aug 2022 01:31:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EB5BB614CA; Tue, 23 Aug 2022 08:31:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6231C433C1; Tue, 23 Aug 2022 08:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243466; bh=QT4ELwD36/p5x2JGWEwyso4qQpwPkC03HMsNuMjrIMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d9j/R096LBHlVT9fh0kKf23cZ/08mLAjxoTnPw1pRAB4dQMHgMhceH3j4P/HbMjJT NFmMH8KWDLPE5LeHu9W5O4G2LZ/90axBrY9mbnMvUljTFz7jfqm2PDVOfCaL0wksdJ Z1ebGvJSviS7mM9eHG5WWHzLe/JBYHumShkJaC1M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jozef Martiniak , Sasha Levin Subject: [PATCH 5.19 286/365] gadgetfs: ep_io - wait until IRQ finishes Date: Tue, 23 Aug 2022 10:03:07 +0200 Message-Id: <20220823080130.159590630@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jozef Martiniak [ Upstream commit 04cb742d4d8f30dc2e83b46ac317eec09191c68e ] after usb_ep_queue() if wait_for_completion_interruptible() is interrupted we need to wait until IRQ gets finished. Otherwise complete() from epio_complete() can corrupt stack. Signed-off-by: Jozef Martiniak Link: https://lore.kernel.org/r/20220708070645.6130-1-jomajm@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/usb/gadget/legacy/inode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/= inode.c index 79990597c39f..01c3ead7d1b4 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c @@ -362,6 +362,7 @@ ep_io (struct ep_data *epdata, void *buf, unsigned len) spin_unlock_irq (&epdata->dev->lock); =20 DBG (epdata->dev, "endpoint gone\n"); + wait_for_completion(&done); epdata->status =3D -ENODEV; } } --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FBBDC32772 for ; Tue, 23 Aug 2022 09:15:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243556AbiHWJPQ (ORCPT ); Tue, 23 Aug 2022 05:15:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348671AbiHWJMW (ORCPT ); Tue, 23 Aug 2022 05:12:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F0796D576; Tue, 23 Aug 2022 01:31:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 19CF76147B; Tue, 23 Aug 2022 08:31:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 250DDC433C1; Tue, 23 Aug 2022 08:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243469; bh=mDDod5hoK9zUIp4GLrFxdxCIQSI8HzlisO5aPIIpYBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=weXUF9jGuxizLED8U2nYYGYAH8rBGyk4ZRrlil22bAqMKnWaqfs9mU6T9zHz7+a8c eR7Hl9u3JQNeqHLGVyfwqFpFhsjgQQeEO2+sJtSI4hyGU71H3Tj15M2X9v9sFhnxyz hGEzNZK/GJ5kR547Ua+vObm8HPNRmrU/nwLeyQHE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Tao Zhang , Nick Desaulniers , Arnd Bergmann , Suzuki K Poulose , Sasha Levin Subject: [PATCH 5.19 287/365] coresight: etm4x: avoid build failure with unrolled loops Date: Tue, 23 Aug 2022 10:03:08 +0200 Message-Id: <20220823080130.208107606@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nick Desaulniers [ Upstream commit 4d45bc82df667ad9e9cb8361830e54fc1264e993 ] When the following configs are enabled: * CORESIGHT * CORESIGHT_SOURCE_ETM4X * UBSAN * UBSAN_TRAP Clang fails assemble the kernel with the error: :1:7: error: expected constant expression in '.inst' directi= ve .inst (0xd5200000|((((2) << 19) | ((1) << 16) | (((((((((((0x160 + (i * 4))= ))) >> 2))) >> 7) & 0x7)) << 12) | ((((((((((0x160 + (i * 4))))) >> 2))) & = 0xf)) << 8) | (((((((((((0x160 + (i * 4))))) >> 2))) >> 4) & 0x7)) << 5)))|= (.L__reg_num_x8)) ^ drivers/hwtracing/coresight/coresight-etm4x-core.c:702:4: note: while in macro instantiation etm4x_relaxed_read32(csa, TRCCNTVRn(i)); ^ drivers/hwtracing/coresight/coresight-etm4x.h:403:4: note: expanded from macro 'etm4x_relaxed_read32' read_etm4x_sysreg_offset((offset), false))) ^ drivers/hwtracing/coresight/coresight-etm4x.h:383:12: note: expanded from macro 'read_etm4x_sysreg_offset' __val =3D read_etm4x_sysreg_const_offset((offset)); \ ^ drivers/hwtracing/coresight/coresight-etm4x.h:149:2: note: expanded from macro 'read_etm4x_sysreg_const_offset' READ_ETM4x_REG(ETM4x_OFFSET_TO_REG(offset)) ^ drivers/hwtracing/coresight/coresight-etm4x.h:144:2: note: expanded from macro 'READ_ETM4x_REG' read_sysreg_s(ETM4x_REG_NUM_TO_SYSREG((reg))) ^ arch/arm64/include/asm/sysreg.h:1108:15: note: expanded from macro 'read_sysreg_s' asm volatile(__mrs_s("%0", r) : "=3Dr" (__val)); \ ^ arch/arm64/include/asm/sysreg.h:1074:2: note: expanded from macro '__mrs_s' " mrs_s " v ", " __stringify(r) "\n" \ ^ Consider the definitions of TRCSSCSRn and TRCCNTVRn: drivers/hwtracing/coresight/coresight-etm4x.h:56 #define TRCCNTVRn(n) (0x160 + (n * 4)) drivers/hwtracing/coresight/coresight-etm4x.h:81 #define TRCSSCSRn(n) (0x2A0 + (n * 4)) Where the macro parameter is expanded to i; a loop induction variable from etm4_disable_hw. When any compiler can determine that loops may be unrolled, then the __builtin_constant_p check in read_etm4x_sysreg_offset() defined in drivers/hwtracing/coresight/coresight-etm4x.h may evaluate to true. This can lead to the expression `(0x160 + (i * 4))` being passed to read_etm4x_sysreg_const_offset. Via the trace above, this is passed through READ_ETM4x_REG, read_sysreg_s, and finally to __mrs_s where it is string-ified and used directly in inline asm. Regardless of which compiler or compiler options determine whether a loop can or can't be unrolled, which determines whether __builtin_constant_p evaluates to true when passed an expression using a loop induction variable, it is NEVER safe to allow the preprocessor to construct inline asm like: asm volatile (".inst (0x160 + (i * 4))" : "=3Dr"(__val)); ^ expected constant expression Instead of read_etm4x_sysreg_offset() using __builtin_constant_p(), use __is_constexpr from include/linux/const.h instead to ensure only expressions that are valid integer constant expressions get passed through to read_sysreg_s(). This is not a bug in clang; it's a potentially unsafe use of the macro arguments in read_etm4x_sysreg_offset dependent on __builtin_constant_p. Link: https://github.com/ClangBuiltLinux/linux/issues/1310 Reported-by: Arnd Bergmann Reported-by: Tao Zhang Signed-off-by: Nick Desaulniers Acked-by: Arnd Bergmann Signed-off-by: Suzuki K Poulose Link: https://lore.kernel.org/r/20220708231520.3958391-1-ndesaulniers@googl= e.com Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/hwtracing/coresight/coresight-etm4x.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtrac= ing/coresight/coresight-etm4x.h index 33869c1d20c3..a7bfea31f7d8 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -7,6 +7,7 @@ #define _CORESIGHT_CORESIGHT_ETM_H =20 #include +#include #include #include #include "coresight-priv.h" @@ -515,7 +516,7 @@ ({ \ u64 __val; \ \ - if (__builtin_constant_p((offset))) \ + if (__is_constexpr((offset))) \ __val =3D read_etm4x_sysreg_const_offset((offset)); \ else \ __val =3D etm4x_sysreg_read((offset), true, (_64bit)); \ --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91B9DC32772 for ; Tue, 23 Aug 2022 09:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243370AbiHWJO2 (ORCPT ); Tue, 23 Aug 2022 05:14:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349332AbiHWJLa (ORCPT ); Tue, 23 Aug 2022 05:11:30 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0835386C37; Tue, 23 Aug 2022 01:31:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 09485CE1B34; Tue, 23 Aug 2022 08:31:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06D13C433C1; Tue, 23 Aug 2022 08:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243472; bh=skXDE7HoEs1CM7r5+jZrhjl8BpmwHHmVvjU7vqHj44E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GewB7pae6xuQCN6bM2E6RBHQfMhyuvQjVaRlbFJyaAc9ZOvV9GU8vxkfLsGdgS6QR O1/NKMXPda+7o6aa/sCofl5b0U3cyPp5J3L83DoUYxF3WsRD2ti71oTe5ZJSIOtpWt N5W2qydmL8P8eiJM00IPSo/bfFWTpXAU05rei7i8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dafna Hirschfeld , Oded Gabbay , Sasha Levin Subject: [PATCH 5.19 288/365] habanalabs: add terminating NULL to attrs arrays Date: Tue, 23 Aug 2022 10:03:09 +0200 Message-Id: <20220823080130.259653833@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dafna Hirschfeld [ Upstream commit 78d503087be190eab36290644ccec050135e7c70 ] Arrays of struct attribute are expected to be NULL terminated. This is required by API methods such as device_add_groups. This fixes a crash when loading the driver for Goya device. Signed-off-by: Dafna Hirschfeld Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/misc/habanalabs/common/sysfs.c | 2 ++ drivers/misc/habanalabs/gaudi/gaudi.c | 1 + drivers/misc/habanalabs/goya/goya_hwmgr.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/drivers/misc/habanalabs/common/sysfs.c b/drivers/misc/habanala= bs/common/sysfs.c index 9ebeb18ab85e..da8181068895 100644 --- a/drivers/misc/habanalabs/common/sysfs.c +++ b/drivers/misc/habanalabs/common/sysfs.c @@ -73,6 +73,7 @@ static DEVICE_ATTR_RO(clk_cur_freq_mhz); static struct attribute *hl_dev_clk_attrs[] =3D { &dev_attr_clk_max_freq_mhz.attr, &dev_attr_clk_cur_freq_mhz.attr, + NULL, }; =20 static ssize_t vrm_ver_show(struct device *dev, struct device_attribute *a= ttr, char *buf) @@ -93,6 +94,7 @@ static DEVICE_ATTR_RO(vrm_ver); =20 static struct attribute *hl_dev_vrm_attrs[] =3D { &dev_attr_vrm_ver.attr, + NULL, }; =20 static ssize_t uboot_ver_show(struct device *dev, struct device_attribute = *attr, diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalab= s/gaudi/gaudi.c index fba322241096..25d735aee6a3 100644 --- a/drivers/misc/habanalabs/gaudi/gaudi.c +++ b/drivers/misc/habanalabs/gaudi/gaudi.c @@ -9187,6 +9187,7 @@ static DEVICE_ATTR_RO(infineon_ver); =20 static struct attribute *gaudi_vrm_dev_attrs[] =3D { &dev_attr_infineon_ver.attr, + NULL, }; =20 static void gaudi_add_device_attr(struct hl_device *hdev, struct attribute= _group *dev_clk_attr_grp, diff --git a/drivers/misc/habanalabs/goya/goya_hwmgr.c b/drivers/misc/haban= alabs/goya/goya_hwmgr.c index 6580fc6a486a..b595721751c1 100644 --- a/drivers/misc/habanalabs/goya/goya_hwmgr.c +++ b/drivers/misc/habanalabs/goya/goya_hwmgr.c @@ -359,6 +359,7 @@ static struct attribute *goya_clk_dev_attrs[] =3D { &dev_attr_pm_mng_profile.attr, &dev_attr_tpc_clk.attr, &dev_attr_tpc_clk_curr.attr, + NULL, }; =20 static ssize_t infineon_ver_show(struct device *dev, struct device_attribu= te *attr, char *buf) @@ -375,6 +376,7 @@ static DEVICE_ATTR_RO(infineon_ver); =20 static struct attribute *goya_vrm_dev_attrs[] =3D { &dev_attr_infineon_ver.attr, + NULL, }; =20 void goya_add_device_attr(struct hl_device *hdev, struct attribute_group *= dev_clk_attr_grp, --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A402C32772 for ; Tue, 23 Aug 2022 09:14:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243360AbiHWJON (ORCPT ); Tue, 23 Aug 2022 05:14:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348981AbiHWJLE (ORCPT ); Tue, 23 Aug 2022 05:11:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04B8786B7B; Tue, 23 Aug 2022 01:31:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8F9016148F; Tue, 23 Aug 2022 08:31:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BB6EC433D7; Tue, 23 Aug 2022 08:31:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243476; bh=sKiCDr2+rFLbZVPMxLPNCZjeW042ncbG+hqCMa4nj3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wj33+jL0xrhAf4H/BqeKmElZ9E+3N/Uy9V2DPl4v0bBkvo0dqMe00oK2qEf1vazOP lnuWF+bL1Vzf+XNveyAhFDQkXXmiOhgenu5HrltWEmBILd4fuHYJbL4JxGh4Yxu3Kn h83Po7ZBKtnWxQ7j9y32KdVB0FJ+JIjAIbUpr4Lk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tal Cohen , Oded Gabbay , Sasha Levin Subject: [PATCH 5.19 289/365] habanalabs/gaudi: invoke device reset from one code block Date: Tue, 23 Aug 2022 10:03:10 +0200 Message-Id: <20220823080130.294328482@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tal Cohen [ Upstream commit be572e67dafbf8004d46a2c9d97338c107efb60e ] In order to prepare the driver code for device reset event notification, change the event handler function flow to call device reset from one code block. In addition, the commit fixes an issue that reset was performed w/o checking the 'hard_reset_on_fw_event' state and w/o setting the HL_DRV_RESET_DELAY flag. Signed-off-by: Tal Cohen Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/misc/habanalabs/gaudi/gaudi.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalab= s/gaudi/gaudi.c index 25d735aee6a3..e6bfaf55c6b6 100644 --- a/drivers/misc/habanalabs/gaudi/gaudi.c +++ b/drivers/misc/habanalabs/gaudi/gaudi.c @@ -7717,10 +7717,10 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct gaudi_device *gaudi =3D hdev->asic_specific; u64 data =3D le64_to_cpu(eq_entry->data[0]); u32 ctl =3D le32_to_cpu(eq_entry->hdr.ctl); - u32 fw_fatal_err_flag =3D 0; + u32 fw_fatal_err_flag =3D 0, flags =3D 0; u16 event_type =3D ((ctl & EQ_CTL_EVENT_TYPE_MASK) >> EQ_CTL_EVENT_TYPE_SHIFT); - bool reset_required; + bool reset_required, reset_direct =3D false; u8 cause; int rc; =20 @@ -7808,7 +7808,8 @@ static void gaudi_handle_eqe(struct hl_device *hdev, dev_err(hdev->dev, "reset required due to %s\n", gaudi_irq_map_table[event_type].name); =20 - hl_device_reset(hdev, 0); + reset_direct =3D true; + goto reset_device; } else { hl_fw_unmask_irq(hdev, event_type); } @@ -7830,7 +7831,8 @@ static void gaudi_handle_eqe(struct hl_device *hdev, dev_err(hdev->dev, "reset required due to %s\n", gaudi_irq_map_table[event_type].name); =20 - hl_device_reset(hdev, 0); + reset_direct =3D true; + goto reset_device; } else { hl_fw_unmask_irq(hdev, event_type); } @@ -7981,12 +7983,17 @@ static void gaudi_handle_eqe(struct hl_device *hdev, return; =20 reset_device: - if (hdev->asic_prop.fw_security_enabled) - hl_device_reset(hdev, HL_DRV_RESET_HARD - | HL_DRV_RESET_BYPASS_REQ_TO_FW - | fw_fatal_err_flag); + reset_required =3D true; + + if (hdev->asic_prop.fw_security_enabled && !reset_direct) + flags =3D HL_DRV_RESET_HARD | HL_DRV_RESET_BYPASS_REQ_TO_FW | fw_fatal_e= rr_flag; else if (hdev->hard_reset_on_fw_events) - hl_device_reset(hdev, HL_DRV_RESET_HARD | HL_DRV_RESET_DELAY | fw_fatal_= err_flag); + flags =3D HL_DRV_RESET_HARD | HL_DRV_RESET_DELAY | fw_fatal_err_flag; + else + reset_required =3D false; + + if (reset_required) + hl_device_reset(hdev, flags); else hl_fw_unmask_irq(hdev, event_type); } --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FCF4C32793 for ; Tue, 23 Aug 2022 09:16:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243709AbiHWJP2 (ORCPT ); Tue, 23 Aug 2022 05:15:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348506AbiHWJMs (ORCPT ); Tue, 23 Aug 2022 05:12:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0EAD86C33; Tue, 23 Aug 2022 01:31:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF1E0614BC; Tue, 23 Aug 2022 08:31:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE261C433D6; Tue, 23 Aug 2022 08:31:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243479; bh=epSUldJ7qZaSa/KN4cH2lvf0JxykKV7qMCXgRU+QuaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z0l7i63AkSN42453pTLeDfJFTBngHltKBNV9+I9omEU4VpmjsA+QyuVpCYhvSQ7hL gDuo2R1lcZHhZDF9EIvQtPK67cxvGPoK168beIlCOvRX6zmWW/Bh64lSdpiL+36zi7 ZcftaY1vLSXDaJnxeCtQsJ3fTq63MAvhR2OEJ8kw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ofir Bitton , Oded Gabbay , Sasha Levin Subject: [PATCH 5.19 290/365] habanalabs/gaudi: fix shift out of bounds Date: Tue, 23 Aug 2022 10:03:11 +0200 Message-Id: <20220823080130.342666788@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ofir Bitton [ Upstream commit 01622098aeb05a5efbb727199bbc2a4653393255 ] When validating NIC queues, queue offset calculation must be performed only for NIC queues. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/misc/habanalabs/gaudi/gaudi.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalab= s/gaudi/gaudi.c index e6bfaf55c6b6..3fb221f2e393 100644 --- a/drivers/misc/habanalabs/gaudi/gaudi.c +++ b/drivers/misc/habanalabs/gaudi/gaudi.c @@ -5654,15 +5654,17 @@ static int gaudi_parse_cb_no_ext_queue(struct hl_de= vice *hdev, { struct asic_fixed_properties *asic_prop =3D &hdev->asic_prop; struct gaudi_device *gaudi =3D hdev->asic_specific; - u32 nic_mask_q_id =3D 1 << (HW_CAP_NIC_SHIFT + - ((parser->hw_queue_id - GAUDI_QUEUE_ID_NIC_0_0) >> 2)); + u32 nic_queue_offset, nic_mask_q_id; =20 if ((parser->hw_queue_id >=3D GAUDI_QUEUE_ID_NIC_0_0) && - (parser->hw_queue_id <=3D GAUDI_QUEUE_ID_NIC_9_3) && - (!(gaudi->hw_cap_initialized & nic_mask_q_id))) { - dev_err(hdev->dev, "h/w queue %d is disabled\n", - parser->hw_queue_id); - return -EINVAL; + (parser->hw_queue_id <=3D GAUDI_QUEUE_ID_NIC_9_3)) { + nic_queue_offset =3D parser->hw_queue_id - GAUDI_QUEUE_ID_NIC_0_0; + nic_mask_q_id =3D 1 << (HW_CAP_NIC_SHIFT + (nic_queue_offset >> 2)); + + if (!(gaudi->hw_cap_initialized & nic_mask_q_id)) { + dev_err(hdev->dev, "h/w queue %d is disabled\n", parser->hw_queue_id); + return -EINVAL; + } } =20 /* For internal queue jobs just check if CB address is valid */ --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E32AC32774 for ; Tue, 23 Aug 2022 09:14:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349135AbiHWJOg (ORCPT ); Tue, 23 Aug 2022 05:14:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243401AbiHWJLj (ORCPT ); Tue, 23 Aug 2022 05:11:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 499156D54C; Tue, 23 Aug 2022 01:31:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0568661360; Tue, 23 Aug 2022 08:31:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8B8BC433D6; Tue, 23 Aug 2022 08:31:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243482; bh=fNAOU3nn93Lkm95oCUBoM40Bm7uOivsDjII/2NQw4E8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X83ELeEn35/C0RXbyx9OJijG/o+pnjT8Vln4XdQkGTHmlzmLKseOwogWNlZMouv0M 7p+4LFXL8VDS9mavGt0cQzOcSbAtO0dRMBtL4E4iTn3Hy2+tKMxvojweNcZjtwt4EK IcGX5bgCbQBtLtUSJqwUhcrN0WnS6HmAO8FdjIzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oded Gabbay , Sasha Levin Subject: [PATCH 5.19 291/365] habanalabs/gaudi: mask constant value before cast Date: Tue, 23 Aug 2022 10:03:12 +0200 Message-Id: <20220823080130.375272491@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oded Gabbay [ Upstream commit e3f49437a2e0221a387ecd192d742ae1434e1e3a ] This fixes a sparse warning of "cast truncates bits from constant value" Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/misc/habanalabs/gaudi/gaudi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalab= s/gaudi/gaudi.c index 3fb221f2e393..b33616aacb33 100644 --- a/drivers/misc/habanalabs/gaudi/gaudi.c +++ b/drivers/misc/habanalabs/gaudi/gaudi.c @@ -3339,19 +3339,19 @@ static void gaudi_init_nic_qman(struct hl_device *h= dev, u32 nic_offset, u32 nic_qm_err_cfg, irq_handler_offset; u32 q_off; =20 - mtr_base_en_lo =3D lower_32_bits(CFG_BASE + + mtr_base_en_lo =3D lower_32_bits((CFG_BASE & U32_MAX) + mmSYNC_MNGR_E_N_SYNC_MNGR_OBJS_MON_PAY_ADDRL_0); mtr_base_en_hi =3D upper_32_bits(CFG_BASE + mmSYNC_MNGR_E_N_SYNC_MNGR_OBJS_MON_PAY_ADDRL_0); - so_base_en_lo =3D lower_32_bits(CFG_BASE + + so_base_en_lo =3D lower_32_bits((CFG_BASE & U32_MAX) + mmSYNC_MNGR_E_N_SYNC_MNGR_OBJS_SOB_OBJ_0); so_base_en_hi =3D upper_32_bits(CFG_BASE + mmSYNC_MNGR_E_N_SYNC_MNGR_OBJS_SOB_OBJ_0); - mtr_base_ws_lo =3D lower_32_bits(CFG_BASE + + mtr_base_ws_lo =3D lower_32_bits((CFG_BASE & U32_MAX) + mmSYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_PAY_ADDRL_0); mtr_base_ws_hi =3D upper_32_bits(CFG_BASE + mmSYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_PAY_ADDRL_0); - so_base_ws_lo =3D lower_32_bits(CFG_BASE + + so_base_ws_lo =3D lower_32_bits((CFG_BASE & U32_MAX) + mmSYNC_MNGR_W_S_SYNC_MNGR_OBJS_SOB_OBJ_0); so_base_ws_hi =3D upper_32_bits(CFG_BASE + mmSYNC_MNGR_W_S_SYNC_MNGR_OBJS_SOB_OBJ_0); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B3DCC32772 for ; Tue, 23 Aug 2022 09:14:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349056AbiHWJOH (ORCPT ); Tue, 23 Aug 2022 05:14:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348940AbiHWJLB (ORCPT ); Tue, 23 Aug 2022 05:11:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42F1B8670A; Tue, 23 Aug 2022 01:31:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B1CEEB81C20; Tue, 23 Aug 2022 08:31:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD140C433C1; Tue, 23 Aug 2022 08:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243485; bh=2T9LF6WeK9qYQ/JCevFZRyjkSghw7v+l+v/fjmvZEQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U56gaPmeochb9HzxaiRxZcaKNFMKUC2SpduNW4MojEvfAt3fbcDtPM+zC0XvDqdlg iLAsIURfm/ShXDHNmkbOM1BM8nxvU8XzFde2L2BPc9dbCO61yW5nRoTnSSgeVcmQuj IdEcNJkm1qWx7yfkgsOrVSlikNE/zX1hQ+GWhsxg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda , Wolfram Sang , Ulf Hansson , Sasha Levin Subject: [PATCH 5.19 292/365] mmc: tmio: avoid glitches when resetting Date: Tue, 23 Aug 2022 10:03:13 +0200 Message-Id: <20220823080130.426373931@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wolfram Sang [ Upstream commit 2e586f8a5b0ed4a525014a692923ac96f6647816 ] If we reset because of an error, we need to preserve values for the clock frequency. Otherwise, glitches may be seen on the bus. To achieve that, we introduce a 'preserve' parameter to the reset function and the IP core specific reset callbacks to handle everything accordingly. Reported-by: Yoshihiro Shimoda Signed-off-by: Wolfram Sang Tested-by: Yoshihiro Shimoda Link: https://lore.kernel.org/r/20220625131722.1397-1-wsa@kernel.org Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/mmc/host/renesas_sdhi_core.c | 29 ++++++++++++++-------------- drivers/mmc/host/tmio_mmc.c | 2 +- drivers/mmc/host/tmio_mmc.h | 6 +++++- drivers/mmc/host/tmio_mmc_core.c | 28 +++++++++++++++++++++------ 4 files changed, 42 insertions(+), 23 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesa= s_sdhi_core.c index 0d258b6e1a43..55f7b27c3de7 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -49,9 +49,6 @@ #define HOST_MODE_GEN3_32BIT (HOST_MODE_GEN3_WMODE | HOST_MODE_GEN3_BUSWID= TH) #define HOST_MODE_GEN3_64BIT 0 =20 -#define CTL_SDIF_MODE 0xe6 -#define SDIF_MODE_HS400 BIT(0) - #define SDHI_VER_GEN2_SDR50 0x490c #define SDHI_VER_RZ_A1 0x820b /* very old datasheets said 0x490c for SDR104, too. They are wrong! */ @@ -562,23 +559,25 @@ static void renesas_sdhi_scc_reset(struct tmio_mmc_ho= st *host, struct renesas_sd } =20 /* only populated for TMIO_MMC_MIN_RCAR2 */ -static void renesas_sdhi_reset(struct tmio_mmc_host *host) +static void renesas_sdhi_reset(struct tmio_mmc_host *host, bool preserve) { struct renesas_sdhi *priv =3D host_to_priv(host); int ret; u16 val; =20 - if (priv->rstc) { - reset_control_reset(priv->rstc); - /* Unknown why but without polling reset status, it will hang */ - read_poll_timeout(reset_control_status, ret, ret =3D=3D 0, 1, 100, - false, priv->rstc); - /* At least SDHI_VER_GEN2_SDR50 needs manual release of reset */ - sd_ctrl_write16(host, CTL_RESET_SD, 0x0001); - priv->needs_adjust_hs400 =3D false; - renesas_sdhi_set_clock(host, host->clk_cache); - } else if (priv->scc_ctl) { - renesas_sdhi_scc_reset(host, priv); + if (!preserve) { + if (priv->rstc) { + reset_control_reset(priv->rstc); + /* Unknown why but without polling reset status, it will hang */ + read_poll_timeout(reset_control_status, ret, ret =3D=3D 0, 1, 100, + false, priv->rstc); + /* At least SDHI_VER_GEN2_SDR50 needs manual release of reset */ + sd_ctrl_write16(host, CTL_RESET_SD, 0x0001); + priv->needs_adjust_hs400 =3D false; + renesas_sdhi_set_clock(host, host->clk_cache); + } else if (priv->scc_ctl) { + renesas_sdhi_scc_reset(host, priv); + } } =20 if (sd_ctrl_read16(host, CTL_VERSION) >=3D SDHI_VER_GEN3_SD) { diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c index b55a29c53d9c..53a2ad9a24b8 100644 --- a/drivers/mmc/host/tmio_mmc.c +++ b/drivers/mmc/host/tmio_mmc.c @@ -75,7 +75,7 @@ static void tmio_mmc_set_clock(struct tmio_mmc_host *host, tmio_mmc_clk_start(host); } =20 -static void tmio_mmc_reset(struct tmio_mmc_host *host) +static void tmio_mmc_reset(struct tmio_mmc_host *host, bool preserve) { sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000); usleep_range(10000, 11000); diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index e754bb3f5c32..501613c74406 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -42,6 +42,7 @@ #define CTL_DMA_ENABLE 0xd8 #define CTL_RESET_SD 0xe0 #define CTL_VERSION 0xe2 +#define CTL_SDIF_MODE 0xe6 /* only known on R-Car 2+ */ =20 /* Definitions for values the CTL_STOP_INTERNAL_ACTION register can take */ #define TMIO_STOP_STP BIT(0) @@ -98,6 +99,9 @@ /* Definitions for values the CTL_DMA_ENABLE register can take */ #define DMA_ENABLE_DMASDRW BIT(1) =20 +/* Definitions for values the CTL_SDIF_MODE register can take */ +#define SDIF_MODE_HS400 BIT(0) /* only known on R-Car 2+ */ + /* Define some IRQ masks */ /* This is the mask used at reset by the chip */ #define TMIO_MASK_ALL 0x837f031d @@ -181,7 +185,7 @@ struct tmio_mmc_host { int (*multi_io_quirk)(struct mmc_card *card, unsigned int direction, int blk_size); int (*write16_hook)(struct tmio_mmc_host *host, int addr); - void (*reset)(struct tmio_mmc_host *host); + void (*reset)(struct tmio_mmc_host *host, bool preserve); bool (*check_retune)(struct tmio_mmc_host *host, struct mmc_request *mrq); void (*fixup_request)(struct tmio_mmc_host *host, struct mmc_request *mrq= ); unsigned int (*get_timeout_cycles)(struct tmio_mmc_host *host); diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_c= ore.c index a5850d83908b..437048bb8027 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -179,8 +179,17 @@ static void tmio_mmc_set_bus_width(struct tmio_mmc_hos= t *host, sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, reg); } =20 -static void tmio_mmc_reset(struct tmio_mmc_host *host) +static void tmio_mmc_reset(struct tmio_mmc_host *host, bool preserve) { + u16 card_opt, clk_ctrl, sdif_mode; + + if (preserve) { + card_opt =3D sd_ctrl_read16(host, CTL_SD_MEM_CARD_OPT); + clk_ctrl =3D sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL); + if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) + sdif_mode =3D sd_ctrl_read16(host, CTL_SDIF_MODE); + } + /* FIXME - should we set stop clock reg here */ sd_ctrl_write16(host, CTL_RESET_SD, 0x0000); usleep_range(10000, 11000); @@ -190,7 +199,7 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host) tmio_mmc_abort_dma(host); =20 if (host->reset) - host->reset(host); + host->reset(host, preserve); =20 sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, host->sdcard_irq_mask_al= l); host->sdcard_irq_mask =3D host->sdcard_irq_mask_all; @@ -206,6 +215,13 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host) sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001); } =20 + if (preserve) { + sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, card_opt); + sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk_ctrl); + if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) + sd_ctrl_write16(host, CTL_SDIF_MODE, sdif_mode); + } + if (host->mmc->card) mmc_retune_needed(host->mmc); } @@ -248,7 +264,7 @@ static void tmio_mmc_reset_work(struct work_struct *wor= k) =20 spin_unlock_irqrestore(&host->lock, flags); =20 - tmio_mmc_reset(host); + tmio_mmc_reset(host, true); =20 /* Ready for new calls */ host->mrq =3D NULL; @@ -961,7 +977,7 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, stru= ct mmc_ios *ios) tmio_mmc_power_off(host); /* For R-Car Gen2+, we need to reset SDHI specific SCC */ if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) - tmio_mmc_reset(host); + tmio_mmc_reset(host, false); =20 host->set_clock(host, 0); break; @@ -1189,7 +1205,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) _host->sdcard_irq_mask_all =3D TMIO_MASK_ALL; =20 _host->set_clock(_host, 0); - tmio_mmc_reset(_host); + tmio_mmc_reset(_host, false); =20 spin_lock_init(&_host->lock); mutex_init(&_host->ios_lock); @@ -1285,7 +1301,7 @@ int tmio_mmc_host_runtime_resume(struct device *dev) struct tmio_mmc_host *host =3D dev_get_drvdata(dev); =20 tmio_mmc_clk_enable(host); - tmio_mmc_reset(host); + tmio_mmc_reset(host, false); =20 if (host->clk_cache) host->set_clock(host, host->clk_cache); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1200CC32792 for ; Tue, 23 Aug 2022 09:16:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350292AbiHWJQy (ORCPT ); Tue, 23 Aug 2022 05:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348371AbiHWJMu (ORCPT ); Tue, 23 Aug 2022 05:12:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6082786FE3; Tue, 23 Aug 2022 01:31:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5961661326; Tue, 23 Aug 2022 08:31:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49ACBC433C1; Tue, 23 Aug 2022 08:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243488; bh=qt61o7YewrXnnLL9ocm5HDs/bnCH6kg7cv3t1Ds3lw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eADwtF/8Y3SzTRsvsabIRkRDcFXDvTppzb3BEolvMOt1xSOx+tY0NCF4RiGR2ayPo N3Kr3+vPHRl/n3n4su7wZFK4htMzvDlhopbOdKbdaN423ppTNUVM3LXfNGp2hd0Op9 9lAX3SkksxOy8iBZmTxqyJ9TTBxfkltYDC/R5l0k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Chanho Park , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 293/365] scsi: ufs: ufs-exynos: Change ufs phy control sequence Date: Tue, 23 Aug 2022 10:03:14 +0200 Message-Id: <20220823080130.466427548@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chanho Park [ Upstream commit 3d73b200f9893d8f5ba5d105e8b69c8d16744fa2 ] Since commit 1599069a62c6 ("phy: core: Warn when phy_power_on is called before phy_init"), the following warning has been reported: phy_power_on was called before phy_init To address this, we need to remove phy_power_on from exynos_ufs_phy_init() and move it after phy_init. phy_power_off and phy_exit are also necessary in exynos_ufs_remove(). Link: https://lore.kernel.org/r/20220706020255.151177-4-chanho61.park@samsu= ng.com Reviewed-by: Krzysztof Kozlowski Signed-off-by: Chanho Park Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/ufs/host/ufs-exynos.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index a81d8cbd542f..25995667c832 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -910,9 +910,13 @@ static int exynos_ufs_phy_init(struct exynos_ufs *ufs) if (ret) { dev_err(hba->dev, "%s: phy init failed, ret =3D %d\n", __func__, ret); - goto out_exit_phy; + return ret; } =20 + ret =3D phy_power_on(generic_phy); + if (ret) + goto out_exit_phy; + return 0; =20 out_exit_phy: @@ -1174,10 +1178,6 @@ static int exynos_ufs_init(struct ufs_hba *hba) goto out; } =20 - ret =3D phy_power_on(ufs->phy); - if (ret) - goto phy_off; - exynos_ufs_priv_init(hba, ufs); =20 if (ufs->drv_data->drv_init) { @@ -1195,8 +1195,6 @@ static int exynos_ufs_init(struct ufs_hba *hba) exynos_ufs_config_smu(ufs); return 0; =20 -phy_off: - phy_power_off(ufs->phy); out: hba->priv =3D NULL; return ret; @@ -1514,9 +1512,14 @@ static int exynos_ufs_probe(struct platform_device *= pdev) static int exynos_ufs_remove(struct platform_device *pdev) { struct ufs_hba *hba =3D platform_get_drvdata(pdev); + struct exynos_ufs *ufs =3D ufshcd_get_variant(hba); =20 pm_runtime_get_sync(&(pdev)->dev); ufshcd_remove(hba); + + phy_power_off(ufs->phy); + phy_exit(ufs->phy); + return 0; } =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7A20C32774 for ; Tue, 23 Aug 2022 09:14:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243828AbiHWJOj (ORCPT ); Tue, 23 Aug 2022 05:14:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243728AbiHWJLs (ORCPT ); Tue, 23 Aug 2022 05:11:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A4F36D57B; Tue, 23 Aug 2022 01:31:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 02427B81C35; Tue, 23 Aug 2022 08:31:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 677D2C433D6; Tue, 23 Aug 2022 08:31:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243494; bh=xXQAFQ/1p0AoaeHh21LVzZFWzJxzwfUL99cZqTHOlzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BRPyqgJeAHdsgxBxKhk9TnteKODs6XGsJhH0c7uKlznJuiffLJNYKPUa5XakhkYv+ ZeYYrKxUrN8v2npefdkmCSEVXm+dc+F+Zd5d2IdyyUbSL2ePGvafwL+O2hsT6KmrKS QouRhycdAPTk7/iqfuhKmrrfRzCUY+EQ3rlS6VrE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Henning Schild , Andy Shevchenko , Hans de Goede , Mika Westerberg , Linus Walleij , Lee Jones , Sasha Levin Subject: [PATCH 5.19 294/365] pinctrl: intel: Check against matching data instead of ACPI companion Date: Tue, 23 Aug 2022 10:03:15 +0200 Message-Id: <20220823080130.502152431@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andy Shevchenko [ Upstream commit c551bd81d198bf1dcd4398d5454acdc0309dbe77 ] In some cases we may get a platform device that has ACPI companion which is different to the pin control described in the ACPI tables. This is primarily happens when device is instantiated by board file. In order to allow this device being enumerated, refactor intel_pinctrl_get_soc_data() to check the matching data instead of ACPI companion. Reported-by: Henning Schild Signed-off-by: Andy Shevchenko Tested-by: Henning Schild Acked-by: Hans de Goede Acked-by: Mika Westerberg Acked-by: Linus Walleij Signed-off-by: Lee Jones Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/pinctrl/intel/pinctrl-intel.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/= pinctrl-intel.c index ffc045f7bf00..fd093e36c3a8 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -1641,16 +1641,14 @@ EXPORT_SYMBOL_GPL(intel_pinctrl_probe_by_uid); =20 const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct pla= tform_device *pdev) { + const struct intel_pinctrl_soc_data * const *table; const struct intel_pinctrl_soc_data *data =3D NULL; - const struct intel_pinctrl_soc_data **table; - struct acpi_device *adev; - unsigned int i; =20 - adev =3D ACPI_COMPANION(&pdev->dev); - if (adev) { - const void *match =3D device_get_match_data(&pdev->dev); + table =3D device_get_match_data(&pdev->dev); + if (table) { + struct acpi_device *adev =3D ACPI_COMPANION(&pdev->dev); + unsigned int i; =20 - table =3D (const struct intel_pinctrl_soc_data **)match; for (i =3D 0; table[i]; i++) { if (!strcmp(adev->pnp.unique_id, table[i]->uid)) { data =3D table[i]; @@ -1664,7 +1662,7 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_ge= t_soc_data(struct platform_ if (!id) return ERR_PTR(-ENODEV); =20 - table =3D (const struct intel_pinctrl_soc_data **)id->driver_data; + table =3D (const struct intel_pinctrl_soc_data * const *)id->driver_data; data =3D table[pdev->id]; } =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40117C32772 for ; Tue, 23 Aug 2022 09:15:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243264AbiHWJPI (ORCPT ); Tue, 23 Aug 2022 05:15:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348555AbiHWJMU (ORCPT ); Tue, 23 Aug 2022 05:12:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 432C075380; Tue, 23 Aug 2022 01:31:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CC34A6123D; Tue, 23 Aug 2022 08:31:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3D2AC433D6; Tue, 23 Aug 2022 08:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243498; bh=bvxl4NfAPWoJeKXPXZQ9lKtZkp/R6dPMZbid1WSJKj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KpvOCRbzYcc9tLxuEHB1Hlf+U/5EaDF6N0QwR6AnAxAomSwUq2PJnPlRLP09q9Pfk RfBALYSrgeLrx6fuQIOibX1vWGxLg6DoENdcyfdUREJOKZ+AOvmVfybWTigV895NAX D/4A/lhH/WRw50fAQUBreLWHmwh0sJyTU5645YXg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Donnellan , Christophe JAILLET , Sasha Levin Subject: [PATCH 5.19 295/365] cxl: Fix a memory leak in an error handling path Date: Tue, 23 Aug 2022 10:03:16 +0200 Message-Id: <20220823080130.533116012@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 3a15b45b5454da862376b5d69a4967f5c6fa1368 ] A bitmap_zalloc() must be balanced by a corresponding bitmap_free() in the error handling path of afu_allocate_irqs(). Acked-by: Andrew Donnellan Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/ce5869418f5838187946eb6b11a52715a93ece3d.16= 57566849.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/misc/cxl/irq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/cxl/irq.c b/drivers/misc/cxl/irq.c index 5f0e2dcebb34..ac3795a7e1f6 100644 --- a/drivers/misc/cxl/irq.c +++ b/drivers/misc/cxl/irq.c @@ -350,6 +350,7 @@ int afu_allocate_irqs(struct cxl_context *ctx, u32 coun= t) =20 out: cxl_ops->release_irq_ranges(&ctx->irqs, ctx->afu->adapter); + bitmap_free(ctx->irq_bitmap); afu_irq_name_free(ctx); return -ENOMEM; } --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 716D0C38145 for ; Tue, 23 Aug 2022 09:17:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349047AbiHWJRZ (ORCPT ); Tue, 23 Aug 2022 05:17:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349118AbiHWJOQ (ORCPT ); Tue, 23 Aug 2022 05:14:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F0B686FFB; Tue, 23 Aug 2022 01:32:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A559BB81BF8; Tue, 23 Aug 2022 08:31:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59A11C433C1; Tue, 23 Aug 2022 08:31:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243502; bh=DDjUZxl2V2JdEZSkI5b5kOsibxbKLbbmvroI1QTDkPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rCqtvxHBFQxpJdXtpvVlyfXjMHYVXuXJ8Uy+0PDS0z0790MwQR+Gddxhzot/gPFJO +Si1jxIIqoAjcmvPpOuBLTica8XmFW4TubTqDcQ0T3lX8AGhAGrl/2OjY0XvNQQzVv sQs26H3dkjsGBitxdlZTVVweTXW9/3qx4r6DHXyk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huacai Chen , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.19 296/365] PCI/ACPI: Guard ARM64-specific mcfg_quirks Date: Tue, 23 Aug 2022 10:03:17 +0200 Message-Id: <20220823080130.574617110@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Huacai Chen [ Upstream commit 40a6cc141b4b9580de140bcb3e893445708acc5d ] Guard ARM64-specific quirks with CONFIG_ARM64 to avoid build errors, since mcfg_quirks will be shared by more than one architectures. Link: https://lore.kernel.org/r/20220714124216.1489304-2-chenhuacai@loongso= n.cn Signed-off-by: Huacai Chen Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/acpi/pci_mcfg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/pci_mcfg.c b/drivers/acpi/pci_mcfg.c index 53cab975f612..63b98eae5e75 100644 --- a/drivers/acpi/pci_mcfg.c +++ b/drivers/acpi/pci_mcfg.c @@ -41,6 +41,8 @@ struct mcfg_fixup { static struct mcfg_fixup mcfg_quirks[] =3D { /* { OEM_ID, OEM_TABLE_ID, REV, SEGMENT, BUS_RANGE, ops, cfgres }, */ =20 +#ifdef CONFIG_ARM64 + #define AL_ECAM(table_id, rev, seg, ops) \ { "AMAZON", table_id, rev, seg, MCFG_BUS_ANY, ops } =20 @@ -169,6 +171,7 @@ static struct mcfg_fixup mcfg_quirks[] =3D { ALTRA_ECAM_QUIRK(1, 13), ALTRA_ECAM_QUIRK(1, 14), ALTRA_ECAM_QUIRK(1, 15), +#endif /* ARM64 */ }; =20 static char mcfg_oem_id[ACPI_OEM_ID_SIZE]; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9CFAC32774 for ; Tue, 23 Aug 2022 09:22:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237224AbiHWJWy (ORCPT ); Tue, 23 Aug 2022 05:22:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350349AbiHWJVm (ORCPT ); Tue, 23 Aug 2022 05:21:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E75F56DF84; Tue, 23 Aug 2022 01:34:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2668E614E9; Tue, 23 Aug 2022 08:33:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24B2DC433B5; Tue, 23 Aug 2022 08:33:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243626; bh=DDeFuJF+/jJw8oszRdDIPDDVt6JZ7zvbZcQR2zC/mkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lndspGLdjuTdRA/rDt2Fi8ATC7qo1NFU90qexq0kj9Xd6/UOmySKhNoL2CuFlLmjV Q8dxIH10ohUkEf5a6V2/bvAvrUmyE8jAdEFmckdlv0rPwhpeTJqINYQKSUyRWd0SIz RMrJSNSDVuvpNvKM742BZuuloMWUIFi+/I3uv/2I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Richard Weinberger , Sasha Levin Subject: [PATCH 5.19 297/365] um: add "noreboot" command line option for PANIC_TIMEOUT=-1 setups Date: Tue, 23 Aug 2022 10:03:18 +0200 Message-Id: <20220823080130.606552627@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit dda520d07b95072a0b63f6c52a8eb566d08ea897 ] QEMU has a -no-reboot option, which halts instead of reboots when the guest asks to reboot. This is invaluable when used with CONFIG_PANIC_TIMEOUT=3D-1 (and panic_on_warn), because it allows panics and warnings to be caught immediately in CI. Implement this in UML too, by way of a basic setup param. Signed-off-by: Jason A. Donenfeld Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/um/os-Linux/skas/process.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/proces= s.c index c316c993a949..b24db6017ded 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c @@ -5,6 +5,7 @@ */ =20 #include +#include #include #include #include @@ -707,10 +708,24 @@ void halt_skas(void) UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT); } =20 +static bool noreboot; + +static int __init noreboot_cmd_param(char *str, int *add) +{ + noreboot =3D true; + return 0; +} + +__uml_setup("noreboot", noreboot_cmd_param, +"noreboot\n" +" Rather than rebooting, exit always, akin to QEMU's -no-reboot option.= \n" +" This is useful if you're using CONFIG_PANIC_TIMEOUT in order to catch= \n" +" crashes in CI\n"); + void reboot_skas(void) { block_signals_trace(); - UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); + UML_LONGJMP(&initial_jmpbuf, noreboot ? INIT_JMP_HALT : INIT_JMP_REBOOT); } =20 void __switch_mm(struct mm_id *mm_idp) --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7ED86C32772 for ; Tue, 23 Aug 2022 09:17:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348356AbiHWJRx (ORCPT ); Tue, 23 Aug 2022 05:17:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347542AbiHWJPc (ORCPT ); Tue, 23 Aug 2022 05:15:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 437646DAE1; Tue, 23 Aug 2022 01:32:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 79B4CB81C4D; Tue, 23 Aug 2022 08:32:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B204CC433C1; Tue, 23 Aug 2022 08:32:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243528; bh=lNsKvYULFuuzdlBwjeh6X66QvKsJxp5dxnGGth5+T8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DhYs0J5YdFDA1qT2WLL/asf73ma/wDOmYHoPNv55wDFj+iBFz1vJVI2E92eQpGidg YhS3D8W1WVSvkRe+ce7qrpBWSlzwc4KTL5XI0ZI176B32kXNbLjxrqedRQgbGSY5hi Bocct2XlUHUyo9gYn3oCEFPlDJvgz+DoKkO17KpY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Frank Rowand , Rob Herring , Sasha Levin Subject: [PATCH 5.19 298/365] of: overlay: Move devicetree_corrupt() check up Date: Tue, 23 Aug 2022 10:03:19 +0200 Message-Id: <20220823080130.638816561@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit e385b0ba6a137f34953e746d70d543660c2de1a0 ] There is no point in doing several preparatory steps in of_overlay_fdt_apply(), only to see of_overlay_apply() return early because of a corrupt device tree. Move the check for a corrupt device tree from of_overlay_apply() to of_overlay_fdt_apply(), to check for this as early as possible. Signed-off-by: Geert Uytterhoeven Reviewed-by: Frank Rowand Tested-by: Frank Rowand Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/c91ce7112eb5167ea46a43d8a980e76b920010ba.16= 57893306.git.geert+renesas@glider.be Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/of/overlay.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 4044ddcb02c6..84a8d402009c 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -903,12 +903,6 @@ static int of_overlay_apply(struct overlay_changeset *= ovcs) { int ret =3D 0, ret_revert, ret_tmp; =20 - if (devicetree_corrupt()) { - pr_err("devicetree state suspect, refuse to apply overlay\n"); - ret =3D -EBUSY; - goto out; - } - ret =3D of_resolve_phandles(ovcs->overlay_root); if (ret) goto out; @@ -983,6 +977,11 @@ int of_overlay_fdt_apply(const void *overlay_fdt, u32 = overlay_fdt_size, =20 *ret_ovcs_id =3D 0; =20 + if (devicetree_corrupt()) { + pr_err("devicetree state suspect, refuse to apply overlay\n"); + return -EBUSY; + } + if (overlay_fdt_size < sizeof(struct fdt_header) || fdt_check_header(overlay_fdt)) { pr_err("Invalid overlay_fdt header\n"); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A47DC32772 for ; Tue, 23 Aug 2022 09:19:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231867AbiHWJSq (ORCPT ); Tue, 23 Aug 2022 05:18:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349985AbiHWJQ2 (ORCPT ); Tue, 23 Aug 2022 05:16:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70B69883E0; Tue, 23 Aug 2022 01:32:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 42BE6B81C35; Tue, 23 Aug 2022 08:32:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 899D1C433C1; Tue, 23 Aug 2022 08:32:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243563; bh=Wk2EN4oWzCNZy1fjsGB+gIos7yTqSgZhVXSohy2ODQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BxJNnbXxmUMmdTXGLj0GbU5dEFut44r0cpvrifZTHr/5E1+yHi0jtLMKY0EajY9ZP 1gKUPmCpAMXVSP3iedreJo1zX4jixlJ2zApr+GPnpieEJdmL3ApZQudypXMUCjUheI lSEUqavKRRlfYGQvy8hRzFKhvEkySsI8RVIdqeQk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Dooks , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 299/365] dmaengine: dw-axi-dmac: do not print NULL LLI during error Date: Tue, 23 Aug 2022 10:03:20 +0200 Message-Id: <20220823080130.678002903@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ben Dooks [ Upstream commit 86cb0defe0e275453bc39e856bb523eb425a6537 ] During debugging we have seen an issue where axi_chan_dump_lli() is passed a NULL LLI pointer which ends up causing an OOPS due to trying to get fields from it. Simply print NULL LLI and exit to avoid this. Signed-off-by: Ben Dooks Link: https://lore.kernel.org/r/20220708170153.269991-3-ben.dooks@sifive.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/d= w-axi-dmac/dw-axi-dmac-platform.c index c741da02b67e..41583f01a360 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -982,6 +982,11 @@ static int dw_axi_dma_chan_slave_config(struct dma_cha= n *dchan, static void axi_chan_dump_lli(struct axi_dma_chan *chan, struct axi_dma_hw_desc *desc) { + if (!desc->lli) { + dev_err(dchan2dev(&chan->vc.chan), "NULL LLI\n"); + return; + } + dev_err(dchan2dev(&chan->vc.chan), "SAR: 0x%llx DAR: 0x%llx LLP: 0x%llx BTS 0x%x CTL: 0x%x:%08x", le64_to_cpu(desc->lli->sar), --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4170C32772 for ; Tue, 23 Aug 2022 09:23:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349626AbiHWJXt (ORCPT ); Tue, 23 Aug 2022 05:23:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349727AbiHWJU6 (ORCPT ); Tue, 23 Aug 2022 05:20:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0D1D8A1E9; Tue, 23 Aug 2022 01:34:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D721DB81BF8; Tue, 23 Aug 2022 08:33:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 442FFC433D6; Tue, 23 Aug 2022 08:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243598; bh=Hz4IDQ1JODRnQj2XRHBXSjJFvRrsRauABgljRV7KOqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t9HnqP0Hh5QUSJWsKFjVhqkgVZe95VhiBMzixt0Q6vYTsyogARRs+ffphbsa+lk3B ktkzaZpscqlRCF87H7EJ79OpjlbOPd7LlYqr8TMoHa5uOo6B+ZvF5JLdgwoMqrHYwT u2MZYBmtuB/dxKlUpbmB/NHiHL51EHv0GJElzZak= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Dooks , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 300/365] dmaengine: dw-axi-dmac: ignore interrupt if no descriptor Date: Tue, 23 Aug 2022 10:03:21 +0200 Message-Id: <20220823080130.725787493@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ben Dooks [ Upstream commit 820f5ce999d2f99961e88c16d65cd26764df0590 ] If the channel has no descriptor and the interrupt is raised then the kernel will OOPS. Check the result of vchan_next_desc() in the handler axi_chan_block_xfer_complete() to avoid the error happening. Signed-off-by: Ben Dooks Link: https://lore.kernel.org/r/20220708170153.269991-4-ben.dooks@sifive.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/d= w-axi-dmac/dw-axi-dmac-platform.c index 41583f01a360..a183d93bd7e2 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -1054,6 +1054,11 @@ static void axi_chan_block_xfer_complete(struct axi_= dma_chan *chan) =20 /* The completed descriptor currently is in the head of vc list */ vd =3D vchan_next_desc(&chan->vc); + if (!vd) { + dev_err(chan2dev(chan), "BUG: %s, IRQ with no descriptors\n", + axi_chan_name(chan)); + goto out; + } =20 if (chan->cyclic) { desc =3D vd_to_axi_desc(vd); @@ -1083,6 +1088,7 @@ static void axi_chan_block_xfer_complete(struct axi_d= ma_chan *chan) axi_chan_start_first_queued(chan); } =20 +out: spin_unlock_irqrestore(&chan->vc.lock, flags); } =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C270C32772 for ; Tue, 23 Aug 2022 09:26:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349858AbiHWJYt (ORCPT ); Tue, 23 Aug 2022 05:24:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbiHWJWK (ORCPT ); Tue, 23 Aug 2022 05:22:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA1C08E0FB; Tue, 23 Aug 2022 01:34:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 47EE6B81C1C; Tue, 23 Aug 2022 08:33:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 844B1C433D6; Tue, 23 Aug 2022 08:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243608; bh=TPy/KETqUmQZnZolpNzXaphI9rczF7IPRF6bkrILUNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dJj7kE49icp3SDmC4ZMcnu5r8Lj5UD3RVcnoPFVEvh4KZsXzPiGhh2Caeg7iz4Nh9 fMruXXdvuPfcjR8lYfwEfopIK+h3NQ/ndrHsckGAJ0Nacee+tpX99y4/lVXFjGVlay ePFyQ0Qe7Bl9g3ewdc1NmQNpG5BxY2vDX2VIrH5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takeshi Saito , Wolfram Sang , Yoshihiro Shimoda , Ulf Hansson , Sasha Levin Subject: [PATCH 5.19 301/365] mmc: renesas_sdhi: newer SoCs dont need manual tap correction Date: Tue, 23 Aug 2022 10:03:22 +0200 Message-Id: <20220823080130.777525058@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takeshi Saito [ Upstream commit 00e8c11c137b2e4b2bf54dc9881cf32e3441ddb4 ] The newest Gen3 SoCs and Gen4 SoCs do not need manual tap correction with HS400 anymore. So, instead of checking the SDHI version, add a quirk flag and set manual tap correction only for affected SoCs. Signed-off-by: Takeshi Saito [wsa: rebased, renamed the quirk variable, removed stale comment] Signed-off-by: Wolfram Sang Reviewed-by: Yoshihiro Shimoda Tested-by: Yoshihiro Shimoda Link: https://lore.kernel.org/r/20220720072901.1266-1-wsa+renesas@sang-engi= neering.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/mmc/host/renesas_sdhi.h | 1 + drivers/mmc/host/renesas_sdhi_core.c | 5 ++--- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdh= i.h index 1a1e3e020a8c..c4abfee1ebae 100644 --- a/drivers/mmc/host/renesas_sdhi.h +++ b/drivers/mmc/host/renesas_sdhi.h @@ -43,6 +43,7 @@ struct renesas_sdhi_quirks { bool hs400_4taps; bool fixed_addr_mode; bool dma_one_rx_only; + bool manual_tap_correction; u32 hs400_bad_taps; const u8 (*hs400_calib_table)[SDHI_CALIB_TABLE_MAX]; }; diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesa= s_sdhi_core.c index 55f7b27c3de7..6edbf5c161ab 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -380,8 +380,7 @@ static void renesas_sdhi_hs400_complete(struct mmc_host= *mmc) sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_DT2FF, priv->scc_tappos_hs400); =20 - /* Gen3 can't do automatic tap correction with HS400, so disable it */ - if (sd_ctrl_read16(host, CTL_VERSION) =3D=3D SDHI_VER_GEN3_SDMMC) + if (priv->quirks && priv->quirks->manual_tap_correction) sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL, ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN & sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL)); @@ -718,7 +717,7 @@ static bool renesas_sdhi_manual_correction(struct tmio_= mmc_host *host, bool use_ sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ, 0); =20 /* Change TAP position according to correction status */ - if (sd_ctrl_read16(host, CTL_VERSION) =3D=3D SDHI_VER_GEN3_SDMMC && + if (priv->quirks && priv->quirks->manual_tap_correction && host->mmc->ios.timing =3D=3D MMC_TIMING_MMC_HS400) { u32 bad_taps =3D priv->quirks ? priv->quirks->hs400_bad_taps : 0; /* diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/ho= st/renesas_sdhi_internal_dmac.c index 3084b15ae2cb..52915404eb07 100644 --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c @@ -170,6 +170,7 @@ static const struct renesas_sdhi_quirks sdhi_quirks_4ta= p_nohs400_one_rx =3D { static const struct renesas_sdhi_quirks sdhi_quirks_4tap =3D { .hs400_4taps =3D true, .hs400_bad_taps =3D BIT(2) | BIT(3) | BIT(6) | BIT(7), + .manual_tap_correction =3D true, }; =20 static const struct renesas_sdhi_quirks sdhi_quirks_nohs400 =3D { @@ -182,25 +183,30 @@ static const struct renesas_sdhi_quirks sdhi_quirks_f= ixed_addr =3D { =20 static const struct renesas_sdhi_quirks sdhi_quirks_bad_taps1357 =3D { .hs400_bad_taps =3D BIT(1) | BIT(3) | BIT(5) | BIT(7), + .manual_tap_correction =3D true, }; =20 static const struct renesas_sdhi_quirks sdhi_quirks_bad_taps2367 =3D { .hs400_bad_taps =3D BIT(2) | BIT(3) | BIT(6) | BIT(7), + .manual_tap_correction =3D true, }; =20 static const struct renesas_sdhi_quirks sdhi_quirks_r8a7796_es13 =3D { .hs400_4taps =3D true, .hs400_bad_taps =3D BIT(2) | BIT(3) | BIT(6) | BIT(7), .hs400_calib_table =3D r8a7796_es13_calib_table, + .manual_tap_correction =3D true, }; =20 static const struct renesas_sdhi_quirks sdhi_quirks_r8a77965 =3D { .hs400_bad_taps =3D BIT(2) | BIT(3) | BIT(6) | BIT(7), .hs400_calib_table =3D r8a77965_calib_table, + .manual_tap_correction =3D true, }; =20 static const struct renesas_sdhi_quirks sdhi_quirks_r8a77990 =3D { .hs400_calib_table =3D r8a77990_calib_table, + .manual_tap_correction =3D true, }; =20 /* --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49A98C32792 for ; Tue, 23 Aug 2022 09:22:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349429AbiHWJWq (ORCPT ); Tue, 23 Aug 2022 05:22:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350011AbiHWJVY (ORCPT ); Tue, 23 Aug 2022 05:21:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11F5F8B99B; Tue, 23 Aug 2022 01:34:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 53C5DB81C29; Tue, 23 Aug 2022 08:33:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD894C433B5; Tue, 23 Aug 2022 08:33:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243611; bh=lFI0+KLWRHDwjEi/LS3WyQnU8XrSg5yvyMJoMLq3Zbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0YghMQJSLr2xWSDFThmXLMYHzs0GJ2cvN3/BijrmLstPkyKnT6SnhldoaNoLQ0wPc tNnEwk+/SD/+Q3ZkkFr1S6fE5Ne1ExEt+stzHdPpUXUp5QtamzMSP8wYjkTSeokL0I g2f2om4XSnEGUvP9T1aNwmgVj2NTetnJ3rF7mOhY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , "Rafael J. Wysocki" , Sudeep Holla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.19 302/365] ACPI: PPTT: Leave the table mapped for the runtime usage Date: Tue, 23 Aug 2022 10:03:23 +0200 Message-Id: <20220823080130.818824528@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sudeep Holla [ Upstream commit 0c80f9e165f8f9cca743d7b6cbdb54362da297e0 ] Currently, everytime an information needs to be fetched from the PPTT, the table is mapped via acpi_get_table() and unmapped after the use via acpi_put_table() which is fine. However we do this at runtime especially when the CPU is hotplugged out and plugged in back since we re-populate the cache topology and other information. However, with the support to fetch LLC information from the PPTT in the cpuhotplug path which is executed in the atomic context, it is preferred to avoid mapping and unmapping of the PPTT for every single use as the acpi_get_table() might sleep waiting for a mutex. In order to avoid the same, the table is needs to just mapped once on the boot CPU and is never unmapped allowing it to be used at runtime with out the hassle of mapping and unmapping the table. Reported-by: Guenter Roeck Cc: Rafael J. Wysocki Signed-off-by: Sudeep Holla -- Hi Rafael, Sorry to bother you again on this PPTT changes. Guenter reported an issue with lockdep enabled in -next that include my cacheinfo/arch_topology chang= es to utilise LLC from PPTT in the CPU hotplug path. Please ack the change once you are happy so that I can get it merged with other fixes via Greg's tree. Regards, Sudeep Acked-by: Rafael J. Wysocki Link: https://lore.kernel.org/r/20220720-arch_topo_fixes-v3-2-43d696288e84@= arm.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/acpi/pptt.c | 102 ++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 55 deletions(-) diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c index 701f61c01359..3ad2823eb6f8 100644 --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c @@ -532,21 +532,37 @@ static int topology_get_acpi_cpu_tag(struct acpi_tabl= e_header *table, return -ENOENT; } =20 + +static struct acpi_table_header *acpi_get_pptt(void) +{ + static struct acpi_table_header *pptt; + acpi_status status; + + /* + * PPTT will be used at runtime on every CPU hotplug in path, so we + * don't need to call acpi_put_table() to release the table mapping. + */ + if (!pptt) { + status =3D acpi_get_table(ACPI_SIG_PPTT, 0, &pptt); + if (ACPI_FAILURE(status)) + acpi_pptt_warn_missing(); + } + + return pptt; +} + static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int fla= g) { struct acpi_table_header *table; - acpi_status status; int retval; =20 - status =3D acpi_get_table(ACPI_SIG_PPTT, 0, &table); - if (ACPI_FAILURE(status)) { - acpi_pptt_warn_missing(); + table =3D acpi_get_pptt(); + if (!table) return -ENOENT; - } + retval =3D topology_get_acpi_cpu_tag(table, cpu, level, flag); pr_debug("Topology Setup ACPI CPU %d, level %d ret =3D %d\n", cpu, level, retval); - acpi_put_table(table); =20 return retval; } @@ -567,16 +583,13 @@ static int find_acpi_cpu_topology_tag(unsigned int cp= u, int level, int flag) static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag) { struct acpi_table_header *table; - acpi_status status; u32 acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); struct acpi_pptt_processor *cpu_node =3D NULL; int ret =3D -ENOENT; =20 - status =3D acpi_get_table(ACPI_SIG_PPTT, 0, &table); - if (ACPI_FAILURE(status)) { - acpi_pptt_warn_missing(); - return ret; - } + table =3D acpi_get_pptt(); + if (!table) + return -ENOENT; =20 if (table->revision >=3D rev) cpu_node =3D acpi_find_processor_node(table, acpi_cpu_id); @@ -584,8 +597,6 @@ static int check_acpi_cpu_flag(unsigned int cpu, int re= v, u32 flag) if (cpu_node) ret =3D (cpu_node->flags & flag) !=3D 0; =20 - acpi_put_table(table); - return ret; } =20 @@ -604,18 +615,15 @@ int acpi_find_last_cache_level(unsigned int cpu) u32 acpi_cpu_id; struct acpi_table_header *table; int number_of_levels =3D 0; - acpi_status status; + + table =3D acpi_get_pptt(); + if (!table) + return -ENOENT; =20 pr_debug("Cache Setup find last level CPU=3D%d\n", cpu); =20 acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); - status =3D acpi_get_table(ACPI_SIG_PPTT, 0, &table); - if (ACPI_FAILURE(status)) { - acpi_pptt_warn_missing(); - } else { - number_of_levels =3D acpi_find_cache_levels(table, acpi_cpu_id); - acpi_put_table(table); - } + number_of_levels =3D acpi_find_cache_levels(table, acpi_cpu_id); pr_debug("Cache Setup find last level level=3D%d\n", number_of_levels); =20 return number_of_levels; @@ -637,20 +645,16 @@ int acpi_find_last_cache_level(unsigned int cpu) int cache_setup_acpi(unsigned int cpu) { struct acpi_table_header *table; - acpi_status status; =20 - pr_debug("Cache Setup ACPI CPU %d\n", cpu); - - status =3D acpi_get_table(ACPI_SIG_PPTT, 0, &table); - if (ACPI_FAILURE(status)) { - acpi_pptt_warn_missing(); + table =3D acpi_get_pptt(); + if (!table) return -ENOENT; - } + + pr_debug("Cache Setup ACPI CPU %d\n", cpu); =20 cache_setup_acpi_cpu(table, cpu); - acpi_put_table(table); =20 - return status; + return 0; } =20 /** @@ -766,50 +770,38 @@ int find_acpi_cpu_topology_package(unsigned int cpu) int find_acpi_cpu_topology_cluster(unsigned int cpu) { struct acpi_table_header *table; - acpi_status status; struct acpi_pptt_processor *cpu_node, *cluster_node; u32 acpi_cpu_id; int retval; int is_thread; =20 - status =3D acpi_get_table(ACPI_SIG_PPTT, 0, &table); - if (ACPI_FAILURE(status)) { - acpi_pptt_warn_missing(); + table =3D acpi_get_pptt(); + if (!table) return -ENOENT; - } =20 acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); cpu_node =3D acpi_find_processor_node(table, acpi_cpu_id); - if (cpu_node =3D=3D NULL || !cpu_node->parent) { - retval =3D -ENOENT; - goto put_table; - } + if (!cpu_node || !cpu_node->parent) + return -ENOENT; =20 is_thread =3D cpu_node->flags & ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD; cluster_node =3D fetch_pptt_node(table, cpu_node->parent); - if (cluster_node =3D=3D NULL) { - retval =3D -ENOENT; - goto put_table; - } + if (!cluster_node) + return -ENOENT; + if (is_thread) { - if (!cluster_node->parent) { - retval =3D -ENOENT; - goto put_table; - } + if (!cluster_node->parent) + return -ENOENT; + cluster_node =3D fetch_pptt_node(table, cluster_node->parent); - if (cluster_node =3D=3D NULL) { - retval =3D -ENOENT; - goto put_table; - } + if (!cluster_node) + return -ENOENT; } if (cluster_node->flags & ACPI_PPTT_ACPI_PROCESSOR_ID_VALID) retval =3D cluster_node->acpi_processor_id; else retval =3D ACPI_PTR_DIFF(cluster_node, table); =20 -put_table: - acpi_put_table(table); - return retval; } =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADAC9C32772 for ; Tue, 23 Aug 2022 09:24:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349552AbiHWJYd (ORCPT ); Tue, 23 Aug 2022 05:24:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350672AbiHWJWE (ORCPT ); Tue, 23 Aug 2022 05:22:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87B378E0CA; Tue, 23 Aug 2022 01:35:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B6E066132D; Tue, 23 Aug 2022 08:33:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1F52C433C1; Tue, 23 Aug 2022 08:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243614; bh=7D0OrVKNjV5W28hSKVEGbz9KYV6kvLGpEuCpVGt/P4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1bBz1aGMQzxQzQ/0edetC0KZoEVLGdUgnEDluDf+mq5ay8C8fQUEp1JEZ39RN5QXL 82AZum4swVk5TJZ4EA1hydEL2VHVf6CK3wlKo5AHCiPp3srZk77gUs4AXJmV6EufjW ouwuQJwbeyifiZ59fLjfvqR3UHUSy/qWUaMN1lnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.19 303/365] RDMA/rxe: Limit the number of calls to each tasklet Date: Tue, 23 Aug 2022 10:03:24 +0200 Message-Id: <20220823080130.862991649@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bob Pearson [ Upstream commit eff6d998ca297cb0b2e53b032a56cf8e04dd8b17 ] Limit the maximum number of calls to each tasklet from rxe_do_task() before yielding the cpu. When the limit is reached reschedule the tasklet and exit the calling loop. This patch prevents one tasklet from consuming 100% of a cpu core and causing a deadlock or soft lockup. Link: https://lore.kernel.org/r/20220630190425.2251-9-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_param.h | 6 ++++++ drivers/infiniband/sw/rxe/rxe_task.c | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/= rxe/rxe_param.h index 568a7cbd13d4..86c7a8bf3cbb 100644 --- a/drivers/infiniband/sw/rxe/rxe_param.h +++ b/drivers/infiniband/sw/rxe/rxe_param.h @@ -105,6 +105,12 @@ enum rxe_device_param { RXE_INFLIGHT_SKBS_PER_QP_HIGH =3D 64, RXE_INFLIGHT_SKBS_PER_QP_LOW =3D 16, =20 + /* Max number of interations of each tasklet + * before yielding the cpu to let other + * work make progress + */ + RXE_MAX_ITERATIONS =3D 1024, + /* Delay before calling arbiter timer */ RXE_NSEC_ARB_TIMER_DELAY =3D 200, =20 diff --git a/drivers/infiniband/sw/rxe/rxe_task.c b/drivers/infiniband/sw/r= xe/rxe_task.c index 0c4db5bb17d7..2248cf33d776 100644 --- a/drivers/infiniband/sw/rxe/rxe_task.c +++ b/drivers/infiniband/sw/rxe/rxe_task.c @@ -8,7 +8,7 @@ #include #include =20 -#include "rxe_task.h" +#include "rxe.h" =20 int __rxe_do_task(struct rxe_task *task) =20 @@ -33,6 +33,7 @@ void rxe_do_task(struct tasklet_struct *t) int cont; int ret; struct rxe_task *task =3D from_tasklet(task, t, tasklet); + unsigned int iterations =3D RXE_MAX_ITERATIONS; =20 spin_lock_bh(&task->state_lock); switch (task->state) { @@ -61,13 +62,20 @@ void rxe_do_task(struct tasklet_struct *t) spin_lock_bh(&task->state_lock); switch (task->state) { case TASK_STATE_BUSY: - if (ret) + if (ret) { task->state =3D TASK_STATE_START; - else + } else if (iterations--) { cont =3D 1; + } else { + /* reschedule the tasklet and exit + * the loop to give up the cpu + */ + tasklet_schedule(&task->tasklet); + task->state =3D TASK_STATE_START; + } break; =20 - /* soneone tried to run the task since the last time we called + /* someone tried to run the task since the last time we called * func, so we will call one more time regardless of the * return value */ --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C40DEC32792 for ; Tue, 23 Aug 2022 09:46:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351532AbiHWJp0 (ORCPT ); Tue, 23 Aug 2022 05:45:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351941AbiHWJkm (ORCPT ); Tue, 23 Aug 2022 05:40:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 512AE792D8; Tue, 23 Aug 2022 01:41:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F1CC66123D; Tue, 23 Aug 2022 08:33:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E02A6C433D6; Tue, 23 Aug 2022 08:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243617; bh=wx7auUZauTUrHSIJMex3tejmGanZog/dMv720xCvWTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uraBdw8zS8OsMI46LCIh7tzxYAof5f57jmzEIFxgwOTqk3SzPqWL+apN/qz+WTXrj h+db5lDAMFhJweYlVn9hy1yr9riy4ZDX9//J6ZKDqehd9IWGufpn6kNFUJg1/h01yI 76ZRNyIkHAJu23+M9OTVXXPUDi7joURehgNbAwxE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Guokai , "Masami Hiramatsu (Google)" , Liao Chang , Guo Ren , Sasha Levin Subject: [PATCH 5.19 304/365] csky/kprobe: reclaim insn_slot on kprobe unregistration Date: Tue, 23 Aug 2022 10:03:25 +0200 Message-Id: <20220823080130.903891051@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liao Chang [ Upstream commit a2310c74d418deca0f1d749c45f1f43162510f51 ] On kprobe registration kernel allocate one insn_slot for new kprobe, but it forget to reclaim the insn_slot on unregistration, leading to a potential leakage. Reported-by: Chen Guokai Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Liao Chang Signed-off-by: Guo Ren Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/csky/kernel/probes/kprobes.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/csky/kernel/probes/kprobes.c b/arch/csky/kernel/probes/kp= robes.c index 34ba684d5962..3c6e5c725d81 100644 --- a/arch/csky/kernel/probes/kprobes.c +++ b/arch/csky/kernel/probes/kprobes.c @@ -124,6 +124,10 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) =20 void __kprobes arch_remove_kprobe(struct kprobe *p) { + if (p->ainsn.api.insn) { + free_insn_slot(p->ainsn.api.insn, 0); + p->ainsn.api.insn =3D NULL; + } } =20 static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEA50C32792 for ; Tue, 23 Aug 2022 09:25:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244531AbiHWJZO (ORCPT ); Tue, 23 Aug 2022 05:25:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349548AbiHWJXK (ORCPT ); Tue, 23 Aug 2022 05:23:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D17EC8F957; Tue, 23 Aug 2022 01:35:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CEC8BB81C4D; Tue, 23 Aug 2022 08:33:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C094C433D6; Tue, 23 Aug 2022 08:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243620; bh=QueCjxHMA4r1uCGTLX+Zuc00mP9QzA7Dxm10f7BgXZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PqXSKpksgWG8R7v1zUdqXT8EDTGqslS7q/aTqOJl3pscTNFxzW3Yn4+K3dkluPZVP oGg3MWY9GW/1EFcN7bbXX5Wnj/Z6ZbljPUCiYf/7ICAOkwEVDTOkrhyfoJN4mjKsAq Z5xR3NJhbxo4+Z0FoXylhpoRUCpN27+jJcKl8dEQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.19 305/365] selftests/kprobe: Do not test for GRP/ without event failures Date: Tue, 23 Aug 2022 10:03:26 +0200 Message-Id: <20220823080130.954139426@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) [ Upstream commit f5eab65ff2b76449286d18efc7fee3e0b72f7d9b ] A new feature is added where kprobes (and other probes) do not need to explicitly state the event name when creating a probe. The event name will come from what is being attached. That is: # echo 'p:foo/ vfs_read' > kprobe_events Will no longer error, but instead create an event: # cat kprobe_events p:foo/p_vfs_read_0 vfs_read This should not be tested as an error case anymore. Remove it from the selftest as now this feature "breaks" the selftest as it no longer fails as expected. Link: https://lore.kernel.org/all/1656296348-16111-1-git-send-email-quic_li= nyyuan@quicinc.com/ Link: https://lkml.kernel.org/r/20220712161707.6dc08a14@gandalf.local.home Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- .../selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_err= ors.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.= tc index fa928b431555..7c02509c71d0 100644 --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc @@ -21,7 +21,6 @@ check_error 'p:^/bar vfs_read' # NO_GROUP_NAME check_error 'p:^1234567890123456789012345678901234567890123456789012345678= 9012345/bar vfs_read' # GROUP_TOO_LONG =20 check_error 'p:^foo.1/bar vfs_read' # BAD_GROUP_NAME -check_error 'p:foo/^ vfs_read' # NO_EVENT_NAME check_error 'p:foo/^123456789012345678901234567890123456789012345678901234= 56789012345 vfs_read' # EVENT_TOO_LONG check_error 'p:foo/^bar.1 vfs_read' # BAD_EVENT_NAME =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 122EAC32772 for ; Tue, 23 Aug 2022 10:07:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352484AbiHWKHn (ORCPT ); Tue, 23 Aug 2022 06:07:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352445AbiHWKBz (ORCPT ); Tue, 23 Aug 2022 06:01:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9209B7C1CD; Tue, 23 Aug 2022 01:49:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BA296B81C50; Tue, 23 Aug 2022 08:33:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F4EBC433C1; Tue, 23 Aug 2022 08:33:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243623; bh=/EAzLTw2LDeTTq+gH0iIZMFAkA3J3B3MG6b3v5PKd8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wXIW0YDMKyye69iUaMvGeD5I66tGKpPpxglAaYKQYrnp/Avt932a+4Sx+43FcCLiV ZUNXc/SuhRw1ASiefOXu34Le3kgWz9nnnhjCzVlzE8f9l8pfhCYoIJt6ZZIyvD3LyX JVQfsq3doNBQQq6SQXFqhxT/ZsWnTj7johk4ggRA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Akhil R , Jon Hunter , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 306/365] dmaengine: tegra: Add terminate() for Tegra234 Date: Tue, 23 Aug 2022 10:03:27 +0200 Message-Id: <20220823080130.997084605@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Akhil R [ Upstream commit 36834c67016794b8fa03d7672a5b7f2cc4529298 ] In certain cases where the DMA client bus gets corrupted or if the end device ceases to send/receive data, DMA can wait indefinitely for the data to be received/sent. Attempting to terminate the transfer will put the DMA in pause flush mode and it remains there. The channel is irrecoverable once this pause times out in Tegra194 and earlier chips. Whereas, from Tegra234, it can be recovered by disabling the channel and reprograming it. Hence add a new terminate() function that ignores the outcome of dma_pause() so that terminate_all() can proceed to disable the channel. Signed-off-by: Akhil R Reviewed-by: Jon Hunter Link: https://lore.kernel.org/r/20220720104045.16099-3-akhilrajeev@nvidia.c= om Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/dma/tegra186-gpc-dma.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c index 05cd451f541d..fa9bda4a2bc6 100644 --- a/drivers/dma/tegra186-gpc-dma.c +++ b/drivers/dma/tegra186-gpc-dma.c @@ -157,8 +157,8 @@ * If any burst is in flight and DMA paused then this is the time to compl= ete * on-flight burst and update DMA status register. */ -#define TEGRA_GPCDMA_BURST_COMPLETE_TIME 20 -#define TEGRA_GPCDMA_BURST_COMPLETION_TIMEOUT 100 +#define TEGRA_GPCDMA_BURST_COMPLETE_TIME 10 +#define TEGRA_GPCDMA_BURST_COMPLETION_TIMEOUT 5000 /* 5 msec */ =20 /* Channel base address offset from GPCDMA base address */ #define TEGRA_GPCDMA_CHANNEL_BASE_ADD_OFFSET 0x20000 @@ -432,6 +432,17 @@ static int tegra_dma_device_resume(struct dma_chan *dc) return 0; } =20 +static inline int tegra_dma_pause_noerr(struct tegra_dma_channel *tdc) +{ + /* Return 0 irrespective of PAUSE status. + * This is useful to recover channels that can exit out of flush + * state when the channel is disabled. + */ + + tegra_dma_pause(tdc); + return 0; +} + static void tegra_dma_disable(struct tegra_dma_channel *tdc) { u32 csr, status; @@ -1292,6 +1303,14 @@ static const struct tegra_dma_chip_data tegra194_dma= _chip_data =3D { .terminate =3D tegra_dma_pause, }; =20 +static const struct tegra_dma_chip_data tegra234_dma_chip_data =3D { + .nr_channels =3D 31, + .channel_reg_size =3D SZ_64K, + .max_dma_count =3D SZ_1G, + .hw_support_pause =3D true, + .terminate =3D tegra_dma_pause_noerr, +}; + static const struct of_device_id tegra_dma_of_match[] =3D { { .compatible =3D "nvidia,tegra186-gpcdma", @@ -1299,6 +1318,9 @@ static const struct of_device_id tegra_dma_of_match[]= =3D { }, { .compatible =3D "nvidia,tegra194-gpcdma", .data =3D &tegra194_dma_chip_data, + }, { + .compatible =3D "nvidia,tegra234-gpcdma", + .data =3D &tegra234_dma_chip_data, }, { }, }; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23FB8C32774 for ; Tue, 23 Aug 2022 09:18:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243853AbiHWJSD (ORCPT ); Tue, 23 Aug 2022 05:18:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347922AbiHWJPc (ORCPT ); Tue, 23 Aug 2022 05:15:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0F986DADC; Tue, 23 Aug 2022 01:32:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F285B61257; Tue, 23 Aug 2022 08:32:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FD87C433C1; Tue, 23 Aug 2022 08:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243533; bh=CGcBH5rQ3CR51QKmCPkYsyRGCuTCXCRNzB1PPUJkLT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DxIlpNJpuP1fxKNsFobfTKfaOKkKRtFQdlFSpmHVeEqnPtdJPPXhJw4ghXlABbKkc cTdnDWG8Q/dMha6aL7XakjnJXmGscNBHZr8Rj3N/DpHahFeiXCZAMRBxM2omgrWfqD zAB4Fd0ZCni5jtR7oPsNbzQc20hKxSNKKEuQS1go= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Baolin Wang , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 307/365] dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed Date: Tue, 23 Aug 2022 10:03:28 +0200 Message-Id: <20220823080131.028457465@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 1e42f82cbec7b2cc4873751e7791e6611901c5fc ] It's not allowed to quit remove early without cleaning up completely. Otherwise this results in resource leaks that probably yield graver problems later. Here for example some tasklets might survive the lifetime of the sprd-dma device and access sdev which is freed after .remove() returns. As none of the device freeing requires an active device, just ignore the return value of pm_runtime_get_sync(). Signed-off-by: Uwe Kleine-K=C3=B6nig Reviewed-by: Baolin Wang Link: https://lore.kernel.org/r/20220721204054.323602-1-u.kleine-koenig@pen= gutronix.de Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/dma/sprd-dma.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 2138b80435ab..474d3ba8ec9f 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -1237,11 +1237,8 @@ static int sprd_dma_remove(struct platform_device *p= dev) { struct sprd_dma_dev *sdev =3D platform_get_drvdata(pdev); struct sprd_dma_chn *c, *cn; - int ret; =20 - ret =3D pm_runtime_get_sync(&pdev->dev); - if (ret < 0) - return ret; + pm_runtime_get_sync(&pdev->dev); =20 /* explicitly free the irq */ if (sdev->irq > 0) --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46246C32792 for ; Tue, 23 Aug 2022 09:18:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349300AbiHWJSG (ORCPT ); Tue, 23 Aug 2022 05:18:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349336AbiHWJPz (ORCPT ); Tue, 23 Aug 2022 05:15:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62E7566A79; Tue, 23 Aug 2022 01:32:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 866B3B81C29; Tue, 23 Aug 2022 08:32:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1EDCC433D6; Tue, 23 Aug 2022 08:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243536; bh=pDZYCUKc7EsLtF1IZaPH9JRuv/2vLuG01EJzQdJBSrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zTElMdIU0LJkckEintWF1VuMjKF6V1XOMoJYFNY1JOldtdmxEFF40meN01hUUoY8o d2PSYj8v0JQxx3z8vGW9jcwW5HSX5eGOq+EHL0SASjLVoDePybW5T8SlMdsrrKJbCz z7dQOWyHH2O0JUpCSrhQppQeJH8aaRNDt8+Z4im8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Md Haris Iqbal , Bob Pearson , Li Zhijian , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.19 308/365] Revert "RDMA/rxe: Create duplicate mapping tables for FMRs" Date: Tue, 23 Aug 2022 10:03:29 +0200 Message-Id: <20220823080131.059195278@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Li Zhijian [ Upstream commit 1e75550648da1fa1cd1969e7597355de8fe8caf6 ] Below 2 commits will be reverted: commit 8ff5f5d9d8cf ("RDMA/rxe: Prevent double freeing rxe_map_set()") commit 647bf13ce944 ("RDMA/rxe: Create duplicate mapping tables for FMRs") The community has a few bug reports which pointed this commit at last. Some proposals are raised up in the meantime but all of them have no follow-up operation. The previous commit led the map_set of FMR to be not available any more if the MR is registered again after invalidating. Although the mentioned patch try to fix a potential race in building/accessing the same table for fast memory regions, it broke rtrs etc ULPs. Since the latter could be worse, revert this patch. With previous commit, it's observed that a same MR in rnbd server will trigger below code path: -> rxe_mr_init_fast() |-> alloc map_set() # map_set is uninitialized |...-> rxe_map_mr_sg() # build the map_set |-> rxe_mr_set_page() |...-> rxe_reg_fast_mr() # mr->state change to VALID from FREE that means # we can access host memory(such rxe_mr_copy) |...-> rxe_invalidate_mr() # mr->state change to FREE from VALID |...-> rxe_reg_fast_mr() # mr->state change to VALID from FREE, # but map_set was not built again |...-> rxe_mr_copy() # kernel crash due to access wild addresses # that lookup from the map_set The backtraces are not always identical. [1st]---------- RIP: 0010:lookup_iova+0x66/0xa0 [rdma_rxe] Code: 00 00 00 48 d3 ee 89 32 c3 4c 8b 18 49 8b 3b 48 8b 47 08 48 39 c6 7= 2 38 48 29 c6 45 31 d2 b8 01 00 00 00 48 63 c8 48 c1 e1 04 <48> 8b 4c 0f 08= 48 39 f1 77 21 83 c0 01 48 29 ce 3d 00 01 00 00 75 RSP: 0018:ffffb7ff80063bf0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff9b9949d86800 RCX: 0000000000000000 RDX: ffffb7ff80063c00 RSI: 0000000049f6b378 RDI: 002818da00000004 RBP: 0000000000000120 R08: ffffb7ff80063c08 R09: ffffb7ff80063c04 R10: 0000000000000002 R11: ffff9b9916f7eef8 R12: ffff9b99488a0038 R13: ffff9b99488a0038 R14: ffff9b9914fb346a R15: ffff9b990ab27000 FS: 0000000000000000(0000) GS:ffff9b997dc00000(0000) knlGS:0000000000000= 000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007efc33a98ed0 CR3: 0000000014f32004 CR4: 00000000001706f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: rxe_mr_copy.part.0+0x6f/0x140 [rdma_rxe] rxe_responder+0x12ee/0x1b60 [rdma_rxe] ? rxe_icrc_check+0x7e/0x100 [rdma_rxe] ? rxe_rcv+0x1d0/0x780 [rdma_rxe] ? rxe_icrc_hdr.isra.0+0xf6/0x160 [rdma_rxe] rxe_do_task+0x67/0xb0 [rdma_rxe] rxe_xmit_packet+0xc7/0x210 [rdma_rxe] rxe_requester+0x680/0xee0 [rdma_rxe] ? update_load_avg+0x5f/0x690 ? update_load_avg+0x5f/0x690 ? rtrs_clt_recv_done+0x1b/0x30 [rtrs_client] [2nd]---------- RIP: 0010:rxe_mr_copy.part.0+0xa8/0x140 [rdma_rxe] Code: 00 00 49 c1 e7 04 48 8b 00 4c 8d 2c d0 48 8b 44 24 10 4d 03 7d 00 8= 5 ed 7f 10 eb 6c 89 54 24 0c 49 83 c7 10 31 c0 85 ed 7e 5e <49> 8b 3f 8b 14= 24 4c 89 f6 48 01 c7 85 d2 74 06 48 89 fe 4c 89 f7 RSP: 0018:ffffae3580063bf8 EFLAGS: 00010202 RAX: 0000000000018978 RBX: ffff9d7ef7a03600 RCX: 0000000000000008 RDX: 000000000000007c RSI: 000000000000007c RDI: ffff9d7ef7a03600 RBP: 0000000000000120 R08: ffffae3580063c08 R09: ffffae3580063c04 R10: ffff9d7efece0038 R11: ffff9d7ec4b1db00 R12: ffff9d7efece0038 R13: ffff9d7ef4098260 R14: ffff9d7f11e23c6a R15: 4c79500065708144 FS: 0000000000000000(0000) GS:ffff9d7f3dc00000(0000) knlGS:0000000000000= 000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fce47276c60 CR3: 0000000003f66004 CR4: 00000000001706f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: rxe_responder+0x12ee/0x1b60 [rdma_rxe] ? rxe_icrc_check+0x7e/0x100 [rdma_rxe] ? rxe_rcv+0x1d0/0x780 [rdma_rxe] ? rxe_icrc_hdr.isra.0+0xf6/0x160 [rdma_rxe] rxe_do_task+0x67/0xb0 [rdma_rxe] rxe_xmit_packet+0xc7/0x210 [rdma_rxe] rxe_requester+0x680/0xee0 [rdma_rxe] ? update_load_avg+0x5f/0x690 ? update_load_avg+0x5f/0x690 ? rtrs_clt_recv_done+0x1b/0x30 [rtrs_client] rxe_do_task+0x67/0xb0 [rdma_rxe] tasklet_action_common.constprop.0+0x92/0xc0 __do_softirq+0xe1/0x2d8 run_ksoftirqd+0x21/0x30 smpboot_thread_fn+0x183/0x220 ? sort_range+0x20/0x20 kthread+0xe2/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30 Link: https://lore.kernel.org/r/1658805386-2-1-git-send-email-lizhijian@fuj= itsu.com Link: https://lore.kernel.org/all/20220210073655.42281-1-guoqing.jiang@linu= x.dev/T/ Link: https://www.spinics.net/lists/linux-rdma/msg110836.html Link: https://lore.kernel.org/lkml/94a5ea93-b8bb-3a01-9497-e2021f29598a@lin= ux.dev/t/ Tested-by: Md Haris Iqbal Reviewed-by: Bob Pearson Signed-off-by: Li Zhijian Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_loc.h | 1 - drivers/infiniband/sw/rxe/rxe_mr.c | 199 +++++++++----------------- drivers/infiniband/sw/rxe/rxe_mw.c | 6 +- drivers/infiniband/sw/rxe/rxe_verbs.c | 39 +++-- drivers/infiniband/sw/rxe/rxe_verbs.h | 21 ++- 5 files changed, 104 insertions(+), 162 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rx= e/rxe_loc.h index 37484a559d20..d86253c6d6b5 100644 --- a/drivers/infiniband/sw/rxe/rxe_loc.h +++ b/drivers/infiniband/sw/rxe/rxe_loc.h @@ -79,7 +79,6 @@ int mr_check_range(struct rxe_mr *mr, u64 iova, size_t le= ngth); int advance_dma_data(struct rxe_dma_info *dma, unsigned int length); int rxe_invalidate_mr(struct rxe_qp *qp, u32 key); int rxe_reg_fast_mr(struct rxe_qp *qp, struct rxe_send_wqe *wqe); -int rxe_mr_set_page(struct ib_mr *ibmr, u64 addr); int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata); void rxe_mr_cleanup(struct rxe_pool_elem *elem); =20 diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe= /rxe_mr.c index 3add52129006..c28b18d59a06 100644 --- a/drivers/infiniband/sw/rxe/rxe_mr.c +++ b/drivers/infiniband/sw/rxe/rxe_mr.c @@ -24,7 +24,7 @@ u8 rxe_get_next_key(u32 last_key) =20 int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length) { - struct rxe_map_set *set =3D mr->cur_map_set; + =20 switch (mr->type) { case IB_MR_TYPE_DMA: @@ -32,8 +32,8 @@ int mr_check_range(struct rxe_mr *mr, u64 iova, size_t le= ngth) =20 case IB_MR_TYPE_USER: case IB_MR_TYPE_MEM_REG: - if (iova < set->iova || length > set->length || - iova > set->iova + set->length - length) + if (iova < mr->iova || length > mr->length || + iova > mr->iova + mr->length - length) return -EFAULT; return 0; =20 @@ -65,89 +65,41 @@ static void rxe_mr_init(int access, struct rxe_mr *mr) mr->map_shift =3D ilog2(RXE_BUF_PER_MAP); } =20 -static void rxe_mr_free_map_set(int num_map, struct rxe_map_set *set) -{ - int i; - - for (i =3D 0; i < num_map; i++) - kfree(set->map[i]); - - kfree(set->map); - kfree(set); -} - -static int rxe_mr_alloc_map_set(int num_map, struct rxe_map_set **setp) +static int rxe_mr_alloc(struct rxe_mr *mr, int num_buf) { int i; - struct rxe_map_set *set; + int num_map; + struct rxe_map **map =3D mr->map; =20 - set =3D kmalloc(sizeof(*set), GFP_KERNEL); - if (!set) - goto err_out; + num_map =3D (num_buf + RXE_BUF_PER_MAP - 1) / RXE_BUF_PER_MAP; =20 - set->map =3D kmalloc_array(num_map, sizeof(struct rxe_map *), GFP_KERNEL); - if (!set->map) - goto err_free_set; + mr->map =3D kmalloc_array(num_map, sizeof(*map), GFP_KERNEL); + if (!mr->map) + goto err1; =20 for (i =3D 0; i < num_map; i++) { - set->map[i] =3D kmalloc(sizeof(struct rxe_map), GFP_KERNEL); - if (!set->map[i]) - goto err_free_map; + mr->map[i] =3D kmalloc(sizeof(**map), GFP_KERNEL); + if (!mr->map[i]) + goto err2; } =20 - *setp =3D set; - - return 0; - -err_free_map: - for (i--; i >=3D 0; i--) - kfree(set->map[i]); - - kfree(set->map); -err_free_set: - kfree(set); -err_out: - return -ENOMEM; -} - -/** - * rxe_mr_alloc() - Allocate memory map array(s) for MR - * @mr: Memory region - * @num_buf: Number of buffer descriptors to support - * @both: If non zero allocate both mr->map and mr->next_map - * else just allocate mr->map. Used for fast MRs - * - * Return: 0 on success else an error - */ -static int rxe_mr_alloc(struct rxe_mr *mr, int num_buf, int both) -{ - int ret; - int num_map; - BUILD_BUG_ON(!is_power_of_2(RXE_BUF_PER_MAP)); - num_map =3D (num_buf + RXE_BUF_PER_MAP - 1) / RXE_BUF_PER_MAP; =20 mr->map_shift =3D ilog2(RXE_BUF_PER_MAP); mr->map_mask =3D RXE_BUF_PER_MAP - 1; + mr->num_buf =3D num_buf; - mr->max_buf =3D num_map * RXE_BUF_PER_MAP; mr->num_map =3D num_map; - - ret =3D rxe_mr_alloc_map_set(num_map, &mr->cur_map_set); - if (ret) - return -ENOMEM; - - if (both) { - ret =3D rxe_mr_alloc_map_set(num_map, &mr->next_map_set); - if (ret) - goto err_free; - } + mr->max_buf =3D num_map * RXE_BUF_PER_MAP; =20 return 0; =20 -err_free: - rxe_mr_free_map_set(mr->num_map, mr->cur_map_set); - mr->cur_map_set =3D NULL; +err2: + for (i--; i >=3D 0; i--) + kfree(mr->map[i]); + + kfree(mr->map); +err1: return -ENOMEM; } =20 @@ -164,7 +116,6 @@ void rxe_mr_init_dma(struct rxe_pd *pd, int access, str= uct rxe_mr *mr) int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova, int access, struct rxe_mr *mr) { - struct rxe_map_set *set; struct rxe_map **map; struct rxe_phys_buf *buf =3D NULL; struct ib_umem *umem; @@ -172,6 +123,7 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 = length, u64 iova, int num_buf; void *vaddr; int err; + int i; =20 umem =3D ib_umem_get(pd->ibpd.device, start, length, access); if (IS_ERR(umem)) { @@ -185,20 +137,18 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u6= 4 length, u64 iova, =20 rxe_mr_init(access, mr); =20 - err =3D rxe_mr_alloc(mr, num_buf, 0); + err =3D rxe_mr_alloc(mr, num_buf); if (err) { pr_warn("%s: Unable to allocate memory for map\n", __func__); goto err_release_umem; } =20 - set =3D mr->cur_map_set; - set->page_shift =3D PAGE_SHIFT; - set->page_mask =3D PAGE_SIZE - 1; - - num_buf =3D 0; - map =3D set->map; + mr->page_shift =3D PAGE_SHIFT; + mr->page_mask =3D PAGE_SIZE - 1; =20 + num_buf =3D 0; + map =3D mr->map; if (length > 0) { buf =3D map[0]->buf; =20 @@ -214,29 +164,33 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u6= 4 length, u64 iova, pr_warn("%s: Unable to get virtual address\n", __func__); err =3D -ENOMEM; - goto err_release_umem; + goto err_cleanup_map; } =20 buf->addr =3D (uintptr_t)vaddr; buf->size =3D PAGE_SIZE; num_buf++; buf++; + } } =20 mr->ibmr.pd =3D &pd->ibpd; mr->umem =3D umem; mr->access =3D access; + mr->length =3D length; + mr->iova =3D iova; + mr->va =3D start; + mr->offset =3D ib_umem_offset(umem); mr->state =3D RXE_MR_STATE_VALID; mr->type =3D IB_MR_TYPE_USER; =20 - set->length =3D length; - set->iova =3D iova; - set->va =3D start; - set->offset =3D ib_umem_offset(umem); - return 0; =20 +err_cleanup_map: + for (i =3D 0; i < mr->num_map; i++) + kfree(mr->map[i]); + kfree(mr->map); err_release_umem: ib_umem_release(umem); err_out: @@ -250,7 +204,7 @@ int rxe_mr_init_fast(struct rxe_pd *pd, int max_pages, = struct rxe_mr *mr) /* always allow remote access for FMRs */ rxe_mr_init(IB_ACCESS_REMOTE, mr); =20 - err =3D rxe_mr_alloc(mr, max_pages, 1); + err =3D rxe_mr_alloc(mr, max_pages); if (err) goto err1; =20 @@ -268,24 +222,21 @@ int rxe_mr_init_fast(struct rxe_pd *pd, int max_pages= , struct rxe_mr *mr) static void lookup_iova(struct rxe_mr *mr, u64 iova, int *m_out, int *n_ou= t, size_t *offset_out) { - struct rxe_map_set *set =3D mr->cur_map_set; - size_t offset =3D iova - set->iova + set->offset; + size_t offset =3D iova - mr->iova + mr->offset; int map_index; int buf_index; u64 length; - struct rxe_map *map; =20 - if (likely(set->page_shift)) { - *offset_out =3D offset & set->page_mask; - offset >>=3D set->page_shift; + if (likely(mr->page_shift)) { + *offset_out =3D offset & mr->page_mask; + offset >>=3D mr->page_shift; *n_out =3D offset & mr->map_mask; *m_out =3D offset >> mr->map_shift; } else { map_index =3D 0; buf_index =3D 0; =20 - map =3D set->map[map_index]; - length =3D map->buf[buf_index].size; + length =3D mr->map[map_index]->buf[buf_index].size; =20 while (offset >=3D length) { offset -=3D length; @@ -295,8 +246,7 @@ static void lookup_iova(struct rxe_mr *mr, u64 iova, in= t *m_out, int *n_out, map_index++; buf_index =3D 0; } - map =3D set->map[map_index]; - length =3D map->buf[buf_index].size; + length =3D mr->map[map_index]->buf[buf_index].size; } =20 *m_out =3D map_index; @@ -317,7 +267,7 @@ void *iova_to_vaddr(struct rxe_mr *mr, u64 iova, int le= ngth) goto out; } =20 - if (!mr->cur_map_set) { + if (!mr->map) { addr =3D (void *)(uintptr_t)iova; goto out; } @@ -330,13 +280,13 @@ void *iova_to_vaddr(struct rxe_mr *mr, u64 iova, int = length) =20 lookup_iova(mr, iova, &m, &n, &offset); =20 - if (offset + length > mr->cur_map_set->map[m]->buf[n].size) { + if (offset + length > mr->map[m]->buf[n].size) { pr_warn("crosses page boundary\n"); addr =3D NULL; goto out; } =20 - addr =3D (void *)(uintptr_t)mr->cur_map_set->map[m]->buf[n].addr + offset; + addr =3D (void *)(uintptr_t)mr->map[m]->buf[n].addr + offset; =20 out: return addr; @@ -372,7 +322,7 @@ int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr= , int length, return 0; } =20 - WARN_ON_ONCE(!mr->cur_map_set); + WARN_ON_ONCE(!mr->map); =20 err =3D mr_check_range(mr, iova, length); if (err) { @@ -382,7 +332,7 @@ int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr= , int length, =20 lookup_iova(mr, iova, &m, &i, &offset); =20 - map =3D mr->cur_map_set->map + m; + map =3D mr->map + m; buf =3D map[0]->buf + i; =20 while (length > 0) { @@ -628,9 +578,8 @@ int rxe_invalidate_mr(struct rxe_qp *qp, u32 key) int rxe_reg_fast_mr(struct rxe_qp *qp, struct rxe_send_wqe *wqe) { struct rxe_mr *mr =3D to_rmr(wqe->wr.wr.reg.mr); - u32 key =3D wqe->wr.wr.reg.key & 0xff; + u32 key =3D wqe->wr.wr.reg.key; u32 access =3D wqe->wr.wr.reg.access; - struct rxe_map_set *set; =20 /* user can only register MR in free state */ if (unlikely(mr->state !=3D RXE_MR_STATE_FREE)) { @@ -646,36 +595,19 @@ int rxe_reg_fast_mr(struct rxe_qp *qp, struct rxe_sen= d_wqe *wqe) return -EINVAL; } =20 + /* user is only allowed to change key portion of l/rkey */ + if (unlikely((mr->lkey & ~0xff) !=3D (key & ~0xff))) { + pr_warn("%s: key =3D 0x%x has wrong index mr->lkey =3D 0x%x\n", + __func__, key, mr->lkey); + return -EINVAL; + } + mr->access =3D access; - mr->lkey =3D (mr->lkey & ~0xff) | key; - mr->rkey =3D (access & IB_ACCESS_REMOTE) ? mr->lkey : 0; + mr->lkey =3D key; + mr->rkey =3D (access & IB_ACCESS_REMOTE) ? key : 0; + mr->iova =3D wqe->wr.wr.reg.mr->iova; mr->state =3D RXE_MR_STATE_VALID; =20 - set =3D mr->cur_map_set; - mr->cur_map_set =3D mr->next_map_set; - mr->cur_map_set->iova =3D wqe->wr.wr.reg.mr->iova; - mr->next_map_set =3D set; - - return 0; -} - -int rxe_mr_set_page(struct ib_mr *ibmr, u64 addr) -{ - struct rxe_mr *mr =3D to_rmr(ibmr); - struct rxe_map_set *set =3D mr->next_map_set; - struct rxe_map *map; - struct rxe_phys_buf *buf; - - if (unlikely(set->nbuf =3D=3D mr->num_buf)) - return -ENOMEM; - - map =3D set->map[set->nbuf / RXE_BUF_PER_MAP]; - buf =3D &map->buf[set->nbuf % RXE_BUF_PER_MAP]; - - buf->addr =3D addr; - buf->size =3D ibmr->page_size; - set->nbuf++; - return 0; } =20 @@ -695,14 +627,15 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata = *udata) void rxe_mr_cleanup(struct rxe_pool_elem *elem) { struct rxe_mr *mr =3D container_of(elem, typeof(*mr), elem); + int i; =20 rxe_put(mr_pd(mr)); - ib_umem_release(mr->umem); =20 - if (mr->cur_map_set) - rxe_mr_free_map_set(mr->num_map, mr->cur_map_set); + if (mr->map) { + for (i =3D 0; i < mr->num_map; i++) + kfree(mr->map[i]); =20 - if (mr->next_map_set) - rxe_mr_free_map_set(mr->num_map, mr->next_map_set); + kfree(mr->map); + } } diff --git a/drivers/infiniband/sw/rxe/rxe_mw.c b/drivers/infiniband/sw/rxe= /rxe_mw.c index 824739008d5b..6c24bc4318e8 100644 --- a/drivers/infiniband/sw/rxe/rxe_mw.c +++ b/drivers/infiniband/sw/rxe/rxe_mw.c @@ -112,15 +112,15 @@ static int rxe_check_bind_mw(struct rxe_qp *qp, struc= t rxe_send_wqe *wqe, =20 /* C10-75 */ if (mw->access & IB_ZERO_BASED) { - if (unlikely(wqe->wr.wr.mw.length > mr->cur_map_set->length)) { + if (unlikely(wqe->wr.wr.mw.length > mr->length)) { pr_err_once( "attempt to bind a ZB MW outside of the MR\n"); return -EINVAL; } } else { - if (unlikely((wqe->wr.wr.mw.addr < mr->cur_map_set->iova) || + if (unlikely((wqe->wr.wr.mw.addr < mr->iova) || ((wqe->wr.wr.mw.addr + wqe->wr.wr.mw.length) > - (mr->cur_map_set->iova + mr->cur_map_set->length)))) { + (mr->iova + mr->length)))) { pr_err_once( "attempt to bind a VA MW outside of the MR\n"); return -EINVAL; diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/= rxe/rxe_verbs.c index 9d995854a174..d2b4e68402d4 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -967,26 +967,41 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd,= enum ib_mr_type mr_type, return ERR_PTR(err); } =20 -/* build next_map_set from scatterlist - * The IB_WR_REG_MR WR will swap map_sets - */ +static int rxe_set_page(struct ib_mr *ibmr, u64 addr) +{ + struct rxe_mr *mr =3D to_rmr(ibmr); + struct rxe_map *map; + struct rxe_phys_buf *buf; + + if (unlikely(mr->nbuf =3D=3D mr->num_buf)) + return -ENOMEM; + + map =3D mr->map[mr->nbuf / RXE_BUF_PER_MAP]; + buf =3D &map->buf[mr->nbuf % RXE_BUF_PER_MAP]; + + buf->addr =3D addr; + buf->size =3D ibmr->page_size; + mr->nbuf++; + + return 0; +} + static int rxe_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, unsigned int *sg_offset) { struct rxe_mr *mr =3D to_rmr(ibmr); - struct rxe_map_set *set =3D mr->next_map_set; int n; =20 - set->nbuf =3D 0; + mr->nbuf =3D 0; =20 - n =3D ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset, rxe_mr_set_page); + n =3D ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset, rxe_set_page); =20 - set->va =3D ibmr->iova; - set->iova =3D ibmr->iova; - set->length =3D ibmr->length; - set->page_shift =3D ilog2(ibmr->page_size); - set->page_mask =3D ibmr->page_size - 1; - set->offset =3D set->iova & set->page_mask; + mr->va =3D ibmr->iova; + mr->iova =3D ibmr->iova; + mr->length =3D ibmr->length; + mr->page_shift =3D ilog2(ibmr->page_size); + mr->page_mask =3D ibmr->page_size - 1; + mr->offset =3D mr->iova & mr->page_mask; =20 return n; } diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/= rxe/rxe_verbs.h index 9bdf33346511..3d524238e5c4 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.h +++ b/drivers/infiniband/sw/rxe/rxe_verbs.h @@ -289,17 +289,6 @@ struct rxe_map { struct rxe_phys_buf buf[RXE_BUF_PER_MAP]; }; =20 -struct rxe_map_set { - struct rxe_map **map; - u64 va; - u64 iova; - size_t length; - u32 offset; - u32 nbuf; - int page_shift; - int page_mask; -}; - static inline int rkey_is_mw(u32 rkey) { u32 index =3D rkey >> 8; @@ -317,20 +306,26 @@ struct rxe_mr { u32 rkey; enum rxe_mr_state state; enum ib_mr_type type; + u64 va; + u64 iova; + size_t length; + u32 offset; int access; =20 + int page_shift; + int page_mask; int map_shift; int map_mask; =20 u32 num_buf; + u32 nbuf; =20 u32 max_buf; u32 num_map; =20 atomic_t num_mw; =20 - struct rxe_map_set *cur_map_set; - struct rxe_map_set *next_map_set; + struct rxe_map **map; }; =20 enum rxe_mw_state { --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFF52C32772 for ; Tue, 23 Aug 2022 09:18:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241471AbiHWJSM (ORCPT ); Tue, 23 Aug 2022 05:18:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349401AbiHWJP4 (ORCPT ); Tue, 23 Aug 2022 05:15:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE4C16DAE5; Tue, 23 Aug 2022 01:32:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9E0D06123D; Tue, 23 Aug 2022 08:32:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A68F3C433D6; Tue, 23 Aug 2022 08:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243539; bh=TmwB1yyIO7hlQxEEZ3YP1Hse/khGDr1TusJ9UJG8jgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KCBR+26xAnyk1YQjv5JdDVTIM8F/AsaRGYO4ew1ReG/eACdxMRFZroWc66BvYZEHK IMdkI3peg283gi5yUW2KxU99pmy2EFXZ0+ha+QfqWFi6DWqeRkQGj7T0eenknJGwUR qva+cUYbmdcf8HTAF55pWfc/yEYubPs0PT1zWgdU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Stafford Horne , Sasha Levin Subject: [PATCH 5.19 309/365] openrisc: io: Define iounmap argument as volatile Date: Tue, 23 Aug 2022 10:03:30 +0200 Message-Id: <20220823080131.102623174@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stafford Horne [ Upstream commit 52e0ea900202d23843daee8f7089817e81dd3dd7 ] When OpenRISC enables PCI it allows for more drivers to be compiled resulting in exposing the following with -Werror. drivers/video/fbdev/riva/fbdev.c: In function 'rivafb_probe': drivers/video/fbdev/riva/fbdev.c:2062:42: error: passing argument 1 of 'iounmap' discards 'volatile' qualifier from poi= nter target type drivers/video/fbdev/nvidia/nvidia.c: In function 'nvidiafb_probe': drivers/video/fbdev/nvidia/nvidia.c:1414:20: error: passing argument 1 of 'iounmap' discards 'volatile' qualifier from poi= nter target type drivers/scsi/aic7xxx/aic7xxx_osm.c: In function 'ahc_platform_free': drivers/scsi/aic7xxx/aic7xxx_osm.c:1231:41: error: passing argument 1 of 'iounmap' discards 'volatile' qualifier from poi= nter target type Most architectures define the iounmap argument to be volatile. To fix this issue we do the same for OpenRISC. This patch must go before PCI is enable= d on OpenRISC to avoid any compile failures. Link: https://lore.kernel.org/lkml/20220729033728.GA2195022@roeck-us.net/ Reported-by: Guenter Roeck Tested-by: Guenter Roeck Signed-off-by: Stafford Horne Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/openrisc/include/asm/io.h | 2 +- arch/openrisc/mm/ioremap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/openrisc/include/asm/io.h b/arch/openrisc/include/asm/io.h index c298061c70a7..8aa3e78181e9 100644 --- a/arch/openrisc/include/asm/io.h +++ b/arch/openrisc/include/asm/io.h @@ -31,7 +31,7 @@ void __iomem *ioremap(phys_addr_t offset, unsigned long size); =20 #define iounmap iounmap -extern void iounmap(void __iomem *addr); +extern void iounmap(volatile void __iomem *addr); =20 #include =20 diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c index daae13a76743..8ec0dafecf25 100644 --- a/arch/openrisc/mm/ioremap.c +++ b/arch/openrisc/mm/ioremap.c @@ -77,7 +77,7 @@ void __iomem *__ref ioremap(phys_addr_t addr, unsigned lo= ng size) } EXPORT_SYMBOL(ioremap); =20 -void iounmap(void __iomem *addr) +void iounmap(volatile void __iomem *addr) { /* If the page is from the fixmap pool then we just clear out * the fixmap mapping. --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AC91C32772 for ; Tue, 23 Aug 2022 09:18:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232743AbiHWJSQ (ORCPT ); Tue, 23 Aug 2022 05:18:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349447AbiHWJQC (ORCPT ); Tue, 23 Aug 2022 05:16:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A2617538E; Tue, 23 Aug 2022 01:32:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B1B2E614C2; Tue, 23 Aug 2022 08:32:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97E44C433D6; Tue, 23 Aug 2022 08:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243542; bh=dA6ZEuwj7DPqjItnEoT4QchiUOKqV/ohRsxC0LHDOW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QW9zXnqgBK7T8Dyhvku0wDnc0sA85R29MiJl+hn4feKR/+PRezn6rWcvdZuWlDpQF sBy0SOJV3nFKDdQHYSjsdRv/QVD/f0YmwDYBMR8S8icKQCDBcgj3pjBgq2Q6+rOTQl ZTFbXG/rvel1ozQf+mOayGKD/XiU73KPhHbgdWp4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Helgaas , Marek Szyprowski , Bjorn Helgaas , Chanho Park , Krzysztof Kozlowski , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 310/365] phy: samsung: phy-exynos-pcie: sanitize init/power_on callbacks Date: Tue, 23 Aug 2022 10:03:31 +0200 Message-Id: <20220823080131.142708441@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marek Szyprowski [ Upstream commit f2812227bb07e2eaee74253f11cea1576945df31 ] The exynos-pcie driver called phy_power_on() before phy_init() for some historical reasons. However the generic PHY framework assumes that the proper sequence is to call phy_init() first, then phy_power_on(). The operations done by both functions should be considered as one action and as such they are called by the exynos-pcie driver (without doing anything between them). The initialization is just a sequence of register writes, which cannot be altered without breaking the hardware operation. To match the generic PHY framework requirement, simply move all register writes to the phy_init()/phy_exit() and drop power_on()/power_off() callbacks. This way the driver will also work with the old (incorrect) PHY initialization call sequence. Link: https://lore.kernel.org/r/20220628220409.26545-1-m.szyprowski@samsung= .com Reported-by: Bjorn Helgaas Signed-off-by: Marek Szyprowski Signed-off-by: Bjorn Helgaas Reviewed-by: Chanho Park Acked-by: Krzysztof Kozlowski Acked-By: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/phy/samsung/phy-exynos-pcie.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos-pcie.c b/drivers/phy/samsung/ph= y-exynos-pcie.c index 578cfe07d07a..53c9230c2907 100644 --- a/drivers/phy/samsung/phy-exynos-pcie.c +++ b/drivers/phy/samsung/phy-exynos-pcie.c @@ -51,6 +51,13 @@ static int exynos5433_pcie_phy_init(struct phy *phy) { struct exynos_pcie_phy *ep =3D phy_get_drvdata(phy); =20 + regmap_update_bits(ep->pmureg, EXYNOS5433_PMU_PCIE_PHY_OFFSET, + BIT(0), 1); + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_GLOBAL_RESET, + PCIE_APP_REQ_EXIT_L1_MODE, 0); + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_L1SUB_CM_CON, + PCIE_REFCLK_GATING_EN, 0); + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_COMMON_RESET, PCIE_PHY_RESET, 1); regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_MAC_RESET, @@ -109,20 +116,7 @@ static int exynos5433_pcie_phy_init(struct phy *phy) return 0; } =20 -static int exynos5433_pcie_phy_power_on(struct phy *phy) -{ - struct exynos_pcie_phy *ep =3D phy_get_drvdata(phy); - - regmap_update_bits(ep->pmureg, EXYNOS5433_PMU_PCIE_PHY_OFFSET, - BIT(0), 1); - regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_GLOBAL_RESET, - PCIE_APP_REQ_EXIT_L1_MODE, 0); - regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_L1SUB_CM_CON, - PCIE_REFCLK_GATING_EN, 0); - return 0; -} - -static int exynos5433_pcie_phy_power_off(struct phy *phy) +static int exynos5433_pcie_phy_exit(struct phy *phy) { struct exynos_pcie_phy *ep =3D phy_get_drvdata(phy); =20 @@ -135,8 +129,7 @@ static int exynos5433_pcie_phy_power_off(struct phy *ph= y) =20 static const struct phy_ops exynos5433_phy_ops =3D { .init =3D exynos5433_pcie_phy_init, - .power_on =3D exynos5433_pcie_phy_power_on, - .power_off =3D exynos5433_pcie_phy_power_off, + .exit =3D exynos5433_pcie_phy_exit, .owner =3D THIS_MODULE, }; =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36000C32772 for ; Tue, 23 Aug 2022 09:18:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237172AbiHWJSl (ORCPT ); Tue, 23 Aug 2022 05:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349686AbiHWJQM (ORCPT ); Tue, 23 Aug 2022 05:16:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1264E870BD; Tue, 23 Aug 2022 01:32:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9D094B81C4C; Tue, 23 Aug 2022 08:32:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6414C433D6; Tue, 23 Aug 2022 08:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243545; bh=MrWX07tsnUvzSzDyKHxZReNNiPHWtCGNB4A0lNM0qb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=16Cpz7SX72askWAFOgS9C3s5MwRffoD/DuK+SsVaL0xxEfSjOKqKYzRzI0PhLhdlD 1LZLYjDlw3jP46ice7A9OL0tKkOZm/CK/yGEEUE2O0a1XXsqvvQfEcbYuEqHx5hOs/ Fj2KZMd9IY5uMzEWLkTIPGyMXi0Bm5rgLgAOCAjQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Logan Gunthorpe , Christoph Hellwig , Song Liu , Jens Axboe , Sasha Levin Subject: [PATCH 5.19 311/365] md: Notify sysfs sync_completed in md_reap_sync_thread() Date: Tue, 23 Aug 2022 10:03:32 +0200 Message-Id: <20220823080131.186923522@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Logan Gunthorpe [ Upstream commit 9973f0fa7d20269fe6fefe6333997fb5914449c1 ] The mdadm test 07layouts randomly produces a kernel hung task deadlock. The deadlock is caused by the suspend_lo/suspend_hi files being set by the mdadm background process during reshape and not being cleared because the process hangs. (Leaving aside the issue of the fragility of freezing kernel tasks by buggy userspace processes...) When the background mdadm process hangs it, is waiting (without a timeout) on a change to the sync_completed file signalling that the reshape has completed. The process is woken up a couple times when the reshape finishes but it is woken up before MD_RECOVERY_RUNNING is cleared so sync_completed_show() reports 0 instead of "none". To fix this, notify the sysfs file in md_reap_sync_thread() after MD_RECOVERY_RUNNING has been cleared. This wakes up mdadm and causes it to continue and write to suspend_lo/suspend_hi to allow IO to continue. Signed-off-by: Logan Gunthorpe Reviewed-by: Christoph Hellwig Signed-off-by: Song Liu Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/md/md.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/md.c b/drivers/md/md.c index 660c52d48256..522b3d6b8c46 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -9466,6 +9466,7 @@ void md_reap_sync_thread(struct mddev *mddev) wake_up(&resync_wait); /* flag recovery needed just to double check */ set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); + sysfs_notify_dirent_safe(mddev->sysfs_completed); sysfs_notify_dirent_safe(mddev->sysfs_action); md_new_event(); if (mddev->event_work.func) --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B193C32772 for ; Tue, 23 Aug 2022 09:18:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235132AbiHWJS2 (ORCPT ); Tue, 23 Aug 2022 05:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349601AbiHWJQH (ORCPT ); Tue, 23 Aug 2022 05:16:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94A267539B; Tue, 23 Aug 2022 01:32:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 25184614C2; Tue, 23 Aug 2022 08:32:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A5E6C43140; Tue, 23 Aug 2022 08:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243548; bh=gm4JWmFIYfwLgfO8bC1MN2J9LdWEiHeJg2NX56k84FU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XU4tSjREz96PFMwsO6RSfe5Dm2mcG5Z7QYGBf4s38+zzriYPlbW8eHUx3wiDDxaFV t1FuK19dpj0nFC1AESNDe/78VBha6gx7yUVqkMnbiu36+NPOTj5kkjP7QyyPRh/wF4 FUPnjtq96XhmSAAXNcVCUpnwmKjaaS8pLn5yZEPc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Logan Gunthorpe , Song Liu , Jens Axboe , Sasha Levin Subject: [PATCH 5.19 312/365] md/raid5: Make logic blocking check consistent with logic that blocks Date: Tue, 23 Aug 2022 10:03:33 +0200 Message-Id: <20220823080131.232792593@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Logan Gunthorpe [ Upstream commit 6e3f50d30af847bebce072182bd735e90a294c6a ] The check in raid5_make_request differs very slightly from the logic that causes it to block lower down. This likely does not cause a bug as the check is fuzzy anyway (as reshape may move on between the first check and the subsequent check). However, make it consistent so it can be cleaned up in a subsequent patch. The condition which causes the schedule is: !(mddev->reshape_backwards ? logical_sector < conf->reshape_progress : logical_sector >=3D conf->reshape_progress) && (mddev->reshape_backwards ? logical_sector < conf->reshape_safe : logical_sector >=3D conf->reshape_safe) The condition that causes the early bailout is made to match this. Signed-off-by: Logan Gunthorpe Signed-off-by: Song Liu Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index c8539d0e12dd..45482cebacdb 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5841,7 +5841,7 @@ static bool raid5_make_request(struct mddev *mddev, s= truct bio * bi) if ((bi->bi_opf & REQ_NOWAIT) && (conf->reshape_progress !=3D MaxSector) && (mddev->reshape_backwards - ? (logical_sector > conf->reshape_progress && logical_sector <=3D con= f->reshape_safe) + ? (logical_sector >=3D conf->reshape_progress && logical_sector < con= f->reshape_safe) : (logical_sector >=3D conf->reshape_safe && logical_sector < conf->r= eshape_progress))) { bio_wouldblock_error(bi); if (rw =3D=3D WRITE) --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D021C32792 for ; Tue, 23 Aug 2022 09:19:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240685AbiHWJS7 (ORCPT ); Tue, 23 Aug 2022 05:18:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349995AbiHWJQ2 (ORCPT ); Tue, 23 Aug 2022 05:16:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7209883C9; Tue, 23 Aug 2022 01:32:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DB1E7B81C1C; Tue, 23 Aug 2022 08:32:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3312FC433C1; Tue, 23 Aug 2022 08:32:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243551; bh=BK6B3gdawsyew22CcsT952m5T51Qwd2OmaLNJ6Zjx3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J6MejM7jgw93ixrfhARvobBdOD2OBtFy8JRPwlgqrgfBKGFx7lpM6MCJW0AuIlj/H HL0Sql7VoZ737D06lU++nU6VsyzUXcfjREy1vekG2Wt8yYaXZ7P08t+BZjuGwH0sTM 3H+R7kiFHfslt3wTAsmNH9ASB7jlPexzUs5QzSWw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yi Zhang , Sagi Grimberg , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.19 313/365] nvmet-tcp: fix lockdep complaint on nvmet_tcp_wq flush during queue teardown Date: Tue, 23 Aug 2022 10:03:34 +0200 Message-Id: <20220823080131.281524707@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sagi Grimberg [ Upstream commit 533d2e8b4d5e4c89772a0adce913525fb86cbbee ] We probably need nvmet_tcp_wq to have MEM_RECLAIM as we are sending/receiving for the socket from works on this workqueue. Also this eliminates lockdep complaints: -- [ 6174.010200] workqueue: WQ_MEM_RECLAIM nvmet-wq:nvmet_tcp_release_queue_work [nvmet_tcp] is flushing !WQ_MEM_RECLAIM nvmet_tcp_wq:nvmet_tcp_io_work [nvmet_tcp] [ 6174.010216] WARNING: CPU: 20 PID: 14456 at kernel/workqueue.c:2628 check_flush_dependency+0x110/0x14c Reported-by: Yi Zhang Signed-off-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/nvme/target/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index 0a9542599ad1..dc3b4dc8fe08 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -1839,7 +1839,8 @@ static int __init nvmet_tcp_init(void) { int ret; =20 - nvmet_tcp_wq =3D alloc_workqueue("nvmet_tcp_wq", WQ_HIGHPRI, 0); + nvmet_tcp_wq =3D alloc_workqueue("nvmet_tcp_wq", + WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); if (!nvmet_tcp_wq) return -ENOMEM; =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48DB6C32772 for ; Tue, 23 Aug 2022 09:19:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237719AbiHWJTE (ORCPT ); Tue, 23 Aug 2022 05:19:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350022AbiHWJQc (ORCPT ); Tue, 23 Aug 2022 05:16:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DF0A883FE; Tue, 23 Aug 2022 01:32:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2BB67614C2; Tue, 23 Aug 2022 08:32:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 300ABC433C1; Tue, 23 Aug 2022 08:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243554; bh=LKYTZ8t1r7PSDOsdZvV9qIXBrHrd4WElWZNqWkPgLvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hy4h0ydBBsYpJOJh6NdZjJYUrdoA4vlFPIomvQo8AFtZXqV732F5zQWY5HBd+oMNH vKQN/1dSJL/1jp9wG9AKHqJ4e8Tegp69bW1FfM4EWhbQHtH0qUeGXsS1Q/bbgDlcvv nlsp8MK7pJx3Q3D7siEn9eiz/dGELZorXhx/C+AY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wentao_Liang , Song Liu , Jens Axboe , Sasha Levin Subject: [PATCH 5.19 314/365] drivers:md:fix a potential use-after-free bug Date: Tue, 23 Aug 2022 10:03:35 +0200 Message-Id: <20220823080131.317193450@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wentao_Liang [ Upstream commit 104212471b1c1817b311771d817fb692af983173 ] In line 2884, "raid5_release_stripe(sh);" drops the reference to sh and may cause sh to be released. However, sh is subsequently used in lines 2886 "if (sh->batch_head && sh !=3D sh->batch_head)". This may result in an use-after-free bug. It can be fixed by moving "raid5_release_stripe(sh);" to the bottom of the function. Signed-off-by: Wentao_Liang Signed-off-by: Song Liu Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 45482cebacdb..1c1310d539f2 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -2881,10 +2881,10 @@ static void raid5_end_write_request(struct bio *bi) if (!test_and_clear_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags)) clear_bit(R5_LOCKED, &sh->dev[i].flags); set_bit(STRIPE_HANDLE, &sh->state); - raid5_release_stripe(sh); =20 if (sh->batch_head && sh !=3D sh->batch_head) raid5_release_stripe(sh->batch_head); + raid5_release_stripe(sh); } =20 static void raid5_error(struct mddev *mddev, struct md_rdev *rdev) --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A437C32772 for ; Tue, 23 Aug 2022 09:19:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242700AbiHWJTR (ORCPT ); Tue, 23 Aug 2022 05:19:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243529AbiHWJQt (ORCPT ); Tue, 23 Aug 2022 05:16:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A694C895D5; Tue, 23 Aug 2022 01:33:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B492614C5; Tue, 23 Aug 2022 08:32:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FF8EC433D6; Tue, 23 Aug 2022 08:32:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243557; bh=ToAhFeKSCUYqwfV7WJxRcx6njmv1ANxzF4hd+UQt+d0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F1gFo8saXOKrgw8lv/m4zuAxNMqbCGy0MBzq+DVnlNlSBv+fPjghGielyzpS8nksf qGoojgyO6zH+1DNuZ4SibsVAyppk417VSA1cz0iBO1QdzZeQImGfPesJkd/Je4ZGeo niL/evEabkYg/N1sDNxsh32jR512GGKjUYgz2WiQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Bin , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.19 315/365] ext4: avoid remove directory when directory is corrupted Date: Tue, 23 Aug 2022 10:03:36 +0200 Message-Id: <20220823080131.358191611@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ye Bin [ Upstream commit b24e77ef1c6d4dbf42749ad4903c97539cc9755a ] Now if check directoy entry is corrupted, ext4_empty_dir may return true then directory will be removed when file system mounted with "errors=3Dcont= inue". In order not to make things worse just return false when directory is corru= pted. Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220622090223.682234-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/ext4/namei.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 4af441494e09..3a31b662f661 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -3090,11 +3090,8 @@ bool ext4_empty_dir(struct inode *inode) de =3D (struct ext4_dir_entry_2 *) (bh->b_data + (offset & (sb->s_blocksize - 1))); if (ext4_check_dir_entry(inode, NULL, de, bh, - bh->b_data, bh->b_size, offset)) { - offset =3D (offset | (sb->s_blocksize - 1)) + 1; - continue; - } - if (le32_to_cpu(de->inode)) { + bh->b_data, bh->b_size, offset) || + le32_to_cpu(de->inode)) { brelse(bh); return false; } --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B77BC32772 for ; Tue, 23 Aug 2022 09:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239374AbiHWJTI (ORCPT ); Tue, 23 Aug 2022 05:19:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350139AbiHWJQl (ORCPT ); Tue, 23 Aug 2022 05:16:41 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B19D3753A1; Tue, 23 Aug 2022 01:32:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 4ED9DCE1B43; Tue, 23 Aug 2022 08:32:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 675F4C433C1; Tue, 23 Aug 2022 08:32:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243560; bh=TT7tWc/244ggDbMGZAOtd6yfrQaNNX6DFkJuHIlf8kw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TlDQmDLqkR+lZjmkeoFYltR9OkmjEBgV+bS9tSr5CBEidmDKn1b6g6Tv/mU4gdpPo X5ZVcnZmjhKzaZ1vwwQdAiueravcpIHIgQkzbPLm6WVcbIHqEZ1KT+VAtsju1V6kh5 OvEvUNHtvHG8/oV9KP+A38kf/u4KOqJUbfjR+pAY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+15cd994e273307bf5cfa@syzkaller.appspotmail.com, Lukas Czerner , Tadeusz Struk , Theodore Tso , Sasha Levin Subject: [PATCH 5.19 316/365] ext4: block range must be validated before use in ext4_mb_clear_bb() Date: Tue, 23 Aug 2022 10:03:37 +0200 Message-Id: <20220823080131.397839950@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Czerner [ Upstream commit 1e1c2b86ef86a8477fd9b9a4f48a6bfe235606f6 ] Block range to free is validated in ext4_free_blocks() using ext4_inode_block_valid() and then it's passed to ext4_mb_clear_bb(). However in some situations on bigalloc file system the range might be adjusted after the validation in ext4_free_blocks() which can lead to troubles on corrupted file systems such as one found by syzkaller that resulted in the following BUG kernel BUG at fs/ext4/ext4.h:3319! PREEMPT SMP NOPTI CPU: 28 PID: 4243 Comm: repro Kdump: loaded Not tainted 5.19.0-rc6+ #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1.fc35 04/0= 1/2014 RIP: 0010:ext4_free_blocks+0x95e/0xa90 Call Trace: ? lock_timer_base+0x61/0x80 ? __es_remove_extent+0x5a/0x760 ? __mod_timer+0x256/0x380 ? ext4_ind_truncate_ensure_credits+0x90/0x220 ext4_clear_blocks+0x107/0x1b0 ext4_free_data+0x15b/0x170 ext4_ind_truncate+0x214/0x2c0 ? _raw_spin_unlock+0x15/0x30 ? ext4_discard_preallocations+0x15a/0x410 ? ext4_journal_check_start+0xe/0x90 ? __ext4_journal_start_sb+0x2f/0x110 ext4_truncate+0x1b5/0x460 ? __ext4_journal_start_sb+0x2f/0x110 ext4_evict_inode+0x2b4/0x6f0 evict+0xd0/0x1d0 ext4_enable_quotas+0x11f/0x1f0 ext4_orphan_cleanup+0x3de/0x430 ? proc_create_seq_private+0x43/0x50 ext4_fill_super+0x295f/0x3ae0 ? snprintf+0x39/0x40 ? sget_fc+0x19c/0x330 ? ext4_reconfigure+0x850/0x850 get_tree_bdev+0x16d/0x260 vfs_get_tree+0x25/0xb0 path_mount+0x431/0xa70 __x64_sys_mount+0xe2/0x120 do_syscall_64+0x5b/0x80 ? do_user_addr_fault+0x1e2/0x670 ? exc_page_fault+0x70/0x170 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x7fdf4e512ace Fix it by making sure that the block range is properly validated before used every time it changes in ext4_free_blocks() or ext4_mb_clear_bb(). Link: https://syzkaller.appspot.com/bug?id=3D5266d464285a03cee9dbfda7d2452a= 72c3c2ae7c Reported-by: syzbot+15cd994e273307bf5cfa@syzkaller.appspotmail.com Signed-off-by: Lukas Czerner Cc: Tadeusz Struk Tested-by: Tadeusz Struk Link: https://lore.kernel.org/r/20220714165903.58260-1-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/ext4/mballoc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 9e06334771a3..38e7dc2531b1 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -5928,6 +5928,15 @@ static void ext4_mb_clear_bb(handle_t *handle, struc= t inode *inode, =20 sbi =3D EXT4_SB(sb); =20 + if (!(flags & EXT4_FREE_BLOCKS_VALIDATED) && + !ext4_inode_block_valid(inode, block, count)) { + ext4_error(sb, "Freeing blocks in system zone - " + "Block =3D %llu, count =3D %lu", block, count); + /* err =3D 0. ext4_std_error should be a no op */ + goto error_return; + } + flags |=3D EXT4_FREE_BLOCKS_VALIDATED; + do_more: overflow =3D 0; ext4_get_group_no_and_offset(sb, block, &block_group, &bit); @@ -5944,6 +5953,8 @@ static void ext4_mb_clear_bb(handle_t *handle, struct= inode *inode, overflow =3D EXT4_C2B(sbi, bit) + count - EXT4_BLOCKS_PER_GROUP(sb); count -=3D overflow; + /* The range changed so it's no longer validated */ + flags &=3D ~EXT4_FREE_BLOCKS_VALIDATED; } count_clusters =3D EXT4_NUM_B2C(sbi, count); bitmap_bh =3D ext4_read_block_bitmap(sb, block_group); @@ -5958,7 +5969,8 @@ static void ext4_mb_clear_bb(handle_t *handle, struct= inode *inode, goto error_return; } =20 - if (!ext4_inode_block_valid(inode, block, count)) { + if (!(flags & EXT4_FREE_BLOCKS_VALIDATED) && + !ext4_inode_block_valid(inode, block, count)) { ext4_error(sb, "Freeing blocks in system zone - " "Block =3D %llu, count =3D %lu", block, count); /* err =3D 0. ext4_std_error should be a no op */ @@ -6081,6 +6093,8 @@ static void ext4_mb_clear_bb(handle_t *handle, struct= inode *inode, block +=3D count; count =3D overflow; put_bh(bitmap_bh); + /* The range changed so it's no longer validated */ + flags &=3D ~EXT4_FREE_BLOCKS_VALIDATED; goto do_more; } error_return: @@ -6127,6 +6141,7 @@ void ext4_free_blocks(handle_t *handle, struct inode = *inode, "block =3D %llu, count =3D %lu", block, count); return; } + flags |=3D EXT4_FREE_BLOCKS_VALIDATED; =20 ext4_debug("freeing block %llu\n", block); trace_ext4_free_blocks(inode, block, count, flags); @@ -6158,6 +6173,8 @@ void ext4_free_blocks(handle_t *handle, struct inode = *inode, block -=3D overflow; count +=3D overflow; } + /* The range changed so it's no longer validated */ + flags &=3D ~EXT4_FREE_BLOCKS_VALIDATED; } overflow =3D EXT4_LBLK_COFF(sbi, count); if (overflow) { @@ -6168,6 +6185,8 @@ void ext4_free_blocks(handle_t *handle, struct inode = *inode, return; } else count +=3D sbi->s_cluster_ratio - overflow; + /* The range changed so it's no longer validated */ + flags &=3D ~EXT4_FREE_BLOCKS_VALIDATED; } =20 if (!bh && (flags & EXT4_FREE_BLOCKS_FORGET)) { --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A79A4C32772 for ; Tue, 23 Aug 2022 09:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244237AbiHWJT3 (ORCPT ); Tue, 23 Aug 2022 05:19:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350278AbiHWJQv (ORCPT ); Tue, 23 Aug 2022 05:16:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94DCE895D2; Tue, 23 Aug 2022 01:33:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 61E7DB81C29; Tue, 23 Aug 2022 08:32:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82D71C433C1; Tue, 23 Aug 2022 08:32:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243567; bh=ho87OgdVd2lfgHZPkZVU6G4Js8hh1GLxQWbGPKq8aXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xCo5W5p599fYskNkW9fPEJQ68bFA2IBKn/keqAhYrAw+zHwcWr0nuu7b3ZGX0JcBQ x8qUBIusIpqtrqQedLp7m0uV2NZhmNORtsiPBJhbx0/hF/MFtTsLCH/ebRnXWUuKcZ Kt21s8hEa1lR+E0MdToyLTOrflV9TXdiyYd4JUaY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleg Kiselev , Theodore Tso , Sasha Levin Subject: [PATCH 5.19 317/365] ext4: avoid resizing to a partial cluster size Date: Tue, 23 Aug 2022 10:03:38 +0200 Message-Id: <20220823080131.440477452@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kiselev, Oleg [ Upstream commit 69cb8e9d8cd97cdf5e293b26d70a9dee3e35e6bd ] This patch avoids an attempt to resize the filesystem to an unaligned cluster boundary. An online resize to a size that is not integral to cluster size results in the last iteration attempting to grow the fs by a negative amount, which trips a BUG_ON and leaves the fs with a corrupted in-memory superblock. Signed-off-by: Oleg Kiselev Link: https://lore.kernel.org/r/0E92A0AB-4F16-4F1A-94B7-702CC6504FDE@amazon= .com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/ext4/resize.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index e5c2713aa11a..cb5a64293881 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -1989,6 +1989,16 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsbl= k_t n_blocks_count) } brelse(bh); =20 + /* + * For bigalloc, trim the requested size to the nearest cluster + * boundary to avoid creating an unusable filesystem. We do this + * silently, instead of returning an error, to avoid breaking + * callers that blindly resize the filesystem to the full size of + * the underlying block device. + */ + if (ext4_has_feature_bigalloc(sb)) + n_blocks_count &=3D ~((1 << EXT4_CLUSTER_BITS(sb)) - 1); + retry: o_blocks_count =3D ext4_blocks_count(es); =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0747EC32792 for ; Tue, 23 Aug 2022 09:19:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345509AbiHWJTW (ORCPT ); Tue, 23 Aug 2022 05:19:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348936AbiHWJRR (ORCPT ); Tue, 23 Aug 2022 05:17:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFC92B28; Tue, 23 Aug 2022 01:33:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 891186123D; Tue, 23 Aug 2022 08:32:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A746C433D6; Tue, 23 Aug 2022 08:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243570; bh=j6NV3NHZXdnVzeVJMsRHbm/l1Gnb2Ly24LwoKMCdh4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ImR31oXTAZ6yjQ/FnHzfRgbA+BRdgFgIzSMFRtC+Y4uONA18IFSVWKC/8kE4/71KA G1/dF7rC5kXU/F8hdVyB1yt6G3rT6aX1974uaSYC72lcRKtYFrAHkOi0PKuNrGxoDt HXvsRwKk8N2trTjK1rEQ3AnLS/yCNj7q7nhdMrQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Steven Rostedt , Andrew Morton , Sasha Levin Subject: [PATCH 5.19 318/365] lib/list_debug.c: Detect uninitialized lists Date: Tue, 23 Aug 2022 10:03:39 +0200 Message-Id: <20220823080131.483274512@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guenter Roeck [ Upstream commit 0cc011c576aaa4de505046f7a6c90933d7c749a9 ] In some circumstances, attempts are made to add entries to or to remove entries from an uninitialized list. A prime example is amdgpu_bo_vm_destroy(): It is indirectly called from ttm_bo_init_reserved() if that function fails, and tries to remove an entry from a list. However, that list is only initialized in amdgpu_bo_create_vm() after the call to ttm_bo_init_reserved() returned success. This results in crashes such as BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 1 PID: 1479 Comm: chrome Not tainted 5.10.110-15768-g29a72e65dae5 Hardware name: Google Grunt/Grunt, BIOS Google_Grunt.11031.149.0 07/15/2020 RIP: 0010:__list_del_entry_valid+0x26/0x7d ... Call Trace: amdgpu_bo_vm_destroy+0x48/0x8b ttm_bo_init_reserved+0x1d7/0x1e0 amdgpu_bo_create+0x212/0x476 ? amdgpu_bo_user_destroy+0x23/0x23 ? kmem_cache_alloc+0x60/0x271 amdgpu_bo_create_vm+0x40/0x7d amdgpu_vm_pt_create+0xe8/0x24b ... Check if the list's prev and next pointers are NULL to catch such problems. Link: https://lkml.kernel.org/r/20220531222951.92073-1-linux@roeck-us.net Signed-off-by: Guenter Roeck Cc: Steven Rostedt Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- lib/list_debug.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/list_debug.c b/lib/list_debug.c index 9daa3fb9d1cd..d98d43f80958 100644 --- a/lib/list_debug.c +++ b/lib/list_debug.c @@ -20,7 +20,11 @@ bool __list_add_valid(struct list_head *new, struct list_head *prev, struct list_head *next) { - if (CHECK_DATA_CORRUPTION(next->prev !=3D prev, + if (CHECK_DATA_CORRUPTION(prev =3D=3D NULL, + "list_add corruption. prev is NULL.\n") || + CHECK_DATA_CORRUPTION(next =3D=3D NULL, + "list_add corruption. next is NULL.\n") || + CHECK_DATA_CORRUPTION(next->prev !=3D prev, "list_add corruption. next->prev should be prev (%px), but was %px. (ne= xt=3D%px).\n", prev, next->prev, next) || CHECK_DATA_CORRUPTION(prev->next !=3D next, @@ -42,7 +46,11 @@ bool __list_del_entry_valid(struct list_head *entry) prev =3D entry->prev; next =3D entry->next; =20 - if (CHECK_DATA_CORRUPTION(next =3D=3D LIST_POISON1, + if (CHECK_DATA_CORRUPTION(next =3D=3D NULL, + "list_del corruption, %px->next is NULL\n", entry) || + CHECK_DATA_CORRUPTION(prev =3D=3D NULL, + "list_del corruption, %px->prev is NULL\n", entry) || + CHECK_DATA_CORRUPTION(next =3D=3D LIST_POISON1, "list_del corruption, %px->next is LIST_POISON1 (%px)\n", entry, LIST_POISON1) || CHECK_DATA_CORRUPTION(prev =3D=3D LIST_POISON2, --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFBECC3F6B0 for ; Tue, 23 Aug 2022 09:22:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349338AbiHWJWk (ORCPT ); Tue, 23 Aug 2022 05:22:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243671AbiHWJUI (ORCPT ); Tue, 23 Aug 2022 05:20:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03109895FB; Tue, 23 Aug 2022 01:33:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 51CB1B81C20; Tue, 23 Aug 2022 08:32:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F9CBC433D6; Tue, 23 Aug 2022 08:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243573; bh=uVE2rYO/FwoZI6CHQRFOhSMx6E4j3S4MrjD6MhJyUfg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WxWzT9sy1MDBQoEr0eBtf3ZI/Ehv8UnInir7NwKLSwZwaOdJItWKpIeKncZfEfS0s o1rhxmdtwVQk5+j7ymOANGTkxRPcrbsv2JTUVCXqD8utxoBTRLt8fTLxUd+gn3LQzc uDuWkob2usXZhiUt0c9sMBglsaKlwpWy8Bpbpv5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dongli Zhang , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.19 319/365] swiotlb: panic if nslabs is too small Date: Tue, 23 Aug 2022 10:03:40 +0200 Message-Id: <20220823080131.532813281@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dongli Zhang [ Upstream commit 0bf28fc40d89b1a3e00d1b79473bad4e9ca20ad1 ] Panic on purpose if nslabs is too small, in order to sync with the remap retry logic. In addition, print the number of bytes for tlb alloc failure. Signed-off-by: Dongli Zhang Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- kernel/dma/swiotlb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 5830dce6081b..f5304e2f6a35 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -242,6 +242,9 @@ void __init swiotlb_init_remap(bool addressing_limit, u= nsigned int flags, if (swiotlb_force_disable) return; =20 + if (nslabs < IO_TLB_MIN_SLABS) + panic("%s: nslabs =3D %lu too small\n", __func__, nslabs); + /* * By default allocate the bounce buffer memory from low memory, but * allow to pick a location everywhere for hypervisors with guest @@ -254,7 +257,8 @@ void __init swiotlb_init_remap(bool addressing_limit, u= nsigned int flags, else tlb =3D memblock_alloc_low(bytes, PAGE_SIZE); if (!tlb) { - pr_warn("%s: failed to allocate tlb structure\n", __func__); + pr_warn("%s: Failed to allocate %zu bytes tlb structure\n", + __func__, bytes); return; } =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24AE2C3F6B0 for ; Tue, 23 Aug 2022 09:22:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348898AbiHWJWV (ORCPT ); Tue, 23 Aug 2022 05:22:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349050AbiHWJUM (ORCPT ); Tue, 23 Aug 2022 05:20:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C8E448C8A; Tue, 23 Aug 2022 01:33:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7CCDB614E1; Tue, 23 Aug 2022 08:32:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 873F8C433C1; Tue, 23 Aug 2022 08:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243575; bh=wL+I1X6OYqaa+s1yOlsuInujXPWsQqoekriR1F0yces=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=asnP2eyaKWmf5kn84AMsHVpGTPMQKaZ6oxHiUBZ7rhUGdieNUsL6eF9dMwwBVbY/t rGBPWud6hY8DNxLS+YA4m0406m/fC7XlKOYbD7v+4a/NfwCtfQfI04O3y02UMu0u6Q QeVU7u2b+yLc5BdCgMarXvymISHGfH4SNS+HNjyk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Timur Tabi , Liang He , Sasha Levin Subject: [PATCH 5.19 320/365] tty: serial: Fix refcount leak bug in ucc_uart.c Date: Tue, 23 Aug 2022 10:03:41 +0200 Message-Id: <20220823080131.574400568@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit d24d7bb2cd947676f9b71fb944d045e09b8b282f ] In soc_info(), of_find_node_by_type() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore. Acked-by: Timur Tabi Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220618060850.4058525-1-windhl@126.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/tty/serial/ucc_uart.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index 6000853973c1..3cc9ef08455c 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c @@ -1137,6 +1137,8 @@ static unsigned int soc_info(unsigned int *rev_h, uns= igned int *rev_l) /* No compatible property, so try the name. */ soc_string =3D np->name; =20 + of_node_put(np); + /* Extract the SOC number from the "PowerPC," string */ if ((sscanf(soc_string, "PowerPC,%u", &soc) !=3D 1) || !soc) return 0; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA392C32772 for ; Tue, 23 Aug 2022 09:24:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349684AbiHWJYE (ORCPT ); Tue, 23 Aug 2022 05:24:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348714AbiHWJUM (ORCPT ); Tue, 23 Aug 2022 05:20:12 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D970E89833; Tue, 23 Aug 2022 01:33:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id F243ACE1B45; Tue, 23 Aug 2022 08:33:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 106CCC433D6; Tue, 23 Aug 2022 08:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243579; bh=c0oQWHbTvcNHrAYGEU4I81+4AJyeLsiRKKSH4gPd8po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pwm3beKzPBY91yiuM+A7gpuA1AGAUvvaroLTG3NOgYo4m7DI7ZKTltBBHtdsMg07R BoHe99JnKnnbzy5QZiU/PB96H+ZRbXiOEt0SXDkIr4tQKwNcazzC1vqMIdG6X7Pv/z zQgMUOvWfWvpfPk3W7FX7ooOVYorQLdgJAfd9IzE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabiano Rosas , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 321/365] KVM: PPC: Book3S HV: Fix "rm_exit" entry in debugfs timings Date: Tue, 23 Aug 2022 10:03:42 +0200 Message-Id: <20220823080131.606216655@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas [ Upstream commit 9981bace85d816ed8724ac46e49285e8488d29e6 ] At debugfs/kvm//vcpu0/timings we show how long each part of the code takes to run: $ cat /sys/kernel/debug/kvm/*-*/vcpu0/timings rm_entry: 123785 49398892 118 4898 rm_intr: 123780 6075890 22 390 rm_exit: 0 0 0 0 <-- NOK guest: 123780 46732919988 402 9997638 cede: 0 0 0 0 <-- OK, no cede napping in P9 The "rm_exit" is always showing zero because it is the last one and end_timing does not increment the counter of the previous entry. We can fix it by calling accumulate_time again instead of end_timing. That way the counter gets incremented. The rest of the arithmetic can be ignored because there are no timing points after this and the accumulators are reset before the next round. Signed-off-by: Fabiano Rosas Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220525130554.2614394-2-farosas@linux.ibm.= com Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/powerpc/kvm/book3s_hv_p9_entry.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_p9_entry.c b/arch/powerpc/kvm/book3= s_hv_p9_entry.c index 112a09b33328..7f88be386b27 100644 --- a/arch/powerpc/kvm/book3s_hv_p9_entry.c +++ b/arch/powerpc/kvm/book3s_hv_p9_entry.c @@ -438,15 +438,6 @@ void restore_p9_host_os_sprs(struct kvm_vcpu *vcpu, EXPORT_SYMBOL_GPL(restore_p9_host_os_sprs); =20 #ifdef CONFIG_KVM_BOOK3S_HV_EXIT_TIMING -static void __start_timing(struct kvm_vcpu *vcpu, struct kvmhv_tb_accumula= tor *next) -{ - struct kvmppc_vcore *vc =3D vcpu->arch.vcore; - u64 tb =3D mftb() - vc->tb_offset_applied; - - vcpu->arch.cur_activity =3D next; - vcpu->arch.cur_tb_start =3D tb; -} - static void __accumulate_time(struct kvm_vcpu *vcpu, struct kvmhv_tb_accum= ulator *next) { struct kvmppc_vcore *vc =3D vcpu->arch.vcore; @@ -478,8 +469,8 @@ static void __accumulate_time(struct kvm_vcpu *vcpu, st= ruct kvmhv_tb_accumulator curr->seqcount =3D seq + 2; } =20 -#define start_timing(vcpu, next) __start_timing(vcpu, next) -#define end_timing(vcpu) __start_timing(vcpu, NULL) +#define start_timing(vcpu, next) __accumulate_time(vcpu, next) +#define end_timing(vcpu) __accumulate_time(vcpu, NULL) #define accumulate_time(vcpu, next) __accumulate_time(vcpu, next) #else #define start_timing(vcpu, next) do {} while (0) --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EF83C32772 for ; Tue, 23 Aug 2022 09:23:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349527AbiHWJXH (ORCPT ); Tue, 23 Aug 2022 05:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350121AbiHWJV3 (ORCPT ); Tue, 23 Aug 2022 05:21:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 181D78B9B4; Tue, 23 Aug 2022 01:34:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0E6A0B81C1B; Tue, 23 Aug 2022 08:33:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31760C43141; Tue, 23 Aug 2022 08:33:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243582; bh=PF8SufQ7tmxL2pVFNfXHYqLarhxmKG0VFpQoYTmqd98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LwFNWLryWGdMFSqfbk0o50/kCG+mIhL7QOUAEQUcHQda/mvJZfhIIoUjj3yk1NV9F zyh3v4ie3yWdjbxOBDSDdbrW07Bg7dUCSDK2N/xG5wxg1xuMvQg2M65wpqTx8VjU+x WLgGSB7H38s/sGLchSoa3K3FrFtCNHqCWTirz1JA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Schspa Shi , Cornelia Huck , Alex Williamson , Sasha Levin Subject: [PATCH 5.19 322/365] vfio: Clear the caps->buf to NULL after free Date: Tue, 23 Aug 2022 10:03:43 +0200 Message-Id: <20220823080131.650582945@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Schspa Shi [ Upstream commit 6641085e8d7b3f061911517f79a2a15a0a21b97b ] On buffer resize failure, vfio_info_cap_add() will free the buffer, report zero for the size, and return -ENOMEM. As additional hardening, also clear the buffer pointer to prevent any chance of a double free. Signed-off-by: Schspa Shi Reviewed-by: Cornelia Huck Link: https://lore.kernel.org/r/20220629022948.55608-1-schspa@gmail.com Signed-off-by: Alex Williamson Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/vfio/vfio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 18fc0916587e..277cd1152dd8 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c @@ -1814,6 +1814,7 @@ struct vfio_info_cap_header *vfio_info_cap_add(struct= vfio_info_cap *caps, buf =3D krealloc(caps->buf, caps->size + size, GFP_KERNEL); if (!buf) { kfree(caps->buf); + caps->buf =3D NULL; caps->size =3D 0; return ERR_PTR(-ENOMEM); } --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0821EC32772 for ; Tue, 23 Aug 2022 09:34:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351200AbiHWJez (ORCPT ); Tue, 23 Aug 2022 05:34:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351080AbiHWJeC (ORCPT ); Tue, 23 Aug 2022 05:34:02 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C154B9569F; Tue, 23 Aug 2022 01:39:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 7A10ACE1B43; Tue, 23 Aug 2022 08:33:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75193C433C1; Tue, 23 Aug 2022 08:33:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243585; bh=G31bJPoYMv94cqbiSEOGE7aQCgluitafdoR37mIssKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lrfVhkwuadyjGKnT11ymvY5AR3jWk9ruXQXij0foTGjgQ6dyTFEc16IscIgIyEF45 iMUdU0UksZRvJW7s9TFccCOeYx6TsYgCq2Jm+AlGFbZIHCYWBkfCvoLTGcu1QOzP6P ldib5cLz8WSAR+/nHepKBmwbQAIJoAK9yhVj/m88= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.19 323/365] mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start Date: Tue, 23 Aug 2022 10:03:44 +0200 Message-Id: <20220823080131.692729369@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 7a9f743ceead60ed454c46fbc3085ee9a79cbebb ] We should call of_node_put() for the reference 'uctl_node' returned by of_get_parent() which will increase the refcount. Otherwise, there will be a refcount leak bug. Signed-off-by: Liang He Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/mips/cavium-octeon/octeon-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-o= cteon/octeon-platform.c index a994022e32c9..ce05c0dd3acd 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -86,11 +86,12 @@ static void octeon2_usb_clocks_start(struct device *dev) "refclk-frequency", &clock_rate); if (i) { dev_err(dev, "No UCTL \"refclk-frequency\"\n"); + of_node_put(uctl_node); goto exit; } i =3D of_property_read_string(uctl_node, "refclk-type", &clock_type); - + of_node_put(uctl_node); if (!i && strcmp("crystal", clock_type) =3D=3D 0) is_crystal_clock =3D true; } --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 365C8C32772 for ; Tue, 23 Aug 2022 09:23:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349614AbiHWJXh (ORCPT ); Tue, 23 Aug 2022 05:23:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346630AbiHWJU0 (ORCPT ); Tue, 23 Aug 2022 05:20:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE8C989919; Tue, 23 Aug 2022 01:33:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B81A961326; Tue, 23 Aug 2022 08:33:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9E1DC433C1; Tue, 23 Aug 2022 08:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243589; bh=YI2a3bQsRpitOm3qvXNGbLX4UFt3jIL05K8HgbujqzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IBhohu4xHIVc9BWGjE0Bi7BKTySZ33Sur9oZaeMJIoa1X5MG9Pf8x0M85/0pVMipW zVgfXP0/4fi8NXA/wHahqNbtiLa023a4H3+LmMDDz+DYJnYzaNr15Og6LNSNokqbk7 swo4qwnRpU8MoEpRyCuRLg0XsKxUdV2WQog5mLrg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ning Li , Yunfei Wang , Robin Murphy , Will Deacon , Joerg Roedel , Sasha Levin Subject: [PATCH 5.19 324/365] iommu/io-pgtable-arm-v7s: Add a quirk to allow pgtable PA up to 35bit Date: Tue, 23 Aug 2022 10:03:45 +0200 Message-Id: <20220823080131.732211610@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yunfei Wang [ Upstream commit bfdd231374181254742c5e2faef0bef2d30c0ee4 ] Single memory zone feature will remove ZONE_DMA32 and ZONE_DMA and cause pgtable PA size larger than 32bit. Since Mediatek IOMMU hardware support at most 35bit PA in pgtable, so add a quirk to allow the PA of pgtables support up to bit35. Signed-off-by: Ning Li Signed-off-by: Yunfei Wang Reviewed-by: Robin Murphy Acked-by: Will Deacon Link: https://lore.kernel.org/r/20220630092927.24925-2-yf.wang@mediatek.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/iommu/io-pgtable-arm-v7s.c | 75 ++++++++++++++++++++++-------- include/linux/io-pgtable.h | 15 ++++-- 2 files changed, 66 insertions(+), 24 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-= arm-v7s.c index be066c1503d3..ba3115fd0f86 100644 --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -182,14 +182,8 @@ static bool arm_v7s_is_mtk_enabled(struct io_pgtable_c= fg *cfg) (cfg->quirks & IO_PGTABLE_QUIRK_ARM_MTK_EXT); } =20 -static arm_v7s_iopte paddr_to_iopte(phys_addr_t paddr, int lvl, - struct io_pgtable_cfg *cfg) +static arm_v7s_iopte to_mtk_iopte(phys_addr_t paddr, arm_v7s_iopte pte) { - arm_v7s_iopte pte =3D paddr & ARM_V7S_LVL_MASK(lvl); - - if (!arm_v7s_is_mtk_enabled(cfg)) - return pte; - if (paddr & BIT_ULL(32)) pte |=3D ARM_V7S_ATTR_MTK_PA_BIT32; if (paddr & BIT_ULL(33)) @@ -199,6 +193,17 @@ static arm_v7s_iopte paddr_to_iopte(phys_addr_t paddr,= int lvl, return pte; } =20 +static arm_v7s_iopte paddr_to_iopte(phys_addr_t paddr, int lvl, + struct io_pgtable_cfg *cfg) +{ + arm_v7s_iopte pte =3D paddr & ARM_V7S_LVL_MASK(lvl); + + if (arm_v7s_is_mtk_enabled(cfg)) + return to_mtk_iopte(paddr, pte); + + return pte; +} + static phys_addr_t iopte_to_paddr(arm_v7s_iopte pte, int lvl, struct io_pgtable_cfg *cfg) { @@ -240,10 +245,17 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, dma_addr_t dma; size_t size =3D ARM_V7S_TABLE_SIZE(lvl, cfg); void *table =3D NULL; + gfp_t gfp_l1; + + /* + * ARM_MTK_TTBR_EXT extend the translation table base support larger + * memory address. + */ + gfp_l1 =3D cfg->quirks & IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT ? + GFP_KERNEL : ARM_V7S_TABLE_GFP_DMA; =20 if (lvl =3D=3D 1) - table =3D (void *)__get_free_pages( - __GFP_ZERO | ARM_V7S_TABLE_GFP_DMA, get_order(size)); + table =3D (void *)__get_free_pages(gfp_l1 | __GFP_ZERO, get_order(size)); else if (lvl =3D=3D 2) table =3D kmem_cache_zalloc(data->l2_tables, gfp); =20 @@ -251,7 +263,8 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, return NULL; =20 phys =3D virt_to_phys(table); - if (phys !=3D (arm_v7s_iopte)phys) { + if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT ? + phys >=3D (1ULL << cfg->oas) : phys !=3D (arm_v7s_iopte)phys) { /* Doesn't fit in PTE */ dev_err(dev, "Page table does not fit in PTE: %pa", &phys); goto out_free; @@ -457,9 +470,14 @@ static arm_v7s_iopte arm_v7s_install_table(arm_v7s_iop= te *table, arm_v7s_iopte curr, struct io_pgtable_cfg *cfg) { + phys_addr_t phys =3D virt_to_phys(table); arm_v7s_iopte old, new; =20 - new =3D virt_to_phys(table) | ARM_V7S_PTE_TYPE_TABLE; + new =3D phys | ARM_V7S_PTE_TYPE_TABLE; + + if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT) + new =3D to_mtk_iopte(phys, new); + if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_NS) new |=3D ARM_V7S_ATTR_NS_TABLE; =20 @@ -779,6 +797,8 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct = io_pgtable_cfg *cfg, void *cookie) { struct arm_v7s_io_pgtable *data; + slab_flags_t slab_flag; + phys_addr_t paddr; =20 if (cfg->ias > (arm_v7s_is_mtk_enabled(cfg) ? 34 : ARM_V7S_ADDR_BITS)) return NULL; @@ -788,7 +808,8 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct = io_pgtable_cfg *cfg, =20 if (cfg->quirks & ~(IO_PGTABLE_QUIRK_ARM_NS | IO_PGTABLE_QUIRK_NO_PERMS | - IO_PGTABLE_QUIRK_ARM_MTK_EXT)) + IO_PGTABLE_QUIRK_ARM_MTK_EXT | + IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT)) return NULL; =20 /* If ARM_MTK_4GB is enabled, the NO_PERMS is also expected. */ @@ -796,15 +817,27 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struc= t io_pgtable_cfg *cfg, !(cfg->quirks & IO_PGTABLE_QUIRK_NO_PERMS)) return NULL; =20 + if ((cfg->quirks & IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT) && + !arm_v7s_is_mtk_enabled(cfg)) + return NULL; + data =3D kmalloc(sizeof(*data), GFP_KERNEL); if (!data) return NULL; =20 spin_lock_init(&data->split_lock); + + /* + * ARM_MTK_TTBR_EXT extend the translation table base support larger + * memory address. + */ + slab_flag =3D cfg->quirks & IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT ? + 0 : ARM_V7S_TABLE_SLAB_FLAGS; + data->l2_tables =3D kmem_cache_create("io-pgtable_armv7s_l2", ARM_V7S_TABLE_SIZE(2, cfg), ARM_V7S_TABLE_SIZE(2, cfg), - ARM_V7S_TABLE_SLAB_FLAGS, NULL); + slab_flag, NULL); if (!data->l2_tables) goto out_free_data; =20 @@ -850,12 +883,16 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struc= t io_pgtable_cfg *cfg, wmb(); =20 /* TTBR */ - cfg->arm_v7s_cfg.ttbr =3D virt_to_phys(data->pgd) | ARM_V7S_TTBR_S | - (cfg->coherent_walk ? (ARM_V7S_TTBR_NOS | - ARM_V7S_TTBR_IRGN_ATTR(ARM_V7S_RGN_WBWA) | - ARM_V7S_TTBR_ORGN_ATTR(ARM_V7S_RGN_WBWA)) : - (ARM_V7S_TTBR_IRGN_ATTR(ARM_V7S_RGN_NC) | - ARM_V7S_TTBR_ORGN_ATTR(ARM_V7S_RGN_NC))); + paddr =3D virt_to_phys(data->pgd); + if (arm_v7s_is_mtk_enabled(cfg)) + cfg->arm_v7s_cfg.ttbr =3D paddr | upper_32_bits(paddr); + else + cfg->arm_v7s_cfg.ttbr =3D paddr | ARM_V7S_TTBR_S | + (cfg->coherent_walk ? (ARM_V7S_TTBR_NOS | + ARM_V7S_TTBR_IRGN_ATTR(ARM_V7S_RGN_WBWA) | + ARM_V7S_TTBR_ORGN_ATTR(ARM_V7S_RGN_WBWA)) : + (ARM_V7S_TTBR_IRGN_ATTR(ARM_V7S_RGN_NC) | + ARM_V7S_TTBR_ORGN_ATTR(ARM_V7S_RGN_NC))); return &data->iop; =20 out_free_data: diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h index 86af6f0a00a2..ca98aeadcc80 100644 --- a/include/linux/io-pgtable.h +++ b/include/linux/io-pgtable.h @@ -74,17 +74,22 @@ struct io_pgtable_cfg { * to support up to 35 bits PA where the bit32, bit33 and bit34 are * encoded in the bit9, bit4 and bit5 of the PTE respectively. * + * IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT: (ARM v7s format) MediaTek IOMMUs + * extend the translation table base support up to 35 bits PA, the + * encoding format is same with IO_PGTABLE_QUIRK_ARM_MTK_EXT. + * * IO_PGTABLE_QUIRK_ARM_TTBR1: (ARM LPAE format) Configure the table * for use in the upper half of a split address space. * * IO_PGTABLE_QUIRK_ARM_OUTER_WBWA: Override the outer-cacheability * attributes set in the TCR for a non-coherent page-table walker. */ - #define IO_PGTABLE_QUIRK_ARM_NS BIT(0) - #define IO_PGTABLE_QUIRK_NO_PERMS BIT(1) - #define IO_PGTABLE_QUIRK_ARM_MTK_EXT BIT(3) - #define IO_PGTABLE_QUIRK_ARM_TTBR1 BIT(5) - #define IO_PGTABLE_QUIRK_ARM_OUTER_WBWA BIT(6) + #define IO_PGTABLE_QUIRK_ARM_NS BIT(0) + #define IO_PGTABLE_QUIRK_NO_PERMS BIT(1) + #define IO_PGTABLE_QUIRK_ARM_MTK_EXT BIT(3) + #define IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT BIT(4) + #define IO_PGTABLE_QUIRK_ARM_TTBR1 BIT(5) + #define IO_PGTABLE_QUIRK_ARM_OUTER_WBWA BIT(6) unsigned long quirks; unsigned long pgsize_bitmap; unsigned int ias; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25BEFC32772 for ; Tue, 23 Aug 2022 09:23:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239218AbiHWJW7 (ORCPT ); Tue, 23 Aug 2022 05:22:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350315AbiHWJVl (ORCPT ); Tue, 23 Aug 2022 05:21:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CFF88D3C5; Tue, 23 Aug 2022 01:34:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F3B0F614C5; Tue, 23 Aug 2022 08:33:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E395FC433C1; Tue, 23 Aug 2022 08:33:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243592; bh=KbyObKk7cSByvvXNFKtPxO7zqzi0cCyZ20ssVNoXFdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NVZo5BgAgalAZtFPUOhQMX8cUA1j4p7qbmgukDNareRa7mZ0AiNHL19NxQerqT06S zbs8K3VquBzYmSogO+RT/Gfp+uunHiVvCeliEpkjaoY6yuEGzIvaSm55SK3FFFUgFC yq7VKRb5p1EAibvdSiVBRduYEgK6V6lzBPBfKQi8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= , Cezary Rojewski , Mark Brown , Sasha Levin Subject: [PATCH 5.19 325/365] ASoC: Intel: avs: Set max DMA segment size Date: Tue, 23 Aug 2022 10:03:46 +0200 Message-Id: <20220823080131.771177793@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amadeusz S=C5=82awi=C5=84ski [ Upstream commit 8544eebc78c96f1834a46b26ade3e7ebe785d10c ] Apparently it is possible for code to allocate large buffers which may cause warnings as reported in [1]. This was fixed for HDA, SOF and skylake in patchset [2], fix it also for avs driver. [1] https://github.com/thesofproject/linux/issues/3430 [2] https://lore.kernel.org/all/20220215132756.31236-1-tiwai@suse.de/ Signed-off-by: Amadeusz S=C5=82awi=C5=84ski Signed-off-by: Cezary Rojewski Link: https://lore.kernel.org/r/20220707124153.1858249-8-cezary.rojewski@in= tel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/intel/avs/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c index 3a0997c3af2b..cf373969bb69 100644 --- a/sound/soc/intel/avs/core.c +++ b/sound/soc/intel/avs/core.c @@ -445,6 +445,7 @@ static int avs_pci_probe(struct pci_dev *pci, const str= uct pci_device_id *id) dma_set_mask(dev, DMA_BIT_MASK(32)); dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); } + dma_set_max_seg_size(dev, UINT_MAX); =20 ret =3D avs_hdac_bus_init_streams(bus); if (ret < 0) { --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48BBCC32772 for ; Tue, 23 Aug 2022 09:20:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346716AbiHWJUL (ORCPT ); Tue, 23 Aug 2022 05:20:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238424AbiHWJTF (ORCPT ); Tue, 23 Aug 2022 05:19:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35CD512615; Tue, 23 Aug 2022 01:33:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CB67BB81C35; Tue, 23 Aug 2022 08:33:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CA62C433C1; Tue, 23 Aug 2022 08:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243595; bh=kRV+Gn5xEpmPrAnDCd4cDOvjWBXX8T4006MlWRjYqyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mub/mPu6zBk1dzsrkt+N61WSRy6gxbT9xkdlIs5c06rGZihJZZNBpbRM7Ev0m1Zwc ypSgpPzVUhA3A4aG6V2CQBK1qXtPu4S73eMzcMRFdSSMv6Iehp+jA8YXbggVceHIB8 B/8JS4JIMEKtR4vcA9da2CRHmD0Zd9n4lC45I/fc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cezary Rojewski , Takashi Iwai , Sasha Levin Subject: [PATCH 5.19 326/365] ALSA: hda: Fix page fault in snd_hda_codec_shutdown() Date: Tue, 23 Aug 2022 10:03:47 +0200 Message-Id: <20220823080131.817356112@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cezary Rojewski [ Upstream commit 980b3a8790b402e959a6d773b38b771019682be1 ] If early probe of HDAudio bus driver fails e.g.: due to missing firmware file, snd_hda_codec_shutdown() ends in manipulating uninitialized codec->pcm_list_head causing page fault. Iinitialization of HDAudio codec in ASoC is split in two: - snd_hda_codec_device_init() - snd_hda_codec_device_new() snd_hda_codec_device_init() is called during probe_codecs() by HDAudio bus driver while snd_hda_codec_device_new() is called by codec-component's ->probe(). The second call will not happen until all components required by related sound card are present within the ASoC framework. With firmware failing to load during the PCI's deferred initialization i.e.: probe_work(), no platform components are ever registered. HDAudio codec enumeration is done at that point though, so the codec components became registered to ASoC framework, calling snd_hda_codec_device_init() in the process. Now, during platform reboot snd_hda_codec_shutdown() is called for every codec found on the HDAudio bus causing oops if any of them has not completed both of their initialization steps. Relocating field initialization fixes the issue. Signed-off-by: Cezary Rojewski Link: https://lore.kernel.org/r/20220706120230.427296-7-cezary.rojewski@int= el.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/pci/hda/hda_codec.c | 41 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index ccb195b7cb08..8828fc3a5c3f 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -931,8 +931,28 @@ snd_hda_codec_device_init(struct hda_bus *bus, unsigne= d int codec_addr, } =20 codec->bus =3D bus; + codec->depop_delay =3D -1; + codec->fixup_id =3D HDA_FIXUP_ID_NOT_SET; + codec->core.dev.release =3D snd_hda_codec_dev_release; + codec->core.exec_verb =3D codec_exec_verb; codec->core.type =3D HDA_DEV_LEGACY; =20 + mutex_init(&codec->spdif_mutex); + mutex_init(&codec->control_mutex); + snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 32); + snd_array_init(&codec->nids, sizeof(struct hda_nid_item), 32); + snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); + snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); + snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8); + snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16); + snd_array_init(&codec->jacktbl, sizeof(struct hda_jack_tbl), 16); + snd_array_init(&codec->verbs, sizeof(struct hda_verb *), 8); + INIT_LIST_HEAD(&codec->conn_list); + INIT_LIST_HEAD(&codec->pcm_list_head); + INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); + refcount_set(&codec->pcm_ref, 1); + init_waitqueue_head(&codec->remove_sleep); + return codec; } EXPORT_SYMBOL_GPL(snd_hda_codec_device_init); @@ -980,29 +1000,8 @@ int snd_hda_codec_device_new(struct hda_bus *bus, str= uct snd_card *card, if (snd_BUG_ON(codec_addr > HDA_MAX_CODEC_ADDRESS)) return -EINVAL; =20 - codec->core.dev.release =3D snd_hda_codec_dev_release; - codec->core.exec_verb =3D codec_exec_verb; - codec->card =3D card; codec->addr =3D codec_addr; - mutex_init(&codec->spdif_mutex); - mutex_init(&codec->control_mutex); - snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 32); - snd_array_init(&codec->nids, sizeof(struct hda_nid_item), 32); - snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); - snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); - snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8); - snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16); - snd_array_init(&codec->jacktbl, sizeof(struct hda_jack_tbl), 16); - snd_array_init(&codec->verbs, sizeof(struct hda_verb *), 8); - INIT_LIST_HEAD(&codec->conn_list); - INIT_LIST_HEAD(&codec->pcm_list_head); - refcount_set(&codec->pcm_ref, 1); - init_waitqueue_head(&codec->remove_sleep); - - INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); - codec->depop_delay =3D -1; - codec->fixup_id =3D HDA_FIXUP_ID_NOT_SET; =20 #ifdef CONFIG_PM codec->power_jiffies =3D jiffies; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F7A1C32772 for ; Tue, 23 Aug 2022 09:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344258AbiHWJsU (ORCPT ); Tue, 23 Aug 2022 05:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352164AbiHWJqA (ORCPT ); Tue, 23 Aug 2022 05:46:00 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CDFE60509; Tue, 23 Aug 2022 01:43:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 3E964CE1B39; Tue, 23 Aug 2022 08:33:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 529CDC433D7; Tue, 23 Aug 2022 08:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243601; bh=zZLL++bYvl0F92rMoTpAbVJJgVpyIgrqAToCvPmUEYA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VmRSCqBn//LUADhOOiNW8oEzqoLeoGhx5UdtPDY5pUsSKn+hge+eReoH6I1cd+fdF KavDY1+klCUGk+x8A5i8+Ya4FOkomML2tZktmrM51mfdsE/irMv5F9lmezcgeuP2t2 6xu5LXEqr+Z6oRqGSFr8UAaY9aLWK4Df2lXMToYg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller , Luis Chamberlain , Sasha Levin Subject: [PATCH 5.19 327/365] modules: Ensure natural alignment for .altinstructions and __bug_table sections Date: Tue, 23 Aug 2022 10:03:48 +0200 Message-Id: <20220823080131.868020705@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller [ Upstream commit 87c482bdfa79f378297d92af49cdf265be199df5 ] In the kernel image vmlinux.lds.S linker scripts the .altinstructions and __bug_table sections are 4- or 8-byte aligned because they hold 32- and/or 64-bit values. Most architectures use altinstructions and BUG() or WARN() in modules as well, but in the module linker script (module.lds.S) those sections are currently missing. As consequence the linker will store their content byte-aligned by default, which then can lead to unnecessary unaligned memory accesses by the CPU when those tables are processed at runtime. Usually unaligned memory accesses are unnoticed, because either the hardware (as on x86 CPUs) or in-kernel exception handlers (e.g. on parisc or sparc) emulate and fix them up at runtime. Nevertheless, such unaligned accesses introduce a performance penalty and can even crash the kernel if there is a bug in the unalignment exception handlers (which happened once to me on the parisc architecture and which is why I noticed that issue at all). This patch fixes a non-critical issue and might be backported at any time. It's trivial and shouldn't introduce any regression because it simply tells the linker to use a different (8-byte alignment) for those sections by default. Signed-off-by: Helge Deller Link: https://lore.kernel.org/all/Yr8%2Fgr8e8I7tVX4d@p100/ Signed-off-by: Luis Chamberlain Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- scripts/module.lds.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/module.lds.S b/scripts/module.lds.S index 1d0e1e4dc3d2..3a3aa2354ed8 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -27,6 +27,8 @@ SECTIONS { .ctors 0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) } .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) } =20 + .altinstructions 0 : ALIGN(8) { KEEP(*(.altinstructions)) } + __bug_table 0 : ALIGN(8) { KEEP(*(__bug_table)) } __jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) } =20 __patchable_function_entries : { *(__patchable_function_entries) } --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 644ABC32772 for ; Tue, 23 Aug 2022 09:23:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349061AbiHWJXa (ORCPT ); Tue, 23 Aug 2022 05:23:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349933AbiHWJVO (ORCPT ); Tue, 23 Aug 2022 05:21:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F4C08A7E4; Tue, 23 Aug 2022 01:34:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 28301B81C4C; Tue, 23 Aug 2022 08:33:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7945AC433D6; Tue, 23 Aug 2022 08:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243604; bh=mwmDbCfw/ao0izZKovfnIvnOORITV54RWHghuELPKFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HZVGWGz+ehC/nk/FSVG6XcBEX9vW2svqCJf89hZ/dn5ugJx+jrCRKIIeRlTZnx+t8 nLGC/k6Qh2vIIBsdTFs5nOsBPaiePxU7oEyfGF4jRUhGPGE9ckiBfMdNrs1GR0+R2f BePyXx2BHIO1A5P7HBT+NBrTSWWMGcPZKCLvhtbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Vehmanen , Peter Ujfalusi , Ranjani Sridharan , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.19 328/365] ASoC: SOF: Intel: cnl: Do not process IPC reply before firmware boot Date: Tue, 23 Aug 2022 10:03:49 +0200 Message-Id: <20220823080131.919228424@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit acacd9eefd0def5a83244d88e5483b5f38ee7287 ] It is not yet clear, but it is possible to create a firmware so broken that it will send a reply message before a FW_READY message (it is not yet clear if FW_READY will arrive later). Since the reply_data is allocated only after the FW_READY message, this will lead to a NULL pointer dereference if not filtered out. The issue was reported with IPC4 firmware but the same condition is present for IPC3. Reported-by: Kai Vehmanen Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220712122357.31282-2-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/sof/intel/cnl.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c index cd6e5f8a5eb4..6c98f65635fc 100644 --- a/sound/soc/sof/intel/cnl.c +++ b/sound/soc/sof/intel/cnl.c @@ -60,17 +60,23 @@ irqreturn_t cnl_ipc4_irq_thread(int irq, void *context) =20 if (primary & SOF_IPC4_MSG_DIR_MASK) { /* Reply received */ - struct sof_ipc4_msg *data =3D sdev->ipc->msg.reply_data; + if (likely(sdev->fw_state =3D=3D SOF_FW_BOOT_COMPLETE)) { + struct sof_ipc4_msg *data =3D sdev->ipc->msg.reply_data; =20 - data->primary =3D primary; - data->extension =3D extension; + data->primary =3D primary; + data->extension =3D extension; =20 - spin_lock_irq(&sdev->ipc_lock); + spin_lock_irq(&sdev->ipc_lock); =20 - snd_sof_ipc_get_reply(sdev); - snd_sof_ipc_reply(sdev, data->primary); + snd_sof_ipc_get_reply(sdev); + snd_sof_ipc_reply(sdev, data->primary); =20 - spin_unlock_irq(&sdev->ipc_lock); + spin_unlock_irq(&sdev->ipc_lock); + } else { + dev_dbg_ratelimited(sdev->dev, + "IPC reply before FW_READY: %#x|%#x\n", + primary, extension); + } } else { /* Notification received */ notification_data.primary =3D primary; @@ -124,15 +130,20 @@ irqreturn_t cnl_ipc_irq_thread(int irq, void *context) CNL_DSP_REG_HIPCCTL, CNL_DSP_REG_HIPCCTL_DONE, 0); =20 - spin_lock_irq(&sdev->ipc_lock); + if (likely(sdev->fw_state =3D=3D SOF_FW_BOOT_COMPLETE)) { + spin_lock_irq(&sdev->ipc_lock); =20 - /* handle immediate reply from DSP core */ - hda_dsp_ipc_get_reply(sdev); - snd_sof_ipc_reply(sdev, msg); + /* handle immediate reply from DSP core */ + hda_dsp_ipc_get_reply(sdev); + snd_sof_ipc_reply(sdev, msg); =20 - cnl_ipc_dsp_done(sdev); + cnl_ipc_dsp_done(sdev); =20 - spin_unlock_irq(&sdev->ipc_lock); + spin_unlock_irq(&sdev->ipc_lock); + } else { + dev_dbg_ratelimited(sdev->dev, "IPC reply before FW_READY: %#x\n", + msg); + } =20 ipc_irq =3D true; } --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4734C32772 for ; Tue, 23 Aug 2022 09:31:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350490AbiHWJaS (ORCPT ); Tue, 23 Aug 2022 05:30:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350022AbiHWJ1x (ORCPT ); Tue, 23 Aug 2022 05:27:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D394491D16; Tue, 23 Aug 2022 01:37:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B9C361446; Tue, 23 Aug 2022 08:35:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8C8EC433C1; Tue, 23 Aug 2022 08:35:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243730; bh=14BEbwuS/9GtFKmOQR6ugEwfl0StUNmna3JofOg1vEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GObWW9G1aLMD9JW9XcGKZMpUQQco8IiIMg3gqksQ4n0F4pIDmedvbTm7tdnbQz+Ej 3hO62cSuBF06XI1hot6bKOoHxBYIzwnCgz4IEkFtaBsOADO1vCyrkgqHKbfncsZgNf ovw+qj4nttJ1lYj7tK4bToC8ec+njFLEPkhqhjEs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Vehmanen , Peter Ujfalusi , Ranjani Sridharan , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.19 329/365] ASoC: SOF: Intel: hda-ipc: Do not process IPC reply before firmware boot Date: Tue, 23 Aug 2022 10:03:50 +0200 Message-Id: <20220823080131.971138228@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit 499cc881b09c8283ab5e75b0d6d21cb427722161 ] It is not yet clear, but it is possible to create a firmware so broken that it will send a reply message before a FW_READY message (it is not yet clear if FW_READY will arrive later). Since the reply_data is allocated only after the FW_READY message, this will lead to a NULL pointer dereference if not filtered out. The issue was reported with IPC4 firmware but the same condition is present for IPC3. Reported-by: Kai Vehmanen Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220712122357.31282-3-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/sof/intel/hda-ipc.c | 39 ++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/sound/soc/sof/intel/hda-ipc.c b/sound/soc/sof/intel/hda-ipc.c index f08011249955..65e688f749ea 100644 --- a/sound/soc/sof/intel/hda-ipc.c +++ b/sound/soc/sof/intel/hda-ipc.c @@ -148,17 +148,23 @@ irqreturn_t hda_dsp_ipc4_irq_thread(int irq, void *co= ntext) =20 if (primary & SOF_IPC4_MSG_DIR_MASK) { /* Reply received */ - struct sof_ipc4_msg *data =3D sdev->ipc->msg.reply_data; + if (likely(sdev->fw_state =3D=3D SOF_FW_BOOT_COMPLETE)) { + struct sof_ipc4_msg *data =3D sdev->ipc->msg.reply_data; =20 - data->primary =3D primary; - data->extension =3D extension; + data->primary =3D primary; + data->extension =3D extension; =20 - spin_lock_irq(&sdev->ipc_lock); + spin_lock_irq(&sdev->ipc_lock); =20 - snd_sof_ipc_get_reply(sdev); - snd_sof_ipc_reply(sdev, data->primary); + snd_sof_ipc_get_reply(sdev); + snd_sof_ipc_reply(sdev, data->primary); =20 - spin_unlock_irq(&sdev->ipc_lock); + spin_unlock_irq(&sdev->ipc_lock); + } else { + dev_dbg_ratelimited(sdev->dev, + "IPC reply before FW_READY: %#x|%#x\n", + primary, extension); + } } else { /* Notification received */ =20 @@ -225,16 +231,21 @@ irqreturn_t hda_dsp_ipc_irq_thread(int irq, void *con= text) * place, the message might not yet be marked as expecting a * reply. */ - spin_lock_irq(&sdev->ipc_lock); + if (likely(sdev->fw_state =3D=3D SOF_FW_BOOT_COMPLETE)) { + spin_lock_irq(&sdev->ipc_lock); =20 - /* handle immediate reply from DSP core */ - hda_dsp_ipc_get_reply(sdev); - snd_sof_ipc_reply(sdev, msg); + /* handle immediate reply from DSP core */ + hda_dsp_ipc_get_reply(sdev); + snd_sof_ipc_reply(sdev, msg); =20 - /* set the done bit */ - hda_dsp_ipc_dsp_done(sdev); + /* set the done bit */ + hda_dsp_ipc_dsp_done(sdev); =20 - spin_unlock_irq(&sdev->ipc_lock); + spin_unlock_irq(&sdev->ipc_lock); + } else { + dev_dbg_ratelimited(sdev->dev, "IPC reply before FW_READY: %#x\n", + msg); + } =20 ipc_irq =3D true; } --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96AB5C32792 for ; Tue, 23 Aug 2022 09:22:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349309AbiHWJWe (ORCPT ); Tue, 23 Aug 2022 05:22:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350433AbiHWJVr (ORCPT ); Tue, 23 Aug 2022 05:21:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 944A08E0E6; Tue, 23 Aug 2022 01:34:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1147D61499; Tue, 23 Aug 2022 08:33:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 181B7C433D6; Tue, 23 Aug 2022 08:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243629; bh=XMqlULsVRDZW+IEUfiphA3cJNCqcrWzjUawBkqNX6W4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VmctdUQG7628qXMTkuyidLA2afXhOF8EKNro7oNP1FfIBkv+GNKPRC6zbFzNlYCIw fB5Oq+wlA63vdUPoYVQIrUVaUMKaDw0uhe7sti0PUkw1Vkn86rfNpbJOXX60sF3/v5 dacefLa0I9hCxP/ZLB7UAEFJJ9PHbRzRyPMLXqjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Pierre-Louis Bossart , Ranjani Sridharan , Mark Brown , Sasha Levin Subject: [PATCH 5.19 330/365] ASoC: SOF: sof-client-probes: Only load the driver if IPC3 is used Date: Tue, 23 Aug 2022 10:03:51 +0200 Message-Id: <20220823080132.023341441@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit 9b93eda355089b36482f7a2f134bdd24be70f907 ] The current implementation of probes only supports IPC3 and should not be loaded for other IPC implementation. Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Link: https://lore.kernel.org/r/20220712131022.1124-1-peter.ujfalusi@linux.= intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/sof/sof-client-probes.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-p= robes.c index 34e6bd356e71..60e4250fac87 100644 --- a/sound/soc/sof/sof-client-probes.c +++ b/sound/soc/sof/sof-client-probes.c @@ -693,6 +693,10 @@ static int sof_probes_client_probe(struct auxiliary_de= vice *auxdev, if (!sof_probes_enabled) return -ENXIO; =20 + /* only ipc3 is supported */ + if (sof_client_get_ipc_type(cdev) !=3D SOF_IPC) + return -ENXIO; + if (!dev->platform_data) { dev_err(dev, "missing platform data\n"); return -ENODEV; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A775CC32774 for ; Tue, 23 Aug 2022 10:07:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352410AbiHWKHf (ORCPT ); Tue, 23 Aug 2022 06:07:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352428AbiHWKBx (ORCPT ); Tue, 23 Aug 2022 06:01:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9254C9753D; Tue, 23 Aug 2022 01:49:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0BE39B81C4E; Tue, 23 Aug 2022 08:34:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68159C4314B; Tue, 23 Aug 2022 08:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243662; bh=HsE6Hc1g0L5kt8Rb3CEnOB/34WTJkVgtm0Yx9+swGaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lccaubqsTk8obb6MKEW1x12wA2929Y7jpQvg7LrxB05169ouXwlgYoNegwXyIXf2R ZMO4olhQMRnUlB17to1/YLXtiY2MsDRDTz20bLD9B5qYkSuYFUmNzzgRI8qKwXSLXJ leUAhIoiv7U4bUFQeRoCc5Tuf8ZuiqGRg3rQ3k+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nguyen Bao Nguyen , Nishiyama Kunihiko , Kuninori Morimoto , Mark Brown , Sasha Levin Subject: [PATCH 5.19 331/365] ASoC: rsnd: care default case on rsnd_ssiu_busif_err_irq_ctrl() Date: Tue, 23 Aug 2022 10:03:52 +0200 Message-Id: <20220823080132.062538913@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuninori Morimoto [ Upstream commit ef30911d3c39fd57884c348c29b9cbff88def155 ] Before, ssiu.c didn't care SSI5-8, thus, commit b1384d4c95088d0 ("ASoC: rsnd: care default case on rsnd_ssiu_busif_err_status_clear()") cares it for status clear. But we should care it for error irq handling, too. This patch cares it. Reported-by: Nguyen Bao Nguyen Reported-by: Nishiyama Kunihiko Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/871quocio1.wl-kuninori.morimoto.gx@renesas.= com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/sh/rcar/ssiu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c index 4b8a63e336c7..d7f4646ee029 100644 --- a/sound/soc/sh/rcar/ssiu.c +++ b/sound/soc/sh/rcar/ssiu.c @@ -67,6 +67,8 @@ static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mod = *mod, int enable) shift =3D 1; offset =3D 1; break; + default: + return; } =20 for (i =3D 0; i < 4; i++) { --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5053DC32772 for ; Tue, 23 Aug 2022 09:28:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350133AbiHWJ2Y (ORCPT ); Tue, 23 Aug 2022 05:28:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350194AbiHWJZe (ORCPT ); Tue, 23 Aug 2022 05:25:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F33975FCF; Tue, 23 Aug 2022 01:36:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CDE5F614E1; Tue, 23 Aug 2022 08:34:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB2D5C433D6; Tue, 23 Aug 2022 08:34:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243697; bh=xwWCPA28vI940tma+9qll3w9FqbWcIpnOhD8qGgH3tE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rBSMA8lbk7t4/n3nP1dwPkMzk6vjivj7Z6hMq2+aR2y5X+3WS+Q5IeU7p6XES+qUh IowbN9IVqoWZeDFKGljbz92ZfWdyd8HQzl7i1RBK9g1qHvHyWYyBcexApKjYGd5ivY SV1fnccEYRXKqHLecrJWovgI9I/41sXV6VVBaSYs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brice Goglin , Conor Dooley , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.19 332/365] riscv: dts: sifive: Add fu540 topology information Date: Tue, 23 Aug 2022 10:03:53 +0200 Message-Id: <20220823080132.111184627@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Conor Dooley [ Upstream commit af8f260abc608c06e4466a282b53f1e2dc09f042 ] The fu540 has no cpu-map node, so tools like hwloc cannot correctly parse the topology. Add the node using the existing node labels. Reported-by: Brice Goglin Link: https://github.com/open-mpi/hwloc/issues/536 Signed-off-by: Conor Dooley Link: https://lore.kernel.org/r/20220705190435.1790466-3-mail@conchuod.ie Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/riscv/boot/dts/sifive/fu540-c000.dtsi b/arch/riscv/boot/d= ts/sifive/fu540-c000.dtsi index e3172d0ffac4..24bba83bec77 100644 --- a/arch/riscv/boot/dts/sifive/fu540-c000.dtsi +++ b/arch/riscv/boot/dts/sifive/fu540-c000.dtsi @@ -133,6 +133,30 @@ interrupt-controller; }; }; + + cpu-map { + cluster0 { + core0 { + cpu =3D <&cpu0>; + }; + + core1 { + cpu =3D <&cpu1>; + }; + + core2 { + cpu =3D <&cpu2>; + }; + + core3 { + cpu =3D <&cpu3>; + }; + + core4 { + cpu =3D <&cpu4>; + }; + }; + }; }; soc { #address-cells =3D <2>; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECD6EC32772 for ; Tue, 23 Aug 2022 09:25:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349806AbiHWJYo (ORCPT ); Tue, 23 Aug 2022 05:24:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237661AbiHWJWM (ORCPT ); Tue, 23 Aug 2022 05:22:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 104E08E9B7; Tue, 23 Aug 2022 01:35:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7D69CB81C62; Tue, 23 Aug 2022 08:35:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7832C433C1; Tue, 23 Aug 2022 08:35:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243712; bh=cqi1K+RO/h6CzrfnFuokGsXKuj/66SUMCYKD3hLy4mA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mx//a14pXuE09VOHfJZEcgnc92LqpnvxUROxmyfNkMudpXRA6+00k8AMGzOSZEre1 /NDFk0/yO89uimkjekSFZnQCf+5P39orLU7joHLDNlCoDsqSiC5qrbY1sLigd/BimC NuvjKzF4EqoOOIKhKu71qJQun/S2Yliv10l7scWI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brice Goglin , Conor Dooley , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.19 333/365] riscv: dts: sifive: Add fu740 topology information Date: Tue, 23 Aug 2022 10:03:54 +0200 Message-Id: <20220823080132.150589788@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Conor Dooley [ Upstream commit bf6cd1c01c959a31002dfa6784c0d8caffed4cf1 ] The fu740 has no cpu-map node, so tools like hwloc cannot correctly parse the topology. Add the node using the existing node labels. Reported-by: Brice Goglin Link: https://github.com/open-mpi/hwloc/issues/536 Signed-off-by: Conor Dooley Link: https://lore.kernel.org/r/20220705190435.1790466-4-mail@conchuod.ie Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/riscv/boot/dts/sifive/fu740-c000.dtsi | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/riscv/boot/dts/sifive/fu740-c000.dtsi b/arch/riscv/boot/d= ts/sifive/fu740-c000.dtsi index 7b77c13496d8..43bed6c0a84f 100644 --- a/arch/riscv/boot/dts/sifive/fu740-c000.dtsi +++ b/arch/riscv/boot/dts/sifive/fu740-c000.dtsi @@ -134,6 +134,30 @@ interrupt-controller; }; }; + + cpu-map { + cluster0 { + core0 { + cpu =3D <&cpu0>; + }; + + core1 { + cpu =3D <&cpu1>; + }; + + core2 { + cpu =3D <&cpu2>; + }; + + core3 { + cpu =3D <&cpu3>; + }; + + core4 { + cpu =3D <&cpu4>; + }; + }; + }; }; soc { #address-cells =3D <2>; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F4A8C32772 for ; Tue, 23 Aug 2022 09:29:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350238AbiHWJ3H (ORCPT ); Tue, 23 Aug 2022 05:29:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350719AbiHWJ0T (ORCPT ); Tue, 23 Aug 2022 05:26:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41F6276764; Tue, 23 Aug 2022 01:36:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 94EFB6132D; Tue, 23 Aug 2022 08:35:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A08B0C433D6; Tue, 23 Aug 2022 08:35:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243715; bh=q4e5RPgusHolD8fcDqoi4kybf9uPxbFOEi5uXMdW6QA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L3XigLwJA8a+fsIwKhEaIhL7mGFePqQJLCkPPWE6DP87nS/5iINKQsIoU0rgighLO 3Uh+JrywlsCXXU7jwniHPNwvNL6eO/mG3n5OaIGgmmlxrYT3wjT9WC2o3rLxdfr1bJ Nx2xfueRKKV8mxIZPx/FjhxD7ArTjg/L+Pz9xfB8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brice Goglin , Conor Dooley , Damien Le Moal , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.19 334/365] riscv: dts: canaan: Add k210 topology information Date: Tue, 23 Aug 2022 10:03:55 +0200 Message-Id: <20220823080132.189132574@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Conor Dooley [ Upstream commit d9d193dea8666bbf69fc21c5bdcdabaa34a466e3 ] The k210 has no cpu-map node, so tools like hwloc cannot correctly parse the topology. Add the node using the existing node labels. Reported-by: Brice Goglin Link: https://github.com/open-mpi/hwloc/issues/536 Signed-off-by: Conor Dooley Reviewed-by: Damien Le Moal Link: https://lore.kernel.org/r/20220705190435.1790466-6-mail@conchuod.ie Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/riscv/boot/dts/canaan/k210.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/riscv/boot/dts/canaan/k210.dtsi b/arch/riscv/boot/dts/can= aan/k210.dtsi index 44d338514761..ec944d1537dc 100644 --- a/arch/riscv/boot/dts/canaan/k210.dtsi +++ b/arch/riscv/boot/dts/canaan/k210.dtsi @@ -65,6 +65,18 @@ compatible =3D "riscv,cpu-intc"; }; }; + + cpu-map { + cluster0 { + core0 { + cpu =3D <&cpu0>; + }; + + core1 { + cpu =3D <&cpu1>; + }; + }; + }; }; =20 sram: memory@80000000 { --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68429C32772 for ; Tue, 23 Aug 2022 09:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235917AbiHWJ25 (ORCPT ); Tue, 23 Aug 2022 05:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350464AbiHWJZu (ORCPT ); Tue, 23 Aug 2022 05:25:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1804E90830; Tue, 23 Aug 2022 01:36:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 829B6614F5; Tue, 23 Aug 2022 08:35:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A867C433C1; Tue, 23 Aug 2022 08:35:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243717; bh=YPFGWF+SZ3nfFejBqr/SAmSzFD052TPPo811pYAyxFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mJCsBt15vXH0R7p/F2hgD6OLcsoL0Q1hCK3SYz1FpkccsAIHtgNU7LYH4PTsq45ZF QWYRtgvcRrafUetZIo/glmWm7Mk4/wtzt35v4jXgKksD8R3bmiKjpG3ERC+ExgCZzI 4okWyzlaZf/L7RuJKxg2nu2xZaE1P0sv41lY7VLU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Mark Brown , Sasha Levin Subject: [PATCH 5.19 335/365] ASoC: nau8821: Dont unconditionally free interrupt Date: Tue, 23 Aug 2022 10:03:56 +0200 Message-Id: <20220823080132.229436719@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Brown [ Upstream commit 2d86cef353b8f3d20b16f8c5615742fd6938c801 ] The remove() operation unconditionally frees the interrupt for the device but we may not actually have an interrupt so there might be nothing to free. Since the interrupt is requested after all other resources we don't need the explicit free anyway, unwinding is guaranteed to be safe, so just delete the remove() function and let devm take care of things. Reported-by: Zheyu Ma Signed-off-by: Mark Brown Tested-by: Zheyu Ma Link: https://lore.kernel.org/r/20220718140405.57233-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/codecs/nau8821.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sound/soc/codecs/nau8821.c b/sound/soc/codecs/nau8821.c index ce4e7f46bb06..e078d2ffb3f6 100644 --- a/sound/soc/codecs/nau8821.c +++ b/sound/soc/codecs/nau8821.c @@ -1665,15 +1665,6 @@ static int nau8821_i2c_probe(struct i2c_client *i2c) return ret; } =20 -static int nau8821_i2c_remove(struct i2c_client *i2c_client) -{ - struct nau8821 *nau8821 =3D i2c_get_clientdata(i2c_client); - - devm_free_irq(nau8821->dev, nau8821->irq, nau8821); - - return 0; -} - static const struct i2c_device_id nau8821_i2c_ids[] =3D { { "nau8821", 0 }, { } @@ -1703,7 +1694,6 @@ static struct i2c_driver nau8821_driver =3D { .acpi_match_table =3D ACPI_PTR(nau8821_acpi_match), }, .probe_new =3D nau8821_i2c_probe, - .remove =3D nau8821_i2c_remove, .id_table =3D nau8821_i2c_ids, }; module_i2c_driver(nau8821_driver); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D31A8C32772 for ; Tue, 23 Aug 2022 09:28:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350178AbiHWJ2q (ORCPT ); Tue, 23 Aug 2022 05:28:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350408AbiHWJZr (ORCPT ); Tue, 23 Aug 2022 05:25:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1148176771; Tue, 23 Aug 2022 01:36:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 92267B81C59; Tue, 23 Aug 2022 08:35:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0444C433D7; Tue, 23 Aug 2022 08:35:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243721; bh=ZvgNG1eC9iccsixk7C5q3yyyNPKNAPFVwtvxIcix/aA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQWl6apKiXthWG134NyIRClul97N0SXtG0XfNLtk/VNzutZCTo82wWhzqrFWCwJvN 7ocQL5/rfddbU2tcu4TKM5tbzCKVur2aU0xB3J500EUUL/AulQ5tj2a7Zk8/jjPbtf G7eJFOnvAH845VZAC/7cRYBmFr+FCWiuxGAjZaZs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, xctan , dram , Ruizhe Pan , Celeste Liu , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.19 336/365] riscv: mmap with PROT_WRITE but no PROT_READ is invalid Date: Tue, 23 Aug 2022 10:03:57 +0200 Message-Id: <20220823080132.268502471@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Celeste Liu [ Upstream commit 2139619bcad7ac44cc8f6f749089120594056613 ] As mentioned in Table 4.5 in RISC-V spec Volume 2 Section 4.3, write but not read is "Reserved for future use.". For now, they are not valid. In the current code, -wx is marked as invalid, but -w- is not marked as invalid. This patch refines that judgment. Reported-by: xctan Co-developed-by: dram Signed-off-by: dram Co-developed-by: Ruizhe Pan Signed-off-by: Ruizhe Pan Signed-off-by: Celeste Liu Link: https://lore.kernel.org/r/PH7PR14MB559464DBDD310E755F5B21E8CEDC9@PH7P= R14MB5594.namprd14.prod.outlook.com Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/riscv/kernel/sys_riscv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/riscv/kernel/sys_riscv.c b/arch/riscv/kernel/sys_riscv.c index 9c0194f176fc..571556bb9261 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -18,9 +18,8 @@ static long riscv_sys_mmap(unsigned long addr, unsigned l= ong len, if (unlikely(offset & (~PAGE_MASK >> page_shift_offset))) return -EINVAL; =20 - if ((prot & PROT_WRITE) && (prot & PROT_EXEC)) - if (unlikely(!(prot & PROT_READ))) - return -EINVAL; + if (unlikely((prot & PROT_WRITE) && !(prot & PROT_READ))) + return -EINVAL; =20 return ksys_mmap_pgoff(addr, len, prot, flags, fd, offset >> (PAGE_SHIFT - page_shift_offset)); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70AE3C32772 for ; Tue, 23 Aug 2022 09:54:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242778AbiHWJy2 (ORCPT ); Tue, 23 Aug 2022 05:54:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352279AbiHWJv2 (ORCPT ); Tue, 23 Aug 2022 05:51:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D399B9F0E9; Tue, 23 Aug 2022 01:45:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 91445B81C63; Tue, 23 Aug 2022 08:35:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D52C6C433D7; Tue, 23 Aug 2022 08:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243724; bh=4qKoqDDrujEnaXSp0+r96irpj98a/vp4++7pVeIYz/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TTDUNKHGPo2N6u3IsP/HyxQ8Bg3mfjEicekAL0vW2Z5ErG6RqLwvCYCBeBOKQijS8 Dz2KmnZdLbs9ULaTUCM51kyTsvrGLuWyrBbtzuF8HTdxJLEQmEnyK81oJvHNqgvfT9 C47KXKYUXd/+6cS+d6ilnHukfWSrQ+KkNLThBN0I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guo Ren , Xianting Tian , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.19 337/365] RISC-V: Add fast call path of crash_kexec() Date: Tue, 23 Aug 2022 10:03:58 +0200 Message-Id: <20220823080132.317191626@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xianting Tian [ Upstream commit 3f1901110a89b0e2e13adb2ac8d1a7102879ea98 ] Currently, almost all archs (x86, arm64, mips...) support fast call of crash_kexec() when "regs && kexec_should_crash()" is true. But RISC-V not, it can only enter crash system via panic(). However panic() doesn't pass the regs of the real accident scene to crash_kexec(), it caused we can't get accurate backtrace via gdb, $ riscv64-linux-gnu-gdb vmlinux vmcore Reading symbols from vmlinux... [New LWP 95] #0 console_unlock () at kernel/printk/printk.c:2557 2557 if (do_cond_resched) (gdb) bt #0 console_unlock () at kernel/printk/printk.c:2557 #1 0x0000000000000000 in ?? () With the patch we can get the accurate backtrace, $ riscv64-linux-gnu-gdb vmlinux vmcore Reading symbols from vmlinux... [New LWP 95] #0 0xffffffe00063a4e0 in test_thread (data=3D) at drivers/= test_crash.c:81 81 *(int *)p =3D 0xdead; (gdb) (gdb) bt #0 0xffffffe00064d5c0 in test_thread (data=3D) at drivers/= test_crash.c:81 #1 0x0000000000000000 in ?? () Test code to produce NULL address dereference in test_crash.c, void *p =3D NULL; *(int *)p =3D 0xdead; Reviewed-by: Guo Ren Tested-by: Xianting Tian Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20220606082308.2883458-1-xianting.tian@linu= x.alibaba.com Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/riscv/kernel/traps.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c index b40426509244..39d0f8bba4b4 100644 --- a/arch/riscv/kernel/traps.c +++ b/arch/riscv/kernel/traps.c @@ -16,6 +16,7 @@ #include #include #include +#include =20 #include #include @@ -44,6 +45,9 @@ void die(struct pt_regs *regs, const char *str) =20 ret =3D notify_die(DIE_OOPS, str, regs, 0, regs->cause, SIGSEGV); =20 + if (regs && kexec_should_crash(current)) + crash_kexec(regs); + bust_spinlocks(0); add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); spin_unlock_irq(&die_lock); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFCBAC32772 for ; Tue, 23 Aug 2022 10:08:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352531AbiHWKH7 (ORCPT ); Tue, 23 Aug 2022 06:07:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352435AbiHWKBy (ORCPT ); Tue, 23 Aug 2022 06:01:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D9786B640; Tue, 23 Aug 2022 01:49:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5DE4FB81C1C; Tue, 23 Aug 2022 08:35:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1DDFC433D7; Tue, 23 Aug 2022 08:35:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243727; bh=feQFNZ1S7BhDIdTLYLh+/Cpkv2mdA7IxHtZ5KdwUEPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FwF//Reg6Tc+JIlUe/l7o7kNtaA9i8I7v09dyiStBEhSkr//TfIqe9OsXBq2a9skO FDlT4EkIHt1ZL/dKcm34Sq3kNVzDaOCvuphK2UY+V81nnVloZjnclQjDq6GYNXxo7z nRSzrAU0qUN/fwgkpJ89FtZOfGHWm+isZoHz+a3A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai-Heng Feng , Lucas Tanure , Takashi Iwai , Sasha Levin Subject: [PATCH 5.19 338/365] ALSA: hda/realtek: Enable speaker and mute LEDs for HP laptops Date: Tue, 23 Aug 2022 10:03:59 +0200 Message-Id: <20220823080132.356410307@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kai-Heng Feng [ Upstream commit c578d5da10dc429c6676ab09f3fec0b79b31633a ] Two more HP laptops that use cs35l41 AMP for speaker and GPIO for mute LEDs. So use the existing quirk to enable them accordingly. [ Sort the entries at the SSID order by tiwai ] Signed-off-by: Kai-Heng Feng Reviewed-by: Lucas Tanure Link: https://lore.kernel.org/r/20220719142015.244426-1-kai.heng.feng@canon= ical.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 09d97a8afdda..1ae9674fa8a3 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9234,6 +9234,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = =3D { SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP= _HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIX= UP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIX= UP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", = ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", = ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BO= OST), --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03ED9C38147 for ; Tue, 23 Aug 2022 09:27:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349412AbiHWJ05 (ORCPT ); Tue, 23 Aug 2022 05:26:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349360AbiHWJXy (ORCPT ); Tue, 23 Aug 2022 05:23:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C0868FD44; Tue, 23 Aug 2022 01:35:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DE824B81C55; Tue, 23 Aug 2022 08:33:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11B21C433B5; Tue, 23 Aug 2022 08:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243632; bh=okV8wTqSRwwrc7yagPrgh3wP5C7ga5hywXWTASOpLHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YaEvRlgGRw+6bhG2eWGIuCZ3ouoAUpCZmZ/C0NBiVClD9XqYd8VZ7163kVWrcZjIe N6xx7AlR1aEd/luY60RbX2q7spV6hF3IQM9gxerKPBb4y00+jsKAN/AL8U1LYc27yG En54bUhb4q7KBK1ozahJ5ANKTDViaDYdBxE6xJLs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Ranjani Sridharan , Bard Liao , Mark Brown , Sasha Levin Subject: [PATCH 5.19 339/365] ASoC: SOF: Intel: hda: add sanity check on SSP index reported by NHLT Date: Tue, 23 Aug 2022 10:04:00 +0200 Message-Id: <20220823080132.400854557@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit e51699505042fb365df3a0ce68b850ccd9ad0108 ] We should have a limited trust in the BIOS and verify that the SSP index reported in NHLT is valid for each platform. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220725195343.145603-2-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/sof/intel/hda.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index ed495b7ad1a9..17f2f3a982c3 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -1395,6 +1395,7 @@ struct snd_soc_acpi_mach *hda_machine_select(struct s= nd_sof_dev *sdev) =20 if (mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER && mach->mach_params.i2s_link_mask) { + const struct sof_intel_dsp_desc *chip =3D get_chip_info(sdev->pdata); int ssp_num; =20 if (hweight_long(mach->mach_params.i2s_link_mask) > 1 && @@ -1404,6 +1405,12 @@ struct snd_soc_acpi_mach *hda_machine_select(struct = snd_sof_dev *sdev) /* fls returns 1-based results, SSPs indices are 0-based */ ssp_num =3D fls(mach->mach_params.i2s_link_mask) - 1; =20 + if (ssp_num >=3D chip->ssp_count) { + dev_err(sdev->dev, "Invalid SSP %d, max on this platform is %d\n", + ssp_num, chip->ssp_count); + return NULL; + } + tplg_filename =3D devm_kasprintf(sdev->dev, GFP_KERNEL, "%s%s%d", sof_pdata->tplg_filename, --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FDE2C32772 for ; Tue, 23 Aug 2022 09:37:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351425AbiHWJhb (ORCPT ); Tue, 23 Aug 2022 05:37:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351767AbiHWJf6 (ORCPT ); Tue, 23 Aug 2022 05:35:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F257E97529; Tue, 23 Aug 2022 01:40:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 98B5BB81C3E; Tue, 23 Aug 2022 08:33:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E11C0C433C1; Tue, 23 Aug 2022 08:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243635; bh=+bJaLNnj4pmy29dsPfdJ3cwRoJe/UpZzGD3F4vtamfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJJ659DbvWJb7G2MOeVZ/elNdeDWjsaLc3i3tZkAtFyXtz9qAq6tSnaJslkzBLzjF OGVskaCUrD03MGhyOwj71KLpP66j12wdI8UsmTp2GhaMVOAsS6a3ff4rFx9oOJyX+/ CCl8/DtIy0xIu+k+HmADCNX1wVWI9Xwfsv2njHRA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Andrey Turkin , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.19 340/365] ASoC: Intel: sof_es8336: Fix GPIO quirks set via module option Date: Tue, 23 Aug 2022 10:04:01 +0200 Message-Id: <20220823080132.439592982@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrey Turkin [ Upstream commit 5e60f1cfb830342304200437121f440b72b54f54 ] The two GPIO quirk bits only affected actual GPIO selection when set by the quirks table. They were reported as being in effect when set via module options but actually did nothing. Reviewed-by: Andy Shevchenko Signed-off-by: Andrey Turkin Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220725194909.145418-4-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/intel/boards/sof_es8336.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/s= of_es8336.c index 23d03e0f7759..4d0c361fc277 100644 --- a/sound/soc/intel/boards/sof_es8336.c +++ b/sound/soc/intel/boards/sof_es8336.c @@ -77,8 +77,6 @@ static const struct acpi_gpio_mapping acpi_enable_both_gp= ios_rev_order[] =3D { { } }; =20 -static const struct acpi_gpio_mapping *gpio_mapping =3D acpi_speakers_enab= le_gpio0; - static void log_quirks(struct device *dev) { dev_info(dev, "quirk mask %#lx\n", quirk); @@ -272,15 +270,6 @@ static int sof_es8336_quirk_cb(const struct dmi_system= _id *id) { quirk =3D (unsigned long)id->driver_data; =20 - if (quirk & SOF_ES8336_HEADPHONE_GPIO) { - if (quirk & SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK) - gpio_mapping =3D acpi_enable_both_gpios; - else - gpio_mapping =3D acpi_enable_both_gpios_rev_order; - } else if (quirk & SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK) { - gpio_mapping =3D acpi_speakers_enable_gpio1; - } - return 1; } =20 @@ -529,6 +518,7 @@ static int sof_es8336_probe(struct platform_device *pde= v) struct acpi_device *adev; struct snd_soc_dai_link *dai_links; struct device *codec_dev; + const struct acpi_gpio_mapping *gpio_mapping; unsigned int cnt =3D 0; int dmic_be_num =3D 0; int hdmi_num =3D 3; @@ -635,6 +625,17 @@ static int sof_es8336_probe(struct platform_device *pd= ev) } =20 /* get speaker enable GPIO */ + if (quirk & SOF_ES8336_HEADPHONE_GPIO) { + if (quirk & SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK) + gpio_mapping =3D acpi_enable_both_gpios; + else + gpio_mapping =3D acpi_enable_both_gpios_rev_order; + } else if (quirk & SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK) { + gpio_mapping =3D acpi_speakers_enable_gpio1; + } else { + gpio_mapping =3D acpi_speakers_enable_gpio0; + } + ret =3D devm_acpi_dev_add_driver_gpios(codec_dev, gpio_mapping); if (ret) dev_warn(codec_dev, "unable to add GPIO mapping table\n"); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56D45C32772 for ; Tue, 23 Aug 2022 09:24:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231202AbiHWJYL (ORCPT ); Tue, 23 Aug 2022 05:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350534AbiHWJVw (ORCPT ); Tue, 23 Aug 2022 05:21:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BEAA8E0DF; Tue, 23 Aug 2022 01:34:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C39B1B81C48; Tue, 23 Aug 2022 08:33:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D31CC433C1; Tue, 23 Aug 2022 08:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243638; bh=K+ir609JSd1Xoem7Z547dEqv671JPfbFvoqdmpiy38o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xF4z6Hncd71Rbvl5XJvwZplrfqO0KKyXiFW/ZHXtaqFZ4u71Cr/WGeBWUcVkp7AK2 Sjnw+jlvnOvLGoVhHfsQlO5PdWPTvfOdrHbcqhCDgtlaP3GX9/Q8vhRml2xKI63+58 wVGf6BFcf4jOoUBJv4VUtaseaV1zN13eb6x8v1og= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Andrey Turkin , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.19 341/365] ASoC: Intel: sof_es8336: ignore GpioInt when looking for speaker/headset GPIO lines Date: Tue, 23 Aug 2022 10:04:02 +0200 Message-Id: <20220823080132.481528437@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrey Turkin [ Upstream commit 751e77011f7a43a204bf2a5d02fbf5f8219bc531 ] This fixes speaker GPIO detection on machines those ACPI tables list their jack detection GpioInt before output GpioIo. GpioInt entry can never be the speaker/headphone amplifier control so it makes sense to only look for GpioIo entries when looking for them. Reviewed-by: Andy Shevchenko Signed-off-by: Andrey Turkin Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220725194909.145418-5-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/intel/boards/sof_es8336.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/s= of_es8336.c index 4d0c361fc277..d70d8255b8c7 100644 --- a/sound/soc/intel/boards/sof_es8336.c +++ b/sound/soc/intel/boards/sof_es8336.c @@ -57,23 +57,23 @@ static const struct acpi_gpio_params enable_gpio0 =3D {= 0, 0, true }; static const struct acpi_gpio_params enable_gpio1 =3D { 1, 0, true }; =20 static const struct acpi_gpio_mapping acpi_speakers_enable_gpio0[] =3D { - { "speakers-enable-gpios", &enable_gpio0, 1 }, + { "speakers-enable-gpios", &enable_gpio0, 1, ACPI_GPIO_QUIRK_ONLY_GPIOIO = }, { } }; =20 static const struct acpi_gpio_mapping acpi_speakers_enable_gpio1[] =3D { - { "speakers-enable-gpios", &enable_gpio1, 1 }, + { "speakers-enable-gpios", &enable_gpio1, 1, ACPI_GPIO_QUIRK_ONLY_GPIOIO = }, }; =20 static const struct acpi_gpio_mapping acpi_enable_both_gpios[] =3D { - { "speakers-enable-gpios", &enable_gpio0, 1 }, - { "headphone-enable-gpios", &enable_gpio1, 1 }, + { "speakers-enable-gpios", &enable_gpio0, 1, ACPI_GPIO_QUIRK_ONLY_GPIOIO = }, + { "headphone-enable-gpios", &enable_gpio1, 1, ACPI_GPIO_QUIRK_ONLY_GPIOIO= }, { } }; =20 static const struct acpi_gpio_mapping acpi_enable_both_gpios_rev_order[] = =3D { - { "speakers-enable-gpios", &enable_gpio1, 1 }, - { "headphone-enable-gpios", &enable_gpio0, 1 }, + { "speakers-enable-gpios", &enable_gpio1, 1, ACPI_GPIO_QUIRK_ONLY_GPIOIO = }, + { "headphone-enable-gpios", &enable_gpio0, 1, ACPI_GPIO_QUIRK_ONLY_GPIOIO= }, { } }; =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FE05C32772 for ; Tue, 23 Aug 2022 09:24:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349794AbiHWJYi (ORCPT ); Tue, 23 Aug 2022 05:24:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230452AbiHWJWI (ORCPT ); Tue, 23 Aug 2022 05:22:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF9718E470; Tue, 23 Aug 2022 01:35:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8CCA9B81C5A; Tue, 23 Aug 2022 08:34:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E279DC433C1; Tue, 23 Aug 2022 08:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243641; bh=R02L0ZCJjmtfN54L9LyXEzxy81yp/EaA6NDAEoEHBw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HKorO44LbLldt477PkakbJT2L6UeMncFZkaYivul+PDBQdS4b0IhQgFuGTdgrutf5 QLNXcWDY4rasnMptv5qC+iDrraD4leI74KOcM8GBliDmEKtMt3xHqUBbDtoLDDOxIa NLLoYF5LglgY2WgxVjzmdCQpdy7uYpbnhC6Qtcqg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ranjani Sridharan , Yong Zhi , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.19 342/365] ASoC: Intel: sof_nau8825: Move quirk check to the front in late probe Date: Tue, 23 Aug 2022 10:04:03 +0200 Message-Id: <20220823080132.530191672@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yong Zhi [ Upstream commit 5b56db90bbaf9d8581e5e6268727d8ad706555e4 ] The sof_rt5682_quirk check was placed in the middle of hdmi handling code, move it to the front to be consistent with sof_rt5682.c/sof_card_late_probe(). Reviewed-by: Ranjani Sridharan Signed-off-by: Yong Zhi Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220725194909.145418-11-pierre-louis.bossa= rt@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/intel/boards/sof_nau8825.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/intel/boards/sof_nau8825.c b/sound/soc/intel/boards/= sof_nau8825.c index 97dcd204a246..9b3a2ff4d9cd 100644 --- a/sound/soc/intel/boards/sof_nau8825.c +++ b/sound/soc/intel/boards/sof_nau8825.c @@ -177,11 +177,6 @@ static int sof_card_late_probe(struct snd_soc_card *ca= rd) struct sof_hdmi_pcm *pcm; int err; =20 - if (list_empty(&ctx->hdmi_pcm_list)) - return -EINVAL; - - pcm =3D list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, head); - if (sof_nau8825_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) { /* Disable Left and Right Spk pin after boot */ snd_soc_dapm_disable_pin(dapm, "Left Spk"); @@ -191,6 +186,11 @@ static int sof_card_late_probe(struct snd_soc_card *ca= rd) return err; } =20 + if (list_empty(&ctx->hdmi_pcm_list)) + return -EINVAL; + + pcm =3D list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, head); + return hda_dsp_hdmi_build_controls(card, pcm->codec_dai->component); } =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D214C32774 for ; Tue, 23 Aug 2022 09:24:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349504AbiHWJYR (ORCPT ); Tue, 23 Aug 2022 05:24:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350570AbiHWJV7 (ORCPT ); Tue, 23 Aug 2022 05:21:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C50D8E0C7; Tue, 23 Aug 2022 01:35:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E6B96614DA; Tue, 23 Aug 2022 08:34:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF406C433D6; Tue, 23 Aug 2022 08:34:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243644; bh=mVBmaehpQ/O+zrjmiuuFeI+9dN+eLesTdAlf4Fd5+Rw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S+p3CsUBmcPjfd8Nfv9gMvx9Et44Ay19hIZnX3EB1QERQ7WM5h5EQrQgxgmBH1m71 WH7ugcQpl3w1etLBw3pic8rrlWn1CMiUqmZ7VrKPZPNPeb26F9LdCooT+KJhm4+g0+ TFMF1aBC6LpmmNZXRfdnCZsb69aBGAWjpJ08VGG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Dufour , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 343/365] watchdog: export lockup_detector_reconfigure Date: Tue, 23 Aug 2022 10:04:04 +0200 Message-Id: <20220823080132.584041384@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Laurent Dufour [ Upstream commit 7c56a8733d0a2a4be2438a7512566e5ce552fccf ] In some circumstances it may be interesting to reconfigure the watchdog from inside the kernel. On PowerPC, this may helpful before and after a LPAR migration (LPM) is initiated, because it implies some latencies, watchdog, and especially NMI watchdog is expected to be triggered during this operation. Reconfiguring the watchdog with a factor, would prevent it to happen too frequently during LPM. Rename lockup_detector_reconfigure() as __lockup_detector_reconfigure() and create a new function lockup_detector_reconfigure() calling __lockup_detector_reconfigure() under the protection of watchdog_mutex. Signed-off-by: Laurent Dufour [mpe: Squash in build fix from Laurent, reported by Sachin] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220713154729.80789-3-ldufour@linux.ibm.com Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- include/linux/nmi.h | 2 ++ kernel/watchdog.c | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 750c7f395ca9..f700ff2df074 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -122,6 +122,8 @@ int watchdog_nmi_probe(void); int watchdog_nmi_enable(unsigned int cpu); void watchdog_nmi_disable(unsigned int cpu); =20 +void lockup_detector_reconfigure(void); + /** * touch_nmi_watchdog - restart NMI watchdog timeout. * diff --git a/kernel/watchdog.c b/kernel/watchdog.c index ecb0e8346e65..8e61f21e7e33 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -537,7 +537,7 @@ int lockup_detector_offline_cpu(unsigned int cpu) return 0; } =20 -static void lockup_detector_reconfigure(void) +static void __lockup_detector_reconfigure(void) { cpus_read_lock(); watchdog_nmi_stop(); @@ -557,6 +557,13 @@ static void lockup_detector_reconfigure(void) __lockup_detector_cleanup(); } =20 +void lockup_detector_reconfigure(void) +{ + mutex_lock(&watchdog_mutex); + __lockup_detector_reconfigure(); + mutex_unlock(&watchdog_mutex); +} + /* * Create the watchdog infrastructure and configure the detector(s). */ @@ -573,13 +580,13 @@ static __init void lockup_detector_setup(void) return; =20 mutex_lock(&watchdog_mutex); - lockup_detector_reconfigure(); + __lockup_detector_reconfigure(); softlockup_initialized =3D true; mutex_unlock(&watchdog_mutex); } =20 #else /* CONFIG_SOFTLOCKUP_DETECTOR */ -static void lockup_detector_reconfigure(void) +static void __lockup_detector_reconfigure(void) { cpus_read_lock(); watchdog_nmi_stop(); @@ -587,9 +594,13 @@ static void lockup_detector_reconfigure(void) watchdog_nmi_start(); cpus_read_unlock(); } +void lockup_detector_reconfigure(void) +{ + __lockup_detector_reconfigure(); +} static inline void lockup_detector_setup(void) { - lockup_detector_reconfigure(); + __lockup_detector_reconfigure(); } #endif /* !CONFIG_SOFTLOCKUP_DETECTOR */ =20 @@ -629,7 +640,7 @@ static void proc_watchdog_update(void) { /* Remove impossible cpus to keep sysctl output clean. */ cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask); - lockup_detector_reconfigure(); + __lockup_detector_reconfigure(); } =20 /* --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 905F7C32772 for ; Tue, 23 Aug 2022 09:52:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242537AbiHWJwr (ORCPT ); Tue, 23 Aug 2022 05:52:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351794AbiHWJuz (ORCPT ); Tue, 23 Aug 2022 05:50:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EB349E110; Tue, 23 Aug 2022 01:45:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A56EDB81C56; Tue, 23 Aug 2022 08:34:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 056A3C4347C; Tue, 23 Aug 2022 08:34:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243647; bh=8Vs1K216HeZwGcDjWgWfkjFQVdk3bJl/msDS7/SN7ug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BkGoTgAds6UCcopmFRCkeNAvCL7tfKFf3vsIMkH94TTl8sNvVf4NszW+NgbVoy+VG a0XWGOdbJoy9es73zKGDWZJQHKIcuUjE9vLL9twVYdQfwn1Obf/pFVe6uB4IIq8fQb m7jbyJBVyr+uCwvvyexQx0wRVWv9KrBIjwa8rAjE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Dufour , Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 344/365] powerpc/watchdog: introduce a NMI watchdogs factor Date: Tue, 23 Aug 2022 10:04:05 +0200 Message-Id: <20220823080132.629878606@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Laurent Dufour [ Upstream commit f5e74e836097d1004077390717d4bd95d4a2c27a ] Introduce a factor which would apply to the NMI watchdog timeout. This factor is a percentage added to the watchdog_tresh value. The value is set under the watchdog_mutex protection and lockup_detector_reconfigure() is called to recompute wd_panic_timeout_tb. Once the factor is set, it remains until it is set back to 0, which means no impact. Signed-off-by: Laurent Dufour Reviewed-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220713154729.80789-4-ldufour@linux.ibm.com Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/powerpc/include/asm/nmi.h | 2 ++ arch/powerpc/kernel/watchdog.c | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/nmi.h b/arch/powerpc/include/asm/nmi.h index ea0e487f87b1..c3c7adef74de 100644 --- a/arch/powerpc/include/asm/nmi.h +++ b/arch/powerpc/include/asm/nmi.h @@ -5,8 +5,10 @@ #ifdef CONFIG_PPC_WATCHDOG extern void arch_touch_nmi_watchdog(void); long soft_nmi_interrupt(struct pt_regs *regs); +void watchdog_nmi_set_timeout_pct(u64 pct); #else static inline void arch_touch_nmi_watchdog(void) {} +static inline void watchdog_nmi_set_timeout_pct(u64 pct) {} #endif =20 #ifdef CONFIG_NMI_IPI diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c index 7d28b9553654..5d903e63f932 100644 --- a/arch/powerpc/kernel/watchdog.c +++ b/arch/powerpc/kernel/watchdog.c @@ -91,6 +91,10 @@ static cpumask_t wd_smp_cpus_pending; static cpumask_t wd_smp_cpus_stuck; static u64 wd_smp_last_reset_tb; =20 +#ifdef CONFIG_PPC_PSERIES +static u64 wd_timeout_pct; +#endif + /* * Try to take the exclusive watchdog action / NMI IPI / printing lock. * wd_smp_lock must be held. If this fails, we should return and wait @@ -527,7 +531,13 @@ static int stop_watchdog_on_cpu(unsigned int cpu) =20 static void watchdog_calc_timeouts(void) { - wd_panic_timeout_tb =3D watchdog_thresh * ppc_tb_freq; + u64 threshold =3D watchdog_thresh; + +#ifdef CONFIG_PPC_PSERIES + threshold +=3D (READ_ONCE(wd_timeout_pct) * threshold) / 100; +#endif + + wd_panic_timeout_tb =3D threshold * ppc_tb_freq; =20 /* Have the SMP detector trigger a bit later */ wd_smp_panic_timeout_tb =3D wd_panic_timeout_tb * 3 / 2; @@ -570,3 +580,12 @@ int __init watchdog_nmi_probe(void) } return 0; } + +#ifdef CONFIG_PPC_PSERIES +void watchdog_nmi_set_timeout_pct(u64 pct) +{ + pr_info("Set the NMI watchdog timeout factor to %llu%%\n", pct); + WRITE_ONCE(wd_timeout_pct, pct); + lockup_detector_reconfigure(); +} +#endif --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7331EC32772 for ; Tue, 23 Aug 2022 09:37:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351485AbiHWJhp (ORCPT ); Tue, 23 Aug 2022 05:37:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351825AbiHWJgB (ORCPT ); Tue, 23 Aug 2022 05:36:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 159F177EBD; Tue, 23 Aug 2022 01:40:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DF4C2B81C5C; Tue, 23 Aug 2022 08:34:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17ECCC433D6; Tue, 23 Aug 2022 08:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243650; bh=E3o1NL9M7MMxOvh5P8/+p5pkrfDEPsN6Qcy7OMxtyBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iNxUGgz1wYS+xdqLHgod7z0VcqYGjCZdtQ7pR/+osCssFe921qG1Sn0mkUYDGz6ZC kBzQHABFPWsVyxutdnNNNIP99uTuJcth2hEJEli1g/0n9oDWqopPOYHxq7RYYVR/bd bH2tJA2haZsdZkbYvminTtYMaL4kwRf9VemOoQ/g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Dufour , Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 345/365] powerpc/pseries/mobility: set NMI watchdog factor during an LPM Date: Tue, 23 Aug 2022 10:04:06 +0200 Message-Id: <20220823080132.671776851@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Laurent Dufour [ Upstream commit 118b1366930c8c833b8b36abef657f40d4e26610 ] During an LPM, while the memory transfer is in progress on the arrival side, some latencies are generated when accessing not yet transferred pages on the arrival side. Thus, the NMI watchdog may be triggered too frequently, which increases the risk to hit an NMI interrupt in a bad place in the kernel, leading to a kernel panic. Disabling the Hard Lockup Watchdog until the memory transfer could be a too strong work around, some users would want this timeout to be eventually triggered if the system is hanging even during an LPM. Introduce a new sysctl variable nmi_watchdog_factor. It allows to apply a factor to the NMI watchdog timeout during an LPM. Just before the CPUs are stopped for the switchover sequence, the NMI watchdog timer is set to watchdog_thresh + factor% A value of 0 has no effect. The default value is 200, meaning that the NMI watchdog is set to 30s during LPM (based on a 10s watchdog_thresh value). Once the memory transfer is achieved, the factor is reset to 0. Setting this value to a high number is like disabling the NMI watchdog during an LPM. Signed-off-by: Laurent Dufour Reviewed-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220713154729.80789-5-ldufour@linux.ibm.com Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- Documentation/admin-guide/sysctl/kernel.rst | 12 ++++++ arch/powerpc/platforms/pseries/mobility.c | 43 +++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/ad= min-guide/sysctl/kernel.rst index ddccd1077462..9b7fa1baf225 100644 --- a/Documentation/admin-guide/sysctl/kernel.rst +++ b/Documentation/admin-guide/sysctl/kernel.rst @@ -592,6 +592,18 @@ to the guest kernel command line (see Documentation/admin-guide/kernel-parameters.rst). =20 =20 +nmi_wd_lpm_factor (PPC only) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D + +Factor to apply to the NMI watchdog timeout (only when ``nmi_watchdog`` is +set to 1). This factor represents the percentage added to +``watchdog_thresh`` when calculating the NMI watchdog timeout during an +LPM. The soft lockup timeout is not impacted. + +A value of 0 means no change. The default value is 200 meaning the NMI +watchdog is set to 30s (based on ``watchdog_thresh`` equal to 10). + + numa_balancing =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platf= orms/pseries/mobility.c index 78f3f74c7056..cbe0989239bf 100644 --- a/arch/powerpc/platforms/pseries/mobility.c +++ b/arch/powerpc/platforms/pseries/mobility.c @@ -48,6 +48,39 @@ struct update_props_workarea { #define MIGRATION_SCOPE (1) #define PRRN_SCOPE -2 =20 +#ifdef CONFIG_PPC_WATCHDOG +static unsigned int nmi_wd_lpm_factor =3D 200; + +#ifdef CONFIG_SYSCTL +static struct ctl_table nmi_wd_lpm_factor_ctl_table[] =3D { + { + .procname =3D "nmi_wd_lpm_factor", + .data =3D &nmi_wd_lpm_factor, + .maxlen =3D sizeof(int), + .mode =3D 0644, + .proc_handler =3D proc_douintvec_minmax, + }, + {} +}; +static struct ctl_table nmi_wd_lpm_factor_sysctl_root[] =3D { + { + .procname =3D "kernel", + .mode =3D 0555, + .child =3D nmi_wd_lpm_factor_ctl_table, + }, + {} +}; + +static int __init register_nmi_wd_lpm_factor_sysctl(void) +{ + register_sysctl_table(nmi_wd_lpm_factor_sysctl_root); + + return 0; +} +device_initcall(register_nmi_wd_lpm_factor_sysctl); +#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_PPC_WATCHDOG */ + static int mobility_rtas_call(int token, char *buf, s32 scope) { int rc; @@ -665,19 +698,29 @@ static int pseries_suspend(u64 handle) static int pseries_migrate_partition(u64 handle) { int ret; + unsigned int factor =3D 0; =20 +#ifdef CONFIG_PPC_WATCHDOG + factor =3D nmi_wd_lpm_factor; +#endif ret =3D wait_for_vasi_session_suspending(handle); if (ret) return ret; =20 vas_migration_handler(VAS_SUSPEND); =20 + if (factor) + watchdog_nmi_set_timeout_pct(factor); + ret =3D pseries_suspend(handle); if (ret =3D=3D 0) post_mobility_fixup(); else pseries_cancel_migration(handle, ret); =20 + if (factor) + watchdog_nmi_set_timeout_pct(0); + vas_migration_handler(VAS_RESUME); =20 return ret; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB7F4C3F6B0 for ; Tue, 23 Aug 2022 09:26:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349936AbiHWJY4 (ORCPT ); Tue, 23 Aug 2022 05:24:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235543AbiHWJWP (ORCPT ); Tue, 23 Aug 2022 05:22:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE4838E9A6; Tue, 23 Aug 2022 01:35:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3A6086148E; Tue, 23 Aug 2022 08:34:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 425ACC433D7; Tue, 23 Aug 2022 08:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243653; bh=txqmN+YAfMMR2TvIi5EB/XRuqWPGhCXHEhadMv2AIf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mDCllxJ+0uZO/rcCKfk6l0vTbXNl0WUnoxc5H3Wr2bxU8ws0VB6Y37u0m8vlkjdrI 0bMDWvALDiUMx3JVH6hAwa7tya3M6N4becFsCw5Z95wh//mIOzww99lDIiP5SzBwNT 9ALpxysI8xqQw+hx57RZbhVNo41w/4xYnQIxa+dU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Bizon , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 346/365] powerpc/32: Set an IBAT covering up to _einittext during init Date: Tue, 23 Aug 2022 10:04:07 +0200 Message-Id: <20220823080132.723879155@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy [ Upstream commit 2a0fb3c155c97c75176e557d61f8e66c1bd9b735 ] Always set an IBAT covering up to _einittext during init because when CONFIG_MODULES is not selected there is no reason to have an exception handler for kernel instruction TLB misses. It implies DBAT and IBAT are now totaly independent, IBATs are set by setibat() and DBAT by setbat(). This allows to revert commit 9bb162fa26ed ("powerpc/603: Fix boot failure with DEBUG_PAGEALLOC and KFENCE") Reported-by: Maxime Bizon Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/ce7f04a39593934d9b1ee68c69144ccd3d4da4a1.16= 55202804.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/powerpc/kernel/head_book3s_32.S | 4 ++-- arch/powerpc/mm/book3s32/mmu.c | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/head_book3s_32.S b/arch/powerpc/kernel/hea= d_book3s_32.S index 6c739beb938c..519b60695167 100644 --- a/arch/powerpc/kernel/head_book3s_32.S +++ b/arch/powerpc/kernel/head_book3s_32.S @@ -418,14 +418,14 @@ InstructionTLBMiss: */ /* Get PTE (linux-style) and check access */ mfspr r3,SPRN_IMISS -#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(= CONFIG_KFENCE) +#ifdef CONFIG_MODULES lis r1, TASK_SIZE@h /* check if kernel address */ cmplw 0,r1,r3 #endif mfspr r2, SPRN_SDR1 li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC | _PAGE_USER rlwinm r2, r2, 28, 0xfffff000 -#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(= CONFIG_KFENCE) +#ifdef CONFIG_MODULES bgt- 112f lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC diff --git a/arch/powerpc/mm/book3s32/mmu.c b/arch/powerpc/mm/book3s32/mmu.c index 49a737fbbd18..40029280c320 100644 --- a/arch/powerpc/mm/book3s32/mmu.c +++ b/arch/powerpc/mm/book3s32/mmu.c @@ -159,7 +159,10 @@ unsigned long __init mmu_mapin_ram(unsigned long base,= unsigned long top) { unsigned long done; unsigned long border =3D (unsigned long)__init_begin - PAGE_OFFSET; + unsigned long size; =20 + size =3D roundup_pow_of_two((unsigned long)_einittext - PAGE_OFFSET); + setibat(0, PAGE_OFFSET, 0, size, PAGE_KERNEL_X); =20 if (debug_pagealloc_enabled_or_kfence() || __map_without_bats) { pr_debug_once("Read-Write memory mapped without BATs\n"); @@ -245,10 +248,9 @@ void mmu_mark_rodata_ro(void) } =20 /* - * Set up one of the I/D BAT (block address translation) register pairs. + * Set up one of the D BAT (block address translation) register pairs. * The parameters are not checked; in particular size must be a power * of 2 between 128k and 256M. - * On 603+, only set IBAT when _PAGE_EXEC is set */ void __init setbat(int index, unsigned long virt, phys_addr_t phys, unsigned int size, pgprot_t prot) @@ -284,10 +286,6 @@ void __init setbat(int index, unsigned long virt, phys= _addr_t phys, /* G bit must be zero in IBATs */ flags &=3D ~_PAGE_EXEC; } - if (flags & _PAGE_EXEC) - bat[0] =3D bat[1]; - else - bat[0].batu =3D bat[0].batl =3D 0; =20 bat_addrs[index].start =3D virt; bat_addrs[index].limit =3D virt + ((bl + 1) << 17) - 1; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCB43C32792 for ; Tue, 23 Aug 2022 09:26:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349995AbiHWJZA (ORCPT ); Tue, 23 Aug 2022 05:25:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349421AbiHWJWl (ORCPT ); Tue, 23 Aug 2022 05:22:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 295B78F961; Tue, 23 Aug 2022 01:35:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4CAF261475; Tue, 23 Aug 2022 08:34:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C032C433D6; Tue, 23 Aug 2022 08:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243656; bh=rgl2pl075cMqiv5B6oltGiEO3MKkPYTTm1hS0wc0SuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lug6VElr4AfMYbEedK0NC5H4t4rlJDZ8GHPEO/3b7HwlliSXOVvsKf5fhBgxhNLir iPgRVVdN62CdwX9LaC+h9ChNeHT9qQJ/My3jFkRzxV5Qz9FsdoVafi/WzZfwaGixNm +4720aG0/yKtka8ni/uHTbaSGTNYZpvJ5S1WuLM0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Christophe Leroy , Arnd Bergmann , Segher Boessenkool , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 347/365] powerpc/32: Dont always pass -mcpu=powerpc to the compiler Date: Tue, 23 Aug 2022 10:04:08 +0200 Message-Id: <20220823080132.777072411@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy [ Upstream commit 446cda1b21d9a6b3697fe399c6a3a00ff4a285f5 ] Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic machine type for 32-bit compile"), when building a 32 bits kernel with a bi-arch version of GCC, or when building a book3s/32 kernel, the option -mcpu=3Dpowerpc is passed to GCC at all time, relying on it being eventually overriden by a subsequent -mcpu=3Dxxxx. But when building the same kernel with a 32 bits only version of GCC, that is not done, relying on gcc being built with the expected default CPU. This logic has two problems. First, it is a bit fragile to rely on whether the GCC version is bi-arch or not, because today we can have bi-arch versions of GCC configured with a 32 bits default. Second, there are some versions of GCC which don't support -mcpu=3Dpowerpc, for instance for e500 SPE-only versions. So, stop relying on this approximative logic and allow the user to decide whether he/she wants to use the toolchain's default CPU or if he/she wants to set one, and allow only possible CPUs based on the selected target. Reported-by: Pali Roh=C3=A1r Signed-off-by: Christophe Leroy Tested-by: Pali Roh=C3=A1r Reviewed-by: Arnd Bergmann Reviewed-by: Segher Boessenkool Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/d4df724691351531bf46d685d654689e5dfa0d74.16= 57549153.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/powerpc/Makefile | 26 +------------------------- arch/powerpc/platforms/Kconfig.cputype | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index a0cd70712061..d54e1fe03551 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -15,23 +15,6 @@ HAS_BIARCH :=3D $(call cc-option-yn, -m32) # Set default 32 bits cross compilers for vdso and boot wrapper CROSS32_COMPILE ?=3D =20 -ifeq ($(HAS_BIARCH),y) -ifeq ($(CROSS32_COMPILE),) -ifdef CONFIG_PPC32 -# These options will be overridden by any -mcpu option that the CPU -# or platform code sets later on the command line, but they are needed -# to set a sane 32-bit cpu target for the 64-bit cross compiler which -# may default to the wrong ISA. -KBUILD_CFLAGS +=3D -mcpu=3Dpowerpc -KBUILD_AFLAGS +=3D -mcpu=3Dpowerpc -endif -endif -endif - -ifdef CONFIG_PPC_BOOK3S_32 -KBUILD_CFLAGS +=3D -mcpu=3Dpowerpc -endif - # If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise ju= st use # ppc64_defconfig because we have nothing better to go on. uname :=3D $(shell uname -m) @@ -183,6 +166,7 @@ endif endif =20 CFLAGS-$(CONFIG_TARGET_CPU_BOOL) +=3D $(call cc-option,-mcpu=3D$(CONFIG_TA= RGET_CPU)) +AFLAGS-$(CONFIG_TARGET_CPU_BOOL) +=3D $(call cc-option,-mcpu=3D$(CONFIG_TA= RGET_CPU)) =20 # Altivec option not allowed with e500mc64 in GCC. ifdef CONFIG_ALTIVEC @@ -193,14 +177,6 @@ endif CFLAGS-$(CONFIG_E5500_CPU) +=3D $(E5500_CPU) CFLAGS-$(CONFIG_E6500_CPU) +=3D $(call cc-option,-mcpu=3De6500,$(E5500_CPU= )) =20 -ifdef CONFIG_PPC32 -ifdef CONFIG_PPC_E500MC -CFLAGS-y +=3D $(call cc-option,-mcpu=3De500mc,-mcpu=3Dpowerpc) -else -CFLAGS-$(CONFIG_E500) +=3D $(call cc-option,-mcpu=3D8540 -msoft-float,-mcp= u=3Dpowerpc) -endif -endif - asinstr :=3D $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=3D1) =20 KBUILD_CPPFLAGS +=3D -I $(srctree)/arch/$(ARCH) $(asinstr) diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platform= s/Kconfig.cputype index 3629fd73083e..18115cabaedf 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -136,9 +136,9 @@ config GENERIC_CPU select ARCH_HAS_FAST_MULTIPLIER select PPC_64S_HASH_MMU =20 -config GENERIC_CPU +config POWERPC_CPU bool "Generic 32 bits powerpc" - depends on PPC32 && !PPC_8xx + depends on PPC32 && !PPC_8xx && !PPC_85xx =20 config CELL_CPU bool "Cell Broadband Engine" @@ -197,11 +197,23 @@ config G4_CPU depends on PPC_BOOK3S_32 select ALTIVEC =20 +config E500_CPU + bool "e500 (8540)" + depends on PPC_85xx && !PPC_E500MC + +config E500MC_CPU + bool "e500mc" + depends on PPC_85xx && PPC_E500MC + +config TOOLCHAIN_DEFAULT_CPU + bool "Rely on the toolchain's implicit default CPU" + depends on PPC32 + endchoice =20 config TARGET_CPU_BOOL bool - default !GENERIC_CPU + default !GENERIC_CPU && !TOOLCHAIN_DEFAULT_CPU =20 config TARGET_CPU string @@ -216,6 +228,9 @@ config TARGET_CPU default "e300c2" if E300C2_CPU default "e300c3" if E300C3_CPU default "G4" if G4_CPU + default "8540" if E500_CPU + default "e500mc" if E500MC_CPU + default "powerpc" if POWERPC_CPU =20 config PPC_BOOK3S def_bool y --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B0CEC52D78 for ; Tue, 23 Aug 2022 09:27:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349849AbiHWJ1T (ORCPT ); Tue, 23 Aug 2022 05:27:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240349AbiHWJYS (ORCPT ); Tue, 23 Aug 2022 05:24:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48DE22BC9; Tue, 23 Aug 2022 01:35:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1D0E5B81C3B; Tue, 23 Aug 2022 08:34:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A430C433C1; Tue, 23 Aug 2022 08:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243659; bh=jld3Qog9SsdZFeVcGy1YR+rTIrPAlZB2z9rTGiZgsQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YqmiYjEiZAeJGtAgFmEmu4TtRuoNPj+uxPB6nlo6vj53VCljHNypntsky9YMAwHbz cfWFMw8mJ1ClWdJAa+kh37HIYCMYuhIW6hKmEzwnCIqE3Vb+2msUY6ELLH2oSqZz4G +CkUWG7rv2lMEAeDBSTTT8LRu7viiEzuA8/sb7QU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivasa Rao Mandadapu , Srinivas Kandagatla , Mark Brown , Sasha Levin Subject: [PATCH 5.19 348/365] ASoC: codecs: va-macro: use fsgen as clock Date: Tue, 23 Aug 2022 10:04:09 +0200 Message-Id: <20220823080132.818607059@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla [ Upstream commit 30097967e0566cac817273ef76add100f6b0f463 ] VA Macro fsgen clock is supplied to other LPASS Macros using proper clock apis, however the internal user uses the registers directly without clk apis. This approch has race condition where in external users of the clock might cut the clock while VA macro is actively using this. Moving the internal usage to clk apis would provide a proper refcounting and avoid such race conditions. This issue was noticed while headset was pulled out while recording is in progress and shifting record patch to DMIC. Reported-by: Srinivasa Rao Mandadapu Signed-off-by: Srinivas Kandagatla Tested-by: Srinivasa Rao Mandadapu Link: https://lore.kernel.org/r/20220727124749.4604-1-srinivas.kandagatla@l= inaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/soc/codecs/lpass-va-macro.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-= macro.c index d18b56e60433..1ea10dc70748 100644 --- a/sound/soc/codecs/lpass-va-macro.c +++ b/sound/soc/codecs/lpass-va-macro.c @@ -199,6 +199,7 @@ struct va_macro { struct clk *mclk; struct clk *macro; struct clk *dcodec; + struct clk *fsgen; struct clk_hw hw; struct lpass_macro *pds; =20 @@ -467,9 +468,9 @@ static int va_macro_mclk_event(struct snd_soc_dapm_widg= et *w, =20 switch (event) { case SND_SOC_DAPM_PRE_PMU: - return va_macro_mclk_enable(va, true); + return clk_prepare_enable(va->fsgen); case SND_SOC_DAPM_POST_PMD: - return va_macro_mclk_enable(va, false); + clk_disable_unprepare(va->fsgen); } =20 return 0; @@ -1473,6 +1474,12 @@ static int va_macro_probe(struct platform_device *pd= ev) if (ret) goto err_clkout; =20 + va->fsgen =3D clk_hw_get_clk(&va->hw, "fsgen"); + if (IS_ERR(va->fsgen)) { + ret =3D PTR_ERR(va->fsgen); + goto err_clkout; + } + ret =3D devm_snd_soc_register_component(dev, &va_macro_component_drv, va_macro_dais, ARRAY_SIZE(va_macro_dais)); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33245C32774 for ; Tue, 23 Aug 2022 09:25:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349494AbiHWJZK (ORCPT ); Tue, 23 Aug 2022 05:25:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349503AbiHWJW5 (ORCPT ); Tue, 23 Aug 2022 05:22:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71CDD75CD1; Tue, 23 Aug 2022 01:35:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 22205B81C54; Tue, 23 Aug 2022 08:34:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61D17C433C1; Tue, 23 Aug 2022 08:34:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243665; bh=nn64llpKQwSVbNBIKVAhqVnQyKZuwOGj7VhDj+fGt14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ch91C9fygbVTb6h9tn6hXt9xiT/HoHVLYuFzDaORqzhJEEABF/95VfSSrkwpyzo0V QQfe18blI3aKOAsggLIMepo/YljJUxJJ3hryZZGRJlE89F/Hk7DLRBFOjzi9OQrCLQ HRsxEWE7TzZZ8eQVCtmjyGgqfThitX8lubTTz2N8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alois Wohlschlager , Miklos Szeredi , Sasha Levin Subject: [PATCH 5.19 349/365] ovl: warn if trusted xattr creation fails Date: Tue, 23 Aug 2022 10:04:10 +0200 Message-Id: <20220823080132.857906640@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miklos Szeredi [ Upstream commit b10b85fe5149ee8b39fbbf86095b303632dde2cd ] When mounting overlayfs in an unprivileged user namespace, trusted xattr creation will fail. This will lead to failures in some file operations, e.g. in the following situation: mkdir lower upper work merged mkdir lower/directory mount -toverlay -olowerdir=3Dlower,upperdir=3Dupper,workdir=3Dwork none m= erged rmdir merged/directory mkdir merged/directory The last mkdir will fail: mkdir: cannot create directory 'merged/directory': Input/output error The cause for these failures is currently extremely non-obvious and hard to debug. Hence, warn the user and suggest using the userxattr mount option, if it is not already supplied and xattr creation fails during the self-check. Reported-by: Alois Wohlschlager Signed-off-by: Miklos Szeredi Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/overlayfs/super.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 1ce5c9698393..4c2096130209 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1418,11 +1418,12 @@ static int ovl_make_workdir(struct super_block *sb,= struct ovl_fs *ofs, */ err =3D ovl_setxattr(ofs, ofs->workdir, OVL_XATTR_OPAQUE, "0", 1); if (err) { + pr_warn("failed to set xattr on upper\n"); ofs->noxattr =3D true; if (ofs->config.index || ofs->config.metacopy) { ofs->config.index =3D false; ofs->config.metacopy =3D false; - pr_warn("upper fs does not support xattr, falling back to index=3Doff,m= etacopy=3Doff.\n"); + pr_warn("...falling back to index=3Doff,metacopy=3Doff.\n"); } /* * xattr support is required for persistent st_ino. @@ -1430,8 +1431,10 @@ static int ovl_make_workdir(struct super_block *sb, = struct ovl_fs *ofs, */ if (ofs->config.xino =3D=3D OVL_XINO_AUTO) { ofs->config.xino =3D OVL_XINO_OFF; - pr_warn("upper fs does not support xattr, falling back to xino=3Doff.\n= "); + pr_warn("...falling back to xino=3Doff.\n"); } + if (err =3D=3D -EPERM && !ofs->config.userxattr) + pr_info("try mounting with 'userxattr' option\n"); err =3D 0; } else { ovl_removexattr(ofs, ofs->workdir, OVL_XATTR_OPAQUE); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4020C32772 for ; Tue, 23 Aug 2022 10:07:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352460AbiHWKHk (ORCPT ); Tue, 23 Aug 2022 06:07:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352430AbiHWKBx (ORCPT ); Tue, 23 Aug 2022 06:01:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E4357C1C3; Tue, 23 Aug 2022 01:49:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7BA2FB81C4C; Tue, 23 Aug 2022 08:34:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2DD1C433D6; Tue, 23 Aug 2022 08:34:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243669; bh=t0TSqAFuhyH1+CMJ7UbBnSE+KHqu5QO/EWY90mPSeHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XP7+8gwUK+RlQ2syisO10kgb1tEsOGEEzUmfmF9BqL+gxersn460Fc7bOkFAyHVdS 4yhfjEvV1FlNaebmIYF1SEdYWwOQpGMVJa92YflI5eYMDUy6uTmq1ePzTkYohW2u1F 6V9p9sVvVagBwFFK2kIoglQ/WaszmlurbV1QoUXA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kardashevskiy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 350/365] powerpc/ioda/iommu/debugfs: Generate unique debugfs entries Date: Tue, 23 Aug 2022 10:04:11 +0200 Message-Id: <20220823080132.903219215@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexey Kardashevskiy [ Upstream commit d73b46c3c1449bf27f793b9d9ee86ed70c7a7163 ] The iommu_table::it_index is a LIOBN which is not initialized on PowerNV as it is not used except IOMMU debugfs where it is used for a node name. This initializes it_index witn a unique number to avoid warnings and have a node for every iommu_table. This should not cause any behavioral change without CONFIG_IOMMU_DEBUGFS. Signed-off-by: Alexey Kardashevskiy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220714080800.3712998-1-aik@ozlabs.ru Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/powerpc/platforms/powernv/pci-ioda.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platf= orms/powernv/pci-ioda.c index c8cf2728031a..9de9b2fb163d 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -1609,6 +1609,7 @@ static void pnv_pci_ioda1_setup_dma_pe(struct pnv_phb= *phb, tbl->it_ops =3D &pnv_ioda1_iommu_ops; pe->table_group.tce32_start =3D tbl->it_offset << tbl->it_page_shift; pe->table_group.tce32_size =3D tbl->it_size << tbl->it_page_shift; + tbl->it_index =3D (phb->hose->global_number << 16) | pe->pe_number; if (!iommu_init_table(tbl, phb->hose->node, 0, 0)) panic("Failed to initialize iommu table"); =20 @@ -1779,6 +1780,7 @@ static long pnv_pci_ioda2_setup_default_config(struct= pnv_ioda_pe *pe) res_end =3D min(window_size, SZ_4G) >> tbl->it_page_shift; } =20 + tbl->it_index =3D (pe->phb->hose->global_number << 16) | pe->pe_number; if (iommu_init_table(tbl, pe->phb->hose->node, res_start, res_end)) rc =3D pnv_pci_ioda2_set_window(&pe->table_group, 0, tbl); else --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EE42C32772 for ; Tue, 23 Aug 2022 09:29:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350227AbiHWJ3D (ORCPT ); Tue, 23 Aug 2022 05:29:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350467AbiHWJZu (ORCPT ); Tue, 23 Aug 2022 05:25:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67096760FC; Tue, 23 Aug 2022 01:36:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2896D61519; Tue, 23 Aug 2022 08:34:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AD4AC4314B; Tue, 23 Aug 2022 08:34:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243672; bh=ShuwgENlE/EI+6Nzcu62eOBuU19hQbRvJ9/8rsU0Q8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQpJ2IWP+YoSQZ0Mt0JvIQDYGzM4aF4R+PSwSYkJnWJeC79Jx+dzGebPRSMB81vVC zDGApo1vhmKkuJCLyd1PP1h9RjDcyVq0/UtHYAbe7aKXnwmKkW0pB1UhssrivrTq// aYTTRJnmPVpO1rmXYkDkgxOeudlZuvxfCBy69vhI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.19 351/365] ALSA: core: Add async signal helpers Date: Tue, 23 Aug 2022 10:04:12 +0200 Message-Id: <20220823080132.955556547@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit ef34a0ae7a2654bc9e58675e36898217fb2799d8 ] Currently the call of kill_fasync() from an interrupt handler might lead to potential spin deadlocks, as spotted by syzkaller. Unfortunately, it's not so trivial to fix this lock chain as it's involved with the tasklist_lock that is touched in allover places. As a temporary workaround, this patch provides the way to defer the async signal notification in a work. The new helper functions, snd_fasync_helper() and snd_kill_faync() are replacements for fasync_helper() and kill_fasync(), respectively. In addition, snd_fasync_free() needs to be called at the destructor of the relevant file object. Link: https://lore.kernel.org/r/20220728125945.29533-2-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- include/sound/core.h | 8 ++++ sound/core/misc.c | 94 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) diff --git a/include/sound/core.h b/include/sound/core.h index 6d4cc49584c6..39cee40ac22e 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -501,4 +501,12 @@ snd_pci_quirk_lookup_id(u16 vendor, u16 device, } #endif =20 +/* async signal helpers */ +struct snd_fasync; + +int snd_fasync_helper(int fd, struct file *file, int on, + struct snd_fasync **fasyncp); +void snd_kill_fasync(struct snd_fasync *fasync, int signal, int poll); +void snd_fasync_free(struct snd_fasync *fasync); + #endif /* __SOUND_CORE_H */ diff --git a/sound/core/misc.c b/sound/core/misc.c index 50e4aaa6270d..d32a19976a2b 100644 --- a/sound/core/misc.c +++ b/sound/core/misc.c @@ -10,6 +10,7 @@ #include #include #include +#include #include =20 #ifdef CONFIG_SND_DEBUG @@ -145,3 +146,96 @@ snd_pci_quirk_lookup(struct pci_dev *pci, const struct= snd_pci_quirk *list) } EXPORT_SYMBOL(snd_pci_quirk_lookup); #endif + +/* + * Deferred async signal helpers + * + * Below are a few helper functions to wrap the async signal handling + * in the deferred work. The main purpose is to avoid the messy deadlock + * around tasklist_lock and co at the kill_fasync() invocation. + * fasync_helper() and kill_fasync() are replaced with snd_fasync_helper() + * and snd_kill_fasync(), respectively. In addition, snd_fasync_free() has + * to be called at releasing the relevant file object. + */ +struct snd_fasync { + struct fasync_struct *fasync; + int signal; + int poll; + int on; + struct list_head list; +}; + +static DEFINE_SPINLOCK(snd_fasync_lock); +static LIST_HEAD(snd_fasync_list); + +static void snd_fasync_work_fn(struct work_struct *work) +{ + struct snd_fasync *fasync; + + spin_lock_irq(&snd_fasync_lock); + while (!list_empty(&snd_fasync_list)) { + fasync =3D list_first_entry(&snd_fasync_list, struct snd_fasync, list); + list_del_init(&fasync->list); + spin_unlock_irq(&snd_fasync_lock); + if (fasync->on) + kill_fasync(&fasync->fasync, fasync->signal, fasync->poll); + spin_lock_irq(&snd_fasync_lock); + } + spin_unlock_irq(&snd_fasync_lock); +} + +static DECLARE_WORK(snd_fasync_work, snd_fasync_work_fn); + +int snd_fasync_helper(int fd, struct file *file, int on, + struct snd_fasync **fasyncp) +{ + struct snd_fasync *fasync =3D NULL; + + if (on) { + fasync =3D kzalloc(sizeof(*fasync), GFP_KERNEL); + if (!fasync) + return -ENOMEM; + INIT_LIST_HEAD(&fasync->list); + } + + spin_lock_irq(&snd_fasync_lock); + if (*fasyncp) { + kfree(fasync); + fasync =3D *fasyncp; + } else { + if (!fasync) { + spin_unlock_irq(&snd_fasync_lock); + return 0; + } + *fasyncp =3D fasync; + } + fasync->on =3D on; + spin_unlock_irq(&snd_fasync_lock); + return fasync_helper(fd, file, on, &fasync->fasync); +} +EXPORT_SYMBOL_GPL(snd_fasync_helper); + +void snd_kill_fasync(struct snd_fasync *fasync, int signal, int poll) +{ + unsigned long flags; + + if (!fasync || !fasync->on) + return; + spin_lock_irqsave(&snd_fasync_lock, flags); + fasync->signal =3D signal; + fasync->poll =3D poll; + list_move(&fasync->list, &snd_fasync_list); + schedule_work(&snd_fasync_work); + spin_unlock_irqrestore(&snd_fasync_lock, flags); +} +EXPORT_SYMBOL_GPL(snd_kill_fasync); + +void snd_fasync_free(struct snd_fasync *fasync) +{ + if (!fasync) + return; + fasync->on =3D 0; + flush_work(&snd_fasync_work); + kfree(fasync); +} +EXPORT_SYMBOL_GPL(snd_fasync_free); --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 312E3C52D79 for ; Tue, 23 Aug 2022 09:27:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349819AbiHWJ11 (ORCPT ); Tue, 23 Aug 2022 05:27:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349772AbiHWJY1 (ORCPT ); Tue, 23 Aug 2022 05:24:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65F7E90194; Tue, 23 Aug 2022 01:35:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 407F761485; Tue, 23 Aug 2022 08:34:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A09DC433D6; Tue, 23 Aug 2022 08:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243675; bh=dJICxAXUVqoAvRcs1iEYL7jr+zKhXIpbPrZJ96/wyv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZwMCqWcDGnd0eZTKPyV9YfSF0n2lJFSrYWLHsEaXxnPd3Qb1AvXBCrtuKxticN6q2 ncj/pEFzIz5X9DTzRfEgi/4CveheUZDUmjo10FTPwDt++F5+IHWzqwliqqAklNOZXN xI/FH89eGyR3vJEFHbZP3Scsn92/1/VflLqecLTQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+1ee0910eca9c94f71f25@syzkaller.appspotmail.com, syzbot+49b10793b867871ee26f@syzkaller.appspotmail.com, syzbot+8285e973a41b5aa68902@syzkaller.appspotmail.com, Takashi Iwai , Sasha Levin Subject: [PATCH 5.19 352/365] ALSA: timer: Use deferred fasync helper Date: Tue, 23 Aug 2022 10:04:13 +0200 Message-Id: <20220823080132.998740514@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 95cc637c1afd83fb7dd3d7c8a53710488f4caf9c ] For avoiding the potential deadlock via kill_fasync() call, use the new fasync helpers to defer the invocation from PCI API. Note that it's merely a workaround. Reported-by: syzbot+1ee0910eca9c94f71f25@syzkaller.appspotmail.com Reported-by: syzbot+49b10793b867871ee26f@syzkaller.appspotmail.com Reported-by: syzbot+8285e973a41b5aa68902@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/20220728125945.29533-3-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/core/timer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sound/core/timer.c b/sound/core/timer.c index b3214baa8919..e08a37c23add 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -83,7 +83,7 @@ struct snd_timer_user { unsigned int filter; struct timespec64 tstamp; /* trigger tstamp */ wait_queue_head_t qchange_sleep; - struct fasync_struct *fasync; + struct snd_fasync *fasync; struct mutex ioctl_lock; }; =20 @@ -1345,7 +1345,7 @@ static void snd_timer_user_interrupt(struct snd_timer= _instance *timeri, } __wake: spin_unlock(&tu->qlock); - kill_fasync(&tu->fasync, SIGIO, POLL_IN); + snd_kill_fasync(tu->fasync, SIGIO, POLL_IN); wake_up(&tu->qchange_sleep); } =20 @@ -1383,7 +1383,7 @@ static void snd_timer_user_ccallback(struct snd_timer= _instance *timeri, spin_lock_irqsave(&tu->qlock, flags); snd_timer_user_append_to_tqueue(tu, &r1); spin_unlock_irqrestore(&tu->qlock, flags); - kill_fasync(&tu->fasync, SIGIO, POLL_IN); + snd_kill_fasync(tu->fasync, SIGIO, POLL_IN); wake_up(&tu->qchange_sleep); } =20 @@ -1453,7 +1453,7 @@ static void snd_timer_user_tinterrupt(struct snd_time= r_instance *timeri, spin_unlock(&tu->qlock); if (append =3D=3D 0) return; - kill_fasync(&tu->fasync, SIGIO, POLL_IN); + snd_kill_fasync(tu->fasync, SIGIO, POLL_IN); wake_up(&tu->qchange_sleep); } =20 @@ -1521,6 +1521,7 @@ static int snd_timer_user_release(struct inode *inode= , struct file *file) snd_timer_instance_free(tu->timeri); } mutex_unlock(&tu->ioctl_lock); + snd_fasync_free(tu->fasync); kfree(tu->queue); kfree(tu->tqueue); kfree(tu); @@ -2135,7 +2136,7 @@ static int snd_timer_user_fasync(int fd, struct file = * file, int on) struct snd_timer_user *tu; =20 tu =3D file->private_data; - return fasync_helper(fd, file, on, &tu->fasync); + return snd_fasync_helper(fd, file, on, &tu->fasync); } =20 static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3B50C32793 for ; Tue, 23 Aug 2022 09:26:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350108AbiHWJZ0 (ORCPT ); Tue, 23 Aug 2022 05:25:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346369AbiHWJYa (ORCPT ); Tue, 23 Aug 2022 05:24:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A53EF9019A; Tue, 23 Aug 2022 01:35:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0D5A6B81C1B; Tue, 23 Aug 2022 08:34:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 569D5C433D7; Tue, 23 Aug 2022 08:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243678; bh=BWjidRQ+edWUR4aH7drez7StIMEyzcJyA/RtL4QAKXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PaeCGs2OXk/8avndwVV/HgzjRsy1ZuS4sp3oWw8bQBBNjO847CQDfE1ExPGoYj5k0 GaGu25whOtxyL2q4VdnEjLUSskvrzoNcbnwcMl0N3HSSU797xQkqFtotgsP4QD7/Jt XldaoiSGob7OUIYGMdkOzlqC8JK0z9RDpcZ13ydg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+8285e973a41b5aa68902@syzkaller.appspotmail.com, syzbot+669c9abf11a6a011dd09@syzkaller.appspotmail.com, Takashi Iwai , Sasha Levin Subject: [PATCH 5.19 353/365] ALSA: pcm: Use deferred fasync helper Date: Tue, 23 Aug 2022 10:04:14 +0200 Message-Id: <20220823080133.039157499@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 96b097091c66df4f6fbf5cbff21df6cc02a2f055 ] For avoiding the potential deadlock via kill_fasync() call, use the new fasync helpers to defer the invocation from timer API. Note that it's merely a workaround. Reported-by: syzbot+8285e973a41b5aa68902@syzkaller.appspotmail.com Reported-by: syzbot+669c9abf11a6a011dd09@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/20220728125945.29533-4-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- include/sound/pcm.h | 2 +- sound/core/pcm.c | 1 + sound/core/pcm_lib.c | 2 +- sound/core/pcm_native.c | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 6b99310b5b88..6987110843f0 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -399,7 +399,7 @@ struct snd_pcm_runtime { snd_pcm_uframes_t twake; /* do transfer (!poll) wakeup if non-zero */ wait_queue_head_t sleep; /* poll sleep */ wait_queue_head_t tsleep; /* transfer sleep */ - struct fasync_struct *fasync; + struct snd_fasync *fasync; bool stop_operating; /* sync_stop will be called */ struct mutex buffer_mutex; /* protect for buffer changes */ atomic_t buffer_accessing; /* >0: in r/w operation, <0: blocked */ diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 977d54320a5c..c917ac84a7e5 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -1005,6 +1005,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substrea= m *substream) substream->runtime =3D NULL; } mutex_destroy(&runtime->buffer_mutex); + snd_fasync_free(runtime->fasync); kfree(runtime); put_pid(substream->pid); substream->pid =3D NULL; diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 1fc7c50ffa62..40751e5aff09 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1822,7 +1822,7 @@ void snd_pcm_period_elapsed_under_stream_lock(struct = snd_pcm_substream *substrea snd_timer_interrupt(substream->timer, 1); #endif _end: - kill_fasync(&runtime->fasync, SIGIO, POLL_IN); + snd_kill_fasync(runtime->fasync, SIGIO, POLL_IN); } EXPORT_SYMBOL(snd_pcm_period_elapsed_under_stream_lock); =20 diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 4adaee62ef33..16fcf57c6f03 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -3945,7 +3945,7 @@ static int snd_pcm_fasync(int fd, struct file * file,= int on) runtime =3D substream->runtime; if (runtime->status->state =3D=3D SNDRV_PCM_STATE_DISCONNECTED) return -EBADFD; - return fasync_helper(fd, file, on, &runtime->fasync); + return snd_fasync_helper(fd, file, on, &runtime->fasync); } =20 /* --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 873E3C32772 for ; Tue, 23 Aug 2022 09:24:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349679AbiHWJX6 (ORCPT ); Tue, 23 Aug 2022 05:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350382AbiHWJVo (ORCPT ); Tue, 23 Aug 2022 05:21:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7161C8C447; Tue, 23 Aug 2022 01:34:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 62292614E7; Tue, 23 Aug 2022 08:34:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 693F8C433C1; Tue, 23 Aug 2022 08:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243681; bh=X/ZLYxxDnih0e0paGcYJ4tSJ7KVpOyF0ATP2RLTK/q4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v6Q6TFrjHMPXMshqefjPLyV50Qj/doAKlFhsBcw+/Rz3OVDzw6P4YUfEoG6h499cy rDRozcjLSZGPmP8Iz71KXrCpuMjQGrCi0BsetXhqfnLYX5yHVYMKcSe0SVEUHX91oo 8Ovhb35YouvM7hD9vYI0n2hUbvtfOHV55RSpEl94= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.19 354/365] ALSA: control: Use deferred fasync helper Date: Tue, 23 Aug 2022 10:04:15 +0200 Message-Id: <20220823080133.088929037@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 4a971e84a7ae10a38d875cd2d4e487c8d1682ca3 ] For avoiding the potential deadlock via kill_fasync() call, use the new fasync helpers to defer the invocation from the control API. Note that it's merely a workaround. Another note: although we haven't received reports about the deadlock with the control API, the deadlock is still potentially possible, and it's better to align the behavior with other core APIs (PCM and timer); so let's move altogether. Link: https://lore.kernel.org/r/20220728125945.29533-5-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- include/sound/control.h | 2 +- sound/core/control.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/sound/control.h b/include/sound/control.h index 985c51a8fb74..a1fc7e0a47d9 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -109,7 +109,7 @@ struct snd_ctl_file { int preferred_subdevice[SND_CTL_SUBDEV_ITEMS]; wait_queue_head_t change_sleep; spinlock_t read_lock; - struct fasync_struct *fasync; + struct snd_fasync *fasync; int subscribed; /* read interface is activated */ struct list_head events; /* waiting events for read */ }; diff --git a/sound/core/control.c b/sound/core/control.c index a25c0d64d104..f66fe4be30d3 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -127,6 +127,7 @@ static int snd_ctl_release(struct inode *inode, struct = file *file) if (control->vd[idx].owner =3D=3D ctl) control->vd[idx].owner =3D NULL; up_write(&card->controls_rwsem); + snd_fasync_free(ctl->fasync); snd_ctl_empty_read_queue(ctl); put_pid(ctl->pid); kfree(ctl); @@ -181,7 +182,7 @@ void snd_ctl_notify(struct snd_card *card, unsigned int= mask, _found: wake_up(&ctl->change_sleep); spin_unlock(&ctl->read_lock); - kill_fasync(&ctl->fasync, SIGIO, POLL_IN); + snd_kill_fasync(ctl->fasync, SIGIO, POLL_IN); } read_unlock_irqrestore(&card->ctl_files_rwlock, flags); } @@ -2002,7 +2003,7 @@ static int snd_ctl_fasync(int fd, struct file * file,= int on) struct snd_ctl_file *ctl; =20 ctl =3D file->private_data; - return fasync_helper(fd, file, on, &ctl->fasync); + return snd_fasync_helper(fd, file, on, &ctl->fasync); } =20 /* return the preferred subdevice number if already assigned; @@ -2170,7 +2171,7 @@ static int snd_ctl_dev_disconnect(struct snd_device *= device) read_lock_irqsave(&card->ctl_files_rwlock, flags); list_for_each_entry(ctl, &card->ctl_files, list) { wake_up(&ctl->change_sleep); - kill_fasync(&ctl->fasync, SIGIO, POLL_ERR); + snd_kill_fasync(ctl->fasync, SIGIO, POLL_ERR); } read_unlock_irqrestore(&card->ctl_files_rwlock, flags); =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19AD3C32774 for ; Tue, 23 Aug 2022 09:28:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350080AbiHWJ1z (ORCPT ); Tue, 23 Aug 2022 05:27:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350014AbiHWJZD (ORCPT ); Tue, 23 Aug 2022 05:25:03 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92C0B760D2; Tue, 23 Aug 2022 01:36:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 332D5CE1B44; Tue, 23 Aug 2022 08:34:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26B4CC433C1; Tue, 23 Aug 2022 08:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243684; bh=Ubdo+zLeCBEUIp0Fs/1zOYCZvfQ0W+LWuOA/P/mTFU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qjdk537XAETYkReiURImRW1LWfq4Z8Dwjd4TyS4ezHWnaDBUScrF94kbz9Zx83tvm U6Gb8lmQjEs0fkDYTe0HqkMOP3ISwM2bocUAQkuYGYCd8/dZhIsVaNHemcJYsm7Efp 6zZYKTWUsbukLOaNDXTd+55xr3oJ0MFUz4aGnyqY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dipanjan Das , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.19 355/365] f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page() Date: Tue, 23 Aug 2022 10:04:16 +0200 Message-Id: <20220823080133.124438091@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Yu [ Upstream commit 141170b759e03958f296033bb7001be62d1d363b ] As Dipanjan Das reported, syzkaller found a f2fs bug as below: RIP: 0010:f2fs_new_node_page+0x19ac/0x1fc0 fs/f2fs/node.c:1295 Call Trace: write_all_xattrs fs/f2fs/xattr.c:487 [inline] __f2fs_setxattr+0xe76/0x2e10 fs/f2fs/xattr.c:743 f2fs_setxattr+0x233/0xab0 fs/f2fs/xattr.c:790 f2fs_xattr_generic_set+0x133/0x170 fs/f2fs/xattr.c:86 __vfs_setxattr+0x115/0x180 fs/xattr.c:182 __vfs_setxattr_noperm+0x125/0x5f0 fs/xattr.c:216 __vfs_setxattr_locked+0x1cf/0x260 fs/xattr.c:277 vfs_setxattr+0x13f/0x330 fs/xattr.c:303 setxattr+0x146/0x160 fs/xattr.c:611 path_setxattr+0x1a7/0x1d0 fs/xattr.c:630 __do_sys_lsetxattr fs/xattr.c:653 [inline] __se_sys_lsetxattr fs/xattr.c:649 [inline] __x64_sys_lsetxattr+0xbd/0x150 fs/xattr.c:649 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 NAT entry and nat bitmap can be inconsistent, e.g. one nid is free in nat bitmap, and blkaddr in its NAT entry is not NULL_ADDR, it may trigger BUG_ON() in f2fs_new_node_page(), fix it. Reported-by: Dipanjan Das Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/f2fs/node.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index cf6f7fc83c08..02e92a72511b 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1292,7 +1292,11 @@ struct page *f2fs_new_node_page(struct dnode_of_data= *dn, unsigned int ofs) dec_valid_node_count(sbi, dn->inode, !ofs); goto fail; } - f2fs_bug_on(sbi, new_ni.blk_addr !=3D NULL_ADDR); + if (unlikely(new_ni.blk_addr !=3D NULL_ADDR)) { + err =3D -EFSCORRUPTED; + set_sbi_flag(sbi, SBI_NEED_FSCK); + goto fail; + } #endif new_ni.nid =3D dn->nid; new_ni.ino =3D dn->inode->i_ino; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B42BC32774 for ; Tue, 23 Aug 2022 10:08:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352568AbiHWKIG (ORCPT ); Tue, 23 Aug 2022 06:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352434AbiHWKBy (ORCPT ); Tue, 23 Aug 2022 06:01:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D87163F25; Tue, 23 Aug 2022 01:49:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7C732B81C5F; Tue, 23 Aug 2022 08:34:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80EC7C433D6; Tue, 23 Aug 2022 08:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243688; bh=nIcfzrungjtKw7y6HO2FvmCrIPM7rRA9aRlAm5poON0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SNRn40+u9fx9QCdCNQEp5e+euBg4J3urz8M4GIsI0qmyxw3Qs6ZEueI3am0t4QG/T 88BsSyDgmRjpuCqj1Kp4XoY9LznOUZyaqpvfU6/CY1UF8+4rmtk2Cksdb59t847vf9 KuChM+FAJ/sleNJhL2F8BZQfE6ZxufnfqE23/nvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenqing Liu , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.19 356/365] f2fs: fix to do sanity check on segment type in build_sit_entries() Date: Tue, 23 Aug 2022 10:04:17 +0200 Message-Id: <20220823080133.179539706@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Yu [ Upstream commit 09beadf289d6e300553e60d6e76f13c0427ecab3 ] As Wenqing Liu reported in bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=3D216285 RIP: 0010:memcpy_erms+0x6/0x10 f2fs_update_meta_page+0x84/0x570 [f2fs] change_curseg.constprop.0+0x159/0xbd0 [f2fs] f2fs_do_replace_block+0x5c7/0x18a0 [f2fs] f2fs_replace_block+0xeb/0x180 [f2fs] recover_data+0x1abd/0x6f50 [f2fs] f2fs_recover_fsync_data+0x12ce/0x3250 [f2fs] f2fs_fill_super+0x4459/0x6190 [f2fs] mount_bdev+0x2cf/0x3b0 legacy_get_tree+0xed/0x1d0 vfs_get_tree+0x81/0x2b0 path_mount+0x47e/0x19d0 do_mount+0xce/0xf0 __x64_sys_mount+0x12c/0x1a0 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd The root cause is segment type is invalid, so in f2fs_do_replace_block(), f2fs accesses f2fs_sm_info::curseg_array with out-of-range segment type, result in accessing invalid curseg->sum_blk during memcpy in f2fs_update_meta_page(). Fix this by adding sanity check on segment type in build_sit_entries(). Reported-by: Wenqing Liu Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/f2fs/segment.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 874c1b9c41a2..ac890c9fa8a1 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -4362,6 +4362,12 @@ static int build_sit_entries(struct f2fs_sb_info *sb= i) return err; seg_info_from_raw_sit(se, &sit); =20 + if (se->type >=3D NR_PERSISTENT_LOG) { + f2fs_err(sbi, "Invalid segment type: %u, segno: %u", + se->type, start); + return -EFSCORRUPTED; + } + sit_valid_blocks[SE_PAGETYPE(se)] +=3D se->valid_blocks; =20 if (f2fs_block_unit_discard(sbi)) { @@ -4410,6 +4416,13 @@ static int build_sit_entries(struct f2fs_sb_info *sb= i) break; seg_info_from_raw_sit(se, &sit); =20 + if (se->type >=3D NR_PERSISTENT_LOG) { + f2fs_err(sbi, "Invalid segment type: %u, segno: %u", + se->type, start); + err =3D -EFSCORRUPTED; + break; + } + sit_valid_blocks[SE_PAGETYPE(se)] +=3D se->valid_blocks; =20 if (f2fs_block_unit_discard(sbi)) { --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB763C32772 for ; Tue, 23 Aug 2022 09:24:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349737AbiHWJYU (ORCPT ); Tue, 23 Aug 2022 05:24:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350647AbiHWJWD (ORCPT ); Tue, 23 Aug 2022 05:22:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 507188E0DA; Tue, 23 Aug 2022 01:34:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C3BF96151B; Tue, 23 Aug 2022 08:34:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC9DCC43470; Tue, 23 Aug 2022 08:34:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243691; bh=vtUXON8ZPY2JWNUwIGTSBD4cwQhMoCHe7RqNx/KHnSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0fWsxUXgqxFOtyW2KKTtIh6tkl05/3P0uetAe8FKZydVLR7ck8Lz06OY6h4126m3D unyhrBkLCCqAnFhQCRbz33tjBoH/BFbOLwK6VeF6Y8wg2H4cJjURabXZkksgfv/nvW hpcmvUzPg38vwzXnfEJ3Rv4hgddd1xQ27oxS5sg4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronnie Sahlberg , Steve French , Sasha Levin Subject: [PATCH 5.19 357/365] smb3: check xattr value length earlier Date: Tue, 23 Aug 2022 10:04:18 +0200 Message-Id: <20220823080133.225187338@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steve French [ Upstream commit 5fa2cffba0b82336a2244d941322eb1627ff787b ] Coverity complains about assigning a pointer based on value length before checking that value length goes beyond the end of the SMB. Although this is even more unlikely as value length is a single byte, and the pointer is not dereferenced until laterm, it is clearer to check the lengths first. Addresses-Coverity: 1467704 ("Speculative execution data leak") Reviewed-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/cifs/smb2ops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 8802995b2d3d..aa4c1d403708 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -1145,9 +1145,7 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, size_t name_len, value_len, user_name_len; =20 while (src_size > 0) { - name =3D &src->ea_data[0]; name_len =3D (size_t)src->ea_name_length; - value =3D &src->ea_data[src->ea_name_length + 1]; value_len =3D (size_t)le16_to_cpu(src->ea_value_length); =20 if (name_len =3D=3D 0) @@ -1159,6 +1157,9 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, goto out; } =20 + name =3D &src->ea_data[0]; + value =3D &src->ea_data[src->ea_name_length + 1]; + if (ea_name) { if (ea_name_len =3D=3D name_len && memcmp(ea_name, name, name_len) =3D=3D 0) { --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46F82C32772 for ; Tue, 23 Aug 2022 09:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350119AbiHWJ2R (ORCPT ); Tue, 23 Aug 2022 05:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350164AbiHWJZc (ORCPT ); Tue, 23 Aug 2022 05:25:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BF79760FD; Tue, 23 Aug 2022 01:36:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8CE92614E9; Tue, 23 Aug 2022 08:34:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9982AC433D6; Tue, 23 Aug 2022 08:34:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243694; bh=Ufu0YQ4jl5NNJVHMzR49EucjoyZ1trfx8HRK1GTs8OQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qtXew0TxwvOwjFkcgn3HVlF2LuMEolrO4vOtMr1s6ssC0GJeQI352YWB48eyBdJfL CaOPIZXheP2t2AmndHtHmieZ2EMpaiU/VkzGtAUxIY2+b6NFuG0jI3yp5EmDH6xP60 O7KjUDnlL9W+A75AAhn1UG7gdQPbd/PdztyzzuQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Zhouyi Zhou , Sasha Levin Subject: [PATCH 5.19 358/365] powerpc/64: Init jump labels before parse_early_param() Date: Tue, 23 Aug 2022 10:04:19 +0200 Message-Id: <20220823080133.266935825@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhouyi Zhou [ Upstream commit ca829e05d3d4f728810cc5e4b468d9ebc7745eb3 ] On 64-bit, calling jump_label_init() in setup_feature_keys() is too late because static keys may be used in subroutines of parse_early_param() which is again subroutine of early_init_devtree(). For example booting with "threadirqs": static_key_enable_cpuslocked(): static key '0xc000000002953260' used befo= re call to jump_label_init() WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:166 static_key_enable_cpusl= ocked+0xfc/0x120 ... NIP static_key_enable_cpuslocked+0xfc/0x120 LR static_key_enable_cpuslocked+0xf8/0x120 Call Trace: static_key_enable_cpuslocked+0xf8/0x120 (unreliable) static_key_enable+0x30/0x50 setup_forced_irqthreads+0x28/0x40 do_early_param+0xa0/0x108 parse_args+0x290/0x4e0 parse_early_options+0x48/0x5c parse_early_param+0x58/0x84 early_init_devtree+0xd4/0x518 early_setup+0xb4/0x214 So call jump_label_init() just before parse_early_param() in early_init_devtree(). Suggested-by: Michael Ellerman Signed-off-by: Zhouyi Zhou [mpe: Add call trace to change log and minor wording edits.] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220726015747.11754-1-zhouzhouyi@gmail.com Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/powerpc/kernel/prom.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index feae8509b59c..b64c3f06c069 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -751,6 +751,13 @@ void __init early_init_devtree(void *params) early_init_dt_scan_root(); early_init_dt_scan_memory_ppc(); =20 + /* + * As generic code authors expect to be able to use static keys + * in early_param() handlers, we initialize the static keys just + * before parsing early params (it's fine to call jump_label_init() + * more than once). + */ + jump_label_init(); parse_early_param(); =20 /* make sure we've parsed cmdline for mem=3D before this */ --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB68DC32772 for ; Tue, 23 Aug 2022 09:24:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349762AbiHWJYZ (ORCPT ); Tue, 23 Aug 2022 05:24:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350629AbiHWJWD (ORCPT ); Tue, 23 Aug 2022 05:22:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 202B48C022; Tue, 23 Aug 2022 01:35:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C815F6152F; Tue, 23 Aug 2022 08:35:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D39E0C433D6; Tue, 23 Aug 2022 08:34:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243700; bh=jCB3yocuDnO1L80aYS568njTv1ha44rBP6GelQkIIuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ljkSHHelEyelphLnIEaBGwgajwbHkeFhipJZKuP9QenOaimKUcXVvx2n8j5CCXKrC tdf9lhS6g0tuDVImvMvw6rl+HoftubsBPp6Moqo0FK4C74lBJvx5hya2othC0KtNTv M0HA9VRk7jZwu1lJlwmPDbn7PS8YwBzpoUgbDblU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linux Kernel Functional Testing , Viresh Kumar , Stanimir Varbanov , Sasha Levin Subject: [PATCH 5.19 359/365] venus: pm_helpers: Fix warning in OPP during probe Date: Tue, 23 Aug 2022 10:04:20 +0200 Message-Id: <20220823080133.306742153@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stanimir Varbanov [ Upstream commit 1d95af02f23031c2e1cca7607c514b86ce85bc6e ] Fix the following WARN triggered during Venus driver probe on 5.19.0-rc8-next-20220728: WARNING: CPU: 7 PID: 339 at drivers/opp/core.c:2471 dev_pm_opp_set_config+= 0x49c/0x610 Modules linked in: qcom_spmi_adc5 rtc_pm8xxx qcom_spmi_adc_tm5 leds_qcom_l= pg led_class_multicolor qcom_pon qcom_vadc_common venus_core(+) qcom_spmi_temp_alarm v4l2_mem2mem= videobuf2_v4l2 msm(+) videobuf2_common crct10dif_ce spi_geni_qcom snd_soc_sm8250 i2c_qcom_geni = gpu_sched snd_soc_qcom_common videodev qcom_q6v5_pas soundwire_qcom drm_dp_aux_bus = qcom_stats drm_display_helper qcom_pil_info soundwire_bus snd_soc_lpass_va_macro mc = qcom_q6v5 phy_qcom_snps_femto_v2 qcom_rng snd_soc_lpass_macro_common snd_soc_lpass_= wsa_macro lpass_gfm_sm8250 slimbus qcom_sysmon qcom_common qcom_glink_smem qmi_help= ers qcom_wdt mdt_loader socinfo icc_osm_l3 display_connector drm_kms_helper qnoc_sm8250 drm fuse ip_tables x_tables ipv6 CPU: 7 PID: 339 Comm: systemd-udevd Not tainted 5.19.0-rc8-next-20220728 #4 Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : dev_pm_opp_set_config+0x49c/0x610 lr : dev_pm_opp_set_config+0x58/0x610 sp : ffff8000093c3710 x29: ffff8000093c3710 x28: ffffbca3959d82b8 x27: ffff8000093c3d00 x26: ffffbca3959d8e08 x25: ffff4396cac98118 x24: ffff4396c0e24810 x23: ffff4396c4272c40 x22: ffff4396c0e24810 x21: ffff8000093c3810 x20: ffff4396cac36800 x19: ffff4396cac96800 x18: 0000000000000000 x17: 0000000000000003 x16: ffffbca3f4edf198 x15: 0000001cba64a858 x14: 0000000000000180 x13: 000000000000017e x12: 0000000000000000 x11: 0000000000000002 x10: 0000000000000a60 x9 : ffff8000093c35c0 x8 : ffff4396c4273700 x7 : ffff43983efca6c0 x6 : ffff43983efca640 x5 : 00000000410fd0d0 x4 : ffff4396c4272c40 x3 : ffffbca3f5d1e008 x2 : 0000000000000000 x1 : ffff4396c2421600 x0 : ffff4396cac96860 Call trace: dev_pm_opp_set_config+0x49c/0x610 devm_pm_opp_set_config+0x18/0x70 vcodec_domains_get+0xb8/0x1638 [venus_core] core_get_v4+0x1d8/0x218 [venus_core] venus_probe+0xf4/0x468 [venus_core] platform_probe+0x68/0xd8 really_probe+0xbc/0x2a8 __driver_probe_device+0x78/0xe0 driver_probe_device+0x3c/0xf0 __driver_attach+0x70/0x120 bus_for_each_dev+0x70/0xc0 driver_attach+0x24/0x30 bus_add_driver+0x150/0x200 driver_register+0x64/0x120 __platform_driver_register+0x28/0x38 qcom_venus_driver_init+0x24/0x1000 [venus_core] do_one_initcall+0x54/0x1c8 do_init_module+0x44/0x1d0 load_module+0x16c8/0x1aa0 __do_sys_finit_module+0xbc/0x110 __arm64_sys_finit_module+0x20/0x30 invoke_syscall+0x44/0x108 el0_svc_common.constprop.0+0xcc/0xf0 do_el0_svc+0x2c/0xb8 el0_svc+0x2c/0x88 el0t_64_sync_handler+0xb8/0xc0 el0t_64_sync+0x18c/0x190 qcom-venus: probe of aa00000.video-codec failed with error -16 The fix is re-ordering the code related to OPP core. The OPP core expects all configuration options to be provided before the OPP table is added. Reported-by: Linux Kernel Functional Testing Suggested-by: Viresh Kumar Signed-off-by: Stanimir Varbanov Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/media/platform/qcom/venus/pm_helpers.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media= /platform/qcom/venus/pm_helpers.c index cb48c5ff3dee..c93d2906e4c7 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -875,7 +875,7 @@ static int vcodec_domains_get(struct venus_core *core) } =20 skip_pmdomains: - if (!core->has_opp_table) + if (!core->res->opp_pmdomain) return 0; =20 /* Attach the power domain for setting performance state */ @@ -1007,6 +1007,10 @@ static int core_get_v4(struct venus_core *core) if (ret) return ret; =20 + ret =3D vcodec_domains_get(core); + if (ret) + return ret; + if (core->res->opp_pmdomain) { ret =3D devm_pm_opp_of_add_table(dev); if (!ret) { @@ -1017,10 +1021,6 @@ static int core_get_v4(struct venus_core *core) } } =20 - ret =3D vcodec_domains_get(core); - if (ret) - return ret; - return 0; } =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A829CC32772 for ; Tue, 23 Aug 2022 09:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350163AbiHWJ2l (ORCPT ); Tue, 23 Aug 2022 05:28:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350382AbiHWJZo (ORCPT ); Tue, 23 Aug 2022 05:25:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0CD47645F; Tue, 23 Aug 2022 01:36:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 97164B81BF8; Tue, 23 Aug 2022 08:35:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC50EC433C1; Tue, 23 Aug 2022 08:35:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243703; bh=FBzSE+qqafdeYuAtXm87bCElk3pUGrsMH2kRGcVhxpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RYDINjpKRd+NgoLU2tPGdwhsqigk1LPeR4ZKON94gkDJTV6OERIrehJN5EAR7vu6H S/b6NSCayMrtD0mfSyRwFk/twhoXd8Rv56ImyVEoTPqvl5nODvKJCm2KBjHdpKB4S0 Uz8M4uLMExdKvXn11Wjb3H5fOj0oSNRk47GYD+kM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Helge Deller , Sasha Levin Subject: [PATCH 5.19 360/365] video: fbdev: i740fb: Check the argument of i740_calc_vclk() Date: Tue, 23 Aug 2022 10:04:21 +0200 Message-Id: <20220823080133.360219688@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma [ Upstream commit 40bf722f8064f50200b8c4f8946cd625b441dda9 ] Since the user can control the arguments of the ioctl() from the user space, under special arguments that may result in a divide-by-zero bug. If the user provides an improper 'pixclock' value that makes the argumet of i740_calc_vclk() less than 'I740_RFREQ_FIX', it will cause a divide-by-zero bug in: drivers/video/fbdev/i740fb.c:353 p_best =3D min(15, ilog2(I740_MAX_VCO_= FREQ / (freq / I740_RFREQ_FIX))); The following log can reveal it: divide error: 0000 [#1] PREEMPT SMP KASAN PTI RIP: 0010:i740_calc_vclk drivers/video/fbdev/i740fb.c:353 [inline] RIP: 0010:i740fb_decode_var drivers/video/fbdev/i740fb.c:646 [inline] RIP: 0010:i740fb_set_par+0x163f/0x3b70 drivers/video/fbdev/i740fb.c:742 Call Trace: fb_set_var+0x604/0xeb0 drivers/video/fbdev/core/fbmem.c:1034 do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1110 fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1189 Fix this by checking the argument of i740_calc_vclk() first. Signed-off-by: Zheyu Ma Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/video/fbdev/i740fb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/i740fb.c b/drivers/video/fbdev/i740fb.c index 09dd85553d4f..7f09a0daaaa2 100644 --- a/drivers/video/fbdev/i740fb.c +++ b/drivers/video/fbdev/i740fb.c @@ -400,7 +400,7 @@ static int i740fb_decode_var(const struct fb_var_screen= info *var, u32 xres, right, hslen, left, xtotal; u32 yres, lower, vslen, upper, ytotal; u32 vxres, xoffset, vyres, yoffset; - u32 bpp, base, dacspeed24, mem; + u32 bpp, base, dacspeed24, mem, freq; u8 r7; int i; =20 @@ -643,7 +643,12 @@ static int i740fb_decode_var(const struct fb_var_scree= ninfo *var, par->atc[VGA_ATC_OVERSCAN] =3D 0; =20 /* Calculate VCLK that most closely matches the requested dot clock */ - i740_calc_vclk((((u32)1e9) / var->pixclock) * (u32)(1e3), par); + freq =3D (((u32)1e9) / var->pixclock) * (u32)(1e3); + if (freq < I740_RFREQ_FIX) { + fb_dbg(info, "invalid pixclock\n"); + freq =3D I740_RFREQ_FIX; + } + i740_calc_vclk(freq, par); =20 /* Since we program the clocks ourselves, always use VCLK2. */ par->misc |=3D 0x0C; --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4BDFC32772 for ; Tue, 23 Aug 2022 09:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242309AbiHWJyi (ORCPT ); Tue, 23 Aug 2022 05:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352290AbiHWJv3 (ORCPT ); Tue, 23 Aug 2022 05:51:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B57627B2A2; Tue, 23 Aug 2022 01:45:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 67387B81C5B; Tue, 23 Aug 2022 08:35:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C64D0C433C1; Tue, 23 Aug 2022 08:35:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243706; bh=pVh0kY2dRG6Xb0FG85icTj2NW55fBngQJ94RJpxzoGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bx+k0r/u0NXhsAjRaUXadsl3Ng0JaG9Qj6gv7lArn7Xojpfdhh0/H9BcFGVNGIsdZ HRWgFixBGRMJgABIWI61wksRcaCpZ9cQQETXrSPC74YkNaMfiPMIAQEL/n/vR87wV3 +dQQ0jHYTKW8KTQ/YAEqYJm5VOhH9urARgPbnJMg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Sudip Mukherjee (Codethink)" , Nathan Chancellor , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.19 361/365] MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0 Date: Tue, 23 Aug 2022 10:04:22 +0200 Message-Id: <20220823080133.394797517@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nathan Chancellor [ Upstream commit 74de14fe05dd6b151d73cb0c73c8ec874cbdcde6 ] When CONFIG_XPA is enabled, Clang warns: arch/mips/mm/tlbex.c:629:24: error: converting the result of '<<' to a bo= olean; did you mean '(1 << _PAGE_NO_EXEC_SHIFT) !=3D 0'? [-Werror,-Wint-in-= bool-context] if (cpu_has_rixi && !!_PAGE_NO_EXEC) { ^ arch/mips/include/asm/pgtable-bits.h:174:28: note: expanded from macro '_= PAGE_NO_EXEC' # define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT) ^ arch/mips/mm/tlbex.c:2568:24: error: converting the result of '<<' to a b= oolean; did you mean '(1 << _PAGE_NO_EXEC_SHIFT) !=3D 0'? [-Werror,-Wint-in= -bool-context] if (!cpu_has_rixi || !_PAGE_NO_EXEC) { ^ arch/mips/include/asm/pgtable-bits.h:174:28: note: expanded from macro '_= PAGE_NO_EXEC' # define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT) ^ 2 errors generated. _PAGE_NO_EXEC can be '0' or '1 << _PAGE_NO_EXEC_SHIFT' depending on the build and runtime configuration, which is what the negation operators are trying to convey. To silence the warning, explicitly compare against 0 so the result of the '<<' operator is not implicitly converted to a boolean. According to its documentation, GCC enables -Wint-in-bool-context with -Wall but this warning is not visible when building the same configuration with GCC. It appears GCC only warns when compiling C++, not C, although the documentation makes no note of this: https://godbolt.org/z/x39q3brxf Reported-by: Sudip Mukherjee (Codethink) Signed-off-by: Nathan Chancellor Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- arch/mips/mm/tlbex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 8dbbd99fc7e8..be4d4670d649 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c @@ -626,7 +626,7 @@ static __maybe_unused void build_convert_pte_to_entrylo= (u32 **p, return; } =20 - if (cpu_has_rixi && !!_PAGE_NO_EXEC) { + if (cpu_has_rixi && _PAGE_NO_EXEC !=3D 0) { if (fill_includes_sw_bits) { UASM_i_ROTR(p, reg, reg, ilog2(_PAGE_GLOBAL)); } else { @@ -2565,7 +2565,7 @@ static void check_pabits(void) unsigned long entry; unsigned pabits, fillbits; =20 - if (!cpu_has_rixi || !_PAGE_NO_EXEC) { + if (!cpu_has_rixi || _PAGE_NO_EXEC =3D=3D 0) { /* * We'll only be making use of the fact that we can rotate bits * into the fill if the CPU supports RIXI, so don't bother --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65373C32772 for ; Tue, 23 Aug 2022 09:40:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243821AbiHWJkQ (ORCPT ); Tue, 23 Aug 2022 05:40:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243334AbiHWJjV (ORCPT ); Tue, 23 Aug 2022 05:39:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78A837859E; Tue, 23 Aug 2022 01:41:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BB2AB61499; Tue, 23 Aug 2022 08:35:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1EE3C433D6; Tue, 23 Aug 2022 08:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243709; bh=qwM3ShvFVEwOhnb4lNkJcm+UOiGSvKD2PWo6NN8Oelg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X9AE7zOFs+IX5JWJ3dn55yWwWX4Fzh0E+LUkEfXD39DN/6TncGfWmykWjfmIOm/Ct mVDxsn0eCnveapeHwohKdGHekSNKX4+oNidEHYqbQgOUO85Rldx35+ryBvPr1hBahc RvUyoPG8XnSTSXdhfeKm4OEoAdp2rkoGXRFIg3So= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daeho Jeong , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.19 362/365] f2fs: revive F2FS_IOC_ABORT_VOLATILE_WRITE Date: Tue, 23 Aug 2022 10:04:23 +0200 Message-Id: <20220823080133.443422112@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daeho Jeong [ Upstream commit 23339e5752d01a4b5e122759b002cf896d26f6c1 ] F2FS_IOC_ABORT_VOLATILE_WRITE was used to abort a atomic write before. However it was removed accidentally. So revive it by changing the name, since volatile write had gone. Signed-off-by: Daeho Jeong Fiexes: 7bc155fec5b3("f2fs: kill volatile write support") Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/f2fs/file.c | 30 ++++++++++++++++++++++++++++-- include/uapi/linux/f2fs.h | 2 +- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index fc0f30738b21..41547604f192 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2108,6 +2108,31 @@ static int f2fs_ioc_commit_atomic_write(struct file = *filp) return ret; } =20 +static int f2fs_ioc_abort_atomic_write(struct file *filp) +{ + struct inode *inode =3D file_inode(filp); + struct user_namespace *mnt_userns =3D file_mnt_user_ns(filp); + int ret; + + if (!inode_owner_or_capable(mnt_userns, inode)) + return -EACCES; + + ret =3D mnt_want_write_file(filp); + if (ret) + return ret; + + inode_lock(inode); + + if (f2fs_is_atomic_file(inode)) + f2fs_abort_atomic_write(inode, true); + + inode_unlock(inode); + + mnt_drop_write_file(filp); + f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); + return ret; +} + static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) { struct inode *inode =3D file_inode(filp); @@ -4063,9 +4088,10 @@ static long __f2fs_ioctl(struct file *filp, unsigned= int cmd, unsigned long arg) return f2fs_ioc_start_atomic_write(filp); case F2FS_IOC_COMMIT_ATOMIC_WRITE: return f2fs_ioc_commit_atomic_write(filp); + case F2FS_IOC_ABORT_ATOMIC_WRITE: + return f2fs_ioc_abort_atomic_write(filp); case F2FS_IOC_START_VOLATILE_WRITE: case F2FS_IOC_RELEASE_VOLATILE_WRITE: - case F2FS_IOC_ABORT_VOLATILE_WRITE: return -EOPNOTSUPP; case F2FS_IOC_SHUTDOWN: return f2fs_ioc_shutdown(filp, arg); @@ -4734,7 +4760,7 @@ long f2fs_compat_ioctl(struct file *file, unsigned in= t cmd, unsigned long arg) case F2FS_IOC_COMMIT_ATOMIC_WRITE: case F2FS_IOC_START_VOLATILE_WRITE: case F2FS_IOC_RELEASE_VOLATILE_WRITE: - case F2FS_IOC_ABORT_VOLATILE_WRITE: + case F2FS_IOC_ABORT_ATOMIC_WRITE: case F2FS_IOC_SHUTDOWN: case FITRIM: case FS_IOC_SET_ENCRYPTION_POLICY: diff --git a/include/uapi/linux/f2fs.h b/include/uapi/linux/f2fs.h index 352a822d4370..3121d127d5aa 100644 --- a/include/uapi/linux/f2fs.h +++ b/include/uapi/linux/f2fs.h @@ -13,7 +13,7 @@ #define F2FS_IOC_COMMIT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 2) #define F2FS_IOC_START_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 3) #define F2FS_IOC_RELEASE_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 4) -#define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5) +#define F2FS_IOC_ABORT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 5) #define F2FS_IOC_GARBAGE_COLLECT _IOW(F2FS_IOCTL_MAGIC, 6, __u32) #define F2FS_IOC_WRITE_CHECKPOINT _IO(F2FS_IOCTL_MAGIC, 7) #define F2FS_IOC_DEFRAGMENT _IOWR(F2FS_IOCTL_MAGIC, 8, \ --=20 2.35.1 From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B225FC3F6B0 for ; Tue, 23 Aug 2022 09:27:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346369AbiHWJ0w (ORCPT ); Tue, 23 Aug 2022 05:26:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348812AbiHWJXR (ORCPT ); Tue, 23 Aug 2022 05:23:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E18C48F954; Tue, 23 Aug 2022 01:35:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 69562B8105C; Tue, 23 Aug 2022 08:35:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8002C433D6; Tue, 23 Aug 2022 08:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243739; bh=VNBLwqQwMaxRtdYunQRItVfVIZ3NgdC7IdwywpT5kvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e4MX2CwDKHzbLbrlJ8XCvgCvom/wP+m0W4i3Kg4M77BkI0YZNX8Tru6VsE5R89ghA iEawymA3PuTVdy4neaM8fKuUH33CNmcwN/4vdRFq3px8m7I82gGqzk9OdgVSa9NDuZ 0eheI+dvHNZLcrZ1Px+tGUPJvLBAQ8BlUI0DYuNQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Bin , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.19 363/365] f2fs: fix null-ptr-deref in f2fs_get_dnode_of_data Date: Tue, 23 Aug 2022 10:04:24 +0200 Message-Id: <20220823080133.493253720@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ye Bin [ Upstream commit 4a2c5b7994960fac29cf8a3f4e62855bae1b27d4 ] There is issue as follows when test f2fs atomic write: F2FS-fs (loop0): Can't find valid F2FS filesystem in 2th superblock F2FS-fs (loop0): invalid crc_offset: 0 F2FS-fs (loop0): f2fs_check_nid_range: out-of-range nid=3D1, run fsck to fi= x. F2FS-fs (loop0): f2fs_check_nid_range: out-of-range nid=3D2, run fsck to fi= x. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BUG: KASAN: null-ptr-deref in f2fs_get_dnode_of_data+0xac/0x16d0 Read of size 8 at addr 0000000000000028 by task rep/1990 CPU: 4 PID: 1990 Comm: rep Not tainted 5.19.0-rc6-next-20220715 #266 Call Trace: dump_stack_lvl+0x6e/0x91 print_report.cold+0x49a/0x6bb kasan_report+0xa8/0x130 f2fs_get_dnode_of_data+0xac/0x16d0 f2fs_do_write_data_page+0x2a5/0x1030 move_data_page+0x3c5/0xdf0 do_garbage_collect+0x2015/0x36c0 f2fs_gc+0x554/0x1d30 f2fs_balance_fs+0x7f5/0xda0 f2fs_write_single_data_page+0xb66/0xdc0 f2fs_write_cache_pages+0x716/0x1420 f2fs_write_data_pages+0x84f/0x9a0 do_writepages+0x130/0x3a0 filemap_fdatawrite_wbc+0x87/0xa0 file_write_and_wait_range+0x157/0x1c0 f2fs_do_sync_file+0x206/0x12d0 f2fs_sync_file+0x99/0xc0 vfs_fsync_range+0x75/0x140 f2fs_file_write_iter+0xd7b/0x1850 vfs_write+0x645/0x780 ksys_write+0xf1/0x1e0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd As 3db1de0e582c commit changed atomic write way which new a cow_inode for atomic write file, and also mark cow_inode as FI_ATOMIC_FILE. When f2fs_do_write_data_page write cow_inode will use cow_inode's cow_inode which is NULL. Then will trigger null-ptr-deref. To solve above issue, introduce FI_COW_FILE flag for COW inode. Fiexes: 3db1de0e582c("f2fs: change the current atomic write way") Signed-off-by: Ye Bin Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- fs/f2fs/f2fs.h | 6 ++++++ fs/f2fs/file.c | 2 +- fs/f2fs/segment.c | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -757,6 +757,7 @@ enum { FI_ENABLE_COMPRESS, /* enable compression in "user" compression mode */ FI_COMPRESS_RELEASED, /* compressed blocks were released */ FI_ALIGNED_WRITE, /* enable aligned write */ + FI_COW_FILE, /* indicate COW file */ FI_MAX, /* max flag, never be used */ }; =20 @@ -3208,6 +3209,11 @@ static inline bool f2fs_is_atomic_file(s return is_inode_flag_set(inode, FI_ATOMIC_FILE); } =20 +static inline bool f2fs_is_cow_file(struct inode *inode) +{ + return is_inode_flag_set(inode, FI_COW_FILE); +} + static inline bool f2fs_is_first_block_written(struct inode *inode) { return is_inode_flag_set(inode, FI_FIRST_BLOCK_WRITTEN); --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2061,7 +2061,7 @@ static int f2fs_ioc_start_atomic_write(s spin_unlock(&sbi->inode_lock[ATOMIC_FILE]); =20 set_inode_flag(inode, FI_ATOMIC_FILE); - set_inode_flag(fi->cow_inode, FI_ATOMIC_FILE); + set_inode_flag(fi->cow_inode, FI_COW_FILE); clear_inode_flag(fi->cow_inode, FI_INLINE_DATA); f2fs_up_write(&fi->i_gc_rwsem[WRITE]); =20 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -193,7 +193,7 @@ void f2fs_abort_atomic_write(struct inod if (f2fs_is_atomic_file(inode)) { if (clean) truncate_inode_pages_final(inode->i_mapping); - clear_inode_flag(fi->cow_inode, FI_ATOMIC_FILE); + clear_inode_flag(fi->cow_inode, FI_COW_FILE); iput(fi->cow_inode); fi->cow_inode =3D NULL; clear_inode_flag(inode, FI_ATOMIC_FILE); @@ -3166,7 +3166,7 @@ static int __get_segment_type_6(struct f return CURSEG_COLD_DATA; if (file_is_hot(inode) || is_inode_flag_set(inode, FI_HOT_DATA) || - f2fs_is_atomic_file(inode)) + f2fs_is_cow_file(inode)) return CURSEG_HOT_DATA; return f2fs_rw_hint_to_seg_type(inode->i_write_hint); } else { From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2280C32772 for ; Tue, 23 Aug 2022 09:25:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350052AbiHWJZF (ORCPT ); Tue, 23 Aug 2022 05:25:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349494AbiHWJWu (ORCPT ); Tue, 23 Aug 2022 05:22:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E8318F944; Tue, 23 Aug 2022 01:35:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BFF6761475; Tue, 23 Aug 2022 08:35:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBACBC433D7; Tue, 23 Aug 2022 08:35:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243733; bh=Z6tw5p3I/8qPJhg9+be/JmAilsolo8TLCG5ED0j4UIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t/JrvDdHy/jPK5GoEXk+UnVn1Qvzb799BM8J7kIwZ6nbLooNpK2a+zEWdaaFuLTMx yo1g5FEfFa7D+hre/8SwBv95PqfZZTaPv9IpukZ2qniXhbE3R3jMAh4zWyWfNdWZLA yWKOEQdoB1kTF6ivDFp/26gSrnOIp318YsZyxoWU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Stanley Chu , Ren Zhijie , "Martin K. Petersen" Subject: [PATCH 5.19 364/365] scsi: ufs: ufs-mediatek: Fix build error and type mismatch Date: Tue, 23 Aug 2022 10:04:25 +0200 Message-Id: <20220823080133.542900028@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ren Zhijie commit f54912b228a8df6c0133e31bc75628677bb8c6e5 upstream. If CONFIG_PM_SLEEP is not set. make ARCH=3Darm64 CROSS_COMPILE=3Daarch64-linux-gnu-, will fail: drivers/ufs/host/ufs-mediatek.c: In function =E2=80=98ufs_mtk_vreg_fix_vcc= =E2=80=99: drivers/ufs/host/ufs-mediatek.c:688:46: warning: format =E2=80=98%u=E2=80= =99 expects argument of type =E2=80=98unsigned int=E2=80=99, but argument 4= has type =E2=80=98long unsigned int=E2=80=99 [-Wformat=3D] snprintf(vcc_name, MAX_VCC_NAME, "vcc-opt%u", res.a1); ~^ ~~~~~~ %lu drivers/ufs/host/ufs-mediatek.c: In function =E2=80=98ufs_mtk_system_suspen= d=E2=80=99: drivers/ufs/host/ufs-mediatek.c:1371:8: error: implicit declaration of func= tion =E2=80=98ufshcd_system_suspend=E2=80=99; did you mean =E2=80=98ufs_mtk= _system_suspend=E2=80=99? [-Werror=3Dimplicit-function-declaration] ret =3D ufshcd_system_suspend(dev); ^~~~~~~~~~~~~~~~~~~~~ ufs_mtk_system_suspend drivers/ufs/host/ufs-mediatek.c: In function =E2=80=98ufs_mtk_system_resume= =E2=80=99: drivers/ufs/host/ufs-mediatek.c:1386:9: error: implicit declaration of func= tion =E2=80=98ufshcd_system_resume=E2=80=99; did you mean =E2=80=98ufs_mtk_= system_resume=E2=80=99? [-Werror=3Dimplicit-function-declaration] return ufshcd_system_resume(dev); ^~~~~~~~~~~~~~~~~~~~ ufs_mtk_system_resume cc1: some warnings being treated as errors The declaration of func "ufshcd_system_suspend()" depends on CONFIG_PM_SLEEP, so the function wrapper ufs_mtk_system_suspend() should wrapped by CONFIG_PM_SLEEP too. Link: https://lore.kernel.org/r/20220619115432.205504-1-renzhijie2@huawei.c= om Fixes: 3fd23b8dfb54 ("scsi: ufs: ufs-mediatek: Fix the timing of configurin= g device regulators") Reported-by: Hulk Robot Reviewed-by: Stanley Chu Signed-off-by: Ren Zhijie Signed-off-by: Martin K. Petersen [only take the suspend/resume portion of the commit - gregkh] Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- drivers/ufs/host/ufs-mediatek.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -1220,6 +1220,7 @@ static int ufs_mtk_remove(struct platfor return 0; } =20 +#ifdef CONFIG_PM_SLEEP int ufs_mtk_system_suspend(struct device *dev) { struct ufs_hba *hba =3D dev_get_drvdata(dev); @@ -1242,6 +1243,7 @@ int ufs_mtk_system_resume(struct device =20 return ufshcd_system_resume(dev); } +#endif =20 int ufs_mtk_runtime_suspend(struct device *dev) { From nobody Thu Dec 18 12:44:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16480C49EC0 for ; Tue, 23 Aug 2022 09:27:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240024AbiHWJ1F (ORCPT ); Tue, 23 Aug 2022 05:27:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349420AbiHWJX5 (ORCPT ); Tue, 23 Aug 2022 05:23:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C7A8FD69; Tue, 23 Aug 2022 01:35:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6004FB81C5A; Tue, 23 Aug 2022 08:35:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF6A3C433C1; Tue, 23 Aug 2022 08:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243736; bh=b1NcyPeOU0MnkxOjOob0ZNsoHSNkdbDkrTUKTqRcK7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AWM10ixog4v1kPye/sTjgc/xU0uwEaqz/wZgqgId6gABQkRMTLpdAK8Ssut1TZRlo 86DJTHBemhwlqhh6TamEbxTbB/SnQVZlfS+q0ZCrx028y9idO/wWo27tJ4nxp6f5x/ c0r8lGcts+eDnx2NYNwHMyass251Romq8otstCww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.19 365/365] Revert "ALSA: hda: Fix page fault in snd_hda_codec_shutdown()" Date: Tue, 23 Aug 2022 10:04:26 +0200 Message-Id: <20220823080133.591066874@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai commit 53f07e9b010b966017e32be1ca1bbcbcc4cee73d upstream. This reverts commit 980b3a8790b402e959a6d773b38b771019682be1. The commit didn't consider the fact that ASoC hdac-hda driver initializes the HD-audio stuff without calling snd_hda_codec_device_init(). Hence this caused a regression leading to Oops. Revert the commit to restore the behavior. Fixes: 980b3a8790b4 ("ALSA: hda: Fix page fault in snd_hda_codec_shutdown()= ") Link: https://lore.kernel.org/r/3c40df55-3aee-1e08-493b-7b30cd84dc00@linux.= intel.com Link: https://lore.kernel.org/r/20220715182903.19594-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Justin M. Forbes Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan --- sound/pci/hda/hda_codec.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -931,28 +931,8 @@ snd_hda_codec_device_init(struct hda_bus } =20 codec->bus =3D bus; - codec->depop_delay =3D -1; - codec->fixup_id =3D HDA_FIXUP_ID_NOT_SET; - codec->core.dev.release =3D snd_hda_codec_dev_release; - codec->core.exec_verb =3D codec_exec_verb; codec->core.type =3D HDA_DEV_LEGACY; =20 - mutex_init(&codec->spdif_mutex); - mutex_init(&codec->control_mutex); - snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 32); - snd_array_init(&codec->nids, sizeof(struct hda_nid_item), 32); - snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); - snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); - snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8); - snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16); - snd_array_init(&codec->jacktbl, sizeof(struct hda_jack_tbl), 16); - snd_array_init(&codec->verbs, sizeof(struct hda_verb *), 8); - INIT_LIST_HEAD(&codec->conn_list); - INIT_LIST_HEAD(&codec->pcm_list_head); - INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); - refcount_set(&codec->pcm_ref, 1); - init_waitqueue_head(&codec->remove_sleep); - return codec; } EXPORT_SYMBOL_GPL(snd_hda_codec_device_init); @@ -1000,8 +980,29 @@ int snd_hda_codec_device_new(struct hda_ if (snd_BUG_ON(codec_addr > HDA_MAX_CODEC_ADDRESS)) return -EINVAL; =20 + codec->core.dev.release =3D snd_hda_codec_dev_release; + codec->core.exec_verb =3D codec_exec_verb; + codec->card =3D card; codec->addr =3D codec_addr; + mutex_init(&codec->spdif_mutex); + mutex_init(&codec->control_mutex); + snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 32); + snd_array_init(&codec->nids, sizeof(struct hda_nid_item), 32); + snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); + snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); + snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8); + snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16); + snd_array_init(&codec->jacktbl, sizeof(struct hda_jack_tbl), 16); + snd_array_init(&codec->verbs, sizeof(struct hda_verb *), 8); + INIT_LIST_HEAD(&codec->conn_list); + INIT_LIST_HEAD(&codec->pcm_list_head); + refcount_set(&codec->pcm_ref, 1); + init_waitqueue_head(&codec->remove_sleep); + + INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); + codec->depop_delay =3D -1; + codec->fixup_id =3D HDA_FIXUP_ID_NOT_SET; =20 #ifdef CONFIG_PM codec->power_jiffies =3D jiffies;