From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0B8CC433EF for ; Mon, 24 Jan 2022 23:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848339AbiAXXWP (ORCPT ); Mon, 24 Jan 2022 18:22:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1584676AbiAXWVc (ORCPT ); Mon, 24 Jan 2022 17:21:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6D89C041881; Mon, 24 Jan 2022 12:52:49 -0800 (PST) Received: from smtp.kernel.org (relay.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 564CB611C2; Mon, 24 Jan 2022 20:52:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CECAC340E5; Mon, 24 Jan 2022 20:52:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057568; bh=PV3zTcZoEZBIfBNhE05GCrsJQVwhbmMUXbm4kUtn8zI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oG/h7ez1OU3vlzJLnvHfQH70PrRtUmnD0jHOiULPorwOcKbVXdfkssgvAdLj4GW1Y DQyZ19Ka8etfAj9Wo+mhLlmMZ4c+ebzZDgj/VPR3Me5iR96zfTiW4ZgrNJE4MNbAip p31Whvr18iKC7cMVw3gFAB0l915hbRVf1P38e2UI= 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.16 0001/1039] KVM: x86/mmu: Fix write-protection of PTs mapped by the TDP MMU Date: Mon, 24 Jan 2022 19:29:50 +0100 Message-Id: <20220124184125.179384891@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Matlack commit 7c8a4742c4abe205ec9daf416c9d42fd6b406e8e upstream. When the TDP MMU is write-protection GFNs for page table protection (as opposed to for dirty logging, or due to the HVA not being writable), it checks if the SPTE is already write-protected and if so skips modifying the SPTE and the TLB flush. This behavior is incorrect because it fails to check if the SPTE is write-protected for page table protection, i.e. fails to check that MMU-writable is '0'. If the SPTE was write-protected for dirty logging but not page table protection, the SPTE could locklessly be made writable, and vCPUs could still be running with writable mappings cached in their TLB. Fix this by only skipping setting the SPTE if the SPTE is already write-protected *and* MMU-writable is already clear. Technically, checking only MMU-writable would suffice; a SPTE cannot be writable without MMU-writable being set. But check both to be paranoid and because it arguably yields more readable code. Fixes: 46044f72c382 ("kvm: x86/mmu: Support write protection for nesting in= tdp MMU") Cc: stable@vger.kernel.org Signed-off-by: David Matlack Message-Id: <20220113233020.3986005-2-dmatlack@google.com> Reviewed-by: Sean Christopherson Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kvm/mmu/tdp_mmu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -1442,12 +1442,12 @@ static bool write_protect_gfn(struct kvm !is_last_spte(iter.old_spte, iter.level)) continue; =20 - if (!is_writable_pte(iter.old_spte)) - break; - new_spte =3D iter.old_spte & ~(PT_WRITABLE_MASK | shadow_mmu_writable_mask); =20 + if (new_spte =3D=3D iter.old_spte) + break; + tdp_mmu_set_spte(kvm, &iter, new_spte); spte_set =3D true; } From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65402C43217 for ; Mon, 24 Jan 2022 21:27:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450750AbiAXVVU (ORCPT ); Mon, 24 Jan 2022 16:21:20 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42638 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358864AbiAXUw7 (ORCPT ); Mon, 24 Jan 2022 15:52:59 -0500 Received: from smtp.kernel.org (relay.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 ABB7060B0B; Mon, 24 Jan 2022 20:52:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EB09C340E7; Mon, 24 Jan 2022 20:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057578; bh=6fZMCQloQ2t3ladZ5ITB1GxhYi5y6jBkCeqwFsjnSLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1T2Daog9HuvSn5QL731fQreO1aZXcyOPsw3J5JUFlUo9ZKURE9sygQT+3qgnEec/i O/lpjNPGciomdHInM3EUHuQfJ5N6xJNbl5gtJqAXmRkCydsV04Yq6x9Zzl4sShtnDd uJWF3kHcAUJMgDGv5EQb+W4iN9XbYueaWnrjUSEU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcelo Tosatti , Paolo Bonzini Subject: [PATCH 5.16 0002/1039] KVM: VMX: switch blocked_vcpu_on_cpu_lock to raw spinlock Date: Mon, 24 Jan 2022 19:29:51 +0100 Message-Id: <20220124184125.216249731@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marcelo Tosatti commit 5f02ef741a785678930f3ff0a8b6b2b0ef1bb402 upstream. blocked_vcpu_on_cpu_lock is taken from hard interrupt context (pi_wakeup_handler), therefore it cannot sleep. Switch it to a raw spinlock. Fixes: [41297.066254] BUG: scheduling while atomic: CPU 0/KVM/635218/0x00010001 [41297.066323] Preemption disabled at: [41297.066324] [] irq_enter_rcu+0xf/0x60 [41297.066339] Call Trace: [41297.066342] [41297.066346] dump_stack_lvl+0x34/0x44 [41297.066353] ? irq_enter_rcu+0xf/0x60 [41297.066356] __schedule_bug.cold+0x7d/0x8b [41297.066361] __schedule+0x439/0x5b0 [41297.066365] ? task_blocks_on_rt_mutex.constprop.0.isra.0+0x1b0/0x440 [41297.066369] schedule_rtlock+0x1e/0x40 [41297.066371] rtlock_slowlock_locked+0xf1/0x260 [41297.066374] rt_spin_lock+0x3b/0x60 [41297.066378] pi_wakeup_handler+0x31/0x90 [kvm_intel] [41297.066388] sysvec_kvm_posted_intr_wakeup_ipi+0x9d/0xd0 [41297.066392] [41297.066392] asm_sysvec_kvm_posted_intr_wakeup_ipi+0x12/0x20 ... Signed-off-by: Marcelo Tosatti Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kvm/vmx/posted_intr.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/arch/x86/kvm/vmx/posted_intr.c +++ b/arch/x86/kvm/vmx/posted_intr.c @@ -15,7 +15,7 @@ * can find which vCPU should be waken up. */ static DEFINE_PER_CPU(struct list_head, blocked_vcpu_on_cpu); -static DEFINE_PER_CPU(spinlock_t, blocked_vcpu_on_cpu_lock); +static DEFINE_PER_CPU(raw_spinlock_t, blocked_vcpu_on_cpu_lock); =20 static inline struct pi_desc *vcpu_to_pi_desc(struct kvm_vcpu *vcpu) { @@ -121,9 +121,9 @@ static void __pi_post_block(struct kvm_v new.control) !=3D old.control); =20 if (!WARN_ON_ONCE(vcpu->pre_pcpu =3D=3D -1)) { - spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); + raw_spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); list_del(&vcpu->blocked_vcpu_list); - spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); + raw_spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); vcpu->pre_pcpu =3D -1; } } @@ -154,11 +154,11 @@ int pi_pre_block(struct kvm_vcpu *vcpu) local_irq_disable(); if (!WARN_ON_ONCE(vcpu->pre_pcpu !=3D -1)) { vcpu->pre_pcpu =3D vcpu->cpu; - spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); + raw_spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); list_add_tail(&vcpu->blocked_vcpu_list, &per_cpu(blocked_vcpu_on_cpu, vcpu->pre_pcpu)); - spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); + raw_spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); } =20 do { @@ -215,7 +215,7 @@ void pi_wakeup_handler(void) struct kvm_vcpu *vcpu; int cpu =3D smp_processor_id(); =20 - spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); + raw_spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); list_for_each_entry(vcpu, &per_cpu(blocked_vcpu_on_cpu, cpu), blocked_vcpu_list) { struct pi_desc *pi_desc =3D vcpu_to_pi_desc(vcpu); @@ -223,13 +223,13 @@ void pi_wakeup_handler(void) if (pi_test_on(pi_desc) =3D=3D 1) kvm_vcpu_kick(vcpu); } - spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); + raw_spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); } =20 void __init pi_init_cpu(int cpu) { INIT_LIST_HEAD(&per_cpu(blocked_vcpu_on_cpu, cpu)); - spin_lock_init(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); + raw_spin_lock_init(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); } =20 bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu) From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0F27C433EF for ; Mon, 24 Jan 2022 21:28:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451184AbiAXVWX (ORCPT ); Mon, 24 Jan 2022 16:22:23 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50036 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358894AbiAXUxE (ORCPT ); Mon, 24 Jan 2022 15:53:04 -0500 Received: from smtp.kernel.org (relay.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 D732AB80FA3; Mon, 24 Jan 2022 20:53:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0BB8C340E5; Mon, 24 Jan 2022 20:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057581; bh=KIinkNyzt4ugcO55WTubE68+yAEKo88iRuWUobe4O7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nWqZ7aoKx2+JCdiS6tSLs00XHfrkZ/ShzHpXAdYrrcGXd23bddO2ueMPCZeoRX/xJ Cd/Ho9kJBgodvqhIw86kpgHtB8s6D7x9DOf446WUff7N4hr+Rv2qvnmCGBQHJ51Iek KvVNV86hRoq+B8pcS8coiVHiE+wOpBpuJeYS9bzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Karl Kurbjun , Jiri Kosina Subject: [PATCH 5.16 0003/1039] HID: Ignore battery for Elan touchscreen on HP Envy X360 15t-dr100 Date: Mon, 24 Jan 2022 19:29:52 +0100 Message-Id: <20220124184125.251451486@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Karl Kurbjun commit f3193ea1b6779023334faa72b214ece457e02656 upstream. Battery status on Elan tablet driver is reported for the HP ENVY x360 15t-dr100. There is no separate battery for the Elan controller resulting i= n a battery level report of 0% or 1% depending on whether a stylus has interact= ed with the screen. These low battery level reports causes a variety of bad behavior in desktop environments. This patch adds the appropriate quirk to indicate that the batery status is unused for this target. Cc: stable@vger.kernel.org Signed-off-by: Karl Kurbjun Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-input.c | 2 ++ 2 files changed, 3 insertions(+) --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -398,6 +398,7 @@ #define USB_DEVICE_ID_HP_X2 0x074d #define USB_DEVICE_ID_HP_X2_10_COVER 0x0755 #define I2C_DEVICE_ID_HP_ENVY_X360_15 0x2d05 +#define I2C_DEVICE_ID_HP_ENVY_X360_15T_DR100 0x29CF #define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817 #define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN 0x2544 #define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -329,6 +329,8 @@ static const struct hid_device_id hid_ba HID_BATTERY_QUIRK_IGNORE }, { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15), HID_BATTERY_QUIRK_IGNORE }, + { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15T_DR100= ), + HID_BATTERY_QUIRK_IGNORE }, { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15), HID_BATTERY_QUIRK_IGNORE }, { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN= ), From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBC6FC433F5 for ; Mon, 24 Jan 2022 21:27:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451535AbiAXVXH (ORCPT ); Mon, 24 Jan 2022 16:23:07 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50058 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351823AbiAXUxH (ORCPT ); Mon, 24 Jan 2022 15:53:07 -0500 Received: from smtp.kernel.org (relay.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 CA121B80CCF; Mon, 24 Jan 2022 20:53:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F262FC340E7; Mon, 24 Jan 2022 20:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057584; bh=vSGR6VHbNUyq1gjucRiTGoZ958d6JifO3hYpyr6RMI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mFR9xQD1Cb7VPZO9LQcPAjVzqTkY1WAO83f6WwrZLA5hUv6rZ3dny6fLz5G1WPxk4 IEhNNuN/QCMQKrmk/qm2YI2IjkhDbJmr0bHt1GnGGCykQKKaoJNPNyRExjLLXWwbt8 aaLwlqe/aqUF/pPRsmB1dab1GDAzI82hDs7jbyLw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Jiri Kosina Subject: [PATCH 5.16 0004/1039] HID: uhid: Fix worker destroying device without any protection Date: Mon, 24 Jan 2022 19:29:53 +0100 Message-Id: <20220124184125.288410926@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jann Horn commit 4ea5763fb79ed89b3bdad455ebf3f33416a81624 upstream. uhid has to run hid_add_device() from workqueue context while allowing parallel use of the userspace API (which is protected with ->devlock). But hid_add_device() can fail. Currently, that is handled by immediately destroying the associated HID device, without using ->devlock - but if there are concurrent requests from userspace, that's wrong and leads to NULL dereferences and/or memory corruption (via use-after-free). Fix it by leaving the HID device as-is in the worker. We can clean it up later, either in the UHID_DESTROY command handler or in the ->release() handler. Cc: stable@vger.kernel.org Fixes: 67f8ecc550b5 ("HID: uhid: fix timeout when probe races with IO") Signed-off-by: Jann Horn Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/uhid.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c @@ -28,11 +28,22 @@ =20 struct uhid_device { struct mutex devlock; + + /* This flag tracks whether the HID device is usable for commands from + * userspace. The flag is already set before hid_add_device(), which + * runs in workqueue context, to allow hid_add_device() to communicate + * with userspace. + * However, if hid_add_device() fails, the flag is cleared without + * holding devlock. + * We guarantee that if @running changes from true to false while you're + * holding @devlock, it's still fine to access @hid. + */ bool running; =20 __u8 *rd_data; uint rd_size; =20 + /* When this is NULL, userspace may use UHID_CREATE/UHID_CREATE2. */ struct hid_device *hid; struct uhid_event input_buf; =20 @@ -63,9 +74,18 @@ static void uhid_device_add_worker(struc if (ret) { hid_err(uhid->hid, "Cannot register HID device: error %d\n", ret); =20 - hid_destroy_device(uhid->hid); - uhid->hid =3D NULL; + /* We used to call hid_destroy_device() here, but that's really + * messy to get right because we have to coordinate with + * concurrent writes from userspace that might be in the middle + * of using uhid->hid. + * Just leave uhid->hid as-is for now, and clean it up when + * userspace tries to close or reinitialize the uhid instance. + * + * However, we do have to clear the ->running flag and do a + * wakeup to make sure userspace knows that the device is gone. + */ uhid->running =3D false; + wake_up_interruptible(&uhid->report_wait); } } =20 @@ -474,7 +494,7 @@ static int uhid_dev_create2(struct uhid_ void *rd_data; int ret; =20 - if (uhid->running) + if (uhid->hid) return -EALREADY; =20 rd_size =3D ev->u.create2.rd_size; @@ -556,7 +576,7 @@ static int uhid_dev_create(struct uhid_d =20 static int uhid_dev_destroy(struct uhid_device *uhid) { - if (!uhid->running) + if (!uhid->hid) return -EINVAL; =20 uhid->running =3D false; @@ -565,6 +585,7 @@ static int uhid_dev_destroy(struct uhid_ cancel_work_sync(&uhid->worker); =20 hid_destroy_device(uhid->hid); + uhid->hid =3D NULL; kfree(uhid->rd_data); =20 return 0; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3408C433EF for ; Mon, 24 Jan 2022 23:18:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1846409AbiAXXPz (ORCPT ); Mon, 24 Jan 2022 18:15:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1584735AbiAXWVj (ORCPT ); Mon, 24 Jan 2022 17:21:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CFD6C054303; Mon, 24 Jan 2022 12:53:10 -0800 (PST) Received: from smtp.kernel.org (relay.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 0516AB811FB; Mon, 24 Jan 2022 20:53:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EC66C36AE2; Mon, 24 Jan 2022 20:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057587; bh=xnUn7jNRsQgFINae2Fala1LuQT7IMhQfr7FYju3KQAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dGlzzuTNSt1IwoJ7HbD9sEcqcMDWVluwANkOfdqZ57tINOdLIqopiDZzd1ZxfcCdN Qc2j5ZHDvIg7cdSSD6cZmObTVFCMKhI4/j42hYA81e1aUdplb98YZqP8YbT08/ZyqJ /0nhEZHJN0nx4OISSjmtDVihAFyEq3LDeCns3tjM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Gerecke , Ping Cheng , Jiri Kosina Subject: [PATCH 5.16 0005/1039] HID: wacom: Reset expected and received contact counts at the same time Date: Mon, 24 Jan 2022 19:29:54 +0100 Message-Id: <20220124184125.320093581@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Gerecke commit 546e41ac994cc185ef3de610ca849a294b5df3ba upstream. These two values go hand-in-hand and must be valid for the driver to behave correctly. We are currently lazy about updating the values and rely on the "expected" code flow to take care of making sure they're valid at the point they're needed. The "expected" flow changed somewhat with commit f8b6a74719b5 ("HID: wacom: generic: Support multiple tools per report"), however. This led to problems with the DTH-2452 due (in part) to *all* contacts being fully processed -- even those past the expected contact count. Specifically, the received count gets reset to 0 once all expected fingers are processed, but not the expected count. The rest of the contacts in the report are then *also* processed since now the driver thinks we've only processed 0 of N expected contacts. Later commits such as 7fb0413baa7f (HID: wacom: Use "Confidence" flag to prevent reporting invalid contacts) worked around the DTH-2452 issue by skipping the invalid contacts at the end of the report, but this is not a complete fix. The confidence flag cannot be relied on when a contact is removed (see the following patch), and dealing with that condition re-introduces the DTH-2452 issue unless we also address this contact count laziness. By resetting expected and received counts at the same time we ensure the driver understands that there are 0 more contacts expected in the report. Similarly, we also make sure to reset the received count if for some reason we're out of sync in the pre-report phase. Link: https://github.com/linuxwacom/input-wacom/issues/288 Fixes: f8b6a74719b5 ("HID: wacom: generic: Support multiple tools per repor= t") CC: stable@vger.kernel.org Signed-off-by: Jason Gerecke Reviewed-by: Ping Cheng Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/wacom_wac.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2692,11 +2692,14 @@ static void wacom_wac_finger_pre_report( hid_data->cc_index >=3D 0) { struct hid_field *field =3D report->field[hid_data->cc_index]; int value =3D field->value[hid_data->cc_value_index]; - if (value) + if (value) { hid_data->num_expected =3D value; + hid_data->num_received =3D 0; + } } else { hid_data->num_expected =3D wacom_wac->features.touch_max; + hid_data->num_received =3D 0; } } =20 @@ -2724,6 +2727,7 @@ static void wacom_wac_finger_report(stru =20 input_sync(input); wacom_wac->hid_data.num_received =3D 0; + wacom_wac->hid_data.num_expected =3D 0; =20 /* keep touch state for pen event */ wacom_wac->shared->touch_down =3D wacom_wac_finger_count_touches(wacom_wa= c); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C706CC4167B for ; Mon, 24 Jan 2022 21:27:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450830AbiAXVVb (ORCPT ); Mon, 24 Jan 2022 16:21:31 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44502 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442101AbiAXUxM (ORCPT ); Mon, 24 Jan 2022 15:53:12 -0500 Received: from smtp.kernel.org (relay.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 77D3C61227; Mon, 24 Jan 2022 20:53:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 262E3C340E7; Mon, 24 Jan 2022 20:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057590; bh=/GYrC+HBo36Zytf1mlcSf2lAscO9v2G3xF7pkIcsPd0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bkz2zlTsqfsq/1P1bZLHbL/+TJnG6TZKQKcJ9dL2m0Vj67VM6bN2hu1asMQoADAcd YSYgciicojFPDbHuFc2cksn5cDbxHAQ+mTjQqWUYueXWtZXsAjsOgZLlIPNYS1umdZ 9Q5oONW44WPiprpcs1tIP8vJ4fwOa2lUYzCcqCdo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Gerecke , Ping Cheng , Jiri Kosina Subject: [PATCH 5.16 0006/1039] HID: wacom: Ignore the confidence flag when a touch is removed Date: Mon, 24 Jan 2022 19:29:55 +0100 Message-Id: <20220124184125.358253731@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Gerecke commit df03e9bd6d4806619b4cdc91a3d7695818a8e2b7 upstream. AES hardware may internally re-classify a contact that it thought was intentional as a palm. Intentional contacts are reported as "down" with the confidence bit set. When this re-classification occurs, however, the state transitions to "up" with the confidence bit cleared. This kind of transition appears to be legal according to Microsoft docs, but we do not handle it correctly. Because the confidence bit is clear, we don't call `wacom_wac_finger_slot` and update userspace. This causes hung touches that confuse userspace and interfere with pen arbitration. This commit adds a special case to ignore the confidence flag if a contact is reported as removed. This ensures we do not leave a hung touch if one of these re-classification events occured. Ideally we'd have some way to also let userspace know that the touch has been re-classified as a palm and needs to be canceled, but that's not possible right now :) Link: https://github.com/linuxwacom/input-wacom/issues/288 Fixes: 7fb0413baa7f (HID: wacom: Use "Confidence" flag to prevent reporting= invalid contacts) CC: stable@vger.kernel.org Signed-off-by: Jason Gerecke Reviewed-by: Ping Cheng Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/wacom_wac.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2588,6 +2588,24 @@ static void wacom_wac_finger_slot(struct } } =20 +static bool wacom_wac_slot_is_active(struct input_dev *dev, int key) +{ + struct input_mt *mt =3D dev->mt; + struct input_mt_slot *s; + + if (!mt) + return false; + + for (s =3D mt->slots; s !=3D mt->slots + mt->num_slots; s++) { + if (s->key =3D=3D key && + input_mt_get_value(s, ABS_MT_TRACKING_ID) >=3D 0) { + return true; + } + } + + return false; +} + static void wacom_wac_finger_event(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value) { @@ -2638,9 +2656,14 @@ static void wacom_wac_finger_event(struc } =20 if (usage->usage_index + 1 =3D=3D field->report_count) { - if (equivalent_usage =3D=3D wacom_wac->hid_data.last_slot_field && - wacom_wac->hid_data.confidence) - wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); + if (equivalent_usage =3D=3D wacom_wac->hid_data.last_slot_field) { + bool touch_removed =3D wacom_wac_slot_is_active(wacom_wac->touch_input, + wacom_wac->hid_data.id) && !wacom_wac->hid_data.tipswitch; + + if (wacom_wac->hid_data.confidence || touch_removed) { + wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); + } + } } } =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77CC0C43217 for ; Mon, 24 Jan 2022 21:27:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451481AbiAXVXB (ORCPT ); Mon, 24 Jan 2022 16:23:01 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49244 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343492AbiAXUxR (ORCPT ); Mon, 24 Jan 2022 15:53:17 -0500 Received: from smtp.kernel.org (relay.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 95640B81257; Mon, 24 Jan 2022 20:53:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF322C340E8; Mon, 24 Jan 2022 20:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057594; bh=5cGp+aSWnuWz15OHFFkJuyGsVGAc0ab+PsZw/z1KGJQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMkw0M7gtU25qhm7E9pYAj7SJCrzGrZvmBRAPC2gUNbH7K9xNpVzFAATf9EZxmsqa PcQHtNPpdIcdcTesUhNSIPPmr3QI8eg3vIRfC0OLmRC7DC++Mmo7+Rznt0uQ5d9uWJ QQyaKQzZHJ/oM6YZI/3ddYecZtCZ1EcsnYuygdYA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Gerecke , Ping Cheng , Jiri Kosina Subject: [PATCH 5.16 0007/1039] HID: wacom: Avoid using stale array indicies to read contact count Date: Mon, 24 Jan 2022 19:29:56 +0100 Message-Id: <20220124184125.387877794@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Gerecke commit 20f3cf5f860f9f267a6a6e5642d3d0525edb1814 upstream. If we ever see a touch report with contact count data we initialize several variables used to read the contact count in the pre-report phase. These variables are never reset if we process a report which doesn't contain a contact count, however. This can cause the pre- report function to trigger a read of arbitrary memory (e.g. NULL if we're lucky) and potentially crash the driver. This commit restores resetting of the variables back to default "none" values that were used prior to the commit mentioned below. Link: https://github.com/linuxwacom/input-wacom/issues/276 Fixes: 003f50ab673c (HID: wacom: Update last_slot_field during pre_report p= hase) CC: stable@vger.kernel.org Signed-off-by: Jason Gerecke Reviewed-by: Ping Cheng Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/wacom_wac.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2682,6 +2682,10 @@ static void wacom_wac_finger_pre_report( =20 hid_data->confidence =3D true; =20 + hid_data->cc_report =3D 0; + hid_data->cc_index =3D -1; + hid_data->cc_value_index =3D -1; + for (i =3D 0; i < report->maxfield; i++) { struct hid_field *field =3D report->field[i]; int j; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F6F5C433EF for ; Mon, 24 Jan 2022 21:27:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451467AbiAXVW7 (ORCPT ); Mon, 24 Jan 2022 16:22:59 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50276 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351838AbiAXUxW (ORCPT ); Mon, 24 Jan 2022 15:53:22 -0500 Received: from smtp.kernel.org (relay.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 5414AB8105C; Mon, 24 Jan 2022 20:53:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0CFAC36AE7; Mon, 24 Jan 2022 20:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057598; bh=MXPVVBYHEXHFo4yE+Xal95RCl5qOtXe7FpJ1wCoXn6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n3bEMADCtMjWy1Es7+2sAUryCsTybdAgQJ2C6bEgr4q1nCle61AgLMNEr2W+5/Ato hDX05m603y4/sCGE3bBO+sf+eI+YvZIItxMuWWRfmvSf+Z2jLzcoz9y0yn/QRyqOrc X7sXB4gLiuH9w2rPIe5fvr01Np//fB++8GUVn6sE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.16 0008/1039] ALSA: core: Fix SSID quirk lookup for subvendor=0 Date: Mon, 24 Jan 2022 19:29:57 +0100 Message-Id: <20220124184125.421745210@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 5576c4f24c56722a2d9fb9c447d896e5b312078b upstream. Some weird devices set the codec SSID vendor ID 0, and snd_pci_quirk_lookup_id() loop aborts at the point although it should still try matching with the SSID device ID. This resulted in a missing quirk for some old Macs. Fix the loop termination condition to check both subvendor and subdevice. Fixes: 73355ddd8775 ("ALSA: hda: Code refactoring snd_hda_pick_fixup()") Cc: BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=3D215495 Link: https://lore.kernel.org/r/20220116082838.19382-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/core/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/core/misc.c +++ b/sound/core/misc.c @@ -112,7 +112,7 @@ snd_pci_quirk_lookup_id(u16 vendor, u16 { const struct snd_pci_quirk *q; =20 - for (q =3D list; q->subvendor; q++) { + for (q =3D list; q->subvendor || q->subdevice; q++) { if (q->subvendor !=3D vendor) continue; if (!q->subdevice || From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70D61C433FE for ; Mon, 24 Jan 2022 21:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450868AbiAXVVi (ORCPT ); Mon, 24 Jan 2022 16:21:38 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46710 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442133AbiAXUxW (ORCPT ); Mon, 24 Jan 2022 15:53:22 -0500 Received: from smtp.kernel.org (relay.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 A956D611DA; Mon, 24 Jan 2022 20:53:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EA6EC340E5; Mon, 24 Jan 2022 20:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057601; bh=wKeoF4KVuNIMj/NAwyFfmj59Rac6LZagk23kK+eb/6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eZKdZV1WlkNIvqX+5ZAs4luAcCAaLsjgWTdC1vDy48F7jnP/XyoiN/95nZ3sstP0a nMi2XbDqjzPUv3s7BSApnlJjwvvZJYf4BPsDqRhtTTXmmdfte7y/CMezOvTCi0IMSz Htby/RpYg3pAe7NmMELuDMCvotoeJcsneatoXbUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shyam Prasad N , Steve French Subject: [PATCH 5.16 0009/1039] cifs: free ntlmsspblob allocated in negotiate Date: Mon, 24 Jan 2022 19:29:58 +0100 Message-Id: <20220124184125.451931499@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shyam Prasad N commit e3548aaf41a200c2af359462be23bcdd76efd795 upstream. One of my previous fixes: cifs: send workstation name during ntlmssp session setup ...changed the prototype of build_ntlmssp_negotiate_blob from being allocated by the caller to being allocated within the function. The caller needs to free this object too. While SMB2 version of the caller did it, I forgot to free for the SMB1 version. Fixing that here. Fixes: 49bd49f983b5 ("cifs: send workstation name during ntlmssp session se= tup") Cc: stable@vger.kernel.org # 5.16 Signed-off-by: Shyam Prasad N Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/cifs/sess.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -1354,7 +1354,7 @@ sess_auth_rawntlmssp_negotiate(struct se &blob_len, ses, sess_data->nls_cp); if (rc) - goto out; + goto out_free_ntlmsspblob; =20 sess_data->iov[1].iov_len =3D blob_len; sess_data->iov[1].iov_base =3D ntlmsspblob; @@ -1362,7 +1362,7 @@ sess_auth_rawntlmssp_negotiate(struct se =20 rc =3D _sess_auth_rawntlmssp_assemble_req(sess_data); if (rc) - goto out; + goto out_free_ntlmsspblob; =20 rc =3D sess_sendreceive(sess_data); =20 @@ -1376,14 +1376,14 @@ sess_auth_rawntlmssp_negotiate(struct se rc =3D 0; =20 if (rc) - goto out; + goto out_free_ntlmsspblob; =20 cifs_dbg(FYI, "rawntlmssp session setup challenge phase\n"); =20 if (smb_buf->WordCount !=3D 4) { rc =3D -EIO; cifs_dbg(VFS, "bad word count %d\n", smb_buf->WordCount); - goto out; + goto out_free_ntlmsspblob; } =20 ses->Suid =3D smb_buf->Uid; /* UID left in wire format (le) */ @@ -1397,10 +1397,13 @@ sess_auth_rawntlmssp_negotiate(struct se cifs_dbg(VFS, "bad security blob length %d\n", blob_len); rc =3D -EINVAL; - goto out; + goto out_free_ntlmsspblob; } =20 rc =3D decode_ntlmssp_challenge(bcc_ptr, blob_len, ses); + +out_free_ntlmsspblob: + kfree(ntlmsspblob); out: sess_free_buffer(sess_data); =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1B23C433EF for ; Mon, 24 Jan 2022 23:19:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1847220AbiAXXTG (ORCPT ); Mon, 24 Jan 2022 18:19:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1584689AbiAXWVd (ORCPT ); Mon, 24 Jan 2022 17:21:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48013C041882; Mon, 24 Jan 2022 12:52:54 -0800 (PST) Received: from smtp.kernel.org (relay.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 04579B80CCF; Mon, 24 Jan 2022 20:52:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E942C36AE3; Mon, 24 Jan 2022 20:52:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057571; bh=uDUAb+qZBHXld3qkmkZnFDhDfgMIF+C1eIkgRfrPvD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UmJbyc5VqwfYgT8jI0xcQRz58kmNnPh4O44QkvDnf+y2Zv3/jfEgPzeFAS2JpQZcI cNe1CplXU58HRALIM+SSju3j9OPWnJjLuqROz6WPNdO2HtTi8OPSGAB5bqeHZJe9BQ bAXbWyn5pDNLm9VCrG4s0GgicMH6q3nC6QGPBo+c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenqing Liu , Chao Yu , Jaegeuk Kim Subject: [PATCH 5.16 0010/1039] f2fs: fix to do sanity check on inode type during garbage collection Date: Mon, 24 Jan 2022 19:29:59 +0100 Message-Id: <20220124184125.486229792@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 9056d6489f5a41cfbb67f719d2c0ce61ead72d9f upstream. As report by Wenqing Liu in bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=3D215231 - Overview kernel NULL pointer dereference triggered in folio_mark_dirty() when mount= and operate on a crafted f2fs image - Reproduce tested on kernel 5.16-rc3, 5.15.X under root 1. mkdir mnt 2. mount -t f2fs tmp1.img mnt 3. touch tmp 4. cp tmp mnt F2FS-fs (loop0): sanity_check_inode: inode (ino=3D49) extent info [5942, 42= 94180864, 4] is incorrect, run fsck to fix F2FS-fs (loop0): f2fs_check_nid_range: out-of-range nid=3D31340049, run fsc= k to fix. BUG: kernel NULL pointer dereference, address: 0000000000000000 folio_mark_dirty+0x33/0x50 move_data_page+0x2dd/0x460 [f2fs] do_garbage_collect+0xc18/0x16a0 [f2fs] f2fs_gc+0x1d3/0xd90 [f2fs] f2fs_balance_fs+0x13a/0x570 [f2fs] f2fs_create+0x285/0x840 [f2fs] path_openat+0xe6d/0x1040 do_filp_open+0xc5/0x140 do_sys_openat2+0x23a/0x310 do_sys_open+0x57/0x80 The root cause is for special file: e.g. character, block, fifo or socket f= ile, f2fs doesn't assign address space operations pointer array for mapping->a_o= ps field, so, in a fuzzed image, SSA table indicates a data block belong to special f= ile, when f2fs tries to migrate that block, it causes NULL pointer access once move_d= ata_page() calls a_ops->set_dirty_page(). Cc: stable@vger.kernel.org Reported-by: Wenqing Liu Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/f2fs/gc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1457,7 +1457,8 @@ next_step: =20 if (phase =3D=3D 3) { inode =3D f2fs_iget(sb, dni.ino); - if (IS_ERR(inode) || is_bad_inode(inode)) + if (IS_ERR(inode) || is_bad_inode(inode) || + special_file(inode->i_mode)) continue; =20 if (!down_write_trylock( From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E091CC4167D for ; Mon, 24 Jan 2022 23:18:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1846386AbiAXXPu (ORCPT ); Mon, 24 Jan 2022 18:15:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1584691AbiAXWVd (ORCPT ); Mon, 24 Jan 2022 17:21:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C111AC041883; Mon, 24 Jan 2022 12:52:55 -0800 (PST) Received: from smtp.kernel.org (relay.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 6190F611F9; Mon, 24 Jan 2022 20:52:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F3CDC340EA; Mon, 24 Jan 2022 20:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057574; bh=jfuQ8/SSqqyyt5xvg642+GN2e1J3uMhRUlEhGKuxvSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sbYd6o4OTYEelV+sjCyH77yhzhsV5Sv9M6aQcgzAXs3QohWNE8pNTCOy3++9xm/DD xdmJc176xvEXfS0q0IHLbmlRY4SHy+EIlBqAoTGJRKkAv3nlAPW0ZwAWEKB31MsgU/ y6k33IMzrPRjRBLUtNd+OyuyIScK2sKSVatvMUBw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 5.16 0011/1039] f2fs: fix to do sanity check in is_alive() Date: Mon, 24 Jan 2022 19:30:00 +0100 Message-Id: <20220124184125.525171284@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 77900c45ee5cd5da63bd4d818a41dbdf367e81cd upstream. In fuzzed image, SSA table may indicate that a data block belongs to invalid node, which node ID is out-of-range (0, 1, 2 or max_nid), in order to avoid migrating inconsistent data in such corrupted image, let's do sanity check anyway before data block migration. Cc: stable@vger.kernel.org Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/f2fs/gc.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1026,6 +1026,9 @@ static bool is_alive(struct f2fs_sb_info set_sbi_flag(sbi, SBI_NEED_FSCK); } =20 + if (f2fs_check_nid_range(sbi, dni->ino)) + return false; + *nofs =3D ofs_of_node(node_page); source_blkaddr =3D data_blkaddr(NULL, node_page, ofs_in_node); f2fs_put_page(node_page, 1); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD168C433F5 for ; Mon, 24 Jan 2022 23:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849295AbiAXXZY (ORCPT ); Mon, 24 Jan 2022 18:25:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587755AbiAXW3h (ORCPT ); Mon, 24 Jan 2022 17:29:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A699FC095410; Mon, 24 Jan 2022 12:55:18 -0800 (PST) Received: from smtp.kernel.org (relay.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 5D196B811FB; Mon, 24 Jan 2022 20:55:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07D9CC340E5; Mon, 24 Jan 2022 20:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057716; bh=IgHUHKKQzYCKAcKqsjwDkEbLcCrTpp0xgZ/idz6puKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JXmLUO7tcuEqok3wReiCViXl0hkF4tlIKJBjOdoDTgmyNpiAa18fW+fmJ8oz2hLqX ZJG59v3pNJC3IbYApdni3w1B6nC8j9mJMbNugezCKEnR/MhiWR5ovDUZlNNY1myabb vV1tecXB7BfK8J+pfkYv1LrNyWZ/mgvQ1/ciOrfs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenqing Liu , Chao Yu , Jaegeuk Kim Subject: [PATCH 5.16 0012/1039] f2fs: fix to do sanity check on last xattr entry in __f2fs_setxattr() Date: Mon, 24 Jan 2022 19:30:01 +0100 Message-Id: <20220124184125.560804776@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 645a3c40ca3d40cc32b4b5972bf2620f2eb5dba6 upstream. As Wenqing Liu reported in bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=3D215235 - Overview page fault in f2fs_setxattr() when mount and operate on corrupted image - Reproduce tested on kernel 5.16-rc3, 5.15.X under root 1. unzip tmp7.zip 2. ./single.sh f2fs 7 Sometimes need to run the script several times - Kernel dump loop0: detected capacity change from 0 to 131072 F2FS-fs (loop0): Found nat_bits in checkpoint F2FS-fs (loop0): Mounted with checkpoint version =3D 7548c2ee BUG: unable to handle page fault for address: ffffe47bc7123f48 RIP: 0010:kfree+0x66/0x320 Call Trace: __f2fs_setxattr+0x2aa/0xc00 [f2fs] f2fs_setxattr+0xfa/0x480 [f2fs] __f2fs_set_acl+0x19b/0x330 [f2fs] __vfs_removexattr+0x52/0x70 __vfs_removexattr_locked+0xb1/0x140 vfs_removexattr+0x56/0x100 removexattr+0x57/0x80 path_removexattr+0xa3/0xc0 __x64_sys_removexattr+0x17/0x20 do_syscall_64+0x37/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xae The root cause is in __f2fs_setxattr(), we missed to do sanity check on last xattr entry, result in out-of-bound memory access during updating inconsistent xattr data of target inode. After the fix, it can detect such xattr inconsistency as below: F2FS-fs (loop11): inode (7) has invalid last xattr entry, entry_size: 60676 F2FS-fs (loop11): inode (8) has corrupted xattr F2FS-fs (loop11): inode (8) has corrupted xattr F2FS-fs (loop11): inode (8) has invalid last xattr entry, entry_size: 47736 Cc: stable@vger.kernel.org Reported-by: Wenqing Liu Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/f2fs/xattr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -684,8 +684,17 @@ static int __f2fs_setxattr(struct inode } =20 last =3D here; - while (!IS_XATTR_LAST_ENTRY(last)) + while (!IS_XATTR_LAST_ENTRY(last)) { + if ((void *)(last) + sizeof(__u32) > last_base_addr || + (void *)XATTR_NEXT_ENTRY(last) > last_base_addr) { + f2fs_err(F2FS_I_SB(inode), "inode (%lu) has invalid last xattr entry, e= ntry_size: %zu", + inode->i_ino, ENTRY_SIZE(last)); + set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK); + error =3D -EFSCORRUPTED; + goto exit; + } last =3D XATTR_NEXT_ENTRY(last); + } =20 newsize =3D XATTR_ALIGN(sizeof(struct f2fs_xattr_entry) + len + size); =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60D35C4167E for ; Mon, 24 Jan 2022 21:27:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450978AbiAXVVz (ORCPT ); Mon, 24 Jan 2022 16:21:55 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46816 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442151AbiAXUxb (ORCPT ); Mon, 24 Jan 2022 15:53:31 -0500 Received: from smtp.kernel.org (relay.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 8C3BB60C44; Mon, 24 Jan 2022 20:53:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 558C5C340E7; Mon, 24 Jan 2022 20:53:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057608; bh=aMCzFlePstTjSYJQ1nZqs+s14GvcDB63SuiLw1DajFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EfBWG2HCv0cgatgK0bgK+OCop9SWQXrdyqryrlASyUZJgY01IKeLGHDV5rUzHPfyS 8rVeUouRvc2xS68Ctbi6UF36KCT+XfIbmpLJqGWbDVi/ZSYcJOKfdiftHgHXlpKjc2 V+G+UJGYuoEb+Ztv71b48L3szABS78Xwsv/WBo1s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaegeuk Kim Subject: [PATCH 5.16 0013/1039] f2fs: avoid EINVAL by SBI_NEED_FSCK when pinning a file Date: Mon, 24 Jan 2022 19:30:02 +0100 Message-Id: <20220124184125.591885196@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jaegeuk Kim commit 19bdba5265624ba6b9d9dd936a0c6ccc167cfe80 upstream. Android OTA failed due to SBI_NEED_FSCK flag when pinning the file. Let's a= void it since we can do in-place-updates. Cc: stable@vger.kernel.org Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/f2fs/data.c | 7 +++++-- fs/f2fs/file.c | 10 +++++----- 2 files changed, 10 insertions(+), 7 deletions(-) --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2617,6 +2617,11 @@ bool f2fs_should_update_outplace(struct { struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); =20 + /* The below cases were checked when setting it. */ + if (f2fs_is_pinned_file(inode)) + return false; + if (fio && is_sbi_flag_set(sbi, SBI_NEED_FSCK)) + return true; if (f2fs_lfs_mode(sbi)) return true; if (S_ISDIR(inode->i_mode)) @@ -2625,8 +2630,6 @@ bool f2fs_should_update_outplace(struct return true; if (f2fs_is_atomic_file(inode)) return true; - if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) - return true; =20 /* swap file is migrating in aligned write mode */ if (is_inode_flag_set(inode, FI_ALIGNED_WRITE)) --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -3143,17 +3143,17 @@ static int f2fs_ioc_set_pin_file(struct =20 inode_lock(inode); =20 - if (f2fs_should_update_outplace(inode, NULL)) { - ret =3D -EINVAL; - goto out; - } - if (!pin) { clear_inode_flag(inode, FI_PIN_FILE); f2fs_i_gc_failures_write(inode, 0); goto done; } =20 + if (f2fs_should_update_outplace(inode, NULL)) { + ret =3D -EINVAL; + goto out; + } + if (f2fs_pin_file_control(inode, false)) { ret =3D -EAGAIN; goto out; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3D89C4332F for ; Mon, 24 Jan 2022 21:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451059AbiAXVWD (ORCPT ); Mon, 24 Jan 2022 16:22:03 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50694 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442263AbiAXUyF (ORCPT ); Mon, 24 Jan 2022 15:54:05 -0500 Received: from smtp.kernel.org (relay.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 CB39FB81057; Mon, 24 Jan 2022 20:54:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06A03C340E5; Mon, 24 Jan 2022 20:54:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057641; bh=DJ/cYkr8MzqT7hAfv92BLVMqYFrXoXo4x8FHMhWFLhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fGcfkbLaDVVm198A5cZ2HKt1l0v9NB1sq1yBxmUOETbudFczMc5gJ7smNHrlLCkIb pr2SKm9k/eW7xHuZcg2bC1F3Feqt6EwI5UfUcB+nSWTmlpxN2LqSZnYhHGx4BE6d/j Jm22oy1LR8jebJ1VQxVCN1HbaZcWVE169kNbc5W8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , "David S. Miller" , syzbot+7f23bcddf626e0593a39@syzkaller.appspotmail.com Subject: [PATCH 5.16 0014/1039] nfc: llcp: fix NULL error pointer dereference on sendmsg() after failed bind() Date: Mon, 24 Jan 2022 19:30:03 +0100 Message-Id: <20220124184125.622205194@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 dded08927ca3c31a5c37f8e7f95fe98770475dd4 upstream. Syzbot detected a NULL pointer dereference of nfc_llcp_sock->dev pointer (which is a 'struct nfc_dev *') with calls to llcp_sock_sendmsg() after a failed llcp_sock_bind(). The message being sent is a SOCK_DGRAM. KASAN report: BUG: KASAN: null-ptr-deref in nfc_alloc_send_skb+0x2d/0xc0 Read of size 4 at addr 00000000000005c8 by task llcp_sock_nfc_a/899 CPU: 5 PID: 899 Comm: llcp_sock_nfc_a Not tainted 5.16.0-rc6-next-2021122= 4-00001-gc6437fbf18b0 #125 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/0= 1/2014 Call Trace: dump_stack_lvl+0x45/0x59 ? nfc_alloc_send_skb+0x2d/0xc0 __kasan_report.cold+0x117/0x11c ? mark_lock+0x480/0x4f0 ? nfc_alloc_send_skb+0x2d/0xc0 kasan_report+0x38/0x50 nfc_alloc_send_skb+0x2d/0xc0 nfc_llcp_send_ui_frame+0x18c/0x2a0 ? nfc_llcp_send_i_frame+0x230/0x230 ? __local_bh_enable_ip+0x86/0xe0 ? llcp_sock_connect+0x470/0x470 ? llcp_sock_connect+0x470/0x470 sock_sendmsg+0x8e/0xa0 ____sys_sendmsg+0x253/0x3f0 ... The issue was visible only with multiple simultaneous calls to bind() and sendmsg(), which resulted in most of the bind() calls to fail. The bind() was failing on checking if there is available WKS/SDP/SAP (respective bit in 'struct nfc_llcp_local' fields). When there was no available WKS/SDP/SAP, the bind returned error but the sendmsg() to such socket was able to trigger mentioned NULL pointer dereference of nfc_llcp_sock->dev. The code looks simply racy and currently it protects several paths against race with checks for (!nfc_llcp_sock->local) which is NULL-ified in error paths of bind(). The llcp_sock_sendmsg() did not have such check but called function nfc_llcp_send_ui_frame() had, although not protected with lock_sock(). Therefore the race could look like (same socket is used all the time): CPU0 CPU1 =3D=3D=3D=3D =3D=3D=3D=3D llcp_sock_bind() - lock_sock() - success - release_sock() - return 0 llcp_sock_sendmsg() - lock_sock() - release_sock() llcp_sock_bind(), same socket - lock_sock() - error - nfc_llcp_send_ui_frame() - if (!llcp_sock->local) - llcp_sock->local =3D NULL - nfc_put_device(dev) - dereference llcp_sock->dev - release_sock() - return -ERRNO The nfc_llcp_send_ui_frame() checked llcp_sock->local outside of the lock, which is racy and ineffective check. Instead, its caller llcp_sock_sendmsg(), should perform the check inside lock_sock(). Reported-and-tested-by: syzbot+7f23bcddf626e0593a39@syzkaller.appspotmail.c= om Fixes: b874dec21d1c ("NFC: Implement LLCP connection less Tx path") Cc: Signed-off-by: Krzysztof Kozlowski Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/nfc/llcp_sock.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/net/nfc/llcp_sock.c +++ b/net/nfc/llcp_sock.c @@ -789,6 +789,11 @@ static int llcp_sock_sendmsg(struct sock =20 lock_sock(sk); =20 + if (!llcp_sock->local) { + release_sock(sk); + return -ENODEV; + } + if (sk->sk_type =3D=3D SOCK_DGRAM) { DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, addr, msg->msg_name); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9493C43217 for ; Mon, 24 Jan 2022 21:28:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451170AbiAXVWU (ORCPT ); Mon, 24 Jan 2022 16:22:20 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48216 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442444AbiAXUyg (ORCPT ); Mon, 24 Jan 2022 15:54:36 -0500 Received: from smtp.kernel.org (relay.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 812D5612E9; Mon, 24 Jan 2022 20:54:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C6E4C36AE9; Mon, 24 Jan 2022 20:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057674; bh=6p4xdbbsxT246YjsLChIgTjGYl8VYvjihW6+X1ld13w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YZ8JnfUUVlT8GGL/eeg+HomrOm9RPz/3jgKy/5XDLgFtyb/PKw1ZHOdmZnnLQPBi/ FLNC8CBbV8cj+5FOU6zw6Gu8jHbX6QXq4tKl9oJxQrOxkbuKh1t28WIfHidX1Ei/D0 TjjM4D0wVHpBgHUgxEBI2g05d47zXFsXKb6ScwNE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Riedmueller , Christian Eggers , Han Xu , Miquel Raynal Subject: [PATCH 5.16 0015/1039] mtd: rawnand: gpmi: Add ERR007117 protection for nfc_apply_timings Date: Mon, 24 Jan 2022 19:30:04 +0100 Message-Id: <20220124184125.652572361@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Eggers commit f53d4c109a666bf1a4883b45d546fba079258717 upstream. gpmi_io clock needs to be gated off when changing the parent/dividers of enfc_clk_root (i.MX6Q/i.MX6UL) respectively qspi2_clk_root (i.MX6SX). Otherwise this rate change can lead to an unresponsive GPMI core which results in DMA timeouts and failed driver probe: [ 4.072318] gpmi-nand 112000.gpmi-nand: DMA timeout, last DMA ... [ 4.370355] gpmi-nand 112000.gpmi-nand: Chip: 0, Error -110 ... [ 4.375988] gpmi-nand 112000.gpmi-nand: Chip: 0, Error -22 [ 4.381524] gpmi-nand 112000.gpmi-nand: Error in ECC-based read: -22 [ 4.387988] gpmi-nand 112000.gpmi-nand: Chip: 0, Error -22 [ 4.393535] gpmi-nand 112000.gpmi-nand: Chip: 0, Error -22 ... Other than stated in i.MX 6 erratum ERR007117, it should be sufficient to gate only gpmi_io because all other bch/nand clocks are derived from different clock roots. The i.MX6 reference manuals state that changing clock muxers can cause glitches but are silent about changing dividers. But tests showed that these glitches can definitely happen on i.MX6ULL. For i.MX7D/8MM in turn, the manual guarantees that no glitches can happen when changing dividers. Co-developed-by: Stefan Riedmueller Signed-off-by: Stefan Riedmueller Signed-off-by: Christian Eggers Cc: stable@vger.kernel.org Acked-by: Han Xu Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211102202022.15551-2-ceggers@arri= .de Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 28 ++++++++++++++++++++++++= +--- 1 file changed, 25 insertions(+), 3 deletions(-) --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c @@ -713,14 +713,32 @@ static void gpmi_nfc_compute_timings(str (use_half_period ? BM_GPMI_CTRL1_HALF_PERIOD : 0); } =20 -static void gpmi_nfc_apply_timings(struct gpmi_nand_data *this) +static int gpmi_nfc_apply_timings(struct gpmi_nand_data *this) { struct gpmi_nfc_hardware_timing *hw =3D &this->hw; struct resources *r =3D &this->resources; void __iomem *gpmi_regs =3D r->gpmi_regs; unsigned int dll_wait_time_us; + int ret; + + /* Clock dividers do NOT guarantee a clean clock signal on its output + * during the change of the divide factor on i.MX6Q/UL/SX. On i.MX7/8, + * all clock dividers provide these guarantee. + */ + if (GPMI_IS_MX6Q(this) || GPMI_IS_MX6SX(this)) + clk_disable_unprepare(r->clock[0]); + + ret =3D clk_set_rate(r->clock[0], hw->clk_rate); + if (ret) { + dev_err(this->dev, "cannot set clock rate to %lu Hz: %d\n", hw->clk_rate= , ret); + return ret; + } =20 - clk_set_rate(r->clock[0], hw->clk_rate); + if (GPMI_IS_MX6Q(this) || GPMI_IS_MX6SX(this)) { + ret =3D clk_prepare_enable(r->clock[0]); + if (ret) + return ret; + } =20 writel(hw->timing0, gpmi_regs + HW_GPMI_TIMING0); writel(hw->timing1, gpmi_regs + HW_GPMI_TIMING1); @@ -739,6 +757,8 @@ static void gpmi_nfc_apply_timings(struc =20 /* Wait for the DLL to settle. */ udelay(dll_wait_time_us); + + return 0; } =20 static int gpmi_setup_interface(struct nand_chip *chip, int chipnr, @@ -2278,7 +2298,9 @@ static int gpmi_nfc_exec_op(struct nand_ */ if (this->hw.must_apply_timings) { this->hw.must_apply_timings =3D false; - gpmi_nfc_apply_timings(this); + ret =3D gpmi_nfc_apply_timings(this); + if (ret) + return ret; } =20 dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3966CC433F5 for ; Mon, 24 Jan 2022 23:29:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850267AbiAXX1o (ORCPT ); Mon, 24 Jan 2022 18:27:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587671AbiAXW30 (ORCPT ); Mon, 24 Jan 2022 17:29:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9071C0E531A; Mon, 24 Jan 2022 12:54:57 -0800 (PST) Received: from smtp.kernel.org (relay.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 7DE24B81218; Mon, 24 Jan 2022 20:54:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC4CCC340E5; Mon, 24 Jan 2022 20:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057696; bh=50brnauWdiAtjqcwyntiqDSwqdYnjzoEqcJ97b19AFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N9Od5PFscBQCk+um7p7rx3UDs4zAPiZKH37J+81aqIfBRMneAqgeIus6HMqJ7d9ZC OzAUF4+tAG/mInb/obeKSCMya2bWVcDliquVc3PaEodWV94bziKuzrtdP8oncvN8gt oWmqdbMMr7DfsmY2KnthOUMZ850o2PrcA6KhlCP0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Riedmueller , Han Xu , Miquel Raynal Subject: [PATCH 5.16 0016/1039] mtd: rawnand: gpmi: Remove explicit default gpmi clock setting for i.MX6 Date: Mon, 24 Jan 2022 19:30:05 +0100 Message-Id: <20220124184125.688761738@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stefan Riedmueller commit aa1baa0e6c1aa4872e481dce4fc7fd6f3dd8496b upstream. There is no need to explicitly set the default gpmi clock rate during boot for the i.MX 6 since this is done during nand_detect anyway. Signed-off-by: Stefan Riedmueller Cc: stable@vger.kernel.org Acked-by: Han Xu Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211102202022.15551-1-ceggers@arri= .de Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 9 --------- 1 file changed, 9 deletions(-) --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c @@ -1052,15 +1052,6 @@ static int gpmi_get_clks(struct gpmi_nan r->clock[i] =3D clk; } =20 - if (GPMI_IS_MX6(this)) - /* - * Set the default value for the gpmi clock. - * - * If you want to use the ONFI nand which is in the - * Synchronous Mode, you should change the clock as you need. - */ - clk_set_rate(r->clock[0], 22000000); - return 0; =20 err_clock: From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 169AEC433FE for ; Mon, 24 Jan 2022 21:28:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451292AbiAXVWh (ORCPT ); Mon, 24 Jan 2022 16:22:37 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48582 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442625AbiAXUzA (ORCPT ); Mon, 24 Jan 2022 15:55:00 -0500 Received: from smtp.kernel.org (relay.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 E0CAC60907; Mon, 24 Jan 2022 20:54:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C08FC340E5; Mon, 24 Jan 2022 20:54:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057699; bh=es4VFNe9AaDnfs8Ou0sM7tYhD3qSg6+pBgcbz0bHUXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eOFEioLRvKZRrpQVJTK6iY5yci28mjq6ud+kMPO9vQGMux3YZ8ujs5bM42JAPOFXR i4nnPyomHNBljIhWzUbACq9+kw033RwNfgp0EYOti3JBwoqGrb+jzA4IjR6ckItuqg rykPACYds5XvfDHAnu8cr9hlMQgUTwJ2bwR+qOA8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Oetken , Miquel Raynal Subject: [PATCH 5.16 0017/1039] mtd: Fixed breaking list in __mtd_del_partition. Date: Mon, 24 Jan 2022 19:30:06 +0100 Message-Id: <20220124184125.723087290@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andreas Oetken commit 2966daf7d253d9904b337b040dd7a43472858b8a upstream. Not the child partition should be removed from the partition list but the partition itself. Otherwise the partition list gets broken and any subsequent remove operations leads to a kernel panic. Fixes: 46b5889cc2c5 ("mtd: implement proper partition handling") Signed-off-by: Andreas Oetken Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211102172604.2921065-1-andreas.oe= tken@siemens-energy.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/mtdpart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -312,7 +312,7 @@ static int __mtd_del_partition(struct mt if (err) return err; =20 - list_del(&child->part.node); + list_del(&mtd->part.node); free_partition(mtd); =20 return 0; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED3D1C43219 for ; Mon, 24 Jan 2022 23:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849338AbiAXXZe (ORCPT ); Mon, 24 Jan 2022 18:25:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587703AbiAXW33 (ORCPT ); Mon, 24 Jan 2022 17:29:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D3B4C047CC3; Mon, 24 Jan 2022 12:55:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 44C14B811FB; Mon, 24 Jan 2022 20:55:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9503C340E5; Mon, 24 Jan 2022 20:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057702; bh=iC3yFsiXLxji/n8wtnpCQ/0JmVUjZqt5fHAV9bJWQ+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eCU78RdKvjiIRBxebQxGAVLHAkbv2982DFtSc8vRExjS7llT+4BLK3HuKCzQ0vYe9 A5RzkSo51bhX7VHgfJQTgv1Uhh9Xc6rz6prizUMOXICJXkob3KCSeocrJQm3nh1RRw o96wYBntg9MPZZVFa+dYV1yWcx/MavocIaaBWBIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Miquel Raynal Subject: [PATCH 5.16 0018/1039] mtd: rawnand: davinci: Dont calculate ECC when reading page Date: Mon, 24 Jan 2022 19:30:07 +0100 Message-Id: <20220124184125.754692636@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Cercueil commit 71e89591502d737c10db2bd4d8fcfaa352552afb upstream. The function nand_davinci_read_page_hwecc_oob_first() does read the ECC data from the OOB area. Therefore it does not need to calculate the ECC as it is already available. Cc: # v5.2 Fixes: a0ac778eb82c ("mtd: rawnand: ingenic: Add support for the JZ4740") Signed-off-by: Paul Cercueil Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211016132228.40254-1-paul@crapoui= llou.net Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/nand/raw/davinci_nand.c | 3 --- 1 file changed, 3 deletions(-) --- a/drivers/mtd/nand/raw/davinci_nand.c +++ b/drivers/mtd/nand/raw/davinci_nand.c @@ -394,7 +394,6 @@ static int nand_davinci_read_page_hwecc_ int eccsteps =3D chip->ecc.steps; uint8_t *p =3D buf; uint8_t *ecc_code =3D chip->ecc.code_buf; - uint8_t *ecc_calc =3D chip->ecc.calc_buf; unsigned int max_bitflips =3D 0; =20 /* Read the OOB area first */ @@ -420,8 +419,6 @@ static int nand_davinci_read_page_hwecc_ if (ret) return ret; =20 - chip->ecc.calculate(chip, p, &ecc_calc[i]); - stat =3D chip->ecc.correct(chip, p, &ecc_code[i], NULL); if (stat =3D=3D -EBADMSG && (chip->ecc.options & NAND_ECC_GENERIC_ERASED_CHECK)) { From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED78AC433FE for ; Mon, 24 Jan 2022 23:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848542AbiAXXWn (ORCPT ); Mon, 24 Jan 2022 18:22:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587714AbiAXW3b (ORCPT ); Mon, 24 Jan 2022 17:29:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF9E5C047CC8; Mon, 24 Jan 2022 12:55:06 -0800 (PST) Received: from smtp.kernel.org (relay.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 4ADC160916; Mon, 24 Jan 2022 20:55:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2034DC340E5; Mon, 24 Jan 2022 20:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057705; bh=zzKbzuFubpHHemI4OYJIDmPJ6QVU/JspdXhTqkh54ZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xq3+b+TUtKKlWRpRBRAZDgPJcgeGOWSkv113E5U07QcQBnioyOhr9FVKJKtF9Nazc TcVDwfVF+idvz7/FHPp11nZKA7tosNN83dvgvb3xTbpNzeWRwPiJx6dnOVHOfYUcG0 iVLWh6hv+VaIEo7QPoeXTw184Shx9IifOOmO/FuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Miquel Raynal Subject: [PATCH 5.16 0019/1039] mtd: rawnand: davinci: Avoid duplicated page read Date: Mon, 24 Jan 2022 19:30:08 +0100 Message-Id: <20220124184125.786487110@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Cercueil commit 9c9d709965385de5a99f84b14bd5860e1541729e upstream. The function nand_davinci_read_page_hwecc_oob_first() first reads the OOB data, extracts the ECC information, programs the ECC hardware before reading the actual data in a loop. Right after the OOB data was read, it called nand_read_page_op() to reset the read cursor to the beginning of the page. This caused the first page to be read twice: in that call, and later in the loop. Address that issue by changing the call to nand_read_page_op() to nand_change_read_column_op(), which will only reset the read cursor. Cc: # v5.2 Fixes: a0ac778eb82c ("mtd: rawnand: ingenic: Add support for the JZ4740") Signed-off-by: Paul Cercueil Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211016132228.40254-2-paul@crapoui= llou.net Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/nand/raw/davinci_nand.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/mtd/nand/raw/davinci_nand.c +++ b/drivers/mtd/nand/raw/davinci_nand.c @@ -401,7 +401,8 @@ static int nand_davinci_read_page_hwecc_ if (ret) return ret; =20 - ret =3D nand_read_page_op(chip, page, 0, NULL, 0); + /* Move read cursor to start of page */ + ret =3D nand_change_read_column_op(chip, 0, NULL, 0, false); if (ret) return ret; =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E68B4C433FE for ; Mon, 24 Jan 2022 21:27:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451426AbiAXVWz (ORCPT ); Mon, 24 Jan 2022 16:22:55 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51530 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442764AbiAXUzL (ORCPT ); Mon, 24 Jan 2022 15:55:11 -0500 Received: from smtp.kernel.org (relay.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 F0056B80CCF; Mon, 24 Jan 2022 20:55:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A9F4C340E5; Mon, 24 Jan 2022 20:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057708; bh=+UqKwQ35sgQOM9w62WCDHOz/u6Y8TNzdLyjcPKVz5Ac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LIP4acmLVJBnSoPHNAtwRuYdylaULmXCstLBo3y5rkUbC4N7in2aYZzIWrhuUe3dA 45bCYnAETWgoEQazHy+dFdqQP2ZmlGdRMIc/+MzC9lNtR0AE+Raus/F+q7KmXm9Mi5 UZxWdRlAhA8HxIbchmHC3N5qnC5i2OvpOXK2Pmo8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Miquel Raynal Subject: [PATCH 5.16 0020/1039] mtd: rawnand: davinci: Rewrite function description Date: Mon, 24 Jan 2022 19:30:09 +0100 Message-Id: <20220124184125.820352097@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Cercueil commit 0697f8441faad552fbeb02d74454b5e7bcc956a2 upstream. The original comment that describes the function nand_davinci_read_page_hwecc_oob_first() is very obscure and it is hard to understand what it is for. Cc: # v5.2 Fixes: a0ac778eb82c ("mtd: rawnand: ingenic: Add support for the JZ4740") Signed-off-by: Paul Cercueil Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211016132228.40254-3-paul@crapoui= llou.net Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/nand/raw/davinci_nand.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/drivers/mtd/nand/raw/davinci_nand.c +++ b/drivers/mtd/nand/raw/davinci_nand.c @@ -372,17 +372,15 @@ correct: } =20 /** - * nand_read_page_hwecc_oob_first - hw ecc, read oob first + * nand_davinci_read_page_hwecc_oob_first - Hardware ECC page read with ECC + * data read from OOB area * @chip: nand chip info structure * @buf: buffer to store read data * @oob_required: caller requires OOB data read to chip->oob_poi * @page: page number to read * - * Hardware ECC for large page chips, require OOB to be read first. For th= is - * ECC mode, the write_page method is re-used from ECC_HW. These methods - * read/write ECC from the OOB area, unlike the ECC_HW_SYNDROME support wi= th - * multiple ECC steps, follows the "infix ECC" scheme and reads/writes ECC= from - * the data area, by overwriting the NAND manufacturer bad block markings. + * Hardware ECC for large page chips, which requires the ECC data to be + * extracted from the OOB before the actual data is read. */ static int nand_davinci_read_page_hwecc_oob_first(struct nand_chip *chip, uint8_t *buf, From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22D47C433EF for ; Mon, 24 Jan 2022 23:29:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850258AbiAXX1n (ORCPT ); Mon, 24 Jan 2022 18:27:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587735AbiAXW3h (ORCPT ); Mon, 24 Jan 2022 17:29:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6475C095405; Mon, 24 Jan 2022 12:55:12 -0800 (PST) Received: from smtp.kernel.org (relay.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 75FDF60916; Mon, 24 Jan 2022 20:55:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A85FC340E5; Mon, 24 Jan 2022 20:55:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057711; bh=m6ghTn5MEElojWEjAHfRtUFtSmV8Q58RWFp1gRVwjwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZvSCwwwCOqNuDtBciFmaV7pasjx+IQXNolwpO01CC/zmIAmwYZJkJi/+sPwYjT20 LzZv0dTeB5KLDHA5MPXgukDoQ/gVaK+YZQ43TV8b0Fhz72bptyckyF36+1nXOkjK8T GqV4SFMzjTK7jnqxiiXWvdAhUj2wYKa/RJ2P3YlY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Miquel Raynal Subject: [PATCH 5.16 0021/1039] mtd: rawnand: Export nand_read_page_hwecc_oob_first() Date: Mon, 24 Jan 2022 19:30:10 +0100 Message-Id: <20220124184125.851098591@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Cercueil commit d8466f73010faf71effb21228ae1cbf577dab130 upstream. Move the function nand_read_page_hwecc_oob_first() (previously nand_davinci_read_page_hwecc_oob_first()) to nand_base.c, and export it as a GPL symbol, so that it can be used by more modules. Cc: # v5.2 Fixes: a0ac778eb82c ("mtd: rawnand: ingenic: Add support for the JZ4740") Signed-off-by: Paul Cercueil Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211016132228.40254-4-paul@crapoui= llou.net Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/nand/raw/davinci_nand.c | 69 -------------------------------= ----- drivers/mtd/nand/raw/nand_base.c | 67 +++++++++++++++++++++++++++++++= +++ include/linux/mtd/rawnand.h | 2 + 3 files changed, 70 insertions(+), 68 deletions(-) --- a/drivers/mtd/nand/raw/davinci_nand.c +++ b/drivers/mtd/nand/raw/davinci_nand.c @@ -371,73 +371,6 @@ correct: return corrected; } =20 -/** - * nand_davinci_read_page_hwecc_oob_first - Hardware ECC page read with ECC - * data read from OOB area - * @chip: nand chip info structure - * @buf: buffer to store read data - * @oob_required: caller requires OOB data read to chip->oob_poi - * @page: page number to read - * - * Hardware ECC for large page chips, which requires the ECC data to be - * extracted from the OOB before the actual data is read. - */ -static int nand_davinci_read_page_hwecc_oob_first(struct nand_chip *chip, - uint8_t *buf, - int oob_required, int page) -{ - struct mtd_info *mtd =3D nand_to_mtd(chip); - int i, eccsize =3D chip->ecc.size, ret; - int eccbytes =3D chip->ecc.bytes; - int eccsteps =3D chip->ecc.steps; - uint8_t *p =3D buf; - uint8_t *ecc_code =3D chip->ecc.code_buf; - unsigned int max_bitflips =3D 0; - - /* Read the OOB area first */ - ret =3D nand_read_oob_op(chip, page, 0, chip->oob_poi, mtd->oobsize); - if (ret) - return ret; - - /* Move read cursor to start of page */ - ret =3D nand_change_read_column_op(chip, 0, NULL, 0, false); - if (ret) - return ret; - - ret =3D mtd_ooblayout_get_eccbytes(mtd, ecc_code, chip->oob_poi, 0, - chip->ecc.total); - if (ret) - return ret; - - for (i =3D 0; eccsteps; eccsteps--, i +=3D eccbytes, p +=3D eccsize) { - int stat; - - chip->ecc.hwctl(chip, NAND_ECC_READ); - - ret =3D nand_read_data_op(chip, p, eccsize, false, false); - if (ret) - return ret; - - stat =3D chip->ecc.correct(chip, p, &ecc_code[i], NULL); - if (stat =3D=3D -EBADMSG && - (chip->ecc.options & NAND_ECC_GENERIC_ERASED_CHECK)) { - /* check for empty pages with bitflips */ - stat =3D nand_check_erased_ecc_chunk(p, eccsize, - &ecc_code[i], - eccbytes, NULL, 0, - chip->ecc.strength); - } - - if (stat < 0) { - mtd->ecc_stats.failed++; - } else { - mtd->ecc_stats.corrected +=3D stat; - max_bitflips =3D max_t(unsigned int, max_bitflips, stat); - } - } - return max_bitflips; -} - /*----------------------------------------------------------------------*/ =20 /* An ECC layout for using 4-bit ECC with small-page flash, storing @@ -647,7 +580,7 @@ static int davinci_nand_attach_chip(stru } else if (chunks =3D=3D 4 || chunks =3D=3D 8) { mtd_set_ooblayout(mtd, nand_get_large_page_ooblayout()); - chip->ecc.read_page =3D nand_davinci_read_page_hwecc_oob_first; + chip->ecc.read_page =3D nand_read_page_hwecc_oob_first; } else { return -EIO; } --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -3161,6 +3161,73 @@ static int nand_read_page_hwecc(struct n } =20 /** + * nand_read_page_hwecc_oob_first - Hardware ECC page read with ECC + * data read from OOB area + * @chip: nand chip info structure + * @buf: buffer to store read data + * @oob_required: caller requires OOB data read to chip->oob_poi + * @page: page number to read + * + * Hardware ECC for large page chips, which requires the ECC data to be + * extracted from the OOB before the actual data is read. + */ +int nand_read_page_hwecc_oob_first(struct nand_chip *chip, uint8_t *buf, + int oob_required, int page) +{ + struct mtd_info *mtd =3D nand_to_mtd(chip); + int i, eccsize =3D chip->ecc.size, ret; + int eccbytes =3D chip->ecc.bytes; + int eccsteps =3D chip->ecc.steps; + uint8_t *p =3D buf; + uint8_t *ecc_code =3D chip->ecc.code_buf; + unsigned int max_bitflips =3D 0; + + /* Read the OOB area first */ + ret =3D nand_read_oob_op(chip, page, 0, chip->oob_poi, mtd->oobsize); + if (ret) + return ret; + + /* Move read cursor to start of page */ + ret =3D nand_change_read_column_op(chip, 0, NULL, 0, false); + if (ret) + return ret; + + ret =3D mtd_ooblayout_get_eccbytes(mtd, ecc_code, chip->oob_poi, 0, + chip->ecc.total); + if (ret) + return ret; + + for (i =3D 0; eccsteps; eccsteps--, i +=3D eccbytes, p +=3D eccsize) { + int stat; + + chip->ecc.hwctl(chip, NAND_ECC_READ); + + ret =3D nand_read_data_op(chip, p, eccsize, false, false); + if (ret) + return ret; + + stat =3D chip->ecc.correct(chip, p, &ecc_code[i], NULL); + if (stat =3D=3D -EBADMSG && + (chip->ecc.options & NAND_ECC_GENERIC_ERASED_CHECK)) { + /* check for empty pages with bitflips */ + stat =3D nand_check_erased_ecc_chunk(p, eccsize, + &ecc_code[i], + eccbytes, NULL, 0, + chip->ecc.strength); + } + + if (stat < 0) { + mtd->ecc_stats.failed++; + } else { + mtd->ecc_stats.corrected +=3D stat; + max_bitflips =3D max_t(unsigned int, max_bitflips, stat); + } + } + return max_bitflips; +} +EXPORT_SYMBOL_GPL(nand_read_page_hwecc_oob_first); + +/** * nand_read_page_syndrome - [REPLACEABLE] hardware ECC syndrome based pag= e read * @chip: nand chip info structure * @buf: buffer to store read data --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -1539,6 +1539,8 @@ int nand_read_data_op(struct nand_chip * bool force_8bit, bool check_only); int nand_write_data_op(struct nand_chip *chip, const void *buf, unsigned int len, bool force_8bit); +int nand_read_page_hwecc_oob_first(struct nand_chip *chip, uint8_t *buf, + int oob_required, int page); =20 /* Scan and identify a NAND device */ int nand_scan_with_ids(struct nand_chip *chip, unsigned int max_chips, From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DD67C41535 for ; Mon, 24 Jan 2022 21:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450933AbiAXVVq (ORCPT ); Mon, 24 Jan 2022 16:21:46 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50404 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442156AbiAXUxg (ORCPT ); Mon, 24 Jan 2022 15:53:36 -0500 Received: from smtp.kernel.org (relay.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 4B189B81063; Mon, 24 Jan 2022 20:53:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BD50C340E5; Mon, 24 Jan 2022 20:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057611; bh=w6SHKE6jX4ZUVWOWECRb9u1Z6a+zZf7mElpRsXhmPcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ASNIidu52vwgs6zqTt0Q9oKlnCTBoAPyEjnr9wXoy7ZODrHEje1/17FYdlUvLF0Gb 1JaONlACoGVSMqBj5WmoiqT+Wv/OlRQbX4bcBbt8bCHsHQoBt4TxoEYSijYkFILZQa yeVYm2yc8UecSSDCaZ0gqAT+Z1vJw1gKEUwfclUc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Miquel Raynal Subject: [PATCH 5.16 0022/1039] mtd: rawnand: ingenic: JZ4740 needs oob_first read page function Date: Mon, 24 Jan 2022 19:30:11 +0100 Message-Id: <20220124184125.880752344@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Cercueil commit 0171480007d64f663aae9226303f1b1e4621229e upstream. The ECC engine on the JZ4740 SoC requires the ECC data to be read before the page; using the default page reading function does not work. Indeed, the old JZ4740 NAND driver (removed in 5.4) did use the 'OOB first' flag that existed back then. Use the newly created nand_read_page_hwecc_oob_first() to address this issue. This issue was not found when the new ingenic-nand driver was developed, most likely because the Device Tree used had the nand-ecc-mode set to "hw_oob_first", which seems to not be supported anymore. Cc: # v5.2 Fixes: a0ac778eb82c ("mtd: rawnand: ingenic: Add support for the JZ4740") Signed-off-by: Paul Cercueil Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211016132228.40254-5-paul@crapoui= llou.net Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c +++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c @@ -32,6 +32,7 @@ struct jz_soc_info { unsigned long addr_offset; unsigned long cmd_offset; const struct mtd_ooblayout_ops *oob_layout; + bool oob_first; }; =20 struct ingenic_nand_cs { @@ -240,6 +241,9 @@ static int ingenic_nand_attach_chip(stru if (chip->bbt_options & NAND_BBT_USE_FLASH) chip->bbt_options |=3D NAND_BBT_NO_OOB; =20 + if (nfc->soc_info->oob_first) + chip->ecc.read_page =3D nand_read_page_hwecc_oob_first; + /* For legacy reasons we use a different layout on the qi,lb60 board. */ if (of_machine_is_compatible("qi,lb60")) mtd_set_ooblayout(mtd, &qi_lb60_ooblayout_ops); @@ -534,6 +538,7 @@ static const struct jz_soc_info jz4740_s .data_offset =3D 0x00000000, .cmd_offset =3D 0x00008000, .addr_offset =3D 0x00010000, + .oob_first =3D true, }; =20 static const struct jz_soc_info jz4725b_soc_info =3D { From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E060BC433F5 for ; Mon, 24 Jan 2022 23:24:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848261AbiAXXWE (ORCPT ); Mon, 24 Jan 2022 18:22:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585400AbiAXWXb (ORCPT ); Mon, 24 Jan 2022 17:23:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 024DEC054327; Mon, 24 Jan 2022 12:53:35 -0800 (PST) Received: from smtp.kernel.org (relay.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 943BF612A5; Mon, 24 Jan 2022 20:53:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76ED4C340E7; Mon, 24 Jan 2022 20:53:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057614; bh=zp/NYWIKoE3tOdV+Shax2CsA4xFUZ7F/J0Kgo/s5+RE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QwEjs399aMahFGomivA6kCJH/ZAhZDcSDJeJ4L5OHkg3s4cgGmEa/piTRZhKMgoiH EUbjnErx4uGLTkfGErUvcwg93RrqQkfcXYTgaqgbo8Cc4zDT7dbB23PCo/Ov3CkFRW MTZSUMAHaV2eo/BpJJzJ5Q8zCOiNlcB90pC/04x4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Alexandre Ghiti , Conor Dooley , Palmer Dabbelt Subject: [PATCH 5.16 0023/1039] riscv: Get rid of MAXPHYSMEM configs Date: Mon, 24 Jan 2022 19:30:12 +0100 Message-Id: <20220124184125.914468792@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexandre Ghiti commit db1503d355a79d1d4255a9996f20e72848b74a56 upstream. CONFIG_MAXPHYSMEM_* are actually never used, even the nommu defconfigs selecting the MAXPHYSMEM_2GB had no effects on PAGE_OFFSET since it was preempted by !MMU case right before. In addition, the move of the kernel mapping at the end of the address space broke the use of MAXPHYSMEM_2G with MMU since it defines PAGE_OFFSET at the same address as the kernel mapping. Reported-by: Geert Uytterhoeven Fixes: 2bfc6cd81bd1 ("riscv: Move kernel mapping outside of linear mapping") Signed-off-by: Alexandre Ghiti Tested-by: Geert Uytterhoeven Tested-by: Conor Dooley Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/Kconfig | 23 ++------------------= --- arch/riscv/configs/nommu_k210_defconfig | 2 -- arch/riscv/configs/nommu_k210_sdcard_defconfig | 2 -- arch/riscv/configs/nommu_virt_defconfig | 1 - 4 files changed, 2 insertions(+), 26 deletions(-) --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -158,10 +158,9 @@ config PA_BITS =20 config PAGE_OFFSET hex - default 0xC0000000 if 32BIT && MAXPHYSMEM_1GB + default 0xC0000000 if 32BIT default 0x80000000 if 64BIT && !MMU - default 0xffffffff80000000 if 64BIT && MAXPHYSMEM_2GB - default 0xffffffe000000000 if 64BIT && MAXPHYSMEM_128GB + default 0xffffffe000000000 if 64BIT =20 config KASAN_SHADOW_OFFSET hex @@ -270,24 +269,6 @@ config MODULE_SECTIONS bool select HAVE_MOD_ARCH_SPECIFIC =20 -choice - prompt "Maximum Physical Memory" - default MAXPHYSMEM_1GB if 32BIT - default MAXPHYSMEM_2GB if 64BIT && CMODEL_MEDLOW - default MAXPHYSMEM_128GB if 64BIT && CMODEL_MEDANY - - config MAXPHYSMEM_1GB - depends on 32BIT - bool "1GiB" - config MAXPHYSMEM_2GB - depends on 64BIT && CMODEL_MEDLOW - bool "2GiB" - config MAXPHYSMEM_128GB - depends on 64BIT && CMODEL_MEDANY - bool "128GiB" -endchoice - - config SMP bool "Symmetric Multi-Processing" help --- a/arch/riscv/configs/nommu_k210_defconfig +++ b/arch/riscv/configs/nommu_k210_defconfig @@ -29,8 +29,6 @@ CONFIG_EMBEDDED=3Dy CONFIG_SLOB=3Dy # CONFIG_MMU is not set CONFIG_SOC_CANAAN=3Dy -CONFIG_SOC_CANAAN_K210_DTB_SOURCE=3D"k210_generic" -CONFIG_MAXPHYSMEM_2GB=3Dy CONFIG_SMP=3Dy CONFIG_NR_CPUS=3D2 CONFIG_CMDLINE=3D"earlycon console=3DttySIF0" --- a/arch/riscv/configs/nommu_k210_sdcard_defconfig +++ b/arch/riscv/configs/nommu_k210_sdcard_defconfig @@ -21,8 +21,6 @@ CONFIG_EMBEDDED=3Dy CONFIG_SLOB=3Dy # CONFIG_MMU is not set CONFIG_SOC_CANAAN=3Dy -CONFIG_SOC_CANAAN_K210_DTB_SOURCE=3D"k210_generic" -CONFIG_MAXPHYSMEM_2GB=3Dy CONFIG_SMP=3Dy CONFIG_NR_CPUS=3D2 CONFIG_CMDLINE=3D"earlycon console=3DttySIF0 rootdelay=3D2 root=3D/dev/mmc= blk0p1 ro" --- a/arch/riscv/configs/nommu_virt_defconfig +++ b/arch/riscv/configs/nommu_virt_defconfig @@ -27,7 +27,6 @@ CONFIG_SLOB=3Dy # CONFIG_SLAB_MERGE_DEFAULT is not set # CONFIG_MMU is not set CONFIG_SOC_VIRT=3Dy -CONFIG_MAXPHYSMEM_2GB=3Dy CONFIG_SMP=3Dy CONFIG_CMDLINE=3D"root=3D/dev/vda rw earlycon=3Duart8250,mmio,0x10000000,1= 15200n8 console=3DttyS0" CONFIG_CMDLINE_FORCE=3Dy From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24959C433F5 for ; Mon, 24 Jan 2022 23:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848280AbiAXXWH (ORCPT ); Mon, 24 Jan 2022 18:22:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585397AbiAXWXb (ORCPT ); Mon, 24 Jan 2022 17:23:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAF54C054329; Mon, 24 Jan 2022 12:53:37 -0800 (PST) Received: from smtp.kernel.org (relay.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 6DA0B611F9; Mon, 24 Jan 2022 20:53:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78C85C340E5; Mon, 24 Jan 2022 20:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057616; bh=+ZEnUcY7+RPgzxA8XBOKMNeE7kGEnqhjp3FKXau1vAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IB0eJpnu0bsmX/mTqqlmEbihnH5WC8iHsY7kat/fuX2vItp1M+4Gj2iJfOjV1F6TV uk+2r8OMo5D27UbC9Axukv5Q9xNHPJ78FWGMVgpTIxYo/cWRMn5ZNiVBuLDpGDKCBc /n7oW/60R/Y+/0Ei+C+WbgvG2Ouy3fAHQg94w3go= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Borowski , Anup Patel , Sean Christopherson , Palmer Dabbelt Subject: [PATCH 5.16 0024/1039] RISC-V: Use common riscv_cpuid_to_hartid_mask() for both SMP=y and SMP=n Date: Mon, 24 Jan 2022 19:30:13 +0100 Message-Id: <20220124184125.950908186@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 869c70609248102f3a2e95a39b6233ff6ea2c932 upstream. Use what is currently the SMP=3Dy version of riscv_cpuid_to_hartid_mask() for both SMP=3Dy and SMP=3Dn to fix a build failure with KVM=3Dm and SMP=3D= n due to boot_cpu_hartid not being exported. This also fixes a second bug where the SMP=3Dn version assumes the sole CPU in the system is in the incoming mask, which may not hold true in kvm_riscv_vcpu_sbi_ecall() if the KVM guest VM has multiple vCPUs (on a SMP=3Dn system). Fixes: 1ef46c231df4 ("RISC-V: Implement new SBI v0.2 extensions") Reported-by: Adam Borowski Reviewed-by: Anup Patel Signed-off-by: Sean Christopherson Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/include/asm/smp.h | 10 ++-------- arch/riscv/kernel/setup.c | 10 ++++++++++ arch/riscv/kernel/smp.c | 10 ---------- 3 files changed, 12 insertions(+), 18 deletions(-) --- a/arch/riscv/include/asm/smp.h +++ b/arch/riscv/include/asm/smp.h @@ -43,7 +43,6 @@ void arch_send_call_function_ipi_mask(st void arch_send_call_function_single_ipi(int cpu); =20 int riscv_hartid_to_cpuid(int hartid); -void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *= out); =20 /* Set custom IPI operations */ void riscv_set_ipi_ops(const struct riscv_ipi_ops *ops); @@ -85,13 +84,6 @@ static inline unsigned long cpuid_to_har return boot_cpu_hartid; } =20 -static inline void riscv_cpuid_to_hartid_mask(const struct cpumask *in, - struct cpumask *out) -{ - cpumask_clear(out); - cpumask_set_cpu(boot_cpu_hartid, out); -} - static inline void riscv_set_ipi_ops(const struct riscv_ipi_ops *ops) { } @@ -102,6 +94,8 @@ static inline void riscv_clear_ipi(void) =20 #endif /* CONFIG_SMP */ =20 +void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *= out); + #if defined(CONFIG_HOTPLUG_CPU) && (CONFIG_SMP) bool cpu_has_hotplug(unsigned int cpu); #else --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -59,6 +59,16 @@ atomic_t hart_lottery __section(".sdata" unsigned long boot_cpu_hartid; static DEFINE_PER_CPU(struct cpu, cpu_devices); =20 +void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *= out) +{ + int cpu; + + cpumask_clear(out); + for_each_cpu(cpu, in) + cpumask_set_cpu(cpuid_to_hartid_map(cpu), out); +} +EXPORT_SYMBOL_GPL(riscv_cpuid_to_hartid_mask); + /* * Place kernel memory regions on the resource tree so that * kexec-tools can retrieve them from /proc/iomem. While there --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -59,16 +59,6 @@ int riscv_hartid_to_cpuid(int hartid) return -ENOENT; } =20 -void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *= out) -{ - int cpu; - - cpumask_clear(out); - for_each_cpu(cpu, in) - cpumask_set_cpu(cpuid_to_hartid_map(cpu), out); -} -EXPORT_SYMBOL_GPL(riscv_cpuid_to_hartid_mask); - bool arch_match_cpu_phys_id(int cpu, u64 phys_id) { return phys_id =3D=3D cpuid_to_hartid_map(cpu); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B192CC433FE for ; Mon, 24 Jan 2022 21:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450954AbiAXVVu (ORCPT ); Mon, 24 Jan 2022 16:21:50 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47078 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442172AbiAXUxl (ORCPT ); Mon, 24 Jan 2022 15:53:41 -0500 Received: from smtp.kernel.org (relay.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 A69D960C60; Mon, 24 Jan 2022 20:53:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 775F7C340E7; Mon, 24 Jan 2022 20:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057620; bh=j6BIUp+UvD5pzXwiUtAQyP7yzx8R7qTuo7sUGKPGpXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=12cZUUAzoKdelutUtKMh1uglytB5e05tsjrjb8TmKFDmwWx5xVYWFzhsY/bUQku5r fVggF+D6TvF7PjI+m9dye+d0nEC9dAwsvQ6MxiaQ3x1JQ/mbkjQc3nBg942Ods3AM/ u6EIkJ6xQe3gmbt2aZQjAogA51g6MtSh6WLd2YMw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Kossifidis , Palmer Dabbelt Subject: [PATCH 5.16 0025/1039] riscv: try to allocate crashkern region from 32bit addressible memory Date: Mon, 24 Jan 2022 19:30:14 +0100 Message-Id: <20220124184125.982757510@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Kossifidis commit decf89f86ecd3c3c3de81c562010d5797bea3de1 upstream. When allocating crash kernel region without explicitly specifying its base address/size, memblock_phys_alloc_range will attempt to allocate memory top to bottom (memblock.bottom_up is false), so the crash kernel region will end up in highmem on 64bit systems. This way swiotlb can't work on the crash kernel, since there won't be any 32bit addressible memory available for the bounce buffers. Try to allocate 32bit addressible memory if available, for the crash kernel by restricting the top search address to be less than SZ_4G. If that fails fallback to the previous behavior. I tested this on HiFive Unmatched where the pci-e controller needs swiotlb to work, with this patch it's possible to access the pci-e controller on crash kernel and mount the rootfs from the nvme. Signed-off-by: Nick Kossifidis Fixes: e53d28180d4d ("RISC-V: Add kdump support") Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/mm/init.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -812,13 +812,22 @@ static void __init reserve_crashkernel(v /* * Current riscv boot protocol requires 2MB alignment for * RV64 and 4MB alignment for RV32 (hugepage size) + * + * Try to alloc from 32bit addressible physical memory so that + * swiotlb can work on the crash kernel. */ crash_base =3D memblock_phys_alloc_range(crash_size, PMD_SIZE, - search_start, search_end); + search_start, + min(search_end, (unsigned long) SZ_4G)); if (crash_base =3D=3D 0) { - pr_warn("crashkernel: couldn't allocate %lldKB\n", - crash_size >> 10); - return; + /* Try again without restricting region to 32bit addressible memory */ + crash_base =3D memblock_phys_alloc_range(crash_size, PMD_SIZE, + search_start, search_end); + if (crash_base =3D=3D 0) { + pr_warn("crashkernel: couldn't allocate %lldKB\n", + crash_size >> 10); + return; + } } =20 pr_info("crashkernel: reserved 0x%016llx - 0x%016llx (%lld MB)\n", From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAC58C433FE for ; Mon, 24 Jan 2022 23:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848200AbiAXXV5 (ORCPT ); Mon, 24 Jan 2022 18:21:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585427AbiAXWXd (ORCPT ); Mon, 24 Jan 2022 17:23:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64ABDC054331; Mon, 24 Jan 2022 12:53:45 -0800 (PST) Received: from smtp.kernel.org (relay.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 2E806B81218; Mon, 24 Jan 2022 20:53:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A9E4C340ED; Mon, 24 Jan 2022 20:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057623; bh=sPzD3sIHCoQZ6kq2zRn0RcdzuU13RsPBbpmhmt4Sj7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gBJhMhpUwx3GDTbbjD+vQpF544o1mBEsyiDzzzoYyZZxvEWavO2Jw5H4uoKFqCy7k psnSlOghs8HX276w87l5XdWe3kiWaol8sR/rvZLtR11SHzDwb4k0A6eNCMrqszV/W1 UrmFxiM6kK/hTlkBAYziXqMrR/tHsOJfvB7M7s80= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Kossifidis , Alexandre Ghiti , Palmer Dabbelt Subject: [PATCH 5.16 0026/1039] riscv: Dont use va_pa_offset on kdump Date: Mon, 24 Jan 2022 19:30:15 +0100 Message-Id: <20220124184126.019245044@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Kossifidis commit a11c07f032a0e9a562a32ece73af96b0e754c4b3 upstream. On kdump instead of using an intermediate step to relocate the kernel, that lives in a "control buffer" outside the current kernel's mapping, we jump to the crash kernel directly by calling riscv_kexec_norelocate(). The current implementation uses va_pa_offset while switching to physical addressing, however since we moved the kernel outside the linear mapping this won't work anymore since riscv_kexec_norelocate() is part of the kernel mapping and we should use kernel_map.va_kernel_pa_offset, and also take XIP kernel into account. We don't really need to use va_pa_offset on riscv_kexec_norelocate, we can just set STVEC to the physical address of the new kernel instead and let the hart jump to the new kernel on the next instruction after setting SATP to zero. This fixes kdump and is also simpler/cleaner. I tested this on the latest qemu and HiFive Unmatched and works as expected. Fixes: 2bfc6cd81bd1 ("riscv: Move kernel mapping outside of linear mapping") Signed-off-by: Nick Kossifidis Reviewed-by: Alexandre Ghiti Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/kernel/kexec_relocate.S | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) --- a/arch/riscv/kernel/kexec_relocate.S +++ b/arch/riscv/kernel/kexec_relocate.S @@ -159,25 +159,15 @@ SYM_CODE_START(riscv_kexec_norelocate) * s0: (const) Phys address to jump to * s1: (const) Phys address of the FDT image * s2: (const) The hartid of the current hart - * s3: (const) kernel_map.va_pa_offset, used when switching MMU off */ mv s0, a1 mv s1, a2 mv s2, a3 - mv s3, a4 =20 /* Disable / cleanup interrupts */ csrw CSR_SIE, zero csrw CSR_SIP, zero =20 - /* Switch to physical addressing */ - la s4, 1f - sub s4, s4, s3 - csrw CSR_STVEC, s4 - csrw CSR_SATP, zero - -.align 2 -1: /* Pass the arguments to the next kernel / Cleanup*/ mv a0, s2 mv a1, s1 @@ -214,7 +204,15 @@ SYM_CODE_START(riscv_kexec_norelocate) csrw CSR_SCAUSE, zero csrw CSR_SSCRATCH, zero =20 - jalr zero, a2, 0 + /* + * Switch to physical addressing + * This will also trigger a jump to CSR_STVEC + * which in this case is the address of the new + * kernel. + */ + csrw CSR_STVEC, a2 + csrw CSR_SATP, zero + SYM_CODE_END(riscv_kexec_norelocate) =20 .section ".rodata" From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16CC8C433FE for ; Mon, 24 Jan 2022 23:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1847158AbiAXXSo (ORCPT ); Mon, 24 Jan 2022 18:18:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585442AbiAXWXd (ORCPT ); Mon, 24 Jan 2022 17:23:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82181C04189A; Mon, 24 Jan 2022 12:53:48 -0800 (PST) Received: from smtp.kernel.org (relay.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 3E560B81218; Mon, 24 Jan 2022 20:53:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 720DBC340E5; Mon, 24 Jan 2022 20:53:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057626; bh=E+29dWAS2bNGWEVBTIKKRP7OxbGQOJmSmmqhxe69i2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BeF8sHTQBI2shzoqeLW9ayyVfDISZ2Q6x9nloNAlZxF2OA2ZiUSnzxs8wYYf65O2/ wyiT9cb7izFbTJWRVAwvX8Sv38FUw8anVIvAY7F4CzlnK/GOVtT8hnRSfhiWmt5K9n wuiDllbrutCZq9yLtkkbYjy3IsRG3uSXPIHygf6Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Kossifidis , Palmer Dabbelt Subject: [PATCH 5.16 0027/1039] riscv: use hart id instead of cpu id on machine_kexec Date: Mon, 24 Jan 2022 19:30:16 +0100 Message-Id: <20220124184126.052139899@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Kossifidis commit 0e105f1d0037d677dff3c697d22f9551e6c39af8 upstream. raw_smp_processor_id() doesn't return the hart id as stated in arch/riscv/include/asm/smp.h, use smp_processor_id() instead to get the cpu id, and cpuid_to_hartid_map() to pass the hart id to the next kernel. This fixes kexec on HiFive Unleashed/Unmatched where cpu ids and hart ids don't match (on qemu-virt they match). Fixes: fba8a8674f68 ("RISC-V: Add kexec support") Signed-off-by: Nick Kossifidis Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/kernel/machine_kexec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/riscv/kernel/machine_kexec.c +++ b/arch/riscv/kernel/machine_kexec.c @@ -169,7 +169,8 @@ machine_kexec(struct kimage *image) struct kimage_arch *internal =3D &image->arch; unsigned long jump_addr =3D (unsigned long) image->start; unsigned long first_ind_entry =3D (unsigned long) &image->head; - unsigned long this_hart_id =3D raw_smp_processor_id(); + unsigned long this_cpu_id =3D smp_processor_id(); + unsigned long this_hart_id =3D cpuid_to_hartid_map(this_cpu_id); unsigned long fdt_addr =3D internal->fdt_addr; void *control_code_buffer =3D page_address(image->control_code_page); riscv_kexec_method kexec_method =3D NULL; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9661C3526D for ; Mon, 24 Jan 2022 23:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848228AbiAXXWB (ORCPT ); Mon, 24 Jan 2022 18:22:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585424AbiAXWXb (ORCPT ); Mon, 24 Jan 2022 17:23:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1CE8C04189C; Mon, 24 Jan 2022 12:53:50 -0800 (PST) Received: from smtp.kernel.org (relay.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 45B51B811FB; Mon, 24 Jan 2022 20:53:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82EC5C340E5; Mon, 24 Jan 2022 20:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057629; bh=QjAv+mVi3dI62MzHUFz7B9G4FS95ehWT/yUknSVrAwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E8/yhqkSmwH+cz7jHIpLEntlFSlNqJgxVAJPzuKIWCjGYbNAugNSktBTv3oItVZOw MPD3J/xsvap3V5QWQ7OJRBBt1w+cfj7odnD3/SH8yK/0pQnxUv81ZqyJGBZnHsPrwE e2enNCaFKxjZGVCp6vrXLoSHbbe43M3hKqe0UjJU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jisheng Zhang , Alexandre Ghiti , Palmer Dabbelt Subject: [PATCH 5.16 0028/1039] riscv: mm: fix wrong phys_ram_base value for RV64 Date: Mon, 24 Jan 2022 19:30:17 +0100 Message-Id: <20220124184126.086370772@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jisheng Zhang commit b0fd4b1bf995172b9efcee23600d4f69571c321c upstream. Currently, if 64BIT and !XIP_KERNEL, the phys_ram_base is always 0, no matter the real start of dram reported by memblock is. Fixes: 6d7f91d914bc ("riscv: Get rid of CONFIG_PHYS_RAM_BASE in kernel phys= ical address conversion") Signed-off-by: Jisheng Zhang Reviewed-by: Alexandre Ghiti Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/mm/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -187,10 +187,10 @@ static void __init setup_bootmem(void) =20 =20 phys_ram_end =3D memblock_end_of_DRAM(); -#ifndef CONFIG_64BIT #ifndef CONFIG_XIP_KERNEL phys_ram_base =3D memblock_start_of_DRAM(); #endif +#ifndef CONFIG_64BIT /* * memblock allocator is not aware of the fact that last 4K bytes of * the addressable memory can not be mapped because of IS_ERR_VALUE From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52CC7C43217 for ; Mon, 24 Jan 2022 21:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451516AbiAXVXF (ORCPT ); Mon, 24 Jan 2022 16:23:05 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50626 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442227AbiAXUxy (ORCPT ); Mon, 24 Jan 2022 15:53:54 -0500 Received: from smtp.kernel.org (relay.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 50A1DB810A8; Mon, 24 Jan 2022 20:53:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 749D3C340E5; Mon, 24 Jan 2022 20:53:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057632; bh=UxwUpDXJ4axt9oqEZOsHQYJIuHllOhKTqnBfWUdnq5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rnvjZFJXt/WmuWsrHIlPtL5XOsNZoThAIF8G3dUTVYdtW5rMePWwfytnGglHPmyRe Xl9zkp3+0ejCmb93FOlT4kf1rQ+7FS5xLoqWqEH3X4f1xKwBA4uPz84/DjgfyoV3KD 6Ud58JqnRoG5HkHSxY9t7YqVEvZVHb8Dkr0vdeB8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas De Marchi , Bjorn Helgaas Subject: [PATCH 5.16 0029/1039] x86/gpu: Reserve stolen memory for first integrated Intel GPU Date: Mon, 24 Jan 2022 19:30:18 +0100 Message-Id: <20220124184126.116269503@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lucas De Marchi commit 9c494ca4d3a535f9ca11ad6af1813983c1c6cbdd upstream. "Stolen memory" is memory set aside for use by an Intel integrated GPU. The intel_graphics_quirks() early quirk reserves this memory when it is called for a GPU that appears in the intel_early_ids[] table of integrated GPUs. Previously intel_graphics_quirks() was marked as QFLAG_APPLY_ONCE, so it was called only for the first Intel GPU found. If a discrete GPU happened to be enumerated first, intel_graphics_quirks() was called for it but not for any integrated GPU found later. Therefore, stolen memory for such an integrated GPU was never reserved. For example, this problem occurs in this Alderlake-P (integrated) + DG2 (discrete) topology where the DG2 is found first, but stolen memory is associated with the integrated GPU: - 00:01.0 Bridge `- 03:00.0 DG2 discrete GPU - 00:02.0 Integrated GPU (with stolen memory) Remove the QFLAG_APPLY_ONCE flag and call intel_graphics_quirks() for every Intel GPU. Reserve stolen memory for the first GPU that appears in intel_early_ids[]. [bhelgaas: commit log, add code comment, squash in https://lore.kernel.org/r/20220118190558.2ququ4vdfjuahicm@ldmartin-desk2] Link: https://lore.kernel.org/r/20220114002843.2083382-1-lucas.demarchi@int= el.com Signed-off-by: Lucas De Marchi Signed-off-by: Bjorn Helgaas Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/early-quirks.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -515,6 +515,7 @@ static const struct intel_early_ops gen1 .stolen_size =3D gen9_stolen_size, }; =20 +/* Intel integrated GPUs for which we need to reserve "stolen memory" */ static const struct pci_device_id intel_early_ids[] __initconst =3D { INTEL_I830_IDS(&i830_early_ops), INTEL_I845G_IDS(&i845_early_ops), @@ -591,6 +592,13 @@ static void __init intel_graphics_quirks u16 device; int i; =20 + /* + * Reserve "stolen memory" for an integrated GPU. If we've already + * found one, there's nothing to do for other (discrete) GPUs. + */ + if (resource_size(&intel_graphics_stolen_res)) + return; + device =3D read_pci_config_16(num, slot, func, PCI_DEVICE_ID); =20 for (i =3D 0; i < ARRAY_SIZE(intel_early_ids); i++) { @@ -703,7 +711,7 @@ static struct chipset early_qrk[] __init { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA, PCI_ANY_ID, - QFLAG_APPLY_ONCE, intel_graphics_quirks }, + 0, intel_graphics_quirks }, /* * HPET on the current version of the Baytrail platform has accuracy * problems: it will halt in deep idle state - so we disable it. From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B716C3525A for ; Mon, 24 Jan 2022 23:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848149AbiAXXVv (ORCPT ); Mon, 24 Jan 2022 18:21:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585937AbiAXWZX (ORCPT ); Mon, 24 Jan 2022 17:25:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C380C0418AD; Mon, 24 Jan 2022 12:53:57 -0800 (PST) Received: from smtp.kernel.org (relay.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 4A96EB81057; Mon, 24 Jan 2022 20:53:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60986C36AE3; Mon, 24 Jan 2022 20:53:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057635; bh=coNUTtreSapjjg9ezr4KWHjBcWf3lunj23LcLPSUqUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t9svWaAy5agR16Wyk0hmAwGgZLOlIgZCETP1K5pMJxhPu/4Aufjyean0UhOGOfVrC 23x++kzL/OiBCbm9aoOdC/lyR6zziuc1Pf+TBAx1BUmO+IQb0mIA6E4UZ2fFIH+K0a hul3rOajVXsbPfNnNQD9zmf7fr/5VAJimjIUoY38= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bedirhan KURT , Louvian Lyndal , Peter Cordes , Ammar Faizi , Willy Tarreau , "Paul E. McKenney" Subject: [PATCH 5.16 0030/1039] tools/nolibc: x86-64: Fix startup code bug Date: Mon, 24 Jan 2022 19:30:19 +0100 Message-Id: <20220124184126.148559174@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ammar Faizi commit 937ed91c712273131de6d2a02caafd3ee84e0c72 upstream. Before this patch, the `_start` function looks like this: ``` 0000000000001170 <_start>: 1170: pop %rdi 1171: mov %rsp,%rsi 1174: lea 0x8(%rsi,%rdi,8),%rdx 1179: and $0xfffffffffffffff0,%rsp 117d: sub $0x8,%rsp 1181: call 1000
1186: movzbq %al,%rdi 118a: mov $0x3c,%rax 1191: syscall 1193: hlt 1194: data16 cs nopw 0x0(%rax,%rax,1) 119f: nop ``` Note the "and" to %rsp with $-16, it makes the %rsp be 16-byte aligned, but then there is a "sub" with $0x8 which makes the %rsp no longer 16-byte aligned, then it calls main. That's the bug! What actually the x86-64 System V ABI mandates is that right before the "call", the %rsp must be 16-byte aligned, not after the "call". So the "sub" with $0x8 here breaks the alignment. Remove it. An example where this rule matters is when the callee needs to align its stack at 16-byte for aligned move instruction, like `movdqa` and `movaps`. If the callee can't align its stack properly, it will result in segmentation fault. x86-64 System V ABI also mandates the deepest stack frame should be zero. Just to be safe, let's zero the %rbp on startup as the content of %rbp may be unspecified when the program starts. Now it looks like this: ``` 0000000000001170 <_start>: 1170: pop %rdi 1171: mov %rsp,%rsi 1174: lea 0x8(%rsi,%rdi,8),%rdx 1179: xor %ebp,%ebp # zero the %rbp 117b: and $0xfffffffffffffff0,%rsp # align the %rsp 117f: call 1000
1184: movzbq %al,%rdi 1188: mov $0x3c,%rax 118f: syscall 1191: hlt 1192: data16 cs nopw 0x0(%rax,%rax,1) 119d: nopl (%rax) ``` Cc: Bedirhan KURT Cc: Louvian Lyndal Reported-by: Peter Cordes Signed-off-by: Ammar Faizi [wt: I did this on purpose due to a misunderstanding of the spec, other archs will thus have to be rechecked, particularly i386] Cc: stable@vger.kernel.org Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/include/nolibc/nolibc.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/tools/include/nolibc/nolibc.h +++ b/tools/include/nolibc/nolibc.h @@ -399,14 +399,20 @@ struct stat { }) =20 /* startup code */ +/* + * x86-64 System V ABI mandates: + * 1) %rsp must be 16-byte aligned right before the function call. + * 2) The deepest stack frame should be zero (the %rbp). + * + */ asm(".section .text\n" ".global _start\n" "_start:\n" "pop %rdi\n" // argc (first arg, %rdi) "mov %rsp, %rsi\n" // argv[] (second arg, %rsi) "lea 8(%rsi,%rdi,8),%rdx\n" // then a NULL then envp (third arg, %rdx) - "and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned w= hen - "sub $8, %rsp\n" // entering the callee + "xor %ebp, %ebp\n" // zero the stack frame + "and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned b= efore call "call main\n" // main() returns the status code, we'll e= xit with it. "movzb %al, %rdi\n" // retrieve exit code from 8 lower bits "mov $60, %rax\n" // NR_exit =3D=3D 60 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB66EC433F5 for ; Mon, 24 Jan 2022 23:18:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385188AbiAXXSE (ORCPT ); Mon, 24 Jan 2022 18:18:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585943AbiAXWZZ (ORCPT ); Mon, 24 Jan 2022 17:25:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D9FEC0418B2; Mon, 24 Jan 2022 12:53:59 -0800 (PST) Received: from smtp.kernel.org (relay.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 42C12B81057; Mon, 24 Jan 2022 20:53:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 631F5C340E5; Mon, 24 Jan 2022 20:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057638; bh=CJ40P4ApaPT+yCkIt+R5SbXdg418MmTbXEyQxB9sxMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cnkm7/wWz8tC0WrcihwoVoXAKxAyUzwOF50zoyR5L2rkF9zD7dvcAmPB0ZE5d5Rko dikfBbKWH03W/UBZ4FYHGxbF4lLyXju4zCA2gOp49mE99Xh/NrN7zhtEnkS7cAy5G9 IChh3uIG/ga0aVHFdrDgW6p6q8o1QNNMPFn6qyhQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , Ard Biesheuvel , Herbert Xu Subject: [PATCH 5.16 0031/1039] crypto: x86/aesni - dont require alignment of data Date: Mon, 24 Jan 2022 19:30:20 +0100 Message-Id: <20220124184126.181559588@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 d480a26bdf872529919e7c30e17f79d0d7b8c4da upstream. x86 AES-NI routines can deal with unaligned data. Crypto context (key, iv etc.) have to be aligned but we take care of that separately by copying it onto the stack. We were feeding unaligned data into crypto routines up until commit 83c83e658863 ("crypto: aesni - refactor scatterlist processing") switched to use the full skcipher API which uses cra_alignmask to decide data alignment. This fixes 21% performance regression in kTLS. Tested by booting with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=3Dy (and running thru various kTLS packets). CC: stable@vger.kernel.org # 5.15+ Fixes: 83c83e658863 ("crypto: aesni - refactor scatterlist processing") Signed-off-by: Jakub Kicinski Acked-by: Ard Biesheuvel Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/crypto/aesni-intel_glue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c @@ -1107,7 +1107,7 @@ static struct aead_alg aesni_aeads[] =3D { .cra_flags =3D CRYPTO_ALG_INTERNAL, .cra_blocksize =3D 1, .cra_ctxsize =3D sizeof(struct aesni_rfc4106_gcm_ctx), - .cra_alignmask =3D AESNI_ALIGN - 1, + .cra_alignmask =3D 0, .cra_module =3D THIS_MODULE, }, }, { @@ -1124,7 +1124,7 @@ static struct aead_alg aesni_aeads[] =3D { .cra_flags =3D CRYPTO_ALG_INTERNAL, .cra_blocksize =3D 1, .cra_ctxsize =3D sizeof(struct generic_gcmaes_ctx), - .cra_alignmask =3D AESNI_ALIGN - 1, + .cra_alignmask =3D 0, .cra_module =3D THIS_MODULE, }, } }; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6FF1C4167B for ; Mon, 24 Jan 2022 23:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356316AbiAXXRk (ORCPT ); Mon, 24 Jan 2022 18:17:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585959AbiAXWZZ (ORCPT ); Mon, 24 Jan 2022 17:25:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DCD6C0418BE; Mon, 24 Jan 2022 12:54:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 0C0C6612CA; Mon, 24 Jan 2022 20:54:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9537C340E5; Mon, 24 Jan 2022 20:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057644; bh=NhTprGcyprwLpWfIqENv8mq2r3cv0BORHm4H5znzBLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LrIh+S2h57PcTgFzqTSJXXfd+lNk6jEfwCXjpccbxyklSyKD4ktKqRAggx8sLK3Gc n99SPVths0vyWhXN6LCQkxfP/VuD+wg997U9lFpZG72j5hwWuh4K3fzG8MVeV2yESm pooZwyb+rmAf6xXMT1+YznnoTs8ARejbgSY8CFVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ammar Faizi , Willy Tarreau , "Paul E. McKenney" Subject: [PATCH 5.16 0032/1039] tools/nolibc: i386: fix initial stack alignment Date: Mon, 24 Jan 2022 19:30:21 +0100 Message-Id: <20220124184126.214759490@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Willy Tarreau commit ebbe0d8a449d183fa43b42d84fcb248e25303985 upstream. After re-checking in the spec and comparing stack offsets with glibc, The last pushed argument must be 16-byte aligned (i.e. aligned before the call) so that in the callee esp+4 is multiple of 16, so the principle is the 32-bit equivalent to what Ammar fixed for x86_64. It's possible that 32-bit code using SSE2 or MMX could have been affected. In addition the frame pointer ought to be zero at the deepest level. Link: https://gitlab.com/x86-psABIs/i386-ABI/-/wikis/Intel386-psABI Cc: Ammar Faizi Cc: stable@vger.kernel.org Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/include/nolibc/nolibc.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/tools/include/nolibc/nolibc.h +++ b/tools/include/nolibc/nolibc.h @@ -583,13 +583,21 @@ struct sys_stat_struct { }) =20 /* startup code */ +/* + * i386 System V ABI mandates: + * 1) last pushed argument must be 16-byte aligned. + * 2) The deepest stack frame should be set to zero + * + */ asm(".section .text\n" ".global _start\n" "_start:\n" "pop %eax\n" // argc (first arg, %eax) "mov %esp, %ebx\n" // argv[] (second arg, %ebx) "lea 4(%ebx,%eax,4),%ecx\n" // then a NULL then envp (third arg, %ecx) - "and $-16, %esp\n" // x86 ABI : esp must be 16-byte aligned w= hen + "xor %ebp, %ebp\n" // zero the stack frame + "and $-16, %esp\n" // x86 ABI : esp must be 16-byte aligned b= efore + "sub $4, %esp\n" // the call instruction (args are aligned) "push %ecx\n" // push all registers on the stack so that= we "push %ebx\n" // support both regparm and plain stack mo= des "push %eax\n" From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7379AC433EF for ; Mon, 24 Jan 2022 21:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451113AbiAXVWJ (ORCPT ); Mon, 24 Jan 2022 16:22:09 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50756 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442284AbiAXUyP (ORCPT ); Mon, 24 Jan 2022 15:54:15 -0500 Received: from smtp.kernel.org (relay.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 DA554B80FA1; Mon, 24 Jan 2022 20:54:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02C7FC340E5; Mon, 24 Jan 2022 20:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057647; bh=TEw8/WP6YfHH4W4x2h4ZS/43zd1x6SlbIuZzOc87T74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oTvuvPuJyUQ/hCLd/wAvOg61VliUAWclFCHWmy3a5uWaplz63dREBJ2F4lRWqYNOG 0MbT9vc5PqdOGn76P1Cv8GTjDOAS9V7ltKPIgCBpTijVwVLxTiOj6KJBql21R4y4Ln +r8YzSZIzMyG/B5BSlHQm+zFRVMk6jp7VF2RCvDE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ammar Faizi , Willy Tarreau , "Paul E. McKenney" Subject: [PATCH 5.16 0033/1039] tools/nolibc: fix incorrect truncation of exit code Date: Mon, 24 Jan 2022 19:30:22 +0100 Message-Id: <20220124184126.244465832@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Willy Tarreau commit de0244ae40ae91145faaf164a4252347607c3711 upstream. Ammar Faizi reported that our exit code handling is wrong. We truncate it to the lowest 8 bits but the syscall itself is expected to take a regular 32-bit signed integer, not an unsigned char. It's the kernel that later truncates it to the lowest 8 bits. The difference is visible in strace, where the program below used to show exit(255) instead of exit(-1): int main(void) { return -1; } This patch applies the fix to all archs. x86_64, i386, arm64, armv7 and mips were all tested and confirmed to work fine now. Risc-v was not tested but the change is trivial and exactly the same as for other archs. Reported-by: Ammar Faizi Cc: stable@vger.kernel.org Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/include/nolibc/nolibc.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) --- a/tools/include/nolibc/nolibc.h +++ b/tools/include/nolibc/nolibc.h @@ -414,7 +414,7 @@ asm(".section .text\n" "xor %ebp, %ebp\n" // zero the stack frame "and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned b= efore call "call main\n" // main() returns the status code, we'll e= xit with it. - "movzb %al, %rdi\n" // retrieve exit code from 8 lower bits + "mov %eax, %edi\n" // retrieve exit code (32 bit) "mov $60, %rax\n" // NR_exit =3D=3D 60 "syscall\n" // really exit "hlt\n" // ensure it does not return @@ -602,9 +602,9 @@ asm(".section .text\n" "push %ebx\n" // support both regparm and plain stack mo= des "push %eax\n" "call main\n" // main() returns the status code in %eax - "movzbl %al, %ebx\n" // retrieve exit code from lower 8 bits - "movl $1, %eax\n" // NR_exit =3D=3D 1 - "int $0x80\n" // exit now + "mov %eax, %ebx\n" // retrieve exit code (32-bit int) + "movl $1, %eax\n" // NR_exit =3D=3D 1 + "int $0x80\n" // exit now "hlt\n" // ensure it does not ""); =20 @@ -788,7 +788,6 @@ asm(".section .text\n" "and %r3, %r1, $-8\n" // AAPCS : sp must be 8-byte aligned in = the "mov %sp, %r3\n" // callee, an bl doesn't push (l= r=3Dpc) "bl main\n" // main() returns the status code, we'll= exit with it. - "and %r0, %r0, $0xff\n" // limit exit code to 8 bits "movs r7, $1\n" // NR_exit =3D=3D 1 "svc $0x00\n" ""); @@ -985,7 +984,6 @@ asm(".section .text\n" "add x2, x2, x1\n" // + argv "and sp, x1, -16\n" // sp must be 16-byte aligned in the cal= lee "bl main\n" // main() returns the status code, we'll= exit with it. - "and x0, x0, 0xff\n" // limit exit code to 8 bits "mov x8, 93\n" // NR_exit =3D=3D 93 "svc #0\n" ""); @@ -1190,7 +1188,7 @@ asm(".section .text\n" "addiu $sp,$sp,-16\n" // the callee expects to save a0..a3 the= re! "jal main\n" // main() returns the status code, we'll= exit with it. "nop\n" // delayed slot - "and $a0, $v0, 0xff\n" // limit exit code to 8 bits + "move $a0, $v0\n" // retrieve 32-bit exit code from v0 "li $v0, 4001\n" // NR_exit =3D=3D 4001 "syscall\n" ".end __start\n" @@ -1388,7 +1386,6 @@ asm(".section .text\n" "add a2,a2,a1\n" // + argv "andi sp,a1,-16\n" // sp must be 16-byte aligned "call main\n" // main() returns the status code, we'll = exit with it. - "andi a0, a0, 0xff\n" // limit exit code to 8 bits "li a7, 93\n" // NR_exit =3D=3D 93 "ecall\n" ""); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27F35C433F5 for ; Mon, 24 Jan 2022 21:28:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451078AbiAXVWE (ORCPT ); Mon, 24 Jan 2022 16:22:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47652 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442282AbiAXUyL (ORCPT ); Mon, 24 Jan 2022 15:54:11 -0500 Received: from smtp.kernel.org (relay.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 4796960B11; Mon, 24 Jan 2022 20:54:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21F93C340E5; Mon, 24 Jan 2022 20:54:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057650; bh=MFXndqI8cxiHslc/dNlSaB1r9JTjhtiZBSwFf6F0MWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RN5XSu4x+4I7lIaV5IqOITU4SiDvbdIq3binhcXMFPTfvsG4iPK5uEcUr4xra2MLE gCwj9JsElybIgnI8IwRJbkfAfYpbY1wAGPSlI+xArmzhF6VWgWK3GXQWBzjiuIshSP C6pMLAEiBmfgClA7S7Kgk2jGAeGgVueJ9Fi/NA6M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Mateusz=20Jo=C5=84czyk?= , Nobuhiro Iwamatsu , Alessandro Zummo , Alexandre Belloni Subject: [PATCH 5.16 0034/1039] rtc: cmos: take rtc_lock while reading from CMOS Date: Mon, 24 Jan 2022 19:30:23 +0100 Message-Id: <20220124184126.276033378@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Mateusz Jo=C5=84czyk commit 454f47ff464325223129b9b5b8d0b61946ec704d upstream. Reading from the CMOS involves writing to the index register and then reading from the data register. Therefore access to the CMOS has to be serialized with rtc_lock. This invocation of CMOS_READ was not serialized, which could cause trouble when other code is accessing CMOS at the same time. Use spin_lock_irq() like the rest of the function. Nothing in kernel modifies the RTC_DM_BINARY bit, so there could be a separate pair of spin_lock_irq() / spin_unlock_irq() before doing the math. Signed-off-by: Mateusz Jo=C5=84czyk Reviewed-by: Nobuhiro Iwamatsu Cc: Alessandro Zummo Cc: Alexandre Belloni Cc: stable@vger.kernel.org Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20211210200131.153887-2-mat.jonczyk@o2.pl Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/rtc/rtc-cmos.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -457,7 +457,10 @@ static int cmos_set_alarm(struct device min =3D t->time.tm_min; sec =3D t->time.tm_sec; =20 + spin_lock_irq(&rtc_lock); rtc_control =3D CMOS_READ(RTC_CONTROL); + spin_unlock_irq(&rtc_lock); + if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { /* Writing 0xff means "don't care" or "match all". */ mon =3D (mon <=3D 12) ? bin2bcd(mon) : 0xff; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45B2EC433EF for ; Mon, 24 Jan 2022 23:19:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1847029AbiAXXSV (ORCPT ); Mon, 24 Jan 2022 18:18:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585997AbiAXWZb (ORCPT ); Mon, 24 Jan 2022 17:25:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABF36C08C5D8; Mon, 24 Jan 2022 12:54:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 49ACD611C2; Mon, 24 Jan 2022 20:54:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C2C5C340E5; Mon, 24 Jan 2022 20:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057653; bh=pOMuClDdtMKtaAUzzkfbJsxX0oBaFCtga5RqV+vM42Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JdB7B/TPgQQDKVc1Fb521n139HvNNlilCJFfCPbB8jLRK3drjTdmJJC0JqH755z3O wUIEjWfO5ATOiIOJiOK19agwCNo8MVX+XeQJHY96Hxd6DxHyyg0vVavRnlLpp1ECG6 b/UfAHzl/UyBcpkiv4rishA9vWgx39CcheKnZi4c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mohammad Athari Bin Ismail , "David S. Miller" Subject: [PATCH 5.16 0035/1039] net: phy: marvell: add Marvell specific PHY loopback Date: Mon, 24 Jan 2022 19:30:24 +0100 Message-Id: <20220124184126.314205688@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mohammad Athari Bin Ismail commit 020a45aff1190c32b1087cd75b57fbf6bff46ea6 upstream. Existing genphy_loopback() is not applicable for Marvell PHY. Besides configuring bit-6 and bit-13 in Page 0 Register 0 (Copper Control Register), it is also required to configure same bits in Page 2 Register 21 (MAC Specific Control Register 2) according to speed of the loopback is operating. Tested working on Marvell88E1510 PHY for all speeds (1000/100/10Mbps). FIXME: Based on trial and error test, it seem 1G need to have delay between soft reset and loopback enablement. Fixes: 014068dcb5b1 ("net: phy: genphy_loopback: add link speed configurati= on") Cc: # 5.15.x Signed-off-by: Mohammad Athari Bin Ismail Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/phy/marvell.c | 56 +++++++++++++++++++++++++++++++++++++++++= ++++- 1 file changed, 55 insertions(+), 1 deletion(-) --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -189,6 +189,8 @@ #define MII_88E1510_GEN_CTRL_REG_1_MODE_RGMII_SGMII 0x4 #define MII_88E1510_GEN_CTRL_REG_1_RESET 0x8000 /* Soft reset */ =20 +#define MII_88E1510_MSCR_2 0x15 + #define MII_VCT5_TX_RX_MDI0_COUPLING 0x10 #define MII_VCT5_TX_RX_MDI1_COUPLING 0x11 #define MII_VCT5_TX_RX_MDI2_COUPLING 0x12 @@ -1932,6 +1934,58 @@ static void marvell_get_stats(struct phy data[i] =3D marvell_get_stat(phydev, i); } =20 +static int m88e1510_loopback(struct phy_device *phydev, bool enable) +{ + int err; + + if (enable) { + u16 bmcr_ctl =3D 0, mscr2_ctl =3D 0; + + if (phydev->speed =3D=3D SPEED_1000) + bmcr_ctl =3D BMCR_SPEED1000; + else if (phydev->speed =3D=3D SPEED_100) + bmcr_ctl =3D BMCR_SPEED100; + + if (phydev->duplex =3D=3D DUPLEX_FULL) + bmcr_ctl |=3D BMCR_FULLDPLX; + + err =3D phy_write(phydev, MII_BMCR, bmcr_ctl); + if (err < 0) + return err; + + if (phydev->speed =3D=3D SPEED_1000) + mscr2_ctl =3D BMCR_SPEED1000; + else if (phydev->speed =3D=3D SPEED_100) + mscr2_ctl =3D BMCR_SPEED100; + + err =3D phy_modify_paged(phydev, MII_MARVELL_MSCR_PAGE, + MII_88E1510_MSCR_2, BMCR_SPEED1000 | + BMCR_SPEED100, mscr2_ctl); + if (err < 0) + return err; + + /* Need soft reset to have speed configuration takes effect */ + err =3D genphy_soft_reset(phydev); + if (err < 0) + return err; + + /* FIXME: Based on trial and error test, it seem 1G need to have + * delay between soft reset and loopback enablement. + */ + if (phydev->speed =3D=3D SPEED_1000) + msleep(1000); + + return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, + BMCR_LOOPBACK); + } else { + err =3D phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, 0); + if (err < 0) + return err; + + return phy_config_aneg(phydev); + } +} + static int marvell_vct5_wait_complete(struct phy_device *phydev) { int i; @@ -3078,7 +3132,7 @@ static struct phy_driver marvell_drivers .get_sset_count =3D marvell_get_sset_count, .get_strings =3D marvell_get_strings, .get_stats =3D marvell_get_stats, - .set_loopback =3D genphy_loopback, + .set_loopback =3D m88e1510_loopback, .get_tunable =3D m88e1011_get_tunable, .set_tunable =3D m88e1011_set_tunable, .cable_test_start =3D marvell_vct7_cable_test_start, From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D153DC433FE for ; Mon, 24 Jan 2022 23:24:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848164AbiAXXVx (ORCPT ); Mon, 24 Jan 2022 18:21:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1586030AbiAXWZd (ORCPT ); Mon, 24 Jan 2022 17:25:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38DF5C035454; Mon, 24 Jan 2022 12:54:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 EA3E2B812A4; Mon, 24 Jan 2022 20:54:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DD6AC340E5; Mon, 24 Jan 2022 20:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057656; bh=l5GlaMQWhaM9tQ49nzfGO/tk9HkHi8Ff5Xjw5ttxKI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fJzvl0d08y0/dI07MyYmLjb44i7kFuQT52ieEtYkowwFppM+k6/hrsgqSjajaR72z xDJn0dgnWdX+Ww33QGm6EMxSW+0VN+ICCsf3oXkZO4sIXvYChOcx1DltJOLWoadTPQ Owv3/PMEPGe6Fhb3/BkZHohc09KKtXyJ8GVuK2Ts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Namjae Jeon , Steve French Subject: [PATCH 5.16 0036/1039] ksmbd: uninitialized variable in create_socket() Date: Mon, 24 Jan 2022 19:30:25 +0100 Message-Id: <20220124184126.345329838@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 b207602fb04537cb21ac38fabd7577eca2fa05ae upstream. The "ksmbd_socket" variable is not initialized on this error path. Cc: stable@vger.kernel.org Fixes: 0626e6641f6b ("cifsd: add server handler for central processing and = tranport layers") Signed-off-by: Dan Carpenter Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ksmbd/transport_tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/ksmbd/transport_tcp.c +++ b/fs/ksmbd/transport_tcp.c @@ -404,7 +404,7 @@ static int create_socket(struct interfac &ksmbd_socket); if (ret) { pr_err("Can't create socket for ipv4: %d\n", ret); - goto out_error; + goto out_clear; } =20 sin.sin_family =3D PF_INET; @@ -462,6 +462,7 @@ static int create_socket(struct interfac =20 out_error: tcp_destroy_socket(ksmbd_socket); +out_clear: iface->ksmbd_socket =3D NULL; return ret; } From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF3DAC433FE for ; Mon, 24 Jan 2022 21:27:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451139AbiAXVWL (ORCPT ); Mon, 24 Jan 2022 16:22:11 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47814 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442338AbiAXUyX (ORCPT ); Mon, 24 Jan 2022 15:54:23 -0500 Received: from smtp.kernel.org (relay.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 3EA76612FC; Mon, 24 Jan 2022 20:54:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24C5CC36AFC; Mon, 24 Jan 2022 20:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057659; bh=2Z0SoDK/JxuIfkyoLIV6jWhnMDf/015SotV8T2bhKis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=id33mj44D/RM2OAY8dAhrs5XHboKjQJeFEj2VlGX/imbfi1h2dJ3LBcg8NkogIhCW UoE6bl8CW45Y2SB78N+vwRk/gIaFLd0qMILHnoM6aGxdqBhrUKlb+4UHCV0zaF+EVG 13n8Jg+lmHjpFKyYqAR4HnYzureV013w+c/P/Scw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Steve French Subject: [PATCH 5.16 0037/1039] ksmbd: fix guest connection failure with nautilus Date: Mon, 24 Jan 2022 19:30:26 +0100 Message-Id: <20220124184126.383266000@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon commit ac090d9c90b087d6fb714e54b2a6dd1e6c373ed6 upstream. MS-SMB2 describe session sign like the following. Session.SigningRequired MUST be set to TRUE under the following conditions: - If the SMB2_NEGOTIATE_SIGNING_REQUIRED bit is set in the SecurityMode field of the client request. - If the SMB2_SESSION_FLAG_IS_GUEST bit is not set in the SessionFlags field and Session.IsAnonymous is FALSE and either Connection.ShouldSign or global RequireMessageSigning is TRUE. When trying guest account connection using nautilus, The login failure happened on session setup. ksmbd does not allow this connection when the user is a guest and the connection sign is set. Just do not set session sign instead of error response as described in the specification. And this change improves the guest connection in Nautilus. Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org # v5.15+ Signed-off-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ksmbd/smb2pdu.c | 64 ++++++++++++++++++++++++------------------------= ----- 1 file changed, 30 insertions(+), 34 deletions(-) --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -1455,11 +1455,6 @@ static int ntlm_authenticate(struct ksmb =20 sess->user =3D user; if (user_guest(sess->user)) { - if (conn->sign) { - ksmbd_debug(SMB, "Guest login not allowed when signing enabled\n"); - return -EPERM; - } - rsp->SessionFlags =3D SMB2_SESSION_FLAG_IS_GUEST_LE; } else { struct authenticate_message *authblob; @@ -1472,38 +1467,39 @@ static int ntlm_authenticate(struct ksmb ksmbd_debug(SMB, "authentication failed\n"); return -EPERM; } + } =20 - /* - * If session state is SMB2_SESSION_VALID, We can assume - * that it is reauthentication. And the user/password - * has been verified, so return it here. - */ - if (sess->state =3D=3D SMB2_SESSION_VALID) { - if (conn->binding) - goto binding_session; - return 0; - } + /* + * If session state is SMB2_SESSION_VALID, We can assume + * that it is reauthentication. And the user/password + * has been verified, so return it here. + */ + if (sess->state =3D=3D SMB2_SESSION_VALID) { + if (conn->binding) + goto binding_session; + return 0; + } =20 - if ((conn->sign || server_conf.enforced_signing) || - (req->SecurityMode & SMB2_NEGOTIATE_SIGNING_REQUIRED)) - sess->sign =3D true; - - if (smb3_encryption_negotiated(conn) && - !(req->Flags & SMB2_SESSION_REQ_FLAG_BINDING)) { - rc =3D conn->ops->generate_encryptionkey(sess); - if (rc) { - ksmbd_debug(SMB, - "SMB3 encryption key generation failed\n"); - return -EINVAL; - } - sess->enc =3D true; - rsp->SessionFlags =3D SMB2_SESSION_FLAG_ENCRYPT_DATA_LE; - /* - * signing is disable if encryption is enable - * on this session - */ - sess->sign =3D false; + if ((rsp->SessionFlags !=3D SMB2_SESSION_FLAG_IS_GUEST_LE && + (conn->sign || server_conf.enforced_signing)) || + (req->SecurityMode & SMB2_NEGOTIATE_SIGNING_REQUIRED)) + sess->sign =3D true; + + if (smb3_encryption_negotiated(conn) && + !(req->Flags & SMB2_SESSION_REQ_FLAG_BINDING)) { + rc =3D conn->ops->generate_encryptionkey(sess); + if (rc) { + ksmbd_debug(SMB, + "SMB3 encryption key generation failed\n"); + return -EINVAL; } + sess->enc =3D true; + rsp->SessionFlags =3D SMB2_SESSION_FLAG_ENCRYPT_DATA_LE; + /* + * signing is disable if encryption is enable + * on this session + */ + sess->sign =3D false; } =20 binding_session: From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2EE4C433F5 for ; Mon, 24 Jan 2022 23:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1847128AbiAXXSe (ORCPT ); Mon, 24 Jan 2022 18:18:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1586055AbiAXWZe (ORCPT ); Mon, 24 Jan 2022 17:25:34 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A3AFC034000; Mon, 24 Jan 2022 12:54:23 -0800 (PST) Received: from smtp.kernel.org (relay.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 26E11611ED; Mon, 24 Jan 2022 20:54:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D735C340E5; Mon, 24 Jan 2022 20:54:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057662; bh=J+KXYCuBSxn16KMxMHIqNdfyCFf5L/O1RLEaiAnQBSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sOwi0pqCvZobkeWDypFPCMOaPhCJcHDg5ffO92C/iQk3wGU5eHfAjRt8AVBR3AmH4 iK38/rQyJkfuU1L9nJl71QtsBO7Bw2qjuO0NfJPnHPXNtd+CJQQNfTbx9Wa3+JFpdl 0Jf1SuctgE0xhhBqc8rd0wSYFXeb9NOXgy4tZnUA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Steve French Subject: [PATCH 5.16 0038/1039] ksmbd: add support for smb2 max credit parameter Date: Mon, 24 Jan 2022 19:30:27 +0100 Message-Id: <20220124184126.414273851@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon commit 004443b3f6d722b455cf963ed7c3edd7f4772405 upstream. Add smb2 max credits parameter to adjust maximum credits value to limit number of outstanding requests. Signed-off-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ksmbd/connection.h | 1 - fs/ksmbd/ksmbd_netlink.h | 1 + fs/ksmbd/smb2misc.c | 2 +- fs/ksmbd/smb2ops.c | 16 ++++++++++++---- fs/ksmbd/smb2pdu.c | 8 ++++---- fs/ksmbd/smb2pdu.h | 1 + fs/ksmbd/smb_common.h | 1 + fs/ksmbd/transport_ipc.c | 2 ++ 8 files changed, 22 insertions(+), 10 deletions(-) --- a/fs/ksmbd/connection.h +++ b/fs/ksmbd/connection.h @@ -62,7 +62,6 @@ struct ksmbd_conn { /* References which are made for this Server object*/ atomic_t r_count; unsigned short total_credits; - unsigned short max_credits; spinlock_t credits_lock; wait_queue_head_t req_running_q; /* Lock to protect requests list*/ --- a/fs/ksmbd/ksmbd_netlink.h +++ b/fs/ksmbd/ksmbd_netlink.h @@ -103,6 +103,7 @@ struct ksmbd_startup_request { * we set the SPARSE_FILES bit (0x40). */ __u32 sub_auth[3]; /* Subauth value for Security ID */ + __u32 smb2_max_credits; /* MAX credits */ __u32 ifc_list_sz; /* interfaces list size */ __s8 ____payload[]; }; --- a/fs/ksmbd/smb2misc.c +++ b/fs/ksmbd/smb2misc.c @@ -326,7 +326,7 @@ static int smb2_validate_credit_charge(s ksmbd_debug(SMB, "Insufficient credit charge, given: %d, needed: %d\n", credit_charge, calc_credit_num); return 1; - } else if (credit_charge > conn->max_credits) { + } else if (credit_charge > conn->vals->max_credits) { ksmbd_debug(SMB, "Too large credit charge: %d\n", credit_charge); return 1; } --- a/fs/ksmbd/smb2ops.c +++ b/fs/ksmbd/smb2ops.c @@ -19,6 +19,7 @@ static struct smb_version_values smb21_s .max_read_size =3D SMB21_DEFAULT_IOSIZE, .max_write_size =3D SMB21_DEFAULT_IOSIZE, .max_trans_size =3D SMB21_DEFAULT_IOSIZE, + .max_credits =3D SMB2_MAX_CREDITS, .large_lock_type =3D 0, .exclusive_lock_type =3D SMB2_LOCKFLAG_EXCLUSIVE, .shared_lock_type =3D SMB2_LOCKFLAG_SHARED, @@ -44,6 +45,7 @@ static struct smb_version_values smb30_s .max_read_size =3D SMB3_DEFAULT_IOSIZE, .max_write_size =3D SMB3_DEFAULT_IOSIZE, .max_trans_size =3D SMB3_DEFAULT_TRANS_SIZE, + .max_credits =3D SMB2_MAX_CREDITS, .large_lock_type =3D 0, .exclusive_lock_type =3D SMB2_LOCKFLAG_EXCLUSIVE, .shared_lock_type =3D SMB2_LOCKFLAG_SHARED, @@ -70,6 +72,7 @@ static struct smb_version_values smb302_ .max_read_size =3D SMB3_DEFAULT_IOSIZE, .max_write_size =3D SMB3_DEFAULT_IOSIZE, .max_trans_size =3D SMB3_DEFAULT_TRANS_SIZE, + .max_credits =3D SMB2_MAX_CREDITS, .large_lock_type =3D 0, .exclusive_lock_type =3D SMB2_LOCKFLAG_EXCLUSIVE, .shared_lock_type =3D SMB2_LOCKFLAG_SHARED, @@ -96,6 +99,7 @@ static struct smb_version_values smb311_ .max_read_size =3D SMB3_DEFAULT_IOSIZE, .max_write_size =3D SMB3_DEFAULT_IOSIZE, .max_trans_size =3D SMB3_DEFAULT_TRANS_SIZE, + .max_credits =3D SMB2_MAX_CREDITS, .large_lock_type =3D 0, .exclusive_lock_type =3D SMB2_LOCKFLAG_EXCLUSIVE, .shared_lock_type =3D SMB2_LOCKFLAG_SHARED, @@ -197,7 +201,6 @@ void init_smb2_1_server(struct ksmbd_con conn->ops =3D &smb2_0_server_ops; conn->cmds =3D smb2_0_server_cmds; conn->max_cmds =3D ARRAY_SIZE(smb2_0_server_cmds); - conn->max_credits =3D SMB2_MAX_CREDITS; conn->signing_algorithm =3D SIGNING_ALG_HMAC_SHA256_LE; =20 if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES) @@ -215,7 +218,6 @@ void init_smb3_0_server(struct ksmbd_con conn->ops =3D &smb3_0_server_ops; conn->cmds =3D smb2_0_server_cmds; conn->max_cmds =3D ARRAY_SIZE(smb2_0_server_cmds); - conn->max_credits =3D SMB2_MAX_CREDITS; conn->signing_algorithm =3D SIGNING_ALG_AES_CMAC_LE; =20 if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES) @@ -240,7 +242,6 @@ void init_smb3_02_server(struct ksmbd_co conn->ops =3D &smb3_0_server_ops; conn->cmds =3D smb2_0_server_cmds; conn->max_cmds =3D ARRAY_SIZE(smb2_0_server_cmds); - conn->max_credits =3D SMB2_MAX_CREDITS; conn->signing_algorithm =3D SIGNING_ALG_AES_CMAC_LE; =20 if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES) @@ -265,7 +266,6 @@ int init_smb3_11_server(struct ksmbd_con conn->ops =3D &smb3_11_server_ops; conn->cmds =3D smb2_0_server_cmds; conn->max_cmds =3D ARRAY_SIZE(smb2_0_server_cmds); - conn->max_credits =3D SMB2_MAX_CREDITS; conn->signing_algorithm =3D SIGNING_ALG_AES_CMAC_LE; =20 if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES) @@ -304,3 +304,11 @@ void init_smb2_max_trans_size(unsigned i smb302_server_values.max_trans_size =3D sz; smb311_server_values.max_trans_size =3D sz; } + +void init_smb2_max_credits(unsigned int sz) +{ + smb21_server_values.max_credits =3D sz; + smb30_server_values.max_credits =3D sz; + smb302_server_values.max_credits =3D sz; + smb311_server_values.max_credits =3D sz; +} --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -308,7 +308,7 @@ int smb2_set_rsp_credits(struct ksmbd_wo =20 hdr->CreditCharge =3D req_hdr->CreditCharge; =20 - if (conn->total_credits > conn->max_credits) { + if (conn->total_credits > conn->vals->max_credits) { hdr->CreditRequest =3D 0; pr_err("Total credits overflow: %d\n", conn->total_credits); return -EINVAL; @@ -329,12 +329,12 @@ int smb2_set_rsp_credits(struct ksmbd_wo if (hdr->Command =3D=3D SMB2_NEGOTIATE) aux_max =3D 0; else - aux_max =3D conn->max_credits - credit_charge; + aux_max =3D conn->vals->max_credits - credit_charge; aux_credits =3D min_t(unsigned short, aux_credits, aux_max); credits_granted =3D credit_charge + aux_credits; =20 - if (conn->max_credits - conn->total_credits < credits_granted) - credits_granted =3D conn->max_credits - + if (conn->vals->max_credits - conn->total_credits < credits_granted) + credits_granted =3D conn->vals->max_credits - conn->total_credits; =20 conn->total_credits +=3D credits_granted; --- a/fs/ksmbd/smb2pdu.h +++ b/fs/ksmbd/smb2pdu.h @@ -980,6 +980,7 @@ int init_smb3_11_server(struct ksmbd_con void init_smb2_max_read_size(unsigned int sz); void init_smb2_max_write_size(unsigned int sz); void init_smb2_max_trans_size(unsigned int sz); +void init_smb2_max_credits(unsigned int sz); =20 bool is_smb2_neg_cmd(struct ksmbd_work *work); bool is_smb2_rsp(struct ksmbd_work *work); --- a/fs/ksmbd/smb_common.h +++ b/fs/ksmbd/smb_common.h @@ -365,6 +365,7 @@ struct smb_version_values { __u32 max_read_size; __u32 max_write_size; __u32 max_trans_size; + __u32 max_credits; __u32 large_lock_type; __u32 exclusive_lock_type; __u32 shared_lock_type; --- a/fs/ksmbd/transport_ipc.c +++ b/fs/ksmbd/transport_ipc.c @@ -301,6 +301,8 @@ static int ipc_server_config_on_startup( init_smb2_max_write_size(req->smb2_max_write); if (req->smb2_max_trans) init_smb2_max_trans_size(req->smb2_max_trans); + if (req->smb2_max_credits) + init_smb2_max_credits(req->smb2_max_credits); =20 ret =3D ksmbd_set_netbios_name(req->netbios_name); ret |=3D ksmbd_set_server_string(req->server_string); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37FA1C433F5 for ; Mon, 24 Jan 2022 21:27:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451153AbiAXVWR (ORCPT ); Mon, 24 Jan 2022 16:22:17 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47958 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442362AbiAXUy1 (ORCPT ); Mon, 24 Jan 2022 15:54:27 -0500 Received: from smtp.kernel.org (relay.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 341156124A; Mon, 24 Jan 2022 20:54:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 162EDC340E5; Mon, 24 Jan 2022 20:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057665; bh=VH5ozs5BLXy+4Jx5uCAGo22XB/FZvRGLoQpaQE8nOHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eI8sr5mxDANRbAuPhmOZIoCOlzgzABC2AQPZSyz5h2Le13Vy4H5Gp+AJGT+kRhBpx nBwYJBl6Ksnq2e6Mv7M80pm0+iSXhrEQeJ8hvI/dHKTcrxYONweeP/sOvcYgeXlZT3 OMlqe4MHyYEPvVi9AdVYwq1Dx+AxyjNYrsejlnPk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Steve French Subject: [PATCH 5.16 0039/1039] ksmbd: move credit charge deduction under processing request Date: Mon, 24 Jan 2022 19:30:28 +0100 Message-Id: <20220124184126.446053646@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon commit 914d7e5709ac59ded70bea7956d408fe2acd7c3c upstream. Moves the credit charge deduction from total_credits under the processing a request. When repeating smb2 lock request and other command request, there will be a problem that ->total_credits does not decrease. Signed-off-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ksmbd/smb2misc.c | 7 ++----- fs/ksmbd/smb2pdu.c | 16 ++++++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) --- a/fs/ksmbd/smb2misc.c +++ b/fs/ksmbd/smb2misc.c @@ -289,7 +289,7 @@ static int smb2_validate_credit_charge(s unsigned int req_len =3D 0, expect_resp_len =3D 0, calc_credit_num, max_l= en; unsigned short credit_charge =3D le16_to_cpu(hdr->CreditCharge); void *__hdr =3D hdr; - int ret; + int ret =3D 0; =20 switch (hdr->Command) { case SMB2_QUERY_INFO: @@ -332,10 +332,7 @@ static int smb2_validate_credit_charge(s } =20 spin_lock(&conn->credits_lock); - if (credit_charge <=3D conn->total_credits) { - conn->total_credits -=3D credit_charge; - ret =3D 0; - } else { + if (credit_charge > conn->total_credits) { ksmbd_debug(SMB, "Insufficient credits granted, given: %u, granted: %u\n= ", credit_charge, conn->total_credits); ret =3D 1; --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -299,9 +299,8 @@ int smb2_set_rsp_credits(struct ksmbd_wo struct smb2_hdr *req_hdr =3D ksmbd_req_buf_next(work); struct smb2_hdr *hdr =3D ksmbd_resp_buf_next(work); struct ksmbd_conn *conn =3D work->conn; - unsigned short credits_requested; + unsigned short credits_requested, aux_max; unsigned short credit_charge, credits_granted =3D 0; - unsigned short aux_max, aux_credits; =20 if (work->send_no_response) return 0; @@ -316,6 +315,13 @@ int smb2_set_rsp_credits(struct ksmbd_wo =20 credit_charge =3D max_t(unsigned short, le16_to_cpu(req_hdr->CreditCharge), 1); + if (credit_charge > conn->total_credits) { + ksmbd_debug(SMB, "Insufficient credits granted, given: %u, granted: %u\n= ", + credit_charge, conn->total_credits); + return -EINVAL; + } + + conn->total_credits -=3D credit_charge; credits_requested =3D max_t(unsigned short, le16_to_cpu(req_hdr->CreditRequest), 1); =20 @@ -325,13 +331,11 @@ int smb2_set_rsp_credits(struct ksmbd_wo * TODO: Need to adjuct CreditRequest value according to * current cpu load */ - aux_credits =3D credits_requested - 1; if (hdr->Command =3D=3D SMB2_NEGOTIATE) - aux_max =3D 0; + aux_max =3D 1; else aux_max =3D conn->vals->max_credits - credit_charge; - aux_credits =3D min_t(unsigned short, aux_credits, aux_max); - credits_granted =3D credit_charge + aux_credits; + credits_granted =3D min_t(unsigned short, credits_requested, aux_max); =20 if (conn->vals->max_credits - conn->total_credits < credits_granted) credits_granted =3D conn->vals->max_credits - From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BD1FC433F5 for ; Mon, 24 Jan 2022 21:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451602AbiAXVXM (ORCPT ); Mon, 24 Jan 2022 16:23:12 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51024 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442407AbiAXUyd (ORCPT ); Mon, 24 Jan 2022 15:54:33 -0500 Received: from smtp.kernel.org (relay.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 08A51B811A9; Mon, 24 Jan 2022 20:54:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27391C340E5; Mon, 24 Jan 2022 20:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057668; bh=4Rcfa26QnKDhYc/Gk76a2mLesjusuoehfEIjDeff2BA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xEqc5CECRqqS4JYCO5KoQxBMvpWKuC45TFUhJK2py8rLe5jvLHL+dEHdqondbHwXF BGcFC52K4nUoGWeIVl8ECt+HR80iPGMo+EK35ePkXeTRSTS6s580SUGvJtfgoh2IHL igMNc08PmsQR7wdKuVX7e4AcLR2DBRP/RxlMxy5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Steve French Subject: [PATCH 5.16 0040/1039] ksmbd: limits exceeding the maximum allowable outstanding requests Date: Mon, 24 Jan 2022 19:30:29 +0100 Message-Id: <20220124184126.488263460@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon commit b589f5db6d4af8f14d70e31e1276b4c017668a26 upstream. If the client ignores the CreditResponse received from the server and continues to send the request, ksmbd limits the requests if it exceeds smb2 max credits. Signed-off-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ksmbd/connection.c | 1 + fs/ksmbd/connection.h | 3 ++- fs/ksmbd/smb2misc.c | 9 +++++++++ fs/ksmbd/smb2pdu.c | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) --- a/fs/ksmbd/connection.c +++ b/fs/ksmbd/connection.c @@ -62,6 +62,7 @@ struct ksmbd_conn *ksmbd_conn_alloc(void atomic_set(&conn->req_running, 0); atomic_set(&conn->r_count, 0); conn->total_credits =3D 1; + conn->outstanding_credits =3D 1; =20 init_waitqueue_head(&conn->req_running_q); INIT_LIST_HEAD(&conn->conns_list); --- a/fs/ksmbd/connection.h +++ b/fs/ksmbd/connection.h @@ -61,7 +61,8 @@ struct ksmbd_conn { atomic_t req_running; /* References which are made for this Server object*/ atomic_t r_count; - unsigned short total_credits; + unsigned int total_credits; + unsigned int outstanding_credits; spinlock_t credits_lock; wait_queue_head_t req_running_q; /* Lock to protect requests list*/ --- a/fs/ksmbd/smb2misc.c +++ b/fs/ksmbd/smb2misc.c @@ -337,7 +337,16 @@ static int smb2_validate_credit_charge(s credit_charge, conn->total_credits); ret =3D 1; } + + if ((u64)conn->outstanding_credits + credit_charge > conn->vals->max_cred= its) { + ksmbd_debug(SMB, "Limits exceeding the maximum allowable outstanding req= uests, given : %u, pending : %u\n", + credit_charge, conn->outstanding_credits); + ret =3D 1; + } else + conn->outstanding_credits +=3D credit_charge; + spin_unlock(&conn->credits_lock); + return ret; } =20 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -322,6 +322,7 @@ int smb2_set_rsp_credits(struct ksmbd_wo } =20 conn->total_credits -=3D credit_charge; + conn->outstanding_credits -=3D credit_charge; credits_requested =3D max_t(unsigned short, le16_to_cpu(req_hdr->CreditRequest), 1); =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A7D5C43219 for ; Mon, 24 Jan 2022 23:24:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848469AbiAXXWe (ORCPT ); Mon, 24 Jan 2022 18:22:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1586851AbiAXW1Z (ORCPT ); Mon, 24 Jan 2022 17:27:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD07BC019B16; Mon, 24 Jan 2022 12:54:32 -0800 (PST) Received: from smtp.kernel.org (relay.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 6D93D61287; Mon, 24 Jan 2022 20:54:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51FEFC36B01; Mon, 24 Jan 2022 20:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057671; bh=olKOp1fP6GqohxFV6u2yGgn8fWqUo03Gd4u6tv86pMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z/1y1uJq8aiwJCwCHHeFVdn0xlCEcLGGEoQl3OZCzluHP5zpN3sSl9ijaZXDbt73D j1/CMdy0rMPKk4Qu6VwSDJtlqHeNWJEA1x/V6PhiUPlBYrXv6OMDxoEoThSASt6ZYW erXCJnlu9hFhHADN3h3xIGEywRlNQ2I5jCWIwkSo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Steve French Subject: [PATCH 5.16 0041/1039] ksmbd: add reserved room in ipc request/response Date: Mon, 24 Jan 2022 19:30:30 +0100 Message-Id: <20220124184126.518506728@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon commit 41dbda16a0902798e732abc6599de256b9dc3b27 upstream. Whenever new parameter is added to smb configuration, It is possible to break the execution of the IPC daemon by mismatch size of request/response. This patch tries to reserve space in ipc request/response in advance to prevent that. Signed-off-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ksmbd/ksmbd_netlink.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/fs/ksmbd/ksmbd_netlink.h +++ b/fs/ksmbd/ksmbd_netlink.h @@ -104,6 +104,7 @@ struct ksmbd_startup_request { */ __u32 sub_auth[3]; /* Subauth value for Security ID */ __u32 smb2_max_credits; /* MAX credits */ + __u32 reserved[128]; /* Reserved room */ __u32 ifc_list_sz; /* interfaces list size */ __s8 ____payload[]; }; @@ -114,7 +115,7 @@ struct ksmbd_startup_request { * IPC request to shutdown ksmbd server. */ struct ksmbd_shutdown_request { - __s32 reserved; + __s32 reserved[16]; }; =20 /* @@ -123,6 +124,7 @@ struct ksmbd_shutdown_request { struct ksmbd_login_request { __u32 handle; __s8 account[KSMBD_REQ_MAX_ACCOUNT_NAME_SZ]; /* user account name */ + __u32 reserved[16]; /* Reserved room */ }; =20 /* @@ -136,6 +138,7 @@ struct ksmbd_login_response { __u16 status; __u16 hash_sz; /* hash size */ __s8 hash[KSMBD_REQ_MAX_HASH_SZ]; /* password hash */ + __u32 reserved[16]; /* Reserved room */ }; =20 /* @@ -144,6 +147,7 @@ struct ksmbd_login_response { struct ksmbd_share_config_request { __u32 handle; __s8 share_name[KSMBD_REQ_MAX_SHARE_NAME]; /* share name */ + __u32 reserved[16]; /* Reserved room */ }; =20 /* @@ -158,6 +162,7 @@ struct ksmbd_share_config_response { __u16 force_directory_mode; __u16 force_uid; __u16 force_gid; + __u32 reserved[128]; /* Reserved room */ __u32 veto_list_sz; __s8 ____payload[]; }; @@ -188,6 +193,7 @@ struct ksmbd_tree_connect_request { __s8 account[KSMBD_REQ_MAX_ACCOUNT_NAME_SZ]; __s8 share[KSMBD_REQ_MAX_SHARE_NAME]; __s8 peer_addr[64]; + __u32 reserved[16]; /* Reserved room */ }; =20 /* @@ -197,6 +203,7 @@ struct ksmbd_tree_connect_response { __u32 handle; __u16 status; __u16 connection_flags; + __u32 reserved[16]; /* Reserved room */ }; =20 /* @@ -205,6 +212,7 @@ struct ksmbd_tree_connect_response { struct ksmbd_tree_disconnect_request { __u64 session_id; /* session id */ __u64 connect_id; /* tree connection id */ + __u32 reserved[16]; /* Reserved room */ }; =20 /* @@ -213,6 +221,7 @@ struct ksmbd_tree_disconnect_request { struct ksmbd_logout_request { __s8 account[KSMBD_REQ_MAX_ACCOUNT_NAME_SZ]; /* user account name */ __u32 account_flags; + __u32 reserved[16]; /* Reserved room */ }; =20 /* From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09A1EC41535 for ; Mon, 24 Jan 2022 23:23:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848014AbiAXXVd (ORCPT ); Mon, 24 Jan 2022 18:21:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1586905AbiAXW1b (ORCPT ); Mon, 24 Jan 2022 17:27:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 390EBC019B20; Mon, 24 Jan 2022 12:54:39 -0800 (PST) Received: from smtp.kernel.org (relay.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 8DAD460B03; Mon, 24 Jan 2022 20:54:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EB40C340E5; Mon, 24 Jan 2022 20:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057678; bh=Z+D5Lb0cITYxKZnNkwCLasS5OuqE492k2Fon+rCWUp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yi/vI76VY1RlBmNAqQUlz/GhXYLTB5C3eDxVUkgaRoHvJDOJZuv4DCqUijGxurIzG D3c2RSu2l4/YZ4ItF/tX9c6j/w7uFnyQYNkx8JRioZPCfLunH2tFHrgk0qthU8oNF5 y+YBE9G0kprERt2g+2U796uwreNePPHNgq+s99U4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0042/1039] media: cec: fix a deadlock situation Date: Mon, 24 Jan 2022 19:30:31 +0100 Message-Id: <20220124184126.550255993@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans Verkuil commit a9e6107616bb8108aa4fc22584a05e69761a91f7 upstream. The cec_devnode struct has a lock meant to serialize access to the fields of this struct. This lock is taken during device node (un)registration and when opening or releasing a filehandle to the device node. When the last open filehandle is closed the cec adapter might be disabled by calling the adap_enable driver callback with the devnode.lock held. However, if during that callback a message or event arrives then the driver will call one of the cec_queue_event() variants in cec-adap.c, and those will take the same devnode.lock to walk the open filehandle list. This obviously causes a deadlock. This is quite easy to reproduce with the cec-gpio driver since that uses the cec-pin framework which generated lots of events and uses a kernel thread for the processing, so when adap_enable is called the thread is still running and can generate events. But I suspect that it might also happen with other drivers if an interrupt arrives signaling e.g. a received message before adap_enable had a chance to disable the interrupts. This patch adds a new mutex to serialize access to the fhs list. When adap_enable() is called the devnode.lock mutex is held, but not devnode.lock_fhs. The event functions in cec-adap.c will now use devnode.lock_fhs instead of devnode.lock, ensuring that it is safe to call those functions from the adap_enable callback. This specific issue only happens if the last open filehandle is closed and the physical address is invalid. This is not something that happens during normal operation, but it does happen when monitoring CEC traffic (e.g. cec-ctl --monitor) with an unconfigured CEC adapter. Signed-off-by: Hans Verkuil Cc: # for v5.13 and up Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/cec/core/cec-adap.c | 38 +++++++++++++++++++++------------= ----- drivers/media/cec/core/cec-api.c | 6 ++++++ drivers/media/cec/core/cec-core.c | 3 +++ include/media/cec.h | 11 +++++++++-- 4 files changed, 39 insertions(+), 19 deletions(-) --- a/drivers/media/cec/core/cec-adap.c +++ b/drivers/media/cec/core/cec-adap.c @@ -161,10 +161,10 @@ static void cec_queue_event(struct cec_a u64 ts =3D ktime_get_ns(); struct cec_fh *fh; =20 - mutex_lock(&adap->devnode.lock); + mutex_lock(&adap->devnode.lock_fhs); list_for_each_entry(fh, &adap->devnode.fhs, list) cec_queue_event_fh(fh, ev, ts); - mutex_unlock(&adap->devnode.lock); + mutex_unlock(&adap->devnode.lock_fhs); } =20 /* Notify userspace that the CEC pin changed state at the given time. */ @@ -178,11 +178,12 @@ void cec_queue_pin_cec_event(struct cec_ }; struct cec_fh *fh; =20 - mutex_lock(&adap->devnode.lock); - list_for_each_entry(fh, &adap->devnode.fhs, list) + mutex_lock(&adap->devnode.lock_fhs); + list_for_each_entry(fh, &adap->devnode.fhs, list) { if (fh->mode_follower =3D=3D CEC_MODE_MONITOR_PIN) cec_queue_event_fh(fh, &ev, ktime_to_ns(ts)); - mutex_unlock(&adap->devnode.lock); + } + mutex_unlock(&adap->devnode.lock_fhs); } EXPORT_SYMBOL_GPL(cec_queue_pin_cec_event); =20 @@ -195,10 +196,10 @@ void cec_queue_pin_hpd_event(struct cec_ }; struct cec_fh *fh; =20 - mutex_lock(&adap->devnode.lock); + mutex_lock(&adap->devnode.lock_fhs); list_for_each_entry(fh, &adap->devnode.fhs, list) cec_queue_event_fh(fh, &ev, ktime_to_ns(ts)); - mutex_unlock(&adap->devnode.lock); + mutex_unlock(&adap->devnode.lock_fhs); } EXPORT_SYMBOL_GPL(cec_queue_pin_hpd_event); =20 @@ -211,10 +212,10 @@ void cec_queue_pin_5v_event(struct cec_a }; struct cec_fh *fh; =20 - mutex_lock(&adap->devnode.lock); + mutex_lock(&adap->devnode.lock_fhs); list_for_each_entry(fh, &adap->devnode.fhs, list) cec_queue_event_fh(fh, &ev, ktime_to_ns(ts)); - mutex_unlock(&adap->devnode.lock); + mutex_unlock(&adap->devnode.lock_fhs); } EXPORT_SYMBOL_GPL(cec_queue_pin_5v_event); =20 @@ -286,12 +287,12 @@ static void cec_queue_msg_monitor(struct u32 monitor_mode =3D valid_la ? CEC_MODE_MONITOR : CEC_MODE_MONITOR_ALL; =20 - mutex_lock(&adap->devnode.lock); + mutex_lock(&adap->devnode.lock_fhs); list_for_each_entry(fh, &adap->devnode.fhs, list) { if (fh->mode_follower >=3D monitor_mode) cec_queue_msg_fh(fh, msg); } - mutex_unlock(&adap->devnode.lock); + mutex_unlock(&adap->devnode.lock_fhs); } =20 /* @@ -302,12 +303,12 @@ static void cec_queue_msg_followers(stru { struct cec_fh *fh; =20 - mutex_lock(&adap->devnode.lock); + mutex_lock(&adap->devnode.lock_fhs); list_for_each_entry(fh, &adap->devnode.fhs, list) { if (fh->mode_follower =3D=3D CEC_MODE_FOLLOWER) cec_queue_msg_fh(fh, msg); } - mutex_unlock(&adap->devnode.lock); + mutex_unlock(&adap->devnode.lock_fhs); } =20 /* Notify userspace of an adapter state change. */ @@ -1573,6 +1574,7 @@ void __cec_s_phys_addr(struct cec_adapte /* Disabling monitor all mode should always succeed */ if (adap->monitor_all_cnt) WARN_ON(call_op(adap, adap_monitor_all_enable, false)); + /* serialize adap_enable */ mutex_lock(&adap->devnode.lock); if (adap->needs_hpd || list_empty(&adap->devnode.fhs)) { WARN_ON(adap->ops->adap_enable(adap, false)); @@ -1584,14 +1586,16 @@ void __cec_s_phys_addr(struct cec_adapte return; } =20 + /* serialize adap_enable */ mutex_lock(&adap->devnode.lock); adap->last_initiator =3D 0xff; adap->transmit_in_progress =3D false; =20 - if ((adap->needs_hpd || list_empty(&adap->devnode.fhs)) && - adap->ops->adap_enable(adap, true)) { - mutex_unlock(&adap->devnode.lock); - return; + if (adap->needs_hpd || list_empty(&adap->devnode.fhs)) { + if (adap->ops->adap_enable(adap, true)) { + mutex_unlock(&adap->devnode.lock); + return; + } } =20 if (adap->monitor_all_cnt && --- a/drivers/media/cec/core/cec-api.c +++ b/drivers/media/cec/core/cec-api.c @@ -586,6 +586,7 @@ static int cec_open(struct inode *inode, return err; } =20 + /* serialize adap_enable */ mutex_lock(&devnode->lock); if (list_empty(&devnode->fhs) && !adap->needs_hpd && @@ -624,7 +625,9 @@ static int cec_open(struct inode *inode, } #endif =20 + mutex_lock(&devnode->lock_fhs); list_add(&fh->list, &devnode->fhs); + mutex_unlock(&devnode->lock_fhs); mutex_unlock(&devnode->lock); =20 return 0; @@ -653,8 +656,11 @@ static int cec_release(struct inode *ino cec_monitor_all_cnt_dec(adap); mutex_unlock(&adap->lock); =20 + /* serialize adap_enable */ mutex_lock(&devnode->lock); + mutex_lock(&devnode->lock_fhs); list_del(&fh->list); + mutex_unlock(&devnode->lock_fhs); if (cec_is_registered(adap) && list_empty(&devnode->fhs) && !adap->needs_hpd && adap->phys_addr =3D=3D CEC_PHYS_ADDR_INVALID) { WARN_ON(adap->ops->adap_enable(adap, false)); --- a/drivers/media/cec/core/cec-core.c +++ b/drivers/media/cec/core/cec-core.c @@ -169,8 +169,10 @@ static void cec_devnode_unregister(struc devnode->registered =3D false; devnode->unregistered =3D true; =20 + mutex_lock(&devnode->lock_fhs); list_for_each_entry(fh, &devnode->fhs, list) wake_up_interruptible(&fh->wait); + mutex_unlock(&devnode->lock_fhs); =20 mutex_unlock(&devnode->lock); =20 @@ -272,6 +274,7 @@ struct cec_adapter *cec_allocate_adapter =20 /* adap->devnode initialization */ INIT_LIST_HEAD(&adap->devnode.fhs); + mutex_init(&adap->devnode.lock_fhs); mutex_init(&adap->devnode.lock); =20 adap->kthread =3D kthread_run(cec_thread_func, adap, "cec-%s", name); --- a/include/media/cec.h +++ b/include/media/cec.h @@ -26,13 +26,17 @@ * @dev: cec device * @cdev: cec character device * @minor: device node minor number + * @lock: lock to serialize open/release and registration * @registered: the device was correctly registered * @unregistered: the device was unregistered + * @lock_fhs: lock to control access to @fhs * @fhs: the list of open filehandles (cec_fh) - * @lock: lock to control access to this structure * * This structure represents a cec-related device node. * + * To add or remove filehandles from @fhs the @lock must be taken first, + * followed by @lock_fhs. It is safe to access @fhs if either lock is held. + * * The @parent is a physical device. It must be set by core or device driv= ers * before registering the node. */ @@ -43,10 +47,13 @@ struct cec_devnode { =20 /* device info */ int minor; + /* serialize open/release and registration */ + struct mutex lock; bool registered; bool unregistered; + /* protect access to fhs */ + struct mutex lock_fhs; struct list_head fhs; - struct mutex lock; }; =20 struct cec_adapter; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3156BC433F5 for ; Mon, 24 Jan 2022 23:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848087AbiAXXVo (ORCPT ); Mon, 24 Jan 2022 18:21:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1586949AbiAXW1e (ORCPT ); Mon, 24 Jan 2022 17:27:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FDD0C019B31; Mon, 24 Jan 2022 12:54:43 -0800 (PST) Received: from smtp.kernel.org (relay.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 47061B81243; Mon, 24 Jan 2022 20:54:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6ACDDC36AE3; Mon, 24 Jan 2022 20:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057681; bh=1xQpMaORlAjMY+OYmQAFt/yWySqQIyzA1KWUNh4bLgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a7WZuRCYlGRc0nlJhD3pyQzQ/NBzJocS6N/LuaMaNKu/n3fTg4b3wQw7H4Zwv3xqV 9rpOzSNmTuDK4TY8ZvOYeEfXE6PmOkQK9pYyUB2mmaWbLJha71FhFofp2soEkXoAtV MGgg7huAHYwn3mTbfiv5/CxWdOh9CM40NWCsymZQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH 5.16 0043/1039] media: ov8865: Disable only enabled regulators on error path Date: Mon, 24 Jan 2022 19:30:32 +0100 Message-Id: <20220124184126.587770188@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 cbe0b3af73bf72fad197756f026084404e2bcdc7 upstream. If powering on the sensor failed, the entire power-off sequence was run independently of how far the power-on sequence proceeded before the error. This lead to disabling regulators and/or clock that was not enabled. Fix this by disabling only clocks and regulators that were enabled previously. Fixes: 11c0d8fdccc5 ("media: i2c: Add support for the OV8865 image sensor") Cc: stable@vger.kernel.org Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/i2c/ov8865.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2330,27 +2330,27 @@ static int ov8865_sensor_power(struct ov if (ret) { dev_err(sensor->dev, "failed to enable DOVDD regulator\n"); - goto disable; + return ret; } =20 ret =3D regulator_enable(sensor->avdd); if (ret) { dev_err(sensor->dev, "failed to enable AVDD regulator\n"); - goto disable; + goto disable_dovdd; } =20 ret =3D regulator_enable(sensor->dvdd); if (ret) { dev_err(sensor->dev, "failed to enable DVDD regulator\n"); - goto disable; + goto disable_avdd; } =20 ret =3D clk_prepare_enable(sensor->extclk); if (ret) { dev_err(sensor->dev, "failed to enable EXTCLK clock\n"); - goto disable; + goto disable_dvdd; } =20 gpiod_set_value_cansleep(sensor->reset, 0); @@ -2359,14 +2359,16 @@ static int ov8865_sensor_power(struct ov /* Time to enter streaming mode according to power timings. */ usleep_range(10000, 12000); } else { -disable: gpiod_set_value_cansleep(sensor->powerdown, 1); gpiod_set_value_cansleep(sensor->reset, 1); =20 clk_disable_unprepare(sensor->extclk); =20 +disable_dvdd: regulator_disable(sensor->dvdd); +disable_avdd: regulator_disable(sensor->avdd); +disable_dovdd: regulator_disable(sensor->dovdd); } =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 937A0C2BA4C for ; Mon, 24 Jan 2022 23:23:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848054AbiAXXVj (ORCPT ); Mon, 24 Jan 2022 18:21:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1586976AbiAXW1f (ORCPT ); Mon, 24 Jan 2022 17:27:35 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9549CC0E5303; Mon, 24 Jan 2022 12:54:46 -0800 (PST) Received: from smtp.kernel.org (relay.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 5BEF1B8122A; Mon, 24 Jan 2022 20:54:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F3D2C340E5; Mon, 24 Jan 2022 20:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057684; bh=PawTXDQsYbpchk/L0u350gN2qSbXLyEo+9hwZYC02lQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WY8KbOi71uuiPkVPjnA6DTBdv7HZnu5rbhNylLbxDEjzSyfZwabvIU6qwPy4Rihzz /W2ZD9v8NJ1SQAMIJpzc/Na+E+ggWcjXMrHPUUkm3OOegRHa4Z+hIlqvr3b1bpN06z HplnLwGwRO/GIEh0rpN4T3GOVm3PhxXJTi31Ed9E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0044/1039] media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE Date: Mon, 24 Jan 2022 19:30:33 +0100 Message-Id: <20220124184126.619934899@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans Verkuil commit cd9d9377ed235b294a492a094e1666178a5e78fd upstream. If V4L2_CAP_READWRITE is not set, then readbuffers must be set to 0, otherwise v4l2-compliance will complain. A note on the Fixes tag below: this patch does not really fix that commit, but it can be applied from that commit onwards. For older code there is no guarantee that device_caps is set, so even though this patch would apply, it will not work reliably. Signed-off-by: Hans Verkuil Fixes: 049e684f2de9 (media: v4l2-dev: fix WARN_ON(!vdev->device_caps)) Cc: Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/v4l2-core/v4l2-ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2090,6 +2090,7 @@ static int v4l_prepare_buf(const struct static int v4l_g_parm(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { + struct video_device *vfd =3D video_devdata(file); struct v4l2_streamparm *p =3D arg; v4l2_std_id std; int ret =3D check_fmt(file, p->type); @@ -2101,7 +2102,8 @@ static int v4l_g_parm(const struct v4l2_ if (p->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE && p->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) return -EINVAL; - p->parm.capture.readbuffers =3D 2; + if (vfd->device_caps & V4L2_CAP_READWRITE) + p->parm.capture.readbuffers =3D 2; ret =3D ops->vidioc_g_std(file, fh, &std); if (ret =3D=3D 0) v4l2_video_std_frame_period(std, &p->parm.capture.timeperframe); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD0DFC43219 for ; Mon, 24 Jan 2022 21:27:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451617AbiAXVXO (ORCPT ); Mon, 24 Jan 2022 16:23:14 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48414 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442551AbiAXUyt (ORCPT ); Mon, 24 Jan 2022 15:54:49 -0500 Received: from smtp.kernel.org (relay.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 CB33660C17; Mon, 24 Jan 2022 20:54:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80F91C340E5; Mon, 24 Jan 2022 20:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057687; bh=AuyhCT3B2V3UEEjSkj4AqU0jUqp3l0eUqnqkXQA3DdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ndwoz32Yvh/GTVdEurq4l/FnH+XYpn5QQa77Pfk/lk/Wcu9rM/SMVfCanKuAkHR0j KmBp8rkK7sB2vdNN6yRHjCe3D0B5X0TJ0EEFCk71S+2oEd4xA4BhszN7JTa50yBkbI QDS8u4y9628MpKgPRhcmTHFoMUHfEX09RLgc8Apo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0045/1039] media: flexcop-usb: fix control-message timeouts Date: Mon, 24 Jan 2022 19:30:34 +0100 Message-Id: <20220124184126.659770435@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 cd1798a387825cc4a51282f5a611ad05bb1ad75f upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Note that the driver was multiplying some of the timeout values with HZ twice resulting in 3000-second timeouts with HZ=3D1000. Also note that two of the timeout defines are currently unused. Fixes: 2154be651b90 ("[media] redrat3: new rc-core IR transceiver device dr= iver") Cc: stable@vger.kernel.org # 3.0 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/b2c2/flexcop-usb.c | 10 +++++----- drivers/media/usb/b2c2/flexcop-usb.h | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) --- a/drivers/media/usb/b2c2/flexcop-usb.c +++ b/drivers/media/usb/b2c2/flexcop-usb.c @@ -87,7 +87,7 @@ static int flexcop_usb_readwrite_dw(stru 0, fc_usb->data, sizeof(u32), - B2C2_WAIT_FOR_OPERATION_RDW * HZ); + B2C2_WAIT_FOR_OPERATION_RDW); =20 if (ret !=3D sizeof(u32)) { err("error while %s dword from %d (%d).", read ? "reading" : @@ -155,7 +155,7 @@ static int flexcop_usb_v8_memory_req(str wIndex, fc_usb->data, buflen, - nWaitTime * HZ); + nWaitTime); if (ret !=3D buflen) ret =3D -EIO; =20 @@ -248,13 +248,13 @@ static int flexcop_usb_i2c_req(struct fl /* DKT 020208 - add this to support special case of DiSEqC */ case USB_FUNC_I2C_CHECKWRITE: pipe =3D B2C2_USB_CTRL_PIPE_OUT; - nWaitTime =3D 2; + nWaitTime =3D 2000; request_type |=3D USB_DIR_OUT; break; case USB_FUNC_I2C_READ: case USB_FUNC_I2C_REPEATREAD: pipe =3D B2C2_USB_CTRL_PIPE_IN; - nWaitTime =3D 2; + nWaitTime =3D 2000; request_type |=3D USB_DIR_IN; break; default: @@ -281,7 +281,7 @@ static int flexcop_usb_i2c_req(struct fl wIndex, fc_usb->data, buflen, - nWaitTime * HZ); + nWaitTime); =20 if (ret !=3D buflen) ret =3D -EIO; --- a/drivers/media/usb/b2c2/flexcop-usb.h +++ b/drivers/media/usb/b2c2/flexcop-usb.h @@ -91,13 +91,13 @@ typedef enum { UTILITY_SRAM_TESTVERIFY =3D 0x16, } flexcop_usb_utility_function_t; =20 -#define B2C2_WAIT_FOR_OPERATION_RW (1*HZ) -#define B2C2_WAIT_FOR_OPERATION_RDW (3*HZ) -#define B2C2_WAIT_FOR_OPERATION_WDW (1*HZ) +#define B2C2_WAIT_FOR_OPERATION_RW 1000 +#define B2C2_WAIT_FOR_OPERATION_RDW 3000 +#define B2C2_WAIT_FOR_OPERATION_WDW 1000 =20 -#define B2C2_WAIT_FOR_OPERATION_V8READ (3*HZ) -#define B2C2_WAIT_FOR_OPERATION_V8WRITE (3*HZ) -#define B2C2_WAIT_FOR_OPERATION_V8FLASH (3*HZ) +#define B2C2_WAIT_FOR_OPERATION_V8READ 3000 +#define B2C2_WAIT_FOR_OPERATION_V8WRITE 3000 +#define B2C2_WAIT_FOR_OPERATION_V8FLASH 3000 =20 typedef enum { V8_MEMORY_PAGE_DVB_CI =3D 0x20, From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46BA6C433FE for ; Mon, 24 Jan 2022 21:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451257AbiAXVWd (ORCPT ); Mon, 24 Jan 2022 16:22:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48474 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442567AbiAXUyw (ORCPT ); Mon, 24 Jan 2022 15:54:52 -0500 Received: from smtp.kernel.org (relay.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 D9AC360B03; Mon, 24 Jan 2022 20:54:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B9B0C340E5; Mon, 24 Jan 2022 20:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057690; bh=oj5Je4hEdh8UvrPiv7Hw9okiM1qi3n2AsOBeJ6hgeSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OtHEGWajK4DjqRe9rNJoSHNxGRWI52ihBw2ANc7uK96kIlILfmNKNacZ9/W+6OYmq Af6KjUg56tPpn6nyNK/m+4vZ3n3wwaDf9pPAXOHRzYxWin0S8G+JbmSWdNMGuLExma WIpDIk5biCDuH2k7FaWOof/e7hUXNf6GjgXIrlAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0046/1039] media: mceusb: fix control-message timeouts Date: Mon, 24 Jan 2022 19:30:35 +0100 Message-Id: <20220124184126.692326982@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 16394e998cbb050730536bdf7e89f5a70efbd974 upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Fixes: 66e89522aff7 ("V4L/DVB: IR: add mceusb IR receiver driver") Cc: stable@vger.kernel.org # 2.6.36 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/rc/mceusb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -1430,7 +1430,7 @@ static void mceusb_gen1_init(struct mceu */ ret =3D usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, - data, USB_CTRL_MSG_SZ, HZ * 3); + data, USB_CTRL_MSG_SZ, 3000); dev_dbg(dev, "set address - ret =3D %d", ret); dev_dbg(dev, "set address - data[0] =3D %d, data[1] =3D %d", data[0], data[1]); @@ -1438,20 +1438,20 @@ static void mceusb_gen1_init(struct mceu /* set feature: bit rate 38400 bps */ ret =3D usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, - 0xc04e, 0x0000, NULL, 0, HZ * 3); + 0xc04e, 0x0000, NULL, 0, 3000); =20 dev_dbg(dev, "set feature - ret =3D %d", ret); =20 /* bRequest 4: set char length to 8 bits */ ret =3D usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 4, USB_TYPE_VENDOR, - 0x0808, 0x0000, NULL, 0, HZ * 3); + 0x0808, 0x0000, NULL, 0, 3000); dev_dbg(dev, "set char length - retB =3D %d", ret); =20 /* bRequest 2: set handshaking to use DTR/DSR */ ret =3D usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 2, USB_TYPE_VENDOR, - 0x0000, 0x0100, NULL, 0, HZ * 3); + 0x0000, 0x0100, NULL, 0, 3000); dev_dbg(dev, "set handshake - retC =3D %d", ret); =20 /* device resume */ From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FF5EC43217 for ; Mon, 24 Jan 2022 23:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849365AbiAXXZh (ORCPT ); Mon, 24 Jan 2022 18:25:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587648AbiAXW3X (ORCPT ); Mon, 24 Jan 2022 17:29:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2354C0E5317; Mon, 24 Jan 2022 12:54:55 -0800 (PST) Received: from smtp.kernel.org (relay.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 7CF6DB811FB; Mon, 24 Jan 2022 20:54:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A467BC340E5; Mon, 24 Jan 2022 20:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057693; bh=lDnMZdm1qIoBNi8zGpb9L19ogrWHp8r6Rf4WFn0gvus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v5SwpL6HmfH6xkfGVtF/PGNvQc097KEA05BNCL506Z/GYYPl5gtRbvT7vMYtos0hH GmmFfYEEhaPQR37H+IY5nb3p8+ND8hGYarF4k3qzZmiEfUS9UAFtJ3ug3NxbIKVrTR bqXNDj4u2Ss5Y+OYVYqkm2hC1YNQ9KiArMS0WjvM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0047/1039] media: em28xx: fix control-message timeouts Date: Mon, 24 Jan 2022 19:30:36 +0100 Message-Id: <20220124184126.723948858@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 d9b7e8df3aa9b8c10708aab60e72e79ac08237e4 upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Fixes: a6c2ba283565 ("[PATCH] v4l: 716: support for em28xx board family") Cc: stable@vger.kernel.org # 2.6.16 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/em28xx/em28xx-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/media/usb/em28xx/em28xx-core.c +++ b/drivers/media/usb/em28xx/em28xx-core.c @@ -89,7 +89,7 @@ int em28xx_read_reg_req_len(struct em28x mutex_lock(&dev->ctrl_urb_lock); ret =3D usb_control_msg(udev, pipe, req, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0x0000, reg, dev->urb_buf, len, HZ); + 0x0000, reg, dev->urb_buf, len, 1000); if (ret < 0) { em28xx_regdbg("(pipe 0x%08x): IN: %02x %02x %02x %02x %02x %02x %02x %0= 2x failed with error %i\n", pipe, @@ -158,7 +158,7 @@ int em28xx_write_regs_req(struct em28xx memcpy(dev->urb_buf, buf, len); ret =3D usb_control_msg(udev, pipe, req, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0x0000, reg, dev->urb_buf, len, HZ); + 0x0000, reg, dev->urb_buf, len, 1000); mutex_unlock(&dev->ctrl_urb_lock); =20 if (ret < 0) { From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AE34C433FE for ; Mon, 24 Jan 2022 23:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849087AbiAXXYl (ORCPT ); Mon, 24 Jan 2022 18:24:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588129AbiAXWbj (ORCPT ); Mon, 24 Jan 2022 17:31:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58BF5C047CD9; Mon, 24 Jan 2022 12:57:03 -0800 (PST) Received: from smtp.kernel.org (relay.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 EE98260907; Mon, 24 Jan 2022 20:57:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6018C340E5; Mon, 24 Jan 2022 20:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057822; bh=qfAGAbyPTg3olyE7z+5FG/FBdquTGx9E7vNPDPs2aZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SEhqJ4/dO2T/T/7XKyrIdXgo/MlJdn50PIJIkoARQGy2Q6gMXbatptiQkQF2x/Gk9 lvqx9lTOPwM2M8gjD0ZxyqfRPtm2hJ7D5+l/nTyP4wOnx2bZ2kbeZsmi/L0vK0PA+j pJavPqbOKRLT0i2OGjdbUoNYKD4/QhsDf7cJIFJE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0048/1039] media: cpia2: fix control-message timeouts Date: Mon, 24 Jan 2022 19:30:37 +0100 Message-Id: <20220124184126.757371888@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 10729be03327f53258cb196362015ad5c6eabe02 upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Fixes: ab33d5071de7 ("V4L/DVB (3376): Add cpia2 camera support") Cc: stable@vger.kernel.org # 2.6.17 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/cpia2/cpia2_usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/media/usb/cpia2/cpia2_usb.c +++ b/drivers/media/usb/cpia2/cpia2_usb.c @@ -550,7 +550,7 @@ static int write_packet(struct usb_devic 0, /* index */ buf, /* buffer */ size, - HZ); + 1000); =20 kfree(buf); return ret; @@ -582,7 +582,7 @@ static int read_packet(struct usb_device 0, /* index */ buf, /* buffer */ size, - HZ); + 1000); =20 if (ret >=3D 0) memcpy(registers, buf, size); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAF25C4332F for ; Mon, 24 Jan 2022 23:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849265AbiAXXZS (ORCPT ); Mon, 24 Jan 2022 18:25:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587764AbiAXW3h (ORCPT ); Mon, 24 Jan 2022 17:29:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0B9AC02B860; Mon, 24 Jan 2022 12:55:20 -0800 (PST) Received: from smtp.kernel.org (relay.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 444F0B811FB; Mon, 24 Jan 2022 20:55:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BDD7C340E5; Mon, 24 Jan 2022 20:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057719; bh=21wLfuqbveCS5JVAQjiuxwd7PXQ2jDvYYmglTZT6T1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qylMtf8dLYTZMseCw99RNBHp3VWDISIjac+PJR0VOjQsmWCHVgq3g0DUhFCag25w4 hSKCZLHnEYvbpfFxa8pHY2SKQtjL3Uh3xUzmUqBkpOXROcIR4tjF3SHZbcbztfHPs+ kRw0zTvMceo//vqJ8KoWBsr+drEnZicMkjsVqn/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0049/1039] media: s2255: fix control-message timeouts Date: Mon, 24 Jan 2022 19:30:38 +0100 Message-Id: <20220124184126.790329143@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 f71d272ad4e354097020a4e6b1dc6e4b59feb50f upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Use the common control-message timeout define for the five-second timeouts. Fixes: 38f993ad8b1f ("V4L/DVB (8125): This driver adds support for the Sens= oray 2255 devices.") Cc: stable@vger.kernel.org # 2.6.27 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/s2255/s2255drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -1882,7 +1882,7 @@ static long s2255_vendor_req(struct s225 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, Value, Index, buf, - TransferBufferLength, HZ * 5); + TransferBufferLength, USB_CTRL_SET_TIMEOUT); =20 if (r >=3D 0) memcpy(TransferBuffer, buf, TransferBufferLength); @@ -1891,7 +1891,7 @@ static long s2255_vendor_req(struct s225 r =3D usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), Request, USB_TYPE_VENDOR | USB_RECIP_DEVICE, Value, Index, buf, - TransferBufferLength, HZ * 5); + TransferBufferLength, USB_CTRL_SET_TIMEOUT); } kfree(buf); return r; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F767C2BA4C for ; Mon, 24 Jan 2022 21:27:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451715AbiAXVXZ (ORCPT ); Mon, 24 Jan 2022 16:23:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51834 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442964AbiAXUzy (ORCPT ); Mon, 24 Jan 2022 15:55:54 -0500 Received: from smtp.kernel.org (relay.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 40A65B810BD; Mon, 24 Jan 2022 20:55:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6108BC340E5; Mon, 24 Jan 2022 20:55:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057752; bh=R3SYvAKMvIzdD7gfCpbP1XBCEPkDA2vnynlCBsHNGkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MHpjA5ews7okIAve8to9MCojCYt/ol8yi96bYH/VYyLI+XFHFS+UL5oGsfjI8W2fG DO/O1mKpfGC0gYr10qhOLUht+g81iBmY6S1cuSuyoSyXv8T4MCVe3HXvPpunwzE6An XbqLLSUhU8HD/vuAnpkPVco4y5zgeNQfeOvDdpxQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kuron , Mauro Carvalho Chehab Subject: [PATCH 5.16 0050/1039] media: dib0700: fix undefined behavior in tuner shutdown Date: Mon, 24 Jan 2022 19:30:39 +0100 Message-Id: <20220124184126.820724440@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Kuron commit f7b77ebe6d2f49c7747b2d619586d1aa33f9ea91 upstream. This fixes a problem where closing the tuner would leave it in a state where it would not tune to any channel when reopened. This problem was discovered as part of https://github.com/hselasky/webcamd/issues/16. Since adap->id is 0 or 1, this bit-shift overflows, which is undefined behavior. The driver still worked in practice as the overflow would in most environments result in 0, which rendered the line a no-op. When running the driver as part of webcamd however, the overflow could lead to 0xff due to optimizations by the compiler, which would, in the end, improperly shut down the tuner. The bug is a regression introduced in the commit referenced below. The present patch causes identical behavior to before that commit for adap->id equal to 0 or 1. The driver does not contain support for dib0700 devices with more adapters, assuming such even exist. Tests have been performed with the Xbox One Digital TV Tuner on amd64. Not all dib0700 devices are expected to be affected by the regression; this code path is only taken by those with incorrect endpoint numbers. Link: https://lore.kernel.org/linux-media/1d2fc36d94ced6f67c7cc21dcc469d5e5= bdd8201.1632689033.git.mchehab+huawei@kernel.org Cc: stable@vger.kernel.org Fixes: 7757ddda6f4f ("[media] DiB0700: add function to change I2C-speed") Signed-off-by: Michael Kuron Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/dvb-usb/dib0700_core.c | 2 -- 1 file changed, 2 deletions(-) --- a/drivers/media/usb/dvb-usb/dib0700_core.c +++ b/drivers/media/usb/dvb-usb/dib0700_core.c @@ -618,8 +618,6 @@ int dib0700_streaming_ctrl(struct dvb_us deb_info("the endpoint number (%i) is not correct, use the adapter id in= stead", adap->fe_adap[0].stream.props.endpoint); if (onoff) st->channel_state |=3D 1 << (adap->id); - else - st->channel_state |=3D 1 << ~(adap->id); } else { if (onoff) st->channel_state |=3D 1 << (adap->fe_adap[0].stream.props.endpoint-2); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D2BEC43217 for ; Mon, 24 Jan 2022 21:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451925AbiAXVXr (ORCPT ); Mon, 24 Jan 2022 16:23:47 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52026 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443172AbiAXU41 (ORCPT ); Mon, 24 Jan 2022 15:56:27 -0500 Received: from smtp.kernel.org (relay.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 52086B811FB; Mon, 24 Jan 2022 20:56:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 871ABC340E5; Mon, 24 Jan 2022 20:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057785; bh=4gyB6Qv06tdS2Y/R6K7VxixzmD3znTGhfuyIXYLQd0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fJ9VyFYrlIzBCQdQf9QoqReBupOK3aW3+qPa/CBWXrulmng+o5DRre8Fm93GPMyWi PB78gfqpw38iPTQBWx6FvJ0CROMwFd5sIyH/Joq9I2c8PYuhlDN2CZKcmSqJ3gBiiU r1UUCEmDUPYDgaRFpFpOfXoicoPpBfhFpbV172lg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0051/1039] media: redrat3: fix control-message timeouts Date: Mon, 24 Jan 2022 19:30:40 +0100 Message-Id: <20220124184126.851950599@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 2adc965c8bfa224e11ecccf9c92fd458c4236428 upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Fixes: 2154be651b90 ("[media] redrat3: new rc-core IR transceiver device dr= iver") Cc: stable@vger.kernel.org # 3.0 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/rc/redrat3.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -404,7 +404,7 @@ static int redrat3_send_cmd(int cmd, str udev =3D rr3->udev; res =3D usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), cmd, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x0000, 0x0000, data, sizeof(u8), HZ * 10); + 0x0000, 0x0000, data, sizeof(u8), 10000); =20 if (res < 0) { dev_err(rr3->dev, "%s: Error sending rr3 cmd res %d, data %d", @@ -480,7 +480,7 @@ static u32 redrat3_get_timeout(struct re pipe =3D usb_rcvctrlpipe(rr3->udev, 0); ret =3D usb_control_msg(rr3->udev, pipe, RR3_GET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, HZ * 5); + RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, 5000); if (ret !=3D len) dev_warn(rr3->dev, "Failed to read timeout from hardware\n"); else { @@ -510,7 +510,7 @@ static int redrat3_set_timeout(struct rc ret =3D usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, RR3_IR_IO_SIG_TIMEOUT, 0, timeout, sizeof(*timeout), - HZ * 25); + 25000); dev_dbg(dev, "set ir parm timeout %d ret 0x%02x\n", be32_to_cpu(*timeout), ret); =20 @@ -542,32 +542,32 @@ static void redrat3_reset(struct redrat3 *val =3D 0x01; rc =3D usb_control_msg(udev, rxpipe, RR3_RESET, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - RR3_CPUCS_REG_ADDR, 0, val, len, HZ * 25); + RR3_CPUCS_REG_ADDR, 0, val, len, 25000); dev_dbg(dev, "reset returned 0x%02x\n", rc); =20 *val =3D length_fuzz; rc =3D usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, - RR3_IR_IO_LENGTH_FUZZ, 0, val, len, HZ * 25); + RR3_IR_IO_LENGTH_FUZZ, 0, val, len, 25000); dev_dbg(dev, "set ir parm len fuzz %d rc 0x%02x\n", *val, rc); =20 *val =3D (65536 - (minimum_pause * 2000)) / 256; rc =3D usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, - RR3_IR_IO_MIN_PAUSE, 0, val, len, HZ * 25); + RR3_IR_IO_MIN_PAUSE, 0, val, len, 25000); dev_dbg(dev, "set ir parm min pause %d rc 0x%02x\n", *val, rc); =20 *val =3D periods_measure_carrier; rc =3D usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, - RR3_IR_IO_PERIODS_MF, 0, val, len, HZ * 25); + RR3_IR_IO_PERIODS_MF, 0, val, len, 25000); dev_dbg(dev, "set ir parm periods measure carrier %d rc 0x%02x", *val, rc); =20 *val =3D RR3_DRIVER_MAXLENS; rc =3D usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, - RR3_IR_IO_MAX_LENGTHS, 0, val, len, HZ * 25); + RR3_IR_IO_MAX_LENGTHS, 0, val, len, 25000); dev_dbg(dev, "set ir parm max lens %d rc 0x%02x\n", *val, rc); =20 kfree(val); @@ -585,7 +585,7 @@ static void redrat3_get_firmware_rev(str rc =3D usb_control_msg(rr3->udev, usb_rcvctrlpipe(rr3->udev, 0), RR3_FW_VERSION, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0, 0, buffer, RR3_FW_VERSION_LEN, HZ * 5); + 0, 0, buffer, RR3_FW_VERSION_LEN, 5000); =20 if (rc >=3D 0) dev_info(rr3->dev, "Firmware rev: %s", buffer); @@ -825,14 +825,14 @@ static int redrat3_transmit_ir(struct rc =20 pipe =3D usb_sndbulkpipe(rr3->udev, rr3->ep_out->bEndpointAddress); ret =3D usb_bulk_msg(rr3->udev, pipe, irdata, - sendbuf_len, &ret_len, 10 * HZ); + sendbuf_len, &ret_len, 10000); dev_dbg(dev, "sent %d bytes, (ret %d)\n", ret_len, ret); =20 /* now tell the hardware to transmit what we sent it */ pipe =3D usb_rcvctrlpipe(rr3->udev, 0); ret =3D usb_control_msg(rr3->udev, pipe, RR3_TX_SEND_SIGNAL, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0, 0, irdata, 2, HZ * 10); + 0, 0, irdata, 2, 10000); =20 if (ret < 0) dev_err(dev, "Error: control msg send failed, rc %d\n", ret); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76D10C4321E for ; Mon, 24 Jan 2022 21:27:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451997AbiAXVXy (ORCPT ); Mon, 24 Jan 2022 16:23:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49742 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443357AbiAXU4o (ORCPT ); Mon, 24 Jan 2022 15:56:44 -0500 Received: from smtp.kernel.org (relay.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 46EDE60B11; Mon, 24 Jan 2022 20:56:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E1D2C340E5; Mon, 24 Jan 2022 20:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057803; bh=PSnOz8+2zdvBrxOTMHC/DW/3Ey4OxIgreWCpGuumD1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aiKx61+vY1wQd9xuXoPDZN9nNrnAUhJeUdWY+S5LzZaH4gNFiMRXTG3bfjFNeUVi9 K/W8zIWUOFZSuKcr4KN2bv9yVGNnQJ5rcR+AkJPiMLC0DYZEkL5gtYOdm4QmNdZN3a 6SQjzVpDfPYhkWBFFtxlftkaQVmJ3fJEnXKLGUeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0052/1039] media: pvrusb2: fix control-message timeouts Date: Mon, 24 Jan 2022 19:30:41 +0100 Message-Id: <20220124184126.884775655@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 b82bf9b9dc305d7d3d93eab106d70dbf2171b43e upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Fixes: d855497edbfb ("V4L/DVB (4228a): pvrusb2 to kernel 2.6.18") Cc: stable@vger.kernel.org # 2.6.18 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -1467,7 +1467,7 @@ static int pvr2_upload_firmware1(struct for (address =3D 0; address < fwsize; address +=3D 0x800) { memcpy(fw_ptr, fw_entry->data + address, 0x800); ret +=3D usb_control_msg(hdw->usb_dev, pipe, 0xa0, 0x40, address, - 0, fw_ptr, 0x800, HZ); + 0, fw_ptr, 0x800, 1000); } =20 trace_firmware("Upload done, releasing device's CPU"); @@ -1605,7 +1605,7 @@ int pvr2_upload_firmware2(struct pvr2_hd ((u32 *)fw_ptr)[icnt] =3D swab32(((u32 *)fw_ptr)[icnt]); =20 ret |=3D usb_bulk_msg(hdw->usb_dev, pipe, fw_ptr,bcnt, - &actual_length, HZ); + &actual_length, 1000); ret |=3D (actual_length !=3D bcnt); if (ret) break; fw_done +=3D bcnt; @@ -3438,7 +3438,7 @@ void pvr2_hdw_cpufw_set_enabled(struct p 0xa0,0xc0, address,0, hdw->fw_buffer+address, - 0x800,HZ); + 0x800,1000); if (ret < 0) break; } =20 @@ -3977,7 +3977,7 @@ void pvr2_hdw_cpureset_assert(struct pvr /* Write the CPUCS register on the 8051. The lsb of the register is the reset bit; a 1 asserts reset while a 0 clears it. */ pipe =3D usb_sndctrlpipe(hdw->usb_dev, 0); - ret =3D usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,HZ); + ret =3D usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,1000); if (ret < 0) { pvr2_trace(PVR2_TRACE_ERROR_LEGS, "cpureset_assert(%d) error=3D%d",val,ret); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABF9CC433F5 for ; Mon, 24 Jan 2022 23:24:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848932AbiAXXYV (ORCPT ); Mon, 24 Jan 2022 18:24:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588135AbiAXWbj (ORCPT ); Mon, 24 Jan 2022 17:31:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FB03C047CD8; Mon, 24 Jan 2022 12:56:49 -0800 (PST) Received: from smtp.kernel.org (relay.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 F0FF1B81233; Mon, 24 Jan 2022 20:56:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29236C340E5; Mon, 24 Jan 2022 20:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057806; bh=237rbF9pS7DmapYAq12bvUaL8GTC3vSFTf2z40fMX3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rhAYXAA3xPpidHHXTBjfbHgK698LuceBr0okUezaWlGD6l97ja8YkJVoZM3EmrBjI i+MIAn1chIjNHHArWXELncwD6l3MoMBcHFU1ZQTpK6xz/3j+8dC/USbLkYQSMrgnaD WFyQashOAX3Zs6rY8dGOWDO3jF4UTxKSmTdYklqE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0053/1039] media: stk1160: fix control-message timeouts Date: Mon, 24 Jan 2022 19:30:42 +0100 Message-Id: <20220124184126.924621989@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 6aa6e70cdb5b863a57bad61310bf89b6617a5d2d upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Fixes: 9cb2173e6ea8 ("[media] media: Add stk1160 new driver (easycap replac= ement)") Cc: stable@vger.kernel.org # 3.7 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/stk1160/stk1160-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/media/usb/stk1160/stk1160-core.c +++ b/drivers/media/usb/stk1160/stk1160-core.c @@ -65,7 +65,7 @@ int stk1160_read_reg(struct stk1160 *dev return -ENOMEM; ret =3D usb_control_msg(dev->udev, pipe, 0x00, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0x00, reg, buf, sizeof(u8), HZ); + 0x00, reg, buf, sizeof(u8), 1000); if (ret < 0) { stk1160_err("read failed on reg 0x%x (%d)\n", reg, ret); @@ -85,7 +85,7 @@ int stk1160_write_reg(struct stk1160 *de =20 ret =3D usb_control_msg(dev->udev, pipe, 0x01, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - value, reg, NULL, 0, HZ); + value, reg, NULL, 0, 1000); if (ret < 0) { stk1160_err("write failed on reg 0x%x (%d)\n", reg, ret); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF819C43217 for ; Mon, 24 Jan 2022 21:27:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452056AbiAXVX5 (ORCPT ); Mon, 24 Jan 2022 16:23:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52258 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443389AbiAXU4w (ORCPT ); Mon, 24 Jan 2022 15:56:52 -0500 Received: from smtp.kernel.org (relay.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 F294DB81243; Mon, 24 Jan 2022 20:56:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 424FBC340E5; Mon, 24 Jan 2022 20:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057809; bh=bd/N2cLIIyZKGPaNuTPqhxCMHdyWjib1d+RJWqvsz/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gl5/52HE9rkRHItua/QNCN/tn7X8DJtkSiZViZe65HTE/SwwdEoOFJ+yAxdKXLwI+ ji5M2YW71nJugx0EahGrdtSvu6ojJr38FUxFtv5hJSRDEeolpHf3YpoxpJjurCqa+n xXJZHGJJG+wuqj8qY2snQUSTIhRa+RHPLGkt6ZzA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0054/1039] media: cec-pin: fix interrupt en/disable handling Date: Mon, 24 Jan 2022 19:30:43 +0100 Message-Id: <20220124184126.962153354@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans Verkuil commit 713bdfa10b5957053811470d298def9537d9ff13 upstream. The en/disable_irq() functions keep track of the 'depth': i.e. if interrupts are disabled twice, then it needs to enable_irq() calls to enable them again. The cec-pin framework didn't take this into accound and could disable irqs multiple times, and it expected that a single enable_irq() would enable them again. Move all calls to en/disable_irq() to the kthread where it is easy to keep track of the current irq state and ensure that multiple en/disable_irq calls never happen. If interrupts where disabled twice, then they would never turn on again, leaving the CEC adapter in a dead state. Signed-off-by: Hans Verkuil Fixes: 865463fc03ed (media: cec-pin: add error injection support) Cc: Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/cec/core/cec-pin.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) --- a/drivers/media/cec/core/cec-pin.c +++ b/drivers/media/cec/core/cec-pin.c @@ -1033,6 +1033,7 @@ static int cec_pin_thread_func(void *_ad { struct cec_adapter *adap =3D _adap; struct cec_pin *pin =3D adap->pin; + bool irq_enabled =3D false; =20 for (;;) { wait_event_interruptible(pin->kthread_waitq, @@ -1060,6 +1061,7 @@ static int cec_pin_thread_func(void *_ad ns_to_ktime(pin->work_rx_msg.rx_ts)); msg->len =3D 0; } + if (pin->work_tx_status) { unsigned int tx_status =3D pin->work_tx_status; =20 @@ -1083,27 +1085,39 @@ static int cec_pin_thread_func(void *_ad switch (atomic_xchg(&pin->work_irq_change, CEC_PIN_IRQ_UNCHANGED)) { case CEC_PIN_IRQ_DISABLE: - pin->ops->disable_irq(adap); + if (irq_enabled) { + pin->ops->disable_irq(adap); + irq_enabled =3D false; + } cec_pin_high(pin); cec_pin_to_idle(pin); hrtimer_start(&pin->timer, ns_to_ktime(0), HRTIMER_MODE_REL); break; case CEC_PIN_IRQ_ENABLE: + if (irq_enabled) + break; pin->enable_irq_failed =3D !pin->ops->enable_irq(adap); if (pin->enable_irq_failed) { cec_pin_to_idle(pin); hrtimer_start(&pin->timer, ns_to_ktime(0), HRTIMER_MODE_REL); + } else { + irq_enabled =3D true; } break; default: break; } - if (kthread_should_stop()) break; } + if (pin->ops->disable_irq && irq_enabled) + pin->ops->disable_irq(adap); + hrtimer_cancel(&pin->timer); + cec_pin_read(pin); + cec_pin_to_idle(pin); + pin->state =3D CEC_ST_OFF; return 0; } =20 @@ -1130,13 +1144,7 @@ static int cec_pin_adap_enable(struct ce hrtimer_start(&pin->timer, ns_to_ktime(0), HRTIMER_MODE_REL); } else { - if (pin->ops->disable_irq) - pin->ops->disable_irq(adap); - hrtimer_cancel(&pin->timer); kthread_stop(pin->kthread); - cec_pin_read(pin); - cec_pin_to_idle(pin); - pin->state =3D CEC_ST_OFF; } return 0; } @@ -1157,11 +1165,8 @@ void cec_pin_start_timer(struct cec_pin if (pin->state !=3D CEC_ST_RX_IRQ) return; =20 - atomic_set(&pin->work_irq_change, CEC_PIN_IRQ_UNCHANGED); - pin->ops->disable_irq(pin->adap); - cec_pin_high(pin); - cec_pin_to_idle(pin); - hrtimer_start(&pin->timer, ns_to_ktime(0), HRTIMER_MODE_REL); + atomic_set(&pin->work_irq_change, CEC_PIN_IRQ_DISABLE); + wake_up_interruptible(&pin->kthread_waitq); } =20 static int cec_pin_adap_transmit(struct cec_adapter *adap, u8 attempts, From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31AC1C433EF for ; Mon, 24 Jan 2022 21:27:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452021AbiAXVX4 (ORCPT ); Mon, 24 Jan 2022 16:23:56 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52278 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443427AbiAXU4z (ORCPT ); Mon, 24 Jan 2022 15:56:55 -0500 Received: from smtp.kernel.org (relay.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 7A14FB81233; Mon, 24 Jan 2022 20:56:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34D32C340E5; Mon, 24 Jan 2022 20:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057813; bh=iQYvZKOwn04GejAiJzx17eTC96LSLpLWKisII9IwQuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VGovbQQ8iZrMN1opNtHCEg3aU7IhOWNDQj/6KRPWdFMdI4jdiMLhUXebtr8fnw/U7 Z16HhZZ6qbJYVPbRTVeIf/vSYd+YjtjEkQNbBEIPyTeVnh0RX/e2B9VXxC/M+t2oqx 0qzbZGkvEtds2dsHOtPuknwJuqdI3BXBh6hgGLOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Marc Kleine-Budde Subject: [PATCH 5.16 0055/1039] can: softing_cs: softingcs_probe(): fix memleak on registration failure Date: Mon, 24 Jan 2022 19:30:44 +0100 Message-Id: <20220124184126.998671788@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 ced4913efb0acc844ed65cc01d091a85d83a2082 upstream. In case device registration fails during probe, the driver state and the embedded platform device structure needs to be freed using platform_device_put() to properly free all resources (e.g. the device name). Fixes: 0a0b7a5f7a04 ("can: add driver for Softing card") Link: https://lore.kernel.org/all/20211222104843.6105-1-johan@kernel.org Cc: stable@vger.kernel.org # 2.6.38 Signed-off-by: Johan Hovold Reviewed-by: Greg Kroah-Hartman Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/can/softing/softing_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/can/softing/softing_cs.c +++ b/drivers/net/can/softing/softing_cs.c @@ -293,7 +293,7 @@ static int softingcs_probe(struct pcmcia return 0; =20 platform_failed: - kfree(dev); + platform_device_put(pdev); mem_failed: pcmcia_bad: pcmcia_failed: From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DED78C43219 for ; Mon, 24 Jan 2022 21:27:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452079AbiAXVYA (ORCPT ); Mon, 24 Jan 2022 16:24:00 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49848 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443443AbiAXU46 (ORCPT ); Mon, 24 Jan 2022 15:56:58 -0500 Received: from smtp.kernel.org (relay.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 D748D60B03; Mon, 24 Jan 2022 20:56:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8774C340E5; Mon, 24 Jan 2022 20:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057816; bh=e4BpGwdT8izfHTQPZn1Ny6wEvrlLCnwgZUVm5AB7R5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ugAdMgexZTUNmSKUvataG+vr+3PS14HBp4AdKRH8VLr3FVUuGoalUfu6bNwIQ7r2i JV9S2famDY4u29QcLDGfa1IQrdWPXCkitW8nmv+nBgTjOINT0LPCJVWKZJRoO8HT4C IWLHUt7NZvYqAo+d+XSiizvVDvlJCZ+ExnibPlvY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emmanuel Grumbach , Tomas Winkler , Alexander Usyskin Subject: [PATCH 5.16 0056/1039] mei: hbm: fix client dma reply status Date: Mon, 24 Jan 2022 19:30:45 +0100 Message-Id: <20220124184127.033162199@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Usyskin commit 6b0b80ac103b2a40c72a47c301745fd1f4ef4697 upstream. Don't blindly copy status value received from the firmware into internal client status field, It may be positive and ERR_PTR(ret) will translate it into an invalid address and the caller will crash. Put the error code into the client status on failure. Fixes: 369aea845951 ("mei: implement client dma setup.") Cc: # v5.11+ Reported-by: Emmanuel Grumbach Tested-by: : Emmanuel Grumbach Acked-by: Tomas Winkler Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler Link: https://lore.kernel.org/r/20211228082047.378115-1-tomas.winkler@intel= .com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/misc/mei/hbm.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) --- a/drivers/misc/mei/hbm.c +++ b/drivers/misc/mei/hbm.c @@ -672,10 +672,14 @@ static void mei_hbm_cl_dma_map_res(struc if (!cl) return; =20 - dev_dbg(dev->dev, "cl dma map result =3D %d\n", res->status); - cl->status =3D res->status; - if (!cl->status) + if (res->status) { + dev_err(dev->dev, "cl dma map failed %d\n", res->status); + cl->status =3D -EFAULT; + } else { + dev_dbg(dev->dev, "cl dma map succeeded\n"); cl->dma_mapped =3D 1; + cl->status =3D 0; + } wake_up(&cl->wait); } =20 @@ -698,10 +702,14 @@ static void mei_hbm_cl_dma_unmap_res(str if (!cl) return; =20 - dev_dbg(dev->dev, "cl dma unmap result =3D %d\n", res->status); - cl->status =3D res->status; - if (!cl->status) + if (res->status) { + dev_err(dev->dev, "cl dma unmap failed %d\n", res->status); + cl->status =3D -EFAULT; + } else { + dev_dbg(dev->dev, "cl dma unmap succeeded\n"); cl->dma_mapped =3D 0; + cl->status =3D 0; + } wake_up(&cl->wait); } =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB459C433F5 for ; Mon, 24 Jan 2022 21:27:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452114AbiAXVYF (ORCPT ); Mon, 24 Jan 2022 16:24:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49882 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443458AbiAXU5A (ORCPT ); Mon, 24 Jan 2022 15:57:00 -0500 Received: from smtp.kernel.org (relay.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 E13B660C17; Mon, 24 Jan 2022 20:56:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7C35C340E5; Mon, 24 Jan 2022 20:56:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057819; bh=lAgpecVtFPKqz8XYq912/7qZ284lwJXrzMb0Oc/wRyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HaXD8tEDJZfZ4AV1R/yOYBQC65zCM82s/180wk1LJqZGT01tdgHWGZyADOPCo3xai IgN+vpkqKKW3N+4NrwR8mLBoCGbZEsmGPSIEQvrsfjAxJamwOouh7dMIKAXb9mrUjH wlxMQEDR17fuAbq3ShZu82UD+TLZSYCemtsfcgNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kunyang Fan , Jonathan Cameron , Andy Shevchenko , Stable@vger.kernel.org Subject: [PATCH 5.16 0057/1039] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs Date: Mon, 24 Jan 2022 19:30:46 +0100 Message-Id: <20220124184127.063912952@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jonathan Cameron commit c9791a94384af07592d29504004d2255dbaf8663 upstream. Unfortuanately a non standards compliant ACPI ID is known to be in the wild on some AAEON boards. Partly revert the removal of these IDs so that ADC081C will again work + add a comment to that affect for future reference. Whilst here use generic firmware properties rather than the ACPI specific handling previously found in this driver. Reported-by: Kunyang Fan Fixes: c458b7ca3fd0 ("iio:adc:ti-adc081c: Drop ACPI ids that seem very unli= kely to be official.") Signed-off-by: Jonathan Cameron Cc: Andy Shevchenko Tested-by: Kunyang Fan #UP-extremei11 Link: https://lore.kernel.org/r/20211205172728.2826512-1-jic23@kernel.org Cc: Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iio/adc/ti-adc081c.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) --- a/drivers/iio/adc/ti-adc081c.c +++ b/drivers/iio/adc/ti-adc081c.c @@ -19,6 +19,7 @@ #include #include #include +#include =20 #include #include @@ -156,13 +157,16 @@ static int adc081c_probe(struct i2c_clie { struct iio_dev *iio; struct adc081c *adc; - struct adcxx1c_model *model; + const struct adcxx1c_model *model; int err; =20 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) return -EOPNOTSUPP; =20 - model =3D &adcxx1c_models[id->driver_data]; + if (dev_fwnode(&client->dev)) + model =3D device_get_match_data(&client->dev); + else + model =3D &adcxx1c_models[id->driver_data]; =20 iio =3D devm_iio_device_alloc(&client->dev, sizeof(*adc)); if (!iio) @@ -210,10 +214,17 @@ static const struct i2c_device_id adc081 }; MODULE_DEVICE_TABLE(i2c, adc081c_id); =20 +static const struct acpi_device_id adc081c_acpi_match[] =3D { + /* Used on some AAEON boards */ + { "ADC081C", (kernel_ulong_t)&adcxx1c_models[ADC081C] }, + { } +}; +MODULE_DEVICE_TABLE(acpi, adc081c_acpi_match); + static const struct of_device_id adc081c_of_match[] =3D { - { .compatible =3D "ti,adc081c" }, - { .compatible =3D "ti,adc101c" }, - { .compatible =3D "ti,adc121c" }, + { .compatible =3D "ti,adc081c", .data =3D &adcxx1c_models[ADC081C] }, + { .compatible =3D "ti,adc101c", .data =3D &adcxx1c_models[ADC101C] }, + { .compatible =3D "ti,adc121c", .data =3D &adcxx1c_models[ADC121C] }, { } }; MODULE_DEVICE_TABLE(of, adc081c_of_match); @@ -222,6 +233,7 @@ static struct i2c_driver adc081c_driver .driver =3D { .name =3D "adc081c", .of_match_table =3D adc081c_of_match, + .acpi_match_table =3D adc081c_acpi_match, }, .probe =3D adc081c_probe, .id_table =3D adc081c_id, From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CED71C4332F for ; Mon, 24 Jan 2022 21:27:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451446AbiAXVW4 (ORCPT ); Mon, 24 Jan 2022 16:22:56 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50276 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442810AbiAXUzY (ORCPT ); Mon, 24 Jan 2022 15:55:24 -0500 Received: from smtp.kernel.org (relay.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 58B59B8105C; Mon, 24 Jan 2022 20:55:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DB13C340E5; Mon, 24 Jan 2022 20:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057722; bh=l+gtYq5zMqIJC9T7FFg/WoG6gd4YYnKZA2mw7RhH/1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aqFLcsiR+XlvMopzzu8l53+x4PZ59325kFSFLrjyu5PEQhdx4Gq2jo2QXYyLv21W7 R9TW9YO5jS24UqrBgBkEOD4NRyedNDzOjpagisDdw31MEYrx6W4PoSsPpD4pgfSe7M 9vA055luz9pmECekrDoeOgZNbzhM2Wj6DWdlk2/Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Pengutronix Kernel Team , Dmitry Torokhov , Oleksij Rempel , Stable@vger.kernel.org Subject: [PATCH 5.16 0058/1039] iio: trigger: Fix a scheduling whilst atomic issue seen on tsc2046 Date: Mon, 24 Jan 2022 19:30:47 +0100 Message-Id: <20220124184127.096367441@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jonathan Cameron commit 9020ef659885f2622cfb386cc229b6d618362895 upstream. IIO triggers are software IRQ chips that split an incoming IRQ into separate IRQs routed to all devices using the trigger. When all consumers are done then a trigger callback reenable() is called. There are a few circumstances under which this can happen in atomic context. 1) A single user of the trigger that calls the iio_trigger_done() function from interrupt context. 2) A race between disconnecting the last device from a trigger and the trigger itself sucessfully being disabled. To avoid a resulting scheduling whilst atomic, close this second corner by using schedule_work() to ensure the reenable is not done in atomic context. Note that drivers must be careful to manage the interaction of set_state() and reenable() callbacks to ensure appropriate reference counting if they are relying on the same hardware controls. Deliberately taking this the slow path rather than via a fixes tree because the error has hard to hit and I would like it to soak for a while before hitting a release kernel. Signed-off-by: Jonathan Cameron Cc: Pengutronix Kernel Team Cc: Dmitry Torokhov Tested-by: Oleksij Rempel Cc: Link: https://lore.kernel.org/r/20211017172209.112387-1-jic23@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iio/industrialio-trigger.c | 36 ++++++++++++++++++++++++++++++++= +++- include/linux/iio/trigger.h | 2 ++ 2 files changed, 37 insertions(+), 1 deletion(-) --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -162,6 +162,39 @@ static struct iio_trigger *iio_trigger_a return trig; } =20 +static void iio_reenable_work_fn(struct work_struct *work) +{ + struct iio_trigger *trig =3D container_of(work, struct iio_trigger, + reenable_work); + + /* + * This 'might' occur after the trigger state is set to disabled - + * in that case the driver should skip reenabling. + */ + trig->ops->reenable(trig); +} + +/* + * In general, reenable callbacks may need to sleep and this path is + * not performance sensitive, so just queue up a work item + * to reneable the trigger for us. + * + * Races that can cause this. + * 1) A handler occurs entirely in interrupt context so the counter + * the final decrement is still in this interrupt. + * 2) The trigger has been removed, but one last interrupt gets through. + * + * For (1) we must call reenable, but not in atomic context. + * For (2) it should be safe to call reenanble, if drivers never blindly + * reenable after state is off. + */ +static void iio_trigger_notify_done_atomic(struct iio_trigger *trig) +{ + if (atomic_dec_and_test(&trig->use_count) && trig->ops && + trig->ops->reenable) + schedule_work(&trig->reenable_work); +} + void iio_trigger_poll(struct iio_trigger *trig) { int i; @@ -173,7 +206,7 @@ void iio_trigger_poll(struct iio_trigger if (trig->subirqs[i].enabled) generic_handle_irq(trig->subirq_base + i); else - iio_trigger_notify_done(trig); + iio_trigger_notify_done_atomic(trig); } } } @@ -535,6 +568,7 @@ struct iio_trigger *viio_trigger_alloc(s trig->dev.type =3D &iio_trig_type; trig->dev.bus =3D &iio_bus_type; device_initialize(&trig->dev); + INIT_WORK(&trig->reenable_work, iio_reenable_work_fn); =20 mutex_init(&trig->pool_lock); trig->subirq_base =3D irq_alloc_descs(-1, 0, --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h @@ -55,6 +55,7 @@ struct iio_trigger_ops { * @attached_own_device:[INTERN] if we are using our own device as trigger, * i.e. if we registered a poll function to the same * device as the one providing the trigger. + * @reenable_work: [INTERN] work item used to ensure reenable can sleep. **/ struct iio_trigger { const struct iio_trigger_ops *ops; @@ -74,6 +75,7 @@ struct iio_trigger { unsigned long pool[BITS_TO_LONGS(CONFIG_IIO_CONSUMERS_PER_TRIGGER)]; struct mutex pool_lock; bool attached_own_device; + struct work_struct reenable_work; }; =20 =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68264C43219 for ; Mon, 24 Jan 2022 23:24:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848584AbiAXXWt (ORCPT ); Mon, 24 Jan 2022 18:22:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587812AbiAXW3n (ORCPT ); Mon, 24 Jan 2022 17:29:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B41C02B866; Mon, 24 Jan 2022 12:55:25 -0800 (PST) Received: from smtp.kernel.org (relay.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 930B8611DA; Mon, 24 Jan 2022 20:55:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A3CEC340E5; Mon, 24 Jan 2022 20:55:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057725; bh=kL6LzLw+oTORP83YCmczMg/dp0X5Xod6kpxH5jq3mtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2rYuaOLyKO+bGs0hx1ICPgsWOdtQoSHwLBfY6wJXQhJt30Rwm1PS6nu8Txm1y+Pku aKwLXov0Viwd6fop7PeUh8VlVPTYRF0WUtc/M09qE8ZysXDg941xB2lsJ28hl+Rogm JP/GDnQKt1jVvtH1yzTf+b2MpZvmTxs+3or+kiyg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Arnd Bergmann , Nick Desaulniers , Nathan Chancellor , Christophe Leroy Subject: [PATCH 5.16 0059/1039] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing() Date: Mon, 24 Jan 2022 19:30:48 +0100 Message-Id: <20220124184127.128262775@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit bc93a22a19eb2b68a16ecf04cdf4b2ed65aaf398 upstream. On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA test leads to "Illegal instruction" failure. Looking at the content of rodata_objcopy.o, we see that the function content zeroes only: Disassembly of section .rodata: 0000000000000000 <.lkdtm_rodata_do_nothing>: 0: 00 00 00 00 .long 0x0 Add the contents flag in order to keep the content of the section while renaming it. Disassembly of section .rodata: 0000000000000000 <.lkdtm_rodata_do_nothing>: 0: 4e 80 00 20 blr Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy") Cc: stable@vger.kernel.org Cc: Kees Cook Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Nick Desaulniers Cc: Nathan Chancellor Signed-off-by: Christophe Leroy Reviewed-by: Nick Desaulniers Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/8900731fbc05fb8b0de18af7133a8fc07c3c53a1.16= 33712176.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/misc/lkdtm/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/misc/lkdtm/Makefile +++ b/drivers/misc/lkdtm/Makefile @@ -20,7 +20,7 @@ CFLAGS_REMOVE_rodata.o +=3D $(CC_FLAGS_LT =20 OBJCOPYFLAGS :=3D OBJCOPYFLAGS_rodata_objcopy.o :=3D \ - --rename-section .noinstr.text=3D.rodata,alloc,readonly,load + --rename-section .noinstr.text=3D.rodata,alloc,readonly,load,contents targets +=3D rodata.o rodata_objcopy.o $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE $(call if_changed,objcopy) From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BA63C433EF for ; Mon, 24 Jan 2022 23:24:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848560AbiAXXWp (ORCPT ); Mon, 24 Jan 2022 18:22:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587813AbiAXW3n (ORCPT ); Mon, 24 Jan 2022 17:29:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E039C02B867; Mon, 24 Jan 2022 12:55:30 -0800 (PST) Received: from smtp.kernel.org (relay.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 4B777B80FA3; Mon, 24 Jan 2022 20:55:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D5FBC340E5; Mon, 24 Jan 2022 20:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057727; bh=rKQhAgl7yFVxM0g7KAZgcV30xVzU86ro9qPVgo2ZozQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZUaq+jbNCUp2ZX3HJjUiUSk0X9xZhM1iN+z2jTpBTkZziuH6332zhJruASyrfFSiO dUZDzLQvHG4mlcAQqxMq0DqHd7OaXiLcti/9g0Yl6GbNa999l+w5UOkKllCt0orX0M FxDHw0bKlct2yJg5bpoYk+uoXXtqrpQuLVsWn4qw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bhaumik Bhatt , Hemant Kumar , Manivannan Sadhasivam , Loic Poulain , Manivannan Sadhasivam Subject: [PATCH 5.16 0060/1039] bus: mhi: pci_generic: Graceful shutdown on freeze Date: Mon, 24 Jan 2022 19:30:49 +0100 Message-Id: <20220124184127.165238435@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Loic Poulain commit f77097ec8c0141a4b5cf3722a246be0cb5677e29 upstream. There is no reason for shutting down MHI ungracefully on freeze, this causes the MHI host stack & device stack to not be aligned anymore since the proper MHI reset sequence is not performed for ungraceful shutdown. Link: https://lore.kernel.org/r/1635268180-13699-1-git-send-email-loic.poul= ain@linaro.org Fixes: 5f0c2ee1fe8d ("bus: mhi: pci-generic: Fix hibernation") Cc: stable@vger.kernel.org Suggested-by: Bhaumik Bhatt Reviewed-by: Bhaumik Bhatt Reviewed-by: Hemant Kumar Reviewed-by: Manivannan Sadhasivam Signed-off-by: Loic Poulain Signed-off-by: Manivannan Sadhasivam Link: https://lore.kernel.org/r/20211216081227.237749-3-manivannan.sadhasiv= am@linaro.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bus/mhi/pci_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/bus/mhi/pci_generic.c +++ b/drivers/bus/mhi/pci_generic.c @@ -1018,7 +1018,7 @@ static int __maybe_unused mhi_pci_freeze * context. */ if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) { - mhi_power_down(mhi_cntrl, false); + mhi_power_down(mhi_cntrl, true); mhi_unprepare_after_power_down(mhi_cntrl); } =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C86F2C433FE for ; Mon, 24 Jan 2022 21:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451848AbiAXVXl (ORCPT ); Mon, 24 Jan 2022 16:23:41 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48982 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442839AbiAXUzb (ORCPT ); Mon, 24 Jan 2022 15:55:31 -0500 Received: from smtp.kernel.org (relay.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 6CA816091C; Mon, 24 Jan 2022 20:55:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D0C6C340E5; Mon, 24 Jan 2022 20:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057730; bh=ZysuhQ7Pz6OFnxju1Jqcw21yLpfW3eWSCctuI/N59A8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rj4OPZATGG8MX/u9rdnGo5zB0EAFxQI3eTA7CqTMl2SOJOASaladN5IpdFjAZbmSc dSVVB2RmFQLA4NRUkeOMKi2RO2Nsz9tkic/XIj0R+8IYdVRSf9DzS0sgSYr1GKQzK0 vDv4HReNo+NBSAv78IWlFVacqaxHEBRZW3aCWYjg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Bhaumik Bhatt , Manivannan Sadhasivam Subject: [PATCH 5.16 0061/1039] bus: mhi: core: Fix reading wake_capable channel configuration Date: Mon, 24 Jan 2022 19:30:50 +0100 Message-Id: <20220124184127.196002038@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bhaumik Bhatt commit 42c4668f7efe1485dfc382517b412c0c6ab102b8 upstream. The 'wake-capable' entry in channel configuration is not set when parsing the configuration specified by the controller driver. Add the missing entry to ensure channel is correctly specified as a 'wake-capable' channel. Link: https://lore.kernel.org/r/1638320491-13382-1-git-send-email-quic_bbha= tt@quicinc.com Fixes: 0cbf260820fa ("bus: mhi: core: Add support for registering MHI contr= ollers") Cc: stable@vger.kernel.org Reviewed-by: Manivannan Sadhasivam Signed-off-by: Bhaumik Bhatt Signed-off-by: Manivannan Sadhasivam Link: https://lore.kernel.org/r/20211216081227.237749-7-manivannan.sadhasiv= am@linaro.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bus/mhi/core/init.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -788,6 +788,7 @@ static int parse_ch_cfg(struct mhi_contr mhi_chan->offload_ch =3D ch_cfg->offload_channel; mhi_chan->db_cfg.reset_req =3D ch_cfg->doorbell_mode_switch; mhi_chan->pre_alloc =3D ch_cfg->auto_queue; + mhi_chan->wake_capable =3D ch_cfg->wake_capable; =20 /* * If MHI host allocates buffers, then the channel direction From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD281C433F5 for ; Mon, 24 Jan 2022 21:27:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451822AbiAXVXj (ORCPT ); Mon, 24 Jan 2022 16:23:39 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46816 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442867AbiAXUzf (ORCPT ); Mon, 24 Jan 2022 15:55:35 -0500 Received: from smtp.kernel.org (relay.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 7B015612C3; Mon, 24 Jan 2022 20:55:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55A18C340EA; Mon, 24 Jan 2022 20:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057733; bh=XmunwkHp3uSTDer0TGSDoR8vFkcsn6YyKg9JSHU7/wM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aqaz7oDnQ3K3IcyldeYn7nz7Wt7W87rLKQjeBJ0h10gdNDmQE5VK/xpQdztjTB0DB wRPnGJbH31wmkcjTLTO9RFJJgvmz0E9f45hxtd9tkyk3UhAfjPm15cVqfNWbwDm6D/ CV87PIsZWxXRI7mjrR85aYKAQPiQyrRjr7kxVn64= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aleksander Morgado , Thomas Perrot , Manivannan Sadhasivam Subject: [PATCH 5.16 0062/1039] bus: mhi: core: Fix race while handling SYS_ERR at power up Date: Mon, 24 Jan 2022 19:30:51 +0100 Message-Id: <20220124184127.234835641@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Manivannan Sadhasivam commit d651ce8e917fa1bf6cfab8dca74c512edffc35d3 upstream. During SYS_ERR condition, as a response to the MHI_RESET from host, some devices tend to issue BHI interrupt without clearing the SYS_ERR state in the device. This creates a race condition and causes a failure in booting up the device. The issue is seen on the Sierra Wireless EM9191 modem during SYS_ERR handling in mhi_async_power_up(). Once the host detects that the device is in SYS_ERR state, it issues MHI_RESET and waits for the device to process the reset request. During this time, the device triggers the BHI interrupt to the host without clearing SYS_ERR condition. So the host starts handling the SYS_ERR condition again. To fix this issue, let's register the IRQ handler only after handling the SYS_ERR check to avoid getting spurious IRQs from the device. Fixes: e18d4e9fa79b ("bus: mhi: core: Handle syserr during power_up") Cc: stable@vger.kernel.org Reported-by: Aleksander Morgado Tested-by: Aleksander Morgado Tested-by: Thomas Perrot Signed-off-by: Manivannan Sadhasivam Link: https://lore.kernel.org/r/20211216081227.237749-8-manivannan.sadhasiv= am@linaro.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bus/mhi/core/pm.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -1053,7 +1053,7 @@ int mhi_async_power_up(struct mhi_contro enum mhi_ee_type current_ee; enum dev_st_transition next_state; struct device *dev =3D &mhi_cntrl->mhi_dev->dev; - u32 val; + u32 interval_us =3D 25000; /* poll register field every 25 milliseconds */ int ret; =20 dev_info(dev, "Requested to power ON\n"); @@ -1070,10 +1070,6 @@ int mhi_async_power_up(struct mhi_contro mutex_lock(&mhi_cntrl->pm_mutex); mhi_cntrl->pm_state =3D MHI_PM_DISABLE; =20 - ret =3D mhi_init_irq_setup(mhi_cntrl); - if (ret) - goto error_setup_irq; - /* Setup BHI INTVEC */ write_lock_irq(&mhi_cntrl->pm_lock); mhi_write_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_INTVEC, 0); @@ -1087,7 +1083,7 @@ int mhi_async_power_up(struct mhi_contro dev_err(dev, "%s is not a valid EE for power on\n", TO_MHI_EXEC_STR(current_ee)); ret =3D -EIO; - goto error_async_power_up; + goto error_exit; } =20 state =3D mhi_get_mhi_state(mhi_cntrl); @@ -1096,20 +1092,12 @@ int mhi_async_power_up(struct mhi_contro =20 if (state =3D=3D MHI_STATE_SYS_ERR) { mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET); - ret =3D wait_event_timeout(mhi_cntrl->state_event, - MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state) || - mhi_read_reg_field(mhi_cntrl, - mhi_cntrl->regs, - MHICTRL, - MHICTRL_RESET_MASK, - MHICTRL_RESET_SHIFT, - &val) || - !val, - msecs_to_jiffies(mhi_cntrl->timeout_ms)); - if (!ret) { - ret =3D -EIO; + ret =3D mhi_poll_reg_field(mhi_cntrl, mhi_cntrl->regs, MHICTRL, + MHICTRL_RESET_MASK, MHICTRL_RESET_SHIFT, 0, + interval_us); + if (ret) { dev_info(dev, "Failed to reset MHI due to syserr state\n"); - goto error_async_power_up; + goto error_exit; } =20 /* @@ -1119,6 +1107,10 @@ int mhi_async_power_up(struct mhi_contro mhi_write_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_INTVEC, 0); } =20 + ret =3D mhi_init_irq_setup(mhi_cntrl); + if (ret) + goto error_exit; + /* Transition to next state */ next_state =3D MHI_IN_PBL(current_ee) ? DEV_ST_TRANSITION_PBL : DEV_ST_TRANSITION_READY; @@ -1131,10 +1123,7 @@ int mhi_async_power_up(struct mhi_contro =20 return 0; =20 -error_async_power_up: - mhi_deinit_free_irq(mhi_cntrl); - -error_setup_irq: +error_exit: mhi_cntrl->pm_state =3D MHI_PM_DISABLE; mutex_unlock(&mhi_cntrl->pm_mutex); =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAE16C43217 for ; Mon, 24 Jan 2022 21:27:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451784AbiAXVXf (ORCPT ); Mon, 24 Jan 2022 16:23:35 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50404 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442888AbiAXUzk (ORCPT ); Mon, 24 Jan 2022 15:55:40 -0500 Received: from smtp.kernel.org (relay.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 277E2B81063; Mon, 24 Jan 2022 20:55:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 505D9C340E5; Mon, 24 Jan 2022 20:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057736; bh=xgcyrFkC9UljTjBgXTXk9Fpz/ONmehoFX52datGdw2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CjnNok/L+5aLth2s5ezdHO8/dx7bir9HYXY67SlrvAFcjryCuVu5H3N7pxln0O/wP grVUsORK07nd1gus/JieUxI7uLNz5rUMcvyIXKrXydEOk8YhU5fl9eruTa6F1JKQgr GIs642dAGICMtft39ifNd0CgxVp2ACasUoGqwz30= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Ben Widawsky , Dan Williams Subject: [PATCH 5.16 0063/1039] cxl/pmem: Fix reference counting for delayed work Date: Mon, 24 Jan 2022 19:30:52 +0100 Message-Id: <20220124184127.272839072@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 08b9e0ab8af48895337192e683de44ab1e1b7427 upstream. There is a potential race between queue_work() returning and the queued-work running that could result in put_device() running before get_device(). Introduce the cxl_nvdimm_bridge_state_work() helper that takes the reference unconditionally, but drops it if no new work was queued, to keep the references balanced. Fixes: 8fdcb1704f61 ("cxl/pmem: Add initial infrastructure for pmem support= ") Cc: Reviewed-by: Jonathan Cameron Reviewed-by: Ben Widawsky Link: https://lore.kernel.org/r/163553734757.2509761.3305231863616785470.st= git@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/cxl/pmem.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) --- a/drivers/cxl/pmem.c +++ b/drivers/cxl/pmem.c @@ -266,14 +266,24 @@ static void cxl_nvb_update_state(struct put_device(&cxl_nvb->dev); } =20 +static void cxl_nvdimm_bridge_state_work(struct cxl_nvdimm_bridge *cxl_nvb) +{ + /* + * Take a reference that the workqueue will drop if new work + * gets queued. + */ + get_device(&cxl_nvb->dev); + if (!queue_work(cxl_pmem_wq, &cxl_nvb->state_work)) + put_device(&cxl_nvb->dev); +} + static void cxl_nvdimm_bridge_remove(struct device *dev) { struct cxl_nvdimm_bridge *cxl_nvb =3D to_cxl_nvdimm_bridge(dev); =20 if (cxl_nvb->state =3D=3D CXL_NVB_ONLINE) cxl_nvb->state =3D CXL_NVB_OFFLINE; - if (queue_work(cxl_pmem_wq, &cxl_nvb->state_work)) - get_device(&cxl_nvb->dev); + cxl_nvdimm_bridge_state_work(cxl_nvb); } =20 static int cxl_nvdimm_bridge_probe(struct device *dev) @@ -294,8 +304,7 @@ static int cxl_nvdimm_bridge_probe(struc } =20 cxl_nvb->state =3D CXL_NVB_ONLINE; - if (queue_work(cxl_pmem_wq, &cxl_nvb->state_work)) - get_device(&cxl_nvb->dev); + cxl_nvdimm_bridge_state_work(cxl_nvb); =20 return 0; } From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6ADDC4332F for ; Mon, 24 Jan 2022 21:27:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451694AbiAXVXV (ORCPT ); Mon, 24 Jan 2022 16:23:21 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51750 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442905AbiAXUzm (ORCPT ); Mon, 24 Jan 2022 15:55:42 -0500 Received: from smtp.kernel.org (relay.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 27D60B80FA3; Mon, 24 Jan 2022 20:55:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 445C2C340E5; Mon, 24 Jan 2022 20:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057739; bh=pVK1zsOv/0tLmL9MAv8ItgdQ70hS1BVlTrlXQD9JcgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ChswbOSzSRZb81wsQARLfxY/cdt/ONZPB5YBnioKYQAZO9KJOPPC5TmzWJiBUiRcZ Tx3S+bJPhF+SxQ3s+Kvc094zBitwFD2xplVmNDqMWT94lnDZEq6Jwt9syfBogC6C/3 Q43afBkDR2SsyZfJIewjwmAfqCH29xbRxih1X+9Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vishal Verma , Dan Williams Subject: [PATCH 5.16 0064/1039] cxl/pmem: Fix module reload vs workqueue state Date: Mon, 24 Jan 2022 19:30:53 +0100 Message-Id: <20220124184127.315214525@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 53989fad1286e652ea3655ae3367ba698da8d2ff upstream. A test of the form: while true; do modprobe -r cxl_pmem; modprobe cxl_pmem; done May lead to a crash signature of the form: BUG: unable to handle page fault for address: ffffffffc0660030 #PF: supervisor instruction fetch in kernel mode #PF: error_code(0x0010) - not-present page [..] Workqueue: cxl_pmem 0xffffffffc0660030 RIP: 0010:0xffffffffc0660030 Code: Unable to access opcode bytes at RIP 0xffffffffc0660006. [..] Call Trace: ? process_one_work+0x4ec/0x9c0 ? pwq_dec_nr_in_flight+0x100/0x100 ? rwlock_bug.part.0+0x60/0x60 ? worker_thread+0x2eb/0x700 In that report the 0xffffffffc0660030 address corresponds to the former function address of cxl_nvb_update_state() from a previous load of the module, not the current address. Fix that by arranging for ->state_work in the 'struct cxl_nvdimm_bridge' object to be reinitialized on cxl_pmem module reload. Details: Recall that CXL subsystem wants to link a CXL memory expander device to an NVDIMM sub-hierarchy when both a persistent memory range has been registered by the CXL platform driver (cxl_acpi) *and* when that CXL memory expander has published persistent memory capacity (Get Partition Info). To this end the cxl_nvdimm_bridge driver arranges to rescan the CXL bus when either of those conditions change. The helper bus_rescan_devices() can not be called underneath the device_lock() for any device on that bus, so the cxl_nvdimm_bridge driver uses a workqueue for the rescan. Typically a driver allocates driver data to hold a 'struct work_struct' for a driven device, but for a workqueue that may run after ->remove() returns, driver data will have been freed. The 'struct cxl_nvdimm_bridge' object holds the state and work_struct directly. Unfortunately it was only arranging for that infrastructure to be initialized once per device creation rather than the necessary once per workqueue (cxl_pmem_wq) creation. Introduce is_cxl_nvdimm_bridge() and cxl_nvdimm_bridge_reset() in support of invalidating stale references to a recently destroyed cxl_pmem_wq. Cc: Fixes: 8fdcb1704f61 ("cxl/pmem: Add initial infrastructure for pmem support= ") Reported-by: Vishal Verma Tested-by: Vishal Verma Link: https://lore.kernel.org/r/163665474585.3505991.8397182770066720755.st= git@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/cxl/core/pmem.c | 8 +++++++- drivers/cxl/cxl.h | 8 ++++++++ drivers/cxl/pmem.c | 29 +++++++++++++++++++++++++++-- 3 files changed, 42 insertions(+), 3 deletions(-) --- a/drivers/cxl/core/pmem.c +++ b/drivers/cxl/core/pmem.c @@ -51,10 +51,16 @@ struct cxl_nvdimm_bridge *to_cxl_nvdimm_ } EXPORT_SYMBOL_GPL(to_cxl_nvdimm_bridge); =20 -__mock int match_nvdimm_bridge(struct device *dev, const void *data) +bool is_cxl_nvdimm_bridge(struct device *dev) { return dev->type =3D=3D &cxl_nvdimm_bridge_type; } +EXPORT_SYMBOL_NS_GPL(is_cxl_nvdimm_bridge, CXL); + +__mock int match_nvdimm_bridge(struct device *dev, const void *data) +{ + return is_cxl_nvdimm_bridge(dev); +} =20 struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct cxl_nvdimm *cxl_nv= d) { --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -196,6 +196,13 @@ struct cxl_decoder { }; =20 =20 +/** + * enum cxl_nvdimm_brige_state - state machine for managing bus rescans + * @CXL_NVB_NEW: Set at bridge create and after cxl_pmem_wq is destroyed + * @CXL_NVB_DEAD: Set at brige unregistration to preclude async probing + * @CXL_NVB_ONLINE: Target state after successful ->probe() + * @CXL_NVB_OFFLINE: Target state after ->remove() or failed ->probe() + */ enum cxl_nvdimm_brige_state { CXL_NVB_NEW, CXL_NVB_DEAD, @@ -308,6 +315,7 @@ struct cxl_nvdimm_bridge *devm_cxl_add_n struct cxl_port *port); struct cxl_nvdimm *to_cxl_nvdimm(struct device *dev); bool is_cxl_nvdimm(struct device *dev); +bool is_cxl_nvdimm_bridge(struct device *dev); int devm_cxl_add_nvdimm(struct device *host, struct cxl_memdev *cxlmd); struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct cxl_nvdimm *cxl_nv= d); =20 --- a/drivers/cxl/pmem.c +++ b/drivers/cxl/pmem.c @@ -316,6 +316,31 @@ static struct cxl_driver cxl_nvdimm_brid .id =3D CXL_DEVICE_NVDIMM_BRIDGE, }; =20 +/* + * Return all bridges to the CXL_NVB_NEW state to invalidate any + * ->state_work referring to the now destroyed cxl_pmem_wq. + */ +static int cxl_nvdimm_bridge_reset(struct device *dev, void *data) +{ + struct cxl_nvdimm_bridge *cxl_nvb; + + if (!is_cxl_nvdimm_bridge(dev)) + return 0; + + cxl_nvb =3D to_cxl_nvdimm_bridge(dev); + device_lock(dev); + cxl_nvb->state =3D CXL_NVB_NEW; + device_unlock(dev); + + return 0; +} + +static void destroy_cxl_pmem_wq(void) +{ + destroy_workqueue(cxl_pmem_wq); + bus_for_each_dev(&cxl_bus_type, NULL, NULL, cxl_nvdimm_bridge_reset); +} + static __init int cxl_pmem_init(void) { int rc; @@ -341,7 +366,7 @@ static __init int cxl_pmem_init(void) err_nvdimm: cxl_driver_unregister(&cxl_nvdimm_bridge_driver); err_bridge: - destroy_workqueue(cxl_pmem_wq); + destroy_cxl_pmem_wq(); return rc; } =20 @@ -349,7 +374,7 @@ static __exit void cxl_pmem_exit(void) { cxl_driver_unregister(&cxl_nvdimm_driver); cxl_driver_unregister(&cxl_nvdimm_bridge_driver); - destroy_workqueue(cxl_pmem_wq); + destroy_cxl_pmem_wq(); } =20 MODULE_LICENSE("GPL v2"); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6058AC433FE for ; Mon, 24 Jan 2022 23:29:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850221AbiAXX1i (ORCPT ); Mon, 24 Jan 2022 18:27:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588099AbiAXWbZ (ORCPT ); Mon, 24 Jan 2022 17:31:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 966F9C047CD1; Mon, 24 Jan 2022 12:55:45 -0800 (PST) Received: from smtp.kernel.org (relay.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 37672B810BD; Mon, 24 Jan 2022 20:55:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49F76C340E5; Mon, 24 Jan 2022 20:55:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057743; bh=xG9/wp4QhclzXUsRrWZ3fP0amrmmXCl5YVFu01iM94I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xaKLJWDvo5WJpE5l80+FynHcVmHMj9zK/wRba5zTQ9bEHuDkSwTNKHOKfyZzhW6UM mAfUmO0M8FRtGgtP9IDyspjAzEfngPYvlo885HRPvVGZipMszclCDFPJmeXuyI8GUQ EhBOJso5D8sODL6pVb4Ynpg++ZuK6zSYxT5yfljI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sumeet Pawnikar , Srinivas Pandruvada , "Rafael J. Wysocki" Subject: [PATCH 5.16 0065/1039] thermal/drivers/int340x: Fix RFIM mailbox write commands Date: Mon, 24 Jan 2022 19:30:54 +0100 Message-Id: <20220124184127.348109281@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sumeet Pawnikar commit 2685c77b80a80c57e2a25a726b82fb31e6e212ab upstream. The existing mail mechanism only supports writing of workload types. However, mailbox command for RFIM (cmd =3D 0x08) also requires write operation which is ignored. This results in failing to store RFI restriction. Fixint this requires enhancing mailbox writes for non workload commands too, so remove the check for MBOX_CMD_WORKLOAD_TYPE_WRITE in mailbox write to allow this other write commands to be supoorted. At the same time, however, we have to make sure that there is no impact on read commands, by avoiding to write anything into the mailbox data register. To properly implement that, add two separate functions for mbox read and write commands for the processor thermal workload command type. This helps to distinguish the read and write workload command types from each other while sending mbox commands. Fixes: 5d6fbc96bd36 ("thermal/drivers/int340x: processor_thermal: Export ad= ditional attributes") Signed-off-by: Sumeet Pawnikar Cc: 5.14+ # 5.14+ Acked-by: Srinivas Pandruvada [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/thermal/intel/int340x_thermal/processor_thermal_device.h | 3=20 drivers/thermal/intel/int340x_thermal/processor_thermal_mbox.c | 100 ++= +++----- drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c | 23 +- 3 files changed, 73 insertions(+), 53 deletions(-) --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h @@ -80,7 +80,8 @@ void proc_thermal_rfim_remove(struct pci int proc_thermal_mbox_add(struct pci_dev *pdev, struct proc_thermal_device= *proc_priv); void proc_thermal_mbox_remove(struct pci_dev *pdev); =20 -int processor_thermal_send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 = cmd_data, u64 *cmd_resp); +int processor_thermal_send_mbox_read_cmd(struct pci_dev *pdev, u16 id, u64= *resp); +int processor_thermal_send_mbox_write_cmd(struct pci_dev *pdev, u16 id, u3= 2 data); int proc_thermal_add(struct device *dev, struct proc_thermal_device *priv); void proc_thermal_remove(struct proc_thermal_device *proc_priv); int proc_thermal_suspend(struct device *dev); --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_mbox.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_mbox.c @@ -24,19 +24,15 @@ =20 static DEFINE_MUTEX(mbox_lock); =20 -static int send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u= 64 *cmd_resp) +static int wait_for_mbox_ready(struct proc_thermal_device *proc_priv) { - struct proc_thermal_device *proc_priv; u32 retries, data; int ret; =20 - mutex_lock(&mbox_lock); - proc_priv =3D pci_get_drvdata(pdev); - /* Poll for rb bit =3D=3D 0 */ retries =3D MBOX_RETRY_COUNT; do { - data =3D readl((void __iomem *) (proc_priv->mmio_base + MBOX_OFFSET_INTE= RFACE)); + data =3D readl(proc_priv->mmio_base + MBOX_OFFSET_INTERFACE); if (data & BIT_ULL(MBOX_BUSY_BIT)) { ret =3D -EBUSY; continue; @@ -45,53 +41,78 @@ static int send_mbox_cmd(struct pci_dev break; } while (--retries); =20 + return ret; +} + +static int send_mbox_write_cmd(struct pci_dev *pdev, u16 id, u32 data) +{ + struct proc_thermal_device *proc_priv; + u32 reg_data; + int ret; + + proc_priv =3D pci_get_drvdata(pdev); + + mutex_lock(&mbox_lock); + + ret =3D wait_for_mbox_ready(proc_priv); if (ret) goto unlock_mbox; =20 - if (cmd_id =3D=3D MBOX_CMD_WORKLOAD_TYPE_WRITE) - writel(cmd_data, (void __iomem *) ((proc_priv->mmio_base + MBOX_OFFSET_D= ATA))); - + writel(data, (proc_priv->mmio_base + MBOX_OFFSET_DATA)); /* Write command register */ - data =3D BIT_ULL(MBOX_BUSY_BIT) | cmd_id; - writel(data, (void __iomem *) ((proc_priv->mmio_base + MBOX_OFFSET_INTERF= ACE))); + reg_data =3D BIT_ULL(MBOX_BUSY_BIT) | id; + writel(reg_data, (proc_priv->mmio_base + MBOX_OFFSET_INTERFACE)); =20 - /* Poll for rb bit =3D=3D 0 */ - retries =3D MBOX_RETRY_COUNT; - do { - data =3D readl((void __iomem *) (proc_priv->mmio_base + MBOX_OFFSET_INTE= RFACE)); - if (data & BIT_ULL(MBOX_BUSY_BIT)) { - ret =3D -EBUSY; - continue; - } + ret =3D wait_for_mbox_ready(proc_priv); =20 - if (data) { - ret =3D -ENXIO; - goto unlock_mbox; - } +unlock_mbox: + mutex_unlock(&mbox_lock); + return ret; +} =20 - ret =3D 0; +static int send_mbox_read_cmd(struct pci_dev *pdev, u16 id, u64 *resp) +{ + struct proc_thermal_device *proc_priv; + u32 reg_data; + int ret; =20 - if (!cmd_resp) - break; + proc_priv =3D pci_get_drvdata(pdev); =20 - if (cmd_id =3D=3D MBOX_CMD_WORKLOAD_TYPE_READ) - *cmd_resp =3D readl((void __iomem *) (proc_priv->mmio_base + MBOX_OFFSE= T_DATA)); - else - *cmd_resp =3D readq((void __iomem *) (proc_priv->mmio_base + MBOX_OFFSE= T_DATA)); + mutex_lock(&mbox_lock); =20 - break; - } while (--retries); + ret =3D wait_for_mbox_ready(proc_priv); + if (ret) + goto unlock_mbox; + + /* Write command register */ + reg_data =3D BIT_ULL(MBOX_BUSY_BIT) | id; + writel(reg_data, (proc_priv->mmio_base + MBOX_OFFSET_INTERFACE)); + + ret =3D wait_for_mbox_ready(proc_priv); + if (ret) + goto unlock_mbox; + + if (id =3D=3D MBOX_CMD_WORKLOAD_TYPE_READ) + *resp =3D readl(proc_priv->mmio_base + MBOX_OFFSET_DATA); + else + *resp =3D readq(proc_priv->mmio_base + MBOX_OFFSET_DATA); =20 unlock_mbox: mutex_unlock(&mbox_lock); return ret; } =20 -int processor_thermal_send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 = cmd_data, u64 *cmd_resp) +int processor_thermal_send_mbox_read_cmd(struct pci_dev *pdev, u16 id, u64= *resp) { - return send_mbox_cmd(pdev, cmd_id, cmd_data, cmd_resp); + return send_mbox_read_cmd(pdev, id, resp); } -EXPORT_SYMBOL_GPL(processor_thermal_send_mbox_cmd); +EXPORT_SYMBOL_NS_GPL(processor_thermal_send_mbox_read_cmd, INT340X_THERMAL= ); + +int processor_thermal_send_mbox_write_cmd(struct pci_dev *pdev, u16 id, u3= 2 data) +{ + return send_mbox_write_cmd(pdev, id, data); +} +EXPORT_SYMBOL_NS_GPL(processor_thermal_send_mbox_write_cmd, INT340X_THERMA= L); =20 /* List of workload types */ static const char * const workload_types[] =3D { @@ -104,7 +125,6 @@ static const char * const workload_types NULL }; =20 - static ssize_t workload_available_types_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -146,7 +166,7 @@ static ssize_t workload_type_store(struc =20 data |=3D ret; =20 - ret =3D send_mbox_cmd(pdev, MBOX_CMD_WORKLOAD_TYPE_WRITE, data, NULL); + ret =3D send_mbox_write_cmd(pdev, MBOX_CMD_WORKLOAD_TYPE_WRITE, data); if (ret) return false; =20 @@ -161,7 +181,7 @@ static ssize_t workload_type_show(struct u64 cmd_resp; int ret; =20 - ret =3D send_mbox_cmd(pdev, MBOX_CMD_WORKLOAD_TYPE_READ, 0, &cmd_resp); + ret =3D send_mbox_read_cmd(pdev, MBOX_CMD_WORKLOAD_TYPE_READ, &cmd_resp); if (ret) return false; =20 @@ -186,8 +206,6 @@ static const struct attribute_group work .name =3D "workload_request" }; =20 - - static bool workload_req_created; =20 int proc_thermal_mbox_add(struct pci_dev *pdev, struct proc_thermal_device= *proc_priv) @@ -196,7 +214,7 @@ int proc_thermal_mbox_add(struct pci_dev int ret; =20 /* Check if there is a mailbox support, if fails return success */ - ret =3D send_mbox_cmd(pdev, MBOX_CMD_WORKLOAD_TYPE_READ, 0, &cmd_resp); + ret =3D send_mbox_read_cmd(pdev, MBOX_CMD_WORKLOAD_TYPE_READ, &cmd_resp); if (ret) return 0; =20 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c @@ -9,6 +9,8 @@ #include #include "processor_thermal_device.h" =20 +MODULE_IMPORT_NS(INT340X_THERMAL); + struct mmio_reg { int read_only; u32 offset; @@ -194,8 +196,7 @@ static ssize_t rfi_restriction_store(str struct device_attribute *attr, const char *buf, size_t count) { - u16 cmd_id =3D 0x0008; - u64 cmd_resp; + u16 id =3D 0x0008; u32 input; int ret; =20 @@ -203,7 +204,7 @@ static ssize_t rfi_restriction_store(str if (ret) return ret; =20 - ret =3D processor_thermal_send_mbox_cmd(to_pci_dev(dev), cmd_id, input, &= cmd_resp); + ret =3D processor_thermal_send_mbox_write_cmd(to_pci_dev(dev), id, input); if (ret) return ret; =20 @@ -214,30 +215,30 @@ static ssize_t rfi_restriction_show(stru struct device_attribute *attr, char *buf) { - u16 cmd_id =3D 0x0007; - u64 cmd_resp; + u16 id =3D 0x0007; + u64 resp; int ret; =20 - ret =3D processor_thermal_send_mbox_cmd(to_pci_dev(dev), cmd_id, 0, &cmd_= resp); + ret =3D processor_thermal_send_mbox_read_cmd(to_pci_dev(dev), id, &resp); if (ret) return ret; =20 - return sprintf(buf, "%llu\n", cmd_resp); + return sprintf(buf, "%llu\n", resp); } =20 static ssize_t ddr_data_rate_show(struct device *dev, struct device_attribute *attr, char *buf) { - u16 cmd_id =3D 0x0107; - u64 cmd_resp; + u16 id =3D 0x0107; + u64 resp; int ret; =20 - ret =3D processor_thermal_send_mbox_cmd(to_pci_dev(dev), cmd_id, 0, &cmd_= resp); + ret =3D processor_thermal_send_mbox_read_cmd(to_pci_dev(dev), id, &resp); if (ret) return ret; =20 - return sprintf(buf, "%llu\n", cmd_resp); + return sprintf(buf, "%llu\n", resp); } =20 static DEVICE_ATTR_RW(rfi_restriction); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C36DC433F5 for ; Mon, 24 Jan 2022 23:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849164AbiAXXY5 (ORCPT ); Mon, 24 Jan 2022 18:24:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588106AbiAXWb2 (ORCPT ); Mon, 24 Jan 2022 17:31:28 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DF1CC047CD2; Mon, 24 Jan 2022 12:55:47 -0800 (PST) Received: from smtp.kernel.org (relay.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 45A3AB810BD; Mon, 24 Jan 2022 20:55:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E1E7C340E5; Mon, 24 Jan 2022 20:55:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057746; bh=V9iYAufSsS6be9z919tbPe8dpbb0u8ajnrEKYbMnD3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EyNiN4hUHLBoxkOgXyrPV9PN+T+G2MOwIfgenaN78RxmLJK5JFa7JtffZqNyC2chn JH51FdXUnpZlIb5vw3Kzp0u1doo7xrYXmUF8u3FX8+CsmZEDrOaA1G2f/cgSIWYjoj Z2S/aG9xH3PdMX085RQVrCw+XCOzski76DWPnyWc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, D Scott Phillips , Marc Zyngier , Catalin Marinas Subject: [PATCH 5.16 0066/1039] arm64: errata: Fix exec handling in erratum 1418040 workaround Date: Mon, 24 Jan 2022 19:30:55 +0100 Message-Id: <20220124184127.386024672@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: D Scott Phillips commit 38e0257e0e6f4fef2aa2966b089b56a8b1cfb75c upstream. The erratum 1418040 workaround enables CNTVCT_EL1 access trapping in EL0 when executing compat threads. The workaround is applied when switching between tasks, but the need for the workaround could also change at an exec(), when a non-compat task execs a compat binary or vice versa. Apply the workaround in arch_setup_new_exec(). This leaves a small window of time between SET_PERSONALITY and arch_setup_new_exec where preemption could occur and confuse the old workaround logic that compares TIF_32BIT between prev and next. Instead, we can just read cntkctl to make sure it's in the state that the next task needs. I measured cntkctl read time to be about the same as a mov from a general-purpose register on N1. Update the workaround logic to examine the current value of cntkctl instead of the previous task's compat state. Fixes: d49f7d7376d0 ("arm64: Move handling of erratum 1418040 into C code") Cc: # 5.9.x Signed-off-by: D Scott Phillips Reviewed-by: Marc Zyngier Link: https://lore.kernel.org/r/20211220234114.3926-1-scott@os.amperecomput= ing.com Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/kernel/process.c | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -439,34 +439,26 @@ static void entry_task_switch(struct tas =20 /* * ARM erratum 1418040 handling, affecting the 32bit view of CNTVCT. - * Assuming the virtual counter is enabled at the beginning of times: - * - * - disable access when switching from a 64bit task to a 32bit task - * - enable access when switching from a 32bit task to a 64bit task + * Ensure access is disabled when switching to a 32bit task, ensure + * access is enabled when switching to a 64bit task. */ -static void erratum_1418040_thread_switch(struct task_struct *prev, - struct task_struct *next) +static void erratum_1418040_thread_switch(struct task_struct *next) { - bool prev32, next32; - u64 val; - - if (!IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040)) - return; - - prev32 =3D is_compat_thread(task_thread_info(prev)); - next32 =3D is_compat_thread(task_thread_info(next)); - - if (prev32 =3D=3D next32 || !this_cpu_has_cap(ARM64_WORKAROUND_1418040)) + if (!IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040) || + !this_cpu_has_cap(ARM64_WORKAROUND_1418040)) return; =20 - val =3D read_sysreg(cntkctl_el1); - - if (!next32) - val |=3D ARCH_TIMER_USR_VCT_ACCESS_EN; + if (is_compat_thread(task_thread_info(next))) + sysreg_clear_set(cntkctl_el1, ARCH_TIMER_USR_VCT_ACCESS_EN, 0); else - val &=3D ~ARCH_TIMER_USR_VCT_ACCESS_EN; + sysreg_clear_set(cntkctl_el1, 0, ARCH_TIMER_USR_VCT_ACCESS_EN); +} =20 - write_sysreg(val, cntkctl_el1); +static void erratum_1418040_new_exec(void) +{ + preempt_disable(); + erratum_1418040_thread_switch(current); + preempt_enable(); } =20 /* @@ -501,7 +493,7 @@ __notrace_funcgraph struct task_struct * contextidr_thread_switch(next); entry_task_switch(next); ssbs_thread_switch(next); - erratum_1418040_thread_switch(prev, next); + erratum_1418040_thread_switch(next); ptrauth_thread_switch_user(next); =20 /* @@ -611,6 +603,7 @@ void arch_setup_new_exec(void) current->mm->context.flags =3D mmflags; ptrauth_thread_init_user(); mte_thread_init_user(); + erratum_1418040_new_exec(); =20 if (task_spec_ssb_noexec(current)) { arch_prctl_spec_ctrl_set(current, PR_SPEC_STORE_BYPASS, From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FE70C4167B for ; Mon, 24 Jan 2022 21:27:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451672AbiAXVXT (ORCPT ); Mon, 24 Jan 2022 16:23:19 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51818 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442949AbiAXUzv (ORCPT ); Mon, 24 Jan 2022 15:55:51 -0500 Received: from smtp.kernel.org (relay.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 34575B8121C; Mon, 24 Jan 2022 20:55:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 657E4C340E5; Mon, 24 Jan 2022 20:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057748; bh=P3mP2RwBxJp/EBT6OaLms76ZlqOs6NnvvLLYqQRsXt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C7pAyoT8uJ6v22CKD3Av+hqwn11CTwZoHAQ5BVTaYZZZkgU9Di+YhvL+7PBKwuXdx u5FWBxS3kTCInjWFeO694Py3hQJ5/qtetKHTUzj2g06SoUPjlNH0DDB7PqoyK3eepS tn7j8Wk+x35BxrFGhVKjmT73p7meKKm0vjud3nD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hari Prasath , Nicolas Ferre Subject: [PATCH 5.16 0067/1039] ARM: dts: at91: update alternate function of signal PD20 Date: Mon, 24 Jan 2022 19:30:56 +0100 Message-Id: <20220124184127.418111473@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hari Prasath commit 12f332d2dd3187472f595b678246adb10d886bd0 upstream. The alternate function of PD20 is 4 as per the datasheet of sama7g5 and not 5 as defined earlier. Signed-off-by: Hari Prasath Fixes: 7540629e2fc7 ("ARM: dts: at91: add sama7g5 SoC DT and sama7g5-ek") Cc: # v5.15+ Signed-off-by: Nicolas Ferre Link: https://lore.kernel.org/r/20211208063553.19807-1-Hari.PrasathGE@micro= chip.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/boot/dts/sama7g5-pinfunc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm/boot/dts/sama7g5-pinfunc.h +++ b/arch/arm/boot/dts/sama7g5-pinfunc.h @@ -765,7 +765,7 @@ #define PIN_PD20__PCK0 PINMUX_PIN(PIN_PD20, 1, 3) #define PIN_PD20__FLEXCOM2_IO3 PINMUX_PIN(PIN_PD20, 2, 2) #define PIN_PD20__PWMH3 PINMUX_PIN(PIN_PD20, 3, 4) -#define PIN_PD20__CANTX4 PINMUX_PIN(PIN_PD20, 5, 2) +#define PIN_PD20__CANTX4 PINMUX_PIN(PIN_PD20, 4, 2) #define PIN_PD20__FLEXCOM5_IO0 PINMUX_PIN(PIN_PD20, 6, 5) #define PIN_PD21 117 #define PIN_PD21__GPIO PINMUX_PIN(PIN_PD21, 0, 0) From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F471C43217 for ; Mon, 24 Jan 2022 23:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850079AbiAXX1Y (ORCPT ); Mon, 24 Jan 2022 18:27:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588117AbiAXWbl (ORCPT ); Mon, 24 Jan 2022 17:31:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58267C047CD3; Mon, 24 Jan 2022 12:55:57 -0800 (PST) Received: from smtp.kernel.org (relay.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 21450B811FB; Mon, 24 Jan 2022 20:55:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56A7DC340E8; Mon, 24 Jan 2022 20:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057754; bh=X/qys7L9pCMYpCx7HVypXrulSy7QADU69CUKRClP4vA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tq8qV9jsEY2yblDnS2vfzMZbHKUraQTyHIuIHqZAZCmfcdgQmvlutU0KxNiGXHqXw jTI/3usimchehX88j56jlcHelntT+A8XsTd1NlrCpq+DM+5E+Zktn7ERNmSFQGlbv+ NnjCe82QqtI9gpp9wCkCfooWDQBpehXu1YRSO7bg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunfei Wang , Robin Murphy , Will Deacon Subject: [PATCH 5.16 0068/1039] iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure Date: Mon, 24 Jan 2022 19:30:57 +0100 Message-Id: <20220124184127.456391982@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit a556cfe4cabc6d79cbb7733f118bbb420b376fe6 upstream. In __arm_v7s_alloc_table function: iommu call kmem_cache_alloc to allocate page table, this function allocate memory may fail, when kmem_cache_alloc fails to allocate table, call virt_to_phys will be abnomal and return unexpected phys and goto out_free, then call kmem_cache_free to release table will trigger KE, __get_free_pages and free_pages have similar problem, so add error handle for page table allocation failure. Fixes: 29859aeb8a6e ("iommu/io-pgtable-arm-v7s: Abort allocation when table= address overflows the PTE") Signed-off-by: Yunfei Wang Cc: # 5.10.* Acked-by: Robin Murphy Link: https://lore.kernel.org/r/20211207113315.29109-1-yf.wang@mediatek.com Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iommu/io-pgtable-arm-v7s.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -246,13 +246,17 @@ static void *__arm_v7s_alloc_table(int l __GFP_ZERO | ARM_V7S_TABLE_GFP_DMA, get_order(size)); else if (lvl =3D=3D 2) table =3D kmem_cache_zalloc(data->l2_tables, gfp); + + if (!table) + return NULL; + phys =3D virt_to_phys(table); if (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; } - if (table && !cfg->coherent_walk) { + if (!cfg->coherent_walk) { dma =3D dma_map_single(dev, table, size, DMA_TO_DEVICE); if (dma_mapping_error(dev, dma)) goto out_free; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAD95C43217 for ; Mon, 24 Jan 2022 23:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850131AbiAXX13 (ORCPT ); Mon, 24 Jan 2022 18:27:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588114AbiAXWbl (ORCPT ); Mon, 24 Jan 2022 17:31:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 802BDC047CD5; Mon, 24 Jan 2022 12:56:00 -0800 (PST) Received: from smtp.kernel.org (relay.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 471E0B811FB; Mon, 24 Jan 2022 20:55:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B56EC340E5; Mon, 24 Jan 2022 20:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057758; bh=JtuOwGjrs+4E0N1ONfB/JKaOLTOJtjSWdNVu1Zx8gZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wwqv7bgQQXywz3tLgwsHYf5C6JZBWPVnHsmZGEEC3wlsGI8IZKZijUFd/9hstYG3C W7vbhMbtdXqL5NoIQE8LK8ynnkZcUnhhRQj6XSDE7SoXLWr312zuB+lq9y4z6aJZeH rPcTThsE3F/NHNKPE1k59ZJM1YE75TNACaFYA850= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Thierry Reding Subject: [PATCH 5.16 0069/1039] gpu: host1x: Add back arm_iommu_detach_device() Date: Mon, 24 Jan 2022 19:30:58 +0100 Message-Id: <20220124184127.487355503@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Osipenko commit d5185965c3b59073c4520bad7dd2adf725b9abba upstream. Host1x DMA buffer isn't mapped properly when CONFIG_ARM_DMA_USE_IOMMU=3Dy. The memory management code of Host1x driver has a longstanding overhaul overdue and it's not obvious where the problem is in this case. Hence let's add back the old workaround which we already had sometime before. It explicitly detaches Host1x device from the offending implicit IOMMU domain. This fixes a completely broken Host1x DMA in case of ARM32 multiplatform kernel config. Cc: stable@vger.kernel.org Fixes: af1cbfb9bf0f ("gpu: host1x: Support DMA mapping of buffers") Signed-off-by: Dmitry Osipenko Signed-off-by: Thierry Reding Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/host1x/dev.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- a/drivers/gpu/host1x/dev.c +++ b/drivers/gpu/host1x/dev.c @@ -18,6 +18,10 @@ #include #undef CREATE_TRACE_POINTS =20 +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) +#include +#endif + #include "bus.h" #include "channel.h" #include "debug.h" @@ -238,6 +242,17 @@ static struct iommu_domain *host1x_iommu struct iommu_domain *domain =3D iommu_get_domain_for_dev(host->dev); int err; =20 +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) + if (host->dev->archdata.mapping) { + struct dma_iommu_mapping *mapping =3D + to_dma_iommu_mapping(host->dev); + arm_iommu_detach_device(host->dev); + arm_iommu_release_mapping(mapping); + + domain =3D iommu_get_domain_for_dev(host->dev); + } +#endif + /* * We may not always want to enable IOMMU support (for example if the * host1x firewall is already enabled and we don't support addressing From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 561CEC433EF for ; Mon, 24 Jan 2022 21:27:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451737AbiAXVXa (ORCPT ); Mon, 24 Jan 2022 16:23:30 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49266 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443005AbiAXU4C (ORCPT ); Mon, 24 Jan 2022 15:56:02 -0500 Received: from smtp.kernel.org (relay.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 A6CE760B28; Mon, 24 Jan 2022 20:56:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A97BC340E5; Mon, 24 Jan 2022 20:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057761; bh=RHR1IXkcIgk2HJtIz0MhPowxjEOro65WsiGHJqwdpCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sROAMMlyhGV786XFkR6DsGBgROVq5paJADlhM8cvnddSV1BWcswERofXqfbvg5q8o eB0R6ZLKjlf90aJRmxa7ag0nLCo9UuR7gUQAdnd6ZdxuiQSqkRabyc0H7rNYwo2apf JtZWYnc5/3RzrF8NLxuvzkJBbPC7uu58sX8QkjdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Thierry Reding Subject: [PATCH 5.16 0070/1039] drm/tegra: Add back arm_iommu_detach_device() Date: Mon, 24 Jan 2022 19:30:59 +0100 Message-Id: <20220124184127.526859872@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Osipenko commit d210919dbdc8a82c676cc3e3c370b1802be63124 upstream. DMA buffers of 2D/3D engines aren't mapped properly when CONFIG_ARM_DMA_USE_IOMMU=3Dy. The memory management code of Tegra DRM driver has a longstanding overhaul overdue and it's not obvious where the problem is in this case. Hence let's add back the old workaround which we already had sometime before. It explicitly detaches DRM devices from the offending implicit IOMMU domain. This fixes a completely broken 2d/3d drivers in case of ARM32 multiplatform kernel config. Cc: stable@vger.kernel.org Fixes: fa6661b7aa0b ("drm/tegra: Optionally attach clients to the IOMMU") Signed-off-by: Dmitry Osipenko Signed-off-by: Thierry Reding Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/tegra/drm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -21,6 +21,10 @@ #include #include =20 +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) +#include +#endif + #include "dc.h" #include "drm.h" #include "gem.h" @@ -936,6 +940,17 @@ int host1x_client_iommu_attach(struct ho struct iommu_group *group =3D NULL; int err; =20 +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) + if (client->dev->archdata.mapping) { + struct dma_iommu_mapping *mapping =3D + to_dma_iommu_mapping(client->dev); + arm_iommu_detach_device(client->dev); + arm_iommu_release_mapping(mapping); + + domain =3D iommu_get_domain_for_dev(client->dev); + } +#endif + /* * If the host1x client is already attached to an IOMMU domain that is * not the shared IOMMU domain, don't try to attach it to a different From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B74AC4167B for ; Mon, 24 Jan 2022 23:24:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385406AbiAXXYD (ORCPT ); Mon, 24 Jan 2022 18:24:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588119AbiAXWbj (ORCPT ); Mon, 24 Jan 2022 17:31:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A0A2C02B868; Mon, 24 Jan 2022 12:56:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 CB2A560C60; Mon, 24 Jan 2022 20:56:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 933CBC340E5; Mon, 24 Jan 2022 20:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057764; bh=FRJ1sEdX/ouz9H8PhmcqYykcpScjvm5uCXoa1Ym69nI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xgt1qOug0IMXoIPiEiAxXaHh0zwWTAaHNSkG6EIvKKCpvyfmHXCVXGoodIj1W+XMY 2HghDfWRs0rtWg06MNUvHQM3nixzUNZEvgZ1vHOdmZncTZufizipUwYIiSZxpqzB0q jkRGrvi+oPb6Dob0Z451JR01eZ1CivzpEzRYThHw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hao Xu , Jens Axboe Subject: [PATCH 5.16 0071/1039] io_uring: fix no lock protection for ctx->cq_extra Date: Mon, 24 Jan 2022 19:31:00 +0100 Message-Id: <20220124184127.559922995@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hao Xu commit e302f1046f4c209291b07ff7bc4d15ca26891f16 upstream. ctx->cq_extra should be protected by completion lock so that the req_need_defer() does the right check. Cc: stable@vger.kernel.org Signed-off-by: Hao Xu Link: https://lore.kernel.org/r/20211125092103.224502-2-haoxu@linux.alibaba= .com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/io_uring.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6544,12 +6544,15 @@ static __cold void io_drain_req(struct i u32 seq =3D io_get_sequence(req); =20 /* Still need defer if there is pending req in defer list. */ + spin_lock(&ctx->completion_lock); if (!req_need_defer(req, seq) && list_empty_careful(&ctx->defer_list)) { + spin_unlock(&ctx->completion_lock); queue: ctx->drain_active =3D false; io_req_task_queue(req); return; } + spin_unlock(&ctx->completion_lock); =20 ret =3D io_req_prep_async(req); if (ret) { From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8B9BC4332F for ; Mon, 24 Jan 2022 21:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451770AbiAXVXe (ORCPT ); Mon, 24 Jan 2022 16:23:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51914 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443036AbiAXU4J (ORCPT ); Mon, 24 Jan 2022 15:56:09 -0500 Received: from smtp.kernel.org (relay.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 893E0B810A8; Mon, 24 Jan 2022 20:56:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B54BEC340E5; Mon, 24 Jan 2022 20:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057767; bh=d8KuQaMMEpwfYk41SbyDZxgaCrp6MyVMmi879u70yiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N+G1ba2FVRaqCyOx4Nizi4mIacyXnMCR8I1hd8PlpxaY1K5KwSEiVAWmnesqVHARY n7dv4d1QkzLYytpq2NlUQqtr3YMOyQNGNem/E6PI9QBXCMsks3Eow1ws1S9k7WXnUr voV3JAIuaeojuigjB6vrJ+uFerkvLYxGZP7eVzmE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Hao , "Michael S. Tsirkin" Subject: [PATCH 5.16 0072/1039] virtio/virtio_mem: handle a possible NULL as a memcpy parameter Date: Mon, 24 Jan 2022 19:31:01 +0100 Message-Id: <20220124184127.597119023@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Hao commit cf4a4493ff70874f8af26d75d4346c591c298e89 upstream. There is a check for vm->sbm.sb_states before, and it should check it here as well. Signed-off-by: Peng Hao Link: https://lore.kernel.org/r/20211222011225.40573-1-flyingpeng@tencent.c= om Signed-off-by: Michael S. Tsirkin Fixes: 5f1f79bbc9e2 ("virtio-mem: Paravirtualized memory hotplug") Cc: stable@vger.kernel.org # v5.8+ Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/virtio/virtio_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/virtio/virtio_mem.c +++ b/drivers/virtio/virtio_mem.c @@ -592,7 +592,7 @@ static int virtio_mem_sbm_sb_states_prep return -ENOMEM; =20 mutex_lock(&vm->hotplug_mutex); - if (new_bitmap) + if (vm->sbm.sb_states) memcpy(new_bitmap, vm->sbm.sb_states, old_pages * PAGE_SIZE); =20 old_bitmap =3D vm->sbm.sb_states; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44490C433FE for ; Mon, 24 Jan 2022 23:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850061AbiAXX1W (ORCPT ); Mon, 24 Jan 2022 18:27:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588120AbiAXWbl (ORCPT ); Mon, 24 Jan 2022 17:31:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE4D0C02B86A; Mon, 24 Jan 2022 12:56:12 -0800 (PST) Received: from smtp.kernel.org (relay.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 95EE3B81057; Mon, 24 Jan 2022 20:56:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F31AC340E5; Mon, 24 Jan 2022 20:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057770; bh=N7iqN2dtcEyo4qkf5F6uhGxw3W2pDTN7WGAfMlTzNYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IrqhCDvN3D6GkybQ/t4A0pjuPiwZNT4EQoSLlWhpdVesneLqn/fGx+uKxvTrX+wak b4osQ9NHnty/dpTYVGsN32BXVcgjT7s+XzkBFGzyI6cpdEdbDpE/eUIwDpQ2gWm4Yn 7rbPu1Emv18NKdo3Hnoa+7vcKerJCyQ59CD4oHLI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Sumit Semwal , Gustavo Padovan , =?UTF-8?q?Christian=20K=C3=B6nig?= , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= Subject: [PATCH 5.16 0073/1039] dma_fence_array: Fix PENDING_ERROR leak in dma_fence_array_signaled() Date: Mon, 24 Jan 2022 19:31:02 +0100 Message-Id: <20220124184127.628739269@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Thomas Hellstr=C3=B6m commit 95d35838880fb040ccb9fe4a48816bd0c8b62df5 upstream. If a dma_fence_array is reported signaled by a call to dma_fence_is_signaled(), it may leak the PENDING_ERROR status. Fix this by clearing the PENDING_ERROR status if we return true in dma_fence_array_signaled(). v2: - Update Cc list, and add R-b. Fixes: 1f70b8b812f3 ("dma-fence: Propagate errors to dma-fence-array contai= ner") Cc: Chris Wilson Cc: Sumit Semwal Cc: Gustavo Padovan Cc: Christian K=C3=B6nig Cc: "Christian K=C3=B6nig" Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: linaro-mm-sig@lists.linaro.org Cc: # v5.4+ Signed-off-by: Thomas Hellstr=C3=B6m Reviewed-by: Christian K=C3=B6nig Link: https://patchwork.freedesktop.org/patch/msgid/20211129152727.448908-1= -thomas.hellstrom@linux.intel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dma-buf/dma-fence-array.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/dma-buf/dma-fence-array.c +++ b/drivers/dma-buf/dma-fence-array.c @@ -104,7 +104,11 @@ static bool dma_fence_array_signaled(str { struct dma_fence_array *array =3D to_dma_fence_array(fence); =20 - return atomic_read(&array->num_pending) <=3D 0; + if (atomic_read(&array->num_pending) > 0) + return false; + + dma_fence_array_clear_pending_error(array); + return true; } =20 static void dma_fence_array_release(struct dma_fence *fence) From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BDD8C43219 for ; Mon, 24 Jan 2022 23:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850096AbiAXX1Z (ORCPT ); Mon, 24 Jan 2022 18:27:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588121AbiAXWbl (ORCPT ); Mon, 24 Jan 2022 17:31:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44298C02B86B; Mon, 24 Jan 2022 12:56:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 D9DE460916; Mon, 24 Jan 2022 20:56:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7283C340E7; Mon, 24 Jan 2022 20:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057773; bh=WpOyy6PjwGpfsS2pWgBqOag+9MmARwpgbKe9wRIksXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CKFZ/W+EyF5deTdMRPVKYZ7Ow9alcn3mGa3ZvgjOqmon3iM2ESh63X5SAeZ6GQ49t Ur86ahDRIDDLnMa2Dc5dvohQGNvDZDNeG5yV/RqtyS4z0M01lIsqq/frrJbCiMDqtd LyWC8ZgFHBvBonSXtTkANr5HJwBnUt42i84b66dE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Bingner , Yifeng Li , Bjorn Helgaas , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= Subject: [PATCH 5.16 0074/1039] PCI: Add function 1 DMA alias quirk for Marvell 88SE9125 SATA controller Date: Mon, 24 Jan 2022 19:31:03 +0100 Message-Id: <20220124184127.660334615@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Yifeng Li commit e445375882883f69018aa669b67cbb37ec873406 upstream. Like other SATA controller chips in the Marvell 88SE91xx series, the Marvell 88SE9125 has the same DMA requester ID hardware bug that prevents it from working under IOMMU. Add it to the list of devices that need the quirk. Without this patch, device initialization fails with DMA errors: ata8: softreset failed (1st FIS failed) DMAR: DRHD: handling fault status reg 2 DMAR: [DMA Write NO_PASID] Request device [03:00.1] fault addr 0xfffc0000= [fault reason 0x02] Present bit in context entry is clear DMAR: DRHD: handling fault status reg 2 DMAR: [DMA Read NO_PASID] Request device [03:00.1] fault addr 0xfffc0000 = [fault reason 0x02] Present bit in context entry is clear After applying the patch, the controller can be successfully initialized: ata8: SATA link up 1.5 Gbps (SStatus 113 SControl 330) ata8.00: ATAPI: PIONEER BD-RW BDR-207M, 1.21, max UDMA/100 ata8.00: configured for UDMA/100 scsi 7:0:0:0: CD-ROM PIONEER BD-RW BDR-207M 1.21 PQ: 0 ANSI= : 5 Link: https://lore.kernel.org/r/YahpKVR+McJVDdkD@work Reported-by: Sam Bingner Tested-by: Sam Bingner Tested-by: Yifeng Li Signed-off-by: Yifeng Li Signed-off-by: Bjorn Helgaas Reviewed-by: Krzysztof Wilczy=C5=84ski Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/quirks.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4103,6 +4103,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_M quirk_dma_func1_alias); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123, quirk_dma_func1_alias); +/* https://bugzilla.kernel.org/show_bug.cgi?id=3D42679#c136 */ +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9125, + quirk_dma_func1_alias); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9128, quirk_dma_func1_alias); /* https://bugzilla.kernel.org/show_bug.cgi?id=3D42679#c14 */ From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92A8DC433FE for ; Mon, 24 Jan 2022 21:27:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451753AbiAXVXc (ORCPT ); Mon, 24 Jan 2022 16:23:32 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49438 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443106AbiAXU4R (ORCPT ); Mon, 24 Jan 2022 15:56:17 -0500 Received: from smtp.kernel.org (relay.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 0ABA9611C2; Mon, 24 Jan 2022 20:56:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7F74C340E5; Mon, 24 Jan 2022 20:56:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057776; bh=JZyEK+DcrtqbQuaMruTet9FOk+71sfIzk2bs8DB1wEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tG/SO+iNKbQDqIEwgGOFL3qDuYoFnDtNOgd/wyjmg1eQFVu7lHeAHm85vwnyICeTG qnApm7fF+1TPwQY9WGyL6zNxOEqL2qBU861z1uMQt2QEExJUnM0SmFvVnnQM5OA21z uaoPhcf9ULxNnAGSFvMS5eehJchRs2parzgFwEL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baoquan He , David Hildenbrand , John Donnelly , Christoph Hellwig , Christoph Lameter , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , David Laight , Borislav Petkov , Marek Szyprowski , Robin Murphy , Andrew Morton , Linus Torvalds Subject: [PATCH 5.16 0075/1039] mm_zone: add function to check if managed dma zone exists Date: Mon, 24 Jan 2022 19:31:04 +0100 Message-Id: <20220124184127.693277380@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baoquan He commit 62b3107073646e0946bd97ff926832bafb846d17 upstream. Patch series "Handle warning of allocation failure on DMA zone w/o managed pages", v4. **Problem observed: On x86_64, when crash is triggered and entering into kdump kernel, page allocation failure can always be seen. --------------------------------- DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations swapper/0: page allocation failure: order:5, mode:0xcc1(GFP_KERNEL|GFP_DMA= ), nodemask=3D(null),cpuset=3D/,mems_allowed=3D0 CPU: 0 PID: 1 Comm: swapper/0 Call Trace: dump_stack+0x7f/0xa1 warn_alloc.cold+0x72/0xd6 ...... __alloc_pages+0x24d/0x2c0 ...... dma_atomic_pool_init+0xdb/0x176 do_one_initcall+0x67/0x320 ? rcu_read_lock_sched_held+0x3f/0x80 kernel_init_freeable+0x290/0x2dc ? rest_init+0x24f/0x24f kernel_init+0xa/0x111 ret_from_fork+0x22/0x30 Mem-Info: ------------------------------------ ***Root cause: In the current kernel, it assumes that DMA zone must have managed pages and try to request pages if CONFIG_ZONE_DMA is enabled. While this is not always true. E.g in kdump kernel of x86_64, only low 1M is presented and locked down at very early stage of boot, so that this low 1M won't be added into buddy allocator to become managed pages of DMA zone. This exception will always cause page allocation failure if page is requested from DMA zone. ***Investigation: This failure happens since below commit merged into linus's tree. 1a6a9044b967 x86/setup: Remove CONFIG_X86_RESERVE_LOW and reservelow=3D o= ptions 23721c8e92f7 x86/crash: Remove crash_reserve_low_1M() f1d4d47c5851 x86/setup: Always reserve the first 1M of RAM 7c321eb2b843 x86/kdump: Remove the backup region handling 6f599d84231f x86/kdump: Always reserve the low 1M when the crashkernel op= tion is specified Before them, on x86_64, the low 640K area will be reused by kdump kernel. So in kdump kernel, the content of low 640K area is copied into a backup region for dumping before jumping into kdump. Then except of those firmware reserved region in [0, 640K], the left area will be added into buddy allocator to become available managed pages of DMA zone. However, after above commits applied, in kdump kernel of x86_64, the low 1M is reserved by memblock, but not released to buddy allocator. So any later page allocation requested from DMA zone will fail. At the beginning, if crashkernel is reserved, the low 1M need be locked down because AMD SME encrypts memory making the old backup region mechanims impossible when switching into kdump kernel. Later, it was also observed that there are BIOSes corrupting memory under 1M. To solve this, in commit f1d4d47c5851, the entire region of low 1M is always reserved after the real mode trampoline is allocated. Besides, recently, Intel engineer mentioned their TDX (Trusted domain extensions) which is under development in kernel also needs to lock down the low 1M. So we can't simply revert above commits to fix the page allocat= ion failure from DMA zone as someone suggested. ***Solution: Currently, only DMA atomic pool and dma-kmalloc will initialize and request page allocation with GFP_DMA during bootup. So only initializ DMA atomic pool when DMA zone has available managed pages, otherwise just skip the initialization. For dma-kmalloc(), for the time being, let's mute the warning of allocation failure if requesting pages from DMA zone while no manged pages. Meanwhile, change code to use dma_alloc_xx/dma_map_xx API to replace kmalloc(GFP_DMA), or do not use GFP_DMA when calling kmalloc() if not necessary. Christoph is posting patches to fix those under drivers/scsi/. Finally, we can remove the need of dma-kmalloc() as people suggested. This patch (of 3): In some places of the current kernel, it assumes that dma zone must have managed pages if CONFIG_ZONE_DMA is enabled. While this is not always true. E.g in kdump kernel of x86_64, only low 1M is presented and locked down at very early stage of boot, so that there's no managed pages at all in DMA zone. This exception will always cause page allocation failure if page is requested from DMA zone. Here add function has_managed_dma() and the relevant helper functions to check if there's DMA zone with managed pages. It will be used in later patches. Link: https://lkml.kernel.org/r/20211223094435.248523-1-bhe@redhat.com Link: https://lkml.kernel.org/r/20211223094435.248523-2-bhe@redhat.com Fixes: 6f599d84231f ("x86/kdump: Always reserve the low 1M when the crashke= rnel option is specified") Signed-off-by: Baoquan He Reviewed-by: David Hildenbrand Acked-by: John Donnelly Cc: Christoph Hellwig Cc: Christoph Lameter Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Vlastimil Babka Cc: David Laight Cc: Borislav Petkov Cc: Marek Szyprowski Cc: Robin Murphy Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/linux/mmzone.h | 9 +++++++++ mm/page_alloc.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+) --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1047,6 +1047,15 @@ static inline int is_highmem_idx(enum zo #endif } =20 +#ifdef CONFIG_ZONE_DMA +bool has_managed_dma(void); +#else +static inline bool has_managed_dma(void) +{ + return false; +} +#endif + /** * is_highmem - helper function to quickly check if a struct zone is a * highmem zone or not. This is an attempt to keep references --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -9460,3 +9460,18 @@ bool take_page_off_buddy(struct page *pa return ret; } #endif + +#ifdef CONFIG_ZONE_DMA +bool has_managed_dma(void) +{ + struct pglist_data *pgdat; + + for_each_online_pgdat(pgdat) { + struct zone *zone =3D &pgdat->node_zones[ZONE_DMA]; + + if (managed_zone(zone)) + return true; + } + return false; +} +#endif /* CONFIG_ZONE_DMA */ From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8570C43219 for ; Mon, 24 Jan 2022 21:27:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451902AbiAXVXp (ORCPT ); Mon, 24 Jan 2022 16:23:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51990 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443128AbiAXU4V (ORCPT ); Mon, 24 Jan 2022 15:56:21 -0500 Received: from smtp.kernel.org (relay.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 903F0B81057; Mon, 24 Jan 2022 20:56:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B32BBC340E5; Mon, 24 Jan 2022 20:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057779; bh=LuecBG6exdVyr57uhsw42o+FTE4KyTz6RrJJmYThb+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Crp+5GgcHgU8yDJxom8eknM1uKALuok/117kOTd3t0O+AtqCdYU3ZrvSmIDMmZXyF IfPZ6T2gGAjhKZAQRCXlvQdv3FCy63jRXlSuTbKFIlHJ8Gtd8w9ixRbhJJNskGhYTz kfbf/PKt0yTOn9RmRddLEInR9wO/dfAez3tFIQwM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baoquan He , Christoph Hellwig , John Donnelly , David Hildenbrand , Marek Szyprowski , Robin Murphy , Borislav Petkov , Christoph Lameter , David Laight , David Rientjes , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Joonsoo Kim , Pekka Enberg , Vlastimil Babka , Andrew Morton , Linus Torvalds Subject: [PATCH 5.16 0076/1039] dma/pool: create dma atomic pool only if dma zone has managed pages Date: Mon, 24 Jan 2022 19:31:05 +0100 Message-Id: <20220124184127.725084274@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baoquan He commit a674e48c5443d12a8a43c3ac42367aa39505d506 upstream. Currently three dma atomic pools are initialized as long as the relevant kernel codes are built in. While in kdump kernel of x86_64, this is not right when trying to create atomic_pool_dma, because there's no managed pages in DMA zone. In the case, DMA zone only has low 1M memory presented and locked down by memblock allocator. So no pages are added into buddy of DMA zone. Please check commit f1d4d47c5851 ("x86/setup: Always reserve the first 1M of RAM"). Then in kdump kernel of x86_64, it always prints below failure message: DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations swapper/0: page allocation failure: order:5, mode:0xcc1(GFP_KERNEL|GFP_DMA= ), nodemask=3D(null),cpuset=3D/,mems_allowed=3D0 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.13.0-0.rc5.20210611git929d931f= 2b40.42.fc35.x86_64 #1 Hardware name: Dell Inc. PowerEdge R910/0P658H, BIOS 2.12.0 06/04/2018 Call Trace: dump_stack+0x7f/0xa1 warn_alloc.cold+0x72/0xd6 __alloc_pages_slowpath.constprop.0+0xf29/0xf50 __alloc_pages+0x24d/0x2c0 alloc_page_interleave+0x13/0xb0 atomic_pool_expand+0x118/0x210 __dma_atomic_pool_init+0x45/0x93 dma_atomic_pool_init+0xdb/0x176 do_one_initcall+0x67/0x320 kernel_init_freeable+0x290/0x2dc kernel_init+0xa/0x111 ret_from_fork+0x22/0x30 Mem-Info: ...... DMA: failed to allocate 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocat= ion DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations Here, let's check if DMA zone has managed pages, then create atomic_pool_dma if yes. Otherwise just skip it. Link: https://lkml.kernel.org/r/20211223094435.248523-3-bhe@redhat.com Fixes: 6f599d84231f ("x86/kdump: Always reserve the low 1M when the crashke= rnel option is specified") Signed-off-by: Baoquan He Reviewed-by: Christoph Hellwig Acked-by: John Donnelly Reviewed-by: David Hildenbrand Cc: Marek Szyprowski Cc: Robin Murphy Cc: Borislav Petkov Cc: Christoph Lameter Cc: David Laight Cc: David Rientjes Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Joonsoo Kim Cc: Pekka Enberg Cc: Vlastimil Babka Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/dma/pool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/dma/pool.c +++ b/kernel/dma/pool.c @@ -203,7 +203,7 @@ static int __init dma_atomic_pool_init(v GFP_KERNEL); if (!atomic_pool_kernel) ret =3D -ENOMEM; - if (IS_ENABLED(CONFIG_ZONE_DMA)) { + if (has_managed_dma()) { atomic_pool_dma =3D __dma_atomic_pool_init(atomic_pool_size, GFP_KERNEL | GFP_DMA); if (!atomic_pool_dma) @@ -226,7 +226,7 @@ static inline struct gen_pool *dma_guess if (prev =3D=3D NULL) { if (IS_ENABLED(CONFIG_ZONE_DMA32) && (gfp & GFP_DMA32)) return atomic_pool_dma32; - if (IS_ENABLED(CONFIG_ZONE_DMA) && (gfp & GFP_DMA)) + if (atomic_pool_dma && (gfp & GFP_DMA)) return atomic_pool_dma; return atomic_pool_kernel; } From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA6D5C43219 for ; Mon, 24 Jan 2022 21:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451872AbiAXVXn (ORCPT ); Mon, 24 Jan 2022 16:23:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49536 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443147AbiAXU4X (ORCPT ); Mon, 24 Jan 2022 15:56:23 -0500 Received: from smtp.kernel.org (relay.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 B516260C60; Mon, 24 Jan 2022 20:56:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95CB3C340E5; Mon, 24 Jan 2022 20:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057782; bh=uhZh2+3pBNI2zviQBklQad147jZXKReeIbcT8fkfFjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pl8tlp9idUFD3LftGKoJM7NZQmuVN5B3xf2r9sl90NiqW3JTD7+7vY8oVeGCi86iN xz1i2Pu7bmyR6QR2TycruU8hDk/hivk2qWz+i5vlgp2wl604wbEc5XKaZyDV176oZG 5BpHlp9qH/DhP3JGp0g/hwJnaeD0oLwVeZYt8El8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baoquan He , John Donnelly , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Borislav Petkov , Christoph Hellwig , David Hildenbrand , David Laight , Marek Szyprowski , Robin Murphy , Andrew Morton , Linus Torvalds Subject: [PATCH 5.16 0077/1039] mm/page_alloc.c: do not warn allocation failure on zone DMA if no managed pages Date: Mon, 24 Jan 2022 19:31:06 +0100 Message-Id: <20220124184127.763092675@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baoquan He commit c4dc63f0032c77464fbd4e7a6afc22fa6913c4a7 upstream. In kdump kernel of x86_64, page allocation failure is observed: kworker/u2:2: page allocation failure: order:0, mode:0xcc1(GFP_KERNEL|GFP_= DMA), nodemask=3D(null),cpuset=3D/,mems_allowed=3D0 CPU: 0 PID: 55 Comm: kworker/u2:2 Not tainted 5.16.0-rc4+ #5 Hardware name: AMD Dinar/Dinar, BIOS RDN1505B 06/05/2013 Workqueue: events_unbound async_run_entry_fn Call Trace: dump_stack_lvl+0x48/0x5e warn_alloc.cold+0x72/0xd6 __alloc_pages_slowpath.constprop.0+0xc69/0xcd0 __alloc_pages+0x1df/0x210 new_slab+0x389/0x4d0 ___slab_alloc+0x58f/0x770 __slab_alloc.constprop.0+0x4a/0x80 kmem_cache_alloc_trace+0x24b/0x2c0 sr_probe+0x1db/0x620 ...... device_add+0x405/0x920 ...... __scsi_add_device+0xe5/0x100 ata_scsi_scan_host+0x97/0x1d0 async_run_entry_fn+0x30/0x130 process_one_work+0x1e8/0x3c0 worker_thread+0x50/0x3b0 ? rescuer_thread+0x350/0x350 kthread+0x16b/0x190 ? set_kthread_struct+0x40/0x40 ret_from_fork+0x22/0x30 Mem-Info: ...... The above failure happened when calling kmalloc() to allocate buffer with GFP_DMA. It requests to allocate slab page from DMA zone while no managed pages at all in there. sr_probe() --> get_capabilities() --> buffer =3D kmalloc(512, GFP_KERNEL | GFP_DMA); Because in the current kernel, dma-kmalloc will be created as long as CONFIG_ZONE_DMA is enabled. However, kdump kernel of x86_64 doesn't have managed pages on DMA zone since commit 6f599d84231f ("x86/kdump: Always reserve the low 1M when the crashkernel option is specified"). The failure can be always reproduced. For now, let's mute the warning of allocation failure if requesting pages from DMA zone while no managed pages. [akpm@linux-foundation.org: fix warning] Link: https://lkml.kernel.org/r/20211223094435.248523-4-bhe@redhat.com Fixes: 6f599d84231f ("x86/kdump: Always reserve the low 1M when the crashke= rnel option is specified") Signed-off-by: Baoquan He Acked-by: John Donnelly Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Vlastimil Babka Cc: Borislav Petkov Cc: Christoph Hellwig Cc: David Hildenbrand Cc: David Laight Cc: Marek Szyprowski Cc: Robin Murphy Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- mm/page_alloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4204,7 +4204,9 @@ void warn_alloc(gfp_t gfp_mask, nodemask va_list args; static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1); =20 - if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs)) + if ((gfp_mask & __GFP_NOWARN) || + !__ratelimit(&nopage_rs) || + ((gfp_mask & __GFP_DMA) && !has_managed_dma())) return; =20 va_start(args, fmt); From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8108C3526E for ; Mon, 24 Jan 2022 21:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452519AbiAXVZq (ORCPT ); Mon, 24 Jan 2022 16:25:46 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52044 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443200AbiAXU4a (ORCPT ); Mon, 24 Jan 2022 15:56:30 -0500 Received: from smtp.kernel.org (relay.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 7740DB8123D; Mon, 24 Jan 2022 20:56:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B7E2C340E5; Mon, 24 Jan 2022 20:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057788; bh=y68xxu8iMAtxJro7Nolt3iQzbp/6pcihsIFLmjlaUH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xuGeAlHbaWzLmhJeZt9zLtxIfOFYzY8NBMNXnbWnw/Rp7PjTJjdfuLOuyvduuvWtB 4gOQkoJOPC/KjaMHkUyRZVIo5wJrq2hkIA3Vi5rRJyg4or1lElAXBxBu3UuC2CpSt3 b6ruZ3RJyS23jcv7gdzSMYASweliDmOYmgTLTV90= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gong , Jouni Malinen , Kalle Valo , "Limonciello, Mario" Subject: [PATCH 5.16 0078/1039] ath11k: add string type to search board data in board-2.bin for WCN6855 Date: Mon, 24 Jan 2022 19:31:07 +0100 Message-Id: <20220124184127.793504812@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wen Gong commit fc95d10ac41d75c14a81afcc8722333d8b2cf80f upstream. Currently ath11k only support string type with bus, chip id and board id such as "bus=3Dahb,qmi-chip-id=3D1,qmi-board-id=3D4" for ahb bus chip and "bus=3Dpci,qmi-chip-id=3D0,qmi-board-id=3D255" for PCIe bus chip in board-2.bin. For WCN6855, it is not enough to distinguish all different chips. This is to add a new string type which include bus, chip id, board id, vendor, device, subsystem-vendor and subsystem-device for WCN6855. ath11k will first load board-2.bin and search in it for the board data with the above parameters, if matched one board data, then download it to firmware, if not matched any one, then ath11k will download the file board.bin to firmware. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ= _LITE-1 Signed-off-by: Wen Gong Signed-off-by: Jouni Malinen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211111065340.20187-1-quic_wgong@quicinc.c= om Cc: "Limonciello, Mario" Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/core.c | 27 +++++++++++++++++++++------ drivers/net/wireless/ath/ath11k/core.h | 13 +++++++++++++ drivers/net/wireless/ath/ath11k/pci.c | 10 ++++++++++ 3 files changed, 44 insertions(+), 6 deletions(-) --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -392,11 +392,26 @@ static int ath11k_core_create_board_name scnprintf(variant, sizeof(variant), ",variant=3D%s", ab->qmi.target.bdf_ext); =20 - scnprintf(name, name_len, - "bus=3D%s,qmi-chip-id=3D%d,qmi-board-id=3D%d%s", - ath11k_bus_str(ab->hif.bus), - ab->qmi.target.chip_id, - ab->qmi.target.board_id, variant); + switch (ab->id.bdf_search) { + case ATH11K_BDF_SEARCH_BUS_AND_BOARD: + scnprintf(name, name_len, + "bus=3D%s,vendor=3D%04x,device=3D%04x,subsystem-vendor=3D%04x,subsyst= em-device=3D%04x,qmi-chip-id=3D%d,qmi-board-id=3D%d%s", + ath11k_bus_str(ab->hif.bus), + ab->id.vendor, ab->id.device, + ab->id.subsystem_vendor, + ab->id.subsystem_device, + ab->qmi.target.chip_id, + ab->qmi.target.board_id, + variant); + break; + default: + scnprintf(name, name_len, + "bus=3D%s,qmi-chip-id=3D%d,qmi-board-id=3D%d%s", + ath11k_bus_str(ab->hif.bus), + ab->qmi.target.chip_id, + ab->qmi.target.board_id, variant); + break; + } =20 ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot using board name '%s'\n", name); =20 @@ -633,7 +648,7 @@ static int ath11k_core_fetch_board_data_ return 0; } =20 -#define BOARD_NAME_SIZE 100 +#define BOARD_NAME_SIZE 200 int ath11k_core_fetch_bdf(struct ath11k_base *ab, struct ath11k_board_data= *bd) { char boardname[BOARD_NAME_SIZE]; --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -47,6 +47,11 @@ enum ath11k_supported_bw { ATH11K_BW_160 =3D 3, }; =20 +enum ath11k_bdf_search { + ATH11K_BDF_SEARCH_DEFAULT, + ATH11K_BDF_SEARCH_BUS_AND_BOARD, +}; + enum wme_ac { WME_AC_BE, WME_AC_BK, @@ -759,6 +764,14 @@ struct ath11k_base { =20 struct completion htc_suspend; =20 + struct { + enum ath11k_bdf_search bdf_search; + u32 vendor; + u32 device; + u32 subsystem_vendor; + u32 subsystem_device; + } id; + /* must be last */ u8 drv_priv[0] __aligned(sizeof(void *)); }; --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -1251,6 +1251,15 @@ static int ath11k_pci_probe(struct pci_d goto err_free_core; } =20 + ath11k_dbg(ab, ATH11K_DBG_BOOT, "pci probe %04x:%04x %04x:%04x\n", + pdev->vendor, pdev->device, + pdev->subsystem_vendor, pdev->subsystem_device); + + ab->id.vendor =3D pdev->vendor; + ab->id.device =3D pdev->device; + ab->id.subsystem_vendor =3D pdev->subsystem_vendor; + ab->id.subsystem_device =3D pdev->subsystem_device; + switch (pci_dev->device) { case QCA6390_DEVICE_ID: ath11k_pci_read_hw_version(ab, &soc_hw_version_major, @@ -1273,6 +1282,7 @@ static int ath11k_pci_probe(struct pci_d ab->hw_rev =3D ATH11K_HW_QCN9074_HW10; break; case WCN6855_DEVICE_ID: + ab->id.bdf_search =3D ATH11K_BDF_SEARCH_BUS_AND_BOARD; ath11k_pci_read_hw_version(ab, &soc_hw_version_major, &soc_hw_version_minor); switch (soc_hw_version_major) { From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C099BC4332F for ; Mon, 24 Jan 2022 23:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850114AbiAXX10 (ORCPT ); Mon, 24 Jan 2022 18:27:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588116AbiAXWbl (ORCPT ); Mon, 24 Jan 2022 17:31:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAEC1C095418; Mon, 24 Jan 2022 12:56:33 -0800 (PST) Received: from smtp.kernel.org (relay.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 A87BBB8122A; Mon, 24 Jan 2022 20:56:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3DD4C340E5; Mon, 24 Jan 2022 20:56:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057791; bh=dsltChIe0jlqUh6dWEG5FKZNlrkLzjZ89+CXhMhClzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C81lXxDq7ZtSWOFgZCwxipN3NDs312S7d3/PWFWH7Va4iekK/a1r+/jxyPXr8RMd/ A+/nN2GPkZiz3lpGD2CT4Sg6FvHvne66fWplVjyXpgqoskytmKVgAngZBGsnP7pAKz ONJdMfYsU32rjvjGsbJh8Y+/JeayN1pcidjUNPHg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gang Li , Muchun Song , "Kirill A. Shutemov" , Hugh Dickins , Andrew Morton , Linus Torvalds Subject: [PATCH 5.16 0079/1039] shmem: fix a race between shmem_unused_huge_shrink and shmem_evict_inode Date: Mon, 24 Jan 2022 19:31:08 +0100 Message-Id: <20220124184127.824709501@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gang Li commit 62c9827cbb996c2c04f615ecd783ce28bcea894b upstream. Fix a data race in commit 779750d20b93 ("shmem: split huge pages beyond i_size under memory pressure"). Here are call traces causing race: Call Trace 1: shmem_unused_huge_shrink+0x3ae/0x410 ? __list_lru_walk_one.isra.5+0x33/0x160 super_cache_scan+0x17c/0x190 shrink_slab.part.55+0x1ef/0x3f0 shrink_node+0x10e/0x330 kswapd+0x380/0x740 kthread+0xfc/0x130 ? mem_cgroup_shrink_node+0x170/0x170 ? kthread_create_on_node+0x70/0x70 ret_from_fork+0x1f/0x30 Call Trace 2: shmem_evict_inode+0xd8/0x190 evict+0xbe/0x1c0 do_unlinkat+0x137/0x330 do_syscall_64+0x76/0x120 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 A simple explanation: Image there are 3 items in the local list (@list). In the first traversal, A is not deleted from @list. 1) A->B->C ^ | pos (leave) In the second traversal, B is deleted from @list. Concurrently, A is deleted from @list through shmem_evict_inode() since last reference counter of inode is dropped by other thread. Then the @list is corrupted. 2) A->B->C ^ ^ | | evict pos (drop) We should make sure the inode is either on the global list or deleted from any local list before iput(). Fixed by moving inodes back to global list before we put them. [akpm@linux-foundation.org: coding style fixes] Link: https://lkml.kernel.org/r/20211125064502.99983-1-ligang.bdlg@bytedanc= e.com Fixes: 779750d20b93 ("shmem: split huge pages beyond i_size under memory pr= essure") Signed-off-by: Gang Li Reviewed-by: Muchun Song Acked-by: Kirill A. Shutemov Cc: Hugh Dickins Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- mm/shmem.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) --- a/mm/shmem.c +++ b/mm/shmem.c @@ -554,7 +554,7 @@ static unsigned long shmem_unused_huge_s struct shmem_inode_info *info; struct page *page; unsigned long batch =3D sc ? sc->nr_to_scan : 128; - int removed =3D 0, split =3D 0; + int split =3D 0; =20 if (list_empty(&sbinfo->shrinklist)) return SHRINK_STOP; @@ -569,7 +569,6 @@ static unsigned long shmem_unused_huge_s /* inode is about to be evicted */ if (!inode) { list_del_init(&info->shrinklist); - removed++; goto next; } =20 @@ -577,12 +576,12 @@ static unsigned long shmem_unused_huge_s if (round_up(inode->i_size, PAGE_SIZE) =3D=3D round_up(inode->i_size, HPAGE_PMD_SIZE)) { list_move(&info->shrinklist, &to_remove); - removed++; goto next; } =20 list_move(&info->shrinklist, &list); next: + sbinfo->shrinklist_len--; if (!--batch) break; } @@ -602,7 +601,7 @@ next: inode =3D &info->vfs_inode; =20 if (nr_to_split && split >=3D nr_to_split) - goto leave; + goto move_back; =20 page =3D find_get_page(inode->i_mapping, (inode->i_size & HPAGE_PMD_MASK) >> PAGE_SHIFT); @@ -616,38 +615,44 @@ next: } =20 /* - * Leave the inode on the list if we failed to lock - * the page at this time. + * Move the inode on the list back to shrinklist if we failed + * to lock the page at this time. * * Waiting for the lock may lead to deadlock in the * reclaim path. */ if (!trylock_page(page)) { put_page(page); - goto leave; + goto move_back; } =20 ret =3D split_huge_page(page); unlock_page(page); put_page(page); =20 - /* If split failed leave the inode on the list */ + /* If split failed move the inode on the list back to shrinklist */ if (ret) - goto leave; + goto move_back; =20 split++; drop: list_del_init(&info->shrinklist); - removed++; -leave: + goto put; +move_back: + /* + * Make sure the inode is either on the global list or deleted + * from any local list before iput() since it could be deleted + * in another thread once we put the inode (then the local list + * is corrupted). + */ + spin_lock(&sbinfo->shrinklist_lock); + list_move(&info->shrinklist, &sbinfo->shrinklist); + sbinfo->shrinklist_len++; + spin_unlock(&sbinfo->shrinklist_lock); +put: iput(inode); } =20 - spin_lock(&sbinfo->shrinklist_lock); - list_splice_tail(&list, &sbinfo->shrinklist); - sbinfo->shrinklist_len -=3D removed; - spin_unlock(&sbinfo->shrinklist_lock); - return split; } =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77E9CC433EF for ; Mon, 24 Jan 2022 23:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850045AbiAXX1T (ORCPT ); Mon, 24 Jan 2022 18:27:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588122AbiAXWbl (ORCPT ); Mon, 24 Jan 2022 17:31:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51F27C047CD6; Mon, 24 Jan 2022 12:56:35 -0800 (PST) Received: from smtp.kernel.org (relay.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 E512460916; Mon, 24 Jan 2022 20:56:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C48F4C340E5; Mon, 24 Jan 2022 20:56:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057794; bh=gsJaKnaWHi5ojQSmHlL+FWWaKCOaXVLvwTdLO9exnxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MPrRoLgc4YAKyJrZuV3oTcil0THCTVE3izN5f8eDcnh0GD2B83+4uv7H+M232GDOd iGQ2pTJXVWK6z+RUVIrXScQ/0X2Y4fNDw7Nm5R09KCMY+hG6PGIqXqKRBWam3Hg6Nb BGBOo6YvfI3NQ9M64ZvBsxwvhVMkuRJ5LuYKX/sc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, aleksandr.o.makarov@gmail.com, Brian Norris , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Chen-Yu Tsai , Heiko Stuebner Subject: [PATCH 5.16 0080/1039] drm/rockchip: dsi: Hold pm-runtime across bind/unbind Date: Mon, 24 Jan 2022 19:31:09 +0100 Message-Id: <20220124184127.854702681@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Brian Norris commit 514db871922f103886ad4d221cf406b4fcc5e74a upstream. In commit 43c2de1002d2 ("drm/rockchip: dsi: move all lane config except LCDC mux to bind()"), we moved most HW configuration to bind(), but we didn't move the runtime PM management. Therefore, depending on initial boot state, runtime-PM workqueue delays, and other timing factors, we may disable our power domain in between the hardware configuration (bind()) and when we enable the display. This can cause us to lose hardware state and fail to configure our display. For example: dw-mipi-dsi-rockchip ff968000.mipi: failed to write command FIFO panel-innolux-p079zca ff960000.mipi.0: failed to write command 0 or: dw-mipi-dsi-rockchip ff968000.mipi: failed to write command FIFO panel-kingdisplay-kd097d04 ff960000.mipi.0: failed write init cmds: -110 We should match the runtime PM to the lifetime of the bind()/unbind() cycle. Tested on Acer Chrometab 10 (RK3399 Gru-Scarlet), with panel drivers built either as modules or built-in. Side notes: it seems one is more likely to see this problem when the panel driver is built into the kernel. I've also seen this problem bisect down to commits that simply changed Kconfig dependencies, because it changed the order in which driver init functions were compiled into the kernel, and therefore the ordering and timing of built-in device probe. Fixes: 43c2de1002d2 ("drm/rockchip: dsi: move all lane config except LCDC m= ux to bind()") Link: https://lore.kernel.org/linux-rockchip/9aedfb528600ecf871885f7293ca42= 07c84d16c1.camel@gmail.com/ Reported-by: Cc: Signed-off-by: Brian Norris Tested-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: Chen-Yu Tsai Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20210928143413.v3.1.Ic2= 904d37f30013a7f3d8476203ad3733c186827e@changeid Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 37 ++++++++++++-------= ----- 1 file changed, 19 insertions(+), 18 deletions(-) --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -772,10 +772,6 @@ static void dw_mipi_dsi_encoder_enable(s if (mux < 0) return; =20 - pm_runtime_get_sync(dsi->dev); - if (dsi->slave) - pm_runtime_get_sync(dsi->slave->dev); - /* * For the RK3399, the clk of grf must be enabled before writing grf * register. And for RK3288 or other soc, this grf_clk must be NULL, @@ -794,20 +790,10 @@ static void dw_mipi_dsi_encoder_enable(s clk_disable_unprepare(dsi->grf_clk); } =20 -static void dw_mipi_dsi_encoder_disable(struct drm_encoder *encoder) -{ - struct dw_mipi_dsi_rockchip *dsi =3D to_dsi(encoder); - - if (dsi->slave) - pm_runtime_put(dsi->slave->dev); - pm_runtime_put(dsi->dev); -} - static const struct drm_encoder_helper_funcs dw_mipi_dsi_encoder_helper_funcs =3D { .atomic_check =3D dw_mipi_dsi_encoder_atomic_check, .enable =3D dw_mipi_dsi_encoder_enable, - .disable =3D dw_mipi_dsi_encoder_disable, }; =20 static int rockchip_dsi_drm_create_encoder(struct dw_mipi_dsi_rockchip *ds= i, @@ -937,10 +923,14 @@ static int dw_mipi_dsi_rockchip_bind(str put_device(second); } =20 + pm_runtime_get_sync(dsi->dev); + if (dsi->slave) + pm_runtime_get_sync(dsi->slave->dev); + ret =3D clk_prepare_enable(dsi->pllref_clk); if (ret) { DRM_DEV_ERROR(dev, "Failed to enable pllref_clk: %d\n", ret); - return ret; + goto out_pm_runtime; } =20 /* @@ -952,7 +942,7 @@ static int dw_mipi_dsi_rockchip_bind(str ret =3D clk_prepare_enable(dsi->grf_clk); if (ret) { DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); - return ret; + goto out_pm_runtime; } =20 dw_mipi_dsi_rockchip_config(dsi); @@ -964,16 +954,23 @@ static int dw_mipi_dsi_rockchip_bind(str ret =3D rockchip_dsi_drm_create_encoder(dsi, drm_dev); if (ret) { DRM_DEV_ERROR(dev, "Failed to create drm encoder\n"); - return ret; + goto out_pm_runtime; } =20 ret =3D dw_mipi_dsi_bind(dsi->dmd, &dsi->encoder); if (ret) { DRM_DEV_ERROR(dev, "Failed to bind: %d\n", ret); - return ret; + goto out_pm_runtime; } =20 return 0; + +out_pm_runtime: + pm_runtime_put(dsi->dev); + if (dsi->slave) + pm_runtime_put(dsi->slave->dev); + + return ret; } =20 static void dw_mipi_dsi_rockchip_unbind(struct device *dev, @@ -988,6 +985,10 @@ static void dw_mipi_dsi_rockchip_unbind( dw_mipi_dsi_unbind(dsi->dmd); =20 clk_disable_unprepare(dsi->pllref_clk); + + pm_runtime_put(dsi->dev); + if (dsi->slave) + pm_runtime_put(dsi->slave->dev); } =20 static const struct component_ops dw_mipi_dsi_rockchip_ops =3D { From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D1BEC4167D for ; Mon, 24 Jan 2022 21:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451982AbiAXVXx (ORCPT ); Mon, 24 Jan 2022 16:23:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52140 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443303AbiAXU4k (ORCPT ); Mon, 24 Jan 2022 15:56:40 -0500 Received: from smtp.kernel.org (relay.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 C3797B811A9; Mon, 24 Jan 2022 20:56:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9CF5C340E5; Mon, 24 Jan 2022 20:56:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057797; bh=ANJ5LKnxfnBTuQcDEKga1MP8P7cUsecKPu5TOiY2Go0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r2V6hGdv8OY/bqHOcNQ9p+tDVWzBB+Uzy84UyhGcCUEYW4fonbjVC7u1sByi4FWRl M0SNquKs4mPEVuS6NbVJmDRNhoCSNxKBWybiMq+g7rRxDhxoP7Cxgg/xPmTLtS0VY9 IJtnYEK6AQiM6lggSbAL7RrZRKlPf0tRjv5l1Zd8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Chen-Yu Tsai , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Heiko Stuebner Subject: [PATCH 5.16 0081/1039] drm/rockchip: dsi: Reconfigure hardware on resume() Date: Mon, 24 Jan 2022 19:31:10 +0100 Message-Id: <20220124184127.887606666@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Brian Norris commit e584cdc1549932f87a2707b56bc588cfac5d89e0 upstream. Since commit 43c2de1002d2 ("drm/rockchip: dsi: move all lane config except LCDC mux to bind()"), we perform most HW configuration in the bind() function. This configuration may be lost on suspend/resume, so we need to call it again. That may lead to errors like this after system suspend/resume: dw-mipi-dsi-rockchip ff968000.mipi: failed to write command FIFO panel-kingdisplay-kd097d04 ff960000.mipi.0: failed write init cmds: -110 Tested on Acer Chromebook Tab 10 (RK3399 Gru-Scarlet). Note that early mailing list versions of this driver borrowed Rockchip's downstream/BSP solution, to do HW configuration in mode_set() (which *is* called at the appropriate pre-enable() times), but that was discarded along the way. I've avoided that still, because mode_set() documentation doesn't suggest this kind of purpose as far as I can tell. Fixes: 43c2de1002d2 ("drm/rockchip: dsi: move all lane config except LCDC m= ux to bind()") Cc: Signed-off-by: Brian Norris Reviewed-by: Chen-Yu Tsai Tested-by: N=C3=ADcolas F. R. A. Prado Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20210928143413.v3.2.I4e= 9d93aadb00b1ffc7d506e3186a25492bf0b732@changeid Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 37 +++++++++++++++++++= +++++ 1 file changed, 37 insertions(+) --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -267,6 +267,8 @@ struct dw_mipi_dsi_rockchip { struct dw_mipi_dsi *dmd; const struct rockchip_dw_dsi_chip_data *cdata; struct dw_mipi_dsi_plat_data pdata; + + bool dsi_bound; }; =20 struct dphy_pll_parameter_map { @@ -963,6 +965,8 @@ static int dw_mipi_dsi_rockchip_bind(str goto out_pm_runtime; } =20 + dsi->dsi_bound =3D true; + return 0; =20 out_pm_runtime: @@ -982,6 +986,8 @@ static void dw_mipi_dsi_rockchip_unbind( if (dsi->is_slave) return; =20 + dsi->dsi_bound =3D false; + dw_mipi_dsi_unbind(dsi->dmd); =20 clk_disable_unprepare(dsi->pllref_clk); @@ -1276,6 +1282,36 @@ static const struct phy_ops dw_mipi_dsi_ .exit =3D dw_mipi_dsi_dphy_exit, }; =20 +static int __maybe_unused dw_mipi_dsi_rockchip_resume(struct device *dev) +{ + struct dw_mipi_dsi_rockchip *dsi =3D dev_get_drvdata(dev); + int ret; + + /* + * Re-configure DSI state, if we were previously initialized. We need + * to do this before rockchip_drm_drv tries to re-enable() any panels. + */ + if (dsi->dsi_bound) { + ret =3D clk_prepare_enable(dsi->grf_clk); + if (ret) { + DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); + return ret; + } + + dw_mipi_dsi_rockchip_config(dsi); + if (dsi->slave) + dw_mipi_dsi_rockchip_config(dsi->slave); + + clk_disable_unprepare(dsi->grf_clk); + } + + return 0; +} + +static const struct dev_pm_ops dw_mipi_dsi_rockchip_pm_ops =3D { + SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, dw_mipi_dsi_rockchip_resume) +}; + static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -1593,6 +1629,7 @@ struct platform_driver dw_mipi_dsi_rockc .remove =3D dw_mipi_dsi_rockchip_remove, .driver =3D { .of_match_table =3D dw_mipi_dsi_rockchip_dt_ids, + .pm =3D &dw_mipi_dsi_rockchip_pm_ops, .name =3D "dw-mipi-dsi-rockchip", }, }; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6875BC4321E for ; Mon, 24 Jan 2022 23:24:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848833AbiAXXXz (ORCPT ); Mon, 24 Jan 2022 18:23:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588126AbiAXWbj (ORCPT ); Mon, 24 Jan 2022 17:31:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32C32C047CD7; Mon, 24 Jan 2022 12:56:43 -0800 (PST) Received: from smtp.kernel.org (relay.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 E1B12B81233; Mon, 24 Jan 2022 20:56:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 048F3C340E5; Mon, 24 Jan 2022 20:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057800; bh=W+/+k2azZaIAX+5Yr6DtFQsLwnUIJoywgp9Jh6rhCI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tV+Z81LojYfjunB+USeoRh8Pxh5fN7VvbCXihmE+yiQyak8wzsOqP0VawCFhOAwyP idV6SerAYJiIW2P9wM5+2PNmKY7x3DODcfuSaHuKPB/o0+BRXpeTj8j9Adn9abfW/d Yeda9+4SHYQs2OokbsdmpEHiQbNGvuwWEVV5Xi+s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , xinhui pan Subject: [PATCH 5.16 0082/1039] drm/ttm: Put BO in its memory managers lru list Date: Mon, 24 Jan 2022 19:31:11 +0100 Message-Id: <20220124184127.917572817@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: xinhui pan commit 781050b0a3164934857c300bb0bc291e38c26b6f upstream. After we move BO to a new memory region, we should put it to the new memory manager's lru list regardless we unlock the resv or not. Cc: stable@vger.kernel.org Reviewed-by: Christian K=C3=B6nig Signed-off-by: xinhui pan Link: https://patchwork.freedesktop.org/patch/msgid/20211110043149.57554-1-= xinhui.pan@amd.com Signed-off-by: Christian K=C3=B6nig Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/ttm/ttm_bo.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -727,6 +727,8 @@ int ttm_mem_evict_first(struct ttm_devic ret =3D ttm_bo_evict(bo, ctx); if (locked) ttm_bo_unreserve(bo); + else + ttm_bo_move_to_lru_tail_unlocked(bo); =20 ttm_bo_put(bo); return ret; From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89361C3525A for ; Mon, 24 Jan 2022 23:24:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584613AbiAXXXi (ORCPT ); Mon, 24 Jan 2022 18:23:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835208AbiAXWfs (ORCPT ); Mon, 24 Jan 2022 17:35:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73661C0E9B96; Mon, 24 Jan 2022 12:58:53 -0800 (PST) Received: from smtp.kernel.org (relay.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 0D85E6135D; Mon, 24 Jan 2022 20:58:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E676DC340E5; Mon, 24 Jan 2022 20:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057932; bh=HMP4DKejjmzzmBiC3x+uMGlYrLYTaLCXGsNBASp+WKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fk8e2mbefWPvOTqTKSMjtWURZEY5SLOxm1Y7MStYI2PHd+2EcP9x/tGQvpvUHaUoI U3e1ODyt64KkCvAMEIU55i5AioMLh8/boqnC8EBs+LHsK3ZjYr5qtPNhVnalfNkIce nD+36M6vkRAdaGD7h5IRNR5SmGEpu75Az3orQbYo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tedd Ho-Jeong An , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0083/1039] Bluetooth: hci_vhci: Fix to set the force_wakeup value Date: Mon, 24 Jan 2022 19:31:12 +0100 Message-Id: <20220124184127.945773742@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tedd Ho-Jeong An [ Upstream commit 8b89637dbac2d73d9f3dadf91b4a7dcdb1fc23af ] This patch sets the wakeup state of the vhci driver when the force_wakeup is updated. Fixes: 60edfad4fd0b6 ("Bluetooth: hci_vhci: Add force_prevent_wake entry") Signed-off-by: Tedd Ho-Jeong An Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bluetooth/hci_vhci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index b45db0db347c6..5fd91106e853d 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c @@ -176,6 +176,8 @@ static ssize_t force_wakeup_write(struct file *file, if (data->wakeup =3D=3D enable) return -EALREADY; =20 + data->wakeup =3D enable; + return count; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A45EC4332F for ; Mon, 24 Jan 2022 23:29:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850022AbiAXX1P (ORCPT ); Mon, 24 Jan 2022 18:27:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588125AbiAXWbl (ORCPT ); Mon, 24 Jan 2022 17:31:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F966C047CDA; Mon, 24 Jan 2022 12:57:06 -0800 (PST) Received: from smtp.kernel.org (relay.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 0E74760907; Mon, 24 Jan 2022 20:57:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4738C340E5; Mon, 24 Jan 2022 20:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057825; bh=V/5o8Qpy4uFlBy2z+Ab0c2iMVN4l55rv5Fr6U+80WS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q3y83igKQKn+0Zsep+5tq1NSWKazlwb57I61OgY3qJBYM489LCzk1I0AyVV2yCvlG NYcQiA7FYcuO9VoYEDexuc6GfVbulQWyw4MSovkZqxrxoAvBctlgK8FaMdX1Heoiux A/0GblW/s80umU3XK8MdyOOzqtSyx+cVLlGsdVdI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tedd Ho-Jeong An , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0084/1039] Bluetooth: mgmt: Fix Experimental Feature Changed event Date: Mon, 24 Jan 2022 19:31:13 +0100 Message-Id: <20220124184127.976219279@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tedd Ho-Jeong An [ Upstream commit b15bfa4df63529150df9ff0585675f728436e0c1 ] This patch fixes the controller index in the Experimental Features Changed event for the offload_codec and the quality_report features to use the actual hdev index instead of non-controller index(0xffff) so the client can receive the event and know which controller the event is for. Fixes: ad93315183285 ("Bluetooth: Add offload feature under experimental fl= ag") Fixes: ae7d925b5c043 ("Bluetooth: Support the quality report events") Signed-off-by: Tedd Ho-Jeong An Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/mgmt.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 3e5283607b97c..44683443300ce 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -3927,7 +3927,9 @@ static int exp_debug_feature_changed(bool enabled, st= ruct sock *skip) } #endif =20 -static int exp_quality_report_feature_changed(bool enabled, struct sock *s= kip) +static int exp_quality_report_feature_changed(bool enabled, + struct hci_dev *hdev, + struct sock *skip) { struct mgmt_ev_exp_feature_changed ev; =20 @@ -3935,7 +3937,7 @@ static int exp_quality_report_feature_changed(bool en= abled, struct sock *skip) memcpy(ev.uuid, quality_report_uuid, 16); ev.flags =3D cpu_to_le32(enabled ? BIT(0) : 0); =20 - return mgmt_limited_event(MGMT_EV_EXP_FEATURE_CHANGED, NULL, + return mgmt_limited_event(MGMT_EV_EXP_FEATURE_CHANGED, hdev, &ev, sizeof(ev), HCI_MGMT_EXP_FEATURE_EVENTS, skip); } @@ -4156,14 +4158,15 @@ static int set_quality_report_func(struct sock *sk,= struct hci_dev *hdev, &rp, sizeof(rp)); =20 if (changed) - exp_quality_report_feature_changed(val, sk); + exp_quality_report_feature_changed(val, hdev, sk); =20 unlock_quality_report: hci_req_sync_unlock(hdev); return err; } =20 -static int exp_offload_codec_feature_changed(bool enabled, struct sock *sk= ip) +static int exp_offload_codec_feature_changed(bool enabled, struct hci_dev = *hdev, + struct sock *skip) { struct mgmt_ev_exp_feature_changed ev; =20 @@ -4171,7 +4174,7 @@ static int exp_offload_codec_feature_changed(bool ena= bled, struct sock *skip) memcpy(ev.uuid, offload_codecs_uuid, 16); ev.flags =3D cpu_to_le32(enabled ? BIT(0) : 0); =20 - return mgmt_limited_event(MGMT_EV_EXP_FEATURE_CHANGED, NULL, + return mgmt_limited_event(MGMT_EV_EXP_FEATURE_CHANGED, hdev, &ev, sizeof(ev), HCI_MGMT_EXP_FEATURE_EVENTS, skip); } @@ -4229,7 +4232,7 @@ static int set_offload_codec_func(struct sock *sk, st= ruct hci_dev *hdev, &rp, sizeof(rp)); =20 if (changed) - exp_offload_codec_feature_changed(val, sk); + exp_offload_codec_feature_changed(val, hdev, sk); =20 return err; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FC5BC433EF for ; Mon, 24 Jan 2022 21:27:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452238AbiAXVYZ (ORCPT ); Mon, 24 Jan 2022 16:24:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50404 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346823AbiAXU5p (ORCPT ); Mon, 24 Jan 2022 15:57:45 -0500 Received: from smtp.kernel.org (relay.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 895CAB81063; Mon, 24 Jan 2022 20:57:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B05F4C340E5; Mon, 24 Jan 2022 20:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057859; bh=U3wisKp1DQL3P73XQGZFVVCkj4o+R4Zq2mDuqeIwGBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OoHBVsX3KdlPyCky4LlG1wx3XhhkLIVoQET7K8MPdcuQ4IGiyl2r6XkeQTDfO/HK+ iHA00JWa6l38gBYBDjqAgsKfZiUoM6UEz1+6Rv5q96A21P+ND3Jg9PAdDakn4gi5J4 GpMR+KVnRsm47vFeMMsBok4axMXwKxX0bjf9Sy3Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0085/1039] Bluetooth: L2CAP: Fix not initializing sk_peer_pid Date: Mon, 24 Jan 2022 19:31:14 +0100 Message-Id: <20220124184128.011755111@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luiz Augusto von Dentz [ Upstream commit f5ff291098f70a70b344df1e388596755c3c8315 ] In order to group sockets being connected using L2CAP_MODE_EXT_FLOWCTL the pid is used but sk_peer_pid was not being initialized as it is currently only done for af_unix. Fixes: b48596d1dc25 ("Bluetooth: L2CAP: Add get_peer_pid callback") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/l2cap_sock.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 160c016a5dfb9..4574c5cb1b596 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -172,6 +172,21 @@ done: return err; } =20 +static void l2cap_sock_init_pid(struct sock *sk) +{ + struct l2cap_chan *chan =3D l2cap_pi(sk)->chan; + + /* Only L2CAP_MODE_EXT_FLOWCTL ever need to access the PID in order to + * group the channels being requested. + */ + if (chan->mode !=3D L2CAP_MODE_EXT_FLOWCTL) + return; + + spin_lock(&sk->sk_peer_lock); + sk->sk_peer_pid =3D get_pid(task_tgid(current)); + spin_unlock(&sk->sk_peer_lock); +} + static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags) { @@ -243,6 +258,8 @@ static int l2cap_sock_connect(struct socket *sock, stru= ct sockaddr *addr, if (chan->psm && bdaddr_type_is_le(chan->src_type) && !chan->mode) chan->mode =3D L2CAP_MODE_LE_FLOWCTL; =20 + l2cap_sock_init_pid(sk); + err =3D l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid), &la.l2_bdaddr, la.l2_bdaddr_type); if (err) @@ -298,6 +315,8 @@ static int l2cap_sock_listen(struct socket *sock, int b= acklog) goto done; } =20 + l2cap_sock_init_pid(sk); + sk->sk_max_ack_backlog =3D backlog; sk->sk_ack_backlog =3D 0; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29382C433EF for ; Mon, 24 Jan 2022 21:33:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450434AbiAXV3j (ORCPT ); Mon, 24 Jan 2022 16:29:39 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51108 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391368AbiAXU6Q (ORCPT ); Mon, 24 Jan 2022 15:58:16 -0500 Received: from smtp.kernel.org (relay.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 D37F261320; Mon, 24 Jan 2022 20:58:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E9AEC340E5; Mon, 24 Jan 2022 20:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057893; bh=eSFAMSNBJ2+1DUCDbG0cVf4bszUJGYhA/TtF+L2iozU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TTZjFucKDsoK/YCRKc5ycnGUFfuB6oai/7PDpSEhOagZqBStMETuxzDVFyzQisVmF Epry6mK+fnmBqS1Si/E1cWU8oqLWldzl8BBaUNMzSGgwXZ6/2qyAzTVkSYPkiFcupD b8Ahmjnnf/lORUiz/LRcLxBKPYCoxU6e0UzV5A8E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.16 0086/1039] drm/bridge: display-connector: fix an uninitialized pointer in probe() Date: Mon, 24 Jan 2022 19:31:15 +0100 Message-Id: <20220124184128.057152528@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 189723fbe9aca18d6f7d638c59a40288030932b5 ] The "label" pointer is used for debug output. The code assumes that it is either NULL or valid, but it is never set to NULL. It is either valid or uninitialized. Fixes: 0c275c30176b ("drm/bridge: Add bridge driver for display connectors") Signed-off-by: Dan Carpenter Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20211013080825.GE6010@k= ili Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/bridge/display-connector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/b= ridge/display-connector.c index 05eb759da6fc6..847a0dce7f1d3 100644 --- a/drivers/gpu/drm/bridge/display-connector.c +++ b/drivers/gpu/drm/bridge/display-connector.c @@ -107,7 +107,7 @@ static int display_connector_probe(struct platform_devi= ce *pdev) { struct display_connector *conn; unsigned int type; - const char *label; + const char *label =3D NULL; int ret; =20 conn =3D devm_kzalloc(&pdev->dev, sizeof(*conn), GFP_KERNEL); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57CD6C4707F for ; Mon, 24 Jan 2022 23:24:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357310AbiAXXX0 (ORCPT ); Mon, 24 Jan 2022 18:23:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835203AbiAXWfs (ORCPT ); Mon, 24 Jan 2022 17:35:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9FB1C07A940; Mon, 24 Jan 2022 12:58:36 -0800 (PST) Received: from smtp.kernel.org (relay.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 B16BBB815A3; Mon, 24 Jan 2022 20:58:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3064C340E5; Mon, 24 Jan 2022 20:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057914; bh=KZblH40VVxpKVtgn0eP/ycmDT5DACGyy1hUw7tz3pc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EwJS/Hd1NgwFLeda/8ctGuc4bAC56e5VLVtehJNNnqDidabnRTJQ19gagciLPs2ye yUl98utZbLrg4ebdKiMLIcxHa3ExTjZvzbnxXXbyaMp1CTCVAAGzcxv+Gy3xntbxcz LtuQ2baJgJSPjQePoLEz5q0JiYztLCrJJr9rtQmo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.16 0087/1039] drm: fix null-ptr-deref in drm_dev_init_release() Date: Mon, 24 Jan 2022 19:31:16 +0100 Message-Id: <20220124184128.088298398@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wang Hai [ Upstream commit acf20ed020ffa4d6cc8347e8d356509b95df3cbe ] I got a null-ptr-deref report: [drm:drm_dev_init [drm]] *ERROR* Cannot allocate anonymous inode: -12 =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 iput+0x3c/0x4a0 ... Call Trace: dump_stack_lvl+0x6c/0x8b kasan_report.cold+0x64/0xdb __asan_load8+0x69/0x90 iput+0x3c/0x4a0 drm_dev_init_release+0x39/0xb0 [drm] drm_managed_release+0x158/0x2d0 [drm] drm_dev_init+0x3a7/0x4c0 [drm] __devm_drm_dev_alloc+0x55/0xd0 [drm] mi0283qt_probe+0x8a/0x2b5 [mi0283qt] spi_probe+0xeb/0x130 ... entry_SYSCALL_64_after_hwframe+0x44/0xae If drm_fs_inode_new() fails in drm_dev_init(), dev->anon_inode will point to PTR_ERR(...) instead of NULL. This will result in null-ptr-deref when drm_fs_inode_free(dev->anon_inode) is called. drm_dev_init() drm_fs_inode_new() // fail, dev->anon_inode =3D PTR_ERR(...) drm_managed_release() drm_dev_init_release() drm_fs_inode_free() // access non-existent anon_inode Define a temp variable and assign it to dev->anon_inode if the temp variable is not PTR_ERR. Fixes: 2cbf7fc6718b ("drm: Use drmm_ for drm_dev_init cleanup") Reported-by: Hulk Robot Signed-off-by: Wang Hai Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20211013114139.4042207-= 1-wanghai38@huawei.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/drm_drv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 7a5097467ba5c..b3a1636d1b984 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -581,6 +581,7 @@ static int drm_dev_init(struct drm_device *dev, const struct drm_driver *driver, struct device *parent) { + struct inode *inode; int ret; =20 if (!drm_core_init_complete) { @@ -617,13 +618,15 @@ static int drm_dev_init(struct drm_device *dev, if (ret) return ret; =20 - dev->anon_inode =3D drm_fs_inode_new(); - if (IS_ERR(dev->anon_inode)) { - ret =3D PTR_ERR(dev->anon_inode); + inode =3D drm_fs_inode_new(); + if (IS_ERR(inode)) { + ret =3D PTR_ERR(inode); DRM_ERROR("Cannot allocate anonymous inode: %d\n", ret); goto err; } =20 + dev->anon_inode =3D inode; + if (drm_core_check_feature(dev, DRIVER_RENDER)) { ret =3D drm_minor_alloc(dev, DRM_MINOR_RENDER); if (ret) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F5E2C43219 for ; Mon, 24 Jan 2022 21:34:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1453358AbiAXVaB (ORCPT ); Mon, 24 Jan 2022 16:30:01 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53780 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351712AbiAXU6k (ORCPT ); Mon, 24 Jan 2022 15:58:40 -0500 Received: from smtp.kernel.org (relay.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 DE176B80FA3; Mon, 24 Jan 2022 20:58:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16B7EC340E5; Mon, 24 Jan 2022 20:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057917; bh=H/tPH33St1gFh5Gacd8JGf5OOGlFWqNnI4EL4xPm4mc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y6IpuxcqUKo+tbME8rB3FYVLQiNP4zQg4smodf5haiY0iF73X4MjgOK6sDn0YgiIX RJ06sGW91aN/q5jPiu138DMLVCZekNtlDqWXqHYoOJKW/iLtSP6Ey9VfQ/pIHu1Wl6 X6HRSE68t1s2hv9ugt4NWWlmZ586GSwVkLU04M6M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.16 0088/1039] drm/panel: kingdisplay-kd097d04: Delete panel on attach() failure Date: Mon, 24 Jan 2022 19:31:17 +0100 Message-Id: <20220124184128.118355347@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit 5f31dbeae8a88f31c3eb4eb526ab4807c40da241 ] If we fail to attach (e.g., because 1 of 2 dual-DSI controllers aren't ready), we leave a dangling drm_panel reference to freed memory. Clean that up on failure. Fixes: 2a994cbed6b2 ("drm/panel: Add Kingdisplay KD097D04 panel driver") Signed-off-by: Brian Norris Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20210923173336.1.Icb4d9= dbc1817f4e826361a4f1cea7461541668f0@changeid Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/g= pu/drm/panel/panel-kingdisplay-kd097d04.c index 86e4213e8bb13..daccb1fd5fdad 100644 --- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c +++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c @@ -406,7 +406,13 @@ static int kingdisplay_panel_probe(struct mipi_dsi_dev= ice *dsi) if (err < 0) return err; =20 - return mipi_dsi_attach(dsi); + err =3D mipi_dsi_attach(dsi); + if (err < 0) { + kingdisplay_panel_del(kingdisplay); + return err; + } + + return 0; } =20 static int kingdisplay_panel_remove(struct mipi_dsi_device *dsi) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98A2AC43219 for ; Mon, 24 Jan 2022 23:29:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849958AbiAXX1F (ORCPT ); Mon, 24 Jan 2022 18:27:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835190AbiAXWfs (ORCPT ); Mon, 24 Jan 2022 17:35:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 766A8C07A94A; Mon, 24 Jan 2022 12:58:41 -0800 (PST) Received: from smtp.kernel.org (relay.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 14FB160C60; Mon, 24 Jan 2022 20:58:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 003D2C340E5; Mon, 24 Jan 2022 20:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057920; bh=IyH1Lh56yH9JDasMVhjm5n150Kxj6K6Tx0L9VwNIBGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MzPs1qb3Pl03QKDqrSvcZ5M/vc4Y+RIuVLLwLEQAHyp5i+HjlcpVYDtho/VfarzhM wYrOQI+BPvflSpHlk95JMu1nsVmvuoz7rh0mEqBdBhSbm4WQZwYD3J4JCMtK5LPY7+ 9pcw6sPO/T7vFdG9FGdHdavt+3bw0KOCU7nikNJg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.16 0089/1039] drm/panel: innolux-p079zca: Delete panel on attach() failure Date: Mon, 24 Jan 2022 19:31:18 +0100 Message-Id: <20220124184128.149662846@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit 32a267e9c057e1636e7afdd20599aa5741a73079 ] If we fail to attach (e.g., because 1 of 2 dual-DSI controllers aren't ready), we leave a dangling drm_panel reference to freed memory. Clean that up on failure. This problem exists since the driver's introduction, but is especially relevant after refactored for dual-DSI variants. Fixes: 14c8f2e9f8ea ("drm/panel: add Innolux P079ZCA panel driver") Fixes: 7ad4e4636c54 ("drm/panel: p079zca: Refactor panel driver to support = multiple panels") Signed-off-by: Brian Norris Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20210923173336.2.I9023c= f8811a3abf4964ed84eb681721d8bb489d6@changeid Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/panel/panel-innolux-p079zca.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/dr= m/panel/panel-innolux-p079zca.c index aea3162253914..f194b62e290ca 100644 --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c @@ -484,6 +484,7 @@ static void innolux_panel_del(struct innolux_panel *inn= olux) static int innolux_panel_probe(struct mipi_dsi_device *dsi) { const struct panel_desc *desc; + struct innolux_panel *innolux; int err; =20 desc =3D of_device_get_match_data(&dsi->dev); @@ -495,7 +496,14 @@ static int innolux_panel_probe(struct mipi_dsi_device = *dsi) if (err < 0) return err; =20 - return mipi_dsi_attach(dsi); + err =3D mipi_dsi_attach(dsi); + if (err < 0) { + innolux =3D mipi_dsi_get_drvdata(dsi); + innolux_panel_del(innolux); + return err; + } + + return 0; } =20 static int innolux_panel_remove(struct mipi_dsi_device *dsi) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A757C433F5 for ; Mon, 24 Jan 2022 23:24:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383869AbiAXXXb (ORCPT ); Mon, 24 Jan 2022 18:23:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835195AbiAXWfs (ORCPT ); Mon, 24 Jan 2022 17:35:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87B4BC0D9435; Mon, 24 Jan 2022 12:58:44 -0800 (PST) Received: from smtp.kernel.org (relay.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 28B006135A; Mon, 24 Jan 2022 20:58:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 041C5C340E5; Mon, 24 Jan 2022 20:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057923; bh=cMFxYRYp6w8MatZ7/I2lqkhrIc1yyjMahxu07RfdL3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HDOyGQqMPI94GYAYDo24Mq1s/AuzS2X6bbzOpMdtyQkx7QbyMTTWI1MJvwP+S4+ua 8axn+qHDmHKIwbMvGL9zCe7Rg4Bm13lhU138ujZc2oYxkTY/0ad84tVzKdsH0IIDne pb+OS2I4nAkaVW1oQ3aV0GqC9XC9kGT7CV60YTLY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Chen-Yu Tsai , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.16 0090/1039] drm/rockchip: dsi: Fix unbalanced clock on probe error Date: Mon, 24 Jan 2022 19:31:19 +0100 Message-Id: <20220124184128.187650856@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Brian Norris [ Upstream commit 251888398753924059f3bb247a44153a2853137f ] Our probe() function never enabled this clock, so we shouldn't disable it if we fail to probe the bridge. Noted by inspection. Fixes: 2d4f7bdafd70 ("drm/rockchip: dsi: migrate to use dw-mipi-dsi bridge = driver") Signed-off-by: Brian Norris Reviewed-by: Chen-Yu Tsai Tested-by: N=C3=ADcolas F. R. A. Prado Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20210928143413.v3.3.Ie8= ceefb51ab6065a1151869b6fcda41a467d4d2c@changeid Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -1433,14 +1433,10 @@ static int dw_mipi_dsi_rockchip_probe(st if (ret !=3D -EPROBE_DEFER) DRM_DEV_ERROR(dev, "Failed to probe dw_mipi_dsi: %d\n", ret); - goto err_clkdisable; + return ret; } =20 return 0; - -err_clkdisable: - clk_disable_unprepare(dsi->pllref_clk); - return ret; } =20 static int dw_mipi_dsi_rockchip_remove(struct platform_device *pdev) From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80BE9C4332F for ; Mon, 24 Jan 2022 23:29:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849938AbiAXX1B (ORCPT ); Mon, 24 Jan 2022 18:27:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835200AbiAXWfs (ORCPT ); Mon, 24 Jan 2022 17:35:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07A0FC0E9B93; Mon, 24 Jan 2022 12:58:49 -0800 (PST) Received: from smtp.kernel.org (relay.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 C29B3B811FB; Mon, 24 Jan 2022 20:58:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F37A5C340E7; Mon, 24 Jan 2022 20:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057926; bh=LLm+7HyVW08h6eIjjhLxlVIBpY/j4cIwzuM3+dTSeIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=haeXDcV8kJuzgTKWXKn/xE7BmcrS8wVV0EJ3WWo7B13zWzn8ERsTXDB/ChbvwhHIq oKq3uMCu2myb+cCwwHIwjf+jwWDT2+7Qdq5FEQLpUdwBk3n0aR/gLXb1PGDbvHKyiz j42Hh/yba49JaB+olro96kwhVHLcHT9ycMz2Qtk4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Chen-Yu Tsai , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.16 0091/1039] drm/rockchip: dsi: Disable PLL clock on bind error Date: Mon, 24 Jan 2022 19:31:20 +0100 Message-Id: <20220124184128.218939986@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Brian Norris [ Upstream commit 5a614570172e1c9f59035d259dd735acd4f1c01b ] Fix some error handling here noticed in review of other changes. Fixes: 2d4f7bdafd70 ("drm/rockchip: dsi: migrate to use dw-mipi-dsi bridge = driver") Signed-off-by: Brian Norris Reported-by: Chen-Yu Tsai Reviewed-by: Chen-Yu Tsai Tested-by: N=C3=ADcolas F. R. A. Prado Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20210928143413.v3.4.I8b= b7a91ecc411d56bc155763faa15f289d7fc074@changeid Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -944,7 +944,7 @@ static int dw_mipi_dsi_rockchip_bind(str ret =3D clk_prepare_enable(dsi->grf_clk); if (ret) { DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); - goto out_pm_runtime; + goto out_pll_clk; } =20 dw_mipi_dsi_rockchip_config(dsi); @@ -956,19 +956,21 @@ static int dw_mipi_dsi_rockchip_bind(str ret =3D rockchip_dsi_drm_create_encoder(dsi, drm_dev); if (ret) { DRM_DEV_ERROR(dev, "Failed to create drm encoder\n"); - goto out_pm_runtime; + goto out_pll_clk; } =20 ret =3D dw_mipi_dsi_bind(dsi->dmd, &dsi->encoder); if (ret) { DRM_DEV_ERROR(dev, "Failed to bind: %d\n", ret); - goto out_pm_runtime; + goto out_pll_clk; } =20 dsi->dsi_bound =3D true; =20 return 0; =20 +out_pll_clk: + clk_disable_unprepare(dsi->pllref_clk); out_pm_runtime: pm_runtime_put(dsi->dev); if (dsi->slave) From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBDF4C433FE for ; Mon, 24 Jan 2022 21:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452320AbiAXVYf (ORCPT ); Mon, 24 Jan 2022 16:24:35 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:52000 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443725AbiAXU6w (ORCPT ); Mon, 24 Jan 2022 15:58:52 -0500 Received: from smtp.kernel.org (relay.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 08E9460C60; Mon, 24 Jan 2022 20:58:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6069C340E7; Mon, 24 Jan 2022 20:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057929; bh=oM9XJ6lkMtHrXDqXRQuGbTYoOCRv3BOX3desWydiKQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WAfhJkZJ5adSIvZcHjbhHh/eWgXADFrXpZq8LfCrT26ZRyV2B2IhyvhXeKEJvnsjT AmfPYj6P5rGWbA1N++BdrWqL+cMgalf4WmxW4ilb1n45SMFlv+6Ydvr+zbK7+QZjLt 3QVlaJhrLa6dMyi4chBnP/u4Knh6hvEtCi0znNpY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Soenke Huster , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0092/1039] Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle() Date: Mon, 24 Jan 2022 19:31:21 +0100 Message-Id: <20220124184128.250254555@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Soenke Huster [ Upstream commit 1d0688421449718c6c5f46e458a378c9b530ba18 ] On the reception of packets with an invalid packet type, the memory of the allocated socket buffers is never freed. Add a default case that frees these to avoid a memory leak. Fixes: afd2daa26c7a ("Bluetooth: Add support for virtio transport driver") Signed-off-by: Soenke Huster Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bluetooth/virtio_bt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bluetooth/virtio_bt.c b/drivers/bluetooth/virtio_bt.c index 57908ce4fae85..076e4942a3f0e 100644 --- a/drivers/bluetooth/virtio_bt.c +++ b/drivers/bluetooth/virtio_bt.c @@ -202,6 +202,9 @@ static void virtbt_rx_handle(struct virtio_bluetooth *v= bt, struct sk_buff *skb) hci_skb_pkt_type(skb) =3D pkt_type; hci_recv_frame(vbt->hdev, skb); break; + default: + kfree_skb(skb); + break; } } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12C7CC433EF for ; Mon, 24 Jan 2022 23:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849010AbiAXXYd (ORCPT ); Mon, 24 Jan 2022 18:24:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588164AbiAXWbj (ORCPT ); Mon, 24 Jan 2022 17:31:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 859B3C047CE3; Mon, 24 Jan 2022 12:57:09 -0800 (PST) Received: from smtp.kernel.org (relay.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 259A5611C8; Mon, 24 Jan 2022 20:57:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 033E7C340E5; Mon, 24 Jan 2022 20:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057828; bh=5mn8xY2Rw2yKpuokmAWh9/JaNI4qxPL/snAS97h6juY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hvSKaK3iLPmDzpWIwoSiRXrEjsqHJ6LtUXH3Rcg8lauJa7x24IACbmMmk5IIyOUHB q8hP4+HYdGt822MsA3V84ZD+AuJy1hpHW4Vb3f2yHgaUrw6Z0sZ1GI8zLN7V/WgL01 k8h0hioavYDL6YO6zz0jGdOzTXLyMIjSySqrRJq8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0093/1039] Bluetooth: cmtp: fix possible panic when cmtp_init_sockets() fails Date: Mon, 24 Jan 2022 19:31:22 +0100 Message-Id: <20220124184128.282005419@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wang Hai [ Upstream commit 2a7ca7459d905febf519163bd9e3eed894de6bb7 ] I got a kernel BUG report when doing fault injection test: Reported-by: Hulk Robot Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:45! ... RIP: 0010:__list_del_entry_valid.cold+0x12/0x4d ... Call Trace: proto_unregister+0x83/0x220 cmtp_cleanup_sockets+0x37/0x40 [cmtp] cmtp_exit+0xe/0x1f [cmtp] do_syscall_64+0x35/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xae If cmtp_init_sockets() in cmtp_init() fails, cmtp_init() still returns success. This will cause a kernel bug when accessing uncreated ctmp related data when the module exits. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Hulk Robot Signed-off-by: Wang Hai Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/cmtp/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index 0a2d78e811cf5..83eb84e8e688f 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -501,9 +501,7 @@ static int __init cmtp_init(void) { BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); =20 - cmtp_init_sockets(); - - return 0; + return cmtp_init_sockets(); } =20 static void __exit cmtp_exit(void) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B28F3C41535 for ; Mon, 24 Jan 2022 21:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452147AbiAXVYJ (ORCPT ); Mon, 24 Jan 2022 16:24:09 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49988 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443526AbiAXU5M (ORCPT ); Mon, 24 Jan 2022 15:57:12 -0500 Received: from smtp.kernel.org (relay.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 1549D60907; Mon, 24 Jan 2022 20:57:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF01EC340E5; Mon, 24 Jan 2022 20:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057831; bh=nLAh1WwS4fr/AUWaPNjL/z4wUxnfEXp/q678GyhCGxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gE2sETQkVLDyHe0vjqti6FY/AACWlBIqEASC7C2vUktLQ4hK7d5zBR/no8ZUbyG3w hsyt6RGHy4qkCrI8Hnp2G5ZZJXPWr4yO6ZZhURXwzpnPZ7tzy06z6T40Py2KmtKNxV qBdFpISQwcwYin7qhEYN/764m0CPO28WCvj0UOiM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Stephen Boyd , Nicolas Saenz Julienne , Michael Stapelberg , Sasha Levin Subject: [PATCH 5.16 0094/1039] clk: bcm-2835: Pick the closest clock rate Date: Mon, 24 Jan 2022 19:31:23 +0100 Message-Id: <20220124184128.313189119@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit 5517357a4733d7cf7c17fc79d0530cfa47add372 ] The driver currently tries to pick the closest rate that is lower than the rate being requested. This causes an issue with clk_set_min_rate() since it actively checks for the rounded rate to be above the minimum that was just set. Let's change the logic a bit to pick the closest rate to the requested rate, no matter if it's actually higher or lower. Fixes: 6d18b8adbe67 ("clk: bcm2835: Support for clock parent selection") Signed-off-by: Maxime Ripard Acked-by: Stephen Boyd Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne # boot and basic func= tionality Tested-by: Michael Stapelberg Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-= 2-maxime@cerno.tech Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/clk/bcm/clk-bcm2835.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index a254512965eb8..bf97b2b2a63f8 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -1216,7 +1216,7 @@ static int bcm2835_clock_determine_rate(struct clk_hw= *hw, rate =3D bcm2835_clock_choose_div_and_prate(hw, i, req->rate, &div, &prate, &avgrate); - if (rate > best_rate && rate <=3D req->rate) { + if (abs(req->rate - rate) < abs(req->rate - best_rate)) { best_parent =3D parent; best_prate =3D prate; best_rate =3D rate; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AC91C433EF for ; Mon, 24 Jan 2022 23:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850149AbiAXX1c (ORCPT ); Mon, 24 Jan 2022 18:27:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588190AbiAXWbj (ORCPT ); Mon, 24 Jan 2022 17:31:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AA21C09541E; Mon, 24 Jan 2022 12:57:15 -0800 (PST) Received: from smtp.kernel.org (relay.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 18AB86130D; Mon, 24 Jan 2022 20:57:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF2A7C340E7; Mon, 24 Jan 2022 20:57:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057834; bh=Orco0cUg8wur0xcjUoBZQdIb4V8qqvT0qtwNt+7/SYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eRjZAcRdsaCiLQDvlGCJj2ysaCzWpyFswdDvylQo8Jwyw9geVI+/cB5Rro/DnEfFQ fLEvcV21LGLWIwpjjDPcRgBlGkTuTGUASAkyJhnn5aUNVMB7S8+7bcDWJLeiNaoO22 0GtNXNHxTek+kQo7DtvnbSBJhXJ7Q0QMhjzIWodw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Stephen Boyd , Nicolas Saenz Julienne , Michael Stapelberg , Sasha Levin Subject: [PATCH 5.16 0095/1039] clk: bcm-2835: Remove rounding up the dividers Date: Mon, 24 Jan 2022 19:31:24 +0100 Message-Id: <20220124184128.347023426@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit 8ca011ef4af48a7af7b15afd8a4a44039dd04cea ] The driver, once it found a divider, tries to round it up by increasing the least significant bit of the fractional part by one when the round_up argument is set and there's a remainder. However, since it increases the divider it will actually reduce the clock rate below what we were asking for, leading to issues with clk_set_min_rate() that will complain that our rounded clock rate is below the minimum of the rate. Since the dividers are fairly precise already, let's remove that part so that we can have clk_set_min_rate() working. This is effectively a revert of 9c95b32ca093 ("clk: bcm2835: add a round up ability to the clock divisor"). Fixes: 9c95b32ca093 ("clk: bcm2835: add a round up ability to the clock div= isor") Signed-off-by: Maxime Ripard Acked-by: Stephen Boyd Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne # boot and basic func= tionality Tested-by: Michael Stapelberg Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-= 3-maxime@cerno.tech Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/clk/bcm/clk-bcm2835.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index bf97b2b2a63f8..3667b4d731e71 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -932,8 +932,7 @@ static int bcm2835_clock_is_on(struct clk_hw *hw) =20 static u32 bcm2835_clock_choose_div(struct clk_hw *hw, unsigned long rate, - unsigned long parent_rate, - bool round_up) + unsigned long parent_rate) { struct bcm2835_clock *clock =3D bcm2835_clock_from_hw(hw); const struct bcm2835_clock_data *data =3D clock->data; @@ -945,10 +944,6 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, =20 rem =3D do_div(temp, rate); div =3D temp; - - /* Round up and mask off the unused bits */ - if (round_up && ((div & unused_frac_mask) !=3D 0 || rem !=3D 0)) - div +=3D unused_frac_mask + 1; div &=3D ~unused_frac_mask; =20 /* different clamping limits apply for a mash clock */ @@ -1079,7 +1074,7 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw, struct bcm2835_clock *clock =3D bcm2835_clock_from_hw(hw); struct bcm2835_cprman *cprman =3D clock->cprman; const struct bcm2835_clock_data *data =3D clock->data; - u32 div =3D bcm2835_clock_choose_div(hw, rate, parent_rate, false); + u32 div =3D bcm2835_clock_choose_div(hw, rate, parent_rate); u32 ctl; =20 spin_lock(&cprman->regs_lock); @@ -1130,7 +1125,7 @@ static unsigned long bcm2835_clock_choose_div_and_pra= te(struct clk_hw *hw, =20 if (!(BIT(parent_idx) & data->set_rate_parent)) { *prate =3D clk_hw_get_rate(parent); - *div =3D bcm2835_clock_choose_div(hw, rate, *prate, true); + *div =3D bcm2835_clock_choose_div(hw, rate, *prate); =20 *avgrate =3D bcm2835_clock_rate_from_divisor(clock, *prate, *div); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10D68C433FE for ; Mon, 24 Jan 2022 21:27:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452167AbiAXVYM (ORCPT ); Mon, 24 Jan 2022 16:24:12 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50102 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443556AbiAXU5T (ORCPT ); Mon, 24 Jan 2022 15:57:19 -0500 Received: from smtp.kernel.org (relay.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 25FF9611C8; Mon, 24 Jan 2022 20:57:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0A2BC340E5; Mon, 24 Jan 2022 20:57:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057837; bh=4V4cxWlmyZvF0156r5z/jnCjIkSbiX6J5fCpOPi18WM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jchcq3oREjjcK/wq+xfV5Jua6WNcX5BeKZNtOmU6E0cFS6S07LY6dqeDgpHfsPbBb HrHCiWq8vha9+HiaYlbKAgynaEyQwuRqKiydr51zb/q/CGgBGK9KaqGFWh4iXYKMU3 coGnbLTgwjbeLUZoqBVwO/YWCrEBlBKARWZKQdOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Nicolas Saenz Julienne , Michael Stapelberg , Sasha Levin Subject: [PATCH 5.16 0096/1039] drm/vc4: hdmi: Set a default HSM rate Date: Mon, 24 Jan 2022 19:31:25 +0100 Message-Id: <20220124184128.387367217@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit 3e85b81591609bb794bb00cd619b20965b5b38cd ] When the firmware doesn't setup the HSM rate (such as when booting without an HDMI cable plugged in), its rate is 0 and thus any register access results in a CPU stall, even though HSM is enabled. Let's enforce a minimum rate at boot to avoid this issue. Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder d= river") Signed-off-by: Maxime Ripard Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne Tested-by: Michael Stapelberg Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-= 4-maxime@cerno.tech Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_hdmi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index b284623e28634..33f61e2f7e6d1 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -94,6 +94,7 @@ # define VC4_HD_M_SW_RST BIT(2) # define VC4_HD_M_ENABLE BIT(0) =20 +#define HSM_MIN_CLOCK_FREQ 120000000 #define CEC_CLOCK_FREQ 40000 =20 #define HDMI_14_MAX_TMDS_CLK (340 * 1000 * 1000) @@ -2162,6 +2163,19 @@ static int vc4_hdmi_bind(struct device *dev, struct = device *master, void *data) vc4_hdmi->disable_4kp60 =3D true; } =20 + /* + * If we boot without any cable connected to the HDMI connector, + * the firmware will skip the HSM initialization and leave it + * with a rate of 0, resulting in a bus lockup when we're + * accessing the registers even if it's enabled. + * + * Let's put a sensible default at runtime_resume so that we + * don't end up in this situation. + */ + ret =3D clk_set_min_rate(vc4_hdmi->hsm_clock, HSM_MIN_CLOCK_FREQ); + if (ret) + goto err_put_ddc; + if (vc4_hdmi->variant->reset) vc4_hdmi->variant->reset(vc4_hdmi); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31782C4332F for ; Mon, 24 Jan 2022 21:27:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452182AbiAXVYO (ORCPT ); Mon, 24 Jan 2022 16:24:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52570 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443570AbiAXU5Z (ORCPT ); Mon, 24 Jan 2022 15:57:25 -0500 Received: from smtp.kernel.org (relay.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 443A7B80CCF; Mon, 24 Jan 2022 20:57:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DB19C340E5; Mon, 24 Jan 2022 20:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057841; bh=eEUMKP1KZjrhKIfKroVDFJye3c2C2i+TYzy8Gb6Bsnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k+jLLZ6RhY22AFRWcBAhR4Z7Cv134TL3syLAnIQt+3XiswG/tDhPdIysMbFqMHjW0 BfStUsVEw1iIXfAP3JbCPryyQOMpIe42EpDPJXycNIHeTl2NMNY2S5Of8o2vodPBdg XlwHz7iPRNXWzZQWV3Vzad3czVtGvgfl8bVLS3xU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Dave Stevenson , Nicolas Saenz Julienne , Michael Stapelberg , Sasha Levin Subject: [PATCH 5.16 0097/1039] drm/vc4: hdmi: Move the HSM clock enable to runtime_pm Date: Mon, 24 Jan 2022 19:31:26 +0100 Message-Id: <20220124184128.416967340@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit c86b41214362e8e715e1343e16d5d6af0562db05 ] In order to access the HDMI controller, we need to make sure the HSM clock is enabled. If we were to access it with the clock disabled, the CPU would completely hang, resulting in an hard crash. Since we have different code path that would require it, let's move that clock enable / disable to runtime_pm that will take care of the reference counting for us. Since we also want to change the HSM clock rate and it's only valid while the clock is disabled, we need to move the clk_set_min_rate() call on the HSM clock above pm_runtime_get_and_sync(). Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder d= river") Signed-off-by: Maxime Ripard Reviewed-by: Dave Stevenson Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne Tested-by: Michael Stapelberg Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-= 5-maxime@cerno.tech Link: https://lore.kernel.org/linux-arm-kernel/20210924152334.1342630-1-max= ime@cerno.tech/ Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_hdmi.c | 70 +++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 33f61e2f7e6d1..63b07087d37e8 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -628,7 +628,6 @@ static void vc4_hdmi_encoder_post_crtc_powerdown(struct= drm_encoder *encoder, vc4_hdmi->variant->phy_disable(vc4_hdmi); =20 clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock); - clk_disable_unprepare(vc4_hdmi->hsm_clock); clk_disable_unprepare(vc4_hdmi->pixel_clock); =20 ret =3D pm_runtime_put(&vc4_hdmi->pdev->dev); @@ -894,28 +893,10 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struc= t drm_encoder *encoder, conn_state_to_vc4_hdmi_conn_state(conn_state); struct drm_display_mode *mode =3D &encoder->crtc->state->adjusted_mode; struct vc4_hdmi *vc4_hdmi =3D encoder_to_vc4_hdmi(encoder); - unsigned long bvb_rate, pixel_rate, hsm_rate; + unsigned long pixel_rate =3D vc4_conn_state->pixel_rate; + unsigned long bvb_rate, hsm_rate; int ret; =20 - ret =3D pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); - if (ret < 0) { - DRM_ERROR("Failed to retain power domain: %d\n", ret); - return; - } - - pixel_rate =3D vc4_conn_state->pixel_rate; - ret =3D clk_set_rate(vc4_hdmi->pixel_clock, pixel_rate); - if (ret) { - DRM_ERROR("Failed to set pixel clock rate: %d\n", ret); - return; - } - - ret =3D clk_prepare_enable(vc4_hdmi->pixel_clock); - if (ret) { - DRM_ERROR("Failed to turn on pixel clock: %d\n", ret); - return; - } - /* * As stated in RPi's vc4 firmware "HDMI state machine (HSM) clock must * be faster than pixel clock, infinitesimally faster, tested in @@ -939,10 +920,21 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struc= t drm_encoder *encoder, return; } =20 - ret =3D clk_prepare_enable(vc4_hdmi->hsm_clock); + ret =3D pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); + if (ret < 0) { + DRM_ERROR("Failed to retain power domain: %d\n", ret); + return; + } + + ret =3D clk_set_rate(vc4_hdmi->pixel_clock, pixel_rate); if (ret) { - DRM_ERROR("Failed to turn on HSM clock: %d\n", ret); - clk_disable_unprepare(vc4_hdmi->pixel_clock); + DRM_ERROR("Failed to set pixel clock rate: %d\n", ret); + return; + } + + ret =3D clk_prepare_enable(vc4_hdmi->pixel_clock); + if (ret) { + DRM_ERROR("Failed to turn on pixel clock: %d\n", ret); return; } =20 @@ -958,7 +950,6 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct = drm_encoder *encoder, ret =3D clk_set_min_rate(vc4_hdmi->pixel_bvb_clock, bvb_rate); if (ret) { DRM_ERROR("Failed to set pixel bvb clock rate: %d\n", ret); - clk_disable_unprepare(vc4_hdmi->hsm_clock); clk_disable_unprepare(vc4_hdmi->pixel_clock); return; } @@ -966,7 +957,6 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct = drm_encoder *encoder, ret =3D clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); if (ret) { DRM_ERROR("Failed to turn on pixel bvb clock: %d\n", ret); - clk_disable_unprepare(vc4_hdmi->hsm_clock); clk_disable_unprepare(vc4_hdmi->pixel_clock); return; } @@ -2100,6 +2090,27 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *= vc4_hdmi) return 0; } =20 +static int __maybe_unused vc4_hdmi_runtime_suspend(struct device *dev) +{ + struct vc4_hdmi *vc4_hdmi =3D dev_get_drvdata(dev); + + clk_disable_unprepare(vc4_hdmi->hsm_clock); + + return 0; +} + +static int vc4_hdmi_runtime_resume(struct device *dev) +{ + struct vc4_hdmi *vc4_hdmi =3D dev_get_drvdata(dev); + int ret; + + ret =3D clk_prepare_enable(vc4_hdmi->hsm_clock); + if (ret) + return ret; + + return 0; +} + static int vc4_hdmi_bind(struct device *dev, struct device *master, void *= data) { const struct vc4_hdmi_variant *variant =3D of_device_get_match_data(dev); @@ -2367,11 +2378,18 @@ static const struct of_device_id vc4_hdmi_dt_match[= ] =3D { {} }; =20 +static const struct dev_pm_ops vc4_hdmi_pm_ops =3D { + SET_RUNTIME_PM_OPS(vc4_hdmi_runtime_suspend, + vc4_hdmi_runtime_resume, + NULL) +}; + struct platform_driver vc4_hdmi_driver =3D { .probe =3D vc4_hdmi_dev_probe, .remove =3D vc4_hdmi_dev_remove, .driver =3D { .name =3D "vc4_hdmi", .of_match_table =3D vc4_hdmi_dt_match, + .pm =3D &vc4_hdmi_pm_ops, }, }; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A631C4167D for ; Mon, 24 Jan 2022 23:24:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848640AbiAXXW5 (ORCPT ); Mon, 24 Jan 2022 18:22:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588256AbiAXWbq (ORCPT ); Mon, 24 Jan 2022 17:31:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 025C8C09542D; Mon, 24 Jan 2022 12:57:25 -0800 (PST) Received: from smtp.kernel.org (relay.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 9382B611ED; Mon, 24 Jan 2022 20:57:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B3EBC340E5; Mon, 24 Jan 2022 20:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057844; bh=V42/D9J+eVOms8WP+nFToDm5/whPS2Hd3Bz6n2GX7uI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CXHMFvTHcPvsy0y/bM1ORmceXuXo9WapkfJA9XE0FApJTiWzP4kKgA+uOR+zQQX6q 4KRzU6SkqWAzbTb/sEo4VVvq1akmEQIVdeKndljEpcdMM+/LHB610lqdonZDovHwL1 1qBqXlONe2SKibwEJkGhc3KqkBM8v6rcfvt1LsjQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Dave Stevenson , Nicolas Saenz Julienne , Michael Stapelberg , Sasha Levin Subject: [PATCH 5.16 0098/1039] drm/vc4: hdmi: Make sure the controller is powered in detect Date: Mon, 24 Jan 2022 19:31:27 +0100 Message-Id: <20220124184128.449490958@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit 0f5251339eda7f7eb7bd4467607ae1d01b24e129 ] If the HPD GPIO is not available and drm_probe_ddc fails, we end up reading the HDMI_HOTPLUG register, but the controller might be powered off resulting in a CPU hang. Make sure we have the power domain and the HSM clock powered during the detect cycle to prevent the hang from happening. Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder d= river") Signed-off-by: Maxime Ripard Reviewed-by: Dave Stevenson Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne Tested-by: Michael Stapelberg Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-= 6-maxime@cerno.tech Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 63b07087d37e8..f7e48bc6cb114 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -168,6 +168,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connect= or, bool force) struct vc4_hdmi *vc4_hdmi =3D connector_to_vc4_hdmi(connector); bool connected =3D false; =20 + WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev)); + if (vc4_hdmi->hpd_gpio && gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio)) { connected =3D true; @@ -188,10 +190,12 @@ vc4_hdmi_connector_detect(struct drm_connector *conne= ctor, bool force) } } =20 + pm_runtime_put(&vc4_hdmi->pdev->dev); return connector_status_connected; } =20 cec_phys_addr_invalidate(vc4_hdmi->cec_adap); + pm_runtime_put(&vc4_hdmi->pdev->dev); return connector_status_disconnected; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56DE9C433F5 for ; Mon, 24 Jan 2022 23:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849974AbiAXX1J (ORCPT ); Mon, 24 Jan 2022 18:27:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588258AbiAXWbq (ORCPT ); Mon, 24 Jan 2022 17:31:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBF19C095430; Mon, 24 Jan 2022 12:57:27 -0800 (PST) Received: from smtp.kernel.org (relay.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 89761612C8; Mon, 24 Jan 2022 20:57:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C986C340E8; Mon, 24 Jan 2022 20:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057847; bh=TN6v4/4sN1+XYeIpKg4vF/SxBkB5QkaJ3j9sK91D2XA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J3d3ETxxwe94ITcip4+QmAbib9egIyrr7khkDSECqvwyDZ5EnQSz0JPq10Dh+jylE /xWWBcL5qxL8vomttAgAU7VkR1z5oudm0C+LLpaOWPxUQnRal16pUps8BK/YrxvwsW dbw3z7rBP71eunQKX+ndJAYpfesjROQZBoY7JSv0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.16 0099/1039] drm/vc4: hdmi: Make sure the controller is powered up during bind Date: Mon, 24 Jan 2022 19:31:28 +0100 Message-Id: <20220124184128.482138775@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit 9c6e4f6ed1d61d5f46946e5c151ceb279eedadb1 ] In the bind hook, we actually need the device to have the HSM clock running during the final part of the display initialisation where we reset the controller and initialise the CEC component. Failing to do so will result in a complete, silent, hang of the CPU. Fixes: 411efa18e4b0 ("drm/vc4: hdmi: Move the HSM clock enable to runtime_p= m") Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-3= -maxime@cerno.tech Reviewed-by: Dave Stevenson Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_hdmi.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index f7e48bc6cb114..29ee9264b0870 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -2191,6 +2191,18 @@ static int vc4_hdmi_bind(struct device *dev, struct = device *master, void *data) if (ret) goto err_put_ddc; =20 + /* + * We need to have the device powered up at this point to call + * our reset hook and for the CEC init. + */ + ret =3D vc4_hdmi_runtime_resume(dev); + if (ret) + goto err_put_ddc; + + pm_runtime_get_noresume(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + if (vc4_hdmi->variant->reset) vc4_hdmi->variant->reset(vc4_hdmi); =20 @@ -2202,8 +2214,6 @@ static int vc4_hdmi_bind(struct device *dev, struct d= evice *master, void *data) clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); } =20 - pm_runtime_enable(dev); - drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); drm_encoder_helper_add(encoder, &vc4_hdmi_encoder_helper_funcs); =20 @@ -2227,6 +2237,8 @@ static int vc4_hdmi_bind(struct device *dev, struct d= evice *master, void *data) vc4_hdmi_debugfs_regs, vc4_hdmi); =20 + pm_runtime_put_sync(dev); + return 0; =20 err_free_cec: @@ -2237,6 +2249,7 @@ err_destroy_conn: vc4_hdmi_connector_destroy(&vc4_hdmi->connector); err_destroy_encoder: drm_encoder_cleanup(encoder); + pm_runtime_put_sync(dev); pm_runtime_disable(dev); err_put_ddc: put_device(&vc4_hdmi->ddc->dev); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D15EAC4167E for ; Mon, 24 Jan 2022 21:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452196AbiAXVYP (ORCPT ); Mon, 24 Jan 2022 16:24:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52674 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443611AbiAXU5h (ORCPT ); Mon, 24 Jan 2022 15:57:37 -0500 Received: from smtp.kernel.org (relay.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 5FD6BB8122A; Mon, 24 Jan 2022 20:57:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 798F4C340E5; Mon, 24 Jan 2022 20:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057850; bh=4+fnPt3xejjbJuigf7xg5qAXgpyUntNLIODFTb80xCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0RS3GaUcqzeqdvzzw47IByelnZXnj0XQWuKKVPdqP5piFMRJWLPE43eeqTmoJGpPA +CaqFi4Z4zfRdcWkaxQVrs+bGM58T0X5uzDCap1plJGjEGikHBBP5d5RCIeIUTZPKx M9rf+7d2iqSDo6OS1lsB6TGFklX2GM+Q49TKZYu0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.16 0100/1039] drm/vc4: hdmi: Rework the pre_crtc_configure error handling Date: Mon, 24 Jan 2022 19:31:29 +0100 Message-Id: <20220124184128.527876920@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit caa51a4c11f1cadba9bcf61ed9e0105711952ce7 ] Since our pre_crtc_configure hook returned void, we didn't implement a goto-based error path handling, leading to errors like failing to put back the device in pm_runtime in all the error paths, but also failing to disable the pixel clock if clk_set_min_rate on the HSM clock fails. Move to a goto-based implementation to have an easier consitency. Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder d= river") Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-4= -maxime@cerno.tech Reviewed-by: Dave Stevenson Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_hdmi.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 29ee9264b0870..05fd54fbb773e 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -933,15 +933,16 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struc= t drm_encoder *encoder, ret =3D clk_set_rate(vc4_hdmi->pixel_clock, pixel_rate); if (ret) { DRM_ERROR("Failed to set pixel clock rate: %d\n", ret); - return; + goto err_put_runtime_pm; } =20 ret =3D clk_prepare_enable(vc4_hdmi->pixel_clock); if (ret) { DRM_ERROR("Failed to turn on pixel clock: %d\n", ret); - return; + goto err_put_runtime_pm; } =20 + vc4_hdmi_cec_update_clk_div(vc4_hdmi); =20 if (pixel_rate > 297000000) @@ -954,15 +955,13 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struc= t drm_encoder *encoder, ret =3D clk_set_min_rate(vc4_hdmi->pixel_bvb_clock, bvb_rate); if (ret) { DRM_ERROR("Failed to set pixel bvb clock rate: %d\n", ret); - clk_disable_unprepare(vc4_hdmi->pixel_clock); - return; + goto err_disable_pixel_clock; } =20 ret =3D clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); if (ret) { DRM_ERROR("Failed to turn on pixel bvb clock: %d\n", ret); - clk_disable_unprepare(vc4_hdmi->pixel_clock); - return; + goto err_disable_pixel_clock; } =20 if (vc4_hdmi->variant->phy_init) @@ -975,6 +974,15 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct= drm_encoder *encoder, =20 if (vc4_hdmi->variant->set_timings) vc4_hdmi->variant->set_timings(vc4_hdmi, conn_state, mode); + + return; + +err_disable_pixel_clock: + clk_disable_unprepare(vc4_hdmi->pixel_clock); +err_put_runtime_pm: + pm_runtime_put(&vc4_hdmi->pdev->dev); + + return; } =20 static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1647AC2BA4C for ; Mon, 24 Jan 2022 23:24:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848758AbiAXXXO (ORCPT ); Mon, 24 Jan 2022 18:23:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588608AbiAXWdl (ORCPT ); Mon, 24 Jan 2022 17:33:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3C60C095436; Mon, 24 Jan 2022 12:57:35 -0800 (PST) Received: from smtp.kernel.org (relay.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 89AD9B812A4; Mon, 24 Jan 2022 20:57:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A931AC340E5; Mon, 24 Jan 2022 20:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057853; bh=6yOJ5HGX4s/hvqyokoZbRAiRTadbNajAI/pYKePkIRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LcCTIDahSKjKEgmr9AqftfevBc+keTUyqM9wi3Gaey7KUwNev6MiKt6jIs3F/H++s Q0w1EU3BjQuRw5c4tEeOW8l2+CPu5RNQGNBiIt0C6FOlYjxB3qYqLH8feIxDRoLH04 HzMnNnQjNdryNVhZ6EflT+51v9JjtaidPLbdKJzo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Nicolas Saenz Julienne , Sasha Levin Subject: [PATCH 5.16 0101/1039] drm/vc4: crtc: Make sure the HDMI controller is powered when disabling Date: Mon, 24 Jan 2022 19:31:30 +0100 Message-Id: <20220124184128.559489885@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit bca10db67bdaf15997a5a2a276e7aa9b6eea1393 ] Since commit 875a4d536842 ("drm/vc4: drv: Disable the CRTC at boot time"), during the initial setup of the driver we call into the VC4 HDMI controller hooks to make sure the controller is properly disabled. However, we were never making sure that the device was properly powered while doing so. This never resulted in any (reported) issue in practice, but since the introduction of commit 4209f03fcb8e ("drm/vc4: hdmi: Warn if we access the controller while disabled") we get a loud complaint when we do that kind of access. Let's make sure we have the HDMI controller properly powered while disabling it. Fixes: 875a4d536842 ("drm/vc4: drv: Disable the CRTC at boot time") Signed-off-by: Maxime Ripard Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne Link: https://patchwork.freedesktop.org/patch/msgid/20210923185013.826679-1= -maxime@cerno.tech Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_crtc.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 18f5009ce90e3..c0df11e5fcf2b 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -32,6 +32,7 @@ #include #include #include +#include =20 #include #include @@ -42,6 +43,7 @@ #include =20 #include "vc4_drv.h" +#include "vc4_hdmi.h" #include "vc4_regs.h" =20 #define HVS_FIFO_LATENCY_PIX 6 @@ -496,8 +498,10 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) enum vc4_encoder_type encoder_type; const struct vc4_pv_data *pv_data; struct drm_encoder *encoder; + struct vc4_hdmi *vc4_hdmi; unsigned encoder_sel; int channel; + int ret; =20 if (!(of_device_is_compatible(vc4_crtc->pdev->dev.of_node, "brcm,bcm2711-pixelvalve2") || @@ -525,7 +529,20 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) if (WARN_ON(!encoder)) return 0; =20 - return vc4_crtc_disable(crtc, encoder, NULL, channel); + vc4_hdmi =3D encoder_to_vc4_hdmi(encoder); + ret =3D pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); + if (ret) + return ret; + + ret =3D vc4_crtc_disable(crtc, encoder, NULL, channel); + if (ret) + return ret; + + ret =3D pm_runtime_put(&vc4_hdmi->pdev->dev); + if (ret) + return ret; + + return 0; } =20 static void vc4_crtc_atomic_disable(struct drm_crtc *crtc, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51E53C433EF for ; Mon, 24 Jan 2022 21:27:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452214AbiAXVYT (ORCPT ); Mon, 24 Jan 2022 16:24:19 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46816 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241281AbiAXU5h (ORCPT ); Mon, 24 Jan 2022 15:57:37 -0500 Received: from smtp.kernel.org (relay.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 DDA94612E9; Mon, 24 Jan 2022 20:57:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2763C340E8; Mon, 24 Jan 2022 20:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057856; bh=RFhbMtU9WWHcwmOOT93T6numiDfaJre4ODtUp/i8QeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AwFvmi2hJ/qrIGIZg+LAq5torC0PZsrJXfeE2QC/PU4JCTKRnrhkXh5PMjQ+A7N/p pMnpLwTB1jQOyM+svNQhZVF1nKSlVvND/OgmEyFiJAxhwVWv0CYuB6vQNOshLlqany 3pEAJ+mxzoA8Q6ojT0l7Xu2T/1RFn+frVREMChj8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Ravnborg , Marek Vasut , Maxime Ripard , Sasha Levin Subject: [PATCH 5.16 0102/1039] drm/bridge: sn65dsi83: Fix bridge removal Date: Mon, 24 Jan 2022 19:31:31 +0100 Message-Id: <20220124184128.591074711@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit c05f1a4e2c4b8a217b448828c4e59fb47454dc75 ] Commit 24417d5b0c00 ("drm/bridge: ti-sn65dsi83: Implement .detach callback") moved the unregistration of the bridge DSI device and bridge itself to the detach callback. While this is correct for the DSI device detach and unregistration, the bridge is added in the driver probe, and should thus be removed as part of its remove callback. Acked-by: Sam Ravnborg Reviewed-by: Marek Vasut Fixes: 24417d5b0c00 ("drm/bridge: ti-sn65dsi83: Implement .detach callback") Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-= 14-maxime@cerno.tech Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge= /ti-sn65dsi83.c index ba1160ec6d6e8..07917681782d2 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c @@ -297,7 +297,6 @@ static void sn65dsi83_detach(struct drm_bridge *bridge) =20 mipi_dsi_detach(ctx->dsi); mipi_dsi_device_unregister(ctx->dsi); - drm_bridge_remove(&ctx->bridge); ctx->dsi =3D NULL; } =20 @@ -711,6 +710,7 @@ static int sn65dsi83_remove(struct i2c_client *client) { struct sn65dsi83 *ctx =3D i2c_get_clientdata(client); =20 + drm_bridge_remove(&ctx->bridge); of_node_put(ctx->host_node); =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EB55C4332F for ; Mon, 24 Jan 2022 21:29:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376423AbiAXV3S (ORCPT ); Mon, 24 Jan 2022 16:29:18 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50446 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352878AbiAXU5n (ORCPT ); Mon, 24 Jan 2022 15:57:43 -0500 Received: from smtp.kernel.org (relay.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 0EF496091C; Mon, 24 Jan 2022 20:57:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B966CC340E5; Mon, 24 Jan 2022 20:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057862; bh=E+geO893sEofmPyZ87Zb0IqJCydCQDY6kQK2m97CFPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uTtF/Xnq/Umzg7iN4e5n7jihg5WDVabZnQGKSJmB0ZmBPeyp/OztH8kDOsDg5+wBa WhSRgYoIXadctArkC1lIKOCMlf1eyljWOZ1AVqTvXGwBqxUlRlLcFR6wbQjuELvAWP egm/J8k/PCNw48yicyQcSmaiDKsIreZc7hPKgvag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.16 0103/1039] drm/virtio: fix potential integer overflow on shift of a int Date: Mon, 24 Jan 2022 19:31:32 +0100 Message-Id: <20220124184128.620812085@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Colin Ian King [ Upstream commit 8f4502fa284478a5264afa8a5a95511276fa9b80 ] The left shift of unsigned int 32 bit integer constant 1 is evaluated using 32 bit arithmetic and then assigned to a signed 64 bit integer. In the case where i is 32 or more this can lead to an overflow. Fix this by shifting the value 1ULL instead. Addresses-Coverity: ("Uninitentional integer overflow") Fixes: 8d6b006e1f51 ("drm/virtio: implement context init: handle VIRTGPU_CO= NTEXT_PARAM_POLL_RINGS_MASK") Signed-off-by: Colin Ian King Link: http://patchwork.freedesktop.org/patch/msgid/20210930101941.16546-1-c= olin.king@canonical.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virti= o/virtgpu_ioctl.c index 3607646d32295..5e8103a197a96 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -819,7 +819,7 @@ static int virtio_gpu_context_init_ioctl(struct drm_dev= ice *dev, if (vfpriv->ring_idx_mask) { valid_ring_mask =3D 0; for (i =3D 0; i < vfpriv->num_rings; i++) - valid_ring_mask |=3D 1 << i; + valid_ring_mask |=3D 1ULL << i; =20 if (~valid_ring_mask & vfpriv->ring_idx_mask) { ret =3D -EINVAL; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABE99C433EF for ; Mon, 24 Jan 2022 23:29:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849879AbiAXX0v (ORCPT ); Mon, 24 Jan 2022 18:26:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382505AbiAXWdl (ORCPT ); Mon, 24 Jan 2022 17:33:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E9C3C0E532B; Mon, 24 Jan 2022 12:57:48 -0800 (PST) Received: from smtp.kernel.org (relay.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 38244B8105C; Mon, 24 Jan 2022 20:57:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F17E2C340E5; Mon, 24 Jan 2022 20:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057866; bh=tctGHt42q3Mwwq0FN9H+8T4NxW6LUpLsKjo4CgiWmo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P0cHeLOL9nKLMxNEc4ENDo1QUO1Kbp7rzOke5h0MGj8hxmvDwp/lyrGjJQtAU5cfi FAxoEQCS8bnZng2JtNABD0FiD7nRqt1yrnRygR/44+jQvnNjnw5+Ob+JalZLCqzzvC Pt1zUu5/30hSJbJ7EOjaOn34s1OX6pCijZqqikZU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.16 0104/1039] drm/virtio: fix another potential integer overflow on shift of a int Date: Mon, 24 Jan 2022 19:31:33 +0100 Message-Id: <20220124184128.650978883@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Colin Ian King [ Upstream commit 74c1bda2f3fa79a93e1c910008649b49b02dc09d ] The left shift of unsigned int 32 bit integer constant 1 is evaluated using 32 bit arithmetic and then assigned to a signed 64 bit integer. In the case where value is 32 or more this can lead to an overflow (value can be in range 0..MAX_CAPSET_ID (63). Fix this by shifting the value 1ULL instead. Addresses-Coverity: ("Uninitentional integer overflow") Fixes: 4fb530e5caf7 ("drm/virtio: implement context init: support init ioct= l") Signed-off-by: Colin Ian King Link: http://patchwork.freedesktop.org/patch/msgid/20210930102748.16922-1-c= olin.king@canonical.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virti= o/virtgpu_ioctl.c index 5e8103a197a96..c708bab555c6b 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -774,7 +774,7 @@ static int virtio_gpu_context_init_ioctl(struct drm_dev= ice *dev, goto out_unlock; } =20 - if ((vgdev->capset_id_mask & (1 << value)) =3D=3D 0) { + if ((vgdev->capset_id_mask & (1ULL << value)) =3D=3D 0) { ret =3D -EINVAL; goto out_unlock; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02969C41535 for ; Mon, 24 Jan 2022 23:24:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848740AbiAXXXM (ORCPT ); Mon, 24 Jan 2022 18:23:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588672AbiAXWdl (ORCPT ); Mon, 24 Jan 2022 17:33:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 378DDC0E5330; Mon, 24 Jan 2022 12:57:50 -0800 (PST) Received: from smtp.kernel.org (relay.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 AFD1E61320; Mon, 24 Jan 2022 20:57:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80AE8C340E7; Mon, 24 Jan 2022 20:57:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057869; bh=Ldv1IgbXLpEOmnG7o28Dn2DVNZGLVTN6NNClYfU6V8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JkY4CHn6PAFEoMrroFySU+dxyojWqTd6+njgPdGgYeNlTU9WOOzhM61rNsmLrdrRE 3B02KlgutjAL6vYkdKSfKEljpKUpEfO3HrNbn5u/5zWaNx0IXbISS6xrUQSOKdyOpu K1F657TFzfzYNa/cJ/C5ypJxaFn2aDMNOU8vUNck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Li , Bryan ODonoghue , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0105/1039] wcn36xx: ensure pairing of init_scan/finish_scan and start_scan/end_scan Date: Mon, 24 Jan 2022 19:31:34 +0100 Message-Id: <20220124184128.681330389@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Li [ Upstream commit 8f1ba8b0ee2679f0b3d22d2a5c1bc70c436fd872 ] An SMD capture from the downstream prima driver on WCN3680B shows the following command sequence for connected scans: - init_scan_req - start_scan_req, channel 1 - end_scan_req, channel 1 - start_scan_req, channel 2 - ... - end_scan_req, channel 3 - finish_scan_req - init_scan_req - start_scan_req, channel 4 - ... - end_scan_req, channel 6 - finish_scan_req - ... - end_scan_req, channel 165 - finish_scan_req Upstream currently never calls wcn36xx_smd_end_scan, and in some cases[1] still sends finish_scan_req twice in a row or before init_scan_req. A typical connected scan looks like this: - init_scan_req - start_scan_req, channel 1 - finish_scan_req - init_scan_req - start_scan_req, channel 2 - ... - start_scan_req, channel 165 - finish_scan_req - finish_scan_req This patch cleans up scanning so that init/finish and start/end are always paired together and correctly nested. - init_scan_req - start_scan_req, channel 1 - end_scan_req, channel 1 - finish_scan_req - init_scan_req - start_scan_req, channel 2 - end_scan_req, channel 2 - ... - start_scan_req, channel 165 - end_scan_req, channel 165 - finish_scan_req Note that upstream will not do batching of 3 active-probe scans before returning to the operating channel, and this patch does not change that. To match downstream in this aspect, adjust IEEE80211_PROBE_DELAY and/or the 125ms max off-channel time in ieee80211_scan_state_decision. [1]: commit d195d7aac09b ("wcn36xx: Ensure finish scan is not requested before start scan") addressed one case of finish_scan_req being sent without a preceding init_scan_req (the case of the operating channel coinciding with the first scan channel); two other cases are: 1) if SW scan is started and aborted immediately, without scanning any channels, we send a finish_scan_req without ever sending init_scan_req, and 2) as SW scan logic always returns us to the operating channel before calling wcn36xx_sw_scan_complete, finish_scan_req is always sent twice at the end of a SW scan Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680= hardware") Signed-off-by: Benjamin Li Tested-by: Bryan O'Donoghue Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211027170306.555535-4-benl@squareup.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/wcn36xx/main.c | 34 +++++++++++++++++----- drivers/net/wireless/ath/wcn36xx/smd.c | 4 +++ drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 + 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless= /ath/wcn36xx/main.c index b04533bbc3a45..0747c27f3bd75 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -402,6 +402,7 @@ static void wcn36xx_change_opchannel(struct wcn36xx *wc= n, int ch) static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed) { struct wcn36xx *wcn =3D hw->priv; + int ret; =20 wcn36xx_dbg(WCN36XX_DBG_MAC, "mac config changed 0x%08x\n", changed); =20 @@ -417,17 +418,31 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u3= 2 changed) * want to receive/transmit regular data packets, then * simply stop the scan session and exit PS mode. */ - wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN, - wcn->sw_scan_vif); - wcn->sw_scan_channel =3D 0; + if (wcn->sw_scan_channel) + wcn36xx_smd_end_scan(wcn, wcn->sw_scan_channel); + if (wcn->sw_scan_init) { + wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN, + wcn->sw_scan_vif); + } } else if (wcn->sw_scan) { /* A scan is ongoing, do not change the operating * channel, but start a scan session on the channel. */ - wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN, - wcn->sw_scan_vif); + if (wcn->sw_scan_channel) + wcn36xx_smd_end_scan(wcn, wcn->sw_scan_channel); + if (!wcn->sw_scan_init) { + /* This can fail if we are unable to notify the + * operating channel. + */ + ret =3D wcn36xx_smd_init_scan(wcn, + HAL_SYS_MODE_SCAN, + wcn->sw_scan_vif); + if (ret) { + mutex_unlock(&wcn->conf_mutex); + return -EIO; + } + } wcn36xx_smd_start_scan(wcn, ch); - wcn->sw_scan_channel =3D ch; } else { wcn36xx_change_opchannel(wcn, ch); } @@ -722,7 +737,12 @@ static void wcn36xx_sw_scan_complete(struct ieee80211_= hw *hw, struct wcn36xx *wcn =3D hw->priv; =20 /* ensure that any scan session is finished */ - wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN, wcn->sw_scan_vif); + if (wcn->sw_scan_channel) + wcn36xx_smd_end_scan(wcn, wcn->sw_scan_channel); + if (wcn->sw_scan_init) { + wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN, + wcn->sw_scan_vif); + } wcn->sw_scan =3D false; wcn->sw_scan_opchannel =3D 0; } diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/= ath/wcn36xx/smd.c index ed45e2cf039be..e44506e4f1d5f 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -722,6 +722,7 @@ int wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn= 36xx_hal_sys_mode mode, wcn36xx_err("hal_init_scan response failed err=3D%d\n", ret); goto out; } + wcn->sw_scan_init =3D true; out: mutex_unlock(&wcn->hal_mutex); return ret; @@ -752,6 +753,7 @@ int wcn36xx_smd_start_scan(struct wcn36xx *wcn, u8 scan= _channel) wcn36xx_err("hal_start_scan response failed err=3D%d\n", ret); goto out; } + wcn->sw_scan_channel =3D scan_channel; out: mutex_unlock(&wcn->hal_mutex); return ret; @@ -782,6 +784,7 @@ int wcn36xx_smd_end_scan(struct wcn36xx *wcn, u8 scan_c= hannel) wcn36xx_err("hal_end_scan response failed err=3D%d\n", ret); goto out; } + wcn->sw_scan_channel =3D 0; out: mutex_unlock(&wcn->hal_mutex); return ret; @@ -823,6 +826,7 @@ int wcn36xx_smd_finish_scan(struct wcn36xx *wcn, wcn36xx_err("hal_finish_scan response failed err=3D%d\n", ret); goto out; } + wcn->sw_scan_init =3D false; out: mutex_unlock(&wcn->hal_mutex); return ret; diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wirel= ess/ath/wcn36xx/wcn36xx.h index 1c8d918137da2..fbd0558c2c196 100644 --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -248,6 +248,7 @@ struct wcn36xx { struct cfg80211_scan_request *scan_req; bool sw_scan; u8 sw_scan_opchannel; + bool sw_scan_init; u8 sw_scan_channel; struct ieee80211_vif *sw_scan_vif; struct mutex scan_lock; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0EFBC433FE for ; Mon, 24 Jan 2022 23:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849858AbiAXX0u (ORCPT ); Mon, 24 Jan 2022 18:26:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588673AbiAXWdl (ORCPT ); Mon, 24 Jan 2022 17:33:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA300C0E5334; Mon, 24 Jan 2022 12:57:52 -0800 (PST) Received: from smtp.kernel.org (relay.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 8A68061320; Mon, 24 Jan 2022 20:57:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92AEDC340E5; Mon, 24 Jan 2022 20:57:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057872; bh=lQxGW83yomj9stvgKpFbQglETKhTfrUyMk/dbOUFkic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pHKNadLO+OgNAU3qy/JxwZS/6XIU8tAf9mcaPnMcU+ZjM6Ubdia6Tc0IpYm3LGSh5 z0svoJorj0NxFH7iSQa2zxAQ3E0alAVSh85VZuDGgjPhXKCKAYn19WwUJSaaPpLDwn w3XF3ffKIQEmvDM/eWmLatKkyBmrLS4Q77r9TmTo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0106/1039] wcn36xx: Indicate beacon not connection loss on MISSED_BEACON_IND Date: Mon, 24 Jan 2022 19:31:35 +0100 Message-Id: <20220124184128.711635787@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 588b45c88ae130fe373a8c50edaf54735c3f4fe3 ] Firmware can trigger a missed beacon indication, this is not the same as a lost signal. Flag to Linux the missed beacon and let the WiFi stack decide for itself if the link is up or down by sending its own probe to determine this. We should only be signalling the link is lost when the firmware indicates Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680= hardware") Signed-off-by: Bryan O'Donoghue Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211027232529.657764-1-bryan.odonoghue@lin= aro.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/wcn36xx/smd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/= ath/wcn36xx/smd.c index e44506e4f1d5f..d3285a504429d 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2736,7 +2736,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36= xx *wcn, wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", tmp->bss_index); vif =3D wcn36xx_priv_to_vif(tmp); - ieee80211_connection_loss(vif); + ieee80211_beacon_loss(vif); } return 0; } @@ -2751,7 +2751,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36= xx *wcn, wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", rsp->bss_index); vif =3D wcn36xx_priv_to_vif(tmp); - ieee80211_connection_loss(vif); + ieee80211_beacon_loss(vif); return 0; } } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 948C9C4321E for ; Mon, 24 Jan 2022 21:37:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455066AbiAXVek (ORCPT ); Mon, 24 Jan 2022 16:34:40 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49266 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443639AbiAXU5z (ORCPT ); Mon, 24 Jan 2022 15:57:55 -0500 Received: from smtp.kernel.org (relay.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 5E440611DA; Mon, 24 Jan 2022 20:57:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47923C340E5; Mon, 24 Jan 2022 20:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057874; bh=KhvIkvCRQAidrDbmtKYuotaLjKwnMHLsfkWCzUzzhO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YAOpRqgZ21eYE9LPlbvZcVp8ArLkdWRZBLAB+x2CSyJFjgRmgjrJwJ6wmIRxvs9EX CPRLC0Ns0/K/NNANlzkfoOfKdpEB9Ompi4HaVkLHI9j2L26KNiVerji1JN0VSrKemE OLPyeUw/tQ6cmpybsOLp8aCDlLedc4zwU4tGLCNc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Yonghong Song , Sasha Levin Subject: [PATCH 5.16 0107/1039] libbpf: Fix section counting logic Date: Mon, 24 Jan 2022 19:31:36 +0100 Message-Id: <20220124184128.743283043@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 0d6988e16a12ebd41d3e268992211b0ceba44ed7 ] e_shnum does include section #0 and as such is exactly the number of ELF sections that we need to allocate memory for to use section indices as array indices. Fix the off-by-one error. This is purely accounting fix, previously we were overallocating one too many array items. But no correctness errors otherwise. Fixes: 25bbbd7a444b ("libbpf: Remove assumptions about uniqueness of .rodat= a/.data/.bss maps") Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20211103173213.1376990-5-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/libbpf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 7c74342bb6680..5367bc8e52073 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -3191,11 +3191,11 @@ static int bpf_object__elf_collect(struct bpf_objec= t *obj) Elf_Scn *scn; Elf64_Shdr *sh; =20 - /* ELF section indices are 1-based, so allocate +1 element to keep - * indexing simple. Also include 0th invalid section into sec_cnt for - * simpler and more traditional iteration logic. + /* ELF section indices are 0-based, but sec #0 is special "invalid" + * section. e_shnum does include sec #0, so e_shnum is the necessary + * size of an array to keep all the sections. */ - obj->efile.sec_cnt =3D 1 + obj->efile.ehdr->e_shnum; + obj->efile.sec_cnt =3D obj->efile.ehdr->e_shnum; obj->efile.secs =3D calloc(obj->efile.sec_cnt, sizeof(*obj->efile.secs)); if (!obj->efile.secs) return -ENOMEM; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DD0CC4332F for ; Mon, 24 Jan 2022 21:37:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455009AbiAXVeg (ORCPT ); Mon, 24 Jan 2022 16:34:36 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53016 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346556AbiAXU6B (ORCPT ); Mon, 24 Jan 2022 15:58:01 -0500 Received: from smtp.kernel.org (relay.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 407FDB810A8; Mon, 24 Jan 2022 20:57:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E345C340EE; Mon, 24 Jan 2022 20:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057878; bh=WZDVIQIpgDa0TPO+WKGnuxZv7obQrPN87x3ZN3QYyIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d72mdtIr5n1dGfy8MlLOp0cLrohAZ4biD8qNDJGmIK3ugpMhsVuhDWeQCYDt6AGtb cdpfYLMle4mD8TXK+pAWY0sR8aNB5XJF9QJzbOrOUOsEjIuyEfqBZwCn9QT3r3HnmH kw7UH8k4AiRBfITXvWJBEwezqIWTY7NApH2i61cs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Dave Stevenson , Sasha Levin Subject: [PATCH 5.16 0108/1039] drm/vc4: hdmi: Enable the scrambler on reconnection Date: Mon, 24 Jan 2022 19:31:37 +0100 Message-Id: <20220124184128.776595374@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit b7551457c5d0b3505b0be247d47919c1ee30506d ] If we have a state already and disconnect/reconnect the display, the SCDC messages won't be sent again since we didn't go through a disable / enable cycle. In order to fix this, let's call the vc4_hdmi_enable_scrambling function in the detect callback if there is a mode and it needs the scrambler to be enabled. Fixes: c85695a2016e ("drm/vc4: hdmi: Enable the scrambler") Signed-off-by: Maxime Ripard Reviewed-by: Dave Stevenson Link: https://lore.kernel.org/r/20211025152903.1088803-10-maxime@cerno.tech Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_hdmi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 05fd54fbb773e..c000946996edb 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -162,6 +162,8 @@ static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi= *vc4_hdmi) static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) {} #endif =20 +static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder); + static enum drm_connector_status vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) { @@ -190,6 +192,7 @@ vc4_hdmi_connector_detect(struct drm_connector *connect= or, bool force) } } =20 + vc4_hdmi_enable_scrambling(&vc4_hdmi->encoder.base.base); pm_runtime_put(&vc4_hdmi->pdev->dev); return connector_status_connected; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70190C433FE for ; Mon, 24 Jan 2022 21:27:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452261AbiAXVY1 (ORCPT ); Mon, 24 Jan 2022 16:24:27 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53064 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234558AbiAXU6E (ORCPT ); Mon, 24 Jan 2022 15:58:04 -0500 Received: from smtp.kernel.org (relay.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 53E93B80FA1; Mon, 24 Jan 2022 20:58:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80242C340E5; Mon, 24 Jan 2022 20:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057881; bh=ar9ht5AP9dAkNJ725Y7CCDGfnkeI2slBT93cSTlvyOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q0icwx5UClFFqNtz9hZdmZD15jPKYJD4tz3/EwnOP7F9RbbvRjhc7H7RyA6xpR8RN Cksf4fqDdcgiJqRnPMfNCOoLrsRFYlaYGDTlMWouBDvVwF4r+p+4d5ipMTVTSqR9oX isQ6HKZmHNxtcKCSesythzbN4YRy3qW+QM3mHkOE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Kumar Kartikeya Dwivedi , Sasha Levin Subject: [PATCH 5.16 0109/1039] libbpf: Fix non-C89 loop variable declaration in gen_loader.c Date: Mon, 24 Jan 2022 19:31:38 +0100 Message-Id: <20220124184128.805775372@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit b8b5cb55f5d3f03cc1479a3768d68173a10359ad ] Fix the `int i` declaration inside the for statement. This is non-C89 compliant. See [0] for user report breaking BCC build. [0] https://github.com/libbpf/libbpf/issues/403 Fixes: 18f4fccbf314 ("libbpf: Update gen_loader to emit BTF_KIND_FUNC reloc= ations") Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Acked-by: Kumar Kartikeya Dwivedi Link: https://lore.kernel.org/bpf/20211105191055.3324874-1-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/gen_loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/gen_loader.c b/tools/lib/bpf/gen_loader.c index 9934851ccde76..5aad39e92a7a5 100644 --- a/tools/lib/bpf/gen_loader.c +++ b/tools/lib/bpf/gen_loader.c @@ -597,8 +597,9 @@ void bpf_gen__record_extern(struct bpf_gen *gen, const = char *name, bool is_weak, static struct ksym_desc *get_ksym_desc(struct bpf_gen *gen, struct ksym_re= lo_desc *relo) { struct ksym_desc *kdesc; + int i; =20 - for (int i =3D 0; i < gen->nr_ksyms; i++) { + for (i =3D 0; i < gen->nr_ksyms; i++) { if (!strcmp(gen->ksyms[i].name, relo->name)) { gen->ksyms[i].ref++; return &gen->ksyms[i]; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C7CFC46467 for ; Mon, 24 Jan 2022 21:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452283AbiAXVY3 (ORCPT ); Mon, 24 Jan 2022 16:24:29 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50862 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353026AbiAXU6F (ORCPT ); Mon, 24 Jan 2022 15:58:05 -0500 Received: from smtp.kernel.org (relay.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 B5CEC61365; Mon, 24 Jan 2022 20:58:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90921C340E5; Mon, 24 Jan 2022 20:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057884; bh=RO+5N/zhRhahqWndNfd+YsjyavI19TV9eMuwRXShToo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TIFpWiSCkkbm9r38mtPAp7mSTovnYEy7aKVudpVvgeOluvHWCW+B/D7GvcqnY2M5z GuTKR2dFSMExAQixtP3U9J/xtGdorTkHgZw9mXP91uTdARIMYyCrTKxJ6BEanVeMgP Kpq3bfuaq0mKHDlnU7i2/SUbNElUN3Vxr58ixcRk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Hengqi Chen , Sasha Levin Subject: [PATCH 5.16 0110/1039] libbpf: Free up resources used by inner map definition Date: Mon, 24 Jan 2022 19:31:39 +0100 Message-Id: <20220124184128.836185058@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 8f7b239ea8cfdc8e64c875ee417fed41431a1f37 ] It's not enough to just free(map->inner_map), as inner_map itself can have extra memory allocated, like map name. Fixes: 646f02ffdd49 ("libbpf: Add BTF-defined map-in-map support") Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Reviewed-by: Hengqi Chen Link: https://lore.kernel.org/bpf/20211107165521.9240-3-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/libbpf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 5367bc8e52073..509f3719409bb 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -9028,7 +9028,10 @@ int bpf_map__set_inner_map_fd(struct bpf_map *map, i= nt fd) pr_warn("error: inner_map_fd already specified\n"); return libbpf_err(-EINVAL); } - zfree(&map->inner_map); + if (map->inner_map) { + bpf_map__destroy(map->inner_map); + zfree(&map->inner_map); + } map->inner_map_fd =3D fd; return 0; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D201C3526D for ; Mon, 24 Jan 2022 21:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452435AbiAXVZh (ORCPT ); Mon, 24 Jan 2022 16:25:37 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50964 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344034AbiAXU6L (ORCPT ); Mon, 24 Jan 2022 15:58:11 -0500 Received: from smtp.kernel.org (relay.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 E10396135E; Mon, 24 Jan 2022 20:58:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCB50C340FF; Mon, 24 Jan 2022 20:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057887; bh=87EGaLCvwwvOqdzfY5gZL3MVLBoAuuQp2zJygvRpI54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zTpX4xMLHgrySUBp+NjNoDEqGWhfTn/tPEMsknUHSxFjQCKtA7KItE8PnLvfwwueS WubH2IP5o/CWmmYmR1BcAXKWaRsqE/6LhKLR72laltt4U3OfCCRNX4rhDVmvL3LGaZ YkqEq93NV5XTvBa/QE5f/+ob2NgFropkem1Rpheg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0111/1039] wcn36xx: Fix DMA channel enable/disable cycle Date: Mon, 24 Jan 2022 19:31:40 +0100 Message-Id: <20220124184128.867009451@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 89dcb1da611d9b3ff0728502d58372fdaae9ebff ] Right now we have a broken sequence where we enable DMA channel interrupts which can be left enabled and never disabled if we hit an error path. Worse still when we unload the driver, the DMA channel interrupt bits are left intact. About the only saving grace here is that we do remember to disable the wcnss interrupt when unload the driver. Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680= hardware") Signed-off-by: Bryan O'Donoghue Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211105122152.1580542-2-bryan.odonoghue@li= naro.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/wcn36xx/dxe.c | 38 ++++++++++++++++++-------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/= ath/wcn36xx/dxe.c index aff04ef662663..0c4f63f1312f8 100644 --- a/drivers/net/wireless/ath/wcn36xx/dxe.c +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c @@ -272,6 +272,21 @@ static int wcn36xx_dxe_enable_ch_int(struct wcn36xx *w= cn, u16 wcn_ch) return 0; } =20 +static void wcn36xx_dxe_disable_ch_int(struct wcn36xx *wcn, u16 wcn_ch) +{ + int reg_data =3D 0; + + wcn36xx_dxe_read_register(wcn, + WCN36XX_DXE_INT_MASK_REG, + ®_data); + + reg_data &=3D ~wcn_ch; + + wcn36xx_dxe_write_register(wcn, + WCN36XX_DXE_INT_MASK_REG, + (int)reg_data); +} + static int wcn36xx_dxe_fill_skb(struct device *dev, struct wcn36xx_dxe_ctl *ctl, gfp_t gfp) @@ -869,7 +884,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) WCN36XX_DXE_WQ_TX_L); =20 wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, ®_data); - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L); =20 /***************************************/ /* Init descriptors for TX HIGH channel */ @@ -893,9 +907,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) =20 wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, ®_data); =20 - /* Enable channel interrupts */ - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H); - /***************************************/ /* Init descriptors for RX LOW channel */ /***************************************/ @@ -905,7 +916,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) goto out_err_rxl_ch; } =20 - /* For RX we need to preallocated buffers */ wcn36xx_dxe_ch_alloc_skb(wcn, &wcn->dxe_rx_l_ch); =20 @@ -928,9 +938,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) WCN36XX_DXE_REG_CTL_RX_L, WCN36XX_DXE_CH_DEFAULT_CTL_RX_L); =20 - /* Enable channel interrupts */ - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); - /***************************************/ /* Init descriptors for RX HIGH channel */ /***************************************/ @@ -962,15 +969,18 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) WCN36XX_DXE_REG_CTL_RX_H, WCN36XX_DXE_CH_DEFAULT_CTL_RX_H); =20 - /* Enable channel interrupts */ - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); - ret =3D wcn36xx_dxe_request_irqs(wcn); if (ret < 0) goto out_err_irq; =20 timer_setup(&wcn->tx_ack_timer, wcn36xx_dxe_tx_timer, 0); =20 + /* Enable channel interrupts */ + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L); + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H); + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); + return 0; =20 out_err_irq: @@ -987,6 +997,12 @@ out_err_txh_ch: =20 void wcn36xx_dxe_deinit(struct wcn36xx *wcn) { + /* Disable channel interrupts */ + wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); + wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); + wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H); + wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L); + free_irq(wcn->tx_irq, wcn); free_irq(wcn->rx_irq, wcn); del_timer(&wcn->tx_ack_timer); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26E2DC4707A for ; Mon, 24 Jan 2022 23:24:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848778AbiAXXXR (ORCPT ); Mon, 24 Jan 2022 18:23:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835115AbiAXWfm (ORCPT ); Mon, 24 Jan 2022 17:35:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CBEAC097FB7; Mon, 24 Jan 2022 12:58:11 -0800 (PST) Received: from smtp.kernel.org (relay.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 DDAAC61323; Mon, 24 Jan 2022 20:58:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B432CC340E5; Mon, 24 Jan 2022 20:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057890; bh=Y3/oFE/QPkDB9XzitazqTYGIxNmsbbIZuW60fHLZWPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H19cGVXO6mot1dtSql1EZVt9Tb1k2fCva0iePIA2DGusrVn2MUDLrd6aQ3dqyo04h DSvYQtzrHGEcWm/BkK8LO97Q1H9RZl8oIxX5Pa/ZsXui20ycSKc9D3MfoVujx8PQSe C8XmCJO501dPZKSrvBLxt2IrC3x1kzcQtaQpmmGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0112/1039] wcn36xx: Release DMA channel descriptor allocations Date: Mon, 24 Jan 2022 19:31:41 +0100 Message-Id: <20220124184128.898293990@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 3652096e5263ad67604b0323f71d133485f410e5 ] When unloading the driver we are not releasing the DMA descriptors which we previously allocated. Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680= hardware") Signed-off-by: Bryan O'Donoghue Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211105122152.1580542-3-bryan.odonoghue@li= naro.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/wcn36xx/dxe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/= ath/wcn36xx/dxe.c index 0c4f63f1312f8..017c7d78072ba 100644 --- a/drivers/net/wireless/ath/wcn36xx/dxe.c +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c @@ -1014,4 +1014,9 @@ void wcn36xx_dxe_deinit(struct wcn36xx *wcn) =20 wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_l_ch); wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_h_ch); + + wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_tx_l_ch); + wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_tx_h_ch); + wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_rx_l_ch); + wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_rx_h_ch); } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2AF3C433F5 for ; Mon, 24 Jan 2022 23:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849895AbiAXX0y (ORCPT ); Mon, 24 Jan 2022 18:26:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835106AbiAXWfm (ORCPT ); Mon, 24 Jan 2022 17:35:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B202C097FBC; Mon, 24 Jan 2022 12:58:17 -0800 (PST) Received: from smtp.kernel.org (relay.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 D045C60B28; Mon, 24 Jan 2022 20:58:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9BB9C36AF6; Mon, 24 Jan 2022 20:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057896; bh=BykGNsLEgQJQdE8IpuoLOMELyB8uGOFV2k4xkifpK4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oaiQMlzJPJ4uPthPFn1e6EoMFgTCquhYnI8kw6Ir6KQICb8aW+XKyckGEXT9N6ukl hdbt1KBW7zYIdLEnCKm/fQW3xSJfjPdLHP5QRFhozJsJDcSJLpSadMnf5ZzWVo4CY3 ScgqUhysRSPa4znBjtN3DJ83bWUyMIm7uiMtpA94= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0113/1039] wcn36xx: Put DXE block into reset before freeing memory Date: Mon, 24 Jan 2022 19:31:42 +0100 Message-Id: <20220124184128.929460481@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit ed04ea76e69e7194f7489cebe23a32a68f39218d ] When deiniting the DXE hardware we should reset the block to ensure there is no spurious DMA write transaction from the downstream WCNSS to upstream MSM at a skbuff address we will have released. Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680= hardware") Signed-off-by: Bryan O'Donoghue Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211105122152.1580542-4-bryan.odonoghue@li= naro.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/wcn36xx/dxe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/= ath/wcn36xx/dxe.c index 017c7d78072ba..e1a35c2eadb6c 100644 --- a/drivers/net/wireless/ath/wcn36xx/dxe.c +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c @@ -997,6 +997,8 @@ out_err_txh_ch: =20 void wcn36xx_dxe_deinit(struct wcn36xx *wcn) { + int reg_data =3D 0; + /* Disable channel interrupts */ wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); @@ -1012,6 +1014,10 @@ void wcn36xx_dxe_deinit(struct wcn36xx *wcn) wcn->tx_ack_skb =3D NULL; } =20 + /* Put the DXE block into reset before freeing memory */ + reg_data =3D WCN36XX_DXE_REG_RESET; + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_REG_CSR_RESET, reg_data); + wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_l_ch); wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_h_ch); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86CA2C3525A for ; Mon, 24 Jan 2022 21:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452417AbiAXVZd (ORCPT ); Mon, 24 Jan 2022 16:25:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51218 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359437AbiAXU6V (ORCPT ); Mon, 24 Jan 2022 15:58:21 -0500 Received: from smtp.kernel.org (relay.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 DB3D860B28; Mon, 24 Jan 2022 20:58:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A512AC340E5; Mon, 24 Jan 2022 20:58:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057899; bh=KNx+81XLGMGGQOWm3ipy3nUWBHABpFfh8FamoSzrYhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Er3iSV1Nya/0t4UynVzACFwr5pbYaqS2SdC7H/QYlL22eQxnvKVDbCa8rhVeAlSMG 8ft5BRas7I4XjlkcMkxUKV1FMxgRGdJq0b94OwFDkWxiZ6lcHH5RY4wxtRpTVYVTT+ u01pyyMdRvwIRaS/PoIHJ955FCyu3WAOubq6pHNM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Li , Loic Poulain , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0114/1039] wcn36xx: populate band before determining rate on RX Date: Mon, 24 Jan 2022 19:31:43 +0100 Message-Id: <20220124184128.961150656@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Li [ Upstream commit c9c5608fafe4dae975c9644c7d14c51ad3b0ed73 ] status.band is used in determination of status.rate -- for 5GHz on legacy rates there is a linear shift between the BD descriptor's rate field and the wcn36xx driver's rate table (wcn_5ghz_rates). We have a special clause to populate status.band for hardware scan offload frames. However, this block occurs after status.rate is already populated. Correctly handle this dependency by moving the band block before the rate block. This patch addresses kernel warnings & missing scan results for 5GHz APs that send their beacons/probe responses at the higher four legacy rates (24-54 Mbps), when using hardware scan offload: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at net/mac80211/rx.c:4532 ieee80211_rx_napi+0x744/= 0x8d8 Modules linked in: wcn36xx [...] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.19.107-g73909= fa #1 Hardware name: Square, Inc. T2 (all variants) (DT) Call trace: dump_backtrace+0x0/0x148 show_stack+0x14/0x1c dump_stack+0xb8/0xf0 __warn+0x2ac/0x2d8 warn_slowpath_null+0x44/0x54 ieee80211_rx_napi+0x744/0x8d8 ieee80211_tasklet_handler+0xa4/0xe0 tasklet_action_common+0xe0/0x118 tasklet_action+0x20/0x28 __do_softirq+0x108/0x1ec irq_exit+0xd4/0xd8 __handle_domain_irq+0x84/0xbc gic_handle_irq+0x4c/0xb8 el1_irq+0xe8/0x190 lpm_cpuidle_enter+0x220/0x260 cpuidle_enter_state+0x114/0x1c0 cpuidle_enter+0x34/0x48 do_idle+0x150/0x268 cpu_startup_entry+0x20/0x24 rest_init+0xd4/0xe0 start_kernel+0x398/0x430 ---[ end trace ae28cb759352b403 ]--- Fixes: 8a27ca394782 ("wcn36xx: Correct band/freq reporting on RX") Signed-off-by: Benjamin Li Tested-by: Loic Poulain Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211104010548.1107405-2-benl@squareup.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/wcn36xx/txrx.c | 37 +++++++++++++------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless= /ath/wcn36xx/txrx.c index 75951ccbc840e..f0a9f069a92a9 100644 --- a/drivers/net/wireless/ath/wcn36xx/txrx.c +++ b/drivers/net/wireless/ath/wcn36xx/txrx.c @@ -314,8 +314,6 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff = *skb) fc =3D __le16_to_cpu(hdr->frame_control); sn =3D IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl)); =20 - status.freq =3D WCN36XX_CENTER_FREQ(wcn); - status.band =3D WCN36XX_BAND(wcn); status.mactime =3D 10; status.signal =3D -get_rssi0(bd); status.antenna =3D 1; @@ -327,6 +325,25 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff= *skb) =20 wcn36xx_dbg(WCN36XX_DBG_RX, "status.flags=3D%x\n", status.flag); =20 + if (bd->scan_learn) { + /* If packet originate from hardware scanning, extract the + * band/channel from bd descriptor. + */ + u8 hwch =3D (bd->reserved0 << 4) + bd->rx_ch; + + if (bd->rf_band !=3D 1 && hwch <=3D sizeof(ab_rx_ch_map) && hwch >=3D 1)= { + status.band =3D NL80211_BAND_5GHZ; + status.freq =3D ieee80211_channel_to_frequency(ab_rx_ch_map[hwch - 1], + status.band); + } else { + status.band =3D NL80211_BAND_2GHZ; + status.freq =3D ieee80211_channel_to_frequency(hwch, status.band); + } + } else { + status.band =3D WCN36XX_BAND(wcn); + status.freq =3D WCN36XX_CENTER_FREQ(wcn); + } + if (bd->rate_id < ARRAY_SIZE(wcn36xx_rate_table)) { rate =3D &wcn36xx_rate_table[bd->rate_id]; status.encoding =3D rate->encoding; @@ -353,22 +370,6 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff= *skb) ieee80211_is_probe_resp(hdr->frame_control)) status.boottime_ns =3D ktime_get_boottime_ns(); =20 - if (bd->scan_learn) { - /* If packet originates from hardware scanning, extract the - * band/channel from bd descriptor. - */ - u8 hwch =3D (bd->reserved0 << 4) + bd->rx_ch; - - if (bd->rf_band !=3D 1 && hwch <=3D sizeof(ab_rx_ch_map) && hwch >=3D 1)= { - status.band =3D NL80211_BAND_5GHZ; - status.freq =3D ieee80211_channel_to_frequency(ab_rx_ch_map[hwch - 1], - status.band); - } else { - status.band =3D NL80211_BAND_2GHZ; - status.freq =3D ieee80211_channel_to_frequency(hwch, status.band); - } - } - memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); =20 if (ieee80211_is_beacon(hdr->frame_control)) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FFB2C433FE for ; Mon, 24 Jan 2022 21:36:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1454936AbiAXVeI (ORCPT ); Mon, 24 Jan 2022 16:34:08 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51358 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344693AbiAXU6X (ORCPT ); Mon, 24 Jan 2022 15:58:23 -0500 Received: from smtp.kernel.org (relay.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 EE1B66148B; Mon, 24 Jan 2022 20:58:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC6ABC340E8; Mon, 24 Jan 2022 20:58:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057902; bh=yoRT3qfphQJgL7iYKNchLDHmu3yMtDJ7MmX9qJOVqRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y5DeWmrJPMwYZGi9+Kv8HN/GqVGWc7yMtyY8rZjN6p3K+iVuDxn6AaEMuOuVWKmv0 YXDf54g7b28hoMnbeP3+qSE6EGkcHsySnepDMkaOLMclfZ3vgUFnkCwIdM2mM/E2pH x4+r6WCgYalX/ISxDtsG0zzTiC4ftEFoJNl0KweA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Li , Loic Poulain , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0115/1039] wcn36xx: fix RX BD rate mapping for 5GHz legacy rates Date: Mon, 24 Jan 2022 19:31:44 +0100 Message-Id: <20220124184128.992544933@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Li [ Upstream commit cfdf6b19e750f7de8ae71a26932f63b52e3bf74c ] The linear mapping between the BD rate field and the driver's 5GHz legacy rates table (wcn_5ghz_rates) does not only apply for the latter four rates -- it applies to all eight rates. Fixes: 6ea131acea98 ("wcn36xx: Fix warning due to bad rate_idx") Signed-off-by: Benjamin Li Tested-by: Loic Poulain Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211104010548.1107405-3-benl@squareup.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/wcn36xx/txrx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless= /ath/wcn36xx/txrx.c index f0a9f069a92a9..dd58dde8c8363 100644 --- a/drivers/net/wireless/ath/wcn36xx/txrx.c +++ b/drivers/net/wireless/ath/wcn36xx/txrx.c @@ -272,7 +272,6 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff = *skb) const struct wcn36xx_rate *rate; struct ieee80211_hdr *hdr; struct wcn36xx_rx_bd *bd; - struct ieee80211_supported_band *sband; u16 fc, sn; =20 /* @@ -350,12 +349,11 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buf= f *skb) status.enc_flags =3D rate->encoding_flags; status.bw =3D rate->bw; status.rate_idx =3D rate->mcs_or_legacy_index; - sband =3D wcn->hw->wiphy->bands[status.band]; status.nss =3D 1; =20 if (status.band =3D=3D NL80211_BAND_5GHZ && status.encoding =3D=3D RX_ENC_LEGACY && - status.rate_idx >=3D sband->n_bitrates) { + status.rate_idx >=3D 4) { /* no dsss rates in 5Ghz rates table */ status.rate_idx -=3D 4; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1990BC433EF for ; Mon, 24 Jan 2022 21:34:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1453306AbiAXV3v (ORCPT ); Mon, 24 Jan 2022 16:29:51 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51470 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359090AbiAXU62 (ORCPT ); Mon, 24 Jan 2022 15:58:28 -0500 Received: from smtp.kernel.org (relay.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 0E9EB6136A; Mon, 24 Jan 2022 20:58:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D74BBC33E2A; Mon, 24 Jan 2022 20:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057905; bh=V1/GE+ipgnFiumzM9fD21tp0S16TTWKVT62r/khFqjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h3MjMcwNJYV3DqL88egH9NRNPd72dA0x25vqC5oHdPStijHsBQW5V7t5LaEbPtWPR WhbuyA9hkLHpeh7ULVw/qRwb33XfreEt2q7ovQOUdcC8b/EBV/uoTuc7/ALWB3iLSL pUAOmKggt/xfvGcrdmfWaJajeMg/1FS/F5VtlNOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sathishkumar Muruganandam , Rameshkumar Sundaram , Jouni Malinen , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0116/1039] ath11k: Send PPDU_STATS_CFG with proper pdev mask to firmware Date: Mon, 24 Jan 2022 19:31:45 +0100 Message-Id: <20220124184129.040711646@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rameshkumar Sundaram [ Upstream commit 16a2c3d5406f95ef6139de52669c60a39443f5f7 ] HTT_PPDU_STATS_CFG_PDEV_ID bit mask for target FW PPDU stats request message was set as bit 8 to 15. Bit 8 is reserved for soc stats and pdev id starts = from bit 9. Hence change the bitmask as bit 9 to 15 and fill the proper pdev id = in the request message. In commit 701e48a43e15 ("ath11k: add packet log support for QCA6390"), both HTT_PPDU_STATS_CFG_PDEV_ID and pdev_mask were changed, but this pdev_mask calculation is not valid for platforms which has multiple pdevs with 1 rxdma per pdev, as this is writing same value(i.e. 2) for all pdevs. Hence fixed= it to consider pdev_idx as well, to make it compatible for both single and mul= ti pd cases. Tested on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01092-QCAHKSWPL_SILICONZ-1 Tested on: IPQ6018 hw1.0 WLAN.HK.2.5.0.1-01067-QCAHKSWPL_SILICONZ-1 Fixes: 701e48a43e15 ("ath11k: add packet log support for QCA6390") Co-developed-by: Sathishkumar Muruganandam Signed-off-by: Sathishkumar Muruganandam Signed-off-by: Rameshkumar Sundaram Signed-off-by: Jouni Malinen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20210721212029.142388-10-jouni@codeaurora.o= rg Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/dp.h | 3 ++- drivers/net/wireless/ath/ath11k/dp_tx.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp.h b/drivers/net/wireless/at= h/ath11k/dp.h index 4794ca04f2136..f524d19aca349 100644 --- a/drivers/net/wireless/ath/ath11k/dp.h +++ b/drivers/net/wireless/ath/ath11k/dp.h @@ -517,7 +517,8 @@ struct htt_ppdu_stats_cfg_cmd { } __packed; =20 #define HTT_PPDU_STATS_CFG_MSG_TYPE GENMASK(7, 0) -#define HTT_PPDU_STATS_CFG_PDEV_ID GENMASK(15, 8) +#define HTT_PPDU_STATS_CFG_SOC_STATS BIT(8) +#define HTT_PPDU_STATS_CFG_PDEV_ID GENMASK(15, 9) #define HTT_PPDU_STATS_CFG_TLV_TYPE_BITMASK GENMASK(31, 16) =20 enum htt_ppdu_stats_tag_type { diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index 879fb2a9dc0c6..10b76f6f710b0 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -903,7 +903,7 @@ int ath11k_dp_tx_htt_h2t_ppdu_stats_req(struct ath11k *= ar, u32 mask) cmd->msg =3D FIELD_PREP(HTT_PPDU_STATS_CFG_MSG_TYPE, HTT_H2T_MSG_TYPE_PPDU_STATS_CFG); =20 - pdev_mask =3D 1 << (i + 1); + pdev_mask =3D 1 << (ar->pdev_idx + i); cmd->msg |=3D FIELD_PREP(HTT_PPDU_STATS_CFG_PDEV_ID, pdev_mask); cmd->msg |=3D FIELD_PREP(HTT_PPDU_STATS_CFG_TLV_TYPE_BITMASK, mask); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8DCCC433FE for ; Mon, 24 Jan 2022 21:34:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1453469AbiAXVaN (ORCPT ); Mon, 24 Jan 2022 16:30:13 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52026 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441813AbiAXU6g (ORCPT ); Mon, 24 Jan 2022 15:58:36 -0500 Received: from smtp.kernel.org (relay.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 96842B815A5; Mon, 24 Jan 2022 20:58:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B19B2C33E20; Mon, 24 Jan 2022 20:58:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057908; bh=N+i2Ktt5HSL7SoYdHLmIVc6uikYJLYEZ1wvPI4WY1uA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LTxNAC/fEcNO5+tEPnkGRkjYC747g+1/bvQrjbQfiPEcaA5apksh2lt0+xhTvOAaJ VsuC7m3mKCdbv1R8MqmArApmbzXSmynq+164suNBpC7bSRWIt7naXX1lwtkykfJrmF y+69gcuzLk+DtMbYmPwoYQPVKgQSdm83l74mIPdM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Monnet , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.16 0117/1039] bpftool: Fix memory leak in prog_dump() Date: Mon, 24 Jan 2022 19:31:46 +0100 Message-Id: <20220124184129.076854913@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quentin Monnet [ Upstream commit ebbd7f64a3fbe9e0f235e39fc244ee9735e2a52a ] Following the extraction of prog_dump() from do_dump(), the struct btf allocated in prog_dump() is no longer freed on error; the struct bpf_prog_linfo is not freed at all. Make sure we release them before exiting the function. Fixes: ec2025095cf6 ("bpftool: Match several programs with same tag") Signed-off-by: Quentin Monnet Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20211110114632.24537-2-quentin@isovalent.= com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/bpf/bpftool/prog.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c index 515d229526026..6ccd17b8eb560 100644 --- a/tools/bpf/bpftool/prog.c +++ b/tools/bpf/bpftool/prog.c @@ -639,8 +639,8 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mo= de, char func_sig[1024]; unsigned char *buf; __u32 member_len; + int fd, err =3D -1; ssize_t n; - int fd; =20 if (mode =3D=3D DUMP_JITED) { if (info->jited_prog_len =3D=3D 0 || !info->jited_prog_insns) { @@ -679,7 +679,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mo= de, if (fd < 0) { p_err("can't open file %s: %s", filepath, strerror(errno)); - return -1; + goto exit_free; } =20 n =3D write(fd, buf, member_len); @@ -687,7 +687,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mo= de, if (n !=3D (ssize_t)member_len) { p_err("error writing output file: %s", n < 0 ? strerror(errno) : "short write"); - return -1; + goto exit_free; } =20 if (json_output) @@ -701,7 +701,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mo= de, info->netns_ino, &disasm_opt); if (!name) - return -1; + goto exit_free; } =20 if (info->nr_jited_func_lens && info->jited_func_lens) { @@ -796,9 +796,12 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode m= ode, kernel_syms_destroy(&dd); } =20 - btf__free(btf); + err =3D 0; =20 - return 0; +exit_free: + btf__free(btf); + bpf_prog_linfo__free(prog_linfo); + return err; } =20 static int do_dump(int argc, char **argv) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FE6AC433F5 for ; Mon, 24 Jan 2022 21:28:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343492AbiAXVYh (ORCPT ); Mon, 24 Jan 2022 16:24:37 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52044 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443683AbiAXU6f (ORCPT ); Mon, 24 Jan 2022 15:58:35 -0500 Received: from smtp.kernel.org (relay.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 AC9D7B812A7; Mon, 24 Jan 2022 20:58:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF58FC340E5; Mon, 24 Jan 2022 20:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057911; bh=UhT0JaI55mgQA7ptyJJ/KmDglLAZ1One7Pak05Uef7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q3Gaa+XJGqXrLntATQXF0kvSFAsT9tg6LuC6aWEf3YeLFqQZF/HasKWmMUWIj7Wqz dEZ1PlzdbATyFWzVYro3UQvXLQUMwtcKZSW/ScbMHeqx0qOhXEfVswwvOmn7p7Jgd4 pya/ylo8teOv+iQh12u3Ofgek/wbP/NG7l3/z3y8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lad Prabhakar , Vignesh Raghavendra , Biju Das , Wolfram Sang , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.16 0118/1039] mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init() Date: Mon, 24 Jan 2022 19:31:47 +0100 Message-Id: <20220124184129.107940134@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 981387ed06b96908223a607f5fba6efa42728fc2 ] rpcif_sw_init() can fail so make sure we check the return value of it and on error exit rpcif_hb_probe() callback with error code. Fixes: 5de15b610f78 ("mtd: hyperbus: add Renesas RPC-IF driver") Signed-off-by: Lad Prabhakar Signed-off-by: Vignesh Raghavendra Reviewed-by: Biju Das Reviewed-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20211025205631.21151-5-prabhakar.mahadev-la= d.rj@bp.renesas.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/hyperbus/rpc-if.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c index ecb050ba95cdf..367b0d72bf622 100644 --- a/drivers/mtd/hyperbus/rpc-if.c +++ b/drivers/mtd/hyperbus/rpc-if.c @@ -124,7 +124,9 @@ static int rpcif_hb_probe(struct platform_device *pdev) if (!hyperbus) return -ENOMEM; =20 - rpcif_sw_init(&hyperbus->rpc, pdev->dev.parent); + error =3D rpcif_sw_init(&hyperbus->rpc, pdev->dev.parent); + if (error) + return error; =20 platform_set_drvdata(pdev, hyperbus); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAEC0C4332F for ; Mon, 24 Jan 2022 23:34:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851031AbiAXXbo (ORCPT ); Mon, 24 Jan 2022 18:31:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836485AbiAXWjg (ORCPT ); Mon, 24 Jan 2022 17:39:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3205BC05486F; Mon, 24 Jan 2022 13:00:43 -0800 (PST) Received: from smtp.kernel.org (relay.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 C8138612E9; Mon, 24 Jan 2022 21:00:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF9ECC340E5; Mon, 24 Jan 2022 21:00:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058042; bh=Aj5TDU2BYJhH8yJcxyj4GLS7YGita8rMfJSmLM8MX+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a0j9ynsquILairebgHqUs9d3a1aMfXCnnOOFeVNwWeVctHOjhJKe0jSA62qJs9m6l VpBpHU5vjEqy8vt3sJaP8FpzDZZsbksMUwsOiLM6cWCtJ28njI5DvKRNUURCiIzpZq dD7GM3RmmWMq38vJSGfhxVKHGknewyX5JeyiwH54= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dillon Min , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0119/1039] media: videobuf2: Fix the size printk format Date: Mon, 24 Jan 2022 19:31:48 +0100 Message-Id: <20220124184129.138927856@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dillon Min [ Upstream commit c9ee220d76775e42f35d634479c978d9350077d3 ] Since the type of parameter size is unsigned long, it should printk by %lu, instead of %ld, fix it. Fixes: 7952be9b6ece ("media: drivers/media/common/videobuf2: rename from vi= deobuf") Signed-off-by: Dillon Min Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/common/videobuf2/videobuf2-dma-contig.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/driver= s/media/common/videobuf2/videobuf2-dma-contig.c index 556e42ba66e55..7c4096e621738 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c @@ -257,7 +257,7 @@ static void *vb2_dc_alloc(struct vb2_buffer *vb, ret =3D vb2_dc_alloc_coherent(buf); =20 if (ret) { - dev_err(dev, "dma alloc of size %ld failed\n", size); + dev_err(dev, "dma alloc of size %lu failed\n", size); kfree(buf); return ERR_PTR(-ENOMEM); } @@ -298,9 +298,9 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_s= truct *vma) =20 vma->vm_ops->open(vma); =20 - pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n", - __func__, (unsigned long)buf->dma_addr, vma->vm_start, - buf->size); + pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %lu\n", + __func__, (unsigned long)buf->dma_addr, vma->vm_start, + buf->size); =20 return 0; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AECDC433F5 for ; Mon, 24 Jan 2022 21:27:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452298AbiAXVYb (ORCPT ); Mon, 24 Jan 2022 16:24:31 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:52116 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443746AbiAXU65 (ORCPT ); Mon, 24 Jan 2022 15:58:57 -0500 Received: from smtp.kernel.org (relay.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 27A2A61414; Mon, 24 Jan 2022 20:58:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1729C340E5; Mon, 24 Jan 2022 20:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057935; bh=eJP1hCWniN1ltL1kT6b/7fbt3ENomNOTOg9u1vjqjEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TUs4qm5YOcvTsDQ6WdRO33cxZ82WIptEMt3LQ0/MLKj/GJOFlE29XZOXw38s27P7A RlqE+hasyKXcEK5Hjfc1vjxzHHcU3L2Sw/szAOErvh0qYddZfoCr4FynrAb35JI0f2 jU8atx7dfde6E1MDoyFbecnKBwgp2JInFqwEIP0U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Daniel Scally , Kieran Bingham , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0120/1039] media: ipu3-cio2: fix error code in cio2_bridge_connect_sensor() Date: Mon, 24 Jan 2022 19:31:49 +0100 Message-Id: <20220124184129.172023559@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 85db29d22cc521d9d06de2f5c7832981a55df157 ] Return -ENODEV if acpi_get_physical_device_location() fails. Don't return success. Fixes: 485aa3df0dff ("media: ipu3-cio2: Parse sensor orientation and rotati= on") Signed-off-by: Dan Carpenter Reviewed-by: Daniel Scally Reviewed-by: Kieran Bingham Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/pci/intel/ipu3/cio2-bridge.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/intel/ipu3/cio2-bridge.c b/drivers/media/pci= /intel/ipu3/cio2-bridge.c index 67c467d3c81f9..0b586b4e537ef 100644 --- a/drivers/media/pci/intel/ipu3/cio2-bridge.c +++ b/drivers/media/pci/intel/ipu3/cio2-bridge.c @@ -238,8 +238,10 @@ static int cio2_bridge_connect_sensor(const struct cio= 2_sensor_config *cfg, goto err_put_adev; =20 status =3D acpi_get_physical_device_location(adev->handle, &sensor->pld); - if (ACPI_FAILURE(status)) + if (ACPI_FAILURE(status)) { + ret =3D -ENODEV; goto err_put_adev; + } =20 if (sensor->ssdb.lanes > CIO2_MAX_LANES) { dev_err(&adev->dev, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1020C433F5 for ; Mon, 24 Jan 2022 21:36:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352333AbiAXVds (ORCPT ); Mon, 24 Jan 2022 16:33:48 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54492 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443904AbiAXU7h (ORCPT ); Mon, 24 Jan 2022 15:59:37 -0500 Received: from smtp.kernel.org (relay.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 6126EB8121C; Mon, 24 Jan 2022 20:59:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8214FC340E5; Mon, 24 Jan 2022 20:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057969; bh=WrCqZQRVcjEqYKrOwStT6HL75yR/zqNeI3M2IfBMBcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pYaS9rcwV8D3MSNY8ueFrt07jr54a2JozT6k8ZacJXfkm00N8x3EOusDjIvEMMY7k 6WItLLCAD0+lXqPpqAFooG7XKIUSLYt40kdwg4Q7CwBKka4kXTrTPcVBs9YPsZglGd bv0zo+oEhc8TiE5FdLanLgoUwB7hWC5kODtf/Pec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tsuchiya Yuto , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0121/1039] media: atomisp: add missing media_device_cleanup() in atomisp_unregister_entities() Date: Mon, 24 Jan 2022 19:31:50 +0100 Message-Id: <20220124184129.203107110@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tsuchiya Yuto [ Upstream commit ce3015b7212e96db426d0c36f80fd159c91155d1 ] After the commit 9832e155f1ed ("[media] media-device: split media initialization and registration"), calling media_device_cleanup() is needed it seems. However, currently it is missing for the module unload path. Note that for the probe failure path, it is already added in atomisp_register_entities(). This patch adds the missing call of media_device_cleanup() in atomisp_unregister_entities(). Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2") Signed-off-by: Tsuchiya Yuto Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/sta= ging/media/atomisp/pci/atomisp_v4l2.c index 1e324f1f656e5..0511c454e769d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -1182,6 +1182,7 @@ static void atomisp_unregister_entities(struct atomis= p_device *isp) =20 v4l2_device_unregister(&isp->v4l2_dev); media_device_unregister(&isp->media_dev); + media_device_cleanup(&isp->media_dev); } =20 static int atomisp_register_entities(struct atomisp_device *isp) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAB21C433F5 for ; Mon, 24 Jan 2022 23:28:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849783AbiAXX0h (ORCPT ); Mon, 24 Jan 2022 18:26:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835946AbiAXWhu (ORCPT ); Mon, 24 Jan 2022 17:37:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 968ECC0E9BB5; Mon, 24 Jan 2022 13:00:03 -0800 (PST) Received: from smtp.kernel.org (relay.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 34F7360916; Mon, 24 Jan 2022 21:00:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 080EFC340E5; Mon, 24 Jan 2022 21:00:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058002; bh=qWbXenzRRa+AVmkAUbR1x2EAU0jv0G6Wwnjuj0RyNZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZYLSSztxDime/5P0sJkTujRg7aqg6W/Q/rOBTgTZsdLr2EOn497AkVIqgKjyj63NR WWTh3LjD54kYGUXV5jHtyIz5LVRNpwhKi0QgikfOA6bI2fZlKJKwK5fURJm+lOED9L E2p+1vsYEiU4PWO0X40Cm6aSB1ew29UlekiMUuQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tsuchiya Yuto , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0122/1039] media: atomisp: fix punit_ddr_dvfs_enable() argument for mrfld_power up case Date: Mon, 24 Jan 2022 19:31:51 +0100 Message-Id: <20220124184129.240398177@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tsuchiya Yuto [ Upstream commit 5bfbf65fcca7325e4d89d289b3c286e11220e386 ] When comparing with intel-aero atomisp [1], it looks like punit_ddr_dvfs_enable() should take `false` as an argument on mrfld_power up case. Code from the intel-aero kernel [1]: int atomisp_mrfld_power_down(struct atomisp_device *isp) { [...] /*WA:Enable DVFS*/ if (IS_CHT) punit_ddr_dvfs_enable(true); int atomisp_mrfld_power_up(struct atomisp_device *isp) { [...] /*WA for PUNIT, if DVFS enabled, ISP timeout observed*/ if (IS_CHT) punit_ddr_dvfs_enable(false); This patch fixes the inverted argument as per the intel-aero code, as well as its comment. While here, fix space issues for comments in atomisp_mrfld_power(). Note that it does not seem to be possible to unify the up/down cases for punit_ddr_dvfs_enable(), i.e., we can't do something like the following: if (IS_CHT) punit_ddr_dvfs_enable(!enable); because according to the intel-aero code [1], the DVFS is disabled before "writing 0x0 to ISPSSPM0 bit[1:0]" and the DVFS is enabled after "writing 0x3 to ISPSSPM0 bit[1:0]". [1] https://github.com/intel-aero/linux-kernel/blob/a1b673258feb91526837727= 5130c5c5df0eafc82/drivers/media/pci/atomisp/atomisp_driver/atomisp_v4l2.c#L= 431-L514 Fixes: 0f441fd70b1e ("media: atomisp: simplify the power down/up code") Signed-off-by: Tsuchiya Yuto Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/sta= ging/media/atomisp/pci/atomisp_v4l2.c index 0511c454e769d..7982cc143374a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -711,15 +711,15 @@ static int atomisp_mrfld_power(struct atomisp_device = *isp, bool enable) =20 dev_dbg(isp->dev, "IUNIT power-%s.\n", enable ? "on" : "off"); =20 - /*WA:Enable DVFS*/ + /* WA for P-Unit, if DVFS enabled, ISP timeout observed */ if (IS_CHT && enable) - punit_ddr_dvfs_enable(true); + punit_ddr_dvfs_enable(false); =20 /* * FIXME:WA for ECS28A, with this sleep, CTS * android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceAbort * PASS, no impact on other platforms - */ + */ if (IS_BYT && enable) msleep(10); =20 @@ -727,7 +727,7 @@ static int atomisp_mrfld_power(struct atomisp_device *i= sp, bool enable) iosf_mbi_modify(BT_MBI_UNIT_PMC, MBI_REG_READ, MRFLD_ISPSSPM0, val, MRFLD_ISPSSPM0_ISPSSC_MASK); =20 - /*WA:Enable DVFS*/ + /* WA:Enable DVFS */ if (IS_CHT && !enable) punit_ddr_dvfs_enable(true); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09304C433EF for ; Mon, 24 Jan 2022 21:37:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455698AbiAXVfx (ORCPT ); Mon, 24 Jan 2022 16:35:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54954 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444229AbiAXVA2 (ORCPT ); Mon, 24 Jan 2022 16:00:28 -0500 Received: from smtp.kernel.org (relay.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 667C0B810A8; Mon, 24 Jan 2022 21:00:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A940C340E5; Mon, 24 Jan 2022 21:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058024; bh=RVQdDPDKOE/a1ZN4sGWxqjsyDozLHpHpTA/eJ4N7kSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RVZ0cIeS8Bc0ZTqWGAOEOu0rEb9TnJMfrgQMlwioLrLnCj0W4zGFYwbSDws6iftI4 9tkkpJFF6T8TkqXDsxmWctxeQANSp9vgw/FcKgVWVcrAxL+wr0Ze4uJzbF/zPzxL0Y iGctFNPefA6/e0rwSa3N2ad6iJQOjhQ+68S//ZYQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tsuchiya Yuto , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0123/1039] media: atomisp: fix inverted logic in buffers_needed() Date: Mon, 24 Jan 2022 19:31:52 +0100 Message-Id: <20220124184129.280692917@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tsuchiya Yuto [ Upstream commit e1921cd14640f0f4d1fad5eb8e448c58a536415d ] When config.mode is IA_CSS_INPUT_MODE_BUFFERED_SENSOR, it rather needs buffers. Fix it by inverting the return value. Fixes: 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 ve= rsion") Signed-off-by: Tsuchiya Yuto Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/atomisp/pci/sh_css_mipi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/stag= ing/media/atomisp/pci/sh_css_mipi.c index 75489f7d75eec..483d40a467c74 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -374,17 +374,17 @@ static bool buffers_needed(struct ia_css_pipe *pipe) { if (!IS_ISP2401) { if (pipe->stream->config.mode =3D=3D IA_CSS_INPUT_MODE_BUFFERED_SENSOR) - return false; - else return true; + else + return false; } =20 if (pipe->stream->config.mode =3D=3D IA_CSS_INPUT_MODE_BUFFERED_SENSOR || pipe->stream->config.mode =3D=3D IA_CSS_INPUT_MODE_TPG || pipe->stream->config.mode =3D=3D IA_CSS_INPUT_MODE_PRBS) - return false; + return true; =20 - return true; + return false; } =20 int --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CA16C433FE for ; Mon, 24 Jan 2022 23:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849677AbiAXX00 (ORCPT ); Mon, 24 Jan 2022 18:26:26 -0500 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 S1835949AbiAXWhu (ORCPT ); Mon, 24 Jan 2022 17:37:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16EF2C0E9BB8; Mon, 24 Jan 2022 13:00:28 -0800 (PST) Received: from smtp.kernel.org (relay.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 AAC5861320; Mon, 24 Jan 2022 21:00:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AAABC340E5; Mon, 24 Jan 2022 21:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058027; bh=5CefI8kLlzwKiG7jZGtST77aCSVR1qeHJlatpgTEvLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mguJWQtVLjqWfMZ0C3r+TLCcSe7RHMUbwljXjjQGcbcPUSrRjuah+hCa6rrpCeqBP pO59L/3p/sLQCPYH9WoWqN0dlOOZGteRFrcLrYaSh0Sy3i7pH75gYKHA+VvFOMIMTQ nnyepxo9RP3o2Umx9n6zDU/ccs0AEFKNEDF87NDk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tsuchiya Yuto , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0124/1039] media: atomisp: do not use err var when checking port validity for ISP2400 Date: Mon, 24 Jan 2022 19:31:53 +0100 Message-Id: <20220124184129.313744301@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tsuchiya Yuto [ Upstream commit 9f6b4fa2d2dfbff4b8a57eeb39b1128a6094ee20 ] Currently, the `port >=3D N_CSI_PORTS || err` checks for ISP2400 are always evaluated as true because the err variable is set to `-EINVAL` on declaration but the variable is never used until the evaluation. Looking at the diff of commit 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version"), the `port >=3D N_CSI_PORTS` check is for ISP2400 and the err variable check is for ISP2401. Fix this issue by adding ISP version test there accordingly. Fixes: 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 ve= rsion") Signed-off-by: Tsuchiya Yuto Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/atomisp/pci/sh_css_mipi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/stag= ing/media/atomisp/pci/sh_css_mipi.c index 483d40a467c74..65fc93c5d56bc 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -430,7 +430,8 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, =20 assert(port < N_CSI_PORTS); =20 - if (port >=3D N_CSI_PORTS || err) { + if ((!IS_ISP2401 && port >=3D N_CSI_PORTS) || + (IS_ISP2401 && err)) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "allocate_mipi_frames(%p) exit: error: port is not correct (port= =3D%d).\n", pipe, port); @@ -559,7 +560,8 @@ free_mipi_frames(struct ia_css_pipe *pipe) =20 assert(port < N_CSI_PORTS); =20 - if (port >=3D N_CSI_PORTS || err) { + if ((!IS_ISP2401 && port >=3D N_CSI_PORTS) || + (IS_ISP2401 && err)) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "free_mipi_frames(%p, %d) exit: error: pipe port is not correct.\= n", pipe, port); @@ -670,7 +672,8 @@ send_mipi_frames(struct ia_css_pipe *pipe) =20 assert(port < N_CSI_PORTS); =20 - if (port >=3D N_CSI_PORTS || err) { + if ((!IS_ISP2401 && port >=3D N_CSI_PORTS) || + (IS_ISP2401 && err)) { IA_CSS_ERROR("send_mipi_frames(%p) exit: invalid port specified (port=3D= %d).\n", pipe, port); return err; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 321C7C4321E for ; Mon, 24 Jan 2022 21:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452713AbiAXV0Q (ORCPT ); Mon, 24 Jan 2022 16:26:16 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51470 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444251AbiAXVAb (ORCPT ); Mon, 24 Jan 2022 16:00:31 -0500 Received: from smtp.kernel.org (relay.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 A09AB61320; Mon, 24 Jan 2022 21:00:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 820B1C340E5; Mon, 24 Jan 2022 21:00:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058030; bh=fH45R+ON9VtofQLm2ZUtUvYmVRrVZ/+s/iF2FwrMnWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aM0r7OA3fNQxv+OS44+WIQSfqyRgk7S0h9kqfVFDgGhWnj4GWwGjJPF/Shco50pjF cIsf4jPLwQ12gm2Uff/l6rBmkG6XsH7zmJVQzJTZn11/rT0q0BGME2D1PsoBRTZN22 RPFPRXDKPsr9dACznJiY3t+I8PQFK5eARywtwM1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tsuchiya Yuto , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0125/1039] media: atomisp: fix inverted error check for ia_css_mipi_is_source_port_valid() Date: Mon, 24 Jan 2022 19:31:54 +0100 Message-Id: <20220124184129.346371798@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tsuchiya Yuto [ Upstream commit d21ce8c2f7bf6d737b60c09f86db141b9e8e47f0 ] The function ia_css_mipi_is_source_port_valid() returns true if the port is valid. So, we can't use the existing err variable as is. To fix this issue while reusing that variable, invert the return value when assigning it to the variable. Fixes: 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 ve= rsion") Signed-off-by: Tsuchiya Yuto Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../staging/media/atomisp/pci/sh_css_mipi.c | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/stag= ing/media/atomisp/pci/sh_css_mipi.c index 65fc93c5d56bc..c1f2f6151c5f8 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -423,10 +423,12 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, return 0; /* AM TODO: Check */ } =20 - if (!IS_ISP2401) + if (!IS_ISP2401) { port =3D (unsigned int)pipe->stream->config.source.port.port; - else - err =3D ia_css_mipi_is_source_port_valid(pipe, &port); + } else { + /* Returns true if port is valid. So, invert it */ + err =3D !ia_css_mipi_is_source_port_valid(pipe, &port); + } =20 assert(port < N_CSI_PORTS); =20 @@ -553,10 +555,12 @@ free_mipi_frames(struct ia_css_pipe *pipe) return err; } =20 - if (!IS_ISP2401) + if (!IS_ISP2401) { port =3D (unsigned int)pipe->stream->config.source.port.port; - else - err =3D ia_css_mipi_is_source_port_valid(pipe, &port); + } else { + /* Returns true if port is valid. So, invert it */ + err =3D !ia_css_mipi_is_source_port_valid(pipe, &port); + } =20 assert(port < N_CSI_PORTS); =20 @@ -665,10 +669,12 @@ send_mipi_frames(struct ia_css_pipe *pipe) /* TODO: AM: maybe this should be returning an error. */ } =20 - if (!IS_ISP2401) + if (!IS_ISP2401) { port =3D (unsigned int)pipe->stream->config.source.port.port; - else - err =3D ia_css_mipi_is_source_port_valid(pipe, &port); + } else { + /* Returns true if port is valid. So, invert it */ + err =3D !ia_css_mipi_is_source_port_valid(pipe, &port); + } =20 assert(port < N_CSI_PORTS); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1319C4332F for ; Mon, 24 Jan 2022 23:34:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851223AbiAXXcL (ORCPT ); Mon, 24 Jan 2022 18:32:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836477AbiAXWjf (ORCPT ); Mon, 24 Jan 2022 17:39:35 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A59DEC05486D; Mon, 24 Jan 2022 13:00:35 -0800 (PST) Received: from smtp.kernel.org (relay.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 625F3B80CCF; Mon, 24 Jan 2022 21:00:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88197C340E5; Mon, 24 Jan 2022 21:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058033; bh=1O9RhcORyxP6y+2nbjiYaQB2E+++rbjfQVEUZMBHDzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7Dykl28uvvyf0OtNHh6QcupRERgVI3L3RiZ79lnSIT5bY7UBcQZwYIViR1Z/4Kk9 A4a2i3hGqF3Pa6+jxSoGRTrBE10YMpgsXZVqYYc7Ra6T4zhmPVMep790y5SRXq+pO5 UzATDt2/CbC2lCYYUSukkE28QMl3XL7S8Yt0f03o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tsuchiya Yuto , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0126/1039] media: atomisp: fix ifdefs in sh_css.c Date: Mon, 24 Jan 2022 19:31:55 +0100 Message-Id: <20220124184129.384288150@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tsuchiya Yuto [ Upstream commit 5a1b2725558f8a3b4cbf0504f53cffae8e163034 ] ## `if (pipe->stream->config.mode =3D=3D IA_CSS_INPUT_MODE_TPG) {` case The intel-aero atomisp has `#if defined(IS_ISP_2400_SYSTEM)` [1]. It is to be defined in the following two places [2]: - css/hive_isp_css_common/system_global.h - css/css_2401_csi2p_system/system_global.h and the former file is to be included on ISP2400 devices, too. So, it is to be defined for both ISP2400 and ISP2401 devices. Because the upstreamed atomisp driver now supports only ISP2400 and ISP2401, just remove the ISP version test again. This matches the other upstream commits like 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version"). While here, moved the comment for define GP_ISEL_TPG_MODE to the appropriate place. [1] https://github.com/intel-aero/linux-kernel/blob/a1b673258feb91526837727= 5130c5c5df0eafc82/drivers/media/pci/atomisp/css/sh_css.c#L552-L558 [2] https://github.com/intel-aero/linux-kernel/search?q=3DIS_ISP_2400_SYSTEM ## `isys_stream_descr->polling_mode` case This does not exist on the intel-aero atomisp. This is because it is based on css version irci_stable_candrpv_0415_20150521_0458. On the other hand, the upstreamed atomisp is based on the following css version depending on the ISP version using ifdefs: - ISP2400: irci_stable_candrpv_0415_20150521_0458 - ISP2401: irci_master_20150911_0724 The `isys_stream_descr->polling_mode` usage was added on updating css version to irci_master_20150701_0213 [3]. So, it is not a ISP version specific thing, but css version specific thing. Because the upstreamed atomisp driver uses irci_master_20150911_0724 for ISP2401, re-add the ISP version check for now. I say "for now" because ISP2401 should eventually use the same css version with ISP2400 (i.e., irci_stable_candrpv_0415_20150521_0458) [3] https://raw.githubusercontent.com/intel/ProductionKernelQuilts/cht-m1st= able-2016_ww31/uefi/cht-m1stable/patches/cam-0439-atomisp2-css2401-and-2401= _legacy-irci_master_2015070.patch ("atomisp2: css2401 and 2401_legacy-irci_master_20150701_0213") Link to Intel's Android kernel patch. ## `coord =3D &me->config.internal_frame_origin_bqs_on_sctbl;` case it was added on commit 4f744a573db3 ("media: atomisp: make sh_css_sp_init_pipeline() ISP version independent") for ISP2401. Because the upstreamed atomisp for the ISP2401 part is based on irci_master_20150911_0724, hence the difference. Because the upstreamed atomisp driver uses irci_master_20150911_0724 for ISP2401, revert the test back to `if (IS_ISP2401)`. Fixes: 27333dadef57 ("media: atomisp: adjust some code at sh_css that could= be broken") Signed-off-by: Tsuchiya Yuto Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/atomisp/pci/sh_css.c | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/m= edia/atomisp/pci/sh_css.c index c4b35cbab3737..ba25d0da8b811 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -522,6 +522,7 @@ ia_css_stream_input_format_bits_per_pixel(struct ia_css= _stream *stream) return bpp; } =20 +/* TODO: move define to proper file in tools */ #define GP_ISEL_TPG_MODE 0x90058 =20 #if !defined(ISP2401) @@ -573,12 +574,8 @@ sh_css_config_input_network(struct ia_css_stream *stre= am) vblank_cycles =3D vblank_lines * (width + hblank_cycles); sh_css_sp_configure_sync_gen(width, height, hblank_cycles, vblank_cycles); - if (!IS_ISP2401) { - if (pipe->stream->config.mode =3D=3D IA_CSS_INPUT_MODE_TPG) { - /* TODO: move define to proper file in tools */ - ia_css_device_store_uint32(GP_ISEL_TPG_MODE, 0); - } - } + if (pipe->stream->config.mode =3D=3D IA_CSS_INPUT_MODE_TPG) + ia_css_device_store_uint32(GP_ISEL_TPG_MODE, 0); } ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "sh_css_config_input_network() leave:\n"); @@ -1009,16 +1006,14 @@ static bool sh_css_translate_stream_cfg_to_isys_str= eam_descr( * ia_css_isys_stream_capture_indication() instead of * ia_css_pipeline_sp_wait_for_isys_stream_N() as isp processing of * capture takes longer than getting an ISYS frame - * - * Only 2401 relevant ?? */ -#if 0 // FIXME: NOT USED on Yocto Aero - isys_stream_descr->polling_mode - =3D early_polling ? INPUT_SYSTEM_POLL_ON_CAPTURE_REQUEST - : INPUT_SYSTEM_POLL_ON_WAIT_FOR_FRAME; - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, - "sh_css_translate_stream_cfg_to_isys_stream_descr() leave:\n"); -#endif + if (IS_ISP2401) { + isys_stream_descr->polling_mode + =3D early_polling ? INPUT_SYSTEM_POLL_ON_CAPTURE_REQUEST + : INPUT_SYSTEM_POLL_ON_WAIT_FOR_FRAME; + ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, + "sh_css_translate_stream_cfg_to_isys_stream_descr() leave:\n"); + } =20 return rc; } @@ -1433,7 +1428,7 @@ static void start_pipe( =20 assert(me); /* all callers are in this file and call with non null argume= nt */ =20 - if (!IS_ISP2401) { + if (IS_ISP2401) { coord =3D &me->config.internal_frame_origin_bqs_on_sctbl; params =3D me->stream->isp_params_configs; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F0B6C433EF for ; Mon, 24 Jan 2022 23:34:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851319AbiAXXcZ (ORCPT ); Mon, 24 Jan 2022 18:32:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836481AbiAXWjf (ORCPT ); Mon, 24 Jan 2022 17:39:35 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 445C3C05486E; Mon, 24 Jan 2022 13:00:37 -0800 (PST) Received: from smtp.kernel.org (relay.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 C8FC661317; Mon, 24 Jan 2022 21:00:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C4A0C340E5; Mon, 24 Jan 2022 21:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058036; bh=sSEVS1zk0Dl1JuiVm6zEkJ5WAzfZPSu9TTNRcXnze8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0rILOimZnUc2zaoyJ/bo9AAXHpONIFDaWSZuSyYUbK7wnbJFqAN9xBLbW9Q0usWJE DVLnv5MEgYdZs67fqQv0t6La/I9Di1NBbl5YTQBS1mmAYbSo9xnUvO5Wn4PEk39ASf M/ApmV440sTChWlqSFUltmAIsi4r8P7Pcgy6mz/4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tsuchiya Yuto , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0127/1039] media: atomisp: add NULL check for asd obtained from atomisp_video_pipe Date: Mon, 24 Jan 2022 19:31:56 +0100 Message-Id: <20220124184129.428402507@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tsuchiya Yuto [ Upstream commit c10bcb13462e9cf43111d17f1e08b4bb4d4401b0 ] This is almost a BUG report with RFC patch that just avoids kernel oopses. Thus, prefixed with [BUG][RFC]. Here is the kernel log after running `v4l2-compliance -d /dev/video4` with this patch applied: kern :err : [25507.580392] atomisp-isp2 0000:00:03.0: can't change powe= r state from D3cold to D0 (config space inaccessible) kern :warn : [25507.592343] isys dma store at addr(0xcd408) val(0) kern :err : [25507.592995] atomisp-isp2 0000:00:03.0: atomisp_queryctl(= ): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.593685] atomisp-isp2 0000:00:03.0: atomisp_g_input()= : asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.593719] atomisp-isp2 0000:00:03.0: atomisp_g_parm():= asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.593727] atomisp-isp2 0000:00:03.0: atomisp_queryctl(= ): asd is NULL, device is ATOMISP ISP ACC [omitting 42 same messages] kern :err : [25507.593976] atomisp-isp2 0000:00:03.0: atomisp_queryctl(= ): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594191] atomisp-isp2 0000:00:03.0: atomisp_g_input()= : asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594449] atomisp-isp2 0000:00:03.0: atomisp_queryctl(= ): asd is NULL, device is ATOMISP ISP ACC [omitting 43 same messages] kern :err : [25507.594756] atomisp-isp2 0000:00:03.0: atomisp_queryctl(= ): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594779] atomisp-isp2 0000:00:03.0: atomisp_g_ctrl():= asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594787] atomisp-isp2 0000:00:03.0: atomisp_s_ctrl():= asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594803] atomisp-isp2 0000:00:03.0: atomisp_camera_g_= ext_ctrls(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594880] atomisp-isp2 0000:00:03.0: atomisp_enum_fmt_= cap(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594915] atomisp-isp2 0000:00:03.0: atomisp_g_parm():= asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595058] atomisp-isp2 0000:00:03.0: atomisp_try_fmt()= : asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595089] atomisp-isp2 0000:00:03.0: atomisp_set_fmt()= : asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595124] atomisp-isp2 0000:00:03.0: atomisp_set_fmt()= : asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595221] atomisp-isp2 0000:00:03.0: atomisp_set_fmt()= : asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595241] atomisp-isp2 0000:00:03.0: atomisp_set_fmt()= : asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.601571] atomisp-isp2 0000:00:03.0: can't change powe= r state from D3cold to D0 (config space inaccessible) kern :warn : [25507.607496] isys dma store at addr(0xcd408) val(0) kern :err : [25507.608604] atomisp-isp2 0000:00:03.0: atomisp_queryctl(= ): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.611988] atomisp-isp2 0000:00:03.0: can't change powe= r state from D3cold to D0 (config space inaccessible) kern :warn : [25507.617420] isys dma store at addr(0xcd408) val(0) kern :err : [25507.618429] atomisp-isp2 0000:00:03.0: atomisp_queryctl(= ): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.618811] atomisp-isp2 0000:00:03.0: atomisp_g_parm():= asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.622193] atomisp-isp2 0000:00:03.0: can't change powe= r state from D3cold to D0 (config space inaccessible) kern :warn : [25507.627355] isys dma store at addr(0xcd408) val(0) kern :err : [25507.628391] atomisp-isp2 0000:00:03.0: atomisp_queryctl(= ): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.631143] atomisp-isp2 0000:00:03.0: can't change powe= r state from D3cold to D0 (config space inaccessible) kern :warn : [25507.635813] isys dma store at addr(0xcd408) val(0) kern :err : [25507.636489] atomisp-isp2 0000:00:03.0: atomisp_queryctl(= ): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.636504] atomisp-isp2 0000:00:03.0: atomisp_s_input()= : asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.636516] atomisp-isp2 0000:00:03.0: atomisp_set_fmt()= : asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.639111] atomisp-isp2 0000:00:03.0: can't change powe= r state from D3cold to D0 (config space inaccessible) kern :warn : [25507.646152] isys dma store at addr(0xcd408) val(0) kern :err : [25507.646831] atomisp-isp2 0000:00:03.0: atomisp_queryctl(= ): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.646847] atomisp-isp2 0000:00:03.0: atomisp_s_input()= : asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.650079] atomisp-isp2 0000:00:03.0: can't change powe= r state from D3cold to D0 (config space inaccessible) kern :warn : [25507.657476] isys dma store at addr(0xcd408) val(0) kern :err : [25507.658741] atomisp-isp2 0000:00:03.0: atomisp_queryctl(= ): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.658759] atomisp-isp2 0000:00:03.0: atomisp_s_input()= : asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.658771] atomisp-isp2 0000:00:03.0: atomisp_set_fmt()= : asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.660959] atomisp-isp2 0000:00:03.0: can't change powe= r state from D3cold to D0 (config space inaccessible) kern :warn : [25507.666665] isys dma store at addr(0xcd408) val(0) kern :err : [25507.667397] atomisp-isp2 0000:00:03.0: atomisp_queryctl(= ): asd is NULL, device is ATOMISP ISP ACC [mchehab: fix coding style] Signed-off-by: Tsuchiya Yuto Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../staging/media/atomisp/pci/atomisp_cmd.c | 73 +++++++++++++++ .../staging/media/atomisp/pci/atomisp_fops.c | 6 ++ .../staging/media/atomisp/pci/atomisp_ioctl.c | 90 +++++++++++++++++++ 3 files changed, 169 insertions(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/stag= ing/media/atomisp/pci/atomisp_cmd.c index 366161cff5602..75a531667d743 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -1715,6 +1715,12 @@ void atomisp_wdt_refresh_pipe(struct atomisp_video_p= ipe *pipe, { unsigned long next; =20 + if (!pipe->asd) { + dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, pipe->vdev.name); + return; + } + if (delay !=3D ATOMISP_WDT_KEEP_CURRENT_DELAY) pipe->wdt_duration =3D delay; =20 @@ -1777,6 +1783,12 @@ void atomisp_wdt_refresh(struct atomisp_sub_device *= asd, unsigned int delay) /* ISP2401 */ void atomisp_wdt_stop_pipe(struct atomisp_video_pipe *pipe, bool sync) { + if (!pipe->asd) { + dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, pipe->vdev.name); + return; + } + if (!atomisp_is_wdt_running(pipe)) return; =20 @@ -4109,6 +4121,12 @@ void atomisp_handle_parameter_and_buffer(struct atom= isp_video_pipe *pipe) unsigned long irqflags; bool need_to_enqueue_buffer =3D false; =20 + if (!asd) { + dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, pipe->vdev.name); + return; + } + if (atomisp_is_vf_pipe(pipe)) return; =20 @@ -4196,6 +4214,12 @@ int atomisp_set_parameters(struct video_device *vdev, struct atomisp_css_params *css_param =3D &asd->params.css_param; int ret; =20 + if (!asd) { + dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + if (!asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream) { dev_err(asd->isp->dev, "%s: internal error!\n", __func__); return -EINVAL; @@ -4857,6 +4881,12 @@ int atomisp_try_fmt(struct video_device *vdev, struc= t v4l2_pix_format *f, int source_pad =3D atomisp_subdev_source_pad(vdev); int ret; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + if (!isp->inputs[asd->input_curr].camera) return -EINVAL; =20 @@ -5198,6 +5228,12 @@ static int atomisp_set_fmt_to_isp(struct video_devic= e *vdev, const struct atomisp_in_fmt_conv *fc; int ret, i; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + v4l2_fh_init(&fh.vfh, vdev); =20 isp_sink_crop =3D atomisp_subdev_get_rect( @@ -5494,6 +5530,7 @@ static int atomisp_set_fmt_to_snr(struct video_device= *vdev, unsigned int dvs_env_w, unsigned int dvs_env_h) { struct atomisp_sub_device *asd =3D atomisp_to_video_pipe(vdev)->asd; + struct atomisp_video_pipe *pipe =3D atomisp_to_video_pipe(vdev); const struct atomisp_format_bridge *format; struct v4l2_subdev_pad_config pad_cfg; struct v4l2_subdev_state pad_state =3D { @@ -5512,6 +5549,12 @@ static int atomisp_set_fmt_to_snr(struct video_devic= e *vdev, struct v4l2_subdev_fh fh; int ret; =20 + if (!asd) { + dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + v4l2_fh_init(&fh.vfh, vdev); =20 stream_index =3D atomisp_source_pad_to_stream_id(asd, source_pad); @@ -5602,6 +5645,12 @@ int atomisp_set_fmt(struct video_device *vdev, struc= t v4l2_format *f) struct v4l2_subdev_fh fh; int ret; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + if (source_pad >=3D ATOMISP_SUBDEV_PADS_NUM) return -EINVAL; =20 @@ -6034,6 +6083,12 @@ int atomisp_set_fmt_file(struct video_device *vdev, = struct v4l2_format *f) struct v4l2_subdev_fh fh; int ret; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + v4l2_fh_init(&fh.vfh, vdev); =20 dev_dbg(isp->dev, "setting fmt %ux%u 0x%x for file inject\n", @@ -6359,6 +6414,12 @@ bool atomisp_is_vf_pipe(struct atomisp_video_pipe *p= ipe) { struct atomisp_sub_device *asd =3D pipe->asd; =20 + if (!asd) { + dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, pipe->vdev.name); + return false; + } + if (pipe =3D=3D &asd->video_out_vf) return true; =20 @@ -6572,6 +6633,12 @@ static int atomisp_get_pipe_id(struct atomisp_video_= pipe *pipe) { struct atomisp_sub_device *asd =3D pipe->asd; =20 + if (!asd) { + dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, pipe->vdev.name); + return -EINVAL; + } + if (ATOMISP_USE_YUVPP(asd)) { return IA_CSS_PIPE_ID_YUVPP; } else if (asd->vfpp->val =3D=3D ATOMISP_VFPP_DISABLE_SCALER) { @@ -6609,6 +6676,12 @@ int atomisp_get_invalid_frame_num(struct video_devic= e *vdev, struct ia_css_pipe_info p_info; int ret; =20 + if (!asd) { + dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + if (asd->isp->inputs[asd->input_curr].camera_caps-> sensor[asd->sensor_curr].stream_num > 1) { /* External ISP */ diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/sta= ging/media/atomisp/pci/atomisp_fops.c index f82bf082aa796..02c19b92bdccb 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -1171,6 +1171,12 @@ static int atomisp_mmap(struct file *file, struct vm= _area_struct *vma) u32 origin_size, new_size; int ret; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + if (!(vma->vm_flags & (VM_WRITE | VM_READ))) return -EACCES; =20 diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/st= aging/media/atomisp/pci/atomisp_ioctl.c index c8a625667e81e..a57e640fbf791 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -646,6 +646,12 @@ static int atomisp_g_input(struct file *file, void *fh= , unsigned int *input) struct atomisp_device *isp =3D video_get_drvdata(vdev); struct atomisp_sub_device *asd =3D atomisp_to_video_pipe(vdev)->asd; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + rt_mutex_lock(&isp->mutex); *input =3D asd->input_curr; rt_mutex_unlock(&isp->mutex); @@ -665,6 +671,12 @@ static int atomisp_s_input(struct file *file, void *fh= , unsigned int input) struct v4l2_subdev *motor; int ret; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + rt_mutex_lock(&isp->mutex); if (input >=3D ATOM_ISP_MAX_INPUTS || input >=3D isp->input_cnt) { dev_dbg(isp->dev, "input_cnt: %d\n", isp->input_cnt); @@ -765,6 +777,12 @@ static int atomisp_enum_fmt_cap(struct file *file, voi= d *fh, unsigned int i, fi =3D 0; int rval; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + rt_mutex_lock(&isp->mutex); rval =3D v4l2_subdev_call(isp->inputs[asd->input_curr].camera, pad, enum_mbus_code, NULL, &code); @@ -1027,6 +1045,12 @@ int __atomisp_reqbufs(struct file *file, void *fh, u16 stream_id =3D atomisp_source_pad_to_stream_id(asd, source_pad); int ret =3D 0, i =3D 0; =20 + if (!asd) { + dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + if (req->count =3D=3D 0) { mutex_lock(&pipe->capq.vb_lock); if (!list_empty(&pipe->capq.stream)) @@ -1154,6 +1178,12 @@ static int atomisp_qbuf(struct file *file, void *fh,= struct v4l2_buffer *buf) u32 pgnr; int ret =3D 0; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + rt_mutex_lock(&isp->mutex); if (isp->isp_fatal_error) { ret =3D -EIO; @@ -1389,6 +1419,12 @@ static int atomisp_dqbuf(struct file *file, void *fh= , struct v4l2_buffer *buf) struct atomisp_device *isp =3D video_get_drvdata(vdev); int ret =3D 0; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + rt_mutex_lock(&isp->mutex); =20 if (isp->isp_fatal_error) { @@ -1640,6 +1676,12 @@ static int atomisp_streamon(struct file *file, void = *fh, int ret =3D 0; unsigned long irqflags; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + dev_dbg(isp->dev, "Start stream on pad %d for asd%d\n", atomisp_subdev_source_pad(vdev), asd->index); =20 @@ -1901,6 +1943,12 @@ int __atomisp_streamoff(struct file *file, void *fh,= enum v4l2_buf_type type) unsigned long flags; bool first_streamoff =3D false; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + dev_dbg(isp->dev, "Stop stream on pad %d for asd%d\n", atomisp_subdev_source_pad(vdev), asd->index); =20 @@ -2150,6 +2198,12 @@ static int atomisp_g_ctrl(struct file *file, void *f= h, struct atomisp_device *isp =3D video_get_drvdata(vdev); int i, ret =3D -EINVAL; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + for (i =3D 0; i < ctrls_num; i++) { if (ci_v4l2_controls[i].id =3D=3D control->id) { ret =3D 0; @@ -2229,6 +2283,12 @@ static int atomisp_s_ctrl(struct file *file, void *f= h, struct atomisp_device *isp =3D video_get_drvdata(vdev); int i, ret =3D -EINVAL; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + for (i =3D 0; i < ctrls_num; i++) { if (ci_v4l2_controls[i].id =3D=3D control->id) { ret =3D 0; @@ -2310,6 +2370,12 @@ static int atomisp_queryctl(struct file *file, void = *fh, struct atomisp_sub_device *asd =3D atomisp_to_video_pipe(vdev)->asd; struct atomisp_device *isp =3D video_get_drvdata(vdev); =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + switch (qc->id) { case V4L2_CID_FOCUS_ABSOLUTE: case V4L2_CID_FOCUS_RELATIVE: @@ -2355,6 +2421,12 @@ static int atomisp_camera_g_ext_ctrls(struct file *f= ile, void *fh, int i; int ret =3D 0; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + if (!IS_ISP2401) motor =3D isp->inputs[asd->input_curr].motor; else @@ -2466,6 +2538,12 @@ static int atomisp_camera_s_ext_ctrls(struct file *f= ile, void *fh, int i; int ret =3D 0; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + if (!IS_ISP2401) motor =3D isp->inputs[asd->input_curr].motor; else @@ -2591,6 +2669,12 @@ static int atomisp_g_parm(struct file *file, void *f= h, struct atomisp_sub_device *asd =3D atomisp_to_video_pipe(vdev)->asd; struct atomisp_device *isp =3D video_get_drvdata(vdev); =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + if (parm->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) { dev_err(isp->dev, "unsupported v4l2 buf type\n"); return -EINVAL; @@ -2613,6 +2697,12 @@ static int atomisp_s_parm(struct file *file, void *f= h, int rval; int fps; =20 + if (!asd) { + dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + if (parm->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) { dev_err(isp->dev, "unsupported v4l2 buf type\n"); return -EINVAL; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3480C4167E for ; Mon, 24 Jan 2022 21:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452795AbiAXV0g (ORCPT ); Mon, 24 Jan 2022 16:26:36 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55078 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444340AbiAXVAm (ORCPT ); Mon, 24 Jan 2022 16:00:42 -0500 Received: from smtp.kernel.org (relay.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 74154B8122A; Mon, 24 Jan 2022 21:00:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A07D2C340E5; Mon, 24 Jan 2022 21:00:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058039; bh=OzkQojU2CQWWU1b+Ypc3Ses6ysxsIjIUCCxdS7saOgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZVL9n6yX8EluVa/R9Be3ppbyDeGfERmbteLWX9qkeJSfBj7CDpEjBLp/BYPT6/5r0 KKNHC5LMOAJ6nuJR2QzT94WurbPxTHSrpzROIh/3O3zgI1eXqKC4TjU2TxqKMhfG7H fxhFZ7NK6heoq+GuYAh+JPcfjjTgj0NyyJT/fnAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0128/1039] media: atomisp: fix enum formats logic Date: Mon, 24 Jan 2022 19:31:57 +0100 Message-Id: <20220124184129.459538078@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit fae46cb0531b45c789e39128f676f2bafa3a7b47 ] Changeset 374d62e7aa50 ("media: v4l2-subdev: Verify v4l2_subdev_call() pad = config argument") added an extra verification for a pads parameter for enum mbus format code. Such change broke atomisp, because now the V4L2 core refuses to enum MBUS formats if the state is empty. So, add .which field in order to select the active formats, in order to make it work again. While here, improve error messages. Fixes: 374d62e7aa50 ("media: v4l2-subdev: Verify v4l2_subdev_call() pad con= fig argument") Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../staging/media/atomisp/pci/atomisp_ioctl.c | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/st= aging/media/atomisp/pci/atomisp_ioctl.c index a57e640fbf791..29826f8e4143d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -773,7 +773,10 @@ static int atomisp_enum_fmt_cap(struct file *file, voi= d *fh, struct video_device *vdev =3D video_devdata(file); struct atomisp_device *isp =3D video_get_drvdata(vdev); struct atomisp_sub_device *asd =3D atomisp_to_video_pipe(vdev)->asd; - struct v4l2_subdev_mbus_code_enum code =3D { 0 }; + struct v4l2_subdev_mbus_code_enum code =3D { + .which =3D V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct v4l2_subdev *camera; unsigned int i, fi =3D 0; int rval; =20 @@ -783,14 +786,20 @@ static int atomisp_enum_fmt_cap(struct file *file, vo= id *fh, return -EINVAL; } =20 + camera =3D isp->inputs[asd->input_curr].camera; + if(!camera) { + dev_err(isp->dev, "%s(): camera is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + rt_mutex_lock(&isp->mutex); - rval =3D v4l2_subdev_call(isp->inputs[asd->input_curr].camera, pad, - enum_mbus_code, NULL, &code); + + rval =3D v4l2_subdev_call(camera, pad, enum_mbus_code, NULL, &code); if (rval =3D=3D -ENOIOCTLCMD) { dev_warn(isp->dev, - "enum_mbus_code pad op not supported. Please fix your sensor driver!\n= "); - // rval =3D v4l2_subdev_call(isp->inputs[asd->input_curr].camera, - // video, enum_mbus_fmt, 0, &code.code); + "enum_mbus_code pad op not supported by %s. Please fix your sensor dri= ver!\n", + camera->name); } rt_mutex_unlock(&isp->mutex); =20 @@ -820,6 +829,8 @@ static int atomisp_enum_fmt_cap(struct file *file, void= *fh, f->pixelformat =3D format->pixelformat; return 0; } + dev_err(isp->dev, "%s(): format for code %x not found.\n", + __func__, code.code); =20 return -EINVAL; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97E9EC3526E for ; Mon, 24 Jan 2022 23:24:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848806AbiAXXXs (ORCPT ); Mon, 24 Jan 2022 18:23:48 -0500 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 S1835199AbiAXWfs (ORCPT ); Mon, 24 Jan 2022 17:35:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28695C0E9BA3; Mon, 24 Jan 2022 12:59:01 -0800 (PST) Received: from smtp.kernel.org (relay.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 D9742B8121C; Mon, 24 Jan 2022 20:58:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A3AAC340EF; Mon, 24 Jan 2022 20:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057938; bh=YRDgXVbtszFbMEbOxnXPIBVRAGY0rRsNjTeP+1sYIQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TAFmoZaLQcWrE0wjFWHfbnLbpAj2o6626tcdFsvsfqEmbDiURzyyXCewu9rjYQGXX M+9vBMLd1nF0orGygs47On25ZNr2UF9OPz6m5Ya3/UJ6TauU7JjLqTtLe/QDYXdBi5 xGR63vcSFPQFygI714c7BXDdKn2muadWu85Y9ugI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Kieran Bingham , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0129/1039] media: atomisp: fix uninitialized bug in gmin_get_pmic_id_and_addr() Date: Mon, 24 Jan 2022 19:31:58 +0100 Message-Id: <20220124184129.497979574@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit cb4d67a998e97365afdf34965b069601da1dae60 ] The "power" pointer is not initialized on the else path and that would lead to an Oops. Link: https://lore.kernel.org/linux-media/20211012082150.GA31086@kili Fixes: c30f4cb2d4c7 ("media: atomisp: Refactor PMIC detection to a separate= function") Signed-off-by: Dan Carpenter Reviewed-by: Kieran Bingham Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/dr= ivers/staging/media/atomisp/pci/atomisp_gmin_platform.c index d8c9e31314b2e..62dc06e224765 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c @@ -481,7 +481,7 @@ fail: =20 static u8 gmin_get_pmic_id_and_addr(struct device *dev) { - struct i2c_client *power; + struct i2c_client *power =3D NULL; static u8 pmic_i2c_addr; =20 if (pmic_id) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 371CFC4167E for ; Mon, 24 Jan 2022 23:34:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850852AbiAXXbB (ORCPT ); Mon, 24 Jan 2022 18:31:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835751AbiAXWhZ (ORCPT ); Mon, 24 Jan 2022 17:37:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A85D7C0E9BA9; Mon, 24 Jan 2022 12:59:02 -0800 (PST) Received: from smtp.kernel.org (relay.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 47CAA61342; Mon, 24 Jan 2022 20:59:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28421C340E5; Mon, 24 Jan 2022 20:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057941; bh=AwFJn6/pMMxcV4YXEZ5zf98OztZsn5CIgYkwv9snTGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EuSZKPIKHC5pEHdOEMxZhpeKSKzu7q82fEh9QlJo6XI9tWosZiIucrIhwCCTUMg+/ O+Sw3iix5zJELd2lmILtSdGQc/wc8OfnuvKQjrktDophKEbNF+BCmT7HyljHAUJvul bBUkmUJruCffxPzTW9RFoITg20PSvfFBoiYgTaFE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jammy Huang , Paul Menzel , Joel Stanley , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0130/1039] media: aspeed: fix mode-detect always time out at 2nd run Date: Mon, 24 Jan 2022 19:31:59 +0100 Message-Id: <20220124184129.533329949@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jammy Huang [ Upstream commit 62cea52ad4bead0ae4be2cfe1142eb0aae0e9fbd ] aspeed_video_get_resolution() will try to do res-detect again if the timing got in last try is invalid. But it will always time out because VE_SEQ_CTRL_TRIG_MODE_DET is only cleared after 1st mode-detect. To fix the problem, just clear VE_SEQ_CTRL_TRIG_MODE_DET before setting it in aspeed_video_enable_mode_detect(). Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver") Signed-off-by: Jammy Huang Acked-by: Paul Menzel Reviewed-by: Joel Stanley Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/aspeed-video.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform= /aspeed-video.c index cad3f97515aef..136383ad0e97c 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -539,6 +539,10 @@ static void aspeed_video_enable_mode_detect(struct asp= eed_video *video) aspeed_video_update(video, VE_INTERRUPT_CTRL, 0, VE_INTERRUPT_MODE_DETECT); =20 + /* Disable mode detect in order to re-trigger */ + aspeed_video_update(video, VE_SEQ_CTRL, + VE_SEQ_CTRL_TRIG_MODE_DET, 0); + /* Trigger mode detect */ aspeed_video_update(video, VE_SEQ_CTRL, 0, VE_SEQ_CTRL_TRIG_MODE_DET); } @@ -824,10 +828,6 @@ static void aspeed_video_get_resolution(struct aspeed_= video *video) return; } =20 - /* Disable mode detect in order to re-trigger */ - aspeed_video_update(video, VE_SEQ_CTRL, - VE_SEQ_CTRL_TRIG_MODE_DET, 0); - aspeed_video_check_and_set_polarity(video); =20 aspeed_video_enable_mode_detect(video); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E167C433EF for ; Mon, 24 Jan 2022 21:34:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1453519AbiAXVaR (ORCPT ); Mon, 24 Jan 2022 16:30:17 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54160 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443770AbiAXU7H (ORCPT ); Mon, 24 Jan 2022 15:59:07 -0500 Received: from smtp.kernel.org (relay.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 D9D10B81057; Mon, 24 Jan 2022 20:59:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FE3BC340E5; Mon, 24 Jan 2022 20:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057944; bh=GEUWqZa4Mds9xpkPoeSkjkmS/DNRRSRnYjCMluj7qrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YfEEV+jhElUuQ6XTgLJ7fnb4lTvM5h60mGcEXvb7GIEf1+zYrzCt14uQmqrd77eSi PtCZSTQCYhAC5jFaIDPb1l3bsj4HGpIaznTyNRviX7D4cklm6L+SH1wK+HonDY/BXZ edQtSyFQx5fmUMrd+ZAMUJKT7T5c68lgGdxWZnu8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Dongliang Mu , syzkaller , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0131/1039] media: em28xx: fix memory leak in em28xx_init_dev Date: Mon, 24 Jan 2022 19:32:00 +0100 Message-Id: <20220124184129.565373621@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dongliang Mu [ Upstream commit 22be5a10d0b24eec9e45decd15d7e6112b25f080 ] In the em28xx_init_rev, if em28xx_audio_setup fails, this function fails to deallocate the media_dev allocated in the em28xx_media_device_init. Fix this by adding em28xx_unregister_media_device to free media_dev. BTW, this patch is tested in my local syzkaller instance, and it can prevent the memory leak from occurring again. CC: Pavel Skripkin Fixes: 37ecc7b1278f ("[media] em28xx: add media controller support") Signed-off-by: Dongliang Mu Reported-by: syzkaller Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/em28xx/em28xx-cards.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em= 28xx/em28xx-cards.c index b207f34af5c6f..b451ce3cb169a 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -3630,8 +3630,10 @@ static int em28xx_init_dev(struct em28xx *dev, struc= t usb_device *udev, =20 if (dev->is_audio_only) { retval =3D em28xx_audio_setup(dev); - if (retval) - return -ENODEV; + if (retval) { + retval =3D -ENODEV; + goto err_deinit_media; + } em28xx_init_extension(dev); =20 return 0; @@ -3650,7 +3652,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct= usb_device *udev, dev_err(&dev->intf->dev, "%s: em28xx_i2c_register bus 0 - error [%d]!\n", __func__, retval); - return retval; + goto err_deinit_media; } =20 /* register i2c bus 1 */ @@ -3666,9 +3668,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct= usb_device *udev, "%s: em28xx_i2c_register bus 1 - error [%d]!\n", __func__, retval); =20 - em28xx_i2c_unregister(dev, 0); - - return retval; + goto err_unreg_i2c; } } =20 @@ -3676,6 +3676,12 @@ static int em28xx_init_dev(struct em28xx *dev, struc= t usb_device *udev, em28xx_card_setup(dev); =20 return 0; + +err_unreg_i2c: + em28xx_i2c_unregister(dev, 0); +err_deinit_media: + em28xx_unregister_media_device(dev); + return retval; } =20 static int em28xx_duplicate_dev(struct em28xx *dev) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 478C1C2BA4C for ; Mon, 24 Jan 2022 23:34:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850878AbiAXXbI (ORCPT ); Mon, 24 Jan 2022 18:31:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835803AbiAXWhf (ORCPT ); Mon, 24 Jan 2022 17:37:35 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFE18C054844; Mon, 24 Jan 2022 12:59:08 -0800 (PST) Received: from smtp.kernel.org (relay.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 5E01761355; Mon, 24 Jan 2022 20:59:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3196EC340E5; Mon, 24 Jan 2022 20:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057947; bh=RxIigBhFTeZ+GtzDVEchnUoTO75Wyk7sQHW98SGKpKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ik06TuR3iEiaYNl9Yt+iGYlz3qaiCnxnl7splqYDFuM9TbL63KUKTOyXxvZIM30P2 Jx9pW0oWBfGZe1UDdt0Q9BVTWe833lrTe65aOnbSEViD2qARMzPNbGF95K1qTRI7/N wyVL90yDGsV2VcECCqmYOK6tuLmWsbsj9lMIE0kk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jammy Huang , Paul Menzel , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0132/1039] media: aspeed: Update signal status immediately to ensure sane hw state Date: Mon, 24 Jan 2022 19:32:01 +0100 Message-Id: <20220124184129.596914928@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jammy Huang [ Upstream commit af6d1bde395cac174ee71adcd3fa43f6435c7206 ] If res-chg, VE_INTERRUPT_MODE_DETECT_WD irq will be raised. But v4l2_input_status won't be updated to no-signal immediately until aspeed_video_get_resolution() in aspeed_video_resolution_work(). During the period of time, aspeed_video_start_frame() could be called because it doesn't know signal becomes unstable now. If it goes with aspeed_video_init_regs() of aspeed_video_irq_res_change() simultaneously, it will mess up hw state. To fix this problem, v4l2_input_status is updated to no-signal immediately for VE_INTERRUPT_MODE_DETECT_WD irq. Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver") Signed-off-by: Jammy Huang Acked-by: Paul Menzel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/aspeed-video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform= /aspeed-video.c index 136383ad0e97c..7a24daf7165a4 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -595,6 +595,8 @@ static void aspeed_video_irq_res_change(struct aspeed_v= ideo *video, ulong delay) set_bit(VIDEO_RES_CHANGE, &video->flags); clear_bit(VIDEO_FRAME_INPRG, &video->flags); =20 + video->v4l2_input_status =3D V4L2_IN_ST_NO_SIGNAL; + aspeed_video_off(video); aspeed_video_bufs_done(video, VB2_BUF_STATE_ERROR); =20 @@ -1375,7 +1377,6 @@ static void aspeed_video_resolution_work(struct work_= struct *work) struct delayed_work *dwork =3D to_delayed_work(work); struct aspeed_video *video =3D container_of(dwork, struct aspeed_video, res_work); - u32 input_status =3D video->v4l2_input_status; =20 aspeed_video_on(video); =20 @@ -1388,8 +1389,7 @@ static void aspeed_video_resolution_work(struct work_= struct *work) aspeed_video_get_resolution(video); =20 if (video->detected_timings.width !=3D video->active_timings.width || - video->detected_timings.height !=3D video->active_timings.height || - input_status !=3D video->v4l2_input_status) { + video->detected_timings.height !=3D video->active_timings.height) { static const struct v4l2_event ev =3D { .type =3D V4L2_EVENT_SOURCE_CHANGE, .u.src_change.changes =3D V4L2_EVENT_SRC_CH_RESOLUTION, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDB7CC43217 for ; Mon, 24 Jan 2022 21:28:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452332AbiAXVZL (ORCPT ); Mon, 24 Jan 2022 16:25:11 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:52400 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443811AbiAXU7M (ORCPT ); Mon, 24 Jan 2022 15:59:12 -0500 Received: from smtp.kernel.org (relay.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 50C8C61330; Mon, 24 Jan 2022 20:59:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32DC2C340E5; Mon, 24 Jan 2022 20:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057950; bh=8rZU2mkEPnLSkCNjqQB28l5RSQofZ+GqJfjHJOjlecg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fyVEkbPMUmMvoaV69PbFmObY+5MSjtRkA8pVPrNyTX8a1QmKrdOs0FzCm5/gHrjIf FKiV0QzRYPCMbsS8JtBl2gDK8pc46oCYVbQq0Vmd9Kzz8jUFBYOPX/xMx5jCBcerD3 52avpGQy4bh4xA0IFOZ9weeJ0srYRT2ArLUwRzIs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neil Armstrong , Alexander Stein , Sasha Levin Subject: [PATCH 5.16 0133/1039] arm64: dts: amlogic: meson-g12: Fix GPU operating point table node name Date: Mon, 24 Jan 2022 19:32:02 +0100 Message-Id: <20220124184129.630000661@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit bb98a6fd0b0e227cefb2ba91cea2b55455f203b7 ] Starting with commit 94274f20f6bf ("dt-bindings: opp: Convert to DT schema") the opp node name has a mandatory pattern. This change fixes the dtbs_check warning: gpu-opp-table: $nodename:0: 'gpu-opp-table' does not match '^opp-table(-[a-z0-9]+)?$' Put the 'gpu' part at the end to match the pattern. Fixes: 916a0edc43f0 ("arm64: dts: amlogic: meson-g12: add the Mali OPP tabl= e and use DVFS") Reviewed-by: Neil Armstrong Signed-off-by: Alexander Stein Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20211026182813.900775-2-alexander.stein@mai= lbox.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64= /boot/dts/amlogic/meson-g12-common.dtsi index 00c6f53290d43..428449d98c0ae 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi @@ -58,7 +58,7 @@ secure-monitor =3D <&sm>; }; =20 - gpu_opp_table: gpu-opp-table { + gpu_opp_table: opp-table-gpu { compatible =3D "operating-points-v2"; =20 opp-124999998 { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84894C4167D for ; Mon, 24 Jan 2022 21:34:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1453645AbiAXVae (ORCPT ); Mon, 24 Jan 2022 16:30:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49988 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442904AbiAXU7P (ORCPT ); Mon, 24 Jan 2022 15:59:15 -0500 Received: from smtp.kernel.org (relay.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 681D460907; Mon, 24 Jan 2022 20:59:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54E20C340E5; Mon, 24 Jan 2022 20:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057953; bh=yt0SBqxMsExRaYTBC1Vv6ewmv9rpWwvS0gCEpAGnriw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D4dj8fWa3QAFx/FmnOKDQrO2wKs92j1pawxmDAX17rbn/P/+hv81vsmRVieEEXasY HR4Q/4Sq/D6A656u5ut0nhjkGC/f5UTQDSODcqbV04F88EnZYAArRMAp+Mt32XAoAk NiT3qJrvlDHLrLJqCoET08smFE0eHgmJarYIwHXA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neil Armstrong , Alexander Stein , Sasha Levin Subject: [PATCH 5.16 0134/1039] arm64: dts: amlogic: Fix SPI NOR flash node name for ODROID N2/N2+ Date: Mon, 24 Jan 2022 19:32:03 +0100 Message-Id: <20220124184129.666187858@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit 95d35256b564aca33fb661eac77dc94bfcffc8df ] Fix the schema warning: "spi-flash@0: $nodename:0: 'spi-flash@0' does not match '^flash(@.*)?$'" from jedec,spi-nor.yaml Fixes: a084eaf3096c ("arm64: dts: meson-g12b-odroid-n2: add SPIFC controlle= r node") Reviewed-by: Neil Armstrong Signed-off-by: Alexander Stein Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20211026182813.900775-3-alexander.stein@mai= lbox.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/a= rm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi index e8a00a2f88128..3e968b2441918 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi @@ -609,7 +609,7 @@ pinctrl-0 =3D <&nor_pins>; pinctrl-names =3D "default"; =20 - mx25u64: spi-flash@0 { + mx25u64: flash@0 { #address-cells =3D <1>; #size-cells =3D <1>; compatible =3D "mxicy,mx25u6435f", "jedec,spi-nor"; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F426C433EF for ; Mon, 24 Jan 2022 23:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849498AbiAXX0A (ORCPT ); Mon, 24 Jan 2022 18:26:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835837AbiAXWhj (ORCPT ); Mon, 24 Jan 2022 17:37:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59DADC054854; Mon, 24 Jan 2022 12:59:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 221D8B81243; Mon, 24 Jan 2022 20:59:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EEE2C36AE9; Mon, 24 Jan 2022 20:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057956; bh=m1F5fWtgDM8E6XKmaqCuV0mNrGXhTgIpzHKN+ItcTok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rRtcMcj+ydkrlBppQcJfJa1tdZBAnZGY6/4Tnckg+uypoMOwCn+FZ4wUlHTpfKqeK 1eqxyaalIh93Bn2nfC4+MIrgKfMd9N37qVk4qbj8l6Clbfvo6sr6YPSIfqQ/FdUAQz jtKf7/+KnmY/ovREVzYIHEuIsDDzUn8cYcyFv2eM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Hewitt , Neil Armstrong , Sasha Levin Subject: [PATCH 5.16 0135/1039] arm64: dts: meson-gxbb-wetek: fix HDMI in early boot Date: Mon, 24 Jan 2022 19:32:04 +0100 Message-Id: <20220124184129.707355171@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Hewitt [ Upstream commit 8182a35868db5f053111d5d9d4da8fcb3f99259d ] Mark the VDDIO_AO18 regulator always-on and set hdmi-supply for the hdmi_tx node to ensure HDMI is powered in the early stages of boot. Fixes: fb72c03e0e32 ("ARM64: dts: meson-gxbb-wetek: add a wetek specific dt= si to cleanup hub and play2") Signed-off-by: Christian Hewitt Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20211012052522.30873-2-christianshewitt@gma= il.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64= /boot/dts/amlogic/meson-gxbb-wetek.dtsi index a350fee1264d7..8e2af986cebaf 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi @@ -64,6 +64,7 @@ regulator-name =3D "VDDIO_AO18"; regulator-min-microvolt =3D <1800000>; regulator-max-microvolt =3D <1800000>; + regulator-always-on; }; =20 vcc_3v3: regulator-vcc_3v3 { @@ -161,6 +162,7 @@ status =3D "okay"; pinctrl-0 =3D <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; pinctrl-names =3D "default"; + hdmi-supply =3D <&vddio_ao18>; }; =20 &hdmi_tx_tmds_port { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C339BC433F5 for ; Mon, 24 Jan 2022 21:28:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376352AbiAXVY4 (ORCPT ); Mon, 24 Jan 2022 16:24:56 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50102 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358037AbiAXU7W (ORCPT ); Mon, 24 Jan 2022 15:59:22 -0500 Received: from smtp.kernel.org (relay.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 9174360C17; Mon, 24 Jan 2022 20:59:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FB34C340E5; Mon, 24 Jan 2022 20:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057960; bh=V3QOwk8IW3ZkXrK9Ww4HIPJ27Oj/Lc/7eiEjo3TghfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y4WRYyiGkN1bFxiA4fnxYLAhwz8JdVicJnx8Rl0Wy2l85slIDsW2oMn6SppwvAWJz ItgNFPJyCLYIsjPv47beSJXOvxnCIFl1EsxW/2W7RXRdVFUmQS4UQmhnwIcNoZLvcU S19FlMGDLRKgoAWVlr4QwkIBf7X7csJZJOWGHMxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Hewitt , Neil Armstrong , Sasha Levin Subject: [PATCH 5.16 0136/1039] arm64: dts: meson-gxbb-wetek: fix missing GPIO binding Date: Mon, 24 Jan 2022 19:32:05 +0100 Message-Id: <20220124184129.748140768@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Hewitt [ Upstream commit c019abb2feba3cbbd7cf7178f8e6499c4fa6fced ] The absence of this binding appears to be harmless in Linux but it breaks Ethernet support in mainline u-boot. So add the binding (which is present in all other u-boot supported GXBB device-trees). Fixes: fb72c03e0e32 ("ARM64: dts: meson-gxbb-wetek: add a wetek specific dt= si to cleanup hub and play2") Signed-off-by: Christian Hewitt Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20211012052522.30873-3-christianshewitt@gma= il.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64= /boot/dts/amlogic/meson-gxbb-wetek.dtsi index 8e2af986cebaf..a4d34398da358 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi @@ -6,6 +6,7 @@ */ =20 #include "meson-gxbb.dtsi" +#include =20 / { aliases { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8904C4332F for ; Mon, 24 Jan 2022 21:28:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377939AbiAXVZE (ORCPT ); Mon, 24 Jan 2022 16:25:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:52586 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443867AbiAXU7Y (ORCPT ); Mon, 24 Jan 2022 15:59:24 -0500 Received: from smtp.kernel.org (relay.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 8F6D0611C8; Mon, 24 Jan 2022 20:59:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70778C340E5; Mon, 24 Jan 2022 20:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057963; bh=HfDFm7yT+3wFCLaafSOjs5CNPekh1pVIIpqUt9Zz73c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R8t+AcPxp6JRMPRvAY8Ro3tF+yx6LQmy/Ya8sqmG9RRgltW3q/n1jQF92CHFj5zmf Y18NdnsEziQaBp1YGesuiGkf6MqOCBU5KdHKFqg7+3kEOzRmoah4LikQclDuSefLSG 3zBwPimDE8tl3RQRHbqPDStKSoN+Fon3osg7ax0A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Peterson , Alexander Aring , David Teigland , Sasha Levin Subject: [PATCH 5.16 0137/1039] fs: dlm: dont call kernel_getpeername() in error_report() Date: Mon, 24 Jan 2022 19:32:06 +0100 Message-Id: <20220124184129.778627014@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Aring [ Upstream commit 4c3d90570bcc2b338f70f61f01110268e281ca3c ] In some cases kernel_getpeername() will held the socket lock which is already held when the socket layer calls error_report() callback. Since commit 9dfc685e0262 ("inet: remove races in inet{6}_getname()") this problem becomes more likely because the socket lock will be held always. You will see something like: bob9-u5 login: [ 562.316860] BUG: spinlock recursion on CPU#7, swapper/7/0 [ 562.318562] lock: 0xffff8f2284720088, .magic: dead4ead, .owner: swapper= /7/0, .owner_cpu: 7 [ 562.319522] CPU: 7 PID: 0 Comm: swapper/7 Not tainted 5.15.0+ #135 [ 562.320346] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.13.0-2.module+el8= .3.0+7353+9de0a3cc 04/01/2014 [ 562.321277] Call Trace: [ 562.321529] [ 562.321734] dump_stack_lvl+0x33/0x42 [ 562.322282] do_raw_spin_lock+0x8b/0xc0 [ 562.322674] lock_sock_nested+0x1e/0x50 [ 562.323057] inet_getname+0x39/0x110 [ 562.323425] ? sock_def_readable+0x80/0x80 [ 562.323838] lowcomms_error_report+0x63/0x260 [dlm] [ 562.324338] ? wait_for_completion_interruptible_timeout+0xd2/0x120 [ 562.324949] ? lock_timer_base+0x67/0x80 [ 562.325330] ? do_raw_spin_unlock+0x49/0xc0 [ 562.325735] ? _raw_spin_unlock_irqrestore+0x1e/0x40 [ 562.326218] ? del_timer+0x54/0x80 [ 562.326549] sk_error_report+0x12/0x70 [ 562.326919] tcp_validate_incoming+0x3c8/0x530 [ 562.327347] ? kvm_clock_read+0x14/0x30 [ 562.327718] ? ktime_get+0x3b/0xa0 [ 562.328055] tcp_rcv_established+0x121/0x660 [ 562.328466] tcp_v4_do_rcv+0x132/0x260 [ 562.328835] tcp_v4_rcv+0xcea/0xe20 [ 562.329173] ip_protocol_deliver_rcu+0x35/0x1f0 [ 562.329615] ip_local_deliver_finish+0x54/0x60 [ 562.330050] ip_local_deliver+0xf7/0x110 [ 562.330431] ? inet_rtm_getroute+0x211/0x840 [ 562.330848] ? ip_protocol_deliver_rcu+0x1f0/0x1f0 [ 562.331310] ip_rcv+0xe1/0xf0 [ 562.331603] ? ip_local_deliver+0x110/0x110 [ 562.332011] __netif_receive_skb_core+0x46a/0x1040 [ 562.332476] ? inet_gro_receive+0x263/0x2e0 [ 562.332885] __netif_receive_skb_list_core+0x13b/0x2c0 [ 562.333383] netif_receive_skb_list_internal+0x1c8/0x2f0 [ 562.333896] ? update_load_avg+0x7e/0x5e0 [ 562.334285] gro_normal_list.part.149+0x19/0x40 [ 562.334722] napi_complete_done+0x67/0x160 [ 562.335134] virtnet_poll+0x2ad/0x408 [virtio_net] [ 562.335644] __napi_poll+0x28/0x140 [ 562.336012] net_rx_action+0x23d/0x300 [ 562.336414] __do_softirq+0xf2/0x2ea [ 562.336803] irq_exit_rcu+0xc1/0xf0 [ 562.337173] common_interrupt+0xb9/0xd0 It is and was always forbidden to call kernel_getpeername() in context of error_report(). To get rid of the problem we access the destination address for the peer over the socket structure. While on it we fix to print out the destination port of the inet socket. Fixes: 1a31833d085a ("DLM: Replace nodeid_to_addr with kernel_getpeername") Reported-by: Bob Peterson Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/dlm/lowcomms.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 8f715c620e1f8..7b1c5f05a988b 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -592,8 +592,8 @@ int dlm_lowcomms_nodes_set_mark(int nodeid, unsigned in= t mark) static void lowcomms_error_report(struct sock *sk) { struct connection *con; - struct sockaddr_storage saddr; void (*orig_report)(struct sock *) =3D NULL; + struct inet_sock *inet; =20 read_lock_bh(&sk->sk_callback_lock); con =3D sock2con(sk); @@ -601,33 +601,31 @@ static void lowcomms_error_report(struct sock *sk) goto out; =20 orig_report =3D listen_sock.sk_error_report; - if (kernel_getpeername(sk->sk_socket, (struct sockaddr *)&saddr) < 0) { - printk_ratelimited(KERN_ERR "dlm: node %d: socket error " - "sending to node %d, port %d, " - "sk_err=3D%d/%d\n", dlm_our_nodeid(), - con->nodeid, dlm_config.ci_tcp_port, - sk->sk_err, sk->sk_err_soft); - } else if (saddr.ss_family =3D=3D AF_INET) { - struct sockaddr_in *sin4 =3D (struct sockaddr_in *)&saddr; =20 + inet =3D inet_sk(sk); + switch (sk->sk_family) { + case AF_INET: printk_ratelimited(KERN_ERR "dlm: node %d: socket error " - "sending to node %d at %pI4, port %d, " + "sending to node %d at %pI4, dport %d, " "sk_err=3D%d/%d\n", dlm_our_nodeid(), - con->nodeid, &sin4->sin_addr.s_addr, - dlm_config.ci_tcp_port, sk->sk_err, + con->nodeid, &inet->inet_daddr, + ntohs(inet->inet_dport), sk->sk_err, sk->sk_err_soft); - } else { - struct sockaddr_in6 *sin6 =3D (struct sockaddr_in6 *)&saddr; - + break; + case AF_INET6: printk_ratelimited(KERN_ERR "dlm: node %d: socket error " - "sending to node %d at %u.%u.%u.%u, " - "port %d, sk_err=3D%d/%d\n", dlm_our_nodeid(), - con->nodeid, sin6->sin6_addr.s6_addr32[0], - sin6->sin6_addr.s6_addr32[1], - sin6->sin6_addr.s6_addr32[2], - sin6->sin6_addr.s6_addr32[3], - dlm_config.ci_tcp_port, sk->sk_err, + "sending to node %d at %pI6c, " + "dport %d, sk_err=3D%d/%d\n", dlm_our_nodeid(), + con->nodeid, &sk->sk_v6_daddr, + ntohs(inet->inet_dport), sk->sk_err, sk->sk_err_soft); + break; + default: + printk_ratelimited(KERN_ERR "dlm: node %d: socket error " + "invalid socket family %d set, " + "sk_err=3D%d/%d\n", dlm_our_nodeid(), + sk->sk_family, sk->sk_err, sk->sk_err_soft); + goto out; } =20 /* below sendcon only handling */ --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C7A1C433EF for ; Mon, 24 Jan 2022 23:29:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849841AbiAXX0r (ORCPT ); Mon, 24 Jan 2022 18:26:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835912AbiAXWhq (ORCPT ); Mon, 24 Jan 2022 17:37:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89F9BC054863; Mon, 24 Jan 2022 12:59:28 -0800 (PST) Received: from smtp.kernel.org (relay.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 529D5B811A9; Mon, 24 Jan 2022 20:59:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68B35C340E5; Mon, 24 Jan 2022 20:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057966; bh=KhFuWy6pIgFqeK/ZBpQXBDs+iXmN2Kr+UX1z8tFIAGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qNVkHIOgSvNqL/49xO2xzzVtxJnXYo/XDwmz03w6+Yh/WomJUaGC+k7l5qynnk4+f yfYuIFYhnzL5A5IXQpV5zTOaK9++8uNjOJCv9sCJHtmeZtM0+jbkYi1FTI28KHFrw2 eY3ug/l+KjrttxB++Q5sYojpRmPEyjhsyPX8syzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lad Prabhakar , Biju Das , Wolfram Sang , Geert Uytterhoeven , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.16 0138/1039] memory: renesas-rpc-if: Return error in case devm_ioremap_resource() fails Date: Mon, 24 Jan 2022 19:32:07 +0100 Message-Id: <20220124184129.813519102@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 818fdfa89baac77a8df5a2c30f4fb798cc937aa0 ] Make sure we return error in case devm_ioremap_resource() fails for dirmap resource. Fixes: ca7d8b980b67 ("memory: add Renesas RPC-IF driver") Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das Reviewed-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20211025205631.21151-6-prabhakar.mahadev-la= d.rj@bp.renesas.com Signed-off-by: Krzysztof Kozlowski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/memory/renesas-rpc-if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-i= f.c index 7435baad00075..ff8bcbccac637 100644 --- a/drivers/memory/renesas-rpc-if.c +++ b/drivers/memory/renesas-rpc-if.c @@ -243,7 +243,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev) res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap"); rpc->dirmap =3D devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(rpc->dirmap)) - rpc->dirmap =3D NULL; + return PTR_ERR(rpc->dirmap); rpc->size =3D resource_size(res); =20 rpc->rstc =3D devm_reset_control_get_exclusive(&pdev->dev, NULL); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 300E5C3525A for ; Mon, 24 Jan 2022 21:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1453735AbiAXVar (ORCPT ); Mon, 24 Jan 2022 16:30:47 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54516 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443916AbiAXU7h (ORCPT ); Mon, 24 Jan 2022 15:59:37 -0500 Received: from smtp.kernel.org (relay.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 5C27AB810BD; Mon, 24 Jan 2022 20:59:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84FC4C340E5; Mon, 24 Jan 2022 20:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057972; bh=0IGBf5tEYiMjH+4RXC5rOqHobWxotPtGXGTcCVuL41w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f0aKrhXncadlwPsS0Xqz8olRSRZ0a0jT5TxNhDjj+ALwQ34p1cD+JKj3iCF2nxuId IzgnzyLDyHV7YTqU83/VspTZbVE0RXl8X2bNUOqGbEOJ8dgWJXXdNSV3nqMChzO/4M othgkgOPKm6Q7pTOg/LaynHzI5D6DUW5+qKGXPoU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Marcel Holtmann , Sasha Levin , syzbot+e3fcb9c4f3c2a931dc40@syzkaller.appspotmail.com Subject: [PATCH 5.16 0139/1039] Bluetooth: stop proccessing malicious adv data Date: Mon, 24 Jan 2022 19:32:08 +0100 Message-Id: <20220124184129.852295486@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 3a56ef719f0b9682afb8a86d64b2399e36faa4e6 ] Syzbot reported slab-out-of-bounds read in hci_le_adv_report_evt(). The problem was in missing validaion check. We should check if data is not malicious and we can read next data block. If we won't check ptr validness, code can read a way beyond skb->end and it can cause problems, of course. Fixes: e95beb414168 ("Bluetooth: hci_le_adv_report_evt code refactoring") Reported-and-tested-by: syzbot+e3fcb9c4f3c2a931dc40@syzkaller.appspotmail.c= om Signed-off-by: Pavel Skripkin Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/hci_event.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 7d0db1ca12482..59f0691d907f6 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -5825,7 +5825,8 @@ static void hci_le_adv_report_evt(struct hci_dev *hde= v, struct sk_buff *skb) struct hci_ev_le_advertising_info *ev =3D ptr; s8 rssi; =20 - if (ev->length <=3D HCI_MAX_AD_LENGTH) { + if (ev->length <=3D HCI_MAX_AD_LENGTH && + ev->data + ev->length <=3D skb_tail_pointer(skb)) { rssi =3D ev->data[ev->length]; process_adv_report(hdev, ev->evt_type, &ev->bdaddr, ev->bdaddr_type, NULL, 0, rssi, @@ -5835,6 +5836,11 @@ static void hci_le_adv_report_evt(struct hci_dev *hd= ev, struct sk_buff *skb) } =20 ptr +=3D sizeof(*ev) + ev->length + 1; + + if (ptr > (void *) skb_tail_pointer(skb) - sizeof(*ev)) { + bt_dev_err(hdev, "Malicious advertising data. Stopping processing"); + break; + } } =20 hci_dev_unlock(hdev); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73FD1C4707A for ; Mon, 24 Jan 2022 21:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452368AbiAXVZU (ORCPT ); Mon, 24 Jan 2022 16:25:20 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:52752 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443929AbiAXU7h (ORCPT ); Mon, 24 Jan 2022 15:59:37 -0500 Received: from smtp.kernel.org (relay.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 A80776131F; Mon, 24 Jan 2022 20:59:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BAA1C340E5; Mon, 24 Jan 2022 20:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057975; bh=fvSo4k2DvJm5t6/jjMZlDtic3DNw8fsnPxhjZI0j8sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aGhRZg4HifZEzRNNdokwj7TVtnkmiltIyfk4hRqMNOgS89CRi9x86+dKsjSiqYHM0 a4kak+wCK5wt+gHUxpdS5RAlcPjFAtCbYiwUR68da1MlxcJyVrngZJpGB+9UphcM/X 0AQu9UDf13vj29V8Ef3L3iYkdas97ewGfeGIBjRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcel Holtmann , Jackie Liu , Sasha Levin Subject: [PATCH 5.16 0140/1039] Bluetooth: fix uninitialized variables notify_evt Date: Mon, 24 Jan 2022 19:32:09 +0100 Message-Id: <20220124184129.882767912@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jackie Liu [ Upstream commit a27c519a816437ec92f0ffa3adbc168c2c08725b ] Coverity Scan report: [...] *** CID 1493985: Uninitialized variables (UNINIT) /net/bluetooth/hci_event.c: 4535 in hci_sync_conn_complete_evt() 4529 4530 /* Notify only in case of SCO over HCI transport data path which 4531 * is zero and non-zero value shall be non-HCI transport data path 4532 */ 4533 if (conn->codec.data_path =3D=3D 0) { 4534 if (hdev->notify) >>> CID 1493985: Uninitialized variables (UNINIT) >>> Using uninitialized value "notify_evt" when calling "*hdev->notify". 4535 hdev->notify(hdev, notify_evt); 4536 } 4537 4538 hci_connect_cfm(conn, ev->status); 4539 if (ev->status) 4540 hci_conn_del(conn); [...] Although only btusb uses air_mode, and he only handles HCI_NOTIFY_ENABLE_SC= O_CVSD and HCI_NOTIFY_ENABLE_SCO_TRANSP, there is still a very small chance that ev->air_mode is not equal to 0x2 and 0x3, but notify_evt is initialized to HCI_NOTIFY_ENABLE_SCO_CVSD or HCI_NOTIFY_ENABLE_SCO_TRANSP. the context is maybe not correct. Let us directly use the required function instead of re-initializing it, so as to restore the original logic and make the code more correct. Addresses-Coverity: ("Uninitialized variables") Fixes: f4f9fa0c07bb ("Bluetooth: Allow usb to auto-suspend when SCO use non= -HCI transport") Suggested-by: Marcel Holtmann Signed-off-by: Jackie Liu Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/hci_event.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 59f0691d907f6..6eba439487749 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -4445,7 +4445,6 @@ static void hci_sync_conn_complete_evt(struct hci_dev= *hdev, { struct hci_ev_sync_conn_complete *ev =3D (void *) skb->data; struct hci_conn *conn; - unsigned int notify_evt; =20 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); =20 @@ -4517,22 +4516,18 @@ static void hci_sync_conn_complete_evt(struct hci_d= ev *hdev, } =20 bt_dev_dbg(hdev, "SCO connected with air mode: %02x", ev->air_mode); - - switch (ev->air_mode) { - case 0x02: - notify_evt =3D HCI_NOTIFY_ENABLE_SCO_CVSD; - break; - case 0x03: - notify_evt =3D HCI_NOTIFY_ENABLE_SCO_TRANSP; - break; - } - /* Notify only in case of SCO over HCI transport data path which * is zero and non-zero value shall be non-HCI transport data path */ - if (conn->codec.data_path =3D=3D 0) { - if (hdev->notify) - hdev->notify(hdev, notify_evt); + if (conn->codec.data_path =3D=3D 0 && hdev->notify) { + switch (ev->air_mode) { + case 0x02: + hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_CVSD); + break; + case 0x03: + hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_TRANSP); + break; + } } =20 hci_connect_cfm(conn, ev->status); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37273C433EF for ; Mon, 24 Jan 2022 21:36:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352350AbiAXVdx (ORCPT ); Mon, 24 Jan 2022 16:33:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54560 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443972AbiAXU7l (ORCPT ); Mon, 24 Jan 2022 15:59:41 -0500 Received: from smtp.kernel.org (relay.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 74EA2B811A9; Mon, 24 Jan 2022 20:59:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A12CEC340E5; Mon, 24 Jan 2022 20:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057978; bh=cdNwSonj5VNSzh2UcDs3FM0H8dMbYOowL2ixBHf52k8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tag845MWwwZ54DRXIYiu6hiBBUhALNS14GlxUDT89jNPESHKQ06+/mFiKc6oeCNFv TP4BlL4lvv6DdQmnVjAf8MOk4nbDasFR/InzNXjWxil3/x/LbKjBQf7QOmN//To8Ay hZlHbz/RKy78Bd+uCF8vI+Xn3KRDxPxZRTRPQHDc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sven Eckelmann , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0141/1039] ath11k: Fix ETSI regd with weather radar overlap Date: Mon, 24 Jan 2022 19:32:10 +0100 Message-Id: <20220124184129.915234920@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sven Eckelmann [ Upstream commit 086c921a354089f209318501038d43c98d3f409f ] Some ETSI countries have a small overlap in the wireless-regdb with an ETSI channel (5590-5650). A good example is Australia: country AU: DFS-ETSI (2400 - 2483.5 @ 40), (36) (5150 - 5250 @ 80), (23), NO-OUTDOOR, AUTO-BW (5250 - 5350 @ 80), (20), NO-OUTDOOR, AUTO-BW, DFS (5470 - 5600 @ 80), (27), DFS (5650 - 5730 @ 80), (27), DFS (5730 - 5850 @ 80), (36) (57000 - 66000 @ 2160), (43), NO-OUTDOOR If the firmware (or the BDF) is shipped with these rules then there is only a 10 MHz overlap with the weather radar: * below: 5470 - 5590 * weather radar: 5590 - 5600 * above: (none for the rule "5470 - 5600 @ 80") There are several wrong assumption in the ath11k code: * there is always a valid range below the weather radar (actually: there could be no range below the weather radar range OR range could be smaller than 20 MHz) * intersected range in the weather radar range is valid (actually: the range could be smaller than 20 MHz) * range above weather radar is either empty or valid (actually: the range could be smaller than 20 MHz) These wrong assumption will lead in this example to a rule (5590 - 5600 @ 20), (N/A, 27), (600000 ms), DFS, AUTO-BW which is invalid according to is_valid_reg_rule() because the freq_diff is only 10 MHz but the max_bandwidth is set to 20 MHz. Which results in a rejection like: WARNING: at backports-20210222_001-4.4.60-b157d2276/net/wireless/reg.c:39= 84 [...] Call trace: [] reg_get_max_bandwidth+0x300/0x3a8 [cfg80211] [] regulatory_set_wiphy_regd_sync+0x3c/0x98 [cfg80211] [] ath11k_regd_update+0x1a8/0x210 [ath11k] [] ath11k_regd_update_work+0x18/0x20 [ath11k] [] process_one_work+0x1f8/0x340 [] worker_thread+0x25c/0x448 [] kthread+0xd0/0xd8 [] ret_from_fork+0x10/0x40 ath11k c000000.wifi: failed to perform regd update : -22 Invalid regulatory domain detected To avoid this, the algorithm has to be changed slightly. Instead of splitting a rule which overlaps with the weather radar range into 3 pieces and accepting the first two parts blindly, it must actually be checked for each piece whether it is a valid range. And only if it is valid, add it to the output array. When these checks are in place, the processed rules for AU would end up as country AU: DFS-ETSI (2400 - 2483 @ 40), (N/A, 36), (N/A) (5150 - 5250 @ 80), (6, 23), (N/A), NO-OUTDOOR, AUTO-BW (5250 - 5350 @ 80), (6, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW (5470 - 5590 @ 80), (6, 27), (0 ms), DFS, AUTO-BW (5650 - 5730 @ 80), (6, 27), (0 ms), DFS, AUTO-BW (5730 - 5850 @ 80), (6, 36), (N/A), AUTO-BW and will be accepted by the wireless regulatory code. Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Sven Eckelmann Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211112153116.1214421-1-sven@narfation.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/reg.c | 103 ++++++++++++++------------ 1 file changed, 56 insertions(+), 47 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/a= th/ath11k/reg.c index a66b5bdd21679..8606170ba80d5 100644 --- a/drivers/net/wireless/ath/ath11k/reg.c +++ b/drivers/net/wireless/ath/ath11k/reg.c @@ -456,6 +456,9 @@ ath11k_reg_adjust_bw(u16 start_freq, u16 end_freq, u16 = max_bw) { u16 bw; =20 + if (end_freq <=3D start_freq) + return 0; + bw =3D end_freq - start_freq; bw =3D min_t(u16, bw, max_bw); =20 @@ -463,8 +466,10 @@ ath11k_reg_adjust_bw(u16 start_freq, u16 end_freq, u16= max_bw) bw =3D 80; else if (bw >=3D 40 && bw < 80) bw =3D 40; - else if (bw < 40) + else if (bw >=3D 20 && bw < 40) bw =3D 20; + else + bw =3D 0; =20 return bw; } @@ -488,73 +493,77 @@ ath11k_reg_update_weather_radar_band(struct ath11k_ba= se *ab, struct cur_reg_rule *reg_rule, u8 *rule_idx, u32 flags, u16 max_bw) { + u32 start_freq; u32 end_freq; u16 bw; u8 i; =20 i =3D *rule_idx; =20 + /* there might be situations when even the input rule must be dropped */ + i--; + + /* frequencies below weather radar */ bw =3D ath11k_reg_adjust_bw(reg_rule->start_freq, ETSI_WEATHER_RADAR_BAND_LOW, max_bw); + if (bw > 0) { + i++; =20 - ath11k_reg_update_rule(regd->reg_rules + i, reg_rule->start_freq, - ETSI_WEATHER_RADAR_BAND_LOW, bw, - reg_rule->ant_gain, reg_rule->reg_power, - flags); + ath11k_reg_update_rule(regd->reg_rules + i, + reg_rule->start_freq, + ETSI_WEATHER_RADAR_BAND_LOW, bw, + reg_rule->ant_gain, reg_rule->reg_power, + flags); =20 - ath11k_dbg(ab, ATH11K_DBG_REG, - "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", - i + 1, reg_rule->start_freq, ETSI_WEATHER_RADAR_BAND_LOW, - bw, reg_rule->ant_gain, reg_rule->reg_power, - regd->reg_rules[i].dfs_cac_ms, - flags); - - if (reg_rule->end_freq > ETSI_WEATHER_RADAR_BAND_HIGH) - end_freq =3D ETSI_WEATHER_RADAR_BAND_HIGH; - else - end_freq =3D reg_rule->end_freq; + ath11k_dbg(ab, ATH11K_DBG_REG, + "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", + i + 1, reg_rule->start_freq, + ETSI_WEATHER_RADAR_BAND_LOW, bw, reg_rule->ant_gain, + reg_rule->reg_power, regd->reg_rules[i].dfs_cac_ms, + flags); + } =20 - bw =3D ath11k_reg_adjust_bw(ETSI_WEATHER_RADAR_BAND_LOW, end_freq, - max_bw); + /* weather radar frequencies */ + start_freq =3D max_t(u32, reg_rule->start_freq, + ETSI_WEATHER_RADAR_BAND_LOW); + end_freq =3D min_t(u32, reg_rule->end_freq, ETSI_WEATHER_RADAR_BAND_HIGH); =20 - i++; + bw =3D ath11k_reg_adjust_bw(start_freq, end_freq, max_bw); + if (bw > 0) { + i++; =20 - ath11k_reg_update_rule(regd->reg_rules + i, - ETSI_WEATHER_RADAR_BAND_LOW, end_freq, bw, - reg_rule->ant_gain, reg_rule->reg_power, - flags); + ath11k_reg_update_rule(regd->reg_rules + i, start_freq, + end_freq, bw, reg_rule->ant_gain, + reg_rule->reg_power, flags); =20 - regd->reg_rules[i].dfs_cac_ms =3D ETSI_WEATHER_RADAR_BAND_CAC_TIMEOUT; + regd->reg_rules[i].dfs_cac_ms =3D ETSI_WEATHER_RADAR_BAND_CAC_TIMEOUT; =20 - ath11k_dbg(ab, ATH11K_DBG_REG, - "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", - i + 1, ETSI_WEATHER_RADAR_BAND_LOW, end_freq, - bw, reg_rule->ant_gain, reg_rule->reg_power, - regd->reg_rules[i].dfs_cac_ms, - flags); - - if (end_freq =3D=3D reg_rule->end_freq) { - regd->n_reg_rules--; - *rule_idx =3D i; - return; + ath11k_dbg(ab, ATH11K_DBG_REG, + "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", + i + 1, start_freq, end_freq, bw, + reg_rule->ant_gain, reg_rule->reg_power, + regd->reg_rules[i].dfs_cac_ms, flags); } =20 + /* frequencies above weather radar */ bw =3D ath11k_reg_adjust_bw(ETSI_WEATHER_RADAR_BAND_HIGH, reg_rule->end_freq, max_bw); + if (bw > 0) { + i++; =20 - i++; - - ath11k_reg_update_rule(regd->reg_rules + i, ETSI_WEATHER_RADAR_BAND_HIGH, - reg_rule->end_freq, bw, - reg_rule->ant_gain, reg_rule->reg_power, - flags); + ath11k_reg_update_rule(regd->reg_rules + i, + ETSI_WEATHER_RADAR_BAND_HIGH, + reg_rule->end_freq, bw, + reg_rule->ant_gain, reg_rule->reg_power, + flags); =20 - ath11k_dbg(ab, ATH11K_DBG_REG, - "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", - i + 1, ETSI_WEATHER_RADAR_BAND_HIGH, reg_rule->end_freq, - bw, reg_rule->ant_gain, reg_rule->reg_power, - regd->reg_rules[i].dfs_cac_ms, - flags); + ath11k_dbg(ab, ATH11K_DBG_REG, + "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", + i + 1, ETSI_WEATHER_RADAR_BAND_HIGH, + reg_rule->end_freq, bw, reg_rule->ant_gain, + reg_rule->reg_power, regd->reg_rules[i].dfs_cac_ms, + flags); + } =20 *rule_idx =3D i; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A848C433EF for ; Mon, 24 Jan 2022 21:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1454884AbiAXVeE (ORCPT ); Mon, 24 Jan 2022 16:34:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54632 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443989AbiAXU7p (ORCPT ); Mon, 24 Jan 2022 15:59:45 -0500 Received: from smtp.kernel.org (relay.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 91CCEB8105C; Mon, 24 Jan 2022 20:59:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0F41C340E7; Mon, 24 Jan 2022 20:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057981; bh=mhCHDlztR2xaxoVSVKhjzH4y06h0vyKSkKPd3wDz+iw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gIrKXhgsv+b9KjJk0gRvR3qM965zFBRj2u1O75EUkHuL2SZpNS2Psd8LrBWjDC2PA dTmPeY7SL4jOOxejD5ULTCiCvwcumiKlsJVWB22BgkK1jmXYYWYsYET8WlrFmT4rDN h2bASIa7M2XvsauwJ/wu6oiNGLV/9odz0ImiBUkE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sven Eckelmann , Karthikeyan Kathirvel , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0142/1039] ath11k: clear the keys properly via DISABLE_KEY Date: Mon, 24 Jan 2022 19:32:11 +0100 Message-Id: <20220124184129.951911203@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Karthikeyan Kathirvel [ Upstream commit 436a4e88659842a7cf634d7cc088c8f2cc94ebf5 ] DISABLE_KEY sets the key_len to 0, firmware will not delete the keys if key_len is 0. Changing from security mode to open mode will cause mcast to be still encrypted without vdev restart. Set the proper key_len for DISABLE_KEY cmd to clear the keys in firmware. Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Reported-by: Sven Eckelmann Signed-off-by: Karthikeyan Kathirvel [sven@narfation.org: split into separate patches, clean up commit message] Signed-off-by: Sven Eckelmann Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211115100441.33771-1-sven@narfation.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/mac.c | 4 +--- drivers/net/wireless/ath/ath11k/wmi.c | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 1cc55602787bb..cdee7545e876a 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -3316,9 +3316,7 @@ static int ath11k_install_key(struct ath11k_vif *arvi= f, return 0; =20 if (cmd =3D=3D DISABLE_KEY) { - /* TODO: Check if FW expects value other than NONE for del */ - /* arg.key_cipher =3D WMI_CIPHER_NONE; */ - arg.key_len =3D 0; + arg.key_cipher =3D WMI_CIPHER_NONE; arg.key_data =3D NULL; goto install; } diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/a= th/ath11k/wmi.c index 04238c29419b5..621a63d6c8c6d 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -1689,7 +1689,8 @@ int ath11k_wmi_vdev_install_key(struct ath11k *ar, tlv =3D (struct wmi_tlv *)(skb->data + sizeof(*cmd)); tlv->header =3D FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_BYTE) | FIELD_PREP(WMI_TLV_LEN, key_len_aligned); - memcpy(tlv->value, (u8 *)arg->key_data, key_len_aligned); + if (arg->key_data) + memcpy(tlv->value, (u8 *)arg->key_data, key_len_aligned); =20 ret =3D ath11k_wmi_cmd_send(wmi, skb, WMI_VDEV_INSTALL_KEY_CMDID); if (ret) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57125C433FE for ; Mon, 24 Jan 2022 23:29:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849825AbiAXX0p (ORCPT ); Mon, 24 Jan 2022 18:26:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835925AbiAXWhr (ORCPT ); Mon, 24 Jan 2022 17:37:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 349ACC05486B; Mon, 24 Jan 2022 12:59:47 -0800 (PST) Received: from smtp.kernel.org (relay.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 A1A5CB811FB; Mon, 24 Jan 2022 20:59:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA694C340E5; Mon, 24 Jan 2022 20:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057984; bh=ZAAVcAfRBcJykvbAOIAdnOcapjFkib2az6P5abi5NX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b1nelFjewmZ37pP7RyZcGdO/Kbc4U0FVJ2vQ6Z8dSNoGGCtfcqIZ1PCanB8JeUu1v SUKAoqcPVNWuWGusJhJe/hQP49zAfRyAfJM07MmlXNg2kU7xMYq5fwB79s3l5Fi3e0 CD0RjJGU9KWsezBns5TL2B38aCOV3HQUkelkHgMQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Venkateswara Naralasetty , Sven Eckelmann , Karthikeyan Kathirvel , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0143/1039] ath11k: reset RSN/WPA present state for open BSS Date: Mon, 24 Jan 2022 19:32:12 +0100 Message-Id: <20220124184129.982882234@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Karthikeyan Kathirvel [ Upstream commit 64bc3aa02ae78b1fcb1b850e0eb1f0622002bfaa ] The ath11k driver is caching the information about RSN/WPA IE in the configured beacon template. The cached information is used during associations to figure out whether 4-way PKT/2-way GTK peer flags need to be set or not. But the code never cleared the state when no such IE was found. This can for example happen when moving from an WPA/RSN to an open setup. The (seemingly connected) peer was then not able to communicate over the link because the firmware assumed a different (encryption enabled) state for the peer. Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 Fixes: 01e34233c645 ("ath11k: fix wmi peer flags in peer assoc command") Cc: Venkateswara Naralasetty Reported-by: Sven Eckelmann Signed-off-by: Karthikeyan Kathirvel [sven@narfation.org: split into separate patches, clean up commit message] Signed-off-by: Sven Eckelmann Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211115100441.33771-2-sven@narfation.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/mac.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index cdee7545e876a..9ed7eb09bdb70 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -1137,11 +1137,15 @@ static int ath11k_mac_setup_bcn_tmpl(struct ath11k_= vif *arvif) =20 if (cfg80211_find_ie(WLAN_EID_RSN, ies, (skb_tail_pointer(bcn) - ies))) arvif->rsnie_present =3D true; + else + arvif->rsnie_present =3D false; =20 if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, WLAN_OUI_TYPE_MICROSOFT_WPA, ies, (skb_tail_pointer(bcn) - ies))) arvif->wpaie_present =3D true; + else + arvif->wpaie_present =3D false; =20 ret =3D ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10441C4321E for ; Mon, 24 Jan 2022 23:28:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849803AbiAXX0m (ORCPT ); Mon, 24 Jan 2022 18:26:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835930AbiAXWhs (ORCPT ); Mon, 24 Jan 2022 17:37:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A846C02B86F; Mon, 24 Jan 2022 12:59:48 -0800 (PST) Received: from smtp.kernel.org (relay.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 27FDC61317; Mon, 24 Jan 2022 20:59:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D51D4C340E5; Mon, 24 Jan 2022 20:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057987; bh=WZ3y8zEoAZCa0dRNCAuVij8BF5EdE9FA38K3vuCAJqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JkszGgGnFvjZPy0qaamFfoJWYt47ArtFGWJgizq334c0rGXbjnMDxdMZ0EuzAPq4l 37Pr3x3tshQ8BoO03EmGzR66LOY7PXyGF6cSVYRquoecNeq01+fhAVqOAh8CqJW/Gs AjShAvv4UuXT5AjiXu3fmmQOR0o8wNbqIuPzchmQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, oujiefeng , Jay Fang , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0144/1039] spi: hisi-kunpeng: Fix the debugfs directory name incorrect Date: Mon, 24 Jan 2022 19:32:13 +0100 Message-Id: <20220124184130.014248113@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: oujiefeng [ Upstream commit 40fafc8eca3f0d41b9dade5c10afb2dad723aad7 ] Change the debugfs directory name from hisi_spi65535 to hisi_spi0. Fixes: 2b2142f247eb ("spi: hisi-kunpeng: Add debugfs support") Signed-off-by: oujiefeng Signed-off-by: Jay Fang Link: https://lore.kernel.org/r/20211117012119.55558-1-f.fangjian@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/spi/spi-hisi-kunpeng.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-hisi-kunpeng.c b/drivers/spi/spi-hisi-kunpeng.c index 58b823a16fc4d..525cc0143a305 100644 --- a/drivers/spi/spi-hisi-kunpeng.c +++ b/drivers/spi/spi-hisi-kunpeng.c @@ -127,7 +127,6 @@ struct hisi_spi { void __iomem *regs; int irq; u32 fifo_len; /* depth of the FIFO buffer */ - u16 bus_num; =20 /* Current message transfer state info */ const void *tx; @@ -165,7 +164,10 @@ static int hisi_spi_debugfs_init(struct hisi_spi *hs) { char name[32]; =20 - snprintf(name, 32, "hisi_spi%d", hs->bus_num); + struct spi_controller *master; + + master =3D container_of(hs->dev, struct spi_controller, dev); + snprintf(name, 32, "hisi_spi%d", master->bus_num); hs->debugfs =3D debugfs_create_dir(name, NULL); if (!hs->debugfs) return -ENOMEM; @@ -467,7 +469,6 @@ static int hisi_spi_probe(struct platform_device *pdev) hs =3D spi_controller_get_devdata(master); hs->dev =3D dev; hs->irq =3D irq; - hs->bus_num =3D pdev->id; =20 hs->regs =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(hs->regs)) @@ -490,7 +491,7 @@ static int hisi_spi_probe(struct platform_device *pdev) master->use_gpio_descriptors =3D true; master->mode_bits =3D SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; master->bits_per_word_mask =3D SPI_BPW_RANGE_MASK(4, 32); - master->bus_num =3D hs->bus_num; + master->bus_num =3D pdev->id; master->setup =3D hisi_spi_setup; master->cleanup =3D hisi_spi_cleanup; master->transfer_one =3D hisi_spi_transfer_one; @@ -506,15 +507,15 @@ static int hisi_spi_probe(struct platform_device *pde= v) return ret; } =20 - if (hisi_spi_debugfs_init(hs)) - dev_info(dev, "failed to create debugfs dir\n"); - ret =3D spi_register_controller(master); if (ret) { dev_err(dev, "failed to register spi master, ret=3D%d\n", ret); return ret; } =20 + if (hisi_spi_debugfs_init(hs)) + dev_info(dev, "failed to create debugfs dir\n"); + dev_info(dev, "hw version:0x%x max-freq:%u kHz\n", readl(hs->regs + HISI_SPI_VERSION), master->max_speed_hz / 1000); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE54DC433F5 for ; Mon, 24 Jan 2022 23:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849581AbiAXX0L (ORCPT ); Mon, 24 Jan 2022 18:26:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835932AbiAXWhs (ORCPT ); Mon, 24 Jan 2022 17:37:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EF55C02B870; Mon, 24 Jan 2022 12:59:51 -0800 (PST) Received: from smtp.kernel.org (relay.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 1EFC260916; Mon, 24 Jan 2022 20:59:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEAD7C340E5; Mon, 24 Jan 2022 20:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057990; bh=BQUSTbqeX9gvk8ph/o/unFOemqAWTvtHM8tjaNdqpjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kd9bv/0zP7ogynckARtOsxjSU042MinoN4GjwKf8aEHE4B1yAzJT818BVI5A9YSBq PwOwFHum9z3naYNtQaru9F0Kph0+O5+pN+hVY/cJxldCYUOfK/xacZUTLwfNpwskec qTrW3dlaS9sT/pUkEqRvj+DUC9LDuCowXFIhKEvY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sumit Garg , Jens Wiklander , Sasha Levin Subject: [PATCH 5.16 0145/1039] tee: fix put order in teedev_close_context() Date: Mon, 24 Jan 2022 19:32:14 +0100 Message-Id: <20220124184130.045366973@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jens Wiklander [ Upstream commit f18397ab3ae23e8e43bba9986e66af6d4497f2ad ] Prior to this patch was teedev_close_context() calling tee_device_put() before teedev_ctx_put() leading to teedev_ctx_release() accessing ctx->teedev just after the reference counter was decreased on the teedev. Fix this by calling teedev_ctx_put() before tee_device_put(). Fixes: 217e0250cccb ("tee: use reference counting for tee_context") Reviewed-by: Sumit Garg Signed-off-by: Jens Wiklander Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tee/tee_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index 2b37bc408fc3d..85102d12d7169 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -98,8 +98,10 @@ void teedev_ctx_put(struct tee_context *ctx) =20 static void teedev_close_context(struct tee_context *ctx) { - tee_device_put(ctx->teedev); + struct tee_device *teedev =3D ctx->teedev; + teedev_ctx_put(ctx); + tee_device_put(teedev); } =20 static int tee_open(struct inode *inode, struct file *filp) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24687C433F5 for ; Mon, 24 Jan 2022 23:29:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849552AbiAXX0I (ORCPT ); Mon, 24 Jan 2022 18:26:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835934AbiAXWhs (ORCPT ); Mon, 24 Jan 2022 17:37:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F9B5C02B871; Mon, 24 Jan 2022 12:59:54 -0800 (PST) Received: from smtp.kernel.org (relay.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 0D67E612E9; Mon, 24 Jan 2022 20:59:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7BCEC340E5; Mon, 24 Jan 2022 20:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057993; bh=Awjc1r/8AS2b08K/MPXxdKLbb1VLsp2k2khdbnO2o44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CrBTqfhcUQz28eMRefPkliTE6ZC9NJXM5zyF/QNmx9zIz3IMN6iGU8Yu47w5Ouw7p ZG9EOWHqQgBcrMnXCZ9IGCO8RDsCTqr1jDRr0GPA2iJIk4A0wHaBrJl0d9OshlbG8C +2O4CTD0Uamx24HTRzsbhkqyuKH44UkKF9h8eMoU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Andrzej Siewior , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.16 0146/1039] kernel/locking: Use a pointer in ww_mutex_trylock(). Date: Mon, 24 Jan 2022 19:32:15 +0100 Message-Id: <20220124184130.078742854@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sebastian Andrzej Siewior [ Upstream commit 2202e15b2b1a946ce760d96748cd7477589701ab ] mutex_acquire_nest() expects a pointer, pass the pointer. Fixes: 12235da8c80a1 ("kernel/locking: Add context to ww_mutex_trylock()") Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20211104122706.frk52zxbjorso2kv@linutronix.= de Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/locking/ww_rt_mutex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/locking/ww_rt_mutex.c b/kernel/locking/ww_rt_mutex.c index 0e00205cf467a..d1473c624105c 100644 --- a/kernel/locking/ww_rt_mutex.c +++ b/kernel/locking/ww_rt_mutex.c @@ -26,7 +26,7 @@ int ww_mutex_trylock(struct ww_mutex *lock, struct ww_acq= uire_ctx *ww_ctx) =20 if (__rt_mutex_trylock(&rtm->rtmutex)) { ww_mutex_set_context_fastpath(lock, ww_ctx); - mutex_acquire_nest(&rtm->dep_map, 0, 1, ww_ctx->dep_map, _RET_IP_); + mutex_acquire_nest(&rtm->dep_map, 0, 1, &ww_ctx->dep_map, _RET_IP_); return 1; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AF5BC43219 for ; Mon, 24 Jan 2022 23:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849735AbiAXX0d (ORCPT ); Mon, 24 Jan 2022 18:26:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835938AbiAXWht (ORCPT ); Mon, 24 Jan 2022 17:37:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18B25C0E9BB1; Mon, 24 Jan 2022 12:59:59 -0800 (PST) Received: from smtp.kernel.org (relay.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 D395AB80CCF; Mon, 24 Jan 2022 20:59:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD2C5C340E5; Mon, 24 Jan 2022 20:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057996; bh=zsvG9gsyB/+katNNGqHNLCo0NLdIzDOFimUQUDWBBhU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=itgGcWSOPDe6suWulrWk+sM3/VmBo7IL2SOUVFB5XqMeBDHOHvJlTE7LH+ImyHNQm 71Ytle8jrxNHlaHy0K9LUK3cV1v7yQ9j8H26YsyBtWidJfZXaUo3lwtLcNpZUXdwB9 V6Tvfu7jPDTf6uoeS8fwPlZaLU+DF/qPmEc1gwIg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Alexander Aring , David Teigland , Sasha Levin Subject: [PATCH 5.16 0147/1039] fs: dlm: fix build with CONFIG_IPV6 disabled Date: Mon, 24 Jan 2022 19:32:16 +0100 Message-Id: <20220124184130.110761736@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Aring [ Upstream commit 1b9beda83e27a0c2cd75d1cb743c297c7b36c844 ] This patch will surround the AF_INET6 case in sk_error_report() of dlm with a #if IS_ENABLED(CONFIG_IPV6). The field sk->sk_v6_daddr is not defined when CONFIG_IPV6 is disabled. If CONFIG_IPV6 is disabled, the socket creation with AF_INET6 should already fail because a runtime check if AF_INET6 is registered. However if there is the possibility that AF_INET6 is set as sk_family the sk_error_report() callback will print then an invalid family type error. Reported-by: kernel test robot Fixes: 4c3d90570bcc ("fs: dlm: don't call kernel_getpeername() in error_rep= ort()") Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/dlm/lowcomms.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 7b1c5f05a988b..7a8efce1c343e 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -612,6 +612,7 @@ static void lowcomms_error_report(struct sock *sk) ntohs(inet->inet_dport), sk->sk_err, sk->sk_err_soft); break; +#if IS_ENABLED(CONFIG_IPV6) case AF_INET6: printk_ratelimited(KERN_ERR "dlm: node %d: socket error " "sending to node %d at %pI6c, " @@ -620,6 +621,7 @@ static void lowcomms_error_report(struct sock *sk) ntohs(inet->inet_dport), sk->sk_err, sk->sk_err_soft); break; +#endif default: printk_ratelimited(KERN_ERR "dlm: node %d: socket error " "invalid socket family %d set, " --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E02CAC433EF for ; Mon, 24 Jan 2022 23:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849638AbiAXX0V (ORCPT ); Mon, 24 Jan 2022 18:26:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835941AbiAXWhu (ORCPT ); Mon, 24 Jan 2022 17:37:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 805E1C0E9BB2; Mon, 24 Jan 2022 13:00:00 -0800 (PST) Received: from smtp.kernel.org (relay.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 22488611DA; Mon, 24 Jan 2022 21:00:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03C52C340E5; Mon, 24 Jan 2022 20:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057999; bh=bLax4OLcXZabgWm10AYP5WuGHuGUFlNoXdOHjo1yZi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mnl6gY1HB/WV1k7Hq198i1TEB5/TxIE3t8KMT4OIdWEUpb+TEJetk+gpjQ7P6upNK rCH7d8IcdI1yyoyp2oUb6Ix7eSf/ufk9hlJmtsdfUwr+TKIW/gDRUhsfwirOa/1Y23 5qXPNQMyzqY7XR1sx62/nbDSmeh/cM5ArYvKlRFo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , Douglas Anderson , Sasha Levin Subject: [PATCH 5.16 0148/1039] drm/dp: Dont read back backlight mode in drm_edp_backlight_enable() Date: Mon, 24 Jan 2022 19:32:17 +0100 Message-Id: <20220124184130.141392342@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lyude Paul [ Upstream commit 646596485e1ed2182adf293dfd5aec4a96c46330 ] As it turns out, apparently some machines will actually leave additional backlight functionality like dynamic backlight control on before the OS loads. Currently we don't take care to disable unsupported features when writing back the backlight mode, which can lead to some rather strange looking behavior when adjusting the backlight. So, let's fix this by just not reading back the current backlight mode on initial enable. I don't think there should really be any downsides to this, and this will ensure we don't leave any unsupported functionality enabled. This should fix at least one (but not all) of the issues seen with DPCD backlight support on fi-bdw-samus v5: * Just avoid reading back DPCD register - Doug Anderson Signed-off-by: Lyude Paul Fixes: 867cf9cd73c3 ("drm/dp: Extract i915's eDP backlight code into DRM he= lpers") Reviewed-by: Douglas Anderson Link: https://patchwork.freedesktop.org/patch/msgid/20211105183342.130810-4= -lyude@redhat.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/drm_dp_helper.c | 40 ++++++++++----------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helpe= r.c index 4d0d1e8e51fa7..db7db839e42d1 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -3246,27 +3246,13 @@ int drm_edp_backlight_enable(struct drm_dp_aux *aux= , const struct drm_edp_backli const u16 level) { int ret; - u8 dpcd_buf, new_dpcd_buf; + u8 dpcd_buf =3D DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD; =20 - ret =3D drm_dp_dpcd_readb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, &dpcd_= buf); - if (ret !=3D 1) { - drm_dbg_kms(aux->drm_dev, - "%s: Failed to read backlight mode: %d\n", aux->name, ret); - return ret < 0 ? ret : -EIO; - } - - new_dpcd_buf =3D dpcd_buf; - - if ((dpcd_buf & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) !=3D DP_EDP_BACKLIGHT= _CONTROL_MODE_DPCD) { - new_dpcd_buf &=3D ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK; - new_dpcd_buf |=3D DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD; - - if (bl->pwmgen_bit_count) { - ret =3D drm_dp_dpcd_writeb(aux, DP_EDP_PWMGEN_BIT_COUNT, bl->pwmgen_bit= _count); - if (ret !=3D 1) - drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux pwmgen bit count: %= d\n", - aux->name, ret); - } + if (bl->pwmgen_bit_count) { + ret =3D drm_dp_dpcd_writeb(aux, DP_EDP_PWMGEN_BIT_COUNT, bl->pwmgen_bit_= count); + if (ret !=3D 1) + drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux pwmgen bit count: %d= \n", + aux->name, ret); } =20 if (bl->pwm_freq_pre_divider) { @@ -3276,16 +3262,14 @@ int drm_edp_backlight_enable(struct drm_dp_aux *aux= , const struct drm_edp_backli "%s: Failed to write aux backlight frequency: %d\n", aux->name, ret); else - new_dpcd_buf |=3D DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE; + dpcd_buf |=3D DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE; } =20 - if (new_dpcd_buf !=3D dpcd_buf) { - ret =3D drm_dp_dpcd_writeb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, new_= dpcd_buf); - if (ret !=3D 1) { - drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux backlight mode: %d\n= ", - aux->name, ret); - return ret < 0 ? ret : -EIO; - } + ret =3D drm_dp_dpcd_writeb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, dpcd_= buf); + if (ret !=3D 1) { + drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux backlight mode: %d\n", + aux->name, ret); + return ret < 0 ? ret : -EIO; } =20 ret =3D drm_edp_backlight_set_level(aux, bl, level); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 464C8C433F5 for ; Mon, 24 Jan 2022 21:36:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352188AbiAXVeQ (ORCPT ); Mon, 24 Jan 2022 16:34:16 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50862 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444150AbiAXVAI (ORCPT ); Mon, 24 Jan 2022 16:00:08 -0500 Received: from smtp.kernel.org (relay.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 6646C611DA; Mon, 24 Jan 2022 21:00:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24851C340E5; Mon, 24 Jan 2022 21:00:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058005; bh=kucaGnne7cqZQPDqTUhLgDG6belnp+ejA+u9CyOrx/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HVb/01x37fk59ltfTuQxIqFiLS9sVvKG/bmE8fnFPNTGrtIEJzJYMvFcf7Joz73f2 Djfpnfm2Pir4WaMP4IXD35emQcxy0uEoIPtHF5AvqOjwRz8IGv6yBijNxxgv+wO8Xo 5VGV+mv1txw3Lwx7yBxkyO7pjmcybFeU22mzETo0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tirthendu Sarkar , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.16 0149/1039] selftests/bpf: Fix xdpxceiver failures for no hugepages Date: Mon, 24 Jan 2022 19:32:18 +0100 Message-Id: <20220124184130.171764698@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tirthendu Sarkar [ Upstream commit dd7f091fd22b1dce6c20e8f7769aa068ed88ac6d ] xsk_configure_umem() needs hugepages to work in unaligned mode. So when hugepages are not configured, 'unaligned' tests should be skipped which is determined by the helper function hugepages_present(). This function erroneously returns true with MAP_NORESERVE flag even when no hugepages are configured. The removal of this flag fixes the issue. The test TEST_TYPE_UNALIGNED_INV_DESC also needs to be skipped when there are no hugepages. However, this was not skipped as there was no check for presence of hugepages and hence was failing. The check to skip the test has now been added. Fixes: a4ba98dd0c69 (selftests: xsk: Add test for unaligned mode) Signed-off-by: Tirthendu Sarkar Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20211117123613.22288-1-tirthendu.sarkar@i= ntel.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/bpf/xdpxceiver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selft= ests/bpf/xdpxceiver.c index 6c7cf8aadc792..621342ec30c48 100644 --- a/tools/testing/selftests/bpf/xdpxceiver.c +++ b/tools/testing/selftests/bpf/xdpxceiver.c @@ -1219,7 +1219,7 @@ static bool hugepages_present(struct ifobject *ifobje= ct) void *bufs; =20 bufs =3D mmap(NULL, mmap_sz, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE | MAP_HUGETLB, -1, 0); + MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0); if (bufs =3D=3D MAP_FAILED) return false; =20 @@ -1366,6 +1366,10 @@ static void run_pkt_test(struct test_spec *test, enu= m test_mode mode, enum test_ testapp_invalid_desc(test); break; case TEST_TYPE_UNALIGNED_INV_DESC: + if (!hugepages_present(test->ifobj_tx)) { + ksft_test_result_skip("No 2M huge pages present.\n"); + return; + } test_spec_set_name(test, "UNALIGNED_INV_DESC"); test->ifobj_tx->umem->unaligned_mode =3D true; test->ifobj_rx->umem->unaligned_mode =3D true; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74384C4332F for ; Mon, 24 Jan 2022 23:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849708AbiAXX0b (ORCPT ); Mon, 24 Jan 2022 18:26:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835944AbiAXWht (ORCPT ); Mon, 24 Jan 2022 17:37:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2A03C0E9BB6; Mon, 24 Jan 2022 13:00:09 -0800 (PST) Received: from smtp.kernel.org (relay.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 7209360B03; Mon, 24 Jan 2022 21:00:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52773C340E7; Mon, 24 Jan 2022 21:00:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058008; bh=ZJHWMUCWg6+N2cEePcY7AEKzfwzAQ9WRJqqZIo2gEFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJjIRKV1uz5AoJ2tLkOM91W9VAyNtNLQhghQ7C+04UeiL3vD1038Fm3td41VcVLvB GxmY3ji/I2aE5WzBQcYrlT4eRE1kiIU2hQjnrAhcwZMyI6/Ii2gTcDxyR4ynOd3PvV y7OVkqGTsA65SAm5og6G0jW9l0N0uQfMhzHFRZc8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeremy Kerr , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0150/1039] mctp/test: Update refcount checking in route fragment tests Date: Mon, 24 Jan 2022 19:32:19 +0100 Message-Id: <20220124184130.204931581@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeremy Kerr [ Upstream commit f6ef47e5bdc6f652176e433b02317fc83049f8d7 ] In 99ce45d5e, we moved a route refcount decrement from mctp_do_fragment_route into the caller. This invalidates the assumption that the route test makes about refcount behaviour, so the route tests fail. This change fixes the test case to suit the new refcount behaviour. Fixes: 99ce45d5e7db ("mctp: Implement extended addressing") Signed-off-by: Jeremy Kerr Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/mctp/test/route-test.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/net/mctp/test/route-test.c b/net/mctp/test/route-test.c index 36fac3daf86a4..86ad15abf8978 100644 --- a/net/mctp/test/route-test.c +++ b/net/mctp/test/route-test.c @@ -150,11 +150,6 @@ static void mctp_test_fragment(struct kunit *test) rt =3D mctp_test_create_route(&init_net, NULL, 10, mtu); KUNIT_ASSERT_TRUE(test, rt); =20 - /* The refcount would usually be incremented as part of a route lookup, - * but we're setting the route directly here. - */ - refcount_inc(&rt->rt.refs); - rc =3D mctp_do_fragment_route(&rt->rt, skb, mtu, MCTP_TAG_OWNER); KUNIT_EXPECT_FALSE(test, rc); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA765C35274 for ; Mon, 24 Jan 2022 21:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452478AbiAXVZn (ORCPT ); Mon, 24 Jan 2022 16:25:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50964 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444177AbiAXVAM (ORCPT ); Mon, 24 Jan 2022 16:00:12 -0500 Received: from smtp.kernel.org (relay.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 8690660916; Mon, 24 Jan 2022 21:00:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A4FBC340E5; Mon, 24 Jan 2022 21:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058012; bh=bTwDCjyp1FfNlpPdJ01CRAf9JzQtnnaDyzG6MorJD20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XXQIHGeLBZkm7hOdrbkTwjs0R/nYoBsOz1m65fFkyiELlgecuYFYjCmJy89nKcH2j ob7odbtOAdsK9i5FsgaIQ2u0l/tOAUXIMoNfxLhyYufvsPrNZgr6AjlYPgDgoy1M6p juLOGvfQq9H5fQGw2Mghi7QSNaPvI+TurUtRN/Jo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Hans de Goede , Sasha Levin Subject: [PATCH 5.16 0151/1039] drm/vboxvideo: fix a NULL vs IS_ERR() check Date: Mon, 24 Jan 2022 19:32:20 +0100 Message-Id: <20220124184130.236313729@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit cebbb5c46d0cb0615fd0c62dea9b44273d0a9780 ] The devm_gen_pool_create() function never returns NULL, it returns error pointers. Fixes: 4cc9b565454b ("drm/vboxvideo: Use devm_gen_pool_create") Signed-off-by: Dan Carpenter Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Link: https://patchwork.freedesktop.org/patch/msgid/20211118111233.GA1147@k= ili Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vboxvideo/vbox_main.c b/drivers/gpu/drm/vboxvi= deo/vbox_main.c index f28779715ccda..c9e8b3a63c621 100644 --- a/drivers/gpu/drm/vboxvideo/vbox_main.c +++ b/drivers/gpu/drm/vboxvideo/vbox_main.c @@ -127,8 +127,8 @@ int vbox_hw_init(struct vbox_private *vbox) /* Create guest-heap mem-pool use 2^4 =3D 16 byte chunks */ vbox->guest_pool =3D devm_gen_pool_create(vbox->ddev.dev, 4, -1, "vboxvideo-accel"); - if (!vbox->guest_pool) - return -ENOMEM; + if (IS_ERR(vbox->guest_pool)) + return PTR_ERR(vbox->guest_pool); =20 ret =3D gen_pool_add_virt(vbox->guest_pool, (unsigned long)vbox->guest_heap, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD7ABC4332F for ; Mon, 24 Jan 2022 21:37:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455353AbiAXVfR (ORCPT ); Mon, 24 Jan 2022 16:35:17 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54896 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444201AbiAXVAT (ORCPT ); Mon, 24 Jan 2022 16:00:19 -0500 Received: from smtp.kernel.org (relay.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 35D25B811FB; Mon, 24 Jan 2022 21:00:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F51AC340E5; Mon, 24 Jan 2022 21:00:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058015; bh=rQ607IDeFU2nWSVgGXcNI0jU6mG3sRhHTCFIHXP0PwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=02cnn9g3tm6G5Yke4Y0cOmSh98cuFGucDmqAsHFRDBs/LS7CZ0uUDKnhKkku9kw91 5Mrl7IHxu5fkCPvUE5vXok4PUy78HYbh+E3+0IXu10j+fzvmw2pJA6PM/Fm7epKZez S0+o9E8HMjYjE4739Mo1iECZh437OrV0sSAbHvS4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gong , Jouni Malinen , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0152/1039] ath11k: set correct NL80211_FEATURE_DYNAMIC_SMPS for WCN6855 Date: Mon, 24 Jan 2022 19:32:21 +0100 Message-Id: <20220124184130.267861766@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wen Gong [ Upstream commit 82c434c103408842a87404e873992b7698b6df2b ] Commit 6f4d70308e5e ("ath11k: support SMPS configuration for 6 GHz") changed "if (ht_cap & WMI_HT_CAP_DYNAMIC_SMPS)" to "if (ht_cap & WMI_HT_CAP_DYNAMIC_SMPS || ar->supports_6ghz)" which means NL80211_FEATURE_DYNAMIC_SMPS is enabled for all chips which support 6 GHz. However, WCN6855 supports 6 GHz but it does not support feature NL80211_FEATURE_DYNAMIC_SMPS, and this can lead to MU-MIMO test failures for WCN6855. Disable NL80211_FEATURE_DYNAMIC_SMPS for WCN6855 since its ht_cap does not support WMI_HT_CAP_DYNAMIC_SMPS. Enable the feature only on QCN9074 as that= 's the only other device supporting 6 GHz band. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ= _LITE-1 Signed-off-by: Wen Gong Signed-off-by: Jouni Malinen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20210914163726.38604-3-jouni@codeaurora.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/core.c | 5 +++++ drivers/net/wireless/ath/ath11k/hw.h | 1 + drivers/net/wireless/ath/ath11k/mac.c | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/= ath/ath11k/core.c index b5a2af3ffc3e1..7ee2ccc49c747 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -82,6 +82,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = =3D { .fix_l1ss =3D true, .max_tx_ring =3D DP_TCL_NUM_RING_MAX, .hal_params =3D &ath11k_hw_hal_params_ipq8074, + .supports_dynamic_smps_6ghz =3D false, }, { .hw_rev =3D ATH11K_HW_IPQ6018_HW10, @@ -131,6 +132,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .fix_l1ss =3D true, .max_tx_ring =3D DP_TCL_NUM_RING_MAX, .hal_params =3D &ath11k_hw_hal_params_ipq8074, + .supports_dynamic_smps_6ghz =3D false, }, { .name =3D "qca6390 hw2.0", @@ -179,6 +181,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .fix_l1ss =3D true, .max_tx_ring =3D DP_TCL_NUM_RING_MAX_QCA6390, .hal_params =3D &ath11k_hw_hal_params_qca6390, + .supports_dynamic_smps_6ghz =3D false, }, { .name =3D "qcn9074 hw1.0", @@ -227,6 +230,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .fix_l1ss =3D true, .max_tx_ring =3D DP_TCL_NUM_RING_MAX, .hal_params =3D &ath11k_hw_hal_params_ipq8074, + .supports_dynamic_smps_6ghz =3D true, }, { .name =3D "wcn6855 hw2.0", @@ -275,6 +279,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .fix_l1ss =3D false, .max_tx_ring =3D DP_TCL_NUM_RING_MAX_QCA6390, .hal_params =3D &ath11k_hw_hal_params_qca6390, + .supports_dynamic_smps_6ghz =3D false, }, }; =20 diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/at= h/ath11k/hw.h index 19223d36846e8..6dcac596e3fe5 100644 --- a/drivers/net/wireless/ath/ath11k/hw.h +++ b/drivers/net/wireless/ath/ath11k/hw.h @@ -176,6 +176,7 @@ struct ath11k_hw_params { bool fix_l1ss; u8 max_tx_ring; const struct ath11k_hw_hal_params *hal_params; + bool supports_dynamic_smps_6ghz; }; =20 struct ath11k_hw_ops { diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 9ed7eb09bdb70..821332cbeb5de 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -7674,7 +7674,8 @@ static int __ath11k_mac_register(struct ath11k *ar) * for each band for a dual band capable radio. It will be tricky to * handle it when the ht capability different for each band. */ - if (ht_cap & WMI_HT_CAP_DYNAMIC_SMPS || ar->supports_6ghz) + if (ht_cap & WMI_HT_CAP_DYNAMIC_SMPS || + (ar->supports_6ghz && ab->hw_params.supports_dynamic_smps_6ghz)) ar->hw->wiphy->features |=3D NL80211_FEATURE_DYNAMIC_SMPS; =20 ar->hw->wiphy->max_scan_ssids =3D WLAN_SCAN_PARAMS_MAX_SSID; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1897C433F5 for ; Mon, 24 Jan 2022 23:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849624AbiAXX0Q (ORCPT ); Mon, 24 Jan 2022 18:26:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835948AbiAXWhu (ORCPT ); Mon, 24 Jan 2022 17:37:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1BAEC0E9BB7; Mon, 24 Jan 2022 13:00:20 -0800 (PST) Received: from smtp.kernel.org (relay.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 67A7FB81063; Mon, 24 Jan 2022 21:00:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86B27C340E5; Mon, 24 Jan 2022 21:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058018; bh=NmOrhhpUlJ8q2hU8Rq29vfhkjMVwm9CScdOI61ffnmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nd/73ALCP+gDY9BQN3tcbdPkV9wIkl82E4Z4OrcgESatKBw1ib1L1DFwNXigZHhcZ Vnyl53J+WMlVwVIkerw6tpDcE9R1Ewau75U8sOLKmOudZ9BxYrA4/0vojU3gyydPhQ tZnwRBgOQTmC4Fr4uqHAvY4/lyn3aodZlIc58ZUg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pradeep Kumar Chitrapu , Sriram R , Jouni Malinen , P Praneesh , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0153/1039] ath11k: allocate dst ring descriptors from cacheable memory Date: Mon, 24 Jan 2022 19:32:22 +0100 Message-Id: <20220124184130.297143262@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: P Praneesh [ Upstream commit 6452f0a3d5651bb7edfd9c709e78973aaa4d3bfc ] tcl_data and reo_dst rings are currently being allocated using dma_allocate_coherent() which is non cacheable. Allocating ring memory from cacheable memory area allows cached descriptor access and prefetch next descriptors to optimize CPU usage during descriptor processing on NAPI. Based on the hardware param we can enable or disable this feature for the corresponding platform. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1.r2-00012-QCAHKSWPL_SILICONZ-1 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01695-QCAHKSWPL_SILICONZ-1 Co-developed-by: Pradeep Kumar Chitrapu Signed-off-by: Pradeep Kumar Chitrapu Co-developed-by: Sriram R Signed-off-by: Sriram R Signed-off-by: Jouni Malinen Signed-off-by: P Praneesh Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1630560820-21905-3-git-send-email-ppranees@= codeaurora.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/core.c | 5 ++++ drivers/net/wireless/ath/ath11k/dp.c | 38 ++++++++++++++++++++++---- drivers/net/wireless/ath/ath11k/dp.h | 1 + drivers/net/wireless/ath/ath11k/hal.c | 28 +++++++++++++++++-- drivers/net/wireless/ath/ath11k/hal.h | 1 + drivers/net/wireless/ath/ath11k/hw.h | 1 + 6 files changed, 67 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/= ath/ath11k/core.c index 7ee2ccc49c747..280f1c6411aeb 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -83,6 +83,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = =3D { .max_tx_ring =3D DP_TCL_NUM_RING_MAX, .hal_params =3D &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz =3D false, + .alloc_cacheable_memory =3D true, }, { .hw_rev =3D ATH11K_HW_IPQ6018_HW10, @@ -133,6 +134,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .max_tx_ring =3D DP_TCL_NUM_RING_MAX, .hal_params =3D &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz =3D false, + .alloc_cacheable_memory =3D true, }, { .name =3D "qca6390 hw2.0", @@ -182,6 +184,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .max_tx_ring =3D DP_TCL_NUM_RING_MAX_QCA6390, .hal_params =3D &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz =3D false, + .alloc_cacheable_memory =3D false, }, { .name =3D "qcn9074 hw1.0", @@ -231,6 +234,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .max_tx_ring =3D DP_TCL_NUM_RING_MAX, .hal_params =3D &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz =3D true, + .alloc_cacheable_memory =3D true, }, { .name =3D "wcn6855 hw2.0", @@ -280,6 +284,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .max_tx_ring =3D DP_TCL_NUM_RING_MAX_QCA6390, .hal_params =3D &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz =3D false, + .alloc_cacheable_memory =3D false, }, }; =20 diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/at= h/ath11k/dp.c index 8baaeeb8cf821..8058b56028ded 100644 --- a/drivers/net/wireless/ath/ath11k/dp.c +++ b/drivers/net/wireless/ath/ath11k/dp.c @@ -101,8 +101,11 @@ void ath11k_dp_srng_cleanup(struct ath11k_base *ab, st= ruct dp_srng *ring) if (!ring->vaddr_unaligned) return; =20 - dma_free_coherent(ab->dev, ring->size, ring->vaddr_unaligned, - ring->paddr_unaligned); + if (ring->cached) + kfree(ring->vaddr_unaligned); + else + dma_free_coherent(ab->dev, ring->size, ring->vaddr_unaligned, + ring->paddr_unaligned); =20 ring->vaddr_unaligned =3D NULL; } @@ -222,6 +225,7 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struct= dp_srng *ring, int entry_sz =3D ath11k_hal_srng_get_entrysize(ab, type); int max_entries =3D ath11k_hal_srng_get_max_entries(ab, type); int ret; + bool cached =3D false; =20 if (max_entries < 0 || entry_sz < 0) return -EINVAL; @@ -230,9 +234,28 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struc= t dp_srng *ring, num_entries =3D max_entries; =20 ring->size =3D (num_entries * entry_sz) + HAL_RING_BASE_ALIGN - 1; - ring->vaddr_unaligned =3D dma_alloc_coherent(ab->dev, ring->size, - &ring->paddr_unaligned, - GFP_KERNEL); + + if (ab->hw_params.alloc_cacheable_memory) { + /* Allocate the reo dst and tx completion rings from cacheable memory */ + switch (type) { + case HAL_REO_DST: + cached =3D true; + break; + default: + cached =3D false; + } + + if (cached) { + ring->vaddr_unaligned =3D kzalloc(ring->size, GFP_KERNEL); + ring->paddr_unaligned =3D virt_to_phys(ring->vaddr_unaligned); + } + } + + if (!cached) + ring->vaddr_unaligned =3D dma_alloc_coherent(ab->dev, ring->size, + &ring->paddr_unaligned, + GFP_KERNEL); + if (!ring->vaddr_unaligned) return -ENOMEM; =20 @@ -292,6 +315,11 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struc= t dp_srng *ring, return -EINVAL; } =20 + if (cached) { + params.flags |=3D HAL_SRNG_FLAGS_CACHED; + ring->cached =3D 1; + } + ret =3D ath11k_hal_srng_setup(ab, type, ring_num, mac_id, ¶ms); if (ret < 0) { ath11k_warn(ab, "failed to setup srng: %d ring_id %d\n", diff --git a/drivers/net/wireless/ath/ath11k/dp.h b/drivers/net/wireless/at= h/ath11k/dp.h index f524d19aca349..a4c36a9be338a 100644 --- a/drivers/net/wireless/ath/ath11k/dp.h +++ b/drivers/net/wireless/ath/ath11k/dp.h @@ -64,6 +64,7 @@ struct dp_srng { dma_addr_t paddr; int size; u32 ring_id; + u8 cached; }; =20 struct dp_rxdma_ring { diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/a= th/ath11k/hal.c index eaa0edca55761..f04edafbd0f15 100644 --- a/drivers/net/wireless/ath/ath11k/hal.c +++ b/drivers/net/wireless/ath/ath11k/hal.c @@ -627,6 +627,21 @@ u32 *ath11k_hal_srng_dst_peek(struct ath11k_base *ab, = struct hal_srng *srng) return NULL; } =20 +static void ath11k_hal_srng_prefetch_desc(struct ath11k_base *ab, + struct hal_srng *srng) +{ + u32 *desc; + + /* prefetch only if desc is available */ + desc =3D ath11k_hal_srng_dst_peek(ab, srng); + if (likely(desc)) { + dma_sync_single_for_cpu(ab->dev, virt_to_phys(desc), + (srng->entry_size * sizeof(u32)), + DMA_FROM_DEVICE); + prefetch(desc); + } +} + u32 *ath11k_hal_srng_dst_get_next_entry(struct ath11k_base *ab, struct hal_srng *srng) { @@ -642,6 +657,10 @@ u32 *ath11k_hal_srng_dst_get_next_entry(struct ath11k_= base *ab, srng->u.dst_ring.tp =3D (srng->u.dst_ring.tp + srng->entry_size) % srng->ring_size; =20 + /* Try to prefetch the next descriptor in the ring */ + if (srng->flags & HAL_SRNG_FLAGS_CACHED) + ath11k_hal_srng_prefetch_desc(ab, srng); + return desc; } =20 @@ -775,11 +794,16 @@ void ath11k_hal_srng_access_begin(struct ath11k_base = *ab, struct hal_srng *srng) { lockdep_assert_held(&srng->lock); =20 - if (srng->ring_dir =3D=3D HAL_SRNG_DIR_SRC) + if (srng->ring_dir =3D=3D HAL_SRNG_DIR_SRC) { srng->u.src_ring.cached_tp =3D *(volatile u32 *)srng->u.src_ring.tp_addr; - else + } else { srng->u.dst_ring.cached_hp =3D *srng->u.dst_ring.hp_addr; + + /* Try to prefetch the next descriptor in the ring */ + if (srng->flags & HAL_SRNG_FLAGS_CACHED) + ath11k_hal_srng_prefetch_desc(ab, srng); + } } =20 /* Update cached ring head/tail pointers to HW. ath11k_hal_srng_access_beg= in() diff --git a/drivers/net/wireless/ath/ath11k/hal.h b/drivers/net/wireless/a= th/ath11k/hal.h index 35ed3a14e200a..0f4f9ce74354b 100644 --- a/drivers/net/wireless/ath/ath11k/hal.h +++ b/drivers/net/wireless/ath/ath11k/hal.h @@ -513,6 +513,7 @@ enum hal_srng_dir { #define HAL_SRNG_FLAGS_DATA_TLV_SWAP 0x00000020 #define HAL_SRNG_FLAGS_LOW_THRESH_INTR_EN 0x00010000 #define HAL_SRNG_FLAGS_MSI_INTR 0x00020000 +#define HAL_SRNG_FLAGS_CACHED 0x20000000 #define HAL_SRNG_FLAGS_LMAC_RING 0x80000000 =20 #define HAL_SRNG_TLV_HDR_TAG GENMASK(9, 1) diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/at= h/ath11k/hw.h index 6dcac596e3fe5..de9e9546f2ec6 100644 --- a/drivers/net/wireless/ath/ath11k/hw.h +++ b/drivers/net/wireless/ath/ath11k/hw.h @@ -177,6 +177,7 @@ struct ath11k_hw_params { u8 max_tx_ring; const struct ath11k_hw_hal_params *hal_params; bool supports_dynamic_smps_6ghz; + bool alloc_cacheable_memory; }; =20 struct ath11k_hw_ops { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C44ACC4332F for ; Mon, 24 Jan 2022 21:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452655AbiAXV0E (ORCPT ); Mon, 24 Jan 2022 16:26:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51218 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444219AbiAXVAW (ORCPT ); Mon, 24 Jan 2022 16:00:22 -0500 Received: from smtp.kernel.org (relay.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 BCC4960B03; Mon, 24 Jan 2022 21:00:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91A88C340E5; Mon, 24 Jan 2022 21:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058021; bh=zG9/q/7DBS3gFy3qP4yp2B1jug0PJjs6Zr51MkeY0PM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qssL+0VgvgNl4CklRdHsY2FeEncA15MyeWJixHUTIdzIorEftXMFBeOfizJKKY+vp 4zdIIunC86JT1FLDUIcdWQPsLDGb/pKor9wdrtkx+f8OI58eu+X4lHtr54ElerZtiX 2qwDH7/qJ2vwkhksnLgKNflKlXi0W8BPrNKqkCeY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Seevalamuthu Mariappan , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0154/1039] ath11k: add hw_param for wakeup_mhi Date: Mon, 24 Jan 2022 19:32:23 +0100 Message-Id: <20220124184130.335105573@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Seevalamuthu Mariappan [ Upstream commit 081e2d6476e30399433b509684d5da4d1844e430 ] Wakeup mhi is needed before pci_read/write only for QCA6390 and WCN6855. Si= nce wakeup & release mhi is enabled for all hardwares, below mhi assert is seen= in QCN9074 when doing 'rmmod ath11k_pci': Kernel panic - not syncing: dev_wake !=3D 0 CPU: 2 PID: 13535 Comm: procd Not tainted 4.4.60 #1 Hardware name: Generic DT based system [<80316dac>] (unwind_backtrace) from [<80313700>] (show_stack+0x10/0x14) [<80313700>] (show_stack) from [<805135dc>] (dump_stack+0x7c/0x9c) [<805135dc>] (dump_stack) from [<8032136c>] (panic+0x84/0x1f8) [<8032136c>] (panic) from [<80549b24>] (mhi_pm_disable_transition+0x3b8/0x= 5b8) [<80549b24>] (mhi_pm_disable_transition) from [<80549ddc>] (mhi_power_down= +0xb8/0x100) [<80549ddc>] (mhi_power_down) from [<7f5242b0>] (ath11k_mhi_op_status_cb+0= x284/0x3ac [ath11k_pci]) [E][__mhi_device_get_sync] Did not enter M0 state, cur_state:RESET pm_stat= e:SHUTDOWN Process [E][__mhi_device_get_sync] Did not enter M0 state, cur_state:RESET pm_stat= e:SHUTDOWN Process [E][__mhi_device_get_sync] Did not enter M0 state, cur_state:RESET pm_stat= e:SHUTDOWN Process [<7f5242b0>] (ath11k_mhi_op_status_cb [ath11k_pci]) from [<7f524878>] (ath= 11k_mhi_stop+0x10/0x20 [ath11k_pci]) [<7f524878>] (ath11k_mhi_stop [ath11k_pci]) from [<7f525b94>] (ath11k_pci_= power_down+0x54/0x90 [ath11k_pci]) [<7f525b94>] (ath11k_pci_power_down [ath11k_pci]) from [<8056b2a8>] (pci_d= evice_shutdown+0x30/0x44) [<8056b2a8>] (pci_device_shutdown) from [<805cfa0c>] (device_shutdown+0x12= 4/0x174) [<805cfa0c>] (device_shutdown) from [<8033aaa4>] (kernel_restart+0xc/0x50) [<8033aaa4>] (kernel_restart) from [<8033ada8>] (SyS_reboot+0x178/0x1ec) [<8033ada8>] (SyS_reboot) from [<80301b80>] (ret_fast_syscall+0x0/0x34) Hence, disable wakeup/release mhi using hw_param for other hardwares. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01060-QCAHKSWPL_SILICONZ-1 Fixes: a05bd8513335 ("ath11k: read and write registers below unwindowed add= ress") Signed-off-by: Seevalamuthu Mariappan Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1636702019-26142-1-git-send-email-quic_seev= alam@quicinc.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/core.c | 5 +++++ drivers/net/wireless/ath/ath11k/hw.h | 1 + drivers/net/wireless/ath/ath11k/pci.c | 12 ++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/= ath/ath11k/core.c index 280f1c6411aeb..638dc97669df2 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -84,6 +84,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = =3D { .hal_params =3D &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz =3D false, .alloc_cacheable_memory =3D true, + .wakeup_mhi =3D false, }, { .hw_rev =3D ATH11K_HW_IPQ6018_HW10, @@ -135,6 +136,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .hal_params =3D &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz =3D false, .alloc_cacheable_memory =3D true, + .wakeup_mhi =3D false, }, { .name =3D "qca6390 hw2.0", @@ -185,6 +187,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .hal_params =3D &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz =3D false, .alloc_cacheable_memory =3D false, + .wakeup_mhi =3D true, }, { .name =3D "qcn9074 hw1.0", @@ -235,6 +238,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .hal_params =3D &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz =3D true, .alloc_cacheable_memory =3D true, + .wakeup_mhi =3D false, }, { .name =3D "wcn6855 hw2.0", @@ -285,6 +289,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .hal_params =3D &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz =3D false, .alloc_cacheable_memory =3D false, + .wakeup_mhi =3D true, }, }; =20 diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/at= h/ath11k/hw.h index de9e9546f2ec6..aa93f0619f936 100644 --- a/drivers/net/wireless/ath/ath11k/hw.h +++ b/drivers/net/wireless/ath/ath11k/hw.h @@ -178,6 +178,7 @@ struct ath11k_hw_params { const struct ath11k_hw_hal_params *hal_params; bool supports_dynamic_smps_6ghz; bool alloc_cacheable_memory; + bool wakeup_mhi; }; =20 struct ath11k_hw_ops { diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/a= th/ath11k/pci.c index 3d353e7c9d5c2..fadded5ef84b2 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -182,7 +182,8 @@ void ath11k_pci_write32(struct ath11k_base *ab, u32 off= set, u32 value) /* for offset beyond BAR + 4K - 32, may * need to wakeup MHI to access. */ - if (test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && + if (ab->hw_params.wakeup_mhi && + test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && offset >=3D ACCESS_ALWAYS_OFF) mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); =20 @@ -206,7 +207,8 @@ void ath11k_pci_write32(struct ath11k_base *ab, u32 off= set, u32 value) } } =20 - if (test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && + if (ab->hw_params.wakeup_mhi && + test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && offset >=3D ACCESS_ALWAYS_OFF) mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); } @@ -219,7 +221,8 @@ u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offse= t) /* for offset beyond BAR + 4K - 32, may * need to wakeup MHI to access. */ - if (test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && + if (ab->hw_params.wakeup_mhi && + test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && offset >=3D ACCESS_ALWAYS_OFF) mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); =20 @@ -243,7 +246,8 @@ u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offse= t) } } =20 - if (test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && + if (ab->hw_params.wakeup_mhi && + test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && offset >=3D ACCESS_ALWAYS_OFF) mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5A00C4321E for ; Mon, 24 Jan 2022 21:43:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457084AbiAXVkx (ORCPT ); Mon, 24 Jan 2022 16:40:53 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55086 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445258AbiAXVCg (ORCPT ); Mon, 24 Jan 2022 16:02:36 -0500 Received: from smtp.kernel.org (relay.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 688AE60916; Mon, 24 Jan 2022 21:02:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C7F4C340E5; Mon, 24 Jan 2022 21:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058155; bh=agaYuHmMsceCY7fMVhfpeJqZyroFBz/itKzXugsUnlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KGpDR5TzvHzsS2uKhDULMTbyxKj+NtKkG49+f1QPHeDoS4dHBKaTBgCcIDFriaEu4 9o1/gadEUGj/yMEbGH5MNFNNiUzqFIFY9EO7Tc6KxXvHENvoEGsNLwdVlMUKn+aZgb ZPV5XzsP5OkS4vHW7sB8Hooa+uAI0J3eoAlWwIS8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.16 0155/1039] arm64: dts: renesas: cat875: Add rx/tx delays Date: Mon, 24 Jan 2022 19:32:24 +0100 Message-Id: <20220124184130.375230465@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Biju Das [ Upstream commit e1a9faddffe7e555304dc2e3284c84fbee0679ee ] The CAT875 sub board from Silicon Linux uses a Realtek PHY. The phy driver commit bbc4d71d63549bcd003 ("net: phy: realtek: fix rtl8211e rx/tx delay config") introduced NFS mount failures. Now it needs both rx/tx delays for the NFS mount to work. This patch fixes the NFS mount failure issue by adding "rgmii-id" mode to the avb device node. Signed-off-by: Biju Das Fixes: bbc4d71d63549bcd ("net: phy: realtek: fix rtl8211e rx/tx delay confi= g") Link: https://lore.kernel.org/r/20211115142830.12651-1-biju.das.jz@bp.renes= as.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/renesas/cat875.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/renesas/cat875.dtsi b/arch/arm64/boot/dts/= renesas/cat875.dtsi index a69d24e9c61db..8c9da8b4bd60b 100644 --- a/arch/arm64/boot/dts/renesas/cat875.dtsi +++ b/arch/arm64/boot/dts/renesas/cat875.dtsi @@ -18,6 +18,7 @@ pinctrl-names =3D "default"; renesas,no-ether-link; phy-handle =3D <&phy0>; + phy-mode =3D "rgmii-id"; status =3D "okay"; =20 phy0: ethernet-phy@0 { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0B95C4167E for ; Mon, 24 Jan 2022 21:38:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455951AbiAXVgx (ORCPT ); Mon, 24 Jan 2022 16:36:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55124 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444379AbiAXVAs (ORCPT ); Mon, 24 Jan 2022 16:00:48 -0500 Received: from smtp.kernel.org (relay.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 925F7B80CCF; Mon, 24 Jan 2022 21:00:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE356C340E5; Mon, 24 Jan 2022 21:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058045; bh=E0GfmjPk2458BTHAGUlK7SfWSFjq1jqdNMCrK7Z2KfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MqApB7r96mJkfJI1B1F18fjlW3YgtE43lBtX9P3oiuRHuKvuG3U/CL+E7E2HvLRFi YZzW7IQv0qyHcz5VY2odUhuc6vcKw/+ywOKqnbAK9fVdfgzILB6DfVdWGvxStEzEf0 ycIHw7XKdy2AwrxysgVnZVgqr9Viz1/G45YeFpks= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0156/1039] media: dmxdev: fix UAF when dvb_register_device() fails Date: Mon, 24 Jan 2022 19:32:25 +0100 Message-Id: <20220124184130.414042699@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wang Hai [ Upstream commit ab599eb11882f834951c436cc080c3455ba32b9b ] I got a use-after-free report: dvbdev: dvb_register_device: failed to create device dvb1.dvr0 (-12) ... =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 dvb_dmxdev_release+0xce/0x2f0 ... Call Trace: dump_stack_lvl+0x6c/0x8b print_address_description.constprop.0+0x48/0x70 kasan_report.cold+0x82/0xdb __asan_load4+0x6b/0x90 dvb_dmxdev_release+0xce/0x2f0 ... Allocated by task 7666: kasan_save_stack+0x23/0x50 __kasan_kmalloc+0x83/0xa0 kmem_cache_alloc_trace+0x22e/0x470 dvb_register_device+0x12f/0x980 dvb_dmxdev_init+0x1f3/0x230 ... Freed by task 7666: kasan_save_stack+0x23/0x50 kasan_set_track+0x20/0x30 kasan_set_free_info+0x24/0x40 __kasan_slab_free+0xf2/0x130 kfree+0xd1/0x5c0 dvb_register_device.cold+0x1ac/0x1fa dvb_dmxdev_init+0x1f3/0x230 ... When dvb_register_device() in dvb_dmxdev_init() fails, dvb_dmxdev_init() does not return a failure, and the memory pointed to by dvbdev or dvr_dvbdev is invalid at this point. If they are used subsequently, it will result in UFA or null-ptr-deref. If dvb_register_device() in dvb_dmxdev_init() fails, fix the bug by making dvb_dmxdev_init() return an error as well. Link: https://lore.kernel.org/linux-media/20211015085741.1203283-1-wanghai3= 8@huawei.com Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Hulk Robot Signed-off-by: Wang Hai Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/dvb-core/dmxdev.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxde= v.c index 5d5a48475a54f..01f288fa37e0e 100644 --- a/drivers/media/dvb-core/dmxdev.c +++ b/drivers/media/dvb-core/dmxdev.c @@ -1413,7 +1413,7 @@ static const struct dvb_device dvbdev_dvr =3D { }; int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) { - int i; + int i, ret; =20 if (dmxdev->demux->open(dmxdev->demux) < 0) return -EUSERS; @@ -1432,14 +1432,26 @@ int dvb_dmxdev_init(struct dmxdev *dmxdev, struct d= vb_adapter *dvb_adapter) DMXDEV_STATE_FREE); } =20 - dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, + ret =3D dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, = dmxdev, DVB_DEVICE_DEMUX, dmxdev->filternum); - dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, + if (ret < 0) + goto err_register_dvbdev; + + ret =3D dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, dmxdev, DVB_DEVICE_DVR, dmxdev->filternum); + if (ret < 0) + goto err_register_dvr_dvbdev; =20 dvb_ringbuffer_init(&dmxdev->dvr_buffer, NULL, 8192); =20 return 0; + +err_register_dvr_dvbdev: + dvb_unregister_device(dmxdev->dvbdev); +err_register_dvbdev: + vfree(dmxdev->filter); + dmxdev->filter =3D NULL; + return ret; } =20 EXPORT_SYMBOL(dvb_dmxdev_init); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 714A7C4707A for ; Mon, 24 Jan 2022 21:28:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1449415AbiAXV2b (ORCPT ); Mon, 24 Jan 2022 16:28:31 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55514 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444715AbiAXVBW (ORCPT ); Mon, 24 Jan 2022 16:01:22 -0500 Received: from smtp.kernel.org (relay.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 79F1FB80FA3; Mon, 24 Jan 2022 21:01:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F8E5C340E5; Mon, 24 Jan 2022 21:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058079; bh=QA8+oOIsCW4SEIRGEnJ6v+finhlrCS8bNEytK881OKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RD1D1JegVhp8qeCr0zIYTs60MzjsvDZj8piRkzbndsQHT1WHRdKFMI+j7iaDhrJnd jg7XkQL8BPDAdiShNudVgbgVb0J1lZxcjpNEm4KEljMyVd/+GLBeQr5JoeHZSAZ0tm ADuU+s769atr/pFVSloJN3XCL/9DfT5xzDhdcjlg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfgang Ocker , Tudor Ambarus , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0157/1039] crypto: atmel-aes - Reestablish the correct tfm context at dequeue Date: Mon, 24 Jan 2022 19:32:26 +0100 Message-Id: <20220124184130.453484468@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus [ Upstream commit 6d48de655917a9d782953eba65de4e3db593ddf0 ] In case there were more requests from different tfms in the crypto queue, only the context of the last initialized tfm was considered. Fixes: ec2088b66f7a ("crypto: atmel-aes - Allocate aes dev at tfm init time= ") Reported-by: Wolfgang Ocker Signed-off-by: Tudor Ambarus Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/atmel-aes.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 9391ccc03382d..fe05584031914 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c @@ -960,6 +960,7 @@ static int atmel_aes_handle_queue(struct atmel_aes_dev = *dd, ctx =3D crypto_tfm_ctx(areq->tfm); =20 dd->areq =3D areq; + dd->ctx =3D ctx; start_async =3D (areq !=3D new_areq); dd->is_async =3D start_async; =20 @@ -1274,7 +1275,6 @@ static int atmel_aes_init_tfm(struct crypto_skcipher = *tfm) =20 crypto_skcipher_set_reqsize(tfm, sizeof(struct atmel_aes_reqctx)); ctx->base.dd =3D dd; - ctx->base.dd->ctx =3D &ctx->base; ctx->base.start =3D atmel_aes_start; =20 return 0; @@ -1291,7 +1291,6 @@ static int atmel_aes_ctr_init_tfm(struct crypto_skcip= her *tfm) =20 crypto_skcipher_set_reqsize(tfm, sizeof(struct atmel_aes_reqctx)); ctx->base.dd =3D dd; - ctx->base.dd->ctx =3D &ctx->base; ctx->base.start =3D atmel_aes_ctr_start; =20 return 0; @@ -1783,7 +1782,6 @@ static int atmel_aes_gcm_init(struct crypto_aead *tfm) =20 crypto_aead_set_reqsize(tfm, sizeof(struct atmel_aes_reqctx)); ctx->base.dd =3D dd; - ctx->base.dd->ctx =3D &ctx->base; ctx->base.start =3D atmel_aes_gcm_start; =20 return 0; @@ -1927,7 +1925,6 @@ static int atmel_aes_xts_init_tfm(struct crypto_skcip= her *tfm) crypto_skcipher_set_reqsize(tfm, sizeof(struct atmel_aes_reqctx) + crypto_skcipher_reqsize(ctx->fallback_tfm)); ctx->base.dd =3D dd; - ctx->base.dd->ctx =3D &ctx->base; ctx->base.start =3D atmel_aes_xts_start; =20 return 0; @@ -2154,7 +2151,6 @@ static int atmel_aes_authenc_init_tfm(struct crypto_a= ead *tfm, crypto_aead_set_reqsize(tfm, (sizeof(struct atmel_aes_authenc_reqctx) + auth_reqsize)); ctx->base.dd =3D dd; - ctx->base.dd->ctx =3D &ctx->base; ctx->base.start =3D atmel_aes_authenc_start; =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FF43C433EF for ; Mon, 24 Jan 2022 23:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851155AbiAXXcF (ORCPT ); Mon, 24 Jan 2022 18:32:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836496AbiAXWjh (ORCPT ); Mon, 24 Jan 2022 17:39:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54C76C054875; Mon, 24 Jan 2022 13:01:55 -0800 (PST) Received: from smtp.kernel.org (relay.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 1327BB81057; Mon, 24 Jan 2022 21:01:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 308A8C340E5; Mon, 24 Jan 2022 21:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058112; bh=3dX7I10Z+FMajBYHYlk7zmc2W2l3aPSNYjfvSrxzmw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QlMHGj5LqkTOMZq+nuB4FeXq+0uzFGwQHgOll4B3XmBZin2jD0d2r7fuqcNHkdOhj DVVwZ1sSORhuEY0O4ZU+oFclgPTG/drzHkpEiuIQ1aV2yUGJfrBwqt/SUhHZJEsQC/ iz4AnIKqoRLvyq+pzk+Tpa03StgrXoUWoRBK9fL0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wei Yongjun , Daniele Alessandrelli , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0158/1039] crypto: keembay-ocs-ecc - Fix error return code in kmb_ocs_ecc_probe() Date: Mon, 24 Jan 2022 19:32:27 +0100 Message-Id: <20220124184130.493179134@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wei Yongjun [ Upstream commit 94ad2d19a97efdb603a21fcad0625f466f1cdd0f ] Fix to return negative error code -ENOMEM from the error handling case instead of 0, as done elsewhere in this function. Fixes: c9f608c38009 ("crypto: keembay-ocs-ecc - Add Keem Bay OCS ECC Driver= ") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun Reviewed-by: Daniele Alessandrelli Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/keembay/keembay-ocs-ecc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/keembay/keembay-ocs-ecc.c b/drivers/crypto/keem= bay/keembay-ocs-ecc.c index 679e6ae295e0b..5d0785d3f1b55 100644 --- a/drivers/crypto/keembay/keembay-ocs-ecc.c +++ b/drivers/crypto/keembay/keembay-ocs-ecc.c @@ -930,6 +930,7 @@ static int kmb_ocs_ecc_probe(struct platform_device *pd= ev) ecc_dev->engine =3D crypto_engine_alloc_init(dev, 1); if (!ecc_dev->engine) { dev_err(dev, "Could not allocate crypto engine\n"); + rc =3D -ENOMEM; goto list_del; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAE2CC4321E for ; Mon, 24 Jan 2022 23:34:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851117AbiAXXb6 (ORCPT ); Mon, 24 Jan 2022 18:31:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836498AbiAXWjh (ORCPT ); Mon, 24 Jan 2022 17:39:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4448BC054879; Mon, 24 Jan 2022 13:02:17 -0800 (PST) Received: from smtp.kernel.org (relay.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 D81E860E8D; Mon, 24 Jan 2022 21:02:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1C93C340E5; Mon, 24 Jan 2022 21:02:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058136; bh=KSy15URbnYdQ2MDCfeKbuVXx50REXtYPVx5KWVcdnkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=StZNNdUgOtJ6Xnr/PZy9tjy8qpYIVwvP9aBuK2s18Pr+aDOMlIhFMFL2C2PgEkJ1i r/NzgOZYcqH1BlEjsUi7t1R2erYD9wH0AB7JG0lIENvnB54bOOYo0xvDnBNKWwaf2i +qbXMxI5JD1EvVdVnvBWuIXKoSkNo02WLF/GOmKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengfeng Ye , Thara Gopinath , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0159/1039] crypto: qce - fix uaf on qce_aead_register_one Date: Mon, 24 Jan 2022 19:32:28 +0100 Message-Id: <20220124184130.541004389@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chengfeng Ye [ Upstream commit 4a9dbd021970ffe1b92521328377b699acba7c52 ] Pointer alg points to sub field of tmpl, it is dereferenced after tmpl is freed. Fix this by accessing alg before free tmpl. Fixes: 9363efb4 ("crypto: qce - Add support for AEAD algorithms") Signed-off-by: Chengfeng Ye Acked-by: Thara Gopinath Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/qce/aead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qce/aead.c b/drivers/crypto/qce/aead.c index 290e2446a2f35..97a530171f07a 100644 --- a/drivers/crypto/qce/aead.c +++ b/drivers/crypto/qce/aead.c @@ -802,8 +802,8 @@ static int qce_aead_register_one(const struct qce_aead_= def *def, struct qce_devi =20 ret =3D crypto_register_aead(alg); if (ret) { - kfree(tmpl); dev_err(qce->dev, "%s registration failed\n", alg->base.cra_name); + kfree(tmpl); return ret; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47614C43219 for ; Mon, 24 Jan 2022 23:34:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851099AbiAXXbz (ORCPT ); Mon, 24 Jan 2022 18:31:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233914AbiAXWjj (ORCPT ); Mon, 24 Jan 2022 17:39:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0E53C05487A; Mon, 24 Jan 2022 13:02:20 -0800 (PST) Received: from smtp.kernel.org (relay.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 50D3E60E8D; Mon, 24 Jan 2022 21:02:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E0C7C340E5; Mon, 24 Jan 2022 21:02:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058139; bh=mt0KdQ610w0e3Y/eYKlgO6C5fSV+AQItylCNXXm/KYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rem19Lmwer26EbTMNVPqAhQ8+FxFXnpHjBNmcsp79et6m1ZXSW3YVCrErJWxN8I0g 8kMDaeFHi+6I8Fhkwu8Cx9LB7JDpqI6jP+B+T4z7aDhqgJqs6S+6vHB7ym//39USoB f8rKY0YoLnPQUxIo8Sd3zlyh7jezLSkt4t44059Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengfeng Ye , Thara Gopinath , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0160/1039] crypto: qce - fix uaf on qce_ahash_register_one Date: Mon, 24 Jan 2022 19:32:29 +0100 Message-Id: <20220124184130.577932260@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chengfeng Ye [ Upstream commit b4cb4d31631912842eb7dce02b4350cbb7562d5e ] Pointer base points to sub field of tmpl, it is dereferenced after tmpl is freed. Fix this by accessing base before free tmpl. Fixes: ec8f5d8f ("crypto: qce - Qualcomm crypto engine driver") Signed-off-by: Chengfeng Ye Acked-by: Thara Gopinath Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/qce/sha.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c index 8e6fcf2c21cc0..59159f5e64e52 100644 --- a/drivers/crypto/qce/sha.c +++ b/drivers/crypto/qce/sha.c @@ -498,8 +498,8 @@ static int qce_ahash_register_one(const struct qce_ahas= h_def *def, =20 ret =3D crypto_register_ahash(alg); if (ret) { - kfree(tmpl); dev_err(qce->dev, "%s registration failed\n", base->cra_name); + kfree(tmpl); return ret; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3D75C433FE for ; Mon, 24 Jan 2022 23:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851286AbiAXXcT (ORCPT ); Mon, 24 Jan 2022 18:32:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836502AbiAXWjk (ORCPT ); Mon, 24 Jan 2022 17:39:40 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58D35C05487B; Mon, 24 Jan 2022 13:02:25 -0800 (PST) Received: from smtp.kernel.org (relay.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 1FF8DB81057; Mon, 24 Jan 2022 21:02:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43410C340E5; Mon, 24 Jan 2022 21:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058142; bh=bCeEhGuG5ikUYPFJUmhaGVS1E5RTYSCU4SD7VpkViHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EMmMU0O/o/nxPIbqAKYMsYj9DgMDX5MdLuKrj6zaWatfUV8xcV95c3tUp5zposPTg PlZUy3rvhSzGDBVeMDQ3pIeTzxNLSlzoBXLJDj2A0KF5FBQqv6Stz32OgtF95Zd3VV LwoTkt7Q54ZTPKueXuKUc21oFYjw/DIwVDv0bofw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengfeng Ye , Thara Gopinath , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0161/1039] crypto: qce - fix uaf on qce_skcipher_register_one Date: Mon, 24 Jan 2022 19:32:30 +0100 Message-Id: <20220124184130.616224478@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chengfeng Ye [ Upstream commit e9c195aaeed1b45c9012adbe29dedb6031e85aa8 ] Pointer alg points to sub field of tmpl, it is dereferenced after tmpl is freed. Fix this by accessing alg before free tmpl. Fixes: ec8f5d8f ("crypto: qce - Qualcomm crypto engine driver") Signed-off-by: Chengfeng Ye Acked-by: Thara Gopinath Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/qce/skcipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c index 8ff10928f581d..3d27cd5210ef5 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c @@ -484,8 +484,8 @@ static int qce_skcipher_register_one(const struct qce_s= kcipher_def *def, =20 ret =3D crypto_register_skcipher(alg); if (ret) { - kfree(tmpl); dev_err(qce->dev, "%s registration failed\n", alg->base.cra_name); + kfree(tmpl); return ret; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31414C433F5 for ; Tue, 25 Jan 2022 02:47:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1313084AbiAYCrY (ORCPT ); Mon, 24 Jan 2022 21:47:24 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54970 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445185AbiAXVC0 (ORCPT ); Mon, 24 Jan 2022 16:02:26 -0500 Received: from smtp.kernel.org (relay.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 8BD7E60B03; Mon, 24 Jan 2022 21:02:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54624C340E5; Mon, 24 Jan 2022 21:02:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058146; bh=m10dGPwTZNb6ccoaErXekfq341WXRr3rw/+jU8rdugk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aEfk+Hb347E6yUr5ppKZEpqUKvxB5yLOwqkatoJjDMz09CTI1KR4VvTAuTINsw55p 5Qtj6wpunXIpBvWa7Mn44C5mb9KRTDEuRRk1BwjMN85iLX4vBrdhSuYo3EbbadIML+ QkAToun5SStC4c1mzy7IFMrNZyVHlcnmt97CMP/0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Prasad Malisetty , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.16 0162/1039] arm64: dts: qcom: sc7280: Fix incorrect clock name Date: Mon, 24 Jan 2022 19:32:31 +0100 Message-Id: <20220124184130.660003489@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Prasad Malisetty [ Upstream commit fa09b2248714c64644576d8064e9bd292a504a0e ] Replace pcie_1_pipe-clk clock name with pcie_1_pipe_clk To match with dt binding. Fixes: ab7772de8612 ("arm64: dts: qcom: SC7280: Add rpmhcc clock controller= node") Signed-off-by: Prasad Malisetty Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/1637060508-30375-2-git-send-email-pmaliset@= codeaurora.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/qcom/sc7280.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qco= m/sc7280.dtsi index 365a2e04e285b..cb94b877d6246 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -576,7 +576,7 @@ <&rpmhcc RPMH_CXO_CLK_A>, <&sleep_clk>, <0>, <0>, <0>, <0>, <0>, <0>; clock-names =3D "bi_tcxo", "bi_tcxo_ao", "sleep_clk", - "pcie_0_pipe_clk", "pcie_1_pipe-clk", + "pcie_0_pipe_clk", "pcie_1_pipe_clk", "ufs_phy_rx_symbol_0_clk", "ufs_phy_rx_symbol_1_clk", "ufs_phy_tx_symbol_0_clk", "usb3_phy_wrapper_gcc_usb30_pipe_clk"; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7279CC43217 for ; Mon, 24 Jan 2022 21:43:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456989AbiAXVkj (ORCPT ); Mon, 24 Jan 2022 16:40:39 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54954 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445206AbiAXVCb (ORCPT ); Mon, 24 Jan 2022 16:02:31 -0500 Received: from smtp.kernel.org (relay.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 59544B810BD; Mon, 24 Jan 2022 21:02:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8087DC340E5; Mon, 24 Jan 2022 21:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058149; bh=3yYTdBly+sCfC5UGnyLhL5seRIkMZilstI3NlwH1Dqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lapmvaEAW4oQx/orCfXlCnT4qetT40vD2LXeRUIK5QVsX9TLM6dizz9rXb25linHe qWM3odPOTF948e9GpW0yHZyy6mMZoSVz7YdnjPvqWRRGQamgb9X2cGqsjZy25iWbql nT+Kc5E7ykheCpbTdUg3E+Ap54UALevJ1Hrat8VU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Prasad Malisetty , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.16 0163/1039] arm64: dts: qcom: sc7280: Fix interrupt-map parent address cells Date: Mon, 24 Jan 2022 19:32:32 +0100 Message-Id: <20220124184130.691686284@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Prasad Malisetty [ Upstream commit 66b788133030f0c69a0ecc7f72f7939b119c9a69 ] Update interrupt-map parent address cells for sc7280 Similar to existing Qcom SoCs. Fixes: 92e0ee9f8 ("arm64: dts: qcom: sc7280: Add PCIe and PHY related nodes= ") Signed-off-by: Prasad Malisetty Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/1637060508-30375-4-git-send-email-pmaliset@= codeaurora.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/qcom/sc7280.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qco= m/sc7280.dtsi index cb94b877d6246..6e27a1beaa33a 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -1592,10 +1592,10 @@ interrupt-names =3D "msi"; #interrupt-cells =3D <1>; interrupt-map-mask =3D <0 0 0 0x7>; - interrupt-map =3D <0 0 0 1 &intc 0 434 IRQ_TYPE_LEVEL_HIGH>, - <0 0 0 2 &intc 0 435 IRQ_TYPE_LEVEL_HIGH>, - <0 0 0 3 &intc 0 438 IRQ_TYPE_LEVEL_HIGH>, - <0 0 0 4 &intc 0 439 IRQ_TYPE_LEVEL_HIGH>; + interrupt-map =3D <0 0 0 1 &intc 0 0 0 434 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 2 &intc 0 0 0 435 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 3 &intc 0 0 0 438 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 4 &intc 0 0 0 439 IRQ_TYPE_LEVEL_HIGH>; =20 clocks =3D <&gcc GCC_PCIE_1_PIPE_CLK>, <&gcc GCC_PCIE_1_PIPE_CLK_SRC>, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D30ABC433F5 for ; Mon, 24 Jan 2022 23:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851246AbiAXXcP (ORCPT ); Mon, 24 Jan 2022 18:32:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836503AbiAXWjk (ORCPT ); Mon, 24 Jan 2022 17:39:40 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BDDAC05487C; Mon, 24 Jan 2022 13:02:34 -0800 (PST) Received: from smtp.kernel.org (relay.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 648A2B811FB; Mon, 24 Jan 2022 21:02:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91777C340E5; Mon, 24 Jan 2022 21:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058152; bh=fDKZb5ZOGOoDpGNIT4AzWS/7B5dYfdm2X4IfhgXunug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IaZdOLH2YghU9R0dAuy+FfNdTUkeCnLKD1uw+Ljrlqp/XQD3yWLT8iPfguFcjvTDt WsFGSGeKfo2OaGvwVXiH4nBNTkXUDEIWbF+Lh5LcYagpQ9k5vkQAarzc98+EGpAeNV H4Izb8sU8msTXkl08Boh6jG1799t24o3Hwz0XOP4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "George G. Davis" , Vignesh Raghavendra , Sasha Levin Subject: [PATCH 5.16 0164/1039] mtd: hyperbus: rpc-if: fix bug in rpcif_hb_remove Date: Mon, 24 Jan 2022 19:32:33 +0100 Message-Id: <20220124184130.734861750@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: George G. Davis [ Upstream commit baaf965f94308301d2dc554d72a87d7432cd5ce6 ] The following KASAN BUG is observed when testing the rpc-if driver on rcar-gen3: root@rcar-gen3:~# modprobe -r rpc-if [ 101.930146] =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 [ 101.937408] BUG: KASAN: slab-out-of-bounds in __lock_acquire+0x518/0x25d0 [ 101.944240] Read of size 8 at addr ffff0004c5be2750 by task modprobe/664 [ 101.950959] [ 101.952466] CPU: 2 PID: 664 Comm: modprobe Not tainted 5.14.0-rc1-00342-= g1a1464d7aa31 #1 [ 101.960578] Hardware name: Renesas H3ULCB board based on r8a77951 (DT) [ 101.967120] Call trace: [ 101.969580] dump_backtrace+0x0/0x2c0 [ 101.973275] show_stack+0x1c/0x30 [ 101.976616] dump_stack_lvl+0x9c/0xd8 [ 101.980301] print_address_description.constprop.0+0x74/0x2b8 [ 101.986071] kasan_report+0x1f4/0x26c [ 101.989757] __asan_load8+0x98/0xd4 [ 101.993266] __lock_acquire+0x518/0x25d0 [ 101.997215] lock_acquire.part.0+0x18c/0x360 [ 102.001506] lock_acquire+0x74/0x90 [ 102.005013] _raw_spin_lock_irq+0x98/0x130 [ 102.009131] __pm_runtime_disable+0x30/0x210 [ 102.013427] rpcif_hb_remove+0x5c/0x70 [rpc_if] [ 102.018001] platform_remove+0x40/0x80 [ 102.021771] __device_release_driver+0x234/0x350 [ 102.026412] driver_detach+0x158/0x20c [ 102.030179] bus_remove_driver+0xa0/0x140 [ 102.034212] driver_unregister+0x48/0x80 [ 102.038153] platform_driver_unregister+0x18/0x24 [ 102.042879] rpcif_platform_driver_exit+0x1c/0x34 [rpc_if] [ 102.048400] __arm64_sys_delete_module+0x210/0x310 [ 102.053212] invoke_syscall+0x60/0x190 [ 102.056986] el0_svc_common+0x12c/0x144 [ 102.060844] do_el0_svc+0x88/0xac [ 102.064181] el0_svc+0x24/0x3c [ 102.067257] el0t_64_sync_handler+0x1a8/0x1b0 [ 102.071634] el0t_64_sync+0x198/0x19c [ 102.075315] [ 102.076815] Allocated by task 628: [ 102.080781] [ 102.082280] Last potentially related work creation: [ 102.087524] [ 102.089022] The buggy address belongs to the object at ffff0004c5be2000 [ 102.089022] which belongs to the cache kmalloc-2k of size 2048 [ 102.101555] The buggy address is located 1872 bytes inside of [ 102.101555] 2048-byte region [ffff0004c5be2000, ffff0004c5be2800) [ 102.113486] The buggy address belongs to the page: [ 102.118409] [ 102.119908] Memory state around the buggy address: [ 102.124711] ffff0004c5be2600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc= fc fc [ 102.131947] ffff0004c5be2680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc= fc fc [ 102.139181] >ffff0004c5be2700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc= fc fc [ 102.146412] ^ [ 102.152257] ffff0004c5be2780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc= fc fc [ 102.159491] ffff0004c5be2800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc= fc fc [ 102.166723] =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 The above bug is caused by use of the wrong pointer in the rpcif_disable_rpm() call. Fix the bug by using the correct pointer. Fixes: 5de15b610f78 ("mtd: hyperbus: add Renesas RPC-IF driver") Signed-off-by: George G. Davis Signed-off-by: Vignesh Raghavendra Link: https://lore.kernel.org/r/20210716204935.25859-1-george_davis@mentor.= com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/hyperbus/rpc-if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c index 367b0d72bf622..dc164c18f8429 100644 --- a/drivers/mtd/hyperbus/rpc-if.c +++ b/drivers/mtd/hyperbus/rpc-if.c @@ -152,9 +152,9 @@ static int rpcif_hb_remove(struct platform_device *pdev) { struct rpcif_hyperbus *hyperbus =3D platform_get_drvdata(pdev); int error =3D hyperbus_unregister_device(&hyperbus->hbdev); - struct rpcif *rpc =3D dev_get_drvdata(pdev->dev.parent); =20 - rpcif_disable_rpm(rpc); + rpcif_disable_rpm(&hyperbus->rpc); + return error; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 488E7C35272 for ; Mon, 24 Jan 2022 21:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378101AbiAXV1A (ORCPT ); Mon, 24 Jan 2022 16:27:00 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53558 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444396AbiAXVAu (ORCPT ); Mon, 24 Jan 2022 16:00:50 -0500 Received: from smtp.kernel.org (relay.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 E0AD4612E9; Mon, 24 Jan 2022 21:00:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E4F6C340E5; Mon, 24 Jan 2022 21:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058048; bh=AuuH0Kty7H2/ZTZUm98NLAwa0+UopAyoe2zfWSIK1HU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wd45aYVFvtw+cucv9Fcjw+A63o8/+DI2YvUwm44ikSixlEdUWmxVK8j83Uc6zXVIX kD/IzjeXc01yTbcE2Tn5Pse8Us/HdS4+ioUkIkSATGKsQgtj4ATSiXI9gz22IESY9R B/GjiqB5Yc3db8NPm2LUCmCvrTZjSTSw5TDo7nTM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thara Gopinath , Lukasz Luba , Viresh Kumar , Sasha Levin Subject: [PATCH 5.16 0165/1039] cpufreq: qcom-cpufreq-hw: Update offline CPUs per-cpu thermal pressure Date: Mon, 24 Jan 2022 19:32:34 +0100 Message-Id: <20220124184130.767895775@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukasz Luba [ Upstream commit 93d9e6f93e1586fcc97498c764be2e8c8401f4bd ] The thermal pressure signal gives information to the scheduler about reduced CPU capacity due to thermal. It is based on a value stored in a per-cpu 'thermal_pressure' variable. The online CPUs will get the new value there, while the offline won't. Unfortunately, when the CPU is back online, the value read from per-cpu variable might be wrong (stale data). This might affect the scheduler decisions, since it sees the CPU capacity differently than what is actually available. Fix it by making sure that all online+offline CPUs would get the proper value in their per-cpu variable when there is throttling or throttling is removed. Fixes: 275157b367f479 ("cpufreq: qcom-cpufreq-hw: Add dcvs interrupt suppor= t") Reviewed-by: Thara Gopinath Signed-off-by: Lukasz Luba Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/cpufreq/qcom-cpufreq-hw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufr= eq-hw.c index a2be0df7e1747..0138b2ec406dc 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -304,7 +304,8 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_da= ta *data) if (capacity > max_capacity) capacity =3D max_capacity; =20 - arch_set_thermal_pressure(policy->cpus, max_capacity - capacity); + arch_set_thermal_pressure(policy->related_cpus, + max_capacity - capacity); =20 /* * In the unlikely case policy is unregistered do not enable --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8F40C3526D for ; Mon, 24 Jan 2022 21:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452903AbiAXV1V (ORCPT ); Mon, 24 Jan 2022 16:27:21 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53582 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444404AbiAXVAw (ORCPT ); Mon, 24 Jan 2022 16:00:52 -0500 Received: from smtp.kernel.org (relay.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 D62B96135E; Mon, 24 Jan 2022 21:00:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0C19C340E5; Mon, 24 Jan 2022 21:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058051; bh=Z0DFj+IIA3ZacqhuK/HbkR0W3oq/NemNEIJFwRpukc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0wXlWcS4Kn1JSOKUgzxBLFOfy2DJdqqOxWYjYneHrLVKOuDYZq17z0MsapiNMdSmA U7Ge25Jj1BRygFn8wnUhXjB2cCKW5d31RwZUpKOofREhCpw9850uGTgasmwS3ds4qH w9uR1xFMKlrSoYKbg+iOrIRj+gRJGL0D11FPN09I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Ford , Fabio Estevam , Shawn Guo , Sasha Levin Subject: [PATCH 5.16 0166/1039] soc: imx: gpcv2: keep i.MX8MM VPU-H1 bus clock active Date: Mon, 24 Jan 2022 19:32:35 +0100 Message-Id: <20220124184130.802467525@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adam Ford [ Upstream commit 8361b8b29f9389084b679db854cf733375c64763 ] Enable the vpu-h1 clock when the domain is active because reading or writing to the VPU-H1 IP block cause the system to hang. Fixes: 656ade7aa42a ("soc: imx: gpcv2: keep i.MX8M* bus clocks enabled") Signed-off-by: Adam Ford Reviewed-by: Fabio Estevam Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/soc/imx/gpcv2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c index b8d52d8d29dbb..7b6dfa33dcb9f 100644 --- a/drivers/soc/imx/gpcv2.c +++ b/drivers/soc/imx/gpcv2.c @@ -734,6 +734,7 @@ static const struct imx_pgc_domain imx8mm_pgc_domains[]= =3D { .map =3D IMX8MM_VPUH1_A53_DOMAIN, }, .pgc =3D BIT(IMX8MM_PGC_VPUH1), + .keep_clocks =3D true, }, =20 [IMX8MM_POWER_DOMAIN_DISPMIX] =3D { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CAC1C433EF for ; Mon, 24 Jan 2022 23:34:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851304AbiAXXcU (ORCPT ); Mon, 24 Jan 2022 18:32:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836484AbiAXWjg (ORCPT ); Mon, 24 Jan 2022 17:39:36 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10B40C054870; Mon, 24 Jan 2022 13:00:57 -0800 (PST) Received: from smtp.kernel.org (relay.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 C1DC9B80FA1; Mon, 24 Jan 2022 21:00:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5FE3C340E5; Mon, 24 Jan 2022 21:00:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058054; bh=MkNJ0R11zL6n7hF6vlIkD+vGmpNLfrFTWV3DUt/AYkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cRgLAbuc26JFrl1fLWfK7k1ABfkSR6VjAxOp4EKcKaTa+pglcA1e6PO5HoAmnoq41 3mFkUZ8lBXvs/faqMtrqLVil/5plnuuj6f3y25w1xKHPZI7TwsnijtGIIwJR+dW+yM GLjdwoG9arZZaYYCfqVS3FmBZIDL3AwL7mZE+12k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Zapolskiy , Matthias Kaehlcke , Bjorn Andersson , Viresh Kumar , Sasha Levin Subject: [PATCH 5.16 0167/1039] cpufreq: qcom-hw: Fix probable nested interrupt handling Date: Mon, 24 Jan 2022 19:32:36 +0100 Message-Id: <20220124184130.833736034@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 e0e27c3d4e20dab861566f1c348ae44e4b498630 ] Re-enabling an interrupt from its own interrupt handler may cause an interrupt storm, if there is a pending interrupt and because its handling is disabled due to already done entrance into the handler above in the stack. Also, apparently it is improper to lock a mutex in an interrupt contex. Fixes: 275157b367f4 ("cpufreq: qcom-cpufreq-hw: Add dcvs interrupt support") Signed-off-by: Vladimir Zapolskiy Reviewed-by: Matthias Kaehlcke Reviewed-by: Bjorn Andersson Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/cpufreq/qcom-cpufreq-hw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufr= eq-hw.c index 0138b2ec406dc..35d93361fda1a 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -343,9 +343,9 @@ static irqreturn_t qcom_lmh_dcvs_handle_irq(int irq, vo= id *data) =20 /* Disable interrupt and enable polling */ disable_irq_nosync(c_data->throttle_irq); - qcom_lmh_dcvs_notify(c_data); + schedule_delayed_work(&c_data->throttle_work, 0); =20 - return 0; + return IRQ_HANDLED; } =20 static const struct qcom_cpufreq_soc_data qcom_soc_data =3D { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B508C43217 for ; Mon, 24 Jan 2022 21:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452975AbiAXV1b (ORCPT ); Mon, 24 Jan 2022 16:27:31 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55262 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444468AbiAXVBA (ORCPT ); Mon, 24 Jan 2022 16:01:00 -0500 Received: from smtp.kernel.org (relay.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 2342EB80FA1; Mon, 24 Jan 2022 21:00:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4650AC340E5; Mon, 24 Jan 2022 21:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058057; bh=zLZtC7ypmlhH1omlZOAIcSh+uqnfUwqd1cdnR2k5tXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vriyTdxdTJoEztgQ0Z0Gmpu+iBcH1Mad+/AeuKFPbVa4dbkuoBrLVdZrV+cEeq9nn 68R2MNTEsXVXGyY/DfploQ8wVjBMEXuXUhJYYH573W7dFqozBytxlNlrnPo8xre6Ak EnBlUVeuhs1cwNcDVvdOXZw9f3tq/cjZkP0ERJ40= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dillon Min , kernel test robot , Linus Walleij , Alexandre Torgue , Sasha Levin Subject: [PATCH 5.16 0168/1039] ARM: dts: stm32: fix dtbs_check warning on ili9341 dts binding on stm32f429 disco Date: Mon, 24 Jan 2022 19:32:37 +0100 Message-Id: <20220124184130.866142103@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dillon Min [ Upstream commit b046049e59dca5e5830dc75ed16acf7657a95161 ] Since the compatible string defined from ilitek,ili9341.yaml is "st,sf-tc240t-9370-t", "ilitek,ili9341" so, append "ilitek,ili9341" to avoid the below dtbs_check warning. arch/arm/boot/dts/stm32f429-disco.dt.yaml: display@1: compatible: ['st,sf-tc240t-9370-t'] is too short Fixes: a726e2f000ec ("ARM: dts: stm32: enable ltdc binding with ili9341, gy= ro l3gd20 on stm32429-disco board") Signed-off-by: Dillon Min Reported-by: kernel test robot Reviewed-by: Linus Walleij Signed-off-by: Alexandre Torgue Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/boot/dts/stm32f429-disco.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/stm32f429-disco.dts b/arch/arm/boot/dts/stm3= 2f429-disco.dts index 075ac57d0bf4a..6435e099c6326 100644 --- a/arch/arm/boot/dts/stm32f429-disco.dts +++ b/arch/arm/boot/dts/stm32f429-disco.dts @@ -192,7 +192,7 @@ =20 display: display@1{ /* Connect panel-ilitek-9341 to ltdc */ - compatible =3D "st,sf-tc240t-9370-t"; + compatible =3D "st,sf-tc240t-9370-t", "ilitek,ili9341"; reg =3D <1>; spi-3wire; spi-max-frequency =3D <10000000>; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3385CC433FE for ; Mon, 24 Jan 2022 23:34:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851067AbiAXXbv (ORCPT ); Mon, 24 Jan 2022 18:31:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836489AbiAXWjg (ORCPT ); Mon, 24 Jan 2022 17:39:36 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C51BC054871; Mon, 24 Jan 2022 13:01:03 -0800 (PST) Received: from smtp.kernel.org (relay.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 3434AB81233; Mon, 24 Jan 2022 21:01:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51387C340E5; Mon, 24 Jan 2022 21:01:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058060; bh=Ix2i5yklliOEQD/vcWRxVdDk4r7GXMXZENMCJQoSCpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ltuypwTLpxBDaFSCin5BANZZOpkI3H9HFoGL0BoxhJwf3S1QYPRDfcTXerJeJO6/ ltSCw7ztBP3S6YQ1r/E/Qfs3JzOqPGeLsub/KXRxnUqZOpAKbE7P/IV59FVL2jMaGx Oh+94zrK04agrR3FwpEq2C0LNNZSBHYu++ibuw3g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Daniel Borkmann , Song Liu , Sasha Levin Subject: [PATCH 5.16 0169/1039] libbpf: Load global data maps lazily on legacy kernels Date: Mon, 24 Jan 2022 19:32:38 +0100 Message-Id: <20220124184130.907300076@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 16e0c35c6f7a2e90d52f3035ecf942af21417b7b ] Load global data maps lazily, if kernel is too old to support global data. Make sure that programs are still correct by detecting if any of the to-be-loaded programs have relocation against any of such maps. This allows to solve the issue ([0]) with bpf_printk() and Clang generating unnecessary and unreferenced .rodata.strX.Y sections, but it also goes further along the CO-RE lines, allowing to have a BPF object in which some code can work on very old kernels and relies only on BPF maps explicitly, while other BPF programs might enjoy global variable support. If such programs are correctly set to not load at runtime on old kernels, bpf_object will load and function correctly now. [0] https://lore.kernel.org/bpf/CAK-59YFPU3qO+_pXWOH+c1LSA=3D8WA1yabJZfRE= jOEXNHAqgXNg@mail.gmail.com/ Fixes: aed659170a31 ("libbpf: Support multiple .rodata.* and .data.* BPF ma= ps") Signed-off-by: Andrii Nakryiko Signed-off-by: Daniel Borkmann Acked-by: Song Liu Link: https://lore.kernel.org/bpf/20211123200105.387855-1-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/libbpf.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 509f3719409bb..4050a0f8dad66 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -4988,6 +4988,24 @@ bpf_object__create_maps(struct bpf_object *obj) for (i =3D 0; i < obj->nr_maps; i++) { map =3D &obj->maps[i]; =20 + /* To support old kernels, we skip creating global data maps + * (.rodata, .data, .kconfig, etc); later on, during program + * loading, if we detect that at least one of the to-be-loaded + * programs is referencing any global data map, we'll error + * out with program name and relocation index logged. + * This approach allows to accommodate Clang emitting + * unnecessary .rodata.str1.1 sections for string literals, + * but also it allows to have CO-RE applications that use + * global variables in some of BPF programs, but not others. + * If those global variable-using programs are not loaded at + * runtime due to bpf_program__set_autoload(prog, false), + * bpf_object loading will succeed just fine even on old + * kernels. + */ + if (bpf_map__is_internal(map) && + !kernel_supports(obj, FEAT_GLOBAL_DATA)) + continue; + retried =3D false; retry: if (map->pin_path) { @@ -5587,6 +5605,14 @@ bpf_object__relocate_data(struct bpf_object *obj, st= ruct bpf_program *prog) insn[0].src_reg =3D BPF_PSEUDO_MAP_IDX_VALUE; insn[0].imm =3D relo->map_idx; } else { + const struct bpf_map *map =3D &obj->maps[relo->map_idx]; + + if (bpf_map__is_internal(map) && + !kernel_supports(obj, FEAT_GLOBAL_DATA)) { + pr_warn("prog '%s': relo #%d: kernel doesn't support global data\n", + prog->name, i); + return -ENOTSUP; + } insn[0].src_reg =3D BPF_PSEUDO_MAP_VALUE; insn[0].imm =3D obj->maps[relo->map_idx].fd; } @@ -6121,6 +6147,8 @@ bpf_object__relocate(struct bpf_object *obj, const ch= ar *targ_btf_path) */ if (prog_is_subprog(obj, prog)) continue; + if (!prog->load) + continue; =20 err =3D bpf_object__relocate_calls(obj, prog); if (err) { @@ -6134,6 +6162,8 @@ bpf_object__relocate(struct bpf_object *obj, const ch= ar *targ_btf_path) prog =3D &obj->programs[i]; if (prog_is_subprog(obj, prog)) continue; + if (!prog->load) + continue; err =3D bpf_object__relocate_data(obj, prog); if (err) { pr_warn("prog '%s': failed to relocate data references: %d\n", @@ -6915,10 +6945,6 @@ static int bpf_object__sanitize_maps(struct bpf_obje= ct *obj) bpf_object__for_each_map(m, obj) { if (!bpf_map__is_internal(m)) continue; - if (!kernel_supports(obj, FEAT_GLOBAL_DATA)) { - pr_warn("kernel doesn't support global data\n"); - return -ENOTSUP; - } if (!kernel_supports(obj, FEAT_ARRAY_MMAP)) m->def.map_flags ^=3D BPF_F_MMAPABLE; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 204C5C433EF for ; Mon, 24 Jan 2022 23:34:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851015AbiAXXbl (ORCPT ); Mon, 24 Jan 2022 18:31:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836488AbiAXWjg (ORCPT ); Mon, 24 Jan 2022 17:39:36 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8450C054872; Mon, 24 Jan 2022 13:01:06 -0800 (PST) Received: from smtp.kernel.org (relay.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 64FB4B81243; Mon, 24 Jan 2022 21:01:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A741C340E8; Mon, 24 Jan 2022 21:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058064; bh=Nq32nGkmOvzmotwTwzSieK08WMBchdmVk7fmJ8Mhz70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ltvacDjkidv0MFbqa1ELREERfr2Z7LLXByjgGtiLEegARZiLcD9ww3p71GN0dn+is f0UrZK859OcVEMUpWv1mOezgGvCqKtekGuZxY/1jKnaS71f0Xb4xUF/Xc/OuvGpPPP 3VFuwW4326z+BC0254XmxDJYQ3ctGsjJDOY8JJWA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.16 0170/1039] tools/resolve_btf_ids: Close ELF file on error Date: Mon, 24 Jan 2022 19:32:39 +0100 Message-Id: <20220124184130.945056389@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 1144ab9bdf3430e1b5b3f22741e5283841951add ] Fix one case where we don't do explicit clean up. Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in EL= F object") Signed-off-by: Andrii Nakryiko Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20211124002325.1737739-2-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/bpf/resolve_btfids/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/mai= n.c index 73409e27be01f..5d26f3c6f918e 100644 --- a/tools/bpf/resolve_btfids/main.c +++ b/tools/bpf/resolve_btfids/main.c @@ -168,7 +168,7 @@ static struct btf_id *btf_id__find(struct rb_root *root= , const char *name) return NULL; } =20 -static struct btf_id* +static struct btf_id * btf_id__add(struct rb_root *root, char *name, bool unique) { struct rb_node **p =3D &root->rb_node; @@ -732,7 +732,8 @@ int main(int argc, const char **argv) if (obj.efile.idlist_shndx =3D=3D -1 || obj.efile.symbols_shndx =3D=3D -1) { pr_debug("Cannot find .BTF_ids or symbols sections, nothing to do\n"); - return 0; + err =3D 0; + goto out; } =20 if (symbols_collect(&obj)) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2E8CC4332F for ; Tue, 25 Jan 2022 02:47:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379980AbiAYCrO (ORCPT ); Mon, 24 Jan 2022 21:47:14 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53752 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444546AbiAXVBI (ORCPT ); Mon, 24 Jan 2022 16:01:08 -0500 Received: from smtp.kernel.org (relay.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 9C7FB60C60; Mon, 24 Jan 2022 21:01:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5008C340E5; Mon, 24 Jan 2022 21:01:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058067; bh=a96iE1mVlz1u2n3mjpHmP704KBiCwyNGseo3af3XAnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OhE82H9lwcLpTMTdT/hg1QvYjRKHQmFB0T0N5c1LoJpqvpDg8C4XSTo0PJVeULRv7 PzGhov2IHWLN84SX1l9FYDYSWntlal3wz62HbGjLMbjED4QFhuNLwjjnAAMx/EqHjx wfyQwC4anNa6h56m4zyR06+PIQjcDILjdKaMih+8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evgeny Vereshchagin , Andrii Nakryiko , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.16 0171/1039] libbpf: Fix potential misaligned memory access in btf_ext__new() Date: Mon, 24 Jan 2022 19:32:40 +0100 Message-Id: <20220124184130.990042419@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 401891a9debaf0a684502f2aaecf53448cee9414 ] Perform a memory copy before we do the sanity checks of btf_ext_hdr. This prevents misaligned memory access if raw btf_ext data is not 4-byte aligned ([0]). While at it, also add missing const qualifier. [0] Closes: https://github.com/libbpf/libbpf/issues/391 Fixes: 2993e0515bb4 ("tools/bpf: add support to read .BTF.ext sections") Reported-by: Evgeny Vereshchagin Signed-off-by: Andrii Nakryiko Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20211124002325.1737739-3-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/btf.c | 10 +++++----- tools/lib/bpf/btf.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index 7e4c5586bd877..c2400804d6bac 100644 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@ -2711,15 +2711,11 @@ void btf_ext__free(struct btf_ext *btf_ext) free(btf_ext); } =20 -struct btf_ext *btf_ext__new(__u8 *data, __u32 size) +struct btf_ext *btf_ext__new(const __u8 *data, __u32 size) { struct btf_ext *btf_ext; int err; =20 - err =3D btf_ext_parse_hdr(data, size); - if (err) - return libbpf_err_ptr(err); - btf_ext =3D calloc(1, sizeof(struct btf_ext)); if (!btf_ext) return libbpf_err_ptr(-ENOMEM); @@ -2732,6 +2728,10 @@ struct btf_ext *btf_ext__new(__u8 *data, __u32 size) } memcpy(btf_ext->data, data, size); =20 + err =3D btf_ext_parse_hdr(btf_ext->data, size); + if (err) + goto done; + if (btf_ext->hdr->hdr_len < offsetofend(struct btf_ext_header, line_info_= len)) { err =3D -EINVAL; goto done; diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index bc005ba3ceec3..17c0a46d8cd22 100644 --- a/tools/lib/bpf/btf.h +++ b/tools/lib/bpf/btf.h @@ -157,7 +157,7 @@ LIBBPF_API int btf__get_map_kv_tids(const struct btf *b= tf, const char *map_name, __u32 expected_value_size, __u32 *key_type_id, __u32 *value_type_id); =20 -LIBBPF_API struct btf_ext *btf_ext__new(__u8 *data, __u32 size); +LIBBPF_API struct btf_ext *btf_ext__new(const __u8 *data, __u32 size); LIBBPF_API void btf_ext__free(struct btf_ext *btf_ext); LIBBPF_API const void *btf_ext__get_raw_data(const struct btf_ext *btf_ext, __u32 *size); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34DF7C3526F for ; Mon, 24 Jan 2022 21:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1453143AbiAXV2P (ORCPT ); Mon, 24 Jan 2022 16:28:15 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53796 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444606AbiAXVBL (ORCPT ); Mon, 24 Jan 2022 16:01:11 -0500 Received: from smtp.kernel.org (relay.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 C473761317; Mon, 24 Jan 2022 21:01:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F689C340E5; Mon, 24 Jan 2022 21:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058070; bh=KXzbmPA767ltcjzNwVWOMCdu5eyCPYs7gRedD1yhhm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=goF2PXxf7QSRK3TAK5FKer4ODLEQKuYej9nnsrgE2oEP8WFqRpqzL6sMnVlA3H7VI RhwFTRZZAEZvZCU2gxsfL1Fr7ikWiEVCw8sifHCnn2AtXm0iauczy8qh4UGPny9Lll K2mXTdfivGbmAogrDqNO3Ct5TaooZHOlOMyrCWXY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.16 0172/1039] libbpf: Fix glob_syms memory leak in bpf_linker Date: Mon, 24 Jan 2022 19:32:41 +0100 Message-Id: <20220124184131.023971255@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 8cb125566c40b7141d8842c534f0ea5820ee3d5c ] glob_syms array wasn't freed on bpf_link__free(). Fix that. Fixes: a46349227cd8 ("libbpf: Add linker extern resolution support for func= tions and global variables") Signed-off-by: Andrii Nakryiko Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20211124002325.1737739-6-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/linker.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c index f677dccdeae44..94bdd97859285 100644 --- a/tools/lib/bpf/linker.c +++ b/tools/lib/bpf/linker.c @@ -210,6 +210,7 @@ void bpf_linker__free(struct bpf_linker *linker) } free(linker->secs); =20 + free(linker->glob_syms); free(linker); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B789C4167E for ; Mon, 24 Jan 2022 21:43:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456731AbiAXVjy (ORCPT ); Mon, 24 Jan 2022 16:39:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53848 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444634AbiAXVBO (ORCPT ); Mon, 24 Jan 2022 16:01:14 -0500 Received: from smtp.kernel.org (relay.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 A5DC061368; Mon, 24 Jan 2022 21:01:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4E10C340E5; Mon, 24 Jan 2022 21:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058073; bh=WYGVexxiQzWsmwuFARY5sLnWD4LDm3nwZavgR065GQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ybugiiHT5Hbw073FMy7P+nlWmCucYzdSzD/sxbU+BPEbVl1y2feW2J6eOc4ZsIHJ5 vJKHw6mgXS37G46UW6K1D3tbKLmlD5nxNgTyW3R/E0aetga0HKdJ1A1B2XF04hv5dT yD+8toHP6A/+wQMu2HgwWqsDTTlay3TpRV2AzOho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.16 0173/1039] libbpf: Fix using invalidated memory in bpf_linker Date: Mon, 24 Jan 2022 19:32:42 +0100 Message-Id: <20220124184131.070872399@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 593835377f24ca1bb98008ec1dc3baefe491ad6e ] add_dst_sec() can invalidate bpf_linker's section index making dst_symtab pointer pointing into unallocated memory. Reinitialize dst_symtab pointer on each iteration to make sure it's always valid. Fixes: faf6ed321cf6 ("libbpf: Add BPF static linker APIs") Signed-off-by: Andrii Nakryiko Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20211124002325.1737739-7-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/linker.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c index 94bdd97859285..6923a0ab3b127 100644 --- a/tools/lib/bpf/linker.c +++ b/tools/lib/bpf/linker.c @@ -2000,7 +2000,7 @@ add_sym: static int linker_append_elf_relos(struct bpf_linker *linker, struct src_o= bj *obj) { struct src_sec *src_symtab =3D &obj->secs[obj->symtab_sec_idx]; - struct dst_sec *dst_symtab =3D &linker->secs[linker->symtab_sec_idx]; + struct dst_sec *dst_symtab; int i, err; =20 for (i =3D 1; i < obj->sec_cnt; i++) { @@ -2033,6 +2033,9 @@ static int linker_append_elf_relos(struct bpf_linker = *linker, struct src_obj *ob return -1; } =20 + /* add_dst_sec() above could have invalidated linker->secs */ + dst_symtab =3D &linker->secs[linker->symtab_sec_idx]; + /* shdr->sh_link points to SYMTAB */ dst_sec->shdr->sh_link =3D linker->symtab_sec_idx; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0C51C433EF for ; Mon, 24 Jan 2022 21:28:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376953AbiAXV2j (ORCPT ); Mon, 24 Jan 2022 16:28:39 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49988 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444684AbiAXVBR (ORCPT ); Mon, 24 Jan 2022 16:01:17 -0500 Received: from smtp.kernel.org (relay.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 B67FF60907; Mon, 24 Jan 2022 21:01:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95834C340E5; Mon, 24 Jan 2022 21:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058076; bh=hcR7x/2ZV51OMl9iVloZAl/i91VC0EVwFhKJbq5L9UI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lBTZk2uPppCYUN5jIrnauGejT+sNaNFpyOcmYa9EDEgpQajyMR1SAnMtbs2RdiqOB csTecTgv/0Frvo8cxjbiWKLqC04PLJ1jj8lTItbwfHzeCypCHNOLqL05Fqu7XU5OpR djFIPSAkCB/Ke3B2k5nABlkmGfGfW/Cx4wBMk1vI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Giovanni Cabiddu , Marco Chiappero , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0174/1039] crypto: qat - fix undetected PFVF timeout in ACK loop Date: Mon, 24 Jan 2022 19:32:43 +0100 Message-Id: <20220124184131.103592156@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Giovanni Cabiddu [ Upstream commit 5002200b4fedd7e90e4fbc2e5c42a4b3351df814 ] If the remote function did not ACK the reception of a message, the function __adf_iov_putmsg() could detect it as a collision. This was due to the fact that the collision and the timeout checks after the ACK loop were in the wrong order. The timeout must be checked at the end of the loop, so fix by swapping the order of the two checks. Fixes: 9b768e8a3909 ("crypto: qat - detect PFVF collision after ACK") Signed-off-by: Giovanni Cabiddu Co-developed-by: Marco Chiappero Signed-off-by: Marco Chiappero Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto= /qat/qat_common/adf_pf2vf_msg.c index 59860bdaedb69..99ee17c3d06bf 100644 --- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c @@ -107,6 +107,12 @@ static int __adf_iov_putmsg(struct adf_accel_dev *acce= l_dev, u32 msg, u8 vf_nr) val =3D ADF_CSR_RD(pmisc_bar_addr, pf2vf_offset); } while ((val & int_bit) && (count++ < ADF_PFVF_MSG_ACK_MAX_RETRY)); =20 + if (val & int_bit) { + dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n"); + val &=3D ~int_bit; + ret =3D -EIO; + } + if (val !=3D msg) { dev_dbg(&GET_DEV(accel_dev), "Collision - PFVF CSR overwritten by remote function\n"); @@ -114,12 +120,6 @@ static int __adf_iov_putmsg(struct adf_accel_dev *acce= l_dev, u32 msg, u8 vf_nr) goto out; } =20 - if (val & int_bit) { - dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n"); - val &=3D ~int_bit; - ret =3D -EIO; - } - /* Finished with the PFVF CSR; relinquish it and leave msg in CSR */ ADF_CSR_WR(pmisc_bar_addr, pf2vf_offset, val & ~local_in_use_mask); out: --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44E9AC433EF for ; Mon, 24 Jan 2022 21:29:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1449819AbiAXV3A (ORCPT ); Mon, 24 Jan 2022 16:29:00 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50102 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444729AbiAXVBX (ORCPT ); Mon, 24 Jan 2022 16:01:23 -0500 Received: from smtp.kernel.org (relay.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 D404161362; Mon, 24 Jan 2022 21:01:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8FB9C340E5; Mon, 24 Jan 2022 21:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058082; bh=f4qv9+XoMJz7jvZPqwNvE9ROL1hpgoLQm93jE0hJKBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LGsQpIq4Jic0lOQFxtIl5rrLV7bzahOfSqm16MIVhRF/j97e+GK0+8O5bUo624sqg qIHWUWXbBx1twJ0zI6/dmtP+L4lAXNi26Z4N0ON3ZhBK3i8TPnDa2nX8gd66H1U1cI dwGx31GQJ4RA4InWEE8+NeCYt/EWCs6PvS6S3c28= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anilkumar Kolli , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0175/1039] ath11k: Use host CE parameters for CE interrupts configuration Date: Mon, 24 Jan 2022 19:32:44 +0100 Message-Id: <20220124184131.143256903@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Anilkumar Kolli [ Upstream commit b689f091aafd1a874b2f88137934276ab0fca480 ] CE interrupt configuration uses host ce parameters to assign/free interrupts. Use host ce parameters to enable/disable interrupts. This patch fixes below BUG, BUG: KASAN: global-out-of-bounds in 0xffffffbffdfb035c at addr ffffffbffde6eeac Read of size 4 by task kworker/u8:2/132 Address belongs to variable ath11k_core_qmi_firmware_ready+0x1b0/0x5bc [at= h11k] OOB is due to ath11k_ahb_ce_irqs_enable() iterates ce_count(which is 12) times and accessing 12th element in target_ce_config (which has only 11 elements) from ath11k_ahb_ce_irq_enable(). With this change host ce configs are used to enable/disable interrupts. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-00471-QCAHKSWPL_SILICONZ-1 Fixes: 967c1d1131fa ("ath11k: move target ce configs to hw_params") Signed-off-by: Anilkumar Kolli Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1637249558-12793-1-git-send-email-akolli@co= deaurora.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/ahb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/a= th/ath11k/ahb.c index 8c9c781afc3e5..096c502cce387 100644 --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c @@ -206,13 +206,13 @@ static void ath11k_ahb_clearbit32(struct ath11k_base = *ab, u8 bit, u32 offset) =20 static void ath11k_ahb_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) { - const struct ce_pipe_config *ce_config; + const struct ce_attr *ce_attr; =20 - ce_config =3D &ab->hw_params.target_ce_config[ce_id]; - if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_OUT) + ce_attr =3D &ab->hw_params.host_ce_config[ce_id]; + if (ce_attr->src_nentries) ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_ADDRESS); =20 - if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_IN) { + if (ce_attr->dest_nentries) { ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); ath11k_ahb_setbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, CE_HOST_IE_3_ADDRESS); @@ -221,13 +221,13 @@ static void ath11k_ahb_ce_irq_enable(struct ath11k_ba= se *ab, u16 ce_id) =20 static void ath11k_ahb_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) { - const struct ce_pipe_config *ce_config; + const struct ce_attr *ce_attr; =20 - ce_config =3D &ab->hw_params.target_ce_config[ce_id]; - if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_OUT) + ce_attr =3D &ab->hw_params.host_ce_config[ce_id]; + if (ce_attr->src_nentries) ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_ADDRESS); =20 - if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_IN) { + if (ce_attr->dest_nentries) { ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); ath11k_ahb_clearbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, CE_HOST_IE_3_ADDRESS); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CBC6C43217 for ; Mon, 24 Jan 2022 23:34:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851053AbiAXXbs (ORCPT ); Mon, 24 Jan 2022 18:31:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836490AbiAXWjg (ORCPT ); Mon, 24 Jan 2022 17:39:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B1D6C054873; Mon, 24 Jan 2022 13:01:26 -0800 (PST) Received: from smtp.kernel.org (relay.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 EF22760C17; Mon, 24 Jan 2022 21:01:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C379AC340E5; Mon, 24 Jan 2022 21:01:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058085; bh=k4iMiEeTASmYGmITRMv4gYpGEhH/4cLgMRmqExbaV+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wt/l/qFg45C7TjkZNcA+y+H6Ty/arb0b0ut/uMkZ4RLWLBfSkwPdaWUSgCggI0/qs MFNcl7cAozVQPwZSVjdzBxwF89HuZ4JBvxImWNha20EHBSv/hcgMO6MQ1s2ktofkZd YwGVbGkFoq9nfpCFzcLC7/9TbAXedprwRM1f6M+0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan , Nishanth Menon , Vignesh Raghavendra , Sasha Levin Subject: [PATCH 5.16 0176/1039] arm64: dts: ti: k3-j721e: correct cache-sets info Date: Mon, 24 Jan 2022 19:32:45 +0100 Message-Id: <20220124184131.176905171@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Fan [ Upstream commit 7a0df1f969c14939f60a7f9a6af72adcc314675f ] A72 Cluster has 48KB Icache, 32KB Dcache and 1MB L2 Cache - ICache is 3-way set-associative - Dcache is 2-way set-associative - Line size are 64bytes So correct the cache-sets info. Fixes: 2d87061e70dea ("arm64: dts: ti: Add Support for J721E SoC") Signed-off-by: Peng Fan Reviewed-by: Nishanth Menon Signed-off-by: Vignesh Raghavendra Link: https://lore.kernel.org/r/20211112063155.3485777-1-peng.fan@oss.nxp.c= om Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/ti/k3-j721e.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/ti/k3-j721e.dtsi b/arch/arm64/boot/dts/ti/= k3-j721e.dtsi index 214359e7288b2..a5967ba139d7e 100644 --- a/arch/arm64/boot/dts/ti/k3-j721e.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j721e.dtsi @@ -64,7 +64,7 @@ i-cache-sets =3D <256>; d-cache-size =3D <0x8000>; d-cache-line-size =3D <64>; - d-cache-sets =3D <128>; + d-cache-sets =3D <256>; next-level-cache =3D <&L2_0>; }; =20 @@ -78,7 +78,7 @@ i-cache-sets =3D <256>; d-cache-size =3D <0x8000>; d-cache-line-size =3D <64>; - d-cache-sets =3D <128>; + d-cache-sets =3D <256>; next-level-cache =3D <&L2_0>; }; }; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51684C433FE for ; Mon, 24 Jan 2022 21:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456002AbiAXVhE (ORCPT ); Mon, 24 Jan 2022 16:37:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55586 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444767AbiAXVBc (ORCPT ); Mon, 24 Jan 2022 16:01:32 -0500 Received: from smtp.kernel.org (relay.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 827B5B81063; Mon, 24 Jan 2022 21:01:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B814BC340E5; Mon, 24 Jan 2022 21:01:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058088; bh=BEB192YSk8J7M70ks8jXvP3kVrZQ28TXQvGWZkv04+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N2UdX3pGZSDM/lDL/AJDOgi1Ko7jvZdnfy0IieA8s0QBTx5LfdM0H6sC6oJB1pY3U iohkoNVI7LSYUya29hJohZ0AM1WczxJKjOTXKej+bhcJokK3RwL2S6DVDmSG1MQodX TguAgOAnUBqiisd6eTmfq4QG/5X3cpb0FKSM3Du4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Richard Genoud , Sasha Levin Subject: [PATCH 5.16 0177/1039] tty: serial: atmel: Check return code of dmaengine_submit() Date: Mon, 24 Jan 2022 19:32:46 +0100 Message-Id: <20220124184131.217361811@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus [ Upstream commit 1e67bd2b8cb90b66e89562598e9c2046246832d3 ] The tx_submit() method of struct dma_async_tx_descriptor is entitled to do sanity checks and return errors if encountered. It's not the case for the DMA controller drivers that this client is using (at_h/xdmac), because they currently don't do sanity checks and always return a positive cookie at tx_submit() method. In case the controller drivers will implement sanity checks and return errors, print a message so that the client will be informed that something went wrong at tx_submit() level. Fixes: 08f738be88bb ("serial: at91: add tx dma support") Signed-off-by: Tudor Ambarus Acked-by: Richard Genoud Link: https://lore.kernel.org/r/20211125090028.786832-3-tudor.ambarus@micro= chip.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/atmel_serial.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_s= erial.c index 2c99a47a25357..376f7a9c2868a 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port) desc->callback =3D atmel_complete_tx_dma; desc->callback_param =3D atmel_port; atmel_port->cookie_tx =3D dmaengine_submit(desc); + if (dma_submit_error(atmel_port->cookie_tx)) { + dev_err(port->dev, "dma_submit_error %d\n", + atmel_port->cookie_tx); + return; + } } =20 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) @@ -1258,6 +1263,11 @@ static int atmel_prepare_rx_dma(struct uart_port *po= rt) desc->callback_param =3D port; atmel_port->desc_rx =3D desc; atmel_port->cookie_rx =3D dmaengine_submit(desc); + if (dma_submit_error(atmel_port->cookie_rx)) { + dev_err(port->dev, "dma_submit_error %d\n", + atmel_port->cookie_rx); + goto chan_err; + } =20 return 0; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 894B2C3526F for ; Mon, 24 Jan 2022 21:38:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456274AbiAXViV (ORCPT ); Mon, 24 Jan 2022 16:38:21 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55618 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444771AbiAXVBd (ORCPT ); Mon, 24 Jan 2022 16:01:33 -0500 Received: from smtp.kernel.org (relay.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 7E5E0B81233; Mon, 24 Jan 2022 21:01:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97445C340E5; Mon, 24 Jan 2022 21:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058091; bh=zikkDb5E0yQAxePuAHSQ7wRITvp+edAuiWAtjoerU2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bWQsTROrasDxrLGfPk9xoNlRQ90hB+y/HNy7BP4OaqOaqsAstxZE01coqxdkIYxc8 xyVMca/qaEXQcWVriIRV3yks+QQAud6TZTLIDf96viyR8jSsUap31myl9006SKQDk6 hSeyQ4akFOFllVn+oBq0CxdWaQC2/h12IE75cuHw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Sasha Levin Subject: [PATCH 5.16 0178/1039] tty: serial: atmel: Call dma_async_issue_pending() Date: Mon, 24 Jan 2022 19:32:47 +0100 Message-Id: <20220124184131.256776519@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus [ Upstream commit 4f4b9b5895614eb2e2b5f4cab7858f44bd113e1b ] The driver wrongly assummed that tx_submit() will start the transfer, which is not the case, now that the at_xdmac driver is fixed. tx_submit is supposed to push the current transaction descriptor to a pending queue, waiting for issue_pending to be called. issue_pending must start the transfer, not tx_submit. Fixes: 34df42f59a60 ("serial: at91: add rx dma support") Fixes: 08f738be88bb ("serial: at91: add tx dma support") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211125090028.786832-4-tudor.ambarus@micro= chip.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/atmel_serial.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_s= erial.c index 376f7a9c2868a..269b4500e9e78 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1009,6 +1009,8 @@ static void atmel_tx_dma(struct uart_port *port) atmel_port->cookie_tx); return; } + + dma_async_issue_pending(chan); } =20 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) @@ -1269,6 +1271,8 @@ static int atmel_prepare_rx_dma(struct uart_port *por= t) goto chan_err; } =20 + dma_async_issue_pending(atmel_port->chan_rx); + return 0; =20 chan_err: --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A732DC35270 for ; Mon, 24 Jan 2022 21:38:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378035AbiAXVid (ORCPT ); Mon, 24 Jan 2022 16:38:33 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55642 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444812AbiAXVBg (ORCPT ); Mon, 24 Jan 2022 16:01:36 -0500 Received: from smtp.kernel.org (relay.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 8DA38B81243; Mon, 24 Jan 2022 21:01:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BDB2C340E7; Mon, 24 Jan 2022 21:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058094; bh=OwpKNv0ksLy2DW7Xq4ObVUnGJwW2RSKgFNXj5Tn8mh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KJzaLQ/FVc6ljE/dX+tqxjfau6yDcEpx2cLfeHHBwm1U/T7RUksFh0dtlxG8AcTjO nXBvU6MONvlAMQ1HbhWKFzKDP9JIHGyINfyXNq7sZOHuhfTD5O/hjLW5SjdZ2g7jyg zm6Vf4dnEhfhUQCxLGS3XFreWXPlQgT46fvq0gJQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joey Gouly , Andy Shevchenko , Linus Walleij , Sasha Levin Subject: [PATCH 5.16 0179/1039] pinctrl: apple: return an error if pinmux is missing in the DT Date: Mon, 24 Jan 2022 19:32:48 +0100 Message-Id: <20220124184131.296510925@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joey Gouly [ Upstream commit 839930ca1bd0c79cdf370d11462ef4a81b664e44 ] If of_property_count_u32_elems returned 0, return -EINVAL to indicate a failure. Previously this would return 0. Fixes: a0f160ffcb83 ("pinctrl: add pinctrl/GPIO driver for Apple SoCs") Signed-off-by: Joey Gouly Suggested-by: Andy Shevchenko Link: https://lore.kernel.org/r/20211121165642.27883-12-joey.gouly@arm.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pinctrl/pinctrl-apple-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-apple-gpio.c b/drivers/pinctrl/pinctrl= -apple-gpio.c index a7861079a6502..c772e31d21223 100644 --- a/drivers/pinctrl/pinctrl-apple-gpio.c +++ b/drivers/pinctrl/pinctrl-apple-gpio.c @@ -114,7 +114,7 @@ static int apple_gpio_dt_node_to_map(struct pinctrl_dev= *pctldev, dev_err(pctl->dev, "missing or empty pinmux property in node %pOFn.\n", node); - return ret; + return ret ? ret : -EINVAL; } =20 num_pins =3D ret; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7EADC433FE for ; Mon, 24 Jan 2022 21:38:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357764AbiAXVhO (ORCPT ); Mon, 24 Jan 2022 16:37:14 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:52752 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444838AbiAXVBi (ORCPT ); Mon, 24 Jan 2022 16:01:38 -0500 Received: from smtp.kernel.org (relay.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 21ED0611C8; Mon, 24 Jan 2022 21:01:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCDA1C340E5; Mon, 24 Jan 2022 21:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058097; bh=YuuSrqYlWfqBWeMQ4MbvsTRyHLnB3n4XxO178j8t/cY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wTWlIEJHUj+SvR86COfrF5+QtM6FCY8NVkyYJvtfAIPSZ5IW00TUEtKV+DxJUJGX0 X2BW5ridq/ZrGibioCzuFr4qizkkUfc0k3rkgyO4ymPRVp+9hQW9bvGpawyuCAQMeQ h2ohs/jRLrpH9pcRw1NRCXvUwgCkl9toF6aAqj0I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , =?UTF-8?q?Alvin=20=C5=A0ipraga?= , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0180/1039] net: dsa: rtl8365mb: set RGMII RX delay in steps of 0.3 ns Date: Mon, 24 Jan 2022 19:32:49 +0100 Message-Id: <20220124184131.329846146@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Alvin =C5=A0ipraga [ Upstream commit ef136837aaf6f37f2dec78551671a6883f868d69 ] A contact at Realtek has clarified what exactly the units of RGMII RX delay are. The answer is that the unit of RX delay is "about 0.3 ns". Take this into account when parsing rx-internal-delay-ps by approximating the closest step value. Delays of more than 2.1 ns are rejected. This obviously contradicts the previous assumption in the driver that a step value of 4 was "about 2 ns", but Realtek also points out that it is easy to find more than one RX delay step value which makes RGMII work. Fixes: 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver for RT= L8365MB-VC") Cc: Ar=C4=B1n=C3=A7 =C3=9CNAL Signed-off-by: Alvin =C5=A0ipraga Acked-by: Ar=C4=B1n=C3=A7 =C3=9CNAL Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/dsa/rtl8365mb.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/dsa/rtl8365mb.c b/drivers/net/dsa/rtl8365mb.c index 078ca4cd71605..48c0e3e466001 100644 --- a/drivers/net/dsa/rtl8365mb.c +++ b/drivers/net/dsa/rtl8365mb.c @@ -767,7 +767,8 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_sm= i *smi, int port, * 0 =3D no delay, 1 =3D 2 ns delay * RX delay: * 0 =3D no delay, 7 =3D maximum delay - * No units are specified, but there are a total of 8 steps. + * Each step is approximately 0.3 ns, so the maximum delay is about + * 2.1 ns. * * The vendor driver also states that this must be configured *before* * forcing the external interface into a particular mode, which is done @@ -778,10 +779,6 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_s= mi *smi, int port, * specified. We ignore the detail of the RGMII interface mode * (RGMII_{RXID, TXID, etc.}), as this is considered to be a PHY-only * property. - * - * For the RX delay, we assume that a register value of 4 corresponds to - * 2 ns. But this is just an educated guess, so ignore all other values - * to avoid too much confusion. */ if (!of_property_read_u32(dn, "tx-internal-delay-ps", &val)) { val =3D val / 1000; /* convert to ns */ @@ -794,13 +791,13 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_= smi *smi, int port, } =20 if (!of_property_read_u32(dn, "rx-internal-delay-ps", &val)) { - val =3D val / 1000; /* convert to ns */ + val =3D DIV_ROUND_CLOSEST(val, 300); /* convert to 0.3 ns step */ =20 - if (val =3D=3D 0 || val =3D=3D 2) - rx_delay =3D val * 2; + if (val <=3D 7) + rx_delay =3D val; else dev_warn(smi->dev, - "EXT port RX delay must be 0 to 2 ns\n"); + "EXT port RX delay must be 0 to 2.1 ns\n"); } =20 ret =3D regmap_update_bits( --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AEBFC433EF for ; Mon, 24 Jan 2022 21:38:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377542AbiAXVhe (ORCPT ); Mon, 24 Jan 2022 16:37:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54560 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444877AbiAXVBm (ORCPT ); Mon, 24 Jan 2022 16:01:42 -0500 Received: from smtp.kernel.org (relay.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 CAB39B811A9; Mon, 24 Jan 2022 21:01:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECBC9C340E5; Mon, 24 Jan 2022 21:01:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058100; bh=LQFQXJKh8AgcmpSq95ncbAZc/m3gURnAWKojwDiSKVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JIVi1kspjh22enzUCP73vc81LWzAYGI2+kaxqrD4ASw03urzRQJeMxGR0C6L3XfXo 1HzyVs5WaX2lG9fH10T+RR7J2AnsnkYCw4TkDNljIqZGDvNIOqVhjzcQzJ+jQIVlSB v+Hwyc3nKITqcfz5LBHxoDkQ791KH7Qe3Z+ieHFY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Nicolas Ferre , Lee Jones , Sasha Levin Subject: [PATCH 5.16 0181/1039] mfd: atmel-flexcom: Remove #ifdef CONFIG_PM_SLEEP Date: Mon, 24 Jan 2022 19:32:50 +0100 Message-Id: <20220124184131.366918946@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea [ Upstream commit 8c0fad75dcaa650e3f3145a2c35847bc6a65cb7f ] Remove compilation flag and use __maybe_unused and pm_ptr instead. Signed-off-by: Claudiu Beznea Acked-by: Nicolas Ferre Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211028135138.3481166-2-claudiu.beznea@mic= rochip.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mfd/atmel-flexcom.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/atmel-flexcom.c b/drivers/mfd/atmel-flexcom.c index d2f5c073fdf31..962f66dc8813e 100644 --- a/drivers/mfd/atmel-flexcom.c +++ b/drivers/mfd/atmel-flexcom.c @@ -87,8 +87,7 @@ static const struct of_device_id atmel_flexcom_of_match[]= =3D { }; MODULE_DEVICE_TABLE(of, atmel_flexcom_of_match); =20 -#ifdef CONFIG_PM_SLEEP -static int atmel_flexcom_resume(struct device *dev) +static int __maybe_unused atmel_flexcom_resume(struct device *dev) { struct atmel_flexcom *ddata =3D dev_get_drvdata(dev); int err; @@ -105,7 +104,6 @@ static int atmel_flexcom_resume(struct device *dev) =20 return 0; } -#endif =20 static SIMPLE_DEV_PM_OPS(atmel_flexcom_pm_ops, NULL, atmel_flexcom_resume); @@ -114,7 +112,7 @@ static struct platform_driver atmel_flexcom_driver =3D { .probe =3D atmel_flexcom_probe, .driver =3D { .name =3D "atmel_flexcom", - .pm =3D &atmel_flexcom_pm_ops, + .pm =3D pm_ptr(&atmel_flexcom_pm_ops), .of_match_table =3D atmel_flexcom_of_match, }, }; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8449BC43219 for ; Mon, 24 Jan 2022 21:38:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456081AbiAXVhm (ORCPT ); Mon, 24 Jan 2022 16:37:42 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55712 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444931AbiAXVBq (ORCPT ); Mon, 24 Jan 2022 16:01:46 -0500 Received: from smtp.kernel.org (relay.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 EF926B8121C; Mon, 24 Jan 2022 21:01:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E786C340E8; Mon, 24 Jan 2022 21:01:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058103; bh=2oPRCzvY5dsRKRC7+16mS3DHzsCSSWf7cRER46nZmQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AvPh9DgtWvYpuh7FWaILLyvGmXYTK+zC1LGZdT+y4hRWmyEbUpC/DqjQnfzgD9Rtg Lyuq+JnbR91jB6mS3xfMkYcDCegTwsljlVfk07XPV1m411aPVqVMD/yYfoonG2mywx FSMs0TrhWhI+vndxaDDzMy0M/4fhYvFK1MJY8nvQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Codrin Ciubotariu , Nicolas Ferre , Lee Jones , Sasha Levin Subject: [PATCH 5.16 0182/1039] mfd: atmel-flexcom: Use .resume_noirq Date: Mon, 24 Jan 2022 19:32:51 +0100 Message-Id: <20220124184131.397925606@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea [ Upstream commit 5d051cf94fd5834a1513aa77e542c49fd973988a ] Flexcom IP embeds 3 other IPs: usart, i2c, spi and selects the operation mode (usart, i2c, spi) via mode register (FLEX_MR). On i2c bus there might be connected critical devices (like PMIC) which on suspend/resume should be suspended/resumed at the end/beginning. i2c uses .suspend_noirq/.resume_noirq for this kind of purposes. Align flexcom to use .resume_noirq as it should be resumed before the embedded IPs. Otherwise the embedded devices might behave badly. Fixes: 7fdec11015c3 ("atmel_flexcom: Support resuming after a chip reset") Signed-off-by: Claudiu Beznea Tested-by: Codrin Ciubotariu Acked-by: Nicolas Ferre Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211028135138.3481166-3-claudiu.beznea@mic= rochip.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mfd/atmel-flexcom.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/atmel-flexcom.c b/drivers/mfd/atmel-flexcom.c index 962f66dc8813e..559eb4d352b68 100644 --- a/drivers/mfd/atmel-flexcom.c +++ b/drivers/mfd/atmel-flexcom.c @@ -87,7 +87,7 @@ static const struct of_device_id atmel_flexcom_of_match[]= =3D { }; MODULE_DEVICE_TABLE(of, atmel_flexcom_of_match); =20 -static int __maybe_unused atmel_flexcom_resume(struct device *dev) +static int __maybe_unused atmel_flexcom_resume_noirq(struct device *dev) { struct atmel_flexcom *ddata =3D dev_get_drvdata(dev); int err; @@ -105,8 +105,9 @@ static int __maybe_unused atmel_flexcom_resume(struct d= evice *dev) return 0; } =20 -static SIMPLE_DEV_PM_OPS(atmel_flexcom_pm_ops, NULL, - atmel_flexcom_resume); +static const struct dev_pm_ops atmel_flexcom_pm_ops =3D { + .resume_noirq =3D atmel_flexcom_resume_noirq, +}; =20 static struct platform_driver atmel_flexcom_driver =3D { .probe =3D atmel_flexcom_probe, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2D30C4167D for ; Mon, 24 Jan 2022 23:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851202AbiAXXcI (ORCPT ); Mon, 24 Jan 2022 18:32:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836493AbiAXWjh (ORCPT ); Mon, 24 Jan 2022 17:39:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6000C054874; Mon, 24 Jan 2022 13:01:47 -0800 (PST) Received: from smtp.kernel.org (relay.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 4366B6131F; Mon, 24 Jan 2022 21:01:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 183EDC340E5; Mon, 24 Jan 2022 21:01:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058106; bh=cf3LxnhY71jlrMoqRMBqvHmx+grq7ctd4LTG2H4U8cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V+OUp9QdQ87TnIrHlJBTPwqtIyHFVjw6Rx+qRKBmbv0VwLewBsvhxm89REL+LP5gS f1630gGYwOjWaxRBsPPMoNNU+YxMHt5DKH3AHVqj2ls6wvzgGl6Jhu27XI5n2MXMRL EahyIY0jOhex93gDUUD75KDG+xH93MvOi4i8+sR8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Valente , Jan Kara , Jens Axboe , Sasha Levin Subject: [PATCH 5.16 0183/1039] bfq: Do not let waker requests skip proper accounting Date: Mon, 24 Jan 2022 19:32:52 +0100 Message-Id: <20220124184131.428737070@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit c65e6fd460b4df796ecd6ea22e132076ed1f2820 ] Commit 7cc4ffc55564 ("block, bfq: put reqs of waker and woken in dispatch list") added a condition to bfq_insert_request() which added waker's requests directly to dispatch list. The rationale was that completing waker's IO is needed to get more IO for the current queue. Although this rationale is valid, there is a hole in it. The waker does not necessarily serve the IO only for the current queue and maybe it's current IO is not needed for current queue to make progress. Furthermore injecting IO like this completely bypasses any service accounting within bfq and thus we do not properly track how much service is waker's queue getting or that the waker is actually doing any IO. Depending on the conditions this can result in the waker getting too much or too few service. Consider for example the following job file: [global] directory=3D/mnt/repro/ rw=3Dwrite size=3D8g time_based runtime=3D30 ramp_time=3D10 blocksize=3D1m direct=3D0 ioengine=3Dsync [slowwriter] numjobs=3D1 prioclass=3D2 prio=3D7 fsync=3D200 [fastwriter] numjobs=3D1 prioclass=3D2 prio=3D0 fsync=3D200 Despite processes have very different IO priorities, they get the same about of service. The reason is that bfq identifies these processes as having waker-wakee relationship and once that happens, IO from fastwriter gets injected during slowwriter's time slice. As a result bfq is not aware that fastwriter has any IO to do and constantly schedules only slowwriter's queue. Thus fastwriter is forced to compete with slowwriter's IO all the time instead of getting its share of time based on IO priority. Drop the special injection condition from bfq_insert_request(). As a result, requests will be tracked and queued in a normal way and on next dispatch bfq_select_queue() can decide whether the waker's inserted requests should be injected during the current queue's timeslice or not. Fixes: 7cc4ffc55564 ("block, bfq: put reqs of waker and woken in dispatch l= ist") Acked-by: Paolo Valente Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20211125133645.27483-8-jack@suse.cz Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- block/bfq-iosched.c | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index fec18118dc309..30918b0e81c02 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -5991,48 +5991,7 @@ static void bfq_insert_request(struct blk_mq_hw_ctx = *hctx, struct request *rq, =20 spin_lock_irq(&bfqd->lock); bfqq =3D bfq_init_rq(rq); - - /* - * Reqs with at_head or passthrough flags set are to be put - * directly into dispatch list. Additional case for putting rq - * directly into the dispatch queue: the only active - * bfq_queues are bfqq and either its waker bfq_queue or one - * of its woken bfq_queues. The rationale behind this - * additional condition is as follows: - * - consider a bfq_queue, say Q1, detected as a waker of - * another bfq_queue, say Q2 - * - by definition of a waker, Q1 blocks the I/O of Q2, i.e., - * some I/O of Q1 needs to be completed for new I/O of Q2 - * to arrive. A notable example of waker is journald - * - so, Q1 and Q2 are in any respect the queues of two - * cooperating processes (or of two cooperating sets of - * processes): the goal of Q1's I/O is doing what needs to - * be done so that new Q2's I/O can finally be - * issued. Therefore, if the service of Q1's I/O is delayed, - * then Q2's I/O is delayed too. Conversely, if Q2's I/O is - * delayed, the goal of Q1's I/O is hindered. - * - as a consequence, if some I/O of Q1/Q2 arrives while - * Q2/Q1 is the only queue in service, there is absolutely - * no point in delaying the service of such an I/O. The - * only possible result is a throughput loss - * - so, when the above condition holds, the best option is to - * have the new I/O dispatched as soon as possible - * - the most effective and efficient way to attain the above - * goal is to put the new I/O directly in the dispatch - * list - * - as an additional restriction, Q1 and Q2 must be the only - * busy queues for this commit to put the I/O of Q2/Q1 in - * the dispatch list. This is necessary, because, if also - * other queues are waiting for service, then putting new - * I/O directly in the dispatch list may evidently cause a - * violation of service guarantees for the other queues - */ - if (!bfqq || - (bfqq !=3D bfqd->in_service_queue && - bfqd->in_service_queue !=3D NULL && - bfq_tot_busy_queues(bfqd) =3D=3D 1 + bfq_bfqq_busy(bfqq) && - (bfqq->waker_bfqq =3D=3D bfqd->in_service_queue || - bfqd->in_service_queue->waker_bfqq =3D=3D bfqq)) || at_head) { + if (!bfqq || at_head) { if (at_head) list_add(&rq->queuelist, &bfqd->dispatch); else @@ -6059,7 +6018,6 @@ static void bfq_insert_request(struct blk_mq_hw_ctx *= hctx, struct request *rq, * merge). */ cmd_flags =3D rq->cmd_flags; - spin_unlock_irq(&bfqd->lock); =20 bfq_update_insert_stats(q, bfqq, idle_timer_disabled, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 817BFC2BA4C for ; Mon, 24 Jan 2022 21:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456169AbiAXVh6 (ORCPT ); Mon, 24 Jan 2022 16:37:58 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54438 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444979AbiAXVBu (ORCPT ); Mon, 24 Jan 2022 16:01:50 -0500 Received: from smtp.kernel.org (relay.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 5122D60C17; Mon, 24 Jan 2022 21:01:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 314AFC340E5; Mon, 24 Jan 2022 21:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058109; bh=RCFUEYNF8zNosS4379XW1Pwb4Rx5S5veAVuWvZxUI2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D9Y1WObEbu60uL+ms9Q57TeIsgGg/5orLASjVI8T0vsj+Utq58Z6cU1ViqemjWf3c QDXL51TY+xbGlAH9o56lF+GKMwruOw69hg3Q2JCZrY95/MsEqdY0W/dUD8+QUSalBY f80ceAgvkVpHEjmbcjwYarQ80r/PM9MPpURaNK6c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Maguire , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.16 0184/1039] libbpf: Silence uninitialized warning/error in btf_dump_dump_type_data Date: Mon, 24 Jan 2022 19:32:53 +0100 Message-Id: <20220124184131.467285436@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Alan Maguire [ Upstream commit 43174f0d4597325cb91f1f1f55263eb6e6101036 ] When compiling libbpf with gcc 4.8.5, we see: CC staticobjs/btf_dump.o btf_dump.c: In function =E2=80=98btf_dump_dump_type_data.isra.24=E2=80=99: btf_dump.c:2296:5: error: =E2=80=98err=E2=80=99 may be used uninitialized i= n this function [-Werror=3Dmaybe-uninitialized] if (err < 0) ^ cc1: all warnings being treated as errors make: *** [staticobjs/btf_dump.o] Error 1 While gcc 4.8.5 is too old to build the upstream kernel, it's possible it could be used to build standalone libbpf which suffers from the same proble= m. Silence the error by initializing 'err' to 0. The warning/error seems to be a false positive since err is set early in the function. Regardless we shouldn't prevent libbpf from building for this. Fixes: 920d16af9b42 ("libbpf: BTF dumper support for typed data") Signed-off-by: Alan Maguire Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/1638180040-8037-1-git-send-email-alan.mag= uire@oracle.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/btf_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c index 17db62b5002e8..5cae71600631b 100644 --- a/tools/lib/bpf/btf_dump.c +++ b/tools/lib/bpf/btf_dump.c @@ -2194,7 +2194,7 @@ static int btf_dump_dump_type_data(struct btf_dump *d, __u8 bits_offset, __u8 bit_sz) { - int size, err; + int size, err =3D 0; =20 size =3D btf_dump_type_data_check_overflow(d, t, id, data, bits_offset); if (size < 0) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16AEFC433EF for ; Mon, 24 Jan 2022 21:39:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456399AbiAXVjC (ORCPT ); Mon, 24 Jan 2022 16:39:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54604 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445066AbiAXVCB (ORCPT ); Mon, 24 Jan 2022 16:02:01 -0500 Received: from smtp.kernel.org (relay.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 627F260B28; Mon, 24 Jan 2022 21:02:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F33EC340E5; Mon, 24 Jan 2022 21:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058120; bh=ckyorOORVsIp70Q+mkMHGOBzftHyZMq+cQA994k0QLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lac4Ah3dcUrCKPITN0Y1m4kSKRP8CKU2mdp1a8dMHzJnNpoAAO8sWotMSM4POrmed R6USd2eStCsE5eBgAt//QhwPqdPE71xrKE5uzk/XzkV3QjpCsUr+DxvMq63VlI47mg JaSF5HXviFM7YcmSGYg9mjSaymZLR3CIUgy5i1uc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eugen Hristev , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0185/1039] media: i2c: imx274: fix s_frame_interval runtime resume not requested Date: Mon, 24 Jan 2022 19:32:54 +0100 Message-Id: <20220124184131.508745317@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eugen Hristev [ Upstream commit da653498c20ba5b185214d8ae43b4e8e9594f520 ] pm_runtime_resume_and_get should be called when the s_frame_interval is called. The driver will try to access device registers to configure VMAX, coarse time and exposure. Currently if the runtime is not resumed, this fails: # media-ctl -d /dev/media0 --set-v4l2 '"IMX274 1-001a":0[fmt:SRGGB10_1X10/= 3840x2 160@1/10]' IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 3840x2160, good= ness 0 IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1920x1080, good= ness -3000 IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1280x720, goodn= ess -4000 IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1280x540, goodn= ess -4180 IMX274 1-001a: __imx274_change_compose: selected 1x1 binning IMX274 1-001a: imx274_set_frame_interval: input frame interval =3D 1 / 10 IMX274 1-001a: imx274_read_mbreg : addr 0x300e, val=3D0x1 (2 bytes) IMX274 1-001a: imx274_set_frame_interval : register SVR =3D 1 IMX274 1-001a: imx274_read_mbreg : addr 0x30f6, val=3D0x6a8 (2 bytes) IMX274 1-001a: imx274_set_frame_interval : register HMAX =3D 1704 IMX274 1-001a: imx274_set_frame_length : input length =3D 2112 IMX274 1-001a: imx274_write_mbreg : i2c bulk write failed, 30f8 =3D 884 (3 = bytes) IMX274 1-001a: imx274_set_frame_length error =3D -121 IMX274 1-001a: imx274_set_frame_interval error =3D -121 Unable to setup formats: Remote I/O error (121) The device is not resumed thus the remote I/O error. Setting the frame interval works at streaming time, because pm_runtime_resume_and_get is called at s_stream time before sensor setup. The failure happens when only the s_frame_interval is called separately independently on streaming time. Fixes: ad97bc37426c ("media: i2c: imx274: Add IMX274 power on and off seque= nce") Signed-off-by: Eugen Hristev Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/i2c/imx274.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c index 0dce92872176d..4d9b64c61f603 100644 --- a/drivers/media/i2c/imx274.c +++ b/drivers/media/i2c/imx274.c @@ -1367,6 +1367,10 @@ static int imx274_s_frame_interval(struct v4l2_subde= v *sd, int min, max, def; int ret; =20 + ret =3D pm_runtime_resume_and_get(&imx274->client->dev); + if (ret < 0) + return ret; + mutex_lock(&imx274->lock); ret =3D imx274_set_frame_interval(imx274, fi->interval); =20 @@ -1398,6 +1402,7 @@ static int imx274_s_frame_interval(struct v4l2_subdev= *sd, =20 unlock: mutex_unlock(&imx274->lock); + pm_runtime_put(&imx274->client->dev); =20 return ret; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C540C43219 for ; Mon, 24 Jan 2022 21:43:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456674AbiAXVjq (ORCPT ); Mon, 24 Jan 2022 16:39:46 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55860 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445083AbiAXVCH (ORCPT ); Mon, 24 Jan 2022 16:02:07 -0500 Received: from smtp.kernel.org (relay.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 5457CB8105C; Mon, 24 Jan 2022 21:02:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 833F6C340E5; Mon, 24 Jan 2022 21:02:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058124; bh=BNw15DMNEo5jqLE6Y6CE4dQGroEOmFccGBlIu/rczgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v0j6Mkq5e6oZLt5HEbphiIvxKIUn3YMJZXbLDRjmuT9qvlGviT6xpm+jiyYtlhvnS XDZRsxLf7tODqvodb3Np+DsVa+T8cDzUv6w15WNhE/7roKb9uznd+yqT/Fy6hFfonH CK0C9GFcAcro4FJjI6uAFEc1oDV6IZ/rPr0GQ0tg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Scally , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0186/1039] media: i2c: Re-order runtime pm initialisation Date: Mon, 24 Jan 2022 19:32:55 +0100 Message-Id: <20220124184131.547439151@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Scally [ Upstream commit d2484fbf780762f6f9cc3abb7a07ee42dca2eaa3 ] The kerneldoc for pm_runtime_set_suspended() says: "It is not valid to call this function for devices with runtime PM enabled" To satisfy that requirement, re-order the calls so that pm_runtime_enable() is the last one. Fixes: 11c0d8fdccc5 ("media: i2c: Add support for the OV8865 image sensor") Signed-off-by: Daniel Scally Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/i2c/ov8865.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2899,8 +2899,8 @@ static int ov8865_probe(struct i2c_clien =20 /* Runtime PM */ =20 - pm_runtime_enable(sensor->dev); pm_runtime_set_suspended(sensor->dev); + pm_runtime_enable(sensor->dev); =20 /* V4L2 subdev register */ =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CB4CC433F5 for ; Mon, 24 Jan 2022 23:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851140AbiAXXcD (ORCPT ); Mon, 24 Jan 2022 18:32:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836497AbiAXWjh (ORCPT ); Mon, 24 Jan 2022 17:39:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19BE0C054878; Mon, 24 Jan 2022 13:02:08 -0800 (PST) Received: from smtp.kernel.org (relay.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 ADE086136A; Mon, 24 Jan 2022 21:02:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F6DBC340E7; Mon, 24 Jan 2022 21:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058127; bh=RQ5Ca9+CytE6FpXfdzRkzs6Fgfx0IT5jkMAAFnh6LJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XyvmvvLes6ARkkVJW8Qvt/rbI+eovfZJy3Die87KQt8FYVxSSST7fqHfxH9n5cbSf lbzAoA2OLjFCqEvKdHF42h/tdkm3YyxrQY4NpQoDz+6I9LtXGgwfRRGzXbVKh2Izz7 EPmWq4WHa1ACdn2/Cex9h4Cp4rFdBp1R7suMPpZM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0187/1039] media: i2c: ov8865: Fix lockdep error Date: Mon, 24 Jan 2022 19:32:56 +0100 Message-Id: <20220124184131.586323555@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 6e1c9bc9ae96e57bcd8807174f2c0f44f9ef7938 ] ov8865_state_init() calls ov8865_state_mipi_configure() which uses __v4l2_ctrl_s_ctrl[_int64](). This means that sensor->mutex (which is also sensor->ctrls.handler.lock) must be locked before calling ov8865_state_init(). Note ov8865_state_mipi_configure() is also used in other places where the lock is already held so it cannot be changed itself. This fixes the following lockdep kernel WARN: [ 13.233421] WARNING: CPU: 0 PID: 8 at drivers/media/v4l2-core/v4l2-ctrls= -api.c:833 __v4l2_ctrl_s_ctrl+0x4d/0x60 [videodev] ... [ 13.234063] Call Trace: [ 13.234074] ov8865_state_configure+0x98b/0xc00 [ov8865] [ 13.234095] ov8865_probe+0x4b1/0x54c [ov8865] [ 13.234117] i2c_device_probe+0x13c/0x2d0 Fixes: 11c0d8fdccc5 ("media: i2c: Add support for the OV8865 image sensor") Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/i2c/ov8865.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2893,7 +2893,9 @@ static int ov8865_probe(struct i2c_clien if (ret) goto error_mutex; =20 + mutex_lock(&sensor->mutex); ret =3D ov8865_state_init(sensor); + mutex_unlock(&sensor->mutex); if (ret) goto error_ctrls; =20 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A181C433FE for ; Mon, 24 Jan 2022 21:43:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456935AbiAXVk2 (ORCPT ); Mon, 24 Jan 2022 16:40:28 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50862 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445095AbiAXVCL (ORCPT ); Mon, 24 Jan 2022 16:02:11 -0500 Received: from smtp.kernel.org (relay.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 C8146611DA; Mon, 24 Jan 2022 21:02:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB269C340E5; Mon, 24 Jan 2022 21:02:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058130; bh=IhACb9bxfxsVvsSEtnGRQo29vIfTysy249Res4IG6L4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mDlZgF8Z+G/ucHLdsJ58kTvecV5Ja775GozrP2TI+xgBXcejbd0QqL+S+bOo78A2r peiMDBtt71Gv10ujEiXdgWBdJorfoderRbt95AkzLolQzKgeuxzU/t+JsWdCNU764p gZPERttGdkX8d32X4mx30yqV1xr2O2O9o2zXmQEQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suresh Udipi , Kazuyoshi Akiyama , Michael Rodin , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0188/1039] media: rcar-csi2: Correct the selection of hsfreqrange Date: Mon, 24 Jan 2022 19:32:57 +0100 Message-Id: <20220124184131.625904622@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Suresh Udipi [ Upstream commit cee44d4fbacbbdfe62697ec94e76c6e4f726c5df ] hsfreqrange should be chosen based on the calculated mbps which is closer to the default bit rate and within the range as per table[1]. But current calculation always selects first value which is greater than or equal to the calculated mbps which may lead to chosing a wrong range in some cases. For example for 360 mbps for H3/M3N Existing logic selects Calculated value 360Mbps : Default 400Mbps Range [368.125 -433.125 mbps] This hsfreqrange is out of range. The logic is changed to get the default value which is closest to the calculated value [1] Calculated value 360Mbps : Default 350Mbps Range [320.625 -380.625 mpbs] [1] specs r19uh0105ej0200-r-car-3rd-generation.pdf [Table 25.9] Please note that According to Renesas in Table 25.9 the range for 220 default value is corrected as below |Range (Mbps) | Default Bit rate (Mbps) | ----------------------------------------------- | 197.125-244.125 | 220 | ----------------------------------------------- Fixes: 769afd212b16 ("media: rcar-csi2: add Renesas R-Car MIPI CSI-2 receiv= er driver") Signed-off-by: Suresh Udipi Signed-off-by: Kazuyoshi Akiyama Signed-off-by: Michael Rodin Reviewed-by: Niklas S=C3=B6derlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/rcar-vin/rcar-csi2.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/pl= atform/rcar-vin/rcar-csi2.c index 11848d0c4a55c..436b7be969202 100644 --- a/drivers/media/platform/rcar-vin/rcar-csi2.c +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c @@ -542,16 +542,23 @@ static int rcsi2_wait_phy_start(struct rcar_csi2 *pri= v, static int rcsi2_set_phypll(struct rcar_csi2 *priv, unsigned int mbps) { const struct rcsi2_mbps_reg *hsfreq; + const struct rcsi2_mbps_reg *hsfreq_prev =3D NULL; =20 - for (hsfreq =3D priv->info->hsfreqrange; hsfreq->mbps !=3D 0; hsfreq++) + for (hsfreq =3D priv->info->hsfreqrange; hsfreq->mbps !=3D 0; hsfreq++) { if (hsfreq->mbps >=3D mbps) break; + hsfreq_prev =3D hsfreq; + } =20 if (!hsfreq->mbps) { dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps); return -ERANGE; } =20 + if (hsfreq_prev && + ((mbps - hsfreq_prev->mbps) <=3D (hsfreq->mbps - mbps))) + hsfreq =3D hsfreq_prev; + rcsi2_write(priv, PHYPLL_REG, PHYPLL_HSFREQRANGE(hsfreq->reg)); =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19C24C433F5 for ; Mon, 24 Jan 2022 21:43:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456914AbiAXVkY (ORCPT ); Mon, 24 Jan 2022 16:40:24 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54806 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445114AbiAXVCO (ORCPT ); Mon, 24 Jan 2022 16:02:14 -0500 Received: from smtp.kernel.org (relay.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 C28E261365; Mon, 24 Jan 2022 21:02:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9860FC340E5; Mon, 24 Jan 2022 21:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058133; bh=elCfbszIBuVRR6VjRT0ZBLCHfXRupXPKDV8BynvhD0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p+kNFVc8FI3Kk3oBQCB8caq/D/BcEIXWRY39hNLyS4RngmnSdaKZ1+2NEAvRvqqfy txUFP+KLt7SsvNhGfRBwjEkTxwr9GYBKSiMT7fNyVBp3Xd+FaxkeoEhQOWaBMEDl4F oQBFwQvTIMwkZ4Y+5z2vsELbLOpKYWHLl1UmsBZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0189/1039] media: imx-pxp: Initialize the spinlock prior to using it Date: Mon, 24 Jan 2022 19:32:58 +0100 Message-Id: <20220124184131.658280532@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit ed2f97ad4b21072f849cf4ae6645d1f2b1d3f550 ] After devm_request_threaded_irq() is called there is a chance that an interrupt may occur before the spinlock is initialized, which will trigger a kernel oops. To prevent that, move the initialization of the spinlock prior to requesting the interrupts. Fixes: 51abcf7fdb70 ("media: imx-pxp: add i.MX Pixel Pipeline driver") Signed-off-by: Fabio Estevam Reviewed-by: Philipp Zabel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/imx-pxp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-= pxp.c index 723b096fedd10..b7174778db539 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -1659,6 +1659,8 @@ static int pxp_probe(struct platform_device *pdev) if (irq < 0) return irq; =20 + spin_lock_init(&dev->irqlock); + ret =3D devm_request_threaded_irq(&pdev->dev, irq, NULL, pxp_irq_handler, IRQF_ONESHOT, dev_name(&pdev->dev), dev); if (ret < 0) { @@ -1676,8 +1678,6 @@ static int pxp_probe(struct platform_device *pdev) goto err_clk; } =20 - spin_lock_init(&dev->irqlock); - ret =3D v4l2_device_register(&pdev->dev, &dev->v4l2_dev); if (ret) goto err_clk; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C43E5C43219 for ; Tue, 25 Jan 2022 00:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372143AbiAYAKn (ORCPT ); Mon, 24 Jan 2022 19:10:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836988AbiAXWlf (ORCPT ); Mon, 24 Jan 2022 17:41:35 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE43BC04D62B; Mon, 24 Jan 2022 13:04:27 -0800 (PST) Received: from smtp.kernel.org (relay.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 71D23B815AB; Mon, 24 Jan 2022 21:04:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DC72C340E5; Mon, 24 Jan 2022 21:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058266; bh=fntRpshkPH1kBf19IZiQRtlhXjIeJ4hCEiSlfehiMwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aro1rurvsKCL7dhAkPr3inlJbUr+Q3zORrRqUGA8H1k3/y/url2In/wP9I6hmGBvD lyqBPWKBOlBahfzUbJWInd/yUD5/buc4yB8jKmfTLC8TLaAa8vZ+7q5NUeYnY2AV0T U8entK0wsppaLKKMyeeW/jdkwiJvXPgNbN8T4M0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Yang Yingliang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0190/1039] media: si470x-i2c: fix possible memory leak in si470x_i2c_probe() Date: Mon, 24 Jan 2022 19:32:59 +0100 Message-Id: <20220124184131.690000207@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit ef054e345ed8c79ce1121a3599b5a2dfd78e57a0 ] n the 'radio->hdl.error' error handling, ctrl handler allocated by v4l2_ctrl_new_std() does not released, and caused memory leak as follows: unreferenced object 0xffff888033d54200 (size 256): comm "i2c-si470x-19", pid 909, jiffies 4294914203 (age 8.072s) hex dump (first 32 bytes): e8 69 11 03 80 88 ff ff 00 46 d5 33 80 88 ff ff .i.......F.3.... 10 42 d5 33 80 88 ff ff 10 42 d5 33 80 88 ff ff .B.3.....B.3.... backtrace: [<00000000086bd4ed>] __kmalloc_node+0x1eb/0x360 [<00000000bdb68871>] kvmalloc_node+0x66/0x120 [<00000000fac74e4c>] v4l2_ctrl_new+0x7b9/0x1c60 [videodev] [<00000000693bf940>] v4l2_ctrl_new_std+0x19b/0x270 [videodev] [<00000000c0cb91bc>] si470x_i2c_probe+0x2d3/0x9a0 [radio_si470x_i2c] [<0000000056a6f01f>] i2c_device_probe+0x4d8/0xbe0 Fix the error handling path to avoid memory leak. Reported-by: Hulk Robot Fixes: 8c081b6f9a9b ("media: radio: Critical v4l2 registration...") Signed-off-by: Yang Yingliang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/radio/si470x/radio-si470x-i2c.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/= radio/si470x/radio-si470x-i2c.c index a972c0705ac79..76d39e2e87706 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -368,7 +368,7 @@ static int si470x_i2c_probe(struct i2c_client *client) if (radio->hdl.error) { retval =3D radio->hdl.error; dev_err(&client->dev, "couldn't register control\n"); - goto err_dev; + goto err_all; } =20 /* video device initialization */ @@ -463,7 +463,6 @@ static int si470x_i2c_probe(struct i2c_client *client) return 0; err_all: v4l2_ctrl_handler_free(&radio->hdl); -err_dev: v4l2_device_unregister(&radio->v4l2_dev); err_initial: return retval; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B3D6C4167D for ; Tue, 25 Jan 2022 00:14:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372461AbiAYALg (ORCPT ); Mon, 24 Jan 2022 19:11:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356613AbiAXWjo (ORCPT ); Mon, 24 Jan 2022 17:39:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB7CFC05487D; Mon, 24 Jan 2022 13:02:39 -0800 (PST) Received: from smtp.kernel.org (relay.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 6CE4D61330; Mon, 24 Jan 2022 21:02:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F753C340E5; Mon, 24 Jan 2022 21:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058158; bh=B5br9ewwZxFUbx8koaJI0fAcTbHZVutvSbyrlS9WXuc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JlHKJ2cDDhbNyK5OEOqBQ7OWI3nPDhdXqrfGL6mCXYu+0zsYLeyzQf3M80X/RbhSP RXtgByGrqkw8FvNGcXbc2lFmhBOGEmiN6CyZcRUesEH+AC2QwD09RPSJchDYdYSfA8 BgyS/MeLEQFwBW50typIyItsHguCXno2S52r+yt4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Tzung-Bi Shih , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0191/1039] media: mtk-vcodec: Fix an error handling path in mtk_vcodec_probe() Date: Mon, 24 Jan 2022 19:33:00 +0100 Message-Id: <20220124184131.723405427@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 615c6f28b9ad7efc9bfbef2cafc6a0c5bc0c21e0 ] In case of error the 'media_device_init()' call is not balanced by a corresponding 'media_device_cleanup()' call. Add it, when needed, as already done in the remove function. Fixes: 118add98f80e ("media: mtk-vcodec: vdec: add media device if using st= ateless api") Signed-off-by: Christophe JAILLET Acked-by: Tzung-Bi Shih Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drive= rs/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c index e6e6a8203eebf..8277c44209b5b 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c @@ -358,6 +358,8 @@ err_media_reg: if (dev->vdec_pdata->uses_stateless_api) v4l2_m2m_unregister_media_controller(dev->m2m_dev_dec); err_reg_cont: + if (dev->vdec_pdata->uses_stateless_api) + media_device_cleanup(&dev->mdev_dec); destroy_workqueue(dev->decode_workqueue); err_event_workq: v4l2_m2m_release(dev->m2m_dev_dec); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8888C4167B for ; Tue, 25 Jan 2022 00:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372875AbiAYAMl (ORCPT ); Mon, 24 Jan 2022 19:12:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359871AbiAXWjp (ORCPT ); Mon, 24 Jan 2022 17:39:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A852C055A81; Mon, 24 Jan 2022 13:03:15 -0800 (PST) Received: from smtp.kernel.org (relay.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 2CDC9B81142; Mon, 24 Jan 2022 21:03:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 556B7C340E7; Mon, 24 Jan 2022 21:03:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058192; bh=8DVnjUcFd86DDYnkbU0t/VHkCYoGPiy5nOa4cst9MaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=USfdiLNAQXTAYF5DHw9VeGl7c3ZvLaHel20+hf3HqOAOiJa05QAGAvUOkDqCSBwHq AaE2JUbuObUNNdonLN5ySJfxwlHORbpEHB3UodrJDwW3a6Udm8Ym/taQORCgbLAY2p mbINmoS1q0Qx2bDszXyMCEs4SrfuJTzdrJToAn2w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dafna Hirschfeld , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0192/1039] media: mtk-vcodec: call v4l2_m2m_ctx_release first when file is released Date: Mon, 24 Jan 2022 19:33:01 +0100 Message-Id: <20220124184131.761761295@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 9f89c881bffbdffe4060ffaef3489a2830a6dd9c ] The func v4l2_m2m_ctx_release waits for currently running jobs to finish and then stop streaming both queues and frees the buffers. All this should be done before the call to mtk_vcodec_enc_release which frees the encoder handler. This fixes null-pointer dereference bug: [ 638.028076] Mem abort info: [ 638.030932] ESR =3D 0x96000004 [ 638.033978] EC =3D 0x25: DABT (current EL), IL =3D 32 bits [ 638.039293] SET =3D 0, FnV =3D 0 [ 638.042338] EA =3D 0, S1PTW =3D 0 [ 638.045474] FSC =3D 0x04: level 0 translation fault [ 638.050349] Data abort info: [ 638.053224] ISV =3D 0, ISS =3D 0x00000004 [ 638.057055] CM =3D 0, WnR =3D 0 [ 638.060018] user pgtable: 4k pages, 48-bit VAs, pgdp=3D000000012b6db000 [ 638.066485] [00000000000001a0] pgd=3D0000000000000000, p4d=3D00000000000= 00000 [ 638.073277] Internal error: Oops: 96000004 [#1] SMP [ 638.078145] Modules linked in: rfkill mtk_vcodec_dec mtk_vcodec_enc uvcv= ideo mtk_mdp mtk_vcodec_common videobuf2_dma_contig v4l2_h264 cdc_ether v4l= 2_mem2mem videobuf2_vmalloc usbnet videobuf2_memops videobuf2_v4l2 r8152 vi= deobuf2_common videodev cros_ec_sensors cros_ec_sensors_core industrialio_t= riggered_buffer kfifo_buf elan_i2c elants_i2c sbs_battery mc cros_usbpd_cha= rger cros_ec_chardev cros_usbpd_logger crct10dif_ce mtk_vpu fuse ip_tables = x_tables ipv6 [ 638.118583] CPU: 0 PID: 212 Comm: kworker/u8:5 Not tainted 5.15.0-06427-= g58a1d4dcfc74-dirty #109 [ 638.127357] Hardware name: Google Elm (DT) [ 638.131444] Workqueue: mtk-vcodec-enc mtk_venc_worker [mtk_vcodec_enc] [ 638.137974] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE= =3D--) [ 638.144925] pc : vp8_enc_encode+0x34/0x2b0 [mtk_vcodec_enc] [ 638.150493] lr : venc_if_encode+0xac/0x1b0 [mtk_vcodec_enc] [ 638.156060] sp : ffff8000124d3c40 [ 638.159364] x29: ffff8000124d3c40 x28: 0000000000000000 x27: 00000000000= 00000 [ 638.166493] x26: 0000000000000000 x25: ffff0000e7f252d0 x24: ffff8000124= d3d58 [ 638.173621] x23: ffff8000124d3d58 x22: ffff8000124d3d60 x21: 00000000000= 00001 [ 638.180750] x20: ffff80001137e000 x19: 0000000000000000 x18: 00000000000= 00001 [ 638.187878] x17: 000000040044ffff x16: 00400032b5503510 x15: 00000000000= 00000 [ 638.195006] x14: ffff8000118536c0 x13: ffff8000ee1da000 x12: 0000000030d= 4d91d [ 638.202134] x11: 0000000000000000 x10: 0000000000000980 x9 : ffff8000124= d3b20 [ 638.209262] x8 : ffff0000c18d4ea0 x7 : ffff0000c18d44c0 x6 : ffff0000c18= d44c0 [ 638.216391] x5 : ffff80000904a3b0 x4 : ffff8000124d3d58 x3 : ffff8000124= d3d60 [ 638.223519] x2 : ffff8000124d3d78 x1 : 0000000000000001 x0 : ffff8000113= 7efb8 [ 638.230648] Call trace: [ 638.233084] vp8_enc_encode+0x34/0x2b0 [mtk_vcodec_enc] [ 638.238304] venc_if_encode+0xac/0x1b0 [mtk_vcodec_enc] [ 638.243525] mtk_venc_worker+0x110/0x250 [mtk_vcodec_enc] [ 638.248918] process_one_work+0x1f8/0x498 [ 638.252923] worker_thread+0x140/0x538 [ 638.256664] kthread+0x148/0x158 [ 638.259884] ret_from_fork+0x10/0x20 [ 638.263455] Code: f90023f9 2a0103f5 aa0303f6 aa0403f8 (f940d277) [ 638.269538] ---[ end trace e374fc10f8e181f5 ]--- [gst-master] root@debian:~/gst-build# [ 638.019193] Unable to handle kerne= l NULL pointer dereference at virtual address 00000000000001a0 Fixes: 4e855a6efa547 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video En= coder Driver") Signed-off-by: Dafna Hirschfeld Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drive= rs/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c index eed67394cf463..f898226fc53e5 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -214,11 +214,11 @@ static int fops_vcodec_release(struct file *file) mtk_v4l2_debug(1, "[%d] encoder", ctx->id); mutex_lock(&dev->dev_mutex); =20 + v4l2_m2m_ctx_release(ctx->m2m_ctx); mtk_vcodec_enc_release(ctx); v4l2_fh_del(&ctx->fh); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->ctrl_hdl); - v4l2_m2m_ctx_release(ctx->m2m_ctx); =20 list_del_init(&ctx->list); kfree(ctx); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED63BC4167D for ; Mon, 24 Jan 2022 23:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359582AbiAXXcz (ORCPT ); Mon, 24 Jan 2022 18:32:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382831AbiAXWjt (ORCPT ); Mon, 24 Jan 2022 17:39:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87FB4C04D60E; Mon, 24 Jan 2022 13:03:47 -0800 (PST) Received: from smtp.kernel.org (relay.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 27C2660907; Mon, 24 Jan 2022 21:03:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05D7EC340E5; Mon, 24 Jan 2022 21:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058226; bh=iy9wBI5msHYzrT8nUEkCeNeNJEHIkvF4/xwuu9386hI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f/Dx9/dfZidD/xXyjhvmgtLILpjRnQbJmf4/BJrZwtfXavlKXClxeRUca87KmL9jk 8h8mp5rF1tA8XCP83Nt1ppkcnjDF/y5OjLA1urUFQUujnYl9xHbpEojBMk0tYoSQoR 1PfTtZN5gXO9A4fRzMpPejoaQRYbicDwU64OXcso= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0193/1039] media: hantro: Hook up RK3399 JPEG encoder output Date: Mon, 24 Jan 2022 19:33:02 +0100 Message-Id: <20220124184131.802438932@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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-Yu Tsai [ Upstream commit 230d683ae04894933720425c8dead9508a09ebc3 ] The JPEG encoder found in the Hantro H1 encoder block only produces a raw entropy-encoded scan. The driver is responsible for building a JPEG compliant bitstream and placing the entropy-encoded scan in it. Right now the driver uses a bounce buffer for the hardware to output the raw scan to. In commit e765dba11ec2 ("hantro: Move hantro_enc_buf_finish to JPEG codec_ops.done"), the code that copies the raw scan from the bounce buffer to the capture buffer was moved, but was only hooked up for the Hantro H1 (then RK3288) variant. The RK3399 variant was broken, producing a JPEG bitstream without the scan, and the capture buffer's .bytesused field unset. Fix this by duplicating the code that is executed when the JPEG encoder finishes encoding a frame. As the encoded length is read back from hardware, and the variants having different register layouts, the code is duplicated rather than shared. Fixes: e765dba11ec2 ("hantro: Move hantro_enc_buf_finish to JPEG codec_ops.= done") Signed-off-by: Chen-Yu Tsai Tested-by: Nicolas Dufresne Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../staging/media/hantro/hantro_h1_jpeg_enc.c | 2 +- drivers/staging/media/hantro/hantro_hw.h | 3 ++- .../media/hantro/rockchip_vpu2_hw_jpeg_enc.c | 17 +++++++++++++++++ drivers/staging/media/hantro/rockchip_vpu_hw.c | 5 +++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c b/drivers/st= aging/media/hantro/hantro_h1_jpeg_enc.c index 56cf261a8e958..9cd713c02a455 100644 --- a/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c +++ b/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c @@ -140,7 +140,7 @@ int hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx) return 0; } =20 -void hantro_jpeg_enc_done(struct hantro_ctx *ctx) +void hantro_h1_jpeg_enc_done(struct hantro_ctx *ctx) { struct hantro_dev *vpu =3D ctx->dev; u32 bytesused =3D vepu_read(vpu, H1_REG_STR_BUF_LIMIT) / 8; diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/med= ia/hantro/hantro_hw.h index 267a6d33a47b5..60d4602d33ed5 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -239,7 +239,8 @@ int hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx); int rockchip_vpu2_jpeg_enc_run(struct hantro_ctx *ctx); int hantro_jpeg_enc_init(struct hantro_ctx *ctx); void hantro_jpeg_enc_exit(struct hantro_ctx *ctx); -void hantro_jpeg_enc_done(struct hantro_ctx *ctx); +void hantro_h1_jpeg_enc_done(struct hantro_ctx *ctx); +void rockchip_vpu2_jpeg_enc_done(struct hantro_ctx *ctx); =20 dma_addr_t hantro_h264_get_ref_buf(struct hantro_ctx *ctx, unsigned int dpb_idx); diff --git a/drivers/staging/media/hantro/rockchip_vpu2_hw_jpeg_enc.c b/dri= vers/staging/media/hantro/rockchip_vpu2_hw_jpeg_enc.c index 991213ce16108..5d9ff420f0b5f 100644 --- a/drivers/staging/media/hantro/rockchip_vpu2_hw_jpeg_enc.c +++ b/drivers/staging/media/hantro/rockchip_vpu2_hw_jpeg_enc.c @@ -171,3 +171,20 @@ int rockchip_vpu2_jpeg_enc_run(struct hantro_ctx *ctx) =20 return 0; } + +void rockchip_vpu2_jpeg_enc_done(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu =3D ctx->dev; + u32 bytesused =3D vepu_read(vpu, VEPU_REG_STR_BUF_LIMIT) / 8; + struct vb2_v4l2_buffer *dst_buf =3D hantro_get_dst_buf(ctx); + + /* + * TODO: Rework the JPEG encoder to eliminate the need + * for a bounce buffer. + */ + memcpy(vb2_plane_vaddr(&dst_buf->vb2_buf, 0) + + ctx->vpu_dst_fmt->header_size, + ctx->jpeg_enc.bounce_buffer.cpu, bytesused); + vb2_set_plane_payload(&dst_buf->vb2_buf, 0, + ctx->vpu_dst_fmt->header_size + bytesused); +} diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/stagi= ng/media/hantro/rockchip_vpu_hw.c index d4f52957cc534..0c22039162a00 100644 --- a/drivers/staging/media/hantro/rockchip_vpu_hw.c +++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c @@ -343,7 +343,7 @@ static const struct hantro_codec_ops rk3066_vpu_codec_o= ps[] =3D { .run =3D hantro_h1_jpeg_enc_run, .reset =3D rockchip_vpu1_enc_reset, .init =3D hantro_jpeg_enc_init, - .done =3D hantro_jpeg_enc_done, + .done =3D hantro_h1_jpeg_enc_done, .exit =3D hantro_jpeg_enc_exit, }, [HANTRO_MODE_H264_DEC] =3D { @@ -371,7 +371,7 @@ static const struct hantro_codec_ops rk3288_vpu_codec_o= ps[] =3D { .run =3D hantro_h1_jpeg_enc_run, .reset =3D rockchip_vpu1_enc_reset, .init =3D hantro_jpeg_enc_init, - .done =3D hantro_jpeg_enc_done, + .done =3D hantro_h1_jpeg_enc_done, .exit =3D hantro_jpeg_enc_exit, }, [HANTRO_MODE_H264_DEC] =3D { @@ -399,6 +399,7 @@ static const struct hantro_codec_ops rk3399_vpu_codec_o= ps[] =3D { .run =3D rockchip_vpu2_jpeg_enc_run, .reset =3D rockchip_vpu2_enc_reset, .init =3D hantro_jpeg_enc_init, + .done =3D rockchip_vpu2_jpeg_enc_done, .exit =3D hantro_jpeg_enc_exit, }, [HANTRO_MODE_H264_DEC] =3D { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51551C4167E for ; Mon, 24 Jan 2022 21:44:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457378AbiAXVlc (ORCPT ); Mon, 24 Jan 2022 16:41:32 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55860 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445574AbiAXVEL (ORCPT ); Mon, 24 Jan 2022 16:04:11 -0500 Received: from smtp.kernel.org (relay.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 5192CB81233; Mon, 24 Jan 2022 21:04:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84BD7C340E8; Mon, 24 Jan 2022 21:04:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058248; bh=RqxmOMV1jbbNks5l2G4rA7iTPry5Lj3BtD4JRhgmkPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5lBW6LUo0/TsAkXJ3LaKAB8l4bPW4MaIOGCURfJoAffsWW7EVAOVRfUg98wJ3ib2 tNlSuMf+XZnnH7tu6/mVhdELV82cSULvog6wPr7qqV9z7JBlmrK64HPmwGVjd3sx9P bGhU58QxvHCHBKUtklKQ2t2BYK0hoSozoO27N17Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Weber , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0194/1039] media: coda: fix CODA960 JPEG encoder buffer overflow Date: Mon, 24 Jan 2022 19:33:03 +0100 Message-Id: <20220124184131.839703630@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 1a59cd88f55068710f6549bee548846661673780 ] Stop the CODA960 JPEG encoder from overflowing capture buffers. The bitstream buffer overflow interrupt doesn't seem to be connected, so this has to be handled via timeout instead. Reported-by: Martin Weber Fixes: 96f6f62c4656 ("media: coda: jpeg: add CODA960 JPEG encoder support") Tested-by: Martin Weber Signed-off-by: Philipp Zabel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/coda/coda-common.c | 8 +++++--- drivers/media/platform/coda/coda-jpeg.c | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/plat= form/coda/coda-common.c index 0e312b0842d7f..9a2640a9c75c6 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c @@ -1537,11 +1537,13 @@ static void coda_pic_run_work(struct work_struct *w= ork) =20 if (!wait_for_completion_timeout(&ctx->completion, msecs_to_jiffies(1000))) { - dev_err(dev->dev, "CODA PIC_RUN timeout\n"); + if (ctx->use_bit) { + dev_err(dev->dev, "CODA PIC_RUN timeout\n"); =20 - ctx->hold =3D true; + ctx->hold =3D true; =20 - coda_hw_reset(ctx); + coda_hw_reset(ctx); + } =20 if (ctx->ops->run_timeout) ctx->ops->run_timeout(ctx); diff --git a/drivers/media/platform/coda/coda-jpeg.c b/drivers/media/platfo= rm/coda/coda-jpeg.c index b11cfbe166dd3..a72f4655e5ad5 100644 --- a/drivers/media/platform/coda/coda-jpeg.c +++ b/drivers/media/platform/coda/coda-jpeg.c @@ -1127,7 +1127,8 @@ static int coda9_jpeg_prepare_encode(struct coda_ctx = *ctx) coda_write(dev, 0, CODA9_REG_JPEG_GBU_BT_PTR); coda_write(dev, 0, CODA9_REG_JPEG_GBU_WD_PTR); coda_write(dev, 0, CODA9_REG_JPEG_GBU_BBSR); - coda_write(dev, 0, CODA9_REG_JPEG_BBC_STRM_CTRL); + coda_write(dev, BIT(31) | ((end_addr - start_addr - header_len) / 256), + CODA9_REG_JPEG_BBC_STRM_CTRL); coda_write(dev, 0, CODA9_REG_JPEG_GBU_CTRL); coda_write(dev, 0, CODA9_REG_JPEG_GBU_FF_RPTR); coda_write(dev, 127, CODA9_REG_JPEG_GBU_BBER); @@ -1257,6 +1258,23 @@ static void coda9_jpeg_finish_encode(struct coda_ctx= *ctx) coda_hw_reset(ctx); } =20 +static void coda9_jpeg_encode_timeout(struct coda_ctx *ctx) +{ + struct coda_dev *dev =3D ctx->dev; + u32 end_addr, wr_ptr; + + /* Handle missing BBC overflow interrupt via timeout */ + end_addr =3D coda_read(dev, CODA9_REG_JPEG_BBC_END_ADDR); + wr_ptr =3D coda_read(dev, CODA9_REG_JPEG_BBC_WR_PTR); + if (wr_ptr >=3D end_addr - 256) { + v4l2_err(&dev->v4l2_dev, "JPEG too large for capture buffer\n"); + coda9_jpeg_finish_encode(ctx); + return; + } + + coda_hw_reset(ctx); +} + static void coda9_jpeg_release(struct coda_ctx *ctx) { int i; @@ -1276,6 +1294,7 @@ const struct coda_context_ops coda9_jpeg_encode_ops = =3D { .start_streaming =3D coda9_jpeg_start_encoding, .prepare_run =3D coda9_jpeg_prepare_encode, .finish_run =3D coda9_jpeg_finish_encode, + .run_timeout =3D coda9_jpeg_encode_timeout, .release =3D coda9_jpeg_release, }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAB84C4321E for ; Mon, 24 Jan 2022 21:44:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457409AbiAXVlf (ORCPT ); Mon, 24 Jan 2022 16:41:35 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56402 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445588AbiAXVEM (ORCPT ); Mon, 24 Jan 2022 16:04:12 -0500 Received: from smtp.kernel.org (relay.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 9201260C17; Mon, 24 Jan 2022 21:04:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CB6CC340EC; Mon, 24 Jan 2022 21:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058251; bh=73OCnF0ijlwNyF0VYdHcUtgcGaBD+/0/qpwxiORDKkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cmkeghe4jxYM7AShIs3h/XivWkyFAg5IeFWfwRTMZbkfPY/iQtQ4GMbiFs69UtpKA tkjTh9Y9VDbJHP864PLJ255mzi9I++yGkUUlyK4prI1CoxXbOzyeHlCkZRizws0tp7 6VsJtcwSgvfto+n+s/SQ7fnyDR440FyC7JdpmJ8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mansur Alisha Shaik , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0195/1039] media: venus: correct low power frequency calculation for encoder Date: Mon, 24 Jan 2022 19:33:04 +0100 Message-Id: <20220124184131.877920159@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mansur Alisha Shaik [ Upstream commit b1f9bb8020783a48151e3a2864fbdc70548566dd ] In exististing implimentation, in min_loaded_core() for low_power vpp frequency value is considering as vpp_freq instead of low_power_freq. Fixed this by correcting vpp frequency calculation for encoder. Fixes: 3cfe5815ce0e (media: venus: Enable low power setting for encoder) Signed-off-by: Mansur Alisha Shaik Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/qcom/venus/pm_helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media= /platform/qcom/venus/pm_helpers.c index cedc664ba755f..184f0cea2fdb8 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -587,8 +587,8 @@ min_loaded_core(struct venus_inst *inst, u32 *min_corei= d, u32 *min_load, bool lo if (inst->session_type =3D=3D VIDC_SESSION_TYPE_DEC) vpp_freq =3D inst_pos->clk_data.vpp_freq; else if (inst->session_type =3D=3D VIDC_SESSION_TYPE_ENC) - vpp_freq =3D low_power ? inst_pos->clk_data.vpp_freq : - inst_pos->clk_data.low_power_freq; + vpp_freq =3D low_power ? inst_pos->clk_data.low_power_freq : + inst_pos->clk_data.vpp_freq; else continue; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EE79C43217 for ; Mon, 24 Jan 2022 23:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359506AbiAXXcn (ORCPT ); Mon, 24 Jan 2022 18:32:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456644AbiAXWjw (ORCPT ); Mon, 24 Jan 2022 17:39:52 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6959BC04D61A; Mon, 24 Jan 2022 13:04:16 -0800 (PST) Received: from smtp.kernel.org (relay.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 31945B8105C; Mon, 24 Jan 2022 21:04:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E5CFC340E5; Mon, 24 Jan 2022 21:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058253; bh=sLeBLzFgVT8t1e9qRMlDmM/Em1aCfW1X4MlX6q4CEq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YTFwCVIalOb6G4HDq8ITDUNt4JpKZqm2fqyR8BtPaRtpR0YRUrQ5qyaCPxXgCizEz zxGpy4IlL7jbNo8cvUUQeMSXD5KFtEwVpCdJBLFzlARcnzros4lK+8goybmRwTQIvI mynFWmFDOLC8jzXUO+btkzzhFP/ch0REUPp7DjeQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0196/1039] media: venus: core: Fix a potential NULL pointer dereference in an error handling path Date: Mon, 24 Jan 2022 19:33:05 +0100 Message-Id: <20220124184131.917171588@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 e4debea9be7d5db52bc6a565a4c02c3c6560d093 ] The normal path of the function makes the assumption that 'pm_ops->core_power' may be NULL. We should make the same assumption in the error handling path or a NULL pointer dereference may occur. Add the missing test before calling 'pm_ops->core_power' Fixes: 9e8efdb57879 ("media: venus: core: vote for video-mem path") Signed-off-by: Christophe JAILLET Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/qcom/venus/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platf= orm/qcom/venus/core.c index f5fa81896012d..fd32385485fa6 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -473,7 +473,8 @@ static __maybe_unused int venus_runtime_suspend(struct = device *dev) err_video_path: icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0); err_cpucfg_path: - pm_ops->core_power(core, POWER_ON); + if (pm_ops->core_power) + pm_ops->core_power(core, POWER_ON); =20 return ret; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD6D6C46467 for ; Tue, 25 Jan 2022 03:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314301AbiAYCur (ORCPT ); Mon, 24 Jan 2022 21:50:47 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57096 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353146AbiAXVEV (ORCPT ); Mon, 24 Jan 2022 16:04:21 -0500 Received: from smtp.kernel.org (relay.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 3B9BBB811A9; Mon, 24 Jan 2022 21:04:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 674D4C340E5; Mon, 24 Jan 2022 21:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058257; bh=Px/8V69LgBn1lpcu7IMMdtgNlAppZ3FW1twrHtuTLLU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EqJrYtDm5q7UQmvolC+Ts37A8wRAXxKyJ/Ljy+z8zDkN2XZ/73GmAqp4p4752IIm4 tJHv8Ot9Zxa0cNrI+/Ldb4tytoL1IQGuaMWI2+oj5HtgrTKIOyopbJQKkvUMTkdWyU fzKbuz4XS7Z0zjRxcnKXzEBh8Oz7WLLPL+AAevL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0197/1039] media: venus: core: Fix a resource leak in the error handling path of venus_probe() Date: Mon, 24 Jan 2022 19:33:06 +0100 Message-Id: <20220124184131.950143884@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 8cc7a1b2aca067397a016cdb971a5e6ad9b640c7 ] A successful 'of_platform_populate()' call should be balanced by a corresponding 'of_platform_depopulate()' call in the error handling path of the probe, as already done in the remove function. A successful 'venus_firmware_init()' call should be balanced by a corresponding 'venus_firmware_deinit()' call in the error handling path of the probe, as already done in the remove function. Update the error handling path accordingly. Fixes: f9799fcce4bb ("media: venus: firmware: register separate platform_de= vice for firmware loader") Signed-off-by: Christophe JAILLET Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/qcom/venus/core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platf= orm/qcom/venus/core.c index fd32385485fa6..877eca1258037 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -350,11 +350,11 @@ static int venus_probe(struct platform_device *pdev) =20 ret =3D venus_firmware_init(core); if (ret) - goto err_runtime_disable; + goto err_of_depopulate; =20 ret =3D venus_boot(core); if (ret) - goto err_runtime_disable; + goto err_firmware_deinit; =20 ret =3D hfi_core_resume(core, true); if (ret) @@ -386,6 +386,10 @@ err_dev_unregister: v4l2_device_unregister(&core->v4l2_dev); err_venus_shutdown: venus_shutdown(core); +err_firmware_deinit: + venus_firmware_deinit(core); +err_of_depopulate: + of_platform_depopulate(dev); err_runtime_disable: pm_runtime_put_noidle(dev); pm_runtime_set_suspended(dev); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1540DC4167B for ; Mon, 24 Jan 2022 21:44:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457430AbiAXVli (ORCPT ); Mon, 24 Jan 2022 16:41:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57154 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353826AbiAXVEY (ORCPT ); Mon, 24 Jan 2022 16:04:24 -0500 Received: from smtp.kernel.org (relay.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 53618B8105C; Mon, 24 Jan 2022 21:04:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80D64C340E5; Mon, 24 Jan 2022 21:04:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058260; bh=kGmLlB4MlOcx7kUoAHREAVQ8rneyprtlbE/fHjmAESE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ARKYqElNp/TNQU1v3Ec+PpmJM1bhwOQxW61dmrwEkKNLgNMZ9pARZ7kQ2PvY1kHRV oaXXoMAsrBnyOzEzDGBz2obLiWOmqmTij/urYvmCeDCQ6+FT7V6WG2ErbKhpdsh1Nu iOPV/mS96uc+ZPdYq9XikXoRCPLWK5Vb58qTFU6Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joakim Zhang , "David S. Miller" , Bhupesh Sharma , Sasha Levin Subject: [PATCH 5.16 0198/1039] net: stmmac: Add platform level debug register dump feature Date: Mon, 24 Jan 2022 19:33:07 +0100 Message-Id: <20220124184131.981512022@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bhupesh Sharma [ Upstream commit 4047b9db1aa7512a10ba3560a3f63821c8c40235 ] dwmac-qcom-ethqos currently exposes a mechanism to dump rgmii registers after the 'stmmac_dvr_probe()' returns. However with commit 5ec55823438e ("net: stmmac: add clocks management for gmac driver"), we now let 'pm_runtime_put()' disable the clocks before returning from 'stmmac_dvr_probe()'. This causes a crash when 'rgmii_dump()' register dumps are enabled, as the clocks are already off. Since other dwmac drivers (possible future users as well) might require a similar register dump feature, introduce a platform level callback to allow the same. This fixes the crash noticed while enabling rgmii_dump() dumps in dwmac-qcom-ethqos driver as well. It also allows future changes to keep a invoking the register dump callback from the correct place inside 'stmmac_dvr_probe()'. Fixes: 5ec55823438e ("net: stmmac: add clocks management for gmac driver") Cc: Joakim Zhang Cc: David S. Miller Signed-off-by: Bhupesh Sharma Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 7 ++++--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++ include/linux/stmmac.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 5c74b6279d690..6b1d9e8879f46 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -113,8 +113,10 @@ static void rgmii_updatel(struct qcom_ethqos *ethqos, rgmii_writel(ethqos, temp, offset); } =20 -static void rgmii_dump(struct qcom_ethqos *ethqos) +static void rgmii_dump(void *priv) { + struct qcom_ethqos *ethqos =3D priv; + dev_dbg(ðqos->pdev->dev, "Rgmii register dump\n"); dev_dbg(ðqos->pdev->dev, "RGMII_IO_MACRO_CONFIG: %x\n", rgmii_readl(ethqos, RGMII_IO_MACRO_CONFIG)); @@ -499,6 +501,7 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) =20 plat_dat->bsp_priv =3D ethqos; plat_dat->fix_mac_speed =3D ethqos_fix_mac_speed; + plat_dat->dump_debug_regs =3D rgmii_dump; plat_dat->has_gmac4 =3D 1; plat_dat->pmt =3D 1; plat_dat->tso_en =3D of_property_read_bool(np, "snps,tso"); @@ -507,8 +510,6 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) if (ret) goto err_clk; =20 - rgmii_dump(ethqos); - return ret; =20 err_clk: diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index 8ded4be08b001..e81a79845d425 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7094,6 +7094,9 @@ int stmmac_dvr_probe(struct device *device, stmmac_init_fs(ndev); #endif =20 + if (priv->plat->dump_debug_regs) + priv->plat->dump_debug_regs(priv->plat->bsp_priv); + /* Let pm_runtime_put() disable the clocks. * If CONFIG_PM is not enabled, the clocks will stay powered. */ diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index a6f03b36fc4f7..1450397fc0bcd 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -233,6 +233,7 @@ struct plat_stmmacenet_data { int (*clks_config)(void *priv, bool enabled); int (*crosststamp)(ktime_t *device, struct system_counterval_t *system, void *ctx); + void (*dump_debug_regs)(void *priv); void *bsp_priv; struct clk *stmmac_clk; struct clk *pclk; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 058D6C43217 for ; Tue, 25 Jan 2022 00:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372198AbiAYAKt (ORCPT ); Mon, 24 Jan 2022 19:10:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836973AbiAXWla (ORCPT ); Mon, 24 Jan 2022 17:41:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8A78C04D625; Mon, 24 Jan 2022 13:04:25 -0800 (PST) Received: from smtp.kernel.org (relay.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 756AFB812A8; Mon, 24 Jan 2022 21:04:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94027C340E5; Mon, 24 Jan 2022 21:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058263; bh=KzpJCoQ7YeJ8gsCUsWa3i1sfOZTwvJHTEKYvDdhXVmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g4x0xfJRVbfv+VZ174qsxj+/ptzMa0rqry+z3dNg3QI9Xm35NrtnmtZyipQVUC1bC 4zlGJso/B92AnZLG/raux3EePBFFn5gZ/P/KlqEcmKZZRmkqcSdnyHTc15qvXD1iGk CPkkfMsuCtR9IbtT0JHl4s/3X/oMx5FOcRyj//Xk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0199/1039] net: lantiq: fix missing free_netdev() on error in ltq_etop_probe() Date: Mon, 24 Jan 2022 19:33:08 +0100 Message-Id: <20220124184132.013656393@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit 2680ce7fc9939221da16e86a2e73cc1df563c82c ] Add the missing free_netdev() before return from ltq_etop_probe() in the error handling case. Fixes: 14d4e308e0aa ("net: lantiq: configure the burst length in ethernet d= rivers") Signed-off-by: Yang Yingliang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/lantiq_etop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lant= iq_etop.c index 072391c494ce4..14059e11710ad 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c @@ -687,13 +687,13 @@ ltq_etop_probe(struct platform_device *pdev) err =3D device_property_read_u32(&pdev->dev, "lantiq,tx-burst-length", &p= riv->tx_burst_len); if (err < 0) { dev_err(&pdev->dev, "unable to read tx-burst-length property\n"); - return err; + goto err_free; } =20 err =3D device_property_read_u32(&pdev->dev, "lantiq,rx-burst-length", &p= riv->rx_burst_len); if (err < 0) { dev_err(&pdev->dev, "unable to read rx-burst-length property\n"); - return err; + goto err_free; } =20 for (i =3D 0; i < MAX_DMA_CHAN; i++) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA41BC43219 for ; Mon, 24 Jan 2022 21:43:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457032AbiAXVkq (ORCPT ); Mon, 24 Jan 2022 16:40:46 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55150 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445301AbiAXVCn (ORCPT ); Mon, 24 Jan 2022 16:02:43 -0500 Received: from smtp.kernel.org (relay.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 76E1360E8D; Mon, 24 Jan 2022 21:02:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F92AC340E8; Mon, 24 Jan 2022 21:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058161; bh=GSPw2tC2/aZH08CgCYUriKjqTe1XdPeZhekrHeV1OJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nqgaFFJF6hJrkca/TEkGgYBgTMieXZCm6Wqza9q4BhnH+tH4/tadrmsw/wEEu9DK6 emwCOmD+2BjK4uPk4w8rDEsFxAtWpH53pVaDXwTotQj4o4cN+qAKoyWDlfZscXBV8b Ske/5VO4KN/hoyHsyAN3powCyD005JvXoPFCcdhY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksij Rempel , =?UTF-8?q?Petr=20Bene=C5=A1?= , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.16 0200/1039] thermal/drivers/imx: Implement runtime PM support Date: Mon, 24 Jan 2022 19:33:09 +0100 Message-Id: <20220124184132.049816270@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Oleksij Rempel [ Upstream commit 4cf2ddf16e175ee18c5c29865c32da7d6269cf44 ] Starting with commit d92ed2c9d3ff ("thermal: imx: Use driver's local data to decide whether to run a measurement") this driver stared using irq_enabled flag to make decision to power on/off the thermal core. This triggered a regression, where after reaching critical temperature, alarm IRQ handler set irq_enabled to false, disabled thermal core and was not able read temperature and disable cooling sequence. In case the cooling device is "CPU/GPU freq", the system will run with reduce performance until next reboot. To solve this issue, we need to move all parts implementing hand made runtime power management and let it handle actual runtime PM framework. Fixes: d92ed2c9d3ff ("thermal: imx: Use driver's local data to decide wheth= er to run a measurement") Signed-off-by: Oleksij Rempel Tested-by: Petr Bene=C5=A1 Link: https://lore.kernel.org/r/20211117103426.81813-1-o.rempel@pengutronix= .de Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/thermal/imx_thermal.c | 145 +++++++++++++++++++++------------- 1 file changed, 91 insertions(+), 54 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 2c7473d86a59b..16663373b6829 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -15,6 +15,7 @@ #include #include #include +#include =20 #define REG_SET 0x4 #define REG_CLR 0x8 @@ -194,6 +195,7 @@ static struct thermal_soc_data thermal_imx7d_data =3D { }; =20 struct imx_thermal_data { + struct device *dev; struct cpufreq_policy *policy; struct thermal_zone_device *tz; struct thermal_cooling_device *cdev; @@ -252,44 +254,15 @@ static int imx_get_temp(struct thermal_zone_device *t= z, int *temp) const struct thermal_soc_data *soc_data =3D data->socdata; struct regmap *map =3D data->tempmon; unsigned int n_meas; - bool wait, run_measurement; u32 val; + int ret; =20 - run_measurement =3D !data->irq_enabled; - if (!run_measurement) { - /* Check if a measurement is currently in progress */ - regmap_read(map, soc_data->temp_data, &val); - wait =3D !(val & soc_data->temp_valid_mask); - } else { - /* - * Every time we measure the temperature, we will power on the - * temperature sensor, enable measurements, take a reading, - * disable measurements, power off the temperature sensor. - */ - regmap_write(map, soc_data->sensor_ctrl + REG_CLR, - soc_data->power_down_mask); - regmap_write(map, soc_data->sensor_ctrl + REG_SET, - soc_data->measure_temp_mask); - - wait =3D true; - } - - /* - * According to the temp sensor designers, it may require up to ~17us - * to complete a measurement. - */ - if (wait) - usleep_range(20, 50); + ret =3D pm_runtime_resume_and_get(data->dev); + if (ret < 0) + return ret; =20 regmap_read(map, soc_data->temp_data, &val); =20 - if (run_measurement) { - regmap_write(map, soc_data->sensor_ctrl + REG_CLR, - soc_data->measure_temp_mask); - regmap_write(map, soc_data->sensor_ctrl + REG_SET, - soc_data->power_down_mask); - } - if ((val & soc_data->temp_valid_mask) =3D=3D 0) { dev_dbg(&tz->device, "temp measurement never finished\n"); return -EAGAIN; @@ -328,6 +301,8 @@ static int imx_get_temp(struct thermal_zone_device *tz,= int *temp) enable_irq(data->irq); } =20 + pm_runtime_put(data->dev); + return 0; } =20 @@ -335,24 +310,16 @@ static int imx_change_mode(struct thermal_zone_device= *tz, enum thermal_device_mode mode) { struct imx_thermal_data *data =3D tz->devdata; - struct regmap *map =3D data->tempmon; - const struct thermal_soc_data *soc_data =3D data->socdata; =20 if (mode =3D=3D THERMAL_DEVICE_ENABLED) { - regmap_write(map, soc_data->sensor_ctrl + REG_CLR, - soc_data->power_down_mask); - regmap_write(map, soc_data->sensor_ctrl + REG_SET, - soc_data->measure_temp_mask); + pm_runtime_get(data->dev); =20 if (!data->irq_enabled) { data->irq_enabled =3D true; enable_irq(data->irq); } } else { - regmap_write(map, soc_data->sensor_ctrl + REG_CLR, - soc_data->measure_temp_mask); - regmap_write(map, soc_data->sensor_ctrl + REG_SET, - soc_data->power_down_mask); + pm_runtime_put(data->dev); =20 if (data->irq_enabled) { disable_irq(data->irq); @@ -393,6 +360,11 @@ static int imx_set_trip_temp(struct thermal_zone_devic= e *tz, int trip, int temp) { struct imx_thermal_data *data =3D tz->devdata; + int ret; + + ret =3D pm_runtime_resume_and_get(data->dev); + if (ret < 0) + return ret; =20 /* do not allow changing critical threshold */ if (trip =3D=3D IMX_TRIP_CRITICAL) @@ -406,6 +378,8 @@ static int imx_set_trip_temp(struct thermal_zone_device= *tz, int trip, =20 imx_set_alarm_temp(data, temp); =20 + pm_runtime_put(data->dev); + return 0; } =20 @@ -681,6 +655,8 @@ static int imx_thermal_probe(struct platform_device *pd= ev) if (!data) return -ENOMEM; =20 + data->dev =3D &pdev->dev; + map =3D syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "fsl,tempmon"); if (IS_ERR(map)) { ret =3D PTR_ERR(map); @@ -800,6 +776,16 @@ static int imx_thermal_probe(struct platform_device *p= dev) data->socdata->power_down_mask); regmap_write(map, data->socdata->sensor_ctrl + REG_SET, data->socdata->measure_temp_mask); + /* After power up, we need a delay before first access can be done. */ + usleep_range(20, 50); + + /* the core was configured and enabled just before */ + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(data->dev); + + ret =3D pm_runtime_resume_and_get(data->dev); + if (ret < 0) + goto disable_runtime_pm; =20 data->irq_enabled =3D true; ret =3D thermal_zone_device_enable(data->tz); @@ -814,10 +800,15 @@ static int imx_thermal_probe(struct platform_device *= pdev) goto thermal_zone_unregister; } =20 + pm_runtime_put(data->dev); + return 0; =20 thermal_zone_unregister: thermal_zone_device_unregister(data->tz); +disable_runtime_pm: + pm_runtime_put_noidle(data->dev); + pm_runtime_disable(data->dev); clk_disable: clk_disable_unprepare(data->thermal_clk); legacy_cleanup: @@ -829,13 +820,9 @@ legacy_cleanup: static int imx_thermal_remove(struct platform_device *pdev) { struct imx_thermal_data *data =3D platform_get_drvdata(pdev); - struct regmap *map =3D data->tempmon; =20 - /* Disable measurements */ - regmap_write(map, data->socdata->sensor_ctrl + REG_SET, - data->socdata->power_down_mask); - if (!IS_ERR(data->thermal_clk)) - clk_disable_unprepare(data->thermal_clk); + pm_runtime_put_noidle(data->dev); + pm_runtime_disable(data->dev); =20 thermal_zone_device_unregister(data->tz); imx_thermal_unregister_legacy_cooling(data); @@ -858,29 +845,79 @@ static int __maybe_unused imx_thermal_suspend(struct = device *dev) ret =3D thermal_zone_device_disable(data->tz); if (ret) return ret; + + return pm_runtime_force_suspend(data->dev); +} + +static int __maybe_unused imx_thermal_resume(struct device *dev) +{ + struct imx_thermal_data *data =3D dev_get_drvdata(dev); + int ret; + + ret =3D pm_runtime_force_resume(data->dev); + if (ret) + return ret; + /* Enabled thermal sensor after resume */ + return thermal_zone_device_enable(data->tz); +} + +static int __maybe_unused imx_thermal_runtime_suspend(struct device *dev) +{ + struct imx_thermal_data *data =3D dev_get_drvdata(dev); + const struct thermal_soc_data *socdata =3D data->socdata; + struct regmap *map =3D data->tempmon; + int ret; + + ret =3D regmap_write(map, socdata->sensor_ctrl + REG_CLR, + socdata->measure_temp_mask); + if (ret) + return ret; + + ret =3D regmap_write(map, socdata->sensor_ctrl + REG_SET, + socdata->power_down_mask); + if (ret) + return ret; + clk_disable_unprepare(data->thermal_clk); =20 return 0; } =20 -static int __maybe_unused imx_thermal_resume(struct device *dev) +static int __maybe_unused imx_thermal_runtime_resume(struct device *dev) { struct imx_thermal_data *data =3D dev_get_drvdata(dev); + const struct thermal_soc_data *socdata =3D data->socdata; + struct regmap *map =3D data->tempmon; int ret; =20 ret =3D clk_prepare_enable(data->thermal_clk); if (ret) return ret; - /* Enabled thermal sensor after resume */ - ret =3D thermal_zone_device_enable(data->tz); + + ret =3D regmap_write(map, socdata->sensor_ctrl + REG_CLR, + socdata->power_down_mask); + if (ret) + return ret; + + ret =3D regmap_write(map, socdata->sensor_ctrl + REG_SET, + socdata->measure_temp_mask); if (ret) return ret; =20 + /* + * According to the temp sensor designers, it may require up to ~17us + * to complete a measurement. + */ + usleep_range(20, 50); + return 0; } =20 -static SIMPLE_DEV_PM_OPS(imx_thermal_pm_ops, - imx_thermal_suspend, imx_thermal_resume); +static const struct dev_pm_ops imx_thermal_pm_ops =3D { + SET_SYSTEM_SLEEP_PM_OPS(imx_thermal_suspend, imx_thermal_resume) + SET_RUNTIME_PM_OPS(imx_thermal_runtime_suspend, + imx_thermal_runtime_resume, NULL) +}; =20 static struct platform_driver imx_thermal =3D { .driver =3D { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAB81C433FE for ; Mon, 24 Jan 2022 21:44:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457099AbiAXVky (ORCPT ); Mon, 24 Jan 2022 16:40:54 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56160 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445320AbiAXVCs (ORCPT ); Mon, 24 Jan 2022 16:02:48 -0500 Received: from smtp.kernel.org (relay.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 4C690B81057; Mon, 24 Jan 2022 21:02:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70613C340E5; Mon, 24 Jan 2022 21:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058165; bh=MMPMmtVSLrtuyr7cLejn7b26l10ZVjMuBWZcYg26WQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ft1zlP+JT9w94b5TJ+snE25Sy8phg8EBFwdWdLDsRCPfaKaoO7fZIgZXRLb3jt8kO 7p1YtwrTZK947uTrXGo7T+JET16eQ77X/lC7cJP/XF0CCcZ9XVfxhrOh7eQzl9DxgR s9pq5F4yfMq8VsxpYp6VCd2Ns4Xr7RISZfqfyYzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesper Dangaard Brouer , Nechama Kraus , Maciej Fijalkowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.16 0201/1039] igc: AF_XDP zero-copy metadata adjust breaks SKBs on XDP_PASS Date: Mon, 24 Jan 2022 19:33:10 +0100 Message-Id: <20220124184132.088197008@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jesper Dangaard Brouer [ Upstream commit 4fa8fcd3440101dbacf4fae91de69877ef751977 ] Driver already implicitly supports XDP metadata access in AF_XDP zero-copy mode, as xsk_buff_pool's xp_alloc() naturally set xdp_buff data_meta equal data. This works fine for XDP and AF_XDP, but if a BPF-prog adjust via bpf_xdp_adjust_meta() and choose to call XDP_PASS, then igc function igc_construct_skb_zc() will construct an invalid SKB packet. The function correctly include the xdp->data_meta area in the memcpy, but forgot to pull header to take metasize into account. Fixes: fc9df2a0b520 ("igc: Enable RX via AF_XDP zero-copy") Signed-off-by: Jesper Dangaard Brouer Tested-by: Nechama Kraus Acked-by: Maciej Fijalkowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/intel/igc/igc_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethern= et/intel/igc/igc_main.c index d28a80a009537..d83e665b3a4f2 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -2448,8 +2448,10 @@ static struct sk_buff *igc_construct_skb_zc(struct i= gc_ring *ring, =20 skb_reserve(skb, xdp->data_meta - xdp->data_hard_start); memcpy(__skb_put(skb, totalsize), xdp->data_meta, totalsize); - if (metasize) + if (metasize) { skb_metadata_set(skb, metasize); + __skb_pull(skb, metasize); + } =20 return skb; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 047A7C4167D for ; Mon, 24 Jan 2022 21:43:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457114AbiAXVk4 (ORCPT ); Mon, 24 Jan 2022 16:40:56 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55124 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445339AbiAXVCu (ORCPT ); Mon, 24 Jan 2022 16:02:50 -0500 Received: from smtp.kernel.org (relay.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 1BD54B80CCF; Mon, 24 Jan 2022 21:02:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53CBBC340E5; Mon, 24 Jan 2022 21:02:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058167; bh=DyGvZKJ4HcQ9TVvA+xGuZUF4BUUr1iPoMEjkyNhdvKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mVPHCJti2RTteHHnO5ztfBk2MmwhJRfOcHzllsnpCmwfH1DnqFpkl9hMShmn4zCfv RDtS8H/7fd3Y//pOmNGaK/Dtq0ksKvhUGhG5EXtgJgCB2twPJKgmoXn9pMG6y7v8Za /6Ud7iHWhUQZ3NGHhzjbt7ocQxLReRZmOG3tFT7w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin , Amish Chana Subject: [PATCH 5.16 0202/1039] netfilter: bridge: add support for pppoe filtering Date: Mon, 24 Jan 2022 19:33:11 +0100 Message-Id: <20220124184132.117825471@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 28b78ecffea8078d81466b2e01bb5a154509f1ba ] This makes 'bridge-nf-filter-pppoe-tagged' sysctl work for bridged traffic. Looking at the original commit it doesn't appear this ever worked: static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *= *pskb, [..] if (skb->protocol =3D=3D htons(ETH_P_8021Q)) { skb_pull(skb, VLAN_HLEN); skb->network_header +=3D VLAN_HLEN; + } else if (skb->protocol =3D=3D htons(ETH_P_PPP_SES)) { + skb_pull(skb, PPPOE_SES_HLEN); + skb->network_header +=3D PPPOE_SES_HLEN; } [..] NF_HOOK(... POST_ROUTING, ...) ... but the adjusted offsets are never restored. The alternative would be to rip this code out for good, but otoh we'd have to keep this anyway for the vlan handling (which works because vlan tag info is in the skb, not the packet payload). Reported-and-tested-by: Amish Chana Fixes: 516299d2f5b6f97 ("[NETFILTER]: bridge-nf: filter bridged IPv4/IPv6 e= ncapsulated in pppoe traffic") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bridge/br_netfilter_hooks.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hook= s.c index b5af68c105a83..4fd882686b04d 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -743,6 +743,9 @@ static int br_nf_dev_queue_xmit(struct net *net, struct= sock *sk, struct sk_buff if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) mtu =3D nf_bridge->frag_max_size; =20 + nf_bridge_update_protocol(skb); + nf_bridge_push_encap_header(skb); + if (skb_is_gso(skb) || skb->len + mtu_reserved <=3D mtu) { nf_bridge_info_free(skb); return br_dev_queue_push_xmit(net, sk, skb); @@ -760,8 +763,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct= sock *sk, struct sk_buff =20 IPCB(skb)->frag_max_size =3D nf_bridge->frag_max_size; =20 - nf_bridge_update_protocol(skb); - data =3D this_cpu_ptr(&brnf_frag_data_storage); =20 if (skb_vlan_tag_present(skb)) { @@ -789,8 +790,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct= sock *sk, struct sk_buff =20 IP6CB(skb)->frag_max_size =3D nf_bridge->frag_max_size; =20 - nf_bridge_update_protocol(skb); - data =3D this_cpu_ptr(&brnf_frag_data_storage); data->encap_size =3D nf_bridge_encap_header_len(skb); data->size =3D ETH_HLEN + data->encap_size; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3635C433F5 for ; Mon, 24 Jan 2022 21:43:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457131AbiAXVlA (ORCPT ); Mon, 24 Jan 2022 16:41:00 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53558 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445345AbiAXVCw (ORCPT ); Mon, 24 Jan 2022 16:02:52 -0500 Received: from smtp.kernel.org (relay.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 7486F61320; Mon, 24 Jan 2022 21:02:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F357C340E5; Mon, 24 Jan 2022 21:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058170; bh=c119dTtFJ/UsDiNJRoA+V53VfW8MDbBahmzYfXdX0aE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0WUuNBlWta3mzI4mxH9Io1Q3rM2DbTuet8xmodACbe+Ud0fMJp3NSKJyuNtLUe17W 0rnK+OYQdaoZpPGBbQlYFRM/5o4VjMYxOlJjydn05NEZfYmNWTQ3EWMWE9+QIkp3u1 VJx9z5EQZ2NkWZ7j8XUPSy/pzF58NDokivxl8EtQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Thomas Gleixner , Eirik Fuller , Michael Ellerman , Nicholas Piggin , Sasha Levin Subject: [PATCH 5.16 0203/1039] powerpc: Avoid discarding flags in system_call_exception() Date: Mon, 24 Jan 2022 19:33:12 +0100 Message-Id: <20220124184132.148938792@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Rutland [ Upstream commit 08b0af5b2affbe7419853e8dd1330e4b3fe27125 ] Some thread flags can be set remotely, and so even when IRQs are disabled, the flags can change under our feet. Thus, when setting flags we must use an atomic operation rather than a plain read-modify-write sequence, as a plain read-modify-write may discard flags which are concurrently set by a remote thread, e.g. // task A // task B tmp =3D A->thread_info.flags; set_tsk_thread_flag(A, NEWFLAG_B); tmp |=3D NEWFLAG_A; A->thread_info.flags =3D tmp; arch/powerpc/kernel/interrupt.c's system_call_exception() sets _TIF_RESTOREALL in the thread info flags with a read-modify-write, which may result in other flags being discarded. Elsewhere in the file it uses clear_bits() to atomically remove flag bits, so use set_bits() here for consistency with those. There may be reasons (e.g. instrumentation) that prevent the use of set_thread_flag() and clear_thread_flag() here, which would otherwise be preferable. Fixes: ae7aaecc3f2f78b7 ("powerpc/64s: system call rfscv workaround for TM = bugs") Signed-off-by: Mark Rutland Signed-off-by: Thomas Gleixner Cc: Eirik Fuller Cc: Michael Ellerman Cc: Nicholas Piggin Link: https://lore.kernel.org/r/20211129130653.2037928-10-mark.rutland@arm.= com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kernel/interrupt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrup= t.c index 835b626cd4760..df048e331cbfe 100644 --- a/arch/powerpc/kernel/interrupt.c +++ b/arch/powerpc/kernel/interrupt.c @@ -148,7 +148,7 @@ notrace long system_call_exception(long r3, long r4, lo= ng r5, */ if (IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM) && unlikely(MSR_TM_TRANSACTIONAL(regs->msr))) - current_thread_info()->flags |=3D _TIF_RESTOREALL; + set_bits(_TIF_RESTOREALL, ¤t_thread_info()->flags); =20 /* * If the system call was made with a transaction active, doom it and --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1671C2BA4C for ; Tue, 25 Jan 2022 00:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372515AbiAYALu (ORCPT ); Mon, 24 Jan 2022 19:11:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356615AbiAXWjo (ORCPT ); Mon, 24 Jan 2022 17:39:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71973C05487E; Mon, 24 Jan 2022 13:02:56 -0800 (PST) Received: from smtp.kernel.org (relay.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 39B3FB8123D; Mon, 24 Jan 2022 21:02:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D0C4C340E5; Mon, 24 Jan 2022 21:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058174; bh=YIVcffIQyq2XLA6aoqQ7+F5OrkIe5KlOSYgHLVyqGi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XgSjUiBI4umC08n9iC9OgAtG/rap2RaSmG92rVgfVVP02nIlGUK0FZTrEKjxLsVJe Nngjbg1iP2NwH5n9fdJjSEqS+C/B7w/ic5ZTTsLucsZKYE/emd574TluZ0F2CwCBvJ 7VJ4wjqFz4ipP9SNBUekWl+16TpcRYh8l6bNLSNQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianwei Hu , "Uladzislau Rezki (Sony)" , Marco Elver , Juri Lelli , Jun Miao , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.16 0204/1039] rcu: Avoid alloc_pages() when recording stack Date: Mon, 24 Jan 2022 19:33:13 +0100 Message-Id: <20220124184132.181097293@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jun Miao [ Upstream commit 300c0c5e721834f484b03fa3062602dd8ff48413 ] The default kasan_record_aux_stack() calls stack_depot_save() with GFP_NOWA= IT, which in turn can then call alloc_pages(GFP_NOWAIT, ...). In general, howe= ver, it is not even possible to use either GFP_ATOMIC nor GFP_NOWAIT in certain non-preemptive contexts/RT kernel including raw_spin_locks (see gfp.h and a= b00db216c9c7). Fix it by instructing stackdepot to not expand stack storage via alloc_page= s() in case it runs out by using kasan_record_aux_stack_noalloc(). Jianwei Hu reported: BUG: sleeping function called from invalid context at kernel/locking/rtmute= x.c:969 in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 15319, name: python3 INFO: lockdep is turned off. irq event stamp: 0 hardirqs last enabled at (0): [<0000000000000000>] 0x0 hardirqs last disabled at (0): [] copy_process+0xaf3/0x= 2590 softirqs last enabled at (0): [] copy_process+0xaf3/0x= 2590 softirqs last disabled at (0): [<0000000000000000>] 0x0 CPU: 6 PID: 15319 Comm: python3 Tainted: G W O 5.15-rc7-preempt-r= t #1 Hardware name: Supermicro SYS-E300-9A-8C/A2SDi-8C-HLN4F, BIOS 1.1b 12/17/= 2018 Call Trace: show_stack+0x52/0x58 dump_stack+0xa1/0xd6 ___might_sleep.cold+0x11c/0x12d rt_spin_lock+0x3f/0xc0 rmqueue+0x100/0x1460 rmqueue+0x100/0x1460 mark_usage+0x1a0/0x1a0 ftrace_graph_ret_addr+0x2a/0xb0 rmqueue_pcplist.constprop.0+0x6a0/0x6a0 __kasan_check_read+0x11/0x20 __zone_watermark_ok+0x114/0x270 get_page_from_freelist+0x148/0x630 is_module_text_address+0x32/0xa0 __alloc_pages_nodemask+0x2f6/0x790 __alloc_pages_slowpath.constprop.0+0x12d0/0x12d0 create_prof_cpu_mask+0x30/0x30 alloc_pages_current+0xb1/0x150 stack_depot_save+0x39f/0x490 kasan_save_stack+0x42/0x50 kasan_save_stack+0x23/0x50 kasan_record_aux_stack+0xa9/0xc0 __call_rcu+0xff/0x9c0 call_rcu+0xe/0x10 put_object+0x53/0x70 __delete_object+0x7b/0x90 kmemleak_free+0x46/0x70 slab_free_freelist_hook+0xb4/0x160 kfree+0xe5/0x420 kfree_const+0x17/0x30 kobject_cleanup+0xaa/0x230 kobject_put+0x76/0x90 netdev_queue_update_kobjects+0x17d/0x1f0 ... ... ksys_write+0xd9/0x180 __x64_sys_write+0x42/0x50 do_syscall_64+0x38/0x50 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Links: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/c= ommit/include/linux/kasan.h?id=3D7cb3007ce2da27ec02a1a3211941e7fe6875b642 Fixes: 84109ab58590 ("rcu: Record kvfree_call_rcu() call stack for KASAN") Fixes: 26e760c9a7c8 ("rcu: kasan: record and print call_rcu() call stack") Reported-by: Jianwei Hu Reviewed-by: Uladzislau Rezki (Sony) Acked-by: Marco Elver Tested-by: Juri Lelli Signed-off-by: Jun Miao Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/rcu/tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index ef8d36f580fc3..906b6887622d3 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -2982,7 +2982,7 @@ __call_rcu(struct rcu_head *head, rcu_callback_t func) head->func =3D func; head->next =3D NULL; local_irq_save(flags); - kasan_record_aux_stack(head); + kasan_record_aux_stack_noalloc(head); rdp =3D this_cpu_ptr(&rcu_data); =20 /* Add the callback to our list. */ @@ -3547,7 +3547,7 @@ void kvfree_call_rcu(struct rcu_head *head, rcu_callb= ack_t func) return; } =20 - kasan_record_aux_stack(ptr); + kasan_record_aux_stack_noalloc(ptr); success =3D add_ptr_to_bulk_krc_lock(&krcp, &flags, ptr, !head); if (!success) { run_page_cache_worker(krcp); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7279CC3526C for ; Tue, 25 Jan 2022 00:14:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372490AbiAYALp (ORCPT ); Mon, 24 Jan 2022 19:11:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356628AbiAXWjo (ORCPT ); Mon, 24 Jan 2022 17:39:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C144C05487F; Mon, 24 Jan 2022 13:02:58 -0800 (PST) Received: from smtp.kernel.org (relay.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 B4B476137C; Mon, 24 Jan 2022 21:02:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8677AC340E5; Mon, 24 Jan 2022 21:02:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058177; bh=AsfyfCHEsg/BjcehF3eM9HOdbGRKyIGsqpPBSOJDue0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ffCIs5yLQtjkp06Ezk6RtY7uxioQ8BL5h/P3YkZA0Zzs5pLMedHu8pUzc82Cw59PQ nfoin8VtRzLNez3mxZMiYd7Xj38vVdhgqwUoAxJWJ23nxNwOtaeQnuGB3P432TkF1L ZkrMKshd6o97JX7sPH7j8wz7Go/0Xz0i1He+1VXM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.16 0205/1039] arm64: dts: qcom: msm8916: fix MMC controller aliases Date: Mon, 24 Jan 2022 19:33:14 +0100 Message-Id: <20220124184132.212229203@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit b0293c19d42f6d6951c2fab9a47fed50baf2c14d ] Change sdhcN aliases to mmcN to make them actually work. Currently the board uses non-standard aliases sdhcN, which do not work, resulting in mmc0 and mmc1 hosts randomly changing indices between boots. Fixes: c4da5a561627 ("arm64: dts: qcom: Add msm8916 sdhci configuration nod= es") Signed-off-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211201020559.1611890-1-dmitry.baryshkov@l= inaro.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/qcom/msm8916.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qc= om/msm8916.dtsi index c1c42f26b61e0..8be601275e9b4 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -19,8 +19,8 @@ #size-cells =3D <2>; =20 aliases { - sdhc1 =3D &sdhc_1; /* SDC1 eMMC slot */ - sdhc2 =3D &sdhc_2; /* SDC2 SD card slot */ + mmc0 =3D &sdhc_1; /* SDC1 eMMC slot */ + mmc1 =3D &sdhc_2; /* SDC2 SD card slot */ }; =20 chosen { }; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5446C4332F for ; Mon, 24 Jan 2022 21:43:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457147AbiAXVlC (ORCPT ); Mon, 24 Jan 2022 16:41:02 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55262 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347028AbiAXVDC (ORCPT ); Mon, 24 Jan 2022 16:03:02 -0500 Received: from smtp.kernel.org (relay.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 67612B811FB; Mon, 24 Jan 2022 21:03:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F133C340E5; Mon, 24 Jan 2022 21:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058180; bh=r6PJTVbTgA7n2wSq8entt3xiWEWDnWuHPyVrqFfvuUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gjr/q4eJRij9zblNdQ/jOqW60PpN6pwa4UjJzwO5gI5aGGMgFS9D08MdmPJVF4F6J uiNt77AefEr1LWDvB80ZtmXxadFsko9Vjlxj44KfUFQovmWSvhdshvuz35eutVtC2J oT4LE7j3DdnfaHlLRFTa38EvBvQJDT/JYuONYnBw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zack Rusin , Martin Krastev , Sasha Levin Subject: [PATCH 5.16 0206/1039] drm/vmwgfx: Remove the deprecated lower mem limit Date: Mon, 24 Jan 2022 19:33:15 +0100 Message-Id: <20220124184132.246155959@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zack Rusin [ Upstream commit 826c387d015247df396a91eadbaca94f0394853c ] TTM during the transition to the new page allocator lost the ability to constrain the allocations via the lower_mem_limit. The code has been unused since the change: 256dd44bd897 ("drm/ttm: nuke old page allocator") and there's no reason to keep it. Fixes: 256dd44bd897 ("drm/ttm: nuke old page allocator") Signed-off-by: Zack Rusin Reviewed-by: Martin Krastev Link: https://patchwork.freedesktop.org/patch/msgid/20211105193845.258816-2= -zackr@vmware.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vmwgfx/ttm_memory.c | 99 +---------------------------- drivers/gpu/drm/vmwgfx/ttm_memory.h | 6 +- 2 files changed, 2 insertions(+), 103 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/ttm_memory.c b/drivers/gpu/drm/vmwgfx/t= tm_memory.c index 7f7fe35fc21df..326d2d177c8bb 100644 --- a/drivers/gpu/drm/vmwgfx/ttm_memory.c +++ b/drivers/gpu/drm/vmwgfx/ttm_memory.c @@ -34,7 +34,6 @@ #include #include #include -#include =20 #include #include @@ -173,69 +172,7 @@ static struct kobj_type ttm_mem_zone_kobj_type =3D { .sysfs_ops =3D &ttm_mem_zone_ops, .default_attrs =3D ttm_mem_zone_attrs, }; - -static struct attribute ttm_mem_global_lower_mem_limit =3D { - .name =3D "lower_mem_limit", - .mode =3D S_IRUGO | S_IWUSR -}; - -static ssize_t ttm_mem_global_show(struct kobject *kobj, - struct attribute *attr, - char *buffer) -{ - struct ttm_mem_global *glob =3D - container_of(kobj, struct ttm_mem_global, kobj); - uint64_t val =3D 0; - - spin_lock(&glob->lock); - val =3D glob->lower_mem_limit; - spin_unlock(&glob->lock); - /* convert from number of pages to KB */ - val <<=3D (PAGE_SHIFT - 10); - return snprintf(buffer, PAGE_SIZE, "%llu\n", - (unsigned long long) val); -} - -static ssize_t ttm_mem_global_store(struct kobject *kobj, - struct attribute *attr, - const char *buffer, - size_t size) -{ - int chars; - uint64_t val64; - unsigned long val; - struct ttm_mem_global *glob =3D - container_of(kobj, struct ttm_mem_global, kobj); - - chars =3D sscanf(buffer, "%lu", &val); - if (chars =3D=3D 0) - return size; - - val64 =3D val; - /* convert from KB to number of pages */ - val64 >>=3D (PAGE_SHIFT - 10); - - spin_lock(&glob->lock); - glob->lower_mem_limit =3D val64; - spin_unlock(&glob->lock); - - return size; -} - -static struct attribute *ttm_mem_global_attrs[] =3D { - &ttm_mem_global_lower_mem_limit, - NULL -}; - -static const struct sysfs_ops ttm_mem_global_ops =3D { - .show =3D &ttm_mem_global_show, - .store =3D &ttm_mem_global_store, -}; - -static struct kobj_type ttm_mem_glob_kobj_type =3D { - .sysfs_ops =3D &ttm_mem_global_ops, - .default_attrs =3D ttm_mem_global_attrs, -}; +static struct kobj_type ttm_mem_glob_kobj_type =3D {0}; =20 static bool ttm_zones_above_swap_target(struct ttm_mem_global *glob, bool from_wq, uint64_t extra) @@ -435,11 +372,6 @@ int ttm_mem_global_init(struct ttm_mem_global *glob, s= truct device *dev) =20 si_meminfo(&si); =20 - spin_lock(&glob->lock); - /* set it as 0 by default to keep original behavior of OOM */ - glob->lower_mem_limit =3D 0; - spin_unlock(&glob->lock); - ret =3D ttm_mem_init_kernel_zone(glob, &si); if (unlikely(ret !=3D 0)) goto out_no_zone; @@ -526,35 +458,6 @@ void ttm_mem_global_free(struct ttm_mem_global *glob, } EXPORT_SYMBOL(ttm_mem_global_free); =20 -/* - * check if the available mem is under lower memory limit - * - * a. if no swap disk at all or free swap space is under swap_mem_limit - * but available system mem is bigger than sys_mem_limit, allow TTM - * allocation; - * - * b. if the available system mem is less than sys_mem_limit but free - * swap disk is bigger than swap_mem_limit, allow TTM allocation. - */ -bool -ttm_check_under_lowerlimit(struct ttm_mem_global *glob, - uint64_t num_pages, - struct ttm_operation_ctx *ctx) -{ - int64_t available; - - /* We allow over commit during suspend */ - if (ctx->force_alloc) - return false; - - available =3D get_nr_swap_pages() + si_mem_available(); - available -=3D num_pages; - if (available < glob->lower_mem_limit) - return true; - - return false; -} - static int ttm_mem_global_reserve(struct ttm_mem_global *glob, struct ttm_mem_zone *single_zone, uint64_t amount, bool reserve) diff --git a/drivers/gpu/drm/vmwgfx/ttm_memory.h b/drivers/gpu/drm/vmwgfx/t= tm_memory.h index c50dba7744854..7b0d617ebcb1e 100644 --- a/drivers/gpu/drm/vmwgfx/ttm_memory.h +++ b/drivers/gpu/drm/vmwgfx/ttm_memory.h @@ -50,8 +50,6 @@ * @work: The workqueue callback for the shrink queue. * @lock: Lock to protect the @shrink - and the memory accounting members, * that is, essentially the whole structure with some exceptions. - * @lower_mem_limit: include lower limit of swap space and lower limit of - * system memory. * @zones: Array of pointers to accounting zones. * @num_zones: Number of populated entries in the @zones array. * @zone_kernel: Pointer to the kernel zone. @@ -69,7 +67,6 @@ extern struct ttm_mem_global { struct workqueue_struct *swap_queue; struct work_struct work; spinlock_t lock; - uint64_t lower_mem_limit; struct ttm_mem_zone *zones[TTM_MEM_MAX_ZONES]; unsigned int num_zones; struct ttm_mem_zone *zone_kernel; @@ -91,6 +88,5 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page, uint64_t size); size_t ttm_round_pot(size_t size); -bool ttm_check_under_lowerlimit(struct ttm_mem_global *glob, uint64_t num_= pages, - struct ttm_operation_ctx *ctx); + #endif --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21FB1C433F5 for ; Mon, 24 Jan 2022 23:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1851341AbiAXXc2 (ORCPT ); Mon, 24 Jan 2022 18:32:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356728AbiAXWjp (ORCPT ); Mon, 24 Jan 2022 17:39:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93847C04D603; Mon, 24 Jan 2022 13:03:04 -0800 (PST) Received: from smtp.kernel.org (relay.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 308F861330; Mon, 24 Jan 2022 21:03:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9357EC340E5; Mon, 24 Jan 2022 21:03:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058183; bh=tdR6gKGncBF3HjpyNtIxUyGnEF9+TBf9ZeYEJNJWJGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ECPMU5fji+WrdDHg7lKG0e8/5B4AMPJ0QfqADSom+zfv/VvRMGU20X7jG6Uh/KAUx e9Zx76ndavY07+d/U9PlW9iO+sN6S+55K/ihY1meA0DSAYlw912dkdnyawmY0GXvP/ NgSAhF24biT5DyqtBKloD//6gVqsgSwLW5migUiY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zack Rusin , Martin Krastev , Sasha Levin Subject: [PATCH 5.16 0207/1039] drm/vmwgfx: Fail to initialize on broken configs Date: Mon, 24 Jan 2022 19:33:16 +0100 Message-Id: <20220124184132.284995393@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zack Rusin [ Upstream commit c451af78f301ff5156998d571c37cab329c10051 ] Some of our hosts have a bug where rescaning a pci bus results in stale fifo memory being mapped on the host. This makes any fifo communication impossible resulting in various kernel crashes. Instead of unexpectedly crashing, predictably fail to load the driver which will preserve the system. Fixes: fb1d9738ca05 ("drm/vmwgfx: Add DRM driver for VMware Virtual GPU") Signed-off-by: Zack Rusin Reviewed-by: Martin Krastev Link: https://patchwork.freedesktop.org/patch/msgid/20211105193845.258816-4= -zackr@vmware.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c b/drivers/gpu/drm/vmwgfx/v= mwgfx_cmd.c index 67db472d3493c..a3bfbb6c3e14a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c @@ -145,6 +145,13 @@ struct vmw_fifo_state *vmw_fifo_create(struct vmw_priv= ate *dev_priv) (unsigned int) max, (unsigned int) min, (unsigned int) fifo->capabilities); + + if (unlikely(min >=3D max)) { + drm_warn(&dev_priv->drm, + "FIFO memory is not usable. Driver failed to initialize."); + return ERR_PTR(-ENXIO); + } + return fifo; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77B44C433F5 for ; Tue, 25 Jan 2022 03:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1313316AbiAYCsT (ORCPT ); Mon, 24 Jan 2022 21:48:19 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55406 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353476AbiAXVDJ (ORCPT ); Mon, 24 Jan 2022 16:03:09 -0500 Received: from smtp.kernel.org (relay.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 4758A61330; Mon, 24 Jan 2022 21:03:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29F37C340E8; Mon, 24 Jan 2022 21:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058186; bh=v6/FXpNGzXAE6TYf3fSLBuAkE9l9oQwNd47fnT/FRjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=crUKKgIScQfakz6m85UahN/T+kKgZHdyhYnJ4bEjAEzBilkqHsmH1YjJzHDeB3F4p NscIcschExw1c0agGjbHctp5Lm8CzHIYBRIA3BAK6jbjFFBF2iOiCmzd9tCh9hMTz0 tk4C3Z0+8aPp6ZtZO7pXl12T7S0fpaYrd+IhyO1M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, William Kucharski , "Steven Rostedt (VMware)" , Tejun Heo , Sasha Levin Subject: [PATCH 5.16 0208/1039] cgroup: Trace event cgroup id fields should be u64 Date: Mon, 24 Jan 2022 19:33:17 +0100 Message-Id: <20220124184132.315640037@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Kucharski [ Upstream commit e14da77113bb890d7bf9e5d17031bdd476a7ce5e ] Various trace event fields that store cgroup IDs were declared as ints, but cgroup_id(() returns a u64 and the structures and associated TP_printk() calls were not updated to reflect this. Fixes: 743210386c03 ("cgroup: use cgrp->kn->id as the cgroup ID") Signed-off-by: William Kucharski Reviewed-by: Steven Rostedt (VMware) Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/trace/events/cgroup.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/trace/events/cgroup.h b/include/trace/events/cgroup.h index 7f42a3de59e6b..dd7d7c9efecdf 100644 --- a/include/trace/events/cgroup.h +++ b/include/trace/events/cgroup.h @@ -59,8 +59,8 @@ DECLARE_EVENT_CLASS(cgroup, =20 TP_STRUCT__entry( __field( int, root ) - __field( int, id ) __field( int, level ) + __field( u64, id ) __string( path, path ) ), =20 @@ -71,7 +71,7 @@ DECLARE_EVENT_CLASS(cgroup, __assign_str(path, path); ), =20 - TP_printk("root=3D%d id=3D%d level=3D%d path=3D%s", + TP_printk("root=3D%d id=3D%llu level=3D%d path=3D%s", __entry->root, __entry->id, __entry->level, __get_str(path)) ); =20 @@ -126,8 +126,8 @@ DECLARE_EVENT_CLASS(cgroup_migrate, =20 TP_STRUCT__entry( __field( int, dst_root ) - __field( int, dst_id ) __field( int, dst_level ) + __field( u64, dst_id ) __field( int, pid ) __string( dst_path, path ) __string( comm, task->comm ) @@ -142,7 +142,7 @@ DECLARE_EVENT_CLASS(cgroup_migrate, __assign_str(comm, task->comm); ), =20 - TP_printk("dst_root=3D%d dst_id=3D%d dst_level=3D%d dst_path=3D%s pid=3D%= d comm=3D%s", + TP_printk("dst_root=3D%d dst_id=3D%llu dst_level=3D%d dst_path=3D%s pid= =3D%d comm=3D%s", __entry->dst_root, __entry->dst_id, __entry->dst_level, __get_str(dst_path), __entry->pid, __get_str(comm)) ); @@ -171,8 +171,8 @@ DECLARE_EVENT_CLASS(cgroup_event, =20 TP_STRUCT__entry( __field( int, root ) - __field( int, id ) __field( int, level ) + __field( u64, id ) __string( path, path ) __field( int, val ) ), @@ -185,7 +185,7 @@ DECLARE_EVENT_CLASS(cgroup_event, __entry->val =3D val; ), =20 - TP_printk("root=3D%d id=3D%d level=3D%d path=3D%s val=3D%d", + TP_printk("root=3D%d id=3D%llu level=3D%d path=3D%s val=3D%d", __entry->root, __entry->id, __entry->level, __get_str(path), __entry->val) ); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDBE7C4321E for ; Tue, 25 Jan 2022 03:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1313929AbiAYCt5 (ORCPT ); Mon, 24 Jan 2022 21:49:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56456 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359574AbiAXVDO (ORCPT ); Mon, 24 Jan 2022 16:03:14 -0500 Received: from smtp.kernel.org (relay.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 16BFFB81257; Mon, 24 Jan 2022 21:03:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4456AC340EF; Mon, 24 Jan 2022 21:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058189; bh=bOT/9j3CWMqdCF6D64BdPYF7kNSLQZRb4VP1RAgo61E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TSbxeMDWipZ3RjGlKUwQpL7moa2uB6IK2ftPJ+hL8pOqyS2jsYPmu7kUbQPE2YZmy QKS2ezMObvirDLx1s2q5P1RbRUuCPi01KxUzHPLwdu7h94g9CEDuQLDqE4lTSA46XF 1ZuLG7+vzdroi3/9GkCJ1kOt7S2307/rbz9oREv4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0209/1039] ACPI: EC: Rework flushing of EC work while suspended to idle Date: Mon, 24 Jan 2022 19:33:18 +0100 Message-Id: <20220124184132.350878842@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki [ Upstream commit 4a9af6cac050dce2e895ec3205c4615383ad9112 ] The flushing of pending work in the EC driver uses drain_workqueue() to flush the event handling work that can requeue itself via advance_transaction(), but this is problematic, because that work may also be requeued from the query workqueue. Namely, if an EC transaction is carried out during the execution of a query handler, it involves calling advance_transaction() which may queue up the event handling work again. This causes the kernel to complain about attempts to add a work item to the EC event workqueue while it is being drained and worst-case it may cause a valid event to be skipped. To avoid this problem, introduce two new counters, events_in_progress and queries_in_progress, incremented when a work item is queued on the event workqueue or the query workqueue, respectively, and decremented at the end of the corresponding work function, and make acpi_ec_dispatch_gpe() the workqueues in a loop until the both of these counters are zero (or system wakeup is pending) instead of calling acpi_ec_flush_work(). At the same time, change __acpi_ec_flush_work() to call flush_workqueue() instead of drain_workqueue() to flush the event workqueue. While at it, use the observation that the work item queued in acpi_ec_query() cannot be pending at that time, because it is used only once, to simplify the code in there. Additionally, clean up a comment in acpi_ec_query() and adjust white space in acpi_ec_event_processor(). Fixes: f0ac20c3f613 ("ACPI: EC: Fix flushing of pending work") Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/ec.c | 57 +++++++++++++++++++++++++++++++---------- drivers/acpi/internal.h | 2 ++ 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index a6366d3f0c786..b9c44e6c5e400 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -166,6 +166,7 @@ struct acpi_ec_query { struct transaction transaction; struct work_struct work; struct acpi_ec_query_handler *handler; + struct acpi_ec *ec; }; =20 static int acpi_ec_query(struct acpi_ec *ec, u8 *data); @@ -452,6 +453,7 @@ static void acpi_ec_submit_query(struct acpi_ec *ec) ec_dbg_evt("Command(%s) submitted/blocked", acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY)); ec->nr_pending_queries++; + ec->events_in_progress++; queue_work(ec_wq, &ec->work); } } @@ -518,7 +520,7 @@ static void acpi_ec_enable_event(struct acpi_ec *ec) #ifdef CONFIG_PM_SLEEP static void __acpi_ec_flush_work(void) { - drain_workqueue(ec_wq); /* flush ec->work */ + flush_workqueue(ec_wq); /* flush ec->work */ flush_workqueue(ec_query_wq); /* flush queries */ } =20 @@ -1103,7 +1105,7 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec,= u8 query_bit) } EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); =20 -static struct acpi_ec_query *acpi_ec_create_query(u8 *pval) +static struct acpi_ec_query *acpi_ec_create_query(struct acpi_ec *ec, u8 *= pval) { struct acpi_ec_query *q; struct transaction *t; @@ -1111,11 +1113,13 @@ static struct acpi_ec_query *acpi_ec_create_query(u= 8 *pval) q =3D kzalloc(sizeof (struct acpi_ec_query), GFP_KERNEL); if (!q) return NULL; + INIT_WORK(&q->work, acpi_ec_event_processor); t =3D &q->transaction; t->command =3D ACPI_EC_COMMAND_QUERY; t->rdata =3D pval; t->rlen =3D 1; + q->ec =3D ec; return q; } =20 @@ -1132,13 +1136,21 @@ static void acpi_ec_event_processor(struct work_str= uct *work) { struct acpi_ec_query *q =3D container_of(work, struct acpi_ec_query, work= ); struct acpi_ec_query_handler *handler =3D q->handler; + struct acpi_ec *ec =3D q->ec; =20 ec_dbg_evt("Query(0x%02x) started", handler->query_bit); + if (handler->func) handler->func(handler->data); else if (handler->handle) acpi_evaluate_object(handler->handle, NULL, NULL, NULL); + ec_dbg_evt("Query(0x%02x) stopped", handler->query_bit); + + spin_lock_irq(&ec->lock); + ec->queries_in_progress--; + spin_unlock_irq(&ec->lock); + acpi_ec_delete_query(q); } =20 @@ -1148,7 +1160,7 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data) int result; struct acpi_ec_query *q; =20 - q =3D acpi_ec_create_query(&value); + q =3D acpi_ec_create_query(ec, &value); if (!q) return -ENOMEM; =20 @@ -1170,19 +1182,20 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *da= ta) } =20 /* - * It is reported that _Qxx are evaluated in a parallel way on - * Windows: + * It is reported that _Qxx are evaluated in a parallel way on Windows: * https://bugzilla.kernel.org/show_bug.cgi?id=3D94411 * - * Put this log entry before schedule_work() in order to make - * it appearing before any other log entries occurred during the - * work queue execution. + * Put this log entry before queue_work() to make it appear in the log + * before any other messages emitted during workqueue handling. */ ec_dbg_evt("Query(0x%02x) scheduled", value); - if (!queue_work(ec_query_wq, &q->work)) { - ec_dbg_evt("Query(0x%02x) overlapped", value); - result =3D -EBUSY; - } + + spin_lock_irq(&ec->lock); + + ec->queries_in_progress++; + queue_work(ec_query_wq, &q->work); + + spin_unlock_irq(&ec->lock); =20 err_exit: if (result) @@ -1240,6 +1253,10 @@ static void acpi_ec_event_handler(struct work_struct= *work) ec_dbg_evt("Event stopped"); =20 acpi_ec_check_event(ec); + + spin_lock_irqsave(&ec->lock, flags); + ec->events_in_progress--; + spin_unlock_irqrestore(&ec->lock, flags); } =20 static void acpi_ec_handle_interrupt(struct acpi_ec *ec) @@ -2021,6 +2038,7 @@ void acpi_ec_set_gpe_wake_mask(u8 action) =20 bool acpi_ec_dispatch_gpe(void) { + bool work_in_progress; u32 ret; =20 if (!first_ec) @@ -2041,8 +2059,19 @@ bool acpi_ec_dispatch_gpe(void) if (ret =3D=3D ACPI_INTERRUPT_HANDLED) pm_pr_dbg("ACPI EC GPE dispatched\n"); =20 - /* Flush the event and query workqueues. */ - acpi_ec_flush_work(); + /* Drain EC work. */ + do { + acpi_ec_flush_work(); + + pm_pr_dbg("ACPI EC work flushed\n"); + + spin_lock_irq(&first_ec->lock); + + work_in_progress =3D first_ec->events_in_progress + + first_ec->queries_in_progress > 0; + + spin_unlock_irq(&first_ec->lock); + } while (work_in_progress && !pm_wakeup_pending()); =20 return false; } diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index d91b560e88674..54b2be94d23dc 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -183,6 +183,8 @@ struct acpi_ec { struct work_struct work; unsigned long timestamp; unsigned long nr_pending_queries; + unsigned int events_in_progress; + unsigned int queries_in_progress; bool busy_polling; unsigned int polling_guard; }; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4289C4321E for ; Tue, 25 Jan 2022 00:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372854AbiAYAMj (ORCPT ); Mon, 24 Jan 2022 19:12:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376878AbiAXWjp (ORCPT ); Mon, 24 Jan 2022 17:39:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12318C055A82; Mon, 24 Jan 2022 13:03:17 -0800 (PST) Received: from smtp.kernel.org (relay.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 A759D6135E; Mon, 24 Jan 2022 21:03:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65974C340E5; Mon, 24 Jan 2022 21:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058196; bh=2kVKJqHtcxVJW0NOQq1o96/VtVRgd9Gc0cgLyrd3S30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KdW8qaJufB0i97aLVsNFLt2RGLDHb6GR+7OnVbCsWSqWN6ggKs2tcCUe0rnpaY1SW rlGRJdH49Yep9cyA1jpObyJ6xzSASFhkspWKiPfgG1oj8mqtoaNIPnZvgXxPAj0Y9A nhYVI7GqJGJs71el0dYpdyH/+fE9c8iQP7T86/Oo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Linus Walleij , Sasha Levin Subject: [PATCH 5.16 0210/1039] pinctrl: mediatek: uninitialized variable in mtk_pctrl_show_one_pin() Date: Mon, 24 Jan 2022 19:33:19 +0100 Message-Id: <20220124184132.386134617@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 67bbbcb49b968a93251de7b23616d5aff5d3a726 ] The "try_all_type" variable is not set if (hw->soc->pull_type) is false leading to the following Smatch warning: drivers/pinctrl/mediatek/pinctrl-paris.c:599 mtk_pctrl_show_one_pin() error: uninitialized symbol 'try_all_type'. Fixes: fb34a9ae383a ("pinctrl: mediatek: support rsel feature") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/20211127140750.GA24002@kili Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pinctrl/mediatek/pinctrl-paris.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/med= iatek/pinctrl-paris.c index d4e02c5d74a89..4c6f6d967b18a 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c @@ -581,7 +581,7 @@ ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw, { int pinmux, pullup, pullen, len =3D 0, r1 =3D -1, r0 =3D -1, rsel =3D -1; const struct mtk_pin_desc *desc; - u32 try_all_type; + u32 try_all_type =3D 0; =20 if (gpio >=3D hw->soc->npins) return -EINVAL; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 349C3C4167B for ; Tue, 25 Jan 2022 03:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314037AbiAYCuM (ORCPT ); Mon, 24 Jan 2022 21:50:12 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56624 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445413AbiAXVDX (ORCPT ); Mon, 24 Jan 2022 16:03:23 -0500 Received: from smtp.kernel.org (relay.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 70498B812A4; Mon, 24 Jan 2022 21:03:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA448C36AE9; Mon, 24 Jan 2022 21:03:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058199; bh=AMRrFw241ZNcJROd7kDoE1b/E1gc3bQHomw3ZEgExvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fIxbrJG/gkN6iU5uB8kco8LitLSs9BPG9TzaIyGjVdfabo5pQHHhcHrU299Sxqfux 2Ln6lq6DlqdRBlHwrSycJgjYJLFJciS2rt6SvzXSvf5jEaPCcDUgUQTDU83c7DEKIV vrsN4ZoZn/qJujq2tTXEopc+XFSkHwk3rgOcAga0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Linus Walleij , Sasha Levin Subject: [PATCH 5.16 0211/1039] pinctrl: mediatek: add a check for error in mtk_pinconf_bias_get_rsel() Date: Mon, 24 Jan 2022 19:33:20 +0100 Message-Id: <20220124184132.426242390@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 9f9d17c228c89e38ed612500126daf626270be9a ] All the other mtk_hw_get_value() calls have a check for "if (err)" so we can add one here as well. This silences a Smatch warning: drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:819 mtk_pinconf_bias_g= et_rsel() error: uninitialized symbol 'pd'. Fixes: fb34a9ae383a ("pinctrl: mediatek: support rsel feature") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/20211127140836.GB24002@kili Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pin= ctrl/mediatek/pinctrl-mtk-common-v2.c index 53779822348da..e1ae3beb9f72b 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c @@ -815,6 +815,8 @@ static int mtk_pinconf_bias_get_rsel(struct mtk_pinctrl= *hw, goto out; =20 err =3D mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_PD, &pd); + if (err) + goto out; =20 if (pu =3D=3D 0 && pd =3D=3D 0) { *pullup =3D 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CCA4C4321E for ; Tue, 25 Jan 2022 00:15:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372833AbiAYAMf (ORCPT ); Mon, 24 Jan 2022 19:12:35 -0500 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 S1382761AbiAXWjq (ORCPT ); Mon, 24 Jan 2022 17:39:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46F52C055A86; Mon, 24 Jan 2022 13:03:23 -0800 (PST) Received: from smtp.kernel.org (relay.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 D9154612E9; Mon, 24 Jan 2022 21:03:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6D81C340E5; Mon, 24 Jan 2022 21:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058202; bh=m3XBgkr5Z/eZ+k0EKJIVJa2TImDNP6ACO8ML6NlEFfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gl8ToutV+KciDEVy05OELQXOpXczPqncKGipM0z3OsLWJyswe8OVtYWVRtJj7UbW1 iOtgtkBslhbpxEdps0UTmfbALmYp4bsjcmILp3WxqnJkTfl6WRgxy43uCFqclpALko xxF1E/C97nGUZDpcefnBVuqaP8hDLDCPsXKMYQ2w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Gerber , Alexander Stein , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.16 0212/1039] thermal/drivers/imx8mm: Enable ADC when enabling monitor Date: Mon, 24 Jan 2022 19:33:21 +0100 Message-Id: <20220124184132.463403607@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Gerber [ Upstream commit 3de89d8842a2b5d3dd22ebf97dd561ae0a330948 ] The i.MX 8MP has a ADC_PD bit in the TMU_TER register that controls the operating mode of the ADC: * 0 means normal operating mode * 1 means power down mode When enabling/disabling the TMU, the ADC operating mode must be set accordingly. i.MX 8M Mini & Nano are lacking this bit. Signed-off-by: Paul Gerber Signed-off-by: Alexander Stein Fixes: 2b8f1f0337c5 ("thermal: imx8mm: Add i.MX8MP support") Link: https://lore.kernel.org/r/20211122114225.196280-1-alexander.stein@ew.= tq-group.com Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/thermal/imx8mm_thermal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_ther= mal.c index 7442e013738f8..af666bd9e8d4d 100644 --- a/drivers/thermal/imx8mm_thermal.c +++ b/drivers/thermal/imx8mm_thermal.c @@ -21,6 +21,7 @@ #define TPS 0x4 #define TRITSR 0x20 /* TMU immediate temp */ =20 +#define TER_ADC_PD BIT(30) #define TER_EN BIT(31) #define TRITSR_TEMP0_VAL_MASK 0xff #define TRITSR_TEMP1_VAL_MASK 0xff0000 @@ -113,6 +114,8 @@ static void imx8mm_tmu_enable(struct imx8mm_tmu *tmu, b= ool enable) =20 val =3D readl_relaxed(tmu->base + TER); val =3D enable ? (val | TER_EN) : (val & ~TER_EN); + if (tmu->socdata->version =3D=3D TMU_VER2) + val =3D enable ? (val & ~TER_ADC_PD) : (val | TER_ADC_PD); writel_relaxed(val, tmu->base + TER); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD865C4167E for ; Mon, 24 Jan 2022 23:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359562AbiAXXcw (ORCPT ); Mon, 24 Jan 2022 18:32:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353814AbiAXWjs (ORCPT ); Mon, 24 Jan 2022 17:39:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1F45C055A89; Mon, 24 Jan 2022 13:03:27 -0800 (PST) Received: from smtp.kernel.org (relay.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 A726DB80FA3; Mon, 24 Jan 2022 21:03:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C70C9C340E5; Mon, 24 Jan 2022 21:03:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058205; bh=FCtfFY34iZEwAr7Qu9zfh7qbShfAkumL+e4sa31RBqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PWNkcRAKYbjBtv1hch0EUCVCEF41O/GnF2p3DbHRUMdH9ofz+Qveyf+17pY/9rAoR 0lKiQE4U00MAOStlxXXMjEb6j7tvymLtoQdRy2c/jOC2gg9UoitSQAK7Syg4UYwkef 2rL8E+c0BtMqw+gmbMX4kyVdMFpMtaZH4VimxbsQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0213/1039] drm/amdgpu: Fix a NULL pointer dereference in amdgpu_connector_lcd_native_mode() Date: Mon, 24 Jan 2022 19:33:22 +0100 Message-Id: <20220124184132.500814873@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit b220110e4cd442156f36e1d9b4914bb9e87b0d00 ] In amdgpu_connector_lcd_native_mode(), the return value of drm_mode_duplicate() is assigned to mode, and there is a dereference of it in amdgpu_connector_lcd_native_mode(), which will lead to a NULL pointer dereference on failure of drm_mode_duplicate(). Fix this bug add a check of mode. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_DRM_AMDGPU=3Dm show no new warnings, and our static analyzer no longer warns about this code. Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)") Signed-off-by: Zhou Qingyang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/d= rm/amd/amdgpu/amdgpu_connectors.c index 0de66f59adb8a..df1f9b88a53f9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -387,6 +387,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *en= coder) native_mode->vdisplay !=3D 0 && native_mode->clock !=3D 0) { mode =3D drm_mode_duplicate(dev, native_mode); + if (!mode) + return NULL; + mode->type =3D DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; drm_mode_set_name(mode); =20 @@ -401,6 +404,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *en= coder) * simpler. */ mode =3D drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay,= 60, true, false, false); + if (!mode) + return NULL; + mode->type =3D DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; DRM_DEBUG_KMS("Adding cvt approximation of native panel mode %s\n", mode= ->name); } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47B4CC4167E for ; Tue, 25 Jan 2022 03:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314059AbiAYCuO (ORCPT ); Mon, 24 Jan 2022 21:50:14 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55790 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445469AbiAXVDi (ORCPT ); Mon, 24 Jan 2022 16:03:38 -0500 Received: from smtp.kernel.org (relay.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 B6B0361317; Mon, 24 Jan 2022 21:03:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C49B1C340E5; Mon, 24 Jan 2022 21:03:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058208; bh=EuZrEE6iroL4h8Fnk2WfPwJrm92ykgsXH1Ll7+avYoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WcbnC6L7M1HMFscF1q4e3gTGnEx5/glQZNvxb1VtcNPRdCYSZd/89Mh3zdM6C0TGJ 2lE/8NW5UcqYRew89uInsKbpvbmjRWyttPvG/3e3BLqg3JWuj9+fVJFXgPMAeEnKQU U8GR0xVXM8aAcMrAUZhzVGuIWB1SDP8xiz3yVXRE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Zhou Qingyang , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0214/1039] drm/radeon/radeon_kms: Fix a NULL pointer dereference in radeon_driver_open_kms() Date: Mon, 24 Jan 2022 19:33:23 +0100 Message-Id: <20220124184132.532128732@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Zhou Qingyang [ Upstream commit ab50cb9df8896b39aae65c537a30de2c79c19735 ] In radeon_driver_open_kms(), radeon_vm_bo_add() is assigned to vm->ib_bo_va and passes and used in radeon_vm_bo_set_addr(). In radeon_vm_bo_set_addr(), there is a dereference of vm->ib_bo_va, which could lead to a NULL pointer dereference on failure of radeon_vm_bo_add(). Fix this bug by adding a check of vm->ib_bo_va. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_DRM_RADEON=3Dm show no new warnings, and our static analyzer no longer warns about this code. Fixes: cc9e67e3d700 ("drm/radeon: fix VM IB handling") Reviewed-by: Christian K=C3=B6nig Signed-off-by: Zhou Qingyang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/radeon/radeon_kms.c | 36 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/r= adeon_kms.c index 482fb0ae6cb5d..66aee48fd09d2 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -648,6 +648,8 @@ void radeon_driver_lastclose_kms(struct drm_device *dev) int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_p= riv) { struct radeon_device *rdev =3D dev->dev_private; + struct radeon_fpriv *fpriv; + struct radeon_vm *vm; int r; =20 file_priv->driver_priv =3D NULL; @@ -660,8 +662,6 @@ int radeon_driver_open_kms(struct drm_device *dev, stru= ct drm_file *file_priv) =20 /* new gpu have virtual address space support */ if (rdev->family >=3D CHIP_CAYMAN) { - struct radeon_fpriv *fpriv; - struct radeon_vm *vm; =20 fpriv =3D kzalloc(sizeof(*fpriv), GFP_KERNEL); if (unlikely(!fpriv)) { @@ -672,35 +672,39 @@ int radeon_driver_open_kms(struct drm_device *dev, st= ruct drm_file *file_priv) if (rdev->accel_working) { vm =3D &fpriv->vm; r =3D radeon_vm_init(rdev, vm); - if (r) { - kfree(fpriv); - goto out_suspend; - } + if (r) + goto out_fpriv; =20 r =3D radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); - if (r) { - radeon_vm_fini(rdev, vm); - kfree(fpriv); - goto out_suspend; - } + if (r) + goto out_vm_fini; =20 /* map the ib pool buffer read only into * virtual address space */ vm->ib_bo_va =3D radeon_vm_bo_add(rdev, vm, rdev->ring_tmp_bo.bo); + if (!vm->ib_bo_va) { + r =3D -ENOMEM; + goto out_vm_fini; + } + r =3D radeon_vm_bo_set_addr(rdev, vm->ib_bo_va, RADEON_VA_IB_OFFSET, RADEON_VM_PAGE_READABLE | RADEON_VM_PAGE_SNOOPED); - if (r) { - radeon_vm_fini(rdev, vm); - kfree(fpriv); - goto out_suspend; - } + if (r) + goto out_vm_fini; } file_priv->driver_priv =3D fpriv; } =20 + if (!r) + goto out_suspend; + +out_vm_fini: + radeon_vm_fini(rdev, vm); +out_fpriv: + kfree(fpriv); out_suspend: pm_runtime_mark_last_busy(dev->dev); pm_runtime_put_autosuspend(dev->dev); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E0FCC433F5 for ; Mon, 24 Jan 2022 21:43:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457209AbiAXVlL (ORCPT ); Mon, 24 Jan 2022 16:41:11 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55816 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445470AbiAXVDi (ORCPT ); Mon, 24 Jan 2022 16:03:38 -0500 Received: from smtp.kernel.org (relay.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 B9A00612E9; Mon, 24 Jan 2022 21:03:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E62AC340E8; Mon, 24 Jan 2022 21:03:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058211; bh=O3Mm+E9WAl3ZojjyLaoVq+63RC1/Ltx/9eK75UIsuGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rqfL0qM2s8lvJAHeyrUShdDeuotW/8dr+AK/6a6KDmVP/vwJgnzYi95s7S0aCAWVK Tvt7AuF/k+41bKnXOzRSqw6XWRkExLglMnx30RAlyNaGmwQOcgQJtAInOitgV2PAb+ xY3eOjTMwWozBW4a8k1BAmrJvfFqN+msMqs4bNio= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexei Starovoitov , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.16 0215/1039] libbpf: Clean gen_loaders attach kind. Date: Mon, 24 Jan 2022 19:33:24 +0100 Message-Id: <20220124184132.566260527@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 19250f5fc0c283892a61f3abf9d65e6325f63897 ] The gen_loader has to clear attach_kind otherwise the programs without attach_btf_id will fail load if they follow programs with attach_btf_id. Fixes: 67234743736a ("libbpf: Generate loader program out of BPF ELF file.") Signed-off-by: Alexei Starovoitov Signed-off-by: Andrii Nakryiko Acked-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20211201181040.23337-12-alexei.starovoito= v@gmail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/gen_loader.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/gen_loader.c b/tools/lib/bpf/gen_loader.c index 5aad39e92a7a5..4ac65afc99e50 100644 --- a/tools/lib/bpf/gen_loader.c +++ b/tools/lib/bpf/gen_loader.c @@ -993,9 +993,11 @@ void bpf_gen__prog_load(struct bpf_gen *gen, debug_ret(gen, "prog_load %s insn_cnt %d", attr.prog_name, attr.insn_cnt); /* successful or not, close btf module FDs used in extern ksyms and attac= h_btf_obj_fd */ cleanup_relos(gen, insns); - if (gen->attach_kind) + if (gen->attach_kind) { emit_sys_close_blob(gen, attr_field(prog_load_attr, attach_btf_obj_fd)); + gen->attach_kind =3D 0; + } emit_check_err(gen); /* remember prog_fd in the stack, if successful */ emit(gen, BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_7, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CF07C4167D for ; Tue, 25 Jan 2022 03:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314087AbiAYCuS (ORCPT ); Mon, 24 Jan 2022 21:50:18 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55618 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445472AbiAXVDj (ORCPT ); Mon, 24 Jan 2022 16:03:39 -0500 Received: from smtp.kernel.org (relay.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 8B15CB80FA1; Mon, 24 Jan 2022 21:03:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8783C340E5; Mon, 24 Jan 2022 21:03:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058214; bh=e8+VAjX8qdBaRBg1pWk9PK9HVYFtA0VS7vIlBkabhfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KhfW+kHjdFpuF/zi0ADUttYl+LfXG6vr/FI3ojooYLL86Qo3NtSgaKfEUPZ92zkjv 26MwtuHTEMoJ4c8oNye4kHLC19gfrJixXQrV1VhyxR+domTUsGmSIl6dR5blAf8evx WU02XTgimqK0wlHSYlptsp6Ti6TLIhim2/9yD9vM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shinichiro Kawasaki , Ming Lei , Jens Axboe , Sasha Levin Subject: [PATCH 5.16 0216/1039] null_blk: allow zero poll queues Date: Mon, 24 Jan 2022 19:33:25 +0100 Message-Id: <20220124184132.601140815@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Lei [ Upstream commit 2bfdbe8b7ebd17b5331071071a910fbabc64b436 ] There isn't any reason to not allow zero poll queues from user viewpoint. Also sometimes we need to compare io poll between poll mode and irq mode, so not allowing poll queues is bad. Fixes: 15dfc662ef31 ("null_blk: Fix handling of submit_queues and poll_queu= es attributes") Cc: Shin'ichiro Kawasaki Signed-off-by: Ming Lei Link: https://lore.kernel.org/r/20211203023935.3424042-1-ming.lei@redhat.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/block/null_blk/main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 323af5c9c8026..fc1317060db54 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -340,9 +340,9 @@ static int nullb_update_nr_hw_queues(struct nullb_devic= e *dev, return 0; =20 /* - * Make sure at least one queue exists for each of submit and poll. + * Make sure at least one submit queue exists. */ - if (!submit_queues || !poll_queues) + if (!submit_queues) return -EINVAL; =20 /* @@ -1918,8 +1918,6 @@ static int null_validate_conf(struct nullb_device *de= v) =20 if (dev->poll_queues > g_poll_queues) dev->poll_queues =3D g_poll_queues; - else if (dev->poll_queues =3D=3D 0) - dev->poll_queues =3D 1; dev->prev_poll_queues =3D dev->poll_queues; =20 dev->queue_mode =3D min_t(unsigned int, dev->queue_mode, NULL_Q_MQ); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F871C4332F for ; Mon, 24 Jan 2022 21:43:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457241AbiAXVlP (ORCPT ); Mon, 24 Jan 2022 16:41:15 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55874 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445481AbiAXVDj (ORCPT ); Mon, 24 Jan 2022 16:03:39 -0500 Received: from smtp.kernel.org (relay.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 F37F36135E; Mon, 24 Jan 2022 21:03:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC0BFC340E5; Mon, 24 Jan 2022 21:03:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058217; bh=+GukFv+UmmsfgFRsXbDyesdwasvKERbn/wIBoWXygSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qJn3qcG2H4QbqJYIXyg12LovNdCqxZB1wk+Y7sDIeV8q2SQTYtd7AIobTSsmy7nlD +92qgXUkdPzQY9Lo9a0YoUk7Xh8g6aiAqzDMDHKb/xpSJ0EN+hIHGUW9QJfvGTovTK lEt8l6HyAoA8/cIIrnBl5p4E1jSpRcJFyBf8ZoAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gaurav Jain , =?UTF-8?q?Horia=20Geant=C4=83?= , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0217/1039] crypto: caam - save caam memory to support crypto engine retry mechanism. Date: Mon, 24 Jan 2022 19:33:26 +0100 Message-Id: <20220124184132.637954486@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Gaurav Jain [ Upstream commit 087e1d715bccf25dc0e83294576e416b0386ba20 ] When caam queue is full (-ENOSPC), caam frees descriptor memory. crypto-engine checks if retry support is true and h/w queue is full(-ENOSPC), then requeue the crypto request. During processing the requested descriptor again, caam gives below error. (caam_jr 30902000.jr: 40000006: DECO: desc idx 0: Invalid KEY Command). This patch adds a check to return when caam input ring is full and retry support is true. so descriptor memory is not freed and requeued request can be processed again. Fixes: 2d653936eb2cf ("crypto: caam - enable crypto-engine retry mechanism") Signed-off-by: Gaurav Jain Reviewed-by: Horia Geant=C4=83 Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/caam/caamalg.c | 6 ++++++ drivers/crypto/caam/caamhash.c | 3 +++ drivers/crypto/caam/caampkc.c | 3 +++ 3 files changed, 12 insertions(+) diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 8697ae53b0633..d3d8bb0a69900 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c @@ -1533,6 +1533,9 @@ static int aead_do_one_req(struct crypto_engine *engi= ne, void *areq) =20 ret =3D caam_jr_enqueue(ctx->jrdev, desc, aead_crypt_done, req); =20 + if (ret =3D=3D -ENOSPC && engine->retry_support) + return ret; + if (ret !=3D -EINPROGRESS) { aead_unmap(ctx->jrdev, rctx->edesc, req); kfree(rctx->edesc); @@ -1762,6 +1765,9 @@ static int skcipher_do_one_req(struct crypto_engine *= engine, void *areq) =20 ret =3D caam_jr_enqueue(ctx->jrdev, desc, skcipher_crypt_done, req); =20 + if (ret =3D=3D -ENOSPC && engine->retry_support) + return ret; + if (ret !=3D -EINPROGRESS) { skcipher_unmap(ctx->jrdev, rctx->edesc, req); kfree(rctx->edesc); diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index e8a6d8bc43b5d..36ef738e4a181 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -765,6 +765,9 @@ static int ahash_do_one_req(struct crypto_engine *engin= e, void *areq) =20 ret =3D caam_jr_enqueue(jrdev, desc, state->ahash_op_done, req); =20 + if (ret =3D=3D -ENOSPC && engine->retry_support) + return ret; + if (ret !=3D -EINPROGRESS) { ahash_unmap(jrdev, state->edesc, req, 0); kfree(state->edesc); diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.c index bf6275ffc4aad..8867275767101 100644 --- a/drivers/crypto/caam/caampkc.c +++ b/drivers/crypto/caam/caampkc.c @@ -380,6 +380,9 @@ static int akcipher_do_one_req(struct crypto_engine *en= gine, void *areq) =20 ret =3D caam_jr_enqueue(jrdev, desc, req_ctx->akcipher_op_done, req); =20 + if (ret =3D=3D -ENOSPC && engine->retry_support) + return ret; + if (ret !=3D -EINPROGRESS) { rsa_pub_unmap(jrdev, req_ctx->edesc, req); rsa_io_unmap(jrdev, req_ctx->edesc, req); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6C49C4321E for ; Mon, 24 Jan 2022 23:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359545AbiAXXcu (ORCPT ); Mon, 24 Jan 2022 18:32:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382818AbiAXWjs (ORCPT ); Mon, 24 Jan 2022 17:39:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D962C055A8C; Mon, 24 Jan 2022 13:03:41 -0800 (PST) Received: from smtp.kernel.org (relay.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 E24C4611C8; Mon, 24 Jan 2022 21:03:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6783C340E5; Mon, 24 Jan 2022 21:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058220; bh=Dm1rBUKIAFcXxvuutpMut0aM2fwHRehNyKyaSmdh4gk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jPZGN+QbNie/GxxdVxZaWaBRlIEYzW0Z0erW1cAS29Mj99XJXOBC/9cvZv80K7R9/ ul4CfSXLf38YzfYED++vNZUnsQ06c+1SpwrQ2icDm/RyxA8Zb9f3+NG26AzG6a05/o OlsY2Uk3z7vJjvIklIH8I+PhvcWVfcD0AS4ONULY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan , Nishanth Menon , Pratyush Yadav , Vignesh Raghavendra , Sasha Levin Subject: [PATCH 5.16 0218/1039] arm64: dts: ti: k3-am642: Fix the L2 cache sets Date: Mon, 24 Jan 2022 19:33:27 +0100 Message-Id: <20220124184132.668442862@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nishanth Menon [ Upstream commit a27a93bf70045be54b594fa8482959ffb84166d7 ] A53's L2 cache[1] on AM642[2] is 256KB. A53's L2 is fixed line length of 64 bytes and 16-way set-associative cache structure. 256KB of L2 / 64 (line length) =3D 4096 ways 4096 ways / 16 =3D 256 sets Fix the l2 cache-sets. [1] https://developer.arm.com/documentation/ddi0500/j/Level-2-Memory-System= /About-the-L2-memory-system?lang=3Den [2] https://www.ti.com/lit/pdf/spruim2 Fixes: 8abae9389bdb ("arm64: dts: ti: Add support for AM642 SoC") Reported-by: Peng Fan Signed-off-by: Nishanth Menon Reviewed-by: Pratyush Yadav Signed-off-by: Vignesh Raghavendra Link: https://lore.kernel.org/r/20211113043635.4296-1-nm@ti.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/ti/k3-am642.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/ti/k3-am642.dtsi b/arch/arm64/boot/dts/ti/= k3-am642.dtsi index e2b397c884018..8a76f4821b11b 100644 --- a/arch/arm64/boot/dts/ti/k3-am642.dtsi +++ b/arch/arm64/boot/dts/ti/k3-am642.dtsi @@ -60,6 +60,6 @@ cache-level =3D <2>; cache-size =3D <0x40000>; cache-line-size =3D <64>; - cache-sets =3D <512>; + cache-sets =3D <256>; }; }; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DE45C433FE for ; Mon, 24 Jan 2022 21:43:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457286AbiAXVlW (ORCPT ); Mon, 24 Jan 2022 16:41:22 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54560 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349038AbiAXVDq (ORCPT ); Mon, 24 Jan 2022 16:03:46 -0500 Received: from smtp.kernel.org (relay.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 BE630B80FA3; Mon, 24 Jan 2022 21:03:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBC72C340E5; Mon, 24 Jan 2022 21:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058223; bh=ADv0iZs0sl/IyTkiljN2Vy1lVQBg5V8EIXUeP+R8lTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qu8GIGKZytjBZtEBlqLmYN/tvgl2A0Qev16GrrXBo89CwM7yamIJM7ELBU7M4o12+ j6L8yzUiFMtSIakoNPuSHMPiYKb0eOsvNKIoN+7CJZgZhOTU16X3ZKiWniwK7P7geD T4Uxh1MsPAEa6EbAxl5hkqjaZPehEg1VMnmGWj4s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan , Nishanth Menon , Pratyush Yadav , Vignesh Raghavendra , Sasha Levin Subject: [PATCH 5.16 0219/1039] arm64: dts: ti: k3-j7200: Fix the L2 cache sets Date: Mon, 24 Jan 2022 19:33:28 +0100 Message-Id: <20220124184132.698679219@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nishanth Menon [ Upstream commit d0c826106f3fc11ff97285102b576b65576654ae ] A72's L2 cache[1] on J7200[2] is 1MB. A72's L2 is fixed line length of 64 bytes and 16-way set-associative cache structure. 1MB of L2 / 64 (line length) =3D 16384 ways 16384 ways / 16 =3D 1024 sets Fix the l2 cache-sets. [1] https://developer.arm.com/documentation/100095/0003/Level-2-Memory-Syst= em/About-the-L2-memory-system [2] https://www.ti.com/lit/pdf/spruiu1 Fixes: d361ed88455f ("arm64: dts: ti: Add support for J7200 SoC") Reported-by: Peng Fan Signed-off-by: Nishanth Menon Reviewed-by: Pratyush Yadav Signed-off-by: Vignesh Raghavendra Link: https://lore.kernel.org/r/20211113043638.4358-1-nm@ti.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/ti/k3-j7200.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/ti/k3-j7200.dtsi b/arch/arm64/boot/dts/ti/= k3-j7200.dtsi index 47567cb260c2b..a99a4d305b7ec 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j7200.dtsi @@ -86,7 +86,7 @@ cache-level =3D <2>; cache-size =3D <0x100000>; cache-line-size =3D <64>; - cache-sets =3D <2048>; + cache-sets =3D <1024>; next-level-cache =3D <&msmc_l3>; }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A3DBC4167D for ; Tue, 25 Jan 2022 03:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314121AbiAYCuV (ORCPT ); Mon, 24 Jan 2022 21:50:21 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56842 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359519AbiAXVDw (ORCPT ); Mon, 24 Jan 2022 16:03:52 -0500 Received: from smtp.kernel.org (relay.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 E3B21B81142; Mon, 24 Jan 2022 21:03:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12289C340E5; Mon, 24 Jan 2022 21:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058229; bh=EqTivTb+Cuvp/WUP4epMML8+2J7gXezxJBji8OHg3sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RrFOISy9YgjJT/2F64Z5tqFS8N5idDObW+4mv94KiJZTFS7LxHdHr4J8VNBgJ8tuR mA4HVWNsw0oErw+oxS+a/6RJdCRIrZLi+JvKKN7NuRzXWfM7npgvVCs7EqorhUUsBG RDKPI2L5Bt2yLqWS7n9lIevNCRFb/W+ASpmasoH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan , Nishanth Menon , Pratyush Yadav , Vignesh Raghavendra , Sasha Levin Subject: [PATCH 5.16 0220/1039] arm64: dts: ti: k3-j721e: Fix the L2 cache sets Date: Mon, 24 Jan 2022 19:33:29 +0100 Message-Id: <20220124184132.729936670@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nishanth Menon [ Upstream commit e9ba3a5bc6fdc2c796c69fdaf5ed6c9957cf9f9d ] A72's L2 cache[1] on J721e[2] is 1MB. A72's L2 is fixed line length of 64 bytes and 16-way set-associative cache structure. 1MB of L2 / 64 (line length) =3D 16384 ways 16384 ways / 16 =3D 1024 sets Fix the l2 cache-sets. [1] https://developer.arm.com/documentation/100095/0003/Level-2-Memory-Syst= em/About-the-L2-memory-system [2] http://www.ti.com/lit/pdf/spruil1 Fixes: 2d87061e70de ("arm64: dts: ti: Add Support for J721E SoC") Reported-by: Peng Fan Signed-off-by: Nishanth Menon Reviewed-by: Pratyush Yadav Signed-off-by: Vignesh Raghavendra Link: https://lore.kernel.org/r/20211113043639.4413-1-nm@ti.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/ti/k3-j721e.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/ti/k3-j721e.dtsi b/arch/arm64/boot/dts/ti/= k3-j721e.dtsi index a5967ba139d7e..4a3872fce5339 100644 --- a/arch/arm64/boot/dts/ti/k3-j721e.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j721e.dtsi @@ -88,7 +88,7 @@ cache-level =3D <2>; cache-size =3D <0x100000>; cache-line-size =3D <64>; - cache-sets =3D <2048>; + cache-sets =3D <1024>; next-level-cache =3D <&msmc_l3>; }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B0ECC4332F for ; Mon, 24 Jan 2022 21:44:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457304AbiAXVl1 (ORCPT ); Mon, 24 Jan 2022 16:41:27 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56860 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359775AbiAXVDz (ORCPT ); Mon, 24 Jan 2022 16:03:55 -0500 Received: from smtp.kernel.org (relay.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 037DCB8121C; Mon, 24 Jan 2022 21:03:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 078DAC340E5; Mon, 24 Jan 2022 21:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058232; bh=VKX05wfh6KhMj0LJnraims849/IJbL0sepFPZ7AWILw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hnFhl39v3Wx9Uo/TM9zcXZiiyG7R1roaw8hH6kMuMDqDnxEwVbCLMePeLsVLyZbkj 2KZQPKtbCDoXdrTT2Y/Jt11mPM8m9Wx0sWnmvE/YKSf7QDuh6dv+yGp//1hSTvNyXJ 8hKxg5RSmzMvwV2ilnPlGcAgJZeGw3qKoN5fe+Ng= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan , Nishanth Menon , Pratyush Yadav , Kishon Vijay Abraham I , Vignesh Raghavendra , Sasha Levin Subject: [PATCH 5.16 0221/1039] arm64: dts: ti: k3-j7200: Correct the d-cache-sets info Date: Mon, 24 Jan 2022 19:33:30 +0100 Message-Id: <20220124184132.769976712@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nishanth Menon [ Upstream commit a172c86931709d6663318609d71a811333bdf4b0 ] A72 Cluster (chapter 1.3.1 [1]) has 48KB Icache, 32KB Dcache and 1MB L2 Cac= he - ICache is 3-way set-associative - Dcache is 2-way set-associative - Line size are 64bytes 32KB (Dcache)/64 (fixed line length of 64 bytes) =3D 512 ways 512 ways / 2 (Dcache is 2-way per set) =3D 256 sets. So, correct the d-cache-sets info. [1] https://www.ti.com/lit/pdf/spruiu1 Fixes: d361ed88455f ("arm64: dts: ti: Add support for J7200 SoC") Reported-by: Peng Fan Signed-off-by: Nishanth Menon Reviewed-by: Pratyush Yadav Reviewed-by: Kishon Vijay Abraham I Signed-off-by: Vignesh Raghavendra Link: https://lore.kernel.org/r/20211113042640.30955-1-nm@ti.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/ti/k3-j7200.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/ti/k3-j7200.dtsi b/arch/arm64/boot/dts/ti/= k3-j7200.dtsi index a99a4d305b7ec..64fef4e67d76a 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j7200.dtsi @@ -62,7 +62,7 @@ i-cache-sets =3D <256>; d-cache-size =3D <0x8000>; d-cache-line-size =3D <64>; - d-cache-sets =3D <128>; + d-cache-sets =3D <256>; next-level-cache =3D <&L2_0>; }; =20 @@ -76,7 +76,7 @@ i-cache-sets =3D <256>; d-cache-size =3D <0x8000>; d-cache-line-size =3D <64>; - d-cache-sets =3D <128>; + d-cache-sets =3D <256>; next-level-cache =3D <&L2_0>; }; }; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FEB9C41535 for ; Tue, 25 Jan 2022 03:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314156AbiAYCu1 (ORCPT ); Mon, 24 Jan 2022 21:50:27 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56130 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359845AbiAXVD5 (ORCPT ); Mon, 24 Jan 2022 16:03:57 -0500 Received: from smtp.kernel.org (relay.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 624A360C60; Mon, 24 Jan 2022 21:03:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 354C1C340E5; Mon, 24 Jan 2022 21:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058235; bh=qF5cqyLXEb7XeIqNI1WiMhwHeeKlGMU/eczpl4CHnJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LZX69Zoxc39SPVFoY6iCc1BfqNZGAxzceb1fwIGrUNDlfTZt1pN84ue2KKJ4m1UjC F+xFL0iU+onWSyYF5SDR6srTG/oEvovnmXsUyKHySIJmedKyvVsneES+o01IKRew2V 4vX56oH0RQWpypHxoZMo4RgsWo2CqyxOWMg80lUg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lizhi Hou , Sasha Levin Subject: [PATCH 5.16 0222/1039] tty: serial: uartlite: allow 64 bit address Date: Mon, 24 Jan 2022 19:33:31 +0100 Message-Id: <20220124184132.801043344@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lizhi Hou [ Upstream commit 3672fb65155530b5eea6225685c75329b6debec3 ] The base address of uartlite registers could be 64 bit address which is from device resource. When ulite_probe() calls ulite_assign(), this 64 bit address is casted to 32-bit. The fix is to replace "u32" type with "phys_addr_t" type for the base address in ulite_assign() argument list. Fixes: 8fa7b6100693 ("[POWERPC] Uartlite: Separate the bus binding from the= driver proper") Signed-off-by: Lizhi Hou Link: https://lore.kernel.org/r/20211129202302.1319033-1-lizhi.hou@xilinx.c= om Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/uartlite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index d3d9566e5dbdf..e1fa52d31474f 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -626,7 +626,7 @@ static struct uart_driver ulite_uart_driver =3D { * * Returns: 0 on success, <0 otherwise */ -static int ulite_assign(struct device *dev, int id, u32 base, int irq, +static int ulite_assign(struct device *dev, int id, phys_addr_t base, int = irq, struct uartlite_data *pdata) { struct uart_port *port; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7075C4167B for ; Mon, 24 Jan 2022 23:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359523AbiAXXcq (ORCPT ); Mon, 24 Jan 2022 18:32:46 -0500 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 S1382851AbiAXWju (ORCPT ); Mon, 24 Jan 2022 17:39:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5785BC04D611; Mon, 24 Jan 2022 13:04:01 -0800 (PST) Received: from smtp.kernel.org (relay.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 1215CB81188; Mon, 24 Jan 2022 21:04:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 369C6C340E5; Mon, 24 Jan 2022 21:03:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058238; bh=hrXnK3lSnVgSWEh61IIYjmLnsYStkmB0E0ezQOBT4ts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aHyZVB8QZ5UGCx7zdMPIUzm7mj9xhTjNwRFr3OqBxIIgox1wddEnHn5FLMcST6tD5 ziB0QCAvQDo1m3vwaCRCROIe9ko+zXo/2eO/7OPEH9CCuMDbogQK1E8gksBAwqcek/ tGVipNNosFoafNBmVwxXYctfUu0CbqB92giyNt5M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lino Sanfilippo , Sasha Levin Subject: [PATCH 5.16 0223/1039] serial: amba-pl011: do not request memory region twice Date: Mon, 24 Jan 2022 19:33:32 +0100 Message-Id: <20220124184132.831001304@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Lino Sanfilippo [ Upstream commit d1180405c7b5c7a1c6bde79d5fc24fe931430737 ] With commit 3873e2d7f63a ("drivers: PL011: refactor pl011_probe()") the function devm_ioremap() called from pl011_setup_port() was replaced with devm_ioremap_resource(). Since this function not only remaps but also requests the ports io memory region it now collides with the .config_port() callback which requests the same region at uart port registration. Since devm_ioremap_resource() already claims the memory successfully, the request in .config_port() fails. Later at uart port deregistration the attempt to release the unclaimed memory also fails. The failure results in a =E2=80=9CTrying to free nonexis= tent resource" warning. Fix these issues by removing the callbacks that implement the redundant memory allocation/release. Also make sure that changing the drivers io memory base address via TIOCSSERIAL is not allowed any more. Fixes: 3873e2d7f63a ("drivers: PL011: refactor pl011_probe()") Signed-off-by: Lino Sanfilippo Link: https://lore.kernel.org/r/20211129174238.8333-1-LinoSanfilippo@gmx.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/amba-pl011.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl01= 1.c index 52518a606c06a..b831d4d64c0a2 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2183,32 +2183,13 @@ static const char *pl011_type(struct uart_port *por= t) return uap->port.type =3D=3D PORT_AMBA ? uap->type : NULL; } =20 -/* - * Release the memory region(s) being used by 'port' - */ -static void pl011_release_port(struct uart_port *port) -{ - release_mem_region(port->mapbase, SZ_4K); -} - -/* - * Request the memory region(s) being used by 'port' - */ -static int pl011_request_port(struct uart_port *port) -{ - return request_mem_region(port->mapbase, SZ_4K, "uart-pl011") - !=3D NULL ? 0 : -EBUSY; -} - /* * Configure/autoconfigure the port. */ static void pl011_config_port(struct uart_port *port, int flags) { - if (flags & UART_CONFIG_TYPE) { + if (flags & UART_CONFIG_TYPE) port->type =3D PORT_AMBA; - pl011_request_port(port); - } } =20 /* @@ -2223,6 +2204,8 @@ static int pl011_verify_port(struct uart_port *port, = struct serial_struct *ser) ret =3D -EINVAL; if (ser->baud_base < 9600) ret =3D -EINVAL; + if (port->mapbase !=3D (unsigned long) ser->iomem_base) + ret =3D -EINVAL; return ret; } =20 @@ -2275,8 +2258,6 @@ static const struct uart_ops amba_pl011_pops =3D { .flush_buffer =3D pl011_dma_flush_buffer, .set_termios =3D pl011_set_termios, .type =3D pl011_type, - .release_port =3D pl011_release_port, - .request_port =3D pl011_request_port, .config_port =3D pl011_config_port, .verify_port =3D pl011_verify_port, #ifdef CONFIG_CONSOLE_POLL @@ -2306,8 +2287,6 @@ static const struct uart_ops sbsa_uart_pops =3D { .shutdown =3D sbsa_uart_shutdown, .set_termios =3D sbsa_uart_set_termios, .type =3D pl011_type, - .release_port =3D pl011_release_port, - .request_port =3D pl011_request_port, .config_port =3D pl011_config_port, .verify_port =3D pl011_verify_port, #ifdef CONFIG_CONSOLE_POLL --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61686C433F5 for ; Mon, 24 Jan 2022 21:44:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457330AbiAXVla (ORCPT ); Mon, 24 Jan 2022 16:41:30 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56946 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445538AbiAXVEE (ORCPT ); Mon, 24 Jan 2022 16:04:04 -0500 Received: from smtp.kernel.org (relay.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 315EFB81188; Mon, 24 Jan 2022 21:04:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47D7BC340E5; Mon, 24 Jan 2022 21:04:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058241; bh=ory3SVYeIybujCMEfusN/VnvpGC5oI84n45u5L7CtDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bSWDneQCLNIgrd4NGaBoFqvSRHaW+HprUszwCa5b6UOvbl93etNjsvHdTDoSR5wig k0e0SHNITXu9l12XkqY5ZnHwJgoyyuyurL/5F1T3CAjnzESY02xbJv32GSXQ3xAiUa 1vCq6tLAxQS6RFkVWg0IDgPlCsupYj6Cnn2NoHAU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Miquel Raynal , Sasha Levin Subject: [PATCH 5.16 0224/1039] mtd: core: provide unique name for nvmem device Date: Mon, 24 Jan 2022 19:33:33 +0100 Message-Id: <20220124184132.862206603@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Walle [ Upstream commit c048b60d39e109c201d31ed5ad3a4f939064d6c4 ] If there is more than one mtd device which supports OTP, there will be a kernel warning about duplicated sysfs entries and the probing will fail. This is because the nvmem device name is not unique. Make it unique by prepending the name of the mtd. E.g. before the name was "user-otp", now it will be "mtd0-user-otp". For reference the kernel splash is: [ 4.665531] sysfs: cannot create duplicate filename '/bus/nvmem/devices/= user-otp' [ 4.673056] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.0-next-202111= 01+ #1296 [ 4.680565] Hardware name: Kontron SMARC-sAL28 (Single PHY) on SMARC Eva= l 2.0 carrier (DT) [ 4.688856] Call trace: [ 4.691303] dump_backtrace+0x0/0x1bc [ 4.694984] show_stack+0x24/0x30 [ 4.698306] dump_stack_lvl+0x68/0x84 [ 4.701980] dump_stack+0x18/0x34 [ 4.705302] sysfs_warn_dup+0x70/0x90 [ 4.708973] sysfs_do_create_link_sd+0x144/0x150 [ 4.713603] sysfs_create_link+0x2c/0x50 [ 4.717535] bus_add_device+0x74/0x120 [ 4.721293] device_add+0x330/0x890 [ 4.724791] device_register+0x2c/0x40 [ 4.728550] nvmem_register+0x240/0x9f0 [ 4.732398] mtd_otp_nvmem_register+0xb0/0x10c [ 4.736854] mtd_device_parse_register+0x28c/0x2b4 [ 4.741659] spi_nor_probe+0x20c/0x2e0 [ 4.745418] spi_mem_probe+0x78/0xbc [ 4.749001] spi_probe+0x90/0xf0 [ 4.752237] really_probe.part.0+0xa4/0x320 .. [ 4.873936] mtd mtd1: Failed to register OTP NVMEM device [ 4.894468] spi-nor: probe of spi0.0 failed with error -17 Fixes: 4b361cfa8624 ("mtd: core: add OTP nvmem provider support") Signed-off-by: Michael Walle Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211104134843.2642800-1-michael@wa= lle.cc Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/mtdcore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 9186268d361b4..fc0bed14bfb10 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -825,8 +825,7 @@ static struct nvmem_device *mtd_otp_nvmem_register(stru= ct mtd_info *mtd, =20 /* OTP nvmem will be registered on the physical device */ config.dev =3D mtd->dev.parent; - /* just reuse the compatible as name */ - config.name =3D compatible; + config.name =3D kasprintf(GFP_KERNEL, "%s-%s", dev_name(&mtd->dev), compa= tible); config.id =3D NVMEM_DEVID_NONE; config.owner =3D THIS_MODULE; config.type =3D NVMEM_TYPE_OTP; @@ -842,6 +841,7 @@ static struct nvmem_device *mtd_otp_nvmem_register(stru= ct mtd_info *mtd, nvmem =3D NULL; =20 of_node_put(np); + kfree(config.name); =20 return nvmem; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EDD7C2BA4C for ; Tue, 25 Jan 2022 03:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314273AbiAYCuj (ORCPT ); Mon, 24 Jan 2022 21:50:39 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56964 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445552AbiAXVEI (ORCPT ); Mon, 24 Jan 2022 16:04:08 -0500 Received: from smtp.kernel.org (relay.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 513A1B81243; Mon, 24 Jan 2022 21:04:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74E73C340E8; Mon, 24 Jan 2022 21:04:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058245; bh=m7RRE022Wc5gZPWYmXs4z6p4oQ3nEjAxUbiCzT3e58w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=djqVHgqkL5XuI95fPuMdbge2VlpkmtBHVp5d4gAtAbCh7Hl0rSAXYy1znEzh/l60L j9ege123Y4AMo/W01OGtOZmm8zXr5L3eV/dXa+puUaZhUUXk0WZOproR0W6uQ1kTOb OMlLccFSEOuJPgSjvoRpaKUHO3t0St7ELaOZWskY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tasos Sahanidis , Denis Efremov , Jens Axboe , Sasha Levin Subject: [PATCH 5.16 0225/1039] floppy: Fix hang in watchdog when disk is ejected Date: Mon, 24 Jan 2022 19:33:34 +0100 Message-Id: <20220124184132.892327683@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tasos Sahanidis [ Upstream commit fb48febce7e30baed94dd791e19521abd2c3fd83 ] When the watchdog detects a disk change, it calls cancel_activity(), which in turn tries to cancel the fd_timer delayed work. In the above scenario, fd_timer_fn is set to fd_watchdog(), meaning it is trying to cancel its own work. This results in a hang as cancel_delayed_work_sync() is waiting for the watchdog (itself) to return, which never happens. This can be reproduced relatively consistently by attempting to read a broken floppy, and ejecting it while IO is being attempted and retried. To resolve this, this patch calls cancel_delayed_work() instead, which cancels the work without waiting for the watchdog to return and finish. Before this regression was introduced, the code in this section used del_timer(), and not del_timer_sync() to delete the watchdog timer. Link: https://lore.kernel.org/r/399e486c-6540-db27-76aa-7a271b061f76@tasoss= ah.com Fixes: 070ad7e793dc ("floppy: convert to delayed work and single-thread wq") Signed-off-by: Tasos Sahanidis Signed-off-by: Denis Efremov Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/block/floppy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index c4267da716fe6..02ba1db5b8046 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -1015,7 +1015,7 @@ static DECLARE_DELAYED_WORK(fd_timer, fd_timer_workfn= ); static void cancel_activity(void) { do_floppy =3D NULL; - cancel_delayed_work_sync(&fd_timer); + cancel_delayed_work(&fd_timer); cancel_work_sync(&floppy_work); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9040C43217 for ; Tue, 25 Jan 2022 03:00:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315041AbiAYCwV (ORCPT ); Mon, 24 Jan 2022 21:52:21 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58614 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376965AbiAXVGR (ORCPT ); Mon, 24 Jan 2022 16:06:17 -0500 Received: from smtp.kernel.org (relay.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 3ACD4B8121C; Mon, 24 Jan 2022 21:06:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60E9BC340E7; Mon, 24 Jan 2022 21:06:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058374; bh=qIu40SqUO5KD28fEgzEEHatZGMorjGgeu74zFz8rpis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jOukcjk6Qtd9KmgQOCdUYenvjx4wrtwOZIeKM82+tlW5hPSZhc7n1o9vJq0hfaadT IptbsggcpYOtJRVd6JpxSymkkbsQVZkOwtXSRrdYkQ2K3uHP0bteAz+Jr+GXVZDb8m YtJF8VDCpFaD1Xf1U1NfQ+35cEyEltZ5PItKB+PM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Pavel Skripkin , Yang Yingliang , Sasha Levin Subject: [PATCH 5.16 0226/1039] staging: rtl8192e: return error code from rtllib_softmac_init() Date: Mon, 24 Jan 2022 19:33:35 +0100 Message-Id: <20220124184132.928520449@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit 68bf78ff59a0891eb1239948e94ce10f73a9dd30 ] If it fails to allocate 'dot11d_info', rtllib_softmac_init() should return error code. And remove unneccessary error message. Fixes: 94a799425eee ("From: wlanfae ") Reviewed-by: Dan Carpenter Reviewed-by: Pavel Skripkin Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20211202030704.2425621-2-yangyingliang@huaw= ei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/rtl8192e/rtllib.h | 2 +- drivers/staging/rtl8192e/rtllib_softmac.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/r= tllib.h index c6f8b772335c1..c985e4ebc545a 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1980,7 +1980,7 @@ void SendDisassociation(struct rtllib_device *ieee, b= ool deauth, u16 asRsn); void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *iee= e); =20 void rtllib_start_ibss(struct rtllib_device *ieee); -void rtllib_softmac_init(struct rtllib_device *ieee); +int rtllib_softmac_init(struct rtllib_device *ieee); void rtllib_softmac_free(struct rtllib_device *ieee); void rtllib_disassociate(struct rtllib_device *ieee); void rtllib_stop_scan(struct rtllib_device *ieee); diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rt= l8192e/rtllib_softmac.c index d2726d01c7573..503d33be71d99 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2952,7 +2952,7 @@ void rtllib_start_protocol(struct rtllib_device *ieee) } } =20 -void rtllib_softmac_init(struct rtllib_device *ieee) +int rtllib_softmac_init(struct rtllib_device *ieee) { int i; =20 @@ -2963,7 +2963,8 @@ void rtllib_softmac_init(struct rtllib_device *ieee) ieee->seq_ctrl[i] =3D 0; ieee->dot11d_info =3D kzalloc(sizeof(struct rt_dot11d_info), GFP_ATOMIC); if (!ieee->dot11d_info) - netdev_err(ieee->dev, "Can't alloc memory for DOT11D\n"); + return -ENOMEM; + ieee->LinkDetectInfo.SlotIndex =3D 0; ieee->LinkDetectInfo.SlotNum =3D 2; ieee->LinkDetectInfo.NumRecvBcnInPeriod =3D 0; @@ -3029,6 +3030,7 @@ void rtllib_softmac_init(struct rtllib_device *ieee) =20 tasklet_setup(&ieee->ps_task, rtllib_sta_ps); =20 + return 0; } =20 void rtllib_softmac_free(struct rtllib_device *ieee) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCB78C433EF for ; Mon, 24 Jan 2022 21:44:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457478AbiAXVlm (ORCPT ); Mon, 24 Jan 2022 16:41:42 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54970 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442438AbiAXVEe (ORCPT ); Mon, 24 Jan 2022 16:04:34 -0500 Received: from smtp.kernel.org (relay.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 DA294611C8; Mon, 24 Jan 2022 21:04:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B649CC340E5; Mon, 24 Jan 2022 21:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058269; bh=TVOUWNBzfDhAxoXUMjAv2R95FzmE2kWLWGzml5e+0xM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rkA0pBWpT8cSAQV4qRVyi5Q42etiWy1+2ZDb0hnlzU77ERghJyVklM3reDsphF32o DqXOxkjadu1MH0tXj21MqYleAw5NOigWP+iEzURw8tD5mh35BJ/YL3F5KOZSih2m6P eWNlASbiyi5OxyjgeQ1McqSoyOzqzAmJYfybkHls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Pavel Skripkin , Yang Yingliang , Sasha Levin Subject: [PATCH 5.16 0227/1039] staging: rtl8192e: rtllib_module: fix error handle case in alloc_rtllib() Date: Mon, 24 Jan 2022 19:33:36 +0100 Message-Id: <20220124184132.960193685@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit e730cd57ac2dfe94bca0f14a3be8e1b21de41a9c ] Some variables are leaked in the error handling in alloc_rtllib(), free the variables in the error path. Fixes: 94a799425eee ("From: wlanfae ") Reviewed-by: Dan Carpenter Reviewed-by: Pavel Skripkin Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20211202030704.2425621-3-yangyingliang@huaw= ei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/rtl8192e/rtllib_module.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl= 8192e/rtllib_module.c index 64d9feee1f392..f00ac94b2639b 100644 --- a/drivers/staging/rtl8192e/rtllib_module.c +++ b/drivers/staging/rtl8192e/rtllib_module.c @@ -88,7 +88,7 @@ struct net_device *alloc_rtllib(int sizeof_priv) err =3D rtllib_networks_allocate(ieee); if (err) { pr_err("Unable to allocate beacon storage: %d\n", err); - goto failed; + goto free_netdev; } rtllib_networks_initialize(ieee); =20 @@ -121,11 +121,13 @@ struct net_device *alloc_rtllib(int sizeof_priv) ieee->hwsec_active =3D 0; =20 memset(ieee->swcamtable, 0, sizeof(struct sw_cam_table) * 32); - rtllib_softmac_init(ieee); + err =3D rtllib_softmac_init(ieee); + if (err) + goto free_crypt_info; =20 ieee->pHTInfo =3D kzalloc(sizeof(struct rt_hi_throughput), GFP_KERNEL); if (!ieee->pHTInfo) - return NULL; + goto free_softmac; =20 HTUpdateDefaultSetting(ieee); HTInitializeHTInfo(ieee); @@ -141,8 +143,14 @@ struct net_device *alloc_rtllib(int sizeof_priv) =20 return dev; =20 - failed: +free_softmac: + rtllib_softmac_free(ieee); +free_crypt_info: + lib80211_crypt_info_free(&ieee->crypt_info); + rtllib_networks_free(ieee); +free_netdev: free_netdev(dev); + return NULL; } EXPORT_SYMBOL(alloc_rtllib); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24C67C433F5 for ; Mon, 24 Jan 2022 23:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347134AbiAXXdH (ORCPT ); Mon, 24 Jan 2022 18:33:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355089AbiAXWlr (ORCPT ); Mon, 24 Jan 2022 17:41:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B3E0C047CF7; Mon, 24 Jan 2022 13:05:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 59A9FB81057; Mon, 24 Jan 2022 21:05:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 830DFC340E7; Mon, 24 Jan 2022 21:05:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058303; bh=wstrC+IV/cNIbO9MQU9ClBIKDF2ZwJOJuBP3G7iJnG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=saDtUQuoghDWsTbRFFVEwqdq96llmyWwmvFSCouBEEsMXHQa7On9WdDz/eHO3c6sL aGINcA8fuSLsJMm4tWct1K9mWuGuig7/XowIgqprYa5Xv6rB+ABDt8jUmhTEICzYTU F69cYJAMOnmnW/wBii+YTClDOweCGv5aYH+mhIFw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark-yw Chen , Sean Wang , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0228/1039] Bluetooth: btmtksdio: fix resume failure Date: Mon, 24 Jan 2022 19:33:37 +0100 Message-Id: <20220124184132.990201935@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wang [ Upstream commit 561ae1d46a8ddcbc13162d5771f5ed6c8249e730 ] btmtksdio have to rely on MMC_PM_KEEP_POWER in pm_flags to avoid that SDIO power is being shut off during the device is in suspend. That fixes the SDIO command fails to access the bus after the device is resumed. Fixes: 7f3c563c575e7 ("Bluetooth: btmtksdio: Add runtime PM support to SDIO= based Bluetooth") Co-developed-by: Mark-yw Chen Signed-off-by: Mark-yw Chen Signed-off-by: Sean Wang Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bluetooth/btmtksdio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c index 9872ef18f9fea..1cbdeca1fdc4a 100644 --- a/drivers/bluetooth/btmtksdio.c +++ b/drivers/bluetooth/btmtksdio.c @@ -1042,6 +1042,8 @@ static int btmtksdio_runtime_suspend(struct device *d= ev) if (!bdev) return 0; =20 + sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); + sdio_claim_host(bdev->func); =20 sdio_writel(bdev->func, C_FW_OWN_REQ_SET, MTK_REG_CHLPCR, &err); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59C33C2BA4C for ; Mon, 24 Jan 2022 21:44:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457696AbiAXVmI (ORCPT ); Mon, 24 Jan 2022 16:42:08 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58236 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345753AbiAXVFi (ORCPT ); Mon, 24 Jan 2022 16:05:38 -0500 Received: from smtp.kernel.org (relay.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 8E1266142D; Mon, 24 Jan 2022 21:05:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A09BC340E7; Mon, 24 Jan 2022 21:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058337; bh=UtU7G7sf0qIUQyYthE+wOEX/xdNpDLbYnazF0AhRFoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aAFgAzB3iEo8FQABNMQgUvsqWa6htWHOxpJKbl1dq+1KgVPnHHXCdda4BBhhtyTSe oM0lvStNIDAG5Q1YVA0mfddDEwAQqXkigT9hAaSAuMlw37tJAss03SKXqOZINuweXL V+D1WTmpBClM64cY5M+sHRoag+GpPUT02noS5ePg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.16 0229/1039] bpf: Fix the test_task_vma selftest to support output shorter than 1 kB Date: Mon, 24 Jan 2022 19:33:38 +0100 Message-Id: <20220124184133.023119129@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Mikityanskiy [ Upstream commit da54ab14953c38d98cb3e34c564c06c3739394b2 ] The test for bpf_iter_task_vma assumes that the output will be longer than 1 kB, as the comment above the loop says. Due to this assumption, the loop becomes infinite if the output turns to be shorter than 1 kB. The return value of read_fd_into_buffer is 0 when the end of file was reached, and len isn't being increased any more. This commit adds a break on EOF to handle short output correctly. For the reference, this is the contents that I get when running test_progs under vmtest.sh, and it's shorter than 1 kB: 00400000-00401000 r--p 00000000 fe:00 25867 /root/bpf/test_progs 00401000-00674000 r-xp 00001000 fe:00 25867 /root/bpf/test_progs 00674000-0095f000 r--p 00274000 fe:00 25867 /root/bpf/test_progs 0095f000-00983000 r--p 0055e000 fe:00 25867 /root/bpf/test_progs 00983000-00a8a000 rw-p 00582000 fe:00 25867 /root/bpf/test_progs 00a8a000-0484e000 rw-p 00000000 00:00 0 7f6c64000000-7f6c64021000 rw-p 00000000 00:00 0 7f6c64021000-7f6c68000000 ---p 00000000 00:00 0 7f6c6ac8f000-7f6c6ac90000 r--s 00000000 00:0d 8032 anon_inode:bpf-map 7f6c6ac90000-7f6c6ac91000 ---p 00000000 00:00 0 7f6c6ac91000-7f6c6b491000 rw-p 00000000 00:00 0 7f6c6b491000-7f6c6b492000 r--s 00000000 00:0d 8032 anon_inode:bpf-map 7f6c6b492000-7f6c6b493000 rw-s 00000000 00:0d 8032 anon_inode:bpf-map 7ffc1e23d000-7ffc1e25e000 rw-p 00000000 00:00 0 7ffc1e3b8000-7ffc1e3bc000 r--p 00000000 00:00 0 7ffc1e3bc000-7ffc1e3bd000 r-xp 00000000 00:00 0 7fffffffe000-7ffffffff000 --xp 00000000 00:00 0 Fixes: e8168840e16c ("selftests/bpf: Add test for bpf_iter_task_vma") Signed-off-by: Maxim Mikityanskiy Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20211130181811.594220-1-maximmi@nvidia.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c b/tools/test= ing/selftests/bpf/prog_tests/bpf_iter.c index 9454331aaf85f..ea6823215e9c0 100644 --- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c +++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c @@ -1206,13 +1206,14 @@ static void test_task_vma(void) goto out; =20 /* Read CMP_BUFFER_SIZE (1kB) from bpf_iter. Read in small chunks - * to trigger seq_file corner cases. The expected output is much - * longer than 1kB, so the while loop will terminate. + * to trigger seq_file corner cases. */ len =3D 0; while (len < CMP_BUFFER_SIZE) { err =3D read_fd_into_buffer(iter_fd, task_vma_output + len, min(read_size, CMP_BUFFER_SIZE - len)); + if (!err) + break; if (CHECK(err < 0, "read_iter_fd", "read_iter_fd failed\n")) goto out; len +=3D err; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D8B6C43219 for ; Mon, 24 Jan 2022 23:58:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367119AbiAXXyM (ORCPT ); Mon, 24 Jan 2022 18:54:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837907AbiAXWpe (ORCPT ); Mon, 24 Jan 2022 17:45:34 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B248C0550CC; Mon, 24 Jan 2022 13:05:56 -0800 (PST) Received: from smtp.kernel.org (relay.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 DC1196142E; Mon, 24 Jan 2022 21:05:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC90EC340E5; Mon, 24 Jan 2022 21:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058355; bh=bRSguhJPl84harqENFcTRVmow9GIgHPy1csFS3mmJgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GPDib1kgn+XJ4rW5nCXjJl/UMc3HpysAQX6W7sRGXJyYZsEKq3dpRE5pqCXEMbqZ6 i9lbS0uwXA2lhH/ihvZLP4wppRFA4bom0ZGqXsfJBTpbk6ACMJNzDzRGYapdRGu3/G YneZH12yIp5T0N2xnNxhptydTjaVNZnTfIagzfVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Donnefort , "Peter Zijlstra (Intel)" , Vincent Guittot , Valentin Schneider , Sasha Levin Subject: [PATCH 5.16 0230/1039] sched/fair: Fix detection of per-CPU kthreads waking a task Date: Mon, 24 Jan 2022 19:33:39 +0100 Message-Id: <20220124184133.054095952@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Donnefort [ Upstream commit 8b4e74ccb582797f6f0b0a50372ebd9fd2372a27 ] select_idle_sibling() has a special case for tasks woken up by a per-CPU kthread, where the selected CPU is the previous one. However, the current condition for this exit path is incomplete. A task can wake up from an interrupt context (e.g. hrtimer), while a per-CPU kthread is running. A such scenario would spuriously trigger the special case described above. Also, a recent change made the idle task like a regular per-CPU kthread, hence making that situation more likely to happen (is_per_cpu_kthread(swapper) being true now). Checking for task context makes sure select_idle_sibling() will not interpret a wake up from any other context as a wake up by a per-CPU kthread. Fixes: 52262ee567ad ("sched/fair: Allow a per-CPU kthread waking a task to = stack on the same CPU, to fix XFS performance regression") Signed-off-by: Vincent Donnefort Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Vincent Guittot Reviewed-by: Valentin Schneider Link: https://lore.kernel.org/r/20211201143450.479472-1-vincent.donnefort@a= rm.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/sched/fair.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6e476f6d94351..97d89516fbea2 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6398,6 +6398,7 @@ static int select_idle_sibling(struct task_struct *p,= int prev, int target) * pattern is IO completions. */ if (is_per_cpu_kthread(current) && + in_task() && prev =3D=3D smp_processor_id() && this_rq()->nr_running <=3D 1) { return prev; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E1C2C43219 for ; Tue, 25 Jan 2022 03:00:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314997AbiAYCwN (ORCPT ); Mon, 24 Jan 2022 21:52:13 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56130 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446008AbiAXVGA (ORCPT ); Mon, 24 Jan 2022 16:06:00 -0500 Received: from smtp.kernel.org (relay.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 15B2860C60; Mon, 24 Jan 2022 21:05:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07DADC340E7; Mon, 24 Jan 2022 21:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058358; bh=/DgqTbH+xxPRtgjYWV9bVu1oAOUCw0uXfaKZbOLN0uc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1tb/cMOBS2cLfycTf7I6+zENmeyBFQ3E1+OFzEGZRzvdPBAYU/uAPCKn1zDMnj0Yq mWEmbwEz47PPImVHUdO4pFVw4XQgg2JGz2aB7s3Kug67oyTxfZGdwWGd6ACUKzqhXs Hcr235m7Yy+wa2MtkCVLok7ZgOUw+isWx+H7wQ/U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Donnefort , "Peter Zijlstra (Intel)" , Valentin Schneider , Dietmar Eggemann , Sasha Levin Subject: [PATCH 5.16 0231/1039] sched/fair: Fix per-CPU kthread and wakee stacking for asym CPU capacity Date: Mon, 24 Jan 2022 19:33:40 +0100 Message-Id: <20220124184133.084799295@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Donnefort [ Upstream commit 014ba44e8184e1acf93e0cbb7089ee847802f8f0 ] select_idle_sibling() has a special case for tasks woken up by a per-CPU kthread where the selected CPU is the previous one. For asymmetric CPU capacity systems, the assumption was that the wakee couldn't have a bigger utilization during task placement than it used to have during the last activation. That was not considering uclamp.min which can completely change between two task activations and as a consequence mandates the fitness criterion asym_fits_capacity(), even for the exit path described above. Fixes: b4c9c9f15649 ("sched/fair: Prefer prev cpu in asymmetric wakeup path= ") Signed-off-by: Vincent Donnefort Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Valentin Schneider Reviewed-by: Dietmar Eggemann Link: https://lkml.kernel.org/r/20211129173115.4006346-1-vincent.donnefort@= arm.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/sched/fair.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 97d89516fbea2..f2cf047b25e56 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6400,7 +6400,8 @@ static int select_idle_sibling(struct task_struct *p,= int prev, int target) if (is_per_cpu_kthread(current) && in_task() && prev =3D=3D smp_processor_id() && - this_rq()->nr_running <=3D 1) { + this_rq()->nr_running <=3D 1 && + asym_fits_capacity(task_util, prev)) { return prev; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DA51C433FE for ; Mon, 24 Jan 2022 23:58:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367082AbiAXXyJ (ORCPT ); Mon, 24 Jan 2022 18:54:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837925AbiAXWpi (ORCPT ); Mon, 24 Jan 2022 17:45:38 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1700EC0550D3; Mon, 24 Jan 2022 13:06:04 -0800 (PST) Received: from smtp.kernel.org (relay.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 C6EEEB80FA1; Mon, 24 Jan 2022 21:06:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA741C340E5; Mon, 24 Jan 2022 21:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058361; bh=y6pxtUIpEOXti+4rAY08oFuU3RChd4ALLBj5AbyrRLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UseJFk04GQWm0MKPh2JbEPS4cGyEXl/J1c7gju9KkDNRoV3FZApCJ/1H9C3XGLE47 Hb9Pno8pSZFUwERAvxdBDkLZEYiFQpVQp476VYD+PQQdOLdO28U8m3Gwpmboi7j+Xd hUiFAneLPHHZbQ0oBCq6/6qu75uFeeFGiRPpFAAI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexei Starovoitov , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.16 0232/1039] bpf: Adjust BTF log size limit. Date: Mon, 24 Jan 2022 19:33:41 +0100 Message-Id: <20220124184133.116112474@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit c5a2d43e998a821701029f23e25b62f9188e93ff ] Make BTF log size limit to be the same as the verifier log size limit. Otherwise tools that progressively increase log size and use the same log for BTF loading and program loading will be hitting hard to debug EINVAL. Signed-off-by: Alexei Starovoitov Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20211201181040.23337-7-alexei.starovoitov= @gmail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/bpf/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 9bdb03767db57..0cb1ceb91ca96 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -4460,7 +4460,7 @@ static struct btf *btf_parse(bpfptr_t btf_data, u32 b= tf_data_size, log->len_total =3D log_size; =20 /* log attributes have to be sane */ - if (log->len_total < 128 || log->len_total > UINT_MAX >> 8 || + if (log->len_total < 128 || log->len_total > UINT_MAX >> 2 || !log->level || !log->ubuf) { err =3D -EINVAL; goto errout; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 840DAC35271 for ; Mon, 24 Jan 2022 23:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367044AbiAXXyD (ORCPT ); Mon, 24 Jan 2022 18:54:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837936AbiAXWpj (ORCPT ); Mon, 24 Jan 2022 17:45:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9170DC0550D7; Mon, 24 Jan 2022 13:06:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 31AF961320; Mon, 24 Jan 2022 21:06:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C610C340E5; Mon, 24 Jan 2022 21:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058364; bh=7wStGB7xxU3AA3sGqmsWeIoblbJjCxRP7FitXitWhZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HMdrdQHw85vb4M/Erlj3HszYx8vCgq5Xt+laSZu5xpGjux330dJLsbUlzA051WSgz ZI8DGh61x6Buqc9dJQqX25zfCkGmwXT8dhQ8B1HV6IEpbJQ59v/lwqDD81M9agc7fv qoDISpUqu7eI6mqsMTAuggsybhg2f3oOb+D+5bkQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Alexei Starovoitov , Yonghong Song , Martin KaFai Lau , Sasha Levin Subject: [PATCH 5.16 0233/1039] bpf: Disallow BPF_LOG_KERNEL log level for bpf(BPF_BTF_LOAD) Date: Mon, 24 Jan 2022 19:33:42 +0100 Message-Id: <20220124184133.145073433@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 866de407444398bc8140ea70de1dba5f91cc34ac ] BPF_LOG_KERNEL is only used internally, so disallow bpf_btf_load() to set log level as BPF_LOG_KERNEL. The same checking has already been done in bpf_check(), so factor out a helper to check the validity of log attributes and use it in both places. Fixes: 8580ac9404f6 ("bpf: Process in-kernel BTF") Signed-off-by: Hou Tao Signed-off-by: Alexei Starovoitov Acked-by: Yonghong Song Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/bpf/20211203053001.740945-1-houtao1@huawei.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/linux/bpf_verifier.h | 7 +++++++ kernel/bpf/btf.c | 3 +-- kernel/bpf/verifier.c | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index c8a78e830fcab..182b16a910849 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -396,6 +396,13 @@ static inline bool bpf_verifier_log_needed(const struc= t bpf_verifier_log *log) log->level =3D=3D BPF_LOG_KERNEL); } =20 +static inline bool +bpf_verifier_log_attr_valid(const struct bpf_verifier_log *log) +{ + return log->len_total >=3D 128 && log->len_total <=3D UINT_MAX >> 2 && + log->level && log->ubuf && !(log->level & ~BPF_LOG_MASK); +} + #define BPF_MAX_SUBPROGS 256 =20 struct bpf_subprog_info { diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 0cb1ceb91ca96..5e037070cb656 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -4460,8 +4460,7 @@ static struct btf *btf_parse(bpfptr_t btf_data, u32 b= tf_data_size, log->len_total =3D log_size; =20 /* log attributes have to be sane */ - if (log->len_total < 128 || log->len_total > UINT_MAX >> 2 || - !log->level || !log->ubuf) { + if (!bpf_verifier_log_attr_valid(log)) { err =3D -EINVAL; goto errout; } diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 4e51bf3f9603a..8ebabae31a431 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -13960,11 +13960,11 @@ int bpf_check(struct bpf_prog **prog, union bpf_a= ttr *attr, bpfptr_t uattr) log->ubuf =3D (char __user *) (unsigned long) attr->log_buf; log->len_total =3D attr->log_size; =20 - ret =3D -EINVAL; /* log attributes have to be sane */ - if (log->len_total < 128 || log->len_total > UINT_MAX >> 2 || - !log->level || !log->ubuf || log->level & ~BPF_LOG_MASK) + if (!bpf_verifier_log_attr_valid(log)) { + ret =3D -EINVAL; goto err_unlock; + } } =20 if (IS_ERR(btf_vmlinux)) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A9FBC47081 for ; Mon, 24 Jan 2022 23:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367064AbiAXXyG (ORCPT ); Mon, 24 Jan 2022 18:54:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837945AbiAXWpj (ORCPT ); Mon, 24 Jan 2022 17:45:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD141C0550DA; Mon, 24 Jan 2022 13:06:08 -0800 (PST) Received: from smtp.kernel.org (relay.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 45CC261440; Mon, 24 Jan 2022 21:06:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25B13C340E5; Mon, 24 Jan 2022 21:06:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058367; bh=ztqfitNffqsFqfEWPzKX7KUjxMzkshc6Xzsm9WfQhxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m5v6nL8lYuo0767OwOxLLWlgeTmDDdtTZdzw0NUCq0XvaNAVwqRAYuvrD70gOQVmg GLmLrCdF/RzI05kFirWnF2Ewyuw+aq2ZdWLUNnczSG14r8mAjP1mxUPFv4QCNs0D3T FEB08uS9B59YAl0AplH4pAV24xObOimQDOgUnwJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Zijlstra , Kajol Jain , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.16 0234/1039] bpf: Remove config check to enable bpf support for branch records Date: Mon, 24 Jan 2022 19:33:43 +0100 Message-Id: <20220124184133.182515019@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kajol Jain [ Upstream commit db52f57211b4e45f0ebb274e2c877b211dc18591 ] Branch data available to BPF programs can be very useful to get stack traces out of userspace application. Commit fff7b64355ea ("bpf: Add bpf_read_branch_records() helper") added BPF support to capture branch records in x86. Enable this feature also for other architectures as well by removing checks specific to x86. If an architecture doesn't support branch records, bpf_read_branch_records() still has appropriate checks and it will return an -EINVAL in that scenario. Based on UAPI helper doc in include/uapi/linux/bpf.h, unsupported architect= ures should return -ENOENT in such case. Hence, update the appropriate check to return -ENOENT instead. Selftest 'perf_branches' result on power9 machine which has the branch stac= ks support: - Before this patch: [command]# ./test_progs -t perf_branches #88/1 perf_branches/perf_branches_hw:FAIL #88/2 perf_branches/perf_branches_no_hw:OK #88 perf_branches:FAIL Summary: 0/1 PASSED, 0 SKIPPED, 1 FAILED - After this patch: [command]# ./test_progs -t perf_branches #88/1 perf_branches/perf_branches_hw:OK #88/2 perf_branches/perf_branches_no_hw:OK #88 perf_branches:OK Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED Selftest 'perf_branches' result on power9 machine which doesn't have branch stack report: - After this patch: [command]# ./test_progs -t perf_branches #88/1 perf_branches/perf_branches_hw:SKIP #88/2 perf_branches/perf_branches_no_hw:OK #88 perf_branches:OK Summary: 1/1 PASSED, 1 SKIPPED, 0 FAILED Fixes: fff7b64355eac ("bpf: Add bpf_read_branch_records() helper") Suggested-by: Peter Zijlstra Signed-off-by: Kajol Jain Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20211206073315.77432-1-kjain@linux.ibm.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/trace/bpf_trace.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index ae9755037b7ee..e36d184615fb7 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -1400,9 +1400,6 @@ static const struct bpf_func_proto bpf_perf_prog_read= _value_proto =3D { BPF_CALL_4(bpf_read_branch_records, struct bpf_perf_event_data_kern *, ctx, void *, buf, u32, size, u64, flags) { -#ifndef CONFIG_X86 - return -ENOENT; -#else static const u32 br_entry_size =3D sizeof(struct perf_branch_entry); struct perf_branch_stack *br_stack =3D ctx->data->br_stack; u32 to_copy; @@ -1411,7 +1408,7 @@ BPF_CALL_4(bpf_read_branch_records, struct bpf_perf_e= vent_data_kern *, ctx, return -EINVAL; =20 if (unlikely(!br_stack)) - return -EINVAL; + return -ENOENT; =20 if (flags & BPF_F_GET_BRANCH_RECORDS_SIZE) return br_stack->nr * br_entry_size; @@ -1423,7 +1420,6 @@ BPF_CALL_4(bpf_read_branch_records, struct bpf_perf_e= vent_data_kern *, ctx, memcpy(buf, br_stack->entries, to_copy); =20 return to_copy; -#endif } =20 static const struct bpf_func_proto bpf_read_branch_records_proto =3D { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91B46C4167B for ; Tue, 25 Jan 2022 03:00:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315018AbiAYCwR (ORCPT ); Mon, 24 Jan 2022 21:52:17 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58586 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446041AbiAXVGO (ORCPT ); Mon, 24 Jan 2022 16:06:14 -0500 Received: from smtp.kernel.org (relay.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 0AD5FB80CCF; Mon, 24 Jan 2022 21:06:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35949C340E5; Mon, 24 Jan 2022 21:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058370; bh=mMOviML6d2B2nz9G6cNtiKt2sKzaa74z8yvSpCvSpoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zF3hqJqleIZ6GWftlyCX+7QQI7xcy4AI6xy6AzT0QasZ+9cRCLsxNpwpowlf4G5gB bLNR9XXftDjap79J31GaKkk9ZxwFzB5N3wQO4ZcuM3BkH4VsRtFJkbcgW6mqtn2AYz AwvWEh2etZevkjk58fRIlyIPrRZiP38PuqUlF+bU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Kieran Bingham , Laurent Pinchart , Laurent Pinchart , Sasha Levin Subject: [PATCH 5.16 0235/1039] drm: rcar-du: Add DSI support to rcar_du_output_name Date: Mon, 24 Jan 2022 19:33:44 +0100 Message-Id: <20220124184133.216456115@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kieran Bingham [ Upstream commit e0e4c64a64780a8672480618142776de8bf98d07 ] The DSI output names were not added when the DSI pipeline support was introduced. Add the correct labels for these outputs, and fix the sort order to match 'enum rcar_du_output' while we are here. Fixes: b291fdcf5114 ("drm: rcar-du: Add r8a779a0 device support") Suggested-by: Biju Das Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-d= u/rcar_du_drv.c index 5612a9e7a9056..5a8131ef81d5a 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c @@ -544,10 +544,12 @@ const char *rcar_du_output_name(enum rcar_du_output o= utput) static const char * const names[] =3D { [RCAR_DU_OUTPUT_DPAD0] =3D "DPAD0", [RCAR_DU_OUTPUT_DPAD1] =3D "DPAD1", - [RCAR_DU_OUTPUT_LVDS0] =3D "LVDS0", - [RCAR_DU_OUTPUT_LVDS1] =3D "LVDS1", + [RCAR_DU_OUTPUT_DSI0] =3D "DSI0", + [RCAR_DU_OUTPUT_DSI1] =3D "DSI1", [RCAR_DU_OUTPUT_HDMI0] =3D "HDMI0", [RCAR_DU_OUTPUT_HDMI1] =3D "HDMI1", + [RCAR_DU_OUTPUT_LVDS0] =3D "LVDS0", + [RCAR_DU_OUTPUT_LVDS1] =3D "LVDS1", [RCAR_DU_OUTPUT_TCON] =3D "TCON", }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37E74C2BA4C for ; Mon, 24 Jan 2022 23:34:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359598AbiAXXc6 (ORCPT ); Mon, 24 Jan 2022 18:32:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837008AbiAXWli (ORCPT ); Mon, 24 Jan 2022 17:41:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FAB0C04D634; Mon, 24 Jan 2022 13:04:33 -0800 (PST) Received: from smtp.kernel.org (relay.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 0F3766131F; Mon, 24 Jan 2022 21:04:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D67FEC340E5; Mon, 24 Jan 2022 21:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058272; bh=ZqBpEma6EwjEHMM+OJMZD2VLNm0DVB11FAv/b+XM+VI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZIoWWWW+QynyPW/YfLmshqn5OLP7kG7JxFC7sEtjIvOEshJAaAVQ+te4YGrKII+7I 8jFF+B50vSanenz8HGrNvWKFctF/aJ+aMKs28Zv96PKR+KY6afUWtYr/g1M/DCk8nD g0z+HXdqFF6UpVEAqUr1bd4YLECuUYS31/j1mVIo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kieran Bingham , Laurent Pinchart , Laurent Pinchart , Sasha Levin Subject: [PATCH 5.16 0236/1039] drm: rcar-du: crtc: Support external DSI dot clock Date: Mon, 24 Jan 2022 19:33:45 +0100 Message-Id: <20220124184133.246171168@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kieran Bingham [ Upstream commit 57b290cb905bec520372ac635d9e9f0548d9d67e ] On platforms with an external clock, both the group and crtc must be handled accordingly to correctly pass through the external clock and configure the DU to use the external rate. The CRTC support was missed while adding the DSI support on the r8a779a0 which led to the output clocks being incorrectly determined. Ensure that when a CRTC is routed through the DSI encoder, the external clock is used without any further divider being applied. Fixes: b291fdcf5114 ("drm: rcar-du: Add r8a779a0 device support") Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-= du/rcar_du_crtc.c index 5672830ca184d..5236f917cc68d 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -261,12 +261,13 @@ static void rcar_du_crtc_set_display_timing(struct rc= ar_du_crtc *rcrtc) rcar_du_group_write(rcrtc->group, DPLLCR, dpllcr); =20 escr =3D ESCR_DCLKSEL_DCLKIN | div; - } else if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index)) { + } else if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index) || + rcdu->info->dsi_clk_mask & BIT(rcrtc->index)) { /* - * Use the LVDS PLL output as the dot clock when outputting to - * the LVDS encoder on an SoC that supports this clock routing - * option. We use the clock directly in that case, without any - * additional divider. + * Use the external LVDS or DSI PLL output as the dot clock when + * outputting to the LVDS or DSI encoder on an SoC that supports + * this clock routing option. We use the clock directly in that + * case, without any additional divider. */ escr =3D ESCR_DCLKSEL_DCLKIN; } else { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52EC9C41535 for ; Mon, 24 Jan 2022 23:34:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359628AbiAXXdD (ORCPT ); Mon, 24 Jan 2022 18:33:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837010AbiAXWli (ORCPT ); Mon, 24 Jan 2022 17:41:38 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19865C055A8F; Mon, 24 Jan 2022 13:04:38 -0800 (PST) Received: from smtp.kernel.org (relay.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 C9F7EB812A8; Mon, 24 Jan 2022 21:04:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA8AFC340E5; Mon, 24 Jan 2022 21:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058275; bh=16LNaUCzIzb/T+JoyZ/ziwN0gPqMj0yFnQdm07T7pxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DHUyfZ+qAkqow1lq2bNaGIvPhQeO6kfo5wVWwoX0XQONplpRlqbhftjZAPEJlMe6d yY8bAOR45PTerA0+wEM2MZq70MW4YTubBPkCePi6IAicNMA+xfjpS3OF4lh86415nb SuFSY6nwImZPqF1oayt+YTq15n4FIqO3cqv/xObA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Reiji Watanabe , Robin Murphy , Catalin Marinas , Sasha Levin Subject: [PATCH 5.16 0237/1039] arm64: clear_page() shouldnt use DC ZVA when DCZID_EL0.DZP == 1 Date: Mon, 24 Jan 2022 19:33:46 +0100 Message-Id: <20220124184133.283001988@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Reiji Watanabe [ Upstream commit f0616abd4e67143b45b04b565839148458857347 ] Currently, clear_page() uses DC ZVA instruction unconditionally. But it should make sure that DCZID_EL0.DZP, which indicates whether or not use of DC ZVA instruction is prohibited, is zero when using the instruction. Use STNP instead when DCZID_EL0.DZP =3D=3D 1. Fixes: f27bb139c387 ("arm64: Miscellaneous library functions") Signed-off-by: Reiji Watanabe Reviewed-by: Robin Murphy Link: https://lore.kernel.org/r/20211206004736.1520989-2-reijiw@google.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/lib/clear_page.S | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/lib/clear_page.S b/arch/arm64/lib/clear_page.S index b84b179edba3a..1fd5d790ab800 100644 --- a/arch/arm64/lib/clear_page.S +++ b/arch/arm64/lib/clear_page.S @@ -16,6 +16,7 @@ */ SYM_FUNC_START_PI(clear_page) mrs x1, dczid_el0 + tbnz x1, #4, 2f /* Branch if DC ZVA is prohibited */ and w1, w1, #0xf mov x2, #4 lsl x1, x2, x1 @@ -25,5 +26,14 @@ SYM_FUNC_START_PI(clear_page) tst x0, #(PAGE_SIZE - 1) b.ne 1b ret + +2: stnp xzr, xzr, [x0] + stnp xzr, xzr, [x0, #16] + stnp xzr, xzr, [x0, #32] + stnp xzr, xzr, [x0, #48] + add x0, x0, #64 + tst x0, #(PAGE_SIZE - 1) + b.ne 2b + ret SYM_FUNC_END_PI(clear_page) EXPORT_SYMBOL(clear_page) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5B08C433EF for ; Tue, 25 Jan 2022 03:00:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314482AbiAYCvF (ORCPT ); Mon, 24 Jan 2022 21:51:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55086 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445674AbiAXVEm (ORCPT ); Mon, 24 Jan 2022 16:04:42 -0500 Received: from smtp.kernel.org (relay.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 32AFB60916; Mon, 24 Jan 2022 21:04:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DAA9C340E5; Mon, 24 Jan 2022 21:04:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058278; bh=0s33lcfy4P2jFzKILFRE4pEzm1ozOlLG3JQ6R6GELwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UWrrlVXvWikm81fC6mbwm1uu1cbEGRaX5jJrz8HAge+Hm8hCNnzBx9J2eqEI7cpnv l4wL3y+mGSnFooDMrsuDeECbW7T5oy6LKzmOFXeAbpjfct7o4Plpoim4HQlSucLkA/ +OlJnlv5tr84gG5YTxzFpyOnoVjmUjGr4LD1tqgw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Reiji Watanabe , Catalin Marinas , Sasha Levin Subject: [PATCH 5.16 0238/1039] arm64: mte: DC {GVA,GZVA} shouldnt be used when DCZID_EL0.DZP == 1 Date: Mon, 24 Jan 2022 19:33:47 +0100 Message-Id: <20220124184133.321609644@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Reiji Watanabe [ Upstream commit 685e2564daa1493053fcd7f1dbed38b35ee2f3cb ] Currently, mte_set_mem_tag_range() and mte_zero_clear_page_tags() use DC {GVA,GZVA} unconditionally. But, they should make sure that DCZID_EL0.DZP, which indicates whether or not use of those instructions is prohibited, is zero when using those instructions. Use ST{G,ZG,Z2G} instead when DCZID_EL0.DZP =3D=3D 1. Fixes: 013bb59dbb7c ("arm64: mte: handle tags zeroing at page allocation ti= me") Fixes: 3d0cca0b02ac ("kasan: speed up mte_set_mem_tag_range") Signed-off-by: Reiji Watanabe Link: https://lore.kernel.org/r/20211206004736.1520989-3-reijiw@google.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/include/asm/mte-kasan.h | 8 +++++--- arch/arm64/lib/mte.S | 8 +++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/mte-kasan.h b/arch/arm64/include/asm/mt= e-kasan.h index 478b9bcf69ad1..e4704a403237e 100644 --- a/arch/arm64/include/asm/mte-kasan.h +++ b/arch/arm64/include/asm/mte-kasan.h @@ -84,10 +84,12 @@ static inline void __dc_gzva(u64 p) static inline void mte_set_mem_tag_range(void *addr, size_t size, u8 tag, bool init) { - u64 curr, mask, dczid_bs, end1, end2, end3; + u64 curr, mask, dczid, dczid_bs, dczid_dzp, end1, end2, end3; =20 /* Read DC G(Z)VA block size from the system register. */ - dczid_bs =3D 4ul << (read_cpuid(DCZID_EL0) & 0xf); + dczid =3D read_cpuid(DCZID_EL0); + dczid_bs =3D 4ul << (dczid & 0xf); + dczid_dzp =3D (dczid >> 4) & 1; =20 curr =3D (u64)__tag_set(addr, tag); mask =3D dczid_bs - 1; @@ -106,7 +108,7 @@ static inline void mte_set_mem_tag_range(void *addr, si= ze_t size, u8 tag, */ #define SET_MEMTAG_RANGE(stg_post, dc_gva) \ do { \ - if (size >=3D 2 * dczid_bs) { \ + if (!dczid_dzp && size >=3D 2 * dczid_bs) {\ do { \ curr =3D stg_post(curr); \ } while (curr < end1); \ diff --git a/arch/arm64/lib/mte.S b/arch/arm64/lib/mte.S index e83643b3995f4..f531dcb95174a 100644 --- a/arch/arm64/lib/mte.S +++ b/arch/arm64/lib/mte.S @@ -43,17 +43,23 @@ SYM_FUNC_END(mte_clear_page_tags) * x0 - address to the beginning of the page */ SYM_FUNC_START(mte_zero_clear_page_tags) + and x0, x0, #(1 << MTE_TAG_SHIFT) - 1 // clear the tag mrs x1, dczid_el0 + tbnz x1, #4, 2f // Branch if DC GZVA is prohibited and w1, w1, #0xf mov x2, #4 lsl x1, x2, x1 - and x0, x0, #(1 << MTE_TAG_SHIFT) - 1 // clear the tag =20 1: dc gzva, x0 add x0, x0, x1 tst x0, #(PAGE_SIZE - 1) b.ne 1b ret + +2: stz2g x0, [x0], #(MTE_GRANULE_SIZE * 2) + tst x0, #(PAGE_SIZE - 1) + b.ne 2b + ret SYM_FUNC_END(mte_zero_clear_page_tags) =20 /* --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D762C433F5 for ; Tue, 25 Jan 2022 00:14:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372104AbiAYAKj (ORCPT ); Mon, 24 Jan 2022 19:10:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837015AbiAXWli (ORCPT ); Mon, 24 Jan 2022 17:41:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBBA2C06B581; Mon, 24 Jan 2022 13:04:42 -0800 (PST) Received: from smtp.kernel.org (relay.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 58E9860B03; Mon, 24 Jan 2022 21:04:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18741C340E5; Mon, 24 Jan 2022 21:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058281; bh=1thdJ/X7BNliuNC54o65kVEUZOHrhkbxjwWO8sllG/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LOZD3jPKeEQ6XD0LMMz8HA/SBeXTANxuEv7dzRTJtp77LJrI5DRBaKMikbnB0/fHS kJmAGEmgw/8C1mBDjLFdWgYeAWCkDSG1H3Oir94mnKhWYqvFQFjfwa3nTZGkXbvoEw ceUQOckxcN0BZYUYUv0sNwqCGiJE9QUhW+r4yB4Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Hans de Goede , Sasha Levin Subject: [PATCH 5.16 0239/1039] platform/x86: wmi: Replace read_takes_no_args with a flags field Date: Mon, 24 Jan 2022 19:33:48 +0100 Message-Id: <20220124184133.355836698@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit a90b38c58667142ecff2521481ed44286d46b140 ] Replace the wmi_block.read_takes_no_args bool field with an unsigned long flags field, used together with test_bit() and friends. This is a preparation patch for fixing a driver->notify() vs ->probe() race, which requires atomic flag handling. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20211128190031.405620-1-hdegoede@redhat.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/platform/x86/wmi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index c34341f4da763..46178e03aecad 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -57,6 +57,10 @@ static_assert(sizeof(typeof_member(struct guid_block, gu= id)) =3D=3D 16); static_assert(sizeof(struct guid_block) =3D=3D 20); static_assert(__alignof__(struct guid_block) =3D=3D 1); =20 +enum { /* wmi_block flags */ + WMI_READ_TAKES_NO_ARGS, +}; + struct wmi_block { struct wmi_device dev; struct list_head list; @@ -67,8 +71,7 @@ struct wmi_block { wmi_notify_handler handler; void *handler_data; u64 req_buf_size; - - bool read_takes_no_args; + unsigned long flags; }; =20 =20 @@ -367,7 +370,7 @@ static acpi_status __query_block(struct wmi_block *wblo= ck, u8 instance, wq_params[0].type =3D ACPI_TYPE_INTEGER; wq_params[0].integer.value =3D instance; =20 - if (instance =3D=3D 0 && wblock->read_takes_no_args) + if (instance =3D=3D 0 && test_bit(WMI_READ_TAKES_NO_ARGS, &wblock->flags)) input.count =3D 0; =20 /* @@ -1113,7 +1116,7 @@ static int wmi_create_device(struct device *wmi_bus_d= ev, * laptops, WQxx may not be a method at all.) */ if (info->type !=3D ACPI_TYPE_METHOD || info->param_count =3D=3D 0) - wblock->read_takes_no_args =3D true; + set_bit(WMI_READ_TAKES_NO_ARGS, &wblock->flags); =20 kfree(info); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CCF5C43217 for ; Mon, 24 Jan 2022 21:44:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457521AbiAXVlp (ORCPT ); Mon, 24 Jan 2022 16:41:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57456 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445711AbiAXVEs (ORCPT ); Mon, 24 Jan 2022 16:04:48 -0500 Received: from smtp.kernel.org (relay.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 21F5AB8123D; Mon, 24 Jan 2022 21:04:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20E8DC340EA; Mon, 24 Jan 2022 21:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058284; bh=B2XzkCbD1hJiPE4C447BD00cSG+WKckSPUTUv11flOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TlV+OK3AQtKuEjxHrjSkMzA/cvGhFvpVh626t0eOIK7rAikFAQueTt5m//8b11MQ4 hyRaZ5c2cpZSc7cBrgSaLubsVAYIIA9bDEi4TLzmvKGoRQfGE+J4MmDEKd34CNVeSX YY50MTIfpOUfrsOaublkzQaUy98wAlFyY4eRMGTA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Hans de Goede , Sasha Levin Subject: [PATCH 5.16 0240/1039] platform/x86: wmi: Fix driver->notify() vs ->probe() race Date: Mon, 24 Jan 2022 19:33:49 +0100 Message-Id: <20220124184133.392081454@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 9918878676a5f9e99b98679f04b9e6c0f5426b0a ] The driver core sets struct device->driver before calling out to the bus' probe() method, this leaves a window where an ACPI notify may happen on the WMI object before the driver's probe() method has completed running, causing e.g. the driver's notify() callback to get called with drvdata not yet being set leading to a NULL pointer deref. At a check for this to the WMI core, ensuring that the notify() callback is not called before the driver is ready. Fixes: 1686f5444546 ("platform/x86: wmi: Incorporate acpi_install_notify_ha= ndler") Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20211128190031.405620-2-hdegoede@redhat.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/platform/x86/wmi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 46178e03aecad..02aba274c4bc2 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -59,6 +59,7 @@ static_assert(__alignof__(struct guid_block) =3D=3D 1); =20 enum { /* wmi_block flags */ WMI_READ_TAKES_NO_ARGS, + WMI_PROBED, }; =20 struct wmi_block { @@ -1008,6 +1009,7 @@ static int wmi_dev_probe(struct device *dev) } } =20 + set_bit(WMI_PROBED, &wblock->flags); return 0; =20 probe_misc_failure: @@ -1025,6 +1027,8 @@ static void wmi_dev_remove(struct device *dev) struct wmi_block *wblock =3D dev_to_wblock(dev); struct wmi_driver *wdriver =3D drv_to_wdrv(dev->driver); =20 + clear_bit(WMI_PROBED, &wblock->flags); + if (wdriver->filter_callback) { misc_deregister(&wblock->char_dev); kfree(wblock->char_dev.name); @@ -1322,7 +1326,7 @@ static void acpi_wmi_notify_handler(acpi_handle handl= e, u32 event, return; =20 /* If a driver is bound, then notify the driver. */ - if (wblock->dev.dev.driver) { + if (test_bit(WMI_PROBED, &wblock->flags) && wblock->dev.dev.driver) { struct wmi_driver *driver =3D drv_to_wdrv(wblock->dev.dev.driver); struct acpi_buffer evdata =3D { ACPI_ALLOCATE_BUFFER, NULL }; acpi_status status; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B34F3C4167B for ; Mon, 24 Jan 2022 21:44:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457536AbiAXVls (ORCPT ); Mon, 24 Jan 2022 16:41:48 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56160 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445725AbiAXVEu (ORCPT ); Mon, 24 Jan 2022 16:04:50 -0500 Received: from smtp.kernel.org (relay.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 31E29B810BD; Mon, 24 Jan 2022 21:04:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30232C340E7; Mon, 24 Jan 2022 21:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058287; bh=9EwleqdRVZtL162VKfnttSjeH2nw2+PWu/If4AcMLWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nRIMM2zMsCrf3cbM/7NcfKiSghJftRscHFUzejC0+UUwXYYQ+Nk4hTkLJhOudN0Y3 7vXCVLvHgqRFgio507LRx7Har4V40XCKkfPJhngN5oNOwNAArhj7nGd6+MCmSe4VhD T4mr6+5fvF1F1wRPItPbIiXQ7assZE2uWGUvUVd4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.16 0241/1039] samples/bpf: Clean up samples/bpf build failes Date: Mon, 24 Jan 2022 19:33:50 +0100 Message-Id: <20220124184133.423600481@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 527024f7aeb683ce7ef49b07ef7ce9ecf015288d ] Remove xdp_samples_user.o rule redefinition which generates Makefile warning and instead override TPROGS_CFLAGS. This seems to work fine when building inside selftests/bpf. That was one big head-scratcher before I found that generic Makefile.target hid this surprising specialization for for xdp_samples_user= .o. Main change is to use actual locally installed libbpf headers. Also drop printk macro re-definition (not even used!). Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20211201232824.3166325-8-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- samples/bpf/Makefile | 13 ++++++++++++- samples/bpf/Makefile.target | 11 ----------- samples/bpf/lwt_len_hist_kern.c | 7 ------- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index a886dff1ba899..6ae62b1dc9388 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -328,7 +328,7 @@ $(BPF_SAMPLES_PATH)/*.c: verify_target_bpf $(LIBBPF) $(src)/*.c: verify_target_bpf $(LIBBPF) =20 libbpf_hdrs: $(LIBBPF) -$(obj)/$(TRACE_HELPERS): | libbpf_hdrs +$(obj)/$(TRACE_HELPERS) $(obj)/$(CGROUP_HELPERS) $(obj)/$(XDP_SAMPLE): | l= ibbpf_hdrs =20 .PHONY: libbpf_hdrs =20 @@ -343,6 +343,17 @@ $(obj)/hbm_out_kern.o: $(src)/hbm.h $(src)/hbm_kern.h $(obj)/hbm.o: $(src)/hbm.h $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h =20 +# Override includes for xdp_sample_user.o because $(srctree)/usr/include in +# TPROGS_CFLAGS causes conflicts +XDP_SAMPLE_CFLAGS +=3D -Wall -O2 -lm \ + -I$(src)/../../tools/include \ + -I$(src)/../../tools/include/uapi \ + -I$(LIBBPF_INCLUDE) \ + -I$(src)/../../tools/testing/selftests/bpf + +$(obj)/$(XDP_SAMPLE): TPROGS_CFLAGS =3D $(XDP_SAMPLE_CFLAGS) +$(obj)/$(XDP_SAMPLE): $(src)/xdp_sample_user.h $(src)/xdp_sample_shared.h + -include $(BPF_SAMPLES_PATH)/Makefile.target =20 VMLINUX_BTF_PATHS ?=3D $(abspath $(if $(O),$(O)/vmlinux)) \ diff --git a/samples/bpf/Makefile.target b/samples/bpf/Makefile.target index 5a368affa0386..7621f55e2947d 100644 --- a/samples/bpf/Makefile.target +++ b/samples/bpf/Makefile.target @@ -73,14 +73,3 @@ quiet_cmd_tprog-cobjs =3D CC $@ cmd_tprog-cobjs =3D $(CC) $(tprogc_flags) -c -o $@ $< $(tprog-cobjs): $(obj)/%.o: $(src)/%.c FORCE $(call if_changed_dep,tprog-cobjs) - -# Override includes for xdp_sample_user.o because $(srctree)/usr/include in -# TPROGS_CFLAGS causes conflicts -XDP_SAMPLE_CFLAGS +=3D -Wall -O2 -lm \ - -I./tools/include \ - -I./tools/include/uapi \ - -I./tools/lib \ - -I./tools/testing/selftests/bpf -$(obj)/xdp_sample_user.o: $(src)/xdp_sample_user.c \ - $(src)/xdp_sample_user.h $(src)/xdp_sample_shared.h - $(CC) $(XDP_SAMPLE_CFLAGS) -c -o $@ $< diff --git a/samples/bpf/lwt_len_hist_kern.c b/samples/bpf/lwt_len_hist_ker= n.c index 9ed63e10e1709..1fa14c54963a1 100644 --- a/samples/bpf/lwt_len_hist_kern.c +++ b/samples/bpf/lwt_len_hist_kern.c @@ -16,13 +16,6 @@ #include #include =20 -# define printk(fmt, ...) \ - ({ \ - char ____fmt[] =3D fmt; \ - bpf_trace_printk(____fmt, sizeof(____fmt), \ - ##__VA_ARGS__); \ - }) - struct bpf_elf_map { __u32 type; __u32 size_key; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83F63C433F5 for ; Mon, 24 Jan 2022 21:44:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457583AbiAXVly (ORCPT ); Mon, 24 Jan 2022 16:41:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57242 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445742AbiAXVEy (ORCPT ); Mon, 24 Jan 2022 16:04:54 -0500 Received: from smtp.kernel.org (relay.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 83DF860E8D; Mon, 24 Jan 2022 21:04:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C0CFC340E5; Mon, 24 Jan 2022 21:04:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058290; bh=BqysmeVxkEVWax6vfPWYAI80fhHBzoQXcnZnF30vv98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WzjErDMfADw1jI8hE8Tt0OjRVh6JOLFzzApx8exKGHPVls7SpcI3OPdeYJzCakPBW a5pexa3ZWPfIxKYBtYY4lVhIAtA8vPS4ppMFlYtF2+BFbVvM+lB1UhBNumGjb1HJ6g oOP5ks5hx1bff8S1JbHVRKuJcZ6UxS8SX2LdS81E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Lobakin , Andrii Nakryiko , Kumar Kartikeya Dwivedi , Sasha Levin Subject: [PATCH 5.16 0242/1039] samples: bpf: Fix xdp_sample_user.o linking with Clang Date: Mon, 24 Jan 2022 19:33:51 +0100 Message-Id: <20220124184133.462059058@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Lobakin [ Upstream commit e64fbcaa7a666f16329b1c67af15ea501bc84586 ] Clang (13) doesn't get the jokes about specifying libraries to link in cclags of individual .o objects: clang-13: warning: -lm: 'linker' input unused [-Wunused-command-line-argume= nt] [ ... ] LD samples/bpf/xdp_redirect_cpu LD samples/bpf/xdp_redirect_map_multi LD samples/bpf/xdp_redirect_map LD samples/bpf/xdp_redirect LD samples/bpf/xdp_monitor /usr/bin/ld: samples/bpf/xdp_sample_user.o: in function `sample_summary_pri= nt': xdp_sample_user.c:(.text+0x84c): undefined reference to `floor' /usr/bin/ld: xdp_sample_user.c:(.text+0x870): undefined reference to `ceil' /usr/bin/ld: xdp_sample_user.c:(.text+0x8cf): undefined reference to `floor' /usr/bin/ld: xdp_sample_user.c:(.text+0x8f3): undefined reference to `ceil' [ more ] Specify '-lm' as ldflags for all xdp_sample_user.o users in the main Makefile and remove it from ccflags of ^ in Makefile.target -- just like it's done for all other samples. This works with all compilers. Fixes: 6e1051a54e31 ("samples: bpf: Convert xdp_monitor to XDP samples help= er") Fixes: b926c55d856c ("samples: bpf: Convert xdp_redirect to XDP samples hel= per") Fixes: e531a220cc59 ("samples: bpf: Convert xdp_redirect_cpu to XDP samples= helper") Fixes: bbe65865aa05 ("samples: bpf: Convert xdp_redirect_map to XDP samples= helper") Fixes: 594a116b2aa1 ("samples: bpf: Convert xdp_redirect_map_multi to XDP s= amples helper") Signed-off-by: Alexander Lobakin Signed-off-by: Andrii Nakryiko Acked-by: Kumar Kartikeya Dwivedi Link: https://lore.kernel.org/bpf/20211203195004.5803-2-alexandr.lobakin@in= tel.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- samples/bpf/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 6ae62b1dc9388..38638845db9d7 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -215,6 +215,11 @@ TPROGS_LDFLAGS :=3D -L$(SYSROOT)/usr/lib endif =20 TPROGS_LDLIBS +=3D $(LIBBPF) -lelf -lz +TPROGLDLIBS_xdp_monitor +=3D -lm +TPROGLDLIBS_xdp_redirect +=3D -lm +TPROGLDLIBS_xdp_redirect_cpu +=3D -lm +TPROGLDLIBS_xdp_redirect_map +=3D -lm +TPROGLDLIBS_xdp_redirect_map_multi +=3D -lm TPROGLDLIBS_tracex4 +=3D -lrt TPROGLDLIBS_trace_output +=3D -lrt TPROGLDLIBS_map_perf_test +=3D -lrt @@ -345,7 +350,7 @@ $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h =20 # Override includes for xdp_sample_user.o because $(srctree)/usr/include in # TPROGS_CFLAGS causes conflicts -XDP_SAMPLE_CFLAGS +=3D -Wall -O2 -lm \ +XDP_SAMPLE_CFLAGS +=3D -Wall -O2 \ -I$(src)/../../tools/include \ -I$(src)/../../tools/include/uapi \ -I$(LIBBPF_INCLUDE) \ --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93DD2C43219 for ; Mon, 24 Jan 2022 21:44:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457639AbiAXVmA (ORCPT ); Mon, 24 Jan 2022 16:42:00 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53558 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445759AbiAXVEz (ORCPT ); Mon, 24 Jan 2022 16:04:55 -0500 Received: from smtp.kernel.org (relay.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 6DA666131F; Mon, 24 Jan 2022 21:04:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51288C340E5; Mon, 24 Jan 2022 21:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058293; bh=MONWWN5Pw6rnKPiBEgg31qpoflv/TBpsiZxOuGbiM5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qdWULLho5spHXQocU6/tTGN3Cbp2Giwa4H5GNCDEvv0xdLr5t/YWHNcPQhVBYIxLH IU7txAEktGkSa2oBxEWou4Km4fEk8zJevHeJQAOyO1b2R/eE3qN3Kzo46IiCjD04UO nvXr1XhaMzSEQAJwV9h9kFczxWBgg98+v7+1n840= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Lobakin , Andrii Nakryiko , Kumar Kartikeya Dwivedi , Sasha Levin Subject: [PATCH 5.16 0243/1039] samples: bpf: Fix unknown warning group build warning on Clang Date: Mon, 24 Jan 2022 19:33:52 +0100 Message-Id: <20220124184133.493287897@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Lobakin [ Upstream commit 6f670d06e47c774bc065aaa84a527a4838f34bd8 ] Clang doesn't have 'stringop-truncation' group like GCC does, and complains about it when building samples which use xdp_sample_user infra: samples/bpf/xdp_sample_user.h:48:32: warning: unknown warning group '-Wstr= ingop-truncation', ignored [-Wunknown-warning-option] #pragma GCC diagnostic ignored "-Wstringop-truncation" ^ [ repeat ] Those are harmless, but avoidable when guarding it with ifdef. I could guard push/pop as well, but this would require one more ifdef cruft around a single line which I don't think is reasonable. Fixes: 156f886cf697 ("samples: bpf: Add basic infrastructure for XDP sample= s") Signed-off-by: Alexander Lobakin Signed-off-by: Andrii Nakryiko Acked-by: Kumar Kartikeya Dwivedi Link: https://lore.kernel.org/bpf/20211203195004.5803-3-alexandr.lobakin@in= tel.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- samples/bpf/xdp_sample_user.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/bpf/xdp_sample_user.h b/samples/bpf/xdp_sample_user.h index d97465ff8c62c..5f44b877ecf5f 100644 --- a/samples/bpf/xdp_sample_user.h +++ b/samples/bpf/xdp_sample_user.h @@ -45,7 +45,9 @@ const char *get_driver_name(int ifindex); int get_mac_addr(int ifindex, void *mac_addr); =20 #pragma GCC diagnostic push +#ifndef __clang__ #pragma GCC diagnostic ignored "-Wstringop-truncation" +#endif __attribute__((unused)) static inline char *safe_strncpy(char *dst, const char *src, size_t size) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7D00C433F5 for ; Tue, 25 Jan 2022 00:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372056AbiAYAKc (ORCPT ); Mon, 24 Jan 2022 19:10:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353848AbiAXWlo (ORCPT ); Mon, 24 Jan 2022 17:41:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 566FBC04D63D; Mon, 24 Jan 2022 13:04:59 -0800 (PST) Received: from smtp.kernel.org (relay.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 1E610B81057; Mon, 24 Jan 2022 21:04:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58A5FC340E5; Mon, 24 Jan 2022 21:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058296; bh=0jacikwTIJ8ekpPO0T6TP7Ryl+hPhvGeAirLDHLFhi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=om49342WxKRfZk3S5Ibmid3vseHt82qsNzlNPnVMh+htL5ivNigBiyXffnU8vUDXq ey+c37AFop8ObGMfjZpbua8h6B1w6OHtAUb5LLAPQQkYoMa3jpQQiNeVuUNj3yi0QV IKj+VDyTasR6MpcjVI8K6adwxXrATfv/Kk0LyEs0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Ricardo Ribalda , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0244/1039] media: uvcvideo: Fix memory leak of object map on error exit path Date: Mon, 24 Jan 2022 19:33:53 +0100 Message-Id: <20220124184133.523951292@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Colin Ian King [ Upstream commit 4b065060555b14c7a9b86c013a1c9bee8e8b6fbd ] Currently when the allocation of map->name fails the error exit path does not kfree the previously allocated object map. Fix this by setting ret to -ENOMEM and taking the free_map exit error path to ensure map is kfree'd. Addresses-Coverity: ("Resource leak") Fixes: 70fa906d6fce ("media: uvcvideo: Use control names from framework") Signed-off-by: Colin Ian King Reviewed-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/uvc/uvc_v4l2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v= 4l2.c index f4e4aff8ddf77..711556d13d03a 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -44,8 +44,10 @@ static int uvc_ioctl_ctrl_map(struct uvc_video_chain *ch= ain, if (v4l2_ctrl_get_name(map->id) =3D=3D NULL) { map->name =3D kmemdup(xmap->name, sizeof(xmap->name), GFP_KERNEL); - if (!map->name) - return -ENOMEM; + if (!map->name) { + ret =3D -ENOMEM; + goto free_map; + } } memcpy(map->entity, xmap->entity, sizeof(map->entity)); map->selector =3D xmap->selector; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B400C3525A for ; Mon, 24 Jan 2022 23:34:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359644AbiAXXdE (ORCPT ); Mon, 24 Jan 2022 18:33:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354423AbiAXWlr (ORCPT ); Mon, 24 Jan 2022 17:41:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0391C04D63F; Mon, 24 Jan 2022 13:05:00 -0800 (PST) Received: from smtp.kernel.org (relay.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 90FDF60B03; Mon, 24 Jan 2022 21:05:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6990EC340E5; Mon, 24 Jan 2022 21:04:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058300; bh=F/hEJXjFztjsMlfPfO2E5y342r2bldbSUn26RRHGDXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=beR10tR+1/VatBFJHR3y45Lb027ac9sQu29J7xwxwOiiXKBZ6ViWuqlb4DKC7kKx0 xD36JtSzgKtVq1lffy6KSaHw+JTt908OOpm4nzX+uY/lpZVnjaH8asW3Yt0fg5zncQ AQOSvr8BjG/vUmID9ggvf0ufyVszHGv1AJa8G9pM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ricardo Ribalda , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0245/1039] media: uvcvideo: Avoid invalid memory access Date: Mon, 24 Jan 2022 19:33:54 +0100 Message-Id: <20220124184133.563200222@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ricardo Ribalda [ Upstream commit f0577b1b6394f954903fcc67e12fe9e7001dafd6 ] If mappings points to an invalid memory, we will be invalid accessing it. Solve it by initializing the value of the variable mapping and by changing the order in the conditional statement (to avoid accessing mapping->id if not needed). Fix: kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] PREEMPT SMP KASAN NOPTI Fixes: 6350d6a4ed487 ("media: uvcvideo: Set error_idx during ctrl_commit er= rors") Signed-off-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/uvc/uvc_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_c= trl.c index 30bfe9069a1fb..9a25d60292558 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -1638,7 +1638,7 @@ static int uvc_ctrl_find_ctrl_idx(struct uvc_entity *= entity, struct v4l2_ext_controls *ctrls, struct uvc_control *uvc_control) { - struct uvc_control_mapping *mapping; + struct uvc_control_mapping *mapping =3D NULL; struct uvc_control *ctrl_found; unsigned int i; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38A9FC4167B for ; Tue, 25 Jan 2022 03:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314522AbiAYCvL (ORCPT ); Mon, 24 Jan 2022 21:51:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57696 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445899AbiAXVFJ (ORCPT ); Mon, 24 Jan 2022 16:05:09 -0500 Received: from smtp.kernel.org (relay.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 A0356B8122A; Mon, 24 Jan 2022 21:05:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7DF8C340E5; Mon, 24 Jan 2022 21:05:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058306; bh=VPdI+TVD86eHiCgBauoaGl9SJlHqgi95GTzmkIVc46U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ji5ocejVTWbk28PUsfCJG3Qh58gU8F47onLnUJw5VkViF8aT1en6URwydPEFtwASu 2XqoG2FZ4IluDfnFN6nrZf537j+f5ItwG7BXBlFN65j4G7gd6NY7VcAZaRJAW4r+r7 mdQcCKnCsBly7fQc4l6zG/vqmikFSkzk47Zx/3+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ricardo Ribalda , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0246/1039] media: uvcvideo: Avoid returning invalid controls Date: Mon, 24 Jan 2022 19:33:55 +0100 Message-Id: <20220124184133.593956076@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ricardo Ribalda [ Upstream commit 414d3b49d9fd4a0bb16a13d929027847fd094f3f ] If the memory where ctrl_found is placed has the value of uvc_ctrl and __uvc_find_control does not find the control we will return an invalid index. Fixes: 6350d6a4ed487 ("media: uvcvideo: Set error_idx during ctrl_commit er= rors") Signed-off-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/uvc/uvc_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_c= trl.c index 9a25d60292558..b4f6edf968bc0 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -1639,7 +1639,7 @@ static int uvc_ctrl_find_ctrl_idx(struct uvc_entity *= entity, struct uvc_control *uvc_control) { struct uvc_control_mapping *mapping =3D NULL; - struct uvc_control *ctrl_found; + struct uvc_control *ctrl_found =3D NULL; unsigned int i; =20 if (!entity) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A416C3526D for ; Mon, 24 Jan 2022 23:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353006AbiAXXdL (ORCPT ); Mon, 24 Jan 2022 18:33:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355033AbiAXWlu (ORCPT ); Mon, 24 Jan 2022 17:41:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 499F6C06B582; Mon, 24 Jan 2022 13:05:10 -0800 (PST) Received: from smtp.kernel.org (relay.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 DB95D61365; Mon, 24 Jan 2022 21:05:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDBA3C340E5; Mon, 24 Jan 2022 21:05:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058309; bh=Yp1NnFfvlH+1ASCwb2Hc7AdUpcyrvhhExdH1MabsrVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UHa50cT3/dudi9VAhzJoiks7wwuebQIrde0MtnXf68Di3yBLUJG5pDi5qRca5XtBG PCY9BQq2WnYHvKtKWYfYt0MKrI1EgiDWXM1UnnJeg4rKKOg2RMaUfebpegT+zIP/32 au7NefZaXhKlraVmDDtsIlRiAwj5ZrDIluiK9E9Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0247/1039] media: dib8000: Fix a memleak in dib8000_init() Date: Mon, 24 Jan 2022 19:33:56 +0100 Message-Id: <20220124184133.630764707@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit 8dbdcc7269a83305ee9d677b75064d3530a48ee2 ] In dib8000_init(), the variable fe is not freed or passed out on the failure of dib8000_identify(&state->i2c), which could lead to a memleak. Fix this bug by adding a kfree of fe in the error path. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_DVB_DIB8000=3Dm show no new warnings, and our static analyzer no longer warns about this code. Fixes: 77e2c0f5d471 ("V4L/DVB (12900): DiB8000: added support for DiBcom IS= DB-T/ISDB-Tsb demodulator DiB8000") Signed-off-by: Zhou Qingyang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/dvb-frontends/dib8000.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-fron= tends/dib8000.c index bb02354a48b81..d67f2dd997d06 100644 --- a/drivers/media/dvb-frontends/dib8000.c +++ b/drivers/media/dvb-frontends/dib8000.c @@ -4473,8 +4473,10 @@ static struct dvb_frontend *dib8000_init(struct i2c_= adapter *i2c_adap, u8 i2c_ad =20 state->timf_default =3D cfg->pll->timf; =20 - if (dib8000_identify(&state->i2c) =3D=3D 0) + if (dib8000_identify(&state->i2c) =3D=3D 0) { + kfree(fe); goto error; + } =20 dibx000_init_i2c_master(&state->i2c_master, DIB8000, state->i2c.adap, sta= te->i2c.addr); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89B3FC433F5 for ; Tue, 25 Jan 2022 03:00:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314843AbiAYCv6 (ORCPT ); Mon, 24 Jan 2022 21:51:58 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57682 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359375AbiAXVFN (ORCPT ); Mon, 24 Jan 2022 16:05:13 -0500 Received: from smtp.kernel.org (relay.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 C574761515; Mon, 24 Jan 2022 21:05:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF7C3C36B00; Mon, 24 Jan 2022 21:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058312; bh=awbqRVaIUfFP7Xv7D24AO89VIJbRkobad3YVxWh0VP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ybrbtZuNzGf11dZ94yijVVrOfP+sob45sgPbt7gWkuHTK9WWNkzCoesglw1LjfANi ybNGTlGMWLY2ge276D3EJcfQmCGYn78/el3s7he0GcTNnXh3PevhhwTR6mPUHdWNsc 6BEYp1+b5/cCtslB097wWFUQdGRHnW2FCQzWY+h8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0248/1039] media: saa7146: mxb: Fix a NULL pointer dereference in mxb_attach() Date: Mon, 24 Jan 2022 19:33:57 +0100 Message-Id: <20220124184133.668160752@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit 0407c49ebe330333478440157c640fffd986f41b ] In mxb_attach(dev, info), saa7146_vv_init() is called to allocate a new memory for dev->vv_data. saa7146_vv_release() will be called on failure of mxb_probe(dev). There is a dereference of dev->vv_data in saa7146_vv_release(), which could lead to a NULL pointer dereference on failure of saa7146_vv_init(). Fix this bug by adding a check of saa7146_vv_init(). This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_VIDEO_MXB=3Dm show no new warnings, and our static analyzer no longer warns about this code. Fixes: 03b1930efd3c ("V4L/DVB: saa7146: fix regression of the av7110/budget= -av driver") Signed-off-by: Zhou Qingyang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/pci/saa7146/mxb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mx= b.c index 73fc901ecf3db..bf0b9b0914cd5 100644 --- a/drivers/media/pci/saa7146/mxb.c +++ b/drivers/media/pci/saa7146/mxb.c @@ -683,10 +683,16 @@ static struct saa7146_ext_vv vv_data; static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio= n_data *info) { struct mxb *mxb; + int ret; =20 DEB_EE("dev:%p\n", dev); =20 - saa7146_vv_init(dev, &vv_data); + ret =3D saa7146_vv_init(dev, &vv_data); + if (ret) { + ERR("Error in saa7146_vv_init()"); + return ret; + } + if (mxb_probe(dev)) { saa7146_vv_release(dev); return -1; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AC61C3526C for ; Tue, 25 Jan 2022 00:08:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1846419AbiAYAFO (ORCPT ); Mon, 24 Jan 2022 19:05:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381804AbiAXWlv (ORCPT ); Mon, 24 Jan 2022 17:41:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EA4FC06B597; Mon, 24 Jan 2022 13:05:16 -0800 (PST) Received: from smtp.kernel.org (relay.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 0CF086141D; Mon, 24 Jan 2022 21:05:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2511C340E5; Mon, 24 Jan 2022 21:05:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058315; bh=ipc7IAl6/w4aJnjz2NcJSJkZF0EoOSK7yODQSB9i+8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0AG/ACUcPKhA06+zI4yJQOCwCGyQ7RnziR1MRjlepTwJ+ZEgXqckI0uejChb/r1bn PvbDOT2f1VHzJmLvToIuCM3fHczdEuJ+zjq8c3uUq1wDpi5gUCIDsxOyxOQ3+H9gKG m1hkfvR3nU0yx+M/OVbYV7jKa80rvX9COWZaVaG4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Schlabbach , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0249/1039] media: si2157: Fix "warm" tuner state detection Date: Mon, 24 Jan 2022 19:33:58 +0100 Message-Id: <20220124184133.698755808@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Schlabbach [ Upstream commit a6441ea29cb2c9314654e093a1cd8020b9b851c8 ] Commit e955f959ac52 ("media: si2157: Better check for running tuner in init") completely broke the "warm" tuner detection of the si2157 driver due to a simple endian error: The Si2157 CRYSTAL_TRIM property code is 0x0402 and needs to be transmitted LSB first. However, it was inserted MSB first, causing the warm detection to always fail and spam the kernel log with tuner initialization messages each time the DVB frontend device was closed and reopened: [ 312.215682] si2157 16-0060: found a 'Silicon Labs Si2157-A30' [ 312.264334] si2157 16-0060: firmware version: 3.0.5 [ 342.248593] si2157 16-0060: found a 'Silicon Labs Si2157-A30' [ 342.295743] si2157 16-0060: firmware version: 3.0.5 [ 372.328574] si2157 16-0060: found a 'Silicon Labs Si2157-A30' [ 372.385035] si2157 16-0060: firmware version: 3.0.5 Also, the reinitializations were observed disturb _other_ tuners on multi-tuner cards such as the Hauppauge WinTV-QuadHD, leading to missed or errored packets when one of the other DVB frontend devices on that card was opened. Fix the order of the property code bytes to make the warm detection work again, also reducing the tuner initialization message in the kernel log to once per power-on, as well as fixing the interference with other tuners. Link: https://lore.kernel.org/linux-media/trinity-2a86eb9d-6264-4387-95e1-b= a7b79a4050f-1638392923493@3c-app-gmx-bap03 Fixes: e955f959ac52 ("media: si2157: Better check for running tuner in init= ") Reported-by: Robert Schlabbach Signed-off-by: Robert Schlabbach Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/tuners/si2157.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index fefb2625f6558..75ddf7ed1faff 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -90,7 +90,7 @@ static int si2157_init(struct dvb_frontend *fe) dev_dbg(&client->dev, "\n"); =20 /* Try to get Xtal trim property, to verify tuner still running */ - memcpy(cmd.args, "\x15\x00\x04\x02", 4); + memcpy(cmd.args, "\x15\x00\x02\x04", 4); cmd.wlen =3D 4; cmd.rlen =3D 4; ret =3D si2157_cmd_execute(client, &cmd); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39D61C4167D for ; Tue, 25 Jan 2022 00:08:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387657AbiAYAFF (ORCPT ); Mon, 24 Jan 2022 19:05:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382872AbiAXWlx (ORCPT ); Mon, 24 Jan 2022 17:41:53 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6371C06B5A3; Mon, 24 Jan 2022 13:05:20 -0800 (PST) Received: from smtp.kernel.org (relay.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 93995B815A3; Mon, 24 Jan 2022 21:05:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B57C1C340E5; Mon, 24 Jan 2022 21:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058318; bh=sgSscAIfs33is+A3+mF+JxJk+KOnqSxfxISmLEcfSqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WvMmriGtzShToeVfXl8+lY+OsBBh06S8mXMLxqfprRBgpwm6R9lS2dwJTb6vp7Quj vTPywwIatTjkC3SL63VDySVPumA70mQc/h6Y809fEAACBqCyzhnugks5H2VU3mq11v aaMd5PAxVKRK0DNQ4+vD7bMgYAZDE0U3jKvKXlQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lv Yunlong , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0250/1039] wireless: iwlwifi: Fix a double free in iwl_txq_dyn_alloc_dma Date: Mon, 24 Jan 2022 19:33:59 +0100 Message-Id: <20220124184133.736087294@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lv Yunlong [ Upstream commit f973795a8d19cbf3d03807704eb7c6ff65788d5a ] In iwl_txq_dyn_alloc_dma, txq->tfds is freed at first time by: iwl_txq_alloc()->goto err_free_tfds->dma_free_coherent(). But it forgot to set txq->tfds to NULL. Then the txq->tfds is freed again in iwl_txq_dyn_alloc_dma by: goto error->iwl_txq_gen2_free_memory()->dma_free_coherent(). My patch sets txq->tfds to NULL after the first free to avoid the double free. Fixes: 0cd1ad2d7fd41 ("iwlwifi: move all bus-independent TX functions to co= mmon code") Signed-off-by: Lv Yunlong Link: https://lore.kernel.org/r/20210403054755.4781-1-lyl2019@mail.ustc.edu= .cn Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/queue/tx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/intel/iwlwifi/queue/tx.c b/drivers/net/wi= reless/intel/iwlwifi/queue/tx.c index 451b060693501..0f3526b0c5b00 100644 --- a/drivers/net/wireless/intel/iwlwifi/queue/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/queue/tx.c @@ -1072,6 +1072,7 @@ int iwl_txq_alloc(struct iwl_trans *trans, struct iwl= _txq *txq, int slots_num, return 0; err_free_tfds: dma_free_coherent(trans->dev, tfd_sz, txq->tfds, txq->dma_addr); + txq->tfds =3D NULL; error: if (txq->entries && cmd_queue) for (i =3D 0; i < slots_num; i++) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6520C43219 for ; Tue, 25 Jan 2022 00:08:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358273AbiAYAE6 (ORCPT ); Mon, 24 Jan 2022 19:04:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382903AbiAXWlx (ORCPT ); Mon, 24 Jan 2022 17:41:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80346C06B5A5; Mon, 24 Jan 2022 13:05:22 -0800 (PST) Received: from smtp.kernel.org (relay.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 1F14F61361; Mon, 24 Jan 2022 21:05:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE3F6C340E5; Mon, 24 Jan 2022 21:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058321; bh=0XhSti58rGg1bd0mP0ZghW2OZEV0aA4SSU2tDfHBNT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0F+c4s/vGI8G2t5kEwm4cnjjC8Y5EVV+h7JblogqYCYiwt8xSHgFJgwHCZ7UgSMk1 L4iBVcKxkFJNufWPEotN5mkTiQ84JV4zHhwOAXQu9n3bQDQAdGZPT8Iis+l8xCrwln DqpWnQs2ozNgLpf+c8NWx0DGZ6+sfsGHuVDnV4gw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Li Hua , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.16 0251/1039] sched/rt: Try to restart rt period timer when rt runtime exceeded Date: Mon, 24 Jan 2022 19:34:00 +0100 Message-Id: <20220124184133.766926257@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hua [ Upstream commit 9b58e976b3b391c0cf02e038d53dd0478ed3013c ] When rt_runtime is modified from -1 to a valid control value, it may cause the task to be throttled all the time. Operations like the following will trigger the bug. E.g: 1. echo -1 > /proc/sys/kernel/sched_rt_runtime_us 2. Run a FIFO task named A that executes while(1) 3. echo 950000 > /proc/sys/kernel/sched_rt_runtime_us When rt_runtime is -1, The rt period timer will not be activated when task A enqueued. And then the task will be throttled after setting rt_runtime to 950,000. The task will always be throttled because the rt period timer is not activated. Fixes: d0b27fa77854 ("sched: rt-group: synchonised bandwidth period") Reported-by: Hulk Robot Signed-off-by: Li Hua Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20211203033618.11895-1-hucool.lihua@huawei.= com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/sched/rt.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index b48baaba2fc2e..7b4f4fbbb4048 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -52,11 +52,8 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 pe= riod, u64 runtime) rt_b->rt_period_timer.function =3D sched_rt_period_timer; } =20 -static void start_rt_bandwidth(struct rt_bandwidth *rt_b) +static inline void do_start_rt_bandwidth(struct rt_bandwidth *rt_b) { - if (!rt_bandwidth_enabled() || rt_b->rt_runtime =3D=3D RUNTIME_INF) - return; - raw_spin_lock(&rt_b->rt_runtime_lock); if (!rt_b->rt_period_active) { rt_b->rt_period_active =3D 1; @@ -75,6 +72,14 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b) raw_spin_unlock(&rt_b->rt_runtime_lock); } =20 +static void start_rt_bandwidth(struct rt_bandwidth *rt_b) +{ + if (!rt_bandwidth_enabled() || rt_b->rt_runtime =3D=3D RUNTIME_INF) + return; + + do_start_rt_bandwidth(rt_b); +} + void init_rt_rq(struct rt_rq *rt_rq) { struct rt_prio_array *array; @@ -1031,13 +1036,17 @@ static void update_curr_rt(struct rq *rq) =20 for_each_sched_rt_entity(rt_se) { struct rt_rq *rt_rq =3D rt_rq_of_se(rt_se); + int exceeded; =20 if (sched_rt_runtime(rt_rq) !=3D RUNTIME_INF) { raw_spin_lock(&rt_rq->rt_runtime_lock); rt_rq->rt_time +=3D delta_exec; - if (sched_rt_runtime_exceeded(rt_rq)) + exceeded =3D sched_rt_runtime_exceeded(rt_rq); + if (exceeded) resched_curr(rq); raw_spin_unlock(&rt_rq->rt_runtime_lock); + if (exceeded) + do_start_rt_bandwidth(sched_rt_bandwidth(rt_rq)); } } } @@ -2911,8 +2920,12 @@ static int sched_rt_global_validate(void) =20 static void sched_rt_do_global(void) { + unsigned long flags; + + raw_spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags); def_rt_bandwidth.rt_runtime =3D global_rt_runtime(); def_rt_bandwidth.rt_period =3D ns_to_ktime(global_rt_period()); + raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags); } =20 int sched_rt_handler(struct ctl_table *table, int write, void *buffer, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A438C433FE for ; Tue, 25 Jan 2022 03:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314910AbiAYCwE (ORCPT ); Mon, 24 Jan 2022 21:52:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58008 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442455AbiAXVF1 (ORCPT ); Mon, 24 Jan 2022 16:05:27 -0500 Received: from smtp.kernel.org (relay.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 2CD946143D; Mon, 24 Jan 2022 21:05:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDB3DC340E8; Mon, 24 Jan 2022 21:05:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058324; bh=VMKrBuXEekjkIWHWkoqddSFajUZpNRkPS7zlR8F06+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pmRH3mNghiN15OThU1rD0kGhcX7t8+Hy+hXkTI6CFv6PlLizhyiUfKTLtt3Cyfl9O D+tKRzdiRYBjYWKk+aOINHfk/urNYgfljHdiVUvSDMDOZ6dXw9CWv+CLgg+hgJTcxx 2BBdc8T6qhPB6+Fyr2JcW5gI+LNDmOvJH8frsAJM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Pratyush Yadav , Michael Walle , Sasha Levin Subject: [PATCH 5.16 0252/1039] mtd: spi-nor: Get rid of nor->page_size Date: Mon, 24 Jan 2022 19:34:01 +0100 Message-Id: <20220124184133.797138495@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus [ Upstream commit 5854d4a6cc356ba3e16d8593ac1c089a32d1759c ] nor->page_size duplicated what nor->params->page_size indicates for no good reason. page_size is a flash parameter of fixed value and it is better suited to be found in nor->params->page_size. Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav Reviewed-by: Michael Walle Link: https://lore.kernel.org/r/20211029172633.886453-5-tudor.ambarus@micro= chip.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/spi-nor/core.c | 19 +++++++++---------- drivers/mtd/spi-nor/xilinx.c | 17 ++++++++++------- include/linux/mtd/spi-nor.h | 2 -- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index cc08bd707378f..fa66dfed002d2 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -1952,6 +1952,7 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t= to, size_t len, struct spi_nor *nor =3D mtd_to_spi_nor(mtd); size_t page_offset, page_remain, i; ssize_t ret; + u32 page_size =3D nor->params->page_size; =20 dev_dbg(nor->dev, "to 0x%08x, len %zd\n", (u32)to, len); =20 @@ -1968,16 +1969,15 @@ static int spi_nor_write(struct mtd_info *mtd, loff= _t to, size_t len, * calculated with an AND operation. On the other cases we * need to do a modulus operation (more expensive). */ - if (is_power_of_2(nor->page_size)) { - page_offset =3D addr & (nor->page_size - 1); + if (is_power_of_2(page_size)) { + page_offset =3D addr & (page_size - 1); } else { uint64_t aux =3D addr; =20 - page_offset =3D do_div(aux, nor->page_size); + page_offset =3D do_div(aux, page_size); } /* the size of data remaining on the first page */ - page_remain =3D min_t(size_t, - nor->page_size - page_offset, len - i); + page_remain =3D min_t(size_t, page_size - page_offset, len - i); =20 addr =3D spi_nor_convert_addr(nor, addr); =20 @@ -3094,7 +3094,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *nam= e, * We need the bounce buffer early to read/write registers when going * through the spi-mem layer (buffers have to be DMA-able). * For spi-mem drivers, we'll reallocate a new buffer if - * nor->page_size turns out to be greater than PAGE_SIZE (which + * nor->params->page_size turns out to be greater than PAGE_SIZE (which * shouldn't happen before long since NOR pages are usually less * than 1KB) after spi_nor_scan() returns. */ @@ -3171,8 +3171,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *nam= e, mtd->flags |=3D MTD_NO_ERASE; =20 mtd->dev.parent =3D dev; - nor->page_size =3D nor->params->page_size; - mtd->writebufsize =3D nor->page_size; + mtd->writebufsize =3D nor->params->page_size; =20 if (of_property_read_bool(np, "broken-flash-reset")) nor->flags |=3D SNOR_F_BROKEN_RESET; @@ -3341,8 +3340,8 @@ static int spi_nor_probe(struct spi_mem *spimem) * and add this logic so that if anyone ever adds support for such * a NOR we don't end up with buffer overflows. */ - if (nor->page_size > PAGE_SIZE) { - nor->bouncebuf_size =3D nor->page_size; + if (nor->params->page_size > PAGE_SIZE) { + nor->bouncebuf_size =3D nor->params->page_size; devm_kfree(nor->dev, nor->bouncebuf); nor->bouncebuf =3D devm_kmalloc(nor->dev, nor->bouncebuf_size, diff --git a/drivers/mtd/spi-nor/xilinx.c b/drivers/mtd/spi-nor/xilinx.c index 1138bdbf41998..0658e47564bac 100644 --- a/drivers/mtd/spi-nor/xilinx.c +++ b/drivers/mtd/spi-nor/xilinx.c @@ -28,11 +28,12 @@ static const struct flash_info xilinx_parts[] =3D { */ static u32 s3an_convert_addr(struct spi_nor *nor, u32 addr) { + u32 page_size =3D nor->params->page_size; u32 offset, page; =20 - offset =3D addr % nor->page_size; - page =3D addr / nor->page_size; - page <<=3D (nor->page_size > 512) ? 10 : 9; + offset =3D addr % page_size; + page =3D addr / page_size; + page <<=3D (page_size > 512) ? 10 : 9; =20 return page | offset; } @@ -40,6 +41,7 @@ static u32 s3an_convert_addr(struct spi_nor *nor, u32 add= r) static int xilinx_nor_setup(struct spi_nor *nor, const struct spi_nor_hwcaps *hwcaps) { + u32 page_size; int ret; =20 ret =3D spi_nor_xread_sr(nor, nor->bouncebuf); @@ -64,10 +66,11 @@ static int xilinx_nor_setup(struct spi_nor *nor, */ if (nor->bouncebuf[0] & XSR_PAGESIZE) { /* Flash in Power of 2 mode */ - nor->page_size =3D (nor->page_size =3D=3D 264) ? 256 : 512; - nor->mtd.writebufsize =3D nor->page_size; - nor->mtd.size =3D 8 * nor->page_size * nor->info->n_sectors; - nor->mtd.erasesize =3D 8 * nor->page_size; + page_size =3D (nor->params->page_size =3D=3D 264) ? 256 : 512; + nor->params->page_size =3D page_size; + nor->mtd.writebufsize =3D page_size; + nor->mtd.size =3D 8 * page_size * nor->info->n_sectors; + nor->mtd.erasesize =3D 8 * page_size; } else { /* Flash in Default addressing mode */ nor->params->convert_addr =3D s3an_convert_addr; diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index f67457748ed84..fc90fce26e337 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -371,7 +371,6 @@ struct spi_nor_flash_parameter; * @bouncebuf_size: size of the bounce buffer * @info: SPI NOR part JEDEC MFR ID and other info * @manufacturer: SPI NOR manufacturer - * @page_size: the page size of the SPI NOR * @addr_width: number of address bytes * @erase_opcode: the opcode for erasing a sector * @read_opcode: the read opcode @@ -401,7 +400,6 @@ struct spi_nor { size_t bouncebuf_size; const struct flash_info *info; const struct spi_nor_manufacturer *manufacturer; - u32 page_size; u8 addr_width; u8 erase_opcode; u8 read_opcode; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06664C4707A for ; Mon, 24 Jan 2022 23:35:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356741AbiAXXeI (ORCPT ); Mon, 24 Jan 2022 18:34:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837266AbiAXWnh (ORCPT ); Mon, 24 Jan 2022 17:43:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2573BC06B5B3; Mon, 24 Jan 2022 13:05:30 -0800 (PST) Received: from smtp.kernel.org (relay.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 E2A1DB812A4; Mon, 24 Jan 2022 21:05:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C774C340E5; Mon, 24 Jan 2022 21:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058327; bh=600Hk523HnsrfpbtHaU+cy1D3C+NbPHA0zIhJYZR4X4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W/aQrUEW++ieWvYbgzy7sLoOLBK7IgPwr0NmLiOLi79Caq7W67fEplGND2UCxF0// p5zwvndYwqlBYs/CXm7h+5SEmzq53f8fuigknZOcdGB4vQSHxCeqAas5HHpaBkvFur deAvd2hnxejESX9HSU0IGG9gggdTIKQQPc0CtUUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Pratyush Yadav , Sasha Levin Subject: [PATCH 5.16 0253/1039] mtd: spi-nor: Fix mtd size for s3an flashes Date: Mon, 24 Jan 2022 19:34:02 +0100 Message-Id: <20220124184133.828118858@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus [ Upstream commit f656b419d41aabafb6b526abc3988dfbf2e5c1ba ] As it was before the blamed commit, s3an_nor_scan() was called after mtd size was set with params->size, and it overwrote the mtd size value with '8 * nor->page_size * nor->info->n_sectors' when XSR_PAGESIZE was set. With the introduction of s3an_post_sfdp_fixups(), we missed to update the mtd size for the s3an flashes. Fix the mtd size by updating both nor->params->size, (which will update the mtd_info size later on) and nor->mtd.size (which is used in spi_nor_set_addr_width()). Fixes: 641edddb4f43 ("mtd: spi-nor: Add s3an_post_sfdp_fixups()") Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav Link: https://lore.kernel.org/r/20211207140254.87681-2-tudor.ambarus@microc= hip.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mtd/spi-nor/xilinx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/xilinx.c b/drivers/mtd/spi-nor/xilinx.c index 0658e47564bac..0ac1d681e84d5 100644 --- a/drivers/mtd/spi-nor/xilinx.c +++ b/drivers/mtd/spi-nor/xilinx.c @@ -69,7 +69,8 @@ static int xilinx_nor_setup(struct spi_nor *nor, page_size =3D (nor->params->page_size =3D=3D 264) ? 256 : 512; nor->params->page_size =3D page_size; nor->mtd.writebufsize =3D page_size; - nor->mtd.size =3D 8 * page_size * nor->info->n_sectors; + nor->params->size =3D 8 * page_size * nor->info->n_sectors; + nor->mtd.size =3D nor->params->size; nor->mtd.erasesize =3D 8 * page_size; } else { /* Flash in Default addressing mode */ --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81CAFC433EF for ; Mon, 24 Jan 2022 23:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382851AbiAXXdQ (ORCPT ); Mon, 24 Jan 2022 18:33:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837277AbiAXWnj (ORCPT ); Mon, 24 Jan 2022 17:43:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 552FBC047CF9; Mon, 24 Jan 2022 13:05:33 -0800 (PST) Received: from smtp.kernel.org (relay.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 1D41BB812A4; Mon, 24 Jan 2022 21:05:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CD48C340E5; Mon, 24 Jan 2022 21:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058330; bh=PPsFtXyL5103MMgwded9LMMBQ4QxVuiPMKhSkyuQ6Z4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o0HMK1Ii2DiLSCLsO2VuRnVEQplkWyR9A0oApnI3fmHECbJFO7iG1Z/11KdIxV8Tl ajsLJmZtdQrbWH4vF3Z+UkY+AGY2zoyPKlRlz6Tgw3S7t4IA50MnEv/U0moIzvQzks tYP5S40vLEsqwrsz5Stc/AHzpLDE59m15xf+597s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0254/1039] ath10k: Fix the MTU size on QCA9377 SDIO Date: Mon, 24 Jan 2022 19:34:03 +0100 Message-Id: <20220124184133.858098998@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit 09b8cd69edcf2be04a781e1781e98e52a775c9ad ] On an imx6dl-pico-pi board with a QCA9377 SDIO chip, simply trying to connect via ssh to another machine causes: [ 55.824159] ath10k_sdio mmc1:0001:1: failed to transmit packet, dropping= : -12 [ 55.832169] ath10k_sdio mmc1:0001:1: failed to submit frame: -12 [ 55.838529] ath10k_sdio mmc1:0001:1: failed to push frame: -12 [ 55.905863] ath10k_sdio mmc1:0001:1: failed to transmit packet, dropping= : -12 [ 55.913650] ath10k_sdio mmc1:0001:1: failed to submit frame: -12 [ 55.919887] ath10k_sdio mmc1:0001:1: failed to push frame: -12 , leading to an ssh connection failure. One user inspected the size of frames on Wireshark and reported the followig: "I was able to narrow the issue down to the mtu. If I set the mtu for the wlan0 device to 1486 instead of 1500, the issue does not happen. The size of frames that I see on Wireshark is exactly 1500 after setting it to 1486." Clearing the HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE avoids the problem and the ssh command works successfully after that. Introduce a 'credit_size_workaround' field to ath10k_hw_params for the QCA9377 SDIO, so that the HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE is not set in this case. Tested with QCA9377 SDIO with firmware WLAN.TF.1.1.1-00061-QCATFSWPZ-1. Fixes: 2f918ea98606 ("ath10k: enable alt data of TX path for sdio") Signed-off-by: Fabio Estevam Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211124131047.713756-1-festevam@denx.de Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath10k/core.c | 19 ++++++++++++++++++- drivers/net/wireless/ath/ath10k/hw.h | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/= ath/ath10k/core.c index 5935e0973d146..5e3b4d10c1a95 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -89,6 +89,7 @@ static const struct ath10k_hw_params ath10k_hw_params_lis= t[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D false, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D true, .dynamic_sar_support =3D false, }, @@ -124,6 +125,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D false, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D true, .dynamic_sar_support =3D false, }, @@ -160,6 +162,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D false, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D false, .dynamic_sar_support =3D false, }, @@ -190,6 +193,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .num_wds_entries =3D 0x20, .uart_pin_workaround =3D true, .tx_stats_over_pktlog =3D false, + .credit_size_workaround =3D false, .bmi_large_size_download =3D true, .supports_peer_stats_info =3D true, .dynamic_sar_support =3D true, @@ -226,6 +230,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D false, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D false, .dynamic_sar_support =3D false, }, @@ -261,6 +266,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D false, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D false, .dynamic_sar_support =3D false, }, @@ -296,6 +302,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D false, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D false, .dynamic_sar_support =3D false, }, @@ -334,6 +341,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D true, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D false, .supports_peer_stats_info =3D true, .dynamic_sar_support =3D true, @@ -376,6 +384,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D false, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D false, .dynamic_sar_support =3D false, }, @@ -424,6 +433,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D false, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D false, .dynamic_sar_support =3D false, }, @@ -469,6 +479,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D false, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D false, .dynamic_sar_support =3D false, }, @@ -504,6 +515,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D false, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D false, .dynamic_sar_support =3D false, }, @@ -541,6 +553,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D true, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D false, .dynamic_sar_support =3D false, }, @@ -570,6 +583,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .ast_skid_limit =3D 0x10, .num_wds_entries =3D 0x20, .uart_pin_workaround =3D true, + .credit_size_workaround =3D true, .dynamic_sar_support =3D false, }, { @@ -611,6 +625,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D false, .hw_filter_reset_required =3D true, .fw_diag_ce_download =3D false, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D false, .dynamic_sar_support =3D false, }, @@ -639,6 +654,7 @@ static const struct ath10k_hw_params ath10k_hw_params_l= ist[] =3D { .rri_on_ddr =3D true, .hw_filter_reset_required =3D false, .fw_diag_ce_download =3D false, + .credit_size_workaround =3D false, .tx_stats_over_pktlog =3D false, .dynamic_sar_support =3D true, }, @@ -714,6 +730,7 @@ static void ath10k_send_suspend_complete(struct ath10k = *ar) =20 static int ath10k_init_sdio(struct ath10k *ar, enum ath10k_firmware_mode m= ode) { + bool mtu_workaround =3D ar->hw_params.credit_size_workaround; int ret; u32 param =3D 0; =20 @@ -731,7 +748,7 @@ static int ath10k_init_sdio(struct ath10k *ar, enum ath= 10k_firmware_mode mode) =20 param |=3D HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET; =20 - if (mode =3D=3D ATH10K_FIRMWARE_MODE_NORMAL) + if (mode =3D=3D ATH10K_FIRMWARE_MODE_NORMAL && !mtu_workaround) param |=3D HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE; else param &=3D ~HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE; diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/at= h/ath10k/hw.h index 6b03c7787e36a..591ef7416b613 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -618,6 +618,9 @@ struct ath10k_hw_params { */ bool uart_pin_workaround; =20 + /* Workaround for the credit size calculation */ + bool credit_size_workaround; + /* tx stats support over pktlog */ bool tx_stats_over_pktlog; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ACDFC41535 for ; Mon, 24 Jan 2022 21:44:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457676AbiAXVmG (ORCPT ); Mon, 24 Jan 2022 16:42:06 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58150 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343668AbiAXVFf (ORCPT ); Mon, 24 Jan 2022 16:05:35 -0500 Received: from smtp.kernel.org (relay.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 909EE60B28; Mon, 24 Jan 2022 21:05:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73449C340E5; Mon, 24 Jan 2022 21:05:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058334; bh=IXvHj7ag7A4+SqD1sdKZ1WXEP0mkxaXoEEPyd+zXsEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yy96po9LsKgR34jz7lR5etnZsSl2jaArpNG70T4Zxg2Unn0uxT0XnFZhf3j3Ga+zM 0OXIfe6W/0L4enXdS/okhwz1WuE3Jtpf3BLyWIbELE/mf2w1mWYv/KsojeGA5egk7B 9KD+2Ms2twznq/eWGZqbCBwn6i1JNsQjrH6fUkJ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Seevalamuthu Mariappan , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0255/1039] ath11k: Fix QMI file type enum value Date: Mon, 24 Jan 2022 19:34:04 +0100 Message-Id: <20220124184133.888375036@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Seevalamuthu Mariappan [ Upstream commit 18ae1ab04525507ae5528245a6df004cacd0d39a ] bdf_type for caldata in QMI_WLANFW_BDF_DOWNLOAD_REQ_V01 is wrongly sent as 1. But, expected bdf_type value for caldata and EEPROM is 2 and 3 respectively. It leads to firmware crash. Fix ath11k_qmi_file_type enum values. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00192-QCAHKSWPL_SILICONZ-1 Fixes: 336e7b53c82f ("ath11k: clean up BDF download functions") Signed-off-by: Seevalamuthu Mariappan Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1638182754-18408-1-git-send-email-quic_seev= alam@quicinc.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/qmi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/qmi.h b/drivers/net/wireless/a= th/ath11k/qmi.h index 3bb0f9ef79968..d9e95b7007653 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.h +++ b/drivers/net/wireless/ath/ath11k/qmi.h @@ -41,7 +41,7 @@ struct ath11k_base; =20 enum ath11k_qmi_file_type { ATH11K_QMI_FILE_TYPE_BDF_GOLDEN, - ATH11K_QMI_FILE_TYPE_CALDATA, + ATH11K_QMI_FILE_TYPE_CALDATA =3D 2, ATH11K_QMI_FILE_TYPE_EEPROM, ATH11K_QMI_MAX_FILE_TYPE, }; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 819DAC4332F for ; Tue, 25 Jan 2022 03:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314930AbiAYCwF (ORCPT ); Mon, 24 Jan 2022 21:52:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55816 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347659AbiAXVFl (ORCPT ); Mon, 24 Jan 2022 16:05:41 -0500 Received: from smtp.kernel.org (relay.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 51D4461330; Mon, 24 Jan 2022 21:05:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E7F0C36AF5; Mon, 24 Jan 2022 21:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058339; bh=Pdf2vX0fM8uHjw0cU5dwaYEfrFReNSKQeS1x5sAOKP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U+HtmkLAy0lua9CdWWiQ2V3bwuh1iAy+Mgsv9c/r+7XLh1i0oIXgXuvP0qNtT+J5X O61VrKojAROmOiSIiMqRKDBz8SQM+9Q4GaELe/PEZqfYAMFQ11+PBpB/hB9WW7S8IB 1OxKrHpEIBycL7z+o91MdOcKU4BBFMoFqFpXQj4I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0256/1039] Bluetooth: MGMT: Use hci_dev_test_and_{set,clear}_flag Date: Mon, 24 Jan 2022 19:34:05 +0100 Message-Id: <20220124184133.921819876@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luiz Augusto von Dentz [ Upstream commit 6f59f991b4e735323f099ac6490e725ae8c750a5 ] This make use of hci_dev_test_and_{set,clear}_flag instead of doing 2 operations in a row. Fixes: cbbdfa6f33198 ("Bluetooth: Enable controller RPA resolution using Ex= perimental feature") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/mgmt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 44683443300ce..c068d05e9616f 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -3969,10 +3969,10 @@ static int set_zero_key_func(struct sock *sk, struc= t hci_dev *hdev, #endif =20 if (hdev && use_ll_privacy(hdev) && !hdev_is_powered(hdev)) { - bool changed =3D hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY); - - hci_dev_clear_flag(hdev, HCI_ENABLE_LL_PRIVACY); + bool changed; =20 + changed =3D hci_dev_test_and_clear_flag(hdev, + HCI_ENABLE_LL_PRIVACY); if (changed) exp_ll_privacy_feature_changed(false, hdev, sk); } @@ -4067,15 +4067,15 @@ static int set_rpa_resolution_func(struct sock *sk,= struct hci_dev *hdev, val =3D !!cp->param[0]; =20 if (val) { - changed =3D !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY); - hci_dev_set_flag(hdev, HCI_ENABLE_LL_PRIVACY); + changed =3D !hci_dev_test_and_set_flag(hdev, + HCI_ENABLE_LL_PRIVACY); hci_dev_clear_flag(hdev, HCI_ADVERTISING); =20 /* Enable LL privacy + supported settings changed */ flags =3D BIT(0) | BIT(1); } else { - changed =3D hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY); - hci_dev_clear_flag(hdev, HCI_ENABLE_LL_PRIVACY); + changed =3D hci_dev_test_and_clear_flag(hdev, + HCI_ENABLE_LL_PRIVACY); =20 /* Disable LL privacy + supported settings changed */ flags =3D BIT(1); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DA61C433FE for ; Tue, 25 Jan 2022 03:00:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314962AbiAYCwH (ORCPT ); Mon, 24 Jan 2022 21:52:07 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58382 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354126AbiAXVFp (ORCPT ); Mon, 24 Jan 2022 16:05:45 -0500 Received: from smtp.kernel.org (relay.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 61A3A6141C; Mon, 24 Jan 2022 21:05:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3973CC340EC; Mon, 24 Jan 2022 21:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058342; bh=jP+0gXL/VNQriQLXfi4a6uJjR2ZLUnqmaq2pjhalBUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=StSvJKeUtlFUGgsxEo68zVwQ5kFHqKJ6jSGXkhSNusqH8yPw4McARO7ENYtXYRiav j4B3FNr5LVtgu+uSyrjWxHvHPXX1rULpcOM32jPLsHhGW1/PZCfX0RgvddqNmlh6Uh wZiAPP93cJxbyeAYPZTHr7piQrYrzyrARd7PLtPw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , Mark Chen , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0257/1039] Bluetooth: btusb: Handle download_firmware failure cases Date: Mon, 24 Jan 2022 19:34:06 +0100 Message-Id: <20220124184133.952496250@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Chen [ Upstream commit 00c0ee9850b7b0cb7c40b8daba806ae2245e59d4 ] For Mediatek chipset, it can not enabled if there are something wrong in btmtk_setup_firmware_79xx(). Thus, the process must be terminated and returned error code. Fixes: fc342c4dc4087 ("Bluetooth: btusb: Add protocol support for MediaTek = MT7921U USB devices") Co-developed-by: Sean Wang Signed-off-by: Sean Wang Signed-off-by: Mark Chen Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bluetooth/btusb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index c923c38658baa..a766660603634 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2895,6 +2895,10 @@ static int btusb_mtk_setup(struct hci_dev *hdev) "mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin", dev_id & 0xffff, (fw_version & 0xff) + 1); err =3D btusb_mtk_setup_firmware_79xx(hdev, fw_bin_name); + if (err < 0) { + bt_dev_err(hdev, "Failed to set up firmware (%d)", err); + return err; + } =20 /* It's Device EndPoint Reset Option Register */ btusb_mtk_uhw_reg_write(data, MTK_EP_RST_OPT, MTK_EP_RST_IN_OUT_OPT); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F2A3C3525A for ; Mon, 24 Jan 2022 21:44:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457750AbiAXVmO (ORCPT ); Mon, 24 Jan 2022 16:42:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58320 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354151AbiAXVFt (ORCPT ); Mon, 24 Jan 2022 16:05:49 -0500 Received: from smtp.kernel.org (relay.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 0B5F8B811FB; Mon, 24 Jan 2022 21:05:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 535D3C340E5; Mon, 24 Jan 2022 21:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058345; bh=X6EgPPABSu9qIS8VsK+/BZjQrgBbZL9LjiIth+gV+38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D02rKWm/L+Nbuqn1eioq6F07MTd1pOyGPCoHKHPjHeuvgDIdCBEveGDmQCP9Cz80d G9C/kUn925Ii7ujc+yBqc8NRthdYDgRFfXY0E9hzYSmMFFLjeKO12zBDhaS5fbj/7F /Zd19ikI7/bEEyDHbE6K1WchiV8bUQdH2IZXOzXU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Rodrigo Siqueira , Pavle Kotarac , Wayne Lin , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0258/1039] drm/amd/display: Fix bug in debugfs crc_win_update entry Date: Mon, 24 Jan 2022 19:34:07 +0100 Message-Id: <20220124184133.986450956@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wayne Lin [ Upstream commit 4bef85d4c9491415b7931407b07f24841c1e0390 ] [Why] crc_rd_wrk shouldn't be null in crc_win_update_set(). Current programming logic is inconsistent in crc_win_update_set(). [How] Initially, return if crc_rd_wrk is NULL. Later on, we can use member of crc_rd_wrk safely. Reported-by: kernel test robot Reported-by: Dan Carpenter Fixes: 9a65df193108 ("drm/amd/display: Use PSP TA to read out crc") Reviewed-by: Rodrigo Siqueira Acked-by: Pavle Kotarac Signed-off-by: Wayne Lin Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/dr= ivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 9d43ecb1f692d..f4e829ec8e108 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -2909,10 +2909,13 @@ static int crc_win_update_set(void *data, u64 val) struct amdgpu_device *adev =3D drm_to_adev(new_crtc->dev); struct crc_rd_work *crc_rd_wrk =3D adev->dm.crc_rd_wrk; =20 + if (!crc_rd_wrk) + return 0; + if (val) { spin_lock_irq(&adev_to_drm(adev)->event_lock); spin_lock_irq(&crc_rd_wrk->crc_rd_work_lock); - if (crc_rd_wrk && crc_rd_wrk->crtc) { + if (crc_rd_wrk->crtc) { old_crtc =3D crc_rd_wrk->crtc; old_acrtc =3D to_amdgpu_crtc(old_crtc); } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2654AC433F5 for ; Mon, 24 Jan 2022 21:44:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457734AbiAXVmN (ORCPT ); Mon, 24 Jan 2022 16:42:13 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58514 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354232AbiAXVFt (ORCPT ); Mon, 24 Jan 2022 16:05:49 -0500 Received: from smtp.kernel.org (relay.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 51A8161317; Mon, 24 Jan 2022 21:05:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 352E6C340E5; Mon, 24 Jan 2022 21:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058348; bh=Ae6xcvFdnKy3FwdPmiKqRI4OXQ4zHeuRYY0s4+yvNzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TpiXxUIsoAD2t9TfB9w1DZdU9sD5d3Z/hBsARP22sgwCjVRFMGXFQvBDqx2Qpaacc vpGjk5kATnBahR9sLtyITNOSBzZp0ax6OKWLiTmKlRq5LWwSzpvN6wiJqDgQ4U/Iwx qQyYaM5FDZS2K4PPQXhwneLGBGV9Np8flBJuC7Wo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Wentland , Nicholas Kazlauskas , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0259/1039] drm/amd/display: Fix out of bounds access on DNC31 stream encoder regs Date: Mon, 24 Jan 2022 19:34:08 +0100 Message-Id: <20220124184134.017744254@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicholas Kazlauskas [ Upstream commit d374d3b493215d637b9e7be12a93f22caf4c1f97 ] [Why] During dcn31_stream_encoder_create, if PHYC/D get remapped to F/G on B0 then we'll index 5 or 6 into a array of length 5 - leading to an access violation on some configs during device creation. [How] Software won't be touching PHYF/PHYG directly, so just extend the array to cover all possible engine IDs. Even if it does by try to access one of these registers by accident the offset will be 0 and we'll get a warning during the access. Fixes: 2fe9a0e1173f ("drm/amd/display: Fix DCN3 B0 DP Alt Mapping") Reviewed-by: Harry Wentland Signed-off-by: Nicholas Kazlauskas Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c b/driver= s/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c index 27afbe6ec0fee..f969ff65f802b 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c @@ -493,7 +493,8 @@ static const struct dcn31_apg_mask apg_mask =3D { SE_DCN3_REG_LIST(id)\ } =20 -static const struct dcn10_stream_enc_registers stream_enc_regs[] =3D { +/* Some encoders won't be initialized here - but they're logical, not phys= ical. */ +static const struct dcn10_stream_enc_registers stream_enc_regs[ENGINE_ID_C= OUNT] =3D { stream_enc_regs(0), stream_enc_regs(1), stream_enc_regs(2), --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEEEAC46467 for ; Mon, 24 Jan 2022 23:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1844694AbiAXXdj (ORCPT ); Mon, 24 Jan 2022 18:33:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837823AbiAXWpZ (ORCPT ); Mon, 24 Jan 2022 17:45:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A95FDC0550C6; Mon, 24 Jan 2022 13:05:52 -0800 (PST) Received: from smtp.kernel.org (relay.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 4754761444; Mon, 24 Jan 2022 21:05:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A810C340E5; Mon, 24 Jan 2022 21:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058351; bh=SyX2binZIMZmb2KlIl35FcVA0rQzcTa8I5o9poz9bXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nkpOXUrnmr1AOF7jA5DcT3wHj0SF7aQ3tzXDyY22iaKTRoL29Ab8BLBrQYVAdI20X RkutxjZO6juoGTYFgDf/gKZkZy579aoEkCtZYsaEFXUHeV2uykHmcR49eRMQVTsLXp Few/IYkWFq+aA8PqzcbIwlyc/YkoQdqB0mf+X5lg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Sasha Levin Subject: [PATCH 5.16 0260/1039] drm/msm/gpu: Dont allow zero fence_id Date: Mon, 24 Jan 2022 19:34:09 +0100 Message-Id: <20220124184134.049799468@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rob Clark [ Upstream commit ca3ffcbeb0c866d9b0cb38eaa2bd4416597b5966 ] Elsewhere we treat zero as "no fence" and __msm_gem_submit_destroy() skips removal from fence_idr. We could alternately change this to use negative values for "no fence" but I think it is more clear to not allow zero as a valid fence_id. Signed-off-by: Rob Clark Fixes: a61acbbe9cf8 ("drm/msm: Track "seqno" fences by idr") Link: https://lore.kernel.org/r/20211129182344.292609-1-robdclark@gmail.com Signed-off-by: Rob Clark Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm= _gem_submit.c index 282628d6b72c0..6cfa984dee6ae 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -881,7 +881,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *= data, * to the underlying fence. */ submit->fence_id =3D idr_alloc_cyclic(&queue->fence_idr, - submit->user_fence, 0, INT_MAX, GFP_KERNEL); + submit->user_fence, 1, INT_MAX, GFP_KERNEL); if (submit->fence_id < 0) { ret =3D submit->fence_id =3D 0; submit->fence_id =3D 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ADC1C433FE for ; Mon, 24 Jan 2022 21:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573735AbiAXVpn (ORCPT ); Mon, 24 Jan 2022 16:45:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60402 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446389AbiAXVIH (ORCPT ); Mon, 24 Jan 2022 16:08:07 -0500 Received: from smtp.kernel.org (relay.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 043B56141C; Mon, 24 Jan 2022 21:08:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8425C340E5; Mon, 24 Jan 2022 21:08:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058485; bh=R3GdNXfUaGyr8KHuooO/tDQGndAoZTEvXAMGEPVcDFc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mAC6FApmBj0yN6IWlbrksk8QfTsYuO9eKY7p1O56GhxT7snuUQfpkSQv696EqE3E7 ojivBOJjAPmqOYW+U3pAWA69zU/MMfP8PGtu3FQWLXKVIArsX7ZF0STrku7EUZIBPa PMzVwxfPTSU3vWRme0qc15sJ2/yvXmlS9wcv1hAY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernelbot , Jackie Liu , Dmitry Baryshkov , Rob Clark , Sasha Levin Subject: [PATCH 5.16 0261/1039] drm/msm/dp: displayPort driver need algorithm rational Date: Mon, 24 Jan 2022 19:34:10 +0100 Message-Id: <20220124184134.081001067@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jackie Liu [ Upstream commit 53d22794711ad630f40d59dd726bd260d77d585f ] Let's select RATIONAL with dp driver. avoid like: [...] x86_64-linux-gnu-ld: drivers/gpu/drm/msm/dp/dp_catalog.o: in function `dp_c= atalog_ctrl_config_msa': dp_catalog.c:(.text+0x57e): undefined reference to `rational_best_approxima= tion' Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support") Reported-by: kernelbot Signed-off-by: Jackie Liu Link: https://lore.kernel.org/r/20211110070950.3355597-2-liu.yun@linux.dev Signed-off-by: Dmitry Baryshkov Signed-off-by: Rob Clark Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/msm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig index 39197b4beea78..1eae5a9645f41 100644 --- a/drivers/gpu/drm/msm/Kconfig +++ b/drivers/gpu/drm/msm/Kconfig @@ -65,6 +65,7 @@ config DRM_MSM_HDMI_HDCP config DRM_MSM_DP bool "Enable DisplayPort support in MSM DRM driver" depends on DRM_MSM + select RATIONAL default y help Compile in support for DP driver in MSM DRM driver. DP external --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3FFAC4707E for ; Mon, 24 Jan 2022 23:37:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359963AbiAXXfa (ORCPT ); Mon, 24 Jan 2022 18:35:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838031AbiAXWps (ORCPT ); Mon, 24 Jan 2022 17:45:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02417C0550E7; Mon, 24 Jan 2022 13:06:18 -0800 (PST) Received: from smtp.kernel.org (relay.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 9582561320; Mon, 24 Jan 2022 21:06:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 717B8C340E7; Mon, 24 Jan 2022 21:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058377; bh=sN1MrGINuCa0tfGr5vuPfsGYIsd6lo6Uw1MmiQI9n8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zbLhdQmf2voHYFudctaja4CgnvAKC2uGO1x1/01ueEFpuxlbIKZFMXoByHbnp5dZL YXh9kA6Ui7ijtCudQNJojXo6dXv5EW2dP7qKENXx4O9Ekhfr/AcLBcZXMJEVEn7HQB nbl1j5yNJHGSE87cLKaOEH4+lcqo4zyAL0iYjkMs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neeraj Upadhyay , Frederic Weisbecker , Uladzislau Rezki , Boqun Feng , Josh Triplett , Joel Fernandes , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.16 0262/1039] rcu/exp: Mark current CPU as exp-QS in IPI loop second pass Date: Mon, 24 Jan 2022 19:34:11 +0100 Message-Id: <20220124184134.113150459@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frederic Weisbecker [ Upstream commit 81f6d49cce2d2fe507e3fddcc4a6db021d9c2e7b ] Expedited RCU grace periods invoke sync_rcu_exp_select_node_cpus(), which takes two passes over the leaf rcu_node structure's CPUs. The first pass gathers up the current CPU and CPUs that are in dynticks idle mode. The workqueue will report a quiescent state on their behalf later. The second pass sends IPIs to the rest of the CPUs, but excludes the current CPU, incorrectly assuming it has been included in the first pass's list of CPUs. Unfortunately the current CPU may have changed between the first and second pass, due to the fact that the various rcu_node structures' ->lock fields have been dropped, thus momentarily enabling preemption. This means that if the second pass's CPU was not on the first pass's list, it will be ignored completely. There will be no IPI sent to it, and there will be no reporting of quiescent states on its behalf. Unfortunately, the expedited grace period will nevertheless be waiting for that CPU to report a quiescent state, but with that CPU having no reason to believe that such a report is needed. The result will be an expedited grace period stall. Fix this by no longer excluding the current CPU from consideration during the second pass. Fixes: b9ad4d6ed18e ("rcu: Avoid self-IPI in sync_rcu_exp_select_node_cpus(= )") Reviewed-by: Neeraj Upadhyay Signed-off-by: Frederic Weisbecker Cc: Uladzislau Rezki Cc: Neeraj Upadhyay Cc: Boqun Feng Cc: Josh Triplett Cc: Joel Fernandes Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/rcu/tree_exp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h index f3947c49eee71..9e58e77b992ed 100644 --- a/kernel/rcu/tree_exp.h +++ b/kernel/rcu/tree_exp.h @@ -387,6 +387,7 @@ retry_ipi: continue; } if (get_cpu() =3D=3D cpu) { + mask_ofl_test |=3D mask; put_cpu(); continue; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E6EAC433EF for ; Mon, 24 Jan 2022 23:58:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366321AbiAXXwj (ORCPT ); Mon, 24 Jan 2022 18:52:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1584588AbiAXWro (ORCPT ); Mon, 24 Jan 2022 17:47:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42D6BC058C9B; Mon, 24 Jan 2022 13:06:52 -0800 (PST) Received: from smtp.kernel.org (relay.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 AC64561361; Mon, 24 Jan 2022 21:06:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83507C340E5; Mon, 24 Jan 2022 21:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058411; bh=09yRgeLES2N2n9ituhlM51IdST8TeNWGNqFMD706Uh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jSkyok+LoOw2Y+I9p1fxOEFFGjbnMokyGZljmiaLEkW9rT/ZTfO7hFV2xetvhyc30 7cqWkVLQzBxydhmfpdz7Q/dXYZwhIP+uu/j0bfGdKjNrdo5UJs8KR9Sf3yBP2cB59Z UyX/+J6/Y2MRu0VVTr0jdgClkHL7+POs7Kdu/51c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Loic Poulain , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0263/1039] wcn36xx: Fix max channels retrieval Date: Mon, 24 Jan 2022 19:34:12 +0100 Message-Id: <20220124184134.143694355@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Loic Poulain [ Upstream commit 09cab4308bf9b8076ee4a3c56015daf9ef9cb23e ] Kernel test robot reported:drivers/net/wireless/ath/wcn36xx/smd.c:943:33: sparse: sparse: cast truncates bits from constant value (780 becomes 80) The 'channels' field is not a simple u8 array but an array of channel_params. Using sizeof for retrieving the max number of channels is then wrong. In practice, it was not an issue, because the sizeof returned value is 780, which is truncated in min_t (u8) to 80, which is the value we expect... Fix that properly using ARRAY_SIZE instead of sizeof. Fixes: d707f812bb05 ("wcn36xx: Channel list update before hardware scan") Reported-by: kernel test robot Signed-off-by: Loic Poulain Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1638435732-14657-1-git-send-email-loic.poul= ain@linaro.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/wcn36xx/smd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/= ath/wcn36xx/smd.c index d3285a504429d..bb07740149456 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -944,7 +944,7 @@ int wcn36xx_smd_update_channel_list(struct wcn36xx *wcn= , struct cfg80211_scan_re =20 INIT_HAL_MSG((*msg_body), WCN36XX_HAL_UPDATE_CHANNEL_LIST_REQ); =20 - msg_body->num_channel =3D min_t(u8, req->n_channels, sizeof(msg_body->cha= nnels)); + msg_body->num_channel =3D min_t(u8, req->n_channels, ARRAY_SIZE(msg_body-= >channels)); for (i =3D 0; i < msg_body->num_channel; i++) { struct wcn36xx_hal_channel_param *param =3D &msg_body->channels[i]; u32 min_power =3D WCN36XX_HAL_DEFAULT_MIN_POWER; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85F14C46467 for ; Mon, 24 Jan 2022 21:44:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457881AbiAXVmZ (ORCPT ); Mon, 24 Jan 2022 16:42:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59368 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345225AbiAXVH3 (ORCPT ); Mon, 24 Jan 2022 16:07:29 -0500 Received: from smtp.kernel.org (relay.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 43A5BB80FA1; Mon, 24 Jan 2022 21:07:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58E7BC340E5; Mon, 24 Jan 2022 21:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058445; bh=nu01olkCxJuUw8m66Dp5sIuc0VHqWRn2P7ZjH/2o+yY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UdHM1mmESkkCw0UlYhMwwG2M1ihl8LdTlx0kU/OeG1xTsGJ5ETGsvtcImWc6Lt3Ej pPr1viDe2rFWxfpDIRXAjEnGIpOeHDQvmdssCvtkNyWDIRVs15bcYanjI8H2iz2iFx jcBGbjMtyi+v3Er16UvJFVw7j/Ym7uKBufm8Rvac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Abhinav Kumar , Rob Clark , Sasha Levin Subject: [PATCH 5.16 0264/1039] drm/msm/dsi: fix initialization in the bonded DSI case Date: Mon, 24 Jan 2022 19:34:13 +0100 Message-Id: <20220124184134.174887354@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 92cb1bedde9dba78d802fe2510949743a2581aed ] Commit 739b4e7756d3 ("drm/msm/dsi: Fix an error code in msm_dsi_modeset_init()") changed msm_dsi_modeset_init() to return an error code in case msm_dsi_manager_validate_current_config() returns false. However this is not an error case, but a slave DSI of the bonded DSI link. In this case msm_dsi_modeset_init() should return 0, but just skip connector and bridge initialization. To reduce possible confusion, drop the msm_dsi_manager_validate_current_config() function, and specif 'bonded && !master' condition directly in the msm_dsi_modeset_init(). Fixes: 739b4e7756d3 ("drm/msm/dsi: Fix an error code in msm_dsi_modeset_ini= t()") Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Link: https://lore.kernel.org/r/20211125180114.561278-1-dmitry.baryshkov@li= naro.org Signed-off-by: Rob Clark Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/msm/dsi/dsi.c | 10 +++++++--- drivers/gpu/drm/msm/dsi/dsi.h | 1 - drivers/gpu/drm/msm/dsi/dsi_manager.c | 17 ----------------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 75ae3008b68f4..fc280cc434943 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -215,9 +215,13 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, stru= ct drm_device *dev, goto fail; } =20 - if (!msm_dsi_manager_validate_current_config(msm_dsi->id)) { - ret =3D -EINVAL; - goto fail; + if (msm_dsi_is_bonded_dsi(msm_dsi) && + !msm_dsi_is_master_dsi(msm_dsi)) { + /* + * Do not return an eror here, + * Just skip creating encoder/connector for the slave-DSI. + */ + return 0; } =20 msm_dsi->encoder =3D encoder; diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 569c8ff062ba4..a63666e59d19e 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -82,7 +82,6 @@ int msm_dsi_manager_cmd_xfer(int id, const struct mipi_ds= i_msg *msg); bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len); int msm_dsi_manager_register(struct msm_dsi *msm_dsi); void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi); -bool msm_dsi_manager_validate_current_config(u8 id); void msm_dsi_manager_tpg_enable(void); =20 /* msm dsi */ diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/ds= i/dsi_manager.c index 20c4d650fd80c..e58ec5c1a4c37 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -649,23 +649,6 @@ fail: return ERR_PTR(ret); } =20 -bool msm_dsi_manager_validate_current_config(u8 id) -{ - bool is_bonded_dsi =3D IS_BONDED_DSI(); - - /* - * For bonded DSI, we only have one drm panel. For this - * use case, we register only one bridge/connector. - * Skip bridge/connector initialisation if it is - * slave-DSI for bonded DSI configuration. - */ - if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id)) { - DBG("Skip bridge registration for slave DSI->id: %d\n", id); - return false; - } - return true; -} - /* initialize bridge */ struct drm_bridge *msm_dsi_manager_bridge_init(u8 id) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86F23C4167E for ; Mon, 24 Jan 2022 21:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573779AbiAXVpx (ORCPT ); Mon, 24 Jan 2022 16:45:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59590 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446298AbiAXVHw (ORCPT ); Mon, 24 Jan 2022 16:07:52 -0500 Received: from smtp.kernel.org (relay.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 00552B81243; Mon, 24 Jan 2022 21:07:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AD69C340E5; Mon, 24 Jan 2022 21:07:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058466; bh=RkngHeAeVCkGRFWJ2UEUeqVNrmIJmwasCnUlDu8quqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IThzIYw3M/+hwDBfvsf76rYyknVt1zD4oeoYhGhBoBsNrE3Y6RFeqNDm4PPkC/pX5 b4R9RB4fS4IBMqmJXFUvGejSl36Y1G4fqbqpWZgRCMQXLRoSolOKl40z2D1NpGK0is C7hrGUQWL5/FNnpZ0+BaExEinUHwF4386R3rgPeY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , TOTE Robot , Brian Norris , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0265/1039] mwifiex: Fix possible ABBA deadlock Date: Mon, 24 Jan 2022 19:34:14 +0100 Message-Id: <20220124184134.207274633@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit 1b8bb8919ef81bfc8873d223b9361f1685f2106d ] Quoting Jia-Ju Bai : mwifiex_dequeue_tx_packet() spin_lock_bh(&priv->wmm.ra_list_spinlock); --> Line 1432 (Lock A) mwifiex_send_addba() spin_lock_bh(&priv->sta_list_spinlock); --> Line 608 (Lock B) mwifiex_process_sta_tx_pause() spin_lock_bh(&priv->sta_list_spinlock); --> Line 398 (Lock B) mwifiex_update_ralist_tx_pause() spin_lock_bh(&priv->wmm.ra_list_spinlock); --> Line 941 (Lock A) Similar report for mwifiex_process_uap_tx_pause(). While the locking expectations in this driver are a bit unclear, the Fixed commit only intended to protect the sta_ptr, so we can drop the lock as soon as we're done with it. IIUC, this deadlock cannot actually happen, because command event processing (which calls mwifiex_process_sta_tx_pause()) is sequentialized with TX packet processing (e.g., mwifiex_dequeue_tx_packet()) via the main loop (mwifiex_main_process()). But it's good not to leave this potential issue lurking. Fixes: f0f7c2275fb9 ("mwifiex: minor cleanups w/ sta_list_spinlock in cfg80= 211.c") Cc: Douglas Anderson Reported-by: TOTE Robot Link: https://lore.kernel.org/linux-wireless/0e495b14-efbb-e0da-37bd-af6bd6= 77ee2c@gmail.com/ Signed-off-by: Brian Norris Reviewed-by: Douglas Anderson Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YaV0pllJ5p/EuUat@google.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/marvell/mwifiex/sta_event.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net= /wireless/marvell/mwifiex/sta_event.c index 68c63268e2e6b..2b2e6e0166e14 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -365,10 +365,12 @@ static void mwifiex_process_uap_tx_pause(struct mwifi= ex_private *priv, sta_ptr =3D mwifiex_get_sta_entry(priv, tp->peermac); if (sta_ptr && sta_ptr->tx_pause !=3D tp->tx_pause) { sta_ptr->tx_pause =3D tp->tx_pause; + spin_unlock_bh(&priv->sta_list_spinlock); mwifiex_update_ralist_tx_pause(priv, tp->peermac, tp->tx_pause); + } else { + spin_unlock_bh(&priv->sta_list_spinlock); } - spin_unlock_bh(&priv->sta_list_spinlock); } } =20 @@ -400,11 +402,13 @@ static void mwifiex_process_sta_tx_pause(struct mwifi= ex_private *priv, sta_ptr =3D mwifiex_get_sta_entry(priv, tp->peermac); if (sta_ptr && sta_ptr->tx_pause !=3D tp->tx_pause) { sta_ptr->tx_pause =3D tp->tx_pause; + spin_unlock_bh(&priv->sta_list_spinlock); mwifiex_update_ralist_tx_pause(priv, tp->peermac, tp->tx_pause); + } else { + spin_unlock_bh(&priv->sta_list_spinlock); } - spin_unlock_bh(&priv->sta_list_spinlock); } } } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C0B9C2BA4C for ; Mon, 24 Jan 2022 21:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573749AbiAXVpq (ORCPT ); Mon, 24 Jan 2022 16:45:46 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59654 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446321AbiAXVHw (ORCPT ); Mon, 24 Jan 2022 16:07:52 -0500 Received: from smtp.kernel.org (relay.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 3AD77B812A4; Mon, 24 Jan 2022 21:07:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DD39C340E5; Mon, 24 Jan 2022 21:07:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058470; bh=KcnNIjP6Rz+rHunKoXuupK88UPEDoviX5kS4HSHMa6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pyuu7nsxmi7ZJDdcmi4SS2H/UbkpTuCrzfex8B8HZyOkmK9zORobpaDnY/Cz+/Aik JDu9O/bEMFIXEvqH7oqrulsMLwsPh9pXerF/ru/4SPsG8ABkSeJzj+IluFN1q49AxP fEq7YP+hdfaRHQqZujwNyTwUe3wOnZ6UCoSOz/5c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Steffen Klassert , Sasha Levin Subject: [PATCH 5.16 0266/1039] xfrm: fix a small bug in xfrm_sa_len() Date: Mon, 24 Jan 2022 19:34:15 +0100 Message-Id: <20220124184134.247461826@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit 7770a39d7c63faec6c4f33666d49a8cb664d0482 ] copy_user_offload() will actually push a struct struct xfrm_user_offload, which is different than (struct xfrm_state *)->xso (struct xfrm_state_offload) Fixes: d77e38e612a01 ("xfrm: Add an IPsec hardware offloading API") Signed-off-by: Eric Dumazet Cc: Steffen Klassert Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/xfrm/xfrm_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 7c36cc1f3d79c..0a2d2bae28316 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -3058,7 +3058,7 @@ static inline unsigned int xfrm_sa_len(struct xfrm_st= ate *x) if (x->props.extra_flags) l +=3D nla_total_size(sizeof(x->props.extra_flags)); if (x->xso.dev) - l +=3D nla_total_size(sizeof(x->xso)); + l +=3D nla_total_size(sizeof(struct xfrm_user_offload)); if (x->props.smark.v | x->props.smark.m) { l +=3D nla_total_size(sizeof(x->props.smark.v)); l +=3D nla_total_size(sizeof(x->props.smark.m)); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F172C4332F for ; Mon, 24 Jan 2022 21:46:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446705AbiAXVoM (ORCPT ); Mon, 24 Jan 2022 16:44:12 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58514 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446333AbiAXVH4 (ORCPT ); Mon, 24 Jan 2022 16:07:56 -0500 Received: from smtp.kernel.org (relay.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 AA35461320; Mon, 24 Jan 2022 21:07:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E59FC340E5; Mon, 24 Jan 2022 21:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058473; bh=mogSOkaOkrrWOdetxmlOv7cZA4WGTZhATUoGO5ISBOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bwysiofRA47rJrF6DC7TYnewxQIEkx2vb020Fmsv7+Nwvk5Q5ohbYraL+0WvW1h6h 8FHc2Lmxrvtyhco6NYYKu+kJ0pZf7XFMmA6XxPQvjjg9OnA8IgV8m+tza0UgPDvizq 6oHVEMiAFpK+IW3X6rd+tWfjPdY3Xm37qNvTB3ZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Dave Hansen , Borislav Petkov , Sasha Levin Subject: [PATCH 5.16 0267/1039] x86/uaccess: Move variable into switch case statement Date: Mon, 24 Jan 2022 19:34:16 +0100 Message-Id: <20220124184134.279284920@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kees Cook [ Upstream commit 61646ca83d3889696f2772edaff122dd96a2935e ] When building with automatic stack variable initialization, GCC 12 complains about variables defined outside of switch case statements. Move the variable into the case that uses it, which silences the warning: ./arch/x86/include/asm/uaccess.h:317:23: warning: statement will never be e= xecuted [-Wswitch-unreachable] 317 | unsigned char x_u8__; \ | ^~~~~~ Fixes: 865c50e1d279 ("x86/uaccess: utilize CONFIG_CC_HAS_ASM_GOTO_OUTPUT") Signed-off-by: Kees Cook Signed-off-by: Dave Hansen Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/20211209043456.1377875-1-keescook@chromium.= org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/include/asm/uaccess.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 33a68407def3f..8ab9e79abb2b4 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -314,11 +314,12 @@ do { \ do { \ __chk_user_ptr(ptr); \ switch (size) { \ - unsigned char x_u8__; \ - case 1: \ + case 1: { \ + unsigned char x_u8__; \ __get_user_asm(x_u8__, ptr, "b", "=3Dq", label); \ (x) =3D x_u8__; \ break; \ + } \ case 2: \ __get_user_asm(x, ptr, "w", "=3Dr", label); \ break; \ --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF874C46467 for ; Mon, 24 Jan 2022 23:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360444AbiAXXgr (ORCPT ); Mon, 24 Jan 2022 18:36:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1839744AbiAXWvx (ORCPT ); Mon, 24 Jan 2022 17:51:53 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B97FBC09D9F0; Mon, 24 Jan 2022 13:07:58 -0800 (PST) Received: from smtp.kernel.org (relay.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 81A99B811FB; Mon, 24 Jan 2022 21:07:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FFE3C340E5; Mon, 24 Jan 2022 21:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058476; bh=iOwbgegqT26I6orDq8beuiWOLFK1+X2f+sFwzIToXCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dtLpkQMbi+nYL042ZCwqzyVpzMok3cY3EZ7z3wnggWVnWz86UiTAYV5P1yckulCOj O+9BIY+F3inWjW1HxsjQssMX77bEWSEe23IXcXGXPkALj2P2EMexW7WiWiKh0Ms2PA LJzE6IZJ+Ubwn6y88eNPE+i9A55OiaGLnw01mqC4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuyi Cheng , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.16 0268/1039] libbpf: Add "bool skipped" to struct bpf_map Date: Mon, 24 Jan 2022 19:34:17 +0100 Message-Id: <20220124184134.312014386@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Shuyi Cheng [ Upstream commit 229fae38d0fc0d6ff58d57cbeb1432da55e58d4f ] Fix error: "failed to pin map: Bad file descriptor, path: /sys/fs/bpf/_rodata_str1_1." In the old kernel, the global data map will not be created, see [0]. So we should skip the pinning of the global data map to avoid bpf_object__pin_maps returning error. Therefore, when the map is not created, we mark =E2=80=9Cmap->skipped" as true and then check during reloc= ation and during pinning. Fixes: 16e0c35c6f7a ("libbpf: Load global data maps lazily on legacy kernel= s") Signed-off-by: Shuyi Cheng Signed-off-by: Andrii Nakryiko Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/libbpf.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 4050a0f8dad66..fd25e30e70cc2 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -400,6 +400,7 @@ struct bpf_map { char *pin_path; bool pinned; bool reused; + bool skipped; __u64 map_extra; }; =20 @@ -5003,8 +5004,10 @@ bpf_object__create_maps(struct bpf_object *obj) * kernels. */ if (bpf_map__is_internal(map) && - !kernel_supports(obj, FEAT_GLOBAL_DATA)) + !kernel_supports(obj, FEAT_GLOBAL_DATA)) { + map->skipped =3D true; continue; + } =20 retried =3D false; retry: @@ -5607,8 +5610,7 @@ bpf_object__relocate_data(struct bpf_object *obj, str= uct bpf_program *prog) } else { const struct bpf_map *map =3D &obj->maps[relo->map_idx]; =20 - if (bpf_map__is_internal(map) && - !kernel_supports(obj, FEAT_GLOBAL_DATA)) { + if (map->skipped) { pr_warn("prog '%s': relo #%d: kernel doesn't support global data\n", prog->name, i); return -ENOTSUP; @@ -7733,6 +7735,9 @@ int bpf_object__pin_maps(struct bpf_object *obj, cons= t char *path) char *pin_path =3D NULL; char buf[PATH_MAX]; =20 + if (map->skipped) + continue; + if (path) { int len; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B628C35273 for ; Mon, 24 Jan 2022 23:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360464AbiAXXgt (ORCPT ); Mon, 24 Jan 2022 18:36:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1839748AbiAXWvx (ORCPT ); Mon, 24 Jan 2022 17:51:53 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9396C09D9F7; Mon, 24 Jan 2022 13:08:00 -0800 (PST) Received: from smtp.kernel.org (relay.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 71B50B81057; Mon, 24 Jan 2022 21:08:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1ECFC340E5; Mon, 24 Jan 2022 21:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058479; bh=485Pel/umrmGTI7pbf0TizhUtAcoT/WJdPbsQcA5Gb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=viZIaBjaN+YzeMo/jKDS89p2LZG23lpMRVS/nn9k4XoShFJDDnatlkTlDPCgL6gsF qYrLWJLRpqGKxY7YGEjHRsKm6uZhLe3mvoJYbzlU5ibqo/UP2nL327ascOqDJaEZMO /Y7/dnw3Oi1QvvSc2Z+Tm3vNdvMXBzzsvFgpAFCE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anders Roxell , Christian Brauner , Shuah Khan , Sasha Levin Subject: [PATCH 5.16 0269/1039] selftests: clone3: clone3: add case CLONE3_ARGS_NO_TEST Date: Mon, 24 Jan 2022 19:34:18 +0100 Message-Id: <20220124184134.343027218@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Anders Roxell [ Upstream commit a531b0c23c0fc68ad758cc31a74cf612a4dafeb0 ] Building selftests/clone3 with clang warns about enumeration not handled in switch case: clone3.c:54:10: warning: enumeration value 'CLONE3_ARGS_NO_TEST' not handle= d in switch [-Wswitch] switch (test_mode) { ^ Add the missing switch case with a comment. Fixes: 17a810699c18 ("selftests: add tests for clone3()") Signed-off-by: Anders Roxell Acked-by: Christian Brauner Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/clone3/clone3.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/clone3/clone3.c b/tools/testing/selfte= sts/clone3/clone3.c index 42be3b9258301..076cf4325f783 100644 --- a/tools/testing/selftests/clone3/clone3.c +++ b/tools/testing/selftests/clone3/clone3.c @@ -52,6 +52,12 @@ static int call_clone3(uint64_t flags, size_t size, enum= test_mode test_mode) size =3D sizeof(struct __clone_args); =20 switch (test_mode) { + case CLONE3_ARGS_NO_TEST: + /* + * Uses default 'flags' and 'SIGCHLD' + * assignment. + */ + break; case CLONE3_ARGS_ALL_0: args.flags =3D 0; args.exit_signal =3D 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 362BCC4707E for ; Mon, 24 Jan 2022 21:46:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378860AbiAXVoD (ORCPT ); Mon, 24 Jan 2022 16:44:03 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59782 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446371AbiAXVIF (ORCPT ); Mon, 24 Jan 2022 16:08:05 -0500 Received: from smtp.kernel.org (relay.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 A35BDB81057; Mon, 24 Jan 2022 21:08:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5D10C340EB; Mon, 24 Jan 2022 21:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058482; bh=qNBywZO7Q40NSzdO4zwsqXT66WdGUyNv/559Vflwzns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l/kWXL/BG8VMaz1iVrc2MA9HIPzsyu0WB34PN2dc7gTw4UXYhRDtub7MWYeXcEGCC +7OxYmbabE6O7l4waKlgNBHiJY3jelKhIP5IFFY8h2dqm0jUkVnXHgaJ99cLh7A36y nyVusdeBXhr/uqTx1hElvzcwT0dwkd9t+trxargg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , Shuah Khan , Sasha Levin Subject: [PATCH 5.16 0270/1039] selftests: harness: avoid false negatives if test has no ASSERTs Date: Mon, 24 Jan 2022 19:34:19 +0100 Message-Id: <20220124184134.380131577@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 3abedf4646fdc0036fcb8ebbc3b600667167fafe ] Test can fail either immediately when ASSERT() failed or at the end if one or more EXPECT() was not met. The exact return code is decided based on the number of successful ASSERT()s. If test has no ASSERT()s, however, the return code will be 0, as if the test did not fail. Start counting ASSERT()s from 1. Fixes: 369130b63178 ("selftests: Enhance kselftest_harness.h to print which= assert failed") Signed-off-by: Jakub Kicinski Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/kselftest_harness.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/se= lftests/kselftest_harness.h index ae0f0f33b2a6e..79a182cfa43ad 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -969,7 +969,7 @@ void __run_test(struct __fixture_metadata *f, t->passed =3D 1; t->skip =3D 0; t->trigger =3D 0; - t->step =3D 0; + t->step =3D 1; t->no_print =3D 0; memset(t->results->reason, 0, sizeof(t->results->reason)); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 974F5C4332F for ; Mon, 24 Jan 2022 23:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359812AbiAXXfA (ORCPT ); Mon, 24 Jan 2022 18:35:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838084AbiAXWpw (ORCPT ); Mon, 24 Jan 2022 17:45:52 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF01EC0550F3; Mon, 24 Jan 2022 13:06:22 -0800 (PST) Received: from smtp.kernel.org (relay.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 3A796B81142; Mon, 24 Jan 2022 21:06:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A4F4C340E8; Mon, 24 Jan 2022 21:06:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058380; bh=f21MzGFvooadYexLUcwxb1T6t4IyhWjyJE0ILpkgpd8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jH6hmUVDhaWDu7YwmiQg+VHVb1c7XtnKVGbc/arLMIRuf+5/bJErMC324d3rfwlrj QjARalrp/S6m8nvVieTNArxCcErgfLT6OXF8Az6HPPiHrYIWRwnDa1o6WdYvNkGCLC rMTf9uC45wpcvKICEeBenvtve1SqYEzOzOlgsDKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Toromanoff , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0271/1039] crypto: stm32/cryp - fix CTR counter carry Date: Mon, 24 Jan 2022 19:34:20 +0100 Message-Id: <20220124184134.410347685@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Toromanoff [ Upstream commit 41c76690b0990efacd15d35cfb4e77318cd80ebb ] STM32 CRYP hardware doesn't manage CTR counter bigger than max U32, as a workaround, at each block the current IV is saved, if the saved IV lower u32 is 0xFFFFFFFF, the full IV is manually incremented, and set in hardware. Fixes: bbb2832620ac ("crypto: stm32 - Fix sparse warnings") Signed-off-by: Nicolas Toromanoff Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/stm32/stm32-cryp.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32= -cryp.c index 7389a0536ff02..d13b262b36252 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -163,7 +163,7 @@ struct stm32_cryp { struct scatter_walk in_walk; struct scatter_walk out_walk; =20 - u32 last_ctr[4]; + __be32 last_ctr[4]; u32 gcm_ctr; }; =20 @@ -1217,27 +1217,26 @@ static void stm32_cryp_check_ctr_counter(struct stm= 32_cryp *cryp) { u32 cr; =20 - if (unlikely(cryp->last_ctr[3] =3D=3D 0xFFFFFFFF)) { - cryp->last_ctr[3] =3D 0; - cryp->last_ctr[2]++; - if (!cryp->last_ctr[2]) { - cryp->last_ctr[1]++; - if (!cryp->last_ctr[1]) - cryp->last_ctr[0]++; - } + if (unlikely(cryp->last_ctr[3] =3D=3D cpu_to_be32(0xFFFFFFFF))) { + /* + * In this case, we need to increment manually the ctr counter, + * as HW doesn't handle the U32 carry. + */ + crypto_inc((u8 *)cryp->last_ctr, sizeof(cryp->last_ctr)); =20 cr =3D stm32_cryp_read(cryp, CRYP_CR); stm32_cryp_write(cryp, CRYP_CR, cr & ~CR_CRYPEN); =20 - stm32_cryp_hw_write_iv(cryp, (__be32 *)cryp->last_ctr); + stm32_cryp_hw_write_iv(cryp, cryp->last_ctr); =20 stm32_cryp_write(cryp, CRYP_CR, cr); } =20 - cryp->last_ctr[0] =3D stm32_cryp_read(cryp, CRYP_IV0LR); - cryp->last_ctr[1] =3D stm32_cryp_read(cryp, CRYP_IV0RR); - cryp->last_ctr[2] =3D stm32_cryp_read(cryp, CRYP_IV1LR); - cryp->last_ctr[3] =3D stm32_cryp_read(cryp, CRYP_IV1RR); + /* The IV registers are BE */ + cryp->last_ctr[0] =3D cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV0LR)); + cryp->last_ctr[1] =3D cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV0RR)); + cryp->last_ctr[2] =3D cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV1LR)); + cryp->last_ctr[3] =3D cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV1RR)); } =20 static bool stm32_cryp_irq_read_data(struct stm32_cryp *cryp) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97E29C3526F for ; Mon, 24 Jan 2022 23:37:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578696AbiAXXef (ORCPT ); Mon, 24 Jan 2022 18:34:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838090AbiAXWpw (ORCPT ); Mon, 24 Jan 2022 17:45:52 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C551C0550F9; Mon, 24 Jan 2022 13:06:24 -0800 (PST) Received: from smtp.kernel.org (relay.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 23295B81142; Mon, 24 Jan 2022 21:06:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EAE5C340E5; Mon, 24 Jan 2022 21:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058382; bh=1Xu0fY9+VgGKTdVcFCdBa37F4Om7SvBXrvrP+wodbko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JOK//x8C42s7VOPLUhvzGQ/irofn7dcla5NAQwdovIm/9jzC4hZnvqnOK05uXOMD/ jRWzUsvXyAtIGuPJA67SuLES7uT8kX9wwJsDRlok0mIpY8sc0YPVyM/66l+wSC7ORT ArPlrhgKlwpT6cF5yp6sa66dvr4UZUol9FlLwNuA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Toromanoff , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0272/1039] crypto: stm32/cryp - fix xts and race condition in crypto_engine requests Date: Mon, 24 Jan 2022 19:34:21 +0100 Message-Id: <20220124184134.442878223@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Toromanoff [ Upstream commit d703c7a994ee34b7fa89baf21631fca0aa9f17fc ] Don't erase key: If key is erased before the crypto_finalize_.*_request() call, some pending process will run with a key=3D{ 0 }. Moreover if the key is reset at end of request, it breaks xts chaining mode, as for last xts block (in case input len is not a multiple of block) a new AES request is started without calling again set_key(). Fixes: 9e054ec21ef8 ("crypto: stm32 - Support for STM32 CRYP crypto module") Signed-off-by: Nicolas Toromanoff Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/stm32/stm32-cryp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32= -cryp.c index d13b262b36252..e2bcc4f98b0ae 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -674,8 +674,6 @@ static void stm32_cryp_finish_req(struct stm32_cryp *cr= yp, int err) else crypto_finalize_skcipher_request(cryp->engine, cryp->req, err); - - memset(cryp->ctx->key, 0, cryp->ctx->keylen); } =20 static int stm32_cryp_cpu_start(struct stm32_cryp *cryp) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A71A0C433FE for ; Mon, 24 Jan 2022 23:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359920AbiAXXfU (ORCPT ); Mon, 24 Jan 2022 18:35:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838097AbiAXWpw (ORCPT ); Mon, 24 Jan 2022 17:45:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FE82C0550FF; Mon, 24 Jan 2022 13:06:27 -0800 (PST) Received: from smtp.kernel.org (relay.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 92E9861447; Mon, 24 Jan 2022 21:06:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D187C36AEB; Mon, 24 Jan 2022 21:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058386; bh=po8e2/5PZlaR1L4ebFA+7hbiUKq4RTDZucpG7BuzS80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yuqmTIgW4DDsb+70ETcd3fdfaYAEq112GjNiinJb7KlkbBQ+zXp2uENP+vm7E/zSo 1msTwTbNcorGZlLV9kiZORqwJlv6TTFAaspj3rKZ7fP94/BStw8Cwmz1keD9hk5EZx ipjY6laBrhz242czJDJ60Ngr+huIeZHU41QH99vI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Toromanoff , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0273/1039] crypto: stm32/cryp - check early input data Date: Mon, 24 Jan 2022 19:34:22 +0100 Message-Id: <20220124184134.471639864@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Toromanoff [ Upstream commit 39e6e699c7fb92bdb2617b596ca4a4ea35c5d2a7 ] Some auto tests failed because driver wasn't returning the expected error with some input size/iv value/tag size. Now: Return 0 early for empty buffer. (We don't need to start the engine for an empty input buffer). Accept any valid authsize for gcm(aes). Return -EINVAL if iv for ccm(aes) is invalid. Return -EINVAL if buffer size is a not a multiple of algorithm block size. Fixes: 9e054ec21ef8 ("crypto: stm32 - Support for STM32 CRYP crypto module") Signed-off-by: Nicolas Toromanoff Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/stm32/stm32-cryp.c | 114 +++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32= -cryp.c index e2bcc4f98b0ae..fd7fb73a4d450 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -799,7 +799,20 @@ static int stm32_cryp_aes_aead_setkey(struct crypto_ae= ad *tfm, const u8 *key, static int stm32_cryp_aes_gcm_setauthsize(struct crypto_aead *tfm, unsigned int authsize) { - return authsize =3D=3D AES_BLOCK_SIZE ? 0 : -EINVAL; + switch (authsize) { + case 4: + case 8: + case 12: + case 13: + case 14: + case 15: + case 16: + break; + default: + return -EINVAL; + } + + return 0; } =20 static int stm32_cryp_aes_ccm_setauthsize(struct crypto_aead *tfm, @@ -823,31 +836,61 @@ static int stm32_cryp_aes_ccm_setauthsize(struct cryp= to_aead *tfm, =20 static int stm32_cryp_aes_ecb_encrypt(struct skcipher_request *req) { + if (req->cryptlen % AES_BLOCK_SIZE) + return -EINVAL; + + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_AES | FLG_ECB | FLG_ENCRYPT); } =20 static int stm32_cryp_aes_ecb_decrypt(struct skcipher_request *req) { + if (req->cryptlen % AES_BLOCK_SIZE) + return -EINVAL; + + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_AES | FLG_ECB); } =20 static int stm32_cryp_aes_cbc_encrypt(struct skcipher_request *req) { + if (req->cryptlen % AES_BLOCK_SIZE) + return -EINVAL; + + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_AES | FLG_CBC | FLG_ENCRYPT); } =20 static int stm32_cryp_aes_cbc_decrypt(struct skcipher_request *req) { + if (req->cryptlen % AES_BLOCK_SIZE) + return -EINVAL; + + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_AES | FLG_CBC); } =20 static int stm32_cryp_aes_ctr_encrypt(struct skcipher_request *req) { + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_AES | FLG_CTR | FLG_ENCRYPT); } =20 static int stm32_cryp_aes_ctr_decrypt(struct skcipher_request *req) { + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_AES | FLG_CTR); } =20 @@ -861,53 +904,122 @@ static int stm32_cryp_aes_gcm_decrypt(struct aead_re= quest *req) return stm32_cryp_aead_crypt(req, FLG_AES | FLG_GCM); } =20 +static inline int crypto_ccm_check_iv(const u8 *iv) +{ + /* 2 <=3D L <=3D 8, so 1 <=3D L' <=3D 7. */ + if (iv[0] < 1 || iv[0] > 7) + return -EINVAL; + + return 0; +} + static int stm32_cryp_aes_ccm_encrypt(struct aead_request *req) { + int err; + + err =3D crypto_ccm_check_iv(req->iv); + if (err) + return err; + return stm32_cryp_aead_crypt(req, FLG_AES | FLG_CCM | FLG_ENCRYPT); } =20 static int stm32_cryp_aes_ccm_decrypt(struct aead_request *req) { + int err; + + err =3D crypto_ccm_check_iv(req->iv); + if (err) + return err; + return stm32_cryp_aead_crypt(req, FLG_AES | FLG_CCM); } =20 static int stm32_cryp_des_ecb_encrypt(struct skcipher_request *req) { + if (req->cryptlen % DES_BLOCK_SIZE) + return -EINVAL; + + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_DES | FLG_ECB | FLG_ENCRYPT); } =20 static int stm32_cryp_des_ecb_decrypt(struct skcipher_request *req) { + if (req->cryptlen % DES_BLOCK_SIZE) + return -EINVAL; + + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_DES | FLG_ECB); } =20 static int stm32_cryp_des_cbc_encrypt(struct skcipher_request *req) { + if (req->cryptlen % DES_BLOCK_SIZE) + return -EINVAL; + + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_DES | FLG_CBC | FLG_ENCRYPT); } =20 static int stm32_cryp_des_cbc_decrypt(struct skcipher_request *req) { + if (req->cryptlen % DES_BLOCK_SIZE) + return -EINVAL; + + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_DES | FLG_CBC); } =20 static int stm32_cryp_tdes_ecb_encrypt(struct skcipher_request *req) { + if (req->cryptlen % DES_BLOCK_SIZE) + return -EINVAL; + + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_TDES | FLG_ECB | FLG_ENCRYPT); } =20 static int stm32_cryp_tdes_ecb_decrypt(struct skcipher_request *req) { + if (req->cryptlen % DES_BLOCK_SIZE) + return -EINVAL; + + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_TDES | FLG_ECB); } =20 static int stm32_cryp_tdes_cbc_encrypt(struct skcipher_request *req) { + if (req->cryptlen % DES_BLOCK_SIZE) + return -EINVAL; + + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_TDES | FLG_CBC | FLG_ENCRYPT); } =20 static int stm32_cryp_tdes_cbc_decrypt(struct skcipher_request *req) { + if (req->cryptlen % DES_BLOCK_SIZE) + return -EINVAL; + + if (req->cryptlen =3D=3D 0) + return 0; + return stm32_cryp_crypt(req, FLG_TDES | FLG_CBC); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3B0DC2BA4C for ; Tue, 25 Jan 2022 03:00:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315176AbiAYCwo (ORCPT ); Mon, 24 Jan 2022 21:52:44 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59086 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391795AbiAXVGb (ORCPT ); Mon, 24 Jan 2022 16:06:31 -0500 Received: from smtp.kernel.org (relay.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 9C22F60C17; Mon, 24 Jan 2022 21:06:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86F38C340E8; Mon, 24 Jan 2022 21:06:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058389; bh=SW3LaOTkedTk7adcIdVcisEywFdafNAxlRBLboYCbE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uqJv7ijdE1fVsB4tvS7WFyLxNF7dKMXAKHb0jEfRxol3c8FOJHIFY9oWVprM7QWS+ eW2HEL5LFbGKDZaypadQ/54IE6cTisc93Nk0/eaLbnt3qv7Y1D+LeMh506d4yxK6+n 8KPALjCBoQwSStgPhMx1pexMnvhd70cqpYUEquWU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Nicolas Toromanoff , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0274/1039] crypto: stm32/cryp - fix double pm exit Date: Mon, 24 Jan 2022 19:34:23 +0100 Message-Id: <20220124184134.501263197@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Toromanoff [ Upstream commit 6c12e742785bf9333faf60bfb96575bdd763448e ] Delete extraneous lines in probe error handling code: pm was disabled twice. Fixes: 65f9aa36ee47 ("crypto: stm32/cryp - Add power management support") Reported-by: Marek Vasut Signed-off-by: Nicolas Toromanoff Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/stm32/stm32-cryp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32= -cryp.c index fd7fb73a4d450..061db567908ae 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -2134,8 +2134,6 @@ err_engine1: list_del(&cryp->list); spin_unlock(&cryp_list.lock); =20 - pm_runtime_disable(dev); - pm_runtime_put_noidle(dev); pm_runtime_disable(dev); pm_runtime_put_noidle(dev); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1AEDC4332F for ; Mon, 24 Jan 2022 23:35:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386180AbiAXXeZ (ORCPT ); Mon, 24 Jan 2022 18:34:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838147AbiAXWp5 (ORCPT ); Mon, 24 Jan 2022 17:45:57 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75209C058C85; Mon, 24 Jan 2022 13:06:34 -0800 (PST) Received: from smtp.kernel.org (relay.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 3CD03B81188; Mon, 24 Jan 2022 21:06:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F6B7C340E7; Mon, 24 Jan 2022 21:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058392; bh=Im0F7TeBzMVqLpyKF0wuta0Ts2zCgNoPJI3BvjCBY7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PhwSalTul+K2/x85M2gQLqwQal/tWUV+NJBWjJtusaDX9dId9AY9Yw19AZFsxVPxc /8vQpRliXZiyBQPrU2YSiORsqiNS6fnduCsJ/jr3z5XxeLffCvSofobxxcNsShX969 ogO+D9ny4bvluqMZxQhZZpwjPdLymNHjqmLBx0aQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Toromanoff , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0275/1039] crypto: stm32/cryp - fix lrw chaining mode Date: Mon, 24 Jan 2022 19:34:24 +0100 Message-Id: <20220124184134.532045141@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Toromanoff [ Upstream commit fa97dc2d48b476ea98199d808d3248d285987e99 ] This fixes the lrw autotest if lrw uses the CRYP as the AES block cipher provider (as ecb(aes)). At end of request, CRYP should not update the IV in case of ECB chaining mode. Indeed the ECB chaining mode never uses the IV, but the software LRW chaining mode uses the IV field as a counter and due to the (unexpected) update done by CRYP while the AES block process, the counter get a wrong value when the IV overflow. Fixes: 5f49f18d27cd ("crypto: stm32/cryp - update to return iv_out") Signed-off-by: Nicolas Toromanoff Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/stm32/stm32-cryp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32= -cryp.c index 061db567908ae..9943836a5c25c 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -644,7 +644,7 @@ static void stm32_cryp_finish_req(struct stm32_cryp *cr= yp, int err) /* Phase 4 : output tag */ err =3D stm32_cryp_read_auth_tag(cryp); =20 - if (!err && (!(is_gcm(cryp) || is_ccm(cryp)))) + if (!err && (!(is_gcm(cryp) || is_ccm(cryp) || is_ecb(cryp)))) stm32_cryp_get_iv(cryp); =20 if (cryp->sgs_copied) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB43EC4321E for ; Mon, 24 Jan 2022 23:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360032AbiAXXfo (ORCPT ); Mon, 24 Jan 2022 18:35:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449715AbiAXWrZ (ORCPT ); Mon, 24 Jan 2022 17:47:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39312C058C8A; Mon, 24 Jan 2022 13:06:39 -0800 (PST) Received: from smtp.kernel.org (relay.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 61F91B80FA1; Mon, 24 Jan 2022 21:06:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD941C340E7; Mon, 24 Jan 2022 21:06:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058396; bh=07t6tUlxdf4guaoKPDTCTVGpGkBUBUAcsyVNPd1k+Ps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AO+6Iug3ngfe4jlvNjjrJR943pBELOGZDGnxi03qBh7csJuNnyHG4c8fZwkIUwGDj a+ueu561JgYoNP7oKfYK2eL8Y1GR0qXiJmdDnirr7VjngL14DVjT5s6RFgirXSdO2p ULn1Gti4Ab84VW7TewQ8Yto6LBkrsgJP7ye/702E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Nicolas Toromanoff , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0276/1039] crypto: stm32/cryp - fix bugs and crash in tests Date: Mon, 24 Jan 2022 19:34:25 +0100 Message-Id: <20220124184134.564925906@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Toromanoff [ Upstream commit 4b898d5cfa4d9a0ad5bc82cb5eafdc092394c6a9 ] Extra crypto manager auto test were crashing or failling due to 2 reasons: - block in a dead loop (dues to issues in cipher end process management) - crash due to read/write unmapped memory (this crash was also reported when using openssl afalg engine) Rework interrupt management, interrupts are masked as soon as they are no more used: if input buffer is fully consumed, "Input FIFO not full" interrupt is masked and if output buffer is full, "Output FIFO not empty" interrupt is masked. And crypto request finish when input *and* outpout buffer are fully read/write. About the crash due to unmapped memory, using scatterwalk_copychunks() that will map and copy each block fix the issue. Using this api and copying full block will also fix unaligned data access, avoid early copy of in/out buffer, and make useless the extra alignment constraint. Fixes: 9e054ec21ef8 ("crypto: stm32 - Support for STM32 CRYP crypto module") Reported-by: Marek Vasut Signed-off-by: Nicolas Toromanoff Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/stm32/stm32-cryp.c | 790 +++++++++--------------------- 1 file changed, 243 insertions(+), 547 deletions(-) diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32= -cryp.c index 9943836a5c25c..cd57c5bae3ce9 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -37,7 +37,6 @@ /* Mode mask =3D bits [15..0] */ #define FLG_MODE_MASK GENMASK(15, 0) /* Bit [31..16] status */ -#define FLG_CCM_PADDED_WA BIT(16) =20 /* Registers */ #define CRYP_CR 0x00000000 @@ -105,8 +104,6 @@ /* Misc */ #define AES_BLOCK_32 (AES_BLOCK_SIZE / sizeof(u32)) #define GCM_CTR_INIT 2 -#define _walked_in (cryp->in_walk.offset - cryp->in_sg->offse= t) -#define _walked_out (cryp->out_walk.offset - cryp->out_sg->off= set) #define CRYP_AUTOSUSPEND_DELAY 50 =20 struct stm32_cryp_caps { @@ -144,21 +141,11 @@ struct stm32_cryp { size_t authsize; size_t hw_blocksize; =20 - size_t total_in; - size_t total_in_save; - size_t total_out; - size_t total_out_save; + size_t payload_in; + size_t header_in; + size_t payload_out; =20 - struct scatterlist *in_sg; struct scatterlist *out_sg; - struct scatterlist *out_sg_save; - - struct scatterlist in_sgl; - struct scatterlist out_sgl; - bool sgs_copied; - - int in_sg_len; - int out_sg_len; =20 struct scatter_walk in_walk; struct scatter_walk out_walk; @@ -262,6 +249,7 @@ static inline int stm32_cryp_wait_output(struct stm32_c= ryp *cryp) } =20 static int stm32_cryp_read_auth_tag(struct stm32_cryp *cryp); +static void stm32_cryp_finish_req(struct stm32_cryp *cryp, int err); =20 static struct stm32_cryp *stm32_cryp_find_dev(struct stm32_cryp_ctx *ctx) { @@ -283,103 +271,6 @@ static struct stm32_cryp *stm32_cryp_find_dev(struct = stm32_cryp_ctx *ctx) return cryp; } =20 -static int stm32_cryp_check_aligned(struct scatterlist *sg, size_t total, - size_t align) -{ - int len =3D 0; - - if (!total) - return 0; - - if (!IS_ALIGNED(total, align)) - return -EINVAL; - - while (sg) { - if (!IS_ALIGNED(sg->offset, sizeof(u32))) - return -EINVAL; - - if (!IS_ALIGNED(sg->length, align)) - return -EINVAL; - - len +=3D sg->length; - sg =3D sg_next(sg); - } - - if (len !=3D total) - return -EINVAL; - - return 0; -} - -static int stm32_cryp_check_io_aligned(struct stm32_cryp *cryp) -{ - int ret; - - ret =3D stm32_cryp_check_aligned(cryp->in_sg, cryp->total_in, - cryp->hw_blocksize); - if (ret) - return ret; - - ret =3D stm32_cryp_check_aligned(cryp->out_sg, cryp->total_out, - cryp->hw_blocksize); - - return ret; -} - -static void sg_copy_buf(void *buf, struct scatterlist *sg, - unsigned int start, unsigned int nbytes, int out) -{ - struct scatter_walk walk; - - if (!nbytes) - return; - - scatterwalk_start(&walk, sg); - scatterwalk_advance(&walk, start); - scatterwalk_copychunks(buf, &walk, nbytes, out); - scatterwalk_done(&walk, out, 0); -} - -static int stm32_cryp_copy_sgs(struct stm32_cryp *cryp) -{ - void *buf_in, *buf_out; - int pages, total_in, total_out; - - if (!stm32_cryp_check_io_aligned(cryp)) { - cryp->sgs_copied =3D 0; - return 0; - } - - total_in =3D ALIGN(cryp->total_in, cryp->hw_blocksize); - pages =3D total_in ? get_order(total_in) : 1; - buf_in =3D (void *)__get_free_pages(GFP_ATOMIC, pages); - - total_out =3D ALIGN(cryp->total_out, cryp->hw_blocksize); - pages =3D total_out ? get_order(total_out) : 1; - buf_out =3D (void *)__get_free_pages(GFP_ATOMIC, pages); - - if (!buf_in || !buf_out) { - dev_err(cryp->dev, "Can't allocate pages when unaligned\n"); - cryp->sgs_copied =3D 0; - return -EFAULT; - } - - sg_copy_buf(buf_in, cryp->in_sg, 0, cryp->total_in, 0); - - sg_init_one(&cryp->in_sgl, buf_in, total_in); - cryp->in_sg =3D &cryp->in_sgl; - cryp->in_sg_len =3D 1; - - sg_init_one(&cryp->out_sgl, buf_out, total_out); - cryp->out_sg_save =3D cryp->out_sg; - cryp->out_sg =3D &cryp->out_sgl; - cryp->out_sg_len =3D 1; - - cryp->sgs_copied =3D 1; - - return 0; -} - static void stm32_cryp_hw_write_iv(struct stm32_cryp *cryp, __be32 *iv) { if (!iv) @@ -481,16 +372,99 @@ static int stm32_cryp_gcm_init(struct stm32_cryp *cry= p, u32 cfg) =20 /* Wait for end of processing */ ret =3D stm32_cryp_wait_enable(cryp); - if (ret) + if (ret) { dev_err(cryp->dev, "Timeout (gcm init)\n"); + return ret; + } =20 - return ret; + /* Prepare next phase */ + if (cryp->areq->assoclen) { + cfg |=3D CR_PH_HEADER; + stm32_cryp_write(cryp, CRYP_CR, cfg); + } else if (stm32_cryp_get_input_text_len(cryp)) { + cfg |=3D CR_PH_PAYLOAD; + stm32_cryp_write(cryp, CRYP_CR, cfg); + } + + return 0; +} + +static void stm32_crypt_gcmccm_end_header(struct stm32_cryp *cryp) +{ + u32 cfg; + int err; + + /* Check if whole header written */ + if (!cryp->header_in) { + /* Wait for completion */ + err =3D stm32_cryp_wait_busy(cryp); + if (err) { + dev_err(cryp->dev, "Timeout (gcm/ccm header)\n"); + stm32_cryp_write(cryp, CRYP_IMSCR, 0); + stm32_cryp_finish_req(cryp, err); + return; + } + + if (stm32_cryp_get_input_text_len(cryp)) { + /* Phase 3 : payload */ + cfg =3D stm32_cryp_read(cryp, CRYP_CR); + cfg &=3D ~CR_CRYPEN; + stm32_cryp_write(cryp, CRYP_CR, cfg); + + cfg &=3D ~CR_PH_MASK; + cfg |=3D CR_PH_PAYLOAD | CR_CRYPEN; + stm32_cryp_write(cryp, CRYP_CR, cfg); + } else { + /* + * Phase 4 : tag. + * Nothing to read, nothing to write, caller have to + * end request + */ + } + } +} + +static void stm32_cryp_write_ccm_first_header(struct stm32_cryp *cryp) +{ + unsigned int i; + size_t written; + size_t len; + u32 alen =3D cryp->areq->assoclen; + u32 block[AES_BLOCK_32] =3D {0}; + u8 *b8 =3D (u8 *)block; + + if (alen <=3D 65280) { + /* Write first u32 of B1 */ + b8[0] =3D (alen >> 8) & 0xFF; + b8[1] =3D alen & 0xFF; + len =3D 2; + } else { + /* Build the two first u32 of B1 */ + b8[0] =3D 0xFF; + b8[1] =3D 0xFE; + b8[2] =3D (alen & 0xFF000000) >> 24; + b8[3] =3D (alen & 0x00FF0000) >> 16; + b8[4] =3D (alen & 0x0000FF00) >> 8; + b8[5] =3D alen & 0x000000FF; + len =3D 6; + } + + written =3D min_t(size_t, AES_BLOCK_SIZE - len, alen); + + scatterwalk_copychunks((char *)block + len, &cryp->in_walk, written, 0); + for (i =3D 0; i < AES_BLOCK_32; i++) + stm32_cryp_write(cryp, CRYP_DIN, block[i]); + + cryp->header_in -=3D written; + + stm32_crypt_gcmccm_end_header(cryp); } =20 static int stm32_cryp_ccm_init(struct stm32_cryp *cryp, u32 cfg) { int ret; - u8 iv[AES_BLOCK_SIZE], b0[AES_BLOCK_SIZE]; + u32 iv_32[AES_BLOCK_32], b0_32[AES_BLOCK_32]; + u8 *iv =3D (u8 *)iv_32, *b0 =3D (u8 *)b0_32; __be32 *bd; u32 *d; unsigned int i, textlen; @@ -531,17 +505,30 @@ static int stm32_cryp_ccm_init(struct stm32_cryp *cry= p, u32 cfg) =20 /* Wait for end of processing */ ret =3D stm32_cryp_wait_enable(cryp); - if (ret) + if (ret) { dev_err(cryp->dev, "Timeout (ccm init)\n"); + return ret; + } =20 - return ret; + /* Prepare next phase */ + if (cryp->areq->assoclen) { + cfg |=3D CR_PH_HEADER | CR_CRYPEN; + stm32_cryp_write(cryp, CRYP_CR, cfg); + + /* Write first (special) block (may move to next phase [payload]) */ + stm32_cryp_write_ccm_first_header(cryp); + } else if (stm32_cryp_get_input_text_len(cryp)) { + cfg |=3D CR_PH_PAYLOAD; + stm32_cryp_write(cryp, CRYP_CR, cfg); + } + + return 0; } =20 static int stm32_cryp_hw_init(struct stm32_cryp *cryp) { int ret; u32 cfg, hw_mode; - pm_runtime_resume_and_get(cryp->dev); =20 /* Disable interrupt */ @@ -605,16 +592,6 @@ static int stm32_cryp_hw_init(struct stm32_cryp *cryp) if (ret) return ret; =20 - /* Phase 2 : header (authenticated data) */ - if (cryp->areq->assoclen) { - cfg |=3D CR_PH_HEADER; - } else if (stm32_cryp_get_input_text_len(cryp)) { - cfg |=3D CR_PH_PAYLOAD; - stm32_cryp_write(cryp, CRYP_CR, cfg); - } else { - cfg |=3D CR_PH_INIT; - } - break; =20 case CR_DES_CBC: @@ -633,8 +610,6 @@ static int stm32_cryp_hw_init(struct stm32_cryp *cryp) =20 stm32_cryp_write(cryp, CRYP_CR, cfg); =20 - cryp->flags &=3D ~FLG_CCM_PADDED_WA; - return 0; } =20 @@ -647,25 +622,6 @@ static void stm32_cryp_finish_req(struct stm32_cryp *c= ryp, int err) if (!err && (!(is_gcm(cryp) || is_ccm(cryp) || is_ecb(cryp)))) stm32_cryp_get_iv(cryp); =20 - if (cryp->sgs_copied) { - void *buf_in, *buf_out; - int pages, len; - - buf_in =3D sg_virt(&cryp->in_sgl); - buf_out =3D sg_virt(&cryp->out_sgl); - - sg_copy_buf(buf_out, cryp->out_sg_save, 0, - cryp->total_out_save, 1); - - len =3D ALIGN(cryp->total_in_save, cryp->hw_blocksize); - pages =3D len ? get_order(len) : 1; - free_pages((unsigned long)buf_in, pages); - - len =3D ALIGN(cryp->total_out_save, cryp->hw_blocksize); - pages =3D len ? get_order(len) : 1; - free_pages((unsigned long)buf_out, pages); - } - pm_runtime_mark_last_busy(cryp->dev); pm_runtime_put_autosuspend(cryp->dev); =20 @@ -1029,6 +985,7 @@ static int stm32_cryp_prepare_req(struct skcipher_requ= est *req, struct stm32_cryp_ctx *ctx; struct stm32_cryp *cryp; struct stm32_cryp_reqctx *rctx; + struct scatterlist *in_sg; int ret; =20 if (!req && !areq) @@ -1054,76 +1011,55 @@ static int stm32_cryp_prepare_req(struct skcipher_r= equest *req, if (req) { cryp->req =3D req; cryp->areq =3D NULL; - cryp->total_in =3D req->cryptlen; - cryp->total_out =3D cryp->total_in; + cryp->header_in =3D 0; + cryp->payload_in =3D req->cryptlen; + cryp->payload_out =3D req->cryptlen; + cryp->authsize =3D 0; } else { /* * Length of input and output data: * Encryption case: - * INPUT =3D AssocData || PlainText + * INPUT =3D AssocData || PlainText * <- assoclen -> <- cryptlen -> - * <------- total_in -----------> * - * OUTPUT =3D AssocData || CipherText || AuthTag - * <- assoclen -> <- cryptlen -> <- authsize -> - * <---------------- total_out -----------------> + * OUTPUT =3D AssocData || CipherText || AuthTag + * <- assoclen -> <-- cryptlen --> <- authsize -> * * Decryption case: - * INPUT =3D AssocData || CipherText || AuthTag - * <- assoclen -> <--------- cryptlen ---------> - * <- authsize -> - * <---------------- total_in ------------------> + * INPUT =3D AssocData || CipherTex || AuthTag + * <- assoclen ---> <---------- cryptlen ----------> * - * OUTPUT =3D AssocData || PlainText - * <- assoclen -> <- crypten - authsize -> - * <---------- total_out -----------------> + * OUTPUT =3D AssocData || PlainText + * <- assoclen -> <- cryptlen - authsize -> */ cryp->areq =3D areq; cryp->req =3D NULL; cryp->authsize =3D crypto_aead_authsize(crypto_aead_reqtfm(areq)); - cryp->total_in =3D areq->assoclen + areq->cryptlen; - if (is_encrypt(cryp)) - /* Append auth tag to output */ - cryp->total_out =3D cryp->total_in + cryp->authsize; - else - /* No auth tag in output */ - cryp->total_out =3D cryp->total_in - cryp->authsize; + if (is_encrypt(cryp)) { + cryp->payload_in =3D areq->cryptlen; + cryp->header_in =3D areq->assoclen; + cryp->payload_out =3D areq->cryptlen; + } else { + cryp->payload_in =3D areq->cryptlen - cryp->authsize; + cryp->header_in =3D areq->assoclen; + cryp->payload_out =3D cryp->payload_in; + } } =20 - cryp->total_in_save =3D cryp->total_in; - cryp->total_out_save =3D cryp->total_out; + in_sg =3D req ? req->src : areq->src; + scatterwalk_start(&cryp->in_walk, in_sg); =20 - cryp->in_sg =3D req ? req->src : areq->src; cryp->out_sg =3D req ? req->dst : areq->dst; - cryp->out_sg_save =3D cryp->out_sg; - - cryp->in_sg_len =3D sg_nents_for_len(cryp->in_sg, cryp->total_in); - if (cryp->in_sg_len < 0) { - dev_err(cryp->dev, "Cannot get in_sg_len\n"); - ret =3D cryp->in_sg_len; - return ret; - } - - cryp->out_sg_len =3D sg_nents_for_len(cryp->out_sg, cryp->total_out); - if (cryp->out_sg_len < 0) { - dev_err(cryp->dev, "Cannot get out_sg_len\n"); - ret =3D cryp->out_sg_len; - return ret; - } - - ret =3D stm32_cryp_copy_sgs(cryp); - if (ret) - return ret; - - scatterwalk_start(&cryp->in_walk, cryp->in_sg); scatterwalk_start(&cryp->out_walk, cryp->out_sg); =20 if (is_gcm(cryp) || is_ccm(cryp)) { /* In output, jump after assoc data */ - scatterwalk_advance(&cryp->out_walk, cryp->areq->assoclen); - cryp->total_out -=3D cryp->areq->assoclen; + scatterwalk_copychunks(NULL, &cryp->out_walk, cryp->areq->assoclen, 2); } =20 + if (is_ctr(cryp)) + memset(cryp->last_ctr, 0, sizeof(cryp->last_ctr)); + ret =3D stm32_cryp_hw_init(cryp); return ret; } @@ -1171,8 +1107,7 @@ static int stm32_cryp_aead_one_req(struct crypto_engi= ne *engine, void *areq) if (!cryp) return -ENODEV; =20 - if (unlikely(!cryp->areq->assoclen && - !stm32_cryp_get_input_text_len(cryp))) { + if (unlikely(!cryp->payload_in && !cryp->header_in)) { /* No input data to process: get tag and finish */ stm32_cryp_finish_req(cryp, 0); return 0; @@ -1181,43 +1116,10 @@ static int stm32_cryp_aead_one_req(struct crypto_en= gine *engine, void *areq) return stm32_cryp_cpu_start(cryp); } =20 -static u32 *stm32_cryp_next_out(struct stm32_cryp *cryp, u32 *dst, - unsigned int n) -{ - scatterwalk_advance(&cryp->out_walk, n); - - if (unlikely(cryp->out_sg->length =3D=3D _walked_out)) { - cryp->out_sg =3D sg_next(cryp->out_sg); - if (cryp->out_sg) { - scatterwalk_start(&cryp->out_walk, cryp->out_sg); - return (sg_virt(cryp->out_sg) + _walked_out); - } - } - - return (u32 *)((u8 *)dst + n); -} - -static u32 *stm32_cryp_next_in(struct stm32_cryp *cryp, u32 *src, - unsigned int n) -{ - scatterwalk_advance(&cryp->in_walk, n); - - if (unlikely(cryp->in_sg->length =3D=3D _walked_in)) { - cryp->in_sg =3D sg_next(cryp->in_sg); - if (cryp->in_sg) { - scatterwalk_start(&cryp->in_walk, cryp->in_sg); - return (sg_virt(cryp->in_sg) + _walked_in); - } - } - - return (u32 *)((u8 *)src + n); -} - static int stm32_cryp_read_auth_tag(struct stm32_cryp *cryp) { - u32 cfg, size_bit, *dst, d32; - u8 *d8; - unsigned int i, j; + u32 cfg, size_bit; + unsigned int i; int ret =3D 0; =20 /* Update Config */ @@ -1240,7 +1142,7 @@ static int stm32_cryp_read_auth_tag(struct stm32_cryp= *cryp) stm32_cryp_write(cryp, CRYP_DIN, size_bit); =20 size_bit =3D is_encrypt(cryp) ? cryp->areq->cryptlen : - cryp->areq->cryptlen - AES_BLOCK_SIZE; + cryp->areq->cryptlen - cryp->authsize; size_bit *=3D 8; if (cryp->caps->swap_final) size_bit =3D (__force u32)cpu_to_be32(size_bit); @@ -1249,11 +1151,9 @@ static int stm32_cryp_read_auth_tag(struct stm32_cry= p *cryp) stm32_cryp_write(cryp, CRYP_DIN, size_bit); } else { /* CCM: write CTR0 */ - u8 iv[AES_BLOCK_SIZE]; - u32 *iv32 =3D (u32 *)iv; - __be32 *biv; - - biv =3D (void *)iv; + u32 iv32[AES_BLOCK_32]; + u8 *iv =3D (u8 *)iv32; + __be32 *biv =3D (__be32 *)iv32; =20 memcpy(iv, cryp->areq->iv, AES_BLOCK_SIZE); memset(iv + AES_BLOCK_SIZE - 1 - iv[0], 0, iv[0] + 1); @@ -1275,39 +1175,18 @@ static int stm32_cryp_read_auth_tag(struct stm32_cr= yp *cryp) } =20 if (is_encrypt(cryp)) { + u32 out_tag[AES_BLOCK_32]; + /* Get and write tag */ - dst =3D sg_virt(cryp->out_sg) + _walked_out; + for (i =3D 0; i < AES_BLOCK_32; i++) + out_tag[i] =3D stm32_cryp_read(cryp, CRYP_DOUT); =20 - for (i =3D 0; i < AES_BLOCK_32; i++) { - if (cryp->total_out >=3D sizeof(u32)) { - /* Read a full u32 */ - *dst =3D stm32_cryp_read(cryp, CRYP_DOUT); - - dst =3D stm32_cryp_next_out(cryp, dst, - sizeof(u32)); - cryp->total_out -=3D sizeof(u32); - } else if (!cryp->total_out) { - /* Empty fifo out (data from input padding) */ - stm32_cryp_read(cryp, CRYP_DOUT); - } else { - /* Read less than an u32 */ - d32 =3D stm32_cryp_read(cryp, CRYP_DOUT); - d8 =3D (u8 *)&d32; - - for (j =3D 0; j < cryp->total_out; j++) { - *((u8 *)dst) =3D *(d8++); - dst =3D stm32_cryp_next_out(cryp, dst, 1); - } - cryp->total_out =3D 0; - } - } + scatterwalk_copychunks(out_tag, &cryp->out_walk, cryp->authsize, 1); } else { /* Get and check tag */ u32 in_tag[AES_BLOCK_32], out_tag[AES_BLOCK_32]; =20 - scatterwalk_map_and_copy(in_tag, cryp->in_sg, - cryp->total_in_save - cryp->authsize, - cryp->authsize, 0); + scatterwalk_copychunks(in_tag, &cryp->in_walk, cryp->authsize, 0); =20 for (i =3D 0; i < AES_BLOCK_32; i++) out_tag[i] =3D stm32_cryp_read(cryp, CRYP_DOUT); @@ -1349,92 +1228,37 @@ static void stm32_cryp_check_ctr_counter(struct stm= 32_cryp *cryp) cryp->last_ctr[3] =3D cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV1RR)); } =20 -static bool stm32_cryp_irq_read_data(struct stm32_cryp *cryp) +static void stm32_cryp_irq_read_data(struct stm32_cryp *cryp) { - unsigned int i, j; - u32 d32, *dst; - u8 *d8; - size_t tag_size; - - /* Do no read tag now (if any) */ - if (is_encrypt(cryp) && (is_gcm(cryp) || is_ccm(cryp))) - tag_size =3D cryp->authsize; - else - tag_size =3D 0; - - dst =3D sg_virt(cryp->out_sg) + _walked_out; - - for (i =3D 0; i < cryp->hw_blocksize / sizeof(u32); i++) { - if (likely(cryp->total_out - tag_size >=3D sizeof(u32))) { - /* Read a full u32 */ - *dst =3D stm32_cryp_read(cryp, CRYP_DOUT); + unsigned int i; + u32 block[AES_BLOCK_32]; =20 - dst =3D stm32_cryp_next_out(cryp, dst, sizeof(u32)); - cryp->total_out -=3D sizeof(u32); - } else if (cryp->total_out =3D=3D tag_size) { - /* Empty fifo out (data from input padding) */ - d32 =3D stm32_cryp_read(cryp, CRYP_DOUT); - } else { - /* Read less than an u32 */ - d32 =3D stm32_cryp_read(cryp, CRYP_DOUT); - d8 =3D (u8 *)&d32; - - for (j =3D 0; j < cryp->total_out - tag_size; j++) { - *((u8 *)dst) =3D *(d8++); - dst =3D stm32_cryp_next_out(cryp, dst, 1); - } - cryp->total_out =3D tag_size; - } - } + for (i =3D 0; i < cryp->hw_blocksize / sizeof(u32); i++) + block[i] =3D stm32_cryp_read(cryp, CRYP_DOUT); =20 - return !(cryp->total_out - tag_size) || !cryp->total_in; + scatterwalk_copychunks(block, &cryp->out_walk, min_t(size_t, cryp->hw_blo= cksize, + cryp->payload_out), 1); + cryp->payload_out -=3D min_t(size_t, cryp->hw_blocksize, + cryp->payload_out); } =20 static void stm32_cryp_irq_write_block(struct stm32_cryp *cryp) { - unsigned int i, j; - u32 *src; - u8 d8[4]; - size_t tag_size; - - /* Do no write tag (if any) */ - if (is_decrypt(cryp) && (is_gcm(cryp) || is_ccm(cryp))) - tag_size =3D cryp->authsize; - else - tag_size =3D 0; - - src =3D sg_virt(cryp->in_sg) + _walked_in; + unsigned int i; + u32 block[AES_BLOCK_32] =3D {0}; =20 - for (i =3D 0; i < cryp->hw_blocksize / sizeof(u32); i++) { - if (likely(cryp->total_in - tag_size >=3D sizeof(u32))) { - /* Write a full u32 */ - stm32_cryp_write(cryp, CRYP_DIN, *src); + scatterwalk_copychunks(block, &cryp->in_walk, min_t(size_t, cryp->hw_bloc= ksize, + cryp->payload_in), 0); + for (i =3D 0; i < cryp->hw_blocksize / sizeof(u32); i++) + stm32_cryp_write(cryp, CRYP_DIN, block[i]); =20 - src =3D stm32_cryp_next_in(cryp, src, sizeof(u32)); - cryp->total_in -=3D sizeof(u32); - } else if (cryp->total_in =3D=3D tag_size) { - /* Write padding data */ - stm32_cryp_write(cryp, CRYP_DIN, 0); - } else { - /* Write less than an u32 */ - memset(d8, 0, sizeof(u32)); - for (j =3D 0; j < cryp->total_in - tag_size; j++) { - d8[j] =3D *((u8 *)src); - src =3D stm32_cryp_next_in(cryp, src, 1); - } - - stm32_cryp_write(cryp, CRYP_DIN, *(u32 *)d8); - cryp->total_in =3D tag_size; - } - } + cryp->payload_in -=3D min_t(size_t, cryp->hw_blocksize, cryp->payload_in); } =20 static void stm32_cryp_irq_write_gcm_padded_data(struct stm32_cryp *cryp) { int err; - u32 cfg, tmp[AES_BLOCK_32]; - size_t total_in_ori =3D cryp->total_in; - struct scatterlist *out_sg_ori =3D cryp->out_sg; + u32 cfg, block[AES_BLOCK_32] =3D {0}; unsigned int i; =20 /* 'Special workaround' procedure described in the datasheet */ @@ -1459,18 +1283,25 @@ static void stm32_cryp_irq_write_gcm_padded_data(st= ruct stm32_cryp *cryp) =20 /* b) pad and write the last block */ stm32_cryp_irq_write_block(cryp); - cryp->total_in =3D total_in_ori; + /* wait end of process */ err =3D stm32_cryp_wait_output(cryp); if (err) { - dev_err(cryp->dev, "Timeout (write gcm header)\n"); + dev_err(cryp->dev, "Timeout (write gcm last data)\n"); return stm32_cryp_finish_req(cryp, err); } =20 /* c) get and store encrypted data */ - stm32_cryp_irq_read_data(cryp); - scatterwalk_map_and_copy(tmp, out_sg_ori, - cryp->total_in_save - total_in_ori, - total_in_ori, 0); + /* + * Same code as stm32_cryp_irq_read_data(), but we want to store + * block value + */ + for (i =3D 0; i < cryp->hw_blocksize / sizeof(u32); i++) + block[i] =3D stm32_cryp_read(cryp, CRYP_DOUT); + + scatterwalk_copychunks(block, &cryp->out_walk, min_t(size_t, cryp->hw_blo= cksize, + cryp->payload_out), 1); + cryp->payload_out -=3D min_t(size_t, cryp->hw_blocksize, + cryp->payload_out); =20 /* d) change mode back to AES GCM */ cfg &=3D ~CR_ALGO_MASK; @@ -1483,19 +1314,13 @@ static void stm32_cryp_irq_write_gcm_padded_data(st= ruct stm32_cryp *cryp) stm32_cryp_write(cryp, CRYP_CR, cfg); =20 /* f) write padded data */ - for (i =3D 0; i < AES_BLOCK_32; i++) { - if (cryp->total_in) - stm32_cryp_write(cryp, CRYP_DIN, tmp[i]); - else - stm32_cryp_write(cryp, CRYP_DIN, 0); - - cryp->total_in -=3D min_t(size_t, sizeof(u32), cryp->total_in); - } + for (i =3D 0; i < AES_BLOCK_32; i++) + stm32_cryp_write(cryp, CRYP_DIN, block[i]); =20 /* g) Empty fifo out */ err =3D stm32_cryp_wait_output(cryp); if (err) { - dev_err(cryp->dev, "Timeout (write gcm header)\n"); + dev_err(cryp->dev, "Timeout (write gcm padded data)\n"); return stm32_cryp_finish_req(cryp, err); } =20 @@ -1508,16 +1333,14 @@ static void stm32_cryp_irq_write_gcm_padded_data(st= ruct stm32_cryp *cryp) =20 static void stm32_cryp_irq_set_npblb(struct stm32_cryp *cryp) { - u32 cfg, payload_bytes; + u32 cfg; =20 /* disable ip, set NPBLB and reneable ip */ cfg =3D stm32_cryp_read(cryp, CRYP_CR); cfg &=3D ~CR_CRYPEN; stm32_cryp_write(cryp, CRYP_CR, cfg); =20 - payload_bytes =3D is_decrypt(cryp) ? cryp->total_in - cryp->authsize : - cryp->total_in; - cfg |=3D (cryp->hw_blocksize - payload_bytes) << CR_NBPBL_SHIFT; + cfg |=3D (cryp->hw_blocksize - cryp->payload_in) << CR_NBPBL_SHIFT; cfg |=3D CR_CRYPEN; stm32_cryp_write(cryp, CRYP_CR, cfg); } @@ -1526,13 +1349,11 @@ static void stm32_cryp_irq_write_ccm_padded_data(st= ruct stm32_cryp *cryp) { int err =3D 0; u32 cfg, iv1tmp; - u32 cstmp1[AES_BLOCK_32], cstmp2[AES_BLOCK_32], tmp[AES_BLOCK_32]; - size_t last_total_out, total_in_ori =3D cryp->total_in; - struct scatterlist *out_sg_ori =3D cryp->out_sg; + u32 cstmp1[AES_BLOCK_32], cstmp2[AES_BLOCK_32]; + u32 block[AES_BLOCK_32] =3D {0}; unsigned int i; =20 /* 'Special workaround' procedure described in the datasheet */ - cryp->flags |=3D FLG_CCM_PADDED_WA; =20 /* a) disable ip */ stm32_cryp_write(cryp, CRYP_IMSCR, 0); @@ -1562,7 +1383,7 @@ static void stm32_cryp_irq_write_ccm_padded_data(stru= ct stm32_cryp *cryp) =20 /* b) pad and write the last block */ stm32_cryp_irq_write_block(cryp); - cryp->total_in =3D total_in_ori; + /* wait end of process */ err =3D stm32_cryp_wait_output(cryp); if (err) { dev_err(cryp->dev, "Timeout (wite ccm padded data)\n"); @@ -1570,13 +1391,16 @@ static void stm32_cryp_irq_write_ccm_padded_data(st= ruct stm32_cryp *cryp) } =20 /* c) get and store decrypted data */ - last_total_out =3D cryp->total_out; - stm32_cryp_irq_read_data(cryp); + /* + * Same code as stm32_cryp_irq_read_data(), but we want to store + * block value + */ + for (i =3D 0; i < cryp->hw_blocksize / sizeof(u32); i++) + block[i] =3D stm32_cryp_read(cryp, CRYP_DOUT); =20 - memset(tmp, 0, sizeof(tmp)); - scatterwalk_map_and_copy(tmp, out_sg_ori, - cryp->total_out_save - last_total_out, - last_total_out, 0); + scatterwalk_copychunks(block, &cryp->out_walk, min_t(size_t, cryp->hw_blo= cksize, + cryp->payload_out), 1); + cryp->payload_out -=3D min_t(size_t, cryp->hw_blocksize, cryp->payload_ou= t); =20 /* d) Load again CRYP_CSGCMCCMxR */ for (i =3D 0; i < ARRAY_SIZE(cstmp2); i++) @@ -1593,10 +1417,10 @@ static void stm32_cryp_irq_write_ccm_padded_data(st= ruct stm32_cryp *cryp) stm32_cryp_write(cryp, CRYP_CR, cfg); =20 /* g) XOR and write padded data */ - for (i =3D 0; i < ARRAY_SIZE(tmp); i++) { - tmp[i] ^=3D cstmp1[i]; - tmp[i] ^=3D cstmp2[i]; - stm32_cryp_write(cryp, CRYP_DIN, tmp[i]); + for (i =3D 0; i < ARRAY_SIZE(block); i++) { + block[i] ^=3D cstmp1[i]; + block[i] ^=3D cstmp2[i]; + stm32_cryp_write(cryp, CRYP_DIN, block[i]); } =20 /* h) wait for completion */ @@ -1610,30 +1434,34 @@ static void stm32_cryp_irq_write_ccm_padded_data(st= ruct stm32_cryp *cryp) =20 static void stm32_cryp_irq_write_data(struct stm32_cryp *cryp) { - if (unlikely(!cryp->total_in)) { + if (unlikely(!cryp->payload_in)) { dev_warn(cryp->dev, "No more data to process\n"); return; } =20 - if (unlikely(cryp->total_in < AES_BLOCK_SIZE && + if (unlikely(cryp->payload_in < AES_BLOCK_SIZE && (stm32_cryp_get_hw_mode(cryp) =3D=3D CR_AES_GCM) && is_encrypt(cryp))) { /* Padding for AES GCM encryption */ - if (cryp->caps->padding_wa) + if (cryp->caps->padding_wa) { /* Special case 1 */ - return stm32_cryp_irq_write_gcm_padded_data(cryp); + stm32_cryp_irq_write_gcm_padded_data(cryp); + return; + } =20 /* Setting padding bytes (NBBLB) */ stm32_cryp_irq_set_npblb(cryp); } =20 - if (unlikely((cryp->total_in - cryp->authsize < AES_BLOCK_SIZE) && + if (unlikely((cryp->payload_in < AES_BLOCK_SIZE) && (stm32_cryp_get_hw_mode(cryp) =3D=3D CR_AES_CCM) && is_decrypt(cryp))) { /* Padding for AES CCM decryption */ - if (cryp->caps->padding_wa) + if (cryp->caps->padding_wa) { /* Special case 2 */ - return stm32_cryp_irq_write_ccm_padded_data(cryp); + stm32_cryp_irq_write_ccm_padded_data(cryp); + return; + } =20 /* Setting padding bytes (NBBLB) */ stm32_cryp_irq_set_npblb(cryp); @@ -1645,192 +1473,60 @@ static void stm32_cryp_irq_write_data(struct stm32= _cryp *cryp) stm32_cryp_irq_write_block(cryp); } =20 -static void stm32_cryp_irq_write_gcm_header(struct stm32_cryp *cryp) +static void stm32_cryp_irq_write_gcmccm_header(struct stm32_cryp *cryp) { - int err; - unsigned int i, j; - u32 cfg, *src; - - src =3D sg_virt(cryp->in_sg) + _walked_in; - - for (i =3D 0; i < AES_BLOCK_32; i++) { - stm32_cryp_write(cryp, CRYP_DIN, *src); - - src =3D stm32_cryp_next_in(cryp, src, sizeof(u32)); - cryp->total_in -=3D min_t(size_t, sizeof(u32), cryp->total_in); - - /* Check if whole header written */ - if ((cryp->total_in_save - cryp->total_in) =3D=3D - cryp->areq->assoclen) { - /* Write padding if needed */ - for (j =3D i + 1; j < AES_BLOCK_32; j++) - stm32_cryp_write(cryp, CRYP_DIN, 0); - - /* Wait for completion */ - err =3D stm32_cryp_wait_busy(cryp); - if (err) { - dev_err(cryp->dev, "Timeout (gcm header)\n"); - return stm32_cryp_finish_req(cryp, err); - } - - if (stm32_cryp_get_input_text_len(cryp)) { - /* Phase 3 : payload */ - cfg =3D stm32_cryp_read(cryp, CRYP_CR); - cfg &=3D ~CR_CRYPEN; - stm32_cryp_write(cryp, CRYP_CR, cfg); - - cfg &=3D ~CR_PH_MASK; - cfg |=3D CR_PH_PAYLOAD; - cfg |=3D CR_CRYPEN; - stm32_cryp_write(cryp, CRYP_CR, cfg); - } else { - /* Phase 4 : tag */ - stm32_cryp_write(cryp, CRYP_IMSCR, 0); - stm32_cryp_finish_req(cryp, 0); - } - - break; - } - - if (!cryp->total_in) - break; - } -} + unsigned int i; + u32 block[AES_BLOCK_32] =3D {0}; + size_t written; =20 -static void stm32_cryp_irq_write_ccm_header(struct stm32_cryp *cryp) -{ - int err; - unsigned int i =3D 0, j, k; - u32 alen, cfg, *src; - u8 d8[4]; - - src =3D sg_virt(cryp->in_sg) + _walked_in; - alen =3D cryp->areq->assoclen; - - if (!_walked_in) { - if (cryp->areq->assoclen <=3D 65280) { - /* Write first u32 of B1 */ - d8[0] =3D (alen >> 8) & 0xFF; - d8[1] =3D alen & 0xFF; - d8[2] =3D *((u8 *)src); - src =3D stm32_cryp_next_in(cryp, src, 1); - d8[3] =3D *((u8 *)src); - src =3D stm32_cryp_next_in(cryp, src, 1); - - stm32_cryp_write(cryp, CRYP_DIN, *(u32 *)d8); - i++; - - cryp->total_in -=3D min_t(size_t, 2, cryp->total_in); - } else { - /* Build the two first u32 of B1 */ - d8[0] =3D 0xFF; - d8[1] =3D 0xFE; - d8[2] =3D alen & 0xFF000000; - d8[3] =3D alen & 0x00FF0000; - - stm32_cryp_write(cryp, CRYP_DIN, *(u32 *)d8); - i++; - - d8[0] =3D alen & 0x0000FF00; - d8[1] =3D alen & 0x000000FF; - d8[2] =3D *((u8 *)src); - src =3D stm32_cryp_next_in(cryp, src, 1); - d8[3] =3D *((u8 *)src); - src =3D stm32_cryp_next_in(cryp, src, 1); - - stm32_cryp_write(cryp, CRYP_DIN, *(u32 *)d8); - i++; - - cryp->total_in -=3D min_t(size_t, 2, cryp->total_in); - } - } + written =3D min_t(size_t, AES_BLOCK_SIZE, cryp->header_in); =20 - /* Write next u32 */ - for (; i < AES_BLOCK_32; i++) { - /* Build an u32 */ - memset(d8, 0, sizeof(u32)); - for (k =3D 0; k < sizeof(u32); k++) { - d8[k] =3D *((u8 *)src); - src =3D stm32_cryp_next_in(cryp, src, 1); - - cryp->total_in -=3D min_t(size_t, 1, cryp->total_in); - if ((cryp->total_in_save - cryp->total_in) =3D=3D alen) - break; - } + scatterwalk_copychunks(block, &cryp->in_walk, written, 0); + for (i =3D 0; i < AES_BLOCK_32; i++) + stm32_cryp_write(cryp, CRYP_DIN, block[i]); =20 - stm32_cryp_write(cryp, CRYP_DIN, *(u32 *)d8); - - if ((cryp->total_in_save - cryp->total_in) =3D=3D alen) { - /* Write padding if needed */ - for (j =3D i + 1; j < AES_BLOCK_32; j++) - stm32_cryp_write(cryp, CRYP_DIN, 0); - - /* Wait for completion */ - err =3D stm32_cryp_wait_busy(cryp); - if (err) { - dev_err(cryp->dev, "Timeout (ccm header)\n"); - return stm32_cryp_finish_req(cryp, err); - } - - if (stm32_cryp_get_input_text_len(cryp)) { - /* Phase 3 : payload */ - cfg =3D stm32_cryp_read(cryp, CRYP_CR); - cfg &=3D ~CR_CRYPEN; - stm32_cryp_write(cryp, CRYP_CR, cfg); - - cfg &=3D ~CR_PH_MASK; - cfg |=3D CR_PH_PAYLOAD; - cfg |=3D CR_CRYPEN; - stm32_cryp_write(cryp, CRYP_CR, cfg); - } else { - /* Phase 4 : tag */ - stm32_cryp_write(cryp, CRYP_IMSCR, 0); - stm32_cryp_finish_req(cryp, 0); - } + cryp->header_in -=3D written; =20 - break; - } - } + stm32_crypt_gcmccm_end_header(cryp); } =20 static irqreturn_t stm32_cryp_irq_thread(int irq, void *arg) { struct stm32_cryp *cryp =3D arg; u32 ph; + u32 it_mask =3D stm32_cryp_read(cryp, CRYP_IMSCR); =20 if (cryp->irq_status & MISR_OUT) /* Output FIFO IRQ: read data */ - if (unlikely(stm32_cryp_irq_read_data(cryp))) { - /* All bytes processed, finish */ - stm32_cryp_write(cryp, CRYP_IMSCR, 0); - stm32_cryp_finish_req(cryp, 0); - return IRQ_HANDLED; - } + stm32_cryp_irq_read_data(cryp); =20 if (cryp->irq_status & MISR_IN) { - if (is_gcm(cryp)) { - ph =3D stm32_cryp_read(cryp, CRYP_CR) & CR_PH_MASK; - if (unlikely(ph =3D=3D CR_PH_HEADER)) - /* Write Header */ - stm32_cryp_irq_write_gcm_header(cryp); - else - /* Input FIFO IRQ: write data */ - stm32_cryp_irq_write_data(cryp); - cryp->gcm_ctr++; - } else if (is_ccm(cryp)) { + if (is_gcm(cryp) || is_ccm(cryp)) { ph =3D stm32_cryp_read(cryp, CRYP_CR) & CR_PH_MASK; if (unlikely(ph =3D=3D CR_PH_HEADER)) /* Write Header */ - stm32_cryp_irq_write_ccm_header(cryp); + stm32_cryp_irq_write_gcmccm_header(cryp); else /* Input FIFO IRQ: write data */ stm32_cryp_irq_write_data(cryp); + if (is_gcm(cryp)) + cryp->gcm_ctr++; } else { /* Input FIFO IRQ: write data */ stm32_cryp_irq_write_data(cryp); } } =20 + /* Mask useless interrupts */ + if (!cryp->payload_in && !cryp->header_in) + it_mask &=3D ~IMSCR_IN; + if (!cryp->payload_out) + it_mask &=3D ~IMSCR_OUT; + stm32_cryp_write(cryp, CRYP_IMSCR, it_mask); + + if (!cryp->payload_in && !cryp->header_in && !cryp->payload_out) + stm32_cryp_finish_req(cryp, 0); + return IRQ_HANDLED; } =20 @@ -1851,7 +1547,7 @@ static struct skcipher_alg crypto_algs[] =3D { .base.cra_flags =3D CRYPTO_ALG_ASYNC, .base.cra_blocksize =3D AES_BLOCK_SIZE, .base.cra_ctxsize =3D sizeof(struct stm32_cryp_ctx), - .base.cra_alignmask =3D 0xf, + .base.cra_alignmask =3D 0, .base.cra_module =3D THIS_MODULE, =20 .init =3D stm32_cryp_init_tfm, @@ -1868,7 +1564,7 @@ static struct skcipher_alg crypto_algs[] =3D { .base.cra_flags =3D CRYPTO_ALG_ASYNC, .base.cra_blocksize =3D AES_BLOCK_SIZE, .base.cra_ctxsize =3D sizeof(struct stm32_cryp_ctx), - .base.cra_alignmask =3D 0xf, + .base.cra_alignmask =3D 0, .base.cra_module =3D THIS_MODULE, =20 .init =3D stm32_cryp_init_tfm, @@ -1886,7 +1582,7 @@ static struct skcipher_alg crypto_algs[] =3D { .base.cra_flags =3D CRYPTO_ALG_ASYNC, .base.cra_blocksize =3D 1, .base.cra_ctxsize =3D sizeof(struct stm32_cryp_ctx), - .base.cra_alignmask =3D 0xf, + .base.cra_alignmask =3D 0, .base.cra_module =3D THIS_MODULE, =20 .init =3D stm32_cryp_init_tfm, @@ -1904,7 +1600,7 @@ static struct skcipher_alg crypto_algs[] =3D { .base.cra_flags =3D CRYPTO_ALG_ASYNC, .base.cra_blocksize =3D DES_BLOCK_SIZE, .base.cra_ctxsize =3D sizeof(struct stm32_cryp_ctx), - .base.cra_alignmask =3D 0xf, + .base.cra_alignmask =3D 0, .base.cra_module =3D THIS_MODULE, =20 .init =3D stm32_cryp_init_tfm, @@ -1921,7 +1617,7 @@ static struct skcipher_alg crypto_algs[] =3D { .base.cra_flags =3D CRYPTO_ALG_ASYNC, .base.cra_blocksize =3D DES_BLOCK_SIZE, .base.cra_ctxsize =3D sizeof(struct stm32_cryp_ctx), - .base.cra_alignmask =3D 0xf, + .base.cra_alignmask =3D 0, .base.cra_module =3D THIS_MODULE, =20 .init =3D stm32_cryp_init_tfm, @@ -1939,7 +1635,7 @@ static struct skcipher_alg crypto_algs[] =3D { .base.cra_flags =3D CRYPTO_ALG_ASYNC, .base.cra_blocksize =3D DES_BLOCK_SIZE, .base.cra_ctxsize =3D sizeof(struct stm32_cryp_ctx), - .base.cra_alignmask =3D 0xf, + .base.cra_alignmask =3D 0, .base.cra_module =3D THIS_MODULE, =20 .init =3D stm32_cryp_init_tfm, @@ -1956,7 +1652,7 @@ static struct skcipher_alg crypto_algs[] =3D { .base.cra_flags =3D CRYPTO_ALG_ASYNC, .base.cra_blocksize =3D DES_BLOCK_SIZE, .base.cra_ctxsize =3D sizeof(struct stm32_cryp_ctx), - .base.cra_alignmask =3D 0xf, + .base.cra_alignmask =3D 0, .base.cra_module =3D THIS_MODULE, =20 .init =3D stm32_cryp_init_tfm, @@ -1986,7 +1682,7 @@ static struct aead_alg aead_algs[] =3D { .cra_flags =3D CRYPTO_ALG_ASYNC, .cra_blocksize =3D 1, .cra_ctxsize =3D sizeof(struct stm32_cryp_ctx), - .cra_alignmask =3D 0xf, + .cra_alignmask =3D 0, .cra_module =3D THIS_MODULE, }, }, @@ -2006,7 +1702,7 @@ static struct aead_alg aead_algs[] =3D { .cra_flags =3D CRYPTO_ALG_ASYNC, .cra_blocksize =3D 1, .cra_ctxsize =3D sizeof(struct stm32_cryp_ctx), - .cra_alignmask =3D 0xf, + .cra_alignmask =3D 0, .cra_module =3D THIS_MODULE, }, }, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43F1CC4167B for ; Mon, 24 Jan 2022 23:37:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360051AbiAXXfu (ORCPT ); Mon, 24 Jan 2022 18:35:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1579276AbiAXWre (ORCPT ); Mon, 24 Jan 2022 17:47:34 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17B05C058C8D; Mon, 24 Jan 2022 13:06:40 -0800 (PST) Received: from smtp.kernel.org (relay.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 96FAE6138B; Mon, 24 Jan 2022 21:06:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A87CDC340E5; Mon, 24 Jan 2022 21:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058399; bh=A7FifYEoNq3WcY60AzUYb/DEVXnbG0VC8sCAVJ03L+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L8fTVul/2M26OjLr5pUG2NVCQP1bZkV/I5sFw/a/rRLVAUJqDfZm3TOoi3PMPOMwP JknVRRNxREFa1WX09dKOcbEFXFasMVsexiIpg3UcZxtgpaZhg0i1rzYxA44Dw5iP91 ZVQgRGI6PyiV0dkg7tGsCMLznaj9jOrk8oV25euE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiner Kallweit , Herbert Xu , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0277/1039] crypto: stm32 - Revert broken pm_runtime_resume_and_get changes Date: Mon, 24 Jan 2022 19:34:26 +0100 Message-Id: <20220124184134.595013115@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Herbert Xu [ Upstream commit 3d6b661330a7954d8136df98160d525eb04dcd6a ] We should not call pm_runtime_resume_and_get where the reference count is expected to be incremented unconditionally. This patch reverts these calls to the original unconditional get_sync call. Reported-by: Heiner Kallweit Fixes: 747bf30fd944 ("crypto: stm32/cryp - Fix PM reference leak...") Fixes: 1cb3ad701970 ("crypto: stm32/hash - Fix PM reference leak...") Signed-off-by: Herbert Xu Acked-by: Rafael J. Wysocki Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/stm32/stm32-cryp.c | 3 ++- drivers/crypto/stm32/stm32-hash.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32= -cryp.c index cd57c5bae3ce9..81eb136b6c11d 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -529,7 +529,8 @@ static int stm32_cryp_hw_init(struct stm32_cryp *cryp) { int ret; u32 cfg, hw_mode; - pm_runtime_resume_and_get(cryp->dev); + + pm_runtime_get_sync(cryp->dev); =20 /* Disable interrupt */ stm32_cryp_write(cryp, CRYP_IMSCR, 0); diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32= -hash.c index 389de9e3302d5..d33006d43f761 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -813,7 +813,7 @@ static void stm32_hash_finish_req(struct ahash_request = *req, int err) static int stm32_hash_hw_init(struct stm32_hash_dev *hdev, struct stm32_hash_request_ctx *rctx) { - pm_runtime_resume_and_get(hdev->dev); + pm_runtime_get_sync(hdev->dev); =20 if (!(HASH_FLAGS_INIT & hdev->flags)) { stm32_hash_write(hdev, HASH_CR, HASH_CR_INIT); @@ -962,7 +962,7 @@ static int stm32_hash_export(struct ahash_request *req,= void *out) u32 *preg; unsigned int i; =20 - pm_runtime_resume_and_get(hdev->dev); + pm_runtime_get_sync(hdev->dev); =20 while ((stm32_hash_read(hdev, HASH_SR) & HASH_SR_BUSY)) cpu_relax(); @@ -1000,7 +1000,7 @@ static int stm32_hash_import(struct ahash_request *re= q, const void *in) =20 preg =3D rctx->hw_context; =20 - pm_runtime_resume_and_get(hdev->dev); + pm_runtime_get_sync(hdev->dev); =20 stm32_hash_write(hdev, HASH_IMR, *preg++); stm32_hash_write(hdev, HASH_STR, *preg++); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C07EDC433F5 for ; Tue, 25 Jan 2022 03:00:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315423AbiAYCxW (ORCPT ); Mon, 24 Jan 2022 21:53:22 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58932 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349099AbiAXVGs (ORCPT ); Mon, 24 Jan 2022 16:06:48 -0500 Received: from smtp.kernel.org (relay.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 4B566B81188; Mon, 24 Jan 2022 21:06:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F0AFC340E5; Mon, 24 Jan 2022 21:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058402; bh=uJ1++earz7G6KZn++LZyYdU2fw7m5hLElXi2bBZLUwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pNUg5T9OGsWu/bCGV2bQVrDQdzDKjlIYJWCYzGg/OVLya0+Lhnt1pffYVGa7Gpo// 5v7LG7GtzCpA7QuNLRAQlrhWRmyCJt7M+TbIWC8+s0dskEUy4FLJb/16X5Sdx6cd/L GCAp2gtDGZH9L26HbMOrY3M6+dKNyqwGXCHYmpOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Weili Qian , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0278/1039] crypto: hisilicon/qm - fix incorrect return value of hisi_qm_resume() Date: Mon, 24 Jan 2022 19:34:27 +0100 Message-Id: <20220124184134.628311296@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Weili Qian [ Upstream commit 3f9dd4c802b96626e869b2d29c8e401dabadd23e ] When hisi_qm_resume() returns 0, it indicates that the device has started successfully. If the device fails to start, hisi_qm_resume() needs to return the actual error code to the caller instead of 0. Fixes: d7ea53395b72 ("crypto: hisilicon - add runtime PM ops") Signed-off-by: Weili Qian Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/hisilicon/qm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 52d6cca6262e2..70b0405494db5 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -6038,7 +6038,7 @@ int hisi_qm_resume(struct device *dev) if (ret) pci_err(pdev, "failed to start qm(%d)\n", ret); =20 - return 0; + return ret; } EXPORT_SYMBOL_GPL(hisi_qm_resume); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD8BAC433FE for ; Tue, 25 Jan 2022 03:00:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315407AbiAYCxU (ORCPT ); Mon, 24 Jan 2022 21:53:20 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59310 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348762AbiAXVGs (ORCPT ); Mon, 24 Jan 2022 16:06:48 -0500 Received: from smtp.kernel.org (relay.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 CCED7612E9; Mon, 24 Jan 2022 21:06:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90D5CC340E5; Mon, 24 Jan 2022 21:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058405; bh=+VyVfYj83dZxsimPLx22dq/9IYfnUuhTlUu61BPlxBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qoz0/kz2WP2TBwb6zYSLX1IkgLR3RlvNyAllMOM+eu5VwZgTbCczTzE2BJHpTcwl5 shaUwoK5K2uqk76LaxoJWTyUOhf9U1CZ44ZILFmI0o1wc4RQY7wMQPnDAaIbvrGSap PetKoplorpSN4ScYn2AC5H2ir9Oj2P+iVwTyB5z0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.16 0279/1039] libbpf: Fix gen_loader assumption on number of programs. Date: Mon, 24 Jan 2022 19:34:28 +0100 Message-Id: <20220124184134.661928656@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 259172bb6514758ce3be1610c500b51a9f44212a ] libbpf's obj->nr_programs includes static and global functions. That number could be higher than the actual number of bpf programs going be loaded by gen_loader. Passing larger nr_programs to bpf_gen__init() doesn't hurt. Tho= se exra stack slots will stay as zero. bpf_gen__finish() needs to check that actual number of progs that gen_loader saw is less than or equal to obj->nr_programs. Fixes: ba05fd36b851 ("libbpf: Perform map fd cleanup for gen_loader in case= of error") Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/gen_loader.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/gen_loader.c b/tools/lib/bpf/gen_loader.c index 4ac65afc99e50..737e7cbe3e547 100644 --- a/tools/lib/bpf/gen_loader.c +++ b/tools/lib/bpf/gen_loader.c @@ -371,8 +371,9 @@ int bpf_gen__finish(struct bpf_gen *gen, int nr_progs, = int nr_maps) { int i; =20 - if (nr_progs !=3D gen->nr_progs || nr_maps !=3D gen->nr_maps) { - pr_warn("progs/maps mismatch\n"); + if (nr_progs < gen->nr_progs || nr_maps !=3D gen->nr_maps) { + pr_warn("nr_progs %d/%d nr_maps %d/%d mismatch\n", + nr_progs, gen->nr_progs, nr_maps, gen->nr_maps); gen->error =3D -EFAULT; return gen->error; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B581C433F5 for ; Mon, 24 Jan 2022 23:49:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364826AbiAXXtO (ORCPT ); Mon, 24 Jan 2022 18:49:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1582435AbiAXWro (ORCPT ); Mon, 24 Jan 2022 17:47:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30D14C058C96; Mon, 24 Jan 2022 13:06:49 -0800 (PST) Received: from smtp.kernel.org (relay.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 B1E7B61445; Mon, 24 Jan 2022 21:06:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9180DC340E5; Mon, 24 Jan 2022 21:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058408; bh=WdeP14lQcT211iQn/z2o5VGDSh3Z+nRsba1nDaLWiWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JkKVHWzOuYu7A9FcXK6Iklwvz6usuX2jvawyRnSzrxRwI0BnUCbZAUSJjSLzaPL/B IM9oivmd8ZJadaqb7CNX4MPEJrg5TW4fr55ITcgV6FlXHh6GdBaZlvgcJM17M7n8c4 VrVr5VBf0e1gE/kOyfXasJOfANlFRPgwBFy1ydaA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rameshkumar Sundaram , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0280/1039] ath11k: Fix deleting uninitialized kernel timer during fragment cache flush Date: Mon, 24 Jan 2022 19:34:29 +0100 Message-Id: <20220124184134.699382002@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rameshkumar Sundaram [ Upstream commit ba53ee7f7f38cf0592b8be1dcdabaf8f7535f8c1 ] frag_timer will be created & initialized for stations when they associate and will be deleted during every key installation while flushing old fragments. For AP interface self peer will be created and Group keys will be installed for this peer, but there will be no real Station entry & hence frag_timer won't be created and initialized, deleting such uninitialized kernel timers causes below warnings and backtraces printed with CONFIG_DEBUG_OBJECTS_TIMERS enabled. [ 177.828008] ODEBUG: assert_init not available (active state 0) object typ= e: timer_list hint: 0x0 [ 177.836833] WARNING: CPU: 3 PID: 188 at lib/debugobjects.c:508 debug_prin= t_object+0xb0/0xf0 [ 177.845185] Modules linked in: ath11k_pci ath11k qmi_helpers qrtr_mhi qrt= r ns mhi [ 177.852679] CPU: 3 PID: 188 Comm: hostapd Not tainted 5.14.0-rc3-32919-g4= 034139e1838-dirty #14 [ 177.865805] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=3D--) [ 177.871804] pc : debug_print_object+0xb0/0xf0 [ 177.876155] lr : debug_print_object+0xb0/0xf0 [ 177.880505] sp : ffffffc01169b5a0 [ 177.883810] x29: ffffffc01169b5a0 x28: ffffff80081c2320 x27: ffffff80081c= 4078 [ 177.890942] x26: ffffff8003fe8f28 x25: ffffff8003de9890 x24: ffffffc01134= d738 [ 177.898075] x23: ffffffc010948f20 x22: ffffffc010b2d2e0 x21: ffffffc01169= b628 [ 177.905206] x20: ffffffc01134d700 x19: ffffffc010c80d98 x18: 000000000000= 03f6 [ 177.912339] x17: 203a657079742074 x16: 63656a626f202930 x15: 000000000000= 0152 [ 177.919471] x14: 0000000000000152 x13: 00000000ffffffea x12: ffffffc010d7= 32e0 [ 177.926603] x11: 0000000000000003 x10: ffffffc010d432a0 x9 : ffffffc010d4= 32f8 [ 177.933735] x8 : 000000000002ffe8 x7 : c0000000ffffdfff x6 : 000000000000= 0001 [ 177.940866] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 00000000ffff= ffff [ 177.947997] x2 : ffffffc010c93240 x1 : ffffff80023624c0 x0 : 000000000000= 0054 [ 177.955130] Call trace: [ 177.957567] debug_print_object+0xb0/0xf0 [ 177.961570] debug_object_assert_init+0x124/0x178 [ 177.966269] try_to_del_timer_sync+0x1c/0x70 [ 177.970536] del_timer_sync+0x30/0x50 [ 177.974192] ath11k_peer_frags_flush+0x34/0x68 [ath11k] [ 177.979439] ath11k_mac_op_set_key+0x1e4/0x338 [ath11k] [ 177.984673] ieee80211_key_enable_hw_accel+0xc8/0x3d0 [ 177.989722] ieee80211_key_replace+0x360/0x740 [ 177.994160] ieee80211_key_link+0x16c/0x210 [ 177.998337] ieee80211_add_key+0x138/0x338 [ 178.002426] nl80211_new_key+0xfc/0x258 [ 178.006257] genl_family_rcv_msg_doit.isra.17+0xd8/0x120 [ 178.011565] genl_rcv_msg+0xd8/0x1c8 [ 178.015134] netlink_rcv_skb+0x38/0xf8 [ 178.018877] genl_rcv+0x34/0x48 [ 178.022012] netlink_unicast+0x174/0x230 [ 178.025928] netlink_sendmsg+0x188/0x388 [ 178.029845] ____sys_sendmsg+0x218/0x250 [ 178.033763] ___sys_sendmsg+0x68/0x90 [ 178.037418] __sys_sendmsg+0x44/0x88 [ 178.040988] __arm64_sys_sendmsg+0x20/0x28 [ 178.045077] invoke_syscall.constprop.5+0x54/0xe0 [ 178.049776] do_el0_svc+0x74/0xc0 [ 178.053084] el0_svc+0x10/0x18 [ 178.056133] el0t_64_sync_handler+0x88/0xb0 [ 178.060310] el0t_64_sync+0x148/0x14c [ 178.063966] ---[ end trace 8a5cf0bf9d34a058 ]--- Add changes to not to delete frag timer for peers during group key installation. Tested on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01092-QCAHKSWPL_SILICONZ-1 Fixes: c3944a562102 ("ath11k: Clear the fragment cache during key install") Signed-off-by: Rameshkumar Sundaram Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1639071421-25078-1-git-send-email-quic_rame= ss@quicinc.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 821332cbeb5de..67be109eda910 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -3452,7 +3452,7 @@ static int ath11k_mac_op_set_key(struct ieee80211_hw = *hw, enum set_key_cmd cmd, /* flush the fragments cache during key (re)install to * ensure all frags in the new frag list belong to the same key. */ - if (peer && cmd =3D=3D SET_KEY) + if (peer && sta && cmd =3D=3D SET_KEY) ath11k_peer_frags_flush(ar, peer); spin_unlock_bh(&ab->base_lock); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A4D9C4167E for ; Mon, 24 Jan 2022 23:37:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360078AbiAXXfy (ORCPT ); Mon, 24 Jan 2022 18:35:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382470AbiAXWrt (ORCPT ); Mon, 24 Jan 2022 17:47:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDCCAC058CA7; Mon, 24 Jan 2022 13:06:56 -0800 (PST) Received: from smtp.kernel.org (relay.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 7A0B3B8105C; Mon, 24 Jan 2022 21:06:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B18CC340E5; Mon, 24 Jan 2022 21:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058414; bh=euvV2qblln196cQvs0sdoJbEw5S8kf4Gg7n8AGEG8qg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KlYddX6MY+4ZHcrDGJRw02u/07UI034w8aMA6ZETUlSN1Dt//pGbEvWFd9jWcR2y7 BRMk/nih7E0mdpDvTnjpt0L7bGrHcZwcwg6jF1yskvyGmha+5Z0Id0nwO0Lzsg4qZw ELmdbMboqqh2AC/KSdzXkzDLNz7ASHVGm+EkOhvk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hector Martin , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0281/1039] spi: Fix incorrect cs_setup delay handling Date: Mon, 24 Jan 2022 19:34:30 +0100 Message-Id: <20220124184134.731725722@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 95c07247399536f83b89dc60cfe7b279d17e69f6 ] Move the cs_setup delay to the end of spi_set_cs. >From include/linux/spi/spi.h: * @cs_setup: delay to be introduced by the controller after CS is asserted The cs_setup delay needs to happen *after* CS is asserted, that is, at the end of spi_set_cs, not at the beginning. Otherwise we're just delaying before the SPI transaction starts at all, which isn't very useful. No drivers use this right now, but that is likely to change soon with an upcoming Apple SPI HID transport driver. Fixes: 25093bdeb6bc ("spi: implement SW control for CS times") Signed-off-by: Hector Martin Link: https://lore.kernel.org/r/20211210170534.177139-1-marcan@marcan.st Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/spi/spi.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index fdd530b150a7a..8ba87b7f8f1a8 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -947,12 +947,9 @@ static void spi_set_cs(struct spi_device *spi, bool en= able, bool force) spi->controller->last_cs_enable =3D enable; spi->controller->last_cs_mode_high =3D spi->mode & SPI_CS_HIGH; =20 - if (spi->cs_gpiod || gpio_is_valid(spi->cs_gpio) || - !spi->controller->set_cs_timing) { - if (activate) - spi_delay_exec(&spi->cs_setup, NULL); - else - spi_delay_exec(&spi->cs_hold, NULL); + if ((spi->cs_gpiod || gpio_is_valid(spi->cs_gpio) || + !spi->controller->set_cs_timing) && !activate) { + spi_delay_exec(&spi->cs_hold, NULL); } =20 if (spi->mode & SPI_CS_HIGH) @@ -994,7 +991,9 @@ static void spi_set_cs(struct spi_device *spi, bool ena= ble, bool force) =20 if (spi->cs_gpiod || gpio_is_valid(spi->cs_gpio) || !spi->controller->set_cs_timing) { - if (!activate) + if (activate) + spi_delay_exec(&spi->cs_setup, NULL); + else spi_delay_exec(&spi->cs_inactive, NULL); } } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F064C4707E for ; Tue, 25 Jan 2022 01:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413162AbiAYAib (ORCPT ); Mon, 24 Jan 2022 19:38:31 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59470 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444318AbiAXVG7 (ORCPT ); Mon, 24 Jan 2022 16:06:59 -0500 Received: from smtp.kernel.org (relay.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 CC29061451; Mon, 24 Jan 2022 21:06:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83AB5C340E5; Mon, 24 Jan 2022 21:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058417; bh=aJ5YBxeO/4QRHT8rngDaLNVmp8PG20YzWHTts758vWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rslqiSlF3EKnu4qdJkIu3l5J51yFtfNPjEtbrzwV9Hhl3zifJ5GN8vjYpIUxrIveO ENH6GYsThmlkg9LOA3Snc9YMeDw8vC8i0hpThdyHpBS1lEo6qBDwQ/EKT8ao7EYOrn wWj2J2w/XqsdEl8suObpbhZxkXI7POqny9QVrYew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Latypov , David Gow , Brendan Higgins , Shuah Khan , Sasha Levin Subject: [PATCH 5.16 0282/1039] kunit: tool: fix --json output for skipped tests Date: Mon, 24 Jan 2022 19:34:31 +0100 Message-Id: <20220124184134.768342225@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Latypov [ Upstream commit 9a6bb30a8830bb868b09629f0b9ad5d2b5fbb2f9 ] Currently, KUnit will report SKIPPED tests as having failed if one uses --json. Add the missing if statement to set the appropriate status ("SKIP"). See https://api.kernelci.org/schema-test-case.html: "status": { "type": "string", "description": "The status of the execution of this test case", "enum": ["PASS", "FAIL", "SKIP", "ERROR"], "default": "PASS" }, with this, we now can properly produce all four of the statuses. Fixes: 5acaf6031f53 ("kunit: tool: Support skipped tests in kunit_tool") Signed-off-by: Daniel Latypov Reviewed-by: David Gow Reviewed-by: Brendan Higgins Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/kunit/kunit_json.py | 2 ++ tools/testing/kunit/kunit_tool_test.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/tools/testing/kunit/kunit_json.py b/tools/testing/kunit/kunit_= json.py index 746bec72b9ac2..b6e66c5d64d14 100644 --- a/tools/testing/kunit/kunit_json.py +++ b/tools/testing/kunit/kunit_json.py @@ -30,6 +30,8 @@ def _get_group_json(test: Test, def_config: str, test_case =3D {"name": subtest.name, "status": "FAIL"} if subtest.status =3D=3D TestStatus.SUCCESS: test_case["status"] =3D "PASS" + elif subtest.status =3D=3D TestStatus.SKIPPED: + test_case["status"] =3D "SKIP" elif subtest.status =3D=3D TestStatus.TEST_CRASHED: test_case["status"] =3D "ERROR" test_cases.append(test_case) diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/k= unit_tool_test.py index 9c41267314573..34cb0a12ba180 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -383,6 +383,12 @@ class KUnitJsonTest(unittest.TestCase): {'name': 'example_simple_test', 'status': 'ERROR'}, result["sub_groups"][1]["test_cases"][0]) =20 + def test_skipped_test_json(self): + result =3D self._json_for('test_skip_tests.log') + self.assertEqual( + {'name': 'example_skip_test', 'status': 'SKIP'}, + result["sub_groups"][1]["test_cases"][1]) + def test_no_tests_json(self): result =3D self._json_for('test_is_test_passed-no_tests_run_with_header.= log') self.assertEqual(0, len(result['sub_groups'])) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5FE1C433EF for ; Mon, 24 Jan 2022 23:48:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364602AbiAXXsh (ORCPT ); Mon, 24 Jan 2022 18:48:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838697AbiAXWry (ORCPT ); Mon, 24 Jan 2022 17:47:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E8A8C058CB0; Mon, 24 Jan 2022 13:07:01 -0800 (PST) Received: from smtp.kernel.org (relay.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 E22F26131F; Mon, 24 Jan 2022 21:07:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEF8CC340E5; Mon, 24 Jan 2022 21:06:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058420; bh=gpWjQ0VaBNniP4xA1fEF6HlyF6wN8PjRmBVxu/REmpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0mK114W1b0NCUzMHpDwjLB2BgwSWAP8xQvV1FtOUhmqfg7v002SUPhqTb6wNb1HSV qS7HQ7QSadMLYS5Gz1vTJ2MoBwP1/gkNumKF37tvEcuesGyYaKpI+WGEHsdMyfBqOk bgsKPDGM1mloBozLL536JLkL2nf23EfKVcKgm6Rc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steven Maddox , Christian Lamparter , Linus Walleij , Arnd Bergmann , Sasha Levin Subject: [PATCH 5.16 0283/1039] ARM: dts: gemini: NAS4220-B: fis-index-block with 128 KiB sectors Date: Mon, 24 Jan 2022 19:34:32 +0100 Message-Id: <20220124184134.800970372@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Lamparter [ Upstream commit 4754eab7e5a78bdefe7a960c5c260c95ebbb5fa6 ] Steven Maddox reported in the OpenWrt bugzilla, that his RaidSonic IB-NAS4220-B was no longer booting with the new OpenWrt 21.02 (uses linux 5.10's device-tree). However, it was working with the previous OpenWrt 19.07 series (uses 4.14). |[ 5.548038] No RedBoot partition table detected in 30000000.flash |[ 5.618553] Searching for RedBoot partition table in 30000000.flash at = offset 0x0 |[ 5.739093] No RedBoot partition table detected in 30000000.flash |... |[ 7.039504] Waiting for root device /dev/mtdblock3... The provided bootlog shows that the RedBoot partition parser was looking for the partition table "at offset 0x0". Which is strange since the comment in the device-tree says it should be at 0xfe0000. Further digging on the internet led to a review site that took some useful PCB pictures of their review unit back in February 2009. Their picture shows a Spansion S29GL128N11TFI01 flash chip. >From Spansion's Datasheet: "S29GL128N: One hundred twenty-eight 64 Kword (128 Kbyte) sectors" Steven also provided a "cat /sys/class/mtd/mtd0/erasesize" from his unit: "131072". With the 128 KiB Sector/Erasesize in mind. This patch changes the fis-index-block property to (0xfe0000 / 0x20000) =3D 0x7f. Fixes: b5a923f8c739 ("ARM: dts: gemini: Switch to redboot partition parsing= ") Reported-by: Steven Maddox Signed-off-by: Christian Lamparter Signed-off-by: Linus Walleij Tested-by: Steven Maddox Link: https://lore.kernel.org/r/20211206004334.4169408-1-linus.walleij@lina= ro.org' Bugzilla: https://bugs.openwrt.org/index.php?do=3Ddetails&task_id=3D4137 Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/boot/dts/gemini-nas4220b.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/gemini-nas4220b.dts b/arch/arm/boot/dts/gemi= ni-nas4220b.dts index 13112a8a5dd88..6544c730340fa 100644 --- a/arch/arm/boot/dts/gemini-nas4220b.dts +++ b/arch/arm/boot/dts/gemini-nas4220b.dts @@ -84,7 +84,7 @@ partitions { compatible =3D "redboot-fis"; /* Eraseblock at 0xfe0000 */ - fis-index-block =3D <0x1fc>; + fis-index-block =3D <0x7f>; }; }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B8B4C3526E for ; Tue, 25 Jan 2022 01:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413131AbiAYAi2 (ORCPT ); Mon, 24 Jan 2022 19:38:28 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59174 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354330AbiAXVHG (ORCPT ); Mon, 24 Jan 2022 16:07:06 -0500 Received: from smtp.kernel.org (relay.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 C30B7B8105C; Mon, 24 Jan 2022 21:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D308EC340E5; Mon, 24 Jan 2022 21:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058423; bh=ZTyiFhQJN4fI0ohqFr2xGTdcTomL+FISSSU8k9rBfuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sn76BkUr7b3v3qs36ZCZdh8d/ix7VC4wsUKL4SmEhD+yciE8m3LzI60mb/Nqb8GzN dJOOZDr8EfItfLUsAbYi/QhHdLSf88mCiSNk+vaABv37mvYLC/9J6dNInu0Vup/nYD 9+jAk4Di3Z18rbporIDUhNC41utHDXI5L+vy3bZ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Murphy , Will Deacon , Sasha Levin Subject: [PATCH 5.16 0284/1039] perf/arm-cmn: Fix CPU hotplug unregistration Date: Mon, 24 Jan 2022 19:34:33 +0100 Message-Id: <20220124184134.829380525@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Murphy [ Upstream commit 56c7c6eaf3eb8ac1ec40d56096c0f2b27250da5f ] Attempting to migrate the PMU context after we've unregistered the PMU device, or especially if we never successfully registered it in the first place, is a woefully bad idea. It's also fundamentally pointless anyway. Make sure to unregister an instance from the hotplug handler *without* invoking the teardown callback. Fixes: 0ba64770a2f2 ("perf: Add Arm CMN-600 PMU driver") Signed-off-by: Robin Murphy Link: https://lore.kernel.org/r/2c221d745544774e4b07583b65b5d4d94f7e0fe4.16= 38530442.git.robin.murphy@arm.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/perf/arm-cmn.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index bc3cba5f8c5dc..400eb7f579dce 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -1561,7 +1561,8 @@ static int arm_cmn_probe(struct platform_device *pdev) =20 err =3D perf_pmu_register(&cmn->pmu, name, -1); if (err) - cpuhp_state_remove_instance(arm_cmn_hp_state, &cmn->cpuhp_node); + cpuhp_state_remove_instance_nocalls(arm_cmn_hp_state, &cmn->cpuhp_node); + return err; } =20 @@ -1572,7 +1573,7 @@ static int arm_cmn_remove(struct platform_device *pde= v) writel_relaxed(0, cmn->dtc[0].base + CMN_DT_DTC_CTL); =20 perf_pmu_unregister(&cmn->pmu); - cpuhp_state_remove_instance(arm_cmn_hp_state, &cmn->cpuhp_node); + cpuhp_state_remove_instance_nocalls(arm_cmn_hp_state, &cmn->cpuhp_node); return 0; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EC64C433F5 for ; Mon, 24 Jan 2022 23:49:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364744AbiAXXs4 (ORCPT ); Mon, 24 Jan 2022 18:48:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838704AbiAXWry (ORCPT ); Mon, 24 Jan 2022 17:47:54 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4C05C058CBF; Mon, 24 Jan 2022 13:07:08 -0800 (PST) Received: from smtp.kernel.org (relay.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 AD742B810BD; Mon, 24 Jan 2022 21:07:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD89AC340E5; Mon, 24 Jan 2022 21:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058426; bh=XgkWYbF8Be1cVQ7orv0JJaV7gZb0NxSF/auslZXVjdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oaJy69sU3V/hD1kGY9GPVf0s+95tF7wKjH5c29v8/ag2QQYKC2kQCzHeFHUmo9GQ3 C2TrrXJiI6V/uIoBJug5WGK5D6nsOWRmo5HGM3dnRIyK3igKL4iZsz829Xyl+Kk/Oj 8zkKAuS7e+N9RfCUPr1yf9ixMeSt/Wyt85rUpEpM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anton Vasilyev , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0285/1039] media: dw2102: Fix use after free Date: Mon, 24 Jan 2022 19:34:34 +0100 Message-Id: <20220124184134.867917232@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Anton Vasilyev [ Upstream commit 589a9f0eb799f77de2c09583bf5bad221fa5d685 ] dvb_usb_device_init stores parts of properties at d->props and d->desc and uses it on dvb_usb_device_exit. Free of properties on module probe leads to use after free. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=3D204597 The patch makes properties static instead of allocated on heap to prevent memleak and use after free. Also fixes s421_properties.devices initialization to have 2 element instead of 6 copied from p7500_properties. [mchehab: fix function call alignments] Link: https://lore.kernel.org/linux-media/20190822104147.4420-1-vasilyev@is= pras.ru Signed-off-by: Anton Vasilyev Fixes: 299c7007e936 ("media: dw2102: Fix memleak on sequence of probes") Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/dvb-usb/dw2102.c | 338 ++++++++++++++++++----------- 1 file changed, 215 insertions(+), 123 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb= /dw2102.c index f0e686b05dc63..ca75ebdc10b37 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -2150,46 +2150,153 @@ static struct dvb_usb_device_properties s6x0_prope= rties =3D { } }; =20 -static const struct dvb_usb_device_description d1100 =3D { - "Prof 1100 USB ", - {&dw2102_table[PROF_1100], NULL}, - {NULL}, -}; +static struct dvb_usb_device_properties p1100_properties =3D { + .caps =3D DVB_USB_IS_AN_I2C_ADAPTER, + .usb_ctrl =3D DEVICE_SPECIFIC, + .size_of_priv =3D sizeof(struct dw2102_state), + .firmware =3D P1100_FIRMWARE, + .no_reconnect =3D 1, =20 -static const struct dvb_usb_device_description d660 =3D { - "TeVii S660 USB", - {&dw2102_table[TEVII_S660], NULL}, - {NULL}, -}; + .i2c_algo =3D &s6x0_i2c_algo, + .rc.core =3D { + .rc_interval =3D 150, + .rc_codes =3D RC_MAP_TBS_NEC, + .module_name =3D "dw2102", + .allowed_protos =3D RC_PROTO_BIT_NEC, + .rc_query =3D prof_rc_query, + }, =20 -static const struct dvb_usb_device_description d480_1 =3D { - "TeVii S480.1 USB", - {&dw2102_table[TEVII_S480_1], NULL}, - {NULL}, + .generic_bulk_ctrl_endpoint =3D 0x81, + .num_adapters =3D 1, + .download_firmware =3D dw2102_load_firmware, + .read_mac_address =3D s6x0_read_mac_address, + .adapter =3D { + { + .num_frontends =3D 1, + .fe =3D {{ + .frontend_attach =3D stv0288_frontend_attach, + .stream =3D { + .type =3D USB_BULK, + .count =3D 8, + .endpoint =3D 0x82, + .u =3D { + .bulk =3D { + .buffersize =3D 4096, + } + } + }, + } }, + } + }, + .num_device_descs =3D 1, + .devices =3D { + {"Prof 1100 USB ", + {&dw2102_table[PROF_1100], NULL}, + {NULL}, + }, + } }; =20 -static const struct dvb_usb_device_description d480_2 =3D { - "TeVii S480.2 USB", - {&dw2102_table[TEVII_S480_2], NULL}, - {NULL}, -}; +static struct dvb_usb_device_properties s660_properties =3D { + .caps =3D DVB_USB_IS_AN_I2C_ADAPTER, + .usb_ctrl =3D DEVICE_SPECIFIC, + .size_of_priv =3D sizeof(struct dw2102_state), + .firmware =3D S660_FIRMWARE, + .no_reconnect =3D 1, =20 -static const struct dvb_usb_device_description d7500 =3D { - "Prof 7500 USB DVB-S2", - {&dw2102_table[PROF_7500], NULL}, - {NULL}, -}; + .i2c_algo =3D &s6x0_i2c_algo, + .rc.core =3D { + .rc_interval =3D 150, + .rc_codes =3D RC_MAP_TEVII_NEC, + .module_name =3D "dw2102", + .allowed_protos =3D RC_PROTO_BIT_NEC, + .rc_query =3D dw2102_rc_query, + }, =20 -static const struct dvb_usb_device_description d421 =3D { - "TeVii S421 PCI", - {&dw2102_table[TEVII_S421], NULL}, - {NULL}, + .generic_bulk_ctrl_endpoint =3D 0x81, + .num_adapters =3D 1, + .download_firmware =3D dw2102_load_firmware, + .read_mac_address =3D s6x0_read_mac_address, + .adapter =3D { + { + .num_frontends =3D 1, + .fe =3D {{ + .frontend_attach =3D ds3000_frontend_attach, + .stream =3D { + .type =3D USB_BULK, + .count =3D 8, + .endpoint =3D 0x82, + .u =3D { + .bulk =3D { + .buffersize =3D 4096, + } + } + }, + } }, + } + }, + .num_device_descs =3D 3, + .devices =3D { + {"TeVii S660 USB", + {&dw2102_table[TEVII_S660], NULL}, + {NULL}, + }, + {"TeVii S480.1 USB", + {&dw2102_table[TEVII_S480_1], NULL}, + {NULL}, + }, + {"TeVii S480.2 USB", + {&dw2102_table[TEVII_S480_2], NULL}, + {NULL}, + }, + } }; =20 -static const struct dvb_usb_device_description d632 =3D { - "TeVii S632 USB", - {&dw2102_table[TEVII_S632], NULL}, - {NULL}, +static struct dvb_usb_device_properties p7500_properties =3D { + .caps =3D DVB_USB_IS_AN_I2C_ADAPTER, + .usb_ctrl =3D DEVICE_SPECIFIC, + .size_of_priv =3D sizeof(struct dw2102_state), + .firmware =3D P7500_FIRMWARE, + .no_reconnect =3D 1, + + .i2c_algo =3D &s6x0_i2c_algo, + .rc.core =3D { + .rc_interval =3D 150, + .rc_codes =3D RC_MAP_TBS_NEC, + .module_name =3D "dw2102", + .allowed_protos =3D RC_PROTO_BIT_NEC, + .rc_query =3D prof_rc_query, + }, + + .generic_bulk_ctrl_endpoint =3D 0x81, + .num_adapters =3D 1, + .download_firmware =3D dw2102_load_firmware, + .read_mac_address =3D s6x0_read_mac_address, + .adapter =3D { + { + .num_frontends =3D 1, + .fe =3D {{ + .frontend_attach =3D prof_7500_frontend_attach, + .stream =3D { + .type =3D USB_BULK, + .count =3D 8, + .endpoint =3D 0x82, + .u =3D { + .bulk =3D { + .buffersize =3D 4096, + } + } + }, + } }, + } + }, + .num_device_descs =3D 1, + .devices =3D { + {"Prof 7500 USB DVB-S2", + {&dw2102_table[PROF_7500], NULL}, + {NULL}, + }, + } }; =20 static struct dvb_usb_device_properties su3000_properties =3D { @@ -2273,6 +2380,59 @@ static struct dvb_usb_device_properties su3000_prope= rties =3D { } }; =20 +static struct dvb_usb_device_properties s421_properties =3D { + .caps =3D DVB_USB_IS_AN_I2C_ADAPTER, + .usb_ctrl =3D DEVICE_SPECIFIC, + .size_of_priv =3D sizeof(struct dw2102_state), + .power_ctrl =3D su3000_power_ctrl, + .num_adapters =3D 1, + .identify_state =3D su3000_identify_state, + .i2c_algo =3D &su3000_i2c_algo, + + .rc.core =3D { + .rc_interval =3D 150, + .rc_codes =3D RC_MAP_SU3000, + .module_name =3D "dw2102", + .allowed_protos =3D RC_PROTO_BIT_RC5, + .rc_query =3D su3000_rc_query, + }, + + .read_mac_address =3D su3000_read_mac_address, + + .generic_bulk_ctrl_endpoint =3D 0x01, + + .adapter =3D { + { + .num_frontends =3D 1, + .fe =3D {{ + .streaming_ctrl =3D su3000_streaming_ctrl, + .frontend_attach =3D m88rs2000_frontend_attach, + .stream =3D { + .type =3D USB_BULK, + .count =3D 8, + .endpoint =3D 0x82, + .u =3D { + .bulk =3D { + .buffersize =3D 4096, + } + } + } + } }, + } + }, + .num_device_descs =3D 2, + .devices =3D { + { "TeVii S421 PCI", + { &dw2102_table[TEVII_S421], NULL }, + { NULL }, + }, + { "TeVii S632 USB", + { &dw2102_table[TEVII_S632], NULL }, + { NULL }, + }, + } +}; + static struct dvb_usb_device_properties t220_properties =3D { .caps =3D DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl =3D DEVICE_SPECIFIC, @@ -2390,101 +2550,33 @@ static struct dvb_usb_device_properties tt_s2_4600= _properties =3D { static int dw2102_probe(struct usb_interface *intf, const struct usb_device_id *id) { - int retval =3D -ENOMEM; - struct dvb_usb_device_properties *p1100; - struct dvb_usb_device_properties *s660; - struct dvb_usb_device_properties *p7500; - struct dvb_usb_device_properties *s421; - - p1100 =3D kmemdup(&s6x0_properties, - sizeof(struct dvb_usb_device_properties), GFP_KERNEL); - if (!p1100) - goto err0; - - /* copy default structure */ - /* fill only different fields */ - p1100->firmware =3D P1100_FIRMWARE; - p1100->devices[0] =3D d1100; - p1100->rc.core.rc_query =3D prof_rc_query; - p1100->rc.core.rc_codes =3D RC_MAP_TBS_NEC; - p1100->adapter->fe[0].frontend_attach =3D stv0288_frontend_attach; - - s660 =3D kmemdup(&s6x0_properties, - sizeof(struct dvb_usb_device_properties), GFP_KERNEL); - if (!s660) - goto err1; - - s660->firmware =3D S660_FIRMWARE; - s660->num_device_descs =3D 3; - s660->devices[0] =3D d660; - s660->devices[1] =3D d480_1; - s660->devices[2] =3D d480_2; - s660->adapter->fe[0].frontend_attach =3D ds3000_frontend_attach; - - p7500 =3D kmemdup(&s6x0_properties, - sizeof(struct dvb_usb_device_properties), GFP_KERNEL); - if (!p7500) - goto err2; - - p7500->firmware =3D P7500_FIRMWARE; - p7500->devices[0] =3D d7500; - p7500->rc.core.rc_query =3D prof_rc_query; - p7500->rc.core.rc_codes =3D RC_MAP_TBS_NEC; - p7500->adapter->fe[0].frontend_attach =3D prof_7500_frontend_attach; - - - s421 =3D kmemdup(&su3000_properties, - sizeof(struct dvb_usb_device_properties), GFP_KERNEL); - if (!s421) - goto err3; - - s421->num_device_descs =3D 2; - s421->devices[0] =3D d421; - s421->devices[1] =3D d632; - s421->adapter->fe[0].frontend_attach =3D m88rs2000_frontend_attach; - - if (0 =3D=3D dvb_usb_device_init(intf, &dw2102_properties, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, &dw2104_properties, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, &dw3101_properties, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, &s6x0_properties, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, p1100, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, s660, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, p7500, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, s421, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, &su3000_properties, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, &t220_properties, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, &tt_s2_4600_properties, - THIS_MODULE, NULL, adapter_nr)) { - - /* clean up copied properties */ - kfree(s421); - kfree(p7500); - kfree(s660); - kfree(p1100); + if (!(dvb_usb_device_init(intf, &dw2102_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &dw2104_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &dw3101_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &s6x0_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &p1100_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &s660_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &p7500_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &s421_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &su3000_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &t220_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &tt_s2_4600_properties, + THIS_MODULE, NULL, adapter_nr))) { =20 return 0; } =20 - retval =3D -ENODEV; - kfree(s421); -err3: - kfree(p7500); -err2: - kfree(s660); -err1: - kfree(p1100); -err0: - return retval; + return -ENODEV; } =20 static void dw2102_disconnect(struct usb_interface *intf) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DC0BC4167D for ; Mon, 24 Jan 2022 23:37:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360236AbiAXXgT (ORCPT ); Mon, 24 Jan 2022 18:36:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838710AbiAXWry (ORCPT ); Mon, 24 Jan 2022 17:47:54 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20B3EC06B5BB; Mon, 24 Jan 2022 13:07:12 -0800 (PST) Received: from smtp.kernel.org (relay.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 D1A6BB81057; Mon, 24 Jan 2022 21:07:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3326C340E5; Mon, 24 Jan 2022 21:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058429; bh=dqbWfEMlNE/Ni041E7Yb6Yct9cWyfdGrWOafYB2jzak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSGcYUwikDNEfFyDCD5JUiORZtillwmuZt4I8nFf2kbI2NciuHjyDRtvSro5bkuy7 2tt8r/i1eHec9aMj1q4amFy3y3E4O6CLQbpokYwU9PKYr39zgbCRiClJAkw0KHMb1Z 2n1ui2o7/MB5p4VF6OmYX6xuvnhh734yDpbriLGM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0286/1039] media: msi001: fix possible null-ptr-deref in msi001_probe() Date: Mon, 24 Jan 2022 19:34:35 +0100 Message-Id: <20220124184134.899133471@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wang Hai [ Upstream commit 3d5831a40d3464eea158180eb12cbd81c5edfb6a ] I got a null-ptr-deref report: BUG: kernel NULL pointer dereference, address: 0000000000000060 ... RIP: 0010:v4l2_ctrl_auto_cluster+0x57/0x270 ... Call Trace: msi001_probe+0x13b/0x24b [msi001] spi_probe+0xeb/0x130 ... do_syscall_64+0x35/0xb0 In msi001_probe(), if the creation of control for bandwidth_auto fails, there will be a null-ptr-deref issue when it is used in v4l2_ctrl_auto_cluster(). Check dev->hdl.error before v4l2_ctrl_auto_cluster() to fix this bug. Link: https://lore.kernel.org/linux-media/20211026112348.2878040-1-wanghai3= 8@huawei.com Fixes: 93203dd6c7c4 ("[media] msi001: Mirics MSi001 silicon tuner driver") Reported-by: Hulk Robot Signed-off-by: Wang Hai Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/tuners/msi001.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/tuners/msi001.c b/drivers/media/tuners/msi001.c index 78e6fd600d8ef..44247049a3190 100644 --- a/drivers/media/tuners/msi001.c +++ b/drivers/media/tuners/msi001.c @@ -442,6 +442,13 @@ static int msi001_probe(struct spi_device *spi) V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1); dev->bandwidth =3D v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, V4L2_CID_RF_TUNER_BANDWIDTH, 200000, 8000000, 1, 200000); + if (dev->hdl.error) { + ret =3D dev->hdl.error; + dev_err(&spi->dev, "Could not initialize controls\n"); + /* control init failed, free handler */ + goto err_ctrl_handler_free; + } + v4l2_ctrl_auto_cluster(2, &dev->bandwidth_auto, 0, false); dev->lna_gain =3D v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, V4L2_CID_RF_TUNER_LNA_GAIN, 0, 1, 1, 1); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39DB4C433EF for ; Mon, 24 Jan 2022 23:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360296AbiAXXgZ (ORCPT ); Mon, 24 Jan 2022 18:36:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838729AbiAXWr6 (ORCPT ); Mon, 24 Jan 2022 17:47:58 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4615C06B5BC; Mon, 24 Jan 2022 13:07:13 -0800 (PST) Received: from smtp.kernel.org (relay.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 4522C61320; Mon, 24 Jan 2022 21:07:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CC69C340E5; Mon, 24 Jan 2022 21:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058432; bh=R+WX8tRh9BhkMM3bYGELy4TMhMrbAv10+Nlt5zhG0vg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PzAMTE8Q3fYvRSivvG2A+F/PnnvpJ7/lui00eIGGG7qyDa33dfUBHreGFyPa/clFi Ld4/mhoORRSObDhA/5iovarN0CsP6wxcTsQ+4g9I8Hnem8Xrg6wXzL6gAGgd5/WyJL 9DRk51ihkdfhlosDpVLmtiNajD1Ks32hVRKUM6YQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0287/1039] media: coda/imx-vdoa: Handle dma_set_coherent_mask error codes Date: Mon, 24 Jan 2022 19:34:36 +0100 Message-Id: <20220124184134.932125326@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 43f0633f89947df57fe0b5025bdd741768007708 ] The return value of dma_set_coherent_mask() is not always 0. To catch the exception in case that dma is not support the mask. Link: https://lore.kernel.org/linux-media/20211206022201.1639460-1-jiasheng= @iscas.ac.cn Fixes: b0444f18e0b1 ("[media] coda: add i.MX6 VDOA driver") Signed-off-by: Jiasheng Jiang Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/coda/imx-vdoa.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/coda/imx-vdoa.c b/drivers/media/platfor= m/coda/imx-vdoa.c index 6996d4571e363..00643f37b3e6f 100644 --- a/drivers/media/platform/coda/imx-vdoa.c +++ b/drivers/media/platform/coda/imx-vdoa.c @@ -287,7 +287,11 @@ static int vdoa_probe(struct platform_device *pdev) struct resource *res; int ret; =20 - dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); + ret =3D dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&pdev->dev, "DMA enable failed\n"); + return ret; + } =20 vdoa =3D devm_kzalloc(&pdev->dev, sizeof(*vdoa), GFP_KERNEL); if (!vdoa) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CBABC35272 for ; Mon, 24 Jan 2022 23:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360215AbiAXXgO (ORCPT ); Mon, 24 Jan 2022 18:36:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838727AbiAXWr6 (ORCPT ); Mon, 24 Jan 2022 17:47:58 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA7AEC068091; Mon, 24 Jan 2022 13:07:16 -0800 (PST) Received: from smtp.kernel.org (relay.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 581B161320; Mon, 24 Jan 2022 21:07:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D45FC340E5; Mon, 24 Jan 2022 21:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058435; bh=UJoBk2AX7uagF3E4lBveV8DtzXXk/DzkBuDh3DUoHyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qpqlgGnQy+FusC03hE5tN1sdYoIcHwBsl+UVeu4DkcyPhZQwsGQrAa9R0GeXl3F1g /S7n54KU3wWHVEe2G9fLKNBUQIyjCOi6TPTtgjY3Xq0fyneBYIWupp2GJp6naqB7fR sdOEZ2HQPfT+xj9czzSharJFOFpBLfinfgIHuXzw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0288/1039] ath11k: Fix a NULL pointer dereference in ath11k_mac_op_hw_scan() Date: Mon, 24 Jan 2022 19:34:37 +0100 Message-Id: <20220124184134.963810672@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit eccd25136386a04ebf46a64f3a34e8e0fab6d9e1 ] In ath11k_mac_op_hw_scan(), the return value of kzalloc() is directly used in memcpy(), which may lead to a NULL pointer dereference on failure of kzalloc(). Fix this bug by adding a check of arg.extraie.ptr. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_ATH11K=3Dm show no new warnings, and our static analyzer no longer warns about this code. Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Zhou Qingyang Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211202155348.71315-1-zhou1615@umn.edu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/mac.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 67be109eda910..5d49a7ea51fae 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -3241,9 +3241,12 @@ static int ath11k_mac_op_hw_scan(struct ieee80211_hw= *hw, arg.scan_id =3D ATH11K_SCAN_ID; =20 if (req->ie_len) { + arg.extraie.ptr =3D kmemdup(req->ie, req->ie_len, GFP_KERNEL); + if (!arg.extraie.ptr) { + ret =3D -ENOMEM; + goto exit; + } arg.extraie.len =3D req->ie_len; - arg.extraie.ptr =3D kzalloc(req->ie_len, GFP_KERNEL); - memcpy(arg.extraie.ptr, req->ie, req->ie_len); } =20 if (req->n_ssids) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1B0AC43217 for ; Mon, 24 Jan 2022 23:37:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360128AbiAXXgF (ORCPT ); Mon, 24 Jan 2022 18:36:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838741AbiAXWsA (ORCPT ); Mon, 24 Jan 2022 17:48:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D003BC068094; Mon, 24 Jan 2022 13:07:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 6A63161446; Mon, 24 Jan 2022 21:07:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33995C340E5; Mon, 24 Jan 2022 21:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058438; bh=wObO+B5KFU6f959FvGizWAR8qcGc9TgRvKJQdmxbzMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hYWSSxeLF1xuLIi3U9ai7mz2AT/2SY09trC2pdk85m1+nBV9xvyZdNpn+9ubzGZQ+ SsyOzy9RMmXbBwPkQBljGdyMn4RZ9DUv8i4mQ6u1Dk7GD2OVMBv3Ze2sx5g5163wsz WxorQQYe9xG8n9duA+u1CX+m7x530rZHDUwA1/gY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kurt Kanzenbach , Vladimir Oltean , Richard Cochran , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0289/1039] net: dsa: hellcreek: Fix insertion of static FDB entries Date: Mon, 24 Jan 2022 19:34:38 +0100 Message-Id: <20220124184134.995912313@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kurt Kanzenbach [ Upstream commit 4db4c3ea56978086ca367a355e440de17d534827 ] The insertion of static FDB entries ignores the pass_blocked bit. That bit = is evaluated with regards to STP. Add the missing functionality. Fixes: e4b27ebc780f ("net: dsa: Add DSA driver for Hirschmann Hellcreek swi= tches") Signed-off-by: Kurt Kanzenbach Reviewed-by: Vladimir Oltean Acked-by: Richard Cochran Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/dsa/hirschmann/hellcreek.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirsc= hmann/hellcreek.c index 4e0b53d94b525..bb1a24c8078be 100644 --- a/drivers/net/dsa/hirschmann/hellcreek.c +++ b/drivers/net/dsa/hirschmann/hellcreek.c @@ -710,8 +710,9 @@ static int __hellcreek_fdb_add(struct hellcreek *hellcr= eek, u16 meta =3D 0; =20 dev_dbg(hellcreek->dev, "Add static FDB entry: MAC=3D%pM, MASK=3D0x%02x, " - "OBT=3D%d, REPRIO_EN=3D%d, PRIO=3D%d\n", entry->mac, entry->portmask, - entry->is_obt, entry->reprio_en, entry->reprio_tc); + "OBT=3D%d, PASS_BLOCKED=3D%d, REPRIO_EN=3D%d, PRIO=3D%d\n", entry->mac, + entry->portmask, entry->is_obt, entry->pass_blocked, + entry->reprio_en, entry->reprio_tc); =20 /* Add mac address */ hellcreek_write(hellcreek, entry->mac[1] | (entry->mac[0] << 8), HR_FDBWD= H); @@ -722,6 +723,8 @@ static int __hellcreek_fdb_add(struct hellcreek *hellcr= eek, meta |=3D entry->portmask << HR_FDBWRM0_PORTMASK_SHIFT; if (entry->is_obt) meta |=3D HR_FDBWRM0_OBT; + if (entry->pass_blocked) + meta |=3D HR_FDBWRM0_PASS_BLOCKED; if (entry->reprio_en) { meta |=3D HR_FDBWRM0_REPRIO_EN; meta |=3D entry->reprio_tc << HR_FDBWRM0_REPRIO_TC_SHIFT; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 332C8C35271 for ; Mon, 24 Jan 2022 23:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360191AbiAXXgL (ORCPT ); Mon, 24 Jan 2022 18:36:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838742AbiAXWsA (ORCPT ); Mon, 24 Jan 2022 17:48:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D136AC068097; Mon, 24 Jan 2022 13:07:22 -0800 (PST) Received: from smtp.kernel.org (relay.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 625FB60E8D; Mon, 24 Jan 2022 21:07:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B827C340E5; Mon, 24 Jan 2022 21:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058441; bh=8e00U0sygiDjy9t1dLdGDBMdtS4FVv8xGfSfW3y8oLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bDuvcUxnPJZygDdKezPWYDV3ArJen/JVrnIuhmEW/YV30t2phHKBd7gOuZYLkQTvO E/ic5ymnrotZqjvgadaYE7MK6W8L6InHQaZUrrCCmIn8ubA02YdhItQvQAWJzdpa2i wBYPUukIVSTxm8W4l/iJauatxM2KfJpmZWRVpYMk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kurt Kanzenbach , Vladimir Oltean , Richard Cochran , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0290/1039] net: dsa: hellcreek: Add STP forwarding rule Date: Mon, 24 Jan 2022 19:34:39 +0100 Message-Id: <20220124184135.028681639@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kurt Kanzenbach [ Upstream commit b7ade35eb53a2455f737a623c24e4b24455b2271 ] Treat STP as management traffic. STP traffic is designated for the CPU port only. In addition, STP traffic has to pass blocked ports. Fixes: e4b27ebc780f ("net: dsa: Add DSA driver for Hirschmann Hellcreek swi= tches") Signed-off-by: Kurt Kanzenbach Reviewed-by: Vladimir Oltean Acked-by: Richard Cochran Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/dsa/hirschmann/hellcreek.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirsc= hmann/hellcreek.c index bb1a24c8078be..b488990b5b06e 100644 --- a/drivers/net/dsa/hirschmann/hellcreek.c +++ b/drivers/net/dsa/hirschmann/hellcreek.c @@ -1074,6 +1074,17 @@ static int hellcreek_setup_fdb(struct hellcreek *hel= lcreek) .reprio_tc =3D 6, /* TC: 6 as per IEEE 802.1AS */ .reprio_en =3D 1, }; + static struct hellcreek_fdb_entry stp =3D { + /* MAC: 01-80-C2-00-00-00 */ + .mac =3D { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }, + .portmask =3D 0x03, /* Management ports */ + .age =3D 0, + .is_obt =3D 0, + .pass_blocked =3D 1, + .is_static =3D 1, + .reprio_tc =3D 6, + .reprio_en =3D 1, + }; int ret; =20 mutex_lock(&hellcreek->reg_lock); @@ -1081,6 +1092,9 @@ static int hellcreek_setup_fdb(struct hellcreek *hell= creek) if (ret) goto out; ret =3D __hellcreek_fdb_add(hellcreek, &p2p); + if (ret) + goto out; + ret =3D __hellcreek_fdb_add(hellcreek, &stp); out: mutex_unlock(&hellcreek->reg_lock); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB698C433FE for ; Mon, 24 Jan 2022 21:46:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573489AbiAXVo6 (ORCPT ); Mon, 24 Jan 2022 16:44:58 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59408 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352884AbiAXVHd (ORCPT ); Mon, 24 Jan 2022 16:07:33 -0500 Received: from smtp.kernel.org (relay.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 5AF4AB8122A; Mon, 24 Jan 2022 21:07:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8308DC340E5; Mon, 24 Jan 2022 21:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058448; bh=dshKwD90z+e4wGtfVuUQB/JeJSaBr+zQf1ZJXNHxZwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d8i0r7YuIBuSjYXuhWQrJK1GVYr4bEQODdgO271M2dIdhlEQRoYoJKwv5WPknchMG XPaq3DJ/ZA9t6G8NreBJMor/78Bof99OXDbbe3jgMgwoEOTHv2S3N8YBr4tayjcGKh XczrMvg2xGNgmMzAp1hCgOk9EvyPxBllTAxFsup0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kurt Kanzenbach , Vladimir Oltean , Richard Cochran , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0291/1039] net: dsa: hellcreek: Allow PTP P2P measurements on blocked ports Date: Mon, 24 Jan 2022 19:34:40 +0100 Message-Id: <20220124184135.058794109@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kurt Kanzenbach [ Upstream commit cad1798d2d0811ded37d1e946c6796102e58013b ] Allow PTP peer delay measurements on blocked ports by STP. In case of topol= ogy changes the PTP stack can directly start with the correct delays. Fixes: ddd56dfe52c9 ("net: dsa: hellcreek: Add PTP clock support") Signed-off-by: Kurt Kanzenbach Reviewed-by: Vladimir Oltean Acked-by: Richard Cochran Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/dsa/hirschmann/hellcreek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirsc= hmann/hellcreek.c index b488990b5b06e..40ce8c0c9167a 100644 --- a/drivers/net/dsa/hirschmann/hellcreek.c +++ b/drivers/net/dsa/hirschmann/hellcreek.c @@ -1069,7 +1069,7 @@ static int hellcreek_setup_fdb(struct hellcreek *hell= creek) .portmask =3D 0x03, /* Management ports */ .age =3D 0, .is_obt =3D 0, - .pass_blocked =3D 0, + .pass_blocked =3D 1, .is_static =3D 1, .reprio_tc =3D 6, /* TC: 6 as per IEEE 802.1AS */ .reprio_en =3D 1, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8506C433EF for ; Mon, 24 Jan 2022 21:46:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457905AbiAXVm3 (ORCPT ); Mon, 24 Jan 2022 16:42:29 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59932 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353511AbiAXVHd (ORCPT ); Mon, 24 Jan 2022 16:07:33 -0500 Received: from smtp.kernel.org (relay.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 B75076131F; Mon, 24 Jan 2022 21:07:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B9D9C340E5; Mon, 24 Jan 2022 21:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058451; bh=bb8964e8msFvAo7Z/rouyLUH8l08cyHY8RTjbv7K7vE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0UPNqKPZe5uTB/aW9IqEosd4EGQdVwrDxWkKLDgS6hrD9A00iRTlqmMUdGD268VRy KoKZBsBj4zuBeT0ctYoQfX3TTqg7QZEr4SBbn39Xnuvuncm16Mma5/3PW/jjsJb7ZP vwdeqCh46cJYvYHmirXk8vP8bA40yR5e+fo1AYh0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kurt Kanzenbach , Richard Cochran , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0292/1039] net: dsa: hellcreek: Add missing PTP via UDP rules Date: Mon, 24 Jan 2022 19:34:41 +0100 Message-Id: <20220124184135.091770773@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kurt Kanzenbach [ Upstream commit 6cf01e451599da630ff1af529d61c5e4db4550ab ] The switch supports PTP for UDP transport too. Therefore, add the missing s= tatic FDB entries to ensure correct forwarding of these packets. Fixes: ddd56dfe52c9 ("net: dsa: hellcreek: Add PTP clock support") Signed-off-by: Kurt Kanzenbach Acked-by: Richard Cochran Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/dsa/hirschmann/hellcreek.c | 64 ++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirsc= hmann/hellcreek.c index 40ce8c0c9167a..b2bab460d2e98 100644 --- a/drivers/net/dsa/hirschmann/hellcreek.c +++ b/drivers/net/dsa/hirschmann/hellcreek.c @@ -1052,7 +1052,7 @@ static void hellcreek_setup_tc_identity_mapping(struc= t hellcreek *hellcreek) =20 static int hellcreek_setup_fdb(struct hellcreek *hellcreek) { - static struct hellcreek_fdb_entry ptp =3D { + static struct hellcreek_fdb_entry l2_ptp =3D { /* MAC: 01-1B-19-00-00-00 */ .mac =3D { 0x01, 0x1b, 0x19, 0x00, 0x00, 0x00 }, .portmask =3D 0x03, /* Management ports */ @@ -1063,7 +1063,29 @@ static int hellcreek_setup_fdb(struct hellcreek *hel= lcreek) .reprio_tc =3D 6, /* TC: 6 as per IEEE 802.1AS */ .reprio_en =3D 1, }; - static struct hellcreek_fdb_entry p2p =3D { + static struct hellcreek_fdb_entry udp4_ptp =3D { + /* MAC: 01-00-5E-00-01-81 */ + .mac =3D { 0x01, 0x00, 0x5e, 0x00, 0x01, 0x81 }, + .portmask =3D 0x03, /* Management ports */ + .age =3D 0, + .is_obt =3D 0, + .pass_blocked =3D 0, + .is_static =3D 1, + .reprio_tc =3D 6, + .reprio_en =3D 1, + }; + static struct hellcreek_fdb_entry udp6_ptp =3D { + /* MAC: 33-33-00-00-01-81 */ + .mac =3D { 0x33, 0x33, 0x00, 0x00, 0x01, 0x81 }, + .portmask =3D 0x03, /* Management ports */ + .age =3D 0, + .is_obt =3D 0, + .pass_blocked =3D 0, + .is_static =3D 1, + .reprio_tc =3D 6, + .reprio_en =3D 1, + }; + static struct hellcreek_fdb_entry l2_p2p =3D { /* MAC: 01-80-C2-00-00-0E */ .mac =3D { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e }, .portmask =3D 0x03, /* Management ports */ @@ -1074,6 +1096,28 @@ static int hellcreek_setup_fdb(struct hellcreek *hel= lcreek) .reprio_tc =3D 6, /* TC: 6 as per IEEE 802.1AS */ .reprio_en =3D 1, }; + static struct hellcreek_fdb_entry udp4_p2p =3D { + /* MAC: 01-00-5E-00-00-6B */ + .mac =3D { 0x01, 0x00, 0x5e, 0x00, 0x00, 0x6b }, + .portmask =3D 0x03, /* Management ports */ + .age =3D 0, + .is_obt =3D 0, + .pass_blocked =3D 1, + .is_static =3D 1, + .reprio_tc =3D 6, + .reprio_en =3D 1, + }; + static struct hellcreek_fdb_entry udp6_p2p =3D { + /* MAC: 33-33-00-00-00-6B */ + .mac =3D { 0x33, 0x33, 0x00, 0x00, 0x00, 0x6b }, + .portmask =3D 0x03, /* Management ports */ + .age =3D 0, + .is_obt =3D 0, + .pass_blocked =3D 1, + .is_static =3D 1, + .reprio_tc =3D 6, + .reprio_en =3D 1, + }; static struct hellcreek_fdb_entry stp =3D { /* MAC: 01-80-C2-00-00-00 */ .mac =3D { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }, @@ -1088,10 +1132,22 @@ static int hellcreek_setup_fdb(struct hellcreek *he= llcreek) int ret; =20 mutex_lock(&hellcreek->reg_lock); - ret =3D __hellcreek_fdb_add(hellcreek, &ptp); + ret =3D __hellcreek_fdb_add(hellcreek, &l2_ptp); + if (ret) + goto out; + ret =3D __hellcreek_fdb_add(hellcreek, &udp4_ptp); + if (ret) + goto out; + ret =3D __hellcreek_fdb_add(hellcreek, &udp6_ptp); + if (ret) + goto out; + ret =3D __hellcreek_fdb_add(hellcreek, &l2_p2p); + if (ret) + goto out; + ret =3D __hellcreek_fdb_add(hellcreek, &udp4_p2p); if (ret) goto out; - ret =3D __hellcreek_fdb_add(hellcreek, &p2p); + ret =3D __hellcreek_fdb_add(hellcreek, &udp6_p2p); if (ret) goto out; ret =3D __hellcreek_fdb_add(hellcreek, &stp); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7678BC433EF for ; Mon, 24 Jan 2022 21:46:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573281AbiAXVoq (ORCPT ); Mon, 24 Jan 2022 16:44:46 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59964 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446212AbiAXVHf (ORCPT ); Mon, 24 Jan 2022 16:07:35 -0500 Received: from smtp.kernel.org (relay.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 C957561425; Mon, 24 Jan 2022 21:07:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5C2BC340E8; Mon, 24 Jan 2022 21:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058454; bh=DX+nFBJs/yKtyiEOKkXjDicl5+9iBgWUYkW0pg5pwmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UcgmLeFWWARiCVxFiKjehv0+7jlcStqKEQpK2lCe+2iBhCoQUI32I8JwZpwSNJHXa hItF1jcvXxOHRqMdrcExSM6lbcuNpjQrCPeV98piGGe6yurFG3ea5/pqdvQ9SZaUkU 2YaRmLCwWtWFcOjFU09v/79TQjdpat2xO3V+h84I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Steev Klimaszewski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.16 0293/1039] arm64: dts: qcom: c630: Fix soundcard setup Date: Mon, 24 Jan 2022 19:34:42 +0100 Message-Id: <20220124184135.128752743@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 c02b360ca67ebeb9de07b47b2fe53f964c2561d1 ] Currently Soundcard has 1 rx device for headset and SoundWire Speaker Playb= ack. This setup has issues, ex if we try to play on headset the audio stream is also sent to SoundWire Speakers and we will hear sound in both headsets and= speakers. Make a separate device for Speakers and Headset so that the streams are different and handled properly. Fixes: 45021d35fcb2 ("arm64: dts: qcom: c630: Enable audio support") Signed-off-by: Srinivas Kandagatla Tested-by: Steev Klimaszewski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211209175342.20386-2-srinivas.kandagatla@= linaro.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts b/arch/ar= m64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts index d6b2ba4396f68..2e882a977e2c4 100644 --- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts +++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts @@ -523,6 +523,10 @@ dai@1 { reg =3D <1>; }; + + dai@2 { + reg =3D <2>; + }; }; =20 &sound { @@ -535,6 +539,7 @@ "SpkrLeft IN", "SPK1 OUT", "SpkrRight IN", "SPK2 OUT", "MM_DL1", "MultiMedia1 Playback", + "MM_DL3", "MultiMedia3 Playback", "MultiMedia2 Capture", "MM_UL2"; =20 mm1-dai-link { @@ -551,6 +556,13 @@ }; }; =20 + mm3-dai-link { + link-name =3D "MultiMedia3"; + cpu { + sound-dai =3D <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA3>; + }; + }; + slim-dai-link { link-name =3D "SLIM Playback"; cpu { @@ -580,6 +592,21 @@ sound-dai =3D <&wcd9340 1>; }; }; + + slim-wcd-dai-link { + link-name =3D "SLIM WCD Playback"; + cpu { + sound-dai =3D <&q6afedai SLIMBUS_1_RX>; + }; + + platform { + sound-dai =3D <&q6routing>; + }; + + codec { + sound-dai =3D <&wcd9340 2>; + }; + }; }; =20 &tlmm { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65A22C433F5 for ; Mon, 24 Jan 2022 21:46:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457920AbiAXVmb (ORCPT ); Mon, 24 Jan 2022 16:42:31 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59474 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377237AbiAXVHk (ORCPT ); Mon, 24 Jan 2022 16:07:40 -0500 Received: from smtp.kernel.org (relay.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 9C37BB81142; Mon, 24 Jan 2022 21:07:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC9C6C340E5; Mon, 24 Jan 2022 21:07:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058457; bh=ar8hptmGNbDlKZ4ZidwdBp6iuwtu7qWVz0456y+JxaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QPT+G7vTFHZVX3Cpxc0Vmky8hSYjjZ/HPbjGn2oLNc9tJSnxXSEzNMNxsUu1sR01/ rn8EJRLLis4SRfwjiRpB2jiEOwGrnt0AoUD3u+yuT8lmpYor/qpqxbWkt9z9h5V7Td OIAn0LYSKlVaIrirgsGIQLO7v/WTovtAOo73/aco= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sricharan R , Baruch Siach , Bryan ODonoghue , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.16 0294/1039] arm64: dts: qcom: ipq6018: Fix gpio-ranges property Date: Mon, 24 Jan 2022 19:34:43 +0100 Message-Id: <20220124184135.165730543@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baruch Siach [ Upstream commit 72cb4c48a46a7cfa58eb5842c0d3672ddd5bd9ad ] There must be three parameters in gpio-ranges property. Fixes this not very helpful error message: OF: /soc/pinctrl@1000000: (null) =3D 3 found 3 Fixes: 1e8277854b49 ("arm64: dts: Add ipq6018 SoC and CP01 board support") Cc: Sricharan R Signed-off-by: Baruch Siach Tested-by: Bryan O'Donoghue Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/8a744cfd96aff5754bfdcf7298d208ddca5b319a.16= 38862030.git.baruch@tkos.co.il Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/qcom/ipq6018.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qc= om/ipq6018.dtsi index 933b56103a464..66ec5615651d4 100644 --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi @@ -220,7 +220,7 @@ interrupts =3D ; gpio-controller; #gpio-cells =3D <2>; - gpio-ranges =3D <&tlmm 0 80>; + gpio-ranges =3D <&tlmm 0 0 80>; interrupt-controller; #interrupt-cells =3D <2>; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EDDEC4321E for ; Mon, 24 Jan 2022 21:46:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573070AbiAXVoS (ORCPT ); Mon, 24 Jan 2022 16:44:18 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59520 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446237AbiAXVHn (ORCPT ); Mon, 24 Jan 2022 16:07:43 -0500 Received: from smtp.kernel.org (relay.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 AF593B810BD; Mon, 24 Jan 2022 21:07:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8C51C36AF6; Mon, 24 Jan 2022 21:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058460; bh=W2fz6Dp5kFEdezSW4eSWeBiIQQYuoPrdjPWyRGEBVoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h25Yy9axh02KWLN9IVDnOLAt1UKJtW8GSUu9VFJBVfPgfbXrFh+bdIPSzD/DIbuFK XZVt2Sock1wEzIZdk0lpauuqELMe1GrlsoaBMNmAtavnsuUICOaBk/O9mzvETN6EJO XvavEWDuE+3CEbraHm/8AlpduX3I3Oo27J5P884s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Abhinav Kumar , Rob Clark , Sasha Levin Subject: [PATCH 5.16 0295/1039] drm/msm/dpu: fix safe status debugfs file Date: Mon, 24 Jan 2022 19:34:44 +0100 Message-Id: <20220124184135.206087473@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit f31b0e24d31e18b4503eeaf0032baeacc0beaff6 ] Make safe_status debugfs fs file actually return safe status rather than danger status data. Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Link: https://lore.kernel.org/r/20211201222633.2476780-3-dmitry.baryshkov@l= inaro.org Signed-off-by: Dmitry Baryshkov Signed-off-by: Rob Clark Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/= disp/dpu1/dpu_kms.c index a15b264282809..d25d18a0084d9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -73,8 +73,8 @@ static int _dpu_danger_signal_status(struct seq_file *s, &status); } else { seq_puts(s, "\nSafe signal status:\n"); - if (kms->hw_mdp->ops.get_danger_status) - kms->hw_mdp->ops.get_danger_status(kms->hw_mdp, + if (kms->hw_mdp->ops.get_safe_status) + kms->hw_mdp->ops.get_safe_status(kms->hw_mdp, &status); } pm_runtime_put_sync(&kms->pdev->dev); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE7B3C43219 for ; Mon, 24 Jan 2022 21:46:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573579AbiAXVpQ (ORCPT ); Mon, 24 Jan 2022 16:45:16 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60114 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352064AbiAXVHo (ORCPT ); Mon, 24 Jan 2022 16:07:44 -0500 Received: from smtp.kernel.org (relay.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 29B4161330; Mon, 24 Jan 2022 21:07:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDCE4C340E7; Mon, 24 Jan 2022 21:07:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058463; bh=fQpo6FexrM9Dgnb+bDUD84yMCWrvuPjJrI1XdmWF2gE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENfOJtIYaoU69/Xo4QiRW/RePvRgzfaki9Z2pCXorBnZd8QgHdz00fOy7LS4REz8M RbBeqWZGORQYQVnGlD962cyhH8JNY2JRBoInsmqymV/n9cKfjc9gjLjbIzNSSvryIS GTMFMLrkMByLi7Ec7YJTjVaObBwI6XV1SdIK5YFw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Douglas Anderson , Laurent Pinchart , Stephen Boyd , Robert Foss , Sasha Levin Subject: [PATCH 5.16 0296/1039] drm/bridge: ti-sn65dsi86: Set max register for regmap Date: Mon, 24 Jan 2022 19:34:45 +0100 Message-Id: <20220124184135.243943575@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephen Boyd [ Upstream commit 0b665d4af35837f0a0ae63135b84a3c187c1db3b ] Set the maximum register to 0xff so we can dump the registers for this device in debugfs. Fixes: a095f15c00e2 ("drm/bridge: add support for sn65dsi86 bridge driver") Cc: Rob Clark Cc: Douglas Anderson Cc: Laurent Pinchart Signed-off-by: Stephen Boyd Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20211215002529.382383-1= -swboyd@chromium.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge= /ti-sn65dsi86.c index 6154bed0af5bf..83d06c16d4d74 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -188,6 +188,7 @@ static const struct regmap_config ti_sn65dsi86_regmap_c= onfig =3D { .val_bits =3D 8, .volatile_table =3D &ti_sn_bridge_volatile_table, .cache_type =3D REGCACHE_NONE, + .max_register =3D 0xFF, }; =20 static void ti_sn65dsi86_write_u16(struct ti_sn65dsi86 *pdata, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 254ECC4707A for ; Mon, 24 Jan 2022 21:46:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354630AbiAXVnv (ORCPT ); Mon, 24 Jan 2022 16:43:51 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58514 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447054AbiAXVJ6 (ORCPT ); Mon, 24 Jan 2022 16:09:58 -0500 Received: from smtp.kernel.org (relay.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 6D33061320; Mon, 24 Jan 2022 21:09:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E16CC340E5; Mon, 24 Jan 2022 21:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058596; bh=7FuChzgMaV2OYhpaYWC7LUUS8H6TQwy/LwWyEKCH3tY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O44MWlWuHV74b4juXZhE1Q7fAIsdClVH0Y+ZED6T8hPKnIVUAeg8RXnTsfUH0ob9Q 1bs3QCX/v+t3kMx5nV81DmIQHOu7VcZiHGOqSofTZsKMnEkCMJYQPSrfmFeVeEEF81 6XBEEAAH0dJU60E95ZyxQCmj9L0Tf/6UbTCcfaMs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Mikko Perttunen , Thierry Reding , Sasha Levin Subject: [PATCH 5.16 0297/1039] gpu: host1x: select CONFIG_DMA_SHARED_BUFFER Date: Mon, 24 Jan 2022 19:34:46 +0100 Message-Id: <20220124184135.279937254@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit 6c7a388b62366f0de9936db3c1921d7f4e0011bc ] Linking fails when dma-buf is disabled: ld.lld: error: undefined symbol: dma_fence_release >>> referenced by fence.c >>> gpu/host1x/fence.o:(host1x_syncpt_fence_enable_signaling)= in archive drivers/built-in.a >>> referenced by fence.c >>> gpu/host1x/fence.o:(host1x_fence_signal) in archive drive= rs/built-in.a >>> referenced by fence.c >>> gpu/host1x/fence.o:(do_fence_timeout) in archive drivers/= built-in.a Fixes: 687db2207b1b ("gpu: host1x: Add DMA fence implementation") Signed-off-by: Arnd Bergmann Reviewed-by: Mikko Perttunen Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/host1x/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig index 6dab94adf25e5..6815b4db17c1b 100644 --- a/drivers/gpu/host1x/Kconfig +++ b/drivers/gpu/host1x/Kconfig @@ -2,6 +2,7 @@ config TEGRA_HOST1X tristate "NVIDIA Tegra host1x driver" depends on ARCH_TEGRA || (ARM && COMPILE_TEST) + select DMA_SHARED_BUFFER select IOMMU_IOVA help Driver for the NVIDIA Tegra host1x hardware. --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBC53C3526E for ; Mon, 24 Jan 2022 21:44:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457954AbiAXVmg (ORCPT ); Mon, 24 Jan 2022 16:42:36 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59838 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377366AbiAXVIR (ORCPT ); Mon, 24 Jan 2022 16:08:17 -0500 Received: from smtp.kernel.org (relay.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 A76B3B812A5; Mon, 24 Jan 2022 21:08:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC848C340E7; Mon, 24 Jan 2022 21:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058488; bh=jwjFmACAnwdgTPgiXQNtUaCkXKpEKBIBAWq4GBFnCFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uafc5laLJhTuj55KZLRMaeo5bC4pnPCJiMCI6CqWbTo87mCSOUwnEkREhMED+FEmX +ip5pAE0id8gUNqaXIGfROJwmbuXoQUdjY3eQInGiiUixnyKr0jumCt4FloIhtsLtq HmZyjHicLK7oZOaLMKIYBw9FKcMiPJnkKXyiTOKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thierry Reding , Sasha Levin Subject: [PATCH 5.16 0298/1039] drm/tegra: gr2d: Explicitly control module reset Date: Mon, 24 Jan 2022 19:34:47 +0100 Message-Id: <20220124184135.315889632@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thierry Reding [ Upstream commit 271fca025a6d43f1c18a48543c5aaf31a31e4694 ] As of commit 4782c0a5dd88 ("clk: tegra: Don't deassert reset on enabling clocks"), module resets are no longer automatically deasserted when the module clock is enabled. To make sure that the gr2d module continues to work, we need to explicitly control the module reset. Fixes: 4782c0a5dd88 ("clk: tegra: Don't deassert reset on enabling clocks") Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/tegra/gr2d.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c index de288cba39055..ba3722f1b8651 100644 --- a/drivers/gpu/drm/tegra/gr2d.c +++ b/drivers/gpu/drm/tegra/gr2d.c @@ -4,9 +4,11 @@ */ =20 #include +#include #include #include #include +#include =20 #include "drm.h" #include "gem.h" @@ -19,6 +21,7 @@ struct gr2d_soc { struct gr2d { struct tegra_drm_client client; struct host1x_channel *channel; + struct reset_control *rst; struct clk *clk; =20 const struct gr2d_soc *soc; @@ -208,6 +211,12 @@ static int gr2d_probe(struct platform_device *pdev) if (!syncpts) return -ENOMEM; =20 + gr2d->rst =3D devm_reset_control_get(dev, NULL); + if (IS_ERR(gr2d->rst)) { + dev_err(dev, "cannot get reset\n"); + return PTR_ERR(gr2d->rst); + } + gr2d->clk =3D devm_clk_get(dev, NULL); if (IS_ERR(gr2d->clk)) { dev_err(dev, "cannot get clock\n"); @@ -220,6 +229,14 @@ static int gr2d_probe(struct platform_device *pdev) return err; } =20 + usleep_range(2000, 4000); + + err =3D reset_control_deassert(gr2d->rst); + if (err < 0) { + dev_err(dev, "failed to deassert reset: %d\n", err); + goto disable_clk; + } + INIT_LIST_HEAD(&gr2d->client.base.list); gr2d->client.base.ops =3D &gr2d_client_ops; gr2d->client.base.dev =3D dev; @@ -234,8 +251,7 @@ static int gr2d_probe(struct platform_device *pdev) err =3D host1x_client_register(&gr2d->client.base); if (err < 0) { dev_err(dev, "failed to register host1x client: %d\n", err); - clk_disable_unprepare(gr2d->clk); - return err; + goto assert_rst; } =20 /* initialize address register map */ @@ -245,6 +261,13 @@ static int gr2d_probe(struct platform_device *pdev) platform_set_drvdata(pdev, gr2d); =20 return 0; + +assert_rst: + (void)reset_control_assert(gr2d->rst); +disable_clk: + clk_disable_unprepare(gr2d->clk); + + return err; } =20 static int gr2d_remove(struct platform_device *pdev) @@ -259,6 +282,12 @@ static int gr2d_remove(struct platform_device *pdev) return err; } =20 + err =3D reset_control_assert(gr2d->rst); + if (err < 0) + dev_err(&pdev->dev, "failed to assert reset: %d\n", err); + + usleep_range(2000, 4000); + clk_disable_unprepare(gr2d->clk); =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDD60C43217 for ; Mon, 24 Jan 2022 23:48:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364473AbiAXXsQ (ORCPT ); Mon, 24 Jan 2022 18:48:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382994AbiAXWxz (ORCPT ); Mon, 24 Jan 2022 17:53:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 605E1C055AB2; Mon, 24 Jan 2022 13:08:43 -0800 (PST) Received: from smtp.kernel.org (relay.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 F39DE611C8; Mon, 24 Jan 2022 21:08:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC52BC340E5; Mon, 24 Jan 2022 21:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058522; bh=AGVcsL5Qg8R5tXC51h+0QVmhQuDGSTsNbuHUgh2FqcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ScHgq0uihkKx5Pqo31KSkV3GM7xQ9wagW+SLXfYPqcyl/EWNm3JkuDKaXzMqMqo+3 PeKpUQeYCSrznEeT64oIsZh7TSY5Yc6gWnTEI7+9KA1VkAq7XLEy14bCcnP501GyGw C8OgADb9feBhwFh8T5qcekNCJzeymQSuLvvVXXlU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thierry Reding , Mikko Perttunen , dri-devel@lists.freedesktop.org, Robin Murphy , Christoph Hellwig , Thierry Reding , Sasha Levin Subject: [PATCH 5.16 0299/1039] drm/tegra: vic: Fix DMA API misuse Date: Mon, 24 Jan 2022 19:34:48 +0100 Message-Id: <20220124184135.352393486@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Murphy [ Upstream commit 5566174cb10a5167d59b0793871cab7990b149b8 ] Upon failure, dma_alloc_coherent() returns NULL. If that does happen, passing some uninitialised stack contents to dma_mapping_error() - which belongs to a different API in the first place - has precious little chance of detecting it. Also include the correct header, because the fragile transitive inclusion currently providing it is going to break soon. Fixes: 20e7dce255e9 ("drm/tegra: Remove memory allocation from Falcon libra= ry") CC: Thierry Reding CC: Mikko Perttunen CC: dri-devel@lists.freedesktop.org Signed-off-by: Robin Murphy Reviewed-by: Christoph Hellwig Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/tegra/vic.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index c02010ff2b7f2..da4af53719917 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -5,6 +5,7 @@ =20 #include #include +#include #include #include #include @@ -232,10 +233,8 @@ static int vic_load_firmware(struct vic *vic) =20 if (!client->group) { virt =3D dma_alloc_coherent(vic->dev, size, &iova, GFP_KERNEL); - - err =3D dma_mapping_error(vic->dev, iova); - if (err < 0) - return err; + if (!virt) + return -ENOMEM; } else { virt =3D tegra_drm_alloc(tegra, size, &iova); } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB51BC3526D for ; Mon, 24 Jan 2022 23:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364399AbiAXXsD (ORCPT ); Mon, 24 Jan 2022 18:48:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588742AbiAXWyE (ORCPT ); Mon, 24 Jan 2022 17:54:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00A82C06136F; Mon, 24 Jan 2022 13:09:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 B19BEB811FB; Mon, 24 Jan 2022 21:09:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDBAEC340E5; Mon, 24 Jan 2022 21:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058556; bh=a9+AARr8CM66RUDoLU7UW29S2ykRGDh6pu0ykWhcya8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m325YtP49Z/1WoxtWYEnXAKcDJdOEJLHZ2UHkJ46bq4xKAMy+G+KS/VuEa11CvtVq ISBLHqakc/xyoxOa4P7utEhYMwAH11SfMEk2XjLYuIKOBZ+D/Mzv5MJ+taoHC67uGK HEImeUYxG37p+bARC/bWSzAymFxuwc+Hd+jErEbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Andrzej Pietrasiewicz , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0300/1039] media: hantro: Fix probe func error path Date: Mon, 24 Jan 2022 19:34:49 +0100 Message-Id: <20220124184135.389465865@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jernej Skrabec [ Upstream commit 37af43b250fda6162005d47bf7c959c70d52b107 ] If clocks for some reason couldn't be enabled, probe function returns immediately, without disabling PM. This obviously leaves PM ref counters unbalanced. Fix that by jumping to appropriate error path, so effects of PM functions are reversed. Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver") Signed-off-by: Jernej Skrabec Acked-by: Andrzej Pietrasiewicz Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/hantro/hantro_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/me= dia/hantro/hantro_drv.c index fb82b9297a2ba..0d56db8376e6a 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -960,7 +960,7 @@ static int hantro_probe(struct platform_device *pdev) ret =3D clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks); if (ret) { dev_err(&pdev->dev, "Failed to prepare clocks\n"); - return ret; + goto err_pm_disable; } =20 ret =3D v4l2_device_register(&pdev->dev, &vpu->v4l2_dev); @@ -1016,6 +1016,7 @@ err_v4l2_unreg: v4l2_device_unregister(&vpu->v4l2_dev); err_clk_unprepare: clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks); +err_pm_disable: pm_runtime_dont_use_autosuspend(vpu->dev); pm_runtime_disable(vpu->dev); return ret; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0A09C3526E for ; Mon, 24 Jan 2022 21:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573674AbiAXVpf (ORCPT ); Mon, 24 Jan 2022 16:45:35 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33566 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446902AbiAXVJi (ORCPT ); Mon, 24 Jan 2022 16:09:38 -0500 Received: from smtp.kernel.org (relay.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 78E766131F; Mon, 24 Jan 2022 21:09:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58730C340E5; Mon, 24 Jan 2022 21:09:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058577; bh=sfLZiX02BJ5cJ5jesEuIRjHJpSQs6iwfZWTLM8msD+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JLG84KrXYqW81gHyoXl/MWNcRx/6Xsude0XoPyl1RaInZYfzdv3DzzFyRZHAU5vmb MEUYgKtCbR1qi2DbugsoJ0zlidXpO9JvrKXAAjGalJzNl5CWFoULrgrUT/4OJaP1v7 GGB6hodEayK0IcEeIsOTZHWaCsVm+3tNuwQ1ODS4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antony Antony , Eyal Birger , Steffen Klassert , Sasha Levin Subject: [PATCH 5.16 0301/1039] xfrm: interface with if_id 0 should return error Date: Mon, 24 Jan 2022 19:34:50 +0100 Message-Id: <20220124184135.429986884@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antony Antony [ Upstream commit 8dce43919566f06e865f7e8949f5c10d8c2493f5 ] xfrm interface if_id =3D 0 would cause xfrm policy lookup errors since Commit 9f8550e4bd9d. Now explicitly fail to create an xfrm interface when if_id =3D 0 With this commit: ip link add ipsec0 type xfrm dev lo if_id 0 Error: if_id must be non zero. v1->v2 change: - add Fixes: tag Fixes: 9f8550e4bd9d ("xfrm: fix disable_xfrm sysctl when used on xfrm inter= faces") Signed-off-by: Antony Antony Reviewed-by: Eyal Birger Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/xfrm/xfrm_interface.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c index 41de46b5ffa94..57448fc519fcd 100644 --- a/net/xfrm/xfrm_interface.c +++ b/net/xfrm/xfrm_interface.c @@ -637,11 +637,16 @@ static int xfrmi_newlink(struct net *src_net, struct = net_device *dev, struct netlink_ext_ack *extack) { struct net *net =3D dev_net(dev); - struct xfrm_if_parms p; + struct xfrm_if_parms p =3D {}; struct xfrm_if *xi; int err; =20 xfrmi_netlink_parms(data, &p); + if (!p.if_id) { + NL_SET_ERR_MSG(extack, "if_id must be non zero"); + return -EINVAL; + } + xi =3D xfrmi_locate(net, &p); if (xi) return -EEXIST; @@ -666,7 +671,12 @@ static int xfrmi_changelink(struct net_device *dev, st= ruct nlattr *tb[], { struct xfrm_if *xi =3D netdev_priv(dev); struct net *net =3D xi->net; - struct xfrm_if_parms p; + struct xfrm_if_parms p =3D {}; + + if (!p.if_id) { + NL_SET_ERR_MSG(extack, "if_id must be non zero"); + return -EINVAL; + } =20 xfrmi_netlink_parms(data, &p); xi =3D xfrmi_locate(net, &p); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9650C4167E for ; Mon, 24 Jan 2022 21:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573697AbiAXVph (ORCPT ); Mon, 24 Jan 2022 16:45:37 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33594 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446928AbiAXVJl (ORCPT ); Mon, 24 Jan 2022 16:09:41 -0500 Received: from smtp.kernel.org (relay.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 6EE6761425; Mon, 24 Jan 2022 21:09:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C8E9C340E5; Mon, 24 Jan 2022 21:09:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058580; bh=pz99iXBwo3/nLwZ7y8IoW/K4Ck88weGFXJ6wv6u8PWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OsSD/CJqRLRjhnkAjc6Sh6xUmk1qvsjKPGCq8sUtIXNB85K3ezAhzEw7bDr3v42mC khazCC62FiB2OiNtMKmtU8QtZwiEbV25zaFdvKg1pvY7UktnpllMVOdtG9ia6Gb1V+ A3GmHjHnXSz/Vm4kiTgTMkXkcCVt7C1nyzeVXKyk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antony Antony , Steffen Klassert , Sasha Levin Subject: [PATCH 5.16 0302/1039] xfrm: state and policy should fail if XFRMA_IF_ID 0 Date: Mon, 24 Jan 2022 19:34:51 +0100 Message-Id: <20220124184135.467108892@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antony Antony [ Upstream commit 68ac0f3810e76a853b5f7b90601a05c3048b8b54 ] xfrm ineterface does not allow xfrm if_id =3D 0 fail to create or update xfrm state and policy. With this commit: ip xfrm policy add src 192.0.2.1 dst 192.0.2.2 dir out if_id 0 RTNETLINK answers: Invalid argument ip xfrm state add src 192.0.2.1 dst 192.0.2.2 proto esp spi 1 \ reqid 1 mode tunnel aead 'rfc4106(gcm(aes))' \ 0x1111111111111111111111111111111111111111 96 if_id 0 RTNETLINK answers: Invalid argument v1->v2 change: - add Fixes: tag Fixes: 9f8550e4bd9d ("xfrm: fix disable_xfrm sysctl when used on xfrm inter= faces") Signed-off-by: Antony Antony Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/xfrm/xfrm_user.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 0a2d2bae28316..b571892fe10f5 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -621,8 +621,13 @@ static struct xfrm_state *xfrm_state_construct(struct = net *net, =20 xfrm_smark_init(attrs, &x->props.smark); =20 - if (attrs[XFRMA_IF_ID]) + if (attrs[XFRMA_IF_ID]) { x->if_id =3D nla_get_u32(attrs[XFRMA_IF_ID]); + if (!x->if_id) { + err =3D -EINVAL; + goto error; + } + } =20 err =3D __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]); if (err) @@ -1413,8 +1418,13 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, s= truct nlmsghdr *nlh, =20 mark =3D xfrm_mark_get(attrs, &m); =20 - if (attrs[XFRMA_IF_ID]) + if (attrs[XFRMA_IF_ID]) { if_id =3D nla_get_u32(attrs[XFRMA_IF_ID]); + if (!if_id) { + err =3D -EINVAL; + goto out_noput; + } + } =20 if (p->info.seq) { x =3D xfrm_find_acq_byseq(net, mark, p->info.seq); @@ -1727,8 +1737,13 @@ static struct xfrm_policy *xfrm_policy_construct(str= uct net *net, struct xfrm_us =20 xfrm_mark_get(attrs, &xp->mark); =20 - if (attrs[XFRMA_IF_ID]) + if (attrs[XFRMA_IF_ID]) { xp->if_id =3D nla_get_u32(attrs[XFRMA_IF_ID]); + if (!xp->if_id) { + err =3D -EINVAL; + goto error; + } + } =20 return xp; error: --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18244C43219 for ; Mon, 24 Jan 2022 21:46:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378477AbiAXVnY (ORCPT ); Mon, 24 Jan 2022 16:43:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60808 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446991AbiAXVJr (ORCPT ); Mon, 24 Jan 2022 16:09:47 -0500 Received: from smtp.kernel.org (relay.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 B8E67B81142; Mon, 24 Jan 2022 21:09:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E52B4C340E5; Mon, 24 Jan 2022 21:09:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058584; bh=l3akZgYVfwMEfwcCOQk0BID8yWFagZs9UcWLxnR9ZfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XhV9cCh0loAfdmBlhtOwWUjPT0NV+2c0B66S8hsBQfy9DjP+6T1ZbIe6l2BGoEe/+ 8NU/9ZlB3OXIwCpOwURez4WBHmAly0cEIv+Mlfcv7pIyDFZ9SzAJSzQf4Luzn7MvpN KRh1x3lIGWknssJrmCNvBWEEapwxrr1MyDehpMKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andre Przywara , Adam Lackorzynski , Peter Maydell , Ard Biesheuvel , Linus Walleij , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.16 0303/1039] ARM: 9159/1: decompressor: Avoid UNPREDICTABLE NOP encoding Date: Mon, 24 Jan 2022 19:34:52 +0100 Message-Id: <20220124184135.499345733@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andre Przywara [ Upstream commit a92882a4d270fbcc021ee6848de5e48b7f0d27f3 ] In the decompressor's head.S we need to start with an instruction that is some kind of NOP, but also mimics as the PE/COFF header, when the kernel is linked as an UEFI application. The clever solution here is "tstne r0, #0x4d000", which in the worst case just clobbers the condition flags, and bears the magic "MZ" signature in the lowest 16 bits. However the encoding used (0x13105a4d) is actually not valid, since bits [15:12] are supposed to be 0 (written as "(0)" in the ARM ARM). Violating this is UNPREDICTABLE, and *can* trigger an UNDEFINED exception. Common Cortex cores seem to ignore those bits, but QEMU chooses to trap, so the code goes fishing because of a missing exception handler at this point. We are just saved by the fact that commonly (with -kernel or when running from U-Boot) the "Z" bit is set, so the instruction is never executed. See [0] for more details. To make things more robust and avoid UNPREDICTABLE behaviour in the kernel code, lets replace this with a "two-instruction NOP": The first instruction is an exclusive OR, the effect of which the second instruction reverts. This does not leave any trace, neither in a register nor in the condition flags. Also it's a perfectly valid encoding. Kudos to Peter Maydell for coming up with this gem. [0] https://lore.kernel.org/qemu-devel/YTPIdbUCmwagL5%2FD@os.inf.tu-dresden= .de/T/ Link: https://lore.kernel.org/linux-arm-kernel/20210908162617.104962-1-andr= e.przywara@arm.com/T/ Fixes: 81a0bc39ea19 ("ARM: add UEFI stub support") Signed-off-by: Andre Przywara Reported-by: Adam Lackorzynski Suggested-by: Peter Maydell Reviewed-by: Ard Biesheuvel Reviewed-by: Linus Walleij Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/boot/compressed/efi-header.S | 22 ++++++++++++++-------- arch/arm/boot/compressed/head.S | 3 ++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compress= ed/efi-header.S index c0e7a745103e2..230030c130853 100644 --- a/arch/arm/boot/compressed/efi-header.S +++ b/arch/arm/boot/compressed/efi-header.S @@ -9,16 +9,22 @@ #include =20 .macro __nop -#ifdef CONFIG_EFI_STUB - @ This is almost but not quite a NOP, since it does clobber the - @ condition flags. But it is the best we can do for EFI, since - @ PE/COFF expects the magic string "MZ" at offset 0, while the - @ ARM/Linux boot protocol expects an executable instruction - @ there. - .inst MZ_MAGIC | (0x1310 << 16) @ tstne r0, #0x4d000 -#else AR_CLASS( mov r0, r0 ) M_CLASS( nop.w ) + .endm + + .macro __initial_nops +#ifdef CONFIG_EFI_STUB + @ This is a two-instruction NOP, which happens to bear the + @ PE/COFF signature "MZ" in the first two bytes, so the kernel + @ is accepted as an EFI binary. Booting via the UEFI stub + @ will not execute those instructions, but the ARM/Linux + @ boot protocol does, so we need some NOPs here. + .inst MZ_MAGIC | (0xe225 << 16) @ eor r5, r5, 0x4d000 + eor r5, r5, 0x4d000 @ undo previous insn +#else + __nop + __nop #endif .endm =20 diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/hea= d.S index b1cb1972361b8..bf79f2f78d232 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -203,7 +203,8 @@ start: * were patching the initial instructions of the kernel, i.e * had started to exploit this "patch area". */ - .rept 7 + __initial_nops + .rept 5 __nop .endr #ifndef CONFIG_THUMB2_KERNEL --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B58DC2BA4C for ; Mon, 24 Jan 2022 23:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386596AbiAXXre (ORCPT ); Mon, 24 Jan 2022 18:47:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1576167AbiAXWzo (ORCPT ); Mon, 24 Jan 2022 17:55:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2938EC0680B6; Mon, 24 Jan 2022 13:09:50 -0800 (PST) Received: from smtp.kernel.org (relay.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 E552AB810BD; Mon, 24 Jan 2022 21:09:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F4096C340E5; Mon, 24 Jan 2022 21:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058587; bh=dxGuISMhA9ZEc5sX9BfzvJSZLkFpxqiBwP7QfUE9xig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1pSj3wM4a+31jGMLDDN7TH1lW71Fxy8/fy42D5ArO0Z2a92PXBciB6GPJZekbV+Br mz+O4Bkkog3r0UuYY7ZxsQUwkeGwHIuTk/OuJAinK5nSmOsZ8qbBDug/v3kqehlNq6 mwAvOD1ZvVu58ZQaRhj2DOkGTj8W4v5M7cZy0seQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wei Yongjun , Sasha Levin Subject: [PATCH 5.16 0304/1039] usb: ftdi-elan: fix memory leak on device disconnect Date: Mon, 24 Jan 2022 19:34:53 +0100 Message-Id: <20220124184135.531746303@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wei Yongjun [ Upstream commit 1646566b5e0c556f779180a8514e521ac735de1e ] 'ftdi' is alloced when probe device, but not free on device disconnect, this cause a memory leak as follows: unreferenced object 0xffff88800d584000 (size 8400): comm "kworker/0:2", pid 3809, jiffies 4295453055 (age 13.784s) hex dump (first 32 bytes): 00 40 58 0d 80 88 ff ff 00 40 58 0d 80 88 ff ff .@X......@X..... 00 00 00 00 00 00 00 00 00 00 00 00 ad 4e ad de .............N.. backtrace: [<000000000d47f947>] kmalloc_order_trace+0x19/0x110 mm/slab_common.c:960 [<000000008548ac68>] ftdi_elan_probe+0x8c/0x880 drivers/usb/misc/ftdi-e= lan.c:2647 [<000000007f73e422>] usb_probe_interface+0x31b/0x800 drivers/usb/core/d= river.c:396 [<00000000fe8d07fc>] really_probe+0x299/0xc30 drivers/base/dd.c:517 [<0000000005da7d32>] __driver_probe_device+0x357/0x500 drivers/base/dd.= c:751 [<000000003c2c9579>] driver_probe_device+0x4e/0x140 drivers/base/dd.c:7= 81 Fix it by freeing 'ftdi' after nobody use it. Fixes: a5c66e4b2418 ("USB: ftdi-elan: client driver for ELAN Uxxx adapters") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun Link: https://lore.kernel.org/r/20211217083428.2441-1-weiyongjun1@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/misc/ftdi-elan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index e5a8fcdbb78e7..6c38c62d29b26 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c @@ -202,6 +202,7 @@ static void ftdi_elan_delete(struct kref *kref) mutex_unlock(&ftdi_module_lock); kfree(ftdi->bulk_in_buffer); ftdi->bulk_in_buffer =3D NULL; + kfree(ftdi); } =20 static void ftdi_elan_put_kref(struct usb_ftdi *ftdi) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B36ABC4707A for ; Mon, 24 Jan 2022 23:37:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360555AbiAXXhA (ORCPT ); Mon, 24 Jan 2022 18:37:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345140AbiAXWzp (ORCPT ); Mon, 24 Jan 2022 17:55:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F096C0680B7; Mon, 24 Jan 2022 13:09:51 -0800 (PST) Received: from smtp.kernel.org (relay.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 3D1AB6146A; Mon, 24 Jan 2022 21:09:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24586C340E5; Mon, 24 Jan 2022 21:09:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058590; bh=Jqatb1L8yQjhbQy9UNMVpIvmVrX+KciqGzLn7FtNWoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wjjAEDhMZU9NJJsPELHsE9+FQoAzHs39eJU7wJwSEDo/oV7smopqVGpCxogjpAaG4 b/zSYjgNPrR24a+a37BkgR2A3dYTgkRYz/me1cqn3EJoM8AtogFagCGmoaH4nZdNlz 3BOHXRxyPdaSAxGeyhtODuCTn9hCdzFVgIh9ke4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Gregory CLEMENT , Sasha Levin Subject: [PATCH 5.16 0305/1039] arm64: dts: marvell: cn9130: add GPIO and SPI aliases Date: Mon, 24 Jan 2022 19:34:54 +0100 Message-Id: <20220124184135.564908526@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 effd42600b987c1e95f946b14fefc1c7639e7439 ] CN9130 has one CP115 built in, which like the CP110 has 2 GPIO and 2 SPI controllers built-in. However, unlike the Armada 7k and 8k the SoC DTSI doesn't add the required aliases as both the Orion SPI driver and MVEBU GPIO drivers require the aliases to be present. So add the required aliases for GPIO and SPI controllers. Fixes: 6b8970bd8d7a ("arm64: dts: marvell: Add support for Marvell CN9130 S= oC support") Signed-off-by: Robert Marko Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/marvell/cn9130.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/boot/dts/marvell/cn9130.dtsi b/arch/arm64/boot/dts/= marvell/cn9130.dtsi index a2b7e5ec979d3..71769ac7f0585 100644 --- a/arch/arm64/boot/dts/marvell/cn9130.dtsi +++ b/arch/arm64/boot/dts/marvell/cn9130.dtsi @@ -11,6 +11,13 @@ model =3D "Marvell Armada CN9130 SoC"; compatible =3D "marvell,cn9130", "marvell,armada-ap807-quad", "marvell,armada-ap807"; + + aliases { + gpio1 =3D &cp0_gpio1; + gpio2 =3D &cp0_gpio2; + spi1 =3D &cp0_spi0; + spi2 =3D &cp0_spi1; + }; }; =20 /* --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B735C46467 for ; Mon, 24 Jan 2022 21:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573715AbiAXVpl (ORCPT ); Mon, 24 Jan 2022 16:45:41 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59654 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447046AbiAXVJ5 (ORCPT ); Mon, 24 Jan 2022 16:09:57 -0500 Received: from smtp.kernel.org (relay.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 1977EB81233; Mon, 24 Jan 2022 21:09:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36667C340E5; Mon, 24 Jan 2022 21:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058593; bh=2/G4H/z6ZjT0mBnaR+ViTzd1dhM7FMwdV/1uFN7ooNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gW2jXS0E5vEYhGBBlfSjBAePFWVzSJ/t1Xy4ACmz2ozVrdjqu2ylaEdCfDP5p3rem 383vHHcvNwhzeQc3hCjIclr7CygIzM292I8VLoaq4Q9rsfgh4b382UCDI1Zexqi5Rm 0vi1SgkXJpMVgyNu6ZZld/E0vy9GyQzLj7jAv+Fc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Gregory CLEMENT , Sasha Levin Subject: [PATCH 5.16 0306/1039] arm64: dts: marvell: cn9130: enable CP0 GPIO controllers Date: Mon, 24 Jan 2022 19:34:55 +0100 Message-Id: <20220124184135.596706810@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 0734f8311ce72c9041e5142769eff2083889c172 ] CN9130 has a built-in CP115 which has 2 GPIO controllers, but unlike in Armada 7k and 8k both are left disabled by the SoC DTSI. This first of all makes no sense as they are always present due to being SoC built-in and its an issue as boards like CN9130-CRB use the CPO GPIO2 pins for regulators and SD card support without enabling them first. So, enable both of them like Armada 7k and 8k do. Fixes: 6b8970bd8d7a ("arm64: dts: marvell: Add support for Marvell CN9130 S= oC support") Signed-off-by: Robert Marko Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/marvell/cn9130.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/marvell/cn9130.dtsi b/arch/arm64/boot/dts/= marvell/cn9130.dtsi index 71769ac7f0585..327b04134134f 100644 --- a/arch/arm64/boot/dts/marvell/cn9130.dtsi +++ b/arch/arm64/boot/dts/marvell/cn9130.dtsi @@ -42,3 +42,11 @@ #undef CP11X_PCIE0_BASE #undef CP11X_PCIE1_BASE #undef CP11X_PCIE2_BASE + +&cp0_gpio1 { + status =3D "okay"; +}; + +&cp0_gpio2 { + status =3D "okay"; +}; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95E64C35271 for ; Mon, 24 Jan 2022 21:44:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353918AbiAXVnJ (ORCPT ); Mon, 24 Jan 2022 16:43:09 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59890 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446436AbiAXVIO (ORCPT ); Mon, 24 Jan 2022 16:08:14 -0500 Received: from smtp.kernel.org (relay.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 D762BB8123A; Mon, 24 Jan 2022 21:08:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E213DC340E7; Mon, 24 Jan 2022 21:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058491; bh=U+Nb0NPZWLh7Nmoze8/HV96EGs6PbpH8kYa4V7Ihd9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WiYz4HNTW7rkx/X1/3zi0tj0lF+HlpmZvMgmjLHrfDNwwnvltp5K75CXRqi4gZeXP 4X+GQpVa7NhBSOUGPp6i594gtpN1D5M8RoSAJpMhdA0nNzSmiVASJo4uTxUl//E6i7 D7uD5+FhZKG6WMZx11yxKtggLxQK2Fb7HZRXSUjE= 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?= , Gregory CLEMENT , Sasha Levin Subject: [PATCH 5.16 0307/1039] ARM: dts: armada-38x: Add generic compatible to UART nodes Date: Mon, 24 Jan 2022 19:34:56 +0100 Message-Id: <20220124184135.632924047@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Marek Beh=C3=BAn [ Upstream commit 62480772263ab6b52e758f2346c70a526abd1d28 ] Add generic compatible string "ns16550a" to serial port nodes of Armada 38x. This makes it possible to use earlycon. Fixes: 0d3d96ab0059 ("ARM: mvebu: add Device Tree description of the Armada= 380/385 SoCs") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Marek Beh=C3=BAn Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/boot/dts/armada-38x.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-3= 8x.dtsi index 9b1a24cc5e91f..df3c8d1d8f641 100644 --- a/arch/arm/boot/dts/armada-38x.dtsi +++ b/arch/arm/boot/dts/armada-38x.dtsi @@ -168,7 +168,7 @@ }; =20 uart0: serial@12000 { - compatible =3D "marvell,armada-38x-uart"; + compatible =3D "marvell,armada-38x-uart", "ns16550a"; reg =3D <0x12000 0x100>; reg-shift =3D <2>; interrupts =3D ; @@ -178,7 +178,7 @@ }; =20 uart1: serial@12100 { - compatible =3D "marvell,armada-38x-uart"; + compatible =3D "marvell,armada-38x-uart", "ns16550a"; reg =3D <0x12100 0x100>; reg-shift =3D <2>; interrupts =3D ; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B914C3526D for ; Mon, 24 Jan 2022 21:44:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349990AbiAXVnC (ORCPT ); Mon, 24 Jan 2022 16:43:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60548 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446447AbiAXVIR (ORCPT ); Mon, 24 Jan 2022 16:08:17 -0500 Received: from smtp.kernel.org (relay.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 1FAC96146E; Mon, 24 Jan 2022 21:08:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 077ACC340E5; Mon, 24 Jan 2022 21:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058494; bh=pINW5Y06eLywlZuwRwe+6QERGMYHIR/VYj2CTS7IREY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yiDAEWbsjE+ErvOU9i4wPaZwNnGTPUwwRUlUO7VjjHx2fQ21Ypeeh5RhFq71ukiuA RpOVcCFQGIvUvt/bEjt26yoVm6uvgVYHAG7uygOtU0rSldfq6wdiy5Ntjdo+1wzuZn JR9Tajn+p161aylzu+W9LO1PA/4LNmBIcZXxiR1E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0308/1039] mt76: mt7921: drop offload_flags overwritten Date: Mon, 24 Jan 2022 19:34:57 +0100 Message-Id: <20220124184135.664168765@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wang [ Upstream commit 2363b6a646b65a207345b9a9024dff0eff3fec44 ] offload_flags have to be dropped for mt7921 because mt76.omac_idx 0 would always run as station mode that would cause Tx encapsulation setting is not applied to mac80211. Also, drop IEEE80211_OFFLOAD_ENCAP_4ADDR too because it is not really being supported. Fixes: e0f9fdda81bd ("mt76: mt7921: add ieee80211_ops") Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net= /wireless/mediatek/mt76/mt7921/main.c index 633c6d2a57acd..b144f5491798a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -318,12 +318,6 @@ static int mt7921_add_interface(struct ieee80211_hw *h= w, mtxq->wcid =3D &mvif->sta.wcid; } =20 - if (vif->type !=3D NL80211_IFTYPE_AP && - (!mvif->mt76.omac_idx || mvif->mt76.omac_idx > 3)) - vif->offload_flags =3D 0; - - vif->offload_flags |=3D IEEE80211_OFFLOAD_ENCAP_4ADDR; - out: mt7921_mutex_release(dev); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C645DC3526D for ; Mon, 24 Jan 2022 23:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360361AbiAXXgi (ORCPT ); Mon, 24 Jan 2022 18:36:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1839865AbiAXWwC (ORCPT ); Mon, 24 Jan 2022 17:52:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CF3FC0EE120; Mon, 24 Jan 2022 13:08:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 330BB611C8; Mon, 24 Jan 2022 21:08:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3904C340E5; Mon, 24 Jan 2022 21:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058497; bh=Zgw5tDOkd3pkJSgwNk1Z+umTFmDwlMzDGAgBtsl77Hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VGxOI0XDtp/vwkS5QmdjjNQ1T4IDd7nkLVjhCSroSXhoIiZr+qGnHqe/Dgrb7k7RS jmKsL/qYml4vyF8egNsLCrrxprTLcRnuALst218XczChf29DsQtxdrTBik/3bvwgZV qRtqmZZEl4c0Za+IgnzsF+Dz+FOvAcyfQQJUytH4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0309/1039] mt76: mt7921: fix MT7921E reset failure Date: Mon, 24 Jan 2022 19:34:58 +0100 Message-Id: <20220124184135.695052739@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wang [ Upstream commit 0efaf31dec572d3aac4316c6d952e06d1c33adc4 ] There is a missing mt7921e_driver_own in the MT7921E reset procedure since the mt7921 mcu.c has been refactored for MT7921S, that will result in MT7921E reset failure, so add it back now. Fixes: dfc7743de1eb ("mt76: mt7921: refactor mcu.c to be bus independent") Reported-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h | 1 + drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c | 4 ++++ drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/n= et/wireless/mediatek/mt76/mt7921/mt7921.h index e9c7c3a195076..d6b823713ba33 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h @@ -446,6 +446,7 @@ int mt7921_mcu_restart(struct mt76_dev *dev); =20 void mt7921e_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, struct sk_buff *skb); +int mt7921e_driver_own(struct mt7921_dev *dev); int mt7921e_mac_reset(struct mt7921_dev *dev); int mt7921e_mcu_init(struct mt7921_dev *dev); int mt7921s_wfsys_reset(struct mt7921_dev *dev); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c b/drivers/= net/wireless/mediatek/mt76/mt7921/pci_mac.c index f9547d27356e1..85286cc9add14 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c @@ -321,6 +321,10 @@ int mt7921e_mac_reset(struct mt7921_dev *dev) MT_INT_MCU_CMD); mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff); =20 + err =3D mt7921e_driver_own(dev); + if (err) + return err; + err =3D mt7921_run_firmware(dev); if (err) goto out; diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c b/drivers/= net/wireless/mediatek/mt76/mt7921/pci_mcu.c index 583a89a34734a..7b34c7f2ab3a6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c @@ -4,7 +4,7 @@ #include "mt7921.h" #include "mcu.h" =20 -static int mt7921e_driver_own(struct mt7921_dev *dev) +int mt7921e_driver_own(struct mt7921_dev *dev) { u32 reg =3D mt7921_reg_map_l1(dev, MT_TOP_LPCR_HOST_BAND0); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6C2AC2BA4C for ; Mon, 24 Jan 2022 23:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360336AbiAXXgd (ORCPT ); Mon, 24 Jan 2022 18:36:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1839864AbiAXWwC (ORCPT ); Mon, 24 Jan 2022 17:52:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 960B6C0EE124; Mon, 24 Jan 2022 13:08:21 -0800 (PST) Received: from smtp.kernel.org (relay.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 32D2361361; Mon, 24 Jan 2022 21:08:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AB83C340E5; Mon, 24 Jan 2022 21:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058500; bh=wCfGmnqg8RDNFzmO5ZVCUAYTvgNwzU7QViE47riBEbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zbxbL3BUVN3YoovtNYi9fdwC+ruPjqiNUMQDafzqHRMLHtY0uGEPnKU661V8pmaqR PhVt3yEOmF2GH38saCV5zpyq4Ayzambfz4VsYD62whKvAC0zY2DH7SsK1gNR2Cxgra C3QoQXCF1zH0j9OPMzCE6SdQ3DYW3uFgKRr8fiWM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0310/1039] mt76: debugfs: fix queue reporting for mt76-usb Date: Mon, 24 Jan 2022 19:34:59 +0100 Message-Id: <20220124184135.729212233@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit eae7df016c30468e09481a75b1339f0ab5ece222 ] Fix number of rx-queued frames reported by mt76_usb driver. Reported-by: kernel test robot Fixes: 2d8be76c1674 ("mt76: debugfs: improve queue node readability") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/debugfs.c b/drivers/net/wir= eless/mediatek/mt76/debugfs.c index b8bcf22a07fd8..47e9911ee9fe6 100644 --- a/drivers/net/wireless/mediatek/mt76/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/debugfs.c @@ -82,7 +82,7 @@ static int mt76_rx_queues_read(struct seq_file *s, void *= data) =20 queued =3D mt76_is_usb(dev) ? q->ndesc - q->queued : q->queued; seq_printf(s, " %9d | %9d | %9d | %9d |\n", - i, q->queued, q->head, q->tail); + i, queued, q->head, q->tail); } =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93FC0C4332F for ; Mon, 24 Jan 2022 23:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360318AbiAXXga (ORCPT ); Mon, 24 Jan 2022 18:36:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1839879AbiAXWwD (ORCPT ); Mon, 24 Jan 2022 17:52:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2951C0EE126; Mon, 24 Jan 2022 13:08:24 -0800 (PST) Received: from smtp.kernel.org (relay.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 405BD611C8; Mon, 24 Jan 2022 21:08:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23ED6C340E5; Mon, 24 Jan 2022 21:08:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058503; bh=JAH7qg2L/G+k79KV4K1U+s1717QvvG9IoCWx99kg8+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qkWtSDOnGE5Lj1uY3MmlYHfbMFAC2doSsqQGDhgGnxsZEPIX97vukwP0lS1kKkwyi lnzq8UR1lW35sflkVI0goIGsp0gQT5laAW4wK9yC3qjmg2NZQBqUhSRJpeOlcCwb0I 5thGhQpuruVWZijIxDuxOQT14fPPVKF9LcdPz5Wc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0311/1039] mt76: fix possible OOB issue in mt76_calculate_default_rate Date: Mon, 24 Jan 2022 19:35:00 +0100 Message-Id: <20220124184135.760432052@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit d4f3d1c4d3c2bcce76a96a6562170664b25112f0 ] Cap max offset value to ARRAY_SIZE(mt76_rates) - 1 in mt76_calculate_default_rate routine in order to avoid possible Out Of Bound accesses. Fixes: 33920b2bf0483 ("mt76: add support for setting mcast rate") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mac80211.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wi= reless/mediatek/mt76/mac80211.c index 62807dc311c19..b0869ff86c49f 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -1494,7 +1494,6 @@ EXPORT_SYMBOL_GPL(mt76_init_queue); u16 mt76_calculate_default_rate(struct mt76_phy *phy, int rateidx) { int offset =3D 0; - struct ieee80211_rate *rate; =20 if (phy->chandef.chan->band !=3D NL80211_BAND_2GHZ) offset =3D 4; @@ -1503,9 +1502,11 @@ u16 mt76_calculate_default_rate(struct mt76_phy *phy= , int rateidx) if (rateidx < 0) rateidx =3D 0; =20 - rate =3D &mt76_rates[offset + rateidx]; + rateidx +=3D offset; + if (rateidx >=3D ARRAY_SIZE(mt76_rates)) + rateidx =3D offset; =20 - return rate->hw_value; + return mt76_rates[rateidx].hw_value; } EXPORT_SYMBOL_GPL(mt76_calculate_default_rate); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFF86C3525A for ; Mon, 24 Jan 2022 23:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360481AbiAXXgw (ORCPT ); Mon, 24 Jan 2022 18:36:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351118AbiAXWxj (ORCPT ); Mon, 24 Jan 2022 17:53:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A111C0EE12B; Mon, 24 Jan 2022 13:08:29 -0800 (PST) Received: from smtp.kernel.org (relay.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 275DFB8123D; Mon, 24 Jan 2022 21:08:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20201C340E5; Mon, 24 Jan 2022 21:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058506; bh=7kR9ewpZ7hOXX/Afq2CPiSJiQAxrzpCzuz/GkMjpraY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZwb7YScHIfHQJEPq6tT1sGRM9cbfQdpNR2GRiczGyWfwBqajvfReSUJ2/sAGAhx1 xYMety0mYuUFssKyVymBzJlWpHLP+sQget4MSzshQ5zb8PB0v8f7vWlZt69cN0ox+M RZdgEcRmc5wOLv16uiqLZ4qTh43teYe2JwyYIuDs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0312/1039] mt76: mt7921: fix possible NULL pointer dereference in mt7921_mac_write_txwi Date: Mon, 24 Jan 2022 19:35:01 +0100 Message-Id: <20220124184135.792115428@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit ec2ebc1c5a5ce49538fa78108c53eaf722eee908 ] Fix a possible NULL pointer deference issue in mt7921_mac_write_txwi routine if vif is NULL. Fixes: 33920b2bf0483 ("mt76: add support for setting mcast rate") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/= wireless/mediatek/mt76/mt7921/mac.c index db3302b1576a0..321d9f1d3f865 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -903,7 +903,7 @@ void mt7921_mac_write_txwi(struct mt7921_dev *dev, __le= 32 *txwi, mt7921_mac_write_txwi_80211(dev, txwi, skb, key); =20 if (txwi[2] & cpu_to_le32(MT_TXD2_FIX_RATE)) { - int rateidx =3D ffs(vif->bss_conf.basic_rates) - 1; + int rateidx =3D vif ? ffs(vif->bss_conf.basic_rates) - 1 : 0; u16 rate, mode; =20 /* hardware won't add HTC for mgmt/ctrl frame */ --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7068BC433EF for ; Mon, 24 Jan 2022 21:44:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457862AbiAXVmY (ORCPT ); Mon, 24 Jan 2022 16:42:24 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60762 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446482AbiAXVIb (ORCPT ); Mon, 24 Jan 2022 16:08:31 -0500 Received: from smtp.kernel.org (relay.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 7CBED61361; Mon, 24 Jan 2022 21:08:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CEAEC340E5; Mon, 24 Jan 2022 21:08:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058509; bh=HXjDHTULbYoyZnnI4A4Z2OtgSDnzKFFpNgxUn8IpImg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JnWj9FJu/MDmrkd4UKwauROOfa4KMSjuQq84Gtg6VMgPO+mrk+E34IllnwgY1DniX sVi+h18oUWAIMrt34aXc4liDzU2USJVV715ciA0nELWQi9lTn0y/F9KB0vQpnCopeV PEwdJxo8us5FLIccwBafG5KcVjWgXfyL8FqFZLdk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0313/1039] mt76: mt7921: move mt76_connac_mcu_set_hif_suspend to bus-related files Date: Mon, 24 Jan 2022 19:35:02 +0100 Message-Id: <20220124184135.825063313@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wang [ Upstream commit 6906aa93eb93d54a42ce1902f00d6ea04ecb039b ] This is a preliminary patch for the following patch ("mt76: mt7921s: fix the device cannot sleep deeply in suspend). mt76_connac_mcu_set_hif_suspend eventually would be handled in each bus-level suspend/resume handler in either mt7921/sdio.c or mt7921/pci.c depending on what type of the bus the device is running on. We can move mt76_connac_mcu_set_hif_suspend to bus-related files to simplify the logic. Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../net/wireless/mediatek/mt76/mt7921/main.c | 13 ++----------- .../net/wireless/mediatek/mt76/mt7921/pci.c | 18 +++++------------- .../net/wireless/mediatek/mt76/mt7921/sdio.c | 18 +++++------------- 3 files changed, 12 insertions(+), 37 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net= /wireless/mediatek/mt76/mt7921/main.c index b144f5491798a..e022251b40069 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -1232,7 +1232,6 @@ static int mt7921_suspend(struct ieee80211_hw *hw, { struct mt7921_dev *dev =3D mt7921_hw_dev(hw); struct mt7921_phy *phy =3D mt7921_hw_phy(hw); - int err; =20 cancel_delayed_work_sync(&phy->scan_work); cancel_delayed_work_sync(&phy->mt76->mac_work); @@ -1250,25 +1249,18 @@ static int mt7921_suspend(struct ieee80211_hw *hw, mt76_connac_mcu_set_suspend_iter, &dev->mphy); =20 - err =3D mt76_connac_mcu_set_hif_suspend(&dev->mt76, true); - mt7921_mutex_release(dev); =20 - return err; + return 0; } =20 static int mt7921_resume(struct ieee80211_hw *hw) { struct mt7921_dev *dev =3D mt7921_hw_dev(hw); struct mt7921_phy *phy =3D mt7921_hw_phy(hw); - int err; =20 mt7921_mutex_acquire(dev); =20 - err =3D mt76_connac_mcu_set_hif_suspend(&dev->mt76, false); - if (err < 0) - goto out; - set_bit(MT76_STATE_RUNNING, &phy->mt76->state); clear_bit(MT76_STATE_SUSPEND, &phy->mt76->state); ieee80211_iterate_active_interfaces(hw, @@ -1278,11 +1270,10 @@ static int mt7921_resume(struct ieee80211_hw *hw) =20 ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work, MT7921_WATCHDOG_TIME); -out: =20 mt7921_mutex_release(dev); =20 - return err; + return 0; } =20 static void mt7921_set_wakeup(struct ieee80211_hw *hw, bool enabled) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/= wireless/mediatek/mt76/mt7921/pci.c index 305b63fa1a8a9..c29dde23d4ab1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -235,7 +235,6 @@ static int mt7921_pci_suspend(struct pci_dev *pdev, pm_= message_t state) struct mt76_dev *mdev =3D pci_get_drvdata(pdev); struct mt7921_dev *dev =3D container_of(mdev, struct mt7921_dev, mt76); struct mt76_connac_pm *pm =3D &dev->pm; - bool hif_suspend; int i, err; =20 pm->suspended =3D true; @@ -246,12 +245,9 @@ static int mt7921_pci_suspend(struct pci_dev *pdev, pm= _message_t state) if (err < 0) goto restore_suspend; =20 - hif_suspend =3D !test_bit(MT76_STATE_SUSPEND, &dev->mphy.state); - if (hif_suspend) { - err =3D mt76_connac_mcu_set_hif_suspend(mdev, true); - if (err) - goto restore_suspend; - } + err =3D mt76_connac_mcu_set_hif_suspend(mdev, true); + if (err) + goto restore_suspend; =20 /* always enable deep sleep during suspend to reduce * power consumption @@ -302,8 +298,7 @@ restore_napi: if (!pm->ds_enable) mt76_connac_mcu_set_deep_sleep(&dev->mt76, false); =20 - if (hif_suspend) - mt76_connac_mcu_set_hif_suspend(mdev, false); + mt76_connac_mcu_set_hif_suspend(mdev, false); =20 restore_suspend: pm->suspended =3D false; @@ -356,10 +351,7 @@ static int mt7921_pci_resume(struct pci_dev *pdev) if (!pm->ds_enable) mt76_connac_mcu_set_deep_sleep(&dev->mt76, false); =20 - if (!test_bit(MT76_STATE_SUSPEND, &dev->mphy.state)) - err =3D mt76_connac_mcu_set_hif_suspend(mdev, false); - - return err; + return mt76_connac_mcu_set_hif_suspend(mdev, false); } #endif /* CONFIG_PM */ =20 diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c b/drivers/net= /wireless/mediatek/mt76/mt7921/sdio.c index ddf0eeb8b6889..5fee489c7a998 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c @@ -203,7 +203,6 @@ static int mt7921s_suspend(struct device *__dev) struct mt7921_dev *dev =3D sdio_get_drvdata(func); struct mt76_connac_pm *pm =3D &dev->pm; struct mt76_dev *mdev =3D &dev->mt76; - bool hif_suspend; int err; =20 pm->suspended =3D true; @@ -214,12 +213,9 @@ static int mt7921s_suspend(struct device *__dev) if (err < 0) goto restore_suspend; =20 - hif_suspend =3D !test_bit(MT76_STATE_SUSPEND, &dev->mphy.state); - if (hif_suspend) { - err =3D mt76_connac_mcu_set_hif_suspend(mdev, true); - if (err) - goto restore_suspend; - } + err =3D mt76_connac_mcu_set_hif_suspend(mdev, true); + if (err) + goto restore_suspend; =20 /* always enable deep sleep during suspend to reduce * power consumption @@ -253,8 +249,7 @@ restore_worker: if (!pm->ds_enable) mt76_connac_mcu_set_deep_sleep(mdev, false); =20 - if (hif_suspend) - mt76_connac_mcu_set_hif_suspend(mdev, false); + mt76_connac_mcu_set_hif_suspend(mdev, false); =20 restore_suspend: pm->suspended =3D false; @@ -285,10 +280,7 @@ static int mt7921s_resume(struct device *__dev) if (!pm->ds_enable) mt76_connac_mcu_set_deep_sleep(mdev, false); =20 - if (!test_bit(MT76_STATE_SUSPEND, &dev->mphy.state)) - err =3D mt76_connac_mcu_set_hif_suspend(mdev, false); - - return err; + return mt76_connac_mcu_set_hif_suspend(mdev, false); } =20 static const struct dev_pm_ops mt7921s_pm_ops =3D { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72402C43217 for ; Mon, 24 Jan 2022 21:44:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457840AbiAXVmV (ORCPT ); Mon, 24 Jan 2022 16:42:21 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59086 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446500AbiAXVIe (ORCPT ); Mon, 24 Jan 2022 16:08:34 -0500 Received: from smtp.kernel.org (relay.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 A937C6142C; Mon, 24 Jan 2022 21:08:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F430C340E5; Mon, 24 Jan 2022 21:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058513; bh=+loTW4ROEUTm1KnXswrf01fFT/KXwETwI7b4IKgZbf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xb+LyZSkYDBoTJeO87GyDT0uoovvJOojFb4qHzuBow7n+6/zXMutjc/lJFdHe9s+U yZ6yqK1jC2BEQNOiaLs9KFsZyUGShONzc0CGx5650dsfaJH/T0MaKmyk7vy/w704Hl T4bo3Chi06UFws17se9O2OnN0YVObi478LGEZ/Ew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leon Yen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0314/1039] mt76: mt7921s: fix the device cannot sleep deeply in suspend Date: Mon, 24 Jan 2022 19:35:03 +0100 Message-Id: <20220124184135.855240081@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wang [ Upstream commit 5ad4faca7690a88b4529238c757b6b8ead8056ec ] According to the MT7921S firmware, the cmd MCU_UNI_CMD_HIF_CTRL have to be last MCU command to execute in suspend handler and all data traffic have to be stopped before the cmd MCU_UNI_CMD_HIF_CTRL starts as well in order that mt7921 can successfully fall into the deep sleep mode. Where we reuse the flag MT76_STATE_SUSPEND and avoid creating another global flag to stop all of the traffic onto the SDIO bus. Fixes: 48fab5bbef40 ("mt76: mt7921: introduce mt7921s support") Reported-by: Leon Yen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +- .../net/wireless/mediatek/mt76/mt7921/main.c | 3 -- .../net/wireless/mediatek/mt76/mt7921/sdio.c | 34 ++++++++++++------- drivers/net/wireless/mediatek/mt76/sdio.c | 3 +- .../net/wireless/mediatek/mt76/sdio_txrx.c | 3 +- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers= /net/wireless/mediatek/mt76/mt76_connac_mcu.c index 26b4b875dcc02..61c4c86e79c88 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -2461,7 +2461,7 @@ void mt76_connac_mcu_set_suspend_iter(void *priv, u8 = *mac, struct ieee80211_vif *vif) { struct mt76_phy *phy =3D priv; - bool suspend =3D test_bit(MT76_STATE_SUSPEND, &phy->state); + bool suspend =3D !test_bit(MT76_STATE_RUNNING, &phy->state); struct ieee80211_hw *hw =3D phy->hw; struct cfg80211_wowlan *wowlan =3D hw->wiphy->wowlan_config; int i; diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net= /wireless/mediatek/mt76/mt7921/main.c index e022251b40069..0b2a6b7f22eae 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -1242,8 +1242,6 @@ static int mt7921_suspend(struct ieee80211_hw *hw, mt7921_mutex_acquire(dev); =20 clear_bit(MT76_STATE_RUNNING, &phy->mt76->state); - - set_bit(MT76_STATE_SUSPEND, &phy->mt76->state); ieee80211_iterate_active_interfaces(hw, IEEE80211_IFACE_ITER_RESUME_ALL, mt76_connac_mcu_set_suspend_iter, @@ -1262,7 +1260,6 @@ static int mt7921_resume(struct ieee80211_hw *hw) mt7921_mutex_acquire(dev); =20 set_bit(MT76_STATE_RUNNING, &phy->mt76->state); - clear_bit(MT76_STATE_SUSPEND, &phy->mt76->state); ieee80211_iterate_active_interfaces(hw, IEEE80211_IFACE_ITER_RESUME_ALL, mt76_connac_mcu_set_suspend_iter, diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c b/drivers/net= /wireless/mediatek/mt76/mt7921/sdio.c index 5fee489c7a998..5c88b6b8d0979 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c @@ -206,6 +206,8 @@ static int mt7921s_suspend(struct device *__dev) int err; =20 pm->suspended =3D true; + set_bit(MT76_STATE_SUSPEND, &mdev->phy.state); + cancel_delayed_work_sync(&pm->ps_work); cancel_work_sync(&pm->wake_work); =20 @@ -213,10 +215,6 @@ static int mt7921s_suspend(struct device *__dev) if (err < 0) goto restore_suspend; =20 - err =3D mt76_connac_mcu_set_hif_suspend(mdev, true); - if (err) - goto restore_suspend; - /* always enable deep sleep during suspend to reduce * power consumption */ @@ -224,34 +222,45 @@ static int mt7921s_suspend(struct device *__dev) =20 mt76_txq_schedule_all(&dev->mphy); mt76_worker_disable(&mdev->tx_worker); - mt76_worker_disable(&mdev->sdio.txrx_worker); mt76_worker_disable(&mdev->sdio.status_worker); - mt76_worker_disable(&mdev->sdio.net_worker); cancel_work_sync(&mdev->sdio.stat_work); clear_bit(MT76_READING_STATS, &dev->mphy.state); - mt76_tx_status_check(mdev, true); =20 - err =3D mt7921_mcu_fw_pmctrl(dev); + mt76_worker_schedule(&mdev->sdio.txrx_worker); + wait_event_timeout(dev->mt76.sdio.wait, + mt76s_txqs_empty(&dev->mt76), 5 * HZ); + + /* It is supposed that SDIO bus is idle at the point */ + err =3D mt76_connac_mcu_set_hif_suspend(mdev, true); if (err) goto restore_worker; =20 + mt76_worker_disable(&mdev->sdio.txrx_worker); + mt76_worker_disable(&mdev->sdio.net_worker); + + err =3D mt7921_mcu_fw_pmctrl(dev); + if (err) + goto restore_txrx_worker; + sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); =20 return 0; =20 +restore_txrx_worker: + mt76_worker_enable(&mdev->sdio.net_worker); + mt76_worker_enable(&mdev->sdio.txrx_worker); + mt76_connac_mcu_set_hif_suspend(mdev, false); + restore_worker: mt76_worker_enable(&mdev->tx_worker); - mt76_worker_enable(&mdev->sdio.txrx_worker); mt76_worker_enable(&mdev->sdio.status_worker); - mt76_worker_enable(&mdev->sdio.net_worker); =20 if (!pm->ds_enable) mt76_connac_mcu_set_deep_sleep(mdev, false); =20 - mt76_connac_mcu_set_hif_suspend(mdev, false); - restore_suspend: + clear_bit(MT76_STATE_SUSPEND, &mdev->phy.state); pm->suspended =3D false; =20 return err; @@ -266,6 +275,7 @@ static int mt7921s_resume(struct device *__dev) int err; =20 pm->suspended =3D false; + clear_bit(MT76_STATE_SUSPEND, &mdev->phy.state); =20 err =3D mt7921_mcu_drv_pmctrl(dev); if (err < 0) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wirele= ss/mediatek/mt76/sdio.c index c99acc21225e1..b0bc7be0fb1fc 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -479,7 +479,8 @@ static void mt76s_status_worker(struct mt76_worker *w) resched =3D true; =20 if (dev->drv->tx_status_data && - !test_and_set_bit(MT76_READING_STATS, &dev->phy.state)) + !test_and_set_bit(MT76_READING_STATS, &dev->phy.state) && + !test_bit(MT76_STATE_SUSPEND, &dev->phy.state)) queue_work(dev->wq, &dev->sdio.stat_work); } while (nframes > 0); =20 diff --git a/drivers/net/wireless/mediatek/mt76/sdio_txrx.c b/drivers/net/w= ireless/mediatek/mt76/sdio_txrx.c index 649a56790b89d..801590a0a334f 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio_txrx.c +++ b/drivers/net/wireless/mediatek/mt76/sdio_txrx.c @@ -317,7 +317,8 @@ void mt76s_txrx_worker(struct mt76_sdio *sdio) if (ret > 0) nframes +=3D ret; =20 - if (test_bit(MT76_MCU_RESET, &dev->phy.state)) { + if (test_bit(MT76_MCU_RESET, &dev->phy.state) || + test_bit(MT76_STATE_SUSPEND, &dev->phy.state)) { if (!mt76s_txqs_empty(dev)) continue; else --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 908CFC433F5 for ; Mon, 24 Jan 2022 23:37:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360532AbiAXXg6 (ORCPT ); Mon, 24 Jan 2022 18:36:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382774AbiAXWxo (ORCPT ); Mon, 24 Jan 2022 17:53:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CD11C0EE12D; Mon, 24 Jan 2022 13:08:37 -0800 (PST) Received: from smtp.kernel.org (relay.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 C013461489; Mon, 24 Jan 2022 21:08:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AB4BC340E5; Mon, 24 Jan 2022 21:08:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058516; bh=/G0qA44KxcJzpX12SZiZmuPSQJ7xQKjHwZtCclxgJY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AtlhgyXGHcxwbG3JwCdrvKjfy87ATK/bZ9027YBCQOFJcnUqRutwepMvi2Gjzm+0A O8p43asqPeTAAKwKOEwMDQ7MeBqtDvz6xPKU1iJEqXhkIOYH1l0XcdYblp6Vurh7DE pM2QLib0ovBfSX0GaclrP9aMLBQIdu4Tz4o4IizY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shayne Chen , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0315/1039] mt76: mt7921: use correct iftype data on 6GHz cap init Date: Mon, 24 Jan 2022 19:35:04 +0100 Message-Id: <20220124184135.889318646@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shayne Chen [ Upstream commit 00ff52346d74c38787ff8b4acde8c5671d9b7fe2 ] Set 6GHz cap to iftype data which is matched to the type of current interface. Fixes: 50ac15a511e3 ("mt76: mt7921: add 6GHz support") Signed-off-by: Shayne Chen Acked-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net= /wireless/mediatek/mt76/mt7921/main.c index 0b2a6b7f22eae..21e745fddc9c3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -166,7 +166,7 @@ mt7921_init_he_caps(struct mt7921_phy *phy, enum nl8021= 1_band band, if (vht_cap->cap & IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN) cap |=3D IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS; =20 - data->he_6ghz_capa.capa =3D cpu_to_le16(cap); + data[idx].he_6ghz_capa.capa =3D cpu_to_le16(cap); } idx++; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70144C3526E for ; Mon, 24 Jan 2022 23:37:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360508AbiAXXgz (ORCPT ); Mon, 24 Jan 2022 18:36:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382775AbiAXWxo (ORCPT ); Mon, 24 Jan 2022 17:53:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7843C061A10; Mon, 24 Jan 2022 13:08:41 -0800 (PST) Received: from smtp.kernel.org (relay.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 831A0B80FA3; Mon, 24 Jan 2022 21:08:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB209C340E5; Mon, 24 Jan 2022 21:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058519; bh=XVfbMr+0bam4xryzd7On8rKa6GlVOXgJT+vvJ89vSBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v5TDG/ZebXH84R+DJhR9it98WcAEmXCcn2wNwx3tQpKQZRmIjEdwna8pC0nvIfGu1 Q29ER5MxBQahmLlEblDWJNx1K5pWtQZ9zl5bM13gvXO/mNoysxTrpS2q9JqwwcN8cT dMejYdw0mbuY9jhmoTmKf5lCMCuhCxlxipqql8Bo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0316/1039] mt76: mt7921s: fix possible kernel crash due to invalid Rx count Date: Mon, 24 Jan 2022 19:35:05 +0100 Message-Id: <20220124184135.922658007@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wang [ Upstream commit 2b7f3574ca9a7ff4a6b4ec1ae4dfdfde481ac80b ] Return the proper error code when out-of-range the Rx aggregation count are reported from the hardware that would create the unreasonable extreme large Rx buffer. [ 100.873810] show_stack+0x20/0x2c [ 100.873823] dump_stack+0xc4/0x140 [ 100.873839] bad_page+0x110/0x114 [ 100.873854] check_new_pages+0xf8/0xfc [ 100.873869] rmqueue+0x5a0/0x640 [ 100.873884] get_page_from_freelist+0x124/0x20c [ 100.873898] __alloc_pages_nodemask+0x114/0x2a4 [ 100.873918] mt76s_rx_run_queue+0xd4/0x2e4 [mt76_sdio 8280a88a0c8c9cf203= f16e194f99ac293bdbb2f5] [ 100.873938] mt76s_rx_handler+0xd4/0x2a0 [mt76_sdio 8280a88a0c8c9cf203f1= 6e194f99ac293bdbb2f5] [ 100.873957] mt76s_txrx_worker+0xac/0x17c [mt76_sdio 8280a88a0c8c9cf203f= 16e194f99ac293bdbb2f5] [ 100.873977] mt7921s_txrx_worker+0x5c/0xd8 [mt7921s d0bdbc018082dbc8dc14= 07614be3c2e7bd64423b] [ 100.874003] __mt76_worker_fn+0xe8/0x170 [mt76 b80af3483a8f9d48e916c12d8= dbfaa0d3cd15337] [ 100.874018] kthread+0x148/0x3ac [ 100.874032] ret_from_fork+0x10/0x30 [ 100.874067] Kernel Offset: 0x1fe2000000 from 0xffffffc010000000 [ 100.874079] PHYS_OFFSET: 0xffffffe800000000 [ 100.874090] CPU features: 0x0240002,2188200c Fixes: 48fab5bbef40 ("mt76: mt7921: introduce mt7921s support") Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7921/sdio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c b/drivers/net= /wireless/mediatek/mt76/mt7921/sdio.c index 5c88b6b8d0979..84be229a899da 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c @@ -62,6 +62,10 @@ static int mt7921s_parse_intr(struct mt76_dev *dev, stru= ct mt76s_intr *intr) if (err < 0) return err; =20 + if (irq_data->rx.num[0] > 16 || + irq_data->rx.num[1] > 128) + return -EINVAL; + intr->isr =3D irq_data->isr; intr->rec_mb =3D irq_data->rec_mb; intr->tx.wtqcr =3D irq_data->tx.wtqcr; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D6A4C3526F for ; Mon, 24 Jan 2022 21:47:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573606AbiAXVpX (ORCPT ); Mon, 24 Jan 2022 16:45:23 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60210 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446607AbiAXVIs (ORCPT ); Mon, 24 Jan 2022 16:08:48 -0500 Received: from smtp.kernel.org (relay.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 B66ADB80CCF; Mon, 24 Jan 2022 21:08:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE9A2C340E5; Mon, 24 Jan 2022 21:08:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058525; bh=AONqG5bMtL6kUVRHWb9GpOeyQRbkloKcPD/OKYlC4ZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jL0f3rTxZfy8f3kmECkdglqwRrdQBdN8rD97pUf8mAq48RtIbRxcNMu0bUVOSg0Wo AyxazxgG8y48Sza2X2cAErPiAc6MXmW3ei7K+HdwiQw1v/oNv5gee2CE+ZN4IVrIo8 kr+i80in2bGNCB6ht6vvpiJDCVUd4wAR2Ngbbi40= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0317/1039] mt76: connac: fix last_chan configuration in mt76_connac_mcu_rate_txpower_band Date: Mon, 24 Jan 2022 19:35:06 +0100 Message-Id: <20220124184135.951734676@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit 73c7c0443685d8d152c3451e7305a2c2bc47b32e ] last_ch configuration must not be dependent on the current configured band but it is defined by hw capabilities since the fw always expects the following order: - 2GHz - 5GHz - 6GHz Fixes: 9b2ea8eee42a1 ("mt76: connac: set 6G phymode in single-sku support") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers= /net/wireless/mediatek/mt76/mt76_connac_mcu.c index 61c4c86e79c88..b15bbd650a90c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -2008,12 +2008,12 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *= phy, } batch_size =3D DIV_ROUND_UP(n_chan, batch_len); =20 - if (!phy->cap.has_5ghz) - last_ch =3D chan_list_2ghz[n_chan - 1]; - else if (phy->cap.has_6ghz) - last_ch =3D chan_list_6ghz[n_chan - 1]; + if (phy->cap.has_6ghz) + last_ch =3D chan_list_6ghz[ARRAY_SIZE(chan_list_6ghz) - 1]; + else if (phy->cap.has_5ghz) + last_ch =3D chan_list_5ghz[ARRAY_SIZE(chan_list_5ghz) - 1]; else - last_ch =3D chan_list_5ghz[n_chan - 1]; + last_ch =3D chan_list_2ghz[ARRAY_SIZE(chan_list_2ghz) - 1]; =20 for (i =3D 0; i < batch_size; i++) { struct mt76_connac_tx_power_limit_tlv tx_power_tlv =3D {}; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 775AAC3526F for ; Mon, 24 Jan 2022 21:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1458040AbiAXVmn (ORCPT ); Mon, 24 Jan 2022 16:42:43 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58932 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230110AbiAXVIw (ORCPT ); Mon, 24 Jan 2022 16:08:52 -0500 Received: from smtp.kernel.org (relay.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 D21DDB80FA3; Mon, 24 Jan 2022 21:08:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F258BC340E5; Mon, 24 Jan 2022 21:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058528; bh=YjrVxM7CLUaCdnPq3WETDJ47sLozfT7aDhMUijcqU08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CfOE1GmC2M/18GoO9qbgk/J6bJ0TRAbpDZP21DCaXRU/65dBiBJ5bRefVlEHaAO4P W1fm+qyPwMfA59Mc98+UIxwohTEWeObqOM653cZEhfigaS7AhHTtxCusWZLQE9Or1r QJlLrElDsZSlK1Qe2TdJUnhSA3FmCs9+mTf4aEkY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0318/1039] mt76: mt7921: fix possible resume failure Date: Mon, 24 Jan 2022 19:35:07 +0100 Message-Id: <20220124184135.983197973@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wang [ Upstream commit 5375001bb4ce22801bf3bb566cc3e67d2d3a5dc0 ] Fix the possible resume failure due to mt76_connac_mcu_set_hif_suspend timeout. That is because clearing the flag pm->suspended too early opened up a race window, where mt7921_poll_tx/rx scheduled a ps_work to put the device in doze mode, that is unexpected for the device is being resumed from the suspend state and would make the remaining MCU comamnds in resume handler failed to execute. Fixes: ffa1bf97425b ("mt76: mt7921: introduce PM support") Co-developed-by: YN Chen Signed-off-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/= wireless/mediatek/mt76/mt7921/pci.c index c29dde23d4ab1..40186e6cd865e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -313,7 +313,6 @@ static int mt7921_pci_resume(struct pci_dev *pdev) struct mt76_connac_pm *pm =3D &dev->pm; int i, err; =20 - pm->suspended =3D false; err =3D pci_set_power_state(pdev, PCI_D0); if (err) return err; @@ -351,7 +350,13 @@ static int mt7921_pci_resume(struct pci_dev *pdev) if (!pm->ds_enable) mt76_connac_mcu_set_deep_sleep(&dev->mt76, false); =20 - return mt76_connac_mcu_set_hif_suspend(mdev, false); + err =3D mt76_connac_mcu_set_hif_suspend(mdev, false); + if (err) + return err; + + pm->suspended =3D false; + + return err; } #endif /* CONFIG_PM */ =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00301C3526E for ; Mon, 24 Jan 2022 23:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366301AbiAXXwg (ORCPT ); Mon, 24 Jan 2022 18:52:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383052AbiAXWx4 (ORCPT ); Mon, 24 Jan 2022 17:53:56 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7727BC061361; Mon, 24 Jan 2022 13:08:54 -0800 (PST) Received: from smtp.kernel.org (relay.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 1A536B811FB; Mon, 24 Jan 2022 21:08:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16F8CC340E5; Mon, 24 Jan 2022 21:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058531; bh=jUgsdUEOYzMQeY3iiMX1KyBUEw4niBVsx+uDtqxYTy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zd3JY8qZ71+0E3t5Pg7ILSbr+vSgA/Uuo1qUZBLXannErcc1UGInkMa4RsRFjaOmR kd04ZJzRKhJzqlyfFqLcuIEuMXYSdXdSKnfNZGUKaFYzWaVOHxHuJzyHxbyEyeyOe5 +xrmrhN4gwN0IbIU4Jru0ctDuGzxZWY1DVQ/m/ZM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0319/1039] mt76: connac: introduce MCU_EXT macros Date: Mon, 24 Jan 2022 19:35:08 +0100 Message-Id: <20220124184136.014876769@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit e6d2070d9d64aad04c12424865cfd9684ba64bea ] Introduce MCU_EXT_CMD and MCU_EXT_QUERY macros in mt76_connac module. This is a preliminary patch to reuse mt76_connac module in mt7915 driver. Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../net/wireless/mediatek/mt76/mt7615/main.c | 4 +- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 154 ++++++++---------- .../wireless/mediatek/mt76/mt7615/testmode.c | 4 +- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 4 +- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 16 +- .../net/wireless/mediatek/mt76/mt7921/main.c | 4 +- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 76 +++------ 7 files changed, 113 insertions(+), 149 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net= /wireless/mediatek/mt76/mt7615/main.c index 890d9b07e1563..24c23d4951432 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -73,7 +73,7 @@ static int mt7615_start(struct ieee80211_hw *hw) goto out; } =20 - ret =3D mt7615_mcu_set_chan_info(phy, MCU_EXT_CMD_SET_RX_PATH); + ret =3D mt7615_mcu_set_chan_info(phy, MCU_EXT_CMD(SET_RX_PATH)); if (ret) goto out; =20 @@ -331,7 +331,7 @@ int mt7615_set_channel(struct mt7615_phy *phy) goto out; } =20 - ret =3D mt7615_mcu_set_chan_info(phy, MCU_EXT_CMD_CHANNEL_SWITCH); + ret =3D mt7615_mcu_set_chan_info(phy, MCU_EXT_CMD(CHANNEL_SWITCH)); if (ret) goto out; =20 diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7615/mcu.c index 25f9cbe2cd610..397a8bb67ffbf 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -87,7 +87,7 @@ struct mt7663_fw_buf { void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb, int cmd, int *wait_seq) { - int txd_len, mcu_cmd =3D cmd & MCU_CMD_MASK; + int txd_len, mcu_cmd =3D FIELD_GET(__MCU_CMD_FIELD_ID, cmd); struct mt7615_uni_txd *uni_txd; struct mt7615_mcu_txd *mcu_txd; u8 seq, q_idx, pkt_fmt; @@ -142,28 +142,17 @@ void mt7615_mcu_fill_msg(struct mt7615_dev *dev, stru= ct sk_buff *skb, mcu_txd->s2d_index =3D MCU_S2D_H2N; mcu_txd->pkt_type =3D MCU_PKT_ID; mcu_txd->seq =3D seq; + mcu_txd->cid =3D mcu_cmd; + mcu_txd->ext_cid =3D FIELD_GET(__MCU_CMD_FIELD_EXT_ID, cmd); =20 - switch (cmd & ~MCU_CMD_MASK) { - case MCU_FW_PREFIX: - mcu_txd->set_query =3D MCU_Q_NA; - mcu_txd->cid =3D mcu_cmd; - break; - case MCU_CE_PREFIX: - if (cmd & MCU_QUERY_MASK) + if (mcu_txd->ext_cid || (cmd & MCU_CE_PREFIX)) { + if (cmd & __MCU_CMD_FIELD_QUERY) mcu_txd->set_query =3D MCU_Q_QUERY; else mcu_txd->set_query =3D MCU_Q_SET; - mcu_txd->cid =3D mcu_cmd; - break; - default: - mcu_txd->cid =3D MCU_CMD_EXT_CID; - if (cmd & MCU_QUERY_PREFIX) - mcu_txd->set_query =3D MCU_Q_QUERY; - else - mcu_txd->set_query =3D MCU_Q_SET; - mcu_txd->ext_cid =3D mcu_cmd; - mcu_txd->ext_cid_ack =3D 1; - break; + mcu_txd->ext_cid_ack =3D !!mcu_txd->ext_cid; + } else { + mcu_txd->set_query =3D MCU_Q_NA; } } EXPORT_SYMBOL_GPL(mt7615_mcu_fill_msg); @@ -184,42 +173,32 @@ int mt7615_mcu_parse_response(struct mt76_dev *mdev, = int cmd, if (seq !=3D rxd->seq) return -EAGAIN; =20 - switch (cmd) { - case MCU_CMD_PATCH_SEM_CONTROL: + if (cmd =3D=3D MCU_CMD_PATCH_SEM_CONTROL) { skb_pull(skb, sizeof(*rxd) - 4); ret =3D *skb->data; - break; - case MCU_EXT_CMD_GET_TEMP: + } else if (cmd =3D=3D MCU_EXT_CMD(GET_TEMP)) { skb_pull(skb, sizeof(*rxd)); ret =3D le32_to_cpu(*(__le32 *)skb->data); - break; - case MCU_EXT_CMD_RF_REG_ACCESS | MCU_QUERY_PREFIX: + } else if (cmd =3D=3D MCU_EXT_QUERY(RF_REG_ACCESS)) { skb_pull(skb, sizeof(*rxd)); ret =3D le32_to_cpu(*(__le32 *)&skb->data[8]); - break; - case MCU_UNI_CMD_DEV_INFO_UPDATE: - case MCU_UNI_CMD_BSS_INFO_UPDATE: - case MCU_UNI_CMD_STA_REC_UPDATE: - case MCU_UNI_CMD_HIF_CTRL: - case MCU_UNI_CMD_OFFLOAD: - case MCU_UNI_CMD_SUSPEND: { + } else if (cmd =3D=3D MCU_UNI_CMD_DEV_INFO_UPDATE || + cmd =3D=3D MCU_UNI_CMD_BSS_INFO_UPDATE || + cmd =3D=3D MCU_UNI_CMD_STA_REC_UPDATE || + cmd =3D=3D MCU_UNI_CMD_HIF_CTRL || + cmd =3D=3D MCU_UNI_CMD_OFFLOAD || + cmd =3D=3D MCU_UNI_CMD_SUSPEND) { struct mt7615_mcu_uni_event *event; =20 skb_pull(skb, sizeof(*rxd)); event =3D (struct mt7615_mcu_uni_event *)skb->data; ret =3D le32_to_cpu(event->status); - break; - } - case MCU_CMD_REG_READ: { + } else if (cmd =3D=3D MCU_CMD_REG_READ) { struct mt7615_mcu_reg_event *event; =20 skb_pull(skb, sizeof(*rxd)); event =3D (struct mt7615_mcu_reg_event *)skb->data; ret =3D (int)le32_to_cpu(event->val); - break; - } - default: - break; } =20 return ret; @@ -253,8 +232,7 @@ u32 mt7615_rf_rr(struct mt7615_dev *dev, u32 wf, u32 re= g) .address =3D cpu_to_le32(reg), }; =20 - return mt76_mcu_send_msg(&dev->mt76, - MCU_EXT_CMD_RF_REG_ACCESS | MCU_QUERY_PREFIX, + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_QUERY(RF_REG_ACCESS), &req, sizeof(req), true); } =20 @@ -270,8 +248,8 @@ int mt7615_rf_wr(struct mt7615_dev *dev, u32 wf, u32 re= g, u32 val) .data =3D cpu_to_le32(val), }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_RF_REG_ACCESS, &req, - sizeof(req), false); + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(RF_REG_ACCESS), + &req, sizeof(req), false); } =20 void mt7622_trigger_hif_int(struct mt7615_dev *dev, bool en) @@ -658,8 +636,8 @@ mt7615_mcu_muar_config(struct mt7615_dev *dev, struct i= eee80211_vif *vif, if (enable) ether_addr_copy(req.addr, addr); =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_MUAR_UPDATE, &req, - sizeof(req), true); + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(MUAR_UPDATE), + &req, sizeof(req), true); } =20 static int @@ -702,7 +680,7 @@ mt7615_mcu_add_dev(struct mt7615_phy *phy, struct ieee8= 0211_vif *vif, return mt7615_mcu_muar_config(dev, vif, false, enable); =20 memcpy(data.tlv.omac_addr, vif->addr, ETH_ALEN); - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_DEV_INFO_UPDATE, + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(DEV_INFO_UPDATE), &data, sizeof(data), true); } =20 @@ -771,7 +749,7 @@ mt7615_mcu_add_beacon_offload(struct mt7615_dev *dev, dev_kfree_skb(skb); =20 out: - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_BCN_OFFLOAD, &req, + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(BCN_OFFLOAD), &req, sizeof(req), true); } =20 @@ -802,8 +780,8 @@ mt7615_mcu_ctrl_pm_state(struct mt7615_dev *dev, int ba= nd, int state) .band_idx =3D band, }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_PM_STATE_CTRL, &req, - sizeof(req), true); + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(PM_STATE_CTRL), + &req, sizeof(req), true); } =20 static int @@ -944,7 +922,7 @@ mt7615_mcu_add_bss(struct mt7615_phy *phy, struct ieee8= 0211_vif *vif, mt7615_mcu_bss_ext_tlv(skb, mvif); =20 return mt76_mcu_skb_send_msg(&dev->mt76, skb, - MCU_EXT_CMD_BSS_INFO_UPDATE, true); + MCU_EXT_CMD(BSS_INFO_UPDATE), true); } =20 static int @@ -966,8 +944,8 @@ mt7615_mcu_wtbl_tx_ba(struct mt7615_dev *dev, mt76_connac_mcu_wtbl_ba_tlv(&dev->mt76, skb, params, enable, true, NULL, wtbl_hdr); =20 - err =3D mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_EXT_CMD_WTBL_UPDATE, - true); + err =3D mt76_mcu_skb_send_msg(&dev->mt76, skb, + MCU_EXT_CMD(WTBL_UPDATE), true); if (err < 0) return err; =20 @@ -979,7 +957,7 @@ mt7615_mcu_wtbl_tx_ba(struct mt7615_dev *dev, mt76_connac_mcu_sta_ba_tlv(skb, params, enable, true); =20 return mt76_mcu_skb_send_msg(&dev->mt76, skb, - MCU_EXT_CMD_STA_REC_UPDATE, true); + MCU_EXT_CMD(STA_REC_UPDATE), true); } =20 static int @@ -1001,7 +979,7 @@ mt7615_mcu_wtbl_rx_ba(struct mt7615_dev *dev, mt76_connac_mcu_sta_ba_tlv(skb, params, enable, false); =20 err =3D mt76_mcu_skb_send_msg(&dev->mt76, skb, - MCU_EXT_CMD_STA_REC_UPDATE, true); + MCU_EXT_CMD(STA_REC_UPDATE), true); if (err < 0 || !enable) return err; =20 @@ -1014,8 +992,8 @@ mt7615_mcu_wtbl_rx_ba(struct mt7615_dev *dev, mt76_connac_mcu_wtbl_ba_tlv(&dev->mt76, skb, params, enable, false, NULL, wtbl_hdr); =20 - return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_EXT_CMD_WTBL_UPDATE, - true); + return mt76_mcu_skb_send_msg(&dev->mt76, skb, + MCU_EXT_CMD(WTBL_UPDATE), true); } =20 static int @@ -1057,7 +1035,7 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struc= t ieee80211_vif *vif, NULL, wtbl_hdr); } =20 - cmd =3D enable ? MCU_EXT_CMD_WTBL_UPDATE : MCU_EXT_CMD_STA_REC_UPDATE; + cmd =3D enable ? MCU_EXT_CMD(WTBL_UPDATE) : MCU_EXT_CMD(STA_REC_UPDATE); skb =3D enable ? wskb : sskb; =20 err =3D mt76_mcu_skb_send_msg(&dev->mt76, skb, cmd, true); @@ -1068,7 +1046,7 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struc= t ieee80211_vif *vif, return err; } =20 - cmd =3D enable ? MCU_EXT_CMD_STA_REC_UPDATE : MCU_EXT_CMD_WTBL_UPDATE; + cmd =3D enable ? MCU_EXT_CMD(STA_REC_UPDATE) : MCU_EXT_CMD(WTBL_UPDATE); skb =3D enable ? sskb : wskb; =20 return mt76_mcu_skb_send_msg(&dev->mt76, skb, cmd, true); @@ -1090,8 +1068,8 @@ mt7615_mcu_wtbl_update_hdr_trans(struct mt7615_dev *d= ev, =20 mt76_connac_mcu_wtbl_hdr_trans_tlv(skb, vif, &msta->wcid, NULL, wtbl_hdr); - return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_EXT_CMD_WTBL_UPDATE, - true); + return mt76_mcu_skb_send_msg(&dev->mt76, skb, + MCU_EXT_CMD(WTBL_UPDATE), true); } =20 static const struct mt7615_mcu_ops wtbl_update_ops =3D { @@ -1136,7 +1114,7 @@ mt7615_mcu_sta_ba(struct mt7615_dev *dev, sta_wtbl, wtbl_hdr); =20 return mt76_mcu_skb_send_msg(&dev->mt76, skb, - MCU_EXT_CMD_STA_REC_UPDATE, true); + MCU_EXT_CMD(STA_REC_UPDATE), true); } =20 static int @@ -1179,7 +1157,7 @@ mt7615_mcu_add_sta(struct mt7615_phy *phy, struct iee= e80211_vif *vif, struct ieee80211_sta *sta, bool enable) { return __mt7615_mcu_add_sta(phy->mt76, vif, sta, enable, - MCU_EXT_CMD_STA_REC_UPDATE, false); + MCU_EXT_CMD(STA_REC_UPDATE), false); } =20 static int @@ -1191,7 +1169,7 @@ mt7615_mcu_sta_update_hdr_trans(struct mt7615_dev *de= v, =20 return mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->wcid, - MCU_EXT_CMD_STA_REC_UPDATE); + MCU_EXT_CMD(STA_REC_UPDATE)); } =20 static const struct mt7615_mcu_ops sta_update_ops =3D { @@ -1694,8 +1672,8 @@ int mt7615_mcu_fw_log_2_host(struct mt7615_dev *dev, = u8 ctrl) .ctrl_val =3D ctrl }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_FW_LOG_2_HOST, &data, - sizeof(data), true); + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(FW_LOG_2_HOST), + &data, sizeof(data), true); } =20 static int mt7615_mcu_cal_cache_apply(struct mt7615_dev *dev) @@ -1707,7 +1685,7 @@ static int mt7615_mcu_cal_cache_apply(struct mt7615_d= ev *dev) .cache_enable =3D true }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_CAL_CACHE, &data, + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(CAL_CACHE), &data, sizeof(data), false); } =20 @@ -1977,7 +1955,7 @@ int mt7615_mcu_set_eeprom(struct mt7615_dev *dev) skb_put_data(skb, eep + offset, eep_len); =20 return mt76_mcu_skb_send_msg(&dev->mt76, skb, - MCU_EXT_CMD_EFUSE_BUFFER_MODE, true); + MCU_EXT_CMD(EFUSE_BUFFER_MODE), true); } =20 int mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 queue, @@ -2013,8 +1991,8 @@ int mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 que= ue, if (params->cw_max) req.cw_max =3D cpu_to_le16(fls(params->cw_max)); =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EDCA_UPDATE, &req, - sizeof(req), true); + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(EDCA_UPDATE), + &req, sizeof(req), true); } =20 int mt7615_mcu_set_dbdc(struct mt7615_dev *dev) @@ -2072,7 +2050,7 @@ int mt7615_mcu_set_dbdc(struct mt7615_dev *dev) ADD_DBDC_ENTRY(DBDC_TYPE_MGMT, 1, 1); =20 out: - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_DBDC_CTRL, &req, + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(DBDC_CTRL), &req, sizeof(req), true); } =20 @@ -2082,8 +2060,8 @@ int mt7615_mcu_del_wtbl_all(struct mt7615_dev *dev) .operation =3D WTBL_RESET_ALL, }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_WTBL_UPDATE, &req, - sizeof(req), true); + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(WTBL_UPDATE), + &req, sizeof(req), true); } =20 int mt7615_mcu_rdd_cmd(struct mt7615_dev *dev, @@ -2103,8 +2081,8 @@ int mt7615_mcu_rdd_cmd(struct mt7615_dev *dev, .val =3D val, }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_SET_RDD_CTRL, &req, - sizeof(req), true); + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RDD_CTRL), + &req, sizeof(req), true); } =20 int mt7615_mcu_set_fcc5_lpn(struct mt7615_dev *dev, int val) @@ -2117,7 +2095,7 @@ int mt7615_mcu_set_fcc5_lpn(struct mt7615_dev *dev, i= nt val) .min_lpn =3D cpu_to_le16(val), }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_SET_RDD_TH, &req, + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RDD_TH), &req, sizeof(req), true); } =20 @@ -2146,7 +2124,7 @@ int mt7615_mcu_set_pulse_th(struct mt7615_dev *dev, #undef __req_field }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_SET_RDD_TH, &req, + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RDD_TH), &req, sizeof(req), true); } =20 @@ -2193,7 +2171,7 @@ int mt7615_mcu_set_radar_th(struct mt7615_dev *dev, i= nt index, #undef __req_field_u32 }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_SET_RDD_TH, &req, + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RDD_TH), &req, sizeof(req), true); } =20 @@ -2225,7 +2203,7 @@ int mt7615_mcu_rdd_send_pattern(struct mt7615_dev *de= v) req.pattern[i].start_time =3D cpu_to_le32(ts); } =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_SET_RDD_PATTERN, + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RDD_PATTERN), &req, sizeof(req), false); } =20 @@ -2394,8 +2372,8 @@ int mt7615_mcu_get_temperature(struct mt7615_dev *dev) u8 rsv[3]; } req =3D {}; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_GET_TEMP, &req, - sizeof(req), true); + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(GET_TEMP), + &req, sizeof(req), true); } =20 int mt7615_mcu_set_test_param(struct mt7615_dev *dev, u8 param, bool test_= mode, @@ -2415,8 +2393,8 @@ int mt7615_mcu_set_test_param(struct mt7615_dev *dev,= u8 param, bool test_mode, .value =3D cpu_to_le32(val), }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_ATE_CTRL, &req, - sizeof(req), false); + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(ATE_CTRL), + &req, sizeof(req), false); } =20 int mt7615_mcu_set_sku_en(struct mt7615_phy *phy, bool enable) @@ -2434,8 +2412,8 @@ int mt7615_mcu_set_sku_en(struct mt7615_phy *phy, boo= l enable) }; =20 return mt76_mcu_send_msg(&dev->mt76, - MCU_EXT_CMD_TX_POWER_FEATURE_CTRL, &req, - sizeof(req), true); + MCU_EXT_CMD(TX_POWER_FEATURE_CTRL), + &req, sizeof(req), true); } =20 static int mt7615_find_freq_idx(const u16 *freqs, int n_freqs, u16 cur) @@ -2574,7 +2552,7 @@ again: =20 out: req.center_freq =3D cpu_to_le16(center_freq); - ret =3D mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_RXDCOC_CAL, &req, + ret =3D mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(RXDCOC_CAL), &req, sizeof(req), true); =20 if ((chandef->width =3D=3D NL80211_CHAN_WIDTH_80P80 || @@ -2695,8 +2673,8 @@ again: =20 out: req.center_freq =3D cpu_to_le16(center_freq); - ret =3D mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_TXDPD_CAL, &req, - sizeof(req), true); + ret =3D mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(TXDPD_CAL), + &req, sizeof(req), true); =20 if ((chandef->width =3D=3D NL80211_CHAN_WIDTH_80P80 || chandef->width =3D=3D NL80211_CHAN_WIDTH_160) && !req.is_freq2) { @@ -2724,7 +2702,7 @@ int mt7615_mcu_set_rx_hdr_trans_blacklist(struct mt76= 15_dev *dev) .etype =3D cpu_to_le16(ETH_P_PAE), }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_RX_HDR_TRANS, + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(RX_HDR_TRANS), &req, sizeof(req), false); } =20 diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/testmode.c b/drivers= /net/wireless/mediatek/mt76/mt7615/testmode.c index 59d99264f5e5f..e5544f4e69797 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/testmode.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/testmode.c @@ -91,7 +91,7 @@ mt7615_tm_set_tx_power(struct mt7615_phy *phy) } =20 return mt76_mcu_skb_send_msg(&dev->mt76, skb, - MCU_EXT_CMD_SET_TX_POWER_CTRL, false); + MCU_EXT_CMD(SET_TX_POWER_CTRL), false); } =20 static void @@ -229,7 +229,7 @@ mt7615_tm_set_tx_frames(struct mt7615_phy *phy, bool en) struct ieee80211_tx_info *info; struct sk_buff *skb =3D phy->mt76->test.tx_skb; =20 - mt7615_mcu_set_chan_info(phy, MCU_EXT_CMD_SET_RX_PATH); + mt7615_mcu_set_chan_info(phy, MCU_EXT_CMD(SET_RX_PATH)); mt7615_tm_set_tx_antenna(phy, en); mt7615_tm_set_rx_enable(dev, !en); if (!en || !skb) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers= /net/wireless/mediatek/mt76/mt76_connac_mcu.c index b15bbd650a90c..f603c6fab583a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -176,7 +176,7 @@ int mt76_connac_mcu_set_mac_enable(struct mt76_dev *dev= , int band, bool enable, .band =3D band, }; =20 - return mt76_mcu_send_msg(dev, MCU_EXT_CMD_MAC_INIT_CTRL, &req_mac, + return mt76_mcu_send_msg(dev, MCU_EXT_CMD(MAC_INIT_CTRL), &req_mac, sizeof(req_mac), true); } EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_mac_enable); @@ -218,7 +218,7 @@ int mt76_connac_mcu_set_rts_thresh(struct mt76_dev *dev= , u32 val, u8 band) .pkt_thresh =3D cpu_to_le32(0x2), }; =20 - return mt76_mcu_send_msg(dev, MCU_EXT_CMD_PROTECT_CTRL, &req, + return mt76_mcu_send_msg(dev, MCU_EXT_CMD(PROTECT_CTRL), &req, sizeof(req), true); } EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_rts_thresh); diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers= /net/wireless/mediatek/mt76/mt76_connac_mcu.h index 4e2c9dafd7765..1c7a99bc26261 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -499,11 +499,19 @@ enum { #define MCU_FW_PREFIX BIT(31) #define MCU_UNI_PREFIX BIT(30) #define MCU_CE_PREFIX BIT(29) -#define MCU_QUERY_PREFIX BIT(28) #define MCU_CMD_MASK ~(MCU_FW_PREFIX | MCU_UNI_PREFIX | \ - MCU_CE_PREFIX | MCU_QUERY_PREFIX) + MCU_CE_PREFIX) =20 -#define MCU_QUERY_MASK BIT(16) +#define __MCU_CMD_FIELD_ID GENMASK(7, 0) +#define __MCU_CMD_FIELD_EXT_ID GENMASK(15, 8) +#define __MCU_CMD_FIELD_QUERY BIT(16) + +#define MCU_CMD(_t) FIELD_PREP(__MCU_CMD_FIELD_ID, \ + MCU_CMD_##_t) +#define MCU_EXT_CMD(_t) (MCU_CMD(EXT_CID) | \ + FIELD_PREP(__MCU_CMD_FIELD_EXT_ID, \ + MCU_EXT_CMD_##_t)) +#define MCU_EXT_QUERY(_t) (MCU_EXT_CMD(_t) | __MCU_CMD_FIELD_QUERY) =20 enum { MCU_EXT_CMD_EFUSE_ACCESS =3D 0x01, @@ -575,7 +583,7 @@ enum { MCU_CMD_GET_NIC_CAPAB =3D MCU_CE_PREFIX | 0x8a, MCU_CMD_SET_MU_EDCA_PARMS =3D MCU_CE_PREFIX | 0xb0, MCU_CMD_REG_WRITE =3D MCU_CE_PREFIX | 0xc0, - MCU_CMD_REG_READ =3D MCU_CE_PREFIX | MCU_QUERY_MASK | 0xc0, + MCU_CMD_REG_READ =3D MCU_CE_PREFIX | __MCU_CMD_FIELD_QUERY | 0xc0, MCU_CMD_CHIP_CONFIG =3D MCU_CE_PREFIX | 0xca, MCU_CMD_FWLOG_2_HOST =3D MCU_CE_PREFIX | 0xc5, MCU_CMD_GET_WTBL =3D MCU_CE_PREFIX | 0xcd, diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net= /wireless/mediatek/mt76/mt7921/main.c index 21e745fddc9c3..e7c9cb66a3543 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -221,7 +221,7 @@ int __mt7921_start(struct mt7921_phy *phy) if (err) return err; =20 - err =3D mt7921_mcu_set_chan_info(phy, MCU_EXT_CMD_SET_RX_PATH); + err =3D mt7921_mcu_set_chan_info(phy, MCU_EXT_CMD(SET_RX_PATH)); if (err) return err; =20 @@ -363,7 +363,7 @@ static int mt7921_set_channel(struct mt7921_phy *phy) =20 mt76_set_channel(phy->mt76); =20 - ret =3D mt7921_mcu_set_chan_info(phy, MCU_EXT_CMD_CHANNEL_SWITCH); + ret =3D mt7921_mcu_set_chan_info(phy, MCU_EXT_CMD(CHANNEL_SWITCH)); if (ret) goto out; =20 diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7921/mcu.c index 6ada1ebe7d68b..50f0c13f1c41e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -179,24 +179,20 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, = int cmd, if (seq !=3D rxd->seq) return -EAGAIN; =20 - switch (cmd) { - case MCU_CMD_PATCH_SEM_CONTROL: + if (cmd =3D=3D MCU_CMD_PATCH_SEM_CONTROL) { skb_pull(skb, sizeof(*rxd) - 4); ret =3D *skb->data; - break; - case MCU_EXT_CMD_GET_TEMP: + } else if (cmd =3D=3D MCU_EXT_CMD(GET_TEMP)) { skb_pull(skb, sizeof(*rxd) + 4); ret =3D le32_to_cpu(*(__le32 *)skb->data); - break; - case MCU_EXT_CMD_EFUSE_ACCESS: + } else if (cmd =3D=3D MCU_EXT_CMD(EFUSE_ACCESS)) { ret =3D mt7921_mcu_parse_eeprom(mdev, skb); - break; - case MCU_UNI_CMD_DEV_INFO_UPDATE: - case MCU_UNI_CMD_BSS_INFO_UPDATE: - case MCU_UNI_CMD_STA_REC_UPDATE: - case MCU_UNI_CMD_HIF_CTRL: - case MCU_UNI_CMD_OFFLOAD: - case MCU_UNI_CMD_SUSPEND: { + } else if (cmd =3D=3D MCU_UNI_CMD_DEV_INFO_UPDATE || + cmd =3D=3D MCU_UNI_CMD_BSS_INFO_UPDATE || + cmd =3D=3D MCU_UNI_CMD_STA_REC_UPDATE || + cmd =3D=3D MCU_UNI_CMD_HIF_CTRL || + cmd =3D=3D MCU_UNI_CMD_OFFLOAD || + cmd =3D=3D MCU_UNI_CMD_SUSPEND) { struct mt7921_mcu_uni_event *event; =20 skb_pull(skb, sizeof(*rxd)); @@ -205,19 +201,14 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, = int cmd, /* skip invalid event */ if (mcu_cmd !=3D event->cid) ret =3D -EAGAIN; - break; - } - case MCU_CMD_REG_READ: { + } else if (cmd =3D=3D MCU_CMD_REG_READ) { struct mt7921_mcu_reg_event *event; =20 skb_pull(skb, sizeof(*rxd)); event =3D (struct mt7921_mcu_reg_event *)skb->data; ret =3D (int)le32_to_cpu(event->val); - break; - } - default: + } else { skb_pull(skb, sizeof(struct mt7921_mcu_rxd)); - break; } =20 return ret; @@ -228,7 +219,7 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, stru= ct sk_buff *skb, int cmd, int *wait_seq) { struct mt7921_dev *dev =3D container_of(mdev, struct mt7921_dev, mt76); - int txd_len, mcu_cmd =3D cmd & MCU_CMD_MASK; + int txd_len, mcu_cmd =3D FIELD_GET(__MCU_CMD_FIELD_ID, cmd); struct mt7921_uni_txd *uni_txd; struct mt7921_mcu_txd *mcu_txd; __le32 *txd; @@ -283,34 +274,20 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, st= ruct sk_buff *skb, MT_TX_MCU_PORT_RX_Q0)); mcu_txd->pkt_type =3D MCU_PKT_ID; mcu_txd->seq =3D seq; + mcu_txd->cid =3D mcu_cmd; + mcu_txd->s2d_index =3D MCU_S2D_H2N; + mcu_txd->ext_cid =3D FIELD_GET(__MCU_CMD_FIELD_EXT_ID, cmd); =20 - switch (cmd & ~MCU_CMD_MASK) { - case MCU_FW_PREFIX: - mcu_txd->set_query =3D MCU_Q_NA; - mcu_txd->cid =3D mcu_cmd; - break; - case MCU_CE_PREFIX: - if (cmd & MCU_QUERY_MASK) - mcu_txd->set_query =3D MCU_Q_QUERY; - else - mcu_txd->set_query =3D MCU_Q_SET; - mcu_txd->cid =3D mcu_cmd; - break; - default: - mcu_txd->cid =3D MCU_CMD_EXT_CID; - if (cmd & MCU_QUERY_PREFIX || cmd =3D=3D MCU_EXT_CMD_EFUSE_ACCESS) + if (mcu_txd->ext_cid || (cmd & MCU_CE_PREFIX)) { + if (cmd & __MCU_CMD_FIELD_QUERY) mcu_txd->set_query =3D MCU_Q_QUERY; else mcu_txd->set_query =3D MCU_Q_SET; - mcu_txd->ext_cid =3D mcu_cmd; - mcu_txd->ext_cid_ack =3D 1; - break; + mcu_txd->ext_cid_ack =3D !!mcu_txd->ext_cid; + } else { + mcu_txd->set_query =3D MCU_Q_NA; } =20 - mcu_txd->s2d_index =3D MCU_S2D_H2N; - WARN_ON(cmd =3D=3D MCU_EXT_CMD_EFUSE_ACCESS && - mcu_txd->set_query !=3D MCU_Q_QUERY); - exit: if (wait_seq) *wait_seq =3D seq; @@ -997,8 +974,8 @@ int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ie= ee80211_vif *vif) e->cw_max =3D cpu_to_le16(10); } =20 - ret =3D mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EDCA_UPDATE, &req, - sizeof(req), true); + ret =3D mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(EDCA_UPDATE), + &req, sizeof(req), true); if (ret) return ret; =20 @@ -1070,7 +1047,7 @@ int mt7921_mcu_set_chan_info(struct mt7921_phy *phy, = int cmd) else req.switch_reason =3D CH_SWITCH_NORMAL; =20 - if (cmd =3D=3D MCU_EXT_CMD_CHANNEL_SWITCH) + if (cmd =3D=3D MCU_EXT_CMD(CHANNEL_SWITCH)) req.rx_streams =3D hweight8(req.rx_streams); =20 if (chandef->width =3D=3D NL80211_CHAN_WIDTH_80P80) { @@ -1093,7 +1070,7 @@ int mt7921_mcu_set_eeprom(struct mt7921_dev *dev) .format =3D EE_FORMAT_WHOLE, }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EFUSE_BUFFER_MODE, + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(EFUSE_BUFFER_MODE), &req, sizeof(req), true); } EXPORT_SYMBOL_GPL(mt7921_mcu_set_eeprom); @@ -1108,8 +1085,9 @@ int mt7921_mcu_get_eeprom(struct mt7921_dev *dev, u32= offset) int ret; u8 *buf; =20 - ret =3D mt76_mcu_send_and_get_msg(&dev->mt76, MCU_EXT_CMD_EFUSE_ACCESS, &= req, - sizeof(req), true, &skb); + ret =3D mt76_mcu_send_and_get_msg(&dev->mt76, + MCU_EXT_QUERY(EFUSE_ACCESS), + &req, sizeof(req), true, &skb); if (ret) return ret; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3177BC4167B for ; Mon, 24 Jan 2022 21:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457969AbiAXVmi (ORCPT ); Mon, 24 Jan 2022 16:42:38 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:32966 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376690AbiAXVI6 (ORCPT ); Mon, 24 Jan 2022 16:08:58 -0500 Received: from smtp.kernel.org (relay.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 7CC29611C8; Mon, 24 Jan 2022 21:08:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B7A8C340E5; Mon, 24 Jan 2022 21:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058534; bh=U34xLw7vLnMhPRMLE74VQLXUltGjNNpQh3KyPaDdGas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EzJxtWuo27T+EZ7/viY6Ar9I30cr9zYw454CLRTuVQDuRgznNcKMOMd3RSkDti/9q f2K0ukNLp999jMnMsCKnbOgrJkkTbkkyrSPwXdr3CQ7c3gjdTKU4y+YXkKY/p+xDUd VH9oNbK7/l2ea/YY8GViZXU+7qLZl9MWpthpjFWo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0320/1039] mt76: connac: align MCU_EXT definitions with 7915 driver Date: Mon, 24 Jan 2022 19:35:09 +0100 Message-Id: <20220124184136.051857288@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit 9d8d136cf0b6d5578442f38ea9eefdf67cc84fc4 ] Align MCU_EXT and MCU_FW definitions between mt76_connac and mt7915 driver. This is a preliminary patch to reuse mt76_connac in mt7915 driver. Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 16 ++++++------- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 24 +++++++++++++++++-- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 2 +- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7615/mcu.c index 397a8bb67ffbf..2232afed72912 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -176,7 +176,7 @@ int mt7615_mcu_parse_response(struct mt76_dev *mdev, in= t cmd, if (cmd =3D=3D MCU_CMD_PATCH_SEM_CONTROL) { skb_pull(skb, sizeof(*rxd) - 4); ret =3D *skb->data; - } else if (cmd =3D=3D MCU_EXT_CMD(GET_TEMP)) { + } else if (cmd =3D=3D MCU_EXT_CMD(THERMAL_CTRL)) { skb_pull(skb, sizeof(*rxd)); ret =3D le32_to_cpu(*(__le32 *)skb->data); } else if (cmd =3D=3D MCU_EXT_QUERY(RF_REG_ACCESS)) { @@ -2095,8 +2095,8 @@ int mt7615_mcu_set_fcc5_lpn(struct mt7615_dev *dev, i= nt val) .min_lpn =3D cpu_to_le16(val), }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RDD_TH), &req, - sizeof(req), true); + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RADAR_TH), + &req, sizeof(req), true); } =20 int mt7615_mcu_set_pulse_th(struct mt7615_dev *dev, @@ -2124,8 +2124,8 @@ int mt7615_mcu_set_pulse_th(struct mt7615_dev *dev, #undef __req_field }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RDD_TH), &req, - sizeof(req), true); + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RADAR_TH), + &req, sizeof(req), true); } =20 int mt7615_mcu_set_radar_th(struct mt7615_dev *dev, int index, @@ -2171,8 +2171,8 @@ int mt7615_mcu_set_radar_th(struct mt7615_dev *dev, i= nt index, #undef __req_field_u32 }; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RDD_TH), &req, - sizeof(req), true); + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RADAR_TH), + &req, sizeof(req), true); } =20 int mt7615_mcu_rdd_send_pattern(struct mt7615_dev *dev) @@ -2372,7 +2372,7 @@ int mt7615_mcu_get_temperature(struct mt7615_dev *dev) u8 rsv[3]; } req =3D {}; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(GET_TEMP), + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_CTRL), &req, sizeof(req), true); } =20 diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers= /net/wireless/mediatek/mt76/mt76_connac_mcu.h index 1c7a99bc26261..9dbb6ae9f21da 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -516,17 +516,21 @@ enum { enum { MCU_EXT_CMD_EFUSE_ACCESS =3D 0x01, MCU_EXT_CMD_RF_REG_ACCESS =3D 0x02, + MCU_EXT_CMD_RF_TEST =3D 0x04, MCU_EXT_CMD_PM_STATE_CTRL =3D 0x07, MCU_EXT_CMD_CHANNEL_SWITCH =3D 0x08, MCU_EXT_CMD_SET_TX_POWER_CTRL =3D 0x11, MCU_EXT_CMD_FW_LOG_2_HOST =3D 0x13, + MCU_EXT_CMD_TXBF_ACTION =3D 0x1e, MCU_EXT_CMD_EFUSE_BUFFER_MODE =3D 0x21, + MCU_EXT_CMD_THERMAL_PROT =3D 0x23, MCU_EXT_CMD_STA_REC_UPDATE =3D 0x25, MCU_EXT_CMD_BSS_INFO_UPDATE =3D 0x26, MCU_EXT_CMD_EDCA_UPDATE =3D 0x27, MCU_EXT_CMD_DEV_INFO_UPDATE =3D 0x2A, - MCU_EXT_CMD_GET_TEMP =3D 0x2c, + MCU_EXT_CMD_THERMAL_CTRL =3D 0x2c, MCU_EXT_CMD_WTBL_UPDATE =3D 0x32, + MCU_EXT_CMD_SET_DRR_CTRL =3D 0x36, MCU_EXT_CMD_SET_RDD_CTRL =3D 0x3a, MCU_EXT_CMD_ATE_CTRL =3D 0x3d, MCU_EXT_CMD_PROTECT_CTRL =3D 0x3e, @@ -535,13 +539,28 @@ enum { MCU_EXT_CMD_RX_HDR_TRANS =3D 0x47, MCU_EXT_CMD_MUAR_UPDATE =3D 0x48, MCU_EXT_CMD_BCN_OFFLOAD =3D 0x49, + MCU_EXT_CMD_RX_AIRTIME_CTRL =3D 0x4a, MCU_EXT_CMD_SET_RX_PATH =3D 0x4e, + MCU_EXT_CMD_EFUSE_FREE_BLOCK =3D 0x4f, MCU_EXT_CMD_TX_POWER_FEATURE_CTRL =3D 0x58, MCU_EXT_CMD_RXDCOC_CAL =3D 0x59, + MCU_EXT_CMD_GET_MIB_INFO =3D 0x5a, MCU_EXT_CMD_TXDPD_CAL =3D 0x60, MCU_EXT_CMD_CAL_CACHE =3D 0x67, - MCU_EXT_CMD_SET_RDD_TH =3D 0x7c, + MCU_EXT_CMD_SET_RADAR_TH =3D 0x7c, MCU_EXT_CMD_SET_RDD_PATTERN =3D 0x7d, + MCU_EXT_CMD_MWDS_SUPPORT =3D 0x80, + MCU_EXT_CMD_SET_SER_TRIGGER =3D 0x81, + MCU_EXT_CMD_SCS_CTRL =3D 0x82, + MCU_EXT_CMD_TWT_AGRT_UPDATE =3D 0x94, + MCU_EXT_CMD_FW_DBG_CTRL =3D 0x95, + MCU_EXT_CMD_OFFCH_SCAN_CTRL =3D 0x9a, + MCU_EXT_CMD_SET_RDD_TH =3D 0x9d, + MCU_EXT_CMD_MURU_CTRL =3D 0x9f, + MCU_EXT_CMD_SET_SPR =3D 0xa8, + MCU_EXT_CMD_GROUP_PRE_CAL_INFO =3D 0xab, + MCU_EXT_CMD_DPD_PRE_CAL_INFO =3D 0xac, + MCU_EXT_CMD_PHY_STAT_INFO =3D 0xad, }; =20 enum { @@ -561,6 +580,7 @@ enum { MCU_CMD_PATCH_START_REQ =3D MCU_FW_PREFIX | 0x05, MCU_CMD_PATCH_FINISH_REQ =3D MCU_FW_PREFIX | 0x07, MCU_CMD_PATCH_SEM_CONTROL =3D MCU_FW_PREFIX | 0x10, + MCU_CMD_WA_PARAM =3D 0xc4, MCU_CMD_EXT_CID =3D 0xed, MCU_CMD_FW_SCATTER =3D MCU_FW_PREFIX | 0xee, MCU_CMD_RESTART_DL_REQ =3D MCU_FW_PREFIX | 0xef, diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7921/mcu.c index 50f0c13f1c41e..51650e9e1845a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -182,7 +182,7 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, in= t cmd, if (cmd =3D=3D MCU_CMD_PATCH_SEM_CONTROL) { skb_pull(skb, sizeof(*rxd) - 4); ret =3D *skb->data; - } else if (cmd =3D=3D MCU_EXT_CMD(GET_TEMP)) { + } else if (cmd =3D=3D MCU_EXT_CMD(THERMAL_CTRL)) { skb_pull(skb, sizeof(*rxd) + 4); ret =3D le32_to_cpu(*(__le32 *)skb->data); } else if (cmd =3D=3D MCU_EXT_CMD(EFUSE_ACCESS)) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CA8DC4332F for ; Mon, 24 Jan 2022 21:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457984AbiAXVmk (ORCPT ); Mon, 24 Jan 2022 16:42:40 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:32998 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446653AbiAXVI7 (ORCPT ); Mon, 24 Jan 2022 16:08:59 -0500 Received: from smtp.kernel.org (relay.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 8A11C61469; Mon, 24 Jan 2022 21:08:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 645FBC340E7; Mon, 24 Jan 2022 21:08:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058538; bh=uQrGCGdoQ9qxoCu/WNLQXqQtn31mcFA9j1l2DQzKAps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o9Gz0LJdhpUTgV6PGbPuLXM1K3WBCluAHJ2lpTr9swKgF0bTpYXoA4ZCYq63QFok2 dwBA8qXtpxtyIYGZJiqa4atT5d5lzBQhamVMVMwcQRZbo+9RVSGKo62HgpHiv47576 CrX3E0thVWcX6dQtsQap/sK6DSNr8bJtE4uMFvkc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0321/1039] mt76: connac: remove MCU_FW_PREFIX bit Date: Mon, 24 Jan 2022 19:35:10 +0100 Message-Id: <20220124184136.091870192@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit 7159eb828d21ad8fb3c1c1782a286a658ba6bf66 ] Get rid of MCU_FW_PREFIX bit since it is no longer used Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers= /net/wireless/mediatek/mt76/mt76_connac_mcu.h index 9dbb6ae9f21da..b3cd6ca815278 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -496,11 +496,9 @@ enum { #define MCU_CMD_UNI_EXT_ACK (MCU_CMD_ACK | MCU_CMD_UNI | \ MCU_CMD_QUERY) =20 -#define MCU_FW_PREFIX BIT(31) #define MCU_UNI_PREFIX BIT(30) #define MCU_CE_PREFIX BIT(29) -#define MCU_CMD_MASK ~(MCU_FW_PREFIX | MCU_UNI_PREFIX | \ - MCU_CE_PREFIX) +#define MCU_CMD_MASK ~(MCU_UNI_PREFIX | MCU_CE_PREFIX) =20 #define __MCU_CMD_FIELD_ID GENMASK(7, 0) #define __MCU_CMD_FIELD_EXT_ID GENMASK(15, 8) @@ -573,17 +571,17 @@ enum { }; =20 enum { - MCU_CMD_TARGET_ADDRESS_LEN_REQ =3D MCU_FW_PREFIX | 0x01, - MCU_CMD_FW_START_REQ =3D MCU_FW_PREFIX | 0x02, + MCU_CMD_TARGET_ADDRESS_LEN_REQ =3D 0x01, + MCU_CMD_FW_START_REQ =3D 0x02, MCU_CMD_INIT_ACCESS_REG =3D 0x3, - MCU_CMD_NIC_POWER_CTRL =3D MCU_FW_PREFIX | 0x4, - MCU_CMD_PATCH_START_REQ =3D MCU_FW_PREFIX | 0x05, - MCU_CMD_PATCH_FINISH_REQ =3D MCU_FW_PREFIX | 0x07, - MCU_CMD_PATCH_SEM_CONTROL =3D MCU_FW_PREFIX | 0x10, + MCU_CMD_NIC_POWER_CTRL =3D 0x4, + MCU_CMD_PATCH_START_REQ =3D 0x05, + MCU_CMD_PATCH_FINISH_REQ =3D 0x07, + MCU_CMD_PATCH_SEM_CONTROL =3D 0x10, MCU_CMD_WA_PARAM =3D 0xc4, MCU_CMD_EXT_CID =3D 0xed, - MCU_CMD_FW_SCATTER =3D MCU_FW_PREFIX | 0xee, - MCU_CMD_RESTART_DL_REQ =3D MCU_FW_PREFIX | 0xef, + MCU_CMD_FW_SCATTER =3D 0xee, + MCU_CMD_RESTART_DL_REQ =3D 0xef, }; =20 /* offload mcu commands */ --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 949FCC4332F for ; Mon, 24 Jan 2022 21:46:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1458012AbiAXVmm (ORCPT ); Mon, 24 Jan 2022 16:42:42 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60440 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356318AbiAXVJE (ORCPT ); Mon, 24 Jan 2022 16:09:04 -0500 Received: from smtp.kernel.org (relay.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 5B002B81188; Mon, 24 Jan 2022 21:09:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CF85C340E5; Mon, 24 Jan 2022 21:09:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058541; bh=cAu+sl2eBg6gdowEPhXePwRqosKPNDPFudiZnY87b8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WTyws1JwchORkfNDdXA+RW+KiJ+RT1Alw7VBrFsanqlcW5Tm230ICGMuYQifAK8J6 hu29JstGDkIZFftG5IANq95AFYKiskamGupxFc1SKGONa0HnEjdtYEm5RQtxyb6SkW QpgFiKf/CdTYAWePOGblbSr08bfEUzIur32cFE68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0322/1039] mt76: connac: introduce MCU_UNI_CMD macro Date: Mon, 24 Jan 2022 19:35:11 +0100 Message-Id: <20220124184136.123251460@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit 5472240245793c13e9986c61dd34c697296deed4 ] Similar to MCU_EXT_CMD, introduce MCU_UNI_CMD for unified commands Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 26 +++++------ .../wireless/mediatek/mt76/mt76_connac_mcu.c | 44 ++++++++++--------- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 19 ++++---- .../net/wireless/mediatek/mt76/mt7921/main.c | 2 +- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 36 +++++++-------- 5 files changed, 64 insertions(+), 63 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7615/mcu.c index 2232afed72912..fcbcfc9f5a04f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -103,7 +103,7 @@ void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct= sk_buff *skb, if (wait_seq) *wait_seq =3D seq; =20 - txd_len =3D cmd & MCU_UNI_PREFIX ? sizeof(*uni_txd) : sizeof(*mcu_txd); + txd_len =3D cmd & __MCU_CMD_FIELD_UNI ? sizeof(*uni_txd) : sizeof(*mcu_tx= d); txd =3D (__le32 *)skb_push(skb, txd_len); =20 if (cmd !=3D MCU_CMD_FW_SCATTER) { @@ -124,7 +124,7 @@ void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct= sk_buff *skb, FIELD_PREP(MT_TXD1_PKT_FMT, pkt_fmt); txd[1] =3D cpu_to_le32(val); =20 - if (cmd & MCU_UNI_PREFIX) { + if (cmd & __MCU_CMD_FIELD_UNI) { uni_txd =3D (struct mt7615_uni_txd *)txd; uni_txd->len =3D cpu_to_le16(skb->len - sizeof(uni_txd->txd)); uni_txd->option =3D MCU_CMD_UNI_EXT_ACK; @@ -182,12 +182,12 @@ int mt7615_mcu_parse_response(struct mt76_dev *mdev, = int cmd, } else if (cmd =3D=3D MCU_EXT_QUERY(RF_REG_ACCESS)) { skb_pull(skb, sizeof(*rxd)); ret =3D le32_to_cpu(*(__le32 *)&skb->data[8]); - } else if (cmd =3D=3D MCU_UNI_CMD_DEV_INFO_UPDATE || - cmd =3D=3D MCU_UNI_CMD_BSS_INFO_UPDATE || - cmd =3D=3D MCU_UNI_CMD_STA_REC_UPDATE || - cmd =3D=3D MCU_UNI_CMD_HIF_CTRL || - cmd =3D=3D MCU_UNI_CMD_OFFLOAD || - cmd =3D=3D MCU_UNI_CMD_SUSPEND) { + } else if (cmd =3D=3D MCU_UNI_CMD(DEV_INFO_UPDATE) || + cmd =3D=3D MCU_UNI_CMD(BSS_INFO_UPDATE) || + cmd =3D=3D MCU_UNI_CMD(STA_REC_UPDATE) || + cmd =3D=3D MCU_UNI_CMD(HIF_CTRL) || + cmd =3D=3D MCU_UNI_CMD(OFFLOAD) || + cmd =3D=3D MCU_UNI_CMD(SUSPEND)) { struct mt7615_mcu_uni_event *event; =20 skb_pull(skb, sizeof(*rxd)); @@ -1263,7 +1263,7 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *= dev, dev_kfree_skb(skb); =20 out: - return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD_BSS_INFO_UPDATE, + return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD(BSS_INFO_UPDATE), &req, sizeof(req), true); } =20 @@ -1292,7 +1292,7 @@ mt7615_mcu_uni_add_sta(struct mt7615_phy *phy, struct= ieee80211_vif *vif, struct ieee80211_sta *sta, bool enable) { return __mt7615_mcu_add_sta(phy->mt76, vif, sta, enable, - MCU_UNI_CMD_STA_REC_UPDATE, true); + MCU_UNI_CMD(STA_REC_UPDATE), true); } =20 static int @@ -1326,7 +1326,7 @@ mt7615_mcu_uni_rx_ba(struct mt7615_dev *dev, mt76_connac_mcu_sta_ba_tlv(skb, params, enable, false); =20 err =3D mt76_mcu_skb_send_msg(&dev->mt76, skb, - MCU_UNI_CMD_STA_REC_UPDATE, true); + MCU_UNI_CMD(STA_REC_UPDATE), true); if (err < 0 || !enable) return err; =20 @@ -1347,7 +1347,7 @@ mt7615_mcu_uni_rx_ba(struct mt7615_dev *dev, sta_wtbl, wtbl_hdr); =20 return mt76_mcu_skb_send_msg(&dev->mt76, skb, - MCU_UNI_CMD_STA_REC_UPDATE, true); + MCU_UNI_CMD(STA_REC_UPDATE), true); } =20 static int @@ -1359,7 +1359,7 @@ mt7615_mcu_sta_uni_update_hdr_trans(struct mt7615_dev= *dev, =20 return mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->wcid, - MCU_UNI_CMD_STA_REC_UPDATE); + MCU_UNI_CMD(STA_REC_UPDATE)); } =20 static const struct mt7615_mcu_ops uni_update_ops =3D { diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers= /net/wireless/mediatek/mt76/mt76_connac_mcu.c index f603c6fab583a..a5857a788da50 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1071,7 +1071,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, =20 memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN); =20 - cmd =3D enable ? MCU_UNI_CMD_DEV_INFO_UPDATE : MCU_UNI_CMD_BSS_INFO_UPDAT= E; + cmd =3D enable ? MCU_UNI_CMD(DEV_INFO_UPDATE) : MCU_UNI_CMD(BSS_INFO_UPDA= TE); data =3D enable ? (void *)&dev_req : (void *)&basic_req; len =3D enable ? sizeof(dev_req) : sizeof(basic_req); =20 @@ -1079,7 +1079,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, if (err < 0) return err; =20 - cmd =3D enable ? MCU_UNI_CMD_BSS_INFO_UPDATE : MCU_UNI_CMD_DEV_INFO_UPDAT= E; + cmd =3D enable ? MCU_UNI_CMD(BSS_INFO_UPDATE) : MCU_UNI_CMD(DEV_INFO_UPDA= TE); data =3D enable ? (void *)&basic_req : (void *)&dev_req; len =3D enable ? sizeof(basic_req) : sizeof(dev_req); =20 @@ -1131,7 +1131,8 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, stru= ct mt76_vif *mvif, mt76_connac_mcu_wtbl_ba_tlv(dev, skb, params, enable, tx, sta_wtbl, wtbl_hdr); =20 - ret =3D mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD_STA_REC_UPDATE, true); + ret =3D mt76_mcu_skb_send_msg(dev, skb, + MCU_UNI_CMD(STA_REC_UPDATE), true); if (ret) return ret; =20 @@ -1141,8 +1142,8 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, stru= ct mt76_vif *mvif, =20 mt76_connac_mcu_sta_ba_tlv(skb, params, enable, tx); =20 - return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD_STA_REC_UPDATE, - true); + return mt76_mcu_skb_send_msg(dev, skb, + MCU_UNI_CMD(STA_REC_UPDATE), true); } EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_ba); =20 @@ -1352,7 +1353,7 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy, basic_req.basic.sta_idx =3D cpu_to_le16(wcid->idx); basic_req.basic.conn_state =3D !enable; =20 - err =3D mt76_mcu_send_msg(mdev, MCU_UNI_CMD_BSS_INFO_UPDATE, &basic_req, + err =3D mt76_mcu_send_msg(mdev, MCU_UNI_CMD(BSS_INFO_UPDATE), &basic_req, sizeof(basic_req), true); if (err < 0) return err; @@ -1390,7 +1391,7 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy, =20 mt76_connac_mcu_uni_bss_he_tlv(phy, vif, (struct tlv *)&he_req.he); - err =3D mt76_mcu_send_msg(mdev, MCU_UNI_CMD_BSS_INFO_UPDATE, + err =3D mt76_mcu_send_msg(mdev, MCU_UNI_CMD(BSS_INFO_UPDATE), &he_req, sizeof(he_req), true); if (err < 0) return err; @@ -1428,7 +1429,7 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy, else if (rlm_req.rlm.control_channel > rlm_req.rlm.center_chan) rlm_req.rlm.sco =3D 3; /* SCB */ =20 - return mt76_mcu_send_msg(mdev, MCU_UNI_CMD_BSS_INFO_UPDATE, &rlm_req, + return mt76_mcu_send_msg(mdev, MCU_UNI_CMD(BSS_INFO_UPDATE), &rlm_req, sizeof(rlm_req), true); } EXPORT_SYMBOL_GPL(mt76_connac_mcu_uni_add_bss); @@ -2143,7 +2144,7 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev= *dev, memcpy(addr, &info->arp_addr_list[i], sizeof(__be32)); } =20 - return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD_OFFLOAD, true); + return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD(OFFLOAD), true); } EXPORT_SYMBOL_GPL(mt76_connac_mcu_update_arp_filter); =20 @@ -2249,7 +2250,8 @@ int mt76_connac_mcu_update_gtk_rekey(struct ieee80211= _hw *hw, memcpy(gtk_tlv->kck, key->kck, NL80211_KCK_LEN); memcpy(gtk_tlv->replay_ctr, key->replay_ctr, NL80211_REPLAY_CTR_LEN); =20 - return mt76_mcu_skb_send_msg(phy->dev, skb, MCU_UNI_CMD_OFFLOAD, true); + return mt76_mcu_skb_send_msg(phy->dev, skb, + MCU_UNI_CMD(OFFLOAD), true); } EXPORT_SYMBOL_GPL(mt76_connac_mcu_update_gtk_rekey); =20 @@ -2275,8 +2277,8 @@ mt76_connac_mcu_set_arp_filter(struct mt76_dev *dev, = struct ieee80211_vif *vif, }, }; =20 - return mt76_mcu_send_msg(dev, MCU_UNI_CMD_OFFLOAD, &req, sizeof(req), - true); + return mt76_mcu_send_msg(dev, MCU_UNI_CMD(OFFLOAD), &req, + sizeof(req), true); } =20 static int @@ -2301,8 +2303,8 @@ mt76_connac_mcu_set_gtk_rekey(struct mt76_dev *dev, s= truct ieee80211_vif *vif, }, }; =20 - return mt76_mcu_send_msg(dev, MCU_UNI_CMD_OFFLOAD, &req, sizeof(req), - true); + return mt76_mcu_send_msg(dev, MCU_UNI_CMD(OFFLOAD), &req, + sizeof(req), true); } =20 static int @@ -2331,8 +2333,8 @@ mt76_connac_mcu_set_suspend_mode(struct mt76_dev *dev, }, }; =20 - return mt76_mcu_send_msg(dev, MCU_UNI_CMD_SUSPEND, &req, sizeof(req), - true); + return mt76_mcu_send_msg(dev, MCU_UNI_CMD(SUSPEND), &req, + sizeof(req), true); } =20 static int @@ -2366,7 +2368,7 @@ mt76_connac_mcu_set_wow_pattern(struct mt76_dev *dev, memcpy(ptlv->pattern, pattern->pattern, pattern->pattern_len); memcpy(ptlv->mask, pattern->mask, DIV_ROUND_UP(pattern->pattern_len, 8)); =20 - return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD_SUSPEND, true); + return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD(SUSPEND), true); } =20 static int @@ -2418,8 +2420,8 @@ mt76_connac_mcu_set_wow_ctrl(struct mt76_phy *phy, st= ruct ieee80211_vif *vif, else if (mt76_is_sdio(dev)) req.wow_ctrl_tlv.wakeup_hif =3D WOW_GPIO; =20 - return mt76_mcu_send_msg(dev, MCU_UNI_CMD_SUSPEND, &req, sizeof(req), - true); + return mt76_mcu_send_msg(dev, MCU_UNI_CMD(SUSPEND), &req, + sizeof(req), true); } =20 int mt76_connac_mcu_set_hif_suspend(struct mt76_dev *dev, bool suspend) @@ -2452,8 +2454,8 @@ int mt76_connac_mcu_set_hif_suspend(struct mt76_dev *= dev, bool suspend) else if (mt76_is_sdio(dev)) req.hdr.hif_type =3D 0; =20 - return mt76_mcu_send_msg(dev, MCU_UNI_CMD_HIF_CTRL, &req, sizeof(req), - true); + return mt76_mcu_send_msg(dev, MCU_UNI_CMD(HIF_CTRL), &req, + sizeof(req), true); } EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_hif_suspend); =20 diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers= /net/wireless/mediatek/mt76/mt76_connac_mcu.h index b3cd6ca815278..5c5fab9154e59 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -496,13 +496,13 @@ enum { #define MCU_CMD_UNI_EXT_ACK (MCU_CMD_ACK | MCU_CMD_UNI | \ MCU_CMD_QUERY) =20 -#define MCU_UNI_PREFIX BIT(30) #define MCU_CE_PREFIX BIT(29) -#define MCU_CMD_MASK ~(MCU_UNI_PREFIX | MCU_CE_PREFIX) +#define MCU_CMD_MASK ~(MCU_CE_PREFIX) =20 #define __MCU_CMD_FIELD_ID GENMASK(7, 0) #define __MCU_CMD_FIELD_EXT_ID GENMASK(15, 8) #define __MCU_CMD_FIELD_QUERY BIT(16) +#define __MCU_CMD_FIELD_UNI BIT(17) =20 #define MCU_CMD(_t) FIELD_PREP(__MCU_CMD_FIELD_ID, \ MCU_CMD_##_t) @@ -510,6 +510,9 @@ enum { FIELD_PREP(__MCU_CMD_FIELD_EXT_ID, \ MCU_EXT_CMD_##_t)) #define MCU_EXT_QUERY(_t) (MCU_EXT_CMD(_t) | __MCU_CMD_FIELD_QUERY) +#define MCU_UNI_CMD(_t) (__MCU_CMD_FIELD_UNI | \ + FIELD_PREP(__MCU_CMD_FIELD_ID, \ + MCU_UNI_CMD_##_t)) =20 enum { MCU_EXT_CMD_EFUSE_ACCESS =3D 0x01, @@ -562,12 +565,12 @@ enum { }; =20 enum { - MCU_UNI_CMD_DEV_INFO_UPDATE =3D MCU_UNI_PREFIX | 0x01, - MCU_UNI_CMD_BSS_INFO_UPDATE =3D MCU_UNI_PREFIX | 0x02, - MCU_UNI_CMD_STA_REC_UPDATE =3D MCU_UNI_PREFIX | 0x03, - MCU_UNI_CMD_SUSPEND =3D MCU_UNI_PREFIX | 0x05, - MCU_UNI_CMD_OFFLOAD =3D MCU_UNI_PREFIX | 0x06, - MCU_UNI_CMD_HIF_CTRL =3D MCU_UNI_PREFIX | 0x07, + MCU_UNI_CMD_DEV_INFO_UPDATE =3D 0x01, + MCU_UNI_CMD_BSS_INFO_UPDATE =3D 0x02, + MCU_UNI_CMD_STA_REC_UPDATE =3D 0x03, + MCU_UNI_CMD_SUSPEND =3D 0x05, + MCU_UNI_CMD_OFFLOAD =3D 0x06, + MCU_UNI_CMD_HIF_CTRL =3D 0x07, }; =20 enum { diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net= /wireless/mediatek/mt76/mt7921/main.c index e7c9cb66a3543..8c55562c1a8d9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -1316,7 +1316,7 @@ static void mt7921_sta_set_decap_offload(struct ieee8= 0211_hw *hw, clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); =20 mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->wcid, - MCU_UNI_CMD_STA_REC_UPDATE); + MCU_UNI_CMD(STA_REC_UPDATE)); } =20 static int mt7921_set_sar_specs(struct ieee80211_hw *hw, diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7921/mcu.c index 51650e9e1845a..e741db152c0d2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -187,12 +187,12 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, = int cmd, ret =3D le32_to_cpu(*(__le32 *)skb->data); } else if (cmd =3D=3D MCU_EXT_CMD(EFUSE_ACCESS)) { ret =3D mt7921_mcu_parse_eeprom(mdev, skb); - } else if (cmd =3D=3D MCU_UNI_CMD_DEV_INFO_UPDATE || - cmd =3D=3D MCU_UNI_CMD_BSS_INFO_UPDATE || - cmd =3D=3D MCU_UNI_CMD_STA_REC_UPDATE || - cmd =3D=3D MCU_UNI_CMD_HIF_CTRL || - cmd =3D=3D MCU_UNI_CMD_OFFLOAD || - cmd =3D=3D MCU_UNI_CMD_SUSPEND) { + } else if (cmd =3D=3D MCU_UNI_CMD(DEV_INFO_UPDATE) || + cmd =3D=3D MCU_UNI_CMD(BSS_INFO_UPDATE) || + cmd =3D=3D MCU_UNI_CMD(STA_REC_UPDATE) || + cmd =3D=3D MCU_UNI_CMD(HIF_CTRL) || + cmd =3D=3D MCU_UNI_CMD(OFFLOAD) || + cmd =3D=3D MCU_UNI_CMD(SUSPEND)) { struct mt7921_mcu_uni_event *event; =20 skb_pull(skb, sizeof(*rxd)); @@ -226,16 +226,12 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, st= ruct sk_buff *skb, u32 val; u8 seq; =20 - switch (cmd) { - case MCU_UNI_CMD_HIF_CTRL: - case MCU_UNI_CMD_SUSPEND: - case MCU_UNI_CMD_OFFLOAD: + if (cmd =3D=3D MCU_UNI_CMD(HIF_CTRL) || + cmd =3D=3D MCU_UNI_CMD(SUSPEND) || + cmd =3D=3D MCU_UNI_CMD(OFFLOAD)) mdev->mcu.timeout =3D HZ / 3; - break; - default: + else mdev->mcu.timeout =3D 3 * HZ; - break; - } =20 seq =3D ++dev->mt76.mcu.msg_seq & 0xf; if (!seq) @@ -244,7 +240,7 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, stru= ct sk_buff *skb, if (cmd =3D=3D MCU_CMD_FW_SCATTER) goto exit; =20 - txd_len =3D cmd & MCU_UNI_PREFIX ? sizeof(*uni_txd) : sizeof(*mcu_txd); + txd_len =3D cmd & __MCU_CMD_FIELD_UNI ? sizeof(*uni_txd) : sizeof(*mcu_tx= d); txd =3D (__le32 *)skb_push(skb, txd_len); =20 val =3D FIELD_PREP(MT_TXD0_TX_BYTES, skb->len) | @@ -256,7 +252,7 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, stru= ct sk_buff *skb, FIELD_PREP(MT_TXD1_HDR_FORMAT, MT_HDR_FORMAT_CMD); txd[1] =3D cpu_to_le32(val); =20 - if (cmd & MCU_UNI_PREFIX) { + if (cmd & __MCU_CMD_FIELD_UNI) { uni_txd =3D (struct mt7921_uni_txd *)txd; uni_txd->len =3D cpu_to_le16(skb->len - sizeof(uni_txd->txd)); uni_txd->option =3D MCU_CMD_UNI_EXT_ACK; @@ -544,7 +540,7 @@ int mt7921_mcu_add_key(struct mt7921_dev *dev, struct i= eee80211_vif *vif, return ret; =20 return mt76_mcu_skb_send_msg(&dev->mt76, skb, - MCU_UNI_CMD_STA_REC_UPDATE, true); + MCU_UNI_CMD(STA_REC_UPDATE), true); } =20 int mt7921_mcu_uni_tx_ba(struct mt7921_dev *dev, @@ -1132,7 +1128,7 @@ int mt7921_mcu_uni_bss_ps(struct mt7921_dev *dev, str= uct ieee80211_vif *vif) if (vif->type !=3D NL80211_IFTYPE_STATION) return -EOPNOTSUPP; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD_BSS_INFO_UPDATE, + return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD(BSS_INFO_UPDATE), &ps_req, sizeof(ps_req), true); } =20 @@ -1168,7 +1164,7 @@ mt7921_mcu_uni_bss_bcnft(struct mt7921_dev *dev, stru= ct ieee80211_vif *vif, if (vif->type !=3D NL80211_IFTYPE_STATION) return 0; =20 - return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD_BSS_INFO_UPDATE, + return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD(BSS_INFO_UPDATE), &bcnft_req, sizeof(bcnft_req), true); } =20 @@ -1223,7 +1219,7 @@ int mt7921_mcu_sta_update(struct mt7921_dev *dev, str= uct ieee80211_sta *sta, .sta =3D sta, .vif =3D vif, .enable =3D enable, - .cmd =3D MCU_UNI_CMD_STA_REC_UPDATE, + .cmd =3D MCU_UNI_CMD(STA_REC_UPDATE), .state =3D state, .offload_fw =3D true, .rcpi =3D to_rcpi(rssi), --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C841C46467 for ; Mon, 24 Jan 2022 23:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366245AbiAXXwd (ORCPT ); Mon, 24 Jan 2022 18:52:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1575156AbiAXWyB (ORCPT ); Mon, 24 Jan 2022 17:54:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FF8BC0F0540; Mon, 24 Jan 2022 13:09:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 B1F3E6149E; Mon, 24 Jan 2022 21:09:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F02CC340E7; Mon, 24 Jan 2022 21:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058544; bh=yxmUWDxo0QK6+OQVC9KcXWy/LiQA2z+wdDrXTXeVaZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jx3bIqXYBVb1NvHjQbCUgFOej9/mRxRpK6huBv2rljg64M2ZARo8biNkNbGumRkHQ Ytqxu+dUeSipWu5OlPGyEeZoudQOWJJyd1rsZ+toU5cK6/xcWxwDGFRxHle0dnFeON WFNAjGeXUFGol/RAmxkUaNKswCmz9NPKOn4Iu08w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0323/1039] mt76: mt7921s: fix suspend error with enlarging mcu timeout value Date: Mon, 24 Jan 2022 19:35:12 +0100 Message-Id: <20220124184136.154834917@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wang [ Upstream commit 1bb42a354d8ca2888c7c2fcbf0add410176a33dc ] Fix the false positive suspend error that may occur on mt7921s with enlarging mcu timeout value. The reason why we have to enlarge mcu timeout from HZ / 3 to HZ is we should consider the additional overhead caused by running concurrently with btmtksdio (a MT7921 bluetooth SDIO driver) that would compete for the same SDIO bus in process context to complete the suspend procedure. Fixes: 48fab5bbef40 ("mt76: mt7921: introduce mt7921s support") Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7921/mcu.c index e741db152c0d2..1cc1c32ca258e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -229,7 +229,7 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, stru= ct sk_buff *skb, if (cmd =3D=3D MCU_UNI_CMD(HIF_CTRL) || cmd =3D=3D MCU_UNI_CMD(SUSPEND) || cmd =3D=3D MCU_UNI_CMD(OFFLOAD)) - mdev->mcu.timeout =3D HZ / 3; + mdev->mcu.timeout =3D HZ; else mdev->mcu.timeout =3D 3 * HZ; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D70EC433EF for ; Mon, 24 Jan 2022 21:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573627AbiAXVpZ (ORCPT ); Mon, 24 Jan 2022 16:45:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60508 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446680AbiAXVJP (ORCPT ); Mon, 24 Jan 2022 16:09:15 -0500 Received: from smtp.kernel.org (relay.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 58639B8121C; Mon, 24 Jan 2022 21:09:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87833C340E5; Mon, 24 Jan 2022 21:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058547; bh=51eI2EFraOmrDDmkbCFXQ04zdEEOQk0+6ysjBoTS5iI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O2nyTiGp7wG1cJAaQcd7T2p7Op12WS2lVicnogAqIWwbPkpVKbyb9CJQeAR87Fwg0 EbTG6UeO77MQQCrLp2NKukxMpj9nHXgXy1dSj8iGzKemrrdNYhvwIx+fCd/IbYzHB6 pGrjJez3HUYWQyu4b2wOgzDP6YgwQzDBMQrFEFVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Claudiu Beznea , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0324/1039] wilc1000: fix double free error in probe() Date: Mon, 24 Jan 2022 19:35:13 +0100 Message-Id: <20220124184136.186749730@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 4894edacfa93d7046bec4fc61fc402ac6a2ac9e8 ] Smatch complains that there is a double free in probe: drivers/net/wireless/microchip/wilc1000/spi.c:186 wilc_bus_probe() error: d= ouble free of 'spi_priv' drivers/net/wireless/microchip/wilc1000/sdio.c:163 wilc_sdio_probe() error:= double free of 'sdio_priv' The problem is that wilc_netdev_cleanup() function frees "wilc->bus_data". That's confusing and a layering violation. Leave the frees in probe(), delete the free in wilc_netdev_cleanup(), and add some new frees to the remove() functions. Fixes: dc8b338f3bcd ("wilc1000: use goto labels on error path") Signed-off-by: Dan Carpenter Reviewed-by: Claudiu Beznea Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211217150311.GC16611@kili Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/microchip/wilc1000/netdev.c | 1 - drivers/net/wireless/microchip/wilc1000/sdio.c | 2 ++ drivers/net/wireless/microchip/wilc1000/spi.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net= /wireless/microchip/wilc1000/netdev.c index 690572e01a2a7..b5fe2a7cd8dcc 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.c +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c @@ -905,7 +905,6 @@ void wilc_netdev_cleanup(struct wilc *wilc) =20 wilc_wlan_cfg_deinit(wilc); wlan_deinit_locks(wilc); - kfree(wilc->bus_data); wiphy_unregister(wilc->wiphy); wiphy_free(wilc->wiphy); } diff --git a/drivers/net/wireless/microchip/wilc1000/sdio.c b/drivers/net/w= ireless/microchip/wilc1000/sdio.c index 26ebf66643425..ec595dbd89592 100644 --- a/drivers/net/wireless/microchip/wilc1000/sdio.c +++ b/drivers/net/wireless/microchip/wilc1000/sdio.c @@ -167,9 +167,11 @@ free: static void wilc_sdio_remove(struct sdio_func *func) { struct wilc *wilc =3D sdio_get_drvdata(func); + struct wilc_sdio *sdio_priv =3D wilc->bus_data; =20 clk_disable_unprepare(wilc->rtc_clk); wilc_netdev_cleanup(wilc); + kfree(sdio_priv); } =20 static int wilc_sdio_reset(struct wilc *wilc) diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c b/drivers/net/wi= reless/microchip/wilc1000/spi.c index 640850f989dd9..d8e893f4dab4f 100644 --- a/drivers/net/wireless/microchip/wilc1000/spi.c +++ b/drivers/net/wireless/microchip/wilc1000/spi.c @@ -190,9 +190,11 @@ free: static int wilc_bus_remove(struct spi_device *spi) { struct wilc *wilc =3D spi_get_drvdata(spi); + struct wilc_spi *spi_priv =3D wilc->bus_data; =20 clk_disable_unprepare(wilc->rtc_clk); wilc_netdev_cleanup(wilc); + kfree(spi_priv); =20 return 0; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEA72C35270 for ; Mon, 24 Jan 2022 21:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1572957AbiAXVmw (ORCPT ); Mon, 24 Jan 2022 16:42:52 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33206 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446705AbiAXVJP (ORCPT ); Mon, 24 Jan 2022 16:09:15 -0500 Received: from smtp.kernel.org (relay.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 D166260C60; Mon, 24 Jan 2022 21:09:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B21BDC340E5; Mon, 24 Jan 2022 21:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058550; bh=dkmUFr49CybcD04y+WFJD6jn5JBcCH1bqnANrKf9inE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RCpZ5CfA0Fke7t0Ks5OITq5h2IGaabkXH1MfPuSUtj5RlBjwxu+yqRJSMM08bKDzi 4vBwDqecNSDnxChvTByt23/hH48CTV61rgh9RS6LZmSeCfcxQfsGZAtZpB5WZIO2er nImewV3xTNUfoGn/iFPukHaE6nJRav4EwktHOV3U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, rtl8821cerfe2 , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0325/1039] rtw88: add quirk to disable pci caps on HP 250 G7 Notebook PC Date: Mon, 24 Jan 2022 19:35:14 +0100 Message-Id: <20220124184136.231934879@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ping-Ke Shih [ Upstream commit c81edb8dddaa36c4defa26240cc19127f147283f ] 8821CE causes random freezes on HP 250 G7 Notebook PC. Add a quirk to disable pci ASPM capability. Reported-by: rtl8821cerfe2 Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211119052437.8671-1-pkshih@realtek.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/realtek/rtw88/pci.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireles= s/realtek/rtw88/pci.c index a7a6ebfaa203c..3b367c9085eba 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.c +++ b/drivers/net/wireless/realtek/rtw88/pci.c @@ -1738,6 +1738,15 @@ static const struct dmi_system_id rtw88_pci_quirks[]= =3D { }, .driver_data =3D (void *)BIT(QUIRK_DIS_PCI_CAP_ASPM), }, + { + .callback =3D disable_pci_caps, + .ident =3D "HP HP 250 G7 Notebook PC", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP 250 G7 Notebook PC"), + }, + .driver_data =3D (void *)BIT(QUIRK_DIS_PCI_CAP_ASPM), + }, {} }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37D67C43217 for ; Mon, 24 Jan 2022 21:46:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1572912AbiAXVmv (ORCPT ); Mon, 24 Jan 2022 16:42:51 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33242 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446702AbiAXVJQ (ORCPT ); Mon, 24 Jan 2022 16:09:16 -0500 Received: from smtp.kernel.org (relay.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 D42EA6147D; Mon, 24 Jan 2022 21:09:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9564C340E5; Mon, 24 Jan 2022 21:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058553; bh=JRhg2ihMM98ffXlxRr3jbRB4CO+4DG9nSjwHNStzLd8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2g2fEjaDOfmoAvKNYfyuk8oB4tN/Zw03Cnhvu3wUqeu8EvLclT6H7Z5yu9NSwZDe7 KgBMz8+H2R6P+OCkgluCg7mDLD6ZJi3LLFVL9jrFmh82poaamYFnqKWyZeecQwoJDr MWnDi64pbG/Hj23R0dGERPRCZezISDRuC+FWFuGg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai-Heng Feng , Jian-Hong Pan , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0326/1039] rtw88: Disable PCIe ASPM while doing NAPI poll on 8821CE Date: Mon, 24 Jan 2022 19:35:15 +0100 Message-Id: <20220124184136.265278530@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 24f5e38a13b5ae2b6105cda8bb47c19108e62a9a ] Many Intel based platforms face system random freeze after commit 9e2fd29864c5 ("rtw88: add napi support"). The commit itself shouldn't be the culprit. My guess is that the 8821CE only leaves ASPM L1 for a short period when IRQ is raised. Since IRQ is masked during NAPI polling, the PCIe link stays at L1 and makes RX DMA extremely slow. Eventually the RX ring becomes messed up: [ 1133.194697] rtw_8821ce 0000:02:00.0: pci bus timeout, check dma status Since the 8821CE hardware may fail to leave ASPM L1, manually do it in the driver to resolve the issue. Fixes: 9e2fd29864c5 ("rtw88: add napi support") Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=3D215131 BugLink: https://bugs.launchpad.net/bugs/1927808 Signed-off-by: Kai-Heng Feng Acked-by: Jian-Hong Pan Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211215114635.333767-1-kai.heng.feng@canon= ical.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/realtek/rtw88/pci.c | 70 +++++++----------------- drivers/net/wireless/realtek/rtw88/pci.h | 2 + 2 files changed, 21 insertions(+), 51 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireles= s/realtek/rtw88/pci.c index 3b367c9085eba..08cf66141889b 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.c +++ b/drivers/net/wireless/realtek/rtw88/pci.c @@ -2,7 +2,6 @@ /* Copyright(c) 2018-2019 Realtek Corporation */ =20 -#include #include #include #include "main.h" @@ -1409,7 +1408,11 @@ static void rtw_pci_link_ps(struct rtw_dev *rtwdev, = bool enter) * throughput. This is probably because the ASPM behavior slightly * varies from different SOC. */ - if (rtwpci->link_ctrl & PCI_EXP_LNKCTL_ASPM_L1) + if (!(rtwpci->link_ctrl & PCI_EXP_LNKCTL_ASPM_L1)) + return; + + if ((enter && atomic_dec_if_positive(&rtwpci->link_usage) =3D=3D 0) || + (!enter && atomic_inc_return(&rtwpci->link_usage) =3D=3D 1)) rtw_pci_aspm_set(rtwdev, enter); } =20 @@ -1658,6 +1661,9 @@ static int rtw_pci_napi_poll(struct napi_struct *napi= , int budget) priv); int work_done =3D 0; =20 + if (rtwpci->rx_no_aspm) + rtw_pci_link_ps(rtwdev, false); + while (work_done < budget) { u32 work_done_once; =20 @@ -1681,6 +1687,8 @@ static int rtw_pci_napi_poll(struct napi_struct *napi= , int budget) if (rtw_pci_get_hw_rx_ring_nr(rtwdev, rtwpci)) napi_schedule(napi); } + if (rtwpci->rx_no_aspm) + rtw_pci_link_ps(rtwdev, true); =20 return work_done; } @@ -1702,59 +1710,13 @@ static void rtw_pci_napi_deinit(struct rtw_dev *rtw= dev) netif_napi_del(&rtwpci->napi); } =20 -enum rtw88_quirk_dis_pci_caps { - QUIRK_DIS_PCI_CAP_MSI, - QUIRK_DIS_PCI_CAP_ASPM, -}; - -static int disable_pci_caps(const struct dmi_system_id *dmi) -{ - uintptr_t dis_caps =3D (uintptr_t)dmi->driver_data; - - if (dis_caps & BIT(QUIRK_DIS_PCI_CAP_MSI)) - rtw_disable_msi =3D true; - if (dis_caps & BIT(QUIRK_DIS_PCI_CAP_ASPM)) - rtw_pci_disable_aspm =3D true; - - return 1; -} - -static const struct dmi_system_id rtw88_pci_quirks[] =3D { - { - .callback =3D disable_pci_caps, - .ident =3D "Protempo Ltd L116HTN6SPW", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "Protempo Ltd"), - DMI_MATCH(DMI_PRODUCT_NAME, "L116HTN6SPW"), - }, - .driver_data =3D (void *)BIT(QUIRK_DIS_PCI_CAP_ASPM), - }, - { - .callback =3D disable_pci_caps, - .ident =3D "HP HP Pavilion Laptop 14-ce0xxx", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "HP"), - DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Laptop 14-ce0xxx"), - }, - .driver_data =3D (void *)BIT(QUIRK_DIS_PCI_CAP_ASPM), - }, - { - .callback =3D disable_pci_caps, - .ident =3D "HP HP 250 G7 Notebook PC", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "HP"), - DMI_MATCH(DMI_PRODUCT_NAME, "HP 250 G7 Notebook PC"), - }, - .driver_data =3D (void *)BIT(QUIRK_DIS_PCI_CAP_ASPM), - }, - {} -}; - int rtw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + struct pci_dev *bridge =3D pci_upstream_bridge(pdev); struct ieee80211_hw *hw; struct rtw_dev *rtwdev; + struct rtw_pci *rtwpci; int drv_data_size; int ret; =20 @@ -1772,6 +1734,9 @@ int rtw_pci_probe(struct pci_dev *pdev, rtwdev->hci.ops =3D &rtw_pci_ops; rtwdev->hci.type =3D RTW_HCI_TYPE_PCIE; =20 + rtwpci =3D (struct rtw_pci *)rtwdev->priv; + atomic_set(&rtwpci->link_usage, 1); + ret =3D rtw_core_init(rtwdev); if (ret) goto err_release_hw; @@ -1800,7 +1765,10 @@ int rtw_pci_probe(struct pci_dev *pdev, goto err_destroy_pci; } =20 - dmi_check_system(rtw88_pci_quirks); + /* Disable PCIe ASPM L1 while doing NAPI poll for 8821CE */ + if (pdev->device =3D=3D 0xc821 && bridge->vendor =3D=3D PCI_VENDOR_ID_INT= EL) + rtwpci->rx_no_aspm =3D true; + rtw_pci_phy_cfg(rtwdev); =20 ret =3D rtw_register_hw(rtwdev, hw); diff --git a/drivers/net/wireless/realtek/rtw88/pci.h b/drivers/net/wireles= s/realtek/rtw88/pci.h index 66f78eb7757c5..0c37efd8c66fa 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.h +++ b/drivers/net/wireless/realtek/rtw88/pci.h @@ -223,6 +223,8 @@ struct rtw_pci { struct rtw_pci_tx_ring tx_rings[RTK_MAX_TX_QUEUE_NUM]; struct rtw_pci_rx_ring rx_rings[RTK_MAX_RX_QUEUE_NUM]; u16 link_ctrl; + atomic_t link_usage; + bool rx_no_aspm; DECLARE_BITMAP(flags, NUM_OF_RTW_PCI_FLAGS); =20 void __iomem *mmap; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1394C3525A for ; Mon, 24 Jan 2022 23:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386727AbiAXXrs (ORCPT ); Mon, 24 Jan 2022 18:47:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588803AbiAXWyE (ORCPT ); Mon, 24 Jan 2022 17:54:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B109C061376; Mon, 24 Jan 2022 13:09:20 -0800 (PST) Received: from smtp.kernel.org (relay.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 1A0EA61451; Mon, 24 Jan 2022 21:09:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1AC6C340E5; Mon, 24 Jan 2022 21:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058559; bh=mw8A8z07fUPafRY6C9qNunWFoYBwuQGlnoVSJVMu5hM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C2y6uNR2ICRFIJrZNKmYmqkNvksAfV/AyPgsFBsQYfAkfKmgR/FWPRR3WCbg6l19m 4RSK0bN1h6mmB1FlDIgaJ+I3KcT/PNB3pRoLVmSOyLram2J9G7rmpoLfb3reL90pNT CEUVPyXI1OtDwDeDhF7xNxy4c9XzwkuME4GfWWUw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0327/1039] iwlwifi: mvm: fix 32-bit build in FTM Date: Mon, 24 Jan 2022 19:35:16 +0100 Message-Id: <20220124184136.296776668@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit 8b0f92549f2c2458200935c12a2e2a6e80234cf5 ] On a 32-bit build, the division here needs to be done using do_div(), otherwise the compiler will try to call a function that doesn't exist, thus failing to build. Fixes: b68bd2e3143a ("iwlwifi: mvm: Add FTM initiator RTT smoothing logic") Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211219111352.e56cbf614a4d.Ib98004= ccd2c7a55fd883a8ea7eebd810f406dec6@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drive= rs/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c index 949fb790f8fb7..3e6c13fc74eb0 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c @@ -1066,7 +1066,8 @@ static void iwl_mvm_ftm_rtt_smoothing(struct iwl_mvm = *mvm, overshoot =3D IWL_MVM_FTM_INITIATOR_SMOOTH_OVERSHOOT; alpha =3D IWL_MVM_FTM_INITIATOR_SMOOTH_ALPHA; =20 - rtt_avg =3D (alpha * rtt + (100 - alpha) * resp->rtt_avg) / 100; + rtt_avg =3D alpha * rtt + (100 - alpha) * resp->rtt_avg; + do_div(rtt_avg, 100); =20 IWL_DEBUG_INFO(mvm, "%pM: prev rtt_avg=3D%lld, new rtt_avg=3D%lld, rtt=3D%lld\n", --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB9E1C43219 for ; Mon, 24 Jan 2022 21:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1458118AbiAXVmq (ORCPT ); Mon, 24 Jan 2022 16:42:46 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60620 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446800AbiAXVJ3 (ORCPT ); Mon, 24 Jan 2022 16:09:29 -0500 Received: from smtp.kernel.org (relay.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 020D6B8105C; Mon, 24 Jan 2022 21:09:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15E1EC340E5; Mon, 24 Jan 2022 21:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058562; bh=c9RpIW94tVdBjMjoQJSSrE2zBofZpQhOST2oDE4CxCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L/jgYzbxLBByDiByf2kIusMDwW6IDzgZAg+rTt3mbwofZIA4Kn0ggnjElRAnGgRhG VM/DL8nyqfBdDGel8E6xp0mtKKmojnMtj1/YIsnTDm3tuzxKTsN83gqw1Luz9oKYB2 +hk5CQPuZf9gd2g/AnBvU3V3mTblKju9skGHxDBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0328/1039] iwlwifi: dont pass actual WGDS revision number in table_revision Date: Mon, 24 Jan 2022 19:35:17 +0100 Message-Id: <20220124184136.334863728@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luca Coelho [ Upstream commit ac9952f6954216be72a8bde210e1ef2c949d8ee0 ] The FW API for PER_CHAIN_LIMIT_OFFSET_CMD is misleading. The element name is table_rev, but it shouldn't actually contain the table revision number, but whether we should use the South Korea scheme or not. Fix the driver so that we only set this value to either 0 or 1. It will only be 1 (meaning South Korea) if the ACPI WGDS table revision is 1. Signed-off-by: Luca Coelho Fixes: 664c011b763e ("iwlwifi: acpi: support reading and storing WGDS revis= ion 2") Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211219121514.abed3b8119c7.I1fdc2c= 14577523fcffdfe8fb5902c2d8efde7e09@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../net/wireless/intel/iwlwifi/fw/api/power.h | 8 ++++---- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/power.h b/drivers/ne= t/wireless/intel/iwlwifi/fw/api/power.h index 4d671c878bb7a..23e27afe94a23 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/api/power.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/power.h @@ -419,7 +419,7 @@ struct iwl_geo_tx_power_profiles_cmd_v1 { * struct iwl_geo_tx_power_profile_cmd_v2 - struct for PER_CHAIN_LIMIT_OFF= SET_CMD cmd. * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation * @table: offset profile per band. - * @table_revision: BIOS table revision. + * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is = misleading) */ struct iwl_geo_tx_power_profiles_cmd_v2 { __le32 ops; @@ -431,7 +431,7 @@ struct iwl_geo_tx_power_profiles_cmd_v2 { * struct iwl_geo_tx_power_profile_cmd_v3 - struct for PER_CHAIN_LIMIT_OFF= SET_CMD cmd. * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation * @table: offset profile per band. - * @table_revision: BIOS table revision. + * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is = misleading) */ struct iwl_geo_tx_power_profiles_cmd_v3 { __le32 ops; @@ -443,7 +443,7 @@ struct iwl_geo_tx_power_profiles_cmd_v3 { * struct iwl_geo_tx_power_profile_cmd_v4 - struct for PER_CHAIN_LIMIT_OFF= SET_CMD cmd. * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation * @table: offset profile per band. - * @table_revision: BIOS table revision. + * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is = misleading) */ struct iwl_geo_tx_power_profiles_cmd_v4 { __le32 ops; @@ -455,7 +455,7 @@ struct iwl_geo_tx_power_profiles_cmd_v4 { * struct iwl_geo_tx_power_profile_cmd_v5 - struct for PER_CHAIN_LIMIT_OFF= SET_CMD cmd. * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation * @table: offset profile per band. - * @table_revision: BIOS table revision. + * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is = misleading) */ struct iwl_geo_tx_power_profiles_cmd_v5 { __le32 ops; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wire= less/intel/iwlwifi/mvm/fw.c index 863fec150e536..9eb78461f2800 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -820,6 +820,7 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) u16 len; u32 n_bands; u32 n_profiles; + u32 sk =3D 0; int ret; u8 cmd_ver =3D iwl_fw_lookup_cmd_ver(mvm->fw, PHY_OPS_GROUP, PER_CHAIN_LIMIT_OFFSET_CMD, @@ -879,19 +880,26 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) if (ret) return 0; =20 + /* Only set to South Korea if the table revision is 1 */ + if (mvm->fwrt.geo_rev =3D=3D 1) + sk =3D 1; + /* - * Set the revision on versions that contain it. + * Set the table_revision to South Korea (1) or not (0). The + * element name is misleading, as it doesn't contain the table + * revision number, but whether the South Korea variation + * should be used. * This must be done after calling iwl_sar_geo_init(). */ if (cmd_ver =3D=3D 5) - cmd.v5.table_revision =3D cpu_to_le32(mvm->fwrt.geo_rev); + cmd.v5.table_revision =3D cpu_to_le32(sk); else if (cmd_ver =3D=3D 4) - cmd.v4.table_revision =3D cpu_to_le32(mvm->fwrt.geo_rev); + cmd.v4.table_revision =3D cpu_to_le32(sk); else if (cmd_ver =3D=3D 3) - cmd.v3.table_revision =3D cpu_to_le32(mvm->fwrt.geo_rev); + cmd.v3.table_revision =3D cpu_to_le32(sk); else if (fw_has_api(&mvm->fwrt.fw->ucode_capa, IWL_UCODE_TLV_API_SAR_TABLE_VER)) - cmd.v2.table_revision =3D cpu_to_le32(mvm->fwrt.geo_rev); + cmd.v2.table_revision =3D cpu_to_le32(sk); =20 return iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(PHY_OPS_GROUP, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C35BC4707A for ; Mon, 24 Jan 2022 23:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386624AbiAXXri (ORCPT ); Mon, 24 Jan 2022 18:47:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1589221AbiAXWyE (ORCPT ); Mon, 24 Jan 2022 17:54:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA3E3C061A78; Mon, 24 Jan 2022 13:09:26 -0800 (PST) Received: from smtp.kernel.org (relay.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 6A6836146B; Mon, 24 Jan 2022 21:09:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B14FC340E5; Mon, 24 Jan 2022 21:09:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058565; bh=SFpaN1Q+FQLxVudgmI3DnJry1PBPmM+zzf/zOsrDouM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DCyT/Xrgo32ARRs662fIHjjYPnTqMBsJto9NOsC8BGn9aIKRuvx/uiCkx3CkQqG+N i+sweG40o/bz+jgXBW2KT4b4j/QhIEO24GfmlzfE3hPVnlgQfEc2wPAHyvzQ2BD6ci S9a7RnyHa3f1EhIuU6bJ8hddEBoxxbhh50g7xB9I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Errera , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0329/1039] iwlwifi: mvm: test roc running status bits before removing the sta Date: Mon, 24 Jan 2022 19:35:18 +0100 Message-Id: <20220124184136.366304226@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Errera [ Upstream commit 998e1aba6e5eb35370eaf30ccc1823426ec11f90 ] In some cases the sta is being removed twice since we do not test the roc aux running before removing it. Start looking at the bit before removing the sta. Signed-off-by: Nathan Errera Fixes: 2c2c3647cde4 ("iwlwifi: mvm: support ADD_STA_CMD_API_S ver 12") Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211219121514.d5376ac6bcb0.Ic5f847= 0ea60c072bde9d1503e5f528b65e301e20@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../net/wireless/intel/iwlwifi/mvm/time-event.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c b/drivers/= net/wireless/intel/iwlwifi/mvm/time-event.c index e91f8e889df70..f93f15357a3f8 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c @@ -49,14 +49,13 @@ void iwl_mvm_roc_done_wk(struct work_struct *wk) struct iwl_mvm *mvm =3D container_of(wk, struct iwl_mvm, roc_done_wk); =20 /* - * Clear the ROC_RUNNING /ROC_AUX_RUNNING status bit. + * Clear the ROC_RUNNING status bit. * This will cause the TX path to drop offchannel transmissions. * That would also be done by mac80211, but it is racy, in particular * in the case that the time event actually completed in the firmware * (which is handled in iwl_mvm_te_handle_notif). */ clear_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status); - clear_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); =20 synchronize_net(); =20 @@ -82,9 +81,19 @@ void iwl_mvm_roc_done_wk(struct work_struct *wk) mvmvif =3D iwl_mvm_vif_from_mac80211(mvm->p2p_device_vif); iwl_mvm_flush_sta(mvm, &mvmvif->bcast_sta, true); } - } else { + } + + /* + * Clear the ROC_AUX_RUNNING status bit. + * This will cause the TX path to drop offchannel transmissions. + * That would also be done by mac80211, but it is racy, in particular + * in the case that the time event actually completed in the firmware + * (which is handled in iwl_mvm_te_handle_notif). + */ + if (test_and_clear_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) { /* do the same in case of hot spot 2.0 */ iwl_mvm_flush_sta(mvm, &mvm->aux_sta, true); + /* In newer version of this command an aux station is added only * in cases of dedicated tx queue and need to be removed in end * of use */ --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5C03C4707A for ; Mon, 24 Jan 2022 21:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1572866AbiAXVmt (ORCPT ); Mon, 24 Jan 2022 16:42:49 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59368 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446847AbiAXVJc (ORCPT ); Mon, 24 Jan 2022 16:09:32 -0500 Received: from smtp.kernel.org (relay.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 421E4B811FB; Mon, 24 Jan 2022 21:09:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 590CEC340E5; Mon, 24 Jan 2022 21:09:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058569; bh=HAxnIYUvZDrbYUQuiX/NRDtGF45GALErTHSE5Q6bXDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=baQuRUrvVBNidnL6PACKoGwL++nySnoqvP32gIZ/XMIru3ef027SiL2pD0cHbHnP7 dgQ1BZOsO9ij4QQ6K36gF25BWSPgRt34phceq3m8X/jNIo57jF6FYX/Fr4v9Uy0S64 d1+ckjXFAj6qqT2D8wVka0jXBv+l/7ed1566M3Hw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avraham Stern , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0330/1039] iwlwifi: mvm: perform 6GHz passive scan after suspend Date: Mon, 24 Jan 2022 19:35:19 +0100 Message-Id: <20220124184136.406568617@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Avraham Stern [ Upstream commit f4745cbb17572209a7fa27a6796ed70e7ada860b ] The 6GHz passive scan is performed only once every 50 minutes. However, in case of suspend/resume, the regulatory information is reset, so 6GHz channels may become disabled. Fix it by performing a 6GHz passive scan within 60 seconds after suspend/resume even if the 50 minutes timeout did not expire yet. Signed-off-by: Avraham Stern Fixes: e8fe3b41c3a3 ("iwlwifi: mvm: Add support for 6GHz passive scan") Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211219121514.6d5c043372cf.I251dd5= 618a3f0b8febbcca788eb861f1cd6039bc@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wi= reless/intel/iwlwifi/mvm/scan.c index a138b5c4cce84..ab960f86b940c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -1924,22 +1924,19 @@ static void iwl_mvm_scan_6ghz_passive_scan(struct i= wl_mvm *mvm, } =20 /* - * 6GHz passive scan is allowed while associated in a defined time - * interval following HW reset or resume flow + * 6GHz passive scan is allowed in a defined time interval following HW + * reset or resume flow, or while not associated and a large interval + * has passed since the last 6GHz passive scan. */ - if (vif->bss_conf.assoc && + if ((vif->bss_conf.assoc || + time_after(mvm->last_6ghz_passive_scan_jiffies + + (IWL_MVM_6GHZ_PASSIVE_SCAN_TIMEOUT * HZ), jiffies)) && (time_before(mvm->last_reset_or_resume_time_jiffies + (IWL_MVM_6GHZ_PASSIVE_SCAN_ASSOC_TIMEOUT * HZ), jiffies))) { - IWL_DEBUG_SCAN(mvm, "6GHz passive scan: associated\n"); - return; - } - - /* No need for 6GHz passive scan if not enough time elapsed */ - if (time_after(mvm->last_6ghz_passive_scan_jiffies + - (IWL_MVM_6GHZ_PASSIVE_SCAN_TIMEOUT * HZ), jiffies)) { - IWL_DEBUG_SCAN(mvm, - "6GHz passive scan: timeout did not expire\n"); + IWL_DEBUG_SCAN(mvm, "6GHz passive scan: %s\n", + vif->bss_conf.assoc ? "associated" : + "timeout did not expire"); return; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B03BCC35273 for ; Mon, 24 Jan 2022 23:48:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364363AbiAXXr2 (ORCPT ); Mon, 24 Jan 2022 18:47:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1840878AbiAXWzj (ORCPT ); Mon, 24 Jan 2022 17:55:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDD8CC0680A6; Mon, 24 Jan 2022 13:09:32 -0800 (PST) Received: from smtp.kernel.org (relay.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 8D6B161451; Mon, 24 Jan 2022 21:09:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AD62C340E5; Mon, 24 Jan 2022 21:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058572; bh=/CjwGGaAUdmDEBm/a/YjAd8KE0FRV4xADIfrAnFqqX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zF0v6gTZSEUTpfCTtpF3so4tOZMrDhuNyje+5hE4c4D0vgQUvPAylWRZ6aUeAccM2 MkKuWZHNC+MavCXmWOKt87zuGM7uPam7mx5SJFHmVthh/mDbXMrXzCUUSbH0qalGVx HdTISxWGS0OAkIjL+n+V2Q2kaRG6QLEPPNSgXtJQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avraham Stern , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0331/1039] iwlwifi: mvm: set protected flag only for NDP ranging Date: Mon, 24 Jan 2022 19:35:20 +0100 Message-Id: <20220124184136.439036135@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Avraham Stern [ Upstream commit 6bb2ea37c02db98cb677f978cfcb833ca608c5eb ] Don't use protected ranging negotiation for FTM ranging as responders that support only FTM ranging don't expect the FTM request to be protected. Signed-off-by: Avraham Stern Fixes: 517a5eb9fab2 ("iwlwifi: mvm: when associated with PMF, use protected= NDP ranging negotiation") Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211219132536.f50ed0e3c6b3.Ibff247= ee9d4e6e0a1a2d08a3c8a4bbb37e6829dd@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drive= rs/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c index 3e6c13fc74eb0..9449d1af3c11a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c @@ -511,7 +511,7 @@ iwl_mvm_ftm_put_target(struct iwl_mvm *mvm, struct ieee= 80211_vif *vif, rcu_read_lock(); =20 sta =3D rcu_dereference(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id]); - if (sta->mfp) + if (sta->mfp && (peer->ftm.trigger_based || peer->ftm.non_trigger_based)) FTM_PUT_FLAG(PMF); =20 rcu_read_unlock(); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02738C4707E for ; Mon, 24 Jan 2022 21:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573046AbiAXVm5 (ORCPT ); Mon, 24 Jan 2022 16:42:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59408 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446883AbiAXVJh (ORCPT ); Mon, 24 Jan 2022 16:09:37 -0500 Received: from smtp.kernel.org (relay.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 3DBCCB80FA1; Mon, 24 Jan 2022 21:09:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57B1EC340E5; Mon, 24 Jan 2022 21:09:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058575; bh=zYvhXmgk5raJcaWJoqoTorEjCgspp2OTg+ecp5a6CF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1hjEWtHRioKA9xbNHNNnCCd+350ZLeg/N+5D0CjFdxzrL992o7rO4QhO8BNoATinN V4CkSbzoex7beFE6imUrrZGzi7r+oziw66G1b5DTggwuypVjHgDTcFvOXjMdoYdvmE nqYOvJm4DkSS0dSr+qdOWj8v2mnGrThvzEPAGGuo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Martin Blumenstingl , Ulf Hansson , Sasha Levin Subject: [PATCH 5.16 0332/1039] mmc: meson-mx-sdhc: add IRQ check Date: Mon, 24 Jan 2022 19:35:21 +0100 Message-Id: <20220124184136.470730761@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Shtylyov [ Upstream commit 77bed755e0f06135faccdd3948863703f9a6e640 ] The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_threaded_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_threaded_irq() with the invalid IRQ #s. Fixes: e4bf1b0970ef ("mmc: host: meson-mx-sdhc: new driver for the Amlogic = Meson SDHC host") Signed-off-by: Sergey Shtylyov Reviewed-by: Martin Blumenstingl Link: https://lore.kernel.org/r/20211217202717.10041-2-s.shtylyov@omp.ru Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mmc/host/meson-mx-sdhc-mmc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-= mx-sdhc-mmc.c index 8fdd0bbbfa21f..28aa78aa08f3f 100644 --- a/drivers/mmc/host/meson-mx-sdhc-mmc.c +++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c @@ -854,6 +854,11 @@ static int meson_mx_sdhc_probe(struct platform_device = *pdev) goto err_disable_pclk; =20 irq =3D platform_get_irq(pdev, 0); + if (irq < 0) { + ret =3D irq; + goto err_disable_pclk; + } + ret =3D devm_request_threaded_irq(dev, irq, meson_mx_sdhc_irq, meson_mx_sdhc_irq_thread, IRQF_ONESHOT, NULL, host); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDA86C4167E for ; Mon, 24 Jan 2022 21:47:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378854AbiAXVrT (ORCPT ); Mon, 24 Jan 2022 16:47:19 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33722 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447975AbiAXVLr (ORCPT ); Mon, 24 Jan 2022 16:11:47 -0500 Received: from smtp.kernel.org (relay.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 A4C37B80FA1; Mon, 24 Jan 2022 21:11:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3C6EC340E5; Mon, 24 Jan 2022 21:11:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058705; bh=LkP5wPAOSpGkOD6OaRU0ev13KEb6uw1g3WHDaHfng7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwk4rdp3frub+YrOnsN34vV6keJb0khLp0UzlD6sXe+zzrOzOBqLv2mRzvN0FaaQk 7y1/NhmmFUcItZxVz7QIJN4xsOv1kQriDLs7H8vCQ+mDw0oZmuwaKJx3gL2btysB0F wD9X8UAH/nCQU8wYkRVhxPrli+N5kjnG/R++25Og= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Martin Blumenstingl , Ulf Hansson , Sasha Levin Subject: [PATCH 5.16 0333/1039] mmc: meson-mx-sdio: add IRQ check Date: Mon, 24 Jan 2022 19:35:22 +0100 Message-Id: <20220124184136.500983288@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Shtylyov [ Upstream commit 8fc9a77bc64e1f23d07953439817d8402ac9706f ] The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_threaded_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_threaded_irq() with the invalid IRQ #s. Fixes: ed80a13bb4c4 ("mmc: meson-mx-sdio: Add a driver for the Amlogic Meso= n8 and Meson8b SoC") Signed-off-by: Sergey Shtylyov Reviewed-by: Martin Blumenstingl Link: https://lore.kernel.org/r/20211217202717.10041-3-s.shtylyov@omp.ru Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mmc/host/meson-mx-sdio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-s= dio.c index d4a48916bfb67..3a19a05ef55a7 100644 --- a/drivers/mmc/host/meson-mx-sdio.c +++ b/drivers/mmc/host/meson-mx-sdio.c @@ -662,6 +662,11 @@ static int meson_mx_mmc_probe(struct platform_device *= pdev) } =20 irq =3D platform_get_irq(pdev, 0); + if (irq < 0) { + ret =3D irq; + goto error_free_mmc; + } + ret =3D devm_request_threaded_irq(host->controller_dev, irq, meson_mx_mmc_irq, meson_mx_mmc_irq_thread, IRQF_ONESHOT, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1216C4167E for ; Mon, 24 Jan 2022 21:46:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352952AbiAXVns (ORCPT ); Mon, 24 Jan 2022 16:43:48 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33854 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447083AbiAXVKA (ORCPT ); Mon, 24 Jan 2022 16:10:00 -0500 Received: from smtp.kernel.org (relay.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 6FB4461451; Mon, 24 Jan 2022 21:10:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50C8CC340E5; Mon, 24 Jan 2022 21:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058599; bh=xLe6OIxRf5HXXv5JzxhjAzembg+iCLkQRK2lINkvGpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tdhOq8FhvLNKosgAgbk+IqRGc7ely3TkTwxfQ7sR6nfce2f6frId8naGvXnp0xYFe +oaVsfaXLEsHAnUVrC7+cMH+VwXZIQQLwUYjtVnU7/PRn4VDKBIfm5U/IbKWPl5h5P jKYiw1/AYUk95744hGzPX8N/XDGy0EazkZJBsz+0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.16 0334/1039] block: fix error unwinding in device_add_disk Date: Mon, 24 Jan 2022 19:35:23 +0100 Message-Id: <20220124184136.533605897@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 99d8690aae4b2f0d1d90075de355ac087f820a66 ] One device_add is called disk->ev will be freed by disk_release, so we should free it twice. Fix this by allocating disk->ev after device_add so that the extra local unwinding can be removed entirely. Based on an earlier patch from Tetsuo Handa. Reported-by: syzbot Tested-by: syzbot Fixes: 83cbce9574462c6b ("block: add error handling for device_add_disk / a= dd_disk") Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20211221161851.788424-1-hch@lst.de Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- block/genhd.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 30362aeacac4b..596e43764846b 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -437,10 +437,6 @@ int __must_check device_add_disk(struct device *parent= , struct gendisk *disk, disk->flags |=3D GENHD_FL_EXT_DEVT; } =20 - ret =3D disk_alloc_events(disk); - if (ret) - goto out_free_ext_minor; - /* delay uevents, until we scanned partition table */ dev_set_uevent_suppress(ddev, 1); =20 @@ -451,7 +447,12 @@ int __must_check device_add_disk(struct device *parent= , struct gendisk *disk, ddev->devt =3D MKDEV(disk->major, disk->first_minor); ret =3D device_add(ddev); if (ret) - goto out_disk_release_events; + goto out_free_ext_minor; + + ret =3D disk_alloc_events(disk); + if (ret) + goto out_device_del; + if (!sysfs_deprecated) { ret =3D sysfs_create_link(block_depr, &ddev->kobj, kobject_name(&ddev->kobj)); @@ -539,8 +540,6 @@ out_del_block_link: sysfs_remove_link(block_depr, dev_name(ddev)); out_device_del: device_del(ddev); -out_disk_release_events: - disk_release_events(disk); out_free_ext_minor: if (disk->major =3D=3D BLOCK_EXT_MAJOR) blk_free_ext_minor(disk->first_minor); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 304D6C4167B for ; Mon, 24 Jan 2022 23:37:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382775AbiAXXhS (ORCPT ); Mon, 24 Jan 2022 18:37:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382474AbiAXW4C (ORCPT ); Mon, 24 Jan 2022 17:56:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDA4EC055AA0; Mon, 24 Jan 2022 13:10:34 -0800 (PST) Received: from smtp.kernel.org (relay.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 7CD006141C; Mon, 24 Jan 2022 21:10:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FC78C340E5; Mon, 24 Jan 2022 21:10:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058633; bh=1sxxLQIPWRG6aWSNdg8Rs1aLFGBqVedpdVrcpjRSgSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dWlCZEk4OmQgk1laMwEUiMQ0BDnklTLeJXYWMQAOMATGv6MD9Ru0l0Boj9Y+WowtM AYZNNcnm/dpxOL5Le41aEQzbWqLkr4jRLbTDPaIEO5Rhf2PVwV7CXcidDongP3pKsu /YJfgrJQci4JMNLDa+6IEzINPNb+Kvj11B8lLBMw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bernard Zhao , Paul Moore , Sasha Levin Subject: [PATCH 5.16 0335/1039] selinux: fix potential memleak in selinux_add_opt() Date: Mon, 24 Jan 2022 19:35:24 +0100 Message-Id: <20220124184136.568570374@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bernard Zhao [ Upstream commit 2e08df3c7c4e4e74e3dd5104c100f0bf6288aaa8 ] This patch try to fix potential memleak in error branch. Fixes: ba6418623385 ("selinux: new helper - selinux_add_opt()") Signed-off-by: Bernard Zhao [PM: tweak the subject line, add Fixes tag] Signed-off-by: Paul Moore Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- security/selinux/hooks.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index dde4ecc0cd186..49b4f59db35e7 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -988,18 +988,22 @@ out: static int selinux_add_opt(int token, const char *s, void **mnt_opts) { struct selinux_mnt_opts *opts =3D *mnt_opts; + bool is_alloc_opts =3D false; =20 if (token =3D=3D Opt_seclabel) /* eaten and completely ignored */ return 0; =20 + if (!s) + return -ENOMEM; + if (!opts) { opts =3D kzalloc(sizeof(struct selinux_mnt_opts), GFP_KERNEL); if (!opts) return -ENOMEM; *mnt_opts =3D opts; + is_alloc_opts =3D true; } - if (!s) - return -ENOMEM; + switch (token) { case Opt_context: if (opts->context || opts->defcontext) @@ -1024,6 +1028,10 @@ static int selinux_add_opt(int token, const char *s,= void **mnt_opts) } return 0; Einval: + if (is_alloc_opts) { + kfree(opts); + *mnt_opts =3D NULL; + } pr_warn(SEL_MOUNT_FAIL_MSG); return -EINVAL; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70469C35270 for ; Mon, 24 Jan 2022 23:37:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360657AbiAXXhK (ORCPT ); Mon, 24 Jan 2022 18:37:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382588AbiAXW4D (ORCPT ); Mon, 24 Jan 2022 17:56:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84BDEC055AA8; Mon, 24 Jan 2022 13:11:08 -0800 (PST) Received: from smtp.kernel.org (relay.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 21C3C61469; Mon, 24 Jan 2022 21:11:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4302C340E5; Mon, 24 Jan 2022 21:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058667; bh=8y110tx3r7t2HN8cFeLXNOvhc6Q0LIpe9KAMP9H6Dxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2NBjjzo5WiwdzH7lKGhCoTS3aDOmllDMfHpNR3oB5l7rN8k30WTR4oO4YVlsIcIb4 FeYUtkM/x9f9Br926It3FhRJ4sOkLhPE2tFiLetQR++pTd8y21G30N0qz75JCE7xA6 cA4syJZshF/BKhyDc5ZBNXJJ7B2CWdcEdzK7H3yA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Johannes Berg , Richard Weinberger , Sasha Levin Subject: [PATCH 5.16 0336/1039] um: fix ndelay/udelay defines Date: Mon, 24 Jan 2022 19:35:25 +0100 Message-Id: <20220124184136.599342727@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit 5f8539e2ff962e25b57742ca7106456403abbc94 ] Many places in the kernel use 'udelay' as an identifier, and are broken with the current "#define udelay um_udelay". Fix this by adding an argument to the macro, and do the same to 'ndelay' as well, just in case. Fixes: 0bc8fb4dda2b ("um: Implement ndelay/udelay in time-travel mode") Reported-by: kernel test robot Signed-off-by: Johannes Berg Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/um/include/asm/delay.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/um/include/asm/delay.h b/arch/um/include/asm/delay.h index 56fc2b8f2dd01..e79b2ab6f40c8 100644 --- a/arch/um/include/asm/delay.h +++ b/arch/um/include/asm/delay.h @@ -14,7 +14,7 @@ static inline void um_ndelay(unsigned long nsecs) ndelay(nsecs); } #undef ndelay -#define ndelay um_ndelay +#define ndelay(n) um_ndelay(n) =20 static inline void um_udelay(unsigned long usecs) { @@ -26,5 +26,5 @@ static inline void um_udelay(unsigned long usecs) udelay(usecs); } #undef udelay -#define udelay um_udelay +#define udelay(n) um_udelay(n) #endif /* __UM_DELAY_H */ --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11885C433F5 for ; Mon, 24 Jan 2022 23:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383742AbiAXXpz (ORCPT ); Mon, 24 Jan 2022 18:45:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837273AbiAXW4L (ORCPT ); Mon, 24 Jan 2022 17:56:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40E73C055AB8; Mon, 24 Jan 2022 13:11:30 -0800 (PST) Received: from smtp.kernel.org (relay.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 F260CB8121C; Mon, 24 Jan 2022 21:11:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20A21C340E5; Mon, 24 Jan 2022 21:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058687; bh=Wcrj+rKfUeDaiHz1P3RN61MxAqpAvccw1pIYIr8pwPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZN68W2rRsvVUyr6A0+TkAcHIAlPj5ovSPQBpx/HJBFOASrE+AND0dob6WbwhrUf2U N3jA1eED2e7xfSU6+aqInHNZK4xIfTnoXWIsJQzh0m7klYH8X7ApCpIVDWivaIVrqW tsV4UY7JHMc8G6glg7XaQJo2CW9XS/SXnrA9meKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Johannes Berg , Richard Weinberger , Sasha Levin Subject: [PATCH 5.16 0337/1039] um: rename set_signals() to um_set_signals() Date: Mon, 24 Jan 2022 19:35:26 +0100 Message-Id: <20220124184136.630151170@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit bbe33504d4a7fdab9011211e55e262c869b3f6cc ] Rename set_signals() as there's at least one driver that uses the same name and can now be built on UM due to PCI support, and thus we can get symbol conflicts. Also rename set_signals_trace() to be consistent. Reported-by: kernel test robot Fixes: 68f5d3f3b654 ("um: add PCI over virtio emulation driver") Signed-off-by: Johannes Berg Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/um/include/asm/irqflags.h | 4 ++-- arch/um/include/shared/longjmp.h | 2 +- arch/um/include/shared/os.h | 4 ++-- arch/um/kernel/ksyms.c | 2 +- arch/um/os-Linux/sigio.c | 6 +++--- arch/um/os-Linux/signal.c | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arch/um/include/asm/irqflags.h b/arch/um/include/asm/irqflags.h index dab5744e9253d..1e69ef5bc35e0 100644 --- a/arch/um/include/asm/irqflags.h +++ b/arch/um/include/asm/irqflags.h @@ -3,7 +3,7 @@ #define __UM_IRQFLAGS_H =20 extern int signals_enabled; -int set_signals(int enable); +int um_set_signals(int enable); void block_signals(void); void unblock_signals(void); =20 @@ -16,7 +16,7 @@ static inline unsigned long arch_local_save_flags(void) #define arch_local_irq_restore arch_local_irq_restore static inline void arch_local_irq_restore(unsigned long flags) { - set_signals(flags); + um_set_signals(flags); } =20 #define arch_local_irq_enable arch_local_irq_enable diff --git a/arch/um/include/shared/longjmp.h b/arch/um/include/shared/long= jmp.h index bdb2869b72b31..8863319039f3d 100644 --- a/arch/um/include/shared/longjmp.h +++ b/arch/um/include/shared/longjmp.h @@ -18,7 +18,7 @@ extern void longjmp(jmp_buf, int); enable =3D *(volatile int *)&signals_enabled; \ n =3D setjmp(*buf); \ if(n !=3D 0) \ - set_signals_trace(enable); \ + um_set_signals_trace(enable); \ n; }) =20 #endif diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h index 96d400387c93e..03ffbdddcc480 100644 --- a/arch/um/include/shared/os.h +++ b/arch/um/include/shared/os.h @@ -238,8 +238,8 @@ extern void send_sigio_to_self(void); extern int change_sig(int signal, int on); extern void block_signals(void); extern void unblock_signals(void); -extern int set_signals(int enable); -extern int set_signals_trace(int enable); +extern int um_set_signals(int enable); +extern int um_set_signals_trace(int enable); extern int os_is_signal_stack(void); extern void deliver_alarm(void); extern void register_pm_wake_signal(void); diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c index b1e5634398d09..3a85bde3e1734 100644 --- a/arch/um/kernel/ksyms.c +++ b/arch/um/kernel/ksyms.c @@ -6,7 +6,7 @@ #include #include =20 -EXPORT_SYMBOL(set_signals); +EXPORT_SYMBOL(um_set_signals); EXPORT_SYMBOL(signals_enabled); =20 EXPORT_SYMBOL(os_stat_fd); diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c index 6597ea1986ffa..9e71794839e87 100644 --- a/arch/um/os-Linux/sigio.c +++ b/arch/um/os-Linux/sigio.c @@ -132,7 +132,7 @@ static void update_thread(void) int n; char c; =20 - flags =3D set_signals_trace(0); + flags =3D um_set_signals_trace(0); CATCH_EINTR(n =3D write(sigio_private[0], &c, sizeof(c))); if (n !=3D sizeof(c)) { printk(UM_KERN_ERR "update_thread : write failed, err =3D %d\n", @@ -147,7 +147,7 @@ static void update_thread(void) goto fail; } =20 - set_signals_trace(flags); + um_set_signals_trace(flags); return; fail: /* Critical section start */ @@ -161,7 +161,7 @@ static void update_thread(void) close(write_sigio_fds[0]); close(write_sigio_fds[1]); /* Critical section end */ - set_signals_trace(flags); + um_set_signals_trace(flags); } =20 int __add_sigio_fd(int fd) diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c index 6cf098c23a394..24a403a70a020 100644 --- a/arch/um/os-Linux/signal.c +++ b/arch/um/os-Linux/signal.c @@ -94,7 +94,7 @@ void sig_handler(int sig, struct siginfo *si, mcontext_t = *mc) =20 sig_handler_common(sig, si, mc); =20 - set_signals_trace(enabled); + um_set_signals_trace(enabled); } =20 static void timer_real_alarm_handler(mcontext_t *mc) @@ -126,7 +126,7 @@ void timer_alarm_handler(int sig, struct siginfo *unuse= d_si, mcontext_t *mc) =20 signals_active &=3D ~SIGALRM_MASK; =20 - set_signals_trace(enabled); + um_set_signals_trace(enabled); } =20 void deliver_alarm(void) { @@ -348,7 +348,7 @@ void unblock_signals(void) } } =20 -int set_signals(int enable) +int um_set_signals(int enable) { int ret; if (signals_enabled =3D=3D enable) @@ -362,7 +362,7 @@ int set_signals(int enable) return ret; } =20 -int set_signals_trace(int enable) +int um_set_signals_trace(int enable) { int ret; if (signals_enabled =3D=3D enable) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8166DC43217 for ; Mon, 24 Jan 2022 23:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1843530AbiAXXqP (ORCPT ); Mon, 24 Jan 2022 18:46:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587682AbiAXW4K (ORCPT ); Mon, 24 Jan 2022 17:56:10 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7C29C055AB9; Mon, 24 Jan 2022 13:11:31 -0800 (PST) Received: from smtp.kernel.org (relay.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 5542A612E9; Mon, 24 Jan 2022 21:11:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37E74C340E5; Mon, 24 Jan 2022 21:11:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058690; bh=EjYjonRQitSknKhd+4bksVPMqHt1V78cIUfxjZQC6x8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tqmrEQ0lA+GZgDVofYxvIol4+SCyesyj1f0UsiTN5uMDA25z/QeZQ38ENdo+HvxYz v01+6lx2lTo49My9PqBXLyF3gcSCb4PuMj2UHcu/ykZz7diw2JEyHgJFO2FF5NXkyp bVocoyqZTwPZfSjy3Clta3zKOCcrGGRi2iWEI9y8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Johannes Berg , Richard Weinberger , Sasha Levin Subject: [PATCH 5.16 0338/1039] um: virt-pci: Fix 32-bit compile Date: Mon, 24 Jan 2022 19:35:27 +0100 Message-Id: <20220124184136.668044062@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit d73820df6437b5d0a57be53faf39db46a0264b3a ] There were a few 32-bit compile warnings that of course turned into errors with -Werror, fix the 32-bit build. Fixes: 68f5d3f3b654 ("um: add PCI over virtio emulation driver") Reported-by: Al Viro Signed-off-by: Johannes Berg Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/um/drivers/virt-pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/um/drivers/virt-pci.c b/arch/um/drivers/virt-pci.c index c080666330234..0ab58016db22f 100644 --- a/arch/um/drivers/virt-pci.c +++ b/arch/um/drivers/virt-pci.c @@ -181,15 +181,15 @@ static unsigned long um_pci_cfgspace_read(void *priv,= unsigned int offset, /* buf->data is maximum size - we may only use parts of it */ struct um_pci_message_buffer *buf; u8 *data; - unsigned long ret =3D ~0ULL; + unsigned long ret =3D ULONG_MAX; =20 if (!dev) - return ~0ULL; + return ULONG_MAX; =20 buf =3D get_cpu_var(um_pci_msg_bufs); data =3D buf->data; =20 - memset(data, 0xff, sizeof(data)); + memset(buf->data, 0xff, sizeof(buf->data)); =20 switch (size) { case 1: @@ -304,7 +304,7 @@ static unsigned long um_pci_bar_read(void *priv, unsign= ed int offset, /* buf->data is maximum size - we may only use parts of it */ struct um_pci_message_buffer *buf; u8 *data; - unsigned long ret =3D ~0ULL; + unsigned long ret =3D ULONG_MAX; =20 buf =3D get_cpu_var(um_pci_msg_bufs); data =3D buf->data; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3943FC43219 for ; Mon, 24 Jan 2022 22:30:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586718AbiAXW1O (ORCPT ); Mon, 24 Jan 2022 17:27:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33588 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447866AbiAXVLg (ORCPT ); Mon, 24 Jan 2022 16:11:36 -0500 Received: from smtp.kernel.org (relay.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 0D527B81142; Mon, 24 Jan 2022 21:11:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2934BC340E5; Mon, 24 Jan 2022 21:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058693; bh=/bLI7PY8b0pniFdtjS+4UE+h+UAG8zivzIo6Fo50J8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EcdGETPRddbF4Ls5vdL0+GWzsCy6nXbYbo+MTUd8zT8/HOMfdzCJyiI7cM6QSAxWv 71zbag37xabMUJRkWm/aEu/LWhq3NaJ+b/EUWsG1nrEM2OyxS4vFgm+Fgv817ZFhlJ ZdYfUZACkAXoEYR0hAhT+h8rmBBm0jxsBhOoMv3A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Johannes Berg , Richard Weinberger , Sasha Levin Subject: [PATCH 5.16 0339/1039] lib/logic_iomem: Fix 32-bit build Date: Mon, 24 Jan 2022 19:35:28 +0100 Message-Id: <20220124184136.697599517@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit 4e84139e14af5ea60772cc4f33d7059aec76e0eb ] On a 32-bit build, the (unsigned long long) casts throw warnings (or errors) due to being to a different integer size. Cast to uintptr_t first (with the __force for sparse) and then further to get the consistent print on 32 and 64-bit. Fixes: ca2e334232b6 ("lib: add iomem emulation (logic_iomem)") Reported-by: Al Viro Signed-off-by: Johannes Berg Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- lib/logic_iomem.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/logic_iomem.c b/lib/logic_iomem.c index 9bdfde0c0f86d..54fa601f3300b 100644 --- a/lib/logic_iomem.c +++ b/lib/logic_iomem.c @@ -79,7 +79,7 @@ static void __iomem *real_ioremap(phys_addr_t offset, siz= e_t size) static void real_iounmap(void __iomem *addr) { WARN(1, "invalid iounmap for addr 0x%llx\n", - (unsigned long long __force)addr); + (unsigned long long)(uintptr_t __force)addr); } #endif /* CONFIG_LOGIC_IOMEM_FALLBACK */ =20 @@ -173,7 +173,7 @@ EXPORT_SYMBOL(iounmap); static u##sz real_raw_read ## op(const volatile void __iomem *addr) \ { \ WARN(1, "Invalid read" #op " at address %llx\n", \ - (unsigned long long __force)addr); \ + (unsigned long long)(uintptr_t __force)addr); \ return (u ## sz)~0ULL; \ } \ \ @@ -181,7 +181,8 @@ static void real_raw_write ## op(u ## sz val, \ volatile void __iomem *addr) \ { \ WARN(1, "Invalid writeq" #op " of 0x%llx at address %llx\n", \ - (unsigned long long)val, (unsigned long long __force)addr);\ + (unsigned long long)val, \ + (unsigned long long)(uintptr_t __force)addr);\ } \ =20 MAKE_FALLBACK(b, 8); @@ -194,14 +195,14 @@ MAKE_FALLBACK(q, 64); static void real_memset_io(volatile void __iomem *addr, int value, size_t = size) { WARN(1, "Invalid memset_io at address 0x%llx\n", - (unsigned long long __force)addr); + (unsigned long long)(uintptr_t __force)addr); } =20 static void real_memcpy_fromio(void *buffer, const volatile void __iomem *= addr, size_t size) { WARN(1, "Invalid memcpy_fromio at address 0x%llx\n", - (unsigned long long __force)addr); + (unsigned long long)(uintptr_t __force)addr); =20 memset(buffer, 0xff, size); } @@ -210,7 +211,7 @@ static void real_memcpy_toio(volatile void __iomem *add= r, const void *buffer, size_t size) { WARN(1, "Invalid memcpy_toio at address 0x%llx\n", - (unsigned long long __force)addr); + (unsigned long long)(uintptr_t __force)addr); } #endif /* CONFIG_LOGIC_IOMEM_FALLBACK */ =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6031EC433EF for ; Mon, 24 Jan 2022 23:57:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365990AbiAXXwG (ORCPT ); Mon, 24 Jan 2022 18:52:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837278AbiAXW4K (ORCPT ); Mon, 24 Jan 2022 17:56:10 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D454C055ABA; Mon, 24 Jan 2022 13:11:39 -0800 (PST) Received: from smtp.kernel.org (relay.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 EDCB4B8121C; Mon, 24 Jan 2022 21:11:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FD31C340E5; Mon, 24 Jan 2022 21:11:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058696; bh=l7UtJdL8SBoqJm1jldU5+fDq8XyAWe8H5vJ8rXhBJ5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C54lZHw5OfMRM9wD6Iq+6boezM9ZNkuL1WpzKAzsnKEUp30j7dB5JTyLkI3bOQdgL AUtOYnipAwSS8D4CSpyyqT0GthIBpkotR6tDh0VrFLCUb+jOUUb8lrhdpDHAnamQMp vMdgkIZaq1iy36+ngzy7jzUjLX5ZknUjR9vJPT2U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Richard Weinberger , Sasha Levin Subject: [PATCH 5.16 0340/1039] lib/logic_iomem: Fix operation on 32-bit Date: Mon, 24 Jan 2022 19:35:29 +0100 Message-Id: <20220124184136.735914825@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit 4e8a5edac5010820e7c5303fc96f5a262e096bb6 ] On 32-bit, the first entry might be at 0/NULL, but that's strange and leads to issues, e.g. where we check "if (ret)". Use a IOREMAP_BIAS/IOREMAP_MASK of 0x80000000UL to avoid this. This then requires reducing the number of areas (via MAX_AREAS), but we still have 128 areas, which is enough. Fixes: ca2e334232b6 ("lib: add iomem emulation (logic_iomem)") Signed-off-by: Johannes Berg Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- lib/logic_iomem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/logic_iomem.c b/lib/logic_iomem.c index 54fa601f3300b..549b22d4bcde1 100644 --- a/lib/logic_iomem.c +++ b/lib/logic_iomem.c @@ -21,15 +21,15 @@ struct logic_iomem_area { =20 #define AREA_SHIFT 24 #define MAX_AREA_SIZE (1 << AREA_SHIFT) -#define MAX_AREAS ((1ULL<<32) / MAX_AREA_SIZE) +#define MAX_AREAS ((1U << 31) / MAX_AREA_SIZE) #define AREA_BITS ((MAX_AREAS - 1) << AREA_SHIFT) #define AREA_MASK (MAX_AREA_SIZE - 1) #ifdef CONFIG_64BIT #define IOREMAP_BIAS 0xDEAD000000000000UL #define IOREMAP_MASK 0xFFFFFFFF00000000UL #else -#define IOREMAP_BIAS 0 -#define IOREMAP_MASK 0 +#define IOREMAP_BIAS 0x80000000UL +#define IOREMAP_MASK 0x80000000UL #endif =20 static DEFINE_MUTEX(regions_mtx); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93045C433FE for ; Mon, 24 Jan 2022 23:47:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2361879AbiAXXlE (ORCPT ); Mon, 24 Jan 2022 18:41:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841065AbiAXW5a (ORCPT ); Mon, 24 Jan 2022 17:57:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BC77C055ABC; Mon, 24 Jan 2022 13:11:41 -0800 (PST) Received: from smtp.kernel.org (relay.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 B4E80B80FA1; Mon, 24 Jan 2022 21:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBF70C340E5; Mon, 24 Jan 2022 21:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058699; bh=Sg3S3kOi4mnZWSbiDwAh4Yx1tel3YqVXV3twfkoYhCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=weFOZsnREhwfgzXBXPrv7aMj61kRjFHkEPLKH2h6jXl0G5vjkoJS7mW1X8b9RMsY7 BPR/y37a8nuTU8G2Cmaj7m/rv/IcMEMibaiGb+GpErIqtUQ7dkwgX0QSgDmjgdmY94 y9hNaP7ecURwW8qleK7z5GVfe2+/W/ZeJqFlHmrs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Richard Weinberger , Sasha Levin Subject: [PATCH 5.16 0341/1039] um: virtio_uml: Fix time-travel external time propagation Date: Mon, 24 Jan 2022 19:35:30 +0100 Message-Id: <20220124184136.768068556@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit 85e73968a040c642fd38f6cba5b73b61f5d0f052 ] When creating an external event, the current time needs to be propagated to other participants of a simulation. This is done in the places here where we kick a virtq etc. However, it must be done for _all_ external events, and that includes making the initial socket connection and later closing it. Call time_travel_propagate_time() to do this before making or closing the socket connection. Apparently, at least for the initial connection creation, due to the remote side in my use cases using microseconds (rather than nanoseconds), this wasn't a problem yet; only started failing between 5.14-rc1 and 5.15-rc1 (didn't test others much), or possibly depending on the configuration, where more delays happen before the virtio devices are initialized. Fixes: 88ce64249233 ("um: Implement time-travel=3Dext") Signed-off-by: Johannes Berg Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/um/drivers/virtio_uml.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c index d51e445df7976..7755cb4ff9fc6 100644 --- a/arch/um/drivers/virtio_uml.c +++ b/arch/um/drivers/virtio_uml.c @@ -1090,6 +1090,8 @@ static void virtio_uml_release_dev(struct device *d) container_of(d, struct virtio_device, dev); struct virtio_uml_device *vu_dev =3D to_virtio_uml_device(vdev); =20 + time_travel_propagate_time(); + /* might not have been opened due to not negotiating the feature */ if (vu_dev->req_fd >=3D 0) { um_free_irq(vu_dev->irq, vu_dev); @@ -1136,6 +1138,8 @@ static int virtio_uml_probe(struct platform_device *p= dev) vu_dev->pdev =3D pdev; vu_dev->req_fd =3D -1; =20 + time_travel_propagate_time(); + do { rc =3D os_connect_socket(pdata->socket_path); } while (rc =3D=3D -EINTR); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15C4AC433EF for ; Mon, 24 Jan 2022 22:18:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583515AbiAXWS0 (ORCPT ); Mon, 24 Jan 2022 17:18:26 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33686 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447918AbiAXVLo (ORCPT ); Mon, 24 Jan 2022 16:11:44 -0500 Received: from smtp.kernel.org (relay.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 9B936B81233; Mon, 24 Jan 2022 21:11:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C161BC340E5; Mon, 24 Jan 2022 21:11:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058702; bh=nbudAHV5Id/HIQCDuN+n30CdC18eMXg3cLWyw/aOG2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2D2AFof3BofQ3g9/IWo4SVqQ8pKfVXZC0HRt+DwaQVXI8Q+4mSlheueNfi/ITubsJ jKh0e7Q0HFs+omrvWGOJXtADkvnGhd9MB6AeehUxoNEzxyoGgmOImitcuCBM6NoOta lv29Q1tA3f4+Cz6VKlOwjxxj61aDRkKc0CbMTLQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0342/1039] Bluetooth: L2CAP: Fix using wrong mode Date: Mon, 24 Jan 2022 19:35:31 +0100 Message-Id: <20220124184136.798730800@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luiz Augusto von Dentz [ Upstream commit 30d57722732d9736554f85f75f9d7ad5402d192e ] If user has a set to use SOCK_STREAM the socket would default to L2CAP_MODE_ERTM which later needs to be adjusted if the destination address is LE which doesn't support such mode. Fixes: 15f02b9105625 ("Bluetooth: L2CAP: Add initial code for Enhanced Cred= it Based Mode") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/l2cap_sock.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 4574c5cb1b596..251017c69ab7f 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -161,7 +161,11 @@ static int l2cap_sock_bind(struct socket *sock, struct= sockaddr *addr, int alen) break; } =20 - if (chan->psm && bdaddr_type_is_le(chan->src_type)) + /* Use L2CAP_MODE_LE_FLOWCTL (CoC) in case of LE address and + * L2CAP_MODE_EXT_FLOWCTL (ECRED) has not been set. + */ + if (chan->psm && bdaddr_type_is_le(chan->src_type) && + chan->mode !=3D L2CAP_MODE_EXT_FLOWCTL) chan->mode =3D L2CAP_MODE_LE_FLOWCTL; =20 chan->state =3D BT_BOUND; @@ -255,7 +259,11 @@ static int l2cap_sock_connect(struct socket *sock, str= uct sockaddr *addr, return -EINVAL; } =20 - if (chan->psm && bdaddr_type_is_le(chan->src_type) && !chan->mode) + /* Use L2CAP_MODE_LE_FLOWCTL (CoC) in case of LE address and + * L2CAP_MODE_EXT_FLOWCTL (ECRED) has not been set. + */ + if (chan->psm && bdaddr_type_is_le(chan->src_type) && + chan->mode !=3D L2CAP_MODE_EXT_FLOWCTL) chan->mode =3D L2CAP_MODE_LE_FLOWCTL; =20 l2cap_sock_init_pid(sk); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 670BAC35272 for ; Mon, 24 Jan 2022 23:48:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364213AbiAXXrB (ORCPT ); Mon, 24 Jan 2022 18:47:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356424AbiAXWz7 (ORCPT ); Mon, 24 Jan 2022 17:55:59 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78006C0680BD; Mon, 24 Jan 2022 13:10:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 401AAB810BD; Mon, 24 Jan 2022 21:10:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58E52C340E5; Mon, 24 Jan 2022 21:10:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058603; bh=GenLxtxLRHNWfA86dEZ+thJRET1S9HTGCB7UNjRlrEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i52JiI3TTBbe8kszDIbz5mnNnirjtwDoK5q661/dXpzXlGrqlckxUU639KUh3BgHd /DOSeg+cMPK2iDsPHCRzpUzytbi0mM/eeopgOTx9hSGEzm80Y0roFa3AzD3oNbjexP Mk46JPpXSMczI85bUMwU/fRoh6O2/MXwc6gfpdlg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Monnet , Paul Chaignon , Andrii Nakryiko , Yonghong Song , Sasha Levin Subject: [PATCH 5.16 0343/1039] bpftool: Enable line buffering for stdout Date: Mon, 24 Jan 2022 19:35:32 +0100 Message-Id: <20220124184136.830520895@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Chaignon [ Upstream commit 1a1a0b0364ad291bd8e509da104ac8b5b1afec5d ] The output of bpftool prog tracelog is currently buffered, which is inconvenient when piping the output into other commands. A simple tracelog | grep will typically not display anything. This patch fixes it by enabling line buffering on stdout for the whole bpftool binary. Fixes: 30da46b5dc3a ("tools: bpftool: add a command to dump the trace pipe") Signed-off-by: Quentin Monnet Signed-off-by: Paul Chaignon Signed-off-by: Andrii Nakryiko Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20211220214528.GA11706@Mem Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/bpf/bpftool/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c index 28237d7cef67f..8fbcff9d557d9 100644 --- a/tools/bpf/bpftool/main.c +++ b/tools/bpf/bpftool/main.c @@ -400,6 +400,8 @@ int main(int argc, char **argv) }; int opt, ret; =20 + setlinebuf(stdout); + last_do_help =3D do_help; pretty_output =3D false; json_output =3D false; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45BA6C4321E for ; Mon, 24 Jan 2022 21:46:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446436AbiAXVnm (ORCPT ); Mon, 24 Jan 2022 16:43:42 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33946 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447166AbiAXVKH (ORCPT ); Mon, 24 Jan 2022 16:10:07 -0500 Received: from smtp.kernel.org (relay.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 A13456148B; Mon, 24 Jan 2022 21:10:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82EACC340EC; Mon, 24 Jan 2022 21:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058606; bh=0uJHedN80f2xLTdruQW7Fj+OFcuWMBzE4MqBNcSaJxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wr8FMdTXPyGbkmagPzh6rL/VaMxXGw8dFIkkaOc9AeMmkedRfmK5TAsYnVNY2mFW5 i4ncaISXwTJ2k4506V1s19cEXdJFvUXD2mRf2iWcUfRCrf9zLlGylCUS6luZL+GlHv 48eUzdbbR7OST0ze8zoxPvKiVI8Dm1cAk/l4hSEw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , AngeloGioacchino Del Regno , Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 5.16 0344/1039] backlight: qcom-wled: Validate enabled string indices in DT Date: Mon, 24 Jan 2022 19:35:33 +0100 Message-Id: <20220124184136.861020501@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit c05b21ebc5bce3ecc78c2c71afd76d92c790a2ac ] The strings passed in DT may possibly cause out-of-bounds register accesses and should be validated before use. Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED= 3") Signed-off-by: Marijn Suijten Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211115203459.1634079-2-marijn.suijten@som= ainline.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/video/backlight/qcom-wled.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/= qcom-wled.c index d094299c2a485..8a42ed89c59c9 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -1528,12 +1528,28 @@ static int wled_configure(struct wled *wled) string_len =3D of_property_count_elems_of_size(dev->of_node, "qcom,enabled-strings", sizeof(u32)); - if (string_len > 0) + if (string_len > 0) { + if (string_len > wled->max_string_count) { + dev_err(dev, "Cannot have more than %d strings\n", + wled->max_string_count); + return -EINVAL; + } + of_property_read_u32_array(dev->of_node, "qcom,enabled-strings", wled->cfg.enabled_strings, sizeof(u32)); =20 + for (i =3D 0; i < string_len; ++i) { + if (wled->cfg.enabled_strings[i] >=3D wled->max_string_count) { + dev_err(dev, + "qcom,enabled-strings index %d at %d is out of bounds\n", + wled->cfg.enabled_strings[i], i); + return -EINVAL; + } + } + } + return 0; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA336C4167D for ; Mon, 24 Jan 2022 21:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573794AbiAXVpy (ORCPT ); Mon, 24 Jan 2022 16:45:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60402 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447202AbiAXVKK (ORCPT ); Mon, 24 Jan 2022 16:10:10 -0500 Received: from smtp.kernel.org (relay.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 9C9986146B; Mon, 24 Jan 2022 21:10:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BF2AC340E5; Mon, 24 Jan 2022 21:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058609; bh=+mc7XH6ZHrcnhKZMatKve+G3YzRkXog/jm9bBkgtgnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iuRsi1I9gFJPcqLIuMfe0eoFFsAFLnhaF0bqvzidUqBOZOJx5GCgFR741JtsLXL92 MLvBj6/KUgAtctvVF2Nf/lEEz4EQtpY3BeDTe7c7AM2oG3wg4Ojm0fmd3gnZrp4CDL toBhxpFK8TaEwW6wbs+mbPMhVIp4JJPhvrbnv20w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , AngeloGioacchino Del Regno , Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 5.16 0345/1039] backlight: qcom-wled: Pass number of elements to read to read_u32_array Date: Mon, 24 Jan 2022 19:35:34 +0100 Message-Id: <20220124184136.891415467@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit e29e24bdabfeddbf8b1a4ecac1af439a85150438 ] of_property_read_u32_array takes the number of elements to read as last argument. This does not always need to be 4 (sizeof(u32)) but should instead be the size of the array in DT as read just above with of_property_count_elems_of_size. To not make such an error go unnoticed again the driver now bails accordingly when of_property_read_u32_array returns an error. Surprisingly the indentation of newlined arguments is lining up again after prepending `rc =3D `. Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED= 3") Signed-off-by: Marijn Suijten Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211115203459.1634079-3-marijn.suijten@som= ainline.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/video/backlight/qcom-wled.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/= qcom-wled.c index 8a42ed89c59c9..d413b913fef32 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -1535,10 +1535,15 @@ static int wled_configure(struct wled *wled) return -EINVAL; } =20 - of_property_read_u32_array(dev->of_node, + rc =3D of_property_read_u32_array(dev->of_node, "qcom,enabled-strings", wled->cfg.enabled_strings, - sizeof(u32)); + string_len); + if (rc) { + dev_err(dev, "Failed to read %d elements from qcom,enabled-strings: %d\= n", + string_len, rc); + return rc; + } =20 for (i =3D 0; i < string_len; ++i) { if (wled->cfg.enabled_strings[i] >=3D wled->max_string_count) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49437C4167E for ; Mon, 24 Jan 2022 23:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364285AbiAXXrK (ORCPT ); Mon, 24 Jan 2022 18:47:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356414AbiAXWz7 (ORCPT ); Mon, 24 Jan 2022 17:55:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BA90C0680BE; Mon, 24 Jan 2022 13:10:13 -0800 (PST) Received: from smtp.kernel.org (relay.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 CF5C661488; Mon, 24 Jan 2022 21:10:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D75EC340E5; Mon, 24 Jan 2022 21:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058612; bh=aoIkoXL+IbHeCwVZEZ3+5rPr3k+SkHRQnWmKrVQ5fs4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Q17gA8P9cOLfaHljVn2F5zMmIW3kYpkBTshhSZ7gGx2Z4W3Xe6bjy7HIqCkeNU6o fTb7LIE7M7IZ4y+9n0D3fLsQrGzZeWSR8kliulycQ5KfpIXQ+oImR/BM3ACFGZzqUL /E0XBOZ4RUKP6AR0m4KmfpHG1eaP3xzhV7qYRklU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , AngeloGioacchino Del Regno , Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 5.16 0346/1039] backlight: qcom-wled: Fix off-by-one maximum with default num_strings Date: Mon, 24 Jan 2022 19:35:35 +0100 Message-Id: <20220124184136.926874921@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit 5ada78b26f935f8751852dffa24f6b545b1d2517 ] When not specifying num-strings in the DT the default is used, but +1 is added to it which turns WLED3 into 4 and WLED4/5 into 5 strings instead of 3 and 4 respectively, causing out-of-bounds reads and register read/writes. This +1 exists for a deficiency in the DT parsing code, and is simply omitted entirely - solving this oob issue - by parsing the property separately much like qcom,enabled-strings. This also enables more stringent checks on the maximum value when qcom,enabled-strings is provided in the DT, by parsing num-strings after enabled-strings to allow it to check against (and in a subsequent patch override) the length of enabled-strings: it is invalid to set num-strings higher than that. The DT currently utilizes it to get around an incorrect fixed read of four elements from that array (has been addressed in a prior patch) by setting a lower num-strings where desired. Fixes: 93c64f1ea1e8 ("leds: add Qualcomm PM8941 WLED driver") Signed-off-by: Marijn Suijten Reviewed-By: AngeloGioacchino Del Regno Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211115203459.1634079-5-marijn.suijten@som= ainline.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/video/backlight/qcom-wled.c | 48 ++++++++++------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/= qcom-wled.c index d413b913fef32..dbcbeda655192 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -1256,21 +1256,6 @@ static const struct wled_var_cfg wled5_ovp_cfg =3D { .size =3D 16, }; =20 -static u32 wled3_num_strings_values_fn(u32 idx) -{ - return idx + 1; -} - -static const struct wled_var_cfg wled3_num_strings_cfg =3D { - .fn =3D wled3_num_strings_values_fn, - .size =3D 3, -}; - -static const struct wled_var_cfg wled4_num_strings_cfg =3D { - .fn =3D wled3_num_strings_values_fn, - .size =3D 4, -}; - static u32 wled3_switch_freq_values_fn(u32 idx) { return 19200 / (2 * (1 + idx)); @@ -1344,11 +1329,6 @@ static int wled_configure(struct wled *wled) .val_ptr =3D &cfg->switch_freq, .cfg =3D &wled3_switch_freq_cfg, }, - { - .name =3D "qcom,num-strings", - .val_ptr =3D &cfg->num_strings, - .cfg =3D &wled3_num_strings_cfg, - }, }; =20 const struct wled_u32_opts wled4_opts[] =3D { @@ -1372,11 +1352,6 @@ static int wled_configure(struct wled *wled) .val_ptr =3D &cfg->switch_freq, .cfg =3D &wled3_switch_freq_cfg, }, - { - .name =3D "qcom,num-strings", - .val_ptr =3D &cfg->num_strings, - .cfg =3D &wled4_num_strings_cfg, - }, }; =20 const struct wled_u32_opts wled5_opts[] =3D { @@ -1400,11 +1375,6 @@ static int wled_configure(struct wled *wled) .val_ptr =3D &cfg->switch_freq, .cfg =3D &wled3_switch_freq_cfg, }, - { - .name =3D "qcom,num-strings", - .val_ptr =3D &cfg->num_strings, - .cfg =3D &wled4_num_strings_cfg, - }, { .name =3D "qcom,modulator-sel", .val_ptr =3D &cfg->mod_sel, @@ -1523,8 +1493,6 @@ static int wled_configure(struct wled *wled) *bool_opts[i].val_ptr =3D true; } =20 - cfg->num_strings =3D cfg->num_strings + 1; - string_len =3D of_property_count_elems_of_size(dev->of_node, "qcom,enabled-strings", sizeof(u32)); @@ -1555,6 +1523,22 @@ static int wled_configure(struct wled *wled) } } =20 + rc =3D of_property_read_u32(dev->of_node, "qcom,num-strings", &val); + if (!rc) { + if (val < 1 || val > wled->max_string_count) { + dev_err(dev, "qcom,num-strings must be between 1 and %d\n", + wled->max_string_count); + return -EINVAL; + } + + if (string_len > 0 && val > string_len) { + dev_err(dev, "qcom,num-strings exceeds qcom,enabled-strings\n"); + return -EINVAL; + } + + cfg->num_strings =3D val; + } + return 0; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89C17C433FE for ; Mon, 24 Jan 2022 21:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573150AbiAXVoe (ORCPT ); Mon, 24 Jan 2022 16:44:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60210 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447251AbiAXVKS (ORCPT ); Mon, 24 Jan 2022 16:10:18 -0500 Received: from smtp.kernel.org (relay.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 8F782B810BD; Mon, 24 Jan 2022 21:10:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0FCFC340E5; Mon, 24 Jan 2022 21:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058615; bh=dpr/6SmkftpYgHSoOA96Mr8yGDl3BpFvFZ1P7MbL7hc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t3sbXaXykg7TQalfkWM7B99UpeMqtmxMMtaMyqFJkLNhpUZJ5z/aXzlB51114NdA7 PdIdzsGzxXRNQ21XmDTA7ClhLIJYnp9smfnmhuZtgHUC1Ts4no5e9M6gKxO9JjEj07 0f+w/i9x98RpekQCtHY62DujjhYeeB8hdIYalV/g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , AngeloGioacchino Del Regno , Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 5.16 0347/1039] backlight: qcom-wled: Override default length with qcom,enabled-strings Date: Mon, 24 Jan 2022 19:35:36 +0100 Message-Id: <20220124184136.958390768@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit 2b4b49602f9feca7b7a84eaa33ad9e666c8aa695 ] The length of qcom,enabled-strings as property array is enough to determine the number of strings to be enabled, without needing to set qcom,num-strings to override the default number of strings when less than the default (which is also the maximum) is provided in DT. This also introduces an extra warning when qcom,num-strings is set, denoting that it is not necessary to set both anymore. It is usually more concise to set just qcom,num-length when a zero-based, contiguous range of strings is needed (the majority of the cases), or to only set qcom,enabled-strings when a specific set of indices is desired. Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED= 3") Signed-off-by: Marijn Suijten Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211115203459.1634079-6-marijn.suijten@som= ainline.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/video/backlight/qcom-wled.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/= qcom-wled.c index dbcbeda655192..c057368e5056e 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -1521,6 +1521,8 @@ static int wled_configure(struct wled *wled) return -EINVAL; } } + + cfg->num_strings =3D string_len; } =20 rc =3D of_property_read_u32(dev->of_node, "qcom,num-strings", &val); @@ -1531,9 +1533,13 @@ static int wled_configure(struct wled *wled) return -EINVAL; } =20 - if (string_len > 0 && val > string_len) { - dev_err(dev, "qcom,num-strings exceeds qcom,enabled-strings\n"); - return -EINVAL; + if (string_len > 0) { + dev_warn(dev, "Only one of qcom,num-strings or qcom,enabled-strings" + " should be set\n"); + if (val > string_len) { + dev_err(dev, "qcom,num-strings exceeds qcom,enabled-strings\n"); + return -EINVAL; + } } =20 cfg->num_strings =3D val; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F3A7C43217 for ; Mon, 24 Jan 2022 21:46:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573180AbiAXVom (ORCPT ); Mon, 24 Jan 2022 16:44:42 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60548 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447263AbiAXVKU (ORCPT ); Mon, 24 Jan 2022 16:10:20 -0500 Received: from smtp.kernel.org (relay.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 E691261471; Mon, 24 Jan 2022 21:10:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C965CC340E5; Mon, 24 Jan 2022 21:10:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058618; bh=O3rKWbRYROdrjBDmKSVUoul83ssFRlJvdg9Jkqbc8ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dLEfl6T/auMPx3D5OKUPTSKuk6SEjjwXRV963OnudoxQ+f1UGhtb0sipZKcaoPSp3 k5Gkb3Li1p0iOSO5o/oftAdjk2URuj1psXbjHLwBYk3HJYHT9MTZZ8stDPRfFoyh7c mHycLR5Ro2rPCmlbMGIrYir0J5ZUC43Sl6RMQIuE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , AngeloGioacchino Del Regno , Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 5.16 0348/1039] backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion Date: Mon, 24 Jan 2022 19:35:37 +0100 Message-Id: <20220124184136.991896518@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit 0a139358548968b2ff308257b4fbeec7badcc3e1 ] The kernel already provides appropriate primitives to perform endianness conversion which should be used in favour of manual bit-wrangling. Signed-off-by: Marijn Suijten Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211115203459.1634079-4-marijn.suijten@som= ainline.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/video/backlight/qcom-wled.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/= qcom-wled.c index c057368e5056e..5306b06044b4f 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -231,14 +231,14 @@ struct wled { static int wled3_set_brightness(struct wled *wled, u16 brightness) { int rc, i; - u8 v[2]; + __le16 v; =20 - v[0] =3D brightness & 0xff; - v[1] =3D (brightness >> 8) & 0xf; + v =3D cpu_to_le16(brightness & WLED3_SINK_REG_BRIGHT_MAX); =20 for (i =3D 0; i < wled->cfg.num_strings; ++i) { rc =3D regmap_bulk_write(wled->regmap, wled->ctrl_addr + - WLED3_SINK_REG_BRIGHT(i), v, 2); + WLED3_SINK_REG_BRIGHT(i), + &v, sizeof(v)); if (rc < 0) return rc; } @@ -250,18 +250,18 @@ static int wled4_set_brightness(struct wled *wled, u1= 6 brightness) { int rc, i; u16 low_limit =3D wled->max_brightness * 4 / 1000; - u8 v[2]; + __le16 v; =20 /* WLED4's lower limit of operation is 0.4% */ if (brightness > 0 && brightness < low_limit) brightness =3D low_limit; =20 - v[0] =3D brightness & 0xff; - v[1] =3D (brightness >> 8) & 0xf; + v =3D cpu_to_le16(brightness & WLED3_SINK_REG_BRIGHT_MAX); =20 for (i =3D 0; i < wled->cfg.num_strings; ++i) { rc =3D regmap_bulk_write(wled->regmap, wled->sink_addr + - WLED4_SINK_REG_BRIGHT(i), v, 2); + WLED4_SINK_REG_BRIGHT(i), + &v, sizeof(v)); if (rc < 0) return rc; } @@ -273,21 +273,20 @@ static int wled5_set_brightness(struct wled *wled, u1= 6 brightness) { int rc, offset; u16 low_limit =3D wled->max_brightness * 1 / 1000; - u8 v[2]; + __le16 v; =20 /* WLED5's lower limit is 0.1% */ if (brightness < low_limit) brightness =3D low_limit; =20 - v[0] =3D brightness & 0xff; - v[1] =3D (brightness >> 8) & 0x7f; + v =3D cpu_to_le16(brightness & WLED5_SINK_REG_BRIGHT_MAX_15B); =20 offset =3D (wled->cfg.mod_sel =3D=3D MOD_A) ? WLED5_SINK_REG_MOD_A_BRIGHTNESS_LSB : WLED5_SINK_REG_MOD_B_BRIGHTNESS_LSB; =20 rc =3D regmap_bulk_write(wled->regmap, wled->sink_addr + offset, - v, 2); + &v, sizeof(v)); return rc; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FA45C41535 for ; Mon, 24 Jan 2022 23:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364246AbiAXXrE (ORCPT ); Mon, 24 Jan 2022 18:47:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356421AbiAXWz7 (ORCPT ); Mon, 24 Jan 2022 17:55:59 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3F6FC0680BF; Mon, 24 Jan 2022 13:10:23 -0800 (PST) Received: from smtp.kernel.org (relay.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 B1318B80CCF; Mon, 24 Jan 2022 21:10:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C605FC340E5; Mon, 24 Jan 2022 21:10:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058621; bh=C2yRUz42DqSxD6SVZ6vEK2YQtCMvqicsfk/FQJFLEfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ik+twVqX/IotTV0XewxqJpaxRlrtLiE2E9KxcU1TXZ7la9SgX3WJWZb1anq37zJ/m K47MdIFEfgSQFs+Bm4aDGIZrjeqpLXdcwp+BQiu7+J353jRKUZrmfRPbPO3I9BQtMU nRLNQ4uP0Qrszy2neSFafyWZCvGk/w/zRONJ6XKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , AngeloGioacchino Del Regno , Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 5.16 0349/1039] backlight: qcom-wled: Respect enabled-strings in set_brightness Date: Mon, 24 Jan 2022 19:35:38 +0100 Message-Id: <20220124184137.022224835@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit ec961cf3241153e0f27d850f1bf0f172e7d27a21 ] The hardware is capable of controlling any non-contiguous sequence of LEDs specified in the DT using qcom,enabled-strings as u32 array, and this also follows from the DT-bindings documentation. The numbers specified in this array represent indices of the LED strings that are to be enabled and disabled. Its value is appropriately used to setup and enable string modules, but completely disregarded in the set_brightness paths which only iterate over the number of strings linearly. Take an example where only string 2 is enabled with qcom,enabled_strings=3D<2>: this string is appropriately enabled but subsequent brightness changes would have only touched the zero'th brightness register because num_strings is 1 here. This is simply addressed by looking up the string for this index in the enabled_strings array just like the other codepaths that iterate over num_strings. Likewise enabled_strings is now also used in the autodetection path for consistent behaviour: when a list of strings is specified in DT only those strings will be probed for autodetection, analogous to how the number of strings that need to be probed is already bound by qcom,num-strings. After all autodetection uses the set_brightness helpers to set an initial value, which could otherwise end up changing brightness on a different set of strings. Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED= 3") Fixes: 03b2b5e86986 ("backlight: qcom-wled: Add support for WLED4 periphera= l") Signed-off-by: Marijn Suijten Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211115203459.1634079-10-marijn.suijten@so= mainline.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/video/backlight/qcom-wled.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/= qcom-wled.c index 5306b06044b4f..f12c76d6e61de 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -237,7 +237,7 @@ static int wled3_set_brightness(struct wled *wled, u16 = brightness) =20 for (i =3D 0; i < wled->cfg.num_strings; ++i) { rc =3D regmap_bulk_write(wled->regmap, wled->ctrl_addr + - WLED3_SINK_REG_BRIGHT(i), + WLED3_SINK_REG_BRIGHT(wled->cfg.enabled_strings[i]), &v, sizeof(v)); if (rc < 0) return rc; @@ -260,7 +260,7 @@ static int wled4_set_brightness(struct wled *wled, u16 = brightness) =20 for (i =3D 0; i < wled->cfg.num_strings; ++i) { rc =3D regmap_bulk_write(wled->regmap, wled->sink_addr + - WLED4_SINK_REG_BRIGHT(i), + WLED4_SINK_REG_BRIGHT(wled->cfg.enabled_strings[i]), &v, sizeof(v)); if (rc < 0) return rc; @@ -571,7 +571,7 @@ unlock_mutex: =20 static void wled_auto_string_detection(struct wled *wled) { - int rc =3D 0, i, delay_time_us; + int rc =3D 0, i, j, delay_time_us; u32 sink_config =3D 0; u8 sink_test =3D 0, sink_valid =3D 0, val; bool fault_set; @@ -618,14 +618,15 @@ static void wled_auto_string_detection(struct wled *w= led) =20 /* Iterate through the strings one by one */ for (i =3D 0; i < wled->cfg.num_strings; i++) { - sink_test =3D BIT((WLED4_SINK_REG_CURR_SINK_SHFT + i)); + j =3D wled->cfg.enabled_strings[i]; + sink_test =3D BIT((WLED4_SINK_REG_CURR_SINK_SHFT + j)); =20 /* Enable feedback control */ rc =3D regmap_write(wled->regmap, wled->ctrl_addr + - WLED3_CTRL_REG_FEEDBACK_CONTROL, i + 1); + WLED3_CTRL_REG_FEEDBACK_CONTROL, j + 1); if (rc < 0) { dev_err(wled->dev, "Failed to enable feedback for SINK %d rc =3D %d\n", - i + 1, rc); + j + 1, rc); goto failed_detect; } =20 @@ -634,7 +635,7 @@ static void wled_auto_string_detection(struct wled *wle= d) WLED4_SINK_REG_CURR_SINK, sink_test); if (rc < 0) { dev_err(wled->dev, "Failed to configure SINK %d rc=3D%d\n", - i + 1, rc); + j + 1, rc); goto failed_detect; } =20 @@ -661,7 +662,7 @@ static void wled_auto_string_detection(struct wled *wle= d) =20 if (fault_set) dev_dbg(wled->dev, "WLED OVP fault detected with SINK %d\n", - i + 1); + j + 1); else sink_valid |=3D sink_test; =20 @@ -701,15 +702,16 @@ static void wled_auto_string_detection(struct wled *w= led) /* Enable valid sinks */ if (wled->version =3D=3D 4) { for (i =3D 0; i < wled->cfg.num_strings; i++) { + j =3D wled->cfg.enabled_strings[i]; if (sink_config & - BIT(WLED4_SINK_REG_CURR_SINK_SHFT + i)) + BIT(WLED4_SINK_REG_CURR_SINK_SHFT + j)) val =3D WLED4_SINK_REG_STR_MOD_MASK; else /* Disable modulator_en for unused sink */ val =3D 0; =20 rc =3D regmap_write(wled->regmap, wled->sink_addr + - WLED4_SINK_REG_STR_MOD_EN(i), val); + WLED4_SINK_REG_STR_MOD_EN(j), val); if (rc < 0) { dev_err(wled->dev, "Failed to configure MODULATOR_EN rc=3D%d\n", rc); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FC06C4167B for ; Mon, 24 Jan 2022 23:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364186AbiAXXq4 (ORCPT ); Mon, 24 Jan 2022 18:46:56 -0500 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 S1376814AbiAXWz7 (ORCPT ); Mon, 24 Jan 2022 17:55:59 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22772C0698C1; Mon, 24 Jan 2022 13:10:26 -0800 (PST) Received: from smtp.kernel.org (relay.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 BC29BB80FA3; Mon, 24 Jan 2022 21:10:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDA15C340E5; Mon, 24 Jan 2022 21:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058624; bh=hPhM26oCQNd5VfkDgqvT9SQOy2C1lCfjkGP4zmnbAwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l2I9JPLuLvNwN3R4CAnPMN78DOmL21PUxUJIurO4A9XFY2J6W+zZhgMNW4DD2wr6P c8SdAm7T3FQKpSu6Ssobpd0dxwACeQW6DOUba+yZDR67y48HYxrTVUmhkdTQWnTTsI kAE/Qsr0GDih8an4sH4NlOK+kWBWUSu1C/4sccrc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Sakari Ailus , Daniel Scally , Heikki Krogerus , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0350/1039] software node: fix wrong node passed to find nargs_prop Date: Mon, 24 Jan 2022 19:35:39 +0100 Message-Id: <20220124184137.054641625@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Cl=C3=A9ment L=C3=A9ger [ Upstream commit c5fc5ba8b6b7bebc05e45036a33405b4c5036c2f ] nargs_prop refers to a property located in the reference that is found within the nargs property. Use the correct reference node in call to property_entry_read_int_array() to retrieve the correct nargs value. Fixes: b06184acf751 ("software node: Add software_node_get_reference_args()= ") Signed-off-by: Cl=C3=A9ment L=C3=A9ger Reviewed-by: Sakari Ailus Reviewed-by: Daniel Scally Acked-by: Heikki Krogerus Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/base/swnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 4debcea4fb12d..0a482212c7e8e 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -529,7 +529,7 @@ software_node_get_reference_args(const struct fwnode_ha= ndle *fwnode, return -ENOENT; =20 if (nargs_prop) { - error =3D property_entry_read_int_array(swnode->node->properties, + error =3D property_entry_read_int_array(ref->node->properties, nargs_prop, sizeof(u32), &nargs_prop_val, 1); if (error) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64035C47081 for ; Mon, 24 Jan 2022 23:58:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366160AbiAXXwZ (ORCPT ); Mon, 24 Jan 2022 18:52:25 -0500 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 S1356464AbiAXW4A (ORCPT ); Mon, 24 Jan 2022 17:56:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85186C0698C2; Mon, 24 Jan 2022 13:10:28 -0800 (PST) Received: from smtp.kernel.org (relay.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 24FC66141C; Mon, 24 Jan 2022 21:10:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08A66C340E5; Mon, 24 Jan 2022 21:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058627; bh=n/lcnXhgHSaRyo+ZtvUumelV6/WcgjJd3RAK8llaias=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DVXo35GjGgC2CQSs58JZnfUH8y61eJeBOgrcop1bvXhoD9RRoFZrf+7dxyocSTUqC t0htKPtPuIaiyPQITiSNn/sdAQwDLFVTAnV9EO03Qk3b0+wTOVY4NQV7TvJMaIUl79 lD3Ip8fSoqK3LtHSX9FOOaw7VghlSYHcmuWTi79g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baochen Qiang , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0351/1039] ath11k: Fix unexpected return buffer manager error for QCA6390 Date: Mon, 24 Jan 2022 19:35:40 +0100 Message-Id: <20220124184137.083494354@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baochen Qiang [ Upstream commit 71c748b5e01e3e28838a8e26a8966fb5adb03df7 ] We are seeing below error on QCA6390: ... [70211.671189] ath11k_pci 0000:72:00.0: failed to parse rx error in wbm_rel= ring desc -22 [70212.696154] ath11k_pci 0000:72:00.0: failed to parse rx error in wbm_rel= ring desc -22 [70213.092941] ath11k_pci 0000:72:00.0: failed to parse rx error in wbm_rel= ring desc -22 ... The reason is that, with commit 734223d78428 ("ath11k: change return buffer manager for QCA6390"), ath11k expects the return buffer manager (RBM) field of descriptor configured as HAL_RX_BUF_RBM_SW1_BM when parsing error frames from WBM2SW3_RELEASE ring. This is a wrong change cause the RBM field is set as HAL_RX_BUF_RBM_SW3_BM. The same issue also applies to REO2TCL ring though we have not got any error reported. Fix it by changing RBM from HAL_RX_BUF_RBM_SW1_BM to HAL_RX_BUF_RBM_SW3_BM for these two rings. Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 Fixes: 734223d78428 ("ath11k: change return buffer manager for QCA6390") Signed-off-by: Baochen Qiang Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211222013536.582527-1-quic_bqiang@quicinc= .com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +- drivers/net/wireless/ath/ath11k/hal_rx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless= /ath/ath11k/dp_rx.c index c5320847b80a7..22b6b6a470d4c 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -3800,7 +3800,7 @@ int ath11k_dp_process_rx_err(struct ath11k_base *ab, = struct napi_struct *napi, ath11k_hal_rx_msdu_link_info_get(link_desc_va, &num_msdus, msdu_cookies, &rbm); if (rbm !=3D HAL_RX_BUF_RBM_WBM_IDLE_DESC_LIST && - rbm !=3D ab->hw_params.hal_params->rx_buf_rbm) { + rbm !=3D HAL_RX_BUF_RBM_SW3_BM) { ab->soc_stats.invalid_rbm++; ath11k_warn(ab, "invalid return buffer manager %d\n", rbm); ath11k_dp_rx_link_desc_return(ab, desc, diff --git a/drivers/net/wireless/ath/ath11k/hal_rx.c b/drivers/net/wireles= s/ath/ath11k/hal_rx.c index 329c404cfa80d..922926246db7a 100644 --- a/drivers/net/wireless/ath/ath11k/hal_rx.c +++ b/drivers/net/wireless/ath/ath11k/hal_rx.c @@ -374,7 +374,7 @@ int ath11k_hal_wbm_desc_parse_err(struct ath11k_base *a= b, void *desc, =20 ret_buf_mgr =3D FIELD_GET(BUFFER_ADDR_INFO1_RET_BUF_MGR, wbm_desc->buf_addr_info.info1); - if (ret_buf_mgr !=3D ab->hw_params.hal_params->rx_buf_rbm) { + if (ret_buf_mgr !=3D HAL_RX_BUF_RBM_SW3_BM) { ab->soc_stats.invalid_rbm++; return -EINVAL; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33431C4332F for ; Mon, 24 Jan 2022 21:46:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573515AbiAXVpC (ORCPT ); Mon, 24 Jan 2022 16:45:02 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60440 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447362AbiAXVKd (ORCPT ); Mon, 24 Jan 2022 16:10:33 -0500 Received: from smtp.kernel.org (relay.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 336E6B80FA3; Mon, 24 Jan 2022 21:10:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67582C340E5; Mon, 24 Jan 2022 21:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058631; bh=w2KZk+H0QJEvW7PC3K2aXvV3aUrFbePvjqUXTQZJgbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TwDKjX1sLnaj+XEaA+euhACiwhKojaAKVMJMnQk09wenqmB3/1hpuC4ws25xNn2Wn tQHgx3YXK/jyrbglvBGhhQijLH/kHRLtJbx/RpxhOFSMsMkwsrQecjr9zb+7uBJZVT psjOorLahFUwFlYeEb8aqW+tcat7oYIllwjLUVZo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Deren Wu , Lorenzo Bianconi , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0352/1039] mt76: mt7921: fix a possible race enabling/disabling runtime-pm Date: Mon, 24 Jan 2022 19:35:41 +0100 Message-Id: <20220124184137.115148951@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit d430dffbe9dd30759f3c64b65bf85b0245c8d8ab ] Fix a possible race enabling/disabling runtime-pm between mt7921_pm_set() and mt7921_poll_rx() since mt7921_pm_wake_work() always schedules rx-napi callback and it will trigger mt7921_pm_power_save_work routine putting chip to in low-power state during mt7921_pm_set processing. Suggested-by: Deren Wu Tested-by: Deren Wu Fixes: 1d8efc741df8 ("mt76: mt7921: introduce Runtime PM support") Signed-off-by: Lorenzo Bianconi Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/0f3e075a2033dc05f09dab4059e5be8cbdccc239.16= 40094847.git.lorenzo@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 3 --- drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 12 +++++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers= /net/wireless/mediatek/mt76/mt76_connac_mac.c index af43bcb545781..306e9eaea9177 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c @@ -7,9 +7,6 @@ int mt76_connac_pm_wake(struct mt76_phy *phy, struct mt76_c= onnac_pm *pm) { struct mt76_dev *dev =3D phy->dev; =20 - if (!pm->enable) - return 0; - if (mt76_is_usb(dev)) return 0; =20 diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c b/drivers/= net/wireless/mediatek/mt76/mt7921/debugfs.c index 7cdfdf83529f6..86fd7292b229f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c @@ -276,7 +276,7 @@ mt7921_pm_set(void *data, u64 val) struct mt7921_dev *dev =3D data; struct mt76_connac_pm *pm =3D &dev->pm; =20 - mt7921_mutex_acquire(dev); + mutex_lock(&dev->mt76.mutex); =20 if (val =3D=3D pm->enable) goto out; @@ -285,7 +285,11 @@ mt7921_pm_set(void *data, u64 val) pm->stats.last_wake_event =3D jiffies; pm->stats.last_doze_event =3D jiffies; } - pm->enable =3D val; + /* make sure the chip is awake here and ps_work is scheduled + * just at end of the this routine. + */ + pm->enable =3D false; + mt76_connac_pm_wake(&dev->mphy, pm); =20 ieee80211_iterate_active_interfaces(mt76_hw(dev), IEEE80211_IFACE_ITER_RESUME_ALL, @@ -293,8 +297,10 @@ mt7921_pm_set(void *data, u64 val) =20 mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable); =20 + pm->enable =3D val; + mt76_connac_power_save_sched(&dev->mphy, pm); out: - mt7921_mutex_release(dev); + mutex_unlock(&dev->mt76.mutex); =20 return 0; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83568C43217 for ; Mon, 24 Jan 2022 21:46:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573562AbiAXVpO (ORCPT ); Mon, 24 Jan 2022 16:45:14 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34266 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447388AbiAXVKi (ORCPT ); Mon, 24 Jan 2022 16:10:38 -0500 Received: from smtp.kernel.org (relay.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 99897611C8; Mon, 24 Jan 2022 21:10:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66EA0C340E5; Mon, 24 Jan 2022 21:10:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058637; bh=kjZCPYkaoD8O3IPDj3N9+OXUTPfaBdFPnZd6whD02Vo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aLcjjV9Eb3V0gyzOtqv2o6h1mTWwvNsGnMCkfZW5aOdydln5WiKGGTXT20kqMnrog R4BbcgJKLECt2kF1OFmrVuzNJJCLfQ6263NzKegJOM3A/gCRzbN1mvWXNE1yL+Kgja hQL50vyP6iud7r+fbMeTO8wOK+pv2wRlIvvAAIss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Panicker Harish , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0353/1039] Bluetooth: hci_qca: Stop IBS timer during BT OFF Date: Mon, 24 Jan 2022 19:35:42 +0100 Message-Id: <20220124184137.148309494@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Panicker Harish [ Upstream commit df1e5c51492fd93ffc293acdcc6f00698d19fedc ] The IBS timers are not stopped properly once BT OFF is triggered. we could see IBS commands being sent along with version command, so stopped IBS timers while Bluetooth is off. Fixes: 3e4be65eb82c ("Bluetooth: hci_qca: Add poweroff support during hci d= own for wcn3990") Signed-off-by: Panicker Harish Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bluetooth/hci_qca.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index dd768a8ed7cbb..9e99311038ae8 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -1928,6 +1928,9 @@ static int qca_power_off(struct hci_dev *hdev) hu->hdev->hw_error =3D NULL; hu->hdev->cmd_timeout =3D NULL; =20 + del_timer_sync(&qca->wake_retrans_timer); + del_timer_sync(&qca->tx_idle_timer); + /* Stop sending shutdown command if soc crashes. */ if (soc_type !=3D QCA_ROME && qca->memdump_state =3D=3D QCA_MEMDUMP_IDLE) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44CD1C43219 for ; Mon, 24 Jan 2022 23:37:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360621AbiAXXhG (ORCPT ); Mon, 24 Jan 2022 18:37:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382512AbiAXW4E (ORCPT ); Mon, 24 Jan 2022 17:56:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D65E7C055AA1; Mon, 24 Jan 2022 13:10:40 -0800 (PST) Received: from smtp.kernel.org (relay.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 73AD76141C; Mon, 24 Jan 2022 21:10:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F88FC340E5; Mon, 24 Jan 2022 21:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058639; bh=3brKqyaqybEcUH8yC/phuL2yfofUBG/ciXNRmRgItE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wCBbpwPRLDpBeKMxZ+FAAPXw5/nvqvoXOut4iPIs+9v2lfbs1NUdSthNAzm4R+efT fdhAhXrF5jNH/nyYH434jIfSHs5I3uKZrJ1Tg5vzC1zAtk0N2QVps9vdWYAmFkq0N6 n/Mlq5Xwb8mm5+ffWUIm4Lad8+FWmth0MyNaTAvY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Borislav Petkov , Sasha Levin Subject: [PATCH 5.16 0354/1039] x86/boot/compressed: Move CLANG_FLAGS to beginning of KBUILD_CFLAGS Date: Mon, 24 Jan 2022 19:35:43 +0100 Message-Id: <20220124184137.179404474@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 5fe392ff9d1f7254a1fbb3f72d9893088e4d23eb ] When cross compiling i386_defconfig on an arm64 host with clang, there are a few instances of '-Waddress-of-packed-member' and '-Wgnu-variable-sized-type-not-at-end' in arch/x86/boot/compressed/, which should both be disabled with the cc-disable-warning calls in that directory's Makefile, which indicates that cc-disable-warning is failing at the point of testing these flags. The cc-disable-warning calls fail because at the point that the flags are tested, KBUILD_CFLAGS has '-march=3Di386' without $(CLANG_FLAGS), which has the '--target=3D' flag to tell clang what architecture it is targeting. Without the '--target=3D' flag, the host architecture (arm64) is used and i386 is not a valid value for '-march=3D' in that case. This error can be seen by adding some logging to try-run: clang-14: error: the clang compiler does not support '-march=3Di386' Invoking the compiler has to succeed prior to calling cc-option or cc-disable-warning in order to accurately test whether or not the flag is supported; if it doesn't, the requested flag can never be added to the compiler flags. Move $(CLANG_FLAGS) to the beginning of KBUILD_FLAGS so that any new flags that might be added in the future can be accurately tested. Fixes: d5cbd80e302d ("x86/boot: Add $(CLANG_FLAGS) to compressed KBUILD_CFL= AGS") Signed-off-by: Nathan Chancellor Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20211222163040.1961481-1-nathan@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/boot/compressed/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/M= akefile index 431bf7f846c3c..e118136460518 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -28,7 +28,11 @@ KCOV_INSTRUMENT :=3D n targets :=3D vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bi= n.lzma \ vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4 vmlinux.bin.zst =20 -KBUILD_CFLAGS :=3D -m$(BITS) -O2 +# CLANG_FLAGS must come before any cc-disable-warning or cc-option calls in +# case of cross compiling, as it has the '--target=3D' flag, which is need= ed to +# avoid errors with '-march=3Di386', and future flags may depend on the ta= rget to +# be valid. +KBUILD_CFLAGS :=3D -m$(BITS) -O2 $(CLANG_FLAGS) KBUILD_CFLAGS +=3D -fno-strict-aliasing -fPIE KBUILD_CFLAGS +=3D -Wundef KBUILD_CFLAGS +=3D -DDISABLE_BRANCH_PROFILING @@ -47,7 +51,6 @@ KBUILD_CFLAGS +=3D -D__DISABLE_EXPORTS # Disable relocation relaxation in case the link is not PIE. KBUILD_CFLAGS +=3D $(call as-option,-Wa$(comma)-mrelax-relocations=3Dno) KBUILD_CFLAGS +=3D -include $(srctree)/include/linux/hidden.h -KBUILD_CFLAGS +=3D $(CLANG_FLAGS) =20 # sev.c indirectly inludes inat-table.h which is generated during # compilation and stored in $(objtree). Add the directory to the includes = so --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 967DCC4167D for ; Mon, 24 Jan 2022 23:37:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386359AbiAXXhW (ORCPT ); Mon, 24 Jan 2022 18:37:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382592AbiAXW4D (ORCPT ); Mon, 24 Jan 2022 17:56:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59AF1C055AA2; Mon, 24 Jan 2022 13:10:45 -0800 (PST) Received: from smtp.kernel.org (relay.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 187BBB80CCF; Mon, 24 Jan 2022 21:10:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F544C340E5; Mon, 24 Jan 2022 21:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058642; bh=dK3hIHSJOFGdVBAyhBXTzS2yjHybOl79EpD320zhCR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K7h8D2FQP9GbQ4zW8Jf1nudySIkIJNUv2KCD9fnwMiCHin/UydFHqIehuE+QUYmGe Ihlm19hn9QYeossWXY+csriTUefqBa810pDGi1R3DcFAGFM59R7IBiS0i8n7Rjd+HY ITj5EM4vlYQFwtRqZjXxp/U0Qf2u8kdGf+Odoz3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0355/1039] crypto: octeontx2 - prevent underflow in get_cores_bmap() Date: Mon, 24 Jan 2022 19:35:44 +0100 Message-Id: <20220124184137.215571101@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 10371b6212bb682f13247733d6b76b91b2b80f9a ] If we're going to cap "eng_grp->g->engs_num" upper bounds then we should cap the lower bounds as well. Fixes: 43ac0b824f1c ("crypto: octeontx2 - load microcode and create engine = groups") Signed-off-by: Dan Carpenter Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c b/drivers/= crypto/marvell/octeontx2/otx2_cptpf_ucode.c index dff34b3ec09e1..7c1b92aaab398 100644 --- a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c +++ b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c @@ -29,7 +29,8 @@ static struct otx2_cpt_bitmap get_cores_bmap(struct devic= e *dev, bool found =3D false; int i; =20 - if (eng_grp->g->engs_num > OTX2_CPT_MAX_ENGINES) { + if (eng_grp->g->engs_num < 0 || + eng_grp->g->engs_num > OTX2_CPT_MAX_ENGINES) { dev_err(dev, "unsupported number of engines %d on octeontx2\n", eng_grp->g->engs_num); return bmap; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FD66C433EF for ; Mon, 24 Jan 2022 22:29:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1585700AbiAXWYs (ORCPT ); Mon, 24 Jan 2022 17:24:48 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34330 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447449AbiAXVKr (ORCPT ); Mon, 24 Jan 2022 16:10:47 -0500 Received: from smtp.kernel.org (relay.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 75E2C6146E; Mon, 24 Jan 2022 21:10:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5274DC340E5; Mon, 24 Jan 2022 21:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058645; bh=QfXVEBS5CJYobEpr5tZk3+nLG5aBcq5DD0u6HnQqvQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oxdwS3dDVPPin4pc9AgCZYH9e/5dbk/Co3qyw6hhuCr4MKf4TdSQhJEk3PHwvKeNi y5jB48n7meRhdPeOgswcbd0RizUJxjv7W5fQ/pcypZskSCWQjfZzDoNCAqKeWFJXdL EZbql0VzYYp6nf/N80mIUAIZ8/cs8do1iBonEfbY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shinichiro Kawasaki , Ming Lei , Jens Axboe , Sasha Levin Subject: [PATCH 5.16 0356/1039] block: null_blk: only set set->nr_maps as 3 if active poll_queues is > 0 Date: Mon, 24 Jan 2022 19:35:45 +0100 Message-Id: <20220124184137.245958548@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Lei [ Upstream commit 19768f80cf23834e65482f1667ff54192d469fee ] It isn't correct to set set->nr_maps as 3 if g_poll_queues is > 0 since we can change it via configfs for null_blk device created there, so only set it as 3 if active poll_queues is > 0. Fixes divide zero exception reported by Shinichiro. Fixes: 2bfdbe8b7ebd ("null_blk: allow zero poll queues") Reported-by: Shinichiro Kawasaki Signed-off-by: Ming Lei Reviewed-by: Shin'ichiro Kawasaki Link: https://lore.kernel.org/r/20211224010831.1521805-1-ming.lei@redhat.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/block/null_blk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index fc1317060db54..e23aac1a83f73 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -1891,7 +1891,7 @@ static int null_init_tag_set(struct nullb *nullb, str= uct blk_mq_tag_set *set) if (g_shared_tag_bitmap) set->flags |=3D BLK_MQ_F_TAG_HCTX_SHARED; set->driver_data =3D nullb; - if (g_poll_queues) + if (poll_queues) set->nr_maps =3D 3; else set->nr_maps =3D 1; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AC83C35274 for ; Mon, 24 Jan 2022 23:37:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360637AbiAXXhI (ORCPT ); Mon, 24 Jan 2022 18:37:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382519AbiAXW4D (ORCPT ); Mon, 24 Jan 2022 17:56:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4457AC055AA3; Mon, 24 Jan 2022 13:10:51 -0800 (PST) Received: from smtp.kernel.org (relay.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 010F2B8121C; Mon, 24 Jan 2022 21:10:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F551C340E5; Mon, 24 Jan 2022 21:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058648; bh=3Fu7+CpOM2je09bja5KFR0o3WRmslcWj3YAGQSVyIFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hd2uPuG6f380x4G1oKDviaDJyiSvLbpPX4upUnxzhrJg7JgDwpoNH55TWhf4jqg8m 6vgHfGfda9mEGxjbh+cPOJEFPO8j0cGEURXvVvX0Xckv51Fqvjz9WVqimmVqxp4+z9 Pqm2MoLICdSVsAOVmVXTKimbctWIVD15qkNvFQ1g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , AngeloGioacchino Del Regno , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0357/1039] regulator: qcom-labibb: OCP interrupts are not a failure while disabled Date: Mon, 24 Jan 2022 19:35:46 +0100 Message-Id: <20220124184137.282853958@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit d27bb69dc83f00f86a830298c967052cded6e784 ] Receiving the Over-Current Protection interrupt while the regulator is disabled does not count as unhandled/failure (IRQ_NONE, or 0 as it were) but a "fake event", usually due to inrush as the is regulator about to be enabled. Fixes: 390af53e0411 ("regulator: qcom-labibb: Implement short-circuit and o= ver-current IRQs") Signed-off-by: Marijn Suijten Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20211224113450.107958-1-marijn.suijten@soma= inline.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/regulator/qcom-labibb-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/qcom-labibb-regulator.c b/drivers/regulator/= qcom-labibb-regulator.c index b3da0dc58782f..639b71eb41ffe 100644 --- a/drivers/regulator/qcom-labibb-regulator.c +++ b/drivers/regulator/qcom-labibb-regulator.c @@ -260,7 +260,7 @@ static irqreturn_t qcom_labibb_ocp_isr(int irq, void *c= hip) =20 /* If the regulator is not enabled, this is a fake event */ if (!ops->is_enabled(vreg->rdev)) - return 0; + return IRQ_HANDLED; =20 /* If we tried to recover for too many times it's not getting better */ if (vreg->ocp_irq_count > LABIBB_MAX_OCP_COUNT) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52AF0C433F5 for ; Mon, 24 Jan 2022 22:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583920AbiAXWYe (ORCPT ); Mon, 24 Jan 2022 17:24:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33222 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447494AbiAXVKy (ORCPT ); Mon, 24 Jan 2022 16:10:54 -0500 Received: from smtp.kernel.org (relay.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 E6DF3B81188; Mon, 24 Jan 2022 21:10:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2131AC340E5; Mon, 24 Jan 2022 21:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058651; bh=Qu5Alj4np2rsmPwZeeQ8YmvOKti3I/KQtYcIQZVE/lg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fUP2AVij7c2Xsm7xFdcw0iy9aHiWf2C+Ke2GdmXzGj6JfbtWk0xLrU3YEuslLQeve AQ/vNW/NcNaky9FYJiamclKpd9HUJmEV9UYFWUJFEZC9MH4b5Lb9jObV8IGKq2edZi KDsCP+JNI7LtBAHXXo6Titd1K7OftpiWvYIoV56U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arseny Demidov , Guenter Roeck , Sasha Levin Subject: [PATCH 5.16 0358/1039] hwmon: (mr75203) fix wrong power-up delay value Date: Mon, 24 Jan 2022 19:35:47 +0100 Message-Id: <20220124184137.315192428@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arseny Demidov [ Upstream commit a8d6d4992ad9d92356619ac372906bd29687bb46 ] In the file mr75203.c we have a macro named POWER_DELAY_CYCLE_256, the correct value should be 0x100. The register ip_tmr is expressed in units of IP clk cycles, in accordance with the datasheet. Typical power-up delays for Temperature Sensor are 256 cycles i.e. 0x100. Fixes: 9d823351a337 ("hwmon: Add hardware monitoring driver for Moortec MR7= 5203 PVT controller") Signed-off-by: Arseny Demidov Link: https://lore.kernel.org/r/20211219102239.1112-1-a.demidov@yadro.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hwmon/mr75203.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c index 868243dba1ee0..1ba1e31459690 100644 --- a/drivers/hwmon/mr75203.c +++ b/drivers/hwmon/mr75203.c @@ -93,7 +93,7 @@ #define VM_CH_REQ BIT(21) =20 #define IP_TMR 0x05 -#define POWER_DELAY_CYCLE_256 0x80 +#define POWER_DELAY_CYCLE_256 0x100 #define POWER_DELAY_CYCLE_64 0x40 =20 #define PVT_POLL_DELAY_US 20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16241C433FE for ; Mon, 24 Jan 2022 23:37:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360570AbiAXXhB (ORCPT ); Mon, 24 Jan 2022 18:37:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382645AbiAXW4E (ORCPT ); Mon, 24 Jan 2022 17:56:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A21B3C055AA4; Mon, 24 Jan 2022 13:10:55 -0800 (PST) Received: from smtp.kernel.org (relay.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 35C5F6141C; Mon, 24 Jan 2022 21:10:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 140B8C340E5; Mon, 24 Jan 2022 21:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058654; bh=LMcJzmhZ16w/aeOwg1sAK9yzJhMtOiwmj70gGTRHMjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XB44q84o9gU3n3jXu1cyh7205M5nbcsfMxhVkilSFqp1sRjK33oUCwAxuHsmHwYbG /g4A7Zew7PyJTT8awptb2wLEf6Oz9deCQ32/uwaVy2+9A3yF5ynd+TE6PHNo+l+Zon 7q2+F8t5tuX5AECsFXrFTjd7S5ePxKrdhq+PerwY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Zixun , Borislav Petkov , Sasha Levin Subject: [PATCH 5.16 0359/1039] x86/mce/inject: Avoid out-of-bounds write when setting flags Date: Mon, 24 Jan 2022 19:35:48 +0100 Message-Id: <20220124184137.348537290@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Zixun [ Upstream commit de768416b203ac84e02a757b782a32efb388476f ] A contrived zero-length write, for example, by using write(2): ... ret =3D write(fd, str, 0); ... to the "flags" file causes: BUG: KASAN: stack-out-of-bounds in flags_write Write of size 1 at addr ffff888019be7ddf by task writefile/3787 CPU: 4 PID: 3787 Comm: writefile Not tainted 5.16.0-rc7+ #12 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/0= 1/2014 due to accessing buf one char before its start. Prevent such out-of-bounds access. [ bp: Productize into a proper patch. Link below is the next best thing because the original mail didn't get archived on lore. ] Fixes: 0451d14d0561 ("EDAC, mce_amd_inj: Modify flags attribute to use stri= ng arguments") Signed-off-by: Zhang Zixun Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/linux-edac/YcnePfF1OOqoQwrX@zn.tnic/ Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/cpu/mce/inject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inj= ect.c index 0bfc14041bbb4..b63b548497c14 100644 --- a/arch/x86/kernel/cpu/mce/inject.c +++ b/arch/x86/kernel/cpu/mce/inject.c @@ -350,7 +350,7 @@ static ssize_t flags_write(struct file *filp, const cha= r __user *ubuf, char buf[MAX_FLAG_OPT_SIZE], *__buf; int err; =20 - if (cnt > MAX_FLAG_OPT_SIZE) + if (!cnt || cnt > MAX_FLAG_OPT_SIZE) return -EINVAL; =20 if (copy_from_user(&buf, ubuf, cnt)) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69E55C433F5 for ; Mon, 24 Jan 2022 22:19:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583562AbiAXWTL (ORCPT ); Mon, 24 Jan 2022 17:19:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33262 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447576AbiAXVLB (ORCPT ); Mon, 24 Jan 2022 16:11:01 -0500 Received: from smtp.kernel.org (relay.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 7AB6DB80CCF; Mon, 24 Jan 2022 21:10:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96285C340E5; Mon, 24 Jan 2022 21:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058658; bh=wAh/haiJ/v7tO3dGBFHipa7wk5ZBATtCVmv/QRDmjlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZHBm5h7DyYvZtj1ubjO+D64krLdqm1y28c4KqGf8L3FHfFcIdaST4FM8BawavJF6/ G5Bnmj28niCIGBbDmUik/v6hKB2UXjWnthYWtwSeBKWmFNRadMXTOXh35Tv1D+DBwr 5kUt/4mlQVn6tZTDZQl6AQZlBQ2evnrfUW2UoWng= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe , Sasha Levin Subject: [PATCH 5.16 0360/1039] io_uring: remove double poll on poll update Date: Mon, 24 Jan 2022 19:35:49 +0100 Message-Id: <20220124184137.379491661@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Begunkov [ Upstream commit e840b4baf3cfb37e2ead4f649a45bb78178677ff ] Before updating a poll request we should remove it from poll queues, including the double poll entry. Fixes: b69de288e913 ("io_uring: allow events and user_data update of runnin= g poll requests") Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/ac39e7f80152613603b8a6cc29a2b6063ac2434f.16= 39605189.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/io_uring.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/io_uring.c b/fs/io_uring.c index fb2a0cb4aaf83..72496f424c155 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5928,6 +5928,7 @@ static int io_poll_update(struct io_kiocb *req, unsig= ned int issue_flags) * update those. For multishot, if we're racing with completion, just * let completion re-add it. */ + io_poll_remove_double(preq); completing =3D !__io_poll_remove_one(preq, &preq->poll, false); if (completing && (preq->poll.events & EPOLLONESHOT)) { ret =3D -EALREADY; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 461E0C433EF for ; Mon, 24 Jan 2022 22:19:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347994AbiAXWSn (ORCPT ); Mon, 24 Jan 2022 17:18:43 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33280 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447592AbiAXVLD (ORCPT ); Mon, 24 Jan 2022 16:11:03 -0500 Received: from smtp.kernel.org (relay.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 882A8B8122A; Mon, 24 Jan 2022 21:11:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A394C340E5; Mon, 24 Jan 2022 21:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058661; bh=19hz3DN36gB56Klljxe2nsrN2tOxcnraYLZOEAd9hso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YmPnuL5Roko1PNAA3VsHj4WTMADlWBXBMYf3cMt6Xea1uG6mnbaYtdPaMOKKWdE4x WdOkCiqcFQpXG5ztfHliRjM2TkRvwbh87uqPTOlME+/PuhaHhKR1zrcOmSrWLiZVC5 H9JRdGpmCYSXaeL1vA4Z2umyT6OTJg3IlBEqmPsM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, TCS Robot , Haimin Zhang , Alexei Starovoitov , Joanne Koong , Sasha Levin Subject: [PATCH 5.16 0361/1039] bpf: Add missing map_get_next_key method to bloom filter map. Date: Mon, 24 Jan 2022 19:35:50 +0100 Message-Id: <20220124184137.412435046@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haimin Zhang [ Upstream commit 3ccdcee28415c4226de05438b4d89eb5514edf73 ] Without it, kernel crashes in map_get_next_key(). Fixes: 9330986c0300 ("bpf: Add bloom filter map implementation") Reported-by: TCS Robot Signed-off-by: Haimin Zhang Signed-off-by: Alexei Starovoitov Acked-by: Joanne Koong Link: https://lore.kernel.org/bpf/1640776802-22421-1-git-send-email-tcs.ker= nel@gmail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/bpf/bloom_filter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/bpf/bloom_filter.c b/kernel/bpf/bloom_filter.c index 277a05e9c9849..b141a1346f72d 100644 --- a/kernel/bpf/bloom_filter.c +++ b/kernel/bpf/bloom_filter.c @@ -82,6 +82,11 @@ static int bloom_map_delete_elem(struct bpf_map *map, vo= id *value) return -EOPNOTSUPP; } =20 +static int bloom_map_get_next_key(struct bpf_map *map, void *key, void *ne= xt_key) +{ + return -EOPNOTSUPP; +} + static struct bpf_map *bloom_map_alloc(union bpf_attr *attr) { u32 bitset_bytes, bitset_mask, nr_hash_funcs, nr_bits; @@ -192,6 +197,7 @@ const struct bpf_map_ops bloom_filter_map_ops =3D { .map_meta_equal =3D bpf_map_meta_equal, .map_alloc =3D bloom_map_alloc, .map_free =3D bloom_map_free, + .map_get_next_key =3D bloom_map_get_next_key, .map_push_elem =3D bloom_map_push_elem, .map_peek_elem =3D bloom_map_peek_elem, .map_pop_elem =3D bloom_map_pop_elem, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E09A7C35275 for ; Mon, 24 Jan 2022 23:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360605AbiAXXhF (ORCPT ); Mon, 24 Jan 2022 18:37:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382589AbiAXW4E (ORCPT ); Mon, 24 Jan 2022 17:56:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CABBC055AA5; Mon, 24 Jan 2022 13:11:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 1B42F61469; Mon, 24 Jan 2022 21:11:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCEE3C340E5; Mon, 24 Jan 2022 21:11:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058664; bh=2BQlgnQsNwEwfMzcRqMA7YHREraPyfZU8xrRYkLHLTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y143LeyqjIO+aQNMWbs3xBKNlT8WooTvoQxFGMfLanofKX0DfidKuOrpYBhCUsV83 77ycAYuG0EYeS0UluziiosRXDN6v1tR0uLEDOqO0aRXzfWRPyJwRj+YCpBP/mKOHW1 6uUNbQn8JQwFTnJtS8wrUBadC2ewaLQf/gTmVJiM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Lad Prabhakar , Sasha Levin Subject: [PATCH 5.16 0362/1039] serial: 8250_bcm7271: Propagate error codes from brcmuart_probe() Date: Mon, 24 Jan 2022 19:35:51 +0100 Message-Id: <20220124184137.453861148@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit c195438f1e84de8fa46b4f5264d12379bee6e9a1 ] In case of failures brcmuart_probe() always returned -ENODEV, this isn't correct for example platform_get_irq_byname() may return -EPROBE_DEFER to handle such cases propagate error codes in brcmuart_probe() in case of failures. Fixes: 41a469482de25 ("serial: 8250: Add new 8250-core based Broadcom STB d= river") Acked-by: Florian Fainelli Signed-off-by: Lad Prabhakar Link: https://lore.kernel.org/r/20211224142917.6966-4-prabhakar.mahadev-lad= .rj@bp.renesas.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/8250/8250_bcm7271.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/82= 50/8250_bcm7271.c index 5163d60756b73..0877cf24f7de0 100644 --- a/drivers/tty/serial/8250/8250_bcm7271.c +++ b/drivers/tty/serial/8250/8250_bcm7271.c @@ -1076,14 +1076,18 @@ static int brcmuart_probe(struct platform_device *p= dev) priv->rx_bufs =3D dma_alloc_coherent(dev, priv->rx_size, &priv->rx_addr, GFP_KERNEL); - if (!priv->rx_bufs) + if (!priv->rx_bufs) { + ret =3D -EINVAL; goto err; + } priv->tx_size =3D UART_XMIT_SIZE; priv->tx_buf =3D dma_alloc_coherent(dev, priv->tx_size, &priv->tx_addr, GFP_KERNEL); - if (!priv->tx_buf) + if (!priv->tx_buf) { + ret =3D -EINVAL; goto err; + } } =20 ret =3D serial8250_register_8250_port(&up); @@ -1097,6 +1101,7 @@ static int brcmuart_probe(struct platform_device *pde= v) if (priv->dma_enabled) { dma_irq =3D platform_get_irq_byname(pdev, "dma"); if (dma_irq < 0) { + ret =3D dma_irq; dev_err(dev, "no IRQ resource info\n"); goto err1; } @@ -1116,7 +1121,7 @@ err1: err: brcmuart_free_bufs(dev, priv); brcmuart_arbitration(priv, 0); - return -ENODEV; + return ret; } =20 static int brcmuart_remove(struct platform_device *pdev) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1056C4167E for ; Mon, 24 Jan 2022 23:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360588AbiAXXhD (ORCPT ); Mon, 24 Jan 2022 18:37:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382661AbiAXW4E (ORCPT ); Mon, 24 Jan 2022 17:56:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44224C055AA9; Mon, 24 Jan 2022 13:11:13 -0800 (PST) Received: from smtp.kernel.org (relay.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 0AC59B8123A; Mon, 24 Jan 2022 21:11:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EE66C340E5; Mon, 24 Jan 2022 21:11:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058670; bh=Wjq8KJMxSK1M36zLBibg6MlMLF1ZI3aYOkSq2/bc0Lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Msj8iebwpRksyHWuDo3gNlIS4uHSMK0Z6e4RBWjLLu17+NE16jxMKzeVyh78ClQNJ 55dsENO4COZD3ZxAcL/wVlt2IaI2jc/mlngn/iZwUqKZCcpsvRfUjyqUTmflWgK77v HmJ0cT5W/V3v2ceUh7SEL3Y24wuTiM2dmGOjv+EY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Harry Wentland , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0363/1039] drm/amd/display: fix dereference before NULL check Date: Mon, 24 Jan 2022 19:35:52 +0100 Message-Id: <20220124184137.484891008@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit f28cad86ada1a7345d7bbd379bef5a8babfa791b ] The "plane_state" pointer was access before checking if it was NULL. Avoid a possible NULL pointer dereference by accessing the plane address after the check. Addresses-Coverity-ID: 1493892 ("Dereference before null check") Fixes: 3f68c01be9a22 ("drm/amd/display: add cyan_skillfish display support") Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Reviewed-by: Harry Wentland Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c b/drivers= /gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c index cfd09b3f705e9..fe22530242d2e 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c @@ -134,11 +134,12 @@ void dcn201_update_plane_addr(const struct dc *dc, st= ruct pipe_ctx *pipe_ctx) PHYSICAL_ADDRESS_LOC addr; struct dc_plane_state *plane_state =3D pipe_ctx->plane_state; struct dce_hwseq *hws =3D dc->hwseq; - struct dc_plane_address uma =3D plane_state->address; + struct dc_plane_address uma; =20 if (plane_state =3D=3D NULL) return; =20 + uma =3D plane_state->address; addr_patched =3D patch_address_for_sbs_tb_stereo(pipe_ctx, &addr); =20 plane_address_in_gpu_space_to_uma(hws, &uma); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEBE9C433EF for ; Mon, 24 Jan 2022 23:57:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366038AbiAXXwM (ORCPT ); Mon, 24 Jan 2022 18:52:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354678AbiAXW4K (ORCPT ); Mon, 24 Jan 2022 17:56:10 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEE0FC055AAB; Mon, 24 Jan 2022 13:11:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 7346F6141C; Mon, 24 Jan 2022 21:11:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5024DC340E5; Mon, 24 Jan 2022 21:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058673; bh=MR0DDHmEUnRhfhkZtXdtcXdk3sQQ2ZdHmzsTEcDQPNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gjXCB/wkjjsm/soO9GkVM5v4pys5Ie/C50DMxeyUihlJ5WgFbQg5bRbh6Ck+aO1++ P8yFGFpN8YY688vH8YpzbSt1KDE4xkRaSgBFwAxtgwFcxsUUTTfknDlTgxZcS8netI OzabdorQcoyoL21PlXK326g3hRuTiYN2xKHRzAoY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0364/1039] ACPI: scan: Create platform device for BCM4752 and LNV4752 ACPI nodes Date: Mon, 24 Jan 2022 19:35:53 +0100 Message-Id: <20220124184137.521769259@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit f85196bdd5a50da74670250564740fc852b3c239 ] BCM4752 and LNV4752 ACPI nodes describe a Broadcom 4752 GPS module attached to an UART of the system. The GPS modules talk a custom protocol which only works with a closed- source Android gpsd daemon which knows this protocol. The ACPI nodes also describe GPIOs to turn the GPS on/off these are handled by the net/rfkill/rfkill-gpio.c code. This handling predates the addition of enumeration of ACPI instantiated serdevs to the kernel and was broken by that addition, because the ACPI scan code now no longer instantiates platform_device-s for these nodes. Rename the i2c_multi_instantiate_ids HID list to ignore_serial_bus_ids and add the BCM4752 and LNV4752 HIDs, so that rfkill-gpio gets a platform_device to bind to again; and so that a tty cdev for gpsd gets created for these. Fixes: e361d1f85855 ("ACPI / scan: Fix enumeration for special UART devices= ") Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/scan.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 2c80765670bc7..25d9f04f19959 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1695,6 +1695,7 @@ static bool acpi_device_enumeration_by_parent(struct = acpi_device *device) { struct list_head resource_list; bool is_serial_bus_slave =3D false; + static const struct acpi_device_id ignore_serial_bus_ids[] =3D { /* * These devices have multiple I2cSerialBus resources and an i2c-client * must be instantiated for each, each with its own i2c_device_id. @@ -1703,11 +1704,18 @@ static bool acpi_device_enumeration_by_parent(struc= t acpi_device *device) * drivers/platform/x86/i2c-multi-instantiate.c driver, which knows * which i2c_device_id to use for each resource. */ - static const struct acpi_device_id i2c_multi_instantiate_ids[] =3D { {"BSG1160", }, {"BSG2150", }, {"INT33FE", }, {"INT3515", }, + /* + * HIDs of device with an UartSerialBusV2 resource for which userspace + * expects a regular tty cdev to be created (instead of the in kernel + * serdev) and which have a kernel driver which expects a platform_dev + * such as the rfkill-gpio driver. + */ + {"BCM4752", }, + {"LNV4752", }, {} }; =20 @@ -1721,8 +1729,7 @@ static bool acpi_device_enumeration_by_parent(struct = acpi_device *device) fwnode_property_present(&device->fwnode, "baud"))) return true; =20 - /* Instantiate a pdev for the i2c-multi-instantiate drv to bind to */ - if (!acpi_match_device_ids(device, i2c_multi_instantiate_ids)) + if (!acpi_match_device_ids(device, ignore_serial_bus_ids)) return false; =20 INIT_LIST_HEAD(&resource_list); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FFBFC43217 for ; Mon, 24 Jan 2022 22:19:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352052AbiAXWSf (ORCPT ); Mon, 24 Jan 2022 17:18:35 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34740 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447700AbiAXVLT (ORCPT ); Mon, 24 Jan 2022 16:11:19 -0500 Received: from smtp.kernel.org (relay.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 B5A9B60C60; Mon, 24 Jan 2022 21:11:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77ABBC340E8; Mon, 24 Jan 2022 21:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058678; bh=ywvwEwdbHU5wOPoIxh/ANzlr4vblBlzIaHREvpeMLtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CMNddaEn+ze8RCt3al5tdxZ23GZPcgQeGMqI4TmKhD5ScQwhZTbjxltfVZJ6kaM/L Znu/obZHuV/W9ktRFMf7FfErT2A2YH2JcoLI1oqMRYOQgzDhtCBp70gHNoIuulGtwO qz4ZY5fxpqhDuvvJtxl2fRpCbR0XRG7l9fX7/Yeg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Dominik Brodowski , Sasha Levin Subject: [PATCH 5.16 0365/1039] pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in __nonstatic_find_io_region() Date: Mon, 24 Jan 2022 19:35:54 +0100 Message-Id: <20220124184137.551740940@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit ca0fe0d7c35c97528bdf621fdca75f13157c27af ] In __nonstatic_find_io_region(), pcmcia_make_resource() is assigned to res and used in pci_bus_alloc_resource(). There is a dereference of res in pci_bus_alloc_resource(), which could lead to a NULL pointer dereference on failure of pcmcia_make_resource(). Fix this bug by adding a check of res. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_PCCARD_NONSTATIC=3Dy show no new warnings, and our static analyzer no longer warns about this code. Fixes: 49b1153adfe1 ("pcmcia: move all pcmcia_resource_ops providers into o= ne module") Signed-off-by: Zhou Qingyang [linux@dominikbrodowski.net: Fix typo in commit message] Signed-off-by: Dominik Brodowski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pcmcia/rsrc_nonstatic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstati= c.c index bb15a8bdbaab5..827ca6e9ee54a 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -690,6 +690,9 @@ static struct resource *__nonstatic_find_io_region(stru= ct pcmcia_socket *s, unsigned long min =3D base; int ret; =20 + if (!res) + return NULL; + data.mask =3D align - 1; data.offset =3D base & data.mask; data.map =3D &s_data->io_db; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0F88C4321E for ; Mon, 24 Jan 2022 22:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586800AbiAXW1V (ORCPT ); Mon, 24 Jan 2022 17:27:21 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33426 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447726AbiAXVLY (ORCPT ); Mon, 24 Jan 2022 16:11:24 -0500 Received: from smtp.kernel.org (relay.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 666F8B8105C; Mon, 24 Jan 2022 21:11:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 915CCC340E5; Mon, 24 Jan 2022 21:11:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058681; bh=HDH01BdQbtjtxDwLkE394xgNnK/+LbYUX8kUZZULQ84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kYz2fBU99AXAyEVKfL7qlu4e0FamZrNlc6uHgWL46wNGxlH3PHKlYHEH5beq/UTro xxGOgZNrBWgfrl6YOd0eI5uNwYWaO3YNZQhgIJkRpPSER+IHDEhX0DMAD492AC/WHF 3WAIgxpC2yjGiDIUHHk7ztgycCFpfVlgdxwxKAbU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Dominik Brodowski , Sasha Levin Subject: [PATCH 5.16 0366/1039] pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in nonstatic_find_mem_region() Date: Mon, 24 Jan 2022 19:35:55 +0100 Message-Id: <20220124184137.590156427@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit 977d2e7c63c3d04d07ba340b39987742e3241554 ] In nonstatic_find_mem_region(), pcmcia_make_resource() is assigned to res and used in pci_bus_alloc_resource(). There a dereference of res in pci_bus_alloc_resource(), which could lead to a NULL pointer dereference on failure of pcmcia_make_resource(). Fix this bug by adding a check of res. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_PCCARD_NONSTATIC=3Dy show no new warnings, and our static analyzer no longer warns about this code. Fixes: 49b1153adfe1 ("pcmcia: move all pcmcia_resource_ops providers into o= ne module") Signed-off-by: Zhou Qingyang Signed-off-by: Dominik Brodowski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pcmcia/rsrc_nonstatic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstati= c.c index 827ca6e9ee54a..1cac528707111 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -812,6 +812,9 @@ static struct resource *nonstatic_find_mem_region(u_lon= g base, u_long num, unsigned long min, max; int ret, i, j; =20 + if (!res) + return NULL; + low =3D low || !(s->features & SS_CAP_PAGE_REGS); =20 data.mask =3D align - 1; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F677C4167B for ; Mon, 24 Jan 2022 22:30:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586780AbiAXW1T (ORCPT ); Mon, 24 Jan 2022 17:27:19 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33566 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447749AbiAXVLZ (ORCPT ); Mon, 24 Jan 2022 16:11:25 -0500 Received: from smtp.kernel.org (relay.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 261EC61469; Mon, 24 Jan 2022 21:11:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D338C340E5; Mon, 24 Jan 2022 21:11:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058684; bh=38QJKayBH1t+mBmsiqgcjzBj6O8WHMCZs2mmLV6jwwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=waw/eDPTsH/Chl2wRlToDbxGqaLUHbiBBcd2COlRECu4qNNLeD/d1xV68vuUTdhDd ukPhJ1Hvvd5e4Fvh+skoXhfmj0uO2R9+rVf49d395WjrYCha4tgmQ2RsfYw3LZjJ68 FM54uUd8UWyOgXZOiaeeLg9s0shdFmAgw5qnoOGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.16 0367/1039] power: reset: mt6397: Check for null res pointer Date: Mon, 24 Jan 2022 19:35:56 +0100 Message-Id: <20220124184137.630019912@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 1c1348bf056dee665760a3bd1cd30b0be7554fc2 ] The return value of platform_get_resource() needs to be checked. To avoid use of error pointer in case that there is no suitable resource. Fixes: d28c74c10751 ("power: reset: add driver for mt6323 poweroff") Signed-off-by: Jiasheng Jiang Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/power/reset/mt6323-poweroff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/power/reset/mt6323-poweroff.c b/drivers/power/reset/mt= 6323-poweroff.c index 0532803e6cbc4..d90e76fcb9383 100644 --- a/drivers/power/reset/mt6323-poweroff.c +++ b/drivers/power/reset/mt6323-poweroff.c @@ -57,6 +57,9 @@ static int mt6323_pwrc_probe(struct platform_device *pdev) return -ENOMEM; =20 res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + pwrc->base =3D res->start; pwrc->regmap =3D mt6397_chip->regmap; pwrc->dev =3D &pdev->dev; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14DA1C433F5 for ; Mon, 24 Jan 2022 23:38:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386284AbiAXXi3 (ORCPT ); Mon, 24 Jan 2022 18:38:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841795AbiAXXAC (ORCPT ); Mon, 24 Jan 2022 18:00:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 688DAC09D313; Mon, 24 Jan 2022 13:13:37 -0800 (PST) Received: from smtp.kernel.org (relay.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 05D8E61513; Mon, 24 Jan 2022 21:13:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD993C340E5; Mon, 24 Jan 2022 21:13:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058816; bh=g5jYcDdJTtAaQIzC6WDSvOuOlk9FXh7FUac05QGiE4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0opCvy+WAXd8BVVnovJKlIXyhX4GKDxcLBZ2g8joOodK1Vch/OebnQKWh2Qxg6Jr1 STm1mz2GD0HLBmnvlRFpi9flihbe6AjW8y90PzuEv66KJBAYn5CCHLFD1CLtY0XV1A CFUkIRt/ARf74Hc3yNwltyhp/rTno3vpPFEnP6z8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raed Salem , Steffen Klassert , Sasha Levin Subject: [PATCH 5.16 0368/1039] net/xfrm: IPsec tunnel mode fix inner_ipproto setting in sec_path Date: Mon, 24 Jan 2022 19:35:57 +0100 Message-Id: <20220124184137.667754585@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Raed Salem [ Upstream commit 45a98ef4922def8c679ca7c454403d1957fe70e7 ] The inner_ipproto saves the inner IP protocol of the plain text packet. This allows vendor's IPsec feature making offload decision at skb's features_check and configuring hardware at ndo_start_xmit, current code implenetation did not handle the case where IPsec is used in tunnel mode. Fix by handling the case when IPsec is used in tunnel mode by reading the protocol of the plain text packet IP protocol. Fixes: fa4535238fb5 ("net/xfrm: Add inner_ipproto into sec_path") Signed-off-by: Raed Salem Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/xfrm/xfrm_output.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index 229544bc70c21..4dc4a7bbe51cf 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c @@ -647,10 +647,12 @@ static int xfrm_output_gso(struct net *net, struct so= ck *sk, struct sk_buff *skb * This requires hardware to know the inner packet type to calculate * the inner header checksum. Save inner ip protocol here to avoid * traversing the packet in the vendor's xmit code. - * If the encap type is IPIP, just save skb->inner_ipproto. Otherwise, - * get the ip protocol from the IP header. + * For IPsec tunnel mode save the ip protocol from the IP header of the + * plain text packet. Otherwise If the encap type is IPIP, just save + * skb->inner_ipproto in any other case get the ip protocol from the IP + * header. */ -static void xfrm_get_inner_ipproto(struct sk_buff *skb) +static void xfrm_get_inner_ipproto(struct sk_buff *skb, struct xfrm_state = *x) { struct xfrm_offload *xo =3D xfrm_offload(skb); const struct ethhdr *eth; @@ -658,6 +660,25 @@ static void xfrm_get_inner_ipproto(struct sk_buff *skb) if (!xo) return; =20 + if (x->outer_mode.encap =3D=3D XFRM_MODE_TUNNEL) { + switch (x->outer_mode.family) { + case AF_INET: + xo->inner_ipproto =3D ip_hdr(skb)->protocol; + break; + case AF_INET6: + xo->inner_ipproto =3D ipv6_hdr(skb)->nexthdr; + break; + default: + break; + } + + return; + } + + /* non-Tunnel Mode */ + if (!skb->encapsulation) + return; + if (skb->inner_protocol_type =3D=3D ENCAP_TYPE_IPPROTO) { xo->inner_ipproto =3D skb->inner_ipproto; return; @@ -712,8 +733,7 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb) sp->xvec[sp->len++] =3D x; xfrm_state_hold(x); =20 - if (skb->encapsulation) - xfrm_get_inner_ipproto(skb); + xfrm_get_inner_ipproto(skb, x); skb->encapsulation =3D 1; =20 if (skb_is_gso(skb)) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF7D3C433F5 for ; Mon, 24 Jan 2022 23:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362298AbiAXXmK (ORCPT ); Mon, 24 Jan 2022 18:42:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841093AbiAXW5g (ORCPT ); Mon, 24 Jan 2022 17:57:36 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17FE9C055ABD; Mon, 24 Jan 2022 13:11:51 -0800 (PST) Received: from smtp.kernel.org (relay.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 D55EAB8121C; Mon, 24 Jan 2022 21:11:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4F6FC340E8; Mon, 24 Jan 2022 21:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058708; bh=50E6Rx/1hjD8ce3GLxo312lfRaJ+k/VnmDjEgimOyp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YzRyBZR/aZlM+3FYFPcDckYcClD3Vz4I2PNT4Yph8Z7SpFhvXwCR1pU1pXTzq8rsV TO43SSbwfX3+nfbB6GYSP7XEzfJhrppAdHaH4bdhr32PHQvhL+shOvYKohKOBD6YHt GIPFXiwVlX2HJo2eH8vo1u2BCy0lUrM22Sf9JafY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Golle , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0369/1039] net: ethernet: mtk_eth_soc: fix return values and refactor MDIO ops Date: Mon, 24 Jan 2022 19:35:58 +0100 Message-Id: <20220124184137.699085044@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Golle [ Upstream commit eda80b249df7bbc7b3dd13907343a3e59bfc57fd ] Instead of returning -1 (-EPERM) when MDIO bus is stuck busy while writing or 0xffff if it happens while reading, return the appropriate -ETIMEDOUT. Also fix return type to int instead of u32. Refactor functions to use bitfield helpers instead of having various masking and shifting constants in the code, which also results in the register definitions in the header file being more obviously related to what is stated in the MediaTek's Reference Manual. Fixes: 656e705243fd0 ("net-next: mediatek: add support for MT7623 ethernet") Signed-off-by: Daniel Golle Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 53 ++++++++++++--------- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 16 +++++-- 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethe= rnet/mediatek/mtk_eth_soc.c index 75d67d1b5f6b2..ab023d3ca81f9 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -91,46 +91,53 @@ static int mtk_mdio_busy_wait(struct mtk_eth *eth) } =20 dev_err(eth->dev, "mdio: MDIO timeout\n"); - return -1; + return -ETIMEDOUT; } =20 -static u32 _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr, - u32 phy_register, u32 write_data) +static int _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr, u32 phy_reg, + u32 write_data) { - if (mtk_mdio_busy_wait(eth)) - return -1; + int ret; =20 - write_data &=3D 0xffff; + ret =3D mtk_mdio_busy_wait(eth); + if (ret < 0) + return ret; =20 - mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START | PHY_IAC_WRITE | - (phy_register << PHY_IAC_REG_SHIFT) | - (phy_addr << PHY_IAC_ADDR_SHIFT) | write_data, + mtk_w32(eth, PHY_IAC_ACCESS | + PHY_IAC_START_C22 | + PHY_IAC_CMD_WRITE | + PHY_IAC_REG(phy_reg) | + PHY_IAC_ADDR(phy_addr) | + PHY_IAC_DATA(write_data), MTK_PHY_IAC); =20 - if (mtk_mdio_busy_wait(eth)) - return -1; + ret =3D mtk_mdio_busy_wait(eth); + if (ret < 0) + return ret; =20 return 0; } =20 -static u32 _mtk_mdio_read(struct mtk_eth *eth, int phy_addr, int phy_reg) +static int _mtk_mdio_read(struct mtk_eth *eth, u32 phy_addr, u32 phy_reg) { - u32 d; + int ret; =20 - if (mtk_mdio_busy_wait(eth)) - return 0xffff; + ret =3D mtk_mdio_busy_wait(eth); + if (ret < 0) + return ret; =20 - mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START | PHY_IAC_READ | - (phy_reg << PHY_IAC_REG_SHIFT) | - (phy_addr << PHY_IAC_ADDR_SHIFT), + mtk_w32(eth, PHY_IAC_ACCESS | + PHY_IAC_START_C22 | + PHY_IAC_CMD_C22_READ | + PHY_IAC_REG(phy_reg) | + PHY_IAC_ADDR(phy_addr), MTK_PHY_IAC); =20 - if (mtk_mdio_busy_wait(eth)) - return 0xffff; - - d =3D mtk_r32(eth, MTK_PHY_IAC) & 0xffff; + ret =3D mtk_mdio_busy_wait(eth); + if (ret < 0) + return ret; =20 - return d; + return mtk_r32(eth, MTK_PHY_IAC) & PHY_IAC_DATA_MASK; } =20 static int mtk_mdio_write(struct mii_bus *bus, int phy_addr, diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethe= rnet/mediatek/mtk_eth_soc.h index 5ef70dd8b49c6..f2d90639d7ed1 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -341,11 +341,17 @@ /* PHY Indirect Access Control registers */ #define MTK_PHY_IAC 0x10004 #define PHY_IAC_ACCESS BIT(31) -#define PHY_IAC_READ BIT(19) -#define PHY_IAC_WRITE BIT(18) -#define PHY_IAC_START BIT(16) -#define PHY_IAC_ADDR_SHIFT 20 -#define PHY_IAC_REG_SHIFT 25 +#define PHY_IAC_REG_MASK GENMASK(29, 25) +#define PHY_IAC_REG(x) FIELD_PREP(PHY_IAC_REG_MASK, (x)) +#define PHY_IAC_ADDR_MASK GENMASK(24, 20) +#define PHY_IAC_ADDR(x) FIELD_PREP(PHY_IAC_ADDR_MASK, (x)) +#define PHY_IAC_CMD_MASK GENMASK(19, 18) +#define PHY_IAC_CMD_WRITE FIELD_PREP(PHY_IAC_CMD_MASK, 1) +#define PHY_IAC_CMD_C22_READ FIELD_PREP(PHY_IAC_CMD_MASK, 2) +#define PHY_IAC_START_MASK GENMASK(17, 16) +#define PHY_IAC_START_C22 FIELD_PREP(PHY_IAC_START_MASK, 1) +#define PHY_IAC_DATA_MASK GENMASK(15, 0) +#define PHY_IAC_DATA(x) FIELD_PREP(PHY_IAC_DATA_MASK, (x)) #define PHY_IAC_TIMEOUT HZ =20 #define MTK_MAC_MISC 0x1000c --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6476DC43217 for ; Mon, 24 Jan 2022 23:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362133AbiAXXlo (ORCPT ); Mon, 24 Jan 2022 18:41:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841135AbiAXW5l (ORCPT ); Mon, 24 Jan 2022 17:57:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 899FAC034610; Mon, 24 Jan 2022 13:12:24 -0800 (PST) Received: from smtp.kernel.org (relay.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 45287B8123D; Mon, 24 Jan 2022 21:12:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93AE7C340E5; Mon, 24 Jan 2022 21:12:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058742; bh=ZiUO++6bgchHIbgpfnE+8NHiJEyM/iEETegiv0Pg5dQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sTamqOwjrrZ3bLnheNVFcdpcCMysSASlZZaLOHc2WRB2pIn4oNFFJP0Y062bh5+iL EXM1cIBtz2MRTqMHbqLGPV0KhVDJfeYD1r6MFigy3RyOFbYFVC0NgQbSGX5pjcMQI/ UcRZrp36yQsrD2Z+hn42WVgjfhucsxbkboOqQMKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Horatiu Vultur , Vladimir Oltean , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0370/1039] net: dsa: fix incorrect function pointer check for MRP ring roles Date: Mon, 24 Jan 2022 19:35:59 +0100 Message-Id: <20220124184137.738106366@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 ff91e1b68490b97c18c649b769618815eb945f11 ] The cross-chip notifier boilerplate code meant to check the presence of ds->ops->port_mrp_add_ring_role before calling it, but checked ds->ops->port_mrp_add instead, before calling ds->ops->port_mrp_add_ring_role. Therefore, a driver which implements one operation but not the other would trigger a NULL pointer dereference. There isn't any such driver in DSA yet, so there is no reason to backport the change. Issue found through code inspection. Cc: Horatiu Vultur Fixes: c595c4330da0 ("net: dsa: add MRP support") Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/dsa/switch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/dsa/switch.c b/net/dsa/switch.c index bb155a16d4540..80816f7e1f996 100644 --- a/net/dsa/switch.c +++ b/net/dsa/switch.c @@ -675,7 +675,7 @@ static int dsa_switch_mrp_add_ring_role(struct dsa_switch *ds, struct dsa_notifier_mrp_ring_role_info *info) { - if (!ds->ops->port_mrp_add) + if (!ds->ops->port_mrp_add_ring_role) return -EOPNOTSUPP; =20 if (ds->index =3D=3D info->sw_index) @@ -689,7 +689,7 @@ static int dsa_switch_mrp_del_ring_role(struct dsa_switch *ds, struct dsa_notifier_mrp_ring_role_info *info) { - if (!ds->ops->port_mrp_del) + if (!ds->ops->port_mrp_del_ring_role) return -EOPNOTSUPP; =20 if (ds->index =3D=3D info->sw_index) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54230C433EF for ; Mon, 24 Jan 2022 23:37:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387569AbiAXXh2 (ORCPT ); Mon, 24 Jan 2022 18:37:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382486AbiAXW6D (ORCPT ); Mon, 24 Jan 2022 17:58:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8DFEC02B87A; Mon, 24 Jan 2022 13:12:57 -0800 (PST) Received: from smtp.kernel.org (relay.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 6ABC7B810BD; Mon, 24 Jan 2022 21:12:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 886CFC340E8; Mon, 24 Jan 2022 21:12:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058775; bh=v3CmNcQuVcLWxRTsj4bwVZeaXhS0Z8OOc7cj1SIMdtw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lkGObqf0TrgCuysKmhe0ylJ31x6t1YcFEBHVF7p3p3wkaNUZV6mrSlZlOT3ryBTWO YATr9MXhB1htWreU2QacRPyVuCitmb3s1WCDa/NP+kChlUPp5aUNlTcg3s3Zn//y3Q STztndIPgtQodcr/zfkeoxrAnJcwwpVODbpE9neM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Xiong , Xiyu Yang , Xin Tan , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.16 0371/1039] netfilter: ipt_CLUSTERIP: fix refcount leak in clusterip_tg_check() Date: Mon, 24 Jan 2022 19:36:00 +0100 Message-Id: <20220124184137.776664213@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit d94a69cb2cfa77294921aae9afcfb866e723a2da ] The issue takes place in one error path of clusterip_tg_check(). When memcmp() returns nonzero, the function simply returns the error code, forgetting to decrease the reference count of a clusterip_config object, which is bumped earlier by clusterip_config_find_get(). This may incur reference count leak. Fix this issue by decrementing the refcount of the object in specific error path. Fixes: 06aa151ad1fc74 ("netfilter: ipt_CLUSTERIP: check MAC address when du= plicate config is set") Signed-off-by: Xin Xiong Signed-off-by: Xiyu Yang Signed-off-by: Xin Tan Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/ipv4/netfilter/ipt_CLUSTERIP.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CL= USTERIP.c index 8fd1aba8af31c..b518f20c9a244 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c @@ -520,8 +520,11 @@ static int clusterip_tg_check(const struct xt_tgchk_pa= ram *par) if (IS_ERR(config)) return PTR_ERR(config); } - } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) + } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) { + clusterip_config_entry_put(config); + clusterip_config_put(config); return -EINVAL; + } =20 ret =3D nf_ct_netns_get(par->net, par->family); if (ret < 0) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F70BC433EF for ; Mon, 24 Jan 2022 22:19:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583065AbiAXWQY (ORCPT ); Mon, 24 Jan 2022 17:16:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34358 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376267AbiAXVNV (ORCPT ); Mon, 24 Jan 2022 16:13:21 -0500 Received: from smtp.kernel.org (relay.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 BCD6EB811F3; Mon, 24 Jan 2022 21:13:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8342C340E5; Mon, 24 Jan 2022 21:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058797; bh=RPNJE7lmv9dsqBv8r2uXE3MZEddVG5SDSzixqBWmW/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AgE8WT0K1sanm2oj7HXRNMcdmiXlHf/B6n4ef6+WxzHmXraNMZrmfAU9qBNeTj1p2 tpJBjUYsXJO9KdYO3qI38QCHQPiqemP+2WUsf1o6M8C43Zv/HIBay89qyogRkzo5m0 7B7rvWKODuVvvChJN1eSFZOjsGCInLcBv3660RNM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.16 0372/1039] bpf, arm64: Use emit_addr_mov_i64() for BPF_PSEUDO_FUNC Date: Mon, 24 Jan 2022 19:36:01 +0100 Message-Id: <20220124184137.812097875@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit e4a41c2c1fa916547e63440c73a51a5eb06247af ] The following error is reported when running "./test_progs -t for_each" under arm64: bpf_jit: multi-func JIT bug 58 !=3D 56 [...] JIT doesn't support bpf-to-bpf calls The root cause is the size of BPF_PSEUDO_FUNC instruction increases from 2 to 3 after the address of called bpf-function is settled and there are two bpf-to-bpf calls in test_pkt_access. The generated instructions are shown below: 0x48: 21 00 C0 D2 movz x1, #0x1, lsl #32 0x4c: 21 00 80 F2 movk x1, #0x1 0x48: E1 3F C0 92 movn x1, #0x1ff, lsl #32 0x4c: 41 FE A2 F2 movk x1, #0x17f2, lsl #16 0x50: 81 70 9F F2 movk x1, #0xfb84 Fixing it by using emit_addr_mov_i64() for BPF_PSEUDO_FUNC, so the size of jited image will not change. Fixes: 69c087ba6225 ("bpf: Add bpf_for_each_map_elem() helper") Signed-off-by: Hou Tao Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20211231151018.3781550-1-houtao1@huawei.c= om Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/net/bpf_jit_comp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index 3a8a7140a9bfb..c2d95aa1d294c 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -791,7 +791,10 @@ emit_cond_jmp: u64 imm64; =20 imm64 =3D (u64)insn1.imm << 32 | (u32)imm; - emit_a64_mov_i64(dst, imm64, ctx); + if (bpf_pseudo_func(insn)) + emit_addr_mov_i64(dst, imm64, ctx); + else + emit_a64_mov_i64(dst, imm64, ctx); =20 return 1; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0D8DC433F5 for ; Mon, 24 Jan 2022 21:54:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574670AbiAXVuC (ORCPT ); Mon, 24 Jan 2022 16:50:02 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34382 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376794AbiAXVN1 (ORCPT ); Mon, 24 Jan 2022 16:13:27 -0500 Received: from smtp.kernel.org (relay.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 03CA9B812A4; Mon, 24 Jan 2022 21:13:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 177ECC340E8; Mon, 24 Jan 2022 21:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058800; bh=nuteEGewQqTwcTFHFsQbW1oe/ul0Q5xnOiHBmfH1eRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xwDtJxbbpjtj12xW19E5UwZL1z0pMTyPSLWsMQHl5wogFWXd7Y+aBVdQeZCni7ZrP AgBpYcR1JVThl8mtiZqAh/i66l7DKcb4M/JYttWmsaa5OX2zdxXcia2iBUVCkj5cJ3 blIpUXH6mw6ZW7iN1v6i3p2t5216XfqM295VMSiM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Fastabend , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.16 0373/1039] bpf, sockmap: Fix return codes from tcp_bpf_recvmsg_parser() Date: Mon, 24 Jan 2022 19:36:02 +0100 Message-Id: <20220124184137.848364641@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Fastabend [ Upstream commit 5b2c5540b8110eea0d67a78fb0ddb9654c58daeb ] Applications can be confused slightly because we do not always return the same error code as expected, e.g. what the TCP stack normally returns. For example on a sock err sk->sk_err instead of returning the sock_error we return EAGAIN. This usually means the application will 'try again' instead of aborting immediately. Another example, when a shutdown event is received we should immediately abort instead of waiting for data when the user provides a timeout. These tend to not be fatal, applications usually recover, but introduces bogus errors to the user or introduces unexpected latency. Before 'c5d2177a72a16' we fell back to the TCP stack when no data was available so we managed to catch many of the cases here, although with the extra latency cost of calling tcp_msg_wait_data() first. To fix lets duplicate the error handling in TCP stack into tcp_bpf so that we get the same error codes. These were found in our CI tests that run applications against sockmap and do longer lived testing, at least compared to test_sockmap that does short-lived ping/pong tests, and in some of our test clusters we deploy. Its non-trivial to do these in a shorter form CI tests that would be appropriate for BPF selftests, but we are looking into it so we can ensure this keeps working going forward. As a preview one idea is to pull in the packetdrill testing which catches some of this. Fixes: c5d2177a72a16 ("bpf, sockmap: Fix race in ingress receive verdict wi= th redirect to self") Signed-off-by: John Fastabend Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220104205918.286416-1-john.fastabend@gm= ail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/ipv4/tcp_bpf.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c index f70aa0932bd6c..9b9b02052fd36 100644 --- a/net/ipv4/tcp_bpf.c +++ b/net/ipv4/tcp_bpf.c @@ -196,12 +196,39 @@ msg_bytes_ready: long timeo; int data; =20 + if (sock_flag(sk, SOCK_DONE)) + goto out; + + if (sk->sk_err) { + copied =3D sock_error(sk); + goto out; + } + + if (sk->sk_shutdown & RCV_SHUTDOWN) + goto out; + + if (sk->sk_state =3D=3D TCP_CLOSE) { + copied =3D -ENOTCONN; + goto out; + } + timeo =3D sock_rcvtimeo(sk, nonblock); + if (!timeo) { + copied =3D -EAGAIN; + goto out; + } + + if (signal_pending(current)) { + copied =3D sock_intr_errno(timeo); + goto out; + } + data =3D tcp_msg_wait_data(sk, psock, timeo); if (data && !sk_psock_queue_empty(psock)) goto msg_bytes_ready; copied =3D -EAGAIN; } +out: release_sock(sk); sk_psock_put(sk, psock); return copied; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C374FC43219 for ; Mon, 24 Jan 2022 22:17:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583040AbiAXWQV (ORCPT ); Mon, 24 Jan 2022 17:16:21 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33426 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376812AbiAXVN3 (ORCPT ); Mon, 24 Jan 2022 16:13:29 -0500 Received: from smtp.kernel.org (relay.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 119ADB81257; Mon, 24 Jan 2022 21:13:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34B92C340E5; Mon, 24 Jan 2022 21:13:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058803; bh=O3sG/Btl6e9DGVuCw18nvCdoB8UchlCudc/UsJkn/Hk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0HWzAqn6K1pIXcyayX/B7nW9zHwJIC0ySKulUEKK/xDiXOjqqK4JfldH/fPXIgv28 X3r65Yq2Ar6TnzTXGJxNuNOti8e24k/KLZ0hRzJrQL1F75bsBV93oXLkiVnkHZYrcC 9pZmdZ130gmMyI0KokQqXE7OIi/9eDzNLuZD5j2Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+bb73e71cf4b8fd376a4f@syzkaller.appspotmail.com, John Fastabend , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.16 0374/1039] bpf, sockmap: Fix double bpf_prog_put on error case in map_link Date: Mon, 24 Jan 2022 19:36:03 +0100 Message-Id: <20220124184137.887370933@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Fastabend [ Upstream commit 218d747a4142f281a256687bb513a135c905867b ] sock_map_link() is called to update a sockmap entry with a sk. But, if the sock_map_init_proto() call fails then we return an error to the map_update op against the sockmap. In the error path though we need to cleanup psock and dec the refcnt on any programs associated with the map, because we refcnt them early in the update process to ensure they are pinned for the psock. (This avoids a race where user deletes programs while also updating the map with new socks.) In current code we do the prog refcnt dec explicitely by calling bpf_prog_put() when the program was found in the map. But, after commit '38207a5e81230' in this error path we've already done the prog to psock assignment so the programs have a reference from the psock as well. This then causes the psock tear down logic, invoked by sk_psock_put() in the error path, to similarly call bpf_prog_put on the programs there. To be explicit this logic does the prog->psock assignment: if (msg_*) psock_set_prog(...) Then the error path under the out_progs label does a similar check and dec with: if (msg_*) bpf_prog_put(...) And the teardown logic sk_psock_put() does ... psock_set_prog(msg_*, NULL) ... triggering another bpf_prog_put(...). Then KASAN gives us this splat, found by syzbot because we've created an inbalance between bpf_prog_inc and bpf_prog_put calling put twice on the program. BUG: KASAN: vmalloc-out-of-bounds in __bpf_prog_put kernel/bpf/syscall.c:= 1812 [inline] BUG: KASAN: vmalloc-out-of-bounds in __bpf_prog_put kernel/bpf/syscall.c:= 1812 [inline] kernel/bpf/syscall.c:1829 BUG: KASAN: vmalloc-out-of-bounds in bpf_prog_put+0x8c/0x4f0 kernel/bpf/s= yscall.c:1829 kernel/bpf/syscall.c:1829 Read of size 8 at addr ffffc90000e76038 by task syz-executor020/3641 To fix clean up error path so it doesn't try to do the bpf_prog_put in the error path once progs are assigned then it relies on the normal psock tear down logic to do complete cleanup. For completness we also cover the case whereh sk_psock_init_strp() fails, but this is not expected because it indicates an incorrect socket type and should be caught earlier. Fixes: 38207a5e8123 ("bpf, sockmap: Attach map progs to psock early for fea= ture probes") Reported-by: syzbot+bb73e71cf4b8fd376a4f@syzkaller.appspotmail.com Signed-off-by: John Fastabend Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220104214645.290900-1-john.fastabend@gm= ail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/core/sock_map.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/net/core/sock_map.c b/net/core/sock_map.c index 4ca4b11f4e5ff..687c81386518c 100644 --- a/net/core/sock_map.c +++ b/net/core/sock_map.c @@ -292,15 +292,23 @@ static int sock_map_link(struct bpf_map *map, struct = sock *sk) if (skb_verdict) psock_set_prog(&psock->progs.skb_verdict, skb_verdict); =20 + /* msg_* and stream_* programs references tracked in psock after this + * point. Reference dec and cleanup will occur through psock destructor + */ ret =3D sock_map_init_proto(sk, psock); - if (ret < 0) - goto out_drop; + if (ret < 0) { + sk_psock_put(sk, psock); + goto out; + } =20 write_lock_bh(&sk->sk_callback_lock); if (stream_parser && stream_verdict && !psock->saved_data_ready) { ret =3D sk_psock_init_strp(sk, psock); - if (ret) - goto out_unlock_drop; + if (ret) { + write_unlock_bh(&sk->sk_callback_lock); + sk_psock_put(sk, psock); + goto out; + } sk_psock_start_strp(sk, psock); } else if (!stream_parser && stream_verdict && !psock->saved_data_ready) { sk_psock_start_verdict(sk,psock); @@ -309,10 +317,6 @@ static int sock_map_link(struct bpf_map *map, struct s= ock *sk) } write_unlock_bh(&sk->sk_callback_lock); return 0; -out_unlock_drop: - write_unlock_bh(&sk->sk_callback_lock); -out_drop: - sk_psock_put(sk, psock); out_progs: if (skb_verdict) bpf_prog_put(skb_verdict); @@ -325,6 +329,7 @@ out_put_stream_parser: out_put_stream_verdict: if (stream_verdict) bpf_prog_put(stream_verdict); +out: return ret; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1533EC433F5 for ; Mon, 24 Jan 2022 21:49:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354783AbiAXVsx (ORCPT ); Mon, 24 Jan 2022 16:48:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34420 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377928AbiAXVNb (ORCPT ); Mon, 24 Jan 2022 16:13:31 -0500 Received: from smtp.kernel.org (relay.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 356F6B8105C; Mon, 24 Jan 2022 21:13:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65F46C340E7; Mon, 24 Jan 2022 21:13:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058807; bh=ZwfV9lC0qIECwSLVyzpet18Z//UfPAeeUHilSu2CnGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RZCwkPkvSxxuf9alnTQs4A05nTX1C5Tq/wZ/FfGMxpIMqEhS81xXE6oeX/L+TjPc/ 2EkQO3wtQYMl4y0QKPMqMq+8qY/mGfOk9/TXGraZgffmURUy7DmGUcab/z+O4oniOg s23GX3Yov69h32bTe+iRMYXGBHbLH5Xo85rByjqI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Borkmann , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.16 0375/1039] bpf: Dont promote bogus looking registers after null check. Date: Mon, 24 Jan 2022 19:36:04 +0100 Message-Id: <20220124184137.918229276@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Borkmann [ Upstream commit e60b0d12a95dcf16a63225cead4541567f5cb517 ] If we ever get to a point again where we convert a bogus looking _or_n= ull typed register containing a non-zero fixed or variable offset, then lets not reset these bounds to zero since they are not and also don't promote the re= gister to a type, but instead leave it as _or_null. Converting to a unk= nown register could be an avenue as well, but then if we run into this case it w= ould allow to leak a kernel pointer this way. Fixes: f1174f77b50c ("bpf/verifier: rework value tracking") Signed-off-by: Daniel Borkmann Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/bpf/verifier.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 8ebabae31a431..45d5e71cd64e6 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -8961,15 +8961,15 @@ static void mark_ptr_or_null_reg(struct bpf_func_st= ate *state, { if (reg_type_may_be_null(reg->type) && reg->id =3D=3D id && !WARN_ON_ONCE(!reg->id)) { - /* Old offset (both fixed and variable parts) should - * have been known-zero, because we don't allow pointer - * arithmetic on pointers that might be NULL. - */ if (WARN_ON_ONCE(reg->smin_value || reg->smax_value || !tnum_equals_const(reg->var_off, 0) || reg->off)) { - __mark_reg_known_zero(reg); - reg->off =3D 0; + /* Old offset (both fixed and variable parts) should + * have been known-zero, because we don't allow pointer + * arithmetic on pointers that might be NULL. If we + * see this happening, don't convert the register. + */ + return; } if (is_null) { reg->type =3D SCALAR_VALUE; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1DECC433F5 for ; Mon, 24 Jan 2022 22:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580675AbiAXWKY (ORCPT ); Mon, 24 Jan 2022 17:10:24 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36376 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378019AbiAXVNb (ORCPT ); Mon, 24 Jan 2022 16:13:31 -0500 Received: from smtp.kernel.org (relay.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 9A8EB612E9; Mon, 24 Jan 2022 21:13:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 772ECC340E5; Mon, 24 Jan 2022 21:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058810; bh=ObGeEL6bLEFy2KfaLCY2uZ88GlwKe9NyM/Hl85xrRt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=suAke3QIJ6haimopMAVTicPT7i+N+/nf7EQtruESc+Qx6qStXsc8997JZuHg4vxDN KuIwmAxeoe7CuRCYvq2o5P2rGGQbk0REEGICjzTZ6NE1zNMK8M2k6G5NsXf0UoV5ry 7G28HmDXoDw1goB8RKiejM8bKADeR4ug/2gNB4gY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kris Van Hees , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.16 0376/1039] bpf: Fix verifier support for validation of async callbacks Date: Mon, 24 Jan 2022 19:36:05 +0100 Message-Id: <20220124184137.947897959@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kris Van Hees [ Upstream commit a5bebc4f00dee47113eed48098c68e88b5ba70e8 ] Commit bfc6bb74e4f1 ("bpf: Implement verifier support for validation of asy= nc callbacks.") added support for BPF_FUNC_timer_set_callback to the __check_func_call() function. The test in __check_func_call() is flaweed because it can mis-interpret a regular BPF-to-BPF pseudo-call as a BPF_FUNC_timer_set_callback callback call. Consider the conditional in the code: if (insn->code =3D=3D (BPF_JMP | BPF_CALL) && insn->imm =3D=3D BPF_FUNC_timer_set_callback) { The BPF_FUNC_timer_set_callback has value 170. This means that if you have a BPF program that contains a pseudo-call with an instruction delta of 170, this conditional will be found to be true by the verifier, and it will interpret the pseudo-call as a callback. This leads to a mess with the verification of the program because it makes the wrong assumptions about the nature of this call. Solution: include an explicit check to ensure that insn->src_reg =3D=3D 0. This ensures that calls cannot be mis-interpreted as an async callback call. Fixes: bfc6bb74e4f1 ("bpf: Implement verifier support for validation of asy= nc callbacks.") Signed-off-by: Kris Van Hees Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20220105210150.GH1559@oracle.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/bpf/verifier.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 45d5e71cd64e6..d48000b90eb8a 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -5965,6 +5965,7 @@ static int __check_func_call(struct bpf_verifier_env = *env, struct bpf_insn *insn } =20 if (insn->code =3D=3D (BPF_JMP | BPF_CALL) && + insn->src_reg =3D=3D 0 && insn->imm =3D=3D BPF_FUNC_timer_set_callback) { struct bpf_verifier_state *async_cb; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CDB0C3525A for ; Mon, 24 Jan 2022 21:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574731AbiAXVuK (ORCPT ); Mon, 24 Jan 2022 16:50:10 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34466 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448674AbiAXVNf (ORCPT ); Mon, 24 Jan 2022 16:13:35 -0500 Received: from smtp.kernel.org (relay.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 6B4BEB8122A; Mon, 24 Jan 2022 21:13:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9090DC340E5; Mon, 24 Jan 2022 21:13:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058813; bh=F2oYiKHVZmI6LKK4R/SUjdr8SVXHmnrD7tlG1U1IfVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NSwfMPPMwYnSOxt0Qv6WsF8bFEgg3SkayQla1lVFSSg33DvoBtLANXmh9Di8iK4xQ KvOIBg9BC1DPVJt4AYx//8ueu/hDN4su7kiVNsObBoWGP3CIaVNmpyTCpHBgl/4XQn 6lIExVLWflMGiGrBghxb1rkV1tADuyjYEjdaOdnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.16 0377/1039] bpf: Fix SO_RCVBUF/SO_SNDBUF handling in _bpf_setsockopt(). Date: Mon, 24 Jan 2022 19:36:06 +0100 Message-Id: <20220124184137.979604025@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 04c350b1ae6bdb12b84009a4d0bf5ab4e621c47b ] The commit 4057765f2dee ("sock: consistent handling of extreme SO_SNDBUF/SO_RCVBUF values") added a change to prevent underflow in setsockopt() around SO_SNDBUF/SO_RCVBUF. This patch adds the same change to _bpf_setsockopt(). Fixes: 4057765f2dee ("sock: consistent handling of extreme SO_SNDBUF/SO_RCV= BUF values") Signed-off-by: Kuniyuki Iwashima Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20220104013153.97906-2-kuniyu@amazon.co.jp Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/core/filter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index 6102f093d59a5..31147a4cfab30 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4742,12 +4742,14 @@ static int _bpf_setsockopt(struct sock *sk, int lev= el, int optname, switch (optname) { case SO_RCVBUF: val =3D min_t(u32, val, sysctl_rmem_max); + val =3D min_t(int, val, INT_MAX / 2); sk->sk_userlocks |=3D SOCK_RCVBUF_LOCK; WRITE_ONCE(sk->sk_rcvbuf, max_t(int, val * 2, SOCK_MIN_RCVBUF)); break; case SO_SNDBUF: val =3D min_t(u32, val, sysctl_wmem_max); + val =3D min_t(int, val, INT_MAX / 2); sk->sk_userlocks |=3D SOCK_SNDBUF_LOCK; WRITE_ONCE(sk->sk_sndbuf, max_t(int, val * 2, SOCK_MIN_SNDBUF)); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C6A0C433F5 for ; Mon, 24 Jan 2022 21:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573811AbiAXVp5 (ORCPT ); Mon, 24 Jan 2022 16:45:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33760 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448020AbiAXVLy (ORCPT ); Mon, 24 Jan 2022 16:11:54 -0500 Received: from smtp.kernel.org (relay.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 F31D6B8121C; Mon, 24 Jan 2022 21:11:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D495C340E5; Mon, 24 Jan 2022 21:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058711; bh=AqUHJMQ2oY0NsP6WS7PPXKuOprmnYcXcK6FdrOhbVas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PewUrMZpCqOV30LoK6McSnp1HXenZbUZpU/EZH9Z2Dz80cGj9sTsSnXSgwXz9lyNT AACOs+vrgGvxmPXSeK48F/n4hXp9zgYzAP+4hQySTrER080KcxJ2w9WZBHTOCyAvnE 0puTROgrWaK9FwqwdC7GVaahhdeQWp2TTpo/08sI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiang Wang , Chengming Zhou , Andrii Nakryiko , Hengqi Chen , Sasha Levin Subject: [PATCH 5.16 0378/1039] libbpf: Use probe_name for legacy kprobe Date: Mon, 24 Jan 2022 19:36:07 +0100 Message-Id: <20220124184138.019901056@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qiang Wang [ Upstream commit 71cff670baff5cc6a6eeb0181e2cc55579c5e1e0 ] Fix a bug in commit 46ed5fc33db9, which wrongly used the func_name instead of probe_name to register legacy kprobe. Fixes: 46ed5fc33db9 ("libbpf: Refactor and simplify legacy kprobe code") Co-developed-by: Chengming Zhou Signed-off-by: Qiang Wang Signed-off-by: Chengming Zhou Signed-off-by: Andrii Nakryiko Tested-by: Hengqi Chen Reviewed-by: Hengqi Chen Link: https://lore.kernel.org/bpf/20211227130713.66933-1-wangqiang.wq.frank= @bytedance.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index fd25e30e70cc2..2696f0b7f0acc 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -9769,7 +9769,7 @@ bpf_program__attach_kprobe_opts(const struct bpf_prog= ram *prog, gen_kprobe_legacy_event_name(probe_name, sizeof(probe_name), func_name, offset); =20 - legacy_probe =3D strdup(func_name); + legacy_probe =3D strdup(probe_name); if (!legacy_probe) return libbpf_err_ptr(-ENOMEM); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51F2CC433FE for ; Mon, 24 Jan 2022 21:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229517AbiAXVqE (ORCPT ); Mon, 24 Jan 2022 16:46:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35284 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448046AbiAXVLz (ORCPT ); Mon, 24 Jan 2022 16:11:55 -0500 Received: from smtp.kernel.org (relay.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 3ADD861451; Mon, 24 Jan 2022 21:11:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 132CDC340E5; Mon, 24 Jan 2022 21:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058714; bh=tZoRqKshpb0jYNvvz3638yINcJjRi1Ic87BJvrzDhSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZK5JmYtm34pamy+HKlwb9Bep+hRqSn46QRoQ3cSy0sYQUit3PnLQ1sS99egt1n4Yw Fz/v5NY4QMUctYMJ8fLy5TFfPMbjBfO6Vse3TVvldECtXNYC4FgpmY7FW/IEf5JRTP 8SJJW1xGYjV+qFU1/qPTzpiWnv9AmawboRiOqXoE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Sasha Levin , Steffen Weinreich Subject: [PATCH 5.16 0379/1039] netfilter: nft_payload: do not update layer 4 checksum when mangling fragments Date: Mon, 24 Jan 2022 19:36:08 +0100 Message-Id: <20220124184138.051803190@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 4e1860a3863707e8177329c006d10f9e37e097a8 ] IP fragments do not come with the transport header, hence skip bogus layer 4 checksum updates. Fixes: 1814096980bb ("netfilter: nft_payload: layer 4 checksum adjustment f= or pseudoheader fields") Reported-and-tested-by: Steffen Weinreich Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/netfilter/nft_payload.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c index bd689938a2e0c..58e96a0fe0b4c 100644 --- a/net/netfilter/nft_payload.c +++ b/net/netfilter/nft_payload.c @@ -546,6 +546,9 @@ static int nft_payload_l4csum_offset(const struct nft_p= ktinfo *pkt, struct sk_buff *skb, unsigned int *l4csum_offset) { + if (pkt->fragoff) + return -1; + switch (pkt->tprot) { case IPPROTO_TCP: *l4csum_offset =3D offsetof(struct tcphdr, check); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32555C3525A for ; Mon, 24 Jan 2022 21:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573818AbiAXVp7 (ORCPT ); Mon, 24 Jan 2022 16:45:59 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35314 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448078AbiAXVL6 (ORCPT ); Mon, 24 Jan 2022 16:11:58 -0500 Received: from smtp.kernel.org (relay.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 4C34E61425; Mon, 24 Jan 2022 21:11:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21D23C340E5; Mon, 24 Jan 2022 21:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058717; bh=GLTJnZCfJHVaIC+X5HqOOgqv8U5UHQODi6Ql/8KIEXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ddhQHlqBz55A3ML4VUAeeJ021W9lf4R1LqhoDrIfKYxO3n+h3qwVraNO5Uv22cLfx KxOpkQd7eaDeCCxmcHROXMpram2N/iW2CF8LWZ4CG1ESEoH5bpJu4A50n965SQNW88 52VyjV1k93XuBtSditIwDKdKOuYge/dn3IoNSw5g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, etkaar , Florian Westphal , Stefano Brivio , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.16 0380/1039] netfilter: nft_set_pipapo: allocate pcpu scratch maps on clone Date: Mon, 24 Jan 2022 19:36:09 +0100 Message-Id: <20220124184138.086534019@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 23c54263efd7cb605e2f7af72717a2a951999217 ] This is needed in case a new transaction is made that doesn't insert any new elements into an already existing set. Else, after second 'nft -f ruleset.txt', lookups in such a set will fail because ->lookup() encounters raw_cpu_ptr(m->scratch) =3D=3D NULL. For the initial rule load, insertion of elements takes care of the allocation, but for rule reloads this isn't guaranteed: we might not have additions to the set. Fixes: 3c4287f62044a90e ("nf_tables: Add set type for arbitrary concatenati= on of ranges") Reported-by: etkaar Signed-off-by: Florian Westphal Reviewed-by: Stefano Brivio Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/netfilter/nft_set_pipapo.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c index dce866d93feed..2c8051d8cca69 100644 --- a/net/netfilter/nft_set_pipapo.c +++ b/net/netfilter/nft_set_pipapo.c @@ -1290,6 +1290,11 @@ static struct nft_pipapo_match *pipapo_clone(struct = nft_pipapo_match *old) if (!new->scratch_aligned) goto out_scratch; #endif + for_each_possible_cpu(i) + *per_cpu_ptr(new->scratch, i) =3D NULL; + + if (pipapo_realloc_scratch(new, old->bsize_max)) + goto out_scratch_realloc; =20 rcu_head_init(&new->rcu); =20 @@ -1334,6 +1339,9 @@ out_lt: kvfree(dst->lt); dst--; } +out_scratch_realloc: + for_each_possible_cpu(i) + kfree(*per_cpu_ptr(new->scratch, i)); #ifdef NFT_PIPAPO_ALIGN free_percpu(new->scratch_aligned); #endif --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DB39C3526E for ; Mon, 24 Jan 2022 23:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362317AbiAXXmM (ORCPT ); Mon, 24 Jan 2022 18:42:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841091AbiAXW5g (ORCPT ); Mon, 24 Jan 2022 17:57:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA85FC055ABE; Mon, 24 Jan 2022 13:12:01 -0800 (PST) Received: from smtp.kernel.org (relay.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 6B8A66147D; Mon, 24 Jan 2022 21:12:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 506B0C340E5; Mon, 24 Jan 2022 21:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058720; bh=RLQt645kFXrizzQINI9AoTr4vJ0Bgr5GYFhh/k5hya0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tnEOIYi8EPGNwvbEhbseyNOl7+paVpl9TdrCp6r/4fyZIIyhq5lL1zlyz8jRlqPo6 xoZmCEoHtP6rkeTHOM8gCPt6qt+vIPT2f/RbmJeq9oKpZjBdKVq8zhlQSUffy5o7rI iCwc/jia0U+5DtJUDKQKLk7eaQxFsDOLvefXz8Bo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miroslav Lichvar , Yangbo Lu , Richard Cochran , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0381/1039] net: fix SOF_TIMESTAMPING_BIND_PHC to work with multiple sockets Date: Mon, 24 Jan 2022 19:36:10 +0100 Message-Id: <20220124184138.119678932@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miroslav Lichvar [ Upstream commit 007747a984ea5e895b7d8b056b24ebf431e1e71d ] When multiple sockets using the SOF_TIMESTAMPING_BIND_PHC flag received a packet with a hardware timestamp (e.g. multiple PTP instances in different PTP domains using the UDPv4/v6 multicast or L2 transport), the timestamps received on some sockets were corrupted due to repeated conversion of the same timestamp (by the same or different vclocks). Fix ptp_convert_timestamp() to not modify the shared skb timestamp and return the converted timestamp as a ktime_t instead. If the conversion fails, return 0 to not confuse the application with timestamps corresponding to an unexpected PHC. Fixes: d7c088265588 ("net: socket: support hardware timestamp conversion to= PHC bound") Signed-off-by: Miroslav Lichvar Cc: Yangbo Lu Cc: Richard Cochran Acked-by: Richard Cochran Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/ptp/ptp_vclock.c | 10 +++++----- include/linux/ptp_clock_kernel.h | 12 +++++++----- net/socket.c | 9 ++++++--- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/ptp/ptp_vclock.c b/drivers/ptp/ptp_vclock.c index baee0379482bc..ab1d233173e13 100644 --- a/drivers/ptp/ptp_vclock.c +++ b/drivers/ptp/ptp_vclock.c @@ -185,8 +185,8 @@ out: } EXPORT_SYMBOL(ptp_get_vclocks_index); =20 -void ptp_convert_timestamp(struct skb_shared_hwtstamps *hwtstamps, - int vclock_index) +ktime_t ptp_convert_timestamp(const struct skb_shared_hwtstamps *hwtstamps, + int vclock_index) { char name[PTP_CLOCK_NAME_LEN] =3D ""; struct ptp_vclock *vclock; @@ -198,12 +198,12 @@ void ptp_convert_timestamp(struct skb_shared_hwtstamp= s *hwtstamps, snprintf(name, PTP_CLOCK_NAME_LEN, "ptp%d", vclock_index); dev =3D class_find_device_by_name(ptp_class, name); if (!dev) - return; + return 0; =20 ptp =3D dev_get_drvdata(dev); if (!ptp->is_virtual_clock) { put_device(dev); - return; + return 0; } =20 vclock =3D info_to_vclock(ptp->info); @@ -215,7 +215,7 @@ void ptp_convert_timestamp(struct skb_shared_hwtstamps = *hwtstamps, spin_unlock_irqrestore(&vclock->lock, flags); =20 put_device(dev); - hwtstamps->hwtstamp =3D ns_to_ktime(ns); + return ns_to_ktime(ns); } EXPORT_SYMBOL(ptp_convert_timestamp); #endif diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_ker= nel.h index 2e5565067355b..554454cb86931 100644 --- a/include/linux/ptp_clock_kernel.h +++ b/include/linux/ptp_clock_kernel.h @@ -351,15 +351,17 @@ int ptp_get_vclocks_index(int pclock_index, int **vcl= ock_index); * * @hwtstamps: skb_shared_hwtstamps structure pointer * @vclock_index: phc index of ptp vclock. + * + * Returns converted timestamp, or 0 on error. */ -void ptp_convert_timestamp(struct skb_shared_hwtstamps *hwtstamps, - int vclock_index); +ktime_t ptp_convert_timestamp(const struct skb_shared_hwtstamps *hwtstamps, + int vclock_index); #else static inline int ptp_get_vclocks_index(int pclock_index, int **vclock_ind= ex) { return 0; } -static inline void ptp_convert_timestamp(struct skb_shared_hwtstamps *hwts= tamps, - int vclock_index) -{ } +static inline ktime_t ptp_convert_timestamp(const struct skb_shared_hwtsta= mps *hwtstamps, + int vclock_index) +{ return 0; } =20 #endif =20 diff --git a/net/socket.c b/net/socket.c index 7f64a6eccf63f..5053eb0100e48 100644 --- a/net/socket.c +++ b/net/socket.c @@ -829,6 +829,7 @@ void __sock_recv_timestamp(struct msghdr *msg, struct s= ock *sk, int empty =3D 1, false_tstamp =3D 0; struct skb_shared_hwtstamps *shhwtstamps =3D skb_hwtstamps(skb); + ktime_t hwtstamp; =20 /* Race occurred between timestamp enabling and packet receiving. Fill in the current time for now. */ @@ -877,10 +878,12 @@ void __sock_recv_timestamp(struct msghdr *msg, struct= sock *sk, (sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE) && !skb_is_swtx_tstamp(skb, false_tstamp)) { if (sk->sk_tsflags & SOF_TIMESTAMPING_BIND_PHC) - ptp_convert_timestamp(shhwtstamps, sk->sk_bind_phc); + hwtstamp =3D ptp_convert_timestamp(shhwtstamps, + sk->sk_bind_phc); + else + hwtstamp =3D shhwtstamps->hwtstamp; =20 - if (ktime_to_timespec64_cond(shhwtstamps->hwtstamp, - tss.ts + 2)) { + if (ktime_to_timespec64_cond(hwtstamp, tss.ts + 2)) { empty =3D 0; =20 if ((sk->sk_tsflags & SOF_TIMESTAMPING_OPT_PKTINFO) && --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 803F6C433EF for ; Mon, 24 Jan 2022 23:47:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2361770AbiAXXkv (ORCPT ); Mon, 24 Jan 2022 18:40:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841089AbiAXW5g (ORCPT ); Mon, 24 Jan 2022 17:57:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5EC5C055ABF; Mon, 24 Jan 2022 13:12:04 -0800 (PST) Received: from smtp.kernel.org (relay.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 762CE6131F; Mon, 24 Jan 2022 21:12:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 614E9C340E5; Mon, 24 Jan 2022 21:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058723; bh=WGPI17vQVAo2cE77Umhe/pZ01t6CYtWwSryzGlKR4Ac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fAX2Xyov3G8BudDESXrh4rUzLqRV0kO/7KoSsy5bamKnkwTJhAKDk9QBQHGqmH66f MVxTbgJ27fcU1CUgXeWUOCas2V02N+rUj6DrnYkkdZ/kI47QfRvVemC+w8mPiPEqXL +50M0G9rUhvb6ZAMiYVL/jjtoDcra5rds6UQZTyM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Paul Mackerras , linux-ppp@vger.kernel.org, syzbot , Guillaume Nault , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0382/1039] ppp: ensure minimum packet size in ppp_write() Date: Mon, 24 Jan 2022 19:36:11 +0100 Message-Id: <20220124184138.152052701@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit 44073187990d5629804ce0627525f6ea5cfef171 ] It seems pretty clear ppp layer assumed user space would always be kind to provide enough data in their write() to a ppp device. This patch makes sure user provides at least 2 bytes. It adds PPP_PROTO_LEN macro that could replace in net-next many occurrences of hard-coded 2 value. I replaced only one occurrence to ease backports to stable kernels. The bug manifests in the following report: BUG: KMSAN: uninit-value in ppp_send_frame+0x28d/0x27c0 drivers/net/ppp/ppp= _generic.c:1740 ppp_send_frame+0x28d/0x27c0 drivers/net/ppp/ppp_generic.c:1740 __ppp_xmit_process+0x23e/0x4b0 drivers/net/ppp/ppp_generic.c:1640 ppp_xmit_process+0x1fe/0x480 drivers/net/ppp/ppp_generic.c:1661 ppp_write+0x5cb/0x5e0 drivers/net/ppp/ppp_generic.c:513 do_iter_write+0xb0c/0x1500 fs/read_write.c:853 vfs_writev fs/read_write.c:924 [inline] do_writev+0x645/0xe00 fs/read_write.c:967 __do_sys_writev fs/read_write.c:1040 [inline] __se_sys_writev fs/read_write.c:1037 [inline] __x64_sys_writev+0xe5/0x120 fs/read_write.c:1037 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x44/0xae Uninit was created at: slab_post_alloc_hook mm/slab.h:524 [inline] slab_alloc_node mm/slub.c:3251 [inline] __kmalloc_node_track_caller+0xe0c/0x1510 mm/slub.c:4974 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0x545/0xf90 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1126 [inline] ppp_write+0x11d/0x5e0 drivers/net/ppp/ppp_generic.c:501 do_iter_write+0xb0c/0x1500 fs/read_write.c:853 vfs_writev fs/read_write.c:924 [inline] do_writev+0x645/0xe00 fs/read_write.c:967 __do_sys_writev fs/read_write.c:1040 [inline] __se_sys_writev fs/read_write.c:1037 [inline] __x64_sys_writev+0xe5/0x120 fs/read_write.c:1037 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x44/0xae Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Eric Dumazet Cc: Paul Mackerras Cc: linux-ppp@vger.kernel.org Reported-by: syzbot Acked-by: Guillaume Nault Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ppp/ppp_generic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 1180a0e2445fb..3ab24988198fe 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -69,6 +69,8 @@ #define MPHDRLEN 6 /* multilink protocol header length */ #define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */ =20 +#define PPP_PROTO_LEN 2 + /* * An instance of /dev/ppp can be associated with either a ppp * interface unit or a ppp channel. In both cases, file->private_data @@ -497,6 +499,9 @@ static ssize_t ppp_write(struct file *file, const char = __user *buf, =20 if (!pf) return -ENXIO; + /* All PPP packets should start with the 2-byte protocol */ + if (count < PPP_PROTO_LEN) + return -EINVAL; ret =3D -ENOMEM; skb =3D alloc_skb(count + pf->hdrlen, GFP_KERNEL); if (!skb) @@ -1764,7 +1769,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) } =20 ++ppp->stats64.tx_packets; - ppp->stats64.tx_bytes +=3D skb->len - 2; + ppp->stats64.tx_bytes +=3D skb->len - PPP_PROTO_LEN; =20 switch (proto) { case PPP_IP: --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3EBFC4167B for ; Mon, 24 Jan 2022 23:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362216AbiAXXl6 (ORCPT ); Mon, 24 Jan 2022 18:41:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841130AbiAXW5l (ORCPT ); Mon, 24 Jan 2022 17:57:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9D04C0797BF; Mon, 24 Jan 2022 13:12:07 -0800 (PST) Received: from smtp.kernel.org (relay.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 47FCF6131F; Mon, 24 Jan 2022 21:12:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5616BC340E5; Mon, 24 Jan 2022 21:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058726; bh=Q3ypDHHx3RUbuMxMVkYb3TNXwem+cB96Bf8NslW8Bak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QNLPMzsEr1DCoA5tGWD97m2akatrcNwQHqWquUxO9lyv/BSt6Wna3y16IVI9O/cKI i++5b/VQ/faMtXxTI47sL9mcYvMHZeCURd3DD593KEIE8Tz+KYj/mWToohOBIPUG2t 27vaMOza4vTaC1ZkX2rKEZUiv2Z9fkupJmJ4uVLU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0383/1039] rocker: fix a sleeping in atomic bug Date: Mon, 24 Jan 2022 19:36:12 +0100 Message-Id: <20220124184138.185390373@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 43d012123122cc69feacab55b71369f386c19566 ] This code is holding the &ofdpa->flow_tbl_lock spinlock so it is not allowed to sleep. That means we have to pass the OFDPA_OP_FLAG_NOWAIT flag to ofdpa_flow_tbl_del(). Fixes: 936bd486564a ("rocker: use FIB notifications instead of switchdev ca= lls") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/rocker/rocker_ofdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c b/drivers/net/ether= net/rocker/rocker_ofdpa.c index 3e1ca7a8d0295..bc70c6abd6a5b 100644 --- a/drivers/net/ethernet/rocker/rocker_ofdpa.c +++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c @@ -2783,7 +2783,8 @@ static void ofdpa_fib4_abort(struct rocker *rocker) if (!ofdpa_port) continue; nh->fib_nh_flags &=3D ~RTNH_F_OFFLOAD; - ofdpa_flow_tbl_del(ofdpa_port, OFDPA_OP_FLAG_REMOVE, + ofdpa_flow_tbl_del(ofdpa_port, + OFDPA_OP_FLAG_REMOVE | OFDPA_OP_FLAG_NOWAIT, flow_entry); } spin_unlock_irqrestore(&ofdpa->flow_tbl_lock, flags); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15427C4321E for ; Mon, 24 Jan 2022 23:45:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2361634AbiAXXki (ORCPT ); Mon, 24 Jan 2022 18:40:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841133AbiAXW5l (ORCPT ); Mon, 24 Jan 2022 17:57:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D61DC0401FB; Mon, 24 Jan 2022 13:12:12 -0800 (PST) Received: from smtp.kernel.org (relay.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 19EB5B8123A; Mon, 24 Jan 2022 21:12:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A3F8C340E5; Mon, 24 Jan 2022 21:12:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058729; bh=I7z8eH5nCgiPqJded8zsJpYyxh4knj/NV0JID3n0uKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SJ/MVyMVepdG/TnAmcviKoMpXLPIPC93BluJFdJUOjDfVMrpNINgAIHdMd3FrnkYO z3luv+Eja5lNlyidpNjOxM2+oIINepA2tD5UETncyUXlZoPJgcsBAKapdQkt7cuuhY uQ7dC+YMb3SJvMUsH28FiQe9hEgiz+7YwuXvPLuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Elder , Jiasheng Jiang , Sasha Levin Subject: [PATCH 5.16 0384/1039] staging: greybus: audio: Check null pointer Date: Mon, 24 Jan 2022 19:36:13 +0100 Message-Id: <20220124184138.217453976@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 2e81948177d769106754085c3e03534e6cc1f623 ] As the possible alloc failure of devm_kcalloc(), it could return null pointer. Therefore, 'strings' should be checked and return NULL if alloc fails to prevent the dereference of the NULL pointer. Also, the caller should also deal with the return value of the gb_generate_enum_strings() and return -ENOMEM if returns NULL. Moreover, because the memory allocated with devm_kzalloc() will be freed automatically when the last reference to the device is dropped, the 'gbe' in gbaudio_tplg_create_enum_kctl() and gbaudio_tplg_create_enum_ctl() do not need to free manually. But the 'control' in gbaudio_tplg_create_widget() and gbaudio_tplg_process_kcontrols() has a specially error handle to cleanup. So it should be better to cleanup 'control' when fails. Fixes: e65579e335da ("greybus: audio: topology: Enable enumerated control s= upport") Reviewed-by: Alex Elder Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20220104150628.1987906-1-jiasheng@iscas.ac.= cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/greybus/audio_topology.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/gre= ybus/audio_topology.c index 7f7d558b76d04..62d7674852bec 100644 --- a/drivers/staging/greybus/audio_topology.c +++ b/drivers/staging/greybus/audio_topology.c @@ -147,6 +147,9 @@ static const char **gb_generate_enum_strings(struct gba= udio_module_info *gb, =20 items =3D le32_to_cpu(gbenum->items); strings =3D devm_kcalloc(gb->dev, items, sizeof(char *), GFP_KERNEL); + if (!strings) + return NULL; + data =3D gbenum->names; =20 for (i =3D 0; i < items; i++) { @@ -655,6 +658,8 @@ static int gbaudio_tplg_create_enum_kctl(struct gbaudio= _module_info *gb, /* since count=3D1, and reg is dummy */ gbe->items =3D le32_to_cpu(gb_enum->items); gbe->texts =3D gb_generate_enum_strings(gb, gb_enum); + if (!gbe->texts) + return -ENOMEM; =20 /* debug enum info */ dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->items, @@ -862,6 +867,8 @@ static int gbaudio_tplg_create_enum_ctl(struct gbaudio_= module_info *gb, /* since count=3D1, and reg is dummy */ gbe->items =3D le32_to_cpu(gb_enum->items); gbe->texts =3D gb_generate_enum_strings(gb, gb_enum); + if (!gbe->texts) + return -ENOMEM; =20 /* debug enum info */ dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->items, @@ -1072,6 +1079,10 @@ static int gbaudio_tplg_create_widget(struct gbaudio= _module_info *module, csize +=3D le16_to_cpu(gbenum->names_length); control->texts =3D (const char * const *) gb_generate_enum_strings(module, gbenum); + if (!control->texts) { + ret =3D -ENOMEM; + goto error; + } control->items =3D le32_to_cpu(gbenum->items); } else { csize =3D sizeof(struct gb_audio_control); @@ -1181,6 +1192,10 @@ static int gbaudio_tplg_process_kcontrols(struct gba= udio_module_info *module, csize +=3D le16_to_cpu(gbenum->names_length); control->texts =3D (const char * const *) gb_generate_enum_strings(module, gbenum); + if (!control->texts) { + ret =3D -ENOMEM; + goto error; + } control->items =3D le32_to_cpu(gbenum->items); } else { csize =3D sizeof(struct gb_audio_control); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06989C4167D for ; Mon, 24 Jan 2022 23:47:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362254AbiAXXmD (ORCPT ); Mon, 24 Jan 2022 18:42:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841129AbiAXW5l (ORCPT ); Mon, 24 Jan 2022 17:57:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B47DC0401FF; Mon, 24 Jan 2022 13:12:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 00DA9B811FB; Mon, 24 Jan 2022 21:12:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62CC3C340E5; Mon, 24 Jan 2022 21:12:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058732; bh=GkT1JKyiWTehfmwWT0NQjNXlQrkt2/3NKwSy1Olvcsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2eUlu+PYiETeCI8Xp7tYT5u8B/V0qn8YkNSSRkC0tEbELOTT8hwXCLxww8/2mPzFQ CYZ1JUMjENBPqwZIkxOrs1blm5KEruUQnj3kK5tlz6sDtkVKiNhne4wXvOBI4dz3aH Np9Y5AIaoaV1lruOMdeLpb8Mc7jD+hkiaLciv630= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0385/1039] fsl/fman: Check for null pointer after calling devm_ioremap Date: Mon, 24 Jan 2022 19:36:14 +0100 Message-Id: <20220124184138.252013946@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit d5a73ec96cc57cf67e51b12820fc2354e7ca46f8 ] As the possible failure of the allocation, the devm_ioremap() may return NULL pointer. Take tgec_initialization() as an example. If allocation fails, the params->base_addr will be NULL pointer and will be assigned to tgec->regs in tgec_config(). Then it will cause the dereference of NULL pointer in set_mac_address(), which is called by tgec_init(). Therefore, it should be better to add the sanity check after the calling of the devm_ioremap(). Fixes: 3933961682a3 ("fsl/fman: Add FMan MAC driver") Signed-off-by: Jiasheng Jiang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/freescale/fman/mac.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethern= et/freescale/fman/mac.c index d9fc5c456bf3e..39ae965cd4f64 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -94,14 +94,17 @@ static void mac_exception(void *handle, enum fman_mac_e= xceptions ex) __func__, ex); } =20 -static void set_fman_mac_params(struct mac_device *mac_dev, - struct fman_mac_params *params) +static int set_fman_mac_params(struct mac_device *mac_dev, + struct fman_mac_params *params) { struct mac_priv_s *priv =3D mac_dev->priv; =20 params->base_addr =3D (typeof(params->base_addr)) devm_ioremap(priv->dev, mac_dev->res->start, resource_size(mac_dev->res)); + if (!params->base_addr) + return -ENOMEM; + memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr)); params->max_speed =3D priv->max_speed; params->phy_if =3D mac_dev->phy_if; @@ -112,6 +115,8 @@ static void set_fman_mac_params(struct mac_device *mac_= dev, params->event_cb =3D mac_exception; params->dev_id =3D mac_dev; params->internal_phy_node =3D priv->internal_phy_node; + + return 0; } =20 static int tgec_initialization(struct mac_device *mac_dev) @@ -123,7 +128,9 @@ static int tgec_initialization(struct mac_device *mac_d= ev) =20 priv =3D mac_dev->priv; =20 - set_fman_mac_params(mac_dev, ¶ms); + err =3D set_fman_mac_params(mac_dev, ¶ms); + if (err) + goto _return; =20 mac_dev->fman_mac =3D tgec_config(¶ms); if (!mac_dev->fman_mac) { @@ -169,7 +176,9 @@ static int dtsec_initialization(struct mac_device *mac_= dev) =20 priv =3D mac_dev->priv; =20 - set_fman_mac_params(mac_dev, ¶ms); + err =3D set_fman_mac_params(mac_dev, ¶ms); + if (err) + goto _return; =20 mac_dev->fman_mac =3D dtsec_config(¶ms); if (!mac_dev->fman_mac) { @@ -218,7 +227,9 @@ static int memac_initialization(struct mac_device *mac_= dev) =20 priv =3D mac_dev->priv; =20 - set_fman_mac_params(mac_dev, ¶ms); + err =3D set_fman_mac_params(mac_dev, ¶ms); + if (err) + goto _return; =20 if (priv->max_speed =3D=3D SPEED_10000) params.phy_if =3D PHY_INTERFACE_MODE_XGMII; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A7C8C433EF for ; Mon, 24 Jan 2022 21:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378694AbiAXVqJ (ORCPT ); Mon, 24 Jan 2022 16:46:09 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33918 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448261AbiAXVMT (ORCPT ); Mon, 24 Jan 2022 16:12:19 -0500 Received: from smtp.kernel.org (relay.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 48423B811FB; Mon, 24 Jan 2022 21:12:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 756C7C340E5; Mon, 24 Jan 2022 21:12:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058736; bh=hMS3Pfo/RADStheTOI07FspzNnegx1/g9BH7Y01uFTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O/I9KwmMFVAtRNHA1mRkqoQO4cmWUJeR2Z69580OJh7UeGYhb3xoJ7WBy7Y9xXJ+8 ZDyaVCOREXW29/znMbStX0b34yMZY1ArTrHxzTDp9aK5lYyQaxt4ENJuwrEN1pkbOO SJL16WeMfCX23a8PDBkDlRMOLzjX6pvMT/VldSKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0386/1039] Bluetooth: hci_bcm: Check for error irq Date: Mon, 24 Jan 2022 19:36:15 +0100 Message-Id: <20220124184138.292152168@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit b38cd3b42fba66cc538edb9cf77e07881f43f8e2 ] For the possible failure of the platform_get_irq(), the returned irq could be error number and will finally cause the failure of the request_irq(). Consider that platform_get_irq() can now in certain cases return -EPROBE_DEFER, and the consequences of letting request_irq() effectively convert that into -EINVAL, even at probe time rather than later on. So it might be better to check just now. Fixes: 0395ffc1ee05 ("Bluetooth: hci_bcm: Add PM for BCM devices") Signed-off-by: Jiasheng Jiang Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bluetooth/hci_bcm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index ef54afa293574..7abf99f0ee399 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -1188,7 +1188,12 @@ static int bcm_probe(struct platform_device *pdev) return -ENOMEM; =20 dev->dev =3D &pdev->dev; - dev->irq =3D platform_get_irq(pdev, 0); + + ret =3D platform_get_irq(pdev, 0); + if (ret < 0) + return ret; + + dev->irq =3D ret; =20 /* Initialize routing field to an unused value */ dev->pcm_int_params[0] =3D 0xff; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 029FFC43217 for ; Mon, 24 Jan 2022 23:45:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2361589AbiAXXk2 (ORCPT ); Mon, 24 Jan 2022 18:40:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841132AbiAXW5l (ORCPT ); Mon, 24 Jan 2022 17:57:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12822C08C5C0; Mon, 24 Jan 2022 13:12:20 -0800 (PST) Received: from smtp.kernel.org (relay.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 A72996131F; Mon, 24 Jan 2022 21:12:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0F17C340E5; Mon, 24 Jan 2022 21:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058739; bh=4ttaYS0IPIApvX9jBxMH4S+arQVzSNj44W36l/3hhes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gp0qYonjln018BpDH5ErYiVRN7oDbW16g4Y/LYNOvN7FAFiss4F5ezQ24umFDNKpK ctvqlpggVlHYLSk0MnMTeiC75R/TJ2VO2/Ek0DRp+C3KB1kteQS3wnc9NZKz3e0iAa dTh9XDvtgQbxXbQ3AYqBkwKNwzhIsfORo73vWKUM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0387/1039] Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe Date: Mon, 24 Jan 2022 19:36:16 +0100 Message-Id: <20220124184138.327483962@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 6845667146a28c09b5dfc401c1ad112374087944 ] The function devm_gpiod_get_index() return error pointers on error. Thus devm_gpiod_get_index_optional() could return NULL and error pointers. The same as devm_gpiod_get_optional() function. Using IS_ERR_OR_NULL() check to catch error pointers. Fixes: 77131dfe ("Bluetooth: hci_qca: Replace devm_gpiod_get() with devm_gp= iod_get_optional()") Signed-off-by: Miaoqian Lin Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bluetooth/hci_qca.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 9e99311038ae8..f6e91fb432a3b 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -2059,14 +2059,14 @@ static int qca_serdev_probe(struct serdev_device *s= erdev) =20 qcadev->bt_en =3D devm_gpiod_get_optional(&serdev->dev, "enable", GPIOD_OUT_LOW); - if (!qcadev->bt_en && data->soc_type =3D=3D QCA_WCN6750) { + if (IS_ERR_OR_NULL(qcadev->bt_en) && data->soc_type =3D=3D QCA_WCN6750) { dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n"); power_ctrl_enabled =3D false; } =20 qcadev->sw_ctrl =3D devm_gpiod_get_optional(&serdev->dev, "swctrl", GPIOD_IN); - if (!qcadev->sw_ctrl && data->soc_type =3D=3D QCA_WCN6750) + if (IS_ERR_OR_NULL(qcadev->sw_ctrl) && data->soc_type =3D=3D QCA_WCN6750) dev_warn(&serdev->dev, "failed to acquire SW_CTRL gpio\n"); =20 qcadev->susclk =3D devm_clk_get_optional(&serdev->dev, NULL); @@ -2088,7 +2088,7 @@ static int qca_serdev_probe(struct serdev_device *ser= dev) =20 qcadev->bt_en =3D devm_gpiod_get_optional(&serdev->dev, "enable", GPIOD_OUT_LOW); - if (!qcadev->bt_en) { + if (IS_ERR_OR_NULL(qcadev->bt_en)) { dev_warn(&serdev->dev, "failed to acquire enable gpio\n"); power_ctrl_enabled =3D false; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B68FC41535 for ; Mon, 24 Jan 2022 21:47:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378722AbiAXVqV (ORCPT ); Mon, 24 Jan 2022 16:46:21 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33960 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448321AbiAXVM1 (ORCPT ); Mon, 24 Jan 2022 16:12:27 -0500 Received: from smtp.kernel.org (relay.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 1A2CAB8123D; Mon, 24 Jan 2022 21:12:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68BEBC340E5; Mon, 24 Jan 2022 21:12:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058744; bh=cZlP7inydCpcNyjSPOxf7NCHLOzHE2ldB8dKrIBV8pU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BsJe1Io6TcIskWxCC+vmN/DsR5+3H+q/EBAeI37DQMpmh4mbcNm3lNo2gb2XqBRsc 0DX0Sli9O1mnkh3PekaSub3thsJHU8A14XfZ7WEpIgAXUBEfwCj9wDQuSMkDseCfyO Iyzouan8N3yUTRrP4pSuG1krBMZJmviWfIi3jTBg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Karsten Graul , Wen Gu , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0388/1039] net/smc: Reset conn->lgr when link group registration fails Date: Mon, 24 Jan 2022 19:36:17 +0100 Message-Id: <20220124184138.361043091@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wen Gu [ Upstream commit 36595d8ad46d9e4c41cc7c48c4405b7c3322deac ] SMC connections might fail to be registered in a link group due to unable to find a usable link during its creation. As a result, smc_conn_create() will return a failure and most resources related to the connection won't be applied or initialized, such as conn->abort_work or conn->lnk. If smc_conn_free() is invoked later, it will try to access the uninitialized resources related to the connection, thus causing a warning or crash. This patch tries to fix this by resetting conn->lgr to NULL if an abnormal exit occurs in smc_lgr_register_conn(), thus avoiding the access to uninitialized resources in smc_conn_free(). Meanwhile, the new created link group should be terminated if smc connections can't be registered in it. So smc_lgr_cleanup_early() is modified to take care of link group only and invoked to terminate unusable link group by smc_conn_create(). The call to smc_conn_free() is moved out from smc_lgr_cleanup_early() to smc_conn_abort(). Fixes: 56bc3b2094b4 ("net/smc: assign link to a new connection") Suggested-by: Karsten Graul Signed-off-by: Wen Gu Acked-by: Karsten Graul Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/smc/af_smc.c | 8 +++++--- net/smc/smc_core.c | 12 +++++++----- net/smc/smc_core.h | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 1c9289f56dc47..211cd91b6c408 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -632,10 +632,12 @@ static int smc_connect_decline_fallback(struct smc_so= ck *smc, int reason_code, =20 static void smc_conn_abort(struct smc_sock *smc, int local_first) { + struct smc_connection *conn =3D &smc->conn; + struct smc_link_group *lgr =3D conn->lgr; + + smc_conn_free(conn); if (local_first) - smc_lgr_cleanup_early(&smc->conn); - else - smc_conn_free(&smc->conn); + smc_lgr_cleanup_early(lgr); } =20 /* check if there is a rdma device available for this connection. */ diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index a6849362f4ddd..c9a8092c4ac96 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -171,8 +171,10 @@ static int smc_lgr_register_conn(struct smc_connection= *conn, bool first) =20 if (!conn->lgr->is_smcd) { rc =3D smcr_lgr_conn_assign_link(conn, first); - if (rc) + if (rc) { + conn->lgr =3D NULL; return rc; + } } /* find a new alert_token_local value not yet used by some connection * in this link group @@ -622,15 +624,13 @@ int smcd_nl_get_lgr(struct sk_buff *skb, struct netli= nk_callback *cb) return skb->len; } =20 -void smc_lgr_cleanup_early(struct smc_connection *conn) +void smc_lgr_cleanup_early(struct smc_link_group *lgr) { - struct smc_link_group *lgr =3D conn->lgr; spinlock_t *lgr_lock; =20 if (!lgr) return; =20 - smc_conn_free(conn); smc_lgr_list_head(lgr, &lgr_lock); spin_lock_bh(lgr_lock); /* do not use this link group for new connections */ @@ -1832,8 +1832,10 @@ create: write_lock_bh(&lgr->conns_lock); rc =3D smc_lgr_register_conn(conn, true); write_unlock_bh(&lgr->conns_lock); - if (rc) + if (rc) { + smc_lgr_cleanup_early(lgr); goto out; + } } conn->local_tx_ctrl.common.type =3D SMC_CDC_MSG_TYPE; conn->local_tx_ctrl.len =3D SMC_WR_TX_SIZE; diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h index d63b08274197e..73d0c35d3eb77 100644 --- a/net/smc/smc_core.h +++ b/net/smc/smc_core.h @@ -468,7 +468,7 @@ static inline void smc_set_pci_values(struct pci_dev *p= ci_dev, struct smc_sock; struct smc_clc_msg_accept_confirm; =20 -void smc_lgr_cleanup_early(struct smc_connection *conn); +void smc_lgr_cleanup_early(struct smc_link_group *lgr); void smc_lgr_terminate_sched(struct smc_link_group *lgr); void smcr_port_add(struct smc_ib_device *smcibdev, u8 ibport); void smcr_port_err(struct smc_ib_device *smcibdev, u8 ibport); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADA41C43219 for ; Mon, 24 Jan 2022 23:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362190AbiAXXlx (ORCPT ); Mon, 24 Jan 2022 18:41:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841134AbiAXW5l (ORCPT ); Mon, 24 Jan 2022 17:57:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 361B1C03463D; Mon, 24 Jan 2022 13:12:30 -0800 (PST) Received: from smtp.kernel.org (relay.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 F0E8CB810BD; Mon, 24 Jan 2022 21:12:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26B7FC340E5; Mon, 24 Jan 2022 21:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058747; bh=tc4vaYi2tH8OU8FZACwACbNtaBA8r1yAdX/YVgAuQhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0V0GcTUmw8QtD2LZpo5U0g33KqVRJs3NX5d6vcYVuy+xe1ZMJEJYdmOTJTxL70TlJ r+5KUG9GtT9sYD96QT0CYMqKCrzfh1FpVZPxmtEXEfqTsySwjYrrfQ8v7RmBbP9y/e Ro1n1QPuHDzJDwOQHNAL5OBJeUgxztQuAGJeqFkk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Sasha Levin Subject: [PATCH 5.16 0389/1039] usb: dwc3: qcom: Fix NULL vs IS_ERR checking in dwc3_qcom_probe Date: Mon, 24 Jan 2022 19:36:18 +0100 Message-Id: <20220124184138.394212355@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit b52fe2dbb3e655eb1483000adfab68a219549e13 ] Since the acpi_create_platform_device() function may return error pointers, dwc3_qcom_create_urs_usb_platdev() function may return error pointers too. Using IS_ERR_OR_NULL() to check the return value to fix this. Fixes: c25c210f590e ("usb: dwc3: qcom: add URS Host support for sdm845 ACPI= boot") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20211222111823.22887-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/dwc3/dwc3-qcom.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 3cb01cdd02c29..b81a9e1c13153 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -769,9 +769,12 @@ static int dwc3_qcom_probe(struct platform_device *pde= v) =20 if (qcom->acpi_pdata->is_urs) { qcom->urs_usb =3D dwc3_qcom_create_urs_usb_platdev(dev); - if (!qcom->urs_usb) { + if (IS_ERR_OR_NULL(qcom->urs_usb)) { dev_err(dev, "failed to create URS USB platdev\n"); - return -ENODEV; + if (!qcom->urs_usb) + return -ENODEV; + else + return PTR_ERR(qcom->urs_usb); } } } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89C48C4332F for ; Mon, 24 Jan 2022 21:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353747AbiAXVqg (ORCPT ); Mon, 24 Jan 2022 16:46:36 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35602 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448372AbiAXVMc (ORCPT ); Mon, 24 Jan 2022 16:12:32 -0500 Received: from smtp.kernel.org (relay.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 5F56C6131F; Mon, 24 Jan 2022 21:12:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30496C340E5; Mon, 24 Jan 2022 21:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058750; bh=IjNxPGEtSYkVvnCwbHUvJvg0zijHBM+PZ9Fgl4BzepI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fDgPvDMxi5maui4pDfdzJp3zWSTYQRPMXKfTIhEhp89li4R6Sf3T0whgFEGwV2iEk X6IQ/0Ng50oCOvCkyaJNBFFvXly0Rh40Hwwg9Lu9koYigRbehOHvK0tHHLMcS4mWVz q997VIK41FdjCIPpdfLUR72zQcRLeXMnMZgjcovc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Minas Harutyunyan , Dinh Nguyen , Sasha Levin Subject: [PATCH 5.16 0390/1039] usb: dwc2: do not gate off the hardware if it does not support clock gating Date: Mon, 24 Jan 2022 19:36:19 +0100 Message-Id: <20220124184138.426988331@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dinh Nguyen [ Upstream commit 34146c68083f1aef6709196b3dc888c1ceffd357 ] We should not be clearing the HCD_FLAG_HW_ACCESSIBLE bit if the hardware does not support clock gating. Fixes: 50fb0c128b6e ("usb: dwc2: Add clock gating entering flow by system s= uspend") Acked-by: Minas Harutyunyan Signed-off-by: Dinh Nguyen Link: https://lore.kernel.org/r/20220104135922.734776-1-dinguyen@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/dwc2/hcd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 13c779a28e94f..f63a27d11fac8 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -4399,11 +4399,12 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd) * If not hibernation nor partial power down are supported, * clock gating is used to save power. */ - if (!hsotg->params.no_clock_gating) + if (!hsotg->params.no_clock_gating) { dwc2_host_enter_clock_gating(hsotg); =20 - /* After entering suspend, hardware is not accessible */ - clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + /* After entering suspend, hardware is not accessible */ + clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + } break; default: goto skip_power_saving; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51C50C3525A for ; Mon, 24 Jan 2022 21:47:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450630AbiAXVrF (ORCPT ); Mon, 24 Jan 2022 16:47:05 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34022 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448405AbiAXVMg (ORCPT ); Mon, 24 Jan 2022 16:12:36 -0500 Received: from smtp.kernel.org (relay.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 3E771B8123A; Mon, 24 Jan 2022 21:12:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FA87C340E5; Mon, 24 Jan 2022 21:12:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058753; bh=hmaQm9JcV2b+UORMYGh52WT9l5TZ+1UROquwJJVRB+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EOCq9iVQ0jJcmVA/0hTVI13SjUpzMVsQ3vfbPVLsG4mLHtpKmNB0kT5l5IptSMktU e5zs7bpiW6h/rn787/YZdTLZn85EDxRvQhp1sqfudK0PUGcqsyDK+bW8HfCEi7RAZG YaYUfM7rkRWbF6BOiUQ+6KZxI2fZIaKHcbWAWBoY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Minas Harutyunyan , John Keeping , Sasha Levin Subject: [PATCH 5.16 0391/1039] usb: dwc2: gadget: initialize max_speed from params Date: Mon, 24 Jan 2022 19:36:20 +0100 Message-Id: <20220124184138.458149131@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Keeping [ Upstream commit 92ef98a4caacad6d4a1490dda45d81ae5ccf5bc9 ] DWC2 may be paired with a full-speed PHY which is not capable of high-speed operation. Report this correctly to the gadget core by setting max_speed from the core parameters. Prior to commit 5324bad66f09f ("usb: dwc2: gadget: implement udc_set_speed()") this didn't cause the hardware to be configured incorrectly, although the speed may have been reported incorrectly. But after that commit params.speed is updated based on a value passed in by the gadget core which may set it to a faster speed than is supported by the hardware. Initialising the max_speed parameter ensures the speed passed to dwc2_gadget_set_speed() will be one supported by the hardware. Fixes: 5324bad66f09f ("usb: dwc2: gadget: implement udc_set_speed()") Acked-by: Minas Harutyunyan Signed-off-by: John Keeping Link: https://lore.kernel.org/r/20220106115731.1473909-1-john@metanate.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/dwc2/gadget.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index ab8d7dad9f567..43cf49c4e5e59 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -4974,7 +4974,18 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg) hsotg->params.g_np_tx_fifo_size); dev_dbg(dev, "RXFIFO size: %d\n", hsotg->params.g_rx_fifo_size); =20 - hsotg->gadget.max_speed =3D USB_SPEED_HIGH; + switch (hsotg->params.speed) { + case DWC2_SPEED_PARAM_LOW: + hsotg->gadget.max_speed =3D USB_SPEED_LOW; + break; + case DWC2_SPEED_PARAM_FULL: + hsotg->gadget.max_speed =3D USB_SPEED_FULL; + break; + default: + hsotg->gadget.max_speed =3D USB_SPEED_HIGH; + break; + } + hsotg->gadget.ops =3D &dwc2_hsotg_gadget_ops; hsotg->gadget.name =3D dev_name(dev); hsotg->gadget.otg_caps =3D &hsotg->params.otg_caps; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECAE3C433FE for ; Mon, 24 Jan 2022 23:47:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362105AbiAXXlk (ORCPT ); Mon, 24 Jan 2022 18:41:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841161AbiAXW5q (ORCPT ); Mon, 24 Jan 2022 17:57:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2187BC03463E; Mon, 24 Jan 2022 13:12:38 -0800 (PST) Received: from smtp.kernel.org (relay.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 A5D75612E9; Mon, 24 Jan 2022 21:12:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FAE1C340E5; Mon, 24 Jan 2022 21:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058757; bh=k1eXA3Vc/yXVD7aYepW49WbAwf5hJ+QkyGEAYVbM4mo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=niv0wF7ayJbkawU7oDMzjB23gJP9dJWfky0sLUavYJ13/EvzmNJEJSG27m0z+IRnk TYEHBbL3F0rkkCUWgXuskPV/qmEp77RKQVxR2dwHlhA8XDrQd9yzbLZNz5kfGzsjpt I17iPoYXJxP9WTTWlr+lCb4p5QZ34Won8irB7OuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Hofman , John Keeping , Sasha Levin Subject: [PATCH 5.16 0392/1039] usb: gadget: u_audio: fix calculations for small bInterval Date: Mon, 24 Jan 2022 19:36:21 +0100 Message-Id: <20220124184138.497253682@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Keeping [ Upstream commit f2f69bf65df12176843ca11eab99949ba69e128b ] If bInterval is 1, then p_interval is 8000 and p_interval_mil is 8E9, which is too big for a 32-bit value. While the storage is indeed 64-bit, this value is used as the divisor in do_div() which will truncate it into a uint32_t leading to incorrect calculated values. Switch back to keeping the base value in struct snd_uac_chip which fits easily into an int, meaning that the division can be done in two steps with the divisor fitting safely into a uint32_t on both steps. Fixes: 6fec018a7e70 ("usb: gadget: u_audio.c: Adding Playback Pitch ctl for= sync playback") Tested-by: Pavel Hofman Signed-off-by: John Keeping Link: https://lore.kernel.org/r/20220104183243.718258-1-john@metanate.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/gadget/function/u_audio.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/fun= ction/u_audio.c index c46400be54641..4fb05f9576a67 100644 --- a/drivers/usb/gadget/function/u_audio.c +++ b/drivers/usb/gadget/function/u_audio.c @@ -76,8 +76,8 @@ struct snd_uac_chip { struct snd_pcm *pcm; =20 /* pre-calculated values for playback iso completion */ - unsigned long long p_interval_mil; unsigned long long p_residue_mil; + unsigned int p_interval; unsigned int p_framesize; }; =20 @@ -194,21 +194,24 @@ static void u_audio_iso_complete(struct usb_ep *ep, s= truct usb_request *req) * If there is a residue from this division, add it to the * residue accumulator. */ + unsigned long long p_interval_mil =3D uac->p_interval * 1000000ULL; + pitched_rate_mil =3D (unsigned long long) params->p_srate * prm->pitch; div_result =3D pitched_rate_mil; - do_div(div_result, uac->p_interval_mil); + do_div(div_result, uac->p_interval); + do_div(div_result, 1000000); frames =3D (unsigned int) div_result; =20 pr_debug("p_srate %d, pitch %d, interval_mil %llu, frames %d\n", - params->p_srate, prm->pitch, uac->p_interval_mil, frames); + params->p_srate, prm->pitch, p_interval_mil, frames); =20 p_pktsize =3D min_t(unsigned int, uac->p_framesize * frames, ep->maxpacket); =20 if (p_pktsize < ep->maxpacket) { - residue_frames_mil =3D pitched_rate_mil - frames * uac->p_interval_mil; + residue_frames_mil =3D pitched_rate_mil - frames * p_interval_mil; p_pktsize_residue_mil =3D uac->p_framesize * residue_frames_mil; } else p_pktsize_residue_mil =3D 0; @@ -222,11 +225,11 @@ static void u_audio_iso_complete(struct usb_ep *ep, s= truct usb_request *req) * size and decrease the accumulator. */ div_result =3D uac->p_residue_mil; - do_div(div_result, uac->p_interval_mil); + do_div(div_result, uac->p_interval); + do_div(div_result, 1000000); if ((unsigned int) div_result >=3D uac->p_framesize) { req->length +=3D uac->p_framesize; - uac->p_residue_mil -=3D uac->p_framesize * - uac->p_interval_mil; + uac->p_residue_mil -=3D uac->p_framesize * p_interval_mil; pr_debug("increased req length to %d\n", req->length); } pr_debug("remains uac->p_residue_mil %llu\n", uac->p_residue_mil); @@ -591,7 +594,7 @@ int u_audio_start_playback(struct g_audio *audio_dev) unsigned int factor; const struct usb_endpoint_descriptor *ep_desc; int req_len, i; - unsigned int p_interval, p_pktsize; + unsigned int p_pktsize; =20 ep =3D audio_dev->in_ep; prm =3D &uac->p_prm; @@ -612,11 +615,10 @@ int u_audio_start_playback(struct g_audio *audio_dev) /* pre-compute some values for iso_complete() */ uac->p_framesize =3D params->p_ssize * num_channels(params->p_chmask); - p_interval =3D factor / (1 << (ep_desc->bInterval - 1)); - uac->p_interval_mil =3D (unsigned long long) p_interval * 1000000; + uac->p_interval =3D factor / (1 << (ep_desc->bInterval - 1)); p_pktsize =3D min_t(unsigned int, uac->p_framesize * - (params->p_srate / p_interval), + (params->p_srate / uac->p_interval), ep->maxpacket); =20 req_len =3D p_pktsize; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE205C4332F for ; Mon, 24 Jan 2022 23:45:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2361377AbiAXXjz (ORCPT ); Mon, 24 Jan 2022 18:39:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841169AbiAXW5q (ORCPT ); Mon, 24 Jan 2022 17:57:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85EDBC03463F; Mon, 24 Jan 2022 13:12:42 -0800 (PST) Received: from smtp.kernel.org (relay.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 4C90AB80FA3; Mon, 24 Jan 2022 21:12:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E762C340E5; Mon, 24 Jan 2022 21:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058760; bh=IixZNRqrC7fA+CC4osZInDTPVqKj2ZTmVK4/tN2viaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OXuajE/5/YK/kjk4AiTKnXlQLCGC2HHoMPHaUJo2z44kY3SVr2o6yJgOBlJzCkWCJ YGTbLDRtqIBtflMIYtuqqFbprbOOiwn3QKi3a6qtx7GbHe7it8b56sTxD+K7XAX3ln 8EXR1sqlnKyb4XkTqXqhF7ek8K43HZFwfCk6CL1Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Hofman , Sasha Levin Subject: [PATCH 5.16 0393/1039] usb: gadget: u_audio: Subdevice 0 for capture ctls Date: Mon, 24 Jan 2022 19:36:22 +0100 Message-Id: <20220124184138.534127053@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hofman [ Upstream commit 601a5bc1aeef772ab1f47582fd322957799f5ab5 ] Both capture and playback alsa devices use subdevice 0. Yet capture-side ctls are defined for subdevice 1. The patch sets subdevice 0 for them. Fixes: 02de698ca812 ("usb: gadget: u_audio: add bi-directional volume and m= ute support") Signed-off-by: Pavel Hofman Link: https://lore.kernel.org/r/20220105104643.90125-1-pavel.hofman@ivitera= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/gadget/function/u_audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/fun= ction/u_audio.c index 4fb05f9576a67..4561d7a183ff4 100644 --- a/drivers/usb/gadget/function/u_audio.c +++ b/drivers/usb/gadget/function/u_audio.c @@ -1147,7 +1147,7 @@ int g_audio_setup(struct g_audio *g_audio, const char= *pcm_name, } =20 kctl->id.device =3D pcm->device; - kctl->id.subdevice =3D i; + kctl->id.subdevice =3D 0; =20 err =3D snd_ctl_add(card, kctl); if (err < 0) @@ -1170,7 +1170,7 @@ int g_audio_setup(struct g_audio *g_audio, const char= *pcm_name, } =20 kctl->id.device =3D pcm->device; - kctl->id.subdevice =3D i; + kctl->id.subdevice =3D 0; =20 =20 kctl->tlv.c =3D u_audio_volume_tlv; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF184C4332F for ; Mon, 24 Jan 2022 23:47:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362052AbiAXXla (ORCPT ); Mon, 24 Jan 2022 18:41:30 -0500 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 S1383742AbiAXW6B (ORCPT ); Mon, 24 Jan 2022 17:58:01 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3B9FC08E877; Mon, 24 Jan 2022 13:12:44 -0800 (PST) Received: from smtp.kernel.org (relay.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 6B3CAB81243; Mon, 24 Jan 2022 21:12:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 878E7C340E5; Mon, 24 Jan 2022 21:12:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058763; bh=anTBheG/cQTrGNr9zNDhDMuwJYqOQuxzSHzVVM1jvHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A0LnkABhV7JA/vE59syLzc7bFfbUBSj1bBG58XdJaGZCRgOaar6748BsLYec1rkwq +B7QJJsqgTLrbwFUMALuful7dk+zqdKYCM1SGJtQRQwx0h1vOxnEmMFphdAquFnJEE IvoBQzMyx+SPNiWk246pWvTZuFQwknnx7LsCrieI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Jiri Kosina , Sasha Levin Subject: [PATCH 5.16 0394/1039] HID: hid-uclogic-params: Invalid parameter check in uclogic_params_init Date: Mon, 24 Jan 2022 19:36:23 +0100 Message-Id: <20220124184138.566261375@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit f364c571a5c77e96de2d32062ff019d6b8d2e2bc ] The function performs a check on its input parameters, however, the hdev parameter is used before the check. Initialize the stack variables after checking the input parameters to avoid a possible NULL pointer dereference. Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery int= o a module") Addresses-Coverity-ID: 1443831 ("Null pointer dereference") Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/hid-uclogic-params.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-par= ams.c index adff1bd68d9f8..3c10b858cf74c 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -834,10 +834,10 @@ int uclogic_params_init(struct uclogic_params *params, struct hid_device *hdev) { int rc; - struct usb_device *udev =3D hid_to_usb_dev(hdev); - __u8 bNumInterfaces =3D udev->config->desc.bNumInterfaces; - struct usb_interface *iface =3D to_usb_interface(hdev->dev.parent); - __u8 bInterfaceNumber =3D iface->cur_altsetting->desc.bInterfaceNumber; + struct usb_device *udev; + __u8 bNumInterfaces; + struct usb_interface *iface; + __u8 bInterfaceNumber; bool found; /* The resulting parameters (noop) */ struct uclogic_params p =3D {0, }; @@ -848,6 +848,11 @@ int uclogic_params_init(struct uclogic_params *params, goto cleanup; } =20 + udev =3D hid_to_usb_dev(hdev); + bNumInterfaces =3D udev->config->desc.bNumInterfaces; + iface =3D to_usb_interface(hdev->dev.parent); + bInterfaceNumber =3D iface->cur_altsetting->desc.bInterfaceNumber; + /* * Set replacement report descriptor if the original matches the * specified size. Otherwise keep interface unchanged. --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6B05C433F5 for ; Mon, 24 Jan 2022 23:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386010AbiAXXj3 (ORCPT ); Mon, 24 Jan 2022 18:39:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841214AbiAXW6B (ORCPT ); Mon, 24 Jan 2022 17:58:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AC2EC08E87F; Mon, 24 Jan 2022 13:12:47 -0800 (PST) Received: from smtp.kernel.org (relay.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 AB80D611C8; Mon, 24 Jan 2022 21:12:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 909BCC340E5; Mon, 24 Jan 2022 21:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058766; bh=VCWqXz36B9QGd4a08A2VpVo1EMBQYp8qx7VMIPbcbn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w+NG9JvNkMbYWrgLL+FCYvl21ia8IT7fqfGZewyFwxd4WgqtsCs1v5gr2cbcgq1nY HUGiEBXJscXeRsWvbkrEI5Qw/bjGYCnOqQXPFoz4b+Dtq4ajXMr098Kf4J+aySW/Vi LnOgYfEtSEOXqB6a5+L5xCOiiR4WhyV4rP5DfQH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Jiri Kosina , Sasha Levin Subject: [PATCH 5.16 0395/1039] HID: hid-uclogic-params: Invalid parameter check in uclogic_params_get_str_desc Date: Mon, 24 Jan 2022 19:36:24 +0100 Message-Id: <20220124184138.598227098@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit 0a94131d6920916ccb6a357037c535533af08819 ] The function performs a check on the hdev input parameters, however, it is used before the check. Initialize the udev variable after the sanity check to avoid a possible NULL pointer dereference. Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery int= o a module") Addresses-Coverity-ID: 1443827 ("Null pointer dereference") Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/hid-uclogic-params.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-par= ams.c index 3c10b858cf74c..3a83e2c39b4fb 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -66,7 +66,7 @@ static int uclogic_params_get_str_desc(__u8 **pbuf, struc= t hid_device *hdev, __u8 idx, size_t len) { int rc; - struct usb_device *udev =3D hid_to_usb_dev(hdev); + struct usb_device *udev; __u8 *buf =3D NULL; =20 /* Check arguments */ @@ -75,6 +75,8 @@ static int uclogic_params_get_str_desc(__u8 **pbuf, struc= t hid_device *hdev, goto cleanup; } =20 + udev =3D hid_to_usb_dev(hdev); + buf =3D kmalloc(len, GFP_KERNEL); if (buf =3D=3D NULL) { rc =3D -ENOMEM; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67260C433EF for ; Mon, 24 Jan 2022 21:48:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574198AbiAXVsE (ORCPT ); Mon, 24 Jan 2022 16:48:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35772 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377730AbiAXVMv (ORCPT ); Mon, 24 Jan 2022 16:12:51 -0500 Received: from smtp.kernel.org (relay.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 9ED32611C8; Mon, 24 Jan 2022 21:12:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E8F0C340E5; Mon, 24 Jan 2022 21:12:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058769; bh=7n7G5SKrA1dBR0fD9xutzkUVLmfgbdkxbUUx2QGunBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KTuvbW9aY2GG7ms8oLJg8na2L5YSTXdKmjnWYoRiMo3rtQf0HKBXJJuyUHv6RzzhS OILEv9kEGIhfZv2nge3KbdH7JIlvIf3F+/GT6mLcA097teTz3x1lltEyVUPkCtO9ow yLzvihesLzJ1gs/mnoaf+AmhAFhlQDsJBrEX8fqQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Jiri Kosina , Sasha Levin Subject: [PATCH 5.16 0396/1039] HID: hid-uclogic-params: Invalid parameter check in uclogic_params_huion_init Date: Mon, 24 Jan 2022 19:36:25 +0100 Message-Id: <20220124184138.631040334@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit ff6b548afe4d9d1ff3a0f6ef79e8cbca25d8f905 ] The function performs a check on its input parameters, however, the hdev parameter is used before the check. Initialize the stack variables after checking the input parameters to avoid a possible NULL pointer dereference. Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery int= o a module") Addresses-Coverity-ID: 1443804 ("Null pointer dereference") Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/hid-uclogic-params.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-par= ams.c index 3a83e2c39b4fb..4136837e4d158 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -709,9 +709,9 @@ static int uclogic_params_huion_init(struct uclogic_par= ams *params, struct hid_device *hdev) { int rc; - struct usb_device *udev =3D hid_to_usb_dev(hdev); - struct usb_interface *iface =3D to_usb_interface(hdev->dev.parent); - __u8 bInterfaceNumber =3D iface->cur_altsetting->desc.bInterfaceNumber; + struct usb_device *udev; + struct usb_interface *iface; + __u8 bInterfaceNumber; bool found; /* The resulting parameters (noop) */ struct uclogic_params p =3D {0, }; @@ -725,6 +725,10 @@ static int uclogic_params_huion_init(struct uclogic_pa= rams *params, goto cleanup; } =20 + udev =3D hid_to_usb_dev(hdev); + iface =3D to_usb_interface(hdev->dev.parent); + bInterfaceNumber =3D iface->cur_altsetting->desc.bInterfaceNumber; + /* If it's not a pen interface */ if (bInterfaceNumber !=3D 0) { /* TODO: Consider marking the interface invalid */ --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 860C8C4332F for ; Mon, 24 Jan 2022 21:54:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574548AbiAXVtp (ORCPT ); Mon, 24 Jan 2022 16:49:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34150 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388853AbiAXVM7 (ORCPT ); Mon, 24 Jan 2022 16:12:59 -0500 Received: from smtp.kernel.org (relay.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 6B8EFB80FA3; Mon, 24 Jan 2022 21:12:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80F82C340EB; Mon, 24 Jan 2022 21:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058772; bh=jbqkzaLPuG7F9MJqasxivM+Wt50FAHFkrTX3lFvAvtw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0d0DaJOjH6SnSutFUe4AIw/GpBqYfPgbtv23ZyQrfO45qQSUZGaDZ/futrtcVUG4n ZBZmE5px7QYqrvsZ6bkdWyBT1/C934+eTfPsZL0RE+cgNY4C7EktvK6/FLxJIcXuzl bB9JQaGSYS5ppRnhesXFc57tJGCcGHFPBi7hC750= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Jiri Kosina , Sasha Levin Subject: [PATCH 5.16 0397/1039] HID: hid-uclogic-params: Invalid parameter check in uclogic_params_frame_init_v1_buttonpad Date: Mon, 24 Jan 2022 19:36:26 +0100 Message-Id: <20220124184138.662439112@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit aa320fdbbbb482c19100f51461bd0069753ce3d7 ] The function performs a check on the hdev input parameters, however, it is used before the check. Initialize the udev variable after the sanity check to avoid a possible NULL pointer dereference. Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery int= o a module") Addresses-Coverity-ID: 1443763 ("Null pointer dereference") Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/hid-uclogic-params.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-par= ams.c index 4136837e4d158..3e70f969fb849 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -452,7 +452,7 @@ static int uclogic_params_frame_init_v1_buttonpad( { int rc; bool found =3D false; - struct usb_device *usb_dev =3D hid_to_usb_dev(hdev); + struct usb_device *usb_dev; char *str_buf =3D NULL; const size_t str_len =3D 16; =20 @@ -462,6 +462,8 @@ static int uclogic_params_frame_init_v1_buttonpad( goto cleanup; } =20 + usb_dev =3D hid_to_usb_dev(hdev); + /* * Enable generic button mode */ --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA0E1C433EF for ; Mon, 24 Jan 2022 23:39:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2361121AbiAXXjF (ORCPT ); Mon, 24 Jan 2022 18:39:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382484AbiAXW6D (ORCPT ); Mon, 24 Jan 2022 17:58:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECAB4C02B87B; Mon, 24 Jan 2022 13:12:59 -0800 (PST) Received: from smtp.kernel.org (relay.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 942B9B81243; Mon, 24 Jan 2022 21:12:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97C6AC340E7; Mon, 24 Jan 2022 21:12:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058778; bh=yCS3kdcuvrsLpG2x1smI/oLscK7914Esvp5KKO44Nv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i1pYtNUec6sM6/7KbgnpE7CB9X+hB5illv/TepczY2eBiSYZP8zzTnz5ScK0bna8Z YkC7QgR5sISYbmDait3g5nYEjhqTZl7cWQYcH5mEFNYbU92WuIo0LNpVrgmwTWlgn7 Jt3Byeak5i0WdZq9r5kSldj5rrs/yUu9U2Lc5ZVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Suchanek , Sasha Levin Subject: [PATCH 5.16 0398/1039] debugfs: lockdown: Allow reading debugfs files that are not world readable Date: Mon, 24 Jan 2022 19:36:27 +0100 Message-Id: <20220124184138.697023872@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Suchanek [ Upstream commit 358fcf5ddbec4e6706405847d6a666f5933a6c25 ] When the kernel is locked down the kernel allows reading only debugfs files with mode 444. Mode 400 is also valid but is not allowed. Make the 444 into a mask. Fixes: 5496197f9b08 ("debugfs: Restrict debugfs when the kernel is locked d= own") Signed-off-by: Michal Suchanek Link: https://lore.kernel.org/r/20220104170505.10248-1-msuchanek@suse.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/debugfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 7d162b0efbf03..950c63fa4d0b2 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -147,7 +147,7 @@ static int debugfs_locked_down(struct inode *inode, struct file *filp, const struct file_operations *real_fops) { - if ((inode->i_mode & 07777) =3D=3D 0444 && + if ((inode->i_mode & 07777 & ~0444) =3D=3D 0 && !(filp->f_mode & FMODE_WRITE) && !real_fops->unlocked_ioctl && !real_fops->compat_ioctl && --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CD09C433FE for ; Mon, 24 Jan 2022 21:48:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574246AbiAXVsd (ORCPT ); Mon, 24 Jan 2022 16:48:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36068 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448564AbiAXVNC (ORCPT ); Mon, 24 Jan 2022 16:13:02 -0500 Received: from smtp.kernel.org (relay.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 2C4776146B; Mon, 24 Jan 2022 21:13:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8AA0C340E5; Mon, 24 Jan 2022 21:13:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058781; bh=KRYqqgWjbG1axnu97YGHjeYl7Ss7mR3mkioLhNf+bLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W2Ij4DJw8dExZEtBewcuDbXVPFPKvQN5zsnvr1ydjMfH+dc2HGO9fQZ89AdBWH7jX Eo5aNREwJY0UK2vjGevUhu8nkMJldzspcHiJnLdO6zfa2PzdkKiT5qLgxFNy1EaDQs fMWgh2BkWIq+6Jxcc1COq8opBqlPaalGHhe0l1jw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Sasha Levin Subject: [PATCH 5.16 0399/1039] drivers/firmware: Add missing platform_device_put() in sysfb_create_simplefb Date: Mon, 24 Jan 2022 19:36:28 +0100 Message-Id: <20220124184138.729231144@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 0589e8889dce8e0f0ea5bbf757f38865e2a469c1 ] Add the missing platform_device_put() before return from sysfb_create_simplefb() in the error handling case. Fixes: 8633ef82f101 ("drivers/firmware: consolidate EFI framebuffer setup f= or all arches") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20211231080431.15385-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/firmware/sysfb_simplefb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_sim= plefb.c index b86761904949c..303a491e520d1 100644 --- a/drivers/firmware/sysfb_simplefb.c +++ b/drivers/firmware/sysfb_simplefb.c @@ -113,12 +113,16 @@ __init int sysfb_create_simplefb(const struct screen_= info *si, sysfb_apply_efi_quirks(pd); =20 ret =3D platform_device_add_resources(pd, &res, 1); - if (ret) + if (ret) { + platform_device_put(pd); return ret; + } =20 ret =3D platform_device_add_data(pd, mode, sizeof(*mode)); - if (ret) + if (ret) { + platform_device_put(pd); return ret; + } =20 return platform_device_add(pd); } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F4E6C433EF for ; Mon, 24 Jan 2022 21:48:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376489AbiAXVsm (ORCPT ); Mon, 24 Jan 2022 16:48:42 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34316 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448595AbiAXVNH (ORCPT ); Mon, 24 Jan 2022 16:13:07 -0500 Received: from smtp.kernel.org (relay.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 5AA27B80CCF; Mon, 24 Jan 2022 21:13:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B3CDC340E5; Mon, 24 Jan 2022 21:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058785; bh=7sD7+lXcXIAbqic7rspXCLXl8Os/glrqskRtRCYDPKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XloTH4P7zBXGhweuG3UCN6wQz85ZBVls+R7fgCbVhHKzb/OxDZzQrt+eG8NUzpie5 NuygNZZQeJ/+cmfmwEtXLEOn2p9EO7FLThm8DfTLempYAa3c5N/+NdAhg1VOO44MMI wpHj6Ozaa6vYZDcCfigCm3S3KrHHUpXQOKZ4jRNw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alyssa Ross , Sasha Levin Subject: [PATCH 5.16 0400/1039] serial: liteuart: fix MODULE_ALIAS Date: Mon, 24 Jan 2022 19:36:29 +0100 Message-Id: <20220124184138.760726501@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alyssa Ross [ Upstream commit 556172fabd226ba14b70c1740d0826a4717473dc ] modprobe can't handle spaces in aliases. Fixes: 1da81e5562fa ("drivers/tty/serial: add LiteUART driver") Signed-off-by: Alyssa Ross Link: https://lore.kernel.org/r/20220104131030.1674733-1-hi@alyssa.is Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/liteuart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 2941659e52747..7f74bf7bdcff8 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -436,4 +436,4 @@ module_exit(liteuart_exit); MODULE_AUTHOR("Antmicro "); MODULE_DESCRIPTION("LiteUART serial driver"); MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform: liteuart"); +MODULE_ALIAS("platform:liteuart"); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1D76C4167D for ; Mon, 24 Jan 2022 21:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574626AbiAXVt7 (ORCPT ); Mon, 24 Jan 2022 16:49:59 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34322 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448615AbiAXVNK (ORCPT ); Mon, 24 Jan 2022 16:13:10 -0500 Received: from smtp.kernel.org (relay.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 827F8B81188; Mon, 24 Jan 2022 21:13:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A655AC340E5; Mon, 24 Jan 2022 21:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058788; bh=99nQwSKz1Odx6KvBOhuf9y+ekPSrDYcvKDTBKOcRLQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZM0VfzuDFqAtZl6YAje6ByDmoem9PWnqqQvAT9YBoa3KYntT52EPo5xQzZdzplD3j k6yt1LYlnQbwZOqDmHEAIeRre7BDOtCwv+5dYT4dkMLORlp4UhhQStpetuAAXVYWDM ZVYgLzTmIVE9Fm1rpnzf2T2oQreH4lsp4IZSgCYo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erwan Le Ray , Valentin Caron , Sasha Levin Subject: [PATCH 5.16 0401/1039] serial: stm32: move tx dma terminate DMA to shutdown Date: Mon, 24 Jan 2022 19:36:30 +0100 Message-Id: <20220124184138.792734034@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Valentin Caron [ Upstream commit 56a23f9319e86e1d62a109896e2c7e52c414e67d ] Terminate DMA transaction and clear CR3_DMAT when shutdown is requested, instead of when remove is requested. If DMA transfer is not stopped in shutdown ops, driver will fail to start a new DMA transfer after next startup ops. Fixes: 3489187204eb ("serial: stm32: adding dma support") Signed-off-by: Erwan Le Ray Signed-off-by: Valentin Caron Link: https://lore.kernel.org/r/20220104182445.4195-2-valentin.caron@foss.s= t.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/stm32-usart.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-us= art.c index 3244e7f6818ca..6cfc3bec67492 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -883,6 +883,11 @@ static void stm32_usart_shutdown(struct uart_port *por= t) u32 val, isr; int ret; =20 + if (stm32_port->tx_dma_busy) { + dmaengine_terminate_async(stm32_port->tx_ch); + stm32_usart_clr_bits(port, ofs->cr3, USART_CR3_DMAT); + } + /* Disable modem control interrupts */ stm32_usart_disable_ms(port); =20 @@ -1570,7 +1575,6 @@ static int stm32_usart_serial_remove(struct platform_= device *pdev) writel_relaxed(cr3, port->membase + ofs->cr3); =20 if (stm32_port->tx_ch) { - dmaengine_terminate_async(stm32_port->tx_ch); stm32_usart_of_dma_tx_remove(stm32_port, pdev); dma_release_channel(stm32_port->tx_ch); } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E48CC433F5 for ; Mon, 24 Jan 2022 23:38:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360990AbiAXXix (ORCPT ); Mon, 24 Jan 2022 18:38:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382562AbiAXW6F (ORCPT ); Mon, 24 Jan 2022 17:58:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1B0EC02B742; Mon, 24 Jan 2022 13:13:13 -0800 (PST) Received: from smtp.kernel.org (relay.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 AFD5FB8122A; Mon, 24 Jan 2022 21:13:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6214C340E5; Mon, 24 Jan 2022 21:13:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058791; bh=1nFGUXS5uHMg5lFL3K/RPXk6Rgm9bRxx6BTr9LD/yQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kzA2QvwqLtIk8l6BmVKnZPvCQqBt2LTV9cFtLXACODwAsScw6msWlZwMVc5/7Cf9O UEoMfNwMzkNewsbnmhQyQz/XMdD5NWJctgVrkFLteFuDvNl6SbuZIgD6uywYgLJkbn Os9INxLbbQe37LSWI5cytpc6ME/JH0rGbwrkaqzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vinod Koul , Douglas Anderson , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0402/1039] spi: qcom: geni: set the error code for gpi transfer Date: Mon, 24 Jan 2022 19:36:31 +0100 Message-Id: <20220124184138.825523450@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vinod Koul [ Upstream commit 74b86d6af81be73bb74995ebeba74417e84b6b6f ] Before we invoke spi_finalize_current_transfer() in spi_gsi_callback_result() we should set the spi->cur_msg->status as appropriate (0 for success, error otherwise). The helps to return error on transfer and not wait till it timesout on error Fixes: b59c122484ec ("spi: spi-geni-qcom: Add support for GPI dma") Signed-off-by: Vinod Koul Reviewed-by: Douglas Anderson Link: https://lore.kernel.org/r/20220103071118.27220-1-vkoul@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/spi/spi-geni-qcom.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c index e2affaee4e769..69e71aac85129 100644 --- a/drivers/spi/spi-geni-qcom.c +++ b/drivers/spi/spi-geni-qcom.c @@ -350,17 +350,21 @@ spi_gsi_callback_result(void *cb, const struct dmaeng= ine_result *result) { struct spi_master *spi =3D cb; =20 + spi->cur_msg->status =3D -EIO; if (result->result !=3D DMA_TRANS_NOERROR) { dev_err(&spi->dev, "DMA txn failed: %d\n", result->result); + spi_finalize_current_transfer(spi); return; } =20 if (!result->residue) { + spi->cur_msg->status =3D 0; dev_dbg(&spi->dev, "DMA txn completed\n"); - spi_finalize_current_transfer(spi); } else { dev_err(&spi->dev, "DMA xfer has pending: %d\n", result->residue); } + + spi_finalize_current_transfer(spi); } =20 static int setup_gsi_xfer(struct spi_transfer *xfer, struct spi_geni_maste= r *mas, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2928FC433FE for ; Mon, 24 Jan 2022 23:37:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359464AbiAXXhm (ORCPT ); Mon, 24 Jan 2022 18:37:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841261AbiAXW6J (ORCPT ); Mon, 24 Jan 2022 17:58:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BF50C02B74C; Mon, 24 Jan 2022 13:13:15 -0800 (PST) Received: from smtp.kernel.org (relay.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 EDC9261471; Mon, 24 Jan 2022 21:13:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF661C340E5; Mon, 24 Jan 2022 21:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058794; bh=/o+LUW1Cr2cpX0MN9+mBS9URWFlB9//SCkxN0ezCjhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zVzhVm/n7u+jMNVM6y6Nx1iPwjsY6NQztRX0+4FFuqY1Joua31EHIXbsrgz7UNmmS YdGNqgmCF8BbdhsIOaSKP+gLZvZ5sdkEnEQieUEu3ku1z0nh9lsAVVjyj8x5mdDB4Y H3oB6givGPC21THMjsSsfqKlVTh1PiRIwldiXLbc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Vinod Koul , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0403/1039] spi: qcom: geni: handle timeout for gpi mode Date: Mon, 24 Jan 2022 19:36:32 +0100 Message-Id: <20220124184138.856581651@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vinod Koul [ Upstream commit f8039ea55d4ccac2238a247a574f0acb3bc1dc4b ] We missed adding handle_err for gpi mode, so add a new function spi_geni_handle_err() which would call handle_fifo_timeout() or newly added handle_gpi_timeout() based on mode Fixes: b59c122484ec ("spi: spi-geni-qcom: Add support for GPI dma") Reported-by: Douglas Anderson Reviewed-by: Douglas Anderson Signed-off-by: Vinod Koul Link: https://lore.kernel.org/r/20220103071118.27220-2-vkoul@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/spi/spi-geni-qcom.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c index 69e71aac85129..079d0cb783ee3 100644 --- a/drivers/spi/spi-geni-qcom.c +++ b/drivers/spi/spi-geni-qcom.c @@ -168,6 +168,30 @@ static void handle_fifo_timeout(struct spi_master *spi, } } =20 +static void handle_gpi_timeout(struct spi_master *spi, struct spi_message = *msg) +{ + struct spi_geni_master *mas =3D spi_master_get_devdata(spi); + + dmaengine_terminate_sync(mas->tx); + dmaengine_terminate_sync(mas->rx); +} + +static void spi_geni_handle_err(struct spi_master *spi, struct spi_message= *msg) +{ + struct spi_geni_master *mas =3D spi_master_get_devdata(spi); + + switch (mas->cur_xfer_mode) { + case GENI_SE_FIFO: + handle_fifo_timeout(spi, msg); + break; + case GENI_GPI_DMA: + handle_gpi_timeout(spi, msg); + break; + default: + dev_err(mas->dev, "Abort on Mode:%d not supported", mas->cur_xfer_mode); + } +} + static bool spi_geni_is_abort_still_pending(struct spi_geni_master *mas) { struct geni_se *se =3D &mas->se; @@ -926,7 +950,7 @@ static int spi_geni_probe(struct platform_device *pdev) spi->can_dma =3D geni_can_dma; spi->dma_map_dev =3D dev->parent; spi->auto_runtime_pm =3D true; - spi->handle_err =3D handle_fifo_timeout; + spi->handle_err =3D spi_geni_handle_err; spi->use_gpio_descriptors =3D true; =20 init_completion(&mas->cs_done); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E25E4C433F5 for ; Mon, 24 Jan 2022 23:47:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2363067AbiAXXnc (ORCPT ); Mon, 24 Jan 2022 18:43:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843477AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D168C06C5AF; Mon, 24 Jan 2022 13:15:26 -0800 (PST) Received: from smtp.kernel.org (relay.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 0738FB811FB; Mon, 24 Jan 2022 21:15:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D194C340E5; Mon, 24 Jan 2022 21:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058923; bh=/EESlIcy4u19W/9Xq1u2Tkvy0QQYoel1/VtuLRwMchQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1FKCDMZe0MSK4bRfM3CWQMihOcsUwahnydDrxAPqyGmG+tEgVdcpafip4SNtTfprf d5iFf0W5gahP1d9g2GNAHEz79befP4IbAmQb03LfVjIUhjwqWIjc74Xe3rUqhhzqTq oLmULhXZ8FiQpF3TcUPKogI0jujgChpkhssxWDe8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Randy Dunlap , Stephen Rothwell , Huang Rui , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0404/1039] x86, sched: Fix undefined reference to init_freq_invariance_cppc() build error Date: Mon, 24 Jan 2022 19:36:33 +0100 Message-Id: <20220124184138.888274826@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Huang Rui [ Upstream commit 6c4ab1b86dac3954d15c00c1a6396d60a1023fab ] The init_freq_invariance_cppc function is implemented in smpboot and depend= s on CONFIG_SMP. MODPOST vmlinux.symvers MODINFO modules.builtin.modinfo GEN modules.builtin LD .tmp_vmlinux.kallsyms1 ld: drivers/acpi/cppc_acpi.o: in function `acpi_cppc_processor_probe': /home/ray/brahma3/linux/drivers/acpi/cppc_acpi.c:819: undefined reference t= o `init_freq_invariance_cppc' make: *** [Makefile:1161: vmlinux] Error 1 See https://lore.kernel.org/lkml/484af487-7511-647e-5c5b-33d4429acdec@infra= dead.org/. Fixes: 41ea667227ba ("x86, sched: Calculate frequency invariance for AMD sy= stems") Reported-by: kernel test robot Reported-by: Randy Dunlap Reported-by: Stephen Rothwell Signed-off-by: Huang Rui [ rjw: Subject edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/include/asm/topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topolog= y.h index cc164777e6619..2f0b6be8eaabc 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -221,7 +221,7 @@ static inline void arch_set_max_freq_ratio(bool turbo_d= isabled) } #endif =20 -#ifdef CONFIG_ACPI_CPPC_LIB +#if defined(CONFIG_ACPI_CPPC_LIB) && defined(CONFIG_SMP) void init_freq_invariance_cppc(void); #define init_freq_invariance_cppc init_freq_invariance_cppc #endif --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEDB6C433F5 for ; Mon, 24 Jan 2022 23:47:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362025AbiAXXlZ (ORCPT ); Mon, 24 Jan 2022 18:41:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841813AbiAXXAE (ORCPT ); Mon, 24 Jan 2022 18:00:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DABC1C09D322; Mon, 24 Jan 2022 13:13:41 -0800 (PST) Received: from smtp.kernel.org (relay.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 A24A4B81142; Mon, 24 Jan 2022 21:13:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1DE8C340E5; Mon, 24 Jan 2022 21:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058819; bh=h2FlKSl0WAXSPEKWoJS3EvlZl717LALX1016o4oT2YM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oforqcSWeXmpFqKTu9RYhUw+hxfZCa8uGzvp0Xb29SYRPBm5NNYPfqalyQS1ea5wI qjk3IkENINEUDxcghzUgzVZfr+Sk1hkgzI5kfGcxPhHHoQmrNKPU3i/p4IRisCB/o4 9IXTA0IYw3tDLN5/BQLbz/YyRXbhKbupljXd2mVQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Gal Pressman , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.16 0405/1039] net/mlx5e: Fix page DMA map/unmap attributes Date: Mon, 24 Jan 2022 19:36:34 +0100 Message-Id: <20220124184138.928021863@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Aya Levin [ Upstream commit 0b7cfa4082fbf550595bc0e40f05614bd83bf0cd ] Driver initiates DMA sync, hence it may skip CPU sync. Add DMA_ATTR_SKIP_CPU_SYNC as input attribute both to dma_map_page and dma_unmap_page to avoid redundant sync with the CPU. When forcing the device to work with SWIOTLB, the extra sync might cause data corruption. The driver unmaps the whole page while the hardware used just a part of the bounce buffer. So syncing overrides the entire page with bounce buffer that only partially contains real data. Fixes: bc77b240b3c5 ("net/mlx5e: Add fragmented memory support for RX multi= packet WQE") Fixes: db05815b36cb ("net/mlx5e: Add XSK zero-copy support") Signed-off-by: Aya Levin Reviewed-by: Gal Pressman Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c b/driver= s/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c index 7b562d2c8a196..279cd8f4e79f7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c @@ -11,13 +11,13 @@ static int mlx5e_xsk_map_pool(struct mlx5e_priv *priv, { struct device *dev =3D mlx5_core_dma_dev(priv->mdev); =20 - return xsk_pool_dma_map(pool, dev, 0); + return xsk_pool_dma_map(pool, dev, DMA_ATTR_SKIP_CPU_SYNC); } =20 static void mlx5e_xsk_unmap_pool(struct mlx5e_priv *priv, struct xsk_buff_pool *pool) { - return xsk_pool_dma_unmap(pool, 0); + return xsk_pool_dma_unmap(pool, DMA_ATTR_SKIP_CPU_SYNC); } =20 static int mlx5e_xsk_get_pools(struct mlx5e_xsk *xsk) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/= ethernet/mellanox/mlx5/core/en_rx.c index 793511d5ee4cd..dfc6604b9538b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -278,8 +278,8 @@ static inline int mlx5e_page_alloc_pool(struct mlx5e_rq= *rq, if (unlikely(!dma_info->page)) return -ENOMEM; =20 - dma_info->addr =3D dma_map_page(rq->pdev, dma_info->page, 0, - PAGE_SIZE, rq->buff.map_dir); + dma_info->addr =3D dma_map_page_attrs(rq->pdev, dma_info->page, 0, PAGE_S= IZE, + rq->buff.map_dir, DMA_ATTR_SKIP_CPU_SYNC); if (unlikely(dma_mapping_error(rq->pdev, dma_info->addr))) { page_pool_recycle_direct(rq->page_pool, dma_info->page); dma_info->page =3D NULL; @@ -300,7 +300,8 @@ static inline int mlx5e_page_alloc(struct mlx5e_rq *rq, =20 void mlx5e_page_dma_unmap(struct mlx5e_rq *rq, struct mlx5e_dma_info *dma_= info) { - dma_unmap_page(rq->pdev, dma_info->addr, PAGE_SIZE, rq->buff.map_dir); + dma_unmap_page_attrs(rq->pdev, dma_info->addr, PAGE_SIZE, rq->buff.map_di= r, + DMA_ATTR_SKIP_CPU_SYNC); } =20 void mlx5e_page_release_dynamic(struct mlx5e_rq *rq, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25A0CC43219 for ; Mon, 24 Jan 2022 23:45:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2361708AbiAXXkp (ORCPT ); Mon, 24 Jan 2022 18:40:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1842521AbiAXXCD (ORCPT ); Mon, 24 Jan 2022 18:02:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 581AAC0F056A; Mon, 24 Jan 2022 13:14:16 -0800 (PST) Received: from smtp.kernel.org (relay.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 1E6A4B8121C; Mon, 24 Jan 2022 21:14:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C8D4C340E5; Mon, 24 Jan 2022 21:14:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058853; bh=OGsdVaPezskp5mjEzTrgfcvbp3YBX8bYP96/p792fYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JFrxbz8YkMS9Ol77eGSzCIi+z6N7W7KKHQkbmLEtvhXLTR7E8n2Hy22ALDA23UqJ6 EPLPFWBfPgEcbDHsTkdLG280xnPAhXdbm0/kkNqlEQPU46G978q7s2LsHVi8+uw6gp pskIPPda9GdAwV1PNX0iUUneElgsRv2Rf0YOITYg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dima Chumak , Roi Dayan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.16 0406/1039] net/mlx5e: Fix nullptr on deleting mirroring rule Date: Mon, 24 Jan 2022 19:36:35 +0100 Message-Id: <20220124184138.959724358@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dima Chumak [ Upstream commit de31854ece175e12ff3c35d07f340988823aed34 ] Deleting a Tc rule with multiple outputs, one of which is internal port, like this one: tc filter del dev enp8s0f0_0 ingress protocol ip pref 5 flower \ dst_mac 0c:42:a1:d1:d0:88 \ src_mac e4:ea:09:08:00:02 \ action tunnel_key set \ src_ip 0.0.0.0 \ dst_ip 7.7.7.8 \ id 8 \ dst_port 4789 \ action mirred egress mirror dev vxlan_sys_4789 pipe \ action mirred egress redirect dev enp8s0f0_1 Triggers a call trace: BUG: kernel NULL pointer dereference, address: 0000000000000230 RIP: 0010:del_sw_hw_rule+0x2b/0x1f0 [mlx5_core] Call Trace: tree_remove_node+0x16/0x30 [mlx5_core] mlx5_del_flow_rules+0x51/0x160 [mlx5_core] __mlx5_eswitch_del_rule+0x4b/0x170 [mlx5_core] mlx5e_tc_del_fdb_flow+0x295/0x550 [mlx5_core] mlx5e_flow_put+0x1f/0x70 [mlx5_core] mlx5e_delete_flower+0x286/0x390 [mlx5_core] tc_setup_cb_destroy+0xac/0x170 fl_hw_destroy_filter+0x94/0xc0 [cls_flower] __fl_delete+0x15e/0x170 [cls_flower] fl_delete+0x36/0x80 [cls_flower] tc_del_tfilter+0x3a6/0x6e0 rtnetlink_rcv_msg+0xe5/0x360 ? rtnl_calcit.isra.0+0x110/0x110 netlink_rcv_skb+0x46/0x110 netlink_unicast+0x16b/0x200 netlink_sendmsg+0x202/0x3d0 sock_sendmsg+0x33/0x40 ____sys_sendmsg+0x1c3/0x200 ? copy_msghdr_from_user+0xd6/0x150 ___sys_sendmsg+0x88/0xd0 ? ___sys_recvmsg+0x88/0xc0 ? do_futex+0x10c/0x460 __sys_sendmsg+0x59/0xa0 do_syscall_64+0x48/0x140 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fix by disabling offloading for flows matching esw_is_chain_src_port_rewrite() which have more than one output. Fixes: 10742efc20a4 ("net/mlx5e: VF tunnel TX traffic offloading") Signed-off-by: Dima Chumak Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../mellanox/mlx5/core/eswitch_offloads.c | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/d= rivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 32bc08a399256..ccb66428aeb5b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -295,26 +295,28 @@ esw_setup_chain_src_port_rewrite(struct mlx5_flow_des= tination *dest, int *i) { struct mlx5_esw_flow_attr *esw_attr =3D attr->esw_attr; - int j, err; + int err; =20 if (!(attr->flags & MLX5_ESW_ATTR_FLAG_SRC_REWRITE)) return -EOPNOTSUPP; =20 - for (j =3D esw_attr->split_count; j < esw_attr->out_count; j++, (*i)++) { - err =3D esw_setup_chain_dest(dest, flow_act, chains, attr->dest_chain, 1= , 0, *i); - if (err) - goto err_setup_chain; + /* flow steering cannot handle more than one dest with the same ft + * in a single flow + */ + if (esw_attr->out_count - esw_attr->split_count > 1) + return -EOPNOTSUPP; =20 - if (esw_attr->dests[j].pkt_reformat) { - flow_act->action |=3D MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; - flow_act->pkt_reformat =3D esw_attr->dests[j].pkt_reformat; - } + err =3D esw_setup_chain_dest(dest, flow_act, chains, attr->dest_chain, 1,= 0, *i); + if (err) + return err; + + if (esw_attr->dests[esw_attr->split_count].pkt_reformat) { + flow_act->action |=3D MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; + flow_act->pkt_reformat =3D esw_attr->dests[esw_attr->split_count].pkt_re= format; } - return 0; + (*i)++; =20 -err_setup_chain: - esw_put_dest_tables_loop(esw, attr, esw_attr->split_count, j); - return err; + return 0; } =20 static void esw_cleanup_chain_src_port_rewrite(struct mlx5_eswitch *esw, --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13E97C2BA4C for ; Mon, 24 Jan 2022 23:58:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365911AbiAXXv5 (ORCPT ); Mon, 24 Jan 2022 18:51:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843471AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0658DC06C5AB; Mon, 24 Jan 2022 13:14:48 -0800 (PST) Received: from smtp.kernel.org (relay.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 981AB6147D; Mon, 24 Jan 2022 21:14:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 812FCC340E5; Mon, 24 Jan 2022 21:14:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058887; bh=ZCpHyFJAoXnEja1vJbnmNPOXxj+CVxDmB0m9DLqkUr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CnuSWAk2T+/zVGkKcEaKvHGUvV3mRHe2TtGXBdfNTMdkZAJ3cWZjeDw89aWDmruVf oQi4puFUtIzdA6mb2ji2TLK45dljQn2wSA8rCJ3peeyg6YHLMB70tiW/GnbsXE5enu 8mripOUEXFxKaacZj3ZrQ19sNHJnnVSMsmTO8hXM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maor Dickman , Vlad Buslov , Roi Dayan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.16 0407/1039] net/mlx5e: Fix wrong usage of fib_info_nh when routes with nexthop objects are used Date: Mon, 24 Jan 2022 19:36:36 +0100 Message-Id: <20220124184138.990561002@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maor Dickman [ Upstream commit 885751eb1b01d276e38f57d78c583e4ce006c5ed ] Creating routes with nexthop objects while in switchdev mode leads to acces= s to un-allocated memory and trigger bellow call trace due to hitting WARN_ON. This is caused due to illegal usage of fib_info_nh in TC tunnel FIB event h= andling to resolve the FIB device while fib_info built in with nexthop. Fixed by ignoring attempts to use nexthop objects with routes until support= can be properly added. WARNING: CPU: 1 PID: 1724 at include/net/nexthop.h:468 mlx5e_tc_tun_fib_eve= nt+0x448/0x570 [mlx5_core] CPU: 1 PID: 1724 Comm: ip Not tainted 5.15.0_for_upstream_min_debug_2021_11= _09_02_04 #1 RIP: 0010:mlx5e_tc_tun_fib_event+0x448/0x570 [mlx5_core] RSP: 0018:ffff8881349f7910 EFLAGS: 00010202 RAX: ffff8881492f1980 RBX: ffff8881349f79e8 RCX: 0000000000000000 RDX: ffff8881349f79e8 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffff8881349f7950 R08: 00000000000000fe R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000000 R12: ffff88811e9d0000 R13: ffff88810eb62000 R14: ffff888106710268 R15: 0000000000000018 FS: 00007f1d5ca6e800(0000) GS:ffff88852c880000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffedba44ff8 CR3: 0000000129808004 CR4: 0000000000370ea0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: atomic_notifier_call_chain+0x42/0x60 call_fib_notifiers+0x21/0x40 fib_table_insert+0x479/0x6d0 ? try_charge_memcg+0x480/0x6d0 inet_rtm_newroute+0x65/0xb0 rtnetlink_rcv_msg+0x2af/0x360 ? page_add_file_rmap+0x13/0x130 ? do_set_pte+0xcd/0x120 ? rtnl_calcit.isra.0+0x120/0x120 netlink_rcv_skb+0x4e/0xf0 netlink_unicast+0x1ee/0x2b0 netlink_sendmsg+0x22e/0x460 sock_sendmsg+0x33/0x40 ____sys_sendmsg+0x1d1/0x1f0 ___sys_sendmsg+0xab/0xf0 ? __mod_memcg_lruvec_state+0x40/0x60 ? __mod_lruvec_page_state+0x95/0xd0 ? page_add_new_anon_rmap+0x4e/0xf0 ? __handle_mm_fault+0xec6/0x1470 __sys_sendmsg+0x51/0x90 ? internal_get_user_pages_fast+0x480/0xa10 do_syscall_64+0x3d/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae Fixes: 8914add2c9e5 ("net/mlx5e: Handle FIB events to update tunnel endpoin= t device") Signed-off-by: Maor Dickman Reviewed-by: Vlad Buslov Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c b/dr= ivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c index 042b1abe1437f..62cbd15ffc341 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c @@ -1579,6 +1579,8 @@ mlx5e_init_fib_work_ipv4(struct mlx5e_priv *priv, struct net_device *fib_dev; =20 fen_info =3D container_of(info, struct fib_entry_notifier_info, info); + if (fen_info->fi->nh) + return NULL; fib_dev =3D fib_info_nh(fen_info->fi, 0)->fib_nh_dev; if (!fib_dev || fib_dev->netdev_ops !=3D &mlx5e_netdev_ops || fen_info->dst_len !=3D 32) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 412A8C433EF for ; Mon, 24 Jan 2022 22:14:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580988AbiAXWLE (ORCPT ); Mon, 24 Jan 2022 17:11:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:35534 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449226AbiAXVPI (ORCPT ); Mon, 24 Jan 2022 16:15:08 -0500 Received: from smtp.kernel.org (relay.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 84028B80FA3; Mon, 24 Jan 2022 21:15:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9906BC340E5; Mon, 24 Jan 2022 21:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058905; bh=BPMprMdY0fyaX+Q+LL/4riMmOaa9YNsihvpiCiAxNGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RVoE7Hin4XVCFdZNVmm4dnbrI/+Ynxu/4N2dWi1THZI1liQIU4zHlzmbrEs99UkEr Xzh2f1vhxq2blC4ToRv/lzNErqoGe3ewYmO9n0rFqAXYiYLGEh9dQKkgD1dg6gW7KU 2oShukgTWoa5othfrh+TdP7+13pGvXJNoQa/qxFA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maor Dickman , Roi Dayan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.16 0408/1039] net/mlx5e: Dont block routes with nexthop objects in SW Date: Mon, 24 Jan 2022 19:36:37 +0100 Message-Id: <20220124184139.026982325@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maor Dickman [ Upstream commit 9e72a55a3c9d54b38a704bb7292d984574a81d9d ] Routes with nexthop objects is currently not supported by multipath offload and any attempts to use it is blocked, however this also block adding SW routes with nexthop. Resolve this by returning NOTIFY_DONE instead of an error which will allow = such a route to be created in SW but not offloaded. This fix also solve an issue which block adding such routes on different de= vices due to missing check if the route FIB device is one of multipath devices. Fixes: 6a87afc072c3 ("mlx5: Fail attempts to use routes with nexthop object= s") Signed-off-by: Maor Dickman Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c b/drivers/net= /ethernet/mellanox/mlx5/core/lag/mp.c index bf4d3cbefa633..1ca01a5b6cdd8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c @@ -268,10 +268,8 @@ static int mlx5_lag_fib_event(struct notifier_block *n= b, fen_info =3D container_of(info, struct fib_entry_notifier_info, info); fi =3D fen_info->fi; - if (fi->nh) { - NL_SET_ERR_MSG_MOD(info->extack, "IPv4 route with nexthop objects is no= t supported"); - return notifier_from_errno(-EINVAL); - } + if (fi->nh) + return NOTIFY_DONE; fib_dev =3D fib_info_nh(fen_info->fi, 0)->fib_nh_dev; if (fib_dev !=3D ldev->pf[MLX5_LAG_P1].netdev && fib_dev !=3D ldev->pf[MLX5_LAG_P2].netdev) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38972C4332F for ; Mon, 24 Jan 2022 22:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577548AbiAXWA2 (ORCPT ); Mon, 24 Jan 2022 17:00:28 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38218 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449256AbiAXVPJ (ORCPT ); Mon, 24 Jan 2022 16:15:09 -0500 Received: from smtp.kernel.org (relay.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 0ADD561451; Mon, 24 Jan 2022 21:15:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8F3EC340E5; Mon, 24 Jan 2022 21:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058908; bh=d6R36MrvRchoiac2EDIDDPVYsSqO0GHpTgvcUZB/b70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCELllb+ympGW39y/wUa1ruvBXBLG9A8/3AfyPhHRBJ3J8DHGdreCtUYfIM3UmZOD 1zC1LZ0iPzxe5rUXjCe6vLjiQCVHnTVv5EwE10gsNKKHKdWXUTnvgRd5b4CuLUeNyW VSpkoeUGpY0TQUq8BNwA4DSwM2Kzd2ruBkkxyAPg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Gal Pressman , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.16 0409/1039] Revert "net/mlx5e: Block offload of outer header csum for UDP tunnels" Date: Mon, 24 Jan 2022 19:36:38 +0100 Message-Id: <20220124184139.064960266@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Aya Levin [ Upstream commit 64050cdad0983ad8060e33c3f4b5aee2366bcebd ] This reverts commit 6d6727dddc7f93fcc155cb8d0c49c29ae0e71122. Although the NIC doesn't support offload of outer header CSUM, using gso_partial_features allows offloading the tunnel's segmentation. The driver relies on the stack CSUM calculation of the outer header. For this, NETIF_F_GSO_UDP_TUNNEL_CSUM must be a member of the device's features. Fixes: 6d6727dddc7f ("net/mlx5e: Block offload of outer header csum for UDP= tunnels") Signed-off-by: Aya Levin Reviewed-by: Gal Pressman Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/ne= t/ethernet/mellanox/mlx5/core/en_main.c index 41379844eee1f..de8acd3217c18 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -4789,9 +4789,13 @@ static void mlx5e_build_nic_netdev(struct net_device= *netdev) } =20 if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) { - netdev->hw_features |=3D NETIF_F_GSO_UDP_TUNNEL; - netdev->hw_enc_features |=3D NETIF_F_GSO_UDP_TUNNEL; - netdev->vlan_features |=3D NETIF_F_GSO_UDP_TUNNEL; + netdev->hw_features |=3D NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev->hw_enc_features |=3D NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev->gso_partial_features =3D NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev->vlan_features |=3D NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM; } =20 if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_GRE)) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41A27C3526C for ; Mon, 24 Jan 2022 23:55:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365883AbiAXXvz (ORCPT ); Mon, 24 Jan 2022 18:51:55 -0500 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 S1843474AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89AA7C06C5AC; Mon, 24 Jan 2022 13:15:12 -0800 (PST) Received: from smtp.kernel.org (relay.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 275E661425; Mon, 24 Jan 2022 21:15:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE212C340E5; Mon, 24 Jan 2022 21:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058911; bh=jCLuVy28HwBiuUUxs7Ez/SG8B5g+9UJE++jF70kFQIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dMKO6dQw36Sz86pGfU69dsVHVksUa6ale4o1YE4JczNWWHm4OEfRoqX78YGQ56mgs B0UdcZviDa3qEfPwfAWV0XGgBouXDmrHaMl59fa/94y0dcYa23/tyXWJ0627NGLHcA s1CeiA0Lci1EiVRXhm0rHExqcUwREluUQ147ZZBo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Gal Pressman , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.16 0410/1039] Revert "net/mlx5e: Block offload of outer header csum for GRE tunnel" Date: Mon, 24 Jan 2022 19:36:39 +0100 Message-Id: <20220124184139.096166047@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Aya Levin [ Upstream commit 01c3fd113ef50490ffd43f78f347ef6bb008510b ] This reverts commit 54e1217b90486c94b26f24dcee1ee5ef5372f832. Although the NIC doesn't support offload of outer header CSUM, using gso_partial_features allows offloading the tunnel's segmentation. The driver relies on the stack CSUM calculation of the outer header. For this, NETIF_F_GSO_GRE_CSUM must be a member of the device's features. Fixes: 54e1217b9048 ("net/mlx5e: Block offload of outer header csum for GRE= tunnel") Signed-off-by: Aya Levin Reviewed-by: Gal Pressman Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/ne= t/ethernet/mellanox/mlx5/core/en_main.c index de8acd3217c18..d92b82cdfd4e1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -4799,9 +4799,12 @@ static void mlx5e_build_nic_netdev(struct net_device= *netdev) } =20 if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_GRE)) { - netdev->hw_features |=3D NETIF_F_GSO_GRE; - netdev->hw_enc_features |=3D NETIF_F_GSO_GRE; - netdev->gso_partial_features |=3D NETIF_F_GSO_GRE; + netdev->hw_features |=3D NETIF_F_GSO_GRE | + NETIF_F_GSO_GRE_CSUM; + netdev->hw_enc_features |=3D NETIF_F_GSO_GRE | + NETIF_F_GSO_GRE_CSUM; + netdev->gso_partial_features |=3D NETIF_F_GSO_GRE | + NETIF_F_GSO_GRE_CSUM; } =20 if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_IPIP)) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 468D9C433FE for ; Mon, 24 Jan 2022 23:55:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365849AbiAXXvt (ORCPT ); Mon, 24 Jan 2022 18:51:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843479AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05DCBC06C5AD; Mon, 24 Jan 2022 13:15:17 -0800 (PST) Received: from smtp.kernel.org (relay.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 B6E9EB80CCF; Mon, 24 Jan 2022 21:15:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D68B3C340E5; Mon, 24 Jan 2022 21:15:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058914; bh=MNP0naKwHatsb8nu+Qq1uQUPHt7r094wxZv8V9/AMEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pJZT4ewC6z7k6qoebKNNg/IY5oLqs0HwoQHdg1BYTnu6WTxfWEaXLPQfduGXvaW+x nXfScedFDfsDR5gkP4OwuCcBoaQJXavfYEHqy6mZVkRIAjlxQsi9hNWVHQoo1+3i/x 7WDjcu6bQUcxpCwaOgqr4ugzpj7msuork4k3XdwA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Blakey , Oz Shlomo , Eli Cohen , Roi Dayan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.16 0411/1039] net/mlx5e: Fix matching on modified inner ip_ecn bits Date: Mon, 24 Jan 2022 19:36:40 +0100 Message-Id: <20220124184139.126950750@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Blakey [ Upstream commit b6dfff21a170af5c695ebaa153b7f5e297ddca03 ] Tunnel device follows RFC 6040, and during decapsulation inner ip_ecn might change depending on inner and outer ip_ecn as follows: +---------+----------------------------------------+ |Arriving | Arriving Outer Header | | Inner +---------+---------+---------+----------+ | Header | Not-ECT | ECT(0) | ECT(1) | CE | +---------+---------+---------+---------+----------+ | Not-ECT | Not-ECT | Not-ECT | Not-ECT | | | ECT(0) | ECT(0) | ECT(0) | ECT(1) | CE* | | ECT(1) | ECT(1) | ECT(1) | ECT(1)* | CE* | | CE | CE | CE | CE | CE | +---------+---------+---------+---------+----------+ Cells marked above are changed from original inner packet ip_ecn value. Tc then matches on the modified inner ip_ecn, but hw offload which matches the inner ip_ecn value before decap, will fail. Fix that by mapping all the cases of outer and inner ip_ecn matching, and only supporting cases where we know inner wouldn't be changed by decap, or in the outer ip_ecn=3DCE case, inner ip_ecn didn't matter. Fixes: bcef735c59f2 ("net/mlx5e: Offload TC matching on tos/ttl for ip tunn= els") Signed-off-by: Paul Blakey Reviewed-by: Oz Shlomo Reviewed-by: Eli Cohen Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 120 +++++++++++++++++- 1 file changed, 116 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/= ethernet/mellanox/mlx5/core/en_tc.c index 5e454a14428f2..9b3adaccc9beb 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -1949,6 +1949,111 @@ u8 mlx5e_tc_get_ip_version(struct mlx5_flow_spec *s= pec, bool outer) return ip_version; } =20 +/* Tunnel device follows RFC 6040, see include/net/inet_ecn.h. + * And changes inner ip_ecn depending on inner and outer ip_ecn as follows: + * +---------+----------------------------------------+ + * |Arriving | Arriving Outer Header | + * | Inner +---------+---------+---------+----------+ + * | Header | Not-ECT | ECT(0) | ECT(1) | CE | + * +---------+---------+---------+---------+----------+ + * | Not-ECT | Not-ECT | Not-ECT | Not-ECT | | + * | ECT(0) | ECT(0) | ECT(0) | ECT(1) | CE* | + * | ECT(1) | ECT(1) | ECT(1) | ECT(1)* | CE* | + * | CE | CE | CE | CE | CE | + * +---------+---------+---------+---------+----------+ + * + * Tc matches on inner after decapsulation on tunnel device, but hw offloa= d matches + * the inner ip_ecn value before hardware decap action. + * + * Cells marked are changed from original inner packet ip_ecn value during= decap, and + * so matching those values on inner ip_ecn before decap will fail. + * + * The following helper allows offload when inner ip_ecn won't be changed = by outer ip_ecn, + * except for the outer ip_ecn =3D CE, where in all cases inner ip_ecn wil= l be changed to CE, + * and such we can drop the inner ip_ecn=3DCE match. + */ + +static int mlx5e_tc_verify_tunnel_ecn(struct mlx5e_priv *priv, + struct flow_cls_offload *f, + bool *match_inner_ecn) +{ + u8 outer_ecn_mask =3D 0, outer_ecn_key =3D 0, inner_ecn_mask =3D 0, inner= _ecn_key =3D 0; + struct flow_rule *rule =3D flow_cls_offload_flow_rule(f); + struct netlink_ext_ack *extack =3D f->common.extack; + struct flow_match_ip match; + + *match_inner_ecn =3D true; + + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IP)) { + flow_rule_match_enc_ip(rule, &match); + outer_ecn_key =3D match.key->tos & INET_ECN_MASK; + outer_ecn_mask =3D match.mask->tos & INET_ECN_MASK; + } + + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IP)) { + flow_rule_match_ip(rule, &match); + inner_ecn_key =3D match.key->tos & INET_ECN_MASK; + inner_ecn_mask =3D match.mask->tos & INET_ECN_MASK; + } + + if (outer_ecn_mask !=3D 0 && outer_ecn_mask !=3D INET_ECN_MASK) { + NL_SET_ERR_MSG_MOD(extack, "Partial match on enc_tos ecn bits isn't supp= orted"); + netdev_warn(priv->netdev, "Partial match on enc_tos ecn bits isn't suppo= rted"); + return -EOPNOTSUPP; + } + + if (!outer_ecn_mask) { + if (!inner_ecn_mask) + return 0; + + NL_SET_ERR_MSG_MOD(extack, + "Matching on tos ecn bits without also matching enc_tos ecn bits is= n't supported"); + netdev_warn(priv->netdev, + "Matching on tos ecn bits without also matching enc_tos ecn bits is= n't supported"); + return -EOPNOTSUPP; + } + + if (inner_ecn_mask && inner_ecn_mask !=3D INET_ECN_MASK) { + NL_SET_ERR_MSG_MOD(extack, + "Partial match on tos ecn bits with match on enc_tos ecn bits isn't= supported"); + netdev_warn(priv->netdev, + "Partial match on tos ecn bits with match on enc_tos ecn bits isn't= supported"); + return -EOPNOTSUPP; + } + + if (!inner_ecn_mask) + return 0; + + /* Both inner and outer have full mask on ecn */ + + if (outer_ecn_key =3D=3D INET_ECN_ECT_1) { + /* inner ecn might change by DECAP action */ + + NL_SET_ERR_MSG_MOD(extack, "Match on enc_tos ecn =3D ECT(1) isn't suppor= ted"); + netdev_warn(priv->netdev, "Match on enc_tos ecn =3D ECT(1) isn't support= ed"); + return -EOPNOTSUPP; + } + + if (outer_ecn_key !=3D INET_ECN_CE) + return 0; + + if (inner_ecn_key !=3D INET_ECN_CE) { + /* Can't happen in software, as packet ecn will be changed to CE after d= ecap */ + NL_SET_ERR_MSG_MOD(extack, + "Match on tos enc_tos ecn =3D CE while match on tos ecn !=3D CE isn= 't supported"); + netdev_warn(priv->netdev, + "Match on tos enc_tos ecn =3D CE while match on tos ecn !=3D CE isn= 't supported"); + return -EOPNOTSUPP; + } + + /* outer ecn =3D CE, inner ecn =3D CE, as decap will change inner ecn to = CE in anycase, + * drop match on inner ecn + */ + *match_inner_ecn =3D false; + + return 0; +} + static int parse_tunnel_attr(struct mlx5e_priv *priv, struct mlx5e_tc_flow *flow, struct mlx5_flow_spec *spec, @@ -2144,6 +2249,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, struct flow_rule *rule =3D flow_cls_offload_flow_rule(f); struct flow_dissector *dissector =3D rule->match.dissector; enum fs_flow_table_type fs_type; + bool match_inner_ecn =3D true; u16 addr_type =3D 0; u8 ip_proto =3D 0; u8 *match_level; @@ -2197,6 +2303,10 @@ static int __parse_cls_flower(struct mlx5e_priv *pri= v, headers_c =3D get_match_inner_headers_criteria(spec); headers_v =3D get_match_inner_headers_value(spec); } + + err =3D mlx5e_tc_verify_tunnel_ecn(priv, f, &match_inner_ecn); + if (err) + return err; } =20 err =3D mlx5e_flower_parse_meta(filter_dev, f); @@ -2420,10 +2530,12 @@ static int __parse_cls_flower(struct mlx5e_priv *pr= iv, struct flow_match_ip match; =20 flow_rule_match_ip(rule, &match); - MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_ecn, - match.mask->tos & 0x3); - MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ecn, - match.key->tos & 0x3); + if (match_inner_ecn) { + MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_ecn, + match.mask->tos & 0x3); + MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ecn, + match.key->tos & 0x3); + } =20 MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_dscp, match.mask->tos >> 2); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A03A9C433EF for ; Mon, 24 Jan 2022 23:55:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365792AbiAXXvn (ORCPT ); Mon, 24 Jan 2022 18:51:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843476AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CF6DC06C5AE; Mon, 24 Jan 2022 13:15:18 -0800 (PST) Received: from smtp.kernel.org (relay.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 2C82861484; Mon, 24 Jan 2022 21:15:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AF4EC340E5; Mon, 24 Jan 2022 21:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058917; bh=StLZvHkPPjNWX2Zkf87Xunam5bpuvhcD5gKxOAP1LCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rehNUeHjYOlq1lAUKykXTH8FHqjZ0OCIUNPHm0gv/zAgQ/KM1ZqCU2kBxv0LrgLnn /8oPjocxA2z4xyszo4zeKh8wPbihbPzRoyZMkylovZsrewFwz+Tn/Awwer3LFRkg8I s8bNsWxp3PdGoQ2DiIssM/80iO+3cuZ0jXXFmCus= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shay Drory , Parav Pandit , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.16 0412/1039] net/mlx5: Fix access to sf_dev_table on allocation failure Date: Mon, 24 Jan 2022 19:36:41 +0100 Message-Id: <20220124184139.165179659@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shay Drory [ Upstream commit a1c7c49c2091926962f8c1c866d386febffec5d8 ] Even when SF devices are supported, the SF device table allocation can still fail. In such case mlx5_sf_dev_supported still reports true, but SF device table is invalid. This can result in NULL table access. Hence, fix it by adding NULL table check. Fixes: 1958fc2f0712 ("net/mlx5: SF, Add auxiliary device driver") Signed-off-by: Shay Drory Reviewed-by: Parav Pandit Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c b/drivers= /net/ethernet/mellanox/mlx5/core/sf/dev/dev.c index f37db7cc32a65..7da012ff0d419 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c @@ -30,10 +30,7 @@ bool mlx5_sf_dev_allocated(const struct mlx5_core_dev *d= ev) { struct mlx5_sf_dev_table *table =3D dev->priv.sf_dev_table; =20 - if (!mlx5_sf_dev_supported(dev)) - return false; - - return !xa_empty(&table->devices); + return table && !xa_empty(&table->devices); } =20 static ssize_t sfnum_show(struct device *dev, struct device_attribute *att= r, char *buf) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2E68C433EF for ; Mon, 24 Jan 2022 22:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577480AbiAXWAR (ORCPT ); Mon, 24 Jan 2022 17:00:17 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38404 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449343AbiAXVP1 (ORCPT ); Mon, 24 Jan 2022 16:15:27 -0500 Received: from smtp.kernel.org (relay.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 551FC6146B; Mon, 24 Jan 2022 21:15:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34E55C340E5; Mon, 24 Jan 2022 21:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058920; bh=pscer4LBca1NjCsM5kMhMA1sNz9foyx1pqD75dRCRa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W7fKrqkcYJTvugtlAEDem7mGVxMpNPVPmzV43p7FG7cAqVUl8jfohxyOQRFc0Dqx2 oCufJ6vTK6kvL+6BRgFJVnEXQVQW7LS3IOdtvbLtobO8mxee1sXk3es+B/lbMX3sSP Pz4KhMQK+OnSVg17NVEmo45aqHyFSr2fe7fjejck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maor Dickman , Roi Dayan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.16 0413/1039] net/mlx5e: Sync VXLAN udp ports during uplink representor profile change Date: Mon, 24 Jan 2022 19:36:42 +0100 Message-Id: <20220124184139.201912951@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maor Dickman [ Upstream commit 07f6dc4024ea1d2314b9c8b81fd4e492864fcca1 ] Currently during NIC profile disablement all VXLAN udp ports offloaded to t= he HW are flushed and during its enablement the driver send notification to the stack to inform the core that the entire UDP tunnel port state has been lost, uplink representor doesn't have the same behavior which can cause VXLAN udp ports offload to be in bad state while moving between modes while VXLAN interface exist. Fixed by aligning the uplink representor profile behavior to the NIC behavi= or. Fixes: 84db66124714 ("net/mlx5e: Move set vxlan nic info to profile init") Signed-off-by: Maor Dickman Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net= /ethernet/mellanox/mlx5/core/en_rep.c index 48895d79796a8..c0df4b1115b72 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -50,6 +50,7 @@ #include "fs_core.h" #include "lib/mlx5.h" #include "lib/devcom.h" +#include "lib/vxlan.h" #define CREATE_TRACE_POINTS #include "diag/en_rep_tracepoint.h" #include "en_accel/ipsec.h" @@ -1027,6 +1028,7 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv= *priv) rtnl_lock(); if (netif_running(netdev)) mlx5e_open(netdev); + udp_tunnel_nic_reset_ntf(priv->netdev); netif_device_attach(netdev); rtnl_unlock(); } @@ -1048,6 +1050,7 @@ static void mlx5e_uplink_rep_disable(struct mlx5e_pri= v *priv) mlx5_notifier_unregister(mdev, &priv->events_nb); mlx5e_rep_tc_disable(priv); mlx5_lag_remove_netdev(mdev, priv->netdev); + mlx5_vxlan_reset_to_default(mdev->vxlan); } =20 static MLX5E_DEFINE_STATS_GRP(sw_rep, 0); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B0B4C433F5 for ; Mon, 24 Jan 2022 21:49:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348525AbiAXVtG (ORCPT ); Mon, 24 Jan 2022 16:49:06 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36628 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448735AbiAXVNn (ORCPT ); Mon, 24 Jan 2022 16:13:43 -0500 Received: from smtp.kernel.org (relay.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 09BFB60C60; Mon, 24 Jan 2022 21:13:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD7E9C340E5; Mon, 24 Jan 2022 21:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058822; bh=LiungtrnGfVSW2X2GPi7o4c/ZYIPirnCDi7gCObCpHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qPUDwhPLNIQr4vdGONMRyJFTGm0IYF2Jghdcj+ovrJTF6ZRS2V/cXF2Dzn5/2XW8B qj1TuQvNZl6DwmWJ4taqM53e06C7zu+pEoj13/FF5iwt1O1a/vpiB0yysGl9MUtzsd UBN3NrvlJ+WC4gogGm2CXyA4bkOwzlc+Ra6v2aqA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Moshe Shemesh , Eran Ben Elisha , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.16 0414/1039] net/mlx5: Set command entry semaphore up once got index free Date: Mon, 24 Jan 2022 19:36:43 +0100 Message-Id: <20220124184139.230822450@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Moshe Shemesh [ Upstream commit 8e715cd613a1e872b9d918e912d90b399785761a ] Avoid a race where command work handler may fail to allocate command entry index, by holding the command semaphore down till command entry index is being freed. Fixes: 410bd754cd73 ("net/mlx5: Add retry mechanism to the command entry in= dex allocation") Signed-off-by: Moshe Shemesh Reviewed-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/et= hernet/mellanox/mlx5/core/cmd.c index a46284ca51720..f588503157d04 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -148,8 +148,12 @@ static void cmd_ent_put(struct mlx5_cmd_work_ent *ent) if (!refcount_dec_and_test(&ent->refcnt)) return; =20 - if (ent->idx >=3D 0) - cmd_free_index(ent->cmd, ent->idx); + if (ent->idx >=3D 0) { + struct mlx5_cmd *cmd =3D ent->cmd; + + cmd_free_index(cmd, ent->idx); + up(ent->page_queue ? &cmd->pages_sem : &cmd->sem); + } =20 cmd_free_ent(ent); } @@ -1602,8 +1606,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_de= v *dev, u64 vec, bool force vector =3D vec & 0xffffffff; for (i =3D 0; i < (1 << cmd->log_sz); i++) { if (test_bit(i, &vector)) { - struct semaphore *sem; - ent =3D cmd->ent_arr[i]; =20 /* if we already completed the command, ignore it */ @@ -1626,10 +1628,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_d= ev *dev, u64 vec, bool force dev->state =3D=3D MLX5_DEVICE_STATE_INTERNAL_ERROR) cmd_ent_put(ent); =20 - if (ent->page_queue) - sem =3D &cmd->pages_sem; - else - sem =3D &cmd->sem; ent->ts2 =3D ktime_get_ns(); memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); dump_command(dev, ent, 0); @@ -1683,7 +1681,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_de= v *dev, u64 vec, bool force */ complete(&ent->done); } - up(sem); } } } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6265AC433EF for ; Mon, 24 Jan 2022 23:38:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386342AbiAXXiR (ORCPT ); Mon, 24 Jan 2022 18:38:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841841AbiAXXAF (ORCPT ); Mon, 24 Jan 2022 18:00:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 921F3C02B772; Mon, 24 Jan 2022 13:13:46 -0800 (PST) Received: from smtp.kernel.org (relay.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 2F81C61469; Mon, 24 Jan 2022 21:13:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D70CC340E5; Mon, 24 Jan 2022 21:13:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058825; bh=3bYJ1Uv45V46z7TGSRB+5GaY5VET5wRoQDd1kBkBs3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2cEO5oIXPGyqluOHowVogsRYyakTQUCtbOjf7RtCSG50pASGtT0RoAWtUdgJiJQWa AmOGofe0JomF33nDLZ+Eb1g7G8boNk5KMCfLzBqemOWL//8kxHaBpSN5G7tEaS9ZUv JTnNsY/glLTjC5aSqW7/bEzGVBBvH5ZcmL+ptECM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zizhuang Deng , Tianjia Zhang , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0415/1039] lib/mpi: Add the return value check of kcalloc() Date: Mon, 24 Jan 2022 19:36:44 +0100 Message-Id: <20220124184139.262102539@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zizhuang Deng [ Upstream commit dd827abe296fe4249b2f8c9b95f72f814ea8348c ] Add the return value check of kcalloc() to avoid potential NULL ptr dereference. Fixes: a8ea8bdd9df9 ("lib/mpi: Extend the MPI library") Signed-off-by: Zizhuang Deng Reviewed-by: Tianjia Zhang Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- lib/mpi/mpi-mod.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/mpi/mpi-mod.c b/lib/mpi/mpi-mod.c index 47bc59edd4ff9..54fcc01564d9d 100644 --- a/lib/mpi/mpi-mod.c +++ b/lib/mpi/mpi-mod.c @@ -40,6 +40,8 @@ mpi_barrett_t mpi_barrett_init(MPI m, int copy) =20 mpi_normalize(m); ctx =3D kcalloc(1, sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return NULL; =20 if (copy) { ctx->m =3D mpi_copy(m); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D83F2C433EF for ; Mon, 24 Jan 2022 21:49:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376262AbiAXVtN (ORCPT ); Mon, 24 Jan 2022 16:49:13 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36738 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448811AbiAXVNw (ORCPT ); Mon, 24 Jan 2022 16:13:52 -0500 Received: from smtp.kernel.org (relay.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 62342614A8; Mon, 24 Jan 2022 21:13:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A40AC36AE2; Mon, 24 Jan 2022 21:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058828; bh=l6Ni9v689sSDYi8RGWJ0Fvwu5bh71a7KQRIO9ThqCxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W38MF4DRlAkuJ1I1UNwujiD9JLwIcbpPhuuLsFOY05J+M+O0j3hfCoX8rfuMOb+Go wtjKyP/wE/pKDAzlfTC+FLATmh2ykrlejUZVaZHyMcI/tJbW/mwYrmOvTnHyuMmwut 6nGKfHsc08vjiJ3gjD30S4TlVu3hnlNHISN8ADaA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0416/1039] Bluetooth: L2CAP: uninitialized variables in l2cap_sock_setsockopt() Date: Mon, 24 Jan 2022 19:36:45 +0100 Message-Id: <20220124184139.296305819@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 2b70d4f9b20635ac328836e50d183632e1930f94 ] The "opt" variable is a u32, but on some paths only the top bytes were initialized and the others contained random stack data. Fixes: a7b75c5a8c41 ("net: pass a sockptr_t into ->setsockopt") Signed-off-by: Dan Carpenter Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/l2cap_sock.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 251017c69ab7f..d2c6785205992 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -903,6 +903,8 @@ static int l2cap_sock_setsockopt(struct socket *sock, i= nt level, int optname, struct l2cap_conn *conn; int len, err =3D 0; u32 opt; + u16 mtu; + u8 mode; =20 BT_DBG("sk %p", sk); =20 @@ -1085,16 +1087,16 @@ static int l2cap_sock_setsockopt(struct socket *soc= k, int level, int optname, break; } =20 - if (copy_from_sockptr(&opt, optval, sizeof(u16))) { + if (copy_from_sockptr(&mtu, optval, sizeof(u16))) { err =3D -EFAULT; break; } =20 if (chan->mode =3D=3D L2CAP_MODE_EXT_FLOWCTL && sk->sk_state =3D=3D BT_CONNECTED) - err =3D l2cap_chan_reconfigure(chan, opt); + err =3D l2cap_chan_reconfigure(chan, mtu); else - chan->imtu =3D opt; + chan->imtu =3D mtu; =20 break; =20 @@ -1116,14 +1118,14 @@ static int l2cap_sock_setsockopt(struct socket *soc= k, int level, int optname, break; } =20 - if (copy_from_sockptr(&opt, optval, sizeof(u8))) { + if (copy_from_sockptr(&mode, optval, sizeof(u8))) { err =3D -EFAULT; break; } =20 - BT_DBG("opt %u", opt); + BT_DBG("mode %u", mode); =20 - err =3D l2cap_set_mode(chan, opt); + err =3D l2cap_set_mode(chan, mode); if (err) break; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0FA6C433F5 for ; Mon, 24 Jan 2022 21:49:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379351AbiAXVtZ (ORCPT ); Mon, 24 Jan 2022 16:49:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34670 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448834AbiAXVNy (ORCPT ); Mon, 24 Jan 2022 16:13:54 -0500 Received: from smtp.kernel.org (relay.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 26373B811A2; Mon, 24 Jan 2022 21:13:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 384DCC340E5; Mon, 24 Jan 2022 21:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058831; bh=I6eodZE1LcEU8Q+OsMt9Qrl7f05Xen+Z8HM/mrSDGKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C/IjIU8/nUTcwnh+OYRKuBCyJz7fVKMwNC7fs/idICvFpQwUkDaq8jgKPgyLkV3BS 2LtYhO0eJCsOQtkBtPk4ye6Z6fykcImebsvKj8qwz2emffYoKHTXlD6qKBfl+wfTJY O6tCRyOD3+6itBwEPJMC7wDEQ3LxDQfe/LVsV08I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0417/1039] Bluetooth: hci_sock: fix endian bug in hci_sock_setsockopt() Date: Mon, 24 Jan 2022 19:36:46 +0100 Message-Id: <20220124184139.328443652@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit b9f9dbad0bd1c302d357fdd327c398f51f5fc2b1 ] This copies a u16 into the high bits of an int, which works on a big endian system but not on a little endian system. Fixes: 09572fca7223 ("Bluetooth: hci_sock: Add support for BT_{SND,RCV}BUF") Signed-off-by: Dan Carpenter Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/hci_sock.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index d0dad1fafe079..f2506e656f3e4 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -1915,7 +1915,8 @@ static int hci_sock_setsockopt(struct socket *sock, i= nt level, int optname, sockptr_t optval, unsigned int len) { struct sock *sk =3D sock->sk; - int err =3D 0, opt =3D 0; + int err =3D 0; + u16 opt; =20 BT_DBG("sk %p, opt %d", sk, optname); =20 @@ -1941,7 +1942,7 @@ static int hci_sock_setsockopt(struct socket *sock, i= nt level, int optname, goto done; } =20 - if (copy_from_sockptr(&opt, optval, sizeof(u16))) { + if (copy_from_sockptr(&opt, optval, sizeof(opt))) { err =3D -EFAULT; break; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD808C433EF for ; Mon, 24 Jan 2022 23:45:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2361287AbiAXXjk (ORCPT ); Mon, 24 Jan 2022 18:39:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1842389AbiAXXBr (ORCPT ); Mon, 24 Jan 2022 18:01:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2DC6C0F0551; Mon, 24 Jan 2022 13:13:55 -0800 (PST) Received: from smtp.kernel.org (relay.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 83D646147D; Mon, 24 Jan 2022 21:13:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C436C340E5; Mon, 24 Jan 2022 21:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058834; bh=hu2038tPn5JoE1cXR2b9Gyfb0XVbNKodylO5hpbvfNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GD7/bqbj7wEFCekn2sjHrkoyoF8XSvWCbCN9hUCJJ6JZvS6qrHCS8n0tTpV7Kjabz 0g8A0tfPQpgxQmsiscU0sYDP+pvHghQVSryNBOJ5ocBr7ZjGLNbt/ZNjdygwEDfHJ/ B5j/dNhYyqVK/7ICSN0i2e7jmNBWAyraLoXD9CeU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , Mat Martineau , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0418/1039] mptcp: fix per socket endpoint accounting Date: Mon, 24 Jan 2022 19:36:47 +0100 Message-Id: <20220124184139.360599133@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit f7d6a237d7422809d458d754016de2844017cb4d ] Since full-mesh endpoint support, the reception of a single ADD_ADDR option can cause multiple subflows creation. When such option is accepted we increment 'add_addr_accepted' by one. When we received a paired RM_ADDR option, we deleted all the relevant subflows, decrementing 'add_addr_accepted' by one for each of them. We have a similar issue for 'local_addr_used' Fix them moving the pm endpoint accounting outside the subflow traversal. Fixes: 1a0d6136c5f0 ("mptcp: local addresses fullmesh") Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/mptcp/pm_netlink.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index f523051f5aef3..65764c8171b37 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -710,6 +710,8 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp= _sock *msk, return; =20 for (i =3D 0; i < rm_list->nr; i++) { + bool removed =3D false; + list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) { struct sock *ssk =3D mptcp_subflow_tcp_sock(subflow); int how =3D RCV_SHUTDOWN | SEND_SHUTDOWN; @@ -729,15 +731,19 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mpt= cp_sock *msk, mptcp_close_ssk(sk, ssk, subflow); spin_lock_bh(&msk->pm.lock); =20 - if (rm_type =3D=3D MPTCP_MIB_RMADDR) { - msk->pm.add_addr_accepted--; - WRITE_ONCE(msk->pm.accept_addr, true); - } else if (rm_type =3D=3D MPTCP_MIB_RMSUBFLOW) { - msk->pm.local_addr_used--; - } + removed =3D true; msk->pm.subflows--; __MPTCP_INC_STATS(sock_net(sk), rm_type); } + if (!removed) + continue; + + if (rm_type =3D=3D MPTCP_MIB_RMADDR) { + msk->pm.add_addr_accepted--; + WRITE_ONCE(msk->pm.accept_addr, true); + } else if (rm_type =3D=3D MPTCP_MIB_RMSUBFLOW) { + msk->pm.local_addr_used--; + } } } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C014C433F5 for ; Mon, 24 Jan 2022 21:54:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574834AbiAXVua (ORCPT ); Mon, 24 Jan 2022 16:50:30 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35284 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448850AbiAXVN7 (ORCPT ); Mon, 24 Jan 2022 16:13:59 -0500 Received: from smtp.kernel.org (relay.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 9713F61469; Mon, 24 Jan 2022 21:13:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CE87C340E5; Mon, 24 Jan 2022 21:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058838; bh=4Xtodu3zTAwAMpuKMCIK/bIZ2u4C1XrKH2z0fYjbXBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qchwmpts16Qt1u53wOHHjfgdjcwZj1Vyi86ugZaUYws1lM2gaWW/i8K31ZUacDLij /7/gX8EKsjSRWOsu0iK/0mYD21ecErM2yfOGpXkh21vhp7YZzqgTqGq1gSZmjhNkn8 ZBso9g0lKXt1lM5LTP2qnqf9/gIKazhIG4nso/TQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthieu Baerts , Mat Martineau , "David S. Miller" , Sasha Levin , Geliang Tang Subject: [PATCH 5.16 0419/1039] mptcp: fix opt size when sending DSS + MP_FAIL Date: Mon, 24 Jan 2022 19:36:48 +0100 Message-Id: <20220124184139.391651474@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matthieu Baerts [ Upstream commit 04fac2cae9422a3401c172571afbcfdd58fa5c7e ] When these two options had to be sent -- which is not common -- the DSS size was not being taken into account in the remaining size. Additionally in this situation, the reported size was only the one of the MP_FAIL which can cause issue if at the end, we need to write more in the TCP options than previously said. Here we use a dedicated variable for MP_FAIL size to keep the WARN_ON_ONCE() just after. Fixes: c25aeb4e0953 ("mptcp: MP_FAIL suboption sending") Acked-and-tested-by: Geliang Tang Signed-off-by: Matthieu Baerts Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/mptcp/options.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index fe98e4f475baa..96c6efdd48bcc 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -821,10 +821,13 @@ bool mptcp_established_options(struct sock *sk, struc= t sk_buff *skb, if (mptcp_established_options_mp(sk, skb, snd_data_fin, &opt_size, remain= ing, opts)) ret =3D true; else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, = remaining, opts)) { + unsigned int mp_fail_size; + ret =3D true; - if (mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { - *size +=3D opt_size; - remaining -=3D opt_size; + if (mptcp_established_options_mp_fail(sk, &mp_fail_size, + remaining - opt_size, opts)) { + *size +=3D opt_size + mp_fail_size; + remaining -=3D opt_size - mp_fail_size; return true; } } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86C66C4321E for ; Mon, 24 Jan 2022 23:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362161AbiAXXls (ORCPT ); Mon, 24 Jan 2022 18:41:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1842496AbiAXXB7 (ORCPT ); Mon, 24 Jan 2022 18:01:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4305FC0F0559; Mon, 24 Jan 2022 13:14:02 -0800 (PST) Received: from smtp.kernel.org (relay.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 C75036141C; Mon, 24 Jan 2022 21:14:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DF29C340E5; Mon, 24 Jan 2022 21:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058841; bh=ZoNkKVhcKuiwDIg6kQ1SLQk1hXz5ho2UjRj/10QBW00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UqD5U5SF5HCnr1yPnLOfJlqwiIc3fgeNJEWktTmpZDmOk8OdwL+DD7+PNEdK54avi sr7Fx5qWjndk712ufLY4NJ14KzN7O06SEKbJfKYjT8PApvuukcecAYv3tz+AImaH/v 8T6f14t0UDSZX4uL3zrCapxPT7RDHoX+0ypL+sho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthieu Baerts , Geliang Tang , Mat Martineau , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0420/1039] mptcp: fix a DSS option writing error Date: Mon, 24 Jan 2022 19:36:49 +0100 Message-Id: <20220124184139.422102200@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geliang Tang [ Upstream commit 110b6d1fe98fd7af9893992459b651594d789293 ] 'ptr +=3D 1;' was omitted in the original code. If the DSS is the last option -- which is what we have most of the time -- that's not an issue. But it is if we need to send something else after like a RM_ADDR or an MP_PRIO. Fixes: 1bff1e43a30e ("mptcp: optimize out option generation") Reviewed-by: Matthieu Baerts Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/mptcp/options.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 96c6efdd48bcc..6661b1d6520f1 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1319,6 +1319,7 @@ void mptcp_write_options(__be32 *ptr, const struct tc= p_sock *tp, put_unaligned_be32(mpext->data_len << 16 | TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); } + ptr +=3D 1; } } else if (OPTIONS_MPTCP_MPC & opts->suboptions) { u8 len, flag =3D MPTCP_CAP_HMAC_SHA256; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E80E0C433EF for ; Mon, 24 Jan 2022 21:54:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574487AbiAXVth (ORCPT ); Mon, 24 Jan 2022 16:49:37 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36992 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448888AbiAXVOJ (ORCPT ); Mon, 24 Jan 2022 16:14:09 -0500 Received: from smtp.kernel.org (relay.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 F1B9C6149E; Mon, 24 Jan 2022 21:14:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9AC2C340E7; Mon, 24 Jan 2022 21:14:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058844; bh=pwnwnU/LAdzSlH5GmWQH3agJIXJJWSc13ZnYoVB68hs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gl+S+cVirc9DvgeO3U+5UpmJb/vZoN9Y+dLpiN8EMKftFBj3bkDotNbb7x3x9G6nJ lLme0AHQt7pjhfzUOJqB9ggoQafqMT+nO9eDqwReI2SPLibTbRYP0aKZgpTLBvh5IB OG7lyN8sUDqHtqxCw93hAtOSgOrdXLAeumbkNdF0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Morton , Michal Hocko , Paolo Abeni , Mat Martineau , "David S. Miller" , Sasha Levin , syzbot+bc9e2d2dbcb347dd215a@syzkaller.appspotmail.com Subject: [PATCH 5.16 0421/1039] mptcp: Check reclaim amount before reducing allocation Date: Mon, 24 Jan 2022 19:36:50 +0100 Message-Id: <20220124184139.452884444@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mat Martineau [ Upstream commit 269bda9e7da48eafb599d01c96199caa2f7547e5 ] syzbot found a page counter underflow that was triggered by MPTCP's reclaim code: page_counter underflow: -4294964789 nr_pages=3D4294967295 WARNING: CPU: 2 PID: 3785 at mm/page_counter.c:56 page_counter_cancel+0xcf/= 0xe0 mm/page_counter.c:56 Modules linked in: CPU: 2 PID: 3785 Comm: kworker/2:6 Not tainted 5.16.0-rc1-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Workqueue: events mptcp_worker RIP: 0010:page_counter_cancel+0xcf/0xe0 mm/page_counter.c:56 Code: c7 04 24 00 00 00 00 45 31 f6 eb 97 e8 2a 2b b5 ff 4c 89 ea 48 89 ee = 48 c7 c7 00 9e b8 89 c6 05 a0 c1 ba 0b 01 e8 95 e4 4b 07 <0f> 0b eb a8 4c 8= 9 e7 e8 25 5a fb ff eb c7 0f 1f 00 41 56 41 55 49 RSP: 0018:ffffc90002d4f918 EFLAGS: 00010082 RAX: 0000000000000000 RBX: ffff88806a494120 RCX: 0000000000000000 RDX: ffff8880688c41c0 RSI: ffffffff815e8f28 RDI: fffff520005a9f15 RBP: ffffffff000009cb R08: 0000000000000000 R09: 0000000000000000 R10: ffffffff815e2cfe R11: 0000000000000000 R12: ffff88806a494120 R13: 00000000ffffffff R14: 0000000000000000 R15: 0000000000000001 FS: 0000000000000000(0000) GS:ffff88802cc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b2de21000 CR3: 000000005ad59000 CR4: 0000000000150ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: page_counter_uncharge+0x2e/0x60 mm/page_counter.c:160 drain_stock+0xc1/0x180 mm/memcontrol.c:2219 refill_stock+0x139/0x2f0 mm/memcontrol.c:2271 __sk_mem_reduce_allocated+0x24d/0x550 net/core/sock.c:2945 __mptcp_rmem_reclaim net/mptcp/protocol.c:167 [inline] __mptcp_mem_reclaim_partial+0x124/0x410 net/mptcp/protocol.c:975 mptcp_mem_reclaim_partial net/mptcp/protocol.c:982 [inline] mptcp_alloc_tx_skb net/mptcp/protocol.c:1212 [inline] mptcp_sendmsg_frag+0x18c6/0x2190 net/mptcp/protocol.c:1279 __mptcp_push_pending+0x232/0x720 net/mptcp/protocol.c:1545 mptcp_release_cb+0xfe/0x200 net/mptcp/protocol.c:2975 release_sock+0xb4/0x1b0 net/core/sock.c:3306 mptcp_worker+0x51e/0xc10 net/mptcp/protocol.c:2443 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 __mptcp_mem_reclaim_partial() could call __mptcp_rmem_reclaim() with a negative value, which passed that negative value to __sk_mem_reduce_allocated() and triggered the splat above. Check for a reclaim amount that is positive and large enough for __mptcp_rmem_reclaim() to actually adjust rmem_fwd_alloc (much like the sk_mem_reclaim_partial() code the function is based on). v2: Use '>' instead of '>=3D', since SK_MEM_QUANTUM - 1 would get right-shifted into nothing by __mptcp_rmem_reclaim. Fixes: 6511882cdd82 ("mptcp: allocate fwd memory separately on the rx and t= x path") Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/252 Reported-and-tested-by: syzbot+bc9e2d2dbcb347dd215a@syzkaller.appspotmail.c= om Cc: Andrew Morton Cc: Michal Hocko Acked-by: Paolo Abeni Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/mptcp/protocol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 54613f5b75217..0cd55e4c30fab 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -972,7 +972,9 @@ static void __mptcp_mem_reclaim_partial(struct sock *sk) =20 lockdep_assert_held_once(&sk->sk_lock.slock); =20 - __mptcp_rmem_reclaim(sk, reclaimable - 1); + if (reclaimable > SK_MEM_QUANTUM) + __mptcp_rmem_reclaim(sk, reclaimable - 1); + sk_mem_reclaim_partial(sk); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A23DFC433FE for ; Mon, 24 Jan 2022 22:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580550AbiAXWKK (ORCPT ); Mon, 24 Jan 2022 17:10:10 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34862 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345360AbiAXVOK (ORCPT ); Mon, 24 Jan 2022 16:14:10 -0500 Received: from smtp.kernel.org (relay.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 E247CB812A5; Mon, 24 Jan 2022 21:14:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 005F3C340E5; Mon, 24 Jan 2022 21:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058847; bh=VhfLq6rswzGbOL/ljKj6bPc7+9MR7Lf4elfV0tKpNaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kiqhslUg9G91Rkev+dFHHnkZHnNamJ7z0obY87r71QaNA9OW4a8/s0Ed/f6gvySrH tzQWghOX+deUTdhRtMyjQseWOTLaqm5oiO/WcH6NtpQpHkZIX/op1QscM0z5uEdtp5 /rCAJXumfI8Vf70KkVDJ56sa52R/vI2EVW5h0mq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0422/1039] spi: spi-meson-spifc: Add missing pm_runtime_disable() in meson_spifc_probe Date: Mon, 24 Jan 2022 19:36:51 +0100 Message-Id: <20220124184139.493000067@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 69c1b87516e327a60b39f96b778fe683259408bf ] If the probe fails, we should use pm_runtime_disable() to balance pm_runtime_enable(). Add missing pm_runtime_disable() for meson_spifc_probe. Fixes: c3e4bc5434d2 ("spi: meson: Add support for Amlogic Meson SPIFC") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220107075424.7774-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/spi/spi-meson-spifc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c index 8eca6f24cb799..c8ed7815c4ba6 100644 --- a/drivers/spi/spi-meson-spifc.c +++ b/drivers/spi/spi-meson-spifc.c @@ -349,6 +349,7 @@ static int meson_spifc_probe(struct platform_device *pd= ev) return 0; out_clk: clk_disable_unprepare(spifc->clk); + pm_runtime_disable(spifc->dev); out_err: spi_master_put(master); return ret; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BC99C433EF for ; Mon, 24 Jan 2022 22:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580533AbiAXWJ7 (ORCPT ); Mon, 24 Jan 2022 17:09:59 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37066 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448902AbiAXVOM (ORCPT ); Mon, 24 Jan 2022 16:14:12 -0500 Received: from smtp.kernel.org (relay.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 563066148B; Mon, 24 Jan 2022 21:14:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CC6FC340E5; Mon, 24 Jan 2022 21:14:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058850; bh=br5AcrBFtY1joqdyAs9YGFFLMk3rYlCqyHCcz2VHz0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZtJcfE6dLT5uXD0cobMhB6toFjtos9FGy5QwwlDcqwCBmRkAIdS3GvGSfQG82KjXG 02yjf6iGlrcvHI5jOQPy1mccy6pwkBV5zv3Js41zv9LpOv6T0GupNfzIk2PkVlwRCN Ss5uUzvfcu3K1txT4YTsFIR4Tm9sIDdKsJfGxU30= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Subbaraya Sundeep , Sunil Goutham , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0423/1039] octeontx2-af: Increment ptp refcount before use Date: Mon, 24 Jan 2022 19:36:52 +0100 Message-Id: <20220124184139.523946948@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 93440f4888cf049dbd22b41aaf94d2e2153b3eb8 ] Before using the ptp pci device by AF driver increment the reference count of it. Fixes: a8b90c9d26d6 ("octeontx2-af: Add PTP device id for CN10K and 95O sil= cons") Signed-off-by: Subbaraya Sundeep Signed-off-by: Sunil Goutham Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/marvell/octeontx2/af/ptp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/ptp.c b/drivers/net/= ethernet/marvell/octeontx2/af/ptp.c index d6321de3cc171..e682b7bfde640 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/ptp.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/ptp.c @@ -60,6 +60,8 @@ struct ptp *ptp_get(void) /* Check driver is bound to PTP block */ if (!ptp) ptp =3D ERR_PTR(-EPROBE_DEFER); + else + pci_dev_get(ptp->pdev); =20 return ptp; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DB8FC433EF for ; Mon, 24 Jan 2022 22:12:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580493AbiAXWJv (ORCPT ); Mon, 24 Jan 2022 17:09:51 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37160 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448937AbiAXVOS (ORCPT ); Mon, 24 Jan 2022 16:14:18 -0500 Received: from smtp.kernel.org (relay.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 4F6EF6141C; Mon, 24 Jan 2022 21:14:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 353ABC340E5; Mon, 24 Jan 2022 21:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058856; bh=V/bcMqNPkVX/u08LsSoXhVbrVGRhAneAsOwIFiWm3F0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qny8aKexySmth3BreCq3Mnfc7yGjBund4Khv/z0IgdNvKkRNjuM16oABixLU3NhPh VGbe9XnvQ8s/UBIghpIPCdXP+6I2xe3c4KyhCAyx+Fn9GLwclSM0CiUgGxohWsy788 js8vG12HsLWm89WOjieSKnIfBttm3Sw/GIofPPk0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rakesh Babu Saladi , Subbaraya Sundeep , Sunil Goutham , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0424/1039] octeontx2-nicvf: Free VF PTP resources. Date: Mon, 24 Jan 2022 19:36:53 +0100 Message-Id: <20220124184139.559681839@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rakesh Babu Saladi [ Upstream commit eabd0f88b0d2d433c5dfe88218d4ce1c11ef04b8 ] When a VF is removed respective PTP resources are not being freed currently. This patch fixes it. Fixes: 43510ef4ddad ("octeontx2-nicvf: Add PTP hardware clock support to NI= X VF") Signed-off-by: Rakesh Babu Saladi Signed-off-by: Subbaraya Sundeep Signed-off-by: Sunil Goutham Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers= /net/ethernet/marvell/octeontx2/nic/otx2_vf.c index 78944ad3492ff..d75f3a78fabf1 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c @@ -684,7 +684,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const str= uct pci_device_id *id) err =3D register_netdev(netdev); if (err) { dev_err(dev, "Failed to register netdevice\n"); - goto err_detach_rsrc; + goto err_ptp_destroy; } =20 err =3D otx2_wq_init(vf); @@ -709,6 +709,8 @@ static int otx2vf_probe(struct pci_dev *pdev, const str= uct pci_device_id *id) =20 err_unreg_netdev: unregister_netdev(netdev); +err_ptp_destroy: + otx2_ptp_destroy(vf); err_detach_rsrc: if (test_bit(CN10K_LMTST, &vf->hw.cap_flag)) qmem_free(vf->dev, vf->dync_lmt); @@ -742,6 +744,7 @@ static void otx2vf_remove(struct pci_dev *pdev) unregister_netdev(netdev); if (vf->otx2_wq) destroy_workqueue(vf->otx2_wq); + otx2_ptp_destroy(vf); otx2vf_disable_mbox_intr(vf); otx2_detach_resources(&vf->mbox); if (test_bit(CN10K_LMTST, &vf->hw.cap_flag)) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DBD0C3525A for ; Mon, 24 Jan 2022 22:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581217AbiAXWLY (ORCPT ); Mon, 24 Jan 2022 17:11:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33918 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359768AbiAXVOW (ORCPT ); Mon, 24 Jan 2022 16:14:22 -0500 Received: from smtp.kernel.org (relay.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 0F321B81243; Mon, 24 Jan 2022 21:14:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23C2EC340E5; Mon, 24 Jan 2022 21:14:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058859; bh=tLYKVPrk6SwB3glulpE2TPmStGQfWvn/PQr44b2j16Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XgYw4whTmsFkoXqPi68o5le/aGQDK8lgnUovxt8I0eFjad64kU411GHnRDMJAeIcs USMoNVVHIFGVyvgPZiLtlj05pUVgbBSV6/nv9ILYgiPbYKO0vyHJucX0qGvEGDadjm B6uxRc0iVH6x/2Pt9HLunhsCTRsdTqKGi/sxzWAk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0425/1039] ax25: uninitialized variable in ax25_setsockopt() Date: Mon, 24 Jan 2022 19:36:54 +0100 Message-Id: <20220124184139.589701660@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 9371937092d5fd502032c1bb4475b36b39b1f1b3 ] The "opt" variable is unsigned long but we only copy 4 bytes from the user so the lower 4 bytes are uninitialized. I have changed the integer overflow checks from ULONG to UINT as well. This is a slight API change but I don't expect it to break anything. Fixes: a7b75c5a8c41 ("net: pass a sockptr_t into ->setsockopt") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/ax25/af_ax25.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index cfca99e295b80..02f43f3e2c564 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -536,7 +536,7 @@ static int ax25_setsockopt(struct socket *sock, int lev= el, int optname, ax25_cb *ax25; struct net_device *dev; char devname[IFNAMSIZ]; - unsigned long opt; + unsigned int opt; int res =3D 0; =20 if (level !=3D SOL_AX25) @@ -568,7 +568,7 @@ static int ax25_setsockopt(struct socket *sock, int lev= el, int optname, break; =20 case AX25_T1: - if (opt < 1 || opt > ULONG_MAX / HZ) { + if (opt < 1 || opt > UINT_MAX / HZ) { res =3D -EINVAL; break; } @@ -577,7 +577,7 @@ static int ax25_setsockopt(struct socket *sock, int lev= el, int optname, break; =20 case AX25_T2: - if (opt < 1 || opt > ULONG_MAX / HZ) { + if (opt < 1 || opt > UINT_MAX / HZ) { res =3D -EINVAL; break; } @@ -593,7 +593,7 @@ static int ax25_setsockopt(struct socket *sock, int lev= el, int optname, break; =20 case AX25_T3: - if (opt < 1 || opt > ULONG_MAX / HZ) { + if (opt < 1 || opt > UINT_MAX / HZ) { res =3D -EINVAL; break; } @@ -601,7 +601,7 @@ static int ax25_setsockopt(struct socket *sock, int lev= el, int optname, break; =20 case AX25_IDLE: - if (opt > ULONG_MAX / (60 * HZ)) { + if (opt > UINT_MAX / (60 * HZ)) { res =3D -EINVAL; break; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84C31C433F5 for ; Mon, 24 Jan 2022 23:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362276AbiAXXmF (ORCPT ); Mon, 24 Jan 2022 18:42:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1842547AbiAXXCF (ORCPT ); Mon, 24 Jan 2022 18:02:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF9ECC0F057C; Mon, 24 Jan 2022 13:14:23 -0800 (PST) Received: from smtp.kernel.org (relay.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 4F91F614FC; Mon, 24 Jan 2022 21:14:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27A8BC340E5; Mon, 24 Jan 2022 21:14:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058862; bh=hPGCHYzswTPBY7Jbzbp86wCDznBp1EHftpZ+lmBxNp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nGOYJoBo9bhZkZjROE9x79p7kEtC0H78faIKbh304F9xG8KmCgV8nluiWSkhPvrRg lJiBE9/qPumtRssI1I929pvhBxNmahQ41IKwddbat+XzETD2FAwAlwLj3NKfOe5Hz+ gAsR+8/dxCIWcImYSlH1RbAKY5TYsZ03c/oHEx9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0426/1039] netrom: fix api breakage in nr_setsockopt() Date: Mon, 24 Jan 2022 19:36:55 +0100 Message-Id: <20220124184139.620652801@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit dc35616e6c2907b0c0c391a205802d8880f7fd85 ] This needs to copy an unsigned int from user space instead of a long to avoid breaking user space with an API change. I have updated all the integer overflow checks from ULONG to UINT as well. This is a slight API change but I do not expect it to affect anything in real life. Fixes: 3087a6f36ee0 ("netrom: fix copying in user data in nr_setsockopt") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/netrom/af_netrom.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index f1ba7dd3d253d..fa9dc2ba39418 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -298,7 +298,7 @@ static int nr_setsockopt(struct socket *sock, int level= , int optname, { struct sock *sk =3D sock->sk; struct nr_sock *nr =3D nr_sk(sk); - unsigned long opt; + unsigned int opt; =20 if (level !=3D SOL_NETROM) return -ENOPROTOOPT; @@ -306,18 +306,18 @@ static int nr_setsockopt(struct socket *sock, int lev= el, int optname, if (optlen < sizeof(unsigned int)) return -EINVAL; =20 - if (copy_from_sockptr(&opt, optval, sizeof(unsigned long))) + if (copy_from_sockptr(&opt, optval, sizeof(opt))) return -EFAULT; =20 switch (optname) { case NETROM_T1: - if (opt < 1 || opt > ULONG_MAX / HZ) + if (opt < 1 || opt > UINT_MAX / HZ) return -EINVAL; nr->t1 =3D opt * HZ; return 0; =20 case NETROM_T2: - if (opt < 1 || opt > ULONG_MAX / HZ) + if (opt < 1 || opt > UINT_MAX / HZ) return -EINVAL; nr->t2 =3D opt * HZ; return 0; @@ -329,13 +329,13 @@ static int nr_setsockopt(struct socket *sock, int lev= el, int optname, return 0; =20 case NETROM_T4: - if (opt < 1 || opt > ULONG_MAX / HZ) + if (opt < 1 || opt > UINT_MAX / HZ) return -EINVAL; nr->t4 =3D opt * HZ; return 0; =20 case NETROM_IDLE: - if (opt > ULONG_MAX / (60 * HZ)) + if (opt > UINT_MAX / (60 * HZ)) return -EINVAL; nr->idle =3D opt * 60 * HZ; return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8697C433EF for ; Mon, 24 Jan 2022 23:47:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2361982AbiAXXlU (ORCPT ); Mon, 24 Jan 2022 18:41:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1842620AbiAXXCS (ORCPT ); Mon, 24 Jan 2022 18:02:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8229C06C588; Mon, 24 Jan 2022 13:14:26 -0800 (PST) Received: from smtp.kernel.org (relay.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 74EAD614D0; Mon, 24 Jan 2022 21:14:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51F84C340E5; Mon, 24 Jan 2022 21:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058865; bh=GG2VcJaBszp1adCiwTCfU7WT3BqNfJaDko/ghevEf3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qxpMUVYL/hN56iz0uwkZutEZ8xvzg5x3tnBDRSxWPsKUDDTuxMFzdgDYSClmezHCs k5c+2QNlfywmGmGsOia97syrJ5mqomCf6zn7CxzsjpPrgZMWVMK2HQrhSaQveGukZc rAdBHF4EbRpYsS/i1s3Y7tbmjk07xfFZEF3k+sf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Fabio Estevam , Sasha Levin Subject: [PATCH 5.16 0427/1039] regmap: Call regmap_debugfs_exit() prior to _init() Date: Mon, 24 Jan 2022 19:36:56 +0100 Message-Id: <20220124184139.652270158@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit 530792efa6cb86f5612ff093333fec735793b582 ] Since commit cffa4b2122f5 ("regmap: debugfs: Fix a memory leak when calling regmap_attach_dev"), the following debugfs error is seen on i.MX boards: debugfs: Directory 'dummy-iomuxc-gpr@20e0000' with parent 'regmap' already = present! In the attempt to fix the memory leak, the above commit added a NULL check for map->debugfs_name. For the first debufs entry, map->debugfs_name is NULL and then the new name is allocated via kasprintf(). For the second debugfs entry, map->debugfs_name() is no longer NULL, so it will keep using the old entry name and the duplicate name error is seen. Quoting Mark Brown: "That means that if the device gets freed we'll end up with the old debugfs file hanging around pointing at nothing. ... To be more explicit this means we need a call to regmap_debugfs_exit() which will clean up all the existing debugfs stuff before we loose references to it." Call regmap_debugfs_exit() prior to regmap_debugfs_init() to fix the problem. Tested on i.MX6Q and i.MX6SX boards. Fixes: cffa4b2122f5 ("regmap: debugfs: Fix a memory leak when calling regma= p_attach_dev") Suggested-by: Mark Brown Signed-off-by: Fabio Estevam Link: https://lore.kernel.org/r/20220107163307.335404-1-festevam@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/base/regmap/regmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 21a0c2562ec06..f7811641ed5ae 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -647,6 +647,7 @@ int regmap_attach_dev(struct device *dev, struct regmap= *map, if (ret) return ret; =20 + regmap_debugfs_exit(map); regmap_debugfs_init(map); =20 /* Add a devres resource for dev_get_regmap() */ --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C37D0C43217 for ; Mon, 24 Jan 2022 21:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574895AbiAXVul (ORCPT ); Mon, 24 Jan 2022 16:50:41 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37578 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448972AbiAXVOa (ORCPT ); Mon, 24 Jan 2022 16:14:30 -0500 Received: from smtp.kernel.org (relay.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 6A417614C7; Mon, 24 Jan 2022 21:14:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47DC1C340E5; Mon, 24 Jan 2022 21:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058868; bh=rktmjRmnahCAgSOOgWpBvMZunEdB5saFcuYLb61QNmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zrG5zHf7FCwdWPZEC+JM2IqIIlJYZ5mf/ycfON0nHnuV5xaEuoAs9q8QsXyl/eRfj ivr68kbfa/2tZsGGwc9pHV7I+mRqJK2CYmvQU0H8AMpQyi91CqjQz2tLK5EYapRbQI CclHgqLdWY0Ikc+W4rP6rY0jRJJpESWk6OuDFP0w= 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.16 0428/1039] net: mscc: ocelot: fix incorrect balancing with down LAG ports Date: Mon, 24 Jan 2022 19:36:57 +0100 Message-Id: <20220124184139.683693516@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 a14e6b69f393d651913edcbe4ec0dec27b8b4b40 ] Assuming the test setup described here: https://patchwork.kernel.org/project/netdevbpf/cover/20210205130240.4072854= -1-vladimir.oltean@nxp.com/ (swp1 and swp2 are in bond0, and bond0 is in a bridge with swp0) it can be seen that when swp1 goes down (on either board A or B), then traffic that should go through that port isn't forwarded anywhere. A dump of the PGID table shows the following: PGID_DST[0] =3D ports 0 PGID_DST[1] =3D ports 1 PGID_DST[2] =3D ports 2 PGID_DST[3] =3D ports 3 PGID_DST[4] =3D ports 4 PGID_DST[5] =3D ports 5 PGID_DST[6] =3D no ports PGID_AGGR[0] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[1] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[2] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[3] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[4] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[5] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[6] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[7] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[8] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[9] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[10] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[11] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[12] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[13] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[14] =3D ports 0, 1, 2, 3, 4, 5 PGID_AGGR[15] =3D ports 0, 1, 2, 3, 4, 5 PGID_SRC[0] =3D ports 1, 2 PGID_SRC[1] =3D ports 0 PGID_SRC[2] =3D ports 0 PGID_SRC[3] =3D no ports PGID_SRC[4] =3D no ports PGID_SRC[5] =3D no ports PGID_SRC[6] =3D ports 0, 1, 2, 3, 4, 5 Whereas a "good" PGID configuration for that setup should have looked like this: PGID_DST[0] =3D ports 0 PGID_DST[1] =3D ports 1, 2 PGID_DST[2] =3D ports 1, 2 PGID_DST[3] =3D ports 3 PGID_DST[4] =3D ports 4 PGID_DST[5] =3D ports 5 PGID_DST[6] =3D no ports PGID_AGGR[0] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[1] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[2] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[3] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[4] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[5] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[6] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[7] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[8] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[9] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[10] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[11] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[12] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[13] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[14] =3D ports 0, 2, 3, 4, 5 PGID_AGGR[15] =3D ports 0, 2, 3, 4, 5 PGID_SRC[0] =3D ports 1, 2 PGID_SRC[1] =3D ports 0 PGID_SRC[2] =3D ports 0 PGID_SRC[3] =3D no ports PGID_SRC[4] =3D no ports PGID_SRC[5] =3D no ports PGID_SRC[6] =3D ports 0, 1, 2, 3, 4, 5 In other words, in the "bad" configuration, the attempt is to remove the inactive swp1 from the destination ports via PGID_DST. But when a MAC table entry is learned, it is learned towards PGID_DST 1, because that is the logical port id of the LAG itself (it is equal to the lowest numbered member port). So when swp1 becomes inactive, if we set PGID_DST[1] to contain just swp1 and not swp2, the packet will not have any chance to reach the destination via swp2. The "correct" way to remove swp1 as a destination is via PGID_AGGR (remove swp1 from the aggregation port groups for all aggregation codes). This means that PGID_DST[1] and PGID_DST[2] must still contain both swp1 and swp2. This makes the MAC table still treat packets destined towards the single-port LAG as "multicast", and the inactive ports are removed via the aggregation code tables. The change presented here is a design one: the ocelot_get_bond_mask() function used to take an "only_active_ports" argument. We don't need that. The only call site that specifies only_active_ports=3Dtrue, ocelot_set_aggr_pgids(), must retrieve the entire bonding mask, because it must program that into PGID_DST. Additionally, it must also clear the inactive ports from the bond mask here, which it can't do if bond_mask just contains the active ports: ac =3D ocelot_read_rix(ocelot, ANA_PGID_PGID, i); ac &=3D ~bond_mask; <---- here /* Don't do division by zero if there was no active * port. Just make all aggregation codes zero. */ if (num_active_ports) ac |=3D BIT(aggr_idx[i % num_active_ports]); ocelot_write_rix(ocelot, ac, ANA_PGID_PGID, i); So it becomes the responsibility of ocelot_set_aggr_pgids() to take ocelot_port->lag_tx_active into consideration when populating the aggr_idx array. Fixes: 23ca3b727ee6 ("net: mscc: ocelot: rebalance LAGs on link up/down eve= nts") Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220107164332.402133-1-vladimir.oltean@nxp= .com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mscc/ocelot.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc= /ocelot.c index 1e4ad953cffbc..d1e883666951c 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1688,8 +1688,7 @@ int ocelot_get_ts_info(struct ocelot *ocelot, int por= t, } EXPORT_SYMBOL(ocelot_get_ts_info); =20 -static u32 ocelot_get_bond_mask(struct ocelot *ocelot, struct net_device *= bond, - bool only_active_ports) +static u32 ocelot_get_bond_mask(struct ocelot *ocelot, struct net_device *= bond) { u32 mask =3D 0; int port; @@ -1700,12 +1699,8 @@ static u32 ocelot_get_bond_mask(struct ocelot *ocelo= t, struct net_device *bond, if (!ocelot_port) continue; =20 - if (ocelot_port->bond =3D=3D bond) { - if (only_active_ports && !ocelot_port->lag_tx_active) - continue; - + if (ocelot_port->bond =3D=3D bond) mask |=3D BIT(port); - } } =20 return mask; @@ -1792,10 +1787,8 @@ void ocelot_apply_bridge_fwd_mask(struct ocelot *oce= lot) mask =3D ocelot_get_bridge_fwd_mask(ocelot, port, bridge); mask |=3D cpu_fwd_mask; mask &=3D ~BIT(port); - if (bond) { - mask &=3D ~ocelot_get_bond_mask(ocelot, bond, - false); - } + if (bond) + mask &=3D ~ocelot_get_bond_mask(ocelot, bond); } else { /* Standalone ports forward only to DSA tag_8021q CPU * ports (if those exist), or to the hardware CPU port @@ -2112,13 +2105,17 @@ static void ocelot_set_aggr_pgids(struct ocelot *oc= elot) if (!bond || (visited & BIT(lag))) continue; =20 - bond_mask =3D ocelot_get_bond_mask(ocelot, bond, true); + bond_mask =3D ocelot_get_bond_mask(ocelot, bond); =20 for_each_set_bit(port, &bond_mask, ocelot->num_phys_ports) { + struct ocelot_port *ocelot_port =3D ocelot->ports[port]; + // Destination mask ocelot_write_rix(ocelot, bond_mask, ANA_PGID_PGID, port); - aggr_idx[num_active_ports++] =3D port; + + if (ocelot_port->lag_tx_active) + aggr_idx[num_active_ports++] =3D port; } =20 for_each_aggr_pgid(ocelot, i) { @@ -2167,8 +2164,7 @@ static void ocelot_setup_logical_port_ids(struct ocel= ot *ocelot) =20 bond =3D ocelot_port->bond; if (bond) { - int lag =3D __ffs(ocelot_get_bond_mask(ocelot, bond, - false)); + int lag =3D __ffs(ocelot_get_bond_mask(ocelot, bond)); =20 ocelot_rmw_gix(ocelot, ANA_PORT_PORT_CFG_PORTID_VAL(lag), --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F94DC41535 for ; Mon, 24 Jan 2022 23:47:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362354AbiAXXmO (ORCPT ); Mon, 24 Jan 2022 18:42:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843316AbiAXXDs (ORCPT ); Mon, 24 Jan 2022 18:03:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C51E6C06C59D; Mon, 24 Jan 2022 13:14:32 -0800 (PST) Received: from smtp.kernel.org (relay.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 64C7861484; Mon, 24 Jan 2022 21:14:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 420A9C340E5; Mon, 24 Jan 2022 21:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058871; bh=3Dr0Y8JmlRteCgNv3ytXBhi/7TFoA+6ATQj4UbNYrkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p6yNJxHah0eXO/Hw0w8R34Gf8JgZcYi+i29fNfZaXF6dULUkRYQLiFutOtGrj9V9s e4CbmkvD1GGYIjr/p4gEqtSO3BMc5p+QwYctKuMzv1QQN67714/qAQe/+O2K1Mpl5n KLcgH9tUiZsg7ycC+c90N0+h8lsrVWP0PcfyeR3s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sunil Goutham , Subbaraya Sundeep , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0429/1039] octeontx2-af: Fix interrupt name strings Date: Mon, 24 Jan 2022 19:36:58 +0100 Message-Id: <20220124184139.716698050@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sunil Goutham [ Upstream commit 6dc9a23e29061e50c36523270de60039ccf536fa ] Fixed interrupt name string logic which currently results in wrong memory location being accessed while dumping /proc/interrupts. Fixes: 4826090719d4 ("octeontx2-af: Enable CPT HW interrupts") Signed-off-by: Sunil Goutham Signed-off-by: Subbaraya Sundeep Link: https://lore.kernel.org/r/1641538505-28367-1-git-send-email-sbhatta@m= arvell.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c | 5 ++--- drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c b/drivers/= net/ethernet/marvell/octeontx2/af/rvu_cpt.c index 45357deecabbf..a73a8017e0ee9 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c @@ -172,14 +172,13 @@ static int cpt_10k_register_interrupts(struct rvu_blo= ck *block, int off) { struct rvu *rvu =3D block->rvu; int blkaddr =3D block->addr; - char irq_name[16]; int i, ret; =20 for (i =3D CPT_10K_AF_INT_VEC_FLT0; i < CPT_10K_AF_INT_VEC_RVU; i++) { - snprintf(irq_name, sizeof(irq_name), "CPTAF FLT%d", i); + sprintf(&rvu->irq_name[(off + i) * NAME_SIZE], "CPTAF FLT%d", i); ret =3D rvu_cpt_do_register_interrupt(block, off + i, rvu_cpt_af_flt_intr_handler, - irq_name); + &rvu->irq_name[(off + i) * NAME_SIZE]); if (ret) goto err; rvu_write64(rvu, blkaddr, CPT_AF_FLTX_INT_ENA_W1S(i), 0x1); diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c b/driv= ers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c index 70bacd38a6d9d..d0ab8f233a029 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c @@ -41,7 +41,7 @@ static bool rvu_common_request_irq(struct rvu *rvu, int o= ffset, struct rvu_devlink *rvu_dl =3D rvu->rvu_dl; int rc; =20 - sprintf(&rvu->irq_name[offset * NAME_SIZE], name); + sprintf(&rvu->irq_name[offset * NAME_SIZE], "%s", name); rc =3D request_irq(pci_irq_vector(rvu->pdev, offset), fn, 0, &rvu->irq_name[offset * NAME_SIZE], rvu_dl); if (rc) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABCEAC433EF for ; Mon, 24 Jan 2022 23:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362406AbiAXXmV (ORCPT ); Mon, 24 Jan 2022 18:42:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843345AbiAXXDv (ORCPT ); Mon, 24 Jan 2022 18:03:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9D05C06C5A1; Mon, 24 Jan 2022 13:14:35 -0800 (PST) Received: from smtp.kernel.org (relay.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 778BE61471; Mon, 24 Jan 2022 21:14:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E01AC340E5; Mon, 24 Jan 2022 21:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058874; bh=6Pwq7Qmz+CXAMR/zefiggxTOBO3q2PQ/Mc2rClt1aTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SXRj0KwkBcPLDB07F+/cHb8ObWH1WybNTmNzhiQ0EiYsorcZg7A2bhiDGkz9ZMhNr 24HUW4teBFPDuo3JnTvbIMNV1ofSeGxZBORHw5KJbhVojf8d9S3lvvHFPmgNv3hwAl LQQ/cz521HrWGeRKaEy9MVrZ2uPZIX0pupCb0EsM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.16 0430/1039] can: mcp251xfd: add missing newline to printed strings Date: Mon, 24 Jan 2022 19:36:59 +0100 Message-Id: <20220124184139.748366175@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 3bd9d8ce6f8c5c43ee2f1106021db0f98882cc75 ] This patch adds the missing newline to printed strings. Fixes: 55e5b97f003e ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SP= I CAN") Link: https://lore.kernel.org/all/20220105154300.1258636-4-mkl@pengutronix.= de Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/c= an/spi/mcp251xfd/mcp251xfd-core.c index e16dc482f3270..63613c186f173 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c @@ -2625,7 +2625,7 @@ static int mcp251xfd_register_chip_detect(struct mcp2= 51xfd_priv *priv) if (!mcp251xfd_is_251X(priv) && priv->devtype_data.model !=3D devtype_data->model) { netdev_info(ndev, - "Detected %s, but firmware specifies a %s. Fixing up.", + "Detected %s, but firmware specifies a %s. Fixing up.\n", __mcp251xfd_get_model_str(devtype_data->model), mcp251xfd_get_model_str(priv)); } @@ -2662,7 +2662,7 @@ static int mcp251xfd_register_check_rx_int(struct mcp= 251xfd_priv *priv) return 0; =20 netdev_info(priv->ndev, - "RX_INT active after softreset, disabling RX_INT support."); + "RX_INT active after softreset, disabling RX_INT support.\n"); devm_gpiod_put(&priv->spi->dev, priv->rx_int); priv->rx_int =3D NULL; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38216C433F5 for ; Mon, 24 Jan 2022 23:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362461AbiAXXmY (ORCPT ); Mon, 24 Jan 2022 18:42:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843433AbiAXXD7 (ORCPT ); Mon, 24 Jan 2022 18:03:59 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 769C6C06C5A4; Mon, 24 Jan 2022 13:14:40 -0800 (PST) Received: from smtp.kernel.org (relay.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 3CF78B8121C; Mon, 24 Jan 2022 21:14:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6518CC340E5; Mon, 24 Jan 2022 21:14:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058878; bh=utsPrtpcWIvwCt9tvxNIxDq0GM9C7hpc0Yc/H/vxqiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MWduGN4Dc050MjBTzh77M8ffK9Ce4Ed9BnlVamcHRkPV6QKJH32/Rfuo1rSEo3mpH y3nYGq/m7TxxXc3E1F2xD9SjZkLu6TbAgolx4x84JIRXjiyinrhWKsYn2hzGwgum2B el1d2BQGRUNZr8a6Hqk9vyrKTd1Td9LxTR2GA9Wc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Jun , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 5.16 0431/1039] tpm: add request_locality before write TPM_INT_ENABLE Date: Mon, 24 Jan 2022 19:37:00 +0100 Message-Id: <20220124184139.779125359@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Jun [ Upstream commit 0ef333f5ba7f24f5d8478425c163d3097f1c7afd ] Locality is not appropriately requested before writing the int mask. Add the missing boilerplate. Fixes: e6aef069b6e9 ("tpm_tis: convert to using locality callbacks") Signed-off-by: Chen Jun Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/char/tpm/tpm_tis_core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_cor= e.c index b2659a4c40168..e2df1098a812f 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -994,7 +994,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_t= is_data *priv, int irq, intmask |=3D TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; intmask &=3D ~TPM_GLOBAL_INT_ENABLE; + + rc =3D request_locality(chip, 0); + if (rc < 0) { + rc =3D -ENODEV; + goto out_err; + } + tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); + release_locality(chip, 0); =20 rc =3D tpm_chip_start(chip); if (rc) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FC06C433FE for ; Mon, 24 Jan 2022 23:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2363084AbiAXXne (ORCPT ); Mon, 24 Jan 2022 18:43:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843459AbiAXXEC (ORCPT ); Mon, 24 Jan 2022 18:04:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8783FC06C5A6; Mon, 24 Jan 2022 13:14:43 -0800 (PST) Received: from smtp.kernel.org (relay.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 46146B8121C; Mon, 24 Jan 2022 21:14:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BE0CC340E5; Mon, 24 Jan 2022 21:14:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058881; bh=zspjBTPA65ubtgbkRw3QgH1nHju9jZUDsFEcbrEiT9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wKxCYiu/sW1KCV/IabqVm12byNDu2BqnH9DlSe3FMJ7Udxlo3SDIJO9Izmj1fKdhQ z6E4kTj+IhDSUjYo3Huz4Lt7PuVFQ4XYacHuqL2QSdQEeMTs37XZW3Av1yg4TtDcNL UJ+KEUDEz/5R8Q1AwIYYwVt5pP0Gy8C9C5dZf2Bc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Jaillet , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 5.16 0432/1039] tpm_tis: Fix an error handling path in tpm_tis_core_init() Date: Mon, 24 Jan 2022 19:37:01 +0100 Message-Id: <20220124184139.814606762@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 e96d52822f5ac0a25de78f95cd23421bcbc93584 ] Commit 79ca6f74dae0 ("tpm: fix Atmel TPM crash caused by too frequent queries") has moved some code around without updating the error handling path. This is now pointless to 'goto out_err' when neither 'clk_enable()' nor 'ioremap()' have been called yet. Make a direct return instead to avoid undoing things that have not been done. Fixes: 79ca6f74dae0 ("tpm: fix Atmel TPM crash caused by too frequent queri= es") Signed-off-by: Christophe Jaillet Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/char/tpm/tpm_tis_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_cor= e.c index e2df1098a812f..36d1ad8f479d7 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -952,7 +952,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_ti= s_data *priv, int irq, =20 rc =3D tpm_tis_read32(priv, TPM_DID_VID(0), &vendor); if (rc < 0) - goto out_err; + return rc; =20 priv->manufacturer_id =3D vendor; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0A73C433EF for ; Mon, 24 Jan 2022 23:47:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2363046AbiAXXn2 (ORCPT ); Mon, 24 Jan 2022 18:43:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843469AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90D3BC06C5AA; Mon, 24 Jan 2022 13:14:46 -0800 (PST) Received: from smtp.kernel.org (relay.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 56FF7B80FA1; Mon, 24 Jan 2022 21:14:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 879D5C340E5; Mon, 24 Jan 2022 21:14:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058884; bh=7V5Ot7QNLcDZm4yJ2eB2b0JK2T1MnQt23O8DU7JiMiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DrtyfKMROIGmvy9jk4Fh2nO4hGzSTpPPcpwVQ34jPUf/9xO6G/+6gm7rADH+ZZd/V meH0SbzZPWiKIFDgbpYRKweGM7Z3F4ks3FfwiN3hm6pLq1DxsyPN2FIbW9qrYwzhfB iswKBch5rAcJiZtheCPzbSiGA4zQeuPIjjw+faoc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kurt Van Dijck , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.16 0433/1039] can: softing: softing_startstop(): fix set but not used variable warning Date: Mon, 24 Jan 2022 19:37:02 +0100 Message-Id: <20220124184139.845331795@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 370d988cc529598ebaec6487d4f84c2115dc696b ] In the function softing_startstop() the variable error_reporting is assigned but not used. The code that uses this variable is commented out. Its stated that the functionality is not finally verified. To fix the warning: | drivers/net/can/softing/softing_fw.c:424:9: error: variable 'error_report= ing' set but not used [-Werror,-Wunused-but-set-variable] remove the comment, activate the code, but add a "0 &&" to the if expression and rely on the optimizer rather than the preprocessor to remove the code. Link: https://lore.kernel.org/all/20220109103126.1872833-1-mkl@pengutronix.= de Fixes: 03fd3cf5a179 ("can: add driver for Softing card") Cc: Kurt Van Dijck Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/can/softing/softing_fw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/softing/softing_fw.c b/drivers/net/can/softing= /softing_fw.c index 7e15368779931..32286f861a195 100644 --- a/drivers/net/can/softing/softing_fw.c +++ b/drivers/net/can/softing/softing_fw.c @@ -565,18 +565,19 @@ int softing_startstop(struct net_device *dev, int up) if (ret < 0) goto failed; } - /* enable_error_frame */ - /* + + /* enable_error_frame + * * Error reporting is switched off at the moment since * the receiving of them is not yet 100% verified * This should be enabled sooner or later - * - if (error_reporting) { + */ + if (0 && error_reporting) { ret =3D softing_fct_cmd(card, 51, "enable_error_frame"); if (ret < 0) goto failed; } - */ + /* initialize interface */ iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]); iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08B8EC46467 for ; Mon, 24 Jan 2022 22:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581176AbiAXWLV (ORCPT ); Mon, 24 Jan 2022 17:11:21 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37956 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449092AbiAXVOx (ORCPT ); Mon, 24 Jan 2022 16:14:53 -0500 Received: from smtp.kernel.org (relay.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 B879A6148C; Mon, 24 Jan 2022 21:14:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B11FC340E5; Mon, 24 Jan 2022 21:14:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058890; bh=+JaUykpnnx79VM58DA0Rf4NkTtZca3z8xnJ8tFJjt9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kGriY2EruQgDsVFHpKh2FGyU+/yLaQlImyLHgFKFGSKXzJ5k3AZoWdY0k9gW8NJJW 1R/Nkt3N9VRXcsOhW3m4dfuq1Ehke10fVUyJkCBZtlVumm5nuZWs8J8Ph28qr/BF61 N9TLUD3javKwddh7bsGLZZG7rhDVuxhYBc2E+6xE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.16 0434/1039] can: xilinx_can: xcan_probe(): check for error irq Date: Mon, 24 Jan 2022 19:37:03 +0100 Message-Id: <20220124184139.890185367@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit c6564c13dae25cd7f8e1de5127b4da4500ee5844 ] For the possible failure of the platform_get_irq(), the returned irq could be error number and will finally cause the failure of the request_irq(). Consider that platform_get_irq() can now in certain cases return -EPROBE_DEFER, and the consequences of letting request_irq() effectively convert that into -EINVAL, even at probe time rather than later on. So it might be better to check just now. Fixes: b1201e44f50b ("can: xilinx CAN controller support") Link: https://lore.kernel.org/all/20211224021324.1447494-1-jiasheng@iscas.a= c.cn Signed-off-by: Jiasheng Jiang Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/can/xilinx_can.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index e2b15d29d15eb..af4a2adc85983 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -1761,7 +1761,12 @@ static int xcan_probe(struct platform_device *pdev) spin_lock_init(&priv->tx_lock); =20 /* Get IRQ for the device */ - ndev->irq =3D platform_get_irq(pdev, 0); + ret =3D platform_get_irq(pdev, 0); + if (ret < 0) + goto err_free; + + ndev->irq =3D ret; + ndev->flags |=3D IFF_ECHO; /* We support local echo */ =20 platform_set_drvdata(pdev, ndev); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CF8BC4332F for ; Mon, 24 Jan 2022 23:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362963AbiAXXnO (ORCPT ); Mon, 24 Jan 2022 18:43:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843478AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1CDCC061A7C; Mon, 24 Jan 2022 13:14:55 -0800 (PST) Received: from smtp.kernel.org (relay.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 5EB7CB811FB; Mon, 24 Jan 2022 21:14:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89FC5C340E5; Mon, 24 Jan 2022 21:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058893; bh=14/r+hbS3Go8S3OHeRGpUygNx3H7+e9c8m+YWqIr+MA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QpxPhhaj+AbaTHGnTkM0/ARnXPAZMGZr3kMiKpGSBAdLJtNM+khj0gS8fS3U9AIei uS5QP+BOU1JkXajajtC+DvXMu2Tqf5dTyzR4DL6qTszOuJ4R313pi4XEg37wgCNLJc 1Vj5xN77RURn6gkGaQNPcbKOAjqSRXmKxuGR2RS0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , Lad Prabhakar , Kieran Bingham , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.16 0435/1039] can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device Date: Mon, 24 Jan 2022 19:37:04 +0100 Message-Id: <20220124184139.921784434@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 72b1e360572f9fa7d08ee554f1da29abce23f288 ] Make sure we free CAN network device in the error path. There are several jumps to fail label after allocating the CAN network device successfully. This patch places the free_candev() under fail label so that in failure path a jump to fail label frees the CAN network device. Fixes: 76e9353a80e9 ("can: rcar_canfd: Add support for RZ/G2L family") Link: https://lore.kernel.org/all/20220106114801.20563-1-prabhakar.mahadev-= lad.rj@bp.renesas.com Reported-by: Pavel Machek Signed-off-by: Lad Prabhakar Reviewed-by: Kieran Bingham Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/can/rcar/rcar_canfd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_= canfd.c index ff9d0f5ae0dd2..388521e70837f 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -1640,8 +1640,7 @@ static int rcar_canfd_channel_probe(struct rcar_canfd= _global *gpriv, u32 ch, ndev =3D alloc_candev(sizeof(*priv), RCANFD_FIFO_DEPTH); if (!ndev) { dev_err(&pdev->dev, "alloc_candev() failed\n"); - err =3D -ENOMEM; - goto fail; + return -ENOMEM; } priv =3D netdev_priv(ndev); =20 @@ -1735,8 +1734,8 @@ static int rcar_canfd_channel_probe(struct rcar_canfd= _global *gpriv, u32 ch, =20 fail_candev: netif_napi_del(&priv->napi); - free_candev(ndev); fail: + free_candev(ndev); return err; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42478C433EF for ; Mon, 24 Jan 2022 22:08:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380084AbiAXWIM (ORCPT ); Mon, 24 Jan 2022 17:08:12 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38026 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449126AbiAXVO5 (ORCPT ); Mon, 24 Jan 2022 16:14:57 -0500 Received: from smtp.kernel.org (relay.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 D539061320; Mon, 24 Jan 2022 21:14:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B3B3C340E5; Mon, 24 Jan 2022 21:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058896; bh=g6pSpn2i0X05d9/e/pvWbJQ995pdOEPCyDaWB64n2Dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A8TfzFupAeMFv+oOIcOMkIgwCyIAZtoxIxpTUMh3Q9UZLkupdfvTAh9MqnJz/Wrvf gisa2/zIcZLd0V3XN8r/K2sfEY0ZKQy3uk/VeMVCl98xpvLLngAfpGLb4kF91mVsGP 992ygy/t9dnIQKygJgcsxWy//EFpUZ7Xz9tAFScI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , "Matthew Wilcox (Oracle)" , Dominik Brodowski , Sasha Levin Subject: [PATCH 5.16 0436/1039] pcmcia: fix setting of kthread task states Date: Mon, 24 Jan 2022 19:37:05 +0100 Message-Id: <20220124184139.955395323@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dominik Brodowski [ Upstream commit fbb3485f1f931102d8ba606f1c28123f5b48afa3 ] We need to set TASK_INTERRUPTIBLE before calling kthread_should_stop(). Otherwise, kthread_stop() might see that the pccardd thread is still in TASK_RUNNING state and fail to wake it up. Additionally, we only need to set the state back to TASK_RUNNING if kthread_should_stop() breaks the loop. Cc: Greg Kroah-Hartman Reported-by: Al Viro Reviewed-by: Matthew Wilcox (Oracle) Fixes: d3046ba809ce ("pcmcia: fix a boot time warning in pcmcia cs code") Signed-off-by: Dominik Brodowski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pcmcia/cs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index e211e2619680c..f70197154a362 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -666,18 +666,16 @@ static int pccardd(void *__skt) if (events || sysfs_events) continue; =20 + set_current_state(TASK_INTERRUPTIBLE); if (kthread_should_stop()) break; =20 - set_current_state(TASK_INTERRUPTIBLE); - schedule(); =20 - /* make sure we are running */ - __set_current_state(TASK_RUNNING); - try_to_freeze(); } + /* make sure we are running before we exit */ + __set_current_state(TASK_RUNNING); =20 /* shut down socket, if a device is still present */ if (skt->state & SOCKET_PRESENT) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7565C41535 for ; Mon, 24 Jan 2022 22:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581010AbiAXWLH (ORCPT ); Mon, 24 Jan 2022 17:11:07 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34150 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449188AbiAXVPI (ORCPT ); Mon, 24 Jan 2022 16:15:08 -0500 Received: from smtp.kernel.org (relay.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 6D33BB81142; Mon, 24 Jan 2022 21:15:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93C72C340E5; Mon, 24 Jan 2022 21:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058899; bh=sSDFp/4Isibgx+viCawhWzXdWhERJeA4CwQLf+j1haA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MmxxWRaBLW1EP7oynW0cNk2ETT9/es42GK4g9MWY3xj96QIr4g6prRS8JlKCushyr BXGD/Q8FwRccdQDM3tJ2EmezlWE0+txwL4XgACb3auCah5jL9TsuKbAzzY+OzGAvqU hb84dVtCuukFnlmxB00Uq1Y3THvec//5KBPka3v8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.16 0437/1039] netfilter: egress: avoid a lockdep splat Date: Mon, 24 Jan 2022 19:37:06 +0100 Message-Id: <20220124184139.986966049@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 6316136ec6e3dd1c302f7e7289a9ee46ecc610ae ] include/linux/netfilter_netdev.h:97 suspicious rcu_dereference_check() usag= e! 2 locks held by sd-resolve/1100: 0: ..(rcu_read_lock_bh){1:3}, at: ip_finish_output2 1: ..(rcu_read_lock_bh){1:3}, at: __dev_queue_xmit __dev_queue_xmit+0 .. The helper has two callers, one uses rcu_read_lock, the other rcu_read_lock_bh(). Annotate the dereference to reflect this. Fixes: 42df6e1d221dd ("netfilter: Introduce egress hook") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/linux/netfilter_netdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/netfilter_netdev.h b/include/linux/netfilter_net= dev.h index b71b57a83bb4f..b4dd96e4dc8dc 100644 --- a/include/linux/netfilter_netdev.h +++ b/include/linux/netfilter_netdev.h @@ -94,7 +94,7 @@ static inline struct sk_buff *nf_hook_egress(struct sk_bu= ff *skb, int *rc, return skb; #endif =20 - e =3D rcu_dereference(dev->nf_hooks_egress); + e =3D rcu_dereference_check(dev->nf_hooks_egress, rcu_read_lock_bh_held()= ); if (!e) return skb; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F0ECC43217 for ; Mon, 24 Jan 2022 23:47:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2363020AbiAXXnW (ORCPT ); Mon, 24 Jan 2022 18:43:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843483AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0714EC061A7D; Mon, 24 Jan 2022 13:15:03 -0800 (PST) Received: from smtp.kernel.org (relay.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 995CB61484; Mon, 24 Jan 2022 21:15:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E609C340E5; Mon, 24 Jan 2022 21:15:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058902; bh=NoDvo/YxdOUEGYfupMkbOcp1Kt4K78zDsvMM0GHU8sQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bqJJ6NRAYw/o4+4TBKEzuP54M07BHVA4GKBGFQVGmpyqDJs4jEt976ICmD9z6XbSd ye/67VpIiMkxqRYvOJ557wEEJtu8f9XHCV+28RrsT3Iz+BxHkPdxUV3nIXNKgB3W3d PYnAgR/mMFFm4z8siU5sqj6GecywtOuQfSHquCYY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Blakey , Jamal Hadi Salim , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0438/1039] net: openvswitch: Fix ct_state nat flags for conns arriving from tc Date: Mon, 24 Jan 2022 19:37:07 +0100 Message-Id: <20220124184140.017948811@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Blakey [ Upstream commit 6f022c2ddbcefaee79502ce5386dfe351d457070 ] Netfilter conntrack maintains NAT flags per connection indicating whether NAT was configured for the connection. Openvswitch maintains NAT flags on the per packet flow key ct_state field, indicating whether NAT was actually executed on the packet. When a packet misses from tc to ovs the conntrack NAT flags are set. However, NAT was not necessarily executed on the packet because the connection's state might still be in NEW state. As such, openvswitch wrongly assumes that NAT was executed and sets an incorrect flow key NAT flags. Fix this, by flagging to openvswitch which NAT was actually done in act_ct via tc_skb_ext and tc_skb_cb to the openvswitch module, so the packet flow key NAT flags will be correctly set. Fixes: b57dc7c13ea9 ("net/sched: Introduce action ct") Signed-off-by: Paul Blakey Acked-by: Jamal Hadi Salim Link: https://lore.kernel.org/r/20220106153804.26451-1-paulb@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/linux/skbuff.h | 4 +++- include/net/pkt_sched.h | 4 +++- net/openvswitch/flow.c | 16 +++++++++++++--- net/sched/act_ct.c | 6 ++++++ net/sched/cls_api.c | 2 ++ 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 4507d77d6941f..60ab0c2fe5674 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -287,7 +287,9 @@ struct tc_skb_ext { __u32 chain; __u16 mru; __u16 zone; - bool post_ct; + u8 post_ct:1; + u8 post_ct_snat:1; + u8 post_ct_dnat:1; }; #endif =20 diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 9e71691c491b7..9e7b21c0b3a6d 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -197,7 +197,9 @@ struct tc_skb_cb { struct qdisc_skb_cb qdisc_cb; =20 u16 mru; - bool post_ct; + u8 post_ct:1; + u8 post_ct_snat:1; + u8 post_ct_dnat:1; u16 zone; /* Only valid if post_ct =3D true */ }; =20 diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 6d262d9aa10ea..02096f2ec6784 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c @@ -859,7 +859,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *t= un_info, #if IS_ENABLED(CONFIG_NET_TC_SKB_EXT) struct tc_skb_ext *tc_ext; #endif - bool post_ct =3D false; + bool post_ct =3D false, post_ct_snat =3D false, post_ct_dnat =3D false; int res, err; u16 zone =3D 0; =20 @@ -900,6 +900,8 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *t= un_info, key->recirc_id =3D tc_ext ? tc_ext->chain : 0; OVS_CB(skb)->mru =3D tc_ext ? tc_ext->mru : 0; post_ct =3D tc_ext ? tc_ext->post_ct : false; + post_ct_snat =3D post_ct ? tc_ext->post_ct_snat : false; + post_ct_dnat =3D post_ct ? tc_ext->post_ct_dnat : false; zone =3D post_ct ? tc_ext->zone : 0; } else { key->recirc_id =3D 0; @@ -911,8 +913,16 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *= tun_info, err =3D key_extract(skb, key); if (!err) { ovs_ct_fill_key(skb, key, post_ct); /* Must be after key_extract(). */ - if (post_ct && !skb_get_nfct(skb)) - key->ct_zone =3D zone; + if (post_ct) { + if (!skb_get_nfct(skb)) { + key->ct_zone =3D zone; + } else { + if (!post_ct_dnat) + key->ct_state &=3D ~OVS_CS_F_DST_NAT; + if (!post_ct_snat) + key->ct_state &=3D ~OVS_CS_F_SRC_NAT; + } + } } return err; } diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index ab3591408419f..2a17eb77c9049 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -839,6 +839,12 @@ static int ct_nat_execute(struct sk_buff *skb, struct = nf_conn *ct, } =20 err =3D nf_nat_packet(ct, ctinfo, hooknum, skb); + if (err =3D=3D NF_ACCEPT) { + if (maniptype =3D=3D NF_NAT_MANIP_SRC) + tc_skb_cb(skb)->post_ct_snat =3D 1; + if (maniptype =3D=3D NF_NAT_MANIP_DST) + tc_skb_cb(skb)->post_ct_dnat =3D 1; + } out: return err; } diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 35c74bdde848e..cc9409aa755eb 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -1625,6 +1625,8 @@ int tcf_classify(struct sk_buff *skb, ext->chain =3D last_executed_chain; ext->mru =3D cb->mru; ext->post_ct =3D cb->post_ct; + ext->post_ct_snat =3D cb->post_ct_snat; + ext->post_ct_dnat =3D cb->post_ct_dnat; ext->zone =3D cb->zone; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 295D4C433EF for ; Mon, 24 Jan 2022 21:57:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575417AbiAXVvj (ORCPT ); Mon, 24 Jan 2022 16:51:39 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:35534 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449879AbiAXVRQ (ORCPT ); Mon, 24 Jan 2022 16:17:16 -0500 Received: from smtp.kernel.org (relay.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 77314B81142; Mon, 24 Jan 2022 21:17:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3F77C340E5; Mon, 24 Jan 2022 21:17:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059030; bh=Rx5RxhbS8kMvSzbQfANI2qKyuJIM3o5KzFcelYuNImg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MydZCj4gYiqyFxf0SfUAxph4H9lDWY2N/IGYJ8UiS/S8IF02tlcOBXQnua07mapr7 CQKPv49FcwVcmfDYEgGl40cCZlYrLuo992FKitQdHlpgRjj5cq61TY+APZcvI50Yw/ pu6rDf5IJrVsP6E+IQXf8teEhHAOpsOnfKly4ujE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0439/1039] iwlwifi: mvm: Use div_s64 instead of do_div in iwl_mvm_ftm_rtt_smoothing() Date: Mon, 24 Jan 2022 19:37:08 +0100 Message-Id: <20220124184140.050838206@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Nathan Chancellor [ Upstream commit 4ccdcc8ffd955490feec05380223db6a48961eb5 ] When building ARCH=3Darm allmodconfig: drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c: In function =E2=80= =98iwl_mvm_ftm_rtt_smoothing=E2=80=99: ./include/asm-generic/div64.h:222:35: error: comparison of distinct pointer= types lacks a cast [-Werror] 222 | (void)(((typeof((n)) *)0) =3D=3D ((uint64_t *)0)); \ | ^~ drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:1070:9: note: in exp= ansion of macro =E2=80=98do_div=E2=80=99 1070 | do_div(rtt_avg, 100); | ^~~~~~ do_div() has to be used with an unsigned 64-bit integer dividend but rtt_avg is a signed 64-bit integer. div_s64() expects a signed 64-bit integer dividend and signed 32-bit divisor, which fits this scenario, so use that function here to fix the warning. Fixes: 8b0f92549f2c ("iwlwifi: mvm: fix 32-bit build in FTM") Signed-off-by: Nathan Chancellor Link: https://lore.kernel.org/r/20211227191757.2354329-1-nathan@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drive= rs/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c index 9449d1af3c11a..628aee634b2ad 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c @@ -1066,8 +1066,7 @@ static void iwl_mvm_ftm_rtt_smoothing(struct iwl_mvm = *mvm, overshoot =3D IWL_MVM_FTM_INITIATOR_SMOOTH_OVERSHOOT; alpha =3D IWL_MVM_FTM_INITIATOR_SMOOTH_ALPHA; =20 - rtt_avg =3D alpha * rtt + (100 - alpha) * resp->rtt_avg; - do_div(rtt_avg, 100); + rtt_avg =3D div_s64(alpha * rtt + (100 - alpha) * resp->rtt_avg, 100); =20 IWL_DEBUG_INFO(mvm, "%pM: prev rtt_avg=3D%lld, new rtt_avg=3D%lld, rtt=3D%lld\n", --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22228C433F5 for ; Mon, 24 Jan 2022 22:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577520AbiAXWAZ (ORCPT ); Mon, 24 Jan 2022 17:00:25 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38478 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449358AbiAXVP3 (ORCPT ); Mon, 24 Jan 2022 16:15:29 -0500 Received: from smtp.kernel.org (relay.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 5A0D96148F; Mon, 24 Jan 2022 21:15:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F1AEC340E4; Mon, 24 Jan 2022 21:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058926; bh=MLNAbOa1lCHdxJ+UNfUyao4m/T1WwTpsj8tHSXjqPBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QxtBznQIEH0rqBnGvBypqAJeSCMLX5gMR7tp6dJ0z1OTc18VqT0yRGps1/ObsqKq3 etZFXmduSCtMGPsaCuvW+JSIULccOhGv+Amk86y42154W755T9Emufwr/7xiGZ3Ig4 4sILO2jiOC3yYYMPaYGRdlO9Hdm0ly4A6kItOiKQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Edwin Peer , Michael Chan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0440/1039] bnxt_en: use firmware provided max timeout for messages Date: Mon, 24 Jan 2022 19:37:09 +0100 Message-Id: <20220124184140.083005088@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Edwin Peer [ Upstream commit bce9a0b7900836df223ab638090df0cb8430d9e8 ] Some older devices cannot accommodate the 40 seconds timeout cap for long running commands (such as NVRAM commands) due to hardware limitations. Allow these devices to request more time for these long running commands, but print a warning, since the longer timeout may cause the hung task watchdog to trigger. In the case of a firmware update operation, this is preferable to failing outright. v2: Use bp->hwrm_cmd_max_timeout directly without the constants. Fixes: 881d8353b05e ("bnxt_en: Add an upper bound for all firmware command = timeouts.") Signed-off-by: Edwin Peer Signed-off-by: Michael Chan Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 ++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 3 ++- drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c | 4 ++-- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 9 +++------ drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h | 3 +-- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethern= et/broadcom/bnxt/bnxt.c index c04ea83188e22..7eaf74e5b2929 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -8008,6 +8008,12 @@ static int bnxt_hwrm_ver_get(struct bnxt *bp) bp->hwrm_cmd_timeout =3D le16_to_cpu(resp->def_req_timeout); if (!bp->hwrm_cmd_timeout) bp->hwrm_cmd_timeout =3D DFLT_HWRM_CMD_TIMEOUT; + bp->hwrm_cmd_max_timeout =3D le16_to_cpu(resp->max_req_timeout) * 1000; + if (!bp->hwrm_cmd_max_timeout) + bp->hwrm_cmd_max_timeout =3D HWRM_CMD_MAX_TIMEOUT; + else if (bp->hwrm_cmd_max_timeout > HWRM_CMD_MAX_TIMEOUT) + netdev_warn(bp->dev, "Device requests max timeout of %d seconds, may tri= gger hung task watchdog\n", + bp->hwrm_cmd_max_timeout / 1000); =20 if (resp->hwrm_intf_maj_8b >=3D 1) { bp->hwrm_max_req_len =3D le16_to_cpu(resp->max_req_win_len); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethern= et/broadcom/bnxt/bnxt.h index 4c9507d82fd0d..6bacd5fae6ba5 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1985,7 +1985,8 @@ struct bnxt { =20 u16 hwrm_max_req_len; u16 hwrm_max_ext_req_len; - int hwrm_cmd_timeout; + unsigned int hwrm_cmd_timeout; + unsigned int hwrm_cmd_max_timeout; struct mutex hwrm_cmd_lock; /* serialize hwrm messages */ struct hwrm_ver_get_output ver_resp; #define FW_VER_STR_LEN 32 diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c b/drivers/n= et/ethernet/broadcom/bnxt/bnxt_coredump.c index d3cb2f21946da..c067898820360 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c @@ -32,7 +32,7 @@ static int bnxt_hwrm_dbg_dma_data(struct bnxt *bp, void *= msg, return -ENOMEM; } =20 - hwrm_req_timeout(bp, msg, HWRM_COREDUMP_TIMEOUT); + hwrm_req_timeout(bp, msg, bp->hwrm_cmd_max_timeout); cmn_resp =3D hwrm_req_hold(bp, msg); resp =3D cmn_resp; =20 @@ -125,7 +125,7 @@ static int bnxt_hwrm_dbg_coredump_initiate(struct bnxt = *bp, u16 component_id, if (rc) return rc; =20 - hwrm_req_timeout(bp, req, HWRM_COREDUMP_TIMEOUT); + hwrm_req_timeout(bp, req, bp->hwrm_cmd_max_timeout); req->component_id =3D cpu_to_le16(component_id); req->segment_id =3D cpu_to_le16(segment_id); =20 diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/ne= t/ethernet/broadcom/bnxt/bnxt_ethtool.c index 8188d55722e4b..7307df49c1313 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -31,9 +31,6 @@ #include "bnxt_nvm_defs.h" /* NVRAM content constant and structure defs */ #include "bnxt_fw_hdr.h" /* Firmware hdr constant and structure defs */ #include "bnxt_coredump.h" -#define FLASH_NVRAM_TIMEOUT ((HWRM_CMD_TIMEOUT) * 100) -#define FLASH_PACKAGE_TIMEOUT ((HWRM_CMD_TIMEOUT) * 200) -#define INSTALL_PACKAGE_TIMEOUT ((HWRM_CMD_TIMEOUT) * 200) =20 static u32 bnxt_get_msglevel(struct net_device *dev) { @@ -2169,7 +2166,7 @@ static int bnxt_flash_nvram(struct net_device *dev, u= 16 dir_type, req->host_src_addr =3D cpu_to_le64(dma_handle); } =20 - hwrm_req_timeout(bp, req, FLASH_NVRAM_TIMEOUT); + hwrm_req_timeout(bp, req, bp->hwrm_cmd_max_timeout); req->dir_type =3D cpu_to_le16(dir_type); req->dir_ordinal =3D cpu_to_le16(dir_ordinal); req->dir_ext =3D cpu_to_le16(dir_ext); @@ -2515,8 +2512,8 @@ int bnxt_flash_package_from_fw_obj(struct net_device = *dev, const struct firmware return rc; } =20 - hwrm_req_timeout(bp, modify, FLASH_PACKAGE_TIMEOUT); - hwrm_req_timeout(bp, install, INSTALL_PACKAGE_TIMEOUT); + hwrm_req_timeout(bp, modify, bp->hwrm_cmd_max_timeout); + hwrm_req_timeout(bp, install, bp->hwrm_cmd_max_timeout); =20 hwrm_req_hold(bp, modify); modify->host_src_addr =3D cpu_to_le64(dma_handle); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c b/drivers/net/e= thernet/broadcom/bnxt/bnxt_hwrm.c index bb7327b82d0b2..8171f4912fa01 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c @@ -496,7 +496,7 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwr= m_ctx *ctx) } =20 /* Limit timeout to an upper limit */ - timeout =3D min_t(uint, ctx->timeout, HWRM_CMD_MAX_TIMEOUT); + timeout =3D min(ctx->timeout, bp->hwrm_cmd_max_timeout ?: HWRM_CMD_MAX_TI= MEOUT); /* convert timeout to usec */ timeout *=3D 1000; =20 diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h b/drivers/net/e= thernet/broadcom/bnxt/bnxt_hwrm.h index 4d17f0d5363bb..9a9fc4e8041b6 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h @@ -58,11 +58,10 @@ void hwrm_update_token(struct bnxt *bp, u16 seq, enum b= nxt_hwrm_wait_state s); =20 #define BNXT_HWRM_MAX_REQ_LEN (bp->hwrm_max_req_len) #define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input) -#define HWRM_CMD_MAX_TIMEOUT 40000 +#define HWRM_CMD_MAX_TIMEOUT 40000U #define SHORT_HWRM_CMD_TIMEOUT 20 #define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout) #define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4) -#define HWRM_COREDUMP_TIMEOUT ((HWRM_CMD_TIMEOUT) * 12) #define BNXT_HWRM_TARGET 0xffff #define BNXT_HWRM_NO_CMPL_RING -1 #define BNXT_HWRM_REQ_MAX_SIZE 128 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49444C433F5 for ; Mon, 24 Jan 2022 23:55:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365742AbiAXXvj (ORCPT ); Mon, 24 Jan 2022 18:51:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843492AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E073C06C5B8; Mon, 24 Jan 2022 13:16:03 -0800 (PST) Received: from smtp.kernel.org (relay.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 14CDAB80CCF; Mon, 24 Jan 2022 21:16:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36B99C340E4; Mon, 24 Jan 2022 21:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058960; bh=+FIhuV+QFoMc3kFprresSPzAW2LFZqusS4F4IERQ6gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yqjFp+OdE9pcMwpzpoZub27eyFdXsQSeVAlr7s5LL/yK+n+JPgrW5pEQpNV7O/goE BDAf1t25i0ZPxTsZKHieUU/GpxApXhFos8S5MTqV+U0RsO8iAAebbn3I3mdZOwG4Nq P92s2UeonxeQBP9oONhbD2bvAXQ1rAnb/yKG7tvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Arnd Bergmann , Jakub Kicinski , Sasha Levin , syzbot+003c0a286b9af5412510@syzkaller.appspotmail.com Subject: [PATCH 5.16 0441/1039] net: mcs7830: handle usb read errors properly Date: Mon, 24 Jan 2022 19:37:10 +0100 Message-Id: <20220124184140.120501193@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 d668769eb9c52b150753f1653f7f5a0aeb8239d2 ] Syzbot reported uninit value in mcs7830_bind(). The problem was in missing validation check for bytes read via usbnet_read_cmd(). usbnet_read_cmd() internally calls usb_control_msg(), that returns number of bytes read. Code should validate that requested number of bytes was actually read. So, this patch adds missing size validation check inside mcs7830_get_reg() to prevent uninit value bugs Reported-and-tested-by: syzbot+003c0a286b9af5412510@syzkaller.appspotmail.c= om Fixes: 2a36d7083438 ("USB: driver for mcs7830 (aka DeLOCK) USB ethernet ada= pter") Signed-off-by: Pavel Skripkin Reviewed-by: Arnd Bergmann Link: https://lore.kernel.org/r/20220106225716.7425-1-paskripkin@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/usb/mcs7830.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c index 326cc4e749d80..fdda0616704ea 100644 --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c @@ -108,8 +108,16 @@ static const char driver_name[] =3D "MOSCHIP usb-ether= net driver"; =20 static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *= data) { - return usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, - 0x0000, index, data, size); + int ret; + + ret =3D usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, + 0x0000, index, data, size); + if (ret < 0) + return ret; + else if (ret < size) + return -ENODATA; + + return ret; } =20 static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, const = void *data) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58D51C35270 for ; Mon, 24 Jan 2022 23:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362586AbiAXXmk (ORCPT ); Mon, 24 Jan 2022 18:42:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843730AbiAXXFi (ORCPT ); Mon, 24 Jan 2022 18:05:38 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E035CC02B77E; Mon, 24 Jan 2022 13:16:35 -0800 (PST) Received: from smtp.kernel.org (relay.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 8836BB811A2; Mon, 24 Jan 2022 21:16:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E02CBC340E4; Mon, 24 Jan 2022 21:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058994; bh=n+2oQiECCDibeXeXVuzVRofAl5ID7Qq6aThu6u/Ccas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hpw+kscnvqiOeTJkcSs9J7R+i1V9wUtYgJpfxldzVuzxDH3GCyCmQymvwSRvljLgZ ciBM576y4y7wAEe1ITg9NIot4FLUKTXHbYM2sgNPKVIOB/NpTUgR6kM0YGKNbtKnya cVXWgvYagraN4iYiR7B8+sm7A5wmbN/J0bBcz5U0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Taehee Yoo , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0442/1039] amt: fix wrong return type of amt_send_membership_update() Date: Mon, 24 Jan 2022 19:37:11 +0100 Message-Id: <20220124184140.152117560@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Taehee Yoo [ Upstream commit dd3ca4c5184ea98e40acb8eb293d85b88ea04ee2 ] amt_send_membership_update() would return -1 but it's return type is bool. So, it should be used TRUE instead of -1. Fixes: cbc21dc1cfe9 ("amt: add data plane of amt interface") Reported-by: kernel test robot Signed-off-by: Taehee Yoo Link: https://lore.kernel.org/r/20220109163702.6331-1-ap420073@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/amt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/amt.c b/drivers/net/amt.c index b732ee9a50ef9..d3a9dda6c7286 100644 --- a/drivers/net/amt.c +++ b/drivers/net/amt.c @@ -1106,7 +1106,7 @@ static bool amt_send_membership_query(struct amt_dev = *amt, rt =3D ip_route_output_key(amt->net, &fl4); if (IS_ERR(rt)) { netdev_dbg(amt->dev, "no route to %pI4\n", &tunnel->ip4); - return -1; + return true; } =20 amtmq =3D skb_push(skb, sizeof(*amtmq)); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BF52C433F5 for ; Mon, 24 Jan 2022 21:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575367AbiAXVvd (ORCPT ); Mon, 24 Jan 2022 16:51:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:39808 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376998AbiAXVQw (ORCPT ); Mon, 24 Jan 2022 16:16:52 -0500 Received: from smtp.kernel.org (relay.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 7A911614BB; Mon, 24 Jan 2022 21:16:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AC3CC36AE3; Mon, 24 Jan 2022 21:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059011; bh=PhEMH2TmR9SH/HlCq8r5xzc38BxxMHpemwszlBVQ4WY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M+mQOG4+xrnbK4TJSdwdCGOxTMCq6yNHqZFrCGAQ0A/obHf/P5MbgNR7cyV/9OzgI ObZlCDjsMqIZWmFsONBCr91HopG5keOuOfRKQeuwe1YZ68LDbOBhfeA68NfYp0fswl wxCUNcQzC8Az6M06KyRlW2y1B6ciPdcvSpvvqP0A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Czerner , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.16 0443/1039] ext4: avoid trim error on fs with small groups Date: Mon, 24 Jan 2022 19:37:12 +0100 Message-Id: <20220124184140.185237193@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit 173b6e383d2a204c9921ffc1eca3b87aa2106c33 ] A user reported FITRIM ioctl failing for him on ext4 on some devices without apparent reason. After some debugging we've found out that these devices (being LVM volumes) report rather large discard granularity of 42MB and the filesystem had 1k blocksize and thus group size of 8MB. Because ext4 FITRIM implementation puts discard granularity into minlen, ext4_trim_fs() declared the trim request as invalid. However just silently doing nothing seems to be a more appropriate reaction to such combination of parameters since user did not specify anything wrong. CC: Lukas Czerner Fixes: 5c2ed62fd447 ("ext4: Adjust minlen with discard_granularity in the F= ITRIM ioctl") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20211112152202.26614-1-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/ioctl.c | 2 -- fs/ext4/mballoc.c | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 606dee9e08a32..220a4c8178b5e 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -1117,8 +1117,6 @@ resizefs_out: sizeof(range))) return -EFAULT; =20 - range.minlen =3D max((unsigned int)range.minlen, - q->limits.discard_granularity); ret =3D ext4_trim_fs(sb, &range); if (ret < 0) return ret; diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 215b7068f548a..9af83b6242ddf 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -6404,6 +6404,7 @@ ext4_trim_all_free(struct super_block *sb, ext4_group= _t group, */ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) { + struct request_queue *q =3D bdev_get_queue(sb->s_bdev); struct ext4_group_info *grp; ext4_group_t group, first_group, last_group; ext4_grpblk_t cnt =3D 0, first_cluster, last_cluster; @@ -6422,6 +6423,13 @@ int ext4_trim_fs(struct super_block *sb, struct fstr= im_range *range) start >=3D max_blks || range->len < sb->s_blocksize) return -EINVAL; + /* No point to try to trim less than discard granularity */ + if (range->minlen < q->limits.discard_granularity) { + minlen =3D EXT4_NUM_B2C(EXT4_SB(sb), + q->limits.discard_granularity >> sb->s_blocksize_bits); + if (minlen > EXT4_CLUSTERS_PER_GROUP(sb)) + goto out; + } if (end >=3D max_blks) end =3D max_blks - 1; if (end <=3D first_data_blk) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 146DFC4707A for ; Mon, 24 Jan 2022 21:58:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355011AbiAXV54 (ORCPT ); Mon, 24 Jan 2022 16:57:56 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:36596 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377051AbiAXVQ7 (ORCPT ); Mon, 24 Jan 2022 16:16:59 -0500 Received: from smtp.kernel.org (relay.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 4992BB8122A; Mon, 24 Jan 2022 21:16:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72DB6C340E5; Mon, 24 Jan 2022 21:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059015; bh=35bdOZwEX15/CDl0eOhUKLqgXQk8j5PQ12jCuwyOO2I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dA4PRiW/DSxMKVKaRh7HCQF6/MPhJtB0LT3C9sIPedbG1JM0ct5Q41d8mI4Y6jRmU lBvsba1nehzw3hAeb2lJLkZdJidFHBF2mwASTlvvu09ligVhrcDoKVOCb8HrRJfSrX dL/1Sm7ZfQdJMt3PsUn61peKdH9qY0BdIIpSWCS4= 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.16 0444/1039] ASoC: Intel: sof_sdw: fix jack detection on HP Spectre x360 convertible Date: Mon, 24 Jan 2022 19:37:13 +0100 Message-Id: <20220124184140.216493992@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 0527b19fa4f390a6054612e1fa1dd4f8efc96739 ] Tests on device show the JD2 mode does not work at all, the 'Headphone Jack' and 'Headset Mic Jack' are shown as 'on' always. JD1 seems to be the better option, with at least a change between the two cases. Jack not plugged-in: [root@fedora ~]# amixer -Dhw:0 cget numid=3D12 numid=3D12,iface=3DCARD,name=3D'Headphone Jack' ; type=3DBOOLEAN,access=3Dr-------,values=3D1 : values=3Doff [root@fedora ~]# amixer -Dhw:0 cget numid=3D13 numid=3D13,iface=3DCARD,name=3D'Headset Mic Jack' ; type=3DBOOLEAN,access=3Dr-------,values=3D1 : values=3Doff Jack plugged-in: [root@fedora ~]# amixer -Dhw:0 cget numid=3D13 numid=3D13,iface=3DCARD,name=3D'Headset Mic Jack' ; type=3DBOOLEAN,access=3Dr-------,values=3D1 : values=3Don [root@fedora ~]# amixer -Dhw:0 cget numid=3D13 numid=3D13,iface=3DCARD,name=3D'Headset Mic Jack' ; type=3DBOOLEAN,access=3Dr-------,values=3D1 : values=3Don The 'Headset Mic Jack' is updated with a delay which seems normal with additional calibration needed. Fixes: d92e279dee56 ('ASoC: Intel: sof_sdw: add quirk for HP Spectre x360 c= onvertible') Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao Link: https://lore.kernel.org/r/20211027021824.24776-3-yung-chuan.liao@linu= x.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/intel/boards/sof_sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_= sdw.c index 77219c3f8766c..54eefaff62a7e 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -188,7 +188,7 @@ static const struct dmi_system_id sof_sdw_quirk_table[]= =3D { }, .driver_data =3D (void *)(SOF_SDW_TGL_HDMI | SOF_SDW_PCH_DMIC | - RT711_JD2), + RT711_JD1), }, { /* NUC15 'Bishop County' LAPBC510 and LAPBC710 skews */ --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C2E7C43217 for ; Mon, 24 Jan 2022 23:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365649AbiAXXv0 (ORCPT ); Mon, 24 Jan 2022 18:51:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383930AbiAXXGH (ORCPT ); Mon, 24 Jan 2022 18:06:07 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D0BDC061A7F; Mon, 24 Jan 2022 13:17:00 -0800 (PST) Received: from smtp.kernel.org (relay.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 39E61B81233; Mon, 24 Jan 2022 21:16:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C29CC36AEB; Mon, 24 Jan 2022 21:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059018; bh=fLy9g1Dn9MLU9x6rBqmMs6F2pQoFUyKdCOxJNNtpLe0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=064UNFFXX07h4wih0LBtYG0dkbBkG56HW8i8jgCQVkXExmrhpFzpMKP90zyRf3Nis k6UvIcFW4NNn65nk8jfNdb5ftXddsWah52b49iD8SaOF+i/xMdsyfFyc9hWFY/DU68 /DGAYXvUo3qMH2qGB9ZNS7FOY7kaZreDh+efmZN0= 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.16 0445/1039] ALSA: jack: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:37:14 +0100 Message-Id: <20220124184140.255356036@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 06764dc931848c3a9bc01a63bbf76a605408bb54 ] snd_ctl_remove() has to be called with card->controls_rwsem held (when called after the card instantiation). This patch add the missing rwsem calls around it. Fixes: 9058cbe1eed2 ("ALSA: jack: implement kctl creating for jack devices") Link: https://lore.kernel.org/r/20211116071314.15065-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/core/jack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/core/jack.c b/sound/core/jack.c index 537df1e98f8ac..d1e3055f2b6a5 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -62,10 +62,13 @@ static int snd_jack_dev_free(struct snd_device *device) struct snd_card *card =3D device->card; struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl; =20 + down_write(&card->controls_rwsem); list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list= ) { list_del_init(&jack_kctl->list); snd_ctl_remove(card, jack_kctl->kctl); } + up_write(&card->controls_rwsem); + if (jack->private_free) jack->private_free(jack); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C43F9C43219 for ; Mon, 24 Jan 2022 21:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577043AbiAXV5L (ORCPT ); Mon, 24 Jan 2022 16:57:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:36656 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352253AbiAXVRD (ORCPT ); Mon, 24 Jan 2022 16:17:03 -0500 Received: from smtp.kernel.org (relay.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 5DF3BB815A5; Mon, 24 Jan 2022 21:17:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70213C340E4; Mon, 24 Jan 2022 21:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059021; bh=60cLQvpCN4PqXns9qUE1a06rKf2YK4MYdVLXKQLv6t8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j+303UXeKzKcmf9PLyl3KHe7WEMzD/vI1w04RF+NiA0MwzsS1VthJgpL6yxyRyOzg INc460S0jAptTkfqxrbmnMrUQn81H9tzQIqku2k3Fcl5j6nNWjA+RfLgmaXI5JCgCC d9uN/wEKeYRmzuaxi/98FOGs6jzQZsutmEKyVBn4= 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.16 0446/1039] ALSA: PCM: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:37:15 +0100 Message-Id: <20220124184140.286801713@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 5471e9762e1af4b7df057a96bfd46cc250979b88 ] snd_ctl_remove() has to be called with card->controls_rwsem held (when called after the card instantiation). This patch add the missing rwsem calls around it. Fixes: a8ff48cb7083 ("ALSA: pcm: Free chmap at PCM free callback, too") Link: https://lore.kernel.org/r/20211116071314.15065-2-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/core/pcm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 6fd3677685d70..ba4a987ed1c62 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -810,7 +810,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal); static void free_chmap(struct snd_pcm_str *pstr) { if (pstr->chmap_kctl) { - snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl); + struct snd_card *card =3D pstr->pcm->card; + + down_write(&card->controls_rwsem); + snd_ctl_remove(card, pstr->chmap_kctl); + up_write(&card->controls_rwsem); pstr->chmap_kctl =3D NULL; } } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35C6BC4332F for ; Mon, 24 Jan 2022 23:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362826AbiAXXnA (ORCPT ); Mon, 24 Jan 2022 18:43:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384506AbiAXXGH (ORCPT ); Mon, 24 Jan 2022 18:06:07 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3E47C06E024; Mon, 24 Jan 2022 13:17:06 -0800 (PST) Received: from smtp.kernel.org (relay.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 6D03DB8123D; Mon, 24 Jan 2022 21:17:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D179C340E4; Mon, 24 Jan 2022 21:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059024; bh=Md4ZH5I6rM15jQTYj4f4nWYyhIsKhAhF5qdEF3guwUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0QPQ+HQ3bccwKNlGRUIKmtbiTD1ZE8YR46oYI23rCFheNt7LqO7F+z1dNhWvQVyCX hB33m7KOJya/s2WaTiUbWU6Y9uMkiEa/TXZEMQAQTnFhi4nVWzDgroJ2GCMWyeaTjN UqcE+3zoU6veVM4clqdt3dgHMnrT4arLioYoVSyg= 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.16 0447/1039] ALSA: hda: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:37:16 +0100 Message-Id: <20220124184140.318641098@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 80bd64af75b4bb11c0329bc66c35da2ddfb66d88 ] snd_ctl_remove() has to be called with card->controls_rwsem held (when called after the card instantiation). This patch add the missing rwsem calls around it. Fixes: d13bd412dce2 ("ALSA: hda - Manage kcontrol lists") Link: https://lore.kernel.org/r/20211116071314.15065-3-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/pci/hda/hda_codec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 0c4a337c9fc0d..eda70814369bd 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1727,8 +1727,11 @@ void snd_hda_ctls_clear(struct hda_codec *codec) { int i; struct hda_nid_item *items =3D codec->mixers.list; + + down_write(&codec->card->controls_rwsem); for (i =3D 0; i < codec->mixers.used; i++) snd_ctl_remove(codec->card, items[i].kctl); + up_write(&codec->card->controls_rwsem); snd_array_free(&codec->mixers); snd_array_free(&codec->nids); } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F981C433F5 for ; Mon, 24 Jan 2022 21:58:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576916AbiAXV4o (ORCPT ); Mon, 24 Jan 2022 16:56:44 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40302 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449841AbiAXVRL (ORCPT ); Mon, 24 Jan 2022 16:17:11 -0500 Received: from smtp.kernel.org (relay.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 E24B861490; Mon, 24 Jan 2022 21:17:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A84AAC340E5; Mon, 24 Jan 2022 21:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059027; bh=cDHcC41BeRDzRH5xuHhn9uCJHlJzt0RBPzFkknz6tko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m9guJUhWsNYGU7xOi3NNd+vSomI9I0wNqZVw7lHkbB1DynVzelN6w+yNNtmuFZumh WGq8HzqxGlm0zsft8NEwZ4Wlq+jezjVuAoCHilHeRwOWVHPYuC6m8ZM5VyXxAfEpk1 AQbEbcIapnllkiPD0NrugGXmEiHFG/WtbBKJPyoI= 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.16 0448/1039] ALSA: hda: Fix potential deadlock at codec unbinding Date: Mon, 24 Jan 2022 19:37:17 +0100 Message-Id: <20220124184140.351719161@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 7206998f578d5553989bc01ea2e544b622e79539 ] When a codec is unbound dynamically via sysfs while its stream is in use, we may face a potential deadlock at the proc remove or a UAF. This happens since the hda_pcm is managed by a linked list, as it handles the hda_pcm object release via kref. When a PCM is opened at the unbinding time, the release of hda_pcm gets delayed and it ends up with the close of the PCM stream releasing the associated hda_pcm object of its own. The hda_pcm destructor contains the PCM device release that includes the removal of procfs entries. And, this removal has the sync of the close of all in-use files -- which would never finish because it's called from the PCM file descriptor itself, i.e. it's trying to shoot its foot. For addressing the deadlock above, this patch changes the way to manage and release the hda_pcm object. The kref of hda_pcm is dropped, and instead a simple refcount is introduced in hda_codec for keeping the track of the active PCM streams, and at each PCM open and close, this refcount is adjusted accordingly. At unbinding, the driver calls snd_device_disconnect() for each PCM stream, then synchronizes with the refcount finish, and finally releases the object resources. Fixes: bbbc7e8502c9 ("ALSA: hda - Allocate hda_pcm objects dynamically") Link: https://lore.kernel.org/r/20211116072459.18930-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/sound/hda_codec.h | 8 +++++--- sound/pci/hda/hda_bind.c | 5 +++++ sound/pci/hda/hda_codec.c | 42 ++++++++++++++++++++++++--------------- sound/pci/hda/hda_local.h | 1 + 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h index 0e45963bb767f..82d9daa178517 100644 --- a/include/sound/hda_codec.h +++ b/include/sound/hda_codec.h @@ -8,7 +8,7 @@ #ifndef __SOUND_HDA_CODEC_H #define __SOUND_HDA_CODEC_H =20 -#include +#include #include #include #include @@ -166,8 +166,8 @@ struct hda_pcm { bool own_chmap; /* codec driver provides own channel maps */ /* private: */ struct hda_codec *codec; - struct kref kref; struct list_head list; + unsigned int disconnected:1; }; =20 /* codec information */ @@ -187,6 +187,8 @@ struct hda_codec { =20 /* PCM to create, set by patch_ops.build_pcms callback */ struct list_head pcm_list_head; + refcount_t pcm_ref; + wait_queue_head_t remove_sleep; =20 /* codec specific info */ void *spec; @@ -420,7 +422,7 @@ void snd_hda_codec_cleanup_for_unbind(struct hda_codec = *codec); =20 static inline void snd_hda_codec_pcm_get(struct hda_pcm *pcm) { - kref_get(&pcm->kref); + refcount_inc(&pcm->codec->pcm_ref); } void snd_hda_codec_pcm_put(struct hda_pcm *pcm); =20 diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c index 1c8bffc3eec6e..7153bd53e1893 100644 --- a/sound/pci/hda/hda_bind.c +++ b/sound/pci/hda/hda_bind.c @@ -156,6 +156,11 @@ static int hda_codec_driver_remove(struct device *dev) return codec->bus->core.ext_ops->hdev_detach(&codec->core); } =20 + refcount_dec(&codec->pcm_ref); + snd_hda_codec_disconnect_pcms(codec); + wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref)); + snd_power_sync_ref(codec->bus->card); + if (codec->patch_ops.free) codec->patch_ops.free(codec); snd_hda_codec_cleanup_for_unbind(codec); diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index eda70814369bd..7016b48227bf2 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -703,20 +703,10 @@ get_hda_cvt_setup(struct hda_codec *codec, hda_nid_t = nid) /* * PCM device */ -static void release_pcm(struct kref *kref) -{ - struct hda_pcm *pcm =3D container_of(kref, struct hda_pcm, kref); - - if (pcm->pcm) - snd_device_free(pcm->codec->card, pcm->pcm); - clear_bit(pcm->device, pcm->codec->bus->pcm_dev_bits); - kfree(pcm->name); - kfree(pcm); -} - void snd_hda_codec_pcm_put(struct hda_pcm *pcm) { - kref_put(&pcm->kref, release_pcm); + if (refcount_dec_and_test(&pcm->codec->pcm_ref)) + wake_up(&pcm->codec->remove_sleep); } EXPORT_SYMBOL_GPL(snd_hda_codec_pcm_put); =20 @@ -731,7 +721,6 @@ struct hda_pcm *snd_hda_codec_pcm_new(struct hda_codec = *codec, return NULL; =20 pcm->codec =3D codec; - kref_init(&pcm->kref); va_start(args, fmt); pcm->name =3D kvasprintf(GFP_KERNEL, fmt, args); va_end(args); @@ -741,6 +730,7 @@ struct hda_pcm *snd_hda_codec_pcm_new(struct hda_codec = *codec, } =20 list_add_tail(&pcm->list, &codec->pcm_list_head); + refcount_inc(&codec->pcm_ref); return pcm; } EXPORT_SYMBOL_GPL(snd_hda_codec_pcm_new); @@ -748,15 +738,31 @@ EXPORT_SYMBOL_GPL(snd_hda_codec_pcm_new); /* * codec destructor */ +void snd_hda_codec_disconnect_pcms(struct hda_codec *codec) +{ + struct hda_pcm *pcm; + + list_for_each_entry(pcm, &codec->pcm_list_head, list) { + if (pcm->disconnected) + continue; + if (pcm->pcm) + snd_device_disconnect(codec->card, pcm->pcm); + snd_hda_codec_pcm_put(pcm); + pcm->disconnected =3D 1; + } +} + static void codec_release_pcms(struct hda_codec *codec) { struct hda_pcm *pcm, *n; =20 list_for_each_entry_safe(pcm, n, &codec->pcm_list_head, list) { - list_del_init(&pcm->list); + list_del(&pcm->list); if (pcm->pcm) - snd_device_disconnect(codec->card, pcm->pcm); - snd_hda_codec_pcm_put(pcm); + snd_device_free(pcm->codec->card, pcm->pcm); + clear_bit(pcm->device, pcm->codec->bus->pcm_dev_bits); + kfree(pcm->name); + kfree(pcm); } } =20 @@ -769,6 +775,7 @@ void snd_hda_codec_cleanup_for_unbind(struct hda_codec = *codec) codec->registered =3D 0; } =20 + snd_hda_codec_disconnect_pcms(codec); cancel_delayed_work_sync(&codec->jackpoll_work); if (!codec->in_freeing) snd_hda_ctls_clear(codec); @@ -792,6 +799,7 @@ void snd_hda_codec_cleanup_for_unbind(struct hda_codec = *codec) remove_conn_list(codec); snd_hdac_regmap_exit(&codec->core); codec->configured =3D 0; + refcount_set(&codec->pcm_ref, 1); /* reset refcount */ } EXPORT_SYMBOL_GPL(snd_hda_codec_cleanup_for_unbind); =20 @@ -958,6 +966,8 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struc= t snd_card *card, 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); =20 INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); codec->depop_delay =3D -1; diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index d22c96eb2f8fb..8621f576446b8 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -137,6 +137,7 @@ int __snd_hda_add_vmaster(struct hda_codec *codec, char= *name, int snd_hda_codec_reset(struct hda_codec *codec); void snd_hda_codec_register(struct hda_codec *codec); void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec); +void snd_hda_codec_disconnect_pcms(struct hda_codec *codec); =20 #define snd_hda_regmap_sync(codec) snd_hdac_regmap_sync(&(codec)->core) =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C359C35271 for ; Mon, 24 Jan 2022 23:48:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362978AbiAXXnR (ORCPT ); Mon, 24 Jan 2022 18:43:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843480AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB2AFC06C5B0; Mon, 24 Jan 2022 13:15:30 -0800 (PST) Received: from smtp.kernel.org (relay.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 6AFDD61484; Mon, 24 Jan 2022 21:15:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5018DC340E4; Mon, 24 Jan 2022 21:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058929; bh=yetuTulqugrN0YKtx8LCtsv1oE7YkFAYIodyAMLxwTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sCR8AzOZoKqHAsJsZClvPablykaoFU2mowffV1f/up3kMrhKnoq28jSoqPEUvMQV2 PaXT6xl0de0iZAxu0LU3OJUaFYgIvv+cE1AuUdd9spCTu/r7W7rwfHStOxoVik+cQ/ tP4vCIGqZluXRPr2hLqMf1HgohrE45ynezyrvg8U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Selvin Xavier , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.16 0449/1039] RDMA/bnxt_re: Scan the whole bitmap when checking if "disabling RCFW with pending cmd-bit" Date: Mon, 24 Jan 2022 19:37:18 +0100 Message-Id: <20220124184140.389611874@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 a917dfb66c0a1fa1caacf3d71edcafcab48e6ff0 ] The 'cmdq->cmdq_bitmap' bitmap is 'rcfw->cmdq_depth' bits long. The size stored in 'cmdq->bmap_size' is the size of the bitmap in bytes. Remove this erroneous 'bmap_size' and use 'rcfw->cmdq_depth' directly in 'bnxt_qplib_disable_rcfw_channel()'. Otherwise some error messages may be missing. Other uses of 'cmdq_bitmap' already take into account 'rcfw->cmdq_depth' directly. Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver") Link: https://lore.kernel.org/r/47ed717c3070a1d0f53e7b4c768a4fd11caf365d.16= 36707421.git.christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET Acked-by: Selvin Xavier Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 6 ++---- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniban= d/hw/bnxt_re/qplib_rcfw.c index 3de854727460e..19a0778d38a2d 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c @@ -618,8 +618,6 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res= *res, if (!cmdq->cmdq_bitmap) goto fail; =20 - cmdq->bmap_size =3D bmap_size; - /* Allocate one extra to hold the QP1 entries */ rcfw->qp_tbl_size =3D qp_tbl_sz + 1; rcfw->qp_tbl =3D kcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_n= ode), @@ -667,8 +665,8 @@ void bnxt_qplib_disable_rcfw_channel(struct bnxt_qplib_= rcfw *rcfw) iounmap(cmdq->cmdq_mbox.reg.bar_reg); iounmap(creq->creq_db.reg.bar_reg); =20 - indx =3D find_first_bit(cmdq->cmdq_bitmap, cmdq->bmap_size); - if (indx !=3D cmdq->bmap_size) + indx =3D find_first_bit(cmdq->cmdq_bitmap, rcfw->cmdq_depth); + if (indx !=3D rcfw->cmdq_depth) dev_err(&rcfw->pdev->dev, "disabling RCFW with pending cmd-bit %lx\n", indx); =20 diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h b/drivers/infiniban= d/hw/bnxt_re/qplib_rcfw.h index 82faa4e4cda84..0a3d8e7da3d42 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h @@ -152,7 +152,6 @@ struct bnxt_qplib_cmdq_ctx { wait_queue_head_t waitq; unsigned long flags; unsigned long *cmdq_bitmap; - u32 bmap_size; u32 seq_num; }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E789C433FE for ; Mon, 24 Jan 2022 21:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575106AbiAXVvC (ORCPT ); Mon, 24 Jan 2022 16:51:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38556 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449430AbiAXVPe (ORCPT ); Mon, 24 Jan 2022 16:15:34 -0500 Received: from smtp.kernel.org (relay.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 9B57A61425; Mon, 24 Jan 2022 21:15:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 620D0C340E4; Mon, 24 Jan 2022 21:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058933; bh=LQqVUSu1kkMBojTaP0fomJ/poZ8XZ9pus7ucI9OB5X4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zi39S5m2cQmLfiRRHAxn3iAVwFaiJIXnRxHWwF3Lm9e/7qo+ukzNm1ExSGKt7DidL wqet9t1JQutt6osp3f9rw7biwthZa7MzlSUkxtKKPnGGhJwIhJR7I0K2roFjffIHzQ mr40cHgqg8UP7k6184Fu5CzywMGc3aRCz6Av0qCE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kamal Heib , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.16 0450/1039] RDMA/hns: Validate the pkey index Date: Mon, 24 Jan 2022 19:37:19 +0100 Message-Id: <20220124184140.421187760@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kamal Heib [ Upstream commit 2a67fcfa0db6b4075515bd23497750849b88850f ] Before query pkey, make sure that the queried index is valid. Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver") Link: https://lore.kernel.org/r/20211117145954.123893-1-kamalheib1@gmail.com Signed-off-by: Kamal Heib Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/infiniband/hw/hns/hns_roce_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband= /hw/hns/hns_roce_main.c index 4194b626f3c65..8233bec053ee3 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -270,6 +270,9 @@ static enum rdma_link_layer hns_roce_get_link_layer(str= uct ib_device *device, static int hns_roce_query_pkey(struct ib_device *ib_dev, u32 port, u16 ind= ex, u16 *pkey) { + if (index > 0) + return -EINVAL; + *pkey =3D PKEY_ID; =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8667C4332F for ; Mon, 24 Jan 2022 23:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362996AbiAXXnU (ORCPT ); Mon, 24 Jan 2022 18:43:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843473AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D6AEC06C5B3; Mon, 24 Jan 2022 13:15:37 -0800 (PST) Received: from smtp.kernel.org (relay.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 B0F6261484; Mon, 24 Jan 2022 21:15:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B6B2C340E4; Mon, 24 Jan 2022 21:15:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058936; bh=XiEZal2TU1ajBjFbZzAocbQPIe4D4ZjRyO1MiTh+6rw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vCqRP5jkIoFVAM1p5P2Q5fcjHFQIindRnGr1pDIZ9lp3o9BGAekVa67iFadg7xva8 r/qnHzHl6Nz+N9ykD+ji/QnFlfGa1iOHSzqa05RyxM/ttzk5JKK8Pyi3hn8RWn+rfp mbyiEAVkYnuBjw0HnX0LVDZvI7whc8fHqvuFTAGs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vishakha Channapattan , Jack Wang , Igor Pylypiv , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 0451/1039] scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd() Date: Mon, 24 Jan 2022 19:37:20 +0100 Message-Id: <20220124184140.452294711@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Igor Pylypiv [ Upstream commit 606c54ae975ad3af540b505b46b55a687501711f ] Starting from commit 05c6c029a44d ("scsi: pm80xx: Increase number of supported queues") driver initializes only max_q_num queues. Do not use an invalid queue if the WARN_ON condition is true. Link: https://lore.kernel.org/r/20211101232825.2350233-4-ipylypiv@google.com Fixes: 7640e1eb8c5d ("scsi: pm80xx: Make mpi_build_cmd locking consistent") Reviewed-by: Vishakha Channapattan Acked-by: Jack Wang Signed-off-by: Igor Pylypiv Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/pm8001/pm8001_hwi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_= hwi.c index 124cb69740c67..4390c8b9170cd 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -1325,7 +1325,9 @@ int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm80= 01_ha, int q_index =3D circularQ - pm8001_ha->inbnd_q_tbl; int rv; =20 - WARN_ON(q_index >=3D PM8001_MAX_INB_NUM); + if (WARN_ON(q_index >=3D pm8001_ha->max_q_num)) + return -EINVAL; + spin_lock_irqsave(&circularQ->iq_lock, flags); rv =3D pm8001_mpi_msg_free_get(circularQ, pm8001_ha->iomb_size, &pMessage); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24C7AC433EF for ; Mon, 24 Jan 2022 23:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362939AbiAXXnN (ORCPT ); Mon, 24 Jan 2022 18:43:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843482AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DCDAC06C5B4; Mon, 24 Jan 2022 13:15:40 -0800 (PST) Received: from smtp.kernel.org (relay.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 A1E7A614AA; Mon, 24 Jan 2022 21:15:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EF55C340E9; Mon, 24 Jan 2022 21:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058939; bh=A0N4YdBGt5+tY/dPPMqDq1dg+euWxHCa2Fb1Nmu3dQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1nPt+nu61vquKL9TMV/TOKXPApSkpASNIvvb83J3zOVbm/clYYevKejPf/lknpPbL Yy9K1Gh2y8Mu0Q4go2dAVxbwgA+EGSHcZHZAhhrynosnSdfVvPsxX/oth/2j/JYKSN NIhkBmXPjiafz56pC5gV08cv672W4BZt0Fjxvejc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lad Prabhakar , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.16 0452/1039] clk: renesas: rzg2l: Check return value of pm_genpd_init() Date: Mon, 24 Jan 2022 19:37:21 +0100 Message-Id: <20220124184140.490570059@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 27527a3d3b162e4512798c058c0e8a216c721187 ] Make sure we check the return value of pm_genpd_init() which might fail. Also add a devres action to remove the power-domain in-case the probe callback fails further down in the code flow. Fixes: ef3c613ccd68a ("clk: renesas: Add CPG core wrapper for RZ/G2L SoC") Signed-off-by: Lad Prabhakar Link: https://lore.kernel.org/r/20211117115101.28281-2-prabhakar.mahadev-la= d.rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/clk/renesas/rzg2l-cpg.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cp= g.c index 4021f6cabda4b..4f04ff57d468a 100644 --- a/drivers/clk/renesas/rzg2l-cpg.c +++ b/drivers/clk/renesas/rzg2l-cpg.c @@ -850,10 +850,16 @@ static void rzg2l_cpg_detach_dev(struct generic_pm_do= main *unused, struct device pm_clk_destroy(dev); } =20 +static void rzg2l_cpg_genpd_remove(void *data) +{ + pm_genpd_remove(data); +} + static int __init rzg2l_cpg_add_clk_domain(struct device *dev) { struct device_node *np =3D dev->of_node; struct generic_pm_domain *genpd; + int ret; =20 genpd =3D devm_kzalloc(dev, sizeof(*genpd), GFP_KERNEL); if (!genpd) @@ -864,7 +870,13 @@ static int __init rzg2l_cpg_add_clk_domain(struct devi= ce *dev) GENPD_FLAG_ACTIVE_WAKEUP; genpd->attach_dev =3D rzg2l_cpg_attach_dev; genpd->detach_dev =3D rzg2l_cpg_detach_dev; - pm_genpd_init(genpd, &pm_domain_always_on_gov, false); + ret =3D pm_genpd_init(genpd, &pm_domain_always_on_gov, false); + if (ret) + return ret; + + ret =3D devm_add_action_or_reset(dev, rzg2l_cpg_genpd_remove, genpd); + if (ret) + return ret; =20 of_genpd_add_provider_simple(np, genpd); return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 768D4C4167D for ; Mon, 24 Jan 2022 21:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575148AbiAXVvF (ORCPT ); Mon, 24 Jan 2022 16:51:05 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:35796 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449526AbiAXVPp (ORCPT ); Mon, 24 Jan 2022 16:15:45 -0500 Received: from smtp.kernel.org (relay.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 88CAEB80FA1; Mon, 24 Jan 2022 21:15:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEA95C340E4; Mon, 24 Jan 2022 21:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058942; bh=zBpNwWKSqsso1OByKSC4HcnXg0qiDGwuZ+0URWSstR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qvOMz2ni0JUC9fmp9eTnnhM3yWbO2iSo8UnaP2EEsHG/jE3H5a8X00k7VeRPev02z Akh9D8MZSGCEClY/sPXOSAlxS0/q5rYmJpzGXXBi5ZE33CugKmo7nbHjgFOexu/Zfo mtkVZCmFavhAtBtsrm8Gg7B1VPXgR0ZCmr9B4/Vw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lad Prabhakar , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.16 0453/1039] clk: renesas: rzg2l: propagate return value of_genpd_add_provider_simple() Date: Mon, 24 Jan 2022 19:37:22 +0100 Message-Id: <20220124184140.528054004@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 33748744f15a110a233b6ae0380f476006e770f0 ] of_genpd_add_provider_simple() might fail, this patch makes sure we check the return value of of_genpd_add_provider_simple() by propagating the return value to the caller of rzg2l_cpg_add_clk_domain(). Fixes: ef3c613ccd68a ("clk: renesas: Add CPG core wrapper for RZ/G2L SoC") Signed-off-by: Lad Prabhakar Link: https://lore.kernel.org/r/20211117115101.28281-3-prabhakar.mahadev-la= d.rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/clk/renesas/rzg2l-cpg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cp= g.c index 4f04ff57d468a..aafd1879ff562 100644 --- a/drivers/clk/renesas/rzg2l-cpg.c +++ b/drivers/clk/renesas/rzg2l-cpg.c @@ -878,8 +878,7 @@ static int __init rzg2l_cpg_add_clk_domain(struct devic= e *dev) if (ret) return ret; =20 - of_genpd_add_provider_simple(np, genpd); - return 0; + return of_genpd_add_provider_simple(np, genpd); } =20 static int __init rzg2l_cpg_probe(struct platform_device *pdev) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BF01C43219 for ; Mon, 24 Jan 2022 23:55:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365773AbiAXXvl (ORCPT ); Mon, 24 Jan 2022 18:51:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843485AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35D90C06C5B5; Mon, 24 Jan 2022 13:15:48 -0800 (PST) Received: from smtp.kernel.org (relay.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 EF778B80CCF; Mon, 24 Jan 2022 21:15:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A11C3C340E4; Mon, 24 Jan 2022 21:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058945; bh=ZTrTILL+jVZqYLfi1HTYLKwvvvtqq9rneJNTbYsC+Cc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aKh1gYRSsDwVu7Yl+znqypXGnHKHALv6GMGDso0G9bRSJGaIdIm9n+8WN4d5Oqge3 fVcLL6s1uB5QccBOAnU8Yht1wEzIomrWjZVMsNoo2YheqLMYP72P4qslCaygE1nrAx yxd3LVlcwNuqF6iM+vmVq09ACP6y8IyXTZNwRDFs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Ford , Fabio Estevam , Abel Vesa , Sasha Levin Subject: [PATCH 5.16 0454/1039] clk: imx8mn: Fix imx8mn_clko1_sels Date: Mon, 24 Jan 2022 19:37:23 +0100 Message-Id: <20220124184140.560309215@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adam Ford [ Upstream commit 570727e9acfac1c2330a01dd5e1272e9c3acec08 ] When attempting to use sys_pll1_80m as the parent for clko1, the system hangs. This is due to the fact that the source select for sys_pll1_80m was incorrectly pointing to m7_alt_pll_clk, which doesn't yet exist. According to Rev 3 of the TRM, The imx8mn_clko1_sels also incorrectly references an osc_27m which does not exist, nor does an entry for source select bits 010b. Fix both by inserting a dummy clock into the missing space in the table and renaming the incorrectly name clock with dummy. Fixes: 96d6392b54db ("clk: imx: Add support for i.MX8MN clock driver") Signed-off-by: Adam Ford Reviewed-by: Fabio Estevam Link: https://lore.kernel.org/r/20211117133202.775633-1-aford173@gmail.com Signed-off-by: Abel Vesa Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/clk/imx/clk-imx8mn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index c55577604e16a..021355a247081 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -277,9 +277,9 @@ static const char * const imx8mn_pdm_sels[] =3D {"osc_2= 4m", "sys_pll2_100m", "audi =20 static const char * const imx8mn_dram_core_sels[] =3D {"dram_pll_out", "dr= am_alt_root", }; =20 -static const char * const imx8mn_clko1_sels[] =3D {"osc_24m", "sys_pll1_80= 0m", "osc_27m", - "sys_pll1_200m", "audio_pll2_out", "vpu_pll", - "sys_pll1_80m", }; +static const char * const imx8mn_clko1_sels[] =3D {"osc_24m", "sys_pll1_80= 0m", "dummy", + "sys_pll1_200m", "audio_pll2_out", "sys_pll2_500m", + "dummy", "sys_pll1_80m", }; static const char * const imx8mn_clko2_sels[] =3D {"osc_24m", "sys_pll2_20= 0m", "sys_pll1_400m", "sys_pll2_166m", "sys_pll3_out", "audio_pll1_out", "video_pll1_out", "osc_32k", }; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13971C433FE for ; Mon, 24 Jan 2022 21:55:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575281AbiAXVvS (ORCPT ); Mon, 24 Jan 2022 16:51:18 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:35842 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449591AbiAXVPv (ORCPT ); Mon, 24 Jan 2022 16:15:51 -0500 Received: from smtp.kernel.org (relay.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 0BC14B811F3; Mon, 24 Jan 2022 21:15:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A0F8C340E4; Mon, 24 Jan 2022 21:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058948; bh=LSL6cfHhkID5SJXenbev0csahBF86XUuUbQBpDHN27Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PQYCGszN5kZYqPj4TmjfZ+H78w4CmTY2q6GkzPayELFI/g+IPyJmINcBZDZvVt5e/ mO1YFr5uHQOWBo+TTizW7Zc5KFIBUVfHkZdBU9n8Ha90KdR5ssvvBASYn6AOhBmfBH Xlh59cwAiBMdGxfcjAaPRUZ44zrKgDTgcKHTlfnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Fitzgerald , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0455/1039] ASoC: cs42l42: Report initial jack state Date: Mon, 24 Jan 2022 19:37:24 +0100 Message-Id: <20220124184140.591589225@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Richard Fitzgerald [ Upstream commit fdd535283779ec9f9c35fda352585c629121214f ] When a jack handler is registered in cs42l42_set_jack() the initial state should be reported if an attached headphone/headset has already been detected. The jack detect sequence takes around 1 second: typically long enough for the machine driver to probe and register the jack handler in time to receive the first report from the interrupt handler. So it is possible on some systems that the correct initial state was seen simply because of lucky timing. Modular builds were more likely to miss the reporting of the initial state. Signed-off-by: Richard Fitzgerald Fixes: 4ca239f33737 ("ASoC: cs42l42: Always enable TS_PLUG and TS_UNPLUG in= terrupts") Link: https://lore.kernel.org/r/20211119124854.58939-1-rf@opensource.cirrus= .com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/codecs/cs42l42.c | 22 ++++++++++++++++++++++ sound/soc/codecs/cs42l42.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c index 27a1c4c73074f..a63fba4e6c9c2 100644 --- a/sound/soc/codecs/cs42l42.c +++ b/sound/soc/codecs/cs42l42.c @@ -521,8 +521,25 @@ static int cs42l42_set_jack(struct snd_soc_component *= component, struct snd_soc_ { struct cs42l42_private *cs42l42 =3D snd_soc_component_get_drvdata(compone= nt); =20 + /* Prevent race with interrupt handler */ + mutex_lock(&cs42l42->jack_detect_mutex); cs42l42->jack =3D jk; =20 + if (jk) { + switch (cs42l42->hs_type) { + case CS42L42_PLUG_CTIA: + case CS42L42_PLUG_OMTP: + snd_soc_jack_report(jk, SND_JACK_HEADSET, SND_JACK_HEADSET); + break; + case CS42L42_PLUG_HEADPHONE: + snd_soc_jack_report(jk, SND_JACK_HEADPHONE, SND_JACK_HEADPHONE); + break; + default: + break; + } + } + mutex_unlock(&cs42l42->jack_detect_mutex); + return 0; } =20 @@ -1611,6 +1628,8 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *= data) CS42L42_M_DETECT_FT_MASK | CS42L42_M_HSBIAS_HIZ_MASK); =20 + mutex_lock(&cs42l42->jack_detect_mutex); + /* Check auto-detect status */ if ((~masks[5]) & irq_params_table[5].mask) { if (stickies[5] & CS42L42_HSDET_AUTO_DONE_MASK) { @@ -1689,6 +1708,8 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *= data) } } =20 + mutex_unlock(&cs42l42->jack_detect_mutex); + return IRQ_HANDLED; } =20 @@ -2033,6 +2054,7 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_c= lient, =20 cs42l42->dev =3D &i2c_client->dev; i2c_set_clientdata(i2c_client, cs42l42); + mutex_init(&cs42l42->jack_detect_mutex); =20 cs42l42->regmap =3D devm_regmap_init_i2c(i2c_client, &cs42l42_regmap); if (IS_ERR(cs42l42->regmap)) { diff --git a/sound/soc/codecs/cs42l42.h b/sound/soc/codecs/cs42l42.h index f45bcc9a3a62f..02128ebf8989a 100644 --- a/sound/soc/codecs/cs42l42.h +++ b/sound/soc/codecs/cs42l42.h @@ -12,6 +12,7 @@ #ifndef __CS42L42_H__ #define __CS42L42_H__ =20 +#include #include =20 #define CS42L42_PAGE_REGISTER 0x00 /* Page Select Register */ @@ -838,6 +839,7 @@ struct cs42l42_private { struct gpio_desc *reset_gpio; struct completion pdn_done; struct snd_soc_jack *jack; + struct mutex jack_detect_mutex; int pll_config; int bclk; u32 sclk; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 867A6C4332F for ; Mon, 24 Jan 2022 23:55:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365819AbiAXXvr (ORCPT ); Mon, 24 Jan 2022 18:51:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843489AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CAB4C06C5B7; Mon, 24 Jan 2022 13:15:52 -0800 (PST) Received: from smtp.kernel.org (relay.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 2BF5461484; Mon, 24 Jan 2022 21:15:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 003CBC340E4; Mon, 24 Jan 2022 21:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058951; bh=xPFcUW/VW0HIXO34nXQrqLM6dA/LfJbR16e5fxSkbvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e0HQ4zjHi2F3fDyLRc+C7ZGubUuWbWWrKvegXywrRXVivrCsrHaFw1m6n1qfPXv0I 034WTj3EoL/WJ1LnWSW4gaIc4AAdcpxhgsKg0FOSQjbC0kC/jGxJ+MiwlUPdRxj9kr 8elVp+3P8TupgIrynA0VJNDXg2Anf0PEmtGjM6p0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peiwei Hu , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0456/1039] powerpc/prom_init: Fix improper check of prom_getprop() Date: Mon, 24 Jan 2022 19:37:25 +0100 Message-Id: <20220124184140.623807965@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peiwei Hu [ Upstream commit 869fb7e5aecbc163003f93f36dcc26d0554319f6 ] prom_getprop() can return PROM_ERROR. Binary operator can not identify it. Fixes: 94d2dde738a5 ("[POWERPC] Efika: prune fixups and make them more care= full") Signed-off-by: Peiwei Hu Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/tencent_BA28CC6897B7C95A92EB8C580B5D1858910= 5@qq.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kernel/prom_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_ini= t.c index 18b04b08b9833..f845065c860e3 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -2991,7 +2991,7 @@ static void __init fixup_device_tree_efika_add_phy(vo= id) =20 /* Check if the phy-handle property exists - bail if it does */ rv =3D prom_getprop(node, "phy-handle", prop, sizeof(prop)); - if (!rv) + if (rv <=3D 0) return; =20 /* --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B34D2C35271 for ; Mon, 24 Jan 2022 21:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575223AbiAXVvJ (ORCPT ); Mon, 24 Jan 2022 16:51:09 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34670 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449644AbiAXVP4 (ORCPT ); Mon, 24 Jan 2022 16:15:56 -0500 Received: from smtp.kernel.org (relay.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 EA315B811FB; Mon, 24 Jan 2022 21:15:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13060C340E4; Mon, 24 Jan 2022 21:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058954; bh=hoGmMt6X0klq0+u7iW/1fCYXghyAHMkMKI5zDTPe7y0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZHGYf+q3xVRrUFTLNJYl1nBUTn9NL3kA+6SvWp7yGE91D8Tob8Og8SKcQbXGPEDWn SUjULQgHlAowYsPOopJ4hLAosWnpB+FPDtlOlnvp2qzZdihwdCEl666Xwu/aCXXR9W 23ODV/hrD2jV4E5KGj8GHp13uf+iW9bXphkX/cls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Bulwahn , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0457/1039] ASoC: uniphier: drop selecting non-existing SND_SOC_UNIPHIER_AIO_DMA Date: Mon, 24 Jan 2022 19:37:26 +0100 Message-Id: <20220124184140.660840865@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Bulwahn [ Upstream commit 49f893253ab43566e34332a969324531fea463f6 ] Commit f37fe2f9987b ("ASoC: uniphier: add support for UniPhier AIO common driver") adds configs SND_SOC_UNIPHIER_{LD11,PXS2}, which select the non-existing config SND_SOC_UNIPHIER_AIO_DMA. Hence, ./scripts/checkkconfigsymbols.py warns: SND_SOC_UNIPHIER_AIO_DMA Referencing files: sound/soc/uniphier/Kconfig Probably, there is actually no further config intended to be selected here. So, just drop selecting the non-existing config. Fixes: f37fe2f9987b ("ASoC: uniphier: add support for UniPhier AIO common d= river") Signed-off-by: Lukas Bulwahn Link: https://lore.kernel.org/r/20211125095158.8394-2-lukas.bulwahn@gmail.c= om Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/uniphier/Kconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/sound/soc/uniphier/Kconfig b/sound/soc/uniphier/Kconfig index aa3592ee1358b..ddfa6424c656b 100644 --- a/sound/soc/uniphier/Kconfig +++ b/sound/soc/uniphier/Kconfig @@ -23,7 +23,6 @@ config SND_SOC_UNIPHIER_LD11 tristate "UniPhier LD11/LD20 Device Driver" depends on SND_SOC_UNIPHIER select SND_SOC_UNIPHIER_AIO - select SND_SOC_UNIPHIER_AIO_DMA help This adds ASoC driver for Socionext UniPhier LD11/LD20 input and output that can be used with other codecs. @@ -34,7 +33,6 @@ config SND_SOC_UNIPHIER_PXS2 tristate "UniPhier PXs2 Device Driver" depends on SND_SOC_UNIPHIER select SND_SOC_UNIPHIER_AIO - select SND_SOC_UNIPHIER_AIO_DMA help This adds ASoC driver for Socionext UniPhier PXs2 input and output that can be used with other codecs. --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5064FC433F5 for ; Mon, 24 Jan 2022 21:54:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575243AbiAXVvL (ORCPT ); Mon, 24 Jan 2022 16:51:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:35896 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449681AbiAXVQA (ORCPT ); Mon, 24 Jan 2022 16:16:00 -0500 Received: from smtp.kernel.org (relay.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 EDB65B8105C; Mon, 24 Jan 2022 21:15:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CC31C340E4; Mon, 24 Jan 2022 21:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058957; bh=8ntT8bn7mdE+kEh+TvWHhZ2ZY1wkjhRLlEw0CeWml1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2h1gwdqdSEiZ0v9FIPn89xang9+z4vx3NebePAfFKHSt6/PVyAHR8/LIpMMRYBjMz K/jbjkDIfkNtvuT6HpwB16io3mBfXdhBmqWKXbIiJ/excGsicLx57/DueSwTxpM5tf dpLnlRiCI6/1wnZJBP/lGoXH/aqZHOxOoOSeJAu0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Bulwahn , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0458/1039] ASoC: codecs: wcd938x: add SND_SOC_WCD938_SDW to codec list instead Date: Mon, 24 Jan 2022 19:37:27 +0100 Message-Id: <20220124184140.692423841@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Bulwahn [ Upstream commit 2039cc1da4bee1fd0df644e26b28ed769cd32a81 ] Commit 045442228868 ("ASoC: codecs: wcd938x: add audio routing and Kconfig") adds SND_SOC_WCD937X, which does not exist, and SND_SOC_WCD938X, which seems not really to be the intended config to be selected, but only a supporting config symbol to the actual config SND_SOC_WCD938X_SDW for the codec. Add SND_SOC_WCD938_SDW to the list instead of SND_SOC_WCD93{7,8}X. The issue was identified with ./scripts/checkkconfigsymbols.py. Fixes: 045442228868 ("ASoC: codecs: wcd938x: add audio routing and Kconfig") Signed-off-by: Lukas Bulwahn Link: https://lore.kernel.org/r/20211125095158.8394-3-lukas.bulwahn@gmail.c= om Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/codecs/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 326f2d611ad4e..3a610ba183ffb 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -241,8 +241,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_UDA1380 imply SND_SOC_WCD9335 imply SND_SOC_WCD934X - imply SND_SOC_WCD937X - imply SND_SOC_WCD938X + imply SND_SOC_WCD938X_SDW imply SND_SOC_LPASS_RX_MACRO imply SND_SOC_LPASS_TX_MACRO imply SND_SOC_WL1273 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E01CFC433EF for ; Mon, 24 Jan 2022 21:54:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575259AbiAXVvM (ORCPT ); Mon, 24 Jan 2022 16:51:12 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38842 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449726AbiAXVQF (ORCPT ); Mon, 24 Jan 2022 16:16:05 -0500 Received: from smtp.kernel.org (relay.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 A8292611C8; Mon, 24 Jan 2022 21:16:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6249AC340E4; Mon, 24 Jan 2022 21:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058964; bh=0pMuCKPO/MhYjB/3MEoZSaWEvbcXKnkvLaoassEfGl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xjOgep8rP8b7XmOx/qYM4OmmuaS1mQrbTw59OP2jPYwx+H/cKKTBKwHDTS8BN0KsU lfr0wk0PD4wX9Gl0J3nTAvfhVUHwa9GSgxBvVXG8o1qzsAniBBZf12Wvkseri8Jucf 77D5rNuJyI76RjUZdterFIkfDMb+zgZJPX7J9sVQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Wang , Guoqing Jiang , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.16 0459/1039] RDMA/rtrs-clt: Fix the initial value of min_latency Date: Mon, 24 Jan 2022 19:37:28 +0100 Message-Id: <20220124184140.723253545@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jack Wang [ Upstream commit 925cac6358677d3d64f9b25f205eeb3d31c9f7f8 ] The type of min_latency is ktime_t, so use KTIME_MAX to initialize the initial value. Fixes: dc3b66a0ce70 ("RDMA/rtrs-clt: Add a minimum latency multipath policy= ") Link: https://lore.kernel.org/r/20211124081040.19533-1-jinpu.wang@ionos.com Signed-off-by: Jack Wang Reviewed-by: Guoqing Jiang Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ul= p/rtrs/rtrs-clt.c index 15c0077dd27eb..e39709dee179d 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -867,7 +867,7 @@ static struct rtrs_clt_sess *get_next_path_min_latency(= struct path_it *it) struct rtrs_clt_sess *min_path =3D NULL; struct rtrs_clt *clt =3D it->clt; struct rtrs_clt_sess *sess; - ktime_t min_latency =3D INT_MAX; + ktime_t min_latency =3D KTIME_MAX; ktime_t latency; =20 list_for_each_entry_rcu(sess, &clt->paths_list, s.entry) { --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA6A3C47080 for ; Mon, 24 Jan 2022 21:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575298AbiAXVvY (ORCPT ); Mon, 24 Jan 2022 16:51:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:35968 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347721AbiAXVQM (ORCPT ); Mon, 24 Jan 2022 16:16:12 -0500 Received: from smtp.kernel.org (relay.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 6C46EB8121C; Mon, 24 Jan 2022 21:16:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85818C340E4; Mon, 24 Jan 2022 21:16:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058967; bh=rtpLZA/dEdKmmCJ55vX9tk3oGIr36nPawB5/HexGmQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fv7pJG+kKt/aBhDod8/hx+6Z/RMCMgU/TTPDc7YpvAd6rdLu628s5rVUF2lKGiuGJ YWdIaJJA79/+WyYoxxnggoRzHqOA7eMtLoEBAwpkLO+KITCp8R4TjEbSGW1ojeejF8 Rf0ay3BVjNFLebJNGVXnncm0jFoGjgx+PYfRV4Wk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Pierre-Louis Bossart , Takashi Iwai , Sasha Levin Subject: [PATCH 5.16 0460/1039] ALSA: hda: Make proper use of timecounter Date: Mon, 24 Jan 2022 19:37:29 +0100 Message-Id: <20220124184140.752170104@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit 6dd21ad81bf96478db3403b1bbe251c0612d0431 ] HDA uses a timecounter to read a hardware clock running at 24 MHz. The conversion factor is set with a mult value of 125 and a shift value of 0, which is not converting the hardware clock to nanoseconds, it is converting to 1/3 nanoseconds because the conversion factor from 24Mhz to nanoseconds is 125/3. The usage sites divide the "nanoseconds" value returned by timecounter_read() by 3 to get a real nanoseconds value. There is a lengthy comment in azx_timecounter_init() explaining this choice. That comment makes blatantly wrong assumptions about how timecounters work and what can overflow. The comment says: * Applying the 1/3 factor as part of the multiplication * requires at least 20 bits for a decent precision, however * overflows occur after about 4 hours or less, not a option. timecounters operate on time deltas between two readouts of a clock and use the mult/shift pair to calculate a precise nanoseconds value: delta_nsec =3D (delta_clock * mult) >> shift; The fractional part is also taken into account and preserved to prevent accumulated rounding errors. For details see cyclecounter_cyc2ns(). The mult/shift pair has to be chosen so that the multiplication of the maximum expected delta value does not result in a 64bit overflow. As the counter wraps around on 32bit, the maximum observable delta between two reads is (1 << 32) - 1 which is about 178.9 seconds. That in turn means the maximum multiplication factor which fits into an u32 will not cause a 64bit overflow ever because it's guaranteed that: ((1 << 32) - 1) ^ 2 < (1 << 64) The resulting correct multiplication factor is 2796202667 and the shift value is 26, i.e. 26 bit precision. The overflow of the multiplication would happen exactly at a clock readout delta of 6597069765 which is way after the wrap around of the hardware clock at around 274.8 seconds which is off from the claimed 4 hours by more than an order of magnitude. If the counter ever wraps around the last read value then the calculation is off by the number of wrap arounds times 178.9 seconds because the overflow cannot be observed. Use clocks_calc_mult_shift(), which calculates the most accurate mult/shift pair based on the given clock frequency, and remove the bogus comment along with the divisions at the readout sites. Fixes: 5d890f591d15 ("ALSA: hda: support for wallclock timestamps") Signed-off-by: Thomas Gleixner Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/871r35kwji.ffs@tglx Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/hda/hdac_stream.c | 14 ++++---------- sound/pci/hda/hda_controller.c | 1 - sound/soc/intel/skylake/skl-pcm.c | 1 - 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c index 9867555883c34..aa7955fdf68a0 100644 --- a/sound/hda/hdac_stream.c +++ b/sound/hda/hdac_stream.c @@ -534,17 +534,11 @@ static void azx_timecounter_init(struct hdac_stream *= azx_dev, cc->mask =3D CLOCKSOURCE_MASK(32); =20 /* - * Converting from 24 MHz to ns means applying a 125/3 factor. - * To avoid any saturation issues in intermediate operations, - * the 125 factor is applied first. The division is applied - * last after reading the timecounter value. - * Applying the 1/3 factor as part of the multiplication - * requires at least 20 bits for a decent precision, however - * overflows occur after about 4 hours or less, not a option. + * Calculate the optimal mult/shift values. The counter wraps + * around after ~178.9 seconds. */ - - cc->mult =3D 125; /* saturation after 195 years */ - cc->shift =3D 0; + clocks_calc_mult_shift(&cc->mult, &cc->shift, 24000000, + NSEC_PER_SEC, 178); =20 nsec =3D 0; /* audio time is elapsed time since trigger */ timecounter_init(tc, cc, nsec); diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 930ae4002a818..75dcb14ff20ad 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -504,7 +504,6 @@ static int azx_get_time_info(struct snd_pcm_substream *= substream, snd_pcm_gettime(substream->runtime, system_ts); =20 nsec =3D timecounter_read(&azx_dev->core.tc); - nsec =3D div_u64(nsec, 3); /* can be optimized */ if (audio_tstamp_config->report_delay) nsec =3D azx_adjust_codec_delay(substream, nsec); =20 diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/sk= l-pcm.c index 9ecaf6a1e8475..e4aa366d356eb 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -1251,7 +1251,6 @@ static int skl_platform_soc_get_time_info( snd_pcm_gettime(substream->runtime, system_ts); =20 nsec =3D timecounter_read(&hstr->tc); - nsec =3D div_u64(nsec, 3); /* can be optimized */ if (audio_tstamp_config->report_delay) nsec =3D skl_adjust_codec_delay(substream, nsec); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AD3FC43217 for ; Mon, 24 Jan 2022 23:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362521AbiAXXma (ORCPT ); Mon, 24 Jan 2022 18:42:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843521AbiAXXEF (ORCPT ); Mon, 24 Jan 2022 18:04:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35811C06E003; Mon, 24 Jan 2022 13:16:11 -0800 (PST) Received: from smtp.kernel.org (relay.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 CABFA61496; Mon, 24 Jan 2022 21:16:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A42BFC340E4; Mon, 24 Jan 2022 21:16:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058970; bh=s9tsxmFlqICboirL075gBp3+3Ny1m13WJnEkExbZ/tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OsygMvCFr6Nq+9QhyFNmpH8xxml2RcEDgbX6RkYcIlsYzvRR7XAoY4egeb7lRGVJD wGxjoJPHl8v/Rwb/nJDv9e3zl1UaffQWt2UMeVj5KY83zuhCd5tv7DSMCZpgghuCzp nKKZMMvFtYwZcClnkuoZDoj7SjtTMULhKApRPNQg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kieran Bingham , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Rob Herring , Sasha Levin Subject: [PATCH 5.16 0461/1039] dt-bindings: thermal: Fix definition of cooling-maps contribution property Date: Mon, 24 Jan 2022 19:37:30 +0100 Message-Id: <20220124184140.783230585@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Niklas S=C3=B6derlund [ Upstream commit 49bcb1506f2e095262c01bda7fd1c0db524c91e2 ] When converting the thermal-zones bindings to yaml the definition of the contribution property changed. The intention is the same, an integer value expressing a ratio of a sum on how much cooling is provided by the device to the zone. But after the conversion the integer value is limited to the range 0 to 100 and expressed as a percentage. This is problematic for two reasons. - This do not match how the binding is used. Out of the 18 files that make use of the property only two (ste-dbx5x0.dtsi and ste-hrefv60plus.dtsi) sets it at a value that satisfy the binding, 100. The remaining 16 files set the value higher and fail to validate. - Expressing the value as a percentage instead of a ratio of the sum is confusing as there is nothing to enforce the sum in the zone is not greater then 100. This patch restore the pre yaml conversion description and removes the value limitation allowing the usage of the bindings to validate. Fixes: 1202a442a31fd2e5 ("dt-bindings: thermal: Add yaml bindings for therm= al zones") Reported-by: Kieran Bingham Signed-off-by: Niklas S=C3=B6derlund Link: https://lore.kernel.org/r/20211109103045.1403686-1-niklas.soderlund+r= enesas@ragnatech.se Signed-off-by: Rob Herring Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../devicetree/bindings/thermal/thermal-zones.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml b= /Documentation/devicetree/bindings/thermal/thermal-zones.yaml index a07de5ed0ca6a..2d34f3ccb2572 100644 --- a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml +++ b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml @@ -199,12 +199,11 @@ patternProperties: =20 contribution: $ref: /schemas/types.yaml#/definitions/uint32 - minimum: 0 - maximum: 100 description: - The percentage contribution of the cooling devices at the - specific trip temperature referenced in this map - to this thermal zone + The cooling contribution to the thermal zone of the refe= rred + cooling device at the referred trip point. The contribut= ion is + a ratio of the sum of all cooling contributions within a + thermal zone. =20 required: - trip --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EC34C433EF for ; Mon, 24 Jan 2022 23:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362498AbiAXXm2 (ORCPT ); Mon, 24 Jan 2022 18:42:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843530AbiAXXEG (ORCPT ); Mon, 24 Jan 2022 18:04:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84249C06E007; Mon, 24 Jan 2022 13:16:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 1500C61484; Mon, 24 Jan 2022 21:16:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C10B9C340E4; Mon, 24 Jan 2022 21:16:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058973; bh=uIlrJieTJOPXrJibd/ldEsy12rV/lAyNi2ogsQpvU0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I7Ev9rctTOUNKCBKZbbDFmjBJgC2E/kN3sZIS5B0vR84M4w04qS+MJnzeOKNbnbCx NgwjlC4Tmofb61+bJ6G4FVmjBe40Am0k5uztJTePX62aivu1cn7W0uuTySyuj+o9p6 tcSrWK4HLbYimsmmIACYSq+RtQBNGadJAqq776bM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nageswara R Sastry , Nicholas Piggin , Madhavan Srinivasan , Athira Rajeev , Nageswara R Sastry , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0462/1039] powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an overflown PMC Date: Mon, 24 Jan 2022 19:37:31 +0100 Message-Id: <20220124184140.814234026@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Athira Rajeev [ Upstream commit 2c9ac51b850d84ee496b0a5d832ce66d411ae552 ] Running perf fuzzer showed below in dmesg logs: "Can't find PMC that caused IRQ" This means a PMU exception happened, but none of the PMC's (Performance Monitor Counter) were found to be overflown. There are some corner cases that clears the PMCs after PMI gets masked. In such cases, the perf interrupt handler will not find the active PMC values that had caused the overflow and thus leads to this message while replaying. Case 1: PMU Interrupt happens during replay of other interrupts and counter values gets cleared by PMU callbacks before replay: During replay of interrupts like timer, __do_irq() and doorbell exception, we conditionally enable interrupts via may_hard_irq_enable(). This could potentially create a window to generate a PMI. Since irq soft mask is set to ALL_DISABLED, the PMI will get masked here. We could get IPIs run before perf interrupt is replayed and the PMU events could be deleted or stopped. This will change the PMU SPR values and resets the counters. Snippet of ftrace log showing PMU callbacks invoked in __do_irq(): -0 [051] dns. 132025441306354: __do_irq <-call_do_irq -0 [051] dns. 132025441306430: irq_enter <-__do_irq -0 [051] dns. 132025441306503: irq_enter_rcu <-__do_irq -0 [051] dnH. 132025441306599: xive_get_irq <-__do_irq <<>> -0 [051] dnH. 132025441307770: generic_smp_call_function_single_int= errupt <-smp_ipi_demux_relaxed -0 [051] dnH. 132025441307839: flush_smp_call_function_queue <-smp_= ipi_demux_relaxed -0 [051] dnH. 132025441308057: _raw_spin_lock <-event_function -0 [051] dnH. 132025441308206: power_pmu_disable <-perf_pmu_disable -0 [051] dnH. 132025441308337: power_pmu_del <-event_sched_out -0 [051] dnH. 132025441308407: power_pmu_read <-power_pmu_del -0 [051] dnH. 132025441308477: read_pmc <-power_pmu_read -0 [051] dnH. 132025441308590: isa207_disable_pmc <-power_pmu_del -0 [051] dnH. 132025441308663: write_pmc <-power_pmu_del -0 [051] dnH. 132025441308787: power_pmu_event_idx <-perf_event_upd= ate_userpage -0 [051] dnH. 132025441308859: rcu_read_unlock_strict <-perf_event_= update_userpage -0 [051] dnH. 132025441308975: power_pmu_enable <-perf_pmu_enable <<>> -0 [051] dnH. 132025441311108: irq_exit <-__do_irq -0 [051] dns. 132025441311319: performance_monitor_exception <-repl= ay_soft_interrupts Case 2: PMI's masked during local_* operations, example local_add(). If the local_add() operation happens within a local_irq_save(), replay of PMI will be during local_irq_restore(). Similar to case 1, this could also create a window before replay where PMU events gets deleted or stopped. Fix it by updating the PMU callback function power_pmu_disable() to check for pending perf interrupt. If there is an overflown PMC and pending perf interrupt indicated in paca, clear the PMI bit in paca to drop that sample. Clearing of PMI bit is done in power_pmu_disable() since disable is invoked before any event gets deleted/stopped. With this fix, if there are more than one event running in the PMU, there is a chance that we clear the PMI bit for the event which is not getting deleted/stopped. The other events may still remain active. Hence to make sure we don't drop valid sample in such cases, another check is added in power_pmu_enable. This checks if there is an overflown PMC found among the active events and if so enable back the PMI bit. Two new helper functions are introduced to clear/set the PMI, ie clear_pmi_irq_pending() and set_pmi_irq_pending(). Helper function pmi_irq_pending() is introduced to give a warning if there is pending PMI bit in paca, but no PMC is overflown. Also there are corner cases which result in performance monitor interrupts being triggered during power_pmu_disable(). This happens since PMXE bit is not cleared along with disabling of other MMCR0 bits in the pmu_disable. Such PMI's could leave the PMU running and could trigger PMI again which will set MMCR0 PMAO bit. This could lead to spurious interrupts in some corner cases. Example, a timer after power_pmu_del() which will re-enable interrupts and triggers a PMI again since PMAO bit is still set. But fails to find valid overflow since PMC was cleared in power_pmu_del(). Fix that by disabling PMXE along with disabling of other MMCR0 bits in power_pmu_disable(). We can't just replay PMI any time. Hence this approach is preferred rather than replaying PMI before resetting overflown PMC. Patch also documents core-book3s on a race condition which can trigger these PMC messages during idle path in PowerNV. Fixes: f442d004806e ("powerpc/64s: Add support to mask perf interrupts and = replay them") Reported-by: Nageswara R Sastry Suggested-by: Nicholas Piggin Suggested-by: Madhavan Srinivasan Signed-off-by: Athira Rajeev Tested-by: Nageswara R Sastry Reviewed-by: Nicholas Piggin [mpe: Make pmi_irq_pending() return bool, reflow/reword some comments] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1626846509-1350-2-git-send-email-atrajeev@l= inux.vnet.ibm.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/include/asm/hw_irq.h | 40 +++++++++++++++++++++ arch/powerpc/perf/core-book3s.c | 58 ++++++++++++++++++++++++++++++- 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/h= w_irq.h index 21cc571ea9c2d..5c98a950eca0d 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h @@ -224,6 +224,42 @@ static inline bool arch_irqs_disabled(void) return arch_irqs_disabled_flags(arch_local_save_flags()); } =20 +static inline void set_pmi_irq_pending(void) +{ + /* + * Invoked from PMU callback functions to set PMI bit in the paca. + * This has to be called with irq's disabled (via hard_irq_disable()). + */ + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) + WARN_ON_ONCE(mfmsr() & MSR_EE); + + get_paca()->irq_happened |=3D PACA_IRQ_PMI; +} + +static inline void clear_pmi_irq_pending(void) +{ + /* + * Invoked from PMU callback functions to clear the pending PMI bit + * in the paca. + */ + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) + WARN_ON_ONCE(mfmsr() & MSR_EE); + + get_paca()->irq_happened &=3D ~PACA_IRQ_PMI; +} + +static inline bool pmi_irq_pending(void) +{ + /* + * Invoked from PMU callback functions to check if there is a pending + * PMI bit in the paca. + */ + if (get_paca()->irq_happened & PACA_IRQ_PMI) + return true; + + return false; +} + #ifdef CONFIG_PPC_BOOK3S /* * To support disabling and enabling of irq with PMI, set of @@ -408,6 +444,10 @@ static inline void do_hard_irq_enable(void) BUILD_BUG(); } =20 +static inline void clear_pmi_irq_pending(void) { } +static inline void set_pmi_irq_pending(void) { } +static inline bool pmi_irq_pending(void) { return false; } + static inline void irq_soft_mask_regs_set_state(struct pt_regs *regs, unsi= gned long val) { } diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3= s.c index 73e62e9b179bc..bef6b1abce702 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -857,6 +857,19 @@ static void write_pmc(int idx, unsigned long val) } } =20 +static int any_pmc_overflown(struct cpu_hw_events *cpuhw) +{ + int i, idx; + + for (i =3D 0; i < cpuhw->n_events; i++) { + idx =3D cpuhw->event[i]->hw.idx; + if ((idx) && ((int)read_pmc(idx) < 0)) + return idx; + } + + return 0; +} + /* Called from sysrq_handle_showregs() */ void perf_event_print_debug(void) { @@ -1281,11 +1294,13 @@ static void power_pmu_disable(struct pmu *pmu) =20 /* * Set the 'freeze counters' bit, clear EBE/BHRBA/PMCC/PMAO/FC56 + * Also clear PMXE to disable PMI's getting triggered in some + * corner cases during PMU disable. */ val =3D mmcr0 =3D mfspr(SPRN_MMCR0); val |=3D MMCR0_FC; val &=3D ~(MMCR0_EBE | MMCR0_BHRBA | MMCR0_PMCC | MMCR0_PMAO | - MMCR0_FC56); + MMCR0_PMXE | MMCR0_FC56); /* Set mmcr0 PMCCEXT for p10 */ if (ppmu->flags & PPMU_ARCH_31) val |=3D MMCR0_PMCCEXT; @@ -1299,6 +1314,23 @@ static void power_pmu_disable(struct pmu *pmu) mb(); isync(); =20 + /* + * Some corner cases could clear the PMU counter overflow + * while a masked PMI is pending. One such case is when + * a PMI happens during interrupt replay and perf counter + * values are cleared by PMU callbacks before replay. + * + * If any PMC corresponding to the active PMU events are + * overflown, disable the interrupt by clearing the paca + * bit for PMI since we are disabling the PMU now. + * Otherwise provide a warning if there is PMI pending, but + * no counter is found overflown. + */ + if (any_pmc_overflown(cpuhw)) + clear_pmi_irq_pending(); + else + WARN_ON(pmi_irq_pending()); + val =3D mmcra =3D cpuhw->mmcr.mmcra; =20 /* @@ -1390,6 +1422,15 @@ static void power_pmu_enable(struct pmu *pmu) * (possibly updated for removal of events). */ if (!cpuhw->n_added) { + /* + * If there is any active event with an overflown PMC + * value, set back PACA_IRQ_PMI which would have been + * cleared in power_pmu_disable(). + */ + hard_irq_disable(); + if (any_pmc_overflown(cpuhw)) + set_pmi_irq_pending(); + mtspr(SPRN_MMCRA, cpuhw->mmcr.mmcra & ~MMCRA_SAMPLE_ENABLE); mtspr(SPRN_MMCR1, cpuhw->mmcr.mmcr1); if (ppmu->flags & PPMU_ARCH_31) @@ -2337,6 +2378,14 @@ static void __perf_event_interrupt(struct pt_regs *r= egs) break; } } + + /* + * Clear PACA_IRQ_PMI in case it was set by + * set_pmi_irq_pending() when PMU was enabled + * after accounting for interrupts. + */ + clear_pmi_irq_pending(); + if (!active) /* reset non active counters that have overflowed */ write_pmc(i + 1, 0); @@ -2356,6 +2405,13 @@ static void __perf_event_interrupt(struct pt_regs *r= egs) } } } + + /* + * During system wide profling or while specific CPU is monitored for an + * event, some corner cases could cause PMC to overflow in idle path. This + * will trigger a PMI after waking up from idle. Since counter values are= _not_ + * saved/restored in idle path, can lead to below "Can't find PMC" messag= e. + */ if (unlikely(!found) && !arch_irq_disabled_regs(regs)) printk_ratelimited(KERN_WARNING "Can't find PMC that caused IRQ\n"); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA572C35273 for ; Mon, 24 Jan 2022 21:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575319AbiAXVv0 (ORCPT ); Mon, 24 Jan 2022 16:51:26 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:39072 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346359AbiAXVQW (ORCPT ); Mon, 24 Jan 2022 16:16:22 -0500 Received: from smtp.kernel.org (relay.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 2757161469; Mon, 24 Jan 2022 21:16:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC54FC340E4; Mon, 24 Jan 2022 21:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058976; bh=uthVye0iwSuswlGwFuQRe9N7bDcMWWKiC6t7peSk9s0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nnFxNtC1kIUZa/GDiZQzsUTlVh3QRJGzEP5m8K5Oi8CvDHv03E/dOZefJDsns3yoS q1RAxssVZgMZH/tBX/ttyE2euODaFEwGytkHfL4XpBDv48Af/l5lQrsMIVw1AlsAQi 9LWC0GHRoTucc6QheYzN9dQU+5VKbQx+bK1dCOac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erhard Furtner , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0463/1039] powerpc/modules: Dont WARN on first module allocation attempt Date: Mon, 24 Jan 2022 19:37:32 +0100 Message-Id: <20220124184140.843266216@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 f1797e4de1146009c888bcf8b6bb6648d55394f1 ] module_alloc() first tries to allocate module text within 24 bits direct jump from kernel text, and tries a wider allocation if first one fails. When first allocation fails the following is observed in kernel logs: vmap allocation for size 2400256 failed: use vmalloc=3D to increase= size systemd-udevd: vmalloc error: size 2395133, vm_struct allocation failed, = mode:0xcc0(GFP_KERNEL), nodemask=3D(null) CPU: 0 PID: 127 Comm: systemd-udevd Tainted: G W 5.15.5-ge= ntoo-PowerMacG4 #9 Call Trace: [e2a53a50] [c0ba0048] dump_stack_lvl+0x80/0xb0 (unreliable) [e2a53a70] [c0540128] warn_alloc+0x11c/0x2b4 [e2a53b50] [c0531be8] __vmalloc_node_range+0xd8/0x64c [e2a53c10] [c00338c0] module_alloc+0xa0/0xac [e2a53c40] [c027a368] load_module+0x2ae0/0x8148 [e2a53e30] [c027fc78] sys_finit_module+0xfc/0x130 [e2a53f30] [c0035098] ret_from_syscall+0x0/0x28 ... Add __GFP_NOWARN flag to first allocation so that no warning appears when it fails. Reported-by: Erhard Furtner Fixes: 2ec13df16704 ("powerpc/modules: Load modules closer to kernel text") Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/93c9b84d6ec76aaf7b4f03468e22433a6d308674.16= 38267035.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kernel/module.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c index ed04a3ba66fe8..40a583e9d3c70 100644 --- a/arch/powerpc/kernel/module.c +++ b/arch/powerpc/kernel/module.c @@ -90,16 +90,17 @@ int module_finalize(const Elf_Ehdr *hdr, } =20 static __always_inline void * -__module_alloc(unsigned long size, unsigned long start, unsigned long end) +__module_alloc(unsigned long size, unsigned long start, unsigned long end,= bool nowarn) { pgprot_t prot =3D strict_module_rwx_enabled() ? PAGE_KERNEL : PAGE_KERNEL= _EXEC; + gfp_t gfp =3D GFP_KERNEL | (nowarn ? __GFP_NOWARN : 0); =20 /* * Don't do huge page allocations for modules yet until more testing * is done. STRICT_MODULE_RWX may require extra work to support this * too. */ - return __vmalloc_node_range(size, 1, start, end, GFP_KERNEL, prot, + return __vmalloc_node_range(size, 1, start, end, gfp, prot, VM_FLUSH_RESET_PERMS | VM_NO_HUGE_VMAP, NUMA_NO_NODE, __builtin_return_address(0)); } @@ -114,13 +115,13 @@ void *module_alloc(unsigned long size) =20 /* First try within 32M limit from _etext to avoid branch trampolines */ if (MODULES_VADDR < PAGE_OFFSET && MODULES_END > limit) - ptr =3D __module_alloc(size, limit, MODULES_END); + ptr =3D __module_alloc(size, limit, MODULES_END, true); =20 if (!ptr) - ptr =3D __module_alloc(size, MODULES_VADDR, MODULES_END); + ptr =3D __module_alloc(size, MODULES_VADDR, MODULES_END, false); =20 return ptr; #else - return __module_alloc(size, VMALLOC_START, VMALLOC_END); + return __module_alloc(size, VMALLOC_START, VMALLOC_END, false); #endif } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFFF0C4332F for ; Mon, 24 Jan 2022 23:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362478AbiAXXm0 (ORCPT ); Mon, 24 Jan 2022 18:42:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843544AbiAXXEH (ORCPT ); Mon, 24 Jan 2022 18:04:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B151BC06E00C; Mon, 24 Jan 2022 13:16:20 -0800 (PST) Received: from smtp.kernel.org (relay.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 5111961484; Mon, 24 Jan 2022 21:16:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15D49C340E4; Mon, 24 Jan 2022 21:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058979; bh=th4VKO5Ug+nK9IqtFEODJ6OwStYjXRjMQK8H8lx4WDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XRf+eJZ8fzzgxjOrp1CHCVDxxSG8cz+oeEE8FrYRm+bs0ECGbHxD6FtHLljSz0Sgu hbDBadwn6dBpIjchdsvmujIq4cUN7O+le8DjqI9dyMJwuVL9pjWFL9tBeJR52UXCr6 qxYOJBHQOhEmmzzrKWj0oncOuqw0ExMDYrYZeD9Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erhard Furtner , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0464/1039] powerpc/32s: Fix shift-out-of-bounds in KASAN init Date: Mon, 24 Jan 2022 19:37:33 +0100 Message-Id: <20220124184140.875034720@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 af11dee4361b3519981fa04d014873f9d9edd6ac ] =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=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D UBSAN: shift-out-of-bounds in arch/powerpc/mm/kasan/book3s_32.c:22:23 shift exponent -1 is negative CPU: 0 PID: 0 Comm: swapper Not tainted 5.15.5-gentoo-PowerMacG4 #9 Call Trace: [c214be60] [c0ba0048] dump_stack_lvl+0x80/0xb0 (unreliable) [c214be80] [c0b99288] ubsan_epilogue+0x10/0x5c [c214be90] [c0b98fe0] __ubsan_handle_shift_out_of_bounds+0x94/0x138 [c214bf00] [c1c0f010] kasan_init_region+0xd8/0x26c [c214bf30] [c1c0ed84] kasan_init+0xc0/0x198 [c214bf70] [c1c08024] setup_arch+0x18/0x54c [c214bfc0] [c1c037f0] start_kernel+0x90/0x33c [c214bff0] [00003610] 0x3610 =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=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D This happens when the directly mapped memory is a power of 2. Fix it by checking the shift and set the result to 0 when shift is -1 Fixes: 7974c4732642 ("powerpc/32s: Implement dedicated kasan_init_region()") Reported-by: Erhard Furtner Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D215169 Link: https://lore.kernel.org/r/15cbc3439d4ad988b225e2119ec99502a5cc6ad3.16= 38261744.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/mm/kasan/book3s_32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/kasan/book3s_32.c b/arch/powerpc/mm/kasan/book= 3s_32.c index 202bd260a0095..35b287b0a8da4 100644 --- a/arch/powerpc/mm/kasan/book3s_32.c +++ b/arch/powerpc/mm/kasan/book3s_32.c @@ -19,7 +19,8 @@ int __init kasan_init_region(void *start, size_t size) block =3D memblock_alloc(k_size, k_size_base); =20 if (block && k_size_base >=3D SZ_128K && k_start =3D=3D ALIGN(k_start, k_= size_base)) { - int k_size_more =3D 1 << (ffs(k_size - k_size_base) - 1); + int shift =3D ffs(k_size - k_size_base); + int k_size_more =3D shift ? 1 << (shift - 1) : 0; =20 setbat(-1, k_start, __pa(block), k_size_base, PAGE_KERNEL); if (k_size_more >=3D SZ_128K) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D5D9C47081 for ; Mon, 24 Jan 2022 21:58:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575336AbiAXVv2 (ORCPT ); Mon, 24 Jan 2022 16:51:28 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37160 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352728AbiAXVQ3 (ORCPT ); Mon, 24 Jan 2022 16:16:29 -0500 Received: from smtp.kernel.org (relay.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 3AA986149E; Mon, 24 Jan 2022 21:16:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E941C340E4; Mon, 24 Jan 2022 21:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058982; bh=nVBgM0OnAk/WgY3rgw0h9PGKVpbHlF3D3agC/aIx4Qg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G4NjSCYetsnNJNrZS8mxMQ2z3oWcoCZxTXQ3jiTyC6qE6iZpat/C5dyKQybNrHg3B qhbcG5mdidip1zKhO42Qs4jqz9LqTZ6Fz4/ABGPaay19djKjHetZo8CC5qydzywgjb T7Bwei9djSlZZuLdpk1VibTgf83rIgv2dw1NXFaQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Waiman Long , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.16 0465/1039] clocksource: Avoid accidental unstable marking of clocksources Date: Mon, 24 Jan 2022 19:37:34 +0100 Message-Id: <20220124184140.907150863@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Waiman Long [ Upstream commit c86ff8c55b8ae68837b2fa59dc0c203907e9a15f ] Since commit db3a34e17433 ("clocksource: Retry clock read if long delays detected") and commit 2e27e793e280 ("clocksource: Reduce clocksource-skew threshold"), it is found that tsc clocksource fallback to hpet can sometimes happen on both Intel and AMD systems especially when they are running stressful benchmarking workloads. Of the 23 systems tested with a v5.14 kernel, 10 of them have switched to hpet clock source during the test run. The result of falling back to hpet is a drastic reduction of performance when running benchmarks. For example, the fio performance tests can drop up to 70% whereas the iperf3 performance can drop up to 80%. 4 hpet fallbacks happened during bootup. They were: [ 8.749399] clocksource: timekeeping watchdog on CPU13: hpet read-back= delay of 263750ns, attempt 4, marking unstable [ 12.044610] clocksource: timekeeping watchdog on CPU19: hpet read-back= delay of 186166ns, attempt 4, marking unstable [ 17.336941] clocksource: timekeeping watchdog on CPU28: hpet read-back= delay of 182291ns, attempt 4, marking unstable [ 17.518565] clocksource: timekeeping watchdog on CPU34: hpet read-back= delay of 252196ns, attempt 4, marking unstable Other fallbacks happen when the systems were running stressful benchmarks. For example: [ 2685.867873] clocksource: timekeeping watchdog on CPU117: hpet read-bac= k delay of 57269ns, attempt 4, marking unstable [46215.471228] clocksource: timekeeping watchdog on CPU8: hpet read-back = delay of 61460ns, attempt 4, marking unstable Commit 2e27e793e280 ("clocksource: Reduce clocksource-skew threshold"), changed the skew margin from 100us to 50us. I think this is too small and can easily be exceeded when running some stressful workloads on a thermally stressed system. So it is switched back to 100us. Even a maximum skew margin of 100us may be too small in for some systems when booting up especially if those systems are under thermal stress. To eliminate the case that the large skew is due to the system being too busy slowing down the reading of both the watchdog and the clocksource, an extra consecutive read of watchdog clock is being done to check this. The consecutive watchdog read delay is compared against WATCHDOG_MAX_SKEW/2. If the delay exceeds the limit, we assume that the system is just too busy. A warning will be printed to the console and the clock skew check is skipped for this round. Fixes: db3a34e17433 ("clocksource: Retry clock read if long delays detected= ") Fixes: 2e27e793e280 ("clocksource: Reduce clocksource-skew threshold") Signed-off-by: Waiman Long Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/time/clocksource.c | 50 ++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index b8a14d2fb5ba6..bcad1a1e5dcf1 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -107,7 +107,7 @@ static u64 suspend_start; * This delay could be due to SMIs, NMIs, or to VCPU preemptions. Used as * a lower bound for cs->uncertainty_margin values when registering clocks. */ -#define WATCHDOG_MAX_SKEW (50 * NSEC_PER_USEC) +#define WATCHDOG_MAX_SKEW (100 * NSEC_PER_USEC) =20 #ifdef CONFIG_CLOCKSOURCE_WATCHDOG static void clocksource_watchdog_work(struct work_struct *work); @@ -205,17 +205,24 @@ EXPORT_SYMBOL_GPL(max_cswd_read_retries); static int verify_n_cpus =3D 8; module_param(verify_n_cpus, int, 0644); =20 -static bool cs_watchdog_read(struct clocksource *cs, u64 *csnow, u64 *wdno= w) +enum wd_read_status { + WD_READ_SUCCESS, + WD_READ_UNSTABLE, + WD_READ_SKIP +}; + +static enum wd_read_status cs_watchdog_read(struct clocksource *cs, u64 *c= snow, u64 *wdnow) { unsigned int nretries; - u64 wd_end, wd_delta; - int64_t wd_delay; + u64 wd_end, wd_end2, wd_delta; + int64_t wd_delay, wd_seq_delay; =20 for (nretries =3D 0; nretries <=3D max_cswd_read_retries; nretries++) { local_irq_disable(); *wdnow =3D watchdog->read(watchdog); *csnow =3D cs->read(cs); wd_end =3D watchdog->read(watchdog); + wd_end2 =3D watchdog->read(watchdog); local_irq_enable(); =20 wd_delta =3D clocksource_delta(wd_end, *wdnow, watchdog->mask); @@ -226,13 +233,34 @@ static bool cs_watchdog_read(struct clocksource *cs, = u64 *csnow, u64 *wdnow) pr_warn("timekeeping watchdog on CPU%d: %s retried %d times before suc= cess\n", smp_processor_id(), watchdog->name, nretries); } - return true; + return WD_READ_SUCCESS; } + + /* + * Now compute delay in consecutive watchdog read to see if + * there is too much external interferences that cause + * significant delay in reading both clocksource and watchdog. + * + * If consecutive WD read-back delay > WATCHDOG_MAX_SKEW/2, + * report system busy, reinit the watchdog and skip the current + * watchdog test. + */ + wd_delta =3D clocksource_delta(wd_end2, wd_end, watchdog->mask); + wd_seq_delay =3D clocksource_cyc2ns(wd_delta, watchdog->mult, watchdog->= shift); + if (wd_seq_delay > WATCHDOG_MAX_SKEW/2) + goto skip_test; } =20 pr_warn("timekeeping watchdog on CPU%d: %s read-back delay of %lldns, att= empt %d, marking unstable\n", smp_processor_id(), watchdog->name, wd_delay, nretries); - return false; + return WD_READ_UNSTABLE; + +skip_test: + pr_info("timekeeping watchdog on CPU%d: %s wd-wd read-back delay of %lldn= s\n", + smp_processor_id(), watchdog->name, wd_seq_delay); + pr_info("wd-%s-wd read-back delay of %lldns, clock-skew test skipped!\n", + cs->name, wd_delay); + return WD_READ_SKIP; } =20 static u64 csnow_mid; @@ -356,6 +384,7 @@ static void clocksource_watchdog(struct timer_list *unu= sed) int next_cpu, reset_pending; int64_t wd_nsec, cs_nsec; struct clocksource *cs; + enum wd_read_status read_ret; u32 md; =20 spin_lock(&watchdog_lock); @@ -373,9 +402,12 @@ static void clocksource_watchdog(struct timer_list *un= used) continue; } =20 - if (!cs_watchdog_read(cs, &csnow, &wdnow)) { - /* Clock readout unreliable, so give it up. */ - __clocksource_unstable(cs); + read_ret =3D cs_watchdog_read(cs, &csnow, &wdnow); + + if (read_ret !=3D WD_READ_SUCCESS) { + if (read_ret =3D=3D WD_READ_UNSTABLE) + /* Clock readout unreliable, so give it up. */ + __clocksource_unstable(cs); continue; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C579CC433F5 for ; Mon, 24 Jan 2022 23:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362922AbiAXXnL (ORCPT ); Mon, 24 Jan 2022 18:43:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383495AbiAXXEV (ORCPT ); Mon, 24 Jan 2022 18:04:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9195C02B777; Mon, 24 Jan 2022 13:16:26 -0800 (PST) Received: from smtp.kernel.org (relay.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 5804B6141C; Mon, 24 Jan 2022 21:16:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39BA9C340E4; Mon, 24 Jan 2022 21:16:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058985; bh=1h+/Z/DAiDZoSEbnMDcCn4AXxNjDsVzS3lRJAXu21lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VvY9MmE4pxrvSfnEaJ/12RdDrp7GjIl7q5CCR9zqTRto5lxFDNBjeWmmXUh43WIsS FLFdj3OiLYEZ9hsQBsZGu6aB8ePhOaOC3hfFcji/ihSu/2BoC+aVeZVje+JkRxKHgY PeVyV3tFrqJRoF5dRw2uXmJTovOPiH0n0Wo0KzVg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bixuan Cui , Takashi Iwai , Sasha Levin Subject: [PATCH 5.16 0466/1039] ALSA: oss: fix compile error when OSS_DEBUG is enabled Date: Mon, 24 Jan 2022 19:37:35 +0100 Message-Id: <20220124184140.946282833@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bixuan Cui [ Upstream commit 8e7daf318d97f25e18b2fc7eb5909e34cd903575 ] Fix compile error when OSS_DEBUG is enabled: sound/core/oss/pcm_oss.c: In function 'snd_pcm_oss_set_trigger': sound/core/oss/pcm_oss.c:2055:10: error: 'substream' undeclared (first use in this function); did you mean 'csubstream'? pcm_dbg(substream->pcm, "pcm_oss: trigger =3D 0x%x\n", trigger); ^ Fixes: 61efcee8608c ("ALSA: oss: Use standard printk helpers") Signed-off-by: Bixuan Cui Link: https://lore.kernel.org/r/1638349134-110369-1-git-send-email-cuibixua= n@linux.alibaba.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/core/oss/pcm_oss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 20a0a4771b9a8..3ee9edf858156 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -2065,7 +2065,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss= _file *pcm_oss_file, int tr int err, cmd; =20 #ifdef OSS_DEBUG - pcm_dbg(substream->pcm, "pcm_oss: trigger =3D 0x%x\n", trigger); + pr_debug("pcm_oss: trigger =3D 0x%x\n", trigger); #endif =09 psubstream =3D pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41227C2BA4C for ; Mon, 24 Jan 2022 21:59:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574128AbiAXV6l (ORCPT ); Mon, 24 Jan 2022 16:58:41 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:39294 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358044AbiAXVQb (ORCPT ); Mon, 24 Jan 2022 16:16:31 -0500 Received: from smtp.kernel.org (relay.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 2671F61484; Mon, 24 Jan 2022 21:16:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32A19C340E4; Mon, 24 Jan 2022 21:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058988; bh=0mn07Z63UB9WDnRDyK8KAWId9NRvMSa9a8fRkkhTd6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1WYYDxYIwiBdDKG44Ou6Nvzvyfc/WtxSYU0TSFcmgj8si2atExbXCzDyas8Z9Edko Yiv6cWVRhBRpyhvVTqLA8/ex552bWcTgT2RKy6P/VyhyErwqgRlzxTzXz5Ev50lNoy acwW6BC0LK94UTnmh4ZKyJXdL9jWinfpQSFge9uY= 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.16 0467/1039] ALSA: usb-audio: Drop superfluous 0 in Presonus Studio 1810cs ID Date: Mon, 24 Jan 2022 19:37:36 +0100 Message-Id: <20220124184140.976598511@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 1e583aef12aa74afd37c1418255cc4b74e023236 ] The vendor ID of Presonus Studio 1810c had a superfluous '0' in its USB ID. Drop it. Fixes: 8dc5efe3d17c ("ALSA: usb-audio: Add support for Presonus Studio 1810= c") Link: https://lore.kernel.org/r/20211202083833.17784-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/usb/format.c | 2 +- sound/usb/mixer_quirks.c | 2 +- sound/usb/quirks.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/usb/format.c b/sound/usb/format.c index f5e676a51b30d..405dc0bf6678c 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -375,7 +375,7 @@ static int parse_uac2_sample_rate_range(struct snd_usb_= audio *chip, for (rate =3D min; rate <=3D max; rate +=3D res) { =20 /* Filter out invalid rates on Presonus Studio 1810c */ - if (chip->usb_id =3D=3D USB_ID(0x0194f, 0x010c) && + if (chip->usb_id =3D=3D USB_ID(0x194f, 0x010c) && !s1810c_valid_sample_rate(fp, rate)) goto skip_rate; =20 diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index 823b6b8de942d..d48729e6a3b0a 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c @@ -3254,7 +3254,7 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer= _interface *mixer) err =3D snd_rme_controls_create(mixer); break; =20 - case USB_ID(0x0194f, 0x010c): /* Presonus Studio 1810c */ + case USB_ID(0x194f, 0x010c): /* Presonus Studio 1810c */ err =3D snd_sc1810_init_mixer(mixer); break; case USB_ID(0x2a39, 0x3fb0): /* RME Babyface Pro FS */ diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 64e1c20311ed4..ab9f3da49941f 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1290,7 +1290,7 @@ int snd_usb_apply_interface_quirk(struct snd_usb_audi= o *chip, if (chip->usb_id =3D=3D USB_ID(0x0763, 0x2012)) return fasttrackpro_skip_setting_quirk(chip, iface, altno); /* presonus studio 1810c: skip altsets incompatible with device_setup */ - if (chip->usb_id =3D=3D USB_ID(0x0194f, 0x010c)) + if (chip->usb_id =3D=3D USB_ID(0x194f, 0x010c)) return s1810c_skip_setting_quirk(chip, iface, altno); =20 =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44D65C43219 for ; Mon, 24 Jan 2022 23:55:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365713AbiAXXvb (ORCPT ); Mon, 24 Jan 2022 18:51:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383497AbiAXXEV (ORCPT ); Mon, 24 Jan 2022 18:04:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB516C02B77C; Mon, 24 Jan 2022 13:16:33 -0800 (PST) Received: from smtp.kernel.org (relay.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 A4159B8123A; Mon, 24 Jan 2022 21:16:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03218C340E4; Mon, 24 Jan 2022 21:16:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058991; bh=kO9zzbykNvCY4rMFSnfyyyarik+GEjCV89BpyAmECy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tKdM25WUNw4wWiF5bRpZKo4mSts/s8W51miLE0sCu66GIKOY3LLYbUb50yJisugMO xQeOT1xWfFlj+80cYGAFq8be8kMNdKmvEwTxBQmZF7jGOEEkYgfbExKqfML2GIdzlB npov/h2wp9VUaOukz/EY57Db5fZGtpvf+r8A/kvE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Tanure , kernel test robot , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0468/1039] ASoC: amd: Fix dependency for SPI master Date: Mon, 24 Jan 2022 19:37:37 +0100 Message-Id: <20220124184141.014006048@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lucas Tanure [ Upstream commit 19a628d8f1a6c16263d8037a918427207c8a95a0 ] Set SPI_MASTER as dependency as is using CS35L41 SPI driver Fixes: 96792fdd77cd1 ("ASoC: amd: enable vangogh platform machine driver bu= ild") Signed-off-by: Lucas Tanure Reported-by: kernel test robot Link: https://lore.kernel.org/r/20211201180004.1402156-1-tanureal@opensourc= e.cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/amd/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig index 2c6af3f8f2961..ff535370e525a 100644 --- a/sound/soc/amd/Kconfig +++ b/sound/soc/amd/Kconfig @@ -68,7 +68,7 @@ config SND_SOC_AMD_VANGOGH_MACH tristate "AMD Vangogh support for NAU8821 CS35L41" select SND_SOC_NAU8821 select SND_SOC_CS35L41_SPI - depends on SND_SOC_AMD_ACP5x && I2C + depends on SND_SOC_AMD_ACP5x && I2C && SPI_MASTER help This option enables machine driver for Vangogh platform using NAU8821 and CS35L41 codecs. --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C1EDC43219 for ; Mon, 24 Jan 2022 21:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380203AbiAXV6h (ORCPT ); Mon, 24 Jan 2022 16:58:37 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:39474 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378272AbiAXVQn (ORCPT ); Mon, 24 Jan 2022 16:16:43 -0500 Received: from smtp.kernel.org (relay.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 CD078614A7; Mon, 24 Jan 2022 21:16:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABCEDC340E5; Mon, 24 Jan 2022 21:16:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058997; bh=jYIRWSiUZSWF2+JFSFBxoVE0otIiJf+SdqOpEdwYg0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vospIbfL5jk6eh3JRrdndDCN7esFnZ6gX6/yQMsXK0WOn+fTd4/De/Cdlim6VNo6F hD+hzmZjWGgeLGFgU+PkEdqOOzE2JirlapKlbg+vFtEbslz2sCuVlXm5zJt1KNj82e YuAfQ4AdwisPR5weeY/A5YCoBB1FVBoqliLKBk60= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.16 0469/1039] misc: at25: Make driver OF independent again Date: Mon, 24 Jan 2022 19:37:38 +0100 Message-Id: <20220124184141.044529893@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 5b557298d7d09cce04e0565a535fbca63661724a ] The commit f60e7074902a ("misc: at25: Make use of device property API") made a good job by enabling the driver for non-OF platforms, but the recent commit 604288bc6196 ("nvmem: eeprom: at25: fix type compiler warning= s") brought that back. Restore greatness of the driver once again. Fixes: eab61fb1cc2e ("nvmem: eeprom: at25: fram discovery simplification") Fixes: fd307a4ad332 ("nvmem: prepare basics for FRAM support") Acked-by: Arnd Bergmann Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20211125212729.86585-2-andriy.shevchenko@li= nux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/misc/eeprom/at25.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index b38978a3b3ffa..9193b812bc07e 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c @@ -17,8 +17,6 @@ #include #include #include -#include -#include #include =20 /* @@ -380,13 +378,14 @@ static int at25_probe(struct spi_device *spi) int sr; u8 id[FM25_ID_LEN]; u8 sernum[FM25_SN_LEN]; + bool is_fram; int i; - const struct of_device_id *match; - bool is_fram =3D 0; =20 - match =3D of_match_device(of_match_ptr(at25_of_match), &spi->dev); - if (match && !strcmp(match->compatible, "cypress,fm25")) - is_fram =3D 1; + err =3D device_property_match_string(&spi->dev, "compatible", "cypress,fm= 25"); + if (err >=3D 0) + is_fram =3D true; + else + is_fram =3D false; =20 at25 =3D devm_kzalloc(&spi->dev, sizeof(struct at25_data), GFP_KERNEL); if (!at25) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F34BC35274 for ; Mon, 24 Jan 2022 21:58:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575352AbiAXVvb (ORCPT ); Mon, 24 Jan 2022 16:51:31 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:39510 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389657AbiAXVQp (ORCPT ); Mon, 24 Jan 2022 16:16:45 -0500 Received: from smtp.kernel.org (relay.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 B4CBC612E9; Mon, 24 Jan 2022 21:16:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0E13C340E4; Mon, 24 Jan 2022 21:16:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059000; bh=0KD1eiKFQZ+15lvlwGjcpA2CZ9608oocxiXbhgHw+rM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G0GTUC07Rmybk5wv02//X2Inmzn27CN5fQvh6j5UiGhXzhJj5BWn78gqXmOq3nUyU sONXiDH//x35cG+CigXPfbY5gtvvp+NxcrlHvq4R6V1MCKCr9bNfMQ1W64Kyc44xBR akJYWKbN9Zn2BDd7RhlVEIoOeRysLMywqYjrvBeI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Sasha Levin Subject: [PATCH 5.16 0470/1039] char/mwave: Adjust io port register size Date: Mon, 24 Jan 2022 19:37:39 +0100 Message-Id: <20220124184141.076124919@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kees Cook [ Upstream commit f5912cc19acd7c24b2dbf65a6340bf194244f085 ] Using MKWORD() on a byte-sized variable results in OOB read. Expand the size of the reserved area so both MKWORD and MKBYTE continue to work without overflow. Silences this warning on a -Warray-bounds build: drivers/char/mwave/3780i.h:346:22: error: array subscript 'short unsigned i= nt[0]' is partly outside array bounds of 'DSP_ISA_SLAVE_CONTROL[1]' [-Werro= r=3Darray-bounds] 346 | #define MKWORD(var) (*((unsigned short *)(&var))) | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/char/mwave/3780i.h:356:40: note: in definition of macro 'OutWordDsp' 356 | #define OutWordDsp(index,value) outw(value,usDspBaseIO+index) | ^~~~~ drivers/char/mwave/3780i.c:373:41: note: in expansion of macro 'MKWORD' 373 | OutWordDsp(DSP_IsaSlaveControl, MKWORD(rSlaveControl)); | ^~~~~~ drivers/char/mwave/3780i.c:358:31: note: while referencing 'rSlaveControl' 358 | DSP_ISA_SLAVE_CONTROL rSlaveControl; | ^~~~~~~~~~~~~ Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20211203084206.3104326-1-keescook@chromium.= org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/char/mwave/3780i.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/mwave/3780i.h b/drivers/char/mwave/3780i.h index 9ccb6b270b071..95164246afd1a 100644 --- a/drivers/char/mwave/3780i.h +++ b/drivers/char/mwave/3780i.h @@ -68,7 +68,7 @@ typedef struct { unsigned char ClockControl:1; /* RW: Clock control: 0=3Dnormal, 1=3Dstop = 3780i clocks */ unsigned char SoftReset:1; /* RW: Soft reset 0=3Dnormal, 1=3Dsoft reset a= ctive */ unsigned char ConfigMode:1; /* RW: Configuration mode, 0=3Dnormal, 1=3Dco= nfig mode */ - unsigned char Reserved:5; /* 0: Reserved */ + unsigned short Reserved:13; /* 0: Reserved */ } DSP_ISA_SLAVE_CONTROL; =20 =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02712C433F5 for ; Mon, 24 Jan 2022 23:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362905AbiAXXnJ (ORCPT ); Mon, 24 Jan 2022 18:43:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383095AbiAXXFt (ORCPT ); Mon, 24 Jan 2022 18:05:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13B47C029806; Mon, 24 Jan 2022 13:16:44 -0800 (PST) Received: from smtp.kernel.org (relay.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 A7B27614A2; Mon, 24 Jan 2022 21:16:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CD62C340E4; Mon, 24 Jan 2022 21:16:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059003; bh=b/4IslJBEQd84GWcAJuYmPtCMrf3yVEFUlsk8XYbfeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uphsUpec/0KhYBHVUtps8afSOuABs0ddABO6DxCIkaa4dZNHHk8P9fHoUrE8KT00+ 4SFEm9CmdRibr7el0cKkLfYruF4yMECMhXYvLULR5xAd2e8IuqArgObN2bhgZffM0F PaV4lcsyrbYe0e8zEWleAodEEhqfJ1k/KYML7m+I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Christian Brauner , Todd Kjos , Sasha Levin Subject: [PATCH 5.16 0471/1039] binder: fix handling of error during copy Date: Mon, 24 Jan 2022 19:37:40 +0100 Message-Id: <20220124184141.109754699@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Todd Kjos [ Upstream commit fe6b1869243f23a485a106c214bcfdc7aa0ed593 ] If a memory copy function fails to copy the whole buffer, a positive integar with the remaining bytes is returned. In binder_translate_fd_array() this can result in an fd being skipped due to the failed copy, but the loop continues processing fds since the early return condition expects a negative integer on error. Fix by returning "ret > 0 ? -EINVAL : ret" to handle this case. Fixes: bb4a2e48d510 ("binder: return errors from buffer copy functions") Suggested-by: Dan Carpenter Acked-by: Christian Brauner Signed-off-by: Todd Kjos Link: https://lore.kernel.org/r/20211130185152.437403-2-tkjos@google.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/android/binder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index c75fb600740cc..7d29d3d931a79 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2269,8 +2269,8 @@ static int binder_translate_fd_array(struct binder_fd= _array_object *fda, if (!ret) ret =3D binder_translate_fd(fd, offset, t, thread, in_reply_to); - if (ret < 0) - return ret; + if (ret) + return ret > 0 ? -EINVAL : ret; } return 0; } --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C852C433EF for ; Mon, 24 Jan 2022 21:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575398AbiAXVvg (ORCPT ); Mon, 24 Jan 2022 16:51:36 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:39620 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449730AbiAXVQr (ORCPT ); Mon, 24 Jan 2022 16:16:47 -0500 Received: from smtp.kernel.org (relay.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 8386161491; Mon, 24 Jan 2022 21:16:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DF01C340E4; Mon, 24 Jan 2022 21:16:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059006; bh=dMH0TrLfYPk5E/hAHhxg0Py6sv4hdcdjMM7UmDRYzEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u5Oms+egUCbPTZZvRf3+YSewlziFMWOrLC2IfKvYGdjqlo63zsd2xF3ejcQjLPJf/ nWq6xPfAfuGBRcSZouGNR+JkANGxFhXUWW8VWA6ST3MpMua8Z+PcIK8UunTwicJKiS DB/KgjhR7IekwB3yY4wDAMpElCOxRHXn9FEk+aeQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martijn Coenen , Christian Brauner , Todd Kjos , Sasha Levin Subject: [PATCH 5.16 0472/1039] binder: avoid potential data leakage when copying txn Date: Mon, 24 Jan 2022 19:37:41 +0100 Message-Id: <20220124184141.140445442@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Todd Kjos [ Upstream commit 6d98eb95b450a75adb4516a1d33652dc78d2b20c ] Transactions are copied from the sender to the target first and objects like BINDER_TYPE_PTR and BINDER_TYPE_FDA are then fixed up. This means there is a short period where the sender's version of these objects are visible to the target prior to the fixups. Instead of copying all of the data first, copy data only after any needed fixups have been applied. Fixes: 457b9a6f09f0 ("Staging: android: add binder driver") Reviewed-by: Martijn Coenen Acked-by: Christian Brauner Signed-off-by: Todd Kjos Link: https://lore.kernel.org/r/20211130185152.437403-3-tkjos@google.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/android/binder.c | 94 ++++++++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 24 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 7d29d3d931a79..99ae919255f4d 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -1608,15 +1608,21 @@ static void binder_cleanup_transaction(struct binde= r_transaction *t, /** * binder_get_object() - gets object and checks for valid metadata * @proc: binder_proc owning the buffer + * @u: sender's user pointer to base of buffer * @buffer: binder_buffer that we're parsing. * @offset: offset in the @buffer at which to validate an object. * @object: struct binder_object to read into * - * Return: If there's a valid metadata object at @offset in @buffer, the + * Copy the binder object at the given offset into @object. If @u is + * provided then the copy is from the sender's buffer. If not, then + * it is copied from the target's @buffer. + * + * Return: If there's a valid metadata object at @offset, the * size of that object. Otherwise, it returns zero. The object * is read into the struct binder_object pointed to by @object. */ static size_t binder_get_object(struct binder_proc *proc, + const void __user *u, struct binder_buffer *buffer, unsigned long offset, struct binder_object *object) @@ -1626,10 +1632,16 @@ static size_t binder_get_object(struct binder_proc = *proc, size_t object_size =3D 0; =20 read_size =3D min_t(size_t, sizeof(*object), buffer->data_size - offset); - if (offset > buffer->data_size || read_size < sizeof(*hdr) || - binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, - offset, read_size)) + if (offset > buffer->data_size || read_size < sizeof(*hdr)) return 0; + if (u) { + if (copy_from_user(object, u + offset, read_size)) + return 0; + } else { + if (binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, + offset, read_size)) + return 0; + } =20 /* Ok, now see if we read a complete object. */ hdr =3D &object->hdr; @@ -1702,7 +1714,7 @@ static struct binder_buffer_object *binder_validate_p= tr( b, buffer_offset, sizeof(object_offset))) return NULL; - object_size =3D binder_get_object(proc, b, object_offset, object); + object_size =3D binder_get_object(proc, NULL, b, object_offset, object); if (!object_size || object->hdr.type !=3D BINDER_TYPE_PTR) return NULL; if (object_offsetp) @@ -1767,7 +1779,8 @@ static bool binder_validate_fixup(struct binder_proc = *proc, unsigned long buffer_offset; struct binder_object last_object; struct binder_buffer_object *last_bbo; - size_t object_size =3D binder_get_object(proc, b, last_obj_offset, + size_t object_size =3D binder_get_object(proc, NULL, b, + last_obj_offset, &last_object); if (object_size !=3D sizeof(*last_bbo)) return false; @@ -1882,7 +1895,7 @@ static void binder_transaction_buffer_release(struct = binder_proc *proc, if (!binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, buffer, buffer_offset, sizeof(object_offset))) - object_size =3D binder_get_object(proc, buffer, + object_size =3D binder_get_object(proc, NULL, buffer, object_offset, &object); if (object_size =3D=3D 0) { pr_err("transaction release %d bad object at offset %lld, size %zd\n", @@ -2455,6 +2468,7 @@ static void binder_transaction(struct binder_proc *pr= oc, binder_size_t off_start_offset, off_end_offset; binder_size_t off_min; binder_size_t sg_buf_offset, sg_buf_end_offset; + binder_size_t user_offset =3D 0; struct binder_proc *target_proc =3D NULL; struct binder_thread *target_thread =3D NULL; struct binder_node *target_node =3D NULL; @@ -2469,6 +2483,8 @@ static void binder_transaction(struct binder_proc *pr= oc, int t_debug_id =3D atomic_inc_return(&binder_last_id); char *secctx =3D NULL; u32 secctx_sz =3D 0; + const void __user *user_buffer =3D (const void __user *) + (uintptr_t)tr->data.ptr.buffer; =20 e =3D binder_transaction_log_add(&binder_transaction_log); e->debug_id =3D t_debug_id; @@ -2780,19 +2796,6 @@ static void binder_transaction(struct binder_proc *p= roc, t->buffer->clear_on_free =3D !!(t->flags & TF_CLEAR_BUF); trace_binder_transaction_alloc_buf(t->buffer); =20 - if (binder_alloc_copy_user_to_buffer( - &target_proc->alloc, - t->buffer, 0, - (const void __user *) - (uintptr_t)tr->data.ptr.buffer, - tr->data_size)) { - binder_user_error("%d:%d got transaction with invalid data ptr\n", - proc->pid, thread->pid); - return_error =3D BR_FAILED_REPLY; - return_error_param =3D -EFAULT; - return_error_line =3D __LINE__; - goto err_copy_data_failed; - } if (binder_alloc_copy_user_to_buffer( &target_proc->alloc, t->buffer, @@ -2837,6 +2840,7 @@ static void binder_transaction(struct binder_proc *pr= oc, size_t object_size; struct binder_object object; binder_size_t object_offset; + binder_size_t copy_size; =20 if (binder_alloc_copy_from_buffer(&target_proc->alloc, &object_offset, @@ -2848,8 +2852,27 @@ static void binder_transaction(struct binder_proc *p= roc, return_error_line =3D __LINE__; goto err_bad_offset; } - object_size =3D binder_get_object(target_proc, t->buffer, - object_offset, &object); + + /* + * Copy the source user buffer up to the next object + * that will be processed. + */ + copy_size =3D object_offset - user_offset; + if (copy_size && (user_offset > object_offset || + binder_alloc_copy_user_to_buffer( + &target_proc->alloc, + t->buffer, user_offset, + user_buffer + user_offset, + copy_size))) { + binder_user_error("%d:%d got transaction with invalid data ptr\n", + proc->pid, thread->pid); + return_error =3D BR_FAILED_REPLY; + return_error_param =3D -EFAULT; + return_error_line =3D __LINE__; + goto err_copy_data_failed; + } + object_size =3D binder_get_object(target_proc, user_buffer, + t->buffer, object_offset, &object); if (object_size =3D=3D 0 || object_offset < off_min) { binder_user_error("%d:%d got transaction with invalid offset (%lld, min= %lld max %lld) or object.\n", proc->pid, thread->pid, @@ -2861,6 +2884,11 @@ static void binder_transaction(struct binder_proc *p= roc, return_error_line =3D __LINE__; goto err_bad_offset; } + /* + * Set offset to the next buffer fragment to be + * copied + */ + user_offset =3D object_offset + object_size; =20 hdr =3D &object.hdr; off_min =3D object_offset + object_size; @@ -2956,9 +2984,14 @@ static void binder_transaction(struct binder_proc *p= roc, } ret =3D binder_translate_fd_array(fda, parent, t, thread, in_reply_to); - if (ret < 0) { + if (!ret) + ret =3D binder_alloc_copy_to_buffer(&target_proc->alloc, + t->buffer, + object_offset, + fda, sizeof(*fda)); + if (ret) { return_error =3D BR_FAILED_REPLY; - return_error_param =3D ret; + return_error_param =3D ret > 0 ? -EINVAL : ret; return_error_line =3D __LINE__; goto err_translate_failed; } @@ -3028,6 +3061,19 @@ static void binder_transaction(struct binder_proc *p= roc, goto err_bad_object_type; } } + /* Done processing objects, copy the rest of the buffer */ + if (binder_alloc_copy_user_to_buffer( + &target_proc->alloc, + t->buffer, user_offset, + user_buffer + user_offset, + tr->data_size - user_offset)) { + binder_user_error("%d:%d got transaction with invalid data ptr\n", + proc->pid, thread->pid); + return_error =3D BR_FAILED_REPLY; + return_error_param =3D -EFAULT; + return_error_line =3D __LINE__; + goto err_copy_data_failed; + } if (t->buffer->oneway_spam_suspect) tcomplete->type =3D BINDER_WORK_TRANSACTION_ONEWAY_SPAM_SUSPECT; else --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 292BBC4332F for ; Mon, 24 Jan 2022 21:55:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575384AbiAXVve (ORCPT ); Mon, 24 Jan 2022 16:51:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:36490 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449749AbiAXVQv (ORCPT ); Mon, 24 Jan 2022 16:16:51 -0500 Received: from smtp.kernel.org (relay.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 3F56EB8123A; Mon, 24 Jan 2022 21:16:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F0B8C340E9; Mon, 24 Jan 2022 21:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059008; bh=8RebVPnGQbTuBjYXPFFVIGJcwMDv/Hu35mDAL/+P9Cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k51OYnIdj5i2lWndyBO/y/RNaWkzTXD+5fPhyV2mgsJsRcN6AXjou+hXemXhy8/6g HWbsMCFF7clz/75szAZ/xvXJTNgF3uyGxb+v5VtPxdS5L4WRdu8qA4tUZ3faUlhcwG wktQRjkqNHFpEmONhxDxuI5stuqV+2jNzjARIItY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Landley , Arnd Bergmann , Stafford Horne , Sasha Levin Subject: [PATCH 5.16 0473/1039] openrisc: Add clone3 ABI wrapper Date: Mon, 24 Jan 2022 19:37:42 +0100 Message-Id: <20220124184141.172946221@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 433fe39f674d58bc7a3e8254a5d2ffc290b7e04e ] Like fork and clone the clone3 syscall needs a wrapper to save callee saved registers, which is required by the OpenRISC ABI. This came up after auditing code following a discussion with Rob Landley and Arnd Bergmann [0]. Tested with the clone3 kselftests and there were no issues. [0] https://lore.kernel.org/all/41206fc7-f8ce-98aa-3718-ba3e1431e320@landle= y.net/T/#m9c0cdb2703813b9df4da04cf6b30de1f1aa89944 Fixes: 07e83dfbe16c ("openrisc: Enable the clone3 syscall") Cc: Rob Landley Cc: Arnd Bergmann Signed-off-by: Stafford Horne Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/openrisc/include/asm/syscalls.h | 2 ++ arch/openrisc/kernel/entry.S | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/arch/openrisc/include/asm/syscalls.h b/arch/openrisc/include/a= sm/syscalls.h index 3a7eeae6f56a8..aa1c7e98722e3 100644 --- a/arch/openrisc/include/asm/syscalls.h +++ b/arch/openrisc/include/asm/syscalls.h @@ -22,9 +22,11 @@ asmlinkage long sys_or1k_atomic(unsigned long type, unsi= gned long *v1, =20 asmlinkage long __sys_clone(unsigned long clone_flags, unsigned long newsp, void __user *parent_tid, void __user *child_tid, int tls); +asmlinkage long __sys_clone3(struct clone_args __user *uargs, size_t size); asmlinkage long __sys_fork(void); =20 #define sys_clone __sys_clone +#define sys_clone3 __sys_clone3 #define sys_fork __sys_fork =20 #endif /* __ASM_OPENRISC_SYSCALLS_H */ diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S index 59c6d3aa7081e..dc5b45e9e72b5 100644 --- a/arch/openrisc/kernel/entry.S +++ b/arch/openrisc/kernel/entry.S @@ -1170,6 +1170,11 @@ ENTRY(__sys_clone) l.j _fork_save_extra_regs_and_call l.nop =20 +ENTRY(__sys_clone3) + l.movhi r29,hi(sys_clone3) + l.j _fork_save_extra_regs_and_call + l.ori r29,r29,lo(sys_clone3) + ENTRY(__sys_fork) l.movhi r29,hi(sys_fork) l.ori r29,r29,lo(sys_fork) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03C8AC43217 for ; Mon, 24 Jan 2022 23:57:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366019AbiAXXwJ (ORCPT ); Mon, 24 Jan 2022 18:52:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845355AbiAXXMI (ORCPT ); Mon, 24 Jan 2022 18:12:08 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B04DEC067A44; Mon, 24 Jan 2022 13:19:02 -0800 (PST) Received: from smtp.kernel.org (relay.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 4FC7761469; Mon, 24 Jan 2022 21:19:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29807C340E5; Mon, 24 Jan 2022 21:19:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059141; bh=QGCFPH1WYvDgr9p4O+VQEVXKCX82xetHO6mmGWOWw2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=swGStBzQ+zlmn9eToWmrcllx0TqZ2ZFgOQxv14PT+sPSTDzOCB2aDbEOhSzpf8FlN uOG0nd7gWda3gmmoMblf62BvdTeui2hmoYOvAdcuxNHRoyHFvDGcxXzje7Kww7Jjlg vf7/qwMWchZk+D0ROlZSXCfbUVMd7/GfZSrZYHHM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Sasha Levin Subject: [PATCH 5.16 0474/1039] uio: uio_dmem_genirq: Catch the Exception Date: Mon, 24 Jan 2022 19:37:43 +0100 Message-Id: <20220124184141.205188392@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit eec91694f927d1026974444eb6a3adccd4f1cbc2 ] The return value of dma_set_coherent_mask() is not always 0. To catch the exception in case that dma is not support the mask. Fixes: 0a0c3b5a24bd ("Add new uio device for dynamic memory allocation") Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20211204000326.1592687-1-jiasheng@iscas.ac.= cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/uio/uio_dmem_genirq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c index 6b5cfa5b06733..1106f33764047 100644 --- a/drivers/uio/uio_dmem_genirq.c +++ b/drivers/uio/uio_dmem_genirq.c @@ -188,7 +188,11 @@ static int uio_dmem_genirq_probe(struct platform_devic= e *pdev) return -ENOMEM; } =20 - dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); + ret =3D dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&pdev->dev, "DMA enable failed\n"); + return ret; + } =20 priv->uioinfo =3D uioinfo; spin_lock_init(&priv->lock); --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F1A1C433EF for ; Mon, 24 Jan 2022 23:54:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365614AbiAXXvW (ORCPT ); Mon, 24 Jan 2022 18:51:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843795AbiAXXGY (ORCPT ); Mon, 24 Jan 2022 18:06:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EAE7C06E035; Mon, 24 Jan 2022 13:17:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 C217B61320; Mon, 24 Jan 2022 21:17:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9853CC340E5; Mon, 24 Jan 2022 21:17:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059033; bh=jD2m76gJr8SX4WVu10homi6mG4H+RudfTZtcaIyUIs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PAUuAApCIfiVP6w82P88Yd0DVqeC5pguIGejrWRW+b6KV0FBHMMkl0AV94GRnmGmz I7qZLDHDQokZhg4V7QazB2E506/ki3sARU5pSTNG1ljuGOuVgO+i7ZRzGNg79Ty0QL 39+nS8lnjRR3O0YBkAT5G8NQBeV1D7ihOztCz8Ug= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ashish Mhetre , Lu Baolu , Joerg Roedel , Sasha Levin Subject: [PATCH 5.16 0475/1039] iommu: Extend mutex lock scope in iommu_probe_device() Date: Mon, 24 Jan 2022 19:37:44 +0100 Message-Id: <20220124184141.239324386@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lu Baolu [ Upstream commit 556f99ac886635e8da15528995f06d1d7028cfca ] Extend the scope of holding group->mutex so that it can cover the default domain check/attachment and direct mappings of reserved regions. Cc: Ashish Mhetre Fixes: 211ff31b3d33b ("iommu: Fix race condition during default domain allo= cation") Signed-off-by: Lu Baolu Link: https://lore.kernel.org/r/20211108061349.1985579-1-baolu.lu@linux.int= el.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iommu/iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index dd7863e453a5f..8b86406b71627 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -288,11 +288,11 @@ int iommu_probe_device(struct device *dev) */ mutex_lock(&group->mutex); iommu_alloc_default_domain(group, dev); - mutex_unlock(&group->mutex); =20 if (group->default_domain) { ret =3D __iommu_attach_device(group->default_domain, dev); if (ret) { + mutex_unlock(&group->mutex); iommu_group_put(group); goto err_release; } @@ -300,6 +300,7 @@ int iommu_probe_device(struct device *dev) =20 iommu_create_device_direct_mappings(group, dev); =20 + mutex_unlock(&group->mutex); iommu_group_put(group); =20 if (ops->probe_finalize) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EF38C46467 for ; Mon, 24 Jan 2022 22:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450423AbiAXWD2 (ORCPT ); Mon, 24 Jan 2022 17:03:28 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37392 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377231AbiAXVRu (ORCPT ); Mon, 24 Jan 2022 16:17:50 -0500 Received: from smtp.kernel.org (relay.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 D9BFFB81188; Mon, 24 Jan 2022 21:17:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0571AC340E4; Mon, 24 Jan 2022 21:17:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059066; bh=eXld64SAj0/uBme7zFW+YGIPcTAU5bs5ccJa8NjUrcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mLa9tCdHORe/pKLsgK4jEF02WRtUT1M6we7t/VRZxarZAIiCsH23KxO8dmIxZFyUw i9AUzFpI6HPMcLTJ1PkxXHv5S1Am45jvACsrUKNqP8xYm1ledgASo12ANZUzdf9R0i ZJR99UJKfDpCAwb9HFuSe1mwq1Cukr07WM08/Cqo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Murphy , Hector Martin , Joerg Roedel , Sasha Levin Subject: [PATCH 5.16 0476/1039] iommu/io-pgtable-arm: Fix table descriptor paddr formatting Date: Mon, 24 Jan 2022 19:37:45 +0100 Message-Id: <20220124184141.276711853@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 9abe2ac834851a7d0b0756e295cf7a292c45ca53 ] Table descriptors were being installed without properly formatting the address using paddr_to_iopte, which does not match up with the iopte_deref in __arm_lpae_map. This is incorrect for the LPAE pte format, as it does not handle the high bits properly. This was found on Apple T6000 DARTs, which require a new pte format (different shift); adding support for that to paddr_to_iopte/iopte_to_paddr caused it to break badly, as even <48-bit addresses would end up incorrect in that case. Fixes: 6c89928ff7a0 ("iommu/io-pgtable-arm: Support 52-bit physical address= ") Acked-by: Robin Murphy Signed-off-by: Hector Martin Link: https://lore.kernel.org/r/20211120031343.88034-1-marcan@marcan.st Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iommu/io-pgtable-arm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index dd9e47189d0d9..94ff319ae8acc 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -315,11 +315,12 @@ static int arm_lpae_init_pte(struct arm_lpae_io_pgtab= le *data, static arm_lpae_iopte arm_lpae_install_table(arm_lpae_iopte *table, arm_lpae_iopte *ptep, arm_lpae_iopte curr, - struct io_pgtable_cfg *cfg) + struct arm_lpae_io_pgtable *data) { arm_lpae_iopte old, new; + struct io_pgtable_cfg *cfg =3D &data->iop.cfg; =20 - new =3D __pa(table) | ARM_LPAE_PTE_TYPE_TABLE; + new =3D paddr_to_iopte(__pa(table), data) | ARM_LPAE_PTE_TYPE_TABLE; if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_NS) new |=3D ARM_LPAE_PTE_NSTABLE; =20 @@ -380,7 +381,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *d= ata, unsigned long iova, if (!cptep) return -ENOMEM; =20 - pte =3D arm_lpae_install_table(cptep, ptep, 0, cfg); + pte =3D arm_lpae_install_table(cptep, ptep, 0, data); if (pte) __arm_lpae_free_pages(cptep, tblsz, cfg); } else if (!cfg->coherent_walk && !(pte & ARM_LPAE_PTE_SW_SYNC)) { @@ -592,7 +593,7 @@ static size_t arm_lpae_split_blk_unmap(struct arm_lpae_= io_pgtable *data, __arm_lpae_init_pte(data, blk_paddr, pte, lvl, 1, &tablep[i]); } =20 - pte =3D arm_lpae_install_table(tablep, ptep, blk_pte, cfg); + pte =3D arm_lpae_install_table(tablep, ptep, blk_pte, data); if (pte !=3D blk_pte) { __arm_lpae_free_pages(tablep, tablesz, cfg); /* --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85B27C4332F for ; Mon, 24 Jan 2022 23:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362706AbiAXXmr (ORCPT ); Mon, 24 Jan 2022 18:42:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844758AbiAXXKO (ORCPT ); Mon, 24 Jan 2022 18:10:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42967C0A0284; Mon, 24 Jan 2022 13:18:21 -0800 (PST) Received: from smtp.kernel.org (relay.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 D3F75611C8; Mon, 24 Jan 2022 21:18:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1E48C340E5; Mon, 24 Jan 2022 21:18:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059100; bh=4mLwih6tINbnvNP9necaLO4eAyc9DYsXQyBja+Tq//0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jckyOONsxDprXKzOcQlMKnJgyUgovA5pOaYf09GCh/Ai1MporJpR50kJpN3A2gDSo 4hJYt+bQ/GgUImRWbB20jX2LhuMuSaCx+qdF3rOEVe+1I+kJjg/tAQNiYVNrtVIFWC wRmjwEljWB80rvf/QdXHafy9aDAqakV+agZI7Uvo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Pierre-Louis Bossart , Kai Vehmanen , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0477/1039] ASoC: SOF: Intel: fix build issue related to CODEC_PROBE_ENTRIES Date: Mon, 24 Jan 2022 19:37:46 +0100 Message-Id: <20220124184141.307544345@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Vehmanen [ Upstream commit 9a83dfcc5ae8230fbf12b63e281d5bb8450ec0e7 ] Fix following error: sound/soc/sof/intel/hda-codec.c:132:35: error: use of undeclared identifier= 'CODEC_PROBE_RETRIES' Found with config: i386-randconfig-r033-20211202 (https://download.01.org/0day-ci/archive/20211203/202112031943.Twg19fWT-lkp= @intel.com/config) Fixes: 046aede2f847 ("ASoC: SOF: Intel: Retry codec probing if it fails") Reported-by: kernel test robot Reviewed-by: Pierre-Louis Bossart Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20211203154721.923496-1-kai.vehmanen@linux.= intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/sof/intel/hda-codec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-code= c.c index 13cd96e6724a4..2f3f4a733d9e6 100644 --- a/sound/soc/sof/intel/hda-codec.c +++ b/sound/soc/sof/intel/hda-codec.c @@ -20,9 +20,10 @@ #include "../../codecs/hdac_hda.h" #endif /* CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC */ =20 +#define CODEC_PROBE_RETRIES 3 + #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) #define IDISP_VID_INTEL 0x80860000 -#define CODEC_PROBE_RETRIES 3 =20 /* load the legacy HDA codec driver */ static int request_codec_module(struct hda_codec *codec) --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4943C433EF for ; Mon, 24 Jan 2022 23:54:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365337AbiAXXum (ORCPT ); Mon, 24 Jan 2022 18:50:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844845AbiAXXK3 (ORCPT ); Mon, 24 Jan 2022 18:10:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA7BAC0A02A2; Mon, 24 Jan 2022 13:18:44 -0800 (PST) Received: from smtp.kernel.org (relay.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 73ADFB811A2; Mon, 24 Jan 2022 21:18:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82E53C340E4; Mon, 24 Jan 2022 21:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059122; bh=sucli1En9E5u5z1IFzbW2r+q38biCmwZYxb30OlR7yk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kL7Fy10sQnqKnu4NDhJvaE4DxZVWJG24y0EnhlEPZd4Scp4yTesFemRAl3T3jkLlG KOEaEMlJ8iXvYzLxh71pXZhDBfCAEMO4p0QvJrUjQE6LOJf4v7vlixr9sC18COdzg3 webFSXJboG2BrBFUN+SirGgk6w9GixAltKGXoBDE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hannes Reinecke , Sumanesh Samanta , Bean Huo , Ming Lei , Bart Van Assche , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 0478/1039] scsi: core: Fix scsi_device_max_queue_depth() Date: Mon, 24 Jan 2022 19:37:47 +0100 Message-Id: <20220124184141.339832686@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit 4bc3bffc1a885eb5cb259e4a25146a4c7b1034e3 ] The comment above scsi_device_max_queue_depth() and also the description of commit ca4453213951 ("scsi: core: Make sure sdev->queue_depth is <=3D max(shost->can_queue, 1024)") contradict the implementation of the function scsi_device_max_queue_depth(). Additionally, the maximum queue depth of a SCSI LUN never exceeds host->can_queue. Fix scsi_device_max_queue_depth() by changing max_t() into min_t(). Link: https://lore.kernel.org/r/20211203231950.193369-2-bvanassche@acm.org Fixes: ca4453213951 ("scsi: core: Make sure sdev->queue_depth is <=3D max(s= host->can_queue, 1024)") Cc: Hannes Reinecke Cc: Sumanesh Samanta Tested-by: Bean Huo Reviewed-by: Ming Lei Reviewed-by: Bean Huo Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/scsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index f6af1562cba49..10e5bffc34aaf 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -201,11 +201,11 @@ void scsi_finish_command(struct scsi_cmnd *cmd) =20 =20 /* - * 1024 is big enough for saturating the fast scsi LUN now + * 1024 is big enough for saturating fast SCSI LUNs. */ int scsi_device_max_queue_depth(struct scsi_device *sdev) { - return max_t(int, sdev->host->can_queue, 1024); + return min_t(int, sdev->host->can_queue, 1024); } =20 /** --=20 2.34.1 From nobody Tue Jun 30 05:22:26 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E28D8C4332F for ; Mon, 24 Jan 2022 23:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2363116AbiAXXnk (ORCPT ); Mon, 24 Jan 2022 18:43:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845250AbiAXXLz (ORCPT ); Mon, 24 Jan 2022 18:11:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C823BC0A02AC; Mon, 24 Jan 2022 13:18:48 -0800 (PST) Received: from smtp.kernel.org (relay.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 F13BEB80FA1; Mon, 24 Jan 2022 21:18:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2679BC340E4; Mon, 24 Jan 2022 21:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059125; bh=bKvUykkz+KduKvfpk3zvPSY4ukBWhuGAf3eo5VAQFFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SlGCljlW4yuRVYWemOk+nm9PzBJRddwjeFSryF6019W0mZBQbsEPkfMqayUDvFSHG 2D0Y0FiDC2lYc9VqzTozfxWhVtK7OKAS1ngr8MlLTpyMx5P2Cr/AUMm6MkDI3fx+g0 s/3j/wUdW79Rd/RBClw4+BCyaCppfOMhDrL3yMGM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Dobriyan , Bean Huo , Bart Van Assche , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 0479/1039] scsi: ufs: Fix race conditions related to driver data Date: Mon, 24 Jan 2022 19:37:48 +0100 Message-Id: <20220124184141.372234326@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit 21ad0e49085deb22c094f91f9da57319a97188e4 ] The driver data pointer must be set before any callbacks are registered that use that pointer. Hence move the initialization of that pointer from after the ufshcd_init() call to inside ufshcd_init(). Link: https://lore.kernel.org/r/20211203231950.193369-7-bvanassche@acm.org Fixes: 3b1d05807a9a ("[SCSI] ufs: Segregate PCI Specific Code") Reported-by: Alexey Dobriyan Tested-by: Bean Huo Reviewed-by: Bean Huo Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/ufs/tc-dwc-g210-pci.c | 1 - drivers/scsi/ufs/ufshcd-pci.c | 2 -- drivers/scsi/ufs/ufshcd-pltfrm.c | 2 -- drivers/scsi/ufs/ufshcd.c | 7 +++++++ 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/tc-dwc-g210-pci.c b/drivers/scsi/ufs/tc-dwc-g= 210-pci.c index 679289e1a78e6..7b08e2e07cc5f 100644 --- a/drivers/scsi/ufs/tc-dwc-g210-pci.c +++ b/drivers/scsi/ufs/tc-dwc-g210-pci.c @@ -110,7 +110,6 @@ tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struc= t pci_device_id *id) return err; } =20 - pci_set_drvdata(pdev, hba); pm_runtime_put_noidle(&pdev->dev); pm_runtime_allow(&pdev->dev); =20 diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index f725248ba57f4..f76692053ca17 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -538,8 +538,6 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci= _device_id *id) return err; } =20 - pci_set_drvdata(pdev, hba); - hba->vops =3D (struct ufs_hba_variant_ops *)id->driver_data; =20 err =3D ufshcd_init(hba, mmio_base, pdev->irq); diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-plt= frm.c index eaeae83b999fd..8b16bbbcb806c 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -361,8 +361,6 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, goto dealloc_host; } =20 - platform_set_drvdata(pdev, hba); - pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); =20 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 13c09dbd99b92..4394081806978 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -9486,6 +9486,13 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *m= mio_base, unsigned int irq) struct device *dev =3D hba->dev; char eh_wq_name[sizeof("ufs_eh_wq_00")]; =20 + /* + * dev_set_drvdata() must be called before any callbacks are registered + * that use dev_get_drvdata() (frequency scaling, clock scaling, hwmon, + * sysfs). + */ + dev_set_drvdata(dev, hba); + if (!mmio_base) { dev_err(hba->dev, "Invalid memory reference for mmio_base is NULL\n"); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C92FC433EF for ; Mon, 24 Jan 2022 23:57:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365966AbiAXXwD (ORCPT ); Mon, 24 Jan 2022 18:52:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845252AbiAXXLz (ORCPT ); Mon, 24 Jan 2022 18:11:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C412C0A02AE; Mon, 24 Jan 2022 13:18:50 -0800 (PST) Received: from smtp.kernel.org (relay.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 E6CC3B811A2; Mon, 24 Jan 2022 21:18:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1064DC340E4; Mon, 24 Jan 2022 21:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059128; bh=vM/wn0gzeh2We6o+cpyhxuqY+/RcIVZXWMkfQnZOjK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GHQ8mk2H6m42L/WyJg+wHVTMXoVrgwxb8IyUESXDa9zkiRPvilwq+F1kJWleaUsv5 zOuOX0OfAgAkSI8299wCxsNeDFBFB5UrndeOXn+mjkiuRENmcGhVF7qoIKr8d2nGkz XUVvWntzZTI0V47eGo2uSik+2EiF/udsONHv35uU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kamal Heib , =?UTF-8?q?Michal=20Kalderon=C2=A0?= , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.16 0480/1039] RDMA/qedr: Fix reporting max_{send/recv}_wr attrs Date: Mon, 24 Jan 2022 19:37:49 +0100 Message-Id: <20220124184141.404989772@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Kamal Heib [ Upstream commit b1a4da64bfc189510e08df1ccb1c589e667dc7a3 ] Fix the wrongly reported max_send_wr and max_recv_wr attributes for user QP by making sure to save their valuse on QP creation, so when query QP is called the attributes will be reported correctly. Fixes: cecbcddf6461 ("qedr: Add support for QP verbs") Link: https://lore.kernel.org/r/20211206201314.124947-1-kamalheib1@gmail.com Signed-off-by: Kamal Heib Acked-by: Michal Kalderon=C2=A0 Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/infiniband/hw/qedr/verbs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qed= r/verbs.c index 9100009f0a23d..a53476653b0d9 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c @@ -1931,6 +1931,7 @@ static int qedr_create_user_qp(struct qedr_dev *dev, /* db offset was calculated in copy_qp_uresp, now set in the user q */ if (qedr_qp_has_sq(qp)) { qp->usq.db_addr =3D ctx->dpi_addr + uresp.sq_db_offset; + qp->sq.max_wr =3D attrs->cap.max_send_wr; rc =3D qedr_db_recovery_add(dev, qp->usq.db_addr, &qp->usq.db_rec_data->db_data, DB_REC_WIDTH_32B, @@ -1941,6 +1942,7 @@ static int qedr_create_user_qp(struct qedr_dev *dev, =20 if (qedr_qp_has_rq(qp)) { qp->urq.db_addr =3D ctx->dpi_addr + uresp.rq_db_offset; + qp->rq.max_wr =3D attrs->cap.max_recv_wr; rc =3D qedr_db_recovery_add(dev, qp->urq.db_addr, &qp->urq.db_rec_data->db_data, DB_REC_WIDTH_32B, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C25BDC3526F for ; Mon, 24 Jan 2022 23:55:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365937AbiAXXwA (ORCPT ); Mon, 24 Jan 2022 18:52:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845261AbiAXXLz (ORCPT ); Mon, 24 Jan 2022 18:11:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 636FCC0A02B2; Mon, 24 Jan 2022 13:18:54 -0800 (PST) Received: from smtp.kernel.org (relay.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 2C5BDB8123A; Mon, 24 Jan 2022 21:18:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DA99C340E4; Mon, 24 Jan 2022 21:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059131; bh=5bUKsrqF9mbHtV4XlYG05/ugAg6Jo+Sb90uYqTfChFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nop0maVa6lVucsRkAhc4uy2PU9je0gp9SaGJ3jPPcUZ41rZWiFUeScC18O+RUsKLq H2HNZOCSgOtuSoc2U8VMCVb5OygtO88SbrIHq79CQUb2u5+lawc0SdbJMtpdPorfWg HZGq0gR8Ep+ChLIsUIi+aG8l7sLSZauY280bnnHM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Juergen Gross , Jason Gunthorpe , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.16 0481/1039] PCI/MSI: Fix pci_irq_vector()/pci_irq_get_affinity() Date: Mon, 24 Jan 2022 19:37:50 +0100 Message-Id: <20220124184141.435262990@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit 29bbc35e29d9b6347780dcacde2deb4b39344167 ] pci_irq_vector() and pci_irq_get_affinity() use the list position to find t= he MSI-X descriptor at a given index. That's correct for the normal case where the entry number is the same as the list position. But it's wrong for cases where MSI-X was allocated with an entries array describing sparse entry numbers into the hardware message descriptor table. That's inconsistent at best. Make it always check the entry number because that's what the zero base index really means. This change won't break existing users which use a sparse entries array for allocation because these users retrieve the Linux interrupt number from the entries array after allocation and none of them uses pci_irq_vector() or pci_irq_get_affinity(). Fixes: aff171641d18 ("PCI: Provide sensible IRQ vector alloc/free routines") Signed-off-by: Thomas Gleixner Tested-by: Juergen Gross Reviewed-by: Jason Gunthorpe Acked-by: Bjorn Helgaas Link: https://lore.kernel.org/r/20211206210223.929792157@linutronix.de Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/msi.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index d84cf30bb2790..8465221be6d21 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -1194,19 +1194,24 @@ EXPORT_SYMBOL(pci_free_irq_vectors); =20 /** * pci_irq_vector - return Linux IRQ number of a device vector - * @dev: PCI device to operate on - * @nr: device-relative interrupt vector index (0-based). + * @dev: PCI device to operate on + * @nr: Interrupt vector index (0-based) + * + * @nr has the following meanings depending on the interrupt mode: + * MSI-X: The index in the MSI-X vector table + * MSI: The index of the enabled MSI vectors + * INTx: Must be 0 + * + * Return: The Linux interrupt number or -EINVAl if @nr is out of range. */ int pci_irq_vector(struct pci_dev *dev, unsigned int nr) { if (dev->msix_enabled) { struct msi_desc *entry; - int i =3D 0; =20 for_each_pci_msi_entry(entry, dev) { - if (i =3D=3D nr) + if (entry->msi_attrib.entry_nr =3D=3D nr) return entry->irq; - i++; } WARN_ON_ONCE(1); return -EINVAL; @@ -1230,17 +1235,22 @@ EXPORT_SYMBOL(pci_irq_vector); * pci_irq_get_affinity - return the affinity of a particular MSI vector * @dev: PCI device to operate on * @nr: device-relative interrupt vector index (0-based). + * + * @nr has the following meanings depending on the interrupt mode: + * MSI-X: The index in the MSI-X vector table + * MSI: The index of the enabled MSI vectors + * INTx: Must be 0 + * + * Return: A cpumask pointer or NULL if @nr is out of range */ const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr) { if (dev->msix_enabled) { struct msi_desc *entry; - int i =3D 0; =20 for_each_pci_msi_entry(entry, dev) { - if (i =3D=3D nr) + if (entry->msi_attrib.entry_nr =3D=3D nr) return &entry->affinity->mask; - i++; } WARN_ON_ONCE(1); return NULL; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEA2FC4167D for ; Mon, 24 Jan 2022 21:57:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575972AbiAXVwt (ORCPT ); Mon, 24 Jan 2022 16:52:49 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37966 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377498AbiAXVTA (ORCPT ); Mon, 24 Jan 2022 16:19:00 -0500 Received: from smtp.kernel.org (relay.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 E1E06B8123A; Mon, 24 Jan 2022 21:18:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26D51C340E4; Mon, 24 Jan 2022 21:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059135; bh=FaB0y9HIYPaqAi9q7owR1nZqkiO+ArzL+57wSpMcVoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fyNIE7iBTyVbZr2OOVH2YW4MLr2aJumoGAqSgLGYSPQwpi9YvdFAkOqku86d8+lgR /AM/o7Y3pH+Sa+bxqmD60gUTopFx0Mm/pirui2/63WBo4PfjeB7FAsQ1p+v/IRbmDt a84F6WfU+c1GCJs0sStRsEu14obCqUkr7r0A8Pl8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erhard Furtner , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0482/1039] powerpc/powermac: Add additional missing lockdep_register_key() Date: Mon, 24 Jan 2022 19:37:51 +0100 Message-Id: <20220124184141.475710269@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 b149d5d45ac9171ed699a256f026c8ebef901112 ] Commit df1f679d19ed ("powerpc/powermac: Add missing lockdep_register_key()") fixed a problem that was causing a WARNING. There are two other places in the same file with the same problem originating from commit 9e607f72748d ("i2c_powermac: shut up lockdep warning"). Add missing lockdep_register_key() Fixes: 9e607f72748d ("i2c_powermac: shut up lockdep warning") Reported-by: Erhard Furtner Signed-off-by: Christophe Leroy Depends-on: df1f679d19ed ("powerpc/powermac: Add missing lockdep_register_k= ey()") Signed-off-by: Michael Ellerman Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D200055 Link: https://lore.kernel.org/r/2c7e421874e21b2fb87813d768cf662f630c2ad4.16= 38984999.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/platforms/powermac/low_i2c.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platf= orms/powermac/low_i2c.c index f77a59b5c2e1a..09bfe4b8f25aa 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c @@ -810,6 +810,7 @@ static void __init pmu_i2c_probe(void) bus->hostdata =3D bus + 1; bus->xfer =3D pmu_i2c_xfer; mutex_init(&bus->mutex); + lockdep_register_key(&bus->lock_key); lockdep_set_class(&bus->mutex, &bus->lock_key); bus->flags =3D pmac_i2c_multibus; list_add(&bus->link, &pmac_i2c_busses); @@ -933,6 +934,7 @@ static void __init smu_i2c_probe(void) bus->hostdata =3D bus + 1; bus->xfer =3D smu_i2c_xfer; mutex_init(&bus->mutex); + lockdep_register_key(&bus->lock_key); lockdep_set_class(&bus->mutex, &bus->lock_key); bus->flags =3D 0; list_add(&bus->link, &pmac_i2c_busses); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FB3FC4707E for ; Mon, 24 Jan 2022 23:48:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357355AbiAXXpx (ORCPT ); Mon, 24 Jan 2022 18:45:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845326AbiAXXMF (ORCPT ); Mon, 24 Jan 2022 18:12:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A982C0A02B8; Mon, 24 Jan 2022 13:19:00 -0800 (PST) Received: from smtp.kernel.org (relay.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 3ED0161469; Mon, 24 Jan 2022 21:18:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08831C340E7; Mon, 24 Jan 2022 21:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059138; bh=Onf+22GTqc/G0V7OktqFtzEvX9dOMso2ZB1VPCpd4NI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YMVdDZq5GK0zHswNs0GjxiiIIDuP55wlcUWI9HtmACRPK7I3m+dhmWCIjM47ZTVp4 9iU6ty0MTSlkklJgkrvOwTO9rtd2jCN/3CvYAOdK5qZEhP2Elh7ZbdkZqbldaZj5zp kk+eGnTo9ZLB6WR1PXHUpLbhjM9DjtqZ0G26Me2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Bjorn Andersson , Will Deacon , Sasha Levin Subject: [PATCH 5.16 0483/1039] iommu/arm-smmu-qcom: Fix TTBR0 read Date: Mon, 24 Jan 2022 19:37:52 +0100 Message-Id: <20220124184141.511596979@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rob Clark [ Upstream commit c31112fbd4077a51a14ff338038c82e9571dc821 ] It is a 64b register, lets not lose the upper bits. Fixes: ab5df7b953d8 ("iommu/arm-smmu-qcom: Add an adreno-smmu-priv callback= to get pagefault info") Signed-off-by: Rob Clark Reviewed-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211108171724.470973-1-robdclark@gmail.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm= /arm-smmu/arm-smmu-qcom.c index ca736b065dd0b..40c91dd368a4d 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c @@ -51,7 +51,7 @@ static void qcom_adreno_smmu_get_fault_info(const void *c= ookie, info->fsynr1 =3D arm_smmu_cb_read(smmu, cfg->cbndx, ARM_SMMU_CB_FSYNR1); info->far =3D arm_smmu_cb_readq(smmu, cfg->cbndx, ARM_SMMU_CB_FAR); info->cbfrsynra =3D arm_smmu_gr1_read(smmu, ARM_SMMU_GR1_CBFRSYNRA(cfg->c= bndx)); - info->ttbr0 =3D arm_smmu_cb_read(smmu, cfg->cbndx, ARM_SMMU_CB_TTBR0); + info->ttbr0 =3D arm_smmu_cb_readq(smmu, cfg->cbndx, ARM_SMMU_CB_TTBR0); info->contextidr =3D arm_smmu_cb_read(smmu, cfg->cbndx, ARM_SMMU_CB_CONTE= XTIDR); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89299C433EF for ; Mon, 24 Jan 2022 23:54:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365581AbiAXXvS (ORCPT ); Mon, 24 Jan 2022 18:51:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843807AbiAXXGY (ORCPT ); Mon, 24 Jan 2022 18:06:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C4BCC06E038; Mon, 24 Jan 2022 13:17:17 -0800 (PST) Received: from smtp.kernel.org (relay.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 C07DA614F5; Mon, 24 Jan 2022 21:17:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9BC7C340E4; Mon, 24 Jan 2022 21:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059036; bh=GSpa0T2zR5nR7t2XEWNXHM0JnhWayGNeHrauchlvb2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0fY1sI4UlPS5//AukobzXcdfyx3DdCbsi4m6B3yIZ6gQaU30UC/luJVJPnlbIiiEt 4V4mBner5AZbfTudAhRuLKD5Ud6pKATC3C4WccpWGka34nD5dTTnhrFmdITgO+HvCK NawdW0D2zvZLajQIGqn24uHYNUpIVHDUlYMhb888= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avihai Horon , Mark Zhang , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.16 0484/1039] RDMA/core: Let ib_find_gid() continue search even after empty entry Date: Mon, 24 Jan 2022 19:37:53 +0100 Message-Id: <20220124184141.543595123@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Avihai Horon [ Upstream commit 483d805191a23191f8294bbf9b4e94836f5d92e4 ] Currently, ib_find_gid() will stop searching after encountering the first empty GID table entry. This behavior is wrong since neither IB nor RoCE spec enforce tightly packed GID tables. For example, when a valid GID entry exists at index N, and if a GID entry is empty at index N-1, ib_find_gid() will fail to find the valid entry. Fix it by making ib_find_gid() continue searching even after encountering missing entries. Fixes: 5eb620c81ce3 ("IB/core: Add helpers for uncached GID and P_Key searc= hes") Link: https://lore.kernel.org/r/e55d331b96cecfc2cf19803d16e7109ea966882d.16= 39055490.git.leonro@nvidia.com Signed-off-by: Avihai Horon Reviewed-by: Mark Zhang Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/infiniband/core/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/dev= ice.c index 22a4adda7981d..a311df07b1bdb 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2461,7 +2461,8 @@ int ib_find_gid(struct ib_device *device, union ib_gi= d *gid, ++i) { ret =3D rdma_query_gid(device, port, i, &tmp_gid); if (ret) - return ret; + continue; + if (!memcmp(&tmp_gid, gid, sizeof *gid)) { *port_num =3D port; if (index) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9A33C433F5 for ; Mon, 24 Jan 2022 23:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362803AbiAXXmz (ORCPT ); Mon, 24 Jan 2022 18:42:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844045AbiAXXHi (ORCPT ); Mon, 24 Jan 2022 18:07:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EB50C06E03E; Mon, 24 Jan 2022 13:17:20 -0800 (PST) Received: from smtp.kernel.org (relay.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 B36F1614A6; Mon, 24 Jan 2022 21:17:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85AEBC36AFB; Mon, 24 Jan 2022 21:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059039; bh=tF0uGitjesxu8ManvGEcTbhnaW04Nx0vJWHp4smfh6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l67EzOipAkcgLVusaMvAZGdCwX0ElCeAx64e5b8Iilw5j1s3OXMXUe+KfrxQ+TFSQ 8/IPLTmKo7kC6kSop28O4RHXrz6Gp3uuN5CZZZb3oDb9uNz9lVKPGik4yPXWGCkKx/ wKcL0Jzo5HNFN704R46ryBXsI1s9BVzfOpHCvNjk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avihai Horon , Mark Zhang , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.16 0485/1039] RDMA/cma: Let cma_resolve_ib_dev() continue search even after empty entry Date: Mon, 24 Jan 2022 19:37:54 +0100 Message-Id: <20220124184141.573177206@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Avihai Horon [ Upstream commit 20679094a0161c94faf77e373fa3f7428a8e14bd ] Currently, when cma_resolve_ib_dev() searches for a matching GID it will stop searching after encountering the first empty GID table entry. This behavior is wrong since neither IB nor RoCE spec enforce tightly packed GID tables. For example, when the matching valid GID entry exists at index N, and if a GID entry is empty at index N-1, cma_resolve_ib_dev() will fail to find the matching valid entry. Fix it by making cma_resolve_ib_dev() continue searching even after encountering missing entries. Fixes: f17df3b0dede ("RDMA/cma: Add support for AF_IB to rdma_resolve_addr(= )") Link: https://lore.kernel.org/r/b7346307e3bb396c43d67d924348c6c496493991.16= 39055490.git.leonro@nvidia.com Signed-off-by: Avihai Horon Reviewed-by: Mark Zhang Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/infiniband/core/cma.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 835ac54d4a24c..a3834ef691910 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -766,6 +766,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *i= d_priv) unsigned int p; u16 pkey, index; enum ib_port_state port_state; + int ret; int i; =20 cma_dev =3D NULL; @@ -784,9 +785,14 @@ static int cma_resolve_ib_dev(struct rdma_id_private *= id_priv) =20 if (ib_get_cached_port_state(cur_dev->device, p, &port_state)) continue; - for (i =3D 0; !rdma_query_gid(cur_dev->device, - p, i, &gid); - i++) { + + for (i =3D 0; i < cur_dev->device->port_data[p].immutable.gid_tbl_len; + ++i) { + ret =3D rdma_query_gid(cur_dev->device, p, i, + &gid); + if (ret) + continue; + if (!memcmp(&gid, dgid, sizeof(gid))) { cma_dev =3D cur_dev; sgid =3D gid; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58B9AC433EF for ; Mon, 24 Jan 2022 22:06:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579174AbiAXWFH (ORCPT ); Mon, 24 Jan 2022 17:05:07 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40852 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378406AbiAXVRZ (ORCPT ); Mon, 24 Jan 2022 16:17:25 -0500 Received: from smtp.kernel.org (relay.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 A3FFE60C60; Mon, 24 Jan 2022 21:17:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88417C340E7; Mon, 24 Jan 2022 21:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059042; bh=KELrlWHcvTQuXSNFFxUFF1tW/4V0P2KYuGkbnaXmsdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aFYXdpydSY/eMO53hRtULDDnhWxoTyBPgLEuZPFDqGzS0aNl00FLLBMddrrF57bcb Yj+tNzhDxa43D63CGnrLs5HGO6dbi74whOa3hWBIs3o+jfGMgc7Ktf/11sAa1e3/Db X4ttRuA8yMXz6CTw1SBraA/tKDD0SQ2oYAriYKEI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0486/1039] ASoC: rt5663: Handle device_property_read_u32_array error codes Date: Mon, 24 Jan 2022 19:37:55 +0100 Message-Id: <20220124184141.608319251@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 2167c0b205960607fb136b4bb3c556a62be1569a ] The return value of device_property_read_u32_array() is not always 0. To catch the exception in case that devm_kzalloc failed and the rt5663->imp_table was NULL, which caused the failure of device_property_read_u32_array. Fixes: 450f0f6a8fb4 ("ASoC: rt5663: Add the manual offset field to compensa= te the DC offset") Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20211215031550.70702-1-jiasheng@iscas.ac.cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/codecs/rt5663.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index 0389b2bb360e2..2138f62e6af5d 100644 --- a/sound/soc/codecs/rt5663.c +++ b/sound/soc/codecs/rt5663.c @@ -3461,6 +3461,7 @@ static void rt5663_calibrate(struct rt5663_priv *rt56= 63) static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) { int table_size; + int ret; =20 device_property_read_u32(dev, "realtek,dc_offset_l_manual", &rt5663->pdata.dc_offset_l_manual); @@ -3477,9 +3478,11 @@ static int rt5663_parse_dp(struct rt5663_priv *rt566= 3, struct device *dev) table_size =3D sizeof(struct impedance_mapping_table) * rt5663->pdata.impedance_sensing_num; rt5663->imp_table =3D devm_kzalloc(dev, table_size, GFP_KERNEL); - device_property_read_u32_array(dev, + ret =3D device_property_read_u32_array(dev, "realtek,impedance_sensing_table", (u32 *)rt5663->imp_table, table_size); + if (ret) + return ret; } =20 return 0; @@ -3504,8 +3507,11 @@ static int rt5663_i2c_probe(struct i2c_client *i2c, =20 if (pdata) rt5663->pdata =3D *pdata; - else - rt5663_parse_dp(rt5663, &i2c->dev); + else { + ret =3D rt5663_parse_dp(rt5663, &i2c->dev); + if (ret) + return ret; + } =20 for (i =3D 0; i < ARRAY_SIZE(rt5663->supplies); i++) rt5663->supplies[i].supply =3D rt5663_supply_names[i]; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6200AC433FE for ; Mon, 24 Jan 2022 23:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362774AbiAXXmx (ORCPT ); Mon, 24 Jan 2022 18:42:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844102AbiAXXHv (ORCPT ); Mon, 24 Jan 2022 18:07:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1185FC09F48C; Mon, 24 Jan 2022 13:17:26 -0800 (PST) Received: from smtp.kernel.org (relay.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 A3ACB614B4; Mon, 24 Jan 2022 21:17:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B9ECC340E4; Mon, 24 Jan 2022 21:17:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059045; bh=Qv3AXBJypUQEhcu/HM/kLS35NH/SfK+kss7qkpXJK+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vn3F6ntYNT0iAziCVwH0js4Me2P7G+0rRVtFUm4T1/8kSJAv2x8aIxfOgPIzoUKjn pzxgRPU98DbENNHdsfB8Zvm1uV51ZB0s+DX3izIXIWUDQ8yEDuSxSsl6auA2nzRNYP p4mKtcqWNFewsXRpW9sIp+qkSKxSSJFdWyIqeQsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Jim Quinlan , Christoph Hellwig , Frank Rowand , Florian Fainelli , Rob Herring , Sasha Levin Subject: [PATCH 5.16 0487/1039] of: unittest: fix warning on PowerPC frame size warning Date: Mon, 24 Jan 2022 19:37:56 +0100 Message-Id: <20220124184141.643180859@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jim Quinlan [ Upstream commit a8d61a9112ad0c9216ab45d050991e07bc4f3408 ] The struct device variable "dev_bogus" was triggering this warning on a PowerPC build: drivers/of/unittest.c: In function 'of_unittest_dma_ranges_one.constpro= p': [...] >> The frame size of 1424 bytes is larger than 1024 bytes [-Wframe-larger-than=3D] This variable is now dynamically allocated. Fixes: e0d072782c734 ("dma-mapping: introduce DMA range map, supplanting dm= a_pfn_offset") Reported-by: kernel test robot Signed-off-by: Jim Quinlan Reviewed-by: Christoph Hellwig Reviewed-by: Frank Rowand Reviewed-by: Florian Fainelli Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20211210184636.7273-2-jim2101024@gmail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/of/unittest.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 481ba8682ebf4..02c5cd06ad19c 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -911,11 +911,18 @@ static void __init of_unittest_dma_ranges_one(const c= har *path, if (!rc) { phys_addr_t paddr; dma_addr_t dma_addr; - struct device dev_bogus; + struct device *dev_bogus; =20 - dev_bogus.dma_range_map =3D map; - paddr =3D dma_to_phys(&dev_bogus, expect_dma_addr); - dma_addr =3D phys_to_dma(&dev_bogus, expect_paddr); + dev_bogus =3D kzalloc(sizeof(struct device), GFP_KERNEL); + if (!dev_bogus) { + unittest(0, "kzalloc() failed\n"); + kfree(map); + return; + } + + dev_bogus->dma_range_map =3D map; + paddr =3D dma_to_phys(dev_bogus, expect_dma_addr); + dma_addr =3D phys_to_dma(dev_bogus, expect_paddr); =20 unittest(paddr =3D=3D expect_paddr, "of_dma_get_range: wrong phys addr %pap (expecting %llx) on node %pOF\= n", @@ -925,6 +932,7 @@ static void __init of_unittest_dma_ranges_one(const cha= r *path, &dma_addr, expect_dma_addr, np); =20 kfree(map); + kfree(dev_bogus); } of_node_put(np); #endif --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6FE5C43217 for ; Mon, 24 Jan 2022 21:58:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576849AbiAXV4f (ORCPT ); Mon, 24 Jan 2022 16:56:35 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38404 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378451AbiAXVRb (ORCPT ); Mon, 24 Jan 2022 16:17:31 -0500 Received: from smtp.kernel.org (relay.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 B574161320; Mon, 24 Jan 2022 21:17:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D048C340E4; Mon, 24 Jan 2022 21:17:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059048; bh=+JhNhfhX4CzHKo6zamglhaOW+gem5nuxs1xCVr/STrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sb3ptaBDq6E4OnMUQMJ++lRxS0o/iOIgFzjy71iMHv39PsitKBNC6Zx7VblUO5Z6l j7454LWmHJrtps6LTXkBICMICE1wOeC1K9M0k/23Q+gRVCGBOxIcJ8zsk0GDbXKUBY KhjfFGQT1UKhCaQULikkAZZyVqSgfoI2lr2t3Z6w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Rowand , Rob Herring , Sasha Levin Subject: [PATCH 5.16 0488/1039] of: unittest: 64 bit dma address test requires arch support Date: Mon, 24 Jan 2022 19:37:57 +0100 Message-Id: <20220124184141.675082704@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Rowand [ Upstream commit 9fd4cf5d3571b27d746b8ead494a3f051485b679 ] If an architecture does not support 64 bit dma addresses then testing for an expected dma address >=3D 0x100000000 will fail. Fixes: e0d072782c73 ("dma-mapping: introduce DMA range map, supplanting dma= _pfn_offset") Signed-off-by: Frank Rowand Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20211212221852.233295-1-frowand.list@gmail.= com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/of/unittest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 02c5cd06ad19c..35af4fedc15de 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -942,8 +942,9 @@ static void __init of_unittest_parse_dma_ranges(void) { of_unittest_dma_ranges_one("/testcase-data/address-tests/device@70000000", 0x0, 0x20000000); - of_unittest_dma_ranges_one("/testcase-data/address-tests/bus@80000000/dev= ice@1000", - 0x100000000, 0x20000000); + if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT)) + of_unittest_dma_ranges_one("/testcase-data/address-tests/bus@80000000/de= vice@1000", + 0x100000000, 0x20000000); of_unittest_dma_ranges_one("/testcase-data/address-tests/pci@90000000", 0x80000000, 0x20000000); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A2C2C3526F for ; Mon, 24 Jan 2022 21:58:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576830AbiAXV4d (ORCPT ); Mon, 24 Jan 2022 16:56:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38478 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449926AbiAXVRc (ORCPT ); Mon, 24 Jan 2022 16:17:32 -0500 Received: from smtp.kernel.org (relay.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 D18676148B; Mon, 24 Jan 2022 21:17:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AED41C340E4; Mon, 24 Jan 2022 21:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059051; bh=OVzwfhHa7Q06DLO2v8bPDfakvQ8TrsmIfo76CKfzYyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aIRL7IYY7/mrZpAy2dRHZQKDKlYRKTN/Ayn4OycD+OJ7/aEF2jP7CiA35umidDtI5 7wqqzItyiO74VATmizBgZtk4v+Mi7nwnhRWUtOvTgGH0S1SqLh4UsqyBnvB7Rej0Cp kt5XqLfRq+Noce/GFQ0Kq+kD/dcPUfugrecWIS7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dillon Min , Patrice Chotard , Gabriel Fernandez , Stephen Boyd , Sasha Levin Subject: [PATCH 5.16 0489/1039] clk: stm32: Fix ltdcs clock turn off by clk_disable_unused() after system enter shell Date: Mon, 24 Jan 2022 19:37:58 +0100 Message-Id: <20220124184141.704984135@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dillon Min [ Upstream commit 6fc058a72f3b7b07fc4de6d66ad1f68951b00f6e ] stm32's clk driver register two ltdc gate clk to clk core by clk_hw_register_gate() and clk_hw_register_composite() first: 'stm32f429_gates[]', clk name is 'ltdc', which no user to use. second: 'stm32f429_aux_clk[]', clk name is 'lcd-tft', used by ltdc driver both of them point to the same offset of stm32's RCC register. after kernel enter console, clk core turn off ltdc's clk as 'stm32f429_gates[]' is no one to use. but, actually 'stm32f429_aux_clk[]' is in use. stm32f469/746/769 have the same issue, fix it. Fixes: daf2d117cbca ("clk: stm32f4: Add lcd-tft clock") Link: https://lore.kernel.org/linux-arm-kernel/1590564453-24499-7-git-send-= email-dillon.minfei@gmail.com/ Link: https://lore.kernel.org/lkml/CAPTRvHkf0cK_4ZidM17rPo99gWDmxgqFt4CDUjq= FFwkOeQeFDg@mail.gmail.com/ Signed-off-by: Dillon Min Reviewed-by: Patrice Chotard Acked-by: Gabriel Fernandez Acked-by: Stephen Boyd Link: https://lore.kernel.org/r/1635232282-3992-10-git-send-email-dillon.mi= nfei@gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/clk/clk-stm32f4.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c index af46176ad0539..473dfe632cc57 100644 --- a/drivers/clk/clk-stm32f4.c +++ b/drivers/clk/clk-stm32f4.c @@ -129,7 +129,6 @@ static const struct stm32f4_gate_data stm32f429_gates[]= __initconst =3D { { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; =20 static const struct stm32f4_gate_data stm32f469_gates[] __initconst =3D { @@ -211,7 +210,6 @@ static const struct stm32f4_gate_data stm32f469_gates[]= __initconst =3D { { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; =20 static const struct stm32f4_gate_data stm32f746_gates[] __initconst =3D { @@ -286,7 +284,6 @@ static const struct stm32f4_gate_data stm32f746_gates[]= __initconst =3D { { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; =20 static const struct stm32f4_gate_data stm32f769_gates[] __initconst =3D { @@ -364,7 +361,6 @@ static const struct stm32f4_gate_data stm32f769_gates[]= __initconst =3D { { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, { STM32F4_RCC_APB2ENR, 30, "mdio", "apb2_div" }, }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB480C2BA4C for ; Mon, 24 Jan 2022 23:54:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365521AbiAXXvG (ORCPT ); Mon, 24 Jan 2022 18:51:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844210AbiAXXII (ORCPT ); Mon, 24 Jan 2022 18:08:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB473C09F49F; Mon, 24 Jan 2022 13:17:36 -0800 (PST) Received: from smtp.kernel.org (relay.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 8A079B81243; Mon, 24 Jan 2022 21:17:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96C26C340E5; Mon, 24 Jan 2022 21:17:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059054; bh=TeYp5QSifAzy2E8GygoVq7w2IL6PghiUOAK0zkgnnm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RAgi0R2nI4efGaC99IXeg+Mw8j0t7qPkEwPeRI/YLf2Kz3a+sDsoeakCV/8TSh/bo XpC8AP5Z85M7YNKqkEPsk3l1l4lcqfpqXLnnfJcASCN5uflEwJokVumlN3pKlhMEz3 XLI9W5whvSBT9GQ5DG6fExu/cLpqMBC5mhlXPNy8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Bulwahn , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.16 0490/1039] mips: add SYS_HAS_CPU_MIPS64_R5 config for MIPS Release 5 support Date: Mon, 24 Jan 2022 19:37:59 +0100 Message-Id: <20220124184141.736245824@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Bulwahn [ Upstream commit fd4eb90b164442cb1e9909f7845e12a0835ac699 ] Commit ab7c01fdc3cf ("mips: Add MIPS Release 5 support") adds the two configs CPU_MIPS32_R5 and CPU_MIPS64_R5, which depend on the corresponding SYS_HAS_CPU_MIPS32_R5 and SYS_HAS_CPU_MIPS64_R5, respectively. The config SYS_HAS_CPU_MIPS32_R5 was already introduced with commit c5b367835cfc ("MIPS: Add support for XPA."); the config SYS_HAS_CPU_MIPS64_R5, however, was never introduced. Hence, ./scripts/checkkconfigsymbols.py warns: SYS_HAS_CPU_MIPS64_R5 Referencing files: arch/mips/Kconfig, arch/mips/include/asm/cpu-type.h Add the definition for config SYS_HAS_CPU_MIPS64_R5 under the assumption that SYS_HAS_CPU_MIPS64_R5 follows the same pattern as the existing SYS_HAS_CPU_MIPS32_R5 and SYS_HAS_CPU_MIPS64_R6. Fixes: ab7c01fdc3cf ("mips: Add MIPS Release 5 support") Signed-off-by: Lukas Bulwahn Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/mips/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 0215dc1529e9a..91ce1c57af005 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -1907,6 +1907,10 @@ config SYS_HAS_CPU_MIPS64_R1 config SYS_HAS_CPU_MIPS64_R2 bool =20 +config SYS_HAS_CPU_MIPS64_R5 + bool + select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT + config SYS_HAS_CPU_MIPS64_R6 bool select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E94ADC4321E for ; Mon, 24 Jan 2022 23:54:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365496AbiAXXvD (ORCPT ); Mon, 24 Jan 2022 18:51:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844233AbiAXXIM (ORCPT ); Mon, 24 Jan 2022 18:08:12 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E77FC09F4A2; Mon, 24 Jan 2022 13:17:39 -0800 (PST) Received: from smtp.kernel.org (relay.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 A6B8CB811A2; Mon, 24 Jan 2022 21:17:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C73DBC340E4; Mon, 24 Jan 2022 21:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059057; bh=ipmEVIXRYyq7vp4hJryUoLzFfRdVsSjgjmRpnw7mLfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mEfjjrRP/8VRbvOKHqKl7jQdQPvZrB00+p7bLoGhtTC6BtIzVScTN4tvvsJWFALgv MI1KzaOq2EFI+jal7ulwepY8BKZV74EwBBUHnq5IOa/M87fViKKJrqni+9fxdCf3bz UwbPJyvsnm1NF6sr/SNTiknO2bIQXznQ6RuN2izM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Lukas Bulwahn , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.16 0491/1039] mips: fix Kconfig reference to PHYS_ADDR_T_64BIT Date: Mon, 24 Jan 2022 19:38:00 +0100 Message-Id: <20220124184141.767752121@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Bulwahn [ Upstream commit a670c82d9ca4f1e7385d9d6f26ff41a50fbdd944 ] Commit d4a451d5fc84 ("arch: remove the ARCH_PHYS_ADDR_T_64BIT config symbol") removes config ARCH_PHYS_ADDR_T_64BIT with all instances of that config refactored appropriately. Since then, it is recommended to use the config PHYS_ADDR_T_64BIT instead. Commit 171543e75272 ("MIPS: Disallow CPU_SUPPORTS_HUGEPAGES for XPA,EVA") introduces the expression "!(32BIT && (ARCH_PHYS_ADDR_T_64BIT || EVA))" for config CPU_SUPPORTS_HUGEPAGES, which unintentionally refers to the non-existing symbol ARCH_PHYS_ADDR_T_64BIT instead of the intended PHYS_ADDR_T_64BIT. Fix this Kconfig reference to the intended PHYS_ADDR_T_64BIT. This issue was identified with the script ./scripts/checkkconfigsymbols.py. I then reported it on the mailing list and Paul confirmed the mistake in the linked email thread. Link: https://lore.kernel.org/lkml/H8IU3R.H5QVNRA077PT@crapouillou.net/ Suggested-by: Paul Cercueil Fixes: 171543e75272 ("MIPS: Disallow CPU_SUPPORTS_HUGEPAGES for XPA,EVA") Signed-off-by: Lukas Bulwahn Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 91ce1c57af005..c5826236d913a 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2069,7 +2069,7 @@ config CPU_SUPPORTS_ADDRWINCFG bool config CPU_SUPPORTS_HUGEPAGES bool - depends on !(32BIT && (ARCH_PHYS_ADDR_T_64BIT || EVA)) + depends on !(32BIT && (PHYS_ADDR_T_64BIT || EVA)) config MIPS_PGD_C0_CONTEXT bool depends on 64BIT --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F504C3525A for ; Mon, 24 Jan 2022 22:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451574AbiAXWDc (ORCPT ); Mon, 24 Jan 2022 17:03:32 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41166 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450007AbiAXVRo (ORCPT ); Mon, 24 Jan 2022 16:17:44 -0500 Received: from smtp.kernel.org (relay.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 E119861425; Mon, 24 Jan 2022 21:17:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8E49C340E4; Mon, 24 Jan 2022 21:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059060; bh=tZ0YmxvMOQXfzZx00GnW7zNtkxAb1Ipi6CFgNNh80E0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wrdxCP3qcmaHaDUPuFowYA/8jBaIHAQbP5CgC4Jx6DwxLuoZTci7KfKEcKOGc16ey DIKNGtDRdvZnzQEQj+n4w1ZK5rjC17KZigR17ZVKBwInM6FtnEBlWC/YK96s3uT8By lMqqVzr0NyF1QLyT5FsNUDyc7Ghp8JobR8KTNf4o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Mark Brown , Vinod Koul , Sasha Levin Subject: [PATCH 5.16 0492/1039] dmaengine: pxa/mmp: stop referencing config->slave_id Date: Mon, 24 Jan 2022 19:38:01 +0100 Message-Id: <20220124184141.798000209@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit 134c37fa250a87a7e77c80a7c59ae16c462e46e0 ] The last driver referencing the slave_id on Marvell PXA and MMP platforms was the SPI driver, but this stopped doing so a long time ago, so the TODO from the earlier patch can no be removed. Fixes: b729bf34535e ("spi/pxa2xx: Don't use slave_id of dma_slave_config") Fixes: 13b3006b8ebd ("dma: mmp_pdma: add filter function") Signed-off-by: Arnd Bergmann Acked-by: Mark Brown Link: https://lore.kernel.org/r/20211122222203.4103644-7-arnd@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dma/mmp_pdma.c | 6 ------ drivers/dma/pxa_dma.c | 7 ------- 2 files changed, 13 deletions(-) diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index a23563cd118b7..5a53d7fcef018 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c @@ -727,12 +727,6 @@ static int mmp_pdma_config_write(struct dma_chan *dcha= n, =20 chan->dir =3D direction; chan->dev_addr =3D addr; - /* FIXME: drivers should be ported over to use the filter - * function. Once that's done, the following two lines can - * be removed. - */ - if (cfg->slave_id) - chan->drcmr =3D cfg->slave_id; =20 return 0; } diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c index 52d04641e3611..6078cc81892e4 100644 --- a/drivers/dma/pxa_dma.c +++ b/drivers/dma/pxa_dma.c @@ -909,13 +909,6 @@ static void pxad_get_config(struct pxad_chan *chan, *dcmd |=3D PXA_DCMD_BURST16; else if (maxburst =3D=3D 32) *dcmd |=3D PXA_DCMD_BURST32; - - /* FIXME: drivers should be ported over to use the filter - * function. Once that's done, the following two lines can - * be removed. - */ - if (chan->cfg.slave_id) - chan->drcmr =3D chan->cfg.slave_id; } =20 static struct dma_async_tx_descriptor * --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A009C4332F for ; Mon, 24 Jan 2022 21:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575504AbiAXVvu (ORCPT ); Mon, 24 Jan 2022 16:51:50 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37350 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450012AbiAXVRq (ORCPT ); Mon, 24 Jan 2022 16:17:46 -0500 Received: from smtp.kernel.org (relay.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 A560DB80CCF; Mon, 24 Jan 2022 21:17:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9366C340E4; Mon, 24 Jan 2022 21:17:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059063; bh=+81L4euDQ5f9crrJwevO7X7oWkOnrFB40RxntAu/H5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KF/lIwCow55bipIlYLMsksRIEOsZ9xZE32XUW3Crs4WZwH58dqnXIkAsJYYbO2pH1 vjSpynFGiq6vf/QBmwZwM2hDS4wpX9A1u1zXYvQPRsHMkKBbmb/ole58EuZkTFuK8z GaK0+uWM6Xw6OiYBUx8LPzde1XemVsZH+Cdpdqyc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Joerg Roedel , Sasha Levin Subject: [PATCH 5.16 0493/1039] iommu/amd: Restore GA log/tail pointer on host resume Date: Mon, 24 Jan 2022 19:38:02 +0100 Message-Id: <20220124184141.828147879@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Levitsky [ Upstream commit a8d4a37d1bb93608501d0d0545f902061152669a ] This will give IOMMU GA log a chance to work after resume from s3/s4. Fixes: 8bda0cfbdc1a6 ("iommu/amd: Detect and initialize guest vAPIC log") Signed-off-by: Maxim Levitsky Link: https://lore.kernel.org/r/20211123161038.48009-2-mlevitsk@redhat.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iommu/amd/init.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 1eacd43cb4368..8dae85fcfc2eb 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -806,16 +806,27 @@ static int iommu_ga_log_enable(struct amd_iommu *iomm= u) { #ifdef CONFIG_IRQ_REMAP u32 status, i; + u64 entry; =20 if (!iommu->ga_log) return -EINVAL; =20 - status =3D readl(iommu->mmio_base + MMIO_STATUS_OFFSET); - /* Check if already running */ - if (status & (MMIO_STATUS_GALOG_RUN_MASK)) + status =3D readl(iommu->mmio_base + MMIO_STATUS_OFFSET); + if (WARN_ON(status & (MMIO_STATUS_GALOG_RUN_MASK))) return 0; =20 + entry =3D iommu_virt_to_phys(iommu->ga_log) | GA_LOG_SIZE_512; + memcpy_toio(iommu->mmio_base + MMIO_GA_LOG_BASE_OFFSET, + &entry, sizeof(entry)); + entry =3D (iommu_virt_to_phys(iommu->ga_log_tail) & + (BIT_ULL(52)-1)) & ~7ULL; + memcpy_toio(iommu->mmio_base + MMIO_GA_LOG_TAIL_OFFSET, + &entry, sizeof(entry)); + writel(0x00, iommu->mmio_base + MMIO_GA_HEAD_OFFSET); + writel(0x00, iommu->mmio_base + MMIO_GA_TAIL_OFFSET); + + iommu_feature_enable(iommu, CONTROL_GAINT_EN); iommu_feature_enable(iommu, CONTROL_GALOG_EN); =20 @@ -825,7 +836,7 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu) break; } =20 - if (i >=3D LOOP_TIMEOUT) + if (WARN_ON(i >=3D LOOP_TIMEOUT)) return -EINVAL; #endif /* CONFIG_IRQ_REMAP */ return 0; @@ -834,8 +845,6 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu) static int iommu_init_ga_log(struct amd_iommu *iommu) { #ifdef CONFIG_IRQ_REMAP - u64 entry; - if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir)) return 0; =20 @@ -849,16 +858,6 @@ static int iommu_init_ga_log(struct amd_iommu *iommu) if (!iommu->ga_log_tail) goto err_out; =20 - entry =3D iommu_virt_to_phys(iommu->ga_log) | GA_LOG_SIZE_512; - memcpy_toio(iommu->mmio_base + MMIO_GA_LOG_BASE_OFFSET, - &entry, sizeof(entry)); - entry =3D (iommu_virt_to_phys(iommu->ga_log_tail) & - (BIT_ULL(52)-1)) & ~7ULL; - memcpy_toio(iommu->mmio_base + MMIO_GA_LOG_TAIL_OFFSET, - &entry, sizeof(entry)); - writel(0x00, iommu->mmio_base + MMIO_GA_HEAD_OFFSET); - writel(0x00, iommu->mmio_base + MMIO_GA_TAIL_OFFSET); - return 0; err_out: free_ga_log(iommu); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B53AC4167D for ; Mon, 24 Jan 2022 21:57:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354795AbiAXVyF (ORCPT ); Mon, 24 Jan 2022 16:54:05 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37420 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446189AbiAXVRz (ORCPT ); Mon, 24 Jan 2022 16:17:55 -0500 Received: from smtp.kernel.org (relay.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 B7BCCB812A4; Mon, 24 Jan 2022 21:17:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED44AC340E4; Mon, 24 Jan 2022 21:17:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059069; bh=nGSKyNwHqxYnvZTzIEn47sHUm0MNCLWPaVZ1C6/ULmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gPN70eBBQAoIg1orgSrU44tYdApWzduoPNyBVRhUowUTagEaw/nYlQKuTed+Ftg0Q SLE3ZuScGAc/txBMBWo5KKDJGZu6nErdQ3pCS/0joFqZGG0i8C2WsEqE4cd0wu1bfM eGCgMltzUEOc5DDsckiOo7ds9YiUYQO7LCkLr+/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Joerg Roedel , Sasha Levin Subject: [PATCH 5.16 0494/1039] iommu/amd: X2apic mode: re-enable after resume Date: Mon, 24 Jan 2022 19:38:03 +0100 Message-Id: <20220124184141.859316718@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Levitsky [ Upstream commit 01b297a48a26bcb96769505ac948db4603b72bd1 ] Otherwise it is guaranteed to not work after the resume... Fixes: 66929812955bb ("iommu/amd: Add support for X2APIC IOMMU interrupts") Signed-off-by: Maxim Levitsky Link: https://lore.kernel.org/r/20211123161038.48009-3-mlevitsk@redhat.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iommu/amd/init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 8dae85fcfc2eb..b905604f434e1 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -2172,7 +2172,6 @@ static int iommu_setup_intcapxt(struct amd_iommu *iom= mu) return ret; } =20 - iommu_feature_enable(iommu, CONTROL_INTCAPXT_EN); return 0; } =20 @@ -2195,6 +2194,10 @@ static int iommu_init_irq(struct amd_iommu *iommu) =20 iommu->int_enabled =3D true; enable_faults: + + if (amd_iommu_xt_mode =3D=3D IRQ_REMAP_X2APIC_MODE) + iommu_feature_enable(iommu, CONTROL_INTCAPXT_EN); + iommu_feature_enable(iommu, CONTROL_EVT_INT_EN); =20 if (iommu->ppr_log !=3D NULL) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24A03C433EF for ; Mon, 24 Jan 2022 21:58:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455647AbiAXVzA (ORCPT ); Mon, 24 Jan 2022 16:55:00 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37456 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446233AbiAXVRz (ORCPT ); Mon, 24 Jan 2022 16:17:55 -0500 Received: from smtp.kernel.org (relay.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 D0700B8123D; Mon, 24 Jan 2022 21:17:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 144EDC340E4; Mon, 24 Jan 2022 21:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059072; bh=OjiKxcoVAjErG6wC1bWCTCsRSp42f+oM48Bj/N17Ck8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2TbxcbGhV5wkuvuoZPCMX5ub4GeAhRIUtAQXuAvRIty4SAC9qQ/phxYtXo2qpm0lf f3rzzu9qqfC0DsH0TJbfybWCrHBLkX1/WkoxJ5om4jailEknRDp6+AYGSmeo+IQcVh Ib9yBNBdW/bEMLn7SN+qy2nJSW3lUUuh5cAoF9EM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Joerg Roedel , Sasha Levin Subject: [PATCH 5.16 0495/1039] iommu/amd: X2apic mode: setup the INTX registers on mask/unmask Date: Mon, 24 Jan 2022 19:38:04 +0100 Message-Id: <20220124184141.889366729@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Levitsky [ Upstream commit 4691f79d62a637958f7b5f55c232a65399500b7a ] This is more logically correct and will also allow us to to use mask/unmask logic to restore INTX setttings after the resume from s3/s4. Fixes: 66929812955bb ("iommu/amd: Add support for X2APIC IOMMU interrupts") Signed-off-by: Maxim Levitsky Link: https://lore.kernel.org/r/20211123161038.48009-4-mlevitsk@redhat.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iommu/amd/init.c | 65 ++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index b905604f434e1..9e895bb8086a6 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -2015,48 +2015,18 @@ union intcapxt { }; } __attribute__ ((packed)); =20 -/* - * There isn't really any need to mask/unmask at the irqchip level because - * the 64-bit INTCAPXT registers can be updated atomically without tearing - * when the affinity is being updated. - */ -static void intcapxt_unmask_irq(struct irq_data *data) -{ -} - -static void intcapxt_mask_irq(struct irq_data *data) -{ -} =20 static struct irq_chip intcapxt_controller; =20 static int intcapxt_irqdomain_activate(struct irq_domain *domain, struct irq_data *irqd, bool reserve) { - struct amd_iommu *iommu =3D irqd->chip_data; - struct irq_cfg *cfg =3D irqd_cfg(irqd); - union intcapxt xt; - - xt.capxt =3D 0ULL; - xt.dest_mode_logical =3D apic->dest_mode_logical; - xt.vector =3D cfg->vector; - xt.destid_0_23 =3D cfg->dest_apicid & GENMASK(23, 0); - xt.destid_24_31 =3D cfg->dest_apicid >> 24; - - /** - * Current IOMMU implemtation uses the same IRQ for all - * 3 IOMMU interrupts. - */ - writeq(xt.capxt, iommu->mmio_base + MMIO_INTCAPXT_EVT_OFFSET); - writeq(xt.capxt, iommu->mmio_base + MMIO_INTCAPXT_PPR_OFFSET); - writeq(xt.capxt, iommu->mmio_base + MMIO_INTCAPXT_GALOG_OFFSET); return 0; } =20 static void intcapxt_irqdomain_deactivate(struct irq_domain *domain, struct irq_data *irqd) { - intcapxt_mask_irq(irqd); } =20 =20 @@ -2090,6 +2060,38 @@ static void intcapxt_irqdomain_free(struct irq_domai= n *domain, unsigned int virq irq_domain_free_irqs_top(domain, virq, nr_irqs); } =20 + +static void intcapxt_unmask_irq(struct irq_data *irqd) +{ + struct amd_iommu *iommu =3D irqd->chip_data; + struct irq_cfg *cfg =3D irqd_cfg(irqd); + union intcapxt xt; + + xt.capxt =3D 0ULL; + xt.dest_mode_logical =3D apic->dest_mode_logical; + xt.vector =3D cfg->vector; + xt.destid_0_23 =3D cfg->dest_apicid & GENMASK(23, 0); + xt.destid_24_31 =3D cfg->dest_apicid >> 24; + + /** + * Current IOMMU implementation uses the same IRQ for all + * 3 IOMMU interrupts. + */ + writeq(xt.capxt, iommu->mmio_base + MMIO_INTCAPXT_EVT_OFFSET); + writeq(xt.capxt, iommu->mmio_base + MMIO_INTCAPXT_PPR_OFFSET); + writeq(xt.capxt, iommu->mmio_base + MMIO_INTCAPXT_GALOG_OFFSET); +} + +static void intcapxt_mask_irq(struct irq_data *irqd) +{ + struct amd_iommu *iommu =3D irqd->chip_data; + + writeq(0, iommu->mmio_base + MMIO_INTCAPXT_EVT_OFFSET); + writeq(0, iommu->mmio_base + MMIO_INTCAPXT_PPR_OFFSET); + writeq(0, iommu->mmio_base + MMIO_INTCAPXT_GALOG_OFFSET); +} + + static int intcapxt_set_affinity(struct irq_data *irqd, const struct cpumask *mask, bool force) { @@ -2099,8 +2101,7 @@ static int intcapxt_set_affinity(struct irq_data *irq= d, ret =3D parent->chip->irq_set_affinity(parent, mask, force); if (ret < 0 || ret =3D=3D IRQ_SET_MASK_OK_DONE) return ret; - - return intcapxt_irqdomain_activate(irqd->domain, irqd, false); + return 0; } =20 static struct irq_chip intcapxt_controller =3D { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16000C433F5 for ; Mon, 24 Jan 2022 23:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362656AbiAXXmp (ORCPT ); Mon, 24 Jan 2022 18:42:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844616AbiAXXJy (ORCPT ); Mon, 24 Jan 2022 18:09:54 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06DDEC09F825; Mon, 24 Jan 2022 13:17:58 -0800 (PST) Received: from smtp.kernel.org (relay.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 B8122B81061; Mon, 24 Jan 2022 21:17:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DABA9C340E4; Mon, 24 Jan 2022 21:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059075; bh=o9mh0CAuKVwblnD04YxsdWNf415LLvY4f8KISait108=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JgXWoP6z7V+LlnZz5VUf1vKVswJB+TN1ZoeeSz3C+08T9JS23ys/e9+SQJ3JX+mBA X8Rg7lGFX5Q3sGMx7jxqpXrKE6OqS/h80q9klHqx92QRCzIHAR2S0thHZV6A0SBVxs xpuHcgdKgTjIDVubGhHNWZ4FXI3UHNrnrrEGGyVM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Joerg Roedel , Sasha Levin Subject: [PATCH 5.16 0496/1039] iommu/amd: X2apic mode: mask/unmask interrupts on suspend/resume Date: Mon, 24 Jan 2022 19:38:05 +0100 Message-Id: <20220124184141.922088375@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Levitsky [ Upstream commit 1980105e3cfc2215c75b4f6b172661d675c467d1 ] Use IRQCHIP_MASK_ON_SUSPEND to make the core irq code to mask the iommu interrupt on suspend and unmask it on the resume. Since now the unmask function updates the INTX settings, that will restore them on resume from s3/s4. Since IRQCHIP_MASK_ON_SUSPEND is only effective for interrupts which are not wakeup sources, remove IRQCHIP_SKIP_SET_WAKE flag and instead implement a dummy .irq_set_wake which doesn't allow the interrupt to become a wakeup source. Fixes: 66929812955bb ("iommu/amd: Add support for X2APIC IOMMU interrupts") Signed-off-by: Maxim Levitsky Link: https://lore.kernel.org/r/20211123161038.48009-5-mlevitsk@redhat.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iommu/amd/init.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 9e895bb8086a6..b94822fc2c9f7 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -2104,6 +2104,11 @@ static int intcapxt_set_affinity(struct irq_data *ir= qd, return 0; } =20 +static int intcapxt_set_wake(struct irq_data *irqd, unsigned int on) +{ + return on ? -EOPNOTSUPP : 0; +} + static struct irq_chip intcapxt_controller =3D { .name =3D "IOMMU-MSI", .irq_unmask =3D intcapxt_unmask_irq, @@ -2111,7 +2116,8 @@ static struct irq_chip intcapxt_controller =3D { .irq_ack =3D irq_chip_ack_parent, .irq_retrigger =3D irq_chip_retrigger_hierarchy, .irq_set_affinity =3D intcapxt_set_affinity, - .flags =3D IRQCHIP_SKIP_SET_WAKE, + .irq_set_wake =3D intcapxt_set_wake, + .flags =3D IRQCHIP_MASK_ON_SUSPEND, }; =20 static const struct irq_domain_ops intcapxt_domain_ops =3D { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33DAFC4321E for ; Mon, 24 Jan 2022 23:47:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362623AbiAXXmn (ORCPT ); Mon, 24 Jan 2022 18:42:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844632AbiAXXJz (ORCPT ); Mon, 24 Jan 2022 18:09:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B93AC09F82C; Mon, 24 Jan 2022 13:18:01 -0800 (PST) Received: from smtp.kernel.org (relay.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 D8E6BB80FA3; Mon, 24 Jan 2022 21:17:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0324BC340E4; Mon, 24 Jan 2022 21:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059078; bh=AARvIspTDx5oeredf44NzHo/9Hvy6QhxhRkqFfkxd5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGLMS6sUos6rSe6gIrLFHKKdaHSiqKWQlQMxiINi/9jKxE7MWEpGoPn4Xr2AcLtHM dTBogFw/HatnzsDjee6hqt5cn+DWRLWBPGvz0k2P/fpLAkEUNDwTwcWwzjqR8zjaja MOj8IC1gQLwQHU4UZAJQLgE96IyKI7IPEwi/f3jE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Joerg Roedel , Sasha Levin Subject: [PATCH 5.16 0497/1039] iommu/amd: Remove useless irq affinity notifier Date: Mon, 24 Jan 2022 19:38:06 +0100 Message-Id: <20220124184141.953120806@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Levitsky [ Upstream commit 575f5cfb13c84f324f9898383fa4a5694e53c9ef ] iommu->intcapxt_notify field is no longer used after a switch to a separate domain was done Fixes: d1adcfbb520c ("iommu/amd: Fix IOMMU interrupt generation in X2APIC m= ode") Signed-off-by: Maxim Levitsky Link: https://lore.kernel.org/r/20211123161038.48009-6-mlevitsk@redhat.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iommu/amd/amd_iommu_types.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_io= mmu_types.h index 867535eb0ce97..ffc89c4fb1205 100644 --- a/drivers/iommu/amd/amd_iommu_types.h +++ b/drivers/iommu/amd/amd_iommu_types.h @@ -645,8 +645,6 @@ struct amd_iommu { /* DebugFS Info */ struct dentry *debugfs; #endif - /* IRQ notifier for IntCapXT interrupt */ - struct irq_affinity_notify intcapxt_notify; }; =20 static inline struct amd_iommu *dev_to_amd_iommu(struct device *dev) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0998C433FE for ; Mon, 24 Jan 2022 21:57:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575519AbiAXVvx (ORCPT ); Mon, 24 Jan 2022 16:51:53 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41534 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446544AbiAXVSF (ORCPT ); Mon, 24 Jan 2022 16:18:05 -0500 Received: from smtp.kernel.org (relay.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 BC0CF614B4; Mon, 24 Jan 2022 21:18:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E1B6C340E4; Mon, 24 Jan 2022 21:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059082; bh=e9ukgO2HtZrPpeNCuBBCRIWPjwNXuYeZrknKf0Rh6RA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pXZBeCHkod3GfaAEq4GG6GFmyc6SOJqpn6Ea9YDNRk0gsFie572KV3BR8SgVDP4Wl ZkmAmpbLlKIHhS0S2/SDmFO7x8+HrYcmeANtWWRZpp71tzX2KdpCwFEgcYiPUo9H3O JE1ppDz4ePMCeLXM3Wbj161miUxjzzrfafNH956M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kevin Tian , Dave Jiang , Cezary Rojewski , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0498/1039] ASoC: Intel: catpt: Test dmaengine_submit() result before moving on Date: Mon, 24 Jan 2022 19:38:07 +0100 Message-Id: <20220124184141.990765690@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 2a9a72e290d4a4741e673f86b9fba9bfb319786d ] After calling dmaengine_submit(), the submitted transfer descriptor belongs to the DMA engine. Pointer to that descriptor may no longer be valid after the call and should be tested before awaiting transfer completion. Reported-by: Kevin Tian Suggested-by: Dave Jiang Fixes: 4fac9b31d0b9 ("ASoC: Intel: Add catpt base members") Signed-off-by: Cezary Rojewski Link: https://lore.kernel.org/r/20211216115743.2130622-2-cezary.rojewski@in= tel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/intel/catpt/dsp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/catpt/dsp.c b/sound/soc/intel/catpt/dsp.c index 9c5fd18f2600f..346bec0003066 100644 --- a/sound/soc/intel/catpt/dsp.c +++ b/sound/soc/intel/catpt/dsp.c @@ -65,6 +65,7 @@ static int catpt_dma_memcpy(struct catpt_dev *cdev, struc= t dma_chan *chan, { struct dma_async_tx_descriptor *desc; enum dma_status status; + int ret; =20 desc =3D dmaengine_prep_dma_memcpy(chan, dst_addr, src_addr, size, DMA_CTRL_ACK); @@ -77,13 +78,22 @@ static int catpt_dma_memcpy(struct catpt_dev *cdev, str= uct dma_chan *chan, catpt_updatel_shim(cdev, HMDC, CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id), CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id)); - dmaengine_submit(desc); + + ret =3D dma_submit_error(dmaengine_submit(desc)); + if (ret) { + dev_err(cdev->dev, "submit tx failed: %d\n", ret); + goto clear_hdda; + } + status =3D dma_wait_for_async_tx(desc); + ret =3D (status =3D=3D DMA_COMPLETE) ? 0 : -EPROTO; + +clear_hdda: /* regardless of status, disable access to HOST memory in demand mode */ catpt_updatel_shim(cdev, HMDC, CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id), 0); =20 - return (status =3D=3D DMA_COMPLETE) ? 0 : -EPROTO; + return ret; } =20 int catpt_dma_memcpy_todsp(struct catpt_dev *cdev, struct dma_chan *chan, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 250FCC433EF for ; Mon, 24 Jan 2022 21:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575537AbiAXVvz (ORCPT ); Mon, 24 Jan 2022 16:51:55 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38842 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349609AbiAXVSG (ORCPT ); Mon, 24 Jan 2022 16:18:06 -0500 Received: from smtp.kernel.org (relay.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 E0DDB614B8; Mon, 24 Jan 2022 21:18:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4075C340E4; Mon, 24 Jan 2022 21:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059085; bh=NArxHwZeGD7GaMmhx/LlhECXgL7KMKQlYAHAYYPDj34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K9rh77rzuFtCc0VgER0bo1cuClU1Y5l75TvX2G5oaWUWnxf9fTU3TfInc9WIigVMJ cD362BFh/A1DOIsgvDJ3MFOes02t2tCZmK9CFnCPbPB5w8ZbZiZ6baF/Id6Ah8Pvkm Lb8IiQt+0mvNerLPpGGCHXpm0E9NCSVgvLcUTjyg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Xiongfeng Wang , Robin Murphy , Joerg Roedel , Sasha Levin Subject: [PATCH 5.16 0499/1039] iommu/iova: Fix race between FQ timeout and teardown Date: Mon, 24 Jan 2022 19:38:08 +0100 Message-Id: <20220124184142.029731523@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiongfeng Wang [ Upstream commit d7061627d701c90e1cac1e1e60c45292f64f3470 ] It turns out to be possible for hotplugging out a device to reach the stage of tearing down the device's group and default domain before the domain's flush queue has drained naturally. At this point, it is then possible for the timeout to expire just before the del_timer() call in free_iova_flush_queue(), such that we then proceed to free the FQ resources while fq_flush_timeout() is still accessing them on another CPU. Crashes due to this have been observed in the wild while removing NVMe devices. Close the race window by using del_timer_sync() to safely wait for any active timeout handler to finish before we start to free things. We already avoid any locking in free_iova_flush_queue() since the FQ is supposed to be inactive anyway, so the potential deadlock scenario does not apply. Fixes: 9a005a800ae8 ("iommu/iova: Add flush timer") Reviewed-by: John Garry Signed-off-by: Xiongfeng Wang [ rm: rewrite commit message ] Signed-off-by: Robin Murphy Link: https://lore.kernel.org/r/0a365e5b07f14b7344677ad6a9a734966a8422ce.16= 39753638.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iommu/iova.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index 9e8bc802ac053..920fcc27c9a1e 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c @@ -83,8 +83,7 @@ static void free_iova_flush_queue(struct iova_domain *iov= ad) if (!has_iova_flush_queue(iovad)) return; =20 - if (timer_pending(&iovad->fq_timer)) - del_timer(&iovad->fq_timer); + del_timer_sync(&iovad->fq_timer); =20 fq_destroy_all_entries(iovad); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28296C433FE for ; Mon, 24 Jan 2022 21:57:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576287AbiAXVxP (ORCPT ); Mon, 24 Jan 2022 16:53:15 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41660 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377071AbiAXVSK (ORCPT ); Mon, 24 Jan 2022 16:18:10 -0500 Received: from smtp.kernel.org (relay.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 D851E61305; Mon, 24 Jan 2022 21:18:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2168C340E4; Mon, 24 Jan 2022 21:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059088; bh=z+/VnVwlH1v1Ouw0e0bxxOYtXPkGQ+iQ8+Ph2rB8skg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VC3ruKKBQxAeOMXp1Yk5gslOCvpFUejs6IURxYo3jYVFJ7oBmqHtXXIjIRbViVnK+ Omn6jJyIqvNQAUNog6r6ddJDM7RzS9I+uu6vRLZQOs+EEQS9sGCKEpzNoCJpQ/KSfx T5bcuQSxzPzOR2vGQGGPPZrlK2Wt8pGHahEMU2dA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trevor Wu , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0500/1039] ASoC: mediatek: mt8195: correct default value Date: Mon, 24 Jan 2022 19:38:09 +0100 Message-Id: <20220124184142.068350819@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trevor Wu [ Upstream commit 30e693ee82d20361f2caacca3b68c79e1a7cb16c ] mt8195_cg_patch is used to reset the default value of audio cg, so the register value could be consistent with CCF reference count. Nevertheless, AUDIO_TOP_CON1[1:0] is used to control an internal mux, and it's expected to keep the default value 0. This patch corrects the default value in case an unexpected behavior happens in the future. Fixes: 6746cc8582599 ("ASoC: mediatek: mt8195: add platform driver") Signed-off-by: Trevor Wu Link: https://lore.kernel.org/r/20211216022424.28470-1-trevor.wu@mediatek.c= om Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c b/sound/soc/mediate= k/mt8195/mt8195-afe-pcm.c index 2bb05a828e8d2..15b4cae2524c1 100644 --- a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c +++ b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c @@ -3028,7 +3028,7 @@ static const struct reg_sequence mt8195_afe_reg_defau= lts[] =3D { =20 static const struct reg_sequence mt8195_cg_patch[] =3D { { AUDIO_TOP_CON0, 0xfffffffb }, - { AUDIO_TOP_CON1, 0xfffffffa }, + { AUDIO_TOP_CON1, 0xfffffff8 }, }; =20 static int mt8195_afe_init_registers(struct mtk_base_afe *afe) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6CBAC433F5 for ; Mon, 24 Jan 2022 23:54:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364868AbiAXXtf (ORCPT ); Mon, 24 Jan 2022 18:49:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844719AbiAXXKI (ORCPT ); Mon, 24 Jan 2022 18:10:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE4A6C09F83C; Mon, 24 Jan 2022 13:18:13 -0800 (PST) Received: from smtp.kernel.org (relay.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 9BE99B81057; Mon, 24 Jan 2022 21:18:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF1F2C340E4; Mon, 24 Jan 2022 21:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059091; bh=t17sdjoAhhTXB6mNYjmpfzPShpRY5qOINxI54UzVfxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v8savHB4RRxlDPLgUIqZDBlXb6Y7JAUiIptlbguALrSbW3EZ6MYRJCSwYioKG/evQ ZX4cnRT2Do1eLGCCTKN0+J2RGT815rgduZLJ1TwUBEBDWB+Y3g+gE+N1NDRwqtJj2q tbkiBPHnaD+9/xOA9/Cz81ad9ZmjVdF6YtTwe3Pw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Syed Nayyar Waris , William Breathitt Gray , Sasha Levin Subject: [PATCH 5.16 0501/1039] counter: 104-quad-8: Fix persistent enabled events bug Date: Mon, 24 Jan 2022 19:38:10 +0100 Message-Id: <20220124184142.105182450@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Breathitt Gray [ Upstream commit c95cc0d95702523f8f361b802c9b7d4eeae07f5d ] A bug exists if the user executes a COUNTER_ADD_WATCH_IOCTL ioctl call, and then executes a COUNTER_DISABLE_EVENTS_IOCTL ioctl call. Disabling the events should disable the 104-QUAD-8 interrupts, but because of this bug the interrupts are not disabling. The reason this bug is occurring is because quad8_events_configure() is called when COUNTER_DISABLE_EVENTS_IOCTL is handled, but the next_irq_trigger[] array has not been cleared before it is checked in the loop. This patch fixes the bug by removing the next_irq_trigger array and instead utilizing a different algorithm of walking the events_list list for the current requested events. When a COUNTER_DISABLE_EVENTS_IOCTL is handled, events_list will be empty and thus all device channels end up with interrupts disabled. Fixes: 7aa2ba0df651 ("counter: 104-quad-8: Add IRQ support for the ACCES 10= 4-QUAD-8") Cc: Syed Nayyar Waris Signed-off-by: William Breathitt Gray Link: https://lore.kernel.org/r/5fd5731cec1c251acee30eefb7c19160d03c9d39.16= 40072891.git.vilhelm.gray@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/counter/104-quad-8.c | 82 +++++++++++++++++------------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c index 1cbd60aaed697..a97027db0446d 100644 --- a/drivers/counter/104-quad-8.c +++ b/drivers/counter/104-quad-8.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -44,7 +45,6 @@ MODULE_PARM_DESC(irq, "ACCES 104-QUAD-8 interrupt line nu= mbers"); * @ab_enable: array of A and B inputs enable configurations * @preset_enable: array of set_to_preset_on_index attribute configurations * @irq_trigger: array of current IRQ trigger function configurations - * @next_irq_trigger: array of next IRQ trigger function configurations * @synchronous_mode: array of index function synchronous mode configurati= ons * @index_polarity: array of index function polarity configurations * @cable_fault_enable: differential encoder cable status enable configura= tions @@ -61,7 +61,6 @@ struct quad8 { unsigned int ab_enable[QUAD8_NUM_COUNTERS]; unsigned int preset_enable[QUAD8_NUM_COUNTERS]; unsigned int irq_trigger[QUAD8_NUM_COUNTERS]; - unsigned int next_irq_trigger[QUAD8_NUM_COUNTERS]; unsigned int synchronous_mode[QUAD8_NUM_COUNTERS]; unsigned int index_polarity[QUAD8_NUM_COUNTERS]; unsigned int cable_fault_enable; @@ -390,7 +389,6 @@ static int quad8_action_read(struct counter_device *cou= nter, } =20 enum { - QUAD8_EVENT_NONE =3D -1, QUAD8_EVENT_CARRY =3D 0, QUAD8_EVENT_COMPARE =3D 1, QUAD8_EVENT_CARRY_BORROW =3D 2, @@ -402,34 +400,49 @@ static int quad8_events_configure(struct counter_devi= ce *counter) struct quad8 *const priv =3D counter->priv; unsigned long irq_enabled =3D 0; unsigned long irqflags; - size_t channel; + struct counter_event_node *event_node; + unsigned int next_irq_trigger; unsigned long ior_cfg; unsigned long base_offset; =20 spin_lock_irqsave(&priv->lock, irqflags); =20 - /* Enable interrupts for the requested channels, disable for the rest */ - for (channel =3D 0; channel < QUAD8_NUM_COUNTERS; channel++) { - if (priv->next_irq_trigger[channel] =3D=3D QUAD8_EVENT_NONE) - continue; + list_for_each_entry(event_node, &counter->events_list, l) { + switch (event_node->event) { + case COUNTER_EVENT_OVERFLOW: + next_irq_trigger =3D QUAD8_EVENT_CARRY; + break; + case COUNTER_EVENT_THRESHOLD: + next_irq_trigger =3D QUAD8_EVENT_COMPARE; + break; + case COUNTER_EVENT_OVERFLOW_UNDERFLOW: + next_irq_trigger =3D QUAD8_EVENT_CARRY_BORROW; + break; + case COUNTER_EVENT_INDEX: + next_irq_trigger =3D QUAD8_EVENT_INDEX; + break; + default: + /* should never reach this path */ + spin_unlock_irqrestore(&priv->lock, irqflags); + return -EINVAL; + } =20 - if (priv->irq_trigger[channel] !=3D priv->next_irq_trigger[channel]) { - /* Save new IRQ function configuration */ - priv->irq_trigger[channel] =3D priv->next_irq_trigger[channel]; + /* Skip configuration if it is the same as previously set */ + if (priv->irq_trigger[event_node->channel] =3D=3D next_irq_trigger) + continue; =20 - /* Load configuration to I/O Control Register */ - ior_cfg =3D priv->ab_enable[channel] | - priv->preset_enable[channel] << 1 | - priv->irq_trigger[channel] << 3; - base_offset =3D priv->base + 2 * channel + 1; - outb(QUAD8_CTR_IOR | ior_cfg, base_offset); - } + /* Save new IRQ function configuration */ + priv->irq_trigger[event_node->channel] =3D next_irq_trigger; =20 - /* Reset next IRQ trigger function configuration */ - priv->next_irq_trigger[channel] =3D QUAD8_EVENT_NONE; + /* Load configuration to I/O Control Register */ + ior_cfg =3D priv->ab_enable[event_node->channel] | + priv->preset_enable[event_node->channel] << 1 | + priv->irq_trigger[event_node->channel] << 3; + base_offset =3D priv->base + 2 * event_node->channel + 1; + outb(QUAD8_CTR_IOR | ior_cfg, base_offset); =20 /* Enable IRQ line */ - irq_enabled |=3D BIT(channel); + irq_enabled |=3D BIT(event_node->channel); } =20 outb(irq_enabled, priv->base + QUAD8_REG_INDEX_INTERRUPT); @@ -442,35 +455,20 @@ static int quad8_events_configure(struct counter_devi= ce *counter) static int quad8_watch_validate(struct counter_device *counter, const struct counter_watch *watch) { - struct quad8 *const priv =3D counter->priv; + struct counter_event_node *event_node; =20 if (watch->channel > QUAD8_NUM_COUNTERS - 1) return -EINVAL; =20 switch (watch->event) { case COUNTER_EVENT_OVERFLOW: - if (priv->next_irq_trigger[watch->channel] =3D=3D QUAD8_EVENT_NONE) - priv->next_irq_trigger[watch->channel] =3D QUAD8_EVENT_CARRY; - else if (priv->next_irq_trigger[watch->channel] !=3D QUAD8_EVENT_CARRY) - return -EINVAL; - return 0; case COUNTER_EVENT_THRESHOLD: - if (priv->next_irq_trigger[watch->channel] =3D=3D QUAD8_EVENT_NONE) - priv->next_irq_trigger[watch->channel] =3D QUAD8_EVENT_COMPARE; - else if (priv->next_irq_trigger[watch->channel] !=3D QUAD8_EVENT_COMPARE) - return -EINVAL; - return 0; case COUNTER_EVENT_OVERFLOW_UNDERFLOW: - if (priv->next_irq_trigger[watch->channel] =3D=3D QUAD8_EVENT_NONE) - priv->next_irq_trigger[watch->channel] =3D QUAD8_EVENT_CARRY_BORROW; - else if (priv->next_irq_trigger[watch->channel] !=3D QUAD8_EVENT_CARRY_B= ORROW) - return -EINVAL; - return 0; case COUNTER_EVENT_INDEX: - if (priv->next_irq_trigger[watch->channel] =3D=3D QUAD8_EVENT_NONE) - priv->next_irq_trigger[watch->channel] =3D QUAD8_EVENT_INDEX; - else if (priv->next_irq_trigger[watch->channel] !=3D QUAD8_EVENT_INDEX) - return -EINVAL; + list_for_each_entry(event_node, &counter->next_events_list, l) + if (watch->channel =3D=3D event_node->channel && + watch->event !=3D event_node->event) + return -EINVAL; return 0; default: return -EINVAL; @@ -1183,8 +1181,6 @@ static int quad8_probe(struct device *dev, unsigned i= nt id) outb(QUAD8_CTR_IOR, base_offset + 1); /* Disable index function; negative index polarity */ outb(QUAD8_CTR_IDR, base_offset + 1); - /* Initialize next IRQ trigger function configuration */ - priv->next_irq_trigger[i] =3D QUAD8_EVENT_NONE; } /* Disable Differential Encoder Cable Status for all channels */ outb(0xFF, base[id] + QUAD8_DIFF_ENCODER_CABLE_STATUS); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5989AC433EF for ; Mon, 24 Jan 2022 23:54:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365159AbiAXXuU (ORCPT ); Mon, 24 Jan 2022 18:50:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844736AbiAXXKO (ORCPT ); Mon, 24 Jan 2022 18:10:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0F14C09F83E; Mon, 24 Jan 2022 13:18:15 -0800 (PST) Received: from smtp.kernel.org (relay.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 96207B811FB; Mon, 24 Jan 2022 21:18:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF5A4C340E4; Mon, 24 Jan 2022 21:18:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059094; bh=Wl7/FqyVESgtyk8MNTltFU21fmpFUMloKKngtNOgNRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UZm/OClDDlGbuII0KT03mwHfmAUXFeytLEl3R59RXx+o1RX0qnLtd5Aszn/DQFPbx oupujNGN1DERcIaM6nRvczs2+ITprqBgoT9mUe7/YlfhtTf5QhgW/n8KFVHzXQ0j2z AwhaToa3EB9tRl2dKvuLza8qQLtEJXrvJEZ8sN5A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-efi@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Herring , Zhen Lei , Pingfan Liu , Dave Kleikamp , John Donnelly , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Sasha Levin Subject: [PATCH 5.16 0502/1039] of: fdt: Aggregate the processing of "linux,usable-memory-range" Date: Mon, 24 Jan 2022 19:38:11 +0100 Message-Id: <20220124184142.136258100@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhen Lei [ Upstream commit 8347b41748c3019157312fbe7f8a6792ae396eb7 ] Currently, we parse the "linux,usable-memory-range" property in early_init_dt_scan_chosen(), to obtain the specified memory range of the crash kernel. We then reserve the required memory after early_init_dt_scan_memory() has identified all available physical memory. Because the two pieces of code are separated far, the readability and maintainability are reduced. So bring them together. Suggested-by: Rob Herring Signed-off-by: Zhen Lei (change the prototype of early_init_dt_check_for_usable_mem_range(), in order to use it outside) Signed-off-by: Pingfan Liu Tested-by: Dave Kleikamp Acked-by: John Donnelly Reviewed-by: Rob Herring Cc: Catalin Marinas Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org To: devicetree@vger.kernel.org To: linux-efi@vger.kernel.org Signed-off-by: Rob Herring Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/of/fdt.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index bdca35284cebd..5a238a933eb29 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -965,18 +965,22 @@ static void __init early_init_dt_check_for_elfcorehdr= (unsigned long node) elfcorehdr_addr, elfcorehdr_size); } =20 -static phys_addr_t cap_mem_addr; -static phys_addr_t cap_mem_size; +static unsigned long chosen_node_offset =3D -FDT_ERR_NOTFOUND; =20 /** * early_init_dt_check_for_usable_mem_range - Decode usable memory range * location from flat tree - * @node: reference to node containing usable memory range location ('chos= en') */ -static void __init early_init_dt_check_for_usable_mem_range(unsigned long = node) +static void __init early_init_dt_check_for_usable_mem_range(void) { const __be32 *prop; int len; + phys_addr_t cap_mem_addr; + phys_addr_t cap_mem_size; + unsigned long node =3D chosen_node_offset; + + if ((long)node < 0) + return; =20 pr_debug("Looking for usable-memory-range property... "); =20 @@ -989,6 +993,8 @@ static void __init early_init_dt_check_for_usable_mem_r= ange(unsigned long node) =20 pr_debug("cap_mem_start=3D%pa cap_mem_size=3D%pa\n", &cap_mem_addr, &cap_mem_size); + + memblock_cap_memory_range(cap_mem_addr, cap_mem_size); } =20 #ifdef CONFIG_SERIAL_EARLYCON @@ -1137,9 +1143,10 @@ int __init early_init_dt_scan_chosen(unsigned long n= ode, const char *uname, (strcmp(uname, "chosen") !=3D 0 && strcmp(uname, "chosen@0") !=3D 0)) return 0; =20 + chosen_node_offset =3D node; + early_init_dt_check_for_initrd(node); early_init_dt_check_for_elfcorehdr(node); - early_init_dt_check_for_usable_mem_range(node); =20 /* Retrieve command line */ p =3D of_get_flat_dt_prop(node, "bootargs", &l); @@ -1275,7 +1282,7 @@ void __init early_init_dt_scan_nodes(void) of_scan_flat_dt(early_init_dt_scan_memory, NULL); =20 /* Handle linux,usable-memory-range property */ - memblock_cap_memory_range(cap_mem_addr, cap_mem_size); + early_init_dt_check_for_usable_mem_range(); } =20 bool __init early_init_dt_scan(void *params) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D80FC43217 for ; Mon, 24 Jan 2022 22:04:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578076AbiAXWBh (ORCPT ); Mon, 24 Jan 2022 17:01:37 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37676 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446773AbiAXVSY (ORCPT ); Mon, 24 Jan 2022 16:18:24 -0500 Received: from smtp.kernel.org (relay.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 77A4CB81057; Mon, 24 Jan 2022 21:18:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E5E8C340E4; Mon, 24 Jan 2022 21:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059097; bh=2ZPHVcGpaSXfIN28Z1vt7OZB9VjTVdIcGorkPScaoY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=adFrGPa9k64AgO/X+haxmEFNtdp1K4O6E29Rks20fz4jEALe9Hsxd6CkESGZs/SLT b+qm7iRaqtc0fwXjJVMUoHdmoMfA7gTWAiZ2FIZjre+2HP3aIWe1+s+uAOiBkqjiCF K7EetBfTX+hOet1BiUqGodaHE5xtVL5DRCHgTa/o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-efi@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pingfan Liu , Rob Herring , Zhen Lei , Catalin Marinas , Will Deacon , Andrew Morton , Mike Rapoport , Geert Uytterhoeven , Frank Rowand , Ard Biesheuvel , Nick Terrell , linux-arm-kernel@lists.infradead.org, Rob Herring , Sasha Levin Subject: [PATCH 5.16 0503/1039] efi: apply memblock cap after memblock_add() Date: Mon, 24 Jan 2022 19:38:12 +0100 Message-Id: <20220124184142.176957209@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pingfan Liu [ Upstream commit b398123bff3bcbc1facb0f29bf6e7b9f1bc55931 ] On arm64, during kdump kernel saves vmcore, it runs into the following bug: ... [ 15.148919] usercopy: Kernel memory exposure attempt detected from SLUB = object 'kmem_cache_node' (offset 0, size 4096)! [ 15.159707] ------------[ cut here ]------------ [ 15.164311] kernel BUG at mm/usercopy.c:99! [ 15.168482] Internal error: Oops - BUG: 0 [#1] SMP [ 15.173261] Modules linked in: xfs libcrc32c crct10dif_ce ghash_ce sha2_= ce sha256_arm64 sha1_ce sbsa_gwdt ast i2c_algo_bit drm_vram_helper drm_kms_= helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec drm_ttm_helper ttm= drm nvme nvme_core xgene_hwmon i2c_designware_platform i2c_designware_core= dm_mirror dm_region_hash dm_log dm_mod overlay squashfs zstd_decompress lo= op [ 15.206186] CPU: 0 PID: 542 Comm: cp Not tainted 5.16.0-rc4 #1 [ 15.212006] Hardware name: GIGABYTE R272-P30-JG/MP32-AR0-JG, BIOS F12 (S= CP: 1.5.20210426) 05/13/2021 [ 15.221125] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE= =3D--) [ 15.228073] pc : usercopy_abort+0x9c/0xa0 [ 15.232074] lr : usercopy_abort+0x9c/0xa0 [ 15.236070] sp : ffff8000121abba0 [ 15.239371] x29: ffff8000121abbb0 x28: 0000000000003000 x27: 00000000000= 00000 [ 15.246494] x26: 0000000080000400 x25: 0000ffff885c7000 x24: 00000000000= 00000 [ 15.253617] x23: 000007ff80400000 x22: ffff07ff80401000 x21: 00000000000= 00001 [ 15.260739] x20: 0000000000001000 x19: ffff07ff80400000 x18: fffffffffff= fffff [ 15.267861] x17: 656a626f2042554c x16: 53206d6f72662064 x15: 65746365746= 56420 [ 15.274983] x14: 74706d6574746120 x13: 2129363930342065 x12: 7a6973202c3= 02074 [ 15.282105] x11: ffffc8b041d1b148 x10: 00000000ffff8000 x9 : ffffc8b0401= 2812c [ 15.289228] x8 : 00000000ffff7fff x7 : ffffc8b041d1b148 x6 : 00000000000= 00000 [ 15.296349] x5 : 0000000000000000 x4 : 0000000000007fff x3 : 00000000000= 00000 [ 15.303471] x2 : 0000000000000000 x1 : ffff07ff8c064800 x0 : 00000000000= 0006b [ 15.310593] Call trace: [ 15.313027] usercopy_abort+0x9c/0xa0 [ 15.316677] __check_heap_object+0xd4/0xf0 [ 15.320762] __check_object_size.part.0+0x160/0x1e0 [ 15.325628] __check_object_size+0x2c/0x40 [ 15.329711] copy_oldmem_page+0x7c/0x140 [ 15.333623] read_from_oldmem.part.0+0xfc/0x1c0 [ 15.338142] __read_vmcore.constprop.0+0x23c/0x350 [ 15.342920] read_vmcore+0x28/0x34 [ 15.346309] proc_reg_read+0xb4/0xf0 [ 15.349871] vfs_read+0xb8/0x1f0 [ 15.353088] ksys_read+0x74/0x100 [ 15.356390] __arm64_sys_read+0x28/0x34 ... This bug introduced by commit b261dba2fdb2 ("arm64: kdump: Remove custom linux,usable-memory-range handling"), which moves memblock_cap_memory_range() to fdt, but it breaches the rules that memblock_cap_memory_range() should come after memblock_add() etc as said in commit e888fa7bb882 ("memblock: Check memory add/cap ordering"). As a consequence, the virtual address set up by copy_oldmem_page() does not bail out from the test of virt_addr_valid() in check_heap_object(), and finally hits the BUG_ON(). Since memblock allocator has no idea about when the memblock is fully populated, while efi_init() is aware, so tackling this issue by calling the interface early_init_dt_check_for_usable_mem_range() exposed by of/fdt. Fixes: b261dba2fdb2 ("arm64: kdump: Remove custom linux,usable-memory-range= handling") Signed-off-by: Pingfan Liu Cc: Rob Herring Cc: Zhen Lei Cc: Catalin Marinas Cc: Will Deacon Cc: Andrew Morton Cc: Mike Rapoport Cc: Geert Uytterhoeven Cc: Frank Rowand Cc: Ard Biesheuvel Cc: Nick Terrell Cc: linux-arm-kernel@lists.infradead.org To: devicetree@vger.kernel.org To: linux-efi@vger.kernel.org Acked-by: Ard Biesheuvel Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20211215021348.8766-1-kernelfans@gmail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/firmware/efi/efi-init.c | 5 +++++ drivers/of/fdt.c | 2 +- include/linux/of_fdt.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-ini= t.c index b19ce1a83f91a..b2c829e95bd14 100644 --- a/drivers/firmware/efi/efi-init.c +++ b/drivers/firmware/efi/efi-init.c @@ -235,6 +235,11 @@ void __init efi_init(void) } =20 reserve_regions(); + /* + * For memblock manipulation, the cap should come after the memblock_add(= ). + * And now, memblock is fully populated, it is time to do capping. + */ + early_init_dt_check_for_usable_mem_range(); efi_esrt_init(); efi_mokvar_table_init(); =20 diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 5a238a933eb29..65af475dfa950 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -971,7 +971,7 @@ static unsigned long chosen_node_offset =3D -FDT_ERR_NO= TFOUND; * early_init_dt_check_for_usable_mem_range - Decode usable memory range * location from flat tree */ -static void __init early_init_dt_check_for_usable_mem_range(void) +void __init early_init_dt_check_for_usable_mem_range(void) { const __be32 *prop; int len; diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h index cf48983d3c867..ad09beb6d13c4 100644 --- a/include/linux/of_fdt.h +++ b/include/linux/of_fdt.h @@ -62,6 +62,7 @@ extern int early_init_dt_scan_chosen(unsigned long node, = const char *uname, int depth, void *data); extern int early_init_dt_scan_memory(unsigned long node, const char *uname, int depth, void *data); +extern void early_init_dt_check_for_usable_mem_range(void); extern int early_init_dt_scan_chosen_stdout(void); extern void early_init_fdt_scan_reserved_mem(void); extern void early_init_fdt_reserve_self(void); @@ -86,6 +87,7 @@ extern void unflatten_and_copy_device_tree(void); extern void early_init_devtree(void *); extern void early_get_first_memblock_info(void *, phys_addr_t *); #else /* CONFIG_OF_EARLY_FLATTREE */ +static inline void early_init_dt_check_for_usable_mem_range(void) {} static inline int early_init_dt_scan_chosen_stdout(void) { return -ENODEV;= } static inline void early_init_fdt_scan_reserved_mem(void) {} static inline void early_init_fdt_reserve_self(void) {} --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54BF3C4167B for ; Mon, 24 Jan 2022 23:54:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364927AbiAXXtv (ORCPT ); Mon, 24 Jan 2022 18:49:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844754AbiAXXKO (ORCPT ); Mon, 24 Jan 2022 18:10:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 716E9C0A0285; Mon, 24 Jan 2022 13:18:24 -0800 (PST) Received: from smtp.kernel.org (relay.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 0FABB614A8; Mon, 24 Jan 2022 21:18:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C28A2C340E4; Mon, 24 Jan 2022 21:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059103; bh=CHPzfW6i5bXLXtdsGALLpzo6sxfPO+RZtns6yyzQsS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eLV/Eh/ZRff51G0ujXwdMedbVNX41Ex8/IXUBizB2xpCUvgHGHUdiUyyisPy1qnuq t9c9Ez86gegZkbvBcXVEw9lv22THeFZDurmex0YE+Hm2sq67S1egD2XBQ7m58e3xw2 3eR23Z9MvCvtaohwkrdMCRsjVTw4L7+o9QEbg2Bs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Alan Stern , Xiang Chen , "Martin K. Petersen" , Sasha Levin , John Garry Subject: [PATCH 5.16 0504/1039] scsi: block: pm: Always set request queue runtime active in blk_post_runtime_resume() Date: Mon, 24 Jan 2022 19:38:13 +0100 Message-Id: <20220124184142.209470147@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Stern [ Upstream commit 6e1fcab00a23f7fe9f4fe9704905a790efa1eeab ] John Garry reported a deadlock that occurs when trying to access a runtime-suspended SATA device. For obscure reasons, the rescan procedure causes the link to be hard-reset, which disconnects the device. The rescan tries to carry out a runtime resume when accessing the device. scsi_rescan_device() holds the SCSI device lock and won't release it until it can put commands onto the device's block queue. This can't happen until the queue is successfully runtime-resumed or the device is unregistered. But the runtime resume fails because the device is disconnected, and __scsi_remove_device() can't do the unregistration because it can't get the device lock. The best way to resolve this deadlock appears to be to allow the block queue to start running again even after an unsuccessful runtime resume. The idea is that the driver or the SCSI error handler will need to be able to use the queue to resolve the runtime resume failure. This patch removes the err argument to blk_post_runtime_resume() and makes the routine act as though the resume was successful always. This fixes the deadlock. Link: https://lore.kernel.org/r/1639999298-244569-4-git-send-email-chenxian= g66@hisilicon.com Fixes: e27829dc92e5 ("scsi: serialize ->rescan against ->remove") Reported-and-tested-by: John Garry Reviewed-by: Bart Van Assche Signed-off-by: Alan Stern Signed-off-by: Xiang Chen Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- block/blk-pm.c | 22 +++++++--------------- drivers/scsi/scsi_pm.c | 2 +- include/linux/blk-pm.h | 2 +- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/block/blk-pm.c b/block/blk-pm.c index 17bd020268d42..2dad62cc15727 100644 --- a/block/blk-pm.c +++ b/block/blk-pm.c @@ -163,27 +163,19 @@ EXPORT_SYMBOL(blk_pre_runtime_resume); /** * blk_post_runtime_resume - Post runtime resume processing * @q: the queue of the device - * @err: return value of the device's runtime_resume function * * Description: - * Update the queue's runtime status according to the return value of t= he - * device's runtime_resume function. If the resume was successful, call - * blk_set_runtime_active() to do the real work of restarting the queue. + * For historical reasons, this routine merely calls blk_set_runtime_ac= tive() + * to do the real work of restarting the queue. It does this regardles= s of + * whether the device's runtime-resume succeeded; even if it failed the + * driver or error handler will need to communicate with the device. * * This function should be called near the end of the device's * runtime_resume callback. */ -void blk_post_runtime_resume(struct request_queue *q, int err) +void blk_post_runtime_resume(struct request_queue *q) { - if (!q->dev) - return; - if (!err) { - blk_set_runtime_active(q); - } else { - spin_lock_irq(&q->queue_lock); - q->rpm_status =3D RPM_SUSPENDED; - spin_unlock_irq(&q->queue_lock); - } + blk_set_runtime_active(q); } EXPORT_SYMBOL(blk_post_runtime_resume); =20 @@ -201,7 +193,7 @@ EXPORT_SYMBOL(blk_post_runtime_resume); * runtime PM status and re-enable peeking requests from the queue. It * should be called before first request is added to the queue. * - * This function is also called by blk_post_runtime_resume() for successful + * This function is also called by blk_post_runtime_resume() for * runtime resumes. It does everything necessary to restart the queue. */ void blk_set_runtime_active(struct request_queue *q) diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c index b5a858c29488a..f06ca9d2a597d 100644 --- a/drivers/scsi/scsi_pm.c +++ b/drivers/scsi/scsi_pm.c @@ -181,7 +181,7 @@ static int sdev_runtime_resume(struct device *dev) blk_pre_runtime_resume(sdev->request_queue); if (pm && pm->runtime_resume) err =3D pm->runtime_resume(dev); - blk_post_runtime_resume(sdev->request_queue, err); + blk_post_runtime_resume(sdev->request_queue); =20 return err; } diff --git a/include/linux/blk-pm.h b/include/linux/blk-pm.h index b80c65aba2493..2580e05a8ab67 100644 --- a/include/linux/blk-pm.h +++ b/include/linux/blk-pm.h @@ -14,7 +14,7 @@ extern void blk_pm_runtime_init(struct request_queue *q, = struct device *dev); extern int blk_pre_runtime_suspend(struct request_queue *q); extern void blk_post_runtime_suspend(struct request_queue *q, int err); extern void blk_pre_runtime_resume(struct request_queue *q); -extern void blk_post_runtime_resume(struct request_queue *q, int err); +extern void blk_post_runtime_resume(struct request_queue *q); extern void blk_set_runtime_active(struct request_queue *q); #else static inline void blk_pm_runtime_init(struct request_queue *q, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 971D1C43217 for ; Mon, 24 Jan 2022 23:47:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2362742AbiAXXmu (ORCPT ); Mon, 24 Jan 2022 18:42:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844746AbiAXXKO (ORCPT ); Mon, 24 Jan 2022 18:10:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 137DCC0A0289; Mon, 24 Jan 2022 13:18:29 -0800 (PST) Received: from smtp.kernel.org (relay.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 CF31CB8105C; Mon, 24 Jan 2022 21:18:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11577C340E4; Mon, 24 Jan 2022 21:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059106; bh=eBtV3ryZiXUZattGsksT7BmwOVTZlzKcXHsLCTSvJcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EDeYySaXQv6nMdJkeBNJpFn3Uhc+znhd+GBL9D5cRkZ0EwYvyOvyT93KEyfL0nnTi IW27OQTkTuDaN8elrJSrWPXdDTbluylV58Bf1OCW5CQtXES+FIcNS7pg1aqoDKe5TK AG68GRV+Thi1DP5x6HWJ8JX68L9rrJxpGoLQ+uc0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryuta NAKANISHI , Kunihiko Hayashi , Vinod Koul , Sasha Levin Subject: [PATCH 5.16 0505/1039] phy: uniphier-usb3ss: fix unintended writing zeros to PHY register Date: Mon, 24 Jan 2022 19:38:14 +0100 Message-Id: <20220124184142.248564599@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ryuta NAKANISHI [ Upstream commit 898c7a9ec81620125f2463714a0f4dea18ad6e54 ] Similar to commit 4a90bbb478db ("phy: uniphier-pcie: Fix updating phy parameters"), in function uniphier_u3ssphy_set_param(), unintentionally write zeros to other fields when writing PHY registers. Fixes: 5ab43d0f8697 ("phy: socionext: add USB3 PHY driver for UniPhier SoC") Signed-off-by: Ryuta NAKANISHI Signed-off-by: Kunihiko Hayashi Link: https://lore.kernel.org/r/1640150369-4134-1-git-send-email-hayashi.ku= nihiko@socionext.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/phy/socionext/phy-uniphier-usb3ss.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/phy/socionext/phy-uniphier-usb3ss.c b/drivers/phy/soci= onext/phy-uniphier-usb3ss.c index 6700645bcbe6b..3b5ffc16a6947 100644 --- a/drivers/phy/socionext/phy-uniphier-usb3ss.c +++ b/drivers/phy/socionext/phy-uniphier-usb3ss.c @@ -22,11 +22,13 @@ #include =20 #define SSPHY_TESTI 0x0 -#define SSPHY_TESTO 0x4 #define TESTI_DAT_MASK GENMASK(13, 6) #define TESTI_ADR_MASK GENMASK(5, 1) #define TESTI_WR_EN BIT(0) =20 +#define SSPHY_TESTO 0x4 +#define TESTO_DAT_MASK GENMASK(7, 0) + #define PHY_F(regno, msb, lsb) { (regno), (msb), (lsb) } =20 #define CDR_CPD_TRIM PHY_F(7, 3, 0) /* RxPLL charge pump current */ @@ -84,12 +86,12 @@ static void uniphier_u3ssphy_set_param(struct uniphier_= u3ssphy_priv *priv, val =3D FIELD_PREP(TESTI_DAT_MASK, 1); val |=3D FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no); uniphier_u3ssphy_testio_write(priv, val); - val =3D readl(priv->base + SSPHY_TESTO); + val =3D readl(priv->base + SSPHY_TESTO) & TESTO_DAT_MASK; =20 /* update value */ - val &=3D ~FIELD_PREP(TESTI_DAT_MASK, field_mask); + val &=3D ~field_mask; data =3D field_mask & (p->value << p->field.lsb); - val =3D FIELD_PREP(TESTI_DAT_MASK, data); + val =3D FIELD_PREP(TESTI_DAT_MASK, data | val); val |=3D FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no); uniphier_u3ssphy_testio_write(priv, val); uniphier_u3ssphy_testio_write(priv, val | TESTI_WR_EN); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77215C46467 for ; Mon, 24 Jan 2022 23:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365035AbiAXXuF (ORCPT ); Mon, 24 Jan 2022 18:50:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844751AbiAXXKO (ORCPT ); Mon, 24 Jan 2022 18:10:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25D26C0A0293; Mon, 24 Jan 2022 13:18:32 -0800 (PST) Received: from smtp.kernel.org (relay.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 D8346B8105C; Mon, 24 Jan 2022 21:18:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09D05C340E4; Mon, 24 Jan 2022 21:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059109; bh=4F+FoEJCjA5dc535C82+wg9z4q7LEbCQMztv5Eb7YX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hxYvk1NvioHd+hI0vkJay7fSKDA9Ng75Tx14pGrGfYtvAlhm2QEbR/ea6qeGSgAfb oIkwcQylyQq1WI9S6Dgu8xprCc+/amBqidw558oNZpBw3q9yTV4Z0/UkxGwFdDQ6KR 6vYyC0eGuUabI3G9NVKRGiO/HY4YDbwOQZ1SH3Xs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0506/1039] ASoC: mediatek: Check for error clk pointer Date: Mon, 24 Jan 2022 19:38:15 +0100 Message-Id: <20220124184142.289822041@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 9de2b9286a6dd16966959b3cb34fc2ddfd39213e ] Yes, you are right and now the return code depending on the init_clks(). Fixes: 6078c651947a ("soc: mediatek: Refine scpsys to support multiple plat= form") Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20211222015157.1025853-1-jiasheng@iscas.ac.= cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/soc/mediatek/mtk-scpsys.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-s= cpsys.c index ca75b14931ec9..670cc82d17dc2 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -411,12 +411,17 @@ out: return ret; } =20 -static void init_clks(struct platform_device *pdev, struct clk **clk) +static int init_clks(struct platform_device *pdev, struct clk **clk) { int i; =20 - for (i =3D CLK_NONE + 1; i < CLK_MAX; i++) + for (i =3D CLK_NONE + 1; i < CLK_MAX; i++) { clk[i] =3D devm_clk_get(&pdev->dev, clk_names[i]); + if (IS_ERR(clk[i])) + return PTR_ERR(clk[i]); + } + + return 0; } =20 static struct scp *init_scp(struct platform_device *pdev, @@ -426,7 +431,7 @@ static struct scp *init_scp(struct platform_device *pde= v, { struct genpd_onecell_data *pd_data; struct resource *res; - int i, j; + int i, j, ret; struct scp *scp; struct clk *clk[CLK_MAX]; =20 @@ -481,7 +486,9 @@ static struct scp *init_scp(struct platform_device *pde= v, =20 pd_data->num_domains =3D num; =20 - init_clks(pdev, clk); + ret =3D init_clks(pdev, clk); + if (ret) + return ERR_PTR(ret); =20 for (i =3D 0; i < num; i++) { struct scp_domain *scpd =3D &scp->domains[i]; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3859C3526E for ; Mon, 24 Jan 2022 23:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365109AbiAXXuP (ORCPT ); Mon, 24 Jan 2022 18:50:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844747AbiAXXKN (ORCPT ); Mon, 24 Jan 2022 18:10:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38B7EC0A0295; Mon, 24 Jan 2022 13:18:34 -0800 (PST) Received: from smtp.kernel.org (relay.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 6120861496; Mon, 24 Jan 2022 21:18:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AABCC340E4; Mon, 24 Jan 2022 21:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059112; bh=crMXqvSs9XeCYRWN5QFY6tsNKDUACgMNtu1LADo50Es=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qOVHfJO7ZoxKEmK83q/802lOpo6CchlCPZYByMkno9r4MYqc+5k/6VAHhSmcKW4zt fNNcu0gvof7n6L3JMbbJg5I3AbudCFM/A36frTqe7eCid06yT5wpbRAK2UuoQwuREg rXrXvhibwwAZZMylraiQpjevkMrUHZkHpYZ/Uch8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sachin Sant , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0507/1039] powerpc/64s: Mask NIP before checking against SRR0 Date: Mon, 24 Jan 2022 19:38:16 +0100 Message-Id: <20220124184142.325472093@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 314f6c23dd8d417281eb9e8a516dd98036f2e7b3 ] When CONFIG_PPC_RFI_SRR_DEBUG=3Dy we check that NIP and SRR0 match when returning from interrupts. This can trigger falsely if NIP has either of its two low bits set via sigreturn or ptrace, while SRR0 has its low two bits masked in hardware. As a quick fix make sure to mask the low bits before doing the check. Fixes: 59dc5bfca0cb ("powerpc/64s: avoid reloading (H)SRR registers if they= are still valid") Reported-by: Sachin Sant Signed-off-by: Michael Ellerman Tested-by: Sachin Sant Link: https://lore.kernel.org/r/20211221135101.2085547-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kernel/interrupt_64.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/inter= rupt_64.S index ec950b08a8dcc..894588b2381e5 100644 --- a/arch/powerpc/kernel/interrupt_64.S +++ b/arch/powerpc/kernel/interrupt_64.S @@ -30,6 +30,7 @@ COMPAT_SYS_CALL_TABLE: .ifc \srr,srr mfspr r11,SPRN_SRR0 ld r12,_NIP(r1) + clrrdi r12,r12,2 100: tdne r11,r12 EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_SRR1 @@ -39,6 +40,7 @@ COMPAT_SYS_CALL_TABLE: .else mfspr r11,SPRN_HSRR0 ld r12,_NIP(r1) + clrrdi r12,r12,2 100: tdne r11,r12 EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_HSRR1 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55AD5C433FE for ; Mon, 24 Jan 2022 21:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575557AbiAXVv5 (ORCPT ); Mon, 24 Jan 2022 16:51:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37814 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377371AbiAXVSj (ORCPT ); Mon, 24 Jan 2022 16:18:39 -0500 Received: from smtp.kernel.org (relay.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 32C92B812A7; Mon, 24 Jan 2022 21:18:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57A72C340E5; Mon, 24 Jan 2022 21:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059115; bh=zW8E6nDHYA+IOGgYE859eoZ7bTAfChWLdJJ/+NaK2gA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sIunj2+sdZxA66iYdpBgZ3Tz5WmqwY5TRk0Ka5d38w34UvrVKSHkOm6EQvf2T21HR v3FzIEEhYsDdi9tgmHrlPhZf78gTnFcQ95HdGEgrjkBkBDEWa6vyNCn8/Pdeh7W4T0 7GQvHAii1+jziBMKTRhsnmjxI/KqwHKsBI+ue3o8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0508/1039] powerpc/64s: Use EMIT_WARN_ENTRY for SRR debug warnings Date: Mon, 24 Jan 2022 19:38:17 +0100 Message-Id: <20220124184142.359193641@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit fd1eaaaaa6864b5fb8f99880fcefb49760b8fe4e ] When CONFIG_PPC_RFI_SRR_DEBUG=3Dy we check the SRR values before returning from interrupts. This is done in asm using EMIT_BUG_ENTRY, and passing BUGFLAG_WARNING. However that fails to create an exception table entry for the warning, and so do_program_check() fails the exception table search and proceeds to call _exception(), resulting in an oops like: Oops: Exception in kernel mode, sig: 5 [#1] LE PAGE_SIZE=3D64K MMU=3DRadix SMP NR_CPUS=3D2048 NUMA pSeries Modules linked in: CPU: 2 PID: 1204 Comm: sigreturn_unali Tainted: P 5.16.0= -rc2-00194-g91ca3d4f77c5 #12 NIP: c00000000000c5b0 LR: 0000000000000000 CTR: 0000000000000000 ... NIP [c00000000000c5b0] system_call_common+0x150/0x268 LR [0000000000000000] 0x0 Call Trace: [c00000000db73e10] [c00000000000c558] system_call_common+0xf8/0x268 (unre= liable) ... Instruction dump: 7cc803a6 888d0931 2c240000 4082001c 38800000 988d0931 e8810170 e8a10178 7c9a03a6 7cbb03a6 7d7a02a6 e9810170 <7f0b6088> 7d7b02a6 e9810178 7f0b6088 We should instead use EMIT_WARN_ENTRY, which creates an exception table entry for the warning, allowing the warning to be correctly recognised, and the code to resume after printing the warning. Note however that because this warning is buried deep in the interrupt return path, we are not able to recover from it (due to MSR_RI being clear), so we still end up in die() with an unrecoverable exception. Fixes: 59dc5bfca0cb ("powerpc/64s: avoid reloading (H)SRR registers if they= are still valid") Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211221135101.2085547-2-mpe@ellerman.id.au Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kernel/interrupt_64.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/inter= rupt_64.S index 894588b2381e5..4b1ff94e67eb4 100644 --- a/arch/powerpc/kernel/interrupt_64.S +++ b/arch/powerpc/kernel/interrupt_64.S @@ -32,21 +32,21 @@ COMPAT_SYS_CALL_TABLE: ld r12,_NIP(r1) clrrdi r12,r12,2 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_SRR1 ld r12,_MSR(r1) 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) .else mfspr r11,SPRN_HSRR0 ld r12,_NIP(r1) clrrdi r12,r12,2 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_HSRR1 ld r12,_MSR(r1) 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) .endif #endif .endm --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 270FCC433F5 for ; Mon, 24 Jan 2022 21:57:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576095AbiAXVxB (ORCPT ); Mon, 24 Jan 2022 16:53:01 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37822 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447065AbiAXVSo (ORCPT ); Mon, 24 Jan 2022 16:18:44 -0500 Received: from smtp.kernel.org (relay.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 36925B8105C; Mon, 24 Jan 2022 21:18:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68541C340E4; Mon, 24 Jan 2022 21:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059119; bh=pieXjopHJClA3R5Ukxgru4qNpdVk33ngFDmFKm50a+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QvVRPgn4Xt1ZTAJDSOxyQevyqvoCTx2Bcd4W7dalyLuuloDTGXdGYeDFPmQ0ybph7 h5cT8moIDqbqzW5Pa/Ixnzo6YKLw6D/PLaFBXs91In4gKC6yMAWdHkgcYYjYpfLCEA YN4NQjBDZUQyps12KMQRoudivMVswLUbcs1kUSJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Swapnil Jakhade , Aswath Govindraju , Vinod Koul , Sasha Levin Subject: [PATCH 5.16 0509/1039] phy: cadence: Sierra: Fix to get correct parent for mux clocks Date: Mon, 24 Jan 2022 19:38:18 +0100 Message-Id: <20220124184142.400075607@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Swapnil Jakhade [ Upstream commit da08aab940092a050a4fb2857ed9479d2b0e03c4 ] Fix get_parent() callback to return the correct index of the parent for PLL_CMNLC1 clock. Add a separate table of register values corresponding to the parent index for PLL_CMNLC1. Update set_parent() callback accordingly. Fixes: 28081b72859f ("phy: cadence: Sierra: Model PLL_CMNLC and PLL_CMNLC1 = as clocks (mux clocks)") Signed-off-by: Swapnil Jakhade Reviewed-by: Aswath Govindraju Link: https://lore.kernel.org/r/20211223060137.9252-12-sjakhade@cadence.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/phy/cadence/phy-cadence-sierra.c | 31 ++++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence= /phy-cadence-sierra.c index e93818e3991fd..3e2d096d54fd7 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -215,7 +215,10 @@ static const int pll_mux_parent_index[][SIERRA_NUM_CMN= _PLLC_PARENTS] =3D { [CMN_PLLLC1] =3D { PLL1_REFCLK, PLL0_REFCLK }, }; =20 -static u32 cdns_sierra_pll_mux_table[] =3D { 0, 1 }; +static u32 cdns_sierra_pll_mux_table[][SIERRA_NUM_CMN_PLLC_PARENTS] =3D { + [CMN_PLLLC] =3D { 0, 1 }, + [CMN_PLLLC1] =3D { 1, 0 }, +}; =20 struct cdns_sierra_inst { struct phy *phy; @@ -436,11 +439,25 @@ static const struct phy_ops ops =3D { static u8 cdns_sierra_pll_mux_get_parent(struct clk_hw *hw) { struct cdns_sierra_pll_mux *mux =3D to_cdns_sierra_pll_mux(hw); + struct regmap_field *plllc1en_field =3D mux->plllc1en_field; + struct regmap_field *termen_field =3D mux->termen_field; struct regmap_field *field =3D mux->pfdclk_sel_preg; unsigned int val; + int index; =20 regmap_field_read(field, &val); - return clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table, 0, val); + + if (strstr(clk_hw_get_name(hw), clk_names[CDNS_SIERRA_PLL_CMNLC1])) { + index =3D clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table[CMN_PLLLC1]= , 0, val); + if (index =3D=3D 1) { + regmap_field_write(plllc1en_field, 1); + regmap_field_write(termen_field, 1); + } + } else { + index =3D clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table[CMN_PLLLC],= 0, val); + } + + return index; } =20 static int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index) @@ -458,7 +475,11 @@ static int cdns_sierra_pll_mux_set_parent(struct clk_h= w *hw, u8 index) ret |=3D regmap_field_write(termen_field, 1); } =20 - val =3D cdns_sierra_pll_mux_table[index]; + if (strstr(clk_hw_get_name(hw), clk_names[CDNS_SIERRA_PLL_CMNLC1])) + val =3D cdns_sierra_pll_mux_table[CMN_PLLLC1][index]; + else + val =3D cdns_sierra_pll_mux_table[CMN_PLLLC][index]; + ret |=3D regmap_field_write(field, val); =20 return ret; @@ -496,8 +517,8 @@ static int cdns_sierra_pll_mux_register(struct cdns_sie= rra_phy *sp, for (i =3D 0; i < num_parents; i++) { clk =3D sp->input_clks[pll_mux_parent_index[clk_index][i]]; if (IS_ERR_OR_NULL(clk)) { - dev_err(dev, "No parent clock for derived_refclk\n"); - return PTR_ERR(clk); + dev_err(dev, "No parent clock for PLL mux clocks\n"); + return IS_ERR(clk) ? PTR_ERR(clk) : -ENOENT; } parent_names[i] =3D __clk_get_name(clk); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAF00C4321E for ; Mon, 24 Jan 2022 23:58:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366566AbiAXXxE (ORCPT ); Mon, 24 Jan 2022 18:53:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845985AbiAXXOJ (ORCPT ); Mon, 24 Jan 2022 18:14:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5778C0A02BD; Mon, 24 Jan 2022 13:20:51 -0800 (PST) Received: from smtp.kernel.org (relay.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 5538C60C44; Mon, 24 Jan 2022 21:20:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D2C2C340E4; Mon, 24 Jan 2022 21:20:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059250; bh=tGwi8PGuwVZUsl3xSmCHNuQbiPSwT1D+Ohe2sWsCveo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bcST5ddlk6I+q9OyHUlUpSpFuUjGand1Op8QUcsQa0u5uc0xBCeA+oiC6PyZdKkhi YUsXbsJ7dkyL3gWUj56fFHzvyf45DWhUNM4YT8Ob7VIm1hZY0D3FAi8/UK0FageYDX ywnnfYTq/uzU4X6ALgLuo5/Pwu6t4aI8d8AoJoMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.16 0510/1039] iio: chemical: sunrise_co2: set val parameter only on success Date: Mon, 24 Jan 2022 19:38:19 +0100 Message-Id: <20220124184142.432735565@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 38ac2f038666521f94d4fa37b5a9441cef832ccf ] Clang static analysis reports this representative warning sunrise_co2.c:410:9: warning: Assigned value is garbage or undefined *val =3D value; ^ ~~~~~ The ealier call to sunrise_read_word can fail without setting value. So defer setting val until we know the read was successful. Fixes: c397894e24f1 ("iio: chemical: Add Senseair Sunrise 006-0-007 driver") Signed-off-by: Tom Rix Link: https://lore.kernel.org/r/20211224150833.3278236-1-trix@redhat.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iio/chemical/sunrise_co2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/chemical/sunrise_co2.c b/drivers/iio/chemical/sunr= ise_co2.c index 233bd0f379c93..8440dc0c77cfe 100644 --- a/drivers/iio/chemical/sunrise_co2.c +++ b/drivers/iio/chemical/sunrise_co2.c @@ -407,24 +407,24 @@ static int sunrise_read_raw(struct iio_dev *iio_dev, mutex_lock(&sunrise->lock); ret =3D sunrise_read_word(sunrise, SUNRISE_CO2_FILTERED_COMP_REG, &value); - *val =3D value; mutex_unlock(&sunrise->lock); =20 if (ret) return ret; =20 + *val =3D value; return IIO_VAL_INT; =20 case IIO_TEMP: mutex_lock(&sunrise->lock); ret =3D sunrise_read_word(sunrise, SUNRISE_CHIP_TEMPERATURE_REG, &value); - *val =3D value; mutex_unlock(&sunrise->lock); =20 if (ret) return ret; =20 + *val =3D value; return IIO_VAL_INT; =20 default: --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92542C43217 for ; Mon, 24 Jan 2022 21:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575646AbiAXVwK (ORCPT ); Mon, 24 Jan 2022 16:52:10 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38074 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447080AbiAXVTI (ORCPT ); Mon, 24 Jan 2022 16:19:08 -0500 Received: from smtp.kernel.org (relay.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 2E062B811FB; Mon, 24 Jan 2022 21:19:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41B23C340E4; Mon, 24 Jan 2022 21:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059144; bh=IRR7woKXRTUuwAj7dh3xDIZETJ6KdYf3GLSVPriOUYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kKdqxAVCqAYqMe/47QtWUfd54Dl6R1kqSRmDp1LXZyl7MHSBsIjouXj89ZDiZbJgG jL3Fe5ebgIUS+DbM2/ZyPGYHDt8azBPnhvdXj7LKi/slNIKyCG715BmUrdlE5t9GL1 ZvA2cgKlhVVNKOWumSaoCrgECpycASXKffYc7CwY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0511/1039] ASoC: samsung: idma: Check of ioremap return value Date: Mon, 24 Jan 2022 19:38:20 +0100 Message-Id: <20220124184142.463537167@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 3ecb46755eb85456b459a1a9f952c52986bce8ec ] Because of the potential failure of the ioremap(), the buf->area could be NULL. Therefore, we need to check it and return -ENOMEM in order to transfer the error. Fixes: f09aecd50f39 ("ASoC: SAMSUNG: Add I2S0 internal dma driver") Signed-off-by: Jiasheng Jiang Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20211228034026.1659385-1-jiasheng@iscas.ac.= cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/samsung/idma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c index 66bcc2f97544b..c3f1b054e2389 100644 --- a/sound/soc/samsung/idma.c +++ b/sound/soc/samsung/idma.c @@ -360,6 +360,8 @@ static int preallocate_idma_buffer(struct snd_pcm *pcm,= int stream) buf->addr =3D idma.lp_tx_addr; buf->bytes =3D idma_hardware.buffer_bytes_max; buf->area =3D (unsigned char * __force)ioremap(buf->addr, buf->bytes); + if (!buf->area) + return -ENOMEM; =20 return 0; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9273BC433EF for ; Mon, 24 Jan 2022 23:58:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366387AbiAXXwp (ORCPT ); Mon, 24 Jan 2022 18:52:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845907AbiAXXNz (ORCPT ); Mon, 24 Jan 2022 18:13:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2DB8C09F4BF; Mon, 24 Jan 2022 13:19:40 -0800 (PST) Received: from smtp.kernel.org (relay.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 AAC58B80FA1; Mon, 24 Jan 2022 21:19:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFE25C340E4; Mon, 24 Jan 2022 21:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059178; bh=4n20CruvaLm92Dk2ViJNwsid1IZpIeyuGIIo5tTJCkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wG5rGyhGeT+vA6zMXs96jRJODmzh4F+1f+yZv8Z4MjfJp0dPP++jGx91VtkiAjwrm 5sefpIWh4YbeJbfPVB5/PHMoRP2nqZo84WcR55d92op1wnkUtOPidwZuZt40/d2KiY 6jw/YdN3FcIwfxO1vrbbq1eB3ecprK6vpWRxbPOI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wei Yongjun , Sasha Levin Subject: [PATCH 5.16 0512/1039] misc: lattice-ecp3-config: Fix task hung when firmware load failed Date: Mon, 24 Jan 2022 19:38:21 +0100 Message-Id: <20220124184142.494965616@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wei Yongjun [ Upstream commit fcee5ce50bdb21116711e38635e3865594af907e ] When firmware load failed, kernel report task hung as follows: INFO: task xrun:5191 blocked for more than 147 seconds. Tainted: G W 5.16.0-rc5-next-20211220+ #11 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:xrun state:D stack: 0 pid: 5191 ppid: 270 flags:0x0000= 0004 Call Trace: __schedule+0xc12/0x4b50 kernel/sched/core.c:4986 schedule+0xd7/0x260 kernel/sched/core.c:6369 (discriminator 1) schedule_timeout+0x7aa/0xa80 kernel/time/timer.c:1857 wait_for_completion+0x181/0x290 kernel/sched/completion.c:85 lattice_ecp3_remove+0x32/0x40 drivers/misc/lattice-ecp3-config.c:221 spi_remove+0x72/0xb0 drivers/spi/spi.c:409 lattice_ecp3_remove() wait for signals from firmware loading, but when load failed, firmware_load() does not send this signal. This cause device remove hung. Fix it by sending signal even if load failed. Fixes: 781551df57c7 ("misc: Add Lattice ECP3 FPGA configuration via SPI") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun Link: https://lore.kernel.org/r/20211228125522.3122284-1-weiyongjun1@huawei= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/misc/lattice-ecp3-config.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3= -config.c index 0f54730c7ed56..98828030b5a4d 100644 --- a/drivers/misc/lattice-ecp3-config.c +++ b/drivers/misc/lattice-ecp3-config.c @@ -76,12 +76,12 @@ static void firmware_load(const struct firmware *fw, vo= id *context) =20 if (fw =3D=3D NULL) { dev_err(&spi->dev, "Cannot load firmware, aborting\n"); - return; + goto out; } =20 if (fw->size =3D=3D 0) { dev_err(&spi->dev, "Error: Firmware size is 0!\n"); - return; + goto out; } =20 /* Fill dummy data (24 stuffing bits for commands) */ @@ -103,7 +103,7 @@ static void firmware_load(const struct firmware *fw, vo= id *context) dev_err(&spi->dev, "Error: No supported FPGA detected (JEDEC_ID=3D%08x)!\n", jedec_id); - return; + goto out; } =20 dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); @@ -116,7 +116,7 @@ static void firmware_load(const struct firmware *fw, vo= id *context) buffer =3D kzalloc(fw->size + 8, GFP_KERNEL); if (!buffer) { dev_err(&spi->dev, "Error: Can't allocate memory!\n"); - return; + goto out; } =20 /* @@ -155,7 +155,7 @@ static void firmware_load(const struct firmware *fw, vo= id *context) "Error: Timeout waiting for FPGA to clear (status=3D%08x)!\n", status); kfree(buffer); - return; + goto out; } =20 dev_info(&spi->dev, "Configuring the FPGA...\n"); @@ -181,7 +181,7 @@ static void firmware_load(const struct firmware *fw, vo= id *context) release_firmware(fw); =20 kfree(buffer); - +out: complete(&data->fw_loaded); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05431C4167B for ; Mon, 24 Jan 2022 21:58:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575764AbiAXVw3 (ORCPT ); Mon, 24 Jan 2022 16:52:29 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38758 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450302AbiAXVUO (ORCPT ); Mon, 24 Jan 2022 16:20:14 -0500 Received: from smtp.kernel.org (relay.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 EDFB2B80FA1; Mon, 24 Jan 2022 21:20:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A171C340E4; Mon, 24 Jan 2022 21:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059211; bh=gHfSCmYBYByuJZQy+bCo3KStS81UFeM1yUwFWwaOcNA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hURe8OSgNVR2xmq6oyZ1WhVqa7r9yK7vjLa1x7R4GrvcjocbrEyn0UkQl6TymiMAb xd7yRDege7ntU6raEUVWFYRxYkoFMeQWKodYEdR0cz9SihSEjujgLIJZk9VSdUIpVv PNOWr6XuiLrar077jScvT0TFqbN8+Y2BqfCzdZZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trevor Wu , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0513/1039] ASoC: mediatek: mt8195: correct pcmif BE dai control flow Date: Mon, 24 Jan 2022 19:38:22 +0100 Message-Id: <20220124184142.533382913@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trevor Wu [ Upstream commit 2355028c0c54c03afb66c589347f1dc9f6fe2e38 ] Originally, the conditions for preventing reentry are not correct. dai->component->active is not the state specifically for pcmif dai, so it is not a correct condition to indicate the status of pcmif dai. On the other hand, snd_soc_dai_stream_actvie() in prepare ops for both playback and capture possibly return true at the first entry when these two streams are opened at the same time. In the patch, I refer to the implementation in mt8192-dai-pcm.c. Clock and enabling bit for PCMIF are managed by DAPM, and the condition for prepare ops is replaced by the status of dai widget. Fixes: 1f95c019115c ("ASoC: mediatek: mt8195: support pcm in platform drive= r") Signed-off-by: Trevor Wu Link: https://lore.kernel.org/r/20211230084731.31372-2-trevor.wu@mediatek.c= om Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/mediatek/mt8195/mt8195-dai-pcm.c | 73 +++++++--------------- sound/soc/mediatek/mt8195/mt8195-reg.h | 1 + 2 files changed, 22 insertions(+), 52 deletions(-) diff --git a/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c b/sound/soc/mediate= k/mt8195/mt8195-dai-pcm.c index 5d10d2c4c991c..151914c873acd 100644 --- a/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c +++ b/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c @@ -80,8 +80,15 @@ static const struct snd_soc_dapm_widget mtk_dai_pcm_widg= ets[] =3D { mtk_dai_pcm_o001_mix, ARRAY_SIZE(mtk_dai_pcm_o001_mix)), =20 + SND_SOC_DAPM_SUPPLY("PCM_EN", PCM_INTF_CON1, + PCM_INTF_CON1_PCM_EN_SHIFT, 0, NULL, 0), + SND_SOC_DAPM_INPUT("PCM1_INPUT"), SND_SOC_DAPM_OUTPUT("PCM1_OUTPUT"), + + SND_SOC_DAPM_CLOCK_SUPPLY("aud_asrc11"), + SND_SOC_DAPM_CLOCK_SUPPLY("aud_asrc12"), + SND_SOC_DAPM_CLOCK_SUPPLY("aud_pcmif"), }; =20 static const struct snd_soc_dapm_route mtk_dai_pcm_routes[] =3D { @@ -97,22 +104,18 @@ static const struct snd_soc_dapm_route mtk_dai_pcm_rou= tes[] =3D { {"PCM1 Playback", NULL, "O000"}, {"PCM1 Playback", NULL, "O001"}, =20 + {"PCM1 Playback", NULL, "PCM_EN"}, + {"PCM1 Playback", NULL, "aud_asrc12"}, + {"PCM1 Playback", NULL, "aud_pcmif"}, + + {"PCM1 Capture", NULL, "PCM_EN"}, + {"PCM1 Capture", NULL, "aud_asrc11"}, + {"PCM1 Capture", NULL, "aud_pcmif"}, + {"PCM1_OUTPUT", NULL, "PCM1 Playback"}, {"PCM1 Capture", NULL, "PCM1_INPUT"}, }; =20 -static void mtk_dai_pcm_enable(struct mtk_base_afe *afe) -{ - regmap_update_bits(afe->regmap, PCM_INTF_CON1, - PCM_INTF_CON1_PCM_EN, PCM_INTF_CON1_PCM_EN); -} - -static void mtk_dai_pcm_disable(struct mtk_base_afe *afe) -{ - regmap_update_bits(afe->regmap, PCM_INTF_CON1, - PCM_INTF_CON1_PCM_EN, 0x0); -} - static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { @@ -207,54 +210,22 @@ static int mtk_dai_pcm_configure(struct snd_pcm_subst= ream *substream, } =20 /* dai ops */ -static int mtk_dai_pcm_startup(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - struct mtk_base_afe *afe =3D snd_soc_dai_get_drvdata(dai); - struct mt8195_afe_private *afe_priv =3D afe->platform_priv; - - if (dai->component->active) - return 0; - - mt8195_afe_enable_clk(afe, afe_priv->clk[MT8195_CLK_AUD_ASRC11]); - mt8195_afe_enable_clk(afe, afe_priv->clk[MT8195_CLK_AUD_ASRC12]); - mt8195_afe_enable_clk(afe, afe_priv->clk[MT8195_CLK_AUD_PCMIF]); - - return 0; -} - -static void mtk_dai_pcm_shutdown(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - struct mtk_base_afe *afe =3D snd_soc_dai_get_drvdata(dai); - struct mt8195_afe_private *afe_priv =3D afe->platform_priv; - - if (dai->component->active) - return; - - mtk_dai_pcm_disable(afe); - - mt8195_afe_disable_clk(afe, afe_priv->clk[MT8195_CLK_AUD_PCMIF]); - mt8195_afe_disable_clk(afe, afe_priv->clk[MT8195_CLK_AUD_ASRC12]); - mt8195_afe_disable_clk(afe, afe_priv->clk[MT8195_CLK_AUD_ASRC11]); -} - static int mtk_dai_pcm_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct mtk_base_afe *afe =3D snd_soc_dai_get_drvdata(dai); - int ret =3D 0; + int ret; =20 - if (snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_PLAYBACK) && - snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_CAPTURE)) + dev_dbg(dai->dev, "%s(), id %d, stream %d, widget active p %d, c %d\n", + __func__, dai->id, substream->stream, + dai->playback_widget->active, dai->capture_widget->active); + + if (dai->playback_widget->active || dai->capture_widget->active) return 0; =20 ret =3D mtk_dai_pcm_configure(substream, dai); if (ret) return ret; =20 - mtk_dai_pcm_enable(afe); - return 0; } =20 @@ -316,8 +287,6 @@ static int mtk_dai_pcm_set_fmt(struct snd_soc_dai *dai,= unsigned int fmt) } =20 static const struct snd_soc_dai_ops mtk_dai_pcm_ops =3D { - .startup =3D mtk_dai_pcm_startup, - .shutdown =3D mtk_dai_pcm_shutdown, .prepare =3D mtk_dai_pcm_prepare, .set_fmt =3D mtk_dai_pcm_set_fmt, }; diff --git a/sound/soc/mediatek/mt8195/mt8195-reg.h b/sound/soc/mediatek/mt= 8195/mt8195-reg.h index d06f9cf85a4ec..d3871353db415 100644 --- a/sound/soc/mediatek/mt8195/mt8195-reg.h +++ b/sound/soc/mediatek/mt8195/mt8195-reg.h @@ -2550,6 +2550,7 @@ #define PCM_INTF_CON1_PCM_FMT(x) (((x) & 0x3) << 1) #define PCM_INTF_CON1_PCM_FMT_MASK (0x3 << 1) #define PCM_INTF_CON1_PCM_EN BIT(0) +#define PCM_INTF_CON1_PCM_EN_SHIFT 0 =20 /* PCM_INTF_CON2 */ #define PCM_INTF_CON2_CLK_DOMAIN_SEL(x) (((x) & 0x3) << 23) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6389BC4332F for ; Mon, 24 Jan 2022 21:57:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575899AbiAXVwl (ORCPT ); Mon, 24 Jan 2022 16:52:41 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43222 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450448AbiAXVUg (ORCPT ); Mon, 24 Jan 2022 16:20:36 -0500 Received: from smtp.kernel.org (relay.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 17297614B4; Mon, 24 Jan 2022 21:20:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F97DC340E4; Mon, 24 Jan 2022 21:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059233; bh=LsVwnJIEvisLM9UBPEff0RzYO/iKyX2BTRuQHjWcbMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D6zrh275JShnzzN+imn/4jk1mkOnKbaJ2UEHF8BT0/OldA8d3jdLDF+uqetRv9dNH WsaVXR1BqgeT06Qqg7oee3enknDcqco5pWYfb87EC31vFFPKp9olYvDizunkoLHqYk 8J7ufPFbcamrpw+A1vT8QZLyqPSVduSvj7zV3euc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sameer Pujar , Takashi Iwai , Sasha Levin Subject: [PATCH 5.16 0514/1039] arm64: tegra: Remove non existent Tegra194 reset Date: Mon, 24 Jan 2022 19:38:23 +0100 Message-Id: <20220124184142.566214059@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sameer Pujar [ Upstream commit 146b3a77af8091cabbd1decc51d67799e69682d2 ] Tegra194 does not really have "hda2codec_2x" related reset. Hence drop this entry to reflect actual HW. Fixes: 4878cc0c9fab ("arm64: tegra: Add HDA controller on Tegra194") Signed-off-by: Sameer Pujar Link: https://lore.kernel.org/r/1640260431-11613-4-git-send-email-spujar@nv= idia.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts= /nvidia/tegra194.dtsi index 851e049b3519c..dcc0e55d6bdbb 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -976,9 +976,8 @@ <&bpmp TEGRA194_CLK_HDA2CODEC_2X>; clock-names =3D "hda", "hda2hdmi", "hda2codec_2x"; resets =3D <&bpmp TEGRA194_RESET_HDA>, - <&bpmp TEGRA194_RESET_HDA2HDMICODEC>, - <&bpmp TEGRA194_RESET_HDA2CODEC_2X>; - reset-names =3D "hda", "hda2hdmi", "hda2codec_2x"; + <&bpmp TEGRA194_RESET_HDA2HDMICODEC>; + reset-names =3D "hda", "hda2hdmi"; power-domains =3D <&bpmp TEGRA194_POWER_DOMAIN_DISP>; interconnects =3D <&mc TEGRA194_MEMORY_CLIENT_HDAR &emc>, <&mc TEGRA194_MEMORY_CLIENT_HDAW &emc>; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79600C43219 for ; Mon, 24 Jan 2022 21:57:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575918AbiAXVwn (ORCPT ); Mon, 24 Jan 2022 16:52:43 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38896 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450471AbiAXVUj (ORCPT ); Mon, 24 Jan 2022 16:20:39 -0500 Received: from smtp.kernel.org (relay.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 A95FDB811A2; Mon, 24 Jan 2022 21:20:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16067C340E4; Mon, 24 Jan 2022 21:20:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059236; bh=Qbnpal6S+UxOf65CG/ERZROcEXBzaAoH3S2RJUPcGq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RPsNuzs1COLkELw2/mZC11+TNSSZVDNo/qQzY/5W/HqRTaJC6zntbPT+5fop1mYvB NaWM0C74JnUpeNLWYNgRbprDdZ0k65Qgzus12mHtZwcedIZHNCFZs/39H78v1RyApS qsnbSyX2Y/53Wa398Vz+zswWhJt1d7IF6PWeQo9s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , kernel test robot , Jonathan Cameron , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.16 0515/1039] mips: lantiq: add support for clk_set_parent() Date: Mon, 24 Jan 2022 19:38:24 +0100 Message-Id: <20220124184142.604075292@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 76f66dfd60dc5d2f9dec22d99091fea1035c5d03 ] Provide a simple implementation of clk_set_parent() in the lantiq subarch so that callers of it will build without errors. Fixes these build errors: ERROR: modpost: "clk_set_parent" [sound/soc/jz4740/snd-soc-jz4740-i2s.ko] u= ndefined! ERROR: modpost: "clk_set_parent" [sound/soc/atmel/snd-soc-atmel-i2s.ko] und= efined! Fixes: 171bb2f19ed6 ("MIPS: Lantiq: Add initial support for Lantiq SoCs") Signed-off-by: Randy Dunlap Reported-by: kernel test robot --to=3Dlinux-mips@vger.kernel.org --cc=3D"John Crispin " = --cc=3D"Jonathan Cameron " --cc=3D"Russell King " --cc=3D"Andy Shevchenko " --cc= =3Dalsa-devel@alsa-project.org --to=3D"Thomas Bogendoerfer " Reviewed-by: Jonathan Cameron Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/mips/lantiq/clk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c index 4916cccf378fd..7a623684d9b5e 100644 --- a/arch/mips/lantiq/clk.c +++ b/arch/mips/lantiq/clk.c @@ -164,6 +164,12 @@ struct clk *clk_get_parent(struct clk *clk) } EXPORT_SYMBOL(clk_get_parent); =20 +int clk_set_parent(struct clk *clk, struct clk *parent) +{ + return 0; +} +EXPORT_SYMBOL(clk_set_parent); + static inline u32 get_counter_resolution(void) { u32 res; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCF1BC4321E for ; Mon, 24 Jan 2022 21:57:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575950AbiAXVwq (ORCPT ); Mon, 24 Jan 2022 16:52:46 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43272 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450490AbiAXVUk (ORCPT ); Mon, 24 Jan 2022 16:20:40 -0500 Received: from smtp.kernel.org (relay.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 CDDD7614C7; Mon, 24 Jan 2022 21:20:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1073C340E4; Mon, 24 Jan 2022 21:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059239; bh=hjv/7tHzGjCV2RdHyu0RB7cGIUyd+Cr9zZGJnMbWeZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uDoR8zkKF18/Mg2Wpib9Y0Pmmvv8gbKoLdP2Lt4GYCaDtkcRYf3nXXSe5aNSCAvu3 htRO0RDmq0Sws483//VH5NBr4sS7/jOT78tGQN1IYxl5SVrXqj44XwpGU/UFvPRVuw 3WGXAcf9tn3z31c0chTzAnGyClMIEHI0jKglZM+s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Jonathan Cameron , Florian Fainelli , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.16 0516/1039] mips: bcm63xx: add support for clk_set_parent() Date: Mon, 24 Jan 2022 19:38:25 +0100 Message-Id: <20220124184142.636743478@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 6f03055d508ff4feb8db02ba3df9303a1db8d381 ] The MIPS BMC63XX subarch does not provide/support clk_set_parent(). This causes build errors in a few drivers, so add a simple implementation of that function so that callers of it will build without errors. Fixes these build errors: ERROR: modpost: "clk_set_parent" [sound/soc/jz4740/snd-soc-jz4740-i2s.ko] u= ndefined! ERROR: modpost: "clk_set_parent" [sound/soc/atmel/snd-soc-atmel-i2s.ko] und= efined! Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx f= amily of SOCs." ) Signed-off-by: Randy Dunlap Reviewed-by: Jonathan Cameron Acked-by: Florian Fainelli Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/mips/bcm63xx/clk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c index 1c91064cb448b..6e6756e8fa0a9 100644 --- a/arch/mips/bcm63xx/clk.c +++ b/arch/mips/bcm63xx/clk.c @@ -387,6 +387,12 @@ struct clk *clk_get_parent(struct clk *clk) } EXPORT_SYMBOL(clk_get_parent); =20 +int clk_set_parent(struct clk *clk, struct clk *parent) +{ + return 0; +} +EXPORT_SYMBOL(clk_set_parent); + unsigned long clk_get_rate(struct clk *clk) { if (!clk) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E23DC4167E for ; Mon, 24 Jan 2022 21:58:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576031AbiAXVwy (ORCPT ); Mon, 24 Jan 2022 16:52:54 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38990 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450514AbiAXVUo (ORCPT ); Mon, 24 Jan 2022 16:20:44 -0500 Received: from smtp.kernel.org (relay.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 7B927B8122A; Mon, 24 Jan 2022 21:20:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97DDDC340E4; Mon, 24 Jan 2022 21:20:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059242; bh=jSECrfroaRL6gnqItNOsQdsp2IFqaB2YwhTsNYAREpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FK+WdRPGTGbxXmsYUEMr4CGo1hbxvACrv9wdL7J2lY6KR4QnbFBSiyS4hctE3lxO7 rB5PXpFVyxXDqSY0JeJtP8Dx9P61EAISci+W21z9KfpiXawQ+bvX73MwLtpCWTeYXh 8vFmOhxgWmgIUNSYsvO57qXZHLfYoTlZHvhivRhc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ammar Faizi , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0517/1039] powerpc/xive: Add missing null check after calling kmalloc Date: Mon, 24 Jan 2022 19:38:26 +0100 Message-Id: <20220124184142.670010140@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Ammar Faizi [ Upstream commit 18dbfcdedc802f9500b2c29794f22a31d27639c0 ] Commit 930914b7d528fc ("powerpc/xive: Add a debugfs file to dump internal XIVE state") forgot to add a null check. Add it. Fixes: 930914b7d528fc6b0249bffc00564100bcf6ef75 ("powerpc/xive: Add a debug= fs file to dump internal XIVE state") Signed-off-by: Ammar Faizi Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211226135314.251221-1-ammar.faizi@intel.c= om Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/sysdev/xive/spapr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/sp= apr.c index f143b6f111ac0..1179632560b8d 100644 --- a/arch/powerpc/sysdev/xive/spapr.c +++ b/arch/powerpc/sysdev/xive/spapr.c @@ -653,6 +653,9 @@ static int xive_spapr_debug_show(struct seq_file *m, vo= id *private) struct xive_irq_bitmap *xibm; char *buf =3D kmalloc(PAGE_SIZE, GFP_KERNEL); =20 + if (!buf) + return -ENOMEM; + list_for_each_entry(xibm, &xive_irq_bitmaps, list) { memset(buf, 0, PAGE_SIZE); bitmap_print_to_pagebuf(true, buf, xibm->bitmap, xibm->count); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C794C4167E for ; Mon, 24 Jan 2022 21:57:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576047AbiAXVw6 (ORCPT ); Mon, 24 Jan 2022 16:52:58 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43322 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450518AbiAXVUq (ORCPT ); Mon, 24 Jan 2022 16:20:46 -0500 Received: from smtp.kernel.org (relay.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 8302B614B7; Mon, 24 Jan 2022 21:20:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AA60C340E4; Mon, 24 Jan 2022 21:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059245; bh=I+JvnFAHS41UTtNdATtf26YEGvSzYJcB0kAE6Oy/G6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iozpRhXVp6DnZmzNZusRx7dOGnfR7eXnmrFoYBajG+UzE84h+uUnlraYoYYpFSr28 WxfR3zbnb53qLfr4x6IdSmAuNEn1xCoXLfPdSa1W/opoEJXLW9AhhrQGpKliE1fZJ6 U00DXuaWoWQB02/z+qASgw76SbZXl72ReVJ7vqFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alyssa Ross , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0518/1039] ASoC: fsl_mqs: fix MODULE_ALIAS Date: Mon, 24 Jan 2022 19:38:27 +0100 Message-Id: <20220124184142.708145770@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alyssa Ross [ Upstream commit 9f3d45318dd9e739ed62e4218839a7a824d3cced ] modprobe can't handle spaces in aliases. Fixes: 9e28f6532c61 ("ASoC: fsl_mqs: Add MQS component driver") Signed-off-by: Alyssa Ross Link: https://lore.kernel.org/r/20220104132218.1690103-1-hi@alyssa.is Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/fsl/fsl_mqs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/fsl/fsl_mqs.c b/sound/soc/fsl/fsl_mqs.c index 27b4536dce443..ceaecbe3a25e4 100644 --- a/sound/soc/fsl/fsl_mqs.c +++ b/sound/soc/fsl/fsl_mqs.c @@ -337,4 +337,4 @@ module_platform_driver(fsl_mqs_driver); MODULE_AUTHOR("Shengjiu Wang "); MODULE_DESCRIPTION("MQS codec driver"); MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform: fsl-mqs"); +MODULE_ALIAS("platform:fsl-mqs"); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21AC7C4167D for ; Mon, 24 Jan 2022 22:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578236AbiAXWCH (ORCPT ); Mon, 24 Jan 2022 17:02:07 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43348 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450533AbiAXVUy (ORCPT ); Mon, 24 Jan 2022 16:20:54 -0500 Received: from smtp.kernel.org (relay.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 93DEB614B8; Mon, 24 Jan 2022 21:20:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78820C340E5; Mon, 24 Jan 2022 21:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059248; bh=wxcf2td4nock/WupOP7KOGXdCb7aoLTxQcRZqO5Uhzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1c5X7+Y+FkGMCmVQd0bli0fyTN3QakZb0bVJ4kfraVW0gyT5n6J7hp+JgnUutS15K kjfdPFD/ThOnXl9G17qpXczNtirUcS4MRcqaKdgsZPtTM39F+tabTrpcvZdHMNs9HX omWgemzi/lPnZg4uo6vRUOBlNKqNGQakraMNTCeU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Christian A. Ehrhardt" , Takashi Iwai , Sasha Levin Subject: [PATCH 5.16 0519/1039] ALSA: hda/cs8409: Increase delay during jack detection Date: Mon, 24 Jan 2022 19:38:28 +0100 Message-Id: <20220124184142.737904112@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian A. Ehrhardt [ Upstream commit 8cd07657177006b67cc1610e4466cc75ad781c05 ] Commit c8b4f0865e82 reduced delays related to cs42l42 jack detection. However, the change was too aggressive. As a result internal speakers on DELL Inspirion 3501 are not detected. Increase the delay in cs42l42_run_jack_detect() a bit. Fixes: c8b4f0865e82 ("ALSA: hda/cs8409: Remove unnecessary delays") Signed-off-by: Christian A. Ehrhardt Link: https://lore.kernel.org/r/20211231131221.itwotyfk5qomn7n6@cae.in-ulm.= de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/pci/hda/patch_cs8409.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/pci/hda/patch_cs8409.c b/sound/pci/hda/patch_cs8409.c index 039b9f2f8e947..bf5d7f0c6ba55 100644 --- a/sound/pci/hda/patch_cs8409.c +++ b/sound/pci/hda/patch_cs8409.c @@ -628,8 +628,8 @@ static void cs42l42_run_jack_detect(struct sub_codec *c= s42l42) cs8409_i2c_write(cs42l42, 0x1b74, 0x07); cs8409_i2c_write(cs42l42, 0x131b, 0xFD); cs8409_i2c_write(cs42l42, 0x1120, 0x80); - /* Wait ~100us*/ - usleep_range(100, 200); + /* Wait ~20ms*/ + usleep_range(20000, 25000); cs8409_i2c_write(cs42l42, 0x111f, 0x77); cs8409_i2c_write(cs42l42, 0x1120, 0xc0); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E728C41535 for ; Mon, 24 Jan 2022 21:58:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575853AbiAXVwi (ORCPT ); Mon, 24 Jan 2022 16:52:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38090 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448683AbiAXVTO (ORCPT ); Mon, 24 Jan 2022 16:19:14 -0500 Received: from smtp.kernel.org (relay.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 48920B81061; Mon, 24 Jan 2022 21:19:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CF92C340E4; Mon, 24 Jan 2022 21:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059148; bh=HXJV0jhVF0YnUWsRplcUKIX+Ihje/JCzSZtYZ+p4VdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tCgvKrLWMc9Wl9xqbOPjcAi9TMATx7qj0HA6RlBSgaOAJfcAgU00Jx4MrIzeMC9+o PFWaesm/UpFhyahH1Oho+kZcJmVjic7CplqK/jj3rA6IFModh+yjctOSb7St+PpQZf LEq3hfk2j+n12NhyfDiRJCUREI0Jh9tLEeY6J9tE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Christian A. Ehrhardt" , Takashi Iwai , Sasha Levin Subject: [PATCH 5.16 0520/1039] ALSA: hda/cs8409: Fix Jack detection after resume Date: Mon, 24 Jan 2022 19:38:29 +0100 Message-Id: <20220124184142.769715347@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian A. Ehrhardt [ Upstream commit 57f234248ff925d88caedf4019ec84e6ecb83909 ] The suspend code unconditionally sets ->hp_jack_in and ->mic_jack_in to zero but without reporting this status change to the HDA core. To compensate for this, always assume a status change on the first unsol event after boot or resume. Fixes: 424e531b47f8 ("ALSA: hda/cs8409: Ensure Type Detection is only run o= n startup when necessary") Signed-off-by: Christian A. Ehrhardt Link: https://lore.kernel.org/r/20211231134432.atwmuzeceqiklcoa@cae.in-ulm.= de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/pci/hda/patch_cs8409-tables.c | 3 +++ sound/pci/hda/patch_cs8409.c | 5 ++++- sound/pci/hda/patch_cs8409.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_cs8409-tables.c b/sound/pci/hda/patch_cs84= 09-tables.c index 0fb0a428428b4..df0b4522babf7 100644 --- a/sound/pci/hda/patch_cs8409-tables.c +++ b/sound/pci/hda/patch_cs8409-tables.c @@ -252,6 +252,7 @@ struct sub_codec cs8409_cs42l42_codec =3D { .init_seq_num =3D ARRAY_SIZE(cs42l42_init_reg_seq), .hp_jack_in =3D 0, .mic_jack_in =3D 0, + .force_status_change =3D 1, .paged =3D 1, .suspended =3D 1, .no_type_dect =3D 0, @@ -443,6 +444,7 @@ struct sub_codec dolphin_cs42l42_0 =3D { .init_seq_num =3D ARRAY_SIZE(dolphin_c0_init_reg_seq), .hp_jack_in =3D 0, .mic_jack_in =3D 0, + .force_status_change =3D 1, .paged =3D 1, .suspended =3D 1, .no_type_dect =3D 0, @@ -456,6 +458,7 @@ struct sub_codec dolphin_cs42l42_1 =3D { .init_seq_num =3D ARRAY_SIZE(dolphin_c1_init_reg_seq), .hp_jack_in =3D 0, .mic_jack_in =3D 0, + .force_status_change =3D 1, .paged =3D 1, .suspended =3D 1, .no_type_dect =3D 1, diff --git a/sound/pci/hda/patch_cs8409.c b/sound/pci/hda/patch_cs8409.c index bf5d7f0c6ba55..aff2b5abb81ea 100644 --- a/sound/pci/hda/patch_cs8409.c +++ b/sound/pci/hda/patch_cs8409.c @@ -636,7 +636,9 @@ static void cs42l42_run_jack_detect(struct sub_codec *c= s42l42) =20 static int cs42l42_handle_tip_sense(struct sub_codec *cs42l42, unsigned in= t reg_ts_status) { - int status_changed =3D 0; + int status_changed =3D cs42l42->force_status_change; + + cs42l42->force_status_change =3D 0; =20 /* TIP_SENSE INSERT/REMOVE */ switch (reg_ts_status) { @@ -791,6 +793,7 @@ static void cs42l42_suspend(struct sub_codec *cs42l42) cs42l42->last_page =3D 0; cs42l42->hp_jack_in =3D 0; cs42l42->mic_jack_in =3D 0; + cs42l42->force_status_change =3D 1; =20 /* Put CS42L42 into Reset */ gpio_data =3D snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GP= IO_DATA, 0); diff --git a/sound/pci/hda/patch_cs8409.h b/sound/pci/hda/patch_cs8409.h index ade2b838590cf..d0b725c7285b6 100644 --- a/sound/pci/hda/patch_cs8409.h +++ b/sound/pci/hda/patch_cs8409.h @@ -305,6 +305,7 @@ struct sub_codec { =20 unsigned int hp_jack_in:1; unsigned int mic_jack_in:1; + unsigned int force_status_change:1; unsigned int suspended:1; unsigned int paged:1; unsigned int last_page; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61ADFC433FE for ; Mon, 24 Jan 2022 23:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386533AbiAXXqG (ORCPT ); Mon, 24 Jan 2022 18:46:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845359AbiAXXMI (ORCPT ); Mon, 24 Jan 2022 18:12:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F4C1C067A48; Mon, 24 Jan 2022 13:19:13 -0800 (PST) Received: from smtp.kernel.org (relay.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 4DC01B8121C; Mon, 24 Jan 2022 21:19:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D618C340E4; Mon, 24 Jan 2022 21:19:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059151; bh=Bb08eC+W8XTdWgECuLhGZ+SpmqB3ZVW7ydcpMUaZC30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RSg8q3OUG6lVg8s7ELLLbCffpPlr4oPLEhd0kTMS+/pjmwZQvfvuzyilg04b/5gh5 3kY/8uHMIyku0PhF6GqqD+BVdpoCu9sUxcLI1g6nzWZPVS8ji0S1cvjfBnkd/L1TEi 4LiTjre4mRq0prYsZUOzV0jXGhUNqZggiQ7uNJGM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Dan Williams , Sasha Levin Subject: [PATCH 5.16 0521/1039] cxl/core: Remove cxld_const_init in cxl_decoder_alloc() Date: Mon, 24 Jan 2022 19:38:30 +0100 Message-Id: <20220124184142.802001397@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Nathan Chancellor [ Upstream commit be185c2988b48db65348d94168c793bdbc8d23c3 ] Commit 48667f676189 ("cxl/core: Split decoder setup into alloc + add") aimed to fix a large stack frame warning but from v5 to v6, it introduced a new instance of the warning due to allocating cxld_const_init on the stack, which was done due to the use of const on the nr_target member of the cxl_decoder struct. With ARCH=3Darm allmodconfig minus CONFIG_KASAN: GCC 11.2.0: drivers/cxl/core/bus.c: In function =E2=80=98cxl_decoder_alloc=E2=80=99: drivers/cxl/core/bus.c:523:1: error: the frame size of 1032 bytes is larger= than 1024 bytes [-Werror=3Dframe-larger-than=3D] 523 | } | ^ cc1: all warnings being treated as errors Clang 12.0.1: drivers/cxl/core/bus.c:486:21: error: stack frame size of 1056 bytes in fun= ction 'cxl_decoder_alloc' [-Werror,-Wframe-larger-than=3D] struct cxl_decoder *cxl_decoder_alloc(struct cxl_port *port, int nr_targets) ^ 1 error generated. Revert that part of the change, which makes the stack frame of cxl_decoder_alloc() much more reasonable. Fixes: 48667f676189 ("cxl/core: Split decoder setup into alloc + add") Link: https://github.com/ClangBuiltLinux/linux/issues/1539 Signed-off-by: Nathan Chancellor Link: https://lore.kernel.org/r/20211210213627.2477370-1-nathan@kernel.org Signed-off-by: Dan Williams Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/cxl/core/bus.c | 6 ++---- drivers/cxl/cxl.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/cxl/core/bus.c b/drivers/cxl/core/bus.c index ebd061d039508..46ce58376580b 100644 --- a/drivers/cxl/core/bus.c +++ b/drivers/cxl/core/bus.c @@ -485,9 +485,7 @@ out_unlock: =20 struct cxl_decoder *cxl_decoder_alloc(struct cxl_port *port, int nr_target= s) { - struct cxl_decoder *cxld, cxld_const_init =3D { - .nr_targets =3D nr_targets, - }; + struct cxl_decoder *cxld; struct device *dev; int rc =3D 0; =20 @@ -497,13 +495,13 @@ struct cxl_decoder *cxl_decoder_alloc(struct cxl_port= *port, int nr_targets) cxld =3D kzalloc(struct_size(cxld, target, nr_targets), GFP_KERNEL); if (!cxld) return ERR_PTR(-ENOMEM); - memcpy(cxld, &cxld_const_init, sizeof(cxld_const_init)); =20 rc =3D ida_alloc(&port->decoder_ida, GFP_KERNEL); if (rc < 0) goto err; =20 cxld->id =3D rc; + cxld->nr_targets =3D nr_targets; dev =3D &cxld->dev; device_initialize(dev); device_set_pm_not_required(dev); diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 3af704e9b448e..7c2b51746e318 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -191,7 +191,7 @@ struct cxl_decoder { int interleave_granularity; enum cxl_decoder_type target_type; unsigned long flags; - const int nr_targets; + int nr_targets; struct cxl_dport *target[]; }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B32DFC4321E for ; Mon, 24 Jan 2022 21:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575670AbiAXVwO (ORCPT ); Mon, 24 Jan 2022 16:52:14 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40302 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449483AbiAXVTP (ORCPT ); Mon, 24 Jan 2022 16:19:15 -0500 Received: from smtp.kernel.org (relay.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 C569A61490; Mon, 24 Jan 2022 21:19:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B7E0C340E4; Mon, 24 Jan 2022 21:19:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059154; bh=dLkJHSehkvwf6TVlYKXzLag1jRfBp/iDlklf0WRr+0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jRfVKPb5BiIsurK9bawi5FD5VeAaLgzli4oR5M7qJUhyVEU0VF6AG5WDbLlyPyYGw vTqQh8LDvN5xbANxCKwEwB1VkTy1efim29Wewx9zoEggBHz2RF0W7RN3rsrmfq2KSw MVI3xYHeJCzgRSYaEksPifae7j9GN3MDcqf0G+Oc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huang Pei , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.16 0522/1039] MIPS: fix local_{add,sub}_return on MIPS64 Date: Mon, 24 Jan 2022 19:38:31 +0100 Message-Id: <20220124184142.841372597@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Huang Pei [ Upstream commit 277c8cb3e8ac199f075bf9576ad286687ed17173 ] Use "daddu/dsubu" for long int on MIPS64 instead of "addu/subu" Fixes: 7232311ef14c ("local_t: mips extension") Signed-off-by: Huang Pei Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/mips/include/asm/local.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h index ecda7295ddcd1..3fa6340903882 100644 --- a/arch/mips/include/asm/local.h +++ b/arch/mips/include/asm/local.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -39,7 +40,7 @@ static __inline__ long local_add_return(long i, local_t *= l) " .set arch=3Dr4000 \n" __SYNC(full, loongson3_war) " \n" "1:" __LL "%1, %2 # local_add_return \n" - " addu %0, %1, %3 \n" + __stringify(LONG_ADDU) " %0, %1, %3 \n" __SC "%0, %2 \n" " beqzl %0, 1b \n" " addu %0, %1, %3 \n" @@ -55,7 +56,7 @@ static __inline__ long local_add_return(long i, local_t *= l) " .set "MIPS_ISA_ARCH_LEVEL" \n" __SYNC(full, loongson3_war) " \n" "1:" __LL "%1, %2 # local_add_return \n" - " addu %0, %1, %3 \n" + __stringify(LONG_ADDU) " %0, %1, %3 \n" __SC "%0, %2 \n" " beqz %0, 1b \n" " addu %0, %1, %3 \n" @@ -88,7 +89,7 @@ static __inline__ long local_sub_return(long i, local_t *= l) " .set arch=3Dr4000 \n" __SYNC(full, loongson3_war) " \n" "1:" __LL "%1, %2 # local_sub_return \n" - " subu %0, %1, %3 \n" + __stringify(LONG_SUBU) " %0, %1, %3 \n" __SC "%0, %2 \n" " beqzl %0, 1b \n" " subu %0, %1, %3 \n" @@ -104,7 +105,7 @@ static __inline__ long local_sub_return(long i, local_t= * l) " .set "MIPS_ISA_ARCH_LEVEL" \n" __SYNC(full, loongson3_war) " \n" "1:" __LL "%1, %2 # local_sub_return \n" - " subu %0, %1, %3 \n" + __stringify(LONG_SUBU) " %0, %1, %3 \n" __SC "%0, %2 \n" " beqz %0, 1b \n" " subu %0, %1, %3 \n" --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD699C4321E for ; Mon, 24 Jan 2022 23:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2363998AbiAXXqa (ORCPT ); Mon, 24 Jan 2022 18:46:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845398AbiAXXMO (ORCPT ); Mon, 24 Jan 2022 18:12:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA5DFC067A4E; Mon, 24 Jan 2022 13:19:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 910DFB8121C; Mon, 24 Jan 2022 21:19:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8AB2C340E4; Mon, 24 Jan 2022 21:19:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059157; bh=Slr51+xyY5i5YjPnVEH/v3kjhkarQhm8KYwpq5C3Fao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=puXg8zQMKPzaAClkJ102WF2lrhpV6cRAcQ5YuSg/w5rARptof89W4cl+SIlXBgzcG X6AA7XR1KkJEe1C91GpQbzv6idIEvtGtD3iimL3BHlyTPRpDWP6ONXTPHmlYDD2fkx 5bW0urOIzsCH4GYYncZCNrpMswbmi1NNoGwv4QGM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kamal Heib , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.16 0523/1039] RDMA/cxgb4: Set queue pair state when being queried Date: Mon, 24 Jan 2022 19:38:32 +0100 Message-Id: <20220124184142.871496305@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kamal Heib [ Upstream commit e375b9c92985e409c4bb95dd43d34915ea7f5e28 ] The API for ib_query_qp requires the driver to set cur_qp_state on return, add the missing set. Fixes: 67bbc05512d8 ("RDMA/cxgb4: Add query_qp support") Link: https://lore.kernel.org/r/20211220152530.60399-1-kamalheib1@gmail.com Signed-off-by: Kamal Heib Reviewed-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/infiniband/hw/cxgb4/qp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4= /qp.c index d20b4ef2c853d..ffbd9a89981e7 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c @@ -2460,6 +2460,7 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp= _attr *attr, memset(attr, 0, sizeof(*attr)); memset(init_attr, 0, sizeof(*init_attr)); attr->qp_state =3D to_ib_qp_state(qhp->attr.state); + attr->cur_qp_state =3D to_ib_qp_state(qhp->attr.state); init_attr->cap.max_send_wr =3D qhp->attr.sq_num_entries; init_attr->cap.max_recv_wr =3D qhp->attr.rq_num_entries; init_attr->cap.max_send_sge =3D qhp->attr.sq_max_sges; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD63EC43219 for ; Mon, 24 Jan 2022 23:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364050AbiAXXqk (ORCPT ); Mon, 24 Jan 2022 18:46:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845410AbiAXXMO (ORCPT ); Mon, 24 Jan 2022 18:12:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29579C067A50; Mon, 24 Jan 2022 13:19:21 -0800 (PST) Received: from smtp.kernel.org (relay.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 BCBAA614D9; Mon, 24 Jan 2022 21:19:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6E25C340E4; Mon, 24 Jan 2022 21:19:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059160; bh=Q1kC21dAegmZRgPiBknkj/MgOmMj2SG0aFo5rzmAtLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ijf8I1lwug+Q/kVSN3XxQMRw7WEuHyvdYszkCVj8E9n3A7C4azJko1e/2Oe7Taqhk f1WsXLjl32VD/wbrsBthzAXdJ8SryT3f7I3xmz1DKM2radhojXdgKVcGZOJC3AB5Sl kKODdzhJrAIZXjejjdJmdCHSBL3dFLPQSGIlfe9E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taniya Das , Stephen Boyd , Sasha Levin Subject: [PATCH 5.16 0524/1039] clk: qcom: gcc-sc7280: Mark gcc_cfg_noc_lpass_clk always enabled Date: Mon, 24 Jan 2022 19:38:33 +0100 Message-Id: <20220124184142.900566554@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Taniya Das [ Upstream commit 9c337073d9d81a145434b22f42dc3128ecd17730 ] The gcc cfg noc lpass clock is required to be always enabled for the LPASS core and audio drivers to be functional. Fixes: a3cc092196ef ("clk: qcom: Add Global Clock controller (GCC) driver f= or SC7280") Signed-off-by: Taniya Das Link: https://lore.kernel.org/r/1640018638-19436-4-git-send-email-tdas@code= aurora.org Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/clk/qcom/gcc-sc7280.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gcc-sc7280.c b/drivers/clk/qcom/gcc-sc7280.c index 8fb6bd69f240e..423627d49719c 100644 --- a/drivers/clk/qcom/gcc-sc7280.c +++ b/drivers/clk/qcom/gcc-sc7280.c @@ -2917,7 +2917,7 @@ static struct clk_branch gcc_cfg_noc_lpass_clk =3D { .enable_mask =3D BIT(0), .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_cfg_noc_lpass_clk", - .ops =3D &clk_branch2_ops, + .ops =3D &clk_branch2_aon_ops, }, }, }; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1DFCC4167D for ; Mon, 24 Jan 2022 23:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364142AbiAXXqu (ORCPT ); Mon, 24 Jan 2022 18:46:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845416AbiAXXMO (ORCPT ); Mon, 24 Jan 2022 18:12:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18F59C067A52; Mon, 24 Jan 2022 13:19:24 -0800 (PST) Received: from smtp.kernel.org (relay.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 AE23761491; Mon, 24 Jan 2022 21:19:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91117C340E7; Mon, 24 Jan 2022 21:19:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059163; bh=4k89oqbZmtEv29d2sp//Spqf8XbzF1OSGGeSkQN8Vws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=spxP35QjNwK/HH+zpzLG46dZ5Bo/A1N2FMVa5KevKpZq74aLFfkdYiE9nTHW9n+c4 eraF1CSj3dWXiQSv6dkt5njXKLF9eK/i49lBtpC5wZ/6rHGkEBzsVtTBW00Rt3tnPN pG6+/KlZdbZOyTJUWj4n1Jm7ndFgoiDcBXEjf9cM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0525/1039] ASoC: imx-card: Need special setting for ak4497 on i.MX8MQ Date: Mon, 24 Jan 2022 19:38:34 +0100 Message-Id: <20220124184142.932239769@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit 3349b3d0c63b8b6fcca58156d72407f0b2e101ac ] The SAI on i.MX8MQ don't support one2one ratio for mclk:bclk, so the mclk frequency exceeds the supported range of codec for the case that sample rate is larger than 705kHZ and format is S32_LE. Update the supported width for such case. Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1641292835-19085-2-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/fsl/imx-card.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index 6f06afd23b16a..96ac1e465fade 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -553,8 +553,23 @@ static int imx_card_parse_of(struct imx_card_data *dat= a) link_data->cpu_sysclk_id =3D FSL_SAI_CLK_MAST1; =20 /* sai may support mclk/bclk =3D 1 */ - if (of_find_property(np, "fsl,mclk-equal-bclk", NULL)) + if (of_find_property(np, "fsl,mclk-equal-bclk", NULL)) { link_data->one2one_ratio =3D true; + } else { + int i; + + /* + * i.MX8MQ don't support one2one ratio, then + * with ak4497 only 16bit case is supported. + */ + for (i =3D 0; i < ARRAY_SIZE(ak4497_fs_mul); i++) { + if (ak4497_fs_mul[i].rmin =3D=3D 705600 && + ak4497_fs_mul[i].rmax =3D=3D 768000) { + ak4497_fs_mul[i].wmin =3D 32; + ak4497_fs_mul[i].wmax =3D 32; + } + } + } } =20 link->cpus->of_node =3D args.np; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D27AC4332F for ; Mon, 24 Jan 2022 23:57:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366057AbiAXXwN (ORCPT ); Mon, 24 Jan 2022 18:52:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845409AbiAXXMO (ORCPT ); Mon, 24 Jan 2022 18:12:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C86FC028C17; Mon, 24 Jan 2022 13:19:29 -0800 (PST) Received: from smtp.kernel.org (relay.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 73D46B80FA1; Mon, 24 Jan 2022 21:19:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3327C340E5; Mon, 24 Jan 2022 21:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059166; bh=CjNurEu/6+GsUqTQ4NQoldgfbFXncMWtPF0rfbat62k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E92vEJtcPCkzkqsLYZn4fiUMytUYzCiXPoQHY0avIeZa2rVc63L45Ble4419bwICz /osIhah8Bt+lhXJHp2qteLnp8jHnvhLaWSGMURrl1VxvOiSLGwKz6RPocA6xjtHEtg lpxTPGUqp3Sn9HR5cnxNoGqceSxyCHa0Z3Jsxl8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0526/1039] ASoC: imx-card: Fix mclk calculation issue for akcodec Date: Mon, 24 Jan 2022 19:38:35 +0100 Message-Id: <20220124184142.962408139@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit f331ae5fa59fbfb748317b290648fc3f1a50d932 ] Transfer the refined slots and slot_width to akcodec_get_mclk_rate() for mclk calculation, otherwise the mclk frequency does not match with the slots and slot_width for S16_LE format, because the default slot_width is 32. Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1641292835-19085-3-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/fsl/imx-card.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index 96ac1e465fade..84a8dcdee9316 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -247,13 +247,14 @@ static bool codec_is_akcodec(unsigned int type) } =20 static unsigned long akcodec_get_mclk_rate(struct snd_pcm_substream *subst= ream, - struct snd_pcm_hw_params *params) + struct snd_pcm_hw_params *params, + int slots, int slot_width) { struct snd_soc_pcm_runtime *rtd =3D substream->private_data; struct imx_card_data *data =3D snd_soc_card_get_drvdata(rtd->card); const struct imx_card_plat_data *plat_data =3D data->plat_data; struct dai_link_data *link_data =3D &data->link_data[rtd->num]; - unsigned int width =3D link_data->slots * link_data->slot_width; + unsigned int width =3D slots * slot_width; unsigned int rate =3D params_rate(params); int i; =20 @@ -349,7 +350,7 @@ static int imx_aif_hw_params(struct snd_pcm_substream *= substream, =20 /* Set MCLK freq */ if (codec_is_akcodec(plat_data->type)) - mclk_freq =3D akcodec_get_mclk_rate(substream, params); + mclk_freq =3D akcodec_get_mclk_rate(substream, params, slots, slot_width= ); else mclk_freq =3D params_rate(params) * slots * slot_width; /* Use the maximum freq from DSD512 (512*44100 =3D 22579200) */ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB54DC35270 for ; Mon, 24 Jan 2022 23:58:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366108AbiAXXwU (ORCPT ); Mon, 24 Jan 2022 18:52:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845408AbiAXXMO (ORCPT ); Mon, 24 Jan 2022 18:12:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF6B8C09F4B6; Mon, 24 Jan 2022 13:19:30 -0800 (PST) Received: from smtp.kernel.org (relay.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 93D20B80FA1; Mon, 24 Jan 2022 21:19:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC4D9C340E4; Mon, 24 Jan 2022 21:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059169; bh=K5eKq+0HrMybBiSNveured9NxZMCaK86vy2yBY9oE8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qcTqC2J29Kj9xYjCvEDnA816dCV4lGv+73mpRYfyst5jRcLWOJUtQBgRf6BLt4EJh I8sgkrRJakp+KdpbstySjxEusA+I11OjHD9VyEY09NYRW893v4Pf+/mNlAOpex4V4A vs6SKuDp0zsnk+u6UvGUIo1ykzUCNuAqxO04htPs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0527/1039] ASoC: imx-card: improve the sound quality for low rate Date: Mon, 24 Jan 2022 19:38:36 +0100 Message-Id: <20220124184142.998295878@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit 3969341813eb56d2dfc39bb64229359a6ae3c195 ] According to RM, on auto mode: For codec AK4458 and AK4497, the lowest ratio of MLCK/FS is 256 if sample rate is 8kHz-48kHz, For codec AK5558, the lowest ratio of MLCK/FS is 512 if sample rate is 8kHz-48kHz. With these setting the sound quality for 8kHz-48kHz can be improved. Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1641292835-19085-4-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/fsl/imx-card.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index 84a8dcdee9316..c7503a5f7cfbc 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -120,7 +120,7 @@ struct imx_card_data { =20 static struct imx_akcodec_fs_mul ak4458_fs_mul[] =3D { /* Normal, < 32kHz */ - { .rmin =3D 8000, .rmax =3D 24000, .wmin =3D 1024, .wmax =3D 1024, }, + { .rmin =3D 8000, .rmax =3D 24000, .wmin =3D 256, .wmax =3D 1024, }, /* Normal, 32kHz */ { .rmin =3D 32000, .rmax =3D 32000, .wmin =3D 256, .wmax =3D 1024, }, /* Normal */ @@ -151,8 +151,8 @@ static struct imx_akcodec_fs_mul ak4497_fs_mul[] =3D { * Table 7 - mapping multiplier and speed mode * Tables 8 & 9 - mapping speed mode and LRCK fs */ - { .rmin =3D 8000, .rmax =3D 32000, .wmin =3D 1024, .wmax =3D 1024, }, = /* Normal, <=3D 32kHz */ - { .rmin =3D 44100, .rmax =3D 48000, .wmin =3D 512, .wmax =3D 512, }, /= * Normal */ + { .rmin =3D 8000, .rmax =3D 32000, .wmin =3D 256, .wmax =3D 1024, }, = /* Normal, <=3D 32kHz */ + { .rmin =3D 44100, .rmax =3D 48000, .wmin =3D 256, .wmax =3D 512, }, /= * Normal */ { .rmin =3D 88200, .rmax =3D 96000, .wmin =3D 256, .wmax =3D 256, }, /= * Double */ { .rmin =3D 176400, .rmax =3D 192000, .wmin =3D 128, .wmax =3D 128, }, /= * Quad */ { .rmin =3D 352800, .rmax =3D 384000, .wmin =3D 128, .wmax =3D 128, }, /= * Oct */ @@ -164,7 +164,7 @@ static struct imx_akcodec_fs_mul ak4497_fs_mul[] =3D { * (Table 4 from datasheet) */ static struct imx_akcodec_fs_mul ak5558_fs_mul[] =3D { - { .rmin =3D 8000, .rmax =3D 32000, .wmin =3D 1024, .wmax =3D 1024, }, + { .rmin =3D 8000, .rmax =3D 32000, .wmin =3D 512, .wmax =3D 1024, }, { .rmin =3D 44100, .rmax =3D 48000, .wmin =3D 512, .wmax =3D 512, }, { .rmin =3D 88200, .rmax =3D 96000, .wmin =3D 256, .wmax =3D 256, }, { .rmin =3D 176400, .rmax =3D 192000, .wmin =3D 128, .wmax =3D 128, }, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47050C4167E for ; Mon, 24 Jan 2022 23:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366222AbiAXXwb (ORCPT ); Mon, 24 Jan 2022 18:52:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845504AbiAXXMa (ORCPT ); Mon, 24 Jan 2022 18:12:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59CA3C067A64; Mon, 24 Jan 2022 13:19:35 -0800 (PST) Received: from smtp.kernel.org (relay.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 90B5CB81142; Mon, 24 Jan 2022 21:19:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C620BC340E4; Mon, 24 Jan 2022 21:19:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059172; bh=YxXYK6Vs5YW1etJLgYJ8W5bksdi4WJjPLmiyrsJ/acs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dicLUq/oyuv1H/hYRPVLhZF51bgwNe6WeadGzq82gJLcpEyc7maVPRzMcFidDAdmr /IxczO3MuvkhcPzF5ONPOz5QfHzrs+xxaOrdYqkfL1o7GHiaU5wkzVTz1rHGnGGiu7 AkL+m2vURc1iNyZMx3AXwR+rHs7QyPbRtYhY8gBY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0528/1039] ASoC: fsl_asrc: refine the check of available clock divider Date: Mon, 24 Jan 2022 19:38:37 +0100 Message-Id: <20220124184143.035179889@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit 320386343451ab6a3577e0ee200dac56a6182944 ] According to RM, the clock divider range is from 1 to 8, clock prescaling ratio may be any power of 2 from 1 to 128. So the supported divider is not all the value between 1 and 1024, just limited value in that range. Create table for the supported divder and add function to check the clock divider is available by comparing with the table. Fixes: d0250cf4f2ab ("ASoC: fsl_asrc: Add an option to select internal rati= o mode") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1641380883-20709-1-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/fsl/fsl_asrc.c | 69 +++++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 24b41881a68f8..d7d1536a4f377 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -19,6 +19,7 @@ #include "fsl_asrc.h" =20 #define IDEAL_RATIO_DECIMAL_DEPTH 26 +#define DIVIDER_NUM 64 =20 #define pair_err(fmt, ...) \ dev_err(&asrc->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__) @@ -101,6 +102,55 @@ static unsigned char clk_map_imx8qxp[2][ASRC_CLK_MAP_L= EN] =3D { }, }; =20 +/* + * According to RM, the divider range is 1 ~ 8, + * prescaler is power of 2 from 1 ~ 128. + */ +static int asrc_clk_divider[DIVIDER_NUM] =3D { + 1, 2, 4, 8, 16, 32, 64, 128, /* divider =3D 1 */ + 2, 4, 8, 16, 32, 64, 128, 256, /* divider =3D 2 */ + 3, 6, 12, 24, 48, 96, 192, 384, /* divider =3D 3 */ + 4, 8, 16, 32, 64, 128, 256, 512, /* divider =3D 4 */ + 5, 10, 20, 40, 80, 160, 320, 640, /* divider =3D 5 */ + 6, 12, 24, 48, 96, 192, 384, 768, /* divider =3D 6 */ + 7, 14, 28, 56, 112, 224, 448, 896, /* divider =3D 7 */ + 8, 16, 32, 64, 128, 256, 512, 1024, /* divider =3D 8 */ +}; + +/* + * Check if the divider is available for internal ratio mode + */ +static bool fsl_asrc_divider_avail(int clk_rate, int rate, int *div) +{ + u32 rem, i; + u64 n; + + if (div) + *div =3D 0; + + if (clk_rate =3D=3D 0 || rate =3D=3D 0) + return false; + + n =3D clk_rate; + rem =3D do_div(n, rate); + + if (div) + *div =3D n; + + if (rem !=3D 0) + return false; + + for (i =3D 0; i < DIVIDER_NUM; i++) { + if (n =3D=3D asrc_clk_divider[i]) + break; + } + + if (i =3D=3D DIVIDER_NUM) + return false; + + return true; +} + /** * fsl_asrc_sel_proc - Select the pre-processing and post-processing optio= ns * @inrate: input sample rate @@ -330,12 +380,12 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair = *pair, bool use_ideal_rate) enum asrc_word_width input_word_width; enum asrc_word_width output_word_width; u32 inrate, outrate, indiv, outdiv; - u32 clk_index[2], div[2], rem[2]; + u32 clk_index[2], div[2]; u64 clk_rate; int in, out, channels; int pre_proc, post_proc; struct clk *clk; - bool ideal; + bool ideal, div_avail; =20 if (!config) { pair_err("invalid pair config\n"); @@ -415,8 +465,7 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *p= air, bool use_ideal_rate) clk =3D asrc_priv->asrck_clk[clk_index[ideal ? OUT : IN]]; =20 clk_rate =3D clk_get_rate(clk); - rem[IN] =3D do_div(clk_rate, inrate); - div[IN] =3D (u32)clk_rate; + div_avail =3D fsl_asrc_divider_avail(clk_rate, inrate, &div[IN]); =20 /* * The divider range is [1, 1024], defined by the hardware. For non- @@ -425,7 +474,7 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *p= air, bool use_ideal_rate) * only result in different converting speeds. So remainder does not * matter, as long as we keep the divider within its valid range. */ - if (div[IN] =3D=3D 0 || (!ideal && (div[IN] > 1024 || rem[IN] !=3D 0))) { + if (div[IN] =3D=3D 0 || (!ideal && !div_avail)) { pair_err("failed to support input sample rate %dHz by asrck_%x\n", inrate, clk_index[ideal ? OUT : IN]); return -EINVAL; @@ -436,13 +485,12 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair = *pair, bool use_ideal_rate) clk =3D asrc_priv->asrck_clk[clk_index[OUT]]; clk_rate =3D clk_get_rate(clk); if (ideal && use_ideal_rate) - rem[OUT] =3D do_div(clk_rate, IDEAL_RATIO_RATE); + div_avail =3D fsl_asrc_divider_avail(clk_rate, IDEAL_RATIO_RATE, &div[OU= T]); else - rem[OUT] =3D do_div(clk_rate, outrate); - div[OUT] =3D clk_rate; + div_avail =3D fsl_asrc_divider_avail(clk_rate, outrate, &div[OUT]); =20 /* Output divider has the same limitation as the input one */ - if (div[OUT] =3D=3D 0 || (!ideal && (div[OUT] > 1024 || rem[OUT] !=3D 0))= ) { + if (div[OUT] =3D=3D 0 || (!ideal && !div_avail)) { pair_err("failed to support output sample rate %dHz by asrck_%x\n", outrate, clk_index[OUT]); return -EINVAL; @@ -621,8 +669,7 @@ static void fsl_asrc_select_clk(struct fsl_asrc_priv *a= src_priv, clk_index =3D asrc_priv->clk_map[j][i]; clk_rate =3D clk_get_rate(asrc_priv->asrck_clk[clk_index]); /* Only match a perfect clock source with no remainder */ - if (clk_rate !=3D 0 && (clk_rate / rate[j]) <=3D 1024 && - (clk_rate % rate[j]) =3D=3D 0) + if (fsl_asrc_divider_avail(clk_rate, rate[j], NULL)) break; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C02FAC433F5 for ; Mon, 24 Jan 2022 23:58:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366350AbiAXXwl (ORCPT ); Mon, 24 Jan 2022 18:52:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845840AbiAXXNm (ORCPT ); Mon, 24 Jan 2022 18:13:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94E6CC067A67; Mon, 24 Jan 2022 13:19:36 -0800 (PST) Received: from smtp.kernel.org (relay.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 DF9B4614BC; Mon, 24 Jan 2022 21:19:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC714C340E4; Mon, 24 Jan 2022 21:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059175; bh=uDbfPJ73HUWqhPHuTRXhY7UbI0yEEfy4ihntlu9sniM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ne6N91lVdJ+FKqVi76IqA/+o+2xZ4VABOU5IcDx9e6kkL+vruqxziXi3giVXZmmuK TPyl6yBXtzFDOwKoBT/F7LHxhr5waw1EBb6e/DMMoCW84hwSIvUni3pLXnTxPnQZm8 YEP7MFwNAaMRP4vkaczSsnfb30cxprNVtO9Am7eY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Conor Dooley , Stephen Boyd , Sasha Levin Subject: [PATCH 5.16 0529/1039] clk: bm1880: remove kfrees on static allocations Date: Mon, 24 Jan 2022 19:38:38 +0100 Message-Id: <20220124184143.068195143@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 c861c1be3897845313a0df47804b1db37c7052e1 ] bm1880_clk_unregister_pll & bm1880_clk_unregister_div both try to free statically allocated variables, so remove those kfrees. For example, if we take L703 kfree(div_hw): - div_hw is a bm1880_div_hw_clock pointer - in bm1880_clk_register_plls this is pointed to an element of arg1: struct bm1880_div_hw_clock *clks - in the probe, where bm1880_clk_register_plls is called arg1 is bm1880_div_clks, defined on L371: static struct bm1880_div_hw_clock bm1880_div_clks[] Signed-off-by: Conor Dooley Fixes: 1ab4601da55b ("clk: Add common clock driver for BM1880 SoC") Link: https://lore.kernel.org/r/20211223154244.1024062-1-conor.dooley@micro= chip.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/clk/clk-bm1880.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/drivers/clk/clk-bm1880.c b/drivers/clk/clk-bm1880.c index e6d6599d310a1..fad78a22218e8 100644 --- a/drivers/clk/clk-bm1880.c +++ b/drivers/clk/clk-bm1880.c @@ -522,14 +522,6 @@ static struct clk_hw *bm1880_clk_register_pll(struct b= m1880_pll_hw_clock *pll_cl return hw; } =20 -static void bm1880_clk_unregister_pll(struct clk_hw *hw) -{ - struct bm1880_pll_hw_clock *pll_hw =3D to_bm1880_pll_clk(hw); - - clk_hw_unregister(hw); - kfree(pll_hw); -} - static int bm1880_clk_register_plls(struct bm1880_pll_hw_clock *clks, int num_clks, struct bm1880_clock_data *data) @@ -555,7 +547,7 @@ static int bm1880_clk_register_plls(struct bm1880_pll_h= w_clock *clks, =20 err_clk: while (i--) - bm1880_clk_unregister_pll(data->hw_data.hws[clks[i].pll.id]); + clk_hw_unregister(data->hw_data.hws[clks[i].pll.id]); =20 return PTR_ERR(hw); } @@ -695,14 +687,6 @@ static struct clk_hw *bm1880_clk_register_div(struct b= m1880_div_hw_clock *div_cl return hw; } =20 -static void bm1880_clk_unregister_div(struct clk_hw *hw) -{ - struct bm1880_div_hw_clock *div_hw =3D to_bm1880_div_clk(hw); - - clk_hw_unregister(hw); - kfree(div_hw); -} - static int bm1880_clk_register_divs(struct bm1880_div_hw_clock *clks, int num_clks, struct bm1880_clock_data *data) @@ -729,7 +713,7 @@ static int bm1880_clk_register_divs(struct bm1880_div_h= w_clock *clks, =20 err_clk: while (i--) - bm1880_clk_unregister_div(data->hw_data.hws[clks[i].div.id]); + clk_hw_unregister(data->hw_data.hws[clks[i].div.id]); =20 return PTR_ERR(hw); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE728C433EF for ; Mon, 24 Jan 2022 21:57:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575689AbiAXVwQ (ORCPT ); Mon, 24 Jan 2022 16:52:16 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42788 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450081AbiAXVTo (ORCPT ); Mon, 24 Jan 2022 16:19:44 -0500 Received: from smtp.kernel.org (relay.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 EC9F661469; Mon, 24 Jan 2022 21:19:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9EEBC340E4; Mon, 24 Jan 2022 21:19:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059181; bh=jq3qAwfolb3vJnwEB5So1WRHousxwOrTd3MkQgUiNl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFOYP4WEMMAkzzx8m2oqlUi9RN1M4MjMTcH3c72v7edAKVQnbedS49WEZorGf3JPd PES7c2zjuCQ5LNsKp2coKvCgcjlB3m0s4mw0aqxpqy2V6fjHVPxDts1G47TR0RRp3M MRFlbqy6+H84NsVF/rIgjx+t8yutunYVprssKTwY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Baruch Siach , Rob Herring , Sasha Levin Subject: [PATCH 5.16 0530/1039] of: base: Fix phandle argument length mismatch error message Date: Mon, 24 Jan 2022 19:38:39 +0100 Message-Id: <20220124184143.098307142@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baruch Siach [ Upstream commit 94a4950a4acff39b5847cc1fee4f65e160813493 ] The cell_count field of of_phandle_iterator is the number of cells we expect in the phandle arguments list when cells_name is missing. The error message should show the number of cells we actually see. Fixes: af3be70a3211 ("of: Improve of_phandle_iterator_next() error message") Cc: Florian Fainelli Signed-off-by: Baruch Siach Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/96519ac55be90a63fa44afe01480c30d08535465.16= 40881913.git.baruch@tkos.co.il Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/of/base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 61de453b885cb..81b956ab2348e 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1349,9 +1349,9 @@ int of_phandle_iterator_next(struct of_phandle_iterat= or *it) * property data length */ if (it->cur + count > it->list_end) { - pr_err("%pOF: %s =3D %d found %d\n", + pr_err("%pOF: %s =3D %d found %td\n", it->parent, it->cells_name, - count, it->cell_count); + count, it->list_end - it->cur); goto err; } } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA431C433F5 for ; Mon, 24 Jan 2022 21:57:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575705AbiAXVwT (ORCPT ); Mon, 24 Jan 2022 16:52:19 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41166 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450097AbiAXVTp (ORCPT ); Mon, 24 Jan 2022 16:19:45 -0500 Received: from smtp.kernel.org (relay.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 1E9A160C60; Mon, 24 Jan 2022 21:19:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB62EC340E4; Mon, 24 Jan 2022 21:19:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059184; bh=xjuXw+oaZke5wdTWzdveNvRQbUT4Qxd8QENQw3Rl7Co=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qUP/ftJS2ZNHPRRFXMo5KdErx7r1dgzrc813Sb0iKj8qvNEJCKrKmIVu4+bm2+PbW sh1qHMCw7N/wnaR+n9ZTqwGzde6oE6bHpV1lj1hB2twfM4BRgWCP/ke50SWeTj+iho wAtHM8r1t6HC46nKiIaRt8lB55+QSS6nVg+W1WK4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Rapoport , Douglas Anderson , Nicolas Boichat , Quentin Perret , Jan Kiszka , Stephen Boyd , Rob Herring , Sasha Levin Subject: [PATCH 5.16 0531/1039] of/fdt: Dont worry about non-memory region overlap for no-map Date: Mon, 24 Jan 2022 19:38:40 +0100 Message-Id: <20220124184143.137270584@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephen Boyd [ Upstream commit da17d6905d29ddcdc04b2fdc37ed8cf1e8437cc8 ] In commit 8a5a75e5e9e5 ("of/fdt: Make sure no-map does not remove already reserved regions") we returned -EBUSY when trying to mark regions as no-map when they intersect with reserved memory. The goal was to find bad no-map reserved memory DT nodes that would unmap the kernel text/data sections. The problem is the reserved memory check will still trigger if the DT has a /memreserve/ that completely subsumes the no-map memory carveouts in the reserved memory node _and_ that region is also not part of the memory reg property. For example in sc7180.dtsi we have the following reserved-memory and memory node: memory@80000000 { /* We expect the bootloader to fill in the size */ reg =3D <0 0x80000000 0 0>; }; smem_mem: memory@80900000 { reg =3D <0x0 0x80900000 0x0 0x200000>; no-map; }; and the memreserve filled in by the bootloader is /memreserve/ 0x80800000 0x400000; while the /memory node is transformed into memory@80000000 { /* The bootloader fills in the size, and adds another region */ reg =3D <0 0x80000000 0 0x00800000>, <0 0x80c00000 0 0x7f200000>; }; The smem region is doubly reserved via /memreserve/ and by not being part of the /memory reg property. This leads to the following warning printed at boot. OF: fdt: Reserved memory: failed to reserve memory for node 'memory@809000= 00': base 0x0000000080900000, size 2 MiB Otherwise nothing really goes wrong because the smem region is not going to be mapped by the kernel's direct linear mapping given that it isn't part of the memory node. Therefore, let's only consider this to be a problem if we're trying to mark a region as no-map and it is actually memory that we're intending to keep out of the kernel's direct mapping but it's already been reserved. Acked-by: Mike Rapoport Cc: Douglas Anderson Cc: Nicolas Boichat Cc: Quentin Perret Cc: Jan Kiszka Fixes: 8a5a75e5e9e5 ("of/fdt: Make sure no-map does not remove already rese= rved regions") Signed-off-by: Stephen Boyd Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20220107194233.2793146-1-swboyd@chromium.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/of/fdt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 65af475dfa950..7e868e5995b7e 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -482,9 +482,11 @@ static int __init early_init_dt_reserve_memory_arch(ph= ys_addr_t base, if (nomap) { /* * If the memory is already reserved (by another region), we - * should not allow it to be marked nomap. + * should not allow it to be marked nomap, but don't worry + * if the region isn't memory as it won't be mapped. */ - if (memblock_is_region_reserved(base, size)) + if (memblock_overlaps_region(&memblock.memory, base, size) && + memblock_is_region_reserved(base, size)) return -EBUSY; =20 return memblock_mark_nomap(base, size); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 655DDC433FE for ; Mon, 24 Jan 2022 23:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366450AbiAXXwu (ORCPT ); Mon, 24 Jan 2022 18:52:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845905AbiAXXNz (ORCPT ); Mon, 24 Jan 2022 18:13:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D0A2C067A6A; Mon, 24 Jan 2022 13:19:48 -0800 (PST) Received: from smtp.kernel.org (relay.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 2A08B61320; Mon, 24 Jan 2022 21:19:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2314C340E4; Mon, 24 Jan 2022 21:19:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059187; bh=BRth5bWhl+JDCIuYfy5CS8sx+fRhAfvxk/XHWkwWoXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yq0qCppTxvsXdPzCMe3DJgUFi5OHflmySu+R15lCEks/J9WeV7kkk480Wobe/I6Mn Bl0xEU6pLvyYSCn1Y0rumCOTEM4omeOsEfcYMD6Xk8EEs/7mvc7dbLHXanx+z/aFtO 6r7z+5758ib6T6gEgvjC6APmKHilckjbCFPY0/1k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Nick Terrell , Paul Cercueil , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.16 0532/1039] MIPS: compressed: Fix build with ZSTD compression Date: Mon, 24 Jan 2022 19:38:41 +0100 Message-Id: <20220124184143.167822711@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Cercueil [ Upstream commit c5c7440fe7f74645940d5c9e2c49cd7efb706a4f ] Fix the following build issues: mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `FSE= _buildDTable_internal': decompress.c:(.text.FSE_buildDTable_internal+0x2cc): undefined reference t= o `__clzdi2' mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `= BIT_initDStream': decompress.c:(.text.BIT_initDStream+0x7c): undefined reference to `__clz= di2' mips64el-linux-ld: decompress.c:(.text.BIT_initDStream+0x158): undefined= reference to `__clzdi2' mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `= ZSTD_buildFSETable_body_default.constprop.0': decompress.c:(.text.ZSTD_buildFSETable_body_default.constprop.0+0x2a8): un= defined reference to `__clzdi2' mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `= FSE_readNCount_body_default': decompress.c:(.text.FSE_readNCount_body_default+0x130): undefined referenc= e to `__ctzdi2' mips64el-linux-ld: decompress.c:(.text.FSE_readNCount_body_default+0x1a4):= undefined reference to `__ctzdi2' mips64el-linux-ld: decompress.c:(.text.FSE_readNCount_body_default+0x2e4):= undefined reference to `__clzdi2' mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `= HUF_readStats_body_default': decompress.c:(.text.HUF_readStats_body_default+0x184): undefined reference= to `__clzdi2' mips64el-linux-ld: decompress.c:(.text.HUF_readStats_body_default+0x1b4): = undefined reference to `__clzdi2' mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `= ZSTD_DCtx_getParameter': decompress.c:(.text.ZSTD_DCtx_getParameter+0x60): undefined reference to `= __clzdi2' Fixes: a510b616131f ("MIPS: Add support for ZSTD-compressed kernels") Reported-by: kernel test robot Reported-by: Nick Terrell Signed-off-by: Paul Cercueil Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/mips/boot/compressed/Makefile | 2 +- arch/mips/boot/compressed/clz_ctz.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 arch/mips/boot/compressed/clz_ctz.c diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed= /Makefile index f27cf31b41401..38e233f7fd7a4 100644 --- a/arch/mips/boot/compressed/Makefile +++ b/arch/mips/boot/compressed/Makefile @@ -52,7 +52,7 @@ endif =20 vmlinuzobjs-$(CONFIG_KERNEL_XZ) +=3D $(obj)/ashldi3.o =20 -vmlinuzobjs-$(CONFIG_KERNEL_ZSTD) +=3D $(obj)/bswapdi.o $(obj)/ashldi3.o +vmlinuzobjs-$(CONFIG_KERNEL_ZSTD) +=3D $(obj)/bswapdi.o $(obj)/ashldi3.o $= (obj)/clz_ctz.o =20 targets :=3D $(notdir $(vmlinuzobjs-y)) =20 diff --git a/arch/mips/boot/compressed/clz_ctz.c b/arch/mips/boot/compresse= d/clz_ctz.c new file mode 100644 index 0000000000000..b4a1b6eb2f8ad --- /dev/null +++ b/arch/mips/boot/compressed/clz_ctz.c @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include "../../../../lib/clz_ctz.c" --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D150CC4167D for ; Mon, 24 Jan 2022 21:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575748AbiAXVw1 (ORCPT ); Mon, 24 Jan 2022 16:52:27 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42878 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450166AbiAXVTz (ORCPT ); Mon, 24 Jan 2022 16:19:55 -0500 Received: from smtp.kernel.org (relay.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 4159961320; Mon, 24 Jan 2022 21:19:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B8D4C340E4; Mon, 24 Jan 2022 21:19:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059190; bh=ZraSDlyB3Ox8MuBaGkawHRM3GvAIGMwaK8tbx1y+SJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k4qR++ms+xO0bCdK++jtlfM1FLYh5H/ofKXa42Wlt4KLyeEcLBzJmHsl7p+VjEzQ6 rWzvvGZMs3Nh47nFkZUdXrvSwonBB658/3NgYsZSdD017PlJSuqO8VOkudu0nvamCy C1oAUYDQHIusYy1eU76Kq0gyVvfbZQmdxzL48c98= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "jason-jh.lin" , Matthias Brugger , Jassi Brar , Sasha Levin Subject: [PATCH 5.16 0533/1039] mailbox: fix gce_num of mt8192 driver data Date: Mon, 24 Jan 2022 19:38:42 +0100 Message-Id: <20220124184143.200649646@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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-jh.lin [ Upstream commit 35ca43710f792ce183312fdc7e4b2bb0b721a173 ] Because mt8192 only have 1 gce, the gce_num should be 1. Fixes: 85dfdbfc13ea ("mailbox: cmdq: add multi-gce clocks support for mt819= 5") Signed-off-by: jason-jh.lin Reviewed-by: Matthias Brugger Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mailbox/mtk-cmdq-mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-= mailbox.c index a8845b162dbfa..9aae13e9e050e 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -658,7 +658,7 @@ static const struct gce_plat gce_plat_v5 =3D { .thread_nr =3D 24, .shift =3D 3, .control_by_sw =3D true, - .gce_num =3D 2 + .gce_num =3D 1 }; =20 static const struct gce_plat gce_plat_v6 =3D { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D597C433EF for ; Mon, 24 Jan 2022 23:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367507AbiAXXzl (ORCPT ); Mon, 24 Jan 2022 18:55:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845906AbiAXXNz (ORCPT ); Mon, 24 Jan 2022 18:13:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23A9AC067A70; Mon, 24 Jan 2022 13:19:56 -0800 (PST) Received: from smtp.kernel.org (relay.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 DEDFAB81142; Mon, 24 Jan 2022 21:19:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B916C340E4; Mon, 24 Jan 2022 21:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059193; bh=TTIVadTQ/H/nHFNTW22sbDeI8axrVJXpDhzc9tFLTPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WWXcqcYHNnV3vp/IdyFTWTIB3fNzFqbPkNtxbv1LHqdqdmt6jSazksCByOIWyLR47 gkvMfC4tZzmFiZQrnJLxGW2gtnrKXGlHF76z9vFbeklheTbF0tx7tpFwTTfuGl9Pey 8kGx56C+E/OFG2KqmQBqhVj40cZ5aXcFekgR+mQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Peng Fan , Jassi Brar , Sasha Levin Subject: [PATCH 5.16 0534/1039] mailbox: imx: Fix an IS_ERR() vs NULL bug Date: Mon, 24 Jan 2022 19:38:43 +0100 Message-Id: <20220124184143.232436141@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 05d06f37196b2e3abeff2b98b785c8803865e646 ] The devm_kzalloc() function does not return error pointers, it returns NULL on failure. Fixes: 97961f78e8bc ("mailbox: imx: support i.MX8ULP S4 MU") Signed-off-by: Dan Carpenter Reviewed-by: Peng Fan Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mailbox/imx-mailbox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c index ffe36a6bef9e0..544de2db64531 100644 --- a/drivers/mailbox/imx-mailbox.c +++ b/drivers/mailbox/imx-mailbox.c @@ -563,8 +563,8 @@ static int imx_mu_probe(struct platform_device *pdev) size =3D sizeof(struct imx_sc_rpc_msg_max); =20 priv->msg =3D devm_kzalloc(dev, size, GFP_KERNEL); - if (IS_ERR(priv->msg)) - return PTR_ERR(priv->msg); + if (!priv->msg) + return -ENOMEM; =20 priv->clk =3D devm_clk_get(dev, NULL); if (IS_ERR(priv->clk)) { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E4D4C433F5 for ; Mon, 24 Jan 2022 23:58:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366367AbiAXXwo (ORCPT ); Mon, 24 Jan 2022 18:52:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845911AbiAXXNz (ORCPT ); Mon, 24 Jan 2022 18:13:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C482C067A71; Mon, 24 Jan 2022 13:19:59 -0800 (PST) Received: from smtp.kernel.org (relay.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 ECA06B80FA1; Mon, 24 Jan 2022 21:19:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26A26C340E4; Mon, 24 Jan 2022 21:19:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059196; bh=4oYtsRdFJt3wVgx1zVbt/5z4Ff6BZH8Q/KvrbYGrPQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ytk/ZkDHJDbflDRDf2bJqNcFzit6MO/bEePrWIzkrmq+o0tSSGo4eE+wSQYldBVfX aAyfZ398kfEMEOUSf1vg989oK+JD6y0SfEvxdRKhDVnFLdWdzYv7YIwPU5ENTKSgxj p7BxQ+HO1bpB1OEmMfA+i6vzm3k0q8rtgnZ5hBts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jassi Brar , Dan Carpenter , Sudeep Holla , Jassi Brar , Sasha Levin Subject: [PATCH 5.16 0535/1039] mailbox: pcc: Avoid using the uninitialized variable dev Date: Mon, 24 Jan 2022 19:38:44 +0100 Message-Id: <20220124184143.265198128@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 960c4056aadcf61983f8eaac159927a052f8cf01 ] Smatch static checker warns: | drivers/mailbox/pcc.c:292 pcc_mbox_request_channel() | error: uninitialized symbol 'dev'. Fix the same by using pr_err instead of dev_err as the variable 'dev' is uninitialized at that stage. Fixes: ce028702ddbc ("mailbox: pcc: Move bulk of PCCT parsing into pcc_mbox= _probe") Cc: Jassi Brar Reported-by: Dan Carpenter Signed-off-by: Sudeep Holla Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mailbox/pcc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 887a3704c12ec..e0a1ab3861f0d 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -289,7 +289,7 @@ pcc_mbox_request_channel(struct mbox_client *cl, int su= bspace_id) pchan =3D chan_info + subspace_id; chan =3D pchan->chan.mchan; if (IS_ERR(chan) || chan->cl) { - dev_err(dev, "Channel not found for idx: %d\n", subspace_id); + pr_err("Channel not found for idx: %d\n", subspace_id); return ERR_PTR(-EBUSY); } dev =3D chan->mbox->dev; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3B37C4332F for ; Mon, 24 Jan 2022 23:58:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366432AbiAXXws (ORCPT ); Mon, 24 Jan 2022 18:52:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845918AbiAXXNz (ORCPT ); Mon, 24 Jan 2022 18:13:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28614C067A73; Mon, 24 Jan 2022 13:20:02 -0800 (PST) Received: from smtp.kernel.org (relay.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 D9E18B80FA1; Mon, 24 Jan 2022 21:20:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E196C340E4; Mon, 24 Jan 2022 21:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059199; bh=2Q3z21wUM/yblriBfeXIPQJaC4MoMvTMrfXYkzT5yWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=loSakum/78fAD6gV6a5u74cKJ8hUtYHrgh84o5agO2Dl+0Y1KIKboRvO2kkQPE57r NBHeQWNvyxpT+ZfTaSplE3T6LQNu1P4waeW8Y5mDHjShY9bYeJrOXz8NL8IBkG7S2o TnzfaSWESRDK2Cvc+ZvLi0q6yJjCMc0GUtwlbGFs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin He , Sudeep Holla , Jassi Brar , Sasha Levin Subject: [PATCH 5.16 0536/1039] mailbox: pcc: Handle all PCC subtypes correctly in pcc_mbox_irq Date: Mon, 24 Jan 2022 19:38:45 +0100 Message-Id: <20220124184143.297944034@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 7215a7857e796c655ae1184b313556102fa8bc40 ] Commit c45ded7e1135 ("mailbox: pcc: Add support for PCCT extended PCC subspaces(type 3/4)") enabled the type3/4 of PCCT, but the change in pcc_mbox_irq breaks the other PCC subtypes. The kernel reports a warning on an Ampere eMag server -->8 CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.16.0-rc4 #127 Hardware name: MiTAC RAPTOR EV-883832-X3-0001/RAPTOR, BIOS 0.14 02/22/2019 Call trace: dump_backtrace+0x0/0x200 show_stack+0x20/0x30 dump_stack_lvl+0x68/0x84 dump_stack+0x18/0x34 __report_bad_irq+0x54/0x17c note_interrupt+0x330/0x428 handle_irq_event_percpu+0x90/0x98 handle_irq_event+0x4c/0x148 handle_fasteoi_irq+0xc4/0x188 generic_handle_domain_irq+0x44/0x68 gic_handle_irq+0x84/0x2ec call_on_irq_stack+0x28/0x34 do_interrupt_handler+0x88/0x90 el1_interrupt+0x48/0xb0 el1h_64_irq_handler+0x18/0x28 el1h_64_irq+0x7c/0x80 Fixes: c45ded7e1135 ("mailbox: pcc: Add support for PCCT extended PCC subsp= aces(type 3/4)") Reported-by: Justin He Tested-by: Justin He Signed-off-by: Sudeep Holla Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mailbox/pcc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index e0a1ab3861f0d..ed18936b8ce68 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -241,9 +241,11 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p) if (ret) return IRQ_NONE; =20 - val &=3D pchan->cmd_complete.status_mask; - if (!val) - return IRQ_NONE; + if (val) { /* Ensure GAS exists and value is non-zero */ + val &=3D pchan->cmd_complete.status_mask; + if (!val) + return IRQ_NONE; + } =20 ret =3D pcc_chan_reg_read(&pchan->error, &val); if (ret) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76DC6C35275 for ; Mon, 24 Jan 2022 23:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367006AbiAXXx6 (ORCPT ); Mon, 24 Jan 2022 18:53:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845966AbiAXXOG (ORCPT ); Mon, 24 Jan 2022 18:14:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39976C0A02BA; Mon, 24 Jan 2022 13:20:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 EAF2DB81188; Mon, 24 Jan 2022 21:20:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1195EC340E4; Mon, 24 Jan 2022 21:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059202; bh=qVTsRmkfHHvtcYhP+AfBxHTCm0Hpp40vXIcFjCKm+lI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MZp7poPCKQ3WGkBME7ZwfAARuiNNmLXOML4gKSOCcbP0gIfAbEfQ2qH2eRRZ/X1BH eQwnmKQ1j5sWrkdd/J+RaHSPf6aWKJ/7q6msW9jlO/OqwBIBOpZAlpFZ0IkBIFPTOc 9j/ar9zZIZUGcj1Bj5ZzPburoCYvoNsUxqCJVQjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Merlijn Wajer , "Sicelo A. Mhlongo" , Pavel Machek , Sasha Levin Subject: [PATCH 5.16 0537/1039] ARM: dts: omap3-n900: Fix lp5523 for multi color Date: Mon, 24 Jan 2022 19:38:46 +0100 Message-Id: <20220124184143.330009016@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sicelo A. Mhlongo [ Upstream commit e9af026a3b24f59d7af4609f73e0ef60a4d6d516 ] Since the LED multicolor framework support was added in commit 92a81562e695 ("leds: lp55xx: Add multicolor framework support to lp55xx") LEDs on this platform stopped working. Fixes: 92a81562e695 ("leds: lp55xx: Add multicolor framework support to lp5= 5xx") Fixes: ac219bf3c9bd ("leds: lp55xx: Convert to use GPIO descriptors") Signed-off-by: Merlijn Wajer Signed-off-by: Sicelo A. Mhlongo Signed-off-by: Pavel Machek Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/boot/dts/omap3-n900.dts | 50 +++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n90= 0.dts index 32335d4ce478b..d40c3d2c4914e 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts @@ -8,6 +8,7 @@ =20 #include "omap34xx.dtsi" #include +#include =20 /* * Default secure signed bootloader (Nokia X-Loader) does not enable L3 fi= rewall @@ -630,63 +631,92 @@ }; =20 lp5523: lp5523@32 { + #address-cells =3D <1>; + #size-cells =3D <0>; compatible =3D "national,lp5523"; reg =3D <0x32>; clock-mode =3D /bits/ 8 <0>; /* LP55XX_CLOCK_AUTO */ - enable-gpio =3D <&gpio2 9 GPIO_ACTIVE_HIGH>; /* 41 */ + enable-gpios =3D <&gpio2 9 GPIO_ACTIVE_HIGH>; /* 41 */ =20 - chan0 { + led@0 { + reg =3D <0>; chan-name =3D "lp5523:kb1"; led-cur =3D /bits/ 8 <50>; max-cur =3D /bits/ 8 <100>; + color =3D ; + function =3D LED_FUNCTION_KBD_BACKLIGHT; }; =20 - chan1 { + led@1 { + reg =3D <1>; chan-name =3D "lp5523:kb2"; led-cur =3D /bits/ 8 <50>; max-cur =3D /bits/ 8 <100>; + color =3D ; + function =3D LED_FUNCTION_KBD_BACKLIGHT; }; =20 - chan2 { + led@2 { + reg =3D <2>; chan-name =3D "lp5523:kb3"; led-cur =3D /bits/ 8 <50>; max-cur =3D /bits/ 8 <100>; + color =3D ; + function =3D LED_FUNCTION_KBD_BACKLIGHT; }; =20 - chan3 { + led@3 { + reg =3D <3>; chan-name =3D "lp5523:kb4"; led-cur =3D /bits/ 8 <50>; max-cur =3D /bits/ 8 <100>; + color =3D ; + function =3D LED_FUNCTION_KBD_BACKLIGHT; }; =20 - chan4 { + led@4 { + reg =3D <4>; chan-name =3D "lp5523:b"; led-cur =3D /bits/ 8 <50>; max-cur =3D /bits/ 8 <100>; + color =3D ; + function =3D LED_FUNCTION_STATUS; }; =20 - chan5 { + led@5 { + reg =3D <5>; chan-name =3D "lp5523:g"; led-cur =3D /bits/ 8 <50>; max-cur =3D /bits/ 8 <100>; + color =3D ; + function =3D LED_FUNCTION_STATUS; }; =20 - chan6 { + led@6 { + reg =3D <6>; chan-name =3D "lp5523:r"; led-cur =3D /bits/ 8 <50>; max-cur =3D /bits/ 8 <100>; + color =3D ; + function =3D LED_FUNCTION_STATUS; }; =20 - chan7 { + led@7 { + reg =3D <7>; chan-name =3D "lp5523:kb5"; led-cur =3D /bits/ 8 <50>; max-cur =3D /bits/ 8 <100>; + color =3D ; + function =3D LED_FUNCTION_KBD_BACKLIGHT; }; =20 - chan8 { + led@8 { + reg =3D <8>; chan-name =3D "lp5523:kb6"; led-cur =3D /bits/ 8 <50>; max-cur =3D /bits/ 8 <100>; + color =3D ; + function =3D LED_FUNCTION_KBD_BACKLIGHT; }; }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE27FC43219 for ; Mon, 24 Jan 2022 22:04:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578130AbiAXWBp (ORCPT ); Mon, 24 Jan 2022 17:01:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38674 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450269AbiAXVUJ (ORCPT ); Mon, 24 Jan 2022 16:20:09 -0500 Received: from smtp.kernel.org (relay.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 03601B81142; Mon, 24 Jan 2022 21:20:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28BFEC340E4; Mon, 24 Jan 2022 21:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059205; bh=Me67gsWeV+RFSnXE3+KumzwdeAVvLxMDCMedH2J8DJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z7cn0C9B4oaPvcEpHKzJc4Z9wtO8aRzYgUHHaedSfDR4r2jCGAZajiqGlbE6Hfm4f LgD/KOaNr3pZW3NvCYzpkIfbHo67m0Njbi7SVQ/3VPaoZP/RhcXmXE/93bt8Q9kQ3A k7+gOTNIvyZhcnTLOj3mixnbr+camGeyNdxP34TY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Merlijn Wajer , Linus Walleij , Pavel Machek , Sasha Levin Subject: [PATCH 5.16 0538/1039] leds: lp55xx: initialise output direction from dts Date: Mon, 24 Jan 2022 19:38:47 +0100 Message-Id: <20220124184143.361853911@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Merlijn Wajer [ Upstream commit 9e87a8da747bf72365abb79e6f64fcca955b4f56 ] Commit a5d3d1adc95f ("leds: lp55xx: Initialize enable GPIO direction to output") attempts to fix this, but the fix did not work since at least for the Nokia N900 the value needs to be set to HIGH, per the device tree. So rather than hardcoding the value to a potentially invalid value for some devices, let's set direction in lp55xx_init_device. Fixes: a5d3d1adc95f ("leds: lp55xx: Initialize enable GPIO direction to out= put") Fixes: 92a81562e695 ("leds: lp55xx: Add multicolor framework support to lp5= 5xx") Fixes: ac219bf3c9bd ("leds: lp55xx: Convert to use GPIO descriptors") Signed-off-by: Merlijn Wajer Reviewed-by: Linus Walleij Signed-off-by: Pavel Machek Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/leds/leds-lp55xx-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-c= ommon.c index d1657c46ee2f8..9fdfc1b9a1a0c 100644 --- a/drivers/leds/leds-lp55xx-common.c +++ b/drivers/leds/leds-lp55xx-common.c @@ -439,6 +439,8 @@ int lp55xx_init_device(struct lp55xx_chip *chip) return -EINVAL; =20 if (pdata->enable_gpiod) { + gpiod_direction_output(pdata->enable_gpiod, 0); + gpiod_set_consumer_name(pdata->enable_gpiod, "LP55xx enable"); gpiod_set_value(pdata->enable_gpiod, 0); usleep_range(1000, 2000); /* Keep enable down at least 1ms */ @@ -694,7 +696,7 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(s= truct device *dev, of_property_read_u8(np, "clock-mode", &pdata->clock_mode); =20 pdata->enable_gpiod =3D devm_gpiod_get_optional(dev, "enable", - GPIOD_OUT_LOW); + GPIOD_ASIS); if (IS_ERR(pdata->enable_gpiod)) return ERR_CAST(pdata->enable_gpiod); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6265C433FE for ; Mon, 24 Jan 2022 23:58:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366468AbiAXXww (ORCPT ); Mon, 24 Jan 2022 18:52:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845967AbiAXXOG (ORCPT ); Mon, 24 Jan 2022 18:14:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A2F4C0A02BB; Mon, 24 Jan 2022 13:20:11 -0800 (PST) Received: from smtp.kernel.org (relay.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 EB804B80CCF; Mon, 24 Jan 2022 21:20:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 223F2C340E4; Mon, 24 Jan 2022 21:20:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059208; bh=9AfX050h7vqtW4uHKfS+QEoh4ELln8/kbkjaziam404=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g9To24djME78oELHXqHMg5/fIoRyUzMyFhSkb26Ojm7xKw4aSHYB809KV1BC6i/nI e1t9+xF++fyNnGNoM8ni2APkp9rJfZXUXZc5a7OmFcZtjPSKsVCu0la3/2CnSVWiqL Kt2AiOH02X+R49T0St9oh6Ur5O+k1mH6shDDG1qU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nguyen Dinh Phi , syzbot+4c4ffd1e1094dae61035@syzkaller.appspotmail.com, Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0539/1039] Bluetooth: hci_sock: purge socket queues in the destruct() callback Date: Mon, 24 Jan 2022 19:38:48 +0100 Message-Id: <20220124184143.393483007@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nguyen Dinh Phi [ Upstream commit 709fca500067524381e28a5f481882930eebac88 ] The receive path may take the socket right before hci_sock_release(), but it may enqueue the packets to the socket queues after the call to skb_queue_purge(), therefore the socket can be destroyed without clear its queues completely. Moving these skb_queue_purge() to the hci_sock_destruct() will fix this issue, because nothing is referencing the socket at this point. Signed-off-by: Nguyen Dinh Phi Reported-by: syzbot+4c4ffd1e1094dae61035@syzkaller.appspotmail.com Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/hci_sock.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index f2506e656f3e4..33b3c0ffc3399 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -889,10 +889,6 @@ static int hci_sock_release(struct socket *sock) } =20 sock_orphan(sk); - - skb_queue_purge(&sk->sk_receive_queue); - skb_queue_purge(&sk->sk_write_queue); - release_sock(sk); sock_put(sk); return 0; @@ -2059,6 +2055,12 @@ static int hci_sock_getsockopt(struct socket *sock, = int level, int optname, return err; } =20 +static void hci_sock_destruct(struct sock *sk) +{ + skb_queue_purge(&sk->sk_receive_queue); + skb_queue_purge(&sk->sk_write_queue); +} + static const struct proto_ops hci_sock_ops =3D { .family =3D PF_BLUETOOTH, .owner =3D THIS_MODULE, @@ -2112,6 +2114,7 @@ static int hci_sock_create(struct net *net, struct so= cket *sock, int protocol, =20 sock->state =3D SS_UNCONNECTED; sk->sk_state =3D BT_OPEN; + sk->sk_destruct =3D hci_sock_destruct; =20 bt_sock_link(&hci_sk_list, sk); return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FF15C35270 for ; Mon, 24 Jan 2022 22:04:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578152AbiAXWBt (ORCPT ); Mon, 24 Jan 2022 17:01:49 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41660 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450321AbiAXVUP (ORCPT ); Mon, 24 Jan 2022 16:20:15 -0500 Received: from smtp.kernel.org (relay.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 327D4611C8; Mon, 24 Jan 2022 21:20:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11F1EC340E4; Mon, 24 Jan 2022 21:20:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059214; bh=zJJCjk/TJ9AzJOpeI4ISVaIgitdR7n9T84pedxcLQjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nsyH7H/a3X7V93Mt1+YXFjtPExby1OXgbdB59C9E8fR7Fqvj77vpm81x7pf7dLnro xPUF3WQx5xtg4OzGWENTZsWWVqhfrtFcrMF0ZZLHnf09EKSC25LlKpcEk4JI5wflFw PVDICukPPcaVaSXz05QLG4+sHU+bzyqB81H5dzsQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Yongjun , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0540/1039] Bluetooth: Fix debugfs entry leak in hci_register_dev() Date: Mon, 24 Jan 2022 19:38:49 +0100 Message-Id: <20220124184143.426234413@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wei Yongjun [ Upstream commit 5a4bb6a8e981d3d0d492aa38412ee80b21033177 ] Fault injection test report debugfs entry leak as follows: debugfs: Directory 'hci0' with parent 'bluetooth' already present! When register_pm_notifier() failed in hci_register_dev(), the debugfs create by debugfs_create_dir() do not removed in the error handing path. Add the remove debugfs code to fix it. Signed-off-by: Wei Yongjun Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/hci_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 2cf77d76c50be..6c00ce302f095 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3883,6 +3883,7 @@ int hci_register_dev(struct hci_dev *hdev) return id; =20 err_wqueue: + debugfs_remove_recursive(hdev->debugfs); destroy_workqueue(hdev->workqueue); destroy_workqueue(hdev->req_workqueue); err: --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D992DC4167B for ; Mon, 24 Jan 2022 22:04:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578172AbiAXWBy (ORCPT ); Mon, 24 Jan 2022 17:01:54 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38794 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450358AbiAXVUW (ORCPT ); Mon, 24 Jan 2022 16:20:22 -0500 Received: from smtp.kernel.org (relay.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 95021B81188; Mon, 24 Jan 2022 21:20:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2258AC340E4; Mon, 24 Jan 2022 21:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059218; bh=KgD6qxy+fP2fvSM/3e8PrWESYFntT/ISgWQqCE2FJS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dtQziMlkN1DA1sQX3v5vYrP8o3b5jNuuGHhWUe+hoo2Opw/aF8hmNApSfRaau6+6c yhsn+WTGaBHqcJeUrkbborYVSmzGtDzuLLudrOMIh8Lsqj6RWZxCWLMt83xvfQxmoE zyAlgB3oL2OFgbTHRSJGurzBukFVMe8CdLuV8fZg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Yongjun , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0541/1039] Bluetooth: Fix memory leak of hci device Date: Mon, 24 Jan 2022 19:38:50 +0100 Message-Id: <20220124184143.466693673@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wei Yongjun [ Upstream commit 75d9b8559ac36e059238ee4f8e33cd86086586ba ] Fault injection test reported memory leak of hci device as follows: unreferenced object 0xffff88800b858000 (size 8192): comm "kworker/0:2", pid 167, jiffies 4294955747 (age 557.148s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 ad 4e ad de .............N.. backtrace: [<0000000070eb1059>] kmem_cache_alloc_trace mm/slub.c:3208 [<00000000015eb521>] hci_alloc_dev_priv include/linux/slab.h:591 [<00000000dcfc1e21>] bpa10x_probe include/net/bluetooth/hci_core.h:1240 [<000000005d3028c7>] usb_probe_interface drivers/usb/core/driver.c:397 [<00000000cbac9243>] really_probe drivers/base/dd.c:517 [<0000000024cab3f0>] __driver_probe_device drivers/base/dd.c:751 [<00000000202135cb>] driver_probe_device drivers/base/dd.c:782 [<000000000761f2bc>] __device_attach_driver drivers/base/dd.c:899 [<00000000f7d63134>] bus_for_each_drv drivers/base/bus.c:427 [<00000000c9551f0b>] __device_attach drivers/base/dd.c:971 [<000000007f79bd16>] bus_probe_device drivers/base/bus.c:487 [<000000007bb8b95a>] device_add drivers/base/core.c:3364 [<000000009564d9ea>] usb_set_configuration drivers/usb/core/message.c:2= 171 [<00000000e4657087>] usb_generic_driver_probe drivers/usb/core/generic.= c:239 [<0000000071ede518>] usb_probe_device drivers/usb/core/driver.c:294 [<00000000cbac9243>] really_probe drivers/base/dd.c:517 hci_alloc_dev() do not init the device's flag. And hci_free_dev() using put_device() to free the memory allocated for this device, but it calls just put_device(dev) only in case of HCI_UNREGISTER flag is set, So any error handing before hci_register_dev() success will cause memory leak. To avoid this behaviour we can using kfree() to release dev before hci_register_dev() success. Signed-off-by: Wei Yongjun Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/hci_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 7827639ecf5c3..4e3e0451b08c1 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -86,6 +86,8 @@ static void bt_host_release(struct device *dev) =20 if (hci_dev_test_flag(hdev, HCI_UNREGISTER)) hci_release_dev(hdev); + else + kfree(hdev); module_put(THIS_MODULE); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ADE5C35272 for ; Mon, 24 Jan 2022 23:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367027AbiAXXyA (ORCPT ); Mon, 24 Jan 2022 18:54:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845968AbiAXXOG (ORCPT ); Mon, 24 Jan 2022 18:14:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2C31C0A02BC; Mon, 24 Jan 2022 13:20:23 -0800 (PST) Received: from smtp.kernel.org (relay.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 AB0E4B8122A; Mon, 24 Jan 2022 21:20:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D22EEC340E4; Mon, 24 Jan 2022 21:20:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059221; bh=FWew8kSA0PCwrUkOdUPtZ3rD8Vs0Xt6T0HP/cCKVwJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ve5EFQANxmJWrwbdugWUS3ICHuDZfouP78L6p4QCWqCTmtymjrBca7McffT/KaSAB dPRpqtggyGjnh4Eqq1fUJRWHK1FSmOYocV7jJjeWoKOIo44EKvHpSWdRGj6aVI2lxR TxE21lvfWve73DonBMPDkECFwloH+ktCAqEGvxcg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.16 0542/1039] drm/panel: Delete panel on mipi_dsi_attach() failure Date: Mon, 24 Jan 2022 19:38:51 +0100 Message-Id: <20220124184143.497065511@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit 9bf7123bb07f98dc76acb5daa91248e6f95713cb ] Many DSI panel drivers fail to clean up their panel references on mipi_dsi_attach() failure, so we're leaving a dangling drm_panel reference to freed memory. Clean that up on failure. Noticed by inspection, after seeing similar problems on other drivers. Therefore, I'm not marking Fixes/stable. Signed-off-by: Brian Norris Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20210923173336.3.If9e74= fa9b1d6eaa9e0e5b95b2b957b992740251c@changeid Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c | 8 +++++++- drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 8 +++++++- drivers/gpu/drm/panel/panel-novatek-nt36672a.c | 8 +++++++- drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c | 8 +++++++- drivers/gpu/drm/panel/panel-ronbo-rb070d30.c | 8 +++++++- drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c | 1 + drivers/gpu/drm/panel/panel-samsung-sofef00.c | 1 + drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 8 +++++++- 8 files changed, 44 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/driver= s/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c index 581661b506f81..f9c1f7bc8218c 100644 --- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c +++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c @@ -227,7 +227,13 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *d= si) dsi->format =3D MIPI_DSI_FMT_RGB888; dsi->lanes =3D 4; =20 - return mipi_dsi_attach(dsi); + ret =3D mipi_dsi_attach(dsi); + if (ret < 0) { + drm_panel_remove(&ctx->panel); + return ret; + } + + return 0; } =20 static int feiyang_dsi_remove(struct mipi_dsi_device *dsi) diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/d= rm/panel/panel-jdi-lt070me05000.c index 733010b5e4f53..3c86ad262d5e0 100644 --- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c @@ -473,7 +473,13 @@ static int jdi_panel_probe(struct mipi_dsi_device *dsi) if (ret < 0) return ret; =20 - return mipi_dsi_attach(dsi); + ret =3D mipi_dsi_attach(dsi); + if (ret < 0) { + jdi_panel_del(jdi); + return ret; + } + + return 0; } =20 static int jdi_panel_remove(struct mipi_dsi_device *dsi) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c b/drivers/gpu/d= rm/panel/panel-novatek-nt36672a.c index 533cd3934b8b7..839b263fb3c0f 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c @@ -656,7 +656,13 @@ static int nt36672a_panel_probe(struct mipi_dsi_device= *dsi) if (err < 0) return err; =20 - return mipi_dsi_attach(dsi); + err =3D mipi_dsi_attach(dsi); + if (err < 0) { + drm_panel_remove(&pinfo->base); + return err; + } + + return 0; } =20 static int nt36672a_panel_remove(struct mipi_dsi_device *dsi) diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers= /gpu/drm/panel/panel-panasonic-vvx10f034n00.c index 3c20beeb17819..3991f5d950af4 100644 --- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c @@ -241,7 +241,13 @@ static int wuxga_nt_panel_probe(struct mipi_dsi_device= *dsi) if (ret < 0) return ret; =20 - return mipi_dsi_attach(dsi); + ret =3D mipi_dsi_attach(dsi); + if (ret < 0) { + wuxga_nt_panel_del(wuxga_nt); + return ret; + } + + return 0; } =20 static int wuxga_nt_panel_remove(struct mipi_dsi_device *dsi) diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm= /panel/panel-ronbo-rb070d30.c index a3782830ae3c4..1fb579a574d9f 100644 --- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c +++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c @@ -199,7 +199,13 @@ static int rb070d30_panel_dsi_probe(struct mipi_dsi_de= vice *dsi) dsi->format =3D MIPI_DSI_FMT_RGB888; dsi->lanes =3D 4; =20 - return mipi_dsi_attach(dsi); + ret =3D mipi_dsi_attach(dsi); + if (ret < 0) { + drm_panel_remove(&ctx->panel); + return ret; + } + + return 0; } =20 static int rb070d30_panel_dsi_remove(struct mipi_dsi_device *dsi) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c b/dri= vers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c index ea63799ff2a1e..29fde3823212b 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c @@ -247,6 +247,7 @@ static int s6e88a0_ams452ef01_probe(struct mipi_dsi_dev= ice *dsi) ret =3D mipi_dsi_attach(dsi); if (ret < 0) { dev_err(dev, "Failed to attach to DSI host: %d\n", ret); + drm_panel_remove(&ctx->panel); return ret; } =20 diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c b/drivers/gpu/dr= m/panel/panel-samsung-sofef00.c index 8cb1853574bb8..6d107e14fcc55 100644 --- a/drivers/gpu/drm/panel/panel-samsung-sofef00.c +++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c @@ -302,6 +302,7 @@ static int sofef00_panel_probe(struct mipi_dsi_device *= dsi) ret =3D mipi_dsi_attach(dsi); if (ret < 0) { dev_err(dev, "Failed to attach to DSI host: %d\n", ret); + drm_panel_remove(&ctx->panel); return ret; } =20 diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/= drm/panel/panel-sharp-ls043t1le01.c index b937e24dac8e0..25829a0a8e801 100644 --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c @@ -296,7 +296,13 @@ static int sharp_nt_panel_probe(struct mipi_dsi_device= *dsi) if (ret < 0) return ret; =20 - return mipi_dsi_attach(dsi); + ret =3D mipi_dsi_attach(dsi); + if (ret < 0) { + sharp_nt_panel_del(sharp_nt); + return ret; + } + + return 0; } =20 static int sharp_nt_panel_remove(struct mipi_dsi_device *dsi) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B83EC433EF for ; Mon, 24 Jan 2022 21:57:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575781AbiAXVwa (ORCPT ); Mon, 24 Jan 2022 16:52:30 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37676 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450398AbiAXVU1 (ORCPT ); Mon, 24 Jan 2022 16:20:27 -0500 Received: from smtp.kernel.org (relay.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 9D2C9B81057; Mon, 24 Jan 2022 21:20:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFC27C340E4; Mon, 24 Jan 2022 21:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059224; bh=dlPDKHqCSXfPjaKZ96hJwLoit81JvMZoIoPBWl/uRsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m9A+tYIRIcKLlYBxb3oYISv8eRyqaDPH8/Yfp1bn/3hmYhU4DvSsrlOVZwc3qR82U ByuA5FM8xlaetEGIU7Erbr/BTqJMbjkYs3r/zr1Ei3sn5to3dza3Yg2ZCcMw95BTAN ilfK1iHaaXNnVxxbCVbuJefU9qdeyu7D5xmA3PvA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Archie Pusaka , Sonny Sasaka , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.16 0543/1039] Bluetooth: Fix removing adv when processing cmd complete Date: Mon, 24 Jan 2022 19:38:52 +0100 Message-Id: <20220124184143.528865585@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Archie Pusaka [ Upstream commit 2128939fe2e771645dd88e1938c27fdf96bd1cd0 ] If we remove one instance of adv using Set Extended Adv Enable, there is a possibility of issue occurs when processing the Command Complete event. Especially, the adv_info might not be found since we already remove it in hci_req_clear_adv_instance() -> hci_remove_adv_instance(). If that's the case, we will mistakenly proceed to remove all adv instances instead of just one single instance. This patch fixes the issue by checking the content of the HCI command instead of checking whether the adv_info is found. Signed-off-by: Archie Pusaka Reviewed-by: Sonny Sasaka Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/hci_event.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 6eba439487749..8882c6dfb48f4 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -1326,8 +1326,10 @@ static void hci_cc_le_set_ext_adv_enable(struct hci_= dev *hdev, &conn->le_conn_timeout, conn->conn_timeout); } else { - if (adv) { - adv->enabled =3D false; + if (cp->num_of_sets) { + if (adv) + adv->enabled =3D false; + /* If just one instance was disabled check if there are * any other instance enabled before clearing HCI_LE_ADV */ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0955EC4167E for ; Mon, 24 Jan 2022 22:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578219AbiAXWCF (ORCPT ); Mon, 24 Jan 2022 17:02:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43168 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450423AbiAXVU2 (ORCPT ); Mon, 24 Jan 2022 16:20:28 -0500 Received: from smtp.kernel.org (relay.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 20F0B61305; Mon, 24 Jan 2022 21:20:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F02F2C340E4; Mon, 24 Jan 2022 21:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059227; bh=hMvz0BBLDKfp6xLtKBumqNeTre1P81r1tH1l9Baj+sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=behnfwQp/OCYQ/rOScrWLRjs/nBOqHk2iG57W/kzKmgH3U8ihi6WLAjS/JBhtD4cj yD9l/3NqzW6yv44RlDxF8aoH8UjhpeC/cnWtzJj+im7juK8nATZ1TMA/BdOId7D13s mAh45GNYPuacpe9ogBV0vHeZ3nHumMC+T+BTgzv4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Grodzovsky , Daniel Vetter , =?UTF-8?q?Christian=20K=C3=B6nig?= , Sasha Levin Subject: [PATCH 5.16 0544/1039] drm/sched: Avoid lockdep spalt on killing a processes Date: Mon, 24 Jan 2022 19:38:53 +0100 Message-Id: <20220124184143.561981088@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Andrey Grodzovsky [ Upstream commit 542cff7893a37445f98ece26aeb3c9c1055e9ea4 ] Probelm: Singlaning one sched fence from within another's sched fence singal callback generates lockdep splat because the both have same lockdep class of their fence->lock Fix: Fix bellow stack by rescheduling to irq work of signaling and killing of jobs that left when entity is killed. [11176.741181] dump_stack+0x10/0x12 [11176.741186] __lock_acquire.cold+0x208/0x2df [11176.741197] lock_acquire+0xc6/0x2d0 [11176.741204] ? dma_fence_signal+0x28/0x80 [11176.741212] _raw_spin_lock_irqsave+0x4d/0x70 [11176.741219] ? dma_fence_signal+0x28/0x80 [11176.741225] dma_fence_signal+0x28/0x80 [11176.741230] drm_sched_fence_finished+0x12/0x20 [gpu_sched] [11176.741240] drm_sched_entity_kill_jobs_cb+0x1c/0x50 [gpu_sched] [11176.741248] dma_fence_signal_timestamp_locked+0xac/0x1a0 [11176.741254] dma_fence_signal+0x3b/0x80 [11176.741260] drm_sched_fence_finished+0x12/0x20 [gpu_sched] [11176.741268] drm_sched_job_done.isra.0+0x7f/0x1a0 [gpu_sched] [11176.741277] drm_sched_job_done_cb+0x12/0x20 [gpu_sched] [11176.741284] dma_fence_signal_timestamp_locked+0xac/0x1a0 [11176.741290] dma_fence_signal+0x3b/0x80 [11176.741296] amdgpu_fence_process+0xd1/0x140 [amdgpu] [11176.741504] sdma_v4_0_process_trap_irq+0x8c/0xb0 [amdgpu] [11176.741731] amdgpu_irq_dispatch+0xce/0x250 [amdgpu] [11176.741954] amdgpu_ih_process+0x81/0x100 [amdgpu] [11176.742174] amdgpu_irq_handler+0x26/0xa0 [amdgpu] [11176.742393] __handle_irq_event_percpu+0x4f/0x2c0 [11176.742402] handle_irq_event_percpu+0x33/0x80 [11176.742408] handle_irq_event+0x39/0x60 [11176.742414] handle_edge_irq+0x93/0x1d0 [11176.742419] __common_interrupt+0x50/0xe0 [11176.742426] common_interrupt+0x80/0x90 Signed-off-by: Andrey Grodzovsky Suggested-by: Daniel Vetter Suggested-by: Christian K=C3=B6nig Tested-by: Christian K=C3=B6nig Reviewed-by: Christian K=C3=B6nig Link: https://www.spinics.net/lists/dri-devel/msg321250.html Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/scheduler/sched_entity.c | 15 ++++++++++++--- include/drm/gpu_scheduler.h | 12 +++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/sch= eduler/sched_entity.c index 27e1573af96e2..191c56064f196 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -190,6 +190,16 @@ long drm_sched_entity_flush(struct drm_sched_entity *e= ntity, long timeout) } EXPORT_SYMBOL(drm_sched_entity_flush); =20 +static void drm_sched_entity_kill_jobs_irq_work(struct irq_work *wrk) +{ + struct drm_sched_job *job =3D container_of(wrk, typeof(*job), work); + + drm_sched_fence_finished(job->s_fence); + WARN_ON(job->s_fence->parent); + job->sched->ops->free_job(job); +} + + /* Signal the scheduler finished fence when the entity in question is kill= ed. */ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f, struct dma_fence_cb *cb) @@ -197,9 +207,8 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fe= nce *f, struct drm_sched_job *job =3D container_of(cb, struct drm_sched_job, finish_cb); =20 - drm_sched_fence_finished(job->s_fence); - WARN_ON(job->s_fence->parent); - job->sched->ops->free_job(job); + init_irq_work(&job->work, drm_sched_entity_kill_jobs_irq_work); + irq_work_queue(&job->work); } =20 static struct dma_fence * diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index f011e4c407f2e..bbc22fad8d802 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -28,6 +28,7 @@ #include #include #include +#include =20 #define MAX_WAIT_SCHED_ENTITY_Q_EMPTY msecs_to_jiffies(1000) =20 @@ -286,7 +287,16 @@ struct drm_sched_job { struct list_head list; struct drm_gpu_scheduler *sched; struct drm_sched_fence *s_fence; - struct dma_fence_cb finish_cb; + + /* + * work is used only after finish_cb has been used and will not be + * accessed anymore. + */ + union { + struct dma_fence_cb finish_cb; + struct irq_work work; + }; + uint64_t id; atomic_t karma; enum drm_sched_priority s_priority; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50642C433EF for ; Mon, 24 Jan 2022 21:57:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575875AbiAXVwk (ORCPT ); Mon, 24 Jan 2022 16:52:40 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43196 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450438AbiAXVUc (ORCPT ); Mon, 24 Jan 2022 16:20:32 -0500 Received: from smtp.kernel.org (relay.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 1D6066136E; Mon, 24 Jan 2022 21:20:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0EE8C340E4; Mon, 24 Jan 2022 21:20:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059230; bh=uJoyLqhseUQJo0ZE3D2WIiitPdPERSXYICGFZS49XR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GoYOEfdWmvoTF0f/suooNNsHfrgkVIULeKab2raE1L9fC/+0xOs/2dgohRSzBg3X2 0fma0SFl2h5NAZNi7/hSZGjJC/rYghgJMiolr4RTnfRXptLEWMY5zWPbzQl8uSHoFW hnv7J0Z5S53xlr7NlkZLK0jH0qMngnin0V1oT12Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland , Sasha Levin Subject: [PATCH 5.16 0545/1039] fs: dlm: filter user dlm messages for kernel locks Date: Mon, 24 Jan 2022 19:38:54 +0100 Message-Id: <20220124184143.593711274@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Aring [ Upstream commit 6c2e3bf68f3e5e5a647aa52be246d5f552d7496d ] This patch fixes the following crash by receiving a invalid message: [ 160.672220] =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 [ 160.676206] BUG: KASAN: user-memory-access in dlm_user_add_ast+0xc3/0x370 [ 160.679659] Read of size 8 at addr 00000000deadbeef by task kworker/u32:= 13/319 [ 160.681447] [ 160.681824] CPU: 10 PID: 319 Comm: kworker/u32:13 Not tainted 5.14.0-rc2= + #399 [ 160.683472] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.14.0-1.module+el8= .6.0+12648+6ede71a5 04/01/2014 [ 160.685574] Workqueue: dlm_recv process_recv_sockets [ 160.686721] Call Trace: [ 160.687310] dump_stack_lvl+0x56/0x6f [ 160.688169] ? dlm_user_add_ast+0xc3/0x370 [ 160.689116] kasan_report.cold.14+0x116/0x11b [ 160.690138] ? dlm_user_add_ast+0xc3/0x370 [ 160.690832] dlm_user_add_ast+0xc3/0x370 [ 160.691502] _receive_unlock_reply+0x103/0x170 [ 160.692241] _receive_message+0x11df/0x1ec0 [ 160.692926] ? rcu_read_lock_sched_held+0xa1/0xd0 [ 160.693700] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 160.694427] ? lock_acquire+0x175/0x400 [ 160.695058] ? do_purge.isra.51+0x200/0x200 [ 160.695744] ? lock_acquired+0x360/0x5d0 [ 160.696400] ? lock_contended+0x6a0/0x6a0 [ 160.697055] ? lock_release+0x21d/0x5e0 [ 160.697686] ? lock_is_held_type+0xe0/0x110 [ 160.698352] ? lock_is_held_type+0xe0/0x110 [ 160.699026] ? ___might_sleep+0x1cc/0x1e0 [ 160.699698] ? dlm_wait_requestqueue+0x94/0x140 [ 160.700451] ? dlm_process_requestqueue+0x240/0x240 [ 160.701249] ? down_write_killable+0x2b0/0x2b0 [ 160.701988] ? do_raw_spin_unlock+0xa2/0x130 [ 160.702690] dlm_receive_buffer+0x1a5/0x210 [ 160.703385] dlm_process_incoming_buffer+0x726/0x9f0 [ 160.704210] receive_from_sock+0x1c0/0x3b0 [ 160.704886] ? dlm_tcp_shutdown+0x30/0x30 [ 160.705561] ? lock_acquire+0x175/0x400 [ 160.706197] ? rcu_read_lock_sched_held+0xa1/0xd0 [ 160.706941] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 160.707681] process_recv_sockets+0x32/0x40 [ 160.708366] process_one_work+0x55e/0xad0 [ 160.709045] ? pwq_dec_nr_in_flight+0x110/0x110 [ 160.709820] worker_thread+0x65/0x5e0 [ 160.710423] ? process_one_work+0xad0/0xad0 [ 160.711087] kthread+0x1ed/0x220 [ 160.711628] ? set_kthread_struct+0x80/0x80 [ 160.712314] ret_from_fork+0x22/0x30 The issue is that we received a DLM message for a user lock but the destination lock is a kernel lock. Note that the address which is trying to derefence is 00000000deadbeef, which is in a kernel lock lkb->lkb_astparam, this field should never be derefenced by the DLM kernel stack. In case of a user lock lkb->lkb_astparam is lkb->lkb_ua (memory is shared by a union field). The struct lkb_ua will be handled by the DLM kernel stack but on a kernel lock it will contain invalid data and ends in most likely crashing the kernel. It can be reproduced with two cluster nodes. node 2: dlm_tool join test echo "862 fooobaar 1 2 1" > /sys/kernel/debug/dlm/test_locks echo "862 3 1" > /sys/kernel/debug/dlm/test_waiters node 1: dlm_tool join test python: foo =3D DLM(h_cmd=3D3, o_nextcmd=3D1, h_nodeid=3D1, h_lockspace=3D0x7722202= 7, \ m_type=3D7, m_flags=3D0x1, m_remid=3D0x862, m_result=3D0xFFFEFFFE) newFile =3D open("/sys/kernel/debug/dlm/comms/2/rawmsg", "wb") newFile.write(bytes(foo)) Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/dlm/lock.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index c502c065d0075..28d1f35b11a4d 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -3973,6 +3973,14 @@ static int validate_message(struct dlm_lkb *lkb, str= uct dlm_message *ms) int from =3D ms->m_header.h_nodeid; int error =3D 0; =20 + /* currently mixing of user/kernel locks are not supported */ + if (ms->m_flags & DLM_IFL_USER && ~lkb->lkb_flags & DLM_IFL_USER) { + log_error(lkb->lkb_resource->res_ls, + "got user dlm message for a kernel lock"); + error =3D -EINVAL; + goto out; + } + switch (ms->m_type) { case DLM_MSG_CONVERT: case DLM_MSG_UNLOCK: @@ -4001,6 +4009,7 @@ static int validate_message(struct dlm_lkb *lkb, stru= ct dlm_message *ms) error =3D -EINVAL; } =20 +out: if (error) log_error(lkb->lkb_resource->res_ls, "ignore invalid message %d from %d %x %x %x %d", --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF94CC433EF for ; Mon, 24 Jan 2022 22:03:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577284AbiAXV7o (ORCPT ); Mon, 24 Jan 2022 16:59:44 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38896 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451331AbiAXVWl (ORCPT ); Mon, 24 Jan 2022 16:22:41 -0500 Received: from smtp.kernel.org (relay.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 5222EB8123A; Mon, 24 Jan 2022 21:22:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76659C340E5; Mon, 24 Jan 2022 21:22:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059359; bh=9n98TaX+hUU8kjXcOlvMGtKM6jKo4501BytYLKGahLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dhxDa85WKc3dpC+Iisml4rNXfOmm/n5kQtjixhHbQOLbODMl+0NPiJon4/IAdx/bh lGyYDy7iJ2R/iyPpvrwyN/PBoMDHfo8Ij8XScW/TUObtMdlfTPcLU7HAo+PqOASLta sRnanMXNquQIEk6c1FNHcbdPHkv5bV82XaQ1LP5Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Yonghong Song , Sasha Levin Subject: [PATCH 5.16 0546/1039] libbpf: Detect corrupted ELF symbols section Date: Mon, 24 Jan 2022 19:38:55 +0100 Message-Id: <20220124184143.626129823@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 833907876be55205d0ec153dcd819c014404ee16 ] Prevent divide-by-zero if ELF is corrupted and has zero sh_entsize. Reported by oss-fuzz project. Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20211103173213.1376990-2-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 2696f0b7f0acc..1cc0383471f01 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -3556,7 +3556,7 @@ static int bpf_object__collect_externs(struct bpf_obj= ect *obj) =20 scn =3D elf_sec_by_idx(obj, obj->efile.symbols_shndx); sh =3D elf_sec_hdr(obj, scn); - if (!sh) + if (!sh || sh->sh_entsize !=3D sizeof(Elf64_Sym)) return -LIBBPF_ERRNO__FORMAT; =20 dummy_var_btf_id =3D add_dummy_ksym_var(obj->btf); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2308DC43219 for ; Mon, 24 Jan 2022 23:58:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366485AbiAXXwz (ORCPT ); Mon, 24 Jan 2022 18:52:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845986AbiAXXOJ (ORCPT ); Mon, 24 Jan 2022 18:14:09 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E03CC067A75; Mon, 24 Jan 2022 13:20:56 -0800 (PST) Received: from smtp.kernel.org (relay.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 26744B81218; Mon, 24 Jan 2022 21:20:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F143C340E4; Mon, 24 Jan 2022 21:20:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059253; bh=aVB5FviLglqF60loxM2XgzrRKvbq4BiXPpr7wIcCXXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJ68WdmNcWTP/dW1BOdHVYNjUqV3s29WirLRFwqHw2XYygQgZehBWuhcDI1mQ2EGx xRCPXtZBW5L7x3tbpeHbpucjnjexZqeWVpN7HVZLUnJcmoCmWIv01lL9Gn3wb2OfU3 Q1I5TToCin0D3ZXTuy/0wTVZFcTII8RIWQt9cs54= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Yonghong Song , Sasha Levin Subject: [PATCH 5.16 0547/1039] libbpf: Improve sanity checking during BTF fix up Date: Mon, 24 Jan 2022 19:38:56 +0100 Message-Id: <20220124184143.658837249@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 88918dc12dc357a06d8d722a684617b1c87a4654 ] If BTF is corrupted DATASEC's variable type ID might be incorrect. Prevent this easy to detect situation with extra NULL check. Reported by oss-fuzz project. Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20211103173213.1376990-3-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/libbpf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 1cc0383471f01..c7ba5e6ed9cfe 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -2753,13 +2753,12 @@ static int btf_fixup_datasec(struct bpf_object *obj= , struct btf *btf, =20 for (i =3D 0, vsi =3D btf_var_secinfos(t); i < vars; i++, vsi++) { t_var =3D btf__type_by_id(btf, vsi->type); - var =3D btf_var(t_var); - - if (!btf_is_var(t_var)) { + if (!t_var || !btf_is_var(t_var)) { pr_debug("Non-VAR type seen in section %s\n", name); return -EINVAL; } =20 + var =3D btf_var(t_var); if (var->linkage =3D=3D BTF_VAR_STATIC) continue; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2825BC4332F for ; Mon, 24 Jan 2022 21:58:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379793AbiAXVyq (ORCPT ); Mon, 24 Jan 2022 16:54:46 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43938 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450803AbiAXVV1 (ORCPT ); Mon, 24 Jan 2022 16:21:27 -0500 Received: from smtp.kernel.org (relay.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 81042614C9; Mon, 24 Jan 2022 21:21:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 699E4C340E4; Mon, 24 Jan 2022 21:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059286; bh=qugYk4pDsPqpyUGAGLi31+juSnBWrfgIxERcbKmTZ94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cB0GTfeQQzFjcG4ZjdqTbY2Vb8wtkd9SD7KhFa8OtEmdXFBLpOQaxlnT4pvoEzt3M RRwswxgWAMLPzEkVkYH7RXec2fXCrodDq2qm2mwj+2x7sCsE0sRDRtClC337pF1Ugi 5KfIAQcqE/7/lQlGYv8Nz6EEOMXn5xVISE13gnuA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Yonghong Song , Sasha Levin Subject: [PATCH 5.16 0548/1039] libbpf: Validate that .BTF and .BTF.ext sections contain data Date: Mon, 24 Jan 2022 19:38:57 +0100 Message-Id: <20220124184143.698193669@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 62554d52e71797eefa3fc15b54008038837bb2d4 ] .BTF and .BTF.ext ELF sections should have SHT_PROGBITS type and contain data. If they are not, ELF is invalid or corrupted, so bail out. Otherwise this can lead to data->d_buf being NULL and SIGSEGV later on. Reported by oss-fuzz project. Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20211103173213.1376990-4-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/libbpf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index c7ba5e6ed9cfe..96cee9cd8c03c 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -3271,8 +3271,12 @@ static int bpf_object__elf_collect(struct bpf_object= *obj) } else if (strcmp(name, MAPS_ELF_SEC) =3D=3D 0) { obj->efile.btf_maps_shndx =3D idx; } else if (strcmp(name, BTF_ELF_SEC) =3D=3D 0) { + if (sh->sh_type !=3D SHT_PROGBITS) + return -LIBBPF_ERRNO__FORMAT; btf_data =3D data; } else if (strcmp(name, BTF_EXT_ELF_SEC) =3D=3D 0) { + if (sh->sh_type !=3D SHT_PROGBITS) + return -LIBBPF_ERRNO__FORMAT; btf_ext_data =3D data; } else if (sh->sh_type =3D=3D SHT_SYMTAB) { /* already processed during the first pass above */ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56CECC43217 for ; Mon, 24 Jan 2022 21:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576897AbiAXV4l (ORCPT ); Mon, 24 Jan 2022 16:56:41 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44548 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451030AbiAXVWA (ORCPT ); Mon, 24 Jan 2022 16:22:00 -0500 Received: from smtp.kernel.org (relay.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 C1F2161320; Mon, 24 Jan 2022 21:21:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0EE5C340E4; Mon, 24 Jan 2022 21:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059319; bh=KHJX1CBivhLoDwFSvdl5GVShspbncmIWqtKSQBbrEYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=00lfQvDFvd+Agb0mASjxRy5W5dK+LY/yPqLi7yMiSPXjjIqb3vc/Bn9rmyuqm68O7 9Imj+xv+jozJi/l7j9paAQjHA1wt+ooC8sONB+Kn/LqD+JWAOs22fadgXMuGFjK8r9 Cp9OERoo7iLPowzfYkle4j2b3cliM67zgBjJ/Y3M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Khoruzhick , Roman Stratiienko , Qiang Yu , Sasha Levin Subject: [PATCH 5.16 0549/1039] drm/lima: fix warning when CONFIG_DEBUG_SG=y & CONFIG_DMA_API_DEBUG=y Date: Mon, 24 Jan 2022 19:38:58 +0100 Message-Id: <20220124184143.737026613@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qiang Yu [ Upstream commit 89636a06fa2ee7826a19c39c19a9bc99ab9340a9 ] Otherwise get following warning: DMA-API: lima 1c40000.gpu: mapping sg segment longer than device claims to = support [len=3D4149248] [max=3D65536] See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5496 Reviewed-by: Vasily Khoruzhick Reported-by: Roman Stratiienko Signed-off-by: Qiang Yu Link: https://patchwork.freedesktop.org/patch/msgid/20211031041604.187216-1= -yuq825@gmail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/lima/lima_device.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/lima/lima_device.c b/drivers/gpu/drm/lima/lima= _device.c index f74f8048af8f2..02cef0cea6572 100644 --- a/drivers/gpu/drm/lima/lima_device.c +++ b/drivers/gpu/drm/lima/lima_device.c @@ -358,6 +358,7 @@ int lima_device_init(struct lima_device *ldev) int err, i; =20 dma_set_coherent_mask(ldev->dev, DMA_BIT_MASK(32)); + dma_set_max_seg_size(ldev->dev, UINT_MAX); =20 err =3D lima_clk_init(ldev); if (err) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D657C4167D for ; Mon, 24 Jan 2022 23:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366867AbiAXXxn (ORCPT ); Mon, 24 Jan 2022 18:53:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846023AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E7FDC067A7A; Mon, 24 Jan 2022 13:22:22 -0800 (PST) Received: from smtp.kernel.org (relay.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 278C8B81188; Mon, 24 Jan 2022 21:22:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 514AAC340E4; Mon, 24 Jan 2022 21:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059339; bh=RCAXm/IjT3B6yE8K0IDp6JIGWscVB0c2c/ZLJ90b314=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TMmmimB2MsbkDHD/TBIw9HujecLv5riURGWKmwdhF3QLk+FwxjIlHW3B+xA53r9iY wDtFdfEI7v1jzPD2QYqHhGnLXzAfQFTGxV+8LQwJmeeduGkUCEG/fPjmslZ6C+CrDX dVCRPrn24rUEQRCZ+qDyYintkCxiniYyScwEhZJg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Hengqi Chen , Sasha Levin Subject: [PATCH 5.16 0550/1039] selftests/bpf: Fix memory leaks in btf_type_c_dump() helper Date: Mon, 24 Jan 2022 19:38:59 +0100 Message-Id: <20220124184143.768902747@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 8ba285874913da21ca39a46376e9cc5ce0f45f94 ] Free up memory and resources used by temporary allocated memstream and btf_dump instance. Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Reviewed-by: Hengqi Chen Link: https://lore.kernel.org/bpf/20211107165521.9240-4-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/bpf/btf_helpers.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/btf_helpers.c b/tools/testing/self= tests/bpf/btf_helpers.c index b5b6b013a245e..3d1a748d09d81 100644 --- a/tools/testing/selftests/bpf/btf_helpers.c +++ b/tools/testing/selftests/bpf/btf_helpers.c @@ -251,18 +251,23 @@ const char *btf_type_c_dump(const struct btf *btf) d =3D btf_dump__new(btf, NULL, &opts, btf_dump_printf); if (libbpf_get_error(d)) { fprintf(stderr, "Failed to create btf_dump instance: %ld\n", libbpf_get_= error(d)); - return NULL; + goto err_out; } =20 for (i =3D 1; i < btf__type_cnt(btf); i++) { err =3D btf_dump__dump_type(d, i); if (err) { fprintf(stderr, "Failed to dump type [%d]: %d\n", i, err); - return NULL; + goto err_out; } } =20 + btf_dump__free(d); fflush(buf_file); fclose(buf_file); return buf; +err_out: + btf_dump__free(d); + fclose(buf_file); + return NULL; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D15AEC4167B for ; Mon, 24 Jan 2022 23:58:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366710AbiAXXxW (ORCPT ); Mon, 24 Jan 2022 18:53:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846025AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92CBFC067A7D; Mon, 24 Jan 2022 13:22:24 -0800 (PST) Received: from smtp.kernel.org (relay.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 3A357B81188; Mon, 24 Jan 2022 21:22:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CE63C340E4; Mon, 24 Jan 2022 21:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059343; bh=/EAeO4xUnZVlE4J3vuK3DNqUta/S6QmR1xXciBHU+t4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KaKw1anUg42BQFWn47k6WcIxzJi+pTM0JetW//CMyPMcOsqZ0h3rz4Lqie6Mc8TNq kJPLZ8DRmmh7h4HfqRX+PQANvSc7j1ZbnDZC1I/3TQtL7lOpIkfs0QGfplB+bH72PW gxuXJAdG/g6La8BLEoVRWN1jfI0zQqA+JPHFj25w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Hengqi Chen , Sasha Levin Subject: [PATCH 5.16 0551/1039] selftests/bpf: Destroy XDP link correctly Date: Mon, 24 Jan 2022 19:39:00 +0100 Message-Id: <20220124184143.806005676@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit f91231eeeed752119f49eb6620cae44ec745a007 ] bpf_link__detach() was confused with bpf_link__destroy() and leaves leaked FD in the process. Fix the problem. Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Reviewed-by: Hengqi Chen Link: https://lore.kernel.org/bpf/20211107165521.9240-9-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c b/t= ools/testing/selftests/bpf/prog_tests/migrate_reuseport.c index 7589c03fd26be..eb2feaac81fe2 100644 --- a/tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c +++ b/tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c @@ -204,8 +204,8 @@ static int pass_ack(struct migrate_reuseport_test_case = *test_case) { int err; =20 - err =3D bpf_link__detach(test_case->link); - if (!ASSERT_OK(err, "bpf_link__detach")) + err =3D bpf_link__destroy(test_case->link); + if (!ASSERT_OK(err, "bpf_link__destroy")) return -1; =20 test_case->link =3D NULL; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53CAAC3526C for ; Mon, 24 Jan 2022 23:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366684AbiAXXxU (ORCPT ); Mon, 24 Jan 2022 18:53:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846026AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1B47C067A7E; Mon, 24 Jan 2022 13:22:29 -0800 (PST) Received: from smtp.kernel.org (relay.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 66FD3B81188; Mon, 24 Jan 2022 21:22:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 908D4C340E4; Mon, 24 Jan 2022 21:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059347; bh=J5+2k5Vu9FXtz194cQpO41gLQP387GfoIjXIZAfACjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ayq8WpobEik83sUiuWRlQvbEjos2b1W1DBmgnuNyBuUUEK4nHgxQyZq/Q3zYZG97P XEeSi+hEEWOSxDpoMYD1cy5t2HxrB0JlXDuD+uJfNXYzb9PxQdUd5NWykIaFkpq7Ll N6sWOI8401q36BOzlXHLyXMg4qLQtlNzwYDbVax4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Hengqi Chen , Sasha Levin Subject: [PATCH 5.16 0552/1039] selftests/bpf: Fix bpf_object leak in skb_ctx selftest Date: Mon, 24 Jan 2022 19:39:01 +0100 Message-Id: <20220124184143.846196058@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 8c7a95520184b6677ca6075e12df9c208d57d088 ] skb_ctx selftest didn't close bpf_object implicitly allocated by bpf_prog_test_load() helper. Fix the problem by explicitly calling bpf_object__close() at the end of the test. Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Reviewed-by: Hengqi Chen Link: https://lore.kernel.org/bpf/20211107165521.9240-10-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/bpf/prog_tests/skb_ctx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/skb_ctx.c b/tools/testi= ng/selftests/bpf/prog_tests/skb_ctx.c index c437e6ba8fe20..db4d72563aaeb 100644 --- a/tools/testing/selftests/bpf/prog_tests/skb_ctx.c +++ b/tools/testing/selftests/bpf/prog_tests/skb_ctx.c @@ -111,4 +111,6 @@ void test_skb_ctx(void) "ctx_out_mark", "skb->mark =3D=3D %u, expected %d\n", skb.mark, 10); + + bpf_object__close(obj); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDF1AC433FE for ; Mon, 24 Jan 2022 21:59:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380355AbiAXV65 (ORCPT ); Mon, 24 Jan 2022 16:58:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:39942 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451244AbiAXVWd (ORCPT ); Mon, 24 Jan 2022 16:22:33 -0500 Received: from smtp.kernel.org (relay.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 45B2CB80FA1; Mon, 24 Jan 2022 21:22:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 767F8C340E5; Mon, 24 Jan 2022 21:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059350; bh=bz1hqXPikVfXBjdlfFqkzfQekXPW+TQfB3hTk5+n4r0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O+Z6CTf3mrWxcg1M2Lv7aUCDZpD6KItqM6DsXgw7tOrv+BmN+n/ulLdmWyByGsFmz tvM2wrF6Q4dTgTauha3XXMZ6beZA2mIy8AftkqAv25EkQ/MygfIWCWQb0YRVroVVP4 HCePV/rK1UGuBvoy9Tzyfg1rKudBKgq4ra1ld6ws= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zekun Shen , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0553/1039] ar5523: Fix null-ptr-deref with unexpected WDCMSG_TARGET_START reply Date: Mon, 24 Jan 2022 19:39:02 +0100 Message-Id: <20220124184143.879719547@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zekun Shen [ Upstream commit ae80b6033834342601e99f74f6a62ff5092b1cee ] Unexpected WDCMSG_TARGET_START replay can lead to null-ptr-deref when ar->tx_cmd->odata is NULL. The patch adds a null check to prevent such case. KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] ar5523_cmd+0x46a/0x581 [ar5523] ar5523_probe.cold+0x1b7/0x18da [ar5523] ? ar5523_cmd_rx_cb+0x7a0/0x7a0 [ar5523] ? __pm_runtime_set_status+0x54a/0x8f0 ? _raw_spin_trylock_bh+0x120/0x120 ? pm_runtime_barrier+0x220/0x220 ? __pm_runtime_resume+0xb1/0xf0 usb_probe_interface+0x25b/0x710 really_probe+0x209/0x5d0 driver_probe_device+0xc6/0x1b0 device_driver_attach+0xe2/0x120 I found the bug using a custome USBFuzz port. It's a research work to fuzz USB stack/drivers. I modified it to fuzz ath9k driver only, providing hand-crafted usb descriptors to QEMU. After fixing the code (fourth byte in usb packet) to WDCMSG_TARGET_START, I got the null-ptr-deref bug. I believe the bug is triggerable whenever cmd->odata is NULL. After patching, I tested with the same input and no longer see the KASAN report. This was NOT tested on a real device. Signed-off-by: Zekun Shen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YXsmPQ3awHFLuAj2@10-18-43-117.dynapool.wire= less.nyu.edu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ar5523/ar5523.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireles= s/ath/ar5523/ar5523.c index 0e9bad33fac85..141c1b5a7b1f3 100644 --- a/drivers/net/wireless/ath/ar5523/ar5523.c +++ b/drivers/net/wireless/ath/ar5523/ar5523.c @@ -153,6 +153,10 @@ static void ar5523_cmd_rx_cb(struct urb *urb) ar5523_err(ar, "Invalid reply to WDCMSG_TARGET_START"); return; } + if (!cmd->odata) { + ar5523_err(ar, "Unexpected WDCMSG_TARGET_START reply"); + return; + } memcpy(cmd->odata, hdr + 1, sizeof(u32)); cmd->olen =3D sizeof(u32); cmd->res =3D 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB2A2C433F5 for ; Mon, 24 Jan 2022 22:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380462AbiAXV7N (ORCPT ); Mon, 24 Jan 2022 16:59:13 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43196 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451259AbiAXVWe (ORCPT ); Mon, 24 Jan 2022 16:22:34 -0500 Received: from smtp.kernel.org (relay.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 8F90960C60; Mon, 24 Jan 2022 21:22:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6468DC340E5; Mon, 24 Jan 2022 21:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059353; bh=9ThM2tKjcmelkSf3NnzxN7fdj2TU5ZXZctFcGUmZTsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y34YWv5b6lr0uXJg2rEFEMbLSLpweN7haOcEqIxCTRh5Y+vM1Xxdb3uS3TwF+I/Q/ n5H0CtpLhO1YsGVv0ePQa+WaZnEmdTnfqEGLFgzxkQpH8DE8/dTF2Psyi6I+ocWo4O twdRvZUGC4ffyHLrz9k83eT/VnXSi/e/TyMrZWYM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , Neil Armstrong , Jernej Skrabec , Sasha Levin Subject: [PATCH 5.16 0554/1039] drm/bridge: dw-hdmi: handle ELD when DRM_BRIDGE_ATTACH_NO_CONNECTOR Date: Mon, 24 Jan 2022 19:39:03 +0100 Message-Id: <20220124184143.919776531@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 3f2532d65a571ca02258b547b5b68ab2e9406fdb ] The current ELD handling takes the internal connector ELD buffer and shares it to the I2S and AHB sub-driver. But with DRM_BRIDGE_ATTACH_NO_CONNECTOR, the connector is created elsewhere (or not), and an eventual connector is known only if the bridge chain up to a connector is enabled. The current dw-hdmi code gets the current connector from atomic_enable() so use the already stored connector pointer and replace the buffer pointer with a callback returning the current connector ELD buffer. Since a connector is not always available, either pass an empty ELD to the alsa HDMI driver or don't call snd_pcm_hw_constraint_eld() in AHB driver. Reported-by: Martin Blumenstingl Signed-off-by: Neil Armstrong [narmstrong: fixed typo in commit log] Acked-by: Jernej Skrabec Link: https://patchwork.freedesktop.org/patch/msgid/20211029135947.3022875-= 1-narmstrong@baylibre.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 10 +++++++--- drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h | 4 ++-- drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 9 ++++++++- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 ++++++++++-- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c b/drivers/= gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c index d0db1acf11d73..7d2ed0ed2fe26 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c @@ -320,13 +320,17 @@ static int dw_hdmi_open(struct snd_pcm_substream *sub= stream) struct snd_pcm_runtime *runtime =3D substream->runtime; struct snd_dw_hdmi *dw =3D substream->private_data; void __iomem *base =3D dw->data.base; + u8 *eld; int ret; =20 runtime->hw =3D dw_hdmi_hw; =20 - ret =3D snd_pcm_hw_constraint_eld(runtime, dw->data.eld); - if (ret < 0) - return ret; + eld =3D dw->data.get_eld(dw->data.hdmi); + if (eld) { + ret =3D snd_pcm_hw_constraint_eld(runtime, eld); + if (ret < 0) + return ret; + } =20 ret =3D snd_pcm_limit_hw_rates(runtime); if (ret < 0) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h b/drivers/gpu/= drm/bridge/synopsys/dw-hdmi-audio.h index cb07dc0da5a70..f72d27208ebef 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h @@ -9,15 +9,15 @@ struct dw_hdmi_audio_data { void __iomem *base; int irq; struct dw_hdmi *hdmi; - u8 *eld; + u8 *(*get_eld)(struct dw_hdmi *hdmi); }; =20 struct dw_hdmi_i2s_audio_data { struct dw_hdmi *hdmi; - u8 *eld; =20 void (*write)(struct dw_hdmi *hdmi, u8 val, int offset); u8 (*read)(struct dw_hdmi *hdmi, int offset); + u8 *(*get_eld)(struct dw_hdmi *hdmi); }; =20 #endif diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/= gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c index feb04f127b550..f50b47ac11a82 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c @@ -135,8 +135,15 @@ static int dw_hdmi_i2s_get_eld(struct device *dev, voi= d *data, uint8_t *buf, size_t len) { struct dw_hdmi_i2s_audio_data *audio =3D data; + u8 *eld; + + eld =3D audio->get_eld(audio->hdmi); + if (eld) + memcpy(buf, eld, min_t(size_t, MAX_ELD_BYTES, len)); + else + /* Pass en empty ELD if connector not available */ + memset(buf, 0, len); =20 - memcpy(buf, audio->eld, min_t(size_t, MAX_ELD_BYTES, len)); return 0; } =20 diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index f08d0fded61f7..e1211a5b334ba 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -757,6 +757,14 @@ static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi= , bool enable) hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); } =20 +static u8 *hdmi_audio_get_eld(struct dw_hdmi *hdmi) +{ + if (!hdmi->curr_conn) + return NULL; + + return hdmi->curr_conn->eld; +} + static void dw_hdmi_ahb_audio_enable(struct dw_hdmi *hdmi) { hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); @@ -3431,7 +3439,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device = *pdev, audio.base =3D hdmi->regs; audio.irq =3D irq; audio.hdmi =3D hdmi; - audio.eld =3D hdmi->connector.eld; + audio.get_eld =3D hdmi_audio_get_eld; hdmi->enable_audio =3D dw_hdmi_ahb_audio_enable; hdmi->disable_audio =3D dw_hdmi_ahb_audio_disable; =20 @@ -3444,7 +3452,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device = *pdev, struct dw_hdmi_i2s_audio_data audio; =20 audio.hdmi =3D hdmi; - audio.eld =3D hdmi->connector.eld; + audio.get_eld =3D hdmi_audio_get_eld; audio.write =3D hdmi_writeb; audio.read =3D hdmi_readb; hdmi->enable_audio =3D dw_hdmi_i2s_audio_enable; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC580C433EF for ; Mon, 24 Jan 2022 22:03:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577239AbiAXV7j (ORCPT ); Mon, 24 Jan 2022 16:59:39 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40022 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451296AbiAXVWi (ORCPT ); Mon, 24 Jan 2022 16:22:38 -0500 Received: from smtp.kernel.org (relay.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 549F8B81057; Mon, 24 Jan 2022 21:22:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EC2DC340E4; Mon, 24 Jan 2022 21:22:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059356; bh=0tDVZXKr9K09AvgqRFA/1j1lSWqb13QUoRj3scev9K0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQes7rLVPvskQzRFnLtBj6EddaUpBzBfm/CxRRUzro4/nD41MiZy49xxHITSNlidY yt5vh/stooPVZYj6DC4tN1H9EeoiBsW815IorIuEQL8KYZpZ+8DE/gliG743bXqz9d n3LaAuQu09BsC1fxlXHRbuHNkEyR+nFpvJ2qUKlo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Diego Viola , Ben Skeggs , Karol Herbst , Sasha Levin Subject: [PATCH 5.16 0555/1039] drm/nouveau/pmu/gm200-: avoid touching PMU outside of DEVINIT/PREOS/ACR Date: Mon, 24 Jan 2022 19:39:04 +0100 Message-Id: <20220124184143.960634757@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Skeggs [ Upstream commit 1d2271d2fb85e54bfc9630a6c30ac0feb9ffb983 ] There have been reports of the WFI timing out on some boards, and a patch was proposed to just remove it. This stuff is rather fragile, and I believe the WFI might be needed with our FW prior to GM200. However, we probably should not be touching PMU during init on GPUs where we depend on NVIDIA FW, outside of limited circumstances, so this should be a somewhat safer change that achieves the desired result. Reported-by: Diego Viola Signed-off-by: Ben Skeggs Reviewed-by: Karol Herbst Signed-off-by: Karol Herbst Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/10 Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../gpu/drm/nouveau/nvkm/subdev/pmu/base.c | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/d= rm/nouveau/nvkm/subdev/pmu/base.c index 24382875fb4f3..455e95a89259f 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c @@ -94,20 +94,13 @@ nvkm_pmu_fini(struct nvkm_subdev *subdev, bool suspend) return 0; } =20 -static int +static void nvkm_pmu_reset(struct nvkm_pmu *pmu) { struct nvkm_device *device =3D pmu->subdev.device; =20 if (!pmu->func->enabled(pmu)) - return 0; - - /* Inhibit interrupts, and wait for idle. */ - nvkm_wr32(device, 0x10a014, 0x0000ffff); - nvkm_msec(device, 2000, - if (!nvkm_rd32(device, 0x10a04c)) - break; - ); + return; =20 /* Reset. */ if (pmu->func->reset) @@ -118,25 +111,37 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu) if (!(nvkm_rd32(device, 0x10a10c) & 0x00000006)) break; ); - - return 0; } =20 static int nvkm_pmu_preinit(struct nvkm_subdev *subdev) { struct nvkm_pmu *pmu =3D nvkm_pmu(subdev); - return nvkm_pmu_reset(pmu); + nvkm_pmu_reset(pmu); + return 0; } =20 static int nvkm_pmu_init(struct nvkm_subdev *subdev) { struct nvkm_pmu *pmu =3D nvkm_pmu(subdev); - int ret =3D nvkm_pmu_reset(pmu); - if (ret =3D=3D 0 && pmu->func->init) - ret =3D pmu->func->init(pmu); - return ret; + struct nvkm_device *device =3D pmu->subdev.device; + + if (!pmu->func->init) + return 0; + + if (pmu->func->enabled(pmu)) { + /* Inhibit interrupts, and wait for idle. */ + nvkm_wr32(device, 0x10a014, 0x0000ffff); + nvkm_msec(device, 2000, + if (!nvkm_rd32(device, 0x10a04c)) + break; + ); + + nvkm_pmu_reset(pmu); + } + + return pmu->func->init(pmu); } =20 static void * --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71328C2BA4C for ; Mon, 24 Jan 2022 21:58:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576123AbiAXVxD (ORCPT ); Mon, 24 Jan 2022 16:53:03 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:39110 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450582AbiAXVVA (ORCPT ); Mon, 24 Jan 2022 16:21:00 -0500 Received: from smtp.kernel.org (relay.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 4276BB8121C; Mon, 24 Jan 2022 21:20:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CFABC340E4; Mon, 24 Jan 2022 21:20:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059257; bh=7KCUkHtCZDPiU8Wu1iyvT6sSWdzlValgHc36KTlvECM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1BzH/T2KJmzQteqPHzENW8QbLX26Fq3AesNtDeFTaUxZsGv7PiN+DZk4YtvEhFG5R daRt6cAWycXm5NO8e0HvilS+cV4kuQa3H++OJi2G5QbnvWtcl8Pv+uziEjfj4M2+88 BZYu9Zt/Sv6ldNkl5KQQ17FqWG+UQg1gHQXxasnQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0556/1039] media: atomisp: fix try_fmt logic Date: Mon, 24 Jan 2022 19:39:05 +0100 Message-Id: <20220124184143.998431150@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit c9e9094c4e42124af909b2f5f6ded0498e0854ac ] The internal try_fmt logic is not meant to provide everything that the V4L2 API should provide. Also, it doesn't decrement the pads that are used only internally by the driver, but aren't part of the device's output. Fix it. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../staging/media/atomisp/pci/atomisp_ioctl.c | 72 ++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/st= aging/media/atomisp/pci/atomisp_ioctl.c index 29826f8e4143d..54624f8814e04 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -863,6 +863,72 @@ static int atomisp_g_fmt_file(struct file *file, void = *fh, return 0; } =20 +static int atomisp_adjust_fmt(struct v4l2_format *f) +{ + const struct atomisp_format_bridge *format_bridge; + u32 padded_width; + + format_bridge =3D atomisp_get_format_bridge(f->fmt.pix.pixelformat); + + padded_width =3D f->fmt.pix.width + pad_w; + + if (format_bridge->planar) { + f->fmt.pix.bytesperline =3D padded_width; + f->fmt.pix.sizeimage =3D PAGE_ALIGN(f->fmt.pix.height * + DIV_ROUND_UP(format_bridge->depth * + padded_width, 8)); + } else { + f->fmt.pix.bytesperline =3D DIV_ROUND_UP(format_bridge->depth * + padded_width, 8); + f->fmt.pix.sizeimage =3D PAGE_ALIGN(f->fmt.pix.height * f->fmt.pix.bytes= perline); + } + + if (f->fmt.pix.field =3D=3D V4L2_FIELD_ANY) + f->fmt.pix.field =3D V4L2_FIELD_NONE; + + format_bridge =3D atomisp_get_format_bridge(f->fmt.pix.pixelformat); + if (!format_bridge) + return -EINVAL; + + /* Currently, raw formats are broken!!! */ + if (format_bridge->sh_fmt =3D=3D IA_CSS_FRAME_FORMAT_RAW) { + f->fmt.pix.pixelformat =3D V4L2_PIX_FMT_YUV420; + + format_bridge =3D atomisp_get_format_bridge(f->fmt.pix.pixelformat); + if (!format_bridge) + return -EINVAL; + } + + padded_width =3D f->fmt.pix.width + pad_w; + + if (format_bridge->planar) { + f->fmt.pix.bytesperline =3D padded_width; + f->fmt.pix.sizeimage =3D PAGE_ALIGN(f->fmt.pix.height * + DIV_ROUND_UP(format_bridge->depth * + padded_width, 8)); + } else { + f->fmt.pix.bytesperline =3D DIV_ROUND_UP(format_bridge->depth * + padded_width, 8); + f->fmt.pix.sizeimage =3D PAGE_ALIGN(f->fmt.pix.height * f->fmt.pix.bytes= perline); + } + + if (f->fmt.pix.field =3D=3D V4L2_FIELD_ANY) + f->fmt.pix.field =3D V4L2_FIELD_NONE; + + /* + * FIXME: do we need to setup this differently, depending on the + * sensor or the pipeline? + */ + f->fmt.pix.colorspace =3D V4L2_COLORSPACE_REC709; + f->fmt.pix.ycbcr_enc =3D V4L2_YCBCR_ENC_709; + f->fmt.pix.xfer_func =3D V4L2_XFER_FUNC_709; + + f->fmt.pix.width -=3D pad_w; + f->fmt.pix.height -=3D pad_h; + + return 0; +} + /* This function looks up the closest available resolution. */ static int atomisp_try_fmt_cap(struct file *file, void *fh, struct v4l2_format *f) @@ -874,7 +940,11 @@ static int atomisp_try_fmt_cap(struct file *file, void= *fh, rt_mutex_lock(&isp->mutex); ret =3D atomisp_try_fmt(vdev, &f->fmt.pix, NULL); rt_mutex_unlock(&isp->mutex); - return ret; + + if (ret) + return ret; + + return atomisp_adjust_fmt(f); } =20 static int atomisp_s_fmt_cap(struct file *file, void *fh, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07181C4707E for ; Mon, 24 Jan 2022 23:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366966AbiAXXxw (ORCPT ); Mon, 24 Jan 2022 18:53:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846001AbiAXXON (ORCPT ); Mon, 24 Jan 2022 18:14:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A453C067A76; Mon, 24 Jan 2022 13:21:02 -0800 (PST) Received: from smtp.kernel.org (relay.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 31509B8105C; Mon, 24 Jan 2022 21:21:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57DDBC340E4; Mon, 24 Jan 2022 21:20:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059259; bh=vIl/gclyF80YoCxy9zzgOrGGbUlqzJB+spj0los22ZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BLzxC/8g/zsOQCNz407z33fPHuwTV8pQ5ncGigyQSQoUSla446Uh0mGB49rg3LezO +JPv41Q4qpdqlEpkPfISqF9vDYus/r+r5SjPtEj3vK2xBoS0L/xTX/qJjh9IUk/NkT spVVAbUOX08lnUaOmb8fMrusVG6aXyK1zmHRy5T0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tsuchiya Yuto , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0557/1039] media: atomisp: set per-devices default mode Date: Mon, 24 Jan 2022 19:39:06 +0100 Message-Id: <20220124184144.030411964@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 2c45e343c581091835c9047ed5298518aa133163 ] The atomisp driver originally used the s_parm command to initialize the run_mode type to the driver. So, before start setting up the streaming, s_parm should be called. So, even having 5 "normal" video devices, one meant to be used for each type, the run_mode was actually selected when s_parm is called. Without setting the run mode, applications that don't call VIDIOC_SET_PARM with a custom atomisp parameters won't work, as the pipeline won't be set: atomisp-isp2 0000:00:03.0: can't create streams atomisp-isp2 0000:00:03.0: __get_frame_info 1600x1200 (padded to 0) return= ed -22 However, commit 8a7c5594c020 ("media: v4l2-ioctl: clear fields in s_parm") broke support for it, with a good reason, as drivers shoudn't be extending the API for their own purposes. So, as an step to allow generic apps to use this driver, put the device's run_mode in preview after open. After this patch, using v4l2grab starts to work on preview mode (/dev/video2): $ v4l2grab -f YUYV -x 1600 -y 1200 -d /dev/video2 -n 1 -u $ feh out000.pnm So, let's just setup the default run_mode that each video devnode should assume, setting it at open() time. Reported-by: Tsuchiya Yuto Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/atomisp/pci/atomisp_fops.c | 5 +++++ .../staging/media/atomisp/pci/atomisp_subdev.c | 15 ++++++++++----- .../staging/media/atomisp/pci/atomisp_subdev.h | 3 +++ drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 4 +++- drivers/staging/media/atomisp/pci/atomisp_v4l2.h | 3 ++- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/sta= ging/media/atomisp/pci/atomisp_fops.c index 02c19b92bdccb..18fff47bd25d2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -877,6 +877,11 @@ done: else pipe->users++; rt_mutex_unlock(&isp->mutex); + + /* Ensure that a mode is set */ + if (asd) + v4l2_ctrl_s_ctrl(asd->run_mode, pipe->default_run_mode); + return 0; =20 css_error: diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/s= taging/media/atomisp/pci/atomisp_subdev.c index 12f22ad007c73..ffaf11e0b0ad8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -1164,23 +1164,28 @@ static int isp_subdev_init_entities(struct atomisp_= sub_device *asd) =20 atomisp_init_acc_pipe(asd, &asd->video_acc); =20 - ret =3D atomisp_video_init(&asd->video_in, "MEMORY"); + ret =3D atomisp_video_init(&asd->video_in, "MEMORY", + ATOMISP_RUN_MODE_SDV); if (ret < 0) return ret; =20 - ret =3D atomisp_video_init(&asd->video_out_capture, "CAPTURE"); + ret =3D atomisp_video_init(&asd->video_out_capture, "CAPTURE", + ATOMISP_RUN_MODE_STILL_CAPTURE); if (ret < 0) return ret; =20 - ret =3D atomisp_video_init(&asd->video_out_vf, "VIEWFINDER"); + ret =3D atomisp_video_init(&asd->video_out_vf, "VIEWFINDER", + ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE); if (ret < 0) return ret; =20 - ret =3D atomisp_video_init(&asd->video_out_preview, "PREVIEW"); + ret =3D atomisp_video_init(&asd->video_out_preview, "PREVIEW", + ATOMISP_RUN_MODE_PREVIEW); if (ret < 0) return ret; =20 - ret =3D atomisp_video_init(&asd->video_out_video_capture, "VIDEO"); + ret =3D atomisp_video_init(&asd->video_out_video_capture, "VIDEO", + ATOMISP_RUN_MODE_VIDEO); if (ret < 0) return ret; =20 diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.h b/drivers/s= taging/media/atomisp/pci/atomisp_subdev.h index d6fcfab6352d7..a8d210ea5f8be 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.h +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.h @@ -81,6 +81,9 @@ struct atomisp_video_pipe { /* the link list to store per_frame parameters */ struct list_head per_frame_params; =20 + /* Store here the initial run mode */ + unsigned int default_run_mode; + unsigned int buffers_in_css; =20 /* irq_lock is used to protect video buffer state change operations and diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/sta= ging/media/atomisp/pci/atomisp_v4l2.c index 7982cc143374a..14c39b8987c95 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -447,7 +447,8 @@ const struct atomisp_dfs_config dfs_config_cht_soc =3D { .dfs_table_size =3D ARRAY_SIZE(dfs_rules_cht_soc), }; =20 -int atomisp_video_init(struct atomisp_video_pipe *video, const char *name) +int atomisp_video_init(struct atomisp_video_pipe *video, const char *name, + unsigned int run_mode) { int ret; const char *direction; @@ -478,6 +479,7 @@ int atomisp_video_init(struct atomisp_video_pipe *video= , const char *name) "ATOMISP ISP %s %s", name, direction); video->vdev.release =3D video_device_release_empty; video_set_drvdata(&video->vdev, video->isp); + video->default_run_mode =3D run_mode; =20 return 0; } diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.h b/drivers/sta= ging/media/atomisp/pci/atomisp_v4l2.h index 81bb356b81720..72611b8286a4a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.h +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.h @@ -27,7 +27,8 @@ struct v4l2_device; struct atomisp_device; struct firmware; =20 -int atomisp_video_init(struct atomisp_video_pipe *video, const char *name); +int atomisp_video_init(struct atomisp_video_pipe *video, const char *name, + unsigned int run_mode); void atomisp_acc_init(struct atomisp_acc_pipe *video, const char *name); void atomisp_video_unregister(struct atomisp_video_pipe *video); void atomisp_acc_unregister(struct atomisp_acc_pipe *video); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9EACC433FE for ; Mon, 24 Jan 2022 21:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576319AbiAXVxT (ORCPT ); Mon, 24 Jan 2022 16:53:19 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:39134 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450613AbiAXVVG (ORCPT ); Mon, 24 Jan 2022 16:21:06 -0500 Received: from smtp.kernel.org (relay.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 E14BEB8105C; Mon, 24 Jan 2022 21:21:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 476CFC340E4; Mon, 24 Jan 2022 21:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059262; bh=oXLBzOz/hkAg5gBd5Fy/0nL79/vChLwPGP35T3oMc8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YGFdxbEymKbUtjyT/cI/8cq/20UZ7c2KXi2+MblCdsOuYqpDjmok3rplTK81a7Yki jmSNMAZe1diplyC6U1KdJ2MF8ocKxox7yma0gortz6sJ7vzf4DpNpp332uGiqC0Hdn /JjvQ0fcx6gcONROG31ct3ucU6v4yjyVedq9VZqw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0558/1039] media: atomisp-ov2680: Fix ov2680_set_fmt() clobbering the exposure Date: Mon, 24 Jan 2022 19:39:07 +0100 Message-Id: <20220124184144.069405886@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 4492289c31364d28c2680b43b18883385a5d216c ] Now that we restore the default or last user set exposure setting on power_up() there is no need for the registers written by ov2680_set_fmt() to write to the exposure register. Not doing so fixes the exposure always being reset to the value from the res->regs array after a set_fmt(). Link: https://lore.kernel.org/linux-media/20211107171549.267583-11-hdegoede= @redhat.com Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/atomisp/i2c/ov2680.h | 24 ---------------------- 1 file changed, 24 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/ov2680.h b/drivers/staging/m= edia/atomisp/i2c/ov2680.h index 874115f35fcad..798b28e134b64 100644 --- a/drivers/staging/media/atomisp/i2c/ov2680.h +++ b/drivers/staging/media/atomisp/i2c/ov2680.h @@ -289,8 +289,6 @@ static struct ov2680_reg const ov2680_global_setting[] = =3D { */ static struct ov2680_reg const ov2680_QCIF_30fps[] =3D { {0x3086, 0x01}, - {0x3501, 0x24}, - {0x3502, 0x40}, {0x370a, 0x23}, {0x3801, 0xa0}, {0x3802, 0x00}, @@ -334,8 +332,6 @@ static struct ov2680_reg const ov2680_QCIF_30fps[] =3D { */ static struct ov2680_reg const ov2680_CIF_30fps[] =3D { {0x3086, 0x01}, - {0x3501, 0x24}, - {0x3502, 0x40}, {0x370a, 0x23}, {0x3801, 0xa0}, {0x3802, 0x00}, @@ -377,8 +373,6 @@ static struct ov2680_reg const ov2680_CIF_30fps[] =3D { */ static struct ov2680_reg const ov2680_QVGA_30fps[] =3D { {0x3086, 0x01}, - {0x3501, 0x24}, - {0x3502, 0x40}, {0x370a, 0x23}, {0x3801, 0xa0}, {0x3802, 0x00}, @@ -420,8 +414,6 @@ static struct ov2680_reg const ov2680_QVGA_30fps[] =3D { */ static struct ov2680_reg const ov2680_656x496_30fps[] =3D { {0x3086, 0x01}, - {0x3501, 0x24}, - {0x3502, 0x40}, {0x370a, 0x23}, {0x3801, 0xa0}, {0x3802, 0x00}, @@ -463,8 +455,6 @@ static struct ov2680_reg const ov2680_656x496_30fps[] = =3D { */ static struct ov2680_reg const ov2680_720x592_30fps[] =3D { {0x3086, 0x01}, - {0x3501, 0x26}, - {0x3502, 0x40}, {0x370a, 0x23}, {0x3801, 0x00}, // X_ADDR_START; {0x3802, 0x00}, @@ -508,8 +498,6 @@ static struct ov2680_reg const ov2680_720x592_30fps[] = =3D { */ static struct ov2680_reg const ov2680_800x600_30fps[] =3D { {0x3086, 0x01}, - {0x3501, 0x26}, - {0x3502, 0x40}, {0x370a, 0x23}, {0x3801, 0x00}, {0x3802, 0x00}, @@ -551,8 +539,6 @@ static struct ov2680_reg const ov2680_800x600_30fps[] = =3D { */ static struct ov2680_reg const ov2680_720p_30fps[] =3D { {0x3086, 0x00}, - {0x3501, 0x48}, - {0x3502, 0xe0}, {0x370a, 0x21}, {0x3801, 0xa0}, {0x3802, 0x00}, @@ -594,8 +580,6 @@ static struct ov2680_reg const ov2680_720p_30fps[] =3D { */ static struct ov2680_reg const ov2680_1296x976_30fps[] =3D { {0x3086, 0x00}, - {0x3501, 0x48}, - {0x3502, 0xe0}, {0x370a, 0x21}, {0x3801, 0xa0}, {0x3802, 0x00}, @@ -637,8 +621,6 @@ static struct ov2680_reg const ov2680_1296x976_30fps[] = =3D { */ static struct ov2680_reg const ov2680_1456x1096_30fps[] =3D { {0x3086, 0x00}, - {0x3501, 0x48}, - {0x3502, 0xe0}, {0x370a, 0x21}, {0x3801, 0x90}, {0x3802, 0x00}, @@ -682,8 +664,6 @@ static struct ov2680_reg const ov2680_1456x1096_30fps[]= =3D { =20 static struct ov2680_reg const ov2680_1616x916_30fps[] =3D { {0x3086, 0x00}, - {0x3501, 0x48}, - {0x3502, 0xe0}, {0x370a, 0x21}, {0x3801, 0x00}, {0x3802, 0x00}, @@ -726,8 +706,6 @@ static struct ov2680_reg const ov2680_1616x916_30fps[] = =3D { #if 0 static struct ov2680_reg const ov2680_1616x1082_30fps[] =3D { {0x3086, 0x00}, - {0x3501, 0x48}, - {0x3502, 0xe0}, {0x370a, 0x21}, {0x3801, 0x00}, {0x3802, 0x00}, @@ -769,8 +747,6 @@ static struct ov2680_reg const ov2680_1616x1082_30fps[]= =3D { */ static struct ov2680_reg const ov2680_1616x1216_30fps[] =3D { {0x3086, 0x00}, - {0x3501, 0x48}, - {0x3502, 0xe0}, {0x370a, 0x21}, {0x3801, 0x00}, {0x3802, 0x00}, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 489CAC433F5 for ; Mon, 24 Jan 2022 21:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576304AbiAXVxR (ORCPT ); Mon, 24 Jan 2022 16:53:17 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43552 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450620AbiAXVVG (ORCPT ); Mon, 24 Jan 2022 16:21:06 -0500 Received: from smtp.kernel.org (relay.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 51211614BE; Mon, 24 Jan 2022 21:21:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18178C340E4; Mon, 24 Jan 2022 21:21:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059265; bh=oN+riz2KPBpT4JWOx2X4OywlB2pWHJD4t8/cTC9SMSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fRr+zAaL11a8UdbmQwnlmeQZwCH8lGtb8PkqKRZ03aRcWxVrI1I6kTUsXE4Y8snvK IlzB2w8M0HNvkELK6NtLSfgfkuOSpdksHmZHQpxYkCnMpirI6+8cPHS/fuUJl5yBsH sp2Aefp/SCNEfMUzLVcWKQpU8SON8bVBKuaCOpcI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0559/1039] media: atomisp: check before deference asd variable Date: Mon, 24 Jan 2022 19:39:08 +0100 Message-Id: <20220124184144.099289157@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 71665d816214124d6bc4eb80314ac8f84ecacd78 ] The asd->isp was referenced before checking if asd is not NULL. This fixes this warning: ../drivers/staging/media/atomisp/pci/atomisp_cmd.c:5548 atomisp_set_fmt_to= _snr() warn: variable dereferenced before check 'asd' (see line 5540) While here, avoid getting the pipe pointer twice. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/stag= ing/media/atomisp/pci/atomisp_cmd.c index 75a531667d743..1ddb9c815a3cb 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -5529,8 +5529,8 @@ static int atomisp_set_fmt_to_snr(struct video_device= *vdev, unsigned int padding_w, unsigned int padding_h, unsigned int dvs_env_w, unsigned int dvs_env_h) { - struct atomisp_sub_device *asd =3D atomisp_to_video_pipe(vdev)->asd; struct atomisp_video_pipe *pipe =3D atomisp_to_video_pipe(vdev); + struct atomisp_sub_device *asd =3D pipe->asd; const struct atomisp_format_bridge *format; struct v4l2_subdev_pad_config pad_cfg; struct v4l2_subdev_state pad_state =3D { @@ -5541,7 +5541,7 @@ static int atomisp_set_fmt_to_snr(struct video_device= *vdev, }; struct v4l2_mbus_framefmt *ffmt =3D &vformat.format; struct v4l2_mbus_framefmt *req_ffmt; - struct atomisp_device *isp =3D asd->isp; + struct atomisp_device *isp; struct atomisp_input_stream_info *stream_info =3D (struct atomisp_input_stream_info *)ffmt->reserved; u16 stream_index =3D ATOMISP_INPUT_STREAM_GENERAL; @@ -5555,6 +5555,8 @@ static int atomisp_set_fmt_to_snr(struct video_device= *vdev, return -EINVAL; } =20 + isp =3D asd->isp; + v4l2_fh_init(&fh.vfh, vdev); =20 stream_index =3D atomisp_source_pad_to_stream_id(asd, source_pad); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13D9FC4167D for ; Mon, 24 Jan 2022 23:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366584AbiAXXxG (ORCPT ); Mon, 24 Jan 2022 18:53:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846013AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A881C0610C8; Mon, 24 Jan 2022 13:21:11 -0800 (PST) Received: from smtp.kernel.org (relay.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 16DD9B81218; Mon, 24 Jan 2022 21:21:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DF1CC340E4; Mon, 24 Jan 2022 21:21:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059268; bh=k/Lz/Zo8RSedFrd/Cb57u0V3RMctMpavMVRb8b8/edc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jZ8pB21F/Uuw6HDKwNLWJGuQ8i6zYvDiNnJ/qKDojFx2PxSDZL9tIyffLo3ZgiEx6 wzTQWK7kDVWEBv6bgNeYpgBkd7sBUI7l7J6vaAH810AmAPYWB4a48wYhj4I4E6nLK0 +BXtxhkQRciO+IAipUT724W47VQ2DqaKe4JfWnVQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wan Jiabing , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.16 0560/1039] ARM: shmobile: rcar-gen2: Add missing of_node_put() Date: Mon, 24 Jan 2022 19:39:09 +0100 Message-Id: <20220124184144.137999152@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wan Jiabing [ Upstream commit 85744f2d938c5f3cfc44cb6533c157469634da93 ] Fix following coccicheck warning: ./arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c:156:1-33: Function for_each_matching_node_and_match should have of_node_put() before break and goto. Early exits from for_each_matching_node_and_match() should decrement the node reference counter. Signed-off-by: Wan Jiabing Link: https://lore.kernel.org/r/20211018014503.7598-1-wanjiabing@vivo.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/= mach-shmobile/regulator-quirk-rcar-gen2.c index ee949255ced3f..09ef73b99dd86 100644 --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c @@ -154,8 +154,10 @@ static int __init rcar_gen2_regulator_quirk(void) return -ENODEV; =20 for_each_matching_node_and_match(np, rcar_gen2_quirk_match, &id) { - if (!of_device_is_available(np)) + if (!of_device_is_available(np)) { + of_node_put(np); break; + } =20 ret =3D of_property_read_u32(np, "reg", &addr); if (ret) /* Skip invalid entry and continue */ @@ -164,6 +166,7 @@ static int __init rcar_gen2_regulator_quirk(void) quirk =3D kzalloc(sizeof(*quirk), GFP_KERNEL); if (!quirk) { ret =3D -ENOMEM; + of_node_put(np); goto err_mem; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD8B8C46467 for ; Mon, 24 Jan 2022 23:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366899AbiAXXxp (ORCPT ); Mon, 24 Jan 2022 18:53:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846007AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7752CC061A80; Mon, 24 Jan 2022 13:21:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 3E0A1B8123A; Mon, 24 Jan 2022 21:21:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D85AC340E4; Mon, 24 Jan 2022 21:21:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059272; bh=bep6sJR3PXgQxcO9jA0MP5nJ6KAIdBpiWgtPVOcKKEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a3FvMFbfw7dj8EVAXAZdxTxeWKLxGSIJtXlQjtr0KyDug1cTCTLkWffKKQwv9mB6U 15RHwf4WVgFksZ5RKkXCwjYrdEBluS96K8hPltXYHvDyUOZte+Ms3jJylw567MofC8 OtDOPql2NDchDRjXJ53C1x8BwRP189uYzt9vVuZs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gong , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0561/1039] ath11k: enable IEEE80211_VHT_EXT_NSS_BW_CAPABLE if NSS ratio enabled Date: Mon, 24 Jan 2022 19:39:10 +0100 Message-Id: <20220124184144.170113354@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Wen Gong [ Upstream commit 78406044bdd0cc8987bc082b76867c63ab1c6af8 ] When NSS ratio enabled reported by firmware, SUPPORTS_VHT_EXT_NSS_BW is set in ath11k, meanwhile IEEE80211_VHT_EXT_NSS_BW_CAPABLE also need to be set, otherwise it is invalid because spec in IEEE Std 802.11=E2=84=A2=E2=80=902020 as below. Table 9-273-Supported VHT-MCS and NSS Set subfields, it has subfield VHT Extended NSS BW Capable, its definition is: Indicates whether the STA is capable of interpreting the Extended NSS BW Support subfield of the VHT Capabilities Information field. dmesg have a message without this patch: ieee80211 phy0: copying sband (band 1) due to VHT EXT NSS BW flag It means mac80211 will set IEEE80211_VHT_EXT_NSS_BW_CAPABLE if ath11k not set it in ieee80211_register_hw(). So it is better to set it in ath11k. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ= _LITE-1 Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211013073704.15888-1-wgong@codeaurora.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/mac.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 5d49a7ea51fae..cb41c3e5708cb 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -4566,6 +4566,10 @@ ath11k_create_vht_cap(struct ath11k *ar, u32 rate_ca= p_tx_chainmask, vht_cap.vht_supported =3D 1; vht_cap.cap =3D ar->pdev->cap.vht_cap; =20 + if (ar->pdev->cap.nss_ratio_enabled) + vht_cap.vht_mcs.tx_highest |=3D + cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE); + ath11k_set_vht_txbf_cap(ar, &vht_cap.cap); =20 rxmcs_map =3D 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24164C43217 for ; Mon, 24 Jan 2022 23:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366792AbiAXXxf (ORCPT ); Mon, 24 Jan 2022 18:53:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846009AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D01D2C061A81; Mon, 24 Jan 2022 13:21:15 -0800 (PST) Received: from smtp.kernel.org (relay.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 6F50D614D8; Mon, 24 Jan 2022 21:21:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C3DEC340E4; Mon, 24 Jan 2022 21:21:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059274; bh=eSOZJjsod7JXBVDUOGZX0mGYhD7AX7qWZXKijpCydxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RZt0DybHI9wNw0w5QBs0otlhWNCBaEZbep/IgJJTho8FG1lEcd5Xg+MgBESoTYj97 i37flXF3EMVGfpOwWClRKswfkFrAhaSimGJE6Fd0kv2fypfeKBwmGWiap+UJcxrUB5 0Cs4XT+GrJy/X7A0pWsEKmp50QglI/PEI49fV3p0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tycho Andersen , =?UTF-8?q?Linus=20L=C3=BCssing?= , Sven Eckelmann , Simon Wunderlich , Sasha Levin Subject: [PATCH 5.16 0562/1039] batman-adv: allow netlink usage in unprivileged containers Date: Mon, 24 Jan 2022 19:39:11 +0100 Message-Id: <20220124184144.210733982@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Linus L=C3=BCssing [ Upstream commit 9057d6c23e7388ee9d037fccc9a7bc8557ce277b ] Currently, creating a batman-adv interface in an unprivileged LXD container and attaching secondary interfaces to it with "ip" or "batctl" works fine. However all batctl debug and configuration commands fail: root@container:~# batctl originators Error received: Operation not permitted root@container:~# batctl orig_interval 1000 root@container:~# batctl orig_interval 2000 root@container:~# batctl orig_interval 1000 To fix this change the generic netlink permissions from GENL_ADMIN_PERM to GENL_UNS_ADMIN_PERM. This way a batman-adv interface is fully maintainable as root from within a user namespace, from an unprivileged container. All except one batman-adv netlink setting are per interface and do not leak information or change settings from the host system and are therefore save to retrieve or modify as root from within an unprivileged container. "batctl routing_algo" / BATADV_CMD_GET_ROUTING_ALGOS is the only exception: It provides the batman-adv kernel module wide default routing algorithm. However it is read-only from netlink and an unprivileged container is still not allowed to modify /sys/module/batman_adv/parameters/routing_algo. Instead it is advised to use the newly introduced "batctl if create routing_algo RA_NAME" / IFLA_BATADV_ALGO_NAME to set the routing algorithm on interface creation, which already works fine in an unprivileged container. Cc: Tycho Andersen Signed-off-by: Linus L=C3=BCssing Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/batman-adv/netlink.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c index 29276284d281c..00875e1d8c44c 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -1368,21 +1368,21 @@ static const struct genl_small_ops batadv_netlink_o= ps[] =3D { { .cmd =3D BATADV_CMD_TP_METER, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .doit =3D batadv_netlink_tp_meter_start, .internal_flags =3D BATADV_FLAG_NEED_MESH, }, { .cmd =3D BATADV_CMD_TP_METER_CANCEL, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .doit =3D batadv_netlink_tp_meter_cancel, .internal_flags =3D BATADV_FLAG_NEED_MESH, }, { .cmd =3D BATADV_CMD_GET_ROUTING_ALGOS, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_algo_dump, }, { @@ -1397,68 +1397,68 @@ static const struct genl_small_ops batadv_netlink_o= ps[] =3D { { .cmd =3D BATADV_CMD_GET_TRANSTABLE_LOCAL, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_tt_local_dump, }, { .cmd =3D BATADV_CMD_GET_TRANSTABLE_GLOBAL, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_tt_global_dump, }, { .cmd =3D BATADV_CMD_GET_ORIGINATORS, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_orig_dump, }, { .cmd =3D BATADV_CMD_GET_NEIGHBORS, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_hardif_neigh_dump, }, { .cmd =3D BATADV_CMD_GET_GATEWAYS, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_gw_dump, }, { .cmd =3D BATADV_CMD_GET_BLA_CLAIM, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_bla_claim_dump, }, { .cmd =3D BATADV_CMD_GET_BLA_BACKBONE, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_bla_backbone_dump, }, { .cmd =3D BATADV_CMD_GET_DAT_CACHE, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_dat_cache_dump, }, { .cmd =3D BATADV_CMD_GET_MCAST_FLAGS, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_mcast_flags_dump, }, { .cmd =3D BATADV_CMD_SET_MESH, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .doit =3D batadv_netlink_set_mesh, .internal_flags =3D BATADV_FLAG_NEED_MESH, }, { .cmd =3D BATADV_CMD_SET_HARDIF, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .doit =3D batadv_netlink_set_hardif, .internal_flags =3D BATADV_FLAG_NEED_MESH | BATADV_FLAG_NEED_HARDIF, @@ -1474,7 +1474,7 @@ static const struct genl_small_ops batadv_netlink_ops= [] =3D { { .cmd =3D BATADV_CMD_SET_VLAN, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .doit =3D batadv_netlink_set_vlan, .internal_flags =3D BATADV_FLAG_NEED_MESH | BATADV_FLAG_NEED_VLAN, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D62DFC4167E for ; Mon, 24 Jan 2022 21:57:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243993AbiAXVxy (ORCPT ); Mon, 24 Jan 2022 16:53:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43788 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450740AbiAXVVT (ORCPT ); Mon, 24 Jan 2022 16:21:19 -0500 Received: from smtp.kernel.org (relay.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 84F2460C44; Mon, 24 Jan 2022 21:21:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DA73C340E4; Mon, 24 Jan 2022 21:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059278; bh=uRzLyO/Gk1KQZE1bnzQHMPHjEnbGuvecA540VjKZ1X0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KGB+QnyeqzIKmOfl9gl4xnSxiLYogKIN0Xr0lyWAgb5kCjjSjHzyDol8TyMNhJTYS fT4cByvfQDlVljOy1gLkxBPHy6cjE1EvNp4kyuEQNX9XPCy+9NZIZ35hmVLsY1LTM8 i4OgZZeqGYo7IVJWHTDZ0qhr86NutXbqwrZGp95U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tiezhu Yang , Daniel Borkmann , Johan Almbladh , Ilya Leoshkevich , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Sasha Levin Subject: [PATCH 5.16 0563/1039] bpf: Change value of MAX_TAIL_CALL_CNT from 32 to 33 Date: Mon, 24 Jan 2022 19:39:12 +0100 Message-Id: <20220124184144.243149591@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Tiezhu Yang [ Upstream commit ebf7f6f0a6cdcc17a3da52b81e4b3a98c4005028 ] In the current code, the actual max tail call count is 33 which is greater than MAX_TAIL_CALL_CNT (defined as 32). The actual limit is not consistent with the meaning of MAX_TAIL_CALL_CNT and thus confusing at first glance. We can see the historical evolution from commit 04fd61ab36ec ("bpf: allow bpf programs to tail-call other bpf programs") and commit f9dabe016b63 ("bpf: Undo off-by-one in interpreter tail call count limit"). In order to avoid changing existing behavior, the actual limit is 33 now, this is reasonable. After commit 874be05f525e ("bpf, tests: Add tail call test suite"), we can see there exists failed testcase. On all archs when CONFIG_BPF_JIT_ALWAYS_ON is not set: # echo 0 > /proc/sys/net/core/bpf_jit_enable # modprobe test_bpf # dmesg | grep -w FAIL Tail call error path, max count reached jited:0 ret 34 !=3D 33 FAIL On some archs: # echo 1 > /proc/sys/net/core/bpf_jit_enable # modprobe test_bpf # dmesg | grep -w FAIL Tail call error path, max count reached jited:1 ret 34 !=3D 33 FAIL Although the above failed testcase has been fixed in commit 18935a72eb25 ("bpf/tests: Fix error in tail call limit tests"), it would still be good to change the value of MAX_TAIL_CALL_CNT from 32 to 33 to make the code more readable. The 32-bit x86 JIT was using a limit of 32, just fix the wrong comments and limit to 33 tail calls as the constant MAX_TAIL_CALL_CNT updated. For the mips64 JIT, use "ori" instead of "addiu" as suggested by Johan Almbladh. For the riscv JIT, use RV_REG_TCC directly to save one register move as suggested by Bj=C3=B6rn T=C3=B6pel. For the other implementations, no funct= ion changes, it does not change the current limit 33, the new value of MAX_TAIL_CALL_CNT can reflect the actual max tail call count, the related tail call testcases in test_bpf module and selftests can work well for the interpreter and the JIT. Here are the test results on x86_64: # uname -m x86_64 # echo 0 > /proc/sys/net/core/bpf_jit_enable # modprobe test_bpf test_suite=3Dtest_tail_calls # dmesg | tail -1 test_bpf: test_tail_calls: Summary: 8 PASSED, 0 FAILED, [0/8 JIT'ed] # rmmod test_bpf # echo 1 > /proc/sys/net/core/bpf_jit_enable # modprobe test_bpf test_suite=3Dtest_tail_calls # dmesg | tail -1 test_bpf: test_tail_calls: Summary: 8 PASSED, 0 FAILED, [8/8 JIT'ed] # rmmod test_bpf # ./test_progs -t tailcalls #142 tailcalls:OK Summary: 1/11 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Tiezhu Yang Signed-off-by: Daniel Borkmann Tested-by: Johan Almbladh Tested-by: Ilya Leoshkevich Acked-by: Bj=C3=B6rn T=C3=B6pel Acked-by: Johan Almbladh Acked-by: Ilya Leoshkevich Link: https://lore.kernel.org/bpf/1636075800-3264-1-git-send-email-yangtiez= hu@loongson.cn Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/net/bpf_jit_32.c | 5 +++-- arch/arm64/net/bpf_jit_comp.c | 5 +++-- arch/mips/net/bpf_jit_comp32.c | 3 +-- arch/mips/net/bpf_jit_comp64.c | 2 +- arch/powerpc/net/bpf_jit_comp32.c | 4 ++-- arch/powerpc/net/bpf_jit_comp64.c | 4 ++-- arch/riscv/net/bpf_jit_comp32.c | 6 ++---- arch/riscv/net/bpf_jit_comp64.c | 7 +++---- arch/s390/net/bpf_jit_comp.c | 6 +++--- arch/sparc/net/bpf_jit_comp_64.c | 2 +- arch/x86/net/bpf_jit_comp.c | 10 +++++----- arch/x86/net/bpf_jit_comp32.c | 4 ++-- include/linux/bpf.h | 2 +- include/uapi/linux/bpf.h | 2 +- kernel/bpf/core.c | 3 ++- lib/test_bpf.c | 4 ++-- tools/include/uapi/linux/bpf.h | 2 +- 17 files changed, 35 insertions(+), 36 deletions(-) diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index eeb6dc0ecf463..e59b41e9ab0c1 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c @@ -1199,7 +1199,8 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx) =20 /* tmp2[0] =3D array, tmp2[1] =3D index */ =20 - /* if (tail_call_cnt > MAX_TAIL_CALL_CNT) + /* + * if (tail_call_cnt >=3D MAX_TAIL_CALL_CNT) * goto out; * tail_call_cnt++; */ @@ -1208,7 +1209,7 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx) tc =3D arm_bpf_get_reg64(tcc, tmp, ctx); emit(ARM_CMP_I(tc[0], hi), ctx); _emit(ARM_COND_EQ, ARM_CMP_I(tc[1], lo), ctx); - _emit(ARM_COND_HI, ARM_B(jmp_offset), ctx); + _emit(ARM_COND_CS, ARM_B(jmp_offset), ctx); emit(ARM_ADDS_I(tc[1], tc[1], 1), ctx); emit(ARM_ADC_I(tc[0], tc[0], 0), ctx); arm_bpf_put_reg64(tcc, tmp, ctx); diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index c2d95aa1d294c..1090a957b3abc 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -287,13 +287,14 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx) emit(A64_CMP(0, r3, tmp), ctx); emit(A64_B_(A64_COND_CS, jmp_offset), ctx); =20 - /* if (tail_call_cnt > MAX_TAIL_CALL_CNT) + /* + * if (tail_call_cnt >=3D MAX_TAIL_CALL_CNT) * goto out; * tail_call_cnt++; */ emit_a64_mov_i64(tmp, MAX_TAIL_CALL_CNT, ctx); emit(A64_CMP(1, tcc, tmp), ctx); - emit(A64_B_(A64_COND_HI, jmp_offset), ctx); + emit(A64_B_(A64_COND_CS, jmp_offset), ctx); emit(A64_ADD_I(1, tcc, tcc, 1), ctx); =20 /* prog =3D array->ptrs[index]; diff --git a/arch/mips/net/bpf_jit_comp32.c b/arch/mips/net/bpf_jit_comp32.c index bd996ede12f8e..044b11b65bcac 100644 --- a/arch/mips/net/bpf_jit_comp32.c +++ b/arch/mips/net/bpf_jit_comp32.c @@ -1381,8 +1381,7 @@ void build_prologue(struct jit_context *ctx) * 16-byte area in the parent's stack frame. On a tail call, the * calling function jumps into the prologue after these instructions. */ - emit(ctx, ori, MIPS_R_T9, MIPS_R_ZERO, - min(MAX_TAIL_CALL_CNT + 1, 0xffff)); + emit(ctx, ori, MIPS_R_T9, MIPS_R_ZERO, min(MAX_TAIL_CALL_CNT, 0xffff)); emit(ctx, sw, MIPS_R_T9, 0, MIPS_R_SP); =20 /* diff --git a/arch/mips/net/bpf_jit_comp64.c b/arch/mips/net/bpf_jit_comp64.c index 815ade7242278..6475828ffb36d 100644 --- a/arch/mips/net/bpf_jit_comp64.c +++ b/arch/mips/net/bpf_jit_comp64.c @@ -552,7 +552,7 @@ void build_prologue(struct jit_context *ctx) * On a tail call, the calling function jumps into the prologue * after this instruction. */ - emit(ctx, addiu, tc, MIPS_R_ZERO, min(MAX_TAIL_CALL_CNT + 1, 0xffff)); + emit(ctx, ori, tc, MIPS_R_ZERO, min(MAX_TAIL_CALL_CNT, 0xffff)); =20 /* =3D=3D=3D Entry-point for tail calls =3D=3D=3D */ =20 diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_c= omp32.c index 0da31d41d4131..8a4faa05f9e41 100644 --- a/arch/powerpc/net/bpf_jit_comp32.c +++ b/arch/powerpc/net/bpf_jit_comp32.c @@ -221,13 +221,13 @@ static int bpf_jit_emit_tail_call(u32 *image, struct = codegen_context *ctx, u32 o PPC_BCC(COND_GE, out); =20 /* - * if (tail_call_cnt > MAX_TAIL_CALL_CNT) + * if (tail_call_cnt >=3D MAX_TAIL_CALL_CNT) * goto out; */ EMIT(PPC_RAW_CMPLWI(_R0, MAX_TAIL_CALL_CNT)); /* tail_call_cnt++; */ EMIT(PPC_RAW_ADDIC(_R0, _R0, 1)); - PPC_BCC(COND_GT, out); + PPC_BCC(COND_GE, out); =20 /* prog =3D array->ptrs[index]; */ EMIT(PPC_RAW_RLWINM(_R3, b2p_index, 2, 0, 29)); diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_c= omp64.c index 8b5157ccfebae..8571aafcc9e1e 100644 --- a/arch/powerpc/net/bpf_jit_comp64.c +++ b/arch/powerpc/net/bpf_jit_comp64.c @@ -228,12 +228,12 @@ static int bpf_jit_emit_tail_call(u32 *image, struct = codegen_context *ctx, u32 o PPC_BCC(COND_GE, out); =20 /* - * if (tail_call_cnt > MAX_TAIL_CALL_CNT) + * if (tail_call_cnt >=3D MAX_TAIL_CALL_CNT) * goto out; */ PPC_BPF_LL(b2p[TMP_REG_1], 1, bpf_jit_stack_tailcallcnt(ctx)); EMIT(PPC_RAW_CMPLWI(b2p[TMP_REG_1], MAX_TAIL_CALL_CNT)); - PPC_BCC(COND_GT, out); + PPC_BCC(COND_GE, out); =20 /* * tail_call_cnt++; diff --git a/arch/riscv/net/bpf_jit_comp32.c b/arch/riscv/net/bpf_jit_comp3= 2.c index e6497424cbf60..529a83b85c1c9 100644 --- a/arch/riscv/net/bpf_jit_comp32.c +++ b/arch/riscv/net/bpf_jit_comp32.c @@ -799,11 +799,10 @@ static int emit_bpf_tail_call(int insn, struct rv_jit= _context *ctx) emit_bcc(BPF_JGE, lo(idx_reg), RV_REG_T1, off, ctx); =20 /* - * temp_tcc =3D tcc - 1; - * if (tcc < 0) + * if (--tcc < 0) * goto out; */ - emit(rv_addi(RV_REG_T1, RV_REG_TCC, -1), ctx); + emit(rv_addi(RV_REG_TCC, RV_REG_TCC, -1), ctx); off =3D ninsns_rvoff(tc_ninsn - (ctx->ninsns - start_insn)); emit_bcc(BPF_JSLT, RV_REG_TCC, RV_REG_ZERO, off, ctx); =20 @@ -829,7 +828,6 @@ static int emit_bpf_tail_call(int insn, struct rv_jit_c= ontext *ctx) if (is_12b_check(off, insn)) return -1; emit(rv_lw(RV_REG_T0, off, RV_REG_T0), ctx); - emit(rv_addi(RV_REG_TCC, RV_REG_T1, 0), ctx); /* Epilogue jumps to *(t0 + 4). */ __build_epilogue(true, ctx); return 0; diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp6= 4.c index f2a779c7e225d..603630b6f3c5b 100644 --- a/arch/riscv/net/bpf_jit_comp64.c +++ b/arch/riscv/net/bpf_jit_comp64.c @@ -327,12 +327,12 @@ static int emit_bpf_tail_call(int insn, struct rv_jit= _context *ctx) off =3D ninsns_rvoff(tc_ninsn - (ctx->ninsns - start_insn)); emit_branch(BPF_JGE, RV_REG_A2, RV_REG_T1, off, ctx); =20 - /* if (TCC-- < 0) + /* if (--TCC < 0) * goto out; */ - emit_addi(RV_REG_T1, tcc, -1, ctx); + emit_addi(RV_REG_TCC, tcc, -1, ctx); off =3D ninsns_rvoff(tc_ninsn - (ctx->ninsns - start_insn)); - emit_branch(BPF_JSLT, tcc, RV_REG_ZERO, off, ctx); + emit_branch(BPF_JSLT, RV_REG_TCC, RV_REG_ZERO, off, ctx); =20 /* prog =3D array->ptrs[index]; * if (!prog) @@ -352,7 +352,6 @@ static int emit_bpf_tail_call(int insn, struct rv_jit_c= ontext *ctx) if (is_12b_check(off, insn)) return -1; emit_ld(RV_REG_T3, off, RV_REG_T2, ctx); - emit_mv(RV_REG_TCC, RV_REG_T1, ctx); __build_epilogue(true, ctx); return 0; } diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 233cc9bcd6527..9ff2bd83aad70 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c @@ -1369,7 +1369,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit,= struct bpf_prog *fp, jit->prg); =20 /* - * if (tail_call_cnt++ > MAX_TAIL_CALL_CNT) + * if (tail_call_cnt++ >=3D MAX_TAIL_CALL_CNT) * goto out; */ =20 @@ -1381,9 +1381,9 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit,= struct bpf_prog *fp, EMIT4_IMM(0xa7080000, REG_W0, 1); /* laal %w1,%w0,off(%r15) */ EMIT6_DISP_LH(0xeb000000, 0x00fa, REG_W1, REG_W0, REG_15, off); - /* clij %w1,MAX_TAIL_CALL_CNT,0x2,out */ + /* clij %w1,MAX_TAIL_CALL_CNT-1,0x2,out */ patch_2_clij =3D jit->prg; - EMIT6_PCREL_RIEC(0xec000000, 0x007f, REG_W1, MAX_TAIL_CALL_CNT, + EMIT6_PCREL_RIEC(0xec000000, 0x007f, REG_W1, MAX_TAIL_CALL_CNT - 1, 2, jit->prg); =20 /* diff --git a/arch/sparc/net/bpf_jit_comp_64.c b/arch/sparc/net/bpf_jit_comp= _64.c index 9a2f20cbd48b7..0bfe1c72a0c9e 100644 --- a/arch/sparc/net/bpf_jit_comp_64.c +++ b/arch/sparc/net/bpf_jit_comp_64.c @@ -867,7 +867,7 @@ static void emit_tail_call(struct jit_ctx *ctx) emit(LD32 | IMMED | RS1(SP) | S13(off) | RD(tmp), ctx); emit_cmpi(tmp, MAX_TAIL_CALL_CNT, ctx); #define OFFSET2 13 - emit_branch(BGU, ctx->idx, ctx->idx + OFFSET2, ctx); + emit_branch(BGEU, ctx->idx, ctx->idx + OFFSET2, ctx); emit_nop(ctx); =20 emit_alu_K(ADD, tmp, 1, ctx); diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index bafe36e69227d..b87d98efd2240 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -412,7 +412,7 @@ static void emit_indirect_jump(u8 **pprog, int reg, u8 = *ip) * ... bpf_tail_call(void *ctx, struct bpf_array *array, u64 index) ... * if (index >=3D array->map.max_entries) * goto out; - * if (++tail_call_cnt > MAX_TAIL_CALL_CNT) + * if (tail_call_cnt++ >=3D MAX_TAIL_CALL_CNT) * goto out; * prog =3D array->ptrs[index]; * if (prog =3D=3D NULL) @@ -446,14 +446,14 @@ static void emit_bpf_tail_call_indirect(u8 **pprog, b= ool *callee_regs_used, EMIT2(X86_JBE, offset); /* jbe out */ =20 /* - * if (tail_call_cnt > MAX_TAIL_CALL_CNT) + * if (tail_call_cnt++ >=3D MAX_TAIL_CALL_CNT) * goto out; */ EMIT2_off32(0x8B, 0x85, tcc_off); /* mov eax, dword ptr [rbp - tc= c_off] */ EMIT3(0x83, 0xF8, MAX_TAIL_CALL_CNT); /* cmp eax, MAX_TAIL_CALL_CNT */ =20 offset =3D ctx->tail_call_indirect_label - (prog + 2 - start); - EMIT2(X86_JA, offset); /* ja out */ + EMIT2(X86_JAE, offset); /* jae out */ EMIT3(0x83, 0xC0, 0x01); /* add eax, 1 */ EMIT2_off32(0x89, 0x85, tcc_off); /* mov dword ptr [rbp - tcc_off= ], eax */ =20 @@ -504,14 +504,14 @@ static void emit_bpf_tail_call_direct(struct bpf_jit_= poke_descriptor *poke, int offset; =20 /* - * if (tail_call_cnt > MAX_TAIL_CALL_CNT) + * if (tail_call_cnt++ >=3D MAX_TAIL_CALL_CNT) * goto out; */ EMIT2_off32(0x8B, 0x85, tcc_off); /* mov eax, dword ptr [rbp = - tcc_off] */ EMIT3(0x83, 0xF8, MAX_TAIL_CALL_CNT); /* cmp eax, MAX_TAIL_CALL_C= NT */ =20 offset =3D ctx->tail_call_direct_label - (prog + 2 - start); - EMIT2(X86_JA, offset); /* ja out */ + EMIT2(X86_JAE, offset); /* jae out */ EMIT3(0x83, 0xC0, 0x01); /* add eax, 1 */ EMIT2_off32(0x89, 0x85, tcc_off); /* mov dword ptr [rbp - tcc= _off], eax */ =20 diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c index da9b7cfa46329..429a89c5468b5 100644 --- a/arch/x86/net/bpf_jit_comp32.c +++ b/arch/x86/net/bpf_jit_comp32.c @@ -1323,7 +1323,7 @@ static void emit_bpf_tail_call(u8 **pprog, u8 *ip) EMIT2(IA32_JBE, jmp_label(jmp_label1, 2)); =20 /* - * if (tail_call_cnt > MAX_TAIL_CALL_CNT) + * if (tail_call_cnt++ >=3D MAX_TAIL_CALL_CNT) * goto out; */ lo =3D (u32)MAX_TAIL_CALL_CNT; @@ -1337,7 +1337,7 @@ static void emit_bpf_tail_call(u8 **pprog, u8 *ip) /* cmp ecx,lo */ EMIT3(0x83, add_1reg(0xF8, IA32_ECX), lo); =20 - /* ja out */ + /* jae out */ EMIT2(IA32_JAE, jmp_label(jmp_label1, 2)); =20 /* add eax,0x1 */ diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 755f38e893be1..9f20b0f539f78 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -1082,7 +1082,7 @@ struct bpf_array { }; =20 #define BPF_COMPLEXITY_LIMIT_INSNS 1000000 /* yes. 1M insns */ -#define MAX_TAIL_CALL_CNT 32 +#define MAX_TAIL_CALL_CNT 33 =20 #define BPF_F_ACCESS_MASK (BPF_F_RDONLY | \ BPF_F_RDONLY_PROG | \ diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index ba5af15e25f5c..b12cfceddb6e9 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -1744,7 +1744,7 @@ union bpf_attr { * if the maximum number of tail calls has been reached for this * chain of programs. This limit is defined in the kernel by the * macro **MAX_TAIL_CALL_CNT** (not accessible to user space), - * which is currently set to 32. + * which is currently set to 33. * Return * 0 on success, or a negative error in case of failure. * diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 2405e39d800fe..b52dc845ecea3 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -1574,7 +1574,8 @@ select_insn: =20 if (unlikely(index >=3D array->map.max_entries)) goto out; - if (unlikely(tail_call_cnt > MAX_TAIL_CALL_CNT)) + + if (unlikely(tail_call_cnt >=3D MAX_TAIL_CALL_CNT)) goto out; =20 tail_call_cnt++; diff --git a/lib/test_bpf.c b/lib/test_bpf.c index adae39567264f..0c5cb2d6436a4 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c @@ -14683,7 +14683,7 @@ static struct tail_call_test tail_call_tests[] =3D { BPF_EXIT_INSN(), }, .flags =3D FLAG_NEED_STATE | FLAG_RESULT_IN_STATE, - .result =3D (MAX_TAIL_CALL_CNT + 1 + 1) * MAX_TESTRUNS, + .result =3D (MAX_TAIL_CALL_CNT + 1) * MAX_TESTRUNS, }, { "Tail call count preserved across function calls", @@ -14705,7 +14705,7 @@ static struct tail_call_test tail_call_tests[] =3D { }, .stack_depth =3D 8, .flags =3D FLAG_NEED_STATE | FLAG_RESULT_IN_STATE, - .result =3D (MAX_TAIL_CALL_CNT + 1 + 1) * MAX_TESTRUNS, + .result =3D (MAX_TAIL_CALL_CNT + 1) * MAX_TESTRUNS, }, { "Tail call error path, NULL target", diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index ba5af15e25f5c..b12cfceddb6e9 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -1744,7 +1744,7 @@ union bpf_attr { * if the maximum number of tail calls has been reached for this * chain of programs. This limit is defined in the kernel by the * macro **MAX_TAIL_CALL_CNT** (not accessible to user space), - * which is currently set to 32. + * which is currently set to 33. * Return * 0 on success, or a negative error in case of failure. * --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE5E1C3526E for ; Mon, 24 Jan 2022 21:58:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379596AbiAXVyT (ORCPT ); Mon, 24 Jan 2022 16:54:19 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43842 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450765AbiAXVVW (ORCPT ); Mon, 24 Jan 2022 16:21:22 -0500 Received: from smtp.kernel.org (relay.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 A932761490; Mon, 24 Jan 2022 21:21:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84D05C340E4; Mon, 24 Jan 2022 21:21:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059281; bh=Fhv3mi1Mm8uNIIYwqjQOhdSly4zsT0G1KS4gJQ8MreU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=si0XCzpEo79L/P4lnz9Dg402KNmBkSIfg6xHeqdLslPx7XX5q4VafbGRL5VdA/AZ0 3oaSBqkZku3eaJWpFsn69kcd3j0VC60ZQXjjujKNAK5Wj7vYRPQ/0ypJw0vg/JpP6W tRMLxGg4SIm0Ot84vCk3/CDtGyl6k1/JZx4EbIFg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0564/1039] media: atomisp: handle errors at sh_css_create_isp_params() Date: Mon, 24 Jan 2022 19:39:13 +0100 Message-Id: <20220124184144.275112895@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 58043dbf6d1ae9deab4f5aa1e039c70112017682 ] The succ var tracks memory allocation erros on this function. Fix it, in order to stop this W=3D1 Werror in clang: drivers/staging/media/atomisp/pci/sh_css_params.c:2430:7: error: variable '= succ' set but not used [-Werror,-Wunused-but-set-variable] bool succ =3D true; ^ Reviewed-by: Nathan Chancellor Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/atomisp/pci/sh_css_params.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/st= aging/media/atomisp/pci/sh_css_params.c index dbd3bfe3d343c..ccc0078795648 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -2431,7 +2431,7 @@ sh_css_create_isp_params(struct ia_css_stream *stream, unsigned int i; struct sh_css_ddr_address_map *ddr_ptrs; struct sh_css_ddr_address_map_size *ddr_ptrs_size; - int err =3D 0; + int err; size_t params_size; struct ia_css_isp_parameters *params =3D kvmalloc(sizeof(struct ia_css_isp_parameters), GFP_KERNEL); @@ -2473,7 +2473,11 @@ sh_css_create_isp_params(struct ia_css_stream *strea= m, succ &=3D (ddr_ptrs->macc_tbl !=3D mmgr_NULL); =20 *isp_params_out =3D params; - return err; + + if (!succ) + return -ENOMEM; + + return 0; } =20 static bool --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 707F6C433EF for ; Mon, 24 Jan 2022 21:58:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354846AbiAXVye (ORCPT ); Mon, 24 Jan 2022 16:54:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:39378 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450796AbiAXVV0 (ORCPT ); Mon, 24 Jan 2022 16:21:26 -0500 Received: from smtp.kernel.org (relay.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 3B2BFB81218; Mon, 24 Jan 2022 21:21:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65823C340E4; Mon, 24 Jan 2022 21:21:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059284; bh=lMOFqeGgZzpBFghHqywCmsX3Rx3mFUPl+LDSGLmVj70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uj+oXFzroqA8lsGp2E3zB4HOtJ0xeI2BCnedUULt/dmwPXcL81puAV/1BrgARC8QH RVMhbBsTyExl9ZnlH1vFOeXJmc195vIhI34rX1N4XWsCkAPLncwFz/yWRarFe6trjW zRsTyLG6wOTHLeQH9pDvSGn3MXrWwtCyKn51Us5k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baochen Qiang , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0565/1039] ath11k: Fix crash caused by uninitialized TX ring Date: Mon, 24 Jan 2022 19:39:14 +0100 Message-Id: <20220124184144.309982794@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baochen Qiang [ Upstream commit 273703ebdb01b6c5f1aaf4b98fb57b177609055c ] Commit 31582373a4a8 ("ath11k: Change number of TCL rings to one for QCA6390") avoids initializing the other entries of dp->tx_ring cause the corresponding TX rings on QCA6390/WCN6855 are not used, but leaves those ring masks in ath11k_hw_ring_mask_qca6390.tx unchanged. Normally this is OK because we will only get interrupts from the first TX ring on these chips and thus only the first entry of dp->tx_ring is involved. In case of one MSI vector, all DP rings share the same IRQ. For each interrupt, all rings have to be checked, which means the other entries of dp->tx_ring are involved. However since they are not initialized, system crashes. Fix this issue by simply removing those ring masks. crash stack: [ 102.907438] BUG: kernel NULL pointer dereference, address: 0000000000000= 028 [ 102.907447] #PF: supervisor read access in kernel mode [ 102.907451] #PF: error_code(0x0000) - not-present page [ 102.907453] PGD 1081f0067 P4D 1081f0067 PUD 1081f1067 PMD 0 [ 102.907460] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC NOPTI [ 102.907465] CPU: 0 PID: 3511 Comm: apt-check Kdump: loaded Tainted: G = E 5.15.0-rc4-wt-ath+ #20 [ 102.907470] Hardware name: AMD Celadon-RN/Celadon-RN, BIOS RCD1005E 10/0= 8/2020 [ 102.907472] RIP: 0010:ath11k_dp_tx_completion_handler+0x201/0x830 [ath11= k] [ 102.907497] Code: 3c 24 4e 8d ac 37 10 04 00 00 4a 8d bc 37 68 04 00 00 = 48 89 3c 24 48 63 c8 89 83 84 18 00 00 48 c1 e1 05 48 03 8b 78 18 00 00 <8b= > 51 08 89 d6 83 e6 07 89 74 24 24 83 fe 03 74 04 85 f6 75 63 41 [ 102.907501] RSP: 0000:ffff9b7340003e08 EFLAGS: 00010202 [ 102.907505] RAX: 0000000000000001 RBX: ffff8e21530c0100 RCX: 00000000000= 00020 [ 102.907508] RDX: 0000000000000000 RSI: 00000000fffffe00 RDI: ffff8e21530= c1938 [ 102.907511] RBP: ffff8e21530c0000 R08: 0000000000000001 R09: 00000000000= 00000 [ 102.907513] R10: ffff8e2145534c10 R11: 0000000000000001 R12: ffff8e21530= c2938 [ 102.907515] R13: ffff8e21530c18e0 R14: 0000000000000100 R15: ffff8e21530= c2978 [ 102.907518] FS: 00007f5d4297e740(0000) GS:ffff8e243d600000(0000) knlGS:= 0000000000000000 [ 102.907521] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 102.907524] CR2: 0000000000000028 CR3: 00000001034ea000 CR4: 00000000003= 50ef0 [ 102.907527] Call Trace: [ 102.907531] [ 102.907537] ath11k_dp_service_srng+0x5c/0x2f0 [ath11k] [ 102.907556] ath11k_pci_ext_grp_napi_poll+0x21/0x70 [ath11k_pci] [ 102.907562] __napi_poll+0x2c/0x160 [ 102.907570] net_rx_action+0x251/0x310 [ 102.907576] __do_softirq+0x107/0x2fc [ 102.907585] irq_exit_rcu+0x74/0x90 [ 102.907593] common_interrupt+0x83/0xa0 [ 102.907600] [ 102.907601] asm_common_interrupt+0x1e/0x40 Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ= _LITE-1 Signed-off-by: Baochen Qiang Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211026011605.58615-1-quic_bqiang@quicinc.= com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/hw.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/hw.c b/drivers/net/wireless/at= h/ath11k/hw.c index da35fcf5bc560..2f0b526188e45 100644 --- a/drivers/net/wireless/ath/ath11k/hw.c +++ b/drivers/net/wireless/ath/ath11k/hw.c @@ -1061,8 +1061,6 @@ const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_= ipq8074 =3D { const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qca6390 =3D { .tx =3D { ATH11K_TX_RING_MASK_0, - ATH11K_TX_RING_MASK_1, - ATH11K_TX_RING_MASK_2, }, .rx_mon_status =3D { 0, 0, 0, 0, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0771C433F5 for ; Mon, 24 Jan 2022 21:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576519AbiAXVzK (ORCPT ); Mon, 24 Jan 2022 16:55:10 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44000 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450827AbiAXVVa (ORCPT ); Mon, 24 Jan 2022 16:21:30 -0500 Received: from smtp.kernel.org (relay.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 64260614D8; Mon, 24 Jan 2022 21:21:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4407EC340E4; Mon, 24 Jan 2022 21:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059289; bh=EZGfL1TCmkidrIE1+PMXiJ6X9E2Pb7CtXObzgF6wVFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=URpk6Iuf87etJww0OLpVRGEVtTKLYFULytJT6+hbV8ccaa0vTPjPYpBQhAp5OWPMd pM5/gfhWHenzk5Qpcje65CKt7nDrrGLO6iY7hi8iBpm/zHurlT/hMQXkkgzvmHZYde wQ6DpbHmJ4C/o5AYphOFn0WfT3nwCiTGDfXqjLdo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amjad Ouled-Ameur , Jerome Brunet , Sasha Levin Subject: [PATCH 5.16 0566/1039] usb: dwc3: meson-g12a: fix shared reset control use Date: Mon, 24 Jan 2022 19:39:15 +0100 Message-Id: <20220124184144.353212169@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Amjad Ouled-Ameur [ Upstream commit 4ce3b45704d5ef46fb4b28083c8aba6716fabf3b ] reset_control_(de)assert() calls are called on a shared reset line when reset_control_reset has been used. This is not allowed by the reset framework. Use reset_control_rearm() call in suspend() and remove() as a way to state that the resource is no longer used, hence the shared reset line may be triggered again by other devices. Use reset_control_rearm() also in case probe fails after reset() has been called. reset_control_rearm() keeps use of triggered_count sane in the reset framework, use of reset_control_reset() on shared reset line should be balanced with reset_control_rearm(). Signed-off-by: Amjad Ouled-Ameur Reported-by: Jerome Brunet Link: https://lore.kernel.org/r/20211112162827.128319-3-aouledameur@baylibr= e.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/dwc3/dwc3-meson-g12a.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-mes= on-g12a.c index d0f9b7c296b0d..bd814df3bf8b8 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -755,16 +755,16 @@ static int dwc3_meson_g12a_probe(struct platform_devi= ce *pdev) =20 ret =3D dwc3_meson_g12a_get_phys(priv); if (ret) - goto err_disable_clks; + goto err_rearm; =20 ret =3D priv->drvdata->setup_regmaps(priv, base); if (ret) - goto err_disable_clks; + goto err_rearm; =20 if (priv->vbus) { ret =3D regulator_enable(priv->vbus); if (ret) - goto err_disable_clks; + goto err_rearm; } =20 /* Get dr_mode */ @@ -825,6 +825,9 @@ err_disable_regulator: if (priv->vbus) regulator_disable(priv->vbus); =20 +err_rearm: + reset_control_rearm(priv->reset); + err_disable_clks: clk_bulk_disable_unprepare(priv->drvdata->num_clks, priv->drvdata->clks); @@ -852,6 +855,8 @@ static int dwc3_meson_g12a_remove(struct platform_devic= e *pdev) pm_runtime_put_noidle(dev); pm_runtime_set_suspended(dev); =20 + reset_control_rearm(priv->reset); + clk_bulk_disable_unprepare(priv->drvdata->num_clks, priv->drvdata->clks); =20 @@ -892,7 +897,7 @@ static int __maybe_unused dwc3_meson_g12a_suspend(struc= t device *dev) phy_exit(priv->phys[i]); } =20 - reset_control_assert(priv->reset); + reset_control_rearm(priv->reset); =20 return 0; } @@ -902,7 +907,9 @@ static int __maybe_unused dwc3_meson_g12a_resume(struct= device *dev) struct dwc3_meson_g12a *priv =3D dev_get_drvdata(dev); int i, ret; =20 - reset_control_deassert(priv->reset); + ret =3D reset_control_reset(priv->reset); + if (ret) + return ret; =20 ret =3D priv->drvdata->usb_init(priv); if (ret) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BE44C433F5 for ; Mon, 24 Jan 2022 23:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366667AbiAXXxQ (ORCPT ); Mon, 24 Jan 2022 18:53:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846008AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B852C061A82; Mon, 24 Jan 2022 13:21:33 -0800 (PST) Received: from smtp.kernel.org (relay.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 3B205614D7; Mon, 24 Jan 2022 21:21:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DB2CC340E4; Mon, 24 Jan 2022 21:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059292; bh=K/eWSfljgcMu7/mLCM+m/uhl8K632G9yFcOz1ichPVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b7Zj3ZfUfX6v0H9cyqxmksu7gEG9ghYPaViczv31gJG3rBGuicNHCJWKZHyx3EHn9 gB0CaqN5MHs/2XS+PIQdDui5LpOZw/9mglcrE46u+bh2CiB8W0c++CG+vTpEUKq/43 cn37bajq3BRmM88MMBb5bqwAlEZS4UfsH81QPzyw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, TCS Robot , Haimin Zhang , Alan Stern , Sasha Levin Subject: [PATCH 5.16 0567/1039] USB: ehci_brcm_hub_control: Improve port index sanitizing Date: Mon, 24 Jan 2022 19:39:16 +0100 Message-Id: <20220124184144.386514080@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haimin Zhang [ Upstream commit 9933698f6119886c110750e67c10ac66f12b730f ] Due to (wIndex & 0xff) - 1 can get an integer greater than 15, this can cause array index to be out of bounds since the size of array port_status is 15. This change prevents a possible out-of-bounds pointer computation by forcing the use of a valid port number. Reported-by: TCS Robot Signed-off-by: Haimin Zhang Signed-off-by: Alan Stern Link: https://lore.kernel.org/r/20211113165320.GA59686@rowland.harvard.edu Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/host/ehci-brcm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/ehci-brcm.c b/drivers/usb/host/ehci-brcm.c index d3626bfa966b4..6a0f64c9e5e88 100644 --- a/drivers/usb/host/ehci-brcm.c +++ b/drivers/usb/host/ehci-brcm.c @@ -62,8 +62,12 @@ static int ehci_brcm_hub_control( u32 __iomem *status_reg; unsigned long flags; int retval, irq_disabled =3D 0; + u32 temp; =20 - status_reg =3D &ehci->regs->port_status[(wIndex & 0xff) - 1]; + temp =3D (wIndex & 0xff) - 1; + if (temp >=3D HCS_N_PORTS_MAX) /* Avoid index-out-of-bounds warning */ + temp =3D 0; + status_reg =3D &ehci->regs->port_status[temp]; =20 /* * RESUME is cleared when GetPortStatus() is called 20ms after start --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D67E9C3526F for ; Mon, 24 Jan 2022 23:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366931AbiAXXxr (ORCPT ); Mon, 24 Jan 2022 18:53:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846010AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 198C8C061755; Mon, 24 Jan 2022 13:21:38 -0800 (PST) Received: from smtp.kernel.org (relay.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 CBCB9B81061; Mon, 24 Jan 2022 21:21:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08439C340E4; Mon, 24 Jan 2022 21:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059295; bh=/8vqTdehX2rFsIR81hlKJ31cDN856d4O4/Em5efcq6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SADURv+6HppuJ0C2VFNCIuw+A4daeBUDHUmKaPPFcjrkkHdqkKtEm+Qg62UIds7Dw VwA39NyS0K4cGkIgyC0D4pl6EzAr6LcAMs4HuV2+0IKBpYMUOo9R/+/pOl3JoPS2wP QiOHyY44DN6mjtdhNnqEBAfSQqfJE2+CB0qhOssg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Keeping , Pavankumar Kondeti , Sasha Levin Subject: [PATCH 5.16 0568/1039] usb: gadget: f_fs: Use stream_open() for endpoint files Date: Mon, 24 Jan 2022 19:39:17 +0100 Message-Id: <20220124184144.425317154@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavankumar Kondeti [ Upstream commit c76ef96fc00eb398c8fc836b0eb2f82bcc619dc7 ] Function fs endpoint file operations are synchronized via an interruptible mutex wait. However we see threads that do ep file operations concurrently are getting blocked for the mutex lock in __fdget_pos(). This is an uninterruptible wait and we see hung task warnings and kernel panic if hung_task_panic systcl is enabled if host does not send/receive the data for long time. The reason for threads getting blocked in __fdget_pos() is due to the file position protection introduced by the commit 9c225f2655e3 ("vfs: atomic f_pos accesses as per POSIX"). Since function fs endpoint files does not have the notion of the file position, switch to the stream mode. This will bypass the file position mutex and threads will be blocked in interruptible state for the function fs mutex. It should not affects user space as we are only changing the task state changes the task state from UNINTERRUPTIBLE to INTERRUPTIBLE while waiting for the USB transfers to be finished. However there is a slight change to the O_NONBLOCK behavior. Earlier threads that are using O_NONBLOCK are also getting blocked inside fdget_pos(). Now they reach to function fs and error code is returned. The non blocking behavior is actually honoured now. Reviewed-by: John Keeping Signed-off-by: Pavankumar Kondeti Link: https://lore.kernel.org/r/1636712682-1226-1-git-send-email-quic_pkond= eti@quicinc.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/gadget/function/f_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/functi= on/f_fs.c index a7e069b185448..25ad1e97a4585 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -614,7 +614,7 @@ static int ffs_ep0_open(struct inode *inode, struct fil= e *file) file->private_data =3D ffs; ffs_data_opened(ffs); =20 - return 0; + return stream_open(inode, file); } =20 static int ffs_ep0_release(struct inode *inode, struct file *file) @@ -1154,7 +1154,7 @@ ffs_epfile_open(struct inode *inode, struct file *fil= e) file->private_data =3D epfile; ffs_data_opened(epfile->ffs); =20 - return 0; + return stream_open(inode, file); } =20 static int ffs_aio_cancel(struct kiocb *kiocb) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95BFBC3526D for ; Mon, 24 Jan 2022 23:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366884AbiAXXxo (ORCPT ); Mon, 24 Jan 2022 18:53:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846017AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DF5FC061756; Mon, 24 Jan 2022 13:21:41 -0800 (PST) Received: from smtp.kernel.org (relay.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 B641DB811FB; Mon, 24 Jan 2022 21:21:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E641C340E4; Mon, 24 Jan 2022 21:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059298; bh=SfqMuc3aiXwjjvVxKLQUhZJjbDkbq19eOpNOriETP+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bscOeXVWTXJ7yzA8UvPgEIk5nZoxJz4riRsN6e8oTWS8+BfkfyrKS1ZbnjWBppo5e ymZtEUPlpmQhwPyF4tj1mpt4wATEvXksjb2vVAHTYOP4SgQpdfJzjXJdFc2WXjhO+/ KN5BV/PcqHjYJ6rS3y8/a3SvVddI59aRhgxRKEgw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Chen , "Peter Zijlstra (Intel)" , Johannes Weiner , Sasha Levin Subject: [PATCH 5.16 0569/1039] psi: Fix PSI_MEM_FULL state when tasks are in memstall and doing reclaim Date: Mon, 24 Jan 2022 19:39:18 +0100 Message-Id: <20220124184144.456044468@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Chen [ Upstream commit cb0e52b7748737b2cf6481fdd9b920ce7e1ebbdf ] We've noticed cases where tasks in a cgroup are stalled on memory but there is little memory FULL pressure since tasks stay on the runqueue in reclaim. A simple example involves a single threaded program that keeps leaking and touching large amounts of memory. It runs in a cgroup with swap enabled, memory.high set at 10M and cpu.max ratio set at 5%. Though there is significant CPU pressure and memory SOME, there is barely any memory FULL since the task enters reclaim and stays on the runqueue. However, this memory-bound task is effectively stalled on memory and we expect memory FULL to match memory SOME in this scenario. The code is confused about memstall && running, thinking there is a stalled task and a productive task when there's only one task: a reclaimer that's counted as both. To fix this, we redefine the condition for PSI_MEM_FULL to check that all running tasks are in an active memstall instead of checking that there are no running tasks. case PSI_MEM_FULL: - return unlikely(tasks[NR_MEMSTALL] && !tasks[NR_RUNNING]); + return unlikely(tasks[NR_MEMSTALL] && + tasks[NR_RUNNING] =3D=3D tasks[NR_MEMSTALL_RUNNING]= ); This will capture reclaimers. It will also capture tasks that called psi_memstall_enter() and are about to sleep, but this should be negligible noise. Signed-off-by: Brian Chen Signed-off-by: Peter Zijlstra (Intel) Acked-by: Johannes Weiner Link: https://lore.kernel.org/r/20211110213312.310243-1-brianchen118@gmail.= com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/linux/psi_types.h | 13 ++++++++++- kernel/sched/psi.c | 45 ++++++++++++++++++++++++--------------- kernel/sched/stats.h | 5 ++++- 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/include/linux/psi_types.h b/include/linux/psi_types.h index 0a23300d49af7..0819c82dba920 100644 --- a/include/linux/psi_types.h +++ b/include/linux/psi_types.h @@ -21,7 +21,17 @@ enum psi_task_count { * don't have to special case any state tracking for it. */ NR_ONCPU, - NR_PSI_TASK_COUNTS =3D 4, + /* + * For IO and CPU stalls the presence of running/oncpu tasks + * in the domain means a partial rather than a full stall. + * For memory it's not so simple because of page reclaimers: + * they are running/oncpu while representing a stall. To tell + * whether a domain has productivity left or not, we need to + * distinguish between regular running (i.e. productive) + * threads and memstall ones. + */ + NR_MEMSTALL_RUNNING, + NR_PSI_TASK_COUNTS =3D 5, }; =20 /* Task state bitmasks */ @@ -29,6 +39,7 @@ enum psi_task_count { #define TSK_MEMSTALL (1 << NR_MEMSTALL) #define TSK_RUNNING (1 << NR_RUNNING) #define TSK_ONCPU (1 << NR_ONCPU) +#define TSK_MEMSTALL_RUNNING (1 << NR_MEMSTALL_RUNNING) =20 /* Resources that workloads could be stalled on */ enum psi_res { diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 1652f2bb54b79..69b19d3af690f 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -34,13 +34,19 @@ * delayed on that resource such that nobody is advancing and the CPU * goes idle. This leaves both workload and CPU unproductive. * - * Naturally, the FULL state doesn't exist for the CPU resource at the - * system level, but exist at the cgroup level, means all non-idle tasks - * in a cgroup are delayed on the CPU resource which used by others outside - * of the cgroup or throttled by the cgroup cpu.max configuration. - * * SOME =3D nr_delayed_tasks !=3D 0 - * FULL =3D nr_delayed_tasks !=3D 0 && nr_running_tasks =3D=3D 0 + * FULL =3D nr_delayed_tasks !=3D 0 && nr_productive_tasks =3D=3D 0 + * + * What it means for a task to be productive is defined differently + * for each resource. For IO, productive means a running task. For + * memory, productive means a running task that isn't a reclaimer. For + * CPU, productive means an oncpu task. + * + * Naturally, the FULL state doesn't exist for the CPU resource at the + * system level, but exist at the cgroup level. At the cgroup level, + * FULL means all non-idle tasks in the cgroup are delayed on the CPU + * resource which is being used by others outside of the cgroup or + * throttled by the cgroup cpu.max configuration. * * The percentage of wallclock time spent in those compound stall * states gives pressure numbers between 0 and 100 for each resource, @@ -81,13 +87,13 @@ * * threads =3D min(nr_nonidle_tasks, nr_cpus) * SOME =3D min(nr_delayed_tasks / threads, 1) - * FULL =3D (threads - min(nr_running_tasks, threads)) / threads + * FULL =3D (threads - min(nr_productive_tasks, threads)) / threads * * For the 257 number crunchers on 256 CPUs, this yields: * * threads =3D min(257, 256) * SOME =3D min(1 / 256, 1) =3D 0.4% - * FULL =3D (256 - min(257, 256)) / 256 =3D 0% + * FULL =3D (256 - min(256, 256)) / 256 =3D 0% * * For the 1 out of 4 memory-delayed tasks, this yields: * @@ -112,7 +118,7 @@ * For each runqueue, we track: * * tSOME[cpu] =3D time(nr_delayed_tasks[cpu] !=3D 0) - * tFULL[cpu] =3D time(nr_delayed_tasks[cpu] && !nr_running_tasks[cpu]) + * tFULL[cpu] =3D time(nr_delayed_tasks[cpu] && !nr_productive_tasks[cp= u]) * tNONIDLE[cpu] =3D time(nr_nonidle_tasks[cpu] !=3D 0) * * and then periodically aggregate: @@ -233,7 +239,8 @@ static bool test_state(unsigned int *tasks, enum psi_st= ates state) case PSI_MEM_SOME: return unlikely(tasks[NR_MEMSTALL]); case PSI_MEM_FULL: - return unlikely(tasks[NR_MEMSTALL] && !tasks[NR_RUNNING]); + return unlikely(tasks[NR_MEMSTALL] && + tasks[NR_RUNNING] =3D=3D tasks[NR_MEMSTALL_RUNNING]); case PSI_CPU_SOME: return unlikely(tasks[NR_RUNNING] > tasks[NR_ONCPU]); case PSI_CPU_FULL: @@ -710,10 +717,11 @@ static void psi_group_change(struct psi_group *group,= int cpu, if (groupc->tasks[t]) { groupc->tasks[t]--; } else if (!psi_bug) { - printk_deferred(KERN_ERR "psi: task underflow! cpu=3D%d t=3D%d tasks=3D= [%u %u %u %u] clear=3D%x set=3D%x\n", + printk_deferred(KERN_ERR "psi: task underflow! cpu=3D%d t=3D%d tasks=3D= [%u %u %u %u %u] clear=3D%x set=3D%x\n", cpu, t, groupc->tasks[0], groupc->tasks[1], groupc->tasks[2], - groupc->tasks[3], clear, set); + groupc->tasks[3], groupc->tasks[4], + clear, set); psi_bug =3D 1; } } @@ -854,12 +862,15 @@ void psi_task_switch(struct task_struct *prev, struct= task_struct *next, int clear =3D TSK_ONCPU, set =3D 0; =20 /* - * When we're going to sleep, psi_dequeue() lets us handle - * TSK_RUNNING and TSK_IOWAIT here, where we can combine it - * with TSK_ONCPU and save walking common ancestors twice. + * When we're going to sleep, psi_dequeue() lets us + * handle TSK_RUNNING, TSK_MEMSTALL_RUNNING and + * TSK_IOWAIT here, where we can combine it with + * TSK_ONCPU and save walking common ancestors twice. */ if (sleep) { clear |=3D TSK_RUNNING; + if (prev->in_memstall) + clear |=3D TSK_MEMSTALL_RUNNING; if (prev->in_iowait) set |=3D TSK_IOWAIT; } @@ -908,7 +919,7 @@ void psi_memstall_enter(unsigned long *flags) rq =3D this_rq_lock_irq(&rf); =20 current->in_memstall =3D 1; - psi_task_change(current, 0, TSK_MEMSTALL); + psi_task_change(current, 0, TSK_MEMSTALL | TSK_MEMSTALL_RUNNING); =20 rq_unlock_irq(rq, &rf); } @@ -937,7 +948,7 @@ void psi_memstall_leave(unsigned long *flags) rq =3D this_rq_lock_irq(&rf); =20 current->in_memstall =3D 0; - psi_task_change(current, TSK_MEMSTALL, 0); + psi_task_change(current, TSK_MEMSTALL | TSK_MEMSTALL_RUNNING, 0); =20 rq_unlock_irq(rq, &rf); } diff --git a/kernel/sched/stats.h b/kernel/sched/stats.h index cfb0893a83d45..3a3c826dd83a7 100644 --- a/kernel/sched/stats.h +++ b/kernel/sched/stats.h @@ -118,6 +118,9 @@ static inline void psi_enqueue(struct task_struct *p, b= ool wakeup) if (static_branch_likely(&psi_disabled)) return; =20 + if (p->in_memstall) + set |=3D TSK_MEMSTALL_RUNNING; + if (!wakeup || p->sched_psi_wake_requeue) { if (p->in_memstall) set |=3D TSK_MEMSTALL; @@ -148,7 +151,7 @@ static inline void psi_dequeue(struct task_struct *p, b= ool sleep) return; =20 if (p->in_memstall) - clear |=3D TSK_MEMSTALL; + clear |=3D (TSK_MEMSTALL | TSK_MEMSTALL_RUNNING); =20 psi_task_change(p, clear, 0); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E776C2BA4C for ; Mon, 24 Jan 2022 23:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366776AbiAXXxd (ORCPT ); Mon, 24 Jan 2022 18:53:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846019AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1843EC061759; Mon, 24 Jan 2022 13:21:43 -0800 (PST) Received: from smtp.kernel.org (relay.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 B4F1BB811FB; Mon, 24 Jan 2022 21:21:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E599CC340E4; Mon, 24 Jan 2022 21:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059301; bh=0mE4HMQmvBOAF1RsNUNu4EhUlU0J1p1amXqdxPdIfWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NRPGAL1nZl119s2rG6dQpBYL42hSCYjA6ww63VFhyIggKUWGRpmqfpaTM6pIB7bJW AWSQ+G6lmqkSsf4/3uyKkMtvR9LRaiJQFJfrPNaEQVaHmwOeM8hdMWRX6dJ4/d4mRx L/irQ+D4sNMW7gtoJpr3cdwFQXmgjYFkDAct8MQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yauhen Kharuzhy , Hans de Goede , Simon Ser , Sasha Levin Subject: [PATCH 5.16 0570/1039] drm: panel-orientation-quirks: Add quirk for the Lenovo Yoga Book X91F/L Date: Mon, 24 Jan 2022 19:39:19 +0100 Message-Id: <20220124184144.495199759@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit bc30c3b0c8a1904d83d5f0d60fb8650a334b207b ] The Lenovo Yoga Book X91F/L uses a panel which has been mounted 90 degrees rotated. Add a quirk for this. Cc: Yauhen Kharuzhy Signed-off-by: Hans de Goede Acked-by: Simon Ser Tested-by: Yauhen Kharuzhy Link: https://patchwork.freedesktop.org/patch/msgid/20211106130227.11927-1-= hdegoede@redhat.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/d= rm/drm_panel_orientation_quirks.c index a9359878f4ed6..042bb80383c93 100644 --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -262,6 +262,12 @@ static const struct dmi_system_id orientation_data[] = =3D { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), }, .driver_data =3D (void *)&lcd1200x1920_rightside_up, + }, { /* Lenovo Yoga Book X90F / X91F / X91L */ + .matches =3D { + /* Non exact match to match all versions */ + DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), + }, + .driver_data =3D (void *)&lcd1200x1920_rightside_up, }, { /* OneGX1 Pro */ .matches =3D { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"), --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E22BFC433FE for ; Mon, 24 Jan 2022 22:04:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380661AbiAXWE1 (ORCPT ); Mon, 24 Jan 2022 17:04:27 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42788 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450922AbiAXVVp (ORCPT ); Mon, 24 Jan 2022 16:21:45 -0500 Received: from smtp.kernel.org (relay.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 08B8D614D7; Mon, 24 Jan 2022 21:21:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDFEDC340E5; Mon, 24 Jan 2022 21:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059304; bh=1EyoLpH3u/C9VtsMId1mXlNNHGrLClCkoMSf0/DC940=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k/FmX+09eWrSgJu6p8wX+1pctsjho6cztan9bAa/gEW3jMEwNP33IP9MqjSQ5rccA PH8GQ4faDN4PSgd+S7oZ+Je7HA4IgLqYAD6YShyYp89pH+19j5uDTyFv4Z9D770EKe 3RztkRamvQIedk723y8ynB5yTagIGnJuRTIwayuw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Jiri Kosina , Sasha Levin Subject: [PATCH 5.16 0571/1039] HID: magicmouse: Report battery level over USB Date: Mon, 24 Jan 2022 19:39:20 +0100 Message-Id: <20220124184144.527010715@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit 0b91b4e4dae63cd43871fc2012370b86ee588f91 ] When connected over USB, the Apple Magic Mouse 2 and the Apple Magic Trackpad 2 register multiple interfaces, one of them is used to report the battery level. However, unlike when connected over Bluetooth, the battery level is not reported automatically and it is required to fetch it manually. Fix the battery report descriptor and add a timer to fetch the battery level. Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/hid-magicmouse.c | 94 +++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 6 deletions(-) diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index d7687ce706144..eba1e8087bfd1 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c @@ -57,6 +57,8 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphere= d multi-touch state fie #define MOUSE_REPORT_ID 0x29 #define MOUSE2_REPORT_ID 0x12 #define DOUBLE_REPORT_ID 0xf7 +#define USB_BATTERY_TIMEOUT_MS 60000 + /* These definitions are not precise, but they're close enough. (Bits * 0x03 seem to indicate the aspect ratio of the touch, bits 0x70 seem * to be some kind of bit mask -- 0x20 may be a near-field reading, @@ -140,6 +142,7 @@ struct magicmouse_sc { =20 struct hid_device *hdev; struct delayed_work work; + struct timer_list battery_timer; }; =20 static int magicmouse_firm_touch(struct magicmouse_sc *msc) @@ -738,6 +741,44 @@ static void magicmouse_enable_mt_work(struct work_stru= ct *work) hid_err(msc->hdev, "unable to request touch data (%d)\n", ret); } =20 +static int magicmouse_fetch_battery(struct hid_device *hdev) +{ +#ifdef CONFIG_HID_BATTERY_STRENGTH + struct hid_report_enum *report_enum; + struct hid_report *report; + + if (!hdev->battery || hdev->vendor !=3D USB_VENDOR_ID_APPLE || + (hdev->product !=3D USB_DEVICE_ID_APPLE_MAGICMOUSE2 && + hdev->product !=3D USB_DEVICE_ID_APPLE_MAGICTRACKPAD2)) + return -1; + + report_enum =3D &hdev->report_enum[hdev->battery_report_type]; + report =3D report_enum->report_id_hash[hdev->battery_report_id]; + + if (!report || report->maxfield < 1) + return -1; + + if (hdev->battery_capacity =3D=3D hdev->battery_max) + return -1; + + hid_hw_request(hdev, report, HID_REQ_GET_REPORT); + return 0; +#else + return -1; +#endif +} + +static void magicmouse_battery_timer_tick(struct timer_list *t) +{ + struct magicmouse_sc *msc =3D from_timer(msc, t, battery_timer); + struct hid_device *hdev =3D msc->hdev; + + if (magicmouse_fetch_battery(hdev) =3D=3D 0) { + mod_timer(&msc->battery_timer, + jiffies + msecs_to_jiffies(USB_BATTERY_TIMEOUT_MS)); + } +} + static int magicmouse_probe(struct hid_device *hdev, const struct hid_device_id *id) { @@ -745,11 +786,6 @@ static int magicmouse_probe(struct hid_device *hdev, struct hid_report *report; int ret; =20 - if (id->vendor =3D=3D USB_VENDOR_ID_APPLE && - id->product =3D=3D USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 && - hdev->type !=3D HID_TYPE_USBMOUSE) - return -ENODEV; - msc =3D devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL); if (msc =3D=3D NULL) { hid_err(hdev, "can't alloc magicmouse descriptor\n"); @@ -775,6 +811,16 @@ static int magicmouse_probe(struct hid_device *hdev, return ret; } =20 + timer_setup(&msc->battery_timer, magicmouse_battery_timer_tick, 0); + mod_timer(&msc->battery_timer, + jiffies + msecs_to_jiffies(USB_BATTERY_TIMEOUT_MS)); + magicmouse_fetch_battery(hdev); + + if (id->vendor =3D=3D USB_VENDOR_ID_APPLE && + (id->product =3D=3D USB_DEVICE_ID_APPLE_MAGICMOUSE2 || + (id->product =3D=3D USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 && hdev->type= !=3D HID_TYPE_USBMOUSE))) + return 0; + if (!msc->input) { hid_err(hdev, "magicmouse input not registered\n"); ret =3D -ENOMEM; @@ -835,17 +881,52 @@ static void magicmouse_remove(struct hid_device *hdev) { struct magicmouse_sc *msc =3D hid_get_drvdata(hdev); =20 - if (msc) + if (msc) { cancel_delayed_work_sync(&msc->work); + del_timer_sync(&msc->battery_timer); + } =20 hid_hw_stop(hdev); } =20 +static __u8 *magicmouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) +{ + /* + * Change the usage from: + * 0x06, 0x00, 0xff, // Usage Page (Vendor Defined Page 1) 0 + * 0x09, 0x0b, // Usage (Vendor Usage 0x0b) 3 + * To: + * 0x05, 0x01, // Usage Page (Generic Desktop) 0 + * 0x09, 0x02, // Usage (Mouse) 2 + */ + if (hdev->vendor =3D=3D USB_VENDOR_ID_APPLE && + (hdev->product =3D=3D USB_DEVICE_ID_APPLE_MAGICMOUSE2 || + hdev->product =3D=3D USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) && + *rsize =3D=3D 83 && rdesc[46] =3D=3D 0x84 && rdesc[58] =3D=3D 0x85) { + hid_info(hdev, + "fixing up magicmouse battery report descriptor\n"); + *rsize =3D *rsize - 1; + rdesc =3D kmemdup(rdesc + 1, *rsize, GFP_KERNEL); + if (!rdesc) + return NULL; + + rdesc[0] =3D 0x05; + rdesc[1] =3D 0x01; + rdesc[2] =3D 0x09; + rdesc[3] =3D 0x02; + } + + return rdesc; +} + static const struct hid_device_id magic_mice[] =3D { { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE), .driver_data =3D 0 }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE2), .driver_data =3D 0 }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, + USB_DEVICE_ID_APPLE_MAGICMOUSE2), .driver_data =3D 0 }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD), .driver_data =3D 0 }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, @@ -861,6 +942,7 @@ static struct hid_driver magicmouse_driver =3D { .id_table =3D magic_mice, .probe =3D magicmouse_probe, .remove =3D magicmouse_remove, + .report_fixup =3D magicmouse_report_fixup, .raw_event =3D magicmouse_raw_event, .event =3D magicmouse_event, .input_mapping =3D magicmouse_input_mapping, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66CEDC41535 for ; Mon, 24 Jan 2022 23:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366756AbiAXXxa (ORCPT ); Mon, 24 Jan 2022 18:53:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846018AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 644B6C0617A9; Mon, 24 Jan 2022 13:21:48 -0800 (PST) Received: from smtp.kernel.org (relay.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 0526D60C60; Mon, 24 Jan 2022 21:21:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4CF3C340E5; Mon, 24 Jan 2022 21:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059307; bh=wgi+j8udB1hBs2lDS+VQzIfA/QubZozAoFQHsIgrftA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BiWCvn+1Vp1PMO77BqQhUtOTqLzcwz04OeoZ/s0r6woMZOSSUxnm0HLuqaTxjqA1h lwk9VkUzy2NVNVYov8K031n6m/N79zElMDXfHmf6Op/JRvgMhEpt7AjGfH7XIrh/SM 33rf0Biay2nFQx0iXtyy8Mkhrea+B+CIRLIW6ueY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Jiri Kosina , Sasha Levin Subject: [PATCH 5.16 0572/1039] HID: apple: Do not reset quirks when the Fn key is not found Date: Mon, 24 Jan 2022 19:39:21 +0100 Message-Id: <20220124184144.565739409@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit a5fe7864d8ada170f19cc47d176bf8260ffb4263 ] When a keyboard without a function key is detected, instead of removing all quirks, remove only the APPLE_HAS_FN quirk. Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/hid-apple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index 2c9c5faa74a97..a4ca5ed00e5f5 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c @@ -428,7 +428,7 @@ static int apple_input_configured(struct hid_device *hd= ev, =20 if ((asc->quirks & APPLE_HAS_FN) && !asc->fn_found) { hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disab= ling Fn key handling\n"); - asc->quirks =3D 0; + asc->quirks &=3D ~APPLE_HAS_FN; } =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD081C46467 for ; Mon, 24 Jan 2022 22:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579078AbiAXWE5 (ORCPT ); Mon, 24 Jan 2022 17:04:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:39622 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450961AbiAXVVx (ORCPT ); Mon, 24 Jan 2022 16:21:53 -0500 Received: from smtp.kernel.org (relay.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 7562BB81061; Mon, 24 Jan 2022 21:21:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1016C340E4; Mon, 24 Jan 2022 21:21:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059310; bh=VHl5CcFlqtJS0OW13GvtjPnDZoxUPw8nr8FYBIbsZDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ugBPNr06RWcL3GjGhgk2G1dzQIBms340P59zVa1dkIcAJq4cfupXuwvEsMCRJoF// RbvI28fgVSfAHSWsAKPriQ2Q4quyWgqv+Qf0PTxPwbd2AHqBDpX+e0euiYpFX7yzuV i6VL47HFIbmc04KS+ZSp56p/FXp5DX8UkmFe93FY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0573/1039] media: b2c2: Add missing check in flexcop_pci_isr: Date: Mon, 24 Jan 2022 19:39:22 +0100 Message-Id: <20220124184144.607023851@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 b13203032e679674c7c518f52a7ec0801ca3a829 ] A out-of-bounds bug can be triggered by an interrupt, the reason for this bug is the lack of checking of register values. In flexcop_pci_isr, the driver reads value from a register and uses it as a dma address. Finally, this address will be passed to the count parameter of find_next_packet. If this value is larger than the size of dma, the index of buffer will be out-of-bounds. Fix this by adding a check after reading the value of the register. The following KASAN report reveals it: BUG: KASAN: slab-out-of-bounds in find_next_packet drivers/media/dvb-core/dvb_demux.c:528 [inline] BUG: KASAN: slab-out-of-bounds in _dvb_dmx_swfilter drivers/media/dvb-core/dvb_demux.c:572 [inline] BUG: KASAN: slab-out-of-bounds in dvb_dmx_swfilter+0x3fa/0x420 drivers/media/dvb-core/dvb_demux.c:603 Read of size 1 at addr ffff8880608c00a0 by task swapper/2/0 CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.19.177-gdba4159c14ef #25 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xec/0x156 lib/dump_stack.c:118 print_address_description+0x78/0x290 mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report+0x25b/0x380 mm/kasan/report.c:412 __asan_report_load1_noabort+0x19/0x20 mm/kasan/report.c:430 find_next_packet drivers/media/dvb-core/dvb_demux.c:528 [inline] _dvb_dmx_swfilter drivers/media/dvb-core/dvb_demux.c:572 [inline] dvb_dmx_swfilter+0x3fa/0x420 drivers/media/dvb-core/dvb_demux.c:603 flexcop_pass_dmx_data+0x2e/0x40 drivers/media/common/b2c2/flexcop.c:167 flexcop_pci_isr+0x3d1/0x5d0 drivers/media/pci/b2c2/flexcop-pci.c:212 __handle_irq_event_percpu+0xfb/0x770 kernel/irq/handle.c:149 handle_irq_event_percpu+0x79/0x150 kernel/irq/handle.c:189 handle_irq_event+0xac/0x140 kernel/irq/handle.c:206 handle_fasteoi_irq+0x232/0x5c0 kernel/irq/chip.c:725 generic_handle_irq_desc include/linux/irqdesc.h:155 [inline] handle_irq+0x230/0x3a0 arch/x86/kernel/irq_64.c:87 do_IRQ+0xa7/0x1e0 arch/x86/kernel/irq.c:247 common_interrupt+0xf/0xf arch/x86/entry/entry_64.S:670 RIP: 0010:native_safe_halt+0x28/0x30 arch/x86/include/asm/irqflags.h:61 Code: 00 00 55 be 04 00 00 00 48 c7 c7 00 62 2f 8c 48 89 e5 e8 fb 31 e8 f8 8b 05 75 4f 8e 03 85 c0 7e 07 0f 00 2d 8a 61 66 00 fb f4 <5d> c3 90 90 90 90 90 90 0f 1f 44 00 00 55 48 89 e5 41 57 41 56 41 RSP: 0018:ffff88806b71fcc8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffde RAX: 0000000000000000 RBX: ffffffff8bde44c8 RCX: ffffffff88a11285 RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffff8c2f6200 RBP: ffff88806b71fcc8 R08: fffffbfff185ec40 R09: fffffbfff185ec40 R10: 0000000000000001 R11: fffffbfff185ec40 R12: 0000000000000002 R13: ffffffff8be9d6e0 R14: 0000000000000000 R15: 0000000000000000 arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline] default_idle+0x6f/0x360 arch/x86/kernel/process.c:557 arch_cpu_idle+0xf/0x20 arch/x86/kernel/process.c:548 default_idle_call+0x3b/0x60 kernel/sched/idle.c:93 cpuidle_idle_call kernel/sched/idle.c:153 [inline] do_idle+0x2ab/0x3c0 kernel/sched/idle.c:263 cpu_startup_entry+0xcb/0xe0 kernel/sched/idle.c:369 start_secondary+0x3b8/0x4e0 arch/x86/kernel/smpboot.c:271 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 Allocated by task 1: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:553 kasan_slab_alloc+0x11/0x20 mm/kasan/kasan.c:490 slab_post_alloc_hook mm/slab.h:445 [inline] slab_alloc_node mm/slub.c:2741 [inline] slab_alloc mm/slub.c:2749 [inline] kmem_cache_alloc+0xeb/0x280 mm/slub.c:2754 kmem_cache_zalloc include/linux/slab.h:699 [inline] __kernfs_new_node+0xe2/0x6f0 fs/kernfs/dir.c:633 kernfs_new_node+0x9a/0x120 fs/kernfs/dir.c:693 __kernfs_create_file+0x5f/0x340 fs/kernfs/file.c:992 sysfs_add_file_mode_ns+0x22a/0x4e0 fs/sysfs/file.c:306 create_files fs/sysfs/group.c:63 [inline] internal_create_group+0x34e/0xc30 fs/sysfs/group.c:147 sysfs_create_group fs/sysfs/group.c:173 [inline] sysfs_create_groups+0x9c/0x140 fs/sysfs/group.c:200 driver_add_groups+0x3e/0x50 drivers/base/driver.c:129 bus_add_driver+0x3a5/0x790 drivers/base/bus.c:684 driver_register+0x1cd/0x410 drivers/base/driver.c:170 __pci_register_driver+0x197/0x200 drivers/pci/pci-driver.c:1411 cx88_audio_pci_driver_init+0x23/0x25 drivers/media/pci/cx88/cx88-alsa.c: 1017 do_one_initcall+0xe0/0x610 init/main.c:884 do_initcall_level init/main.c:952 [inline] do_initcalls init/main.c:960 [inline] do_basic_setup init/main.c:978 [inline] kernel_init_freeable+0x4d0/0x592 init/main.c:1145 kernel_init+0x18/0x190 init/main.c:1062 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 Freed by task 0: (stack is not available) The buggy address belongs to the object at ffff8880608c0000 which belongs to the cache kernfs_node_cache of size 160 The buggy address is located 0 bytes to the right of 160-byte region [ffff8880608c0000, ffff8880608c00a0) The buggy address belongs to the page: page:ffffea0001823000 count:1 mapcount:0 mapping:ffff88806bed1e00 index:0x0 compound_mapcount: 0 flags: 0x100000000008100(slab|head) raw: 0100000000008100 dead000000000100 dead000000000200 ffff88806bed1e00 raw: 0000000000000000 0000000000240024 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880608bff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880608c0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880608c0080: 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00 00 ^ ffff8880608c0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880608c0180: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 =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 Link: https://lore.kernel.org/linux-media/1620723603-30912-1-git-send-email= -zheyuma97@gmail.com Reported-by: Zheyu Ma Signed-off-by: Zheyu Ma Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/pci/b2c2/flexcop-pci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/pci/b2c2/flexcop-pci.c b/drivers/media/pci/b2c2/= flexcop-pci.c index 6a4c7cb0ad0f9..486c8ec0fa60d 100644 --- a/drivers/media/pci/b2c2/flexcop-pci.c +++ b/drivers/media/pci/b2c2/flexcop-pci.c @@ -185,6 +185,8 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_i= d) dma_addr_t cur_addr =3D fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; u32 cur_pos =3D cur_addr - fc_pci->dma[0].dma_addr0; + if (cur_pos > fc_pci->dma[0].size * 2) + goto error; =20 deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, last_cur_pos: %08x = ", jiffies_to_usecs(jiffies - fc_pci->last_irq), @@ -225,6 +227,7 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_i= d) ret =3D IRQ_NONE; } =20 +error: spin_unlock_irqrestore(&fc_pci->irq_lock, flags); return ret; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45244C4321E for ; Mon, 24 Jan 2022 21:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576890AbiAXV4k (ORCPT ); Mon, 24 Jan 2022 16:56:40 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44430 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450966AbiAXVVy (ORCPT ); Mon, 24 Jan 2022 16:21:54 -0500 Received: from smtp.kernel.org (relay.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 150B8614DA; Mon, 24 Jan 2022 21:21:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7789C340E4; Mon, 24 Jan 2022 21:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059313; bh=xwKORReWGw5mqUHtAtglYkKZr9iec73HNhvD8L3tEmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P9FH4s0+PtwgauWWsJ7Y73v5YFNHTrWYjiAtXQ/U+r8W8KG1sVaUP4K3smZC3nzlV YU/xh/pcjKwjh2Sh2777FTYmqzYqPTeTd1OTMlgpuTSM/qOy9hbynAi/fR57ylwqu+ NtBMdDvXQcrxC+Xx6FuV9w+oj+DPBB0/PCgofKrY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Olsa , Andrii Nakryiko , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.16 0574/1039] libbpf: Accommodate DWARF/compiler bug with duplicated structs Date: Mon, 24 Jan 2022 19:39:23 +0100 Message-Id: <20220124184144.643212658@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit efdd3eb8015e7447095f02a26eaabd164cd18004 ] According to [0], compilers sometimes might produce duplicate DWARF definitions for exactly the same struct/union within the same compilation unit (CU). We've had similar issues with identical arrays and handled them with a similar workaround in 6b6e6b1d09aa ("libbpf: Accomodate DWARF/compiler bug with duplicated identical arrays"). Do the same for struct/union by ensuring that two structs/unions are exactly the same, down to the integer values of field referenced type IDs. Solving this more generically (allowing referenced types to be equivalent, but using different type IDs, all within a single CU) requires a huge complexity increase to handle many-to-many mappings between canonidal and candidate type graphs. Before we invest in that, let's see if this approach handles all the instances of this issue in practice. Thankfully it's pretty rare, it seems. [0] https://lore.kernel.org/bpf/YXr2NFlJTAhHdZqq@krava/ Reported-by: Jiri Olsa Signed-off-by: Andrii Nakryiko Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20211117194114.347675-1-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/btf.c | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index c2400804d6bac..dc86259980231 100644 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@ -3443,8 +3443,8 @@ static long btf_hash_struct(struct btf_type *t) } =20 /* - * Check structural compatibility of two FUNC_PROTOs, ignoring referenced = type - * IDs. This check is performed during type graph equivalence check and + * Check structural compatibility of two STRUCTs/UNIONs, ignoring referenc= ed + * type IDs. This check is performed during type graph equivalence check a= nd * referenced types equivalence is checked separately. */ static bool btf_shallow_equal_struct(struct btf_type *t1, struct btf_type = *t2) @@ -3817,6 +3817,31 @@ static int btf_dedup_identical_arrays(struct btf_ded= up *d, __u32 id1, __u32 id2) return btf_equal_array(t1, t2); } =20 +/* Check if given two types are identical STRUCT/UNION definitions */ +static bool btf_dedup_identical_structs(struct btf_dedup *d, __u32 id1, __= u32 id2) +{ + const struct btf_member *m1, *m2; + struct btf_type *t1, *t2; + int n, i; + + t1 =3D btf_type_by_id(d->btf, id1); + t2 =3D btf_type_by_id(d->btf, id2); + + if (!btf_is_composite(t1) || btf_kind(t1) !=3D btf_kind(t2)) + return false; + + if (!btf_shallow_equal_struct(t1, t2)) + return false; + + m1 =3D btf_members(t1); + m2 =3D btf_members(t2); + for (i =3D 0, n =3D btf_vlen(t1); i < n; i++, m1++, m2++) { + if (m1->type !=3D m2->type) + return false; + } + return true; +} + /* * Check equivalence of BTF type graph formed by candidate struct/union (w= e'll * call it "candidate graph" in this description for brevity) to a type gr= aph @@ -3928,6 +3953,8 @@ static int btf_dedup_is_equiv(struct btf_dedup *d, __= u32 cand_id, =20 hypot_type_id =3D d->hypot_map[canon_id]; if (hypot_type_id <=3D BTF_MAX_NR_TYPES) { + if (hypot_type_id =3D=3D cand_id) + return 1; /* In some cases compiler will generate different DWARF types * for *identical* array type definitions and use them for * different fields within the *same* struct. This breaks type @@ -3936,8 +3963,18 @@ static int btf_dedup_is_equiv(struct btf_dedup *d, _= _u32 cand_id, * types within a single CU. So work around that by explicitly * allowing identical array types here. */ - return hypot_type_id =3D=3D cand_id || - btf_dedup_identical_arrays(d, hypot_type_id, cand_id); + if (btf_dedup_identical_arrays(d, hypot_type_id, cand_id)) + return 1; + /* It turns out that similar situation can happen with + * struct/union sometimes, sigh... Handle the case where + * structs/unions are exactly the same, down to the referenced + * type IDs. Anything more complicated (e.g., if referenced + * types are different, but equivalent) is *way more* + * complicated and requires a many-to-many equivalence mapping. + */ + if (btf_dedup_identical_structs(d, hypot_type_id, cand_id)) + return 1; + return 0; } =20 if (btf_dedup_hypot_map_add(d, canon_id, cand_id)) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BAB6C4167E for ; Mon, 24 Jan 2022 23:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366604AbiAXXxI (ORCPT ); Mon, 24 Jan 2022 18:53:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846012AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA53BC06127C; Mon, 24 Jan 2022 13:21:58 -0800 (PST) Received: from smtp.kernel.org (relay.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 87112B8123D; Mon, 24 Jan 2022 21:21:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8B82C340E4; Mon, 24 Jan 2022 21:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059316; bh=oLdh2IIQhyz8/cfQ/4uNzzA2+eaqF5O7TwGmsi6SxmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RloTmhDmexkQTyXWfIMzeIqlbeRx/mtmhbzPQuoJfD4RYOF7Ca6xW1gDBO707eHsP XEX6ogQO0+ebhfJ/QxRzKefaEFd3i0oEmeQzOlF1le+gPzy55A6qjNtVXki2xE2xKN pWIdow2TLwtETOWUJ++5+b9BAu/6IJlsVXeTD6tY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abaci Robot , Yang Li , Geert Uytterhoeven , Sergey Shtylyov , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0575/1039] ethernet: renesas: Use div64_ul instead of do_div Date: Mon, 24 Jan 2022 19:39:24 +0100 Message-Id: <20220124184144.674393499@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Li [ Upstream commit d9f31aeaa1e5aefa68130878af3c3513d41c1e2d ] do_div() does a 64-by-32 division. Here the divisor is an unsigned long which on some platforms is 64 bit wide. So use div64_ul instead of do_div to avoid a possible truncation. Eliminate the following coccicheck warning: ./drivers/net/ethernet/renesas/ravb_main.c:2492:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead. Reported-by: Abaci Robot Signed-off-by: Yang Li Reviewed-by: Geert Uytterhoeven Reviewed-by: Sergey Shtylyov Link: https://lore.kernel.org/r/1637228883-100100-1-git-send-email-yang.lee= @linux.alibaba.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/renesas/ravb_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/etherne= t/renesas/ravb_main.c index b4c597f4040c8..151cce2fe36d5 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -30,8 +30,7 @@ #include #include #include - -#include +#include =20 #include "ravb.h" =20 @@ -2488,8 +2487,7 @@ static int ravb_set_gti(struct net_device *ndev) if (!rate) return -EINVAL; =20 - inc =3D 1000000000ULL << 20; - do_div(inc, rate); + inc =3D div64_ul(1000000000ULL << 20, rate); =20 if (inc < GTI_TIV_MIN || inc > GTI_TIV_MAX) { dev_err(dev, "gti.tiv increment 0x%llx is outside the range 0x%x - 0x%x\= n", --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E301C433FE for ; Mon, 24 Jan 2022 21:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354909AbiAXV4v (ORCPT ); Mon, 24 Jan 2022 16:56:51 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38674 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451061AbiAXVWE (ORCPT ); Mon, 24 Jan 2022 16:22:04 -0500 Received: from smtp.kernel.org (relay.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 46B10B81142; Mon, 24 Jan 2022 21:22:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FADBC340E4; Mon, 24 Jan 2022 21:22:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059322; bh=bLZe5OoYsGgnPbNAU3HWfa4F/i/GsLBmkpOXd9PxLn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dnz70WMr9VeKQsqNdX0/QHrsbC7a2bXqFteAbd30/qMcooB3wMw5hMoGcEisp5I4z 3OYrjQEbogcgoNjBdLGwp1FRa/l8Zx19lULy/2kNVKtqccrvHwNUdcFMjU9H4GZrms UhZRXfeIEmak48aUo08g2KUzPXIycrB/bX2LROw4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinh Nguyen , Borislav Petkov , Michal Simek , Sasha Levin Subject: [PATCH 5.16 0576/1039] EDAC/synopsys: Use the quirk for version instead of ddr version Date: Mon, 24 Jan 2022 19:39:25 +0100 Message-Id: <20220124184144.704959594@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dinh Nguyen [ Upstream commit bd1d6da17c296bd005bfa656952710d256e77dd3 ] Version 2.40a supports DDR_ECC_INTR_SUPPORT for a quirk, so use that quirk to determine a call to setup_address_map(). Signed-off-by: Dinh Nguyen Signed-off-by: Borislav Petkov Reviewed-by: Michal Simek Link: https://lkml.kernel.org/r/20211012190709.1504152-1-dinguyen@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/edac/synopsys_edac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c index 7d08627e738b3..a5486d86fdd2f 100644 --- a/drivers/edac/synopsys_edac.c +++ b/drivers/edac/synopsys_edac.c @@ -1352,8 +1352,7 @@ static int mc_probe(struct platform_device *pdev) } } =20 - if (of_device_is_compatible(pdev->dev.of_node, - "xlnx,zynqmp-ddrc-2.40a")) + if (priv->p_data->quirks & DDR_ECC_INTR_SUPPORT) setup_address_map(priv); #endif =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48B5DC47080 for ; Mon, 24 Jan 2022 23:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366827AbiAXXxj (ORCPT ); Mon, 24 Jan 2022 18:53:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846014AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 897FFC06127D; Mon, 24 Jan 2022 13:22:07 -0800 (PST) Received: from smtp.kernel.org (relay.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 50FB0B80FA1; Mon, 24 Jan 2022 21:22:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A116C340E5; Mon, 24 Jan 2022 21:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059325; bh=Yraa2Ik+sFawregwHtzg1NwMU7yrmYsObsjSXF+bWPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M4EdJbsZ76xEAy6nRAaU3YIVpWw63KJLH4kEtSNkB2YQvTMnZmF/PLu27hYseLA4j DJMbczVJq1j4zm5BmXCCyWsQKyx5Ckg2aWA8jrV6Sj6JG8LJkZuU9RXGz2T/Ef8WQt Z8pmNykXzxs28jLZb5QJ6iAiCm8tlFEcRAAxaMy0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.16 0577/1039] arm64: dts: qcom: sm[68]350: Use interrupts-extended with pdc interrupts Date: Mon, 24 Jan 2022 19:39:26 +0100 Message-Id: <20220124184144.735147743@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 9e7f7b65c7f04c5cfda97d6bd0d452a49e60f24e ] Using interrupts =3D <&pdc X Y> makes the interrupt framework interpret thi= s as the &pdc-nth range of the main interrupt controller (GIC). Fix it. Signed-off-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211114012755.112226-5-konrad.dybcio@somai= nline.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/qcom/sm6350.dtsi | 4 ++-- arch/arm64/boot/dts/qcom/sm8350.dtsi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sm6350.dtsi b/arch/arm64/boot/dts/qco= m/sm6350.dtsi index 973e18fe3b674..cd55797facf69 100644 --- a/arch/arm64/boot/dts/qcom/sm6350.dtsi +++ b/arch/arm64/boot/dts/qcom/sm6350.dtsi @@ -631,7 +631,7 @@ reg =3D <0 0x0c263000 0 0x1ff>, /* TM */ <0 0x0c222000 0 0x8>; /* SROT */ #qcom,sensors =3D <16>; - interrupts =3D <&pdc 26 IRQ_TYPE_LEVEL_HIGH>, + interrupts-extended =3D <&pdc 26 IRQ_TYPE_LEVEL_HIGH>, <&pdc 28 IRQ_TYPE_LEVEL_HIGH>; interrupt-names =3D "uplow", "critical"; #thermal-sensor-cells =3D <1>; @@ -642,7 +642,7 @@ reg =3D <0 0x0c265000 0 0x1ff>, /* TM */ <0 0x0c223000 0 0x8>; /* SROT */ #qcom,sensors =3D <16>; - interrupts =3D <&pdc 27 IRQ_TYPE_LEVEL_HIGH>, + interrupts-extended =3D <&pdc 27 IRQ_TYPE_LEVEL_HIGH>, <&pdc 29 IRQ_TYPE_LEVEL_HIGH>; interrupt-names =3D "uplow", "critical"; #thermal-sensor-cells =3D <1>; diff --git a/arch/arm64/boot/dts/qcom/sm8350.dtsi b/arch/arm64/boot/dts/qco= m/sm8350.dtsi index d134280e29390..a8c040c564096 100644 --- a/arch/arm64/boot/dts/qcom/sm8350.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8350.dtsi @@ -910,7 +910,7 @@ reg =3D <0 0x0c263000 0 0x1ff>, /* TM */ <0 0x0c222000 0 0x8>; /* SROT */ #qcom,sensors =3D <15>; - interrupts =3D <&pdc 26 IRQ_TYPE_LEVEL_HIGH>, + interrupts-extended =3D <&pdc 26 IRQ_TYPE_LEVEL_HIGH>, <&pdc 28 IRQ_TYPE_LEVEL_HIGH>; interrupt-names =3D "uplow", "critical"; #thermal-sensor-cells =3D <1>; @@ -921,7 +921,7 @@ reg =3D <0 0x0c265000 0 0x1ff>, /* TM */ <0 0x0c223000 0 0x8>; /* SROT */ #qcom,sensors =3D <14>; - interrupts =3D <&pdc 27 IRQ_TYPE_LEVEL_HIGH>, + interrupts-extended =3D <&pdc 27 IRQ_TYPE_LEVEL_HIGH>, <&pdc 29 IRQ_TYPE_LEVEL_HIGH>; interrupt-names =3D "uplow", "critical"; #thermal-sensor-cells =3D <1>; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F214C4167B for ; Mon, 24 Jan 2022 23:58:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366548AbiAXXxB (ORCPT ); Mon, 24 Jan 2022 18:53:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846016AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02A5FC061A83; Mon, 24 Jan 2022 13:22:09 -0800 (PST) Received: from smtp.kernel.org (relay.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 9526161469; Mon, 24 Jan 2022 21:22:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5D76C340E5; Mon, 24 Jan 2022 21:22:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059328; bh=Pubd9XPMb1C5VzQiXmeoVrk3Q+1SvW5q7o0MHI7eAGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tBWaCxsP6BMMUGT1CBIKE7Nwf8WQI+uy2h0E+ldS+xT9QWRzxocNBX/khqjc6m/5T Uk0CSiOEJ8tFO2mD4iE9F7h36yDO7+/AaIBJ8s7XUn16AjQu4qU/gR7wSkD8jkyBhP 7hFkQbeguNzucTeG6IZb6h6ABSs11rwTZL56sXCM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.16 0578/1039] arm64: dts: qcom: sm8350: Shorten camera-thermal-bottom name Date: Mon, 24 Jan 2022 19:39:27 +0100 Message-Id: <20220124184144.776109178@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit f52dd33943ca5f84ae76890f352f6d9e12512c3f ] Thermal zone names should not be longer than 20 names, which is indicated by a message at boot. Change "camera-thermal-bottom" to "cam-thermal-bottom" to fix it. Signed-off-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211114012755.112226-6-konrad.dybcio@somai= nline.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/qcom/sm8350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sm8350.dtsi b/arch/arm64/boot/dts/qco= m/sm8350.dtsi index a8c040c564096..c13858cf50dd2 100644 --- a/arch/arm64/boot/dts/qcom/sm8350.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8350.dtsi @@ -2447,7 +2447,7 @@ }; }; =20 - camera-thermal-bottom { + cam-thermal-bottom { polling-delay-passive =3D <250>; polling-delay =3D <1000>; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01FD9C4321E for ; Mon, 24 Jan 2022 23:58:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366724AbiAXXxY (ORCPT ); Mon, 24 Jan 2022 18:53:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846024AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09EF6C067A77; Mon, 24 Jan 2022 13:22:12 -0800 (PST) Received: from smtp.kernel.org (relay.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 9D00460C60; Mon, 24 Jan 2022 21:22:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B94FC340E4; Mon, 24 Jan 2022 21:22:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059331; bh=bk9nZDAqnO/Hmuv3stLRFANXP3OxWAyedFH4l31DiW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XGNZLZ/G81f4cs5w0gLYW8bNZNFR0VcAmOVVE3g7djEYLE5reCwba3WE6a/nOUZJe Y0dI9bcpLJbWSZFBIzYco3L/cMipG/64nKA5gTzPywRtv4fXMOl78I6vzIP8/lIRSo orcWL7Xdrc6dSmVo4rpZmzhxQXYLdf+Qh0sqbyKQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Frieder Schrempf , Lucas Stach , NXP Linux Team , Peng Fan , Shawn Guo , Sasha Levin Subject: [PATCH 5.16 0579/1039] soc: imx: gpcv2: Synchronously suspend MIX domains Date: Mon, 24 Jan 2022 19:39:28 +0100 Message-Id: <20220124184144.807597716@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 f756f435f7dd823f2d4bd593ce1bf3168def1308 ] In case the following power domain sequence happens, iMX8M Mini always hang= s: gpumix:on -> gpu:on -> gpu:off -> gpu:on This is likely due to another quirk of the GPC block. This situation can be prevented by always synchronously powering off both the domain and MIX doma= in. Make it so. This turns the aforementioned sequence into: gpumix:on -> gpu:on -> gpu:off -> gpumix:off -> gpumix:on -> gpu:on Signed-off-by: Marek Vasut Cc: Frieder Schrempf Cc: Lucas Stach Cc: NXP Linux Team Cc: Peng Fan Cc: Shawn Guo Acked-by: Lucas Stach Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/soc/imx/gpcv2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c index 7b6dfa33dcb9f..8176380b02e6e 100644 --- a/drivers/soc/imx/gpcv2.c +++ b/drivers/soc/imx/gpcv2.c @@ -377,7 +377,7 @@ static int imx_pgc_power_down(struct generic_pm_domain = *genpd) } } =20 - pm_runtime_put(domain->dev); + pm_runtime_put_sync_suspend(domain->dev); =20 return 0; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38377C35270 for ; Mon, 24 Jan 2022 23:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366853AbiAXXxl (ORCPT ); Mon, 24 Jan 2022 18:53:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846022AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19DEEC067A78; Mon, 24 Jan 2022 13:22:15 -0800 (PST) Received: from smtp.kernel.org (relay.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 A22B561469; Mon, 24 Jan 2022 21:22:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77B64C340E5; Mon, 24 Jan 2022 21:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059334; bh=S72zmxOG0k3L7U4zKehJLaSpMyumIyBnV8FZbTgUH0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=avMkpndoVQuWigQsiY/V/OP5DG0njWSTlVoPRUy9ODjnAuH5O1KCjX3k1HVRmhs9q o1gF8NX/CtnRlvK0yF1QT7Y/AoDwdre0h58Al2+MJkAsM31yc/b3Z5e/Ha1ISOGR5y zQh+tefodzTSfsbtS6IyH76I3tYHzkFBI5CQhmak= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Bulwahn , Arnd Bergmann , Shawn Guo , Sasha Levin Subject: [PATCH 5.16 0580/1039] ARM: imx: rename DEBUG_IMX21_IMX27_UART to DEBUG_IMX27_UART Date: Mon, 24 Jan 2022 19:39:29 +0100 Message-Id: <20220124184144.841835919@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Bulwahn [ Upstream commit b0100bce4ff82ec1ccd3c1f3d339fd2df6a81784 ] Since commit 4b563a066611 ("ARM: imx: Remove imx21 support"), the config DEBUG_IMX21_IMX27_UART is really only debug support for IMX27. So, rename this option to DEBUG_IMX27_UART and adjust dependencies in Kconfig and rename the definitions to IMX27 as further clean-up. This issue was discovered with ./scripts/checkkconfigsymbols.py, which reported that DEBUG_IMX21_IMX27_UART depends on the non-existing config SOC_IMX21. Signed-off-by: Lukas Bulwahn Reviewed-by: Arnd Bergmann Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/Kconfig.debug | 14 +++++++------- arch/arm/include/debug/imx-uart.h | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 98436702e0c7e..644875d73ba15 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -410,12 +410,12 @@ choice Say Y here if you want kernel low-level debugging support on i.MX25. =20 - config DEBUG_IMX21_IMX27_UART - bool "i.MX21 and i.MX27 Debug UART" - depends on SOC_IMX21 || SOC_IMX27 + config DEBUG_IMX27_UART + bool "i.MX27 Debug UART" + depends on SOC_IMX27 help Say Y here if you want kernel low-level debugging support - on i.MX21 or i.MX27. + on i.MX27. =20 config DEBUG_IMX28_UART bool "i.MX28 Debug UART" @@ -1481,7 +1481,7 @@ config DEBUG_IMX_UART_PORT int "i.MX Debug UART Port Selection" depends on DEBUG_IMX1_UART || \ DEBUG_IMX25_UART || \ - DEBUG_IMX21_IMX27_UART || \ + DEBUG_IMX27_UART || \ DEBUG_IMX31_UART || \ DEBUG_IMX35_UART || \ DEBUG_IMX50_UART || \ @@ -1540,12 +1540,12 @@ config DEBUG_LL_INCLUDE default "debug/icedcc.S" if DEBUG_ICEDCC default "debug/imx.S" if DEBUG_IMX1_UART || \ DEBUG_IMX25_UART || \ - DEBUG_IMX21_IMX27_UART || \ + DEBUG_IMX27_UART || \ DEBUG_IMX31_UART || \ DEBUG_IMX35_UART || \ DEBUG_IMX50_UART || \ DEBUG_IMX51_UART || \ - DEBUG_IMX53_UART ||\ + DEBUG_IMX53_UART || \ DEBUG_IMX6Q_UART || \ DEBUG_IMX6SL_UART || \ DEBUG_IMX6SX_UART || \ diff --git a/arch/arm/include/debug/imx-uart.h b/arch/arm/include/debug/imx= -uart.h index c8eb83d4b8964..3edbb3c5b42bf 100644 --- a/arch/arm/include/debug/imx-uart.h +++ b/arch/arm/include/debug/imx-uart.h @@ -11,13 +11,6 @@ #define IMX1_UART_BASE_ADDR(n) IMX1_UART##n##_BASE_ADDR #define IMX1_UART_BASE(n) IMX1_UART_BASE_ADDR(n) =20 -#define IMX21_UART1_BASE_ADDR 0x1000a000 -#define IMX21_UART2_BASE_ADDR 0x1000b000 -#define IMX21_UART3_BASE_ADDR 0x1000c000 -#define IMX21_UART4_BASE_ADDR 0x1000d000 -#define IMX21_UART_BASE_ADDR(n) IMX21_UART##n##_BASE_ADDR -#define IMX21_UART_BASE(n) IMX21_UART_BASE_ADDR(n) - #define IMX25_UART1_BASE_ADDR 0x43f90000 #define IMX25_UART2_BASE_ADDR 0x43f94000 #define IMX25_UART3_BASE_ADDR 0x5000c000 @@ -26,6 +19,13 @@ #define IMX25_UART_BASE_ADDR(n) IMX25_UART##n##_BASE_ADDR #define IMX25_UART_BASE(n) IMX25_UART_BASE_ADDR(n) =20 +#define IMX27_UART1_BASE_ADDR 0x1000a000 +#define IMX27_UART2_BASE_ADDR 0x1000b000 +#define IMX27_UART3_BASE_ADDR 0x1000c000 +#define IMX27_UART4_BASE_ADDR 0x1000d000 +#define IMX27_UART_BASE_ADDR(n) IMX27_UART##n##_BASE_ADDR +#define IMX27_UART_BASE(n) IMX27_UART_BASE_ADDR(n) + #define IMX31_UART1_BASE_ADDR 0x43f90000 #define IMX31_UART2_BASE_ADDR 0x43f94000 #define IMX31_UART3_BASE_ADDR 0x5000c000 @@ -112,10 +112,10 @@ =20 #ifdef CONFIG_DEBUG_IMX1_UART #define UART_PADDR IMX_DEBUG_UART_BASE(IMX1) -#elif defined(CONFIG_DEBUG_IMX21_IMX27_UART) -#define UART_PADDR IMX_DEBUG_UART_BASE(IMX21) #elif defined(CONFIG_DEBUG_IMX25_UART) #define UART_PADDR IMX_DEBUG_UART_BASE(IMX25) +#elif defined(CONFIG_DEBUG_IMX27_UART) +#define UART_PADDR IMX_DEBUG_UART_BASE(IMX27) #elif defined(CONFIG_DEBUG_IMX31_UART) #define UART_PADDR IMX_DEBUG_UART_BASE(IMX31) #elif defined(CONFIG_DEBUG_IMX35_UART) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EEFBC41535 for ; Mon, 24 Jan 2022 21:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574467AbiAXV5j (ORCPT ); Mon, 24 Jan 2022 16:57:39 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44732 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451155AbiAXVWS (ORCPT ); Mon, 24 Jan 2022 16:22:18 -0500 Received: from smtp.kernel.org (relay.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 8B68861469; Mon, 24 Jan 2022 21:22:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70DE1C340E4; Mon, 24 Jan 2022 21:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059337; bh=HFolmNo+c+aMlXO4NpVNNdLLeHerT2CSqgdw0YSR8sc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PS1WVTHwgWsa3AXLC/FIFz+X8dECP8jyRRpaTelFkbfI6mijmzmqZS/bp36XV7ABA yLS+Y3f7Rf78AW0uGrhtgjWjnDvtt9oawO3/x/PcjkvMfnlqOFe+Uf2hTjcwb1aYxx Yy06IiGLnHuNZ4HejDAZ3XAQAsPFWyYbIXLqpkpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anilkumar Kolli , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0581/1039] ath11k: Fix mon status ring rx tlv processing Date: Mon, 24 Jan 2022 19:39:30 +0100 Message-Id: <20220124184144.872005397@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Anilkumar Kolli [ Upstream commit 09f16f7390f302937409738d6cb6ce99b265f455 ] In HE monitor capture, HAL_TLV_STATUS_PPDU_DONE is received on processing multiple skb. Do not clear the ppdu_info till the HAL_TLV_STATUS_PPDU_DONE is received. This fixes below warning and packet drops in monitor mode. "Rate marked as an HE rate but data is invalid: MCS: 6, NSS: 0" WARNING: at PC is at ieee80211_rx_napi+0x624/0x840 [mac80211] Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01693-QCAHKSWPL_SILICONZ-1 Signed-off-by: Anilkumar Kolli Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1637249433-10316-1-git-send-email-akolli@co= deaurora.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/dp_rx.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless= /ath/ath11k/dp_rx.c index 22b6b6a470d4c..621372c568d2c 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -3064,10 +3064,10 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_b= ase *ab, int mac_id, if (!num_buffs_reaped) goto exit; =20 - while ((skb =3D __skb_dequeue(&skb_list))) { - memset(&ppdu_info, 0, sizeof(ppdu_info)); - ppdu_info.peer_id =3D HAL_INVALID_PEERID; + memset(&ppdu_info, 0, sizeof(ppdu_info)); + ppdu_info.peer_id =3D HAL_INVALID_PEERID; =20 + while ((skb =3D __skb_dequeue(&skb_list))) { if (ath11k_debugfs_is_pktlog_lite_mode_enabled(ar)) { log_type =3D ATH11K_PKTLOG_TYPE_LITE_RX; rx_buf_sz =3D DP_RX_BUFFER_SIZE_LITE; @@ -3095,10 +3095,7 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_ba= se *ab, int mac_id, ath11k_dbg(ab, ATH11K_DBG_DATA, "failed to find the peer with peer_id %d\n", ppdu_info.peer_id); - spin_unlock_bh(&ab->base_lock); - rcu_read_unlock(); - dev_kfree_skb_any(skb); - continue; + goto next_skb; } =20 arsta =3D (struct ath11k_sta *)peer->sta->drv_priv; @@ -3107,10 +3104,13 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_b= ase *ab, int mac_id, if (ath11k_debugfs_is_pktlog_peer_valid(ar, peer->addr)) trace_ath11k_htt_rxdesc(ar, skb->data, log_type, rx_buf_sz); =20 +next_skb: spin_unlock_bh(&ab->base_lock); rcu_read_unlock(); =20 dev_kfree_skb_any(skb); + memset(&ppdu_info, 0, sizeof(ppdu_info)); + ppdu_info.peer_id =3D HAL_INVALID_PEERID; } exit: return num_buffs_reaped; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 907AAC433F5 for ; Mon, 24 Jan 2022 22:09:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580267AbiAXWJK (ORCPT ); Mon, 24 Jan 2022 17:09:10 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45782 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452251AbiAXVY0 (ORCPT ); Mon, 24 Jan 2022 16:24:26 -0500 Received: from smtp.kernel.org (relay.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 99970614D8; Mon, 24 Jan 2022 21:24:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E80DC340E4; Mon, 24 Jan 2022 21:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059465; bh=3v1HE+aP+jyFLtVWiJY2W1IvFFukw8FwMDbrTfFOkGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hHo8PGzq+IU4hyJFlLgS3jDOMSBuqIS8t0bnA8frwVI/UlRdrDHMuPdchflbcCCRy iMn+/KWwe8V27kHkQHLS/xcPGcIBC+omKgk3S4qDvZXDgp/ih/YyJLPdBc+SSoFN9s GyNaaOlTxbOr/0ZOgu8NWyy/k6sfnxicr9GQaoSg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abaci Robot , Yang Li , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0582/1039] drm/amd/display: check top_pipe_to_program pointer Date: Mon, 24 Jan 2022 19:39:31 +0100 Message-Id: <20220124184144.909444563@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Li [ Upstream commit a689e8d1f80012f90384ebac9dcfac4201f9f77e ] Clang static analysis reports this error drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:2870:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference] if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { ^ top_pipe_to_program being NULL is caught as an error But then it is used to report the error. So add a check before using it. Reported-by: Abaci Robot Signed-off-by: Yang Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd= /display/dc/core/dc.c index 0ded4decee05f..f0fbd8ad56229 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2870,7 +2870,8 @@ static void commit_planes_for_stream(struct dc *dc, #endif =20 if ((update_type !=3D UPDATE_TYPE_FAST) && stream->update_flags.bits.dsc_= changed) - if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable)= { + if (top_pipe_to_program && + top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { if (should_use_dmub_lock(stream->link)) { union dmub_hw_lock_flags hw_locks =3D { 0 }; struct dmub_hw_lock_inst_flags inst_flags =3D { 0 }; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D4D0C4332F for ; Mon, 24 Jan 2022 22:03:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577324AbiAXV7w (ORCPT ); Mon, 24 Jan 2022 16:59:52 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43272 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451345AbiAXVWn (ORCPT ); Mon, 24 Jan 2022 16:22:43 -0500 Received: from smtp.kernel.org (relay.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 C269D61305; Mon, 24 Jan 2022 21:22:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1C15C340E4; Mon, 24 Jan 2022 21:22:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059362; bh=K1P0TxYjsDj04lZnqfKDF20Wp9vKSWilXUlbwfumO/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ggKcWDDidZeyN8vLWMo08nX3+1CWwm+jCx69VNzwC4koWY+l3BuB9aQAZN8Y3m7Ps D+YWRohe0jzSc4A5GPlDJLKd+6cu50NnOMD3kCyFX8+VXK9pnzVow4PICQUe4kcDso 9E9kCPpQrpgp+T5JYopAnwiWaRYD/lpIpAJi0VFo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Wentland , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0583/1039] drm/amdgpu/display: set vblank_disable_immediate for DC Date: Mon, 24 Jan 2022 19:39:32 +0100 Message-Id: <20220124184144.945945777@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 92020e81ddbeac351ea4a19bcf01743f32b9c800 ] Disable vblanks immediately to save power. I think this was missed when we merged DC support. Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1781 Reviewed-by: Harry Wentland Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 1 - drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_irq.c index cc2e0c9cfe0a1..4f3c62adccbde 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c @@ -333,7 +333,6 @@ int amdgpu_irq_init(struct amdgpu_device *adev) if (!amdgpu_device_has_dc_support(adev)) { if (!adev->enable_virtual_display) /* Disable vblank IRQs aggressively for power-saving */ - /* XXX: can this be enabled for DC? */ adev_to_drm(adev)->vblank_disable_immediate =3D true; =20 r =3D drm_vblank_init(adev_to_drm(adev), adev->mode_info.num_crtc); diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gp= u/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 05f7ffd6a28da..e12f841d1d110 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1597,6 +1597,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) adev_to_drm(adev)->mode_config.cursor_width =3D adev->dm.dc->caps.max_cur= sor_size; adev_to_drm(adev)->mode_config.cursor_height =3D adev->dm.dc->caps.max_cu= rsor_size; =20 + /* Disable vblank IRQs aggressively for power-saving */ + adev_to_drm(adev)->vblank_disable_immediate =3D true; + if (drm_vblank_init(adev_to_drm(adev), adev->dm.display_indexes_num)) { DRM_ERROR( "amdgpu: failed to initialize sw for display support.\n"); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B129DC4167E for ; Mon, 24 Jan 2022 22:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580903AbiAXWK4 (ORCPT ); Mon, 24 Jan 2022 17:10:56 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45156 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451656AbiAXVXQ (ORCPT ); Mon, 24 Jan 2022 16:23:16 -0500 Received: from smtp.kernel.org (relay.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 2E74A6136E; Mon, 24 Jan 2022 21:23:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3F42C340E4; Mon, 24 Jan 2022 21:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059395; bh=f8+DzzjtvvnxDthTcjNQ/23aDxrL03Fv6o1cZ2WdV3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n5v/miXOtIt+Dcc8GXglTlcoEc5SbcWOWjUIzB1InQ7K8CM2uc9l83otgHby1G2i3 2HXXLf3pvuc3JfriGouc564BdexQPCV/TqsrOuEevoxUkop57j8ZYUGCpQUAvsdV+e Cv8MoIxmT5sVXno+5blKaHbWV5pNarbhhaQHQTkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kiszka , Suman Anna , Nishanth Menon , Sasha Levin Subject: [PATCH 5.16 0584/1039] soc: ti: pruss: fix referenced node in error message Date: Mon, 24 Jan 2022 19:39:33 +0100 Message-Id: <20220124184144.976566063@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kiszka [ Upstream commit 8aa35e0bb5eaa42bac415ad0847985daa7b4890c ] So far, "(null)" is reported for the node that is missing clocks. Signed-off-by: Jan Kiszka Acked-by: Suman Anna Signed-off-by: Nishanth Menon Link: https://lore.kernel.org/r/d6e24953-ea89-fd1c-6e16-7a0142118054@siemen= s.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/soc/ti/pruss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c index 49da387d77494..b36779309e49b 100644 --- a/drivers/soc/ti/pruss.c +++ b/drivers/soc/ti/pruss.c @@ -129,7 +129,7 @@ static int pruss_clk_init(struct pruss *pruss, struct d= evice_node *cfg_node) =20 clks_np =3D of_get_child_by_name(cfg_node, "clocks"); if (!clks_np) { - dev_err(dev, "%pOF is missing its 'clocks' node\n", clks_np); + dev_err(dev, "%pOF is missing its 'clocks' node\n", cfg_node); return -ENODEV; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14B48C47081 for ; Mon, 24 Jan 2022 22:06:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579742AbiAXWGQ (ORCPT ); Mon, 24 Jan 2022 17:06:16 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45430 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451945AbiAXVXu (ORCPT ); Mon, 24 Jan 2022 16:23:50 -0500 Received: from smtp.kernel.org (relay.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 8F32A614C7; Mon, 24 Jan 2022 21:23:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79564C340E4; Mon, 24 Jan 2022 21:23:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059429; bh=y1BrdKWyVxffW81kGbIO98I+Zu2GchAttOjh6y8BlKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XGk7f0pRzc1oGT7XwESv3olP6G0S+ieJzFgLKRSzX1/dsW3/0Nb31wIydESvvVShF 8ZXbM4rsEmv164QHrcbhnbK25O4Si7lWfphtt1LrZOsNJQFQkBKpSMO3elinlKkAMd 54t04goGLdVK1Bbnufbl+KqsFR8GKjed3mx9AWWM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Biederman , Danielle Ratson , Ido Schimmel , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0585/1039] mlxsw: pci: Add shutdown method in PCI driver Date: Mon, 24 Jan 2022 19:39:34 +0100 Message-Id: <20220124184145.007666353@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Danielle Ratson [ Upstream commit c1020d3cf4752f61a6a413f632ea2ce2370e150d ] On an arm64 platform with the Spectrum ASIC, after loading and executing a new kernel via kexec, the following trace [1] is observed. This seems to be caused by the fact that the device is not properly shutdown before executing the new kernel. Fix this by implementing a shutdown method which mirrors the remove method, as recommended by the kexec maintainer [2][3]. [1] BUG: Bad page state in process devlink pfn:22f73d page:fffffe00089dcf40 refcount:-1 mapcount:0 mapping:0000000000000000 index= :0x0 flags: 0x2ffff00000000000() raw: 2ffff00000000000 0000000000000000 ffffffff089d0201 0000000000000000 raw: 0000000000000000 0000000000000000 ffffffffffffffff 0000000000000000 page dumped because: nonzero _refcount Modules linked in: CPU: 1 PID: 16346 Comm: devlink Tainted: G B 5.8.0-rc6-custom-273020-gac6b3= 65b1bf5 #44 Hardware name: Marvell Armada 7040 TX4810M (DT) Call trace: dump_backtrace+0x0/0x1d0 show_stack+0x1c/0x28 dump_stack+0xbc/0x118 bad_page+0xcc/0xf8 check_free_page_bad+0x80/0x88 __free_pages_ok+0x3f8/0x418 __free_pages+0x38/0x60 kmem_freepages+0x200/0x2a8 slab_destroy+0x28/0x68 slabs_destroy+0x60/0x90 ___cache_free+0x1b4/0x358 kfree+0xc0/0x1d0 skb_free_head+0x2c/0x38 skb_release_data+0x110/0x1a0 skb_release_all+0x2c/0x38 consume_skb+0x38/0x130 __dev_kfree_skb_any+0x44/0x50 mlxsw_pci_rdq_fini+0x8c/0xb0 mlxsw_pci_queue_fini.isra.0+0x28/0x58 mlxsw_pci_queue_group_fini+0x58/0x88 mlxsw_pci_aqs_fini+0x2c/0x60 mlxsw_pci_fini+0x34/0x50 mlxsw_core_bus_device_unregister+0x104/0x1d0 mlxsw_devlink_core_bus_device_reload_down+0x2c/0x48 devlink_reload+0x44/0x158 devlink_nl_cmd_reload+0x270/0x290 genl_rcv_msg+0x188/0x2f0 netlink_rcv_skb+0x5c/0x118 genl_rcv+0x3c/0x50 netlink_unicast+0x1bc/0x278 netlink_sendmsg+0x194/0x390 __sys_sendto+0xe0/0x158 __arm64_sys_sendto+0x2c/0x38 el0_svc_common.constprop.0+0x70/0x168 do_el0_svc+0x28/0x88 el0_sync_handler+0x88/0x190 el0_sync+0x140/0x180 [2] https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1195432.html [3] https://patchwork.kernel.org/project/linux-scsi/patch/20170212214920.28866-= 1-anton@ozlabs.org/#20116693 Cc: Eric Biederman Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlxsw/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethern= et/mellanox/mlxsw/pci.c index a15c95a10bae4..cd3331a077bbf 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -1973,6 +1973,7 @@ int mlxsw_pci_driver_register(struct pci_driver *pci_= driver) { pci_driver->probe =3D mlxsw_pci_probe; pci_driver->remove =3D mlxsw_pci_remove; + pci_driver->shutdown =3D mlxsw_pci_remove; return pci_register_driver(pci_driver); } EXPORT_SYMBOL(mlxsw_pci_driver_register); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A5DAC3526F for ; Mon, 24 Jan 2022 23:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367858AbiAXX4m (ORCPT ); Mon, 24 Jan 2022 18:56:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846416AbiAXXPz (ORCPT ); Mon, 24 Jan 2022 18:15:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63D25C0604CF; Mon, 24 Jan 2022 13:24:08 -0800 (PST) Received: from smtp.kernel.org (relay.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 00622614C9; Mon, 24 Jan 2022 21:24:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7FA4C340E4; Mon, 24 Jan 2022 21:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059447; bh=REBuG4OoCqpO2dEgywiMEnlKX2lH4hWXFOcoOtaLmws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kqBIs3K9j84lHej5as9GL+6WVJSycKSmxuAcTRR0T0lx4NhT4mMF07BvgjsNx58mF PUfwTf2Zw13BYolNN4Nt6OO4hC6Rd0Q9eVWpHSL5wkBRx5z1tsj9+fUFuasAXZbO+m xdnv5Iwgc00+ED6VNRax7p1gs/djwWobx6WwxcGY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aric Cyr , Qingqing Zhuo , Martin Leung , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0586/1039] drm/amd/display: add else to avoid double destroy clk_mgr Date: Mon, 24 Jan 2022 19:39:35 +0100 Message-Id: <20220124184145.038092690@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Martin Leung [ Upstream commit 11dff0e871037a6ad978e52f826a2eb7f5fb274a ] [Why & How] when changing some code we accidentally changed else if-> if. reverting that. Reviewed-by: Aric Cyr Acked-by: Qingqing Zhuo Signed-off-by: Martin Leung Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c b/drivers/gpu= /drm/amd/display/dc/clk_mgr/clk_mgr.c index 26f96ee324729..9200c8ce02ba9 100644 --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c @@ -308,8 +308,7 @@ void dc_destroy_clk_mgr(struct clk_mgr *clk_mgr_base) case FAMILY_NV: if (ASICREV_IS_SIENNA_CICHLID_P(clk_mgr_base->ctx->asic_id.hw_internal_r= ev)) { dcn3_clk_mgr_destroy(clk_mgr); - } - if (ASICREV_IS_DIMGREY_CAVEFISH_P(clk_mgr_base->ctx->asic_id.hw_internal= _rev)) { + } else if (ASICREV_IS_DIMGREY_CAVEFISH_P(clk_mgr_base->ctx->asic_id.hw_i= nternal_rev)) { dcn3_clk_mgr_destroy(clk_mgr); } if (ASICREV_IS_BEIGE_GOBY_P(clk_mgr_base->ctx->asic_id.hw_internal_rev))= { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C56C9C47085 for ; Mon, 24 Jan 2022 22:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579789AbiAXWG5 (ORCPT ); Mon, 24 Jan 2022 17:06:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40736 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452170AbiAXVYN (ORCPT ); Mon, 24 Jan 2022 16:24:13 -0500 Received: from smtp.kernel.org (relay.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 8C163B812A4; Mon, 24 Jan 2022 21:24:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B17D0C340E4; Mon, 24 Jan 2022 21:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059450; bh=rko4MC36AgJP3EXLrY5Ps0LX8nTKm3wAjDd0/UzRWcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TaKpjXxbJqINz/RlkxGn6NtIb2BTZTKRkX7qVPK0Rz6vFWoSGwmsbNUCyIxoGnUbt oKjyR7e8Eim+VujcoruVp6yHvY8IwzFRK17QcyiMD2mqmW077+aWoi55+ik1EkZqCj tbWEAA4EzxVGF0Tb9gEHypWdalCpnGLp2LZ2vNH8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martyn Welch , Peter Senna Tschudin , Martyn Welch , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sasha Levin Subject: [PATCH 5.16 0587/1039] drm/bridge: megachips: Ensure both bridges are probed before registration Date: Mon, 24 Jan 2022 19:39:36 +0100 Message-Id: <20220124184145.071229573@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Martyn Welch [ Upstream commit 11632d4aa2b3f126790e81a4415d6c23103cf8bb ] In the configuration used by the b850v3, the STDP2690 is used to read EDID data whilst it's the STDP4028 which can detect when monitors are connected. This can result in problems at boot with monitors connected when the STDP4028 is probed first, a monitor is detected and an attempt is made to read the EDID data before the STDP2690 has probed: [ 3.795721] Unable to handle kernel NULL pointer dereference at virtual = address 00000018 [ 3.803845] pgd =3D (ptrval) [ 3.806581] [00000018] *pgd=3D00000000 [ 3.810180] Internal error: Oops: 5 [#1] SMP ARM [ 3.814813] Modules linked in: [ 3.817879] CPU: 0 PID: 64 Comm: kworker/u4:1 Not tainted 5.15.0 #1 [ 3.824161] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [ 3.830705] Workqueue: events_unbound deferred_probe_work_func [ 3.836565] PC is at stdp2690_get_edid+0x44/0x19c [ 3.841286] LR is at ge_b850v3_lvds_get_modes+0x2c/0x5c [ 3.846526] pc : [<805eae10>] lr : [<805eb138>] psr: 80000013 [ 3.852802] sp : 81c359d0 ip : 7dbb550b fp : 81c35a1c [ 3.858037] r10: 81c73840 r9 : 81c73894 r8 : 816d9800 [ 3.863270] r7 : 00000000 r6 : 81c34000 r5 : 00000000 r4 : 810c35f0 [ 3.869808] r3 : 80e3e294 r2 : 00000080 r1 : 00000cc0 r0 : 81401180 [ 3.876349] Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment= none [ 3.883499] Control: 10c5387d Table: 1000404a DAC: 00000051 [ 3.889254] Register r0 information: slab kmem_cache start 81401180 poin= ter offset 0 [ 3.897034] Register r1 information: non-paged memory [ 3.902097] Register r2 information: non-paged memory [ 3.907160] Register r3 information: non-slab/vmalloc memory [ 3.912832] Register r4 information: non-slab/vmalloc memory [ 3.918503] Register r5 information: NULL pointer [ 3.923217] Register r6 information: non-slab/vmalloc memory [ 3.928887] Register r7 information: NULL pointer [ 3.933601] Register r8 information: slab kmalloc-1k start 816d9800 poin= ter offset 0 size 1024 [ 3.942244] Register r9 information: slab kmalloc-2k start 81c73800 poin= ter offset 148 size 2048 [ 3.951058] Register r10 information: slab kmalloc-2k start 81c73800 poi= nter offset 64 size 2048 [ 3.959873] Register r11 information: non-slab/vmalloc memory [ 3.965632] Register r12 information: non-paged memory [ 3.970781] Process kworker/u4:1 (pid: 64, stack limit =3D 0x(ptrval)) [ 3.977148] Stack: (0x81c359d0 to 0x81c36000) [ 3.981517] 59c0: 80b2b668 80b2b5bc = 000002e2 0000034e [ 3.989712] 59e0: 81c35a8c 816d98e8 81c35a14 7dbb550b 805bfcd0 810c35f0 = 81c73840 824addc0 [ 3.997906] 5a00: 00001000 816d9800 81c73894 81c73840 81c35a34 81c35a20 = 805eb138 805eadd8 [ 4.006099] 5a20: 810c35f0 00000045 81c35adc 81c35a38 80594188 805eb118 = 80d7c788 80dd1848 [ 4.014292] 5a40: 00000000 81c35a50 80dca950 811194d3 80dca7c4 80dca944 = 80dca91c 816d9800 [ 4.022485] 5a60: 81c34000 81c760a8 816d9800 80c58c98 810c35f0 816d98e8 = 00001000 00001000 [ 4.030678] 5a80: 00000000 00000000 8017712c 81c60000 00000002 00000001 = 00000000 00000000 [ 4.038870] 5aa0: 816d9900 816d9900 00000000 7dbb550b 805c700c 00000008 = 826282c8 826282c8 [ 4.047062] 5ac0: 00001000 81e1ce40 00001000 00000002 81c35bf4 81c35ae0 = 805d9694 80593fc0 [ 4.055255] 5ae0: 8017a970 80179ad8 00000179 00000000 81c35bcc 81c35b00 = 80177108 8017a950 [ 4.063447] 5b00: 00000000 81c35b10 81c34000 00000000 81004fd8 81010a38 = 00000000 00000059 [ 4.071639] 5b20: 816d98d4 81fbb718 00000013 826282c8 8017a940 81c35b40 = 81134448 00000400 [ 4.079831] 5b40: 00000178 00000000 e063b9c1 00000000 c2000049 00000040 = 00000000 00000008 [ 4.088024] 5b60: 82628300 82628380 00000000 00000000 81c34000 00000000 = 81fbb700 82628340 [ 4.096216] 5b80: 826283c0 00001000 00000000 00000010 816d9800 826282c0 = 801766f8 00000000 [ 4.104408] 5ba0: 00000000 81004fd8 00000049 00000000 00000000 00000001 = 80dcf940 80178de4 [ 4.112601] 5bc0: 81c35c0c 7dbb550b 80178de4 81fbb700 00000010 00000010 = 810c35f4 81e1ce40 [ 4.120793] 5be0: 81c40908 0000000c 81c35c64 81c35bf8 805a7f18 805d94a0 = 81c35c3c 816d9800 [ 4.128985] 5c00: 00000010 81c34000 81c35c2c 81c35c18 8012fce0 805be90c = 81c35c3c 81c35c28 [ 4.137178] 5c20: 805be90c 80173210 81fbb600 81fbb6b4 81c35c5c 7dbb550b = 81c35c64 81fbb700 [ 4.145370] 5c40: 816d9800 00000010 810c35f4 81e1ce40 81c40908 0000000c = 81c35c84 81c35c68 [ 4.153565] 5c60: 805a8c78 805a7ed0 816d9800 81fbb700 00000010 00000000 = 81c35cac 81c35c88 [ 4.161758] 5c80: 805a8dc4 805a8b68 816d9800 00000000 816d9800 00000000 = 8179f810 810c42d0 [ 4.169950] 5ca0: 81c35ccc 81c35cb0 805e47b0 805a8d18 824aa240 81e1ea80 = 81c40908 81126b60 [ 4.178144] 5cc0: 81c35d14 81c35cd0 8060db1c 805e46cc 81c35d14 81c35ce0 = 80dd90f8 810c4d58 [ 4.186338] 5ce0: 80dd90dc 81fe9740 fffffffe 81fe9740 81e1ea80 00000000 = 810c4d6c 80c4b95c [ 4.194531] 5d00: 80dd9a3c 815c6810 81c35d34 81c35d18 8060dc9c 8060d8fc = 8246b440 815c6800 [ 4.202724] 5d20: 815c6810 eefd8e00 81c35d44 81c35d38 8060dd80 8060dbec = 81c35d6c 81c35d48 [ 4.210918] 5d40: 805e98a4 8060dd70 00000000 815c6810 810c45b0 81126e90 = 81126e90 80dd9a3c [ 4.219112] 5d60: 81c35d8c 81c35d70 80619574 805e9808 815c6810 00000000 = 810c45b0 81126e90 [ 4.227305] 5d80: 81c35db4 81c35d90 806168dc 80619514 80625df0 80623c80 = 815c6810 810c45b0 [ 4.235498] 5da0: 81c35e6c 815c6810 81c35dec 81c35db8 80616d04 80616800 = 81c35de4 81c35dc8 [ 4.243691] 5dc0: 808382b0 80b2f444 8116e310 8116e314 81c35e6c 815c6810 = 00000003 80dd9a3c [ 4.251884] 5de0: 81c35e14 81c35df0 80616ec8 80616c60 00000001 810c45b0 = 81c35e6c 815c6810 [ 4.260076] 5e00: 00000001 80dd9a3c 81c35e34 81c35e18 80617338 80616e90 = 00000000 81c35e6c [ 4.268269] 5e20: 80617284 81c34000 81c35e64 81c35e38 80614730 80617290 = 81c35e64 8171a06c [ 4.276461] 5e40: 81e220b8 7dbb550b 815c6810 81c34000 815c6854 81126e90 = 81c35e9c 81c35e68 [ 4.284654] 5e60: 8061673c 806146a8 8060f5e0 815c6810 00000001 7dbb550b = 00000000 810c5080 [ 4.292847] 5e80: 810c5320 815c6810 81126e90 00000000 81c35eac 81c35ea0 = 80617554 80616650 [ 4.301040] 5ea0: 81c35ecc 81c35eb0 80615694 80617544 810c5080 810c5080 = 810c5094 81126e90 [ 4.309233] 5ec0: 81c35efc 81c35ed0 80615c6c 8061560c 80615bc0 810c50c0 = 817eeb00 81412800 [ 4.317425] 5ee0: 814c3000 00000000 814c300d 81119a60 81c35f3c 81c35f00 = 80141488 80615bcc [ 4.325618] 5f00: 81c60000 81c34000 81c35f24 81c35f18 80143078 817eeb00 = 81412800 817eeb18 [ 4.333811] 5f20: 81412818 81003d00 00000088 81412800 81c35f74 81c35f40 = 80141a48 80141298 [ 4.342005] 5f40: 81c35f74 81c34000 801481ac 817efa40 817efc00 801417d8 = 817eeb00 00000000 [ 4.350199] 5f60: 815a7e7c 81c34000 81c35fac 81c35f78 80149b1c 801417e4 = 817efc20 817efc20 [ 4.358391] 5f80: ffffe000 817efa40 801499a8 00000000 00000000 00000000 = 00000000 00000000 [ 4.366583] 5fa0: 00000000 81c35fb0 80100130 801499b4 00000000 00000000 = 00000000 00000000 [ 4.374774] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 = 00000000 00000000 [ 4.382966] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 = 00000000 00000000 [ 4.391155] Backtrace: [ 4.393613] [<805eadcc>] (stdp2690_get_edid) from [<805eb138>] (ge_b850v= 3_lvds_get_modes+0x2c/0x5c) [ 4.402691] r10:81c73840 r9:81c73894 r8:816d9800 r7:00001000 r6:824addc= 0 r5:81c73840 [ 4.410534] r4:810c35f0 [ 4.413073] [<805eb10c>] (ge_b850v3_lvds_get_modes) from [<80594188>] (d= rm_helper_probe_single_connector_modes+0x1d4/0x84c) [ 4.424240] r5:00000045 r4:810c35f0 [ 4.427822] [<80593fb4>] (drm_helper_probe_single_connector_modes) from = [<805d9694>] (drm_client_modeset_probe+0x200/0x1384) [ 4.439074] r10:00000002 r9:00001000 r8:81e1ce40 r7:00001000 r6:826282c= 8 r5:826282c8 [ 4.446917] r4:00000008 [ 4.449455] [<805d9494>] (drm_client_modeset_probe) from [<805a7f18>] (_= _drm_fb_helper_initial_config_and_unlock+0x54/0x5b4) [ 4.460713] r10:0000000c r9:81c40908 r8:81e1ce40 r7:810c35f4 r6:0000001= 0 r5:00000010 [ 4.468556] r4:81fbb700 [ 4.471095] [<805a7ec4>] (__drm_fb_helper_initial_config_and_unlock) fro= m [<805a8c78>] (drm_fbdev_client_hotplug+0x11c/0x1b0) [ 4.482434] r10:0000000c r9:81c40908 r8:81e1ce40 r7:810c35f4 r6:0000001= 0 r5:816d9800 [ 4.490276] r4:81fbb700 [ 4.492814] [<805a8b5c>] (drm_fbdev_client_hotplug) from [<805a8dc4>] (d= rm_fbdev_generic_setup+0xb8/0x1a4) [ 4.502494] r7:00000000 r6:00000010 r5:81fbb700 r4:816d9800 [ 4.508160] [<805a8d0c>] (drm_fbdev_generic_setup) from [<805e47b0>] (im= x_drm_bind+0xf0/0x130) [ 4.516805] r7:810c42d0 r6:8179f810 r5:00000000 r4:816d9800 [ 4.522474] [<805e46c0>] (imx_drm_bind) from [<8060db1c>] (try_to_bring_= up_master+0x22c/0x2f0) [ 4.531116] r7:81126b60 r6:81c40908 r5:81e1ea80 r4:824aa240 [ 4.536783] [<8060d8f0>] (try_to_bring_up_master) from [<8060dc9c>] (__c= omponent_add+0xbc/0x184) [ 4.545597] r10:815c6810 r9:80dd9a3c r8:80c4b95c r7:810c4d6c r6:0000000= 0 r5:81e1ea80 [ 4.553440] r4:81fe9740 [ 4.555980] [<8060dbe0>] (__component_add) from [<8060dd80>] (component_= add+0x1c/0x20) [ 4.563921] r7:eefd8e00 r6:815c6810 r5:815c6800 r4:8246b440 [ 4.569589] [<8060dd64>] (component_add) from [<805e98a4>] (dw_hdmi_imx_= probe+0xa8/0xe8) [ 4.577702] [<805e97fc>] (dw_hdmi_imx_probe) from [<80619574>] (platform= _probe+0x6c/0xc8) [ 4.585908] r9:80dd9a3c r8:81126e90 r7:81126e90 r6:810c45b0 r5:815c6810= r4:00000000 [ 4.593662] [<80619508>] (platform_probe) from [<806168dc>] (really_prob= e+0xe8/0x460) [ 4.601524] r7:81126e90 r6:810c45b0 r5:00000000 r4:815c6810 [ 4.607191] [<806167f4>] (really_probe) from [<80616d04>] (__driver_prob= e_device+0xb0/0x230) [ 4.615658] r7:815c6810 r6:81c35e6c r5:810c45b0 r4:815c6810 [ 4.621326] [<80616c54>] (__driver_probe_device) from [<80616ec8>] (driv= er_probe_device+0x44/0xe0) [ 4.630313] r9:80dd9a3c r8:00000003 r7:815c6810 r6:81c35e6c r5:8116e314= r4:8116e310 [ 4.638068] [<80616e84>] (driver_probe_device) from [<80617338>] (__devi= ce_attach_driver+0xb4/0x12c) [ 4.647227] r9:80dd9a3c r8:00000001 r7:815c6810 r6:81c35e6c r5:810c45b0= r4:00000001 [ 4.654981] [<80617284>] (__device_attach_driver) from [<80614730>] (bus= _for_each_drv+0x94/0xd8) [ 4.663794] r7:81c34000 r6:80617284 r5:81c35e6c r4:00000000 [ 4.669461] [<8061469c>] (bus_for_each_drv) from [<8061673c>] (__device_= attach+0xf8/0x190) [ 4.677753] r7:81126e90 r6:815c6854 r5:81c34000 r4:815c6810 [ 4.683419] [<80616644>] (__device_attach) from [<80617554>] (device_ini= tial_probe+0x1c/0x20) [ 4.691971] r8:00000000 r7:81126e90 r6:815c6810 r5:810c5320 r4:810c5080 [ 4.698681] [<80617538>] (device_initial_probe) from [<80615694>] (bus_p= robe_device+0x94/0x9c) [ 4.707318] [<80615600>] (bus_probe_device) from [<80615c6c>] (deferred_= probe_work_func+0xac/0xf0) [ 4.716305] r7:81126e90 r6:810c5094 r5:810c5080 r4:810c5080 [ 4.721973] [<80615bc0>] (deferred_probe_work_func) from [<80141488>] (p= rocess_one_work+0x1fc/0x54c) [ 4.731139] r10:81119a60 r9:814c300d r8:00000000 r7:814c3000 r6:8141280= 0 r5:817eeb00 [ 4.738981] r4:810c50c0 r3:80615bc0 [ 4.742563] [<8014128c>] (process_one_work) from [<80141a48>] (worker_th= read+0x270/0x570) [ 4.750765] r10:81412800 r9:00000088 r8:81003d00 r7:81412818 r6:817eeb1= 8 r5:81412800 [ 4.758608] r4:817eeb00 [ 4.761147] [<801417d8>] (worker_thread) from [<80149b1c>] (kthread+0x17= 4/0x190) [ 4.768574] r10:81c34000 r9:815a7e7c r8:00000000 r7:817eeb00 r6:801417d= 8 r5:817efc00 [ 4.776417] r4:817efa40 [ 4.778955] [<801499a8>] (kthread) from [<80100130>] (ret_from_fork+0x14= /0x24) [ 4.786201] Exception stack(0x81c35fb0 to 0x81c35ff8) [ 4.791266] 5fa0: 00000000 00000000 = 00000000 00000000 [ 4.799459] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 = 00000000 00000000 [ 4.807651] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 [ 4.814279] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:0000000= 0 r5:801499a8 [ 4.822120] r4:817efa40 [ 4.824664] Code: e3a02080 e593001c e3a01d33 e3a05000 (e5979018) Split the registration from the STDP4028 probe routine and only perform registration once both the STDP4028 and STDP2690 have probed. Signed-off-by: Martyn Welch CC: Peter Senna Tschudin CC: Martyn Welch CC: Neil Armstrong CC: Robert Foss CC: Laurent Pinchart CC: Jonas Karlman CC: Jernej Skrabec Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/43552c3404e8fdf92d8bc56= 58fac24e9f03c2c57.1637836606.git.martyn.welch@collabora.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/dri= vers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c index d2808c4a6fb1c..cce98bf2a4e73 100644 --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c @@ -306,19 +306,10 @@ out: mutex_unlock(&ge_b850v3_lvds_dev_mutex); } =20 -static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, - const struct i2c_device_id *id) +static int ge_b850v3_register(void) { + struct i2c_client *stdp4028_i2c =3D ge_b850v3_lvds_ptr->stdp4028_i2c; struct device *dev =3D &stdp4028_i2c->dev; - int ret; - - ret =3D ge_b850v3_lvds_init(dev); - - if (ret) - return ret; - - ge_b850v3_lvds_ptr->stdp4028_i2c =3D stdp4028_i2c; - i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); =20 /* drm bridge initialization */ ge_b850v3_lvds_ptr->bridge.funcs =3D &ge_b850v3_lvds_funcs; @@ -343,6 +334,27 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_clie= nt *stdp4028_i2c, "ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr); } =20 +static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, + const struct i2c_device_id *id) +{ + struct device *dev =3D &stdp4028_i2c->dev; + int ret; + + ret =3D ge_b850v3_lvds_init(dev); + + if (ret) + return ret; + + ge_b850v3_lvds_ptr->stdp4028_i2c =3D stdp4028_i2c; + i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); + + /* Only register after both bridges are probed */ + if (!ge_b850v3_lvds_ptr->stdp2690_i2c) + return 0; + + return ge_b850v3_register(); +} + static int stdp4028_ge_b850v3_fw_remove(struct i2c_client *stdp4028_i2c) { ge_b850v3_lvds_remove(); @@ -386,7 +398,11 @@ static int stdp2690_ge_b850v3_fw_probe(struct i2c_clie= nt *stdp2690_i2c, ge_b850v3_lvds_ptr->stdp2690_i2c =3D stdp2690_i2c; i2c_set_clientdata(stdp2690_i2c, ge_b850v3_lvds_ptr); =20 - return 0; + /* Only register after both bridges are probed */ + if (!ge_b850v3_lvds_ptr->stdp4028_i2c) + return 0; + + return ge_b850v3_register(); } =20 static int stdp2690_ge_b850v3_fw_remove(struct i2c_client *stdp2690_i2c) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66906C35271 for ; Mon, 24 Jan 2022 23:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367950AbiAXX4z (ORCPT ); Mon, 24 Jan 2022 18:56:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846419AbiAXXPz (ORCPT ); Mon, 24 Jan 2022 18:15:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AAEEC0604D0; Mon, 24 Jan 2022 13:24:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 BD3DA61320; Mon, 24 Jan 2022 21:24:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2FB5C340E4; Mon, 24 Jan 2022 21:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059453; bh=cdFXuFaCObFyYMFaICM/VLalkvjImrTRIgfaj6Fp60w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HhtcIFzBKrctYhB0946H0Efteh9tYp+NuxJYzBDVZP0FaB2DnzLf475y27Mnt5PDz +YXcN5Jvbdb0h2IKHCfc6ii0WRj2LgHdPLKXYx/J6X62gnG1e9UWZSUOhqWdxt4M6N 2eu/d/RjsI2Q41EJp7jSWePmrPxL31D1fT51khhU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby , Sasha Levin Subject: [PATCH 5.16 0588/1039] mxser: keep only !tty test in ISR Date: Mon, 24 Jan 2022 19:39:37 +0100 Message-Id: <20220124184145.101983897@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Slaby [ Upstream commit 274ab58dc2b460cc474ffc7ccfcede4b2be1a3f5 ] The others are superfluous with tty refcounting in place now. And they are racy in fact: * tty_port_initialized() reports false for a small moment after interrupts are enabled. * closing is 1 while the port is still alive. The queues are flushed later during close anyway. So there is no need for this special handling. Actually, the ISR should not flush the queues. It should behave as every other driver, just queue the chars into tty buffer and go on. But this will be changed later. There is still a lot code depending on having tty in ISR (and not only tty_port). Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20211118073125.12283-4-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/mxser.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 93a95a135a71a..27caa2f9ba79b 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -262,7 +262,6 @@ struct mxser_port { unsigned int xmit_head; unsigned int xmit_tail; unsigned int xmit_cnt; - int closing; =20 spinlock_t slock; }; @@ -918,7 +917,6 @@ static void mxser_close(struct tty_struct *tty, struct = file *filp) return; if (tty_port_close_start(port, tty, filp) =3D=3D 0) return; - info->closing =3D 1; mutex_lock(&port->mutex); mxser_close_port(port); mxser_flush_buffer(tty); @@ -927,7 +925,6 @@ static void mxser_close(struct tty_struct *tty, struct = file *filp) mxser_shutdown_port(port); tty_port_set_initialized(port, 0); mutex_unlock(&port->mutex); - info->closing =3D 0; /* Right now the tty_port set is done outside of the close_end helper as we don't yet have everyone using refcounts */=09 tty_port_close_end(port, tty); @@ -1683,7 +1680,7 @@ static bool mxser_port_isr(struct mxser_port *port) =20 iir &=3D MOXA_MUST_IIR_MASK; tty =3D tty_port_tty_get(&port->port); - if (!tty || port->closing || !tty_port_initialized(&port->port)) { + if (!tty) { status =3D inb(port->ioaddr + UART_LSR); outb(port->FCR | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, port->ioaddr + UART_FCR); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8245DC433F5 for ; Mon, 24 Jan 2022 22:08:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380208AbiAXWIe (ORCPT ); Mon, 24 Jan 2022 17:08:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45706 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452206AbiAXVYR (ORCPT ); Mon, 24 Jan 2022 16:24:17 -0500 Received: from smtp.kernel.org (relay.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 D16D6614CB; Mon, 24 Jan 2022 21:24:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4DC8C340E4; Mon, 24 Jan 2022 21:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059456; bh=3kPQFQXrFwsqTMtVM9ew+ZI2qMLU4r4nNQNU7LoZqa0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pnCDK0m1xmVUdGxArAjBoIOM+r0ggwcZZQQT1NwzHH/p4ryshzsu/K94aUhPeZiw1 kVp5FtBMymFvcQPzNqbc5re5acb+GQBhDiQsKfRQPpuzEm8Z605f6IbbHnVBPqMpuf wofZLctTVLk5xJelg7o+wv3Ss8hIDayiJc/JVL1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby , Sasha Levin Subject: [PATCH 5.16 0589/1039] mxser: dont throttle manually Date: Mon, 24 Jan 2022 19:39:38 +0100 Message-Id: <20220124184145.134971912@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Slaby [ Upstream commit c6693e6e07805f1b7822b13a5b482bf2b6a1f312 ] First, checking tty->receive_room to signalize whether there is enough space in the tty buffers does not make much sense. Provided the tty buffers are in tty_port and those are not checked at all. Second, if the rx path is throttled, with CRTSCTS, RTS is deasserted, but is never asserted again. This leads to port "lockup", not accepting any more input. So: 1) stty -F /dev/ttyMI0 crtscts # the mxser port 2) stty -F /dev/ttyS6 crtscts # the connected port 3) cat /dev/ttyMI0 4) "write in a loop" to /dev/ttyS6 5) cat from 3) produces the bytes from 4) 6) killall -STOP cat (the 3)'s one) 7) wait for RTS to drop on /dev/ttyMI0 8) killall -CONT cat (again the 3)'s one) cat erroneously produces no more output now (i.e. no data sent from ttyS6 to ttyMI can be seen). Note that the step 7) is performed twice: once from n_tty by tty_throttle_safe(), once by mxser_stoprx() from the receive path. Then after step 7), n_tty correctly unthrottles the input, but mxser calls mxser_stoprx() again as there is still only a little space in n_tty buffers (tty->receive_room mentioned at the beginning), but the device's FIFO is/can be already filled. After this patch, the output is correctly resumed, i.e. n_tty both throttles and unthrottles without interfering with mxser's attempts. This allows us to get rid of the non-standard ldisc_stop_rx flag from struct mxser_port. Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20211118073125.12283-15-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/mxser.c | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 27caa2f9ba79b..3b5d193b7f245 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -251,8 +251,6 @@ struct mxser_port { u8 MCR; /* Modem control register */ u8 FCR; /* FIFO control register */ =20 - bool ldisc_stop_rx; - struct async_icount icount; /* kernel counters for 4 input interrupts */ unsigned int timeout; =20 @@ -1323,11 +1321,14 @@ static int mxser_get_icount(struct tty_struct *tty, return 0; } =20 -static void mxser_stoprx(struct tty_struct *tty) +/* + * This routine is called by the upper-layer tty layer to signal that + * incoming characters should be throttled. + */ +static void mxser_throttle(struct tty_struct *tty) { struct mxser_port *info =3D tty->driver_data; =20 - info->ldisc_stop_rx =3D true; if (I_IXOFF(tty)) { if (info->board->must_hwid) { info->IER &=3D ~MOXA_MUST_RECV_ISR; @@ -1346,21 +1347,11 @@ static void mxser_stoprx(struct tty_struct *tty) } } =20 -/* - * This routine is called by the upper-layer tty layer to signal that - * incoming characters should be throttled. - */ -static void mxser_throttle(struct tty_struct *tty) -{ - mxser_stoprx(tty); -} - static void mxser_unthrottle(struct tty_struct *tty) { struct mxser_port *info =3D tty->driver_data; =20 /* startrx */ - info->ldisc_stop_rx =3D false; if (I_IXOFF(tty)) { if (info->x_char) info->x_char =3D 0; @@ -1543,9 +1534,6 @@ static bool mxser_receive_chars_new(struct tty_struct= *tty, if (hwid =3D=3D MOXA_MUST_MU150_HWID) gdl &=3D MOXA_MUST_GDL_MASK; =20 - if (gdl >=3D tty->receive_room && !port->ldisc_stop_rx) - mxser_stoprx(tty); - while (gdl--) { u8 ch =3D inb(port->ioaddr + UART_RX); tty_insert_flip_char(&port->port, ch, 0); @@ -1558,10 +1546,8 @@ static u8 mxser_receive_chars_old(struct tty_struct = *tty, struct mxser_port *port, u8 status) { enum mxser_must_hwid hwid =3D port->board->must_hwid; - int recv_room =3D tty->receive_room; int ignored =3D 0; int max =3D 256; - int cnt =3D 0; u8 ch; =20 do { @@ -1596,14 +1582,8 @@ static u8 mxser_receive_chars_old(struct tty_struct = *tty, port->icount.overrun++; } } - tty_insert_flip_char(&port->port, ch, flag); - cnt++; - if (cnt >=3D recv_room) { - if (!port->ldisc_stop_rx) - mxser_stoprx(tty); + if (!tty_insert_flip_char(&port->port, ch, flag)) break; - } - } =20 if (hwid) @@ -1618,9 +1598,6 @@ static u8 mxser_receive_chars_old(struct tty_struct *= tty, static u8 mxser_receive_chars(struct tty_struct *tty, struct mxser_port *port, u8 status) { - if (tty->receive_room =3D=3D 0 && !port->ldisc_stop_rx) - mxser_stoprx(tty); - if (!mxser_receive_chars_new(tty, port, status)) status =3D mxser_receive_chars_old(tty, port, status); =20 @@ -1833,7 +1810,6 @@ static void mxser_initbrd(struct mxser_board *brd, bo= ol high_baud) tty_port_init(&info->port); info->port.ops =3D &mxser_port_ops; info->board =3D brd; - info->ldisc_stop_rx =3D false; =20 /* Enhance mode enabled here */ if (brd->must_hwid !=3D MOXA_OTHER_UART) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26236C433F5 for ; Mon, 24 Jan 2022 22:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580152AbiAXWIx (ORCPT ); Mon, 24 Jan 2022 17:08:53 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44732 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452215AbiAXVYU (ORCPT ); Mon, 24 Jan 2022 16:24:20 -0500 Received: from smtp.kernel.org (relay.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 C60E861320; Mon, 24 Jan 2022 21:24:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7A5AC340E4; Mon, 24 Jan 2022 21:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059459; bh=iJWsnEH3EqlFoyUdRdRa/2WUrAEJb4H3pNL5VUzpUbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qd57NVl2iUDNZZFn5WQxJaKWFUHPdtDsKahxmeuikE+73gH3KdAFAZanjyNqsDvba s96ayB3WYgtjekQcIKiyTax2Pqh6/C498Preb3MHYMh2f1gVKhGiHZYnG/K00u7s1B Gh04ZePS0+BDoGcCGxBK3IJIqk/bHXLuEnFP1sZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby , Sasha Levin Subject: [PATCH 5.16 0590/1039] mxser: increase buf_overrun if tty_insert_flip_char() fails Date: Mon, 24 Jan 2022 19:39:39 +0100 Message-Id: <20220124184145.165420298@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Slaby [ Upstream commit eb68ac0462bffc2ceb63b3a76737d6c9f186e6de ] mxser doesn't increase port->icount.buf_overrun at all. Do so if overrun happens, so that it can be read from the stats. Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20211118073125.12283-17-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/mxser.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 3b5d193b7f245..39458b42df7b0 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1536,7 +1536,8 @@ static bool mxser_receive_chars_new(struct tty_struct= *tty, =20 while (gdl--) { u8 ch =3D inb(port->ioaddr + UART_RX); - tty_insert_flip_char(&port->port, ch, 0); + if (!tty_insert_flip_char(&port->port, ch, 0)) + port->icount.buf_overrun++; } =20 return true; @@ -1582,8 +1583,10 @@ static u8 mxser_receive_chars_old(struct tty_struct = *tty, port->icount.overrun++; } } - if (!tty_insert_flip_char(&port->port, ch, flag)) + if (!tty_insert_flip_char(&port->port, ch, flag)) { + port->icount.buf_overrun++; break; + } } =20 if (hwid) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F730C4707E for ; Mon, 24 Jan 2022 23:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367937AbiAXX4w (ORCPT ); Mon, 24 Jan 2022 18:56:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846423AbiAXXPz (ORCPT ); Mon, 24 Jan 2022 18:15:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF966C0604D1; Mon, 24 Jan 2022 13:24:24 -0800 (PST) Received: from smtp.kernel.org (relay.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 6CB8EB8122A; Mon, 24 Jan 2022 21:24:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97129C340E4; Mon, 24 Jan 2022 21:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059462; bh=P0K1qFpXW6iZLb8fx18FKgzSyX5CF/f0E9RlLpHqlc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IN3QVG7F4Nqw5Kht3s/NXcgVqZI9JFeegJ5QCPt0DbXdCwaWjzCB0cu26YZT9vyym 6k/lfCtM2C/eSj5st1M5k0gx1tFjFxtL/hni1BmJB63dO4x0jw3Xbbbg9aYgm/B58S xoLSRqIqNSA3sW8E3rhJ3gpCr2jRWgQ81d1NjHfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emil Renner Berthing , Andy Shevchenko , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.16 0591/1039] serial: 8250_dw: Add StarFive JH7100 quirk Date: Mon, 24 Jan 2022 19:39:40 +0100 Message-Id: <20220124184145.197234693@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Emil Renner Berthing [ Upstream commit 57dcb6ec85d59e04285b7dcf10924bb819c8e46f ] On the StarFive JH7100 RISC-V SoC the UART core clocks can't be set to exactly 16 * 115200Hz and many other common bitrates. Trying this will only result in a higher input clock, but low enough that the UART's internal divisor can't come close enough to the baud rate target. So rather than try to set the input clock it's better to skip the clk_set_rate call and rely solely on the UART's internal divisor. Signed-off-by: Emil Renner Berthing Reviewed-by: Andy Shevchenko Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20211116150119.2171-15-kernel@esmil.dk Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/8250/8250_dw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/82= 50_dw.c index 53f57c3b9f42c..1769808031c52 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -414,6 +414,8 @@ static void dw8250_quirks(struct uart_port *p, struct d= w8250_data *data) =20 if (of_device_is_compatible(np, "marvell,armada-38x-uart")) p->serial_out =3D dw8250_serial_out38x; + if (of_device_is_compatible(np, "starfive,jh7100-uart")) + p->set_termios =3D dw8250_do_set_termios; =20 } else if (acpi_dev_present("APMC0D08", NULL, -1)) { p->iotype =3D UPIO_MEM32; @@ -696,6 +698,7 @@ static const struct of_device_id dw8250_of_match[] =3D { { .compatible =3D "cavium,octeon-3860-uart" }, { .compatible =3D "marvell,armada-38x-uart" }, { .compatible =3D "renesas,rzn1-uart" }, + { .compatible =3D "starfive,jh7100-uart" }, { /* Sentinel */ } }; MODULE_DEVICE_TABLE(of, dw8250_of_match); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60EDAC43217 for ; Mon, 24 Jan 2022 22:03:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577406AbiAXWAD (ORCPT ); Mon, 24 Jan 2022 17:00:03 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38990 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451378AbiAXVWr (ORCPT ); Mon, 24 Jan 2022 16:22:47 -0500 Received: from smtp.kernel.org (relay.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 65179B811FB; Mon, 24 Jan 2022 21:22:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A06AC340E4; Mon, 24 Jan 2022 21:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059365; bh=k0ORuEQnGTqteUEkwb9luAXHUAo6NBshCwtibeD8tfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bvcFThnE3I6AMwvUwonYiRAEcMYT00DI8ShSUUMWcHF9yurk9tAKeEBZcvg0rl5r2 YXcaATV5Ro3tO1kmjLqgtnhPrjbY0+6K3reDAs+jd4APiSJdzwc3E8JGIgGdALL0HR DC3Wrk4qIUVv+x7XyDZGvils3RRHZgfGte8YMspk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fugang Duan , Sherry Sun , Sasha Levin Subject: [PATCH 5.16 0592/1039] tty: serial: imx: disable UCR4_OREN in .stop_rx() instead of .shutdown() Date: Mon, 24 Jan 2022 19:39:41 +0100 Message-Id: <20220124184145.230409176@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fugang Duan [ Upstream commit 028e083832b06fdeeb290e1e57dc1f6702c4c215 ] The UCR4_OREN should be disabled before disabling the uart receiver in .stop_rx() instead of in the .shutdown(). Otherwise, if we have the overrun error during the receiver disable process, the overrun interrupt will keep trigging until we disable the OREN interrupt in the .shutdown(), because the ORE status can only be cleared when read the rx FIFO or reset the controller. Although the called time between the receiver disable and OREN disable in .shutdown() is very short, there is still the risk of endless interrupt during this short period of time. So here change to disable OREN before the receiver been disabled in .stop_rx(). Signed-off-by: Fugang Duan Signed-off-by: Sherry Sun Link: https://lore.kernel.org/r/20211125020349.4980-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/imx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 90f82e6c54e46..6f7f382d0b1fa 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -486,18 +486,21 @@ static void imx_uart_stop_tx(struct uart_port *port) static void imx_uart_stop_rx(struct uart_port *port) { struct imx_port *sport =3D (struct imx_port *)port; - u32 ucr1, ucr2; + u32 ucr1, ucr2, ucr4; =20 ucr1 =3D imx_uart_readl(sport, UCR1); ucr2 =3D imx_uart_readl(sport, UCR2); + ucr4 =3D imx_uart_readl(sport, UCR4); =20 if (sport->dma_is_enabled) { ucr1 &=3D ~(UCR1_RXDMAEN | UCR1_ATDMAEN); } else { ucr1 &=3D ~UCR1_RRDYEN; ucr2 &=3D ~UCR2_ATEN; + ucr4 &=3D ~UCR4_OREN; } imx_uart_writel(sport, ucr1, UCR1); + imx_uart_writel(sport, ucr4, UCR4); =20 ucr2 &=3D ~UCR2_RXEN; imx_uart_writel(sport, ucr2, UCR2); @@ -1544,7 +1547,7 @@ static void imx_uart_shutdown(struct uart_port *port) imx_uart_writel(sport, ucr1, UCR1); =20 ucr4 =3D imx_uart_readl(sport, UCR4); - ucr4 &=3D ~(UCR4_OREN | UCR4_TCEN); + ucr4 &=3D ~UCR4_TCEN; imx_uart_writel(sport, ucr4, UCR4); =20 spin_unlock_irqrestore(&sport->port.lock, flags); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B34DC4167D for ; Mon, 24 Jan 2022 22:03:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577459AbiAXWAP (ORCPT ); Mon, 24 Jan 2022 17:00:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40148 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451392AbiAXVWu (ORCPT ); Mon, 24 Jan 2022 16:22:50 -0500 Received: from smtp.kernel.org (relay.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 49B77B811A2; Mon, 24 Jan 2022 21:22:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A4FAC340E4; Mon, 24 Jan 2022 21:22:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059368; bh=jq5nSyDGNO8hpQ1IHIdwhL+JRSQlm2E4xpGYFSvtRJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FqU7ZrHpMZncOpa2qg62N8MRZ/5COfN4PMKusEQQPWhcjnWMsqrEPRWmnAjtbgKFJ iY//4SfUkPIhg0wZ6+GRAqrBAHYSzqGQvyRP+51ku/GN2WRuYkAq8EZu4Tu9/OiZg/ ym1XNhDjOQQ3bV8fyFAFpQGQtwFTR00DiEnhCTTI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.16 0593/1039] gpiolib: acpi: Do not set the IRQ type if the IRQ is already in use Date: Mon, 24 Jan 2022 19:39:42 +0100 Message-Id: <20220124184145.265483102@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit bdfd6ab8fdccd8b138837efff66f4a1911496378 ] If the IRQ is already in use, then acpi_dev_gpio_irq_get_by() really should not change the type underneath the current owner. I specifically hit an issue with this an a Chuwi Hi8 Super (CWI509) Bay Trail tablet, when the Boot OS selection in the BIOS is set to Android. In this case _STA for a MAX17047 ACPI I2C device wrongly returns 0xf and the _CRS resources for this device include a GpioInt pointing to a GPIO already in use by an _AEI handler, with a different type then specified in the _CRS for the MAX17047 device. Leading to the acpi_dev_gpio_irq_get() call done by the i2c-core-acpi.c code changing the type breaking the _AEI handler. Now this clearly is a bug in the DSDT of this tablet (in Android mode), but in general calling irq_set_irq_type() on an IRQ which already is in use seems like a bad idea. Signed-off-by: Hans de Goede Signed-off-by: Andy Shevchenko Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpio/gpiolib-acpi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 985e8589c58ba..feb8157d2d672 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -1056,10 +1056,17 @@ int acpi_dev_gpio_irq_get_by(struct acpi_device *ad= ev, const char *name, int ind irq_flags =3D acpi_dev_get_irq_type(info.triggering, info.polarity); =20 - /* Set type if specified and different than the current one */ - if (irq_flags !=3D IRQ_TYPE_NONE && - irq_flags !=3D irq_get_trigger_type(irq)) - irq_set_irq_type(irq, irq_flags); + /* + * If the IRQ is not already in use then set type + * if specified and different than the current one. + */ + if (can_request_irq(irq, irq_flags)) { + if (irq_flags !=3D IRQ_TYPE_NONE && + irq_flags !=3D irq_get_trigger_type(irq)) + irq_set_irq_type(irq, irq_flags); + } else { + dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); + } =20 return irq; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A258C433FE for ; Mon, 24 Jan 2022 22:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577586AbiAXWAg (ORCPT ); Mon, 24 Jan 2022 17:00:36 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40176 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451404AbiAXVWy (ORCPT ); Mon, 24 Jan 2022 16:22:54 -0500 Received: from smtp.kernel.org (relay.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 2F873B8123D; Mon, 24 Jan 2022 21:22:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6193BC340E4; Mon, 24 Jan 2022 21:22:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059370; bh=hEOXtMUwE/45Nh6ai1hbQxYP2KFHIOMKiavrEhac3jM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f+QWbv9LSAA4Rqj/ZfSXb1kmYiGni+elscsL1Huc/gCXj9cxTSVklkF2cHI4BnsLH noryMqsxuTGjm2UjBirZJkhXc1YRoJzgKqSLwl2NSP2m7iWBr0cQSMiDP4FXVBQ7Qy EygRvyCU5klhfb6QlHej41mUm0LplN7BgrcbPa8U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengfeng Ye , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.16 0594/1039] HSI: core: Fix return freed object in hsi_new_client Date: Mon, 24 Jan 2022 19:39:43 +0100 Message-Id: <20220124184145.299780465@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chengfeng Ye [ Upstream commit a1ee1c08fcd5af03187dcd41dcab12fd5b379555 ] cl is freed on error of calling device_register, but this object is return later, which will cause uaf issue. Fix it by return NULL on error. Signed-off-by: Chengfeng Ye Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hsi/hsi_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c index ec90713564e32..884066109699c 100644 --- a/drivers/hsi/hsi_core.c +++ b/drivers/hsi/hsi_core.c @@ -102,6 +102,7 @@ struct hsi_client *hsi_new_client(struct hsi_port *port, if (device_register(&cl->device) < 0) { pr_err("hsi: failed to register client: %s\n", info->name); put_device(&cl->device); + goto err; } =20 return cl; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C44EBC3526E for ; Mon, 24 Jan 2022 23:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366913AbiAXXxq (ORCPT ); Mon, 24 Jan 2022 18:53:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846029AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6BF5C06F8CE; Mon, 24 Jan 2022 13:22:56 -0800 (PST) Received: from smtp.kernel.org (relay.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 620CAB81243; Mon, 24 Jan 2022 21:22:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49840C340E4; Mon, 24 Jan 2022 21:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059374; bh=FtVstA5Qd9mauR9+4JEDWKdV8yzsC6t8OYr2IPene8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qCjpmZEVdcEk5hcIBmkBnJIYQHuTJSips7LRyKcoq0PIquEEh4nPELyQBo1FW8eW4 4H8DaEpuQ6TB0vyaJOrGtl+rb6waWwmbGDHD7boEc+EkSRmNwQjc8m2GH8ibCdSMfn +mdRAA3/p5yNORAkfAg3Ja5BpDxNvmAVliSLVQ8M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Mueller , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0595/1039] crypto: jitter - consider 32 LSB for APT Date: Mon, 24 Jan 2022 19:39:44 +0100 Message-Id: <20220124184145.331956167@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Stephan M=C3=BCller [ Upstream commit 552d03a223eda3df84526ab2c1f4d82e15eaee7a ] The APT compares the current time stamp with a pre-set value. The current code only considered the 4 LSB only. Yet, after reviews by mathematicians of the user space Jitter RNG version >=3D 3.1.0, it was concluded that the APT can be calculated on the 32 LSB of the time delta. Thi change is applied to the kernel. This fixes a bug where an AMD EPYC fails this test as its RDTSC value contains zeros in the LSB. The most appropriate fix would have been to apply a GCD calculation and divide the time stamp by the GCD. Yet, this is a significant code change that will be considered for a future update. Note, tests showed that constantly the GCD always was 32 on these systems, i.e. the 5 LSB were always zero (thus failing the APT since it only considered the 4 LSB for its calculation). Signed-off-by: Stephan Mueller Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- crypto/jitterentropy.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crypto/jitterentropy.c b/crypto/jitterentropy.c index 4dc2261cdeefb..788d90749715a 100644 --- a/crypto/jitterentropy.c +++ b/crypto/jitterentropy.c @@ -265,7 +265,6 @@ static int jent_stuck(struct rand_data *ec, __u64 curre= nt_delta) { __u64 delta2 =3D jent_delta(ec->last_delta, current_delta); __u64 delta3 =3D jent_delta(ec->last_delta2, delta2); - unsigned int delta_masked =3D current_delta & JENT_APT_WORD_MASK; =20 ec->last_delta =3D current_delta; ec->last_delta2 =3D delta2; @@ -274,7 +273,7 @@ static int jent_stuck(struct rand_data *ec, __u64 curre= nt_delta) * Insert the result of the comparison of two back-to-back time * deltas. */ - jent_apt_insert(ec, delta_masked); + jent_apt_insert(ec, current_delta); =20 if (!current_delta || !delta2 || !delta3) { /* RCT with a stuck bit */ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3D22C43219 for ; Mon, 24 Jan 2022 23:58:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366646AbiAXXxO (ORCPT ); Mon, 24 Jan 2022 18:53:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846072AbiAXXOW (ORCPT ); Mon, 24 Jan 2022 18:14:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDABEC06F8D0; Mon, 24 Jan 2022 13:22:58 -0800 (PST) Received: from smtp.kernel.org (relay.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 71719B81243; Mon, 24 Jan 2022 21:22:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95CAAC340E4; Mon, 24 Jan 2022 21:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059377; bh=lGJRpRCjDTX1CV5Q8d9zP8u0eeWcNT5bB1+N9cZQVD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KKhY1akFeoIumrQEN38z2ru4SxCsc0WRxYze5fhYWVrX0lcCjGunYca9pl6UD17jm cBFji3CWtPgUwkFl9F2WJmnyVXK/in0Gygt0X+aa3zMqmV4jkBpxBBj3ANQLGd2dW7 HvEVKuYDJDHPsiilMkQoou8QugojanOvY6bxHcIo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0596/1039] rtw89: fix potentially access out of range of RF register array Date: Mon, 24 Jan 2022 19:39:45 +0100 Message-Id: <20220124184145.369990067@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ping-Ke Shih [ Upstream commit 30101812a09b37bc8aa409a83f603d4c072198f2 ] The RF register array is used to help firmware to restore RF settings. The original code can potentially access out of range, if the size is between (RTW89_H2C_RF_PAGE_SIZE * RTW89_H2C_RF_PAGE_NUM + 1) to ((RTW89_H2C_RF_PAGE_SIZE + 1) * RTW89_H2C_RF_PAGE_NUM). Fortunately, current used size doesn't fall into the wrong case, and the size will not change if we don't update RF parameter. Reported-by: Dan Carpenter Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211119055729.12826-1-pkshih@realtek.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/realtek/rtw89/phy.c | 33 ++++++++++++++---------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireles= s/realtek/rtw89/phy.c index ab134856baac7..d75e9de8df7c6 100644 --- a/drivers/net/wireless/realtek/rtw89/phy.c +++ b/drivers/net/wireless/realtek/rtw89/phy.c @@ -654,6 +654,12 @@ rtw89_phy_cofig_rf_reg_store(struct rtw89_dev *rtwdev, u16 idx =3D info->curr_idx % RTW89_H2C_RF_PAGE_SIZE; u8 page =3D info->curr_idx / RTW89_H2C_RF_PAGE_SIZE; =20 + if (page >=3D RTW89_H2C_RF_PAGE_NUM) { + rtw89_warn(rtwdev, "RF parameters exceed size. path=3D%d, idx=3D%d", + rf_path, info->curr_idx); + return; + } + info->rtw89_phy_config_rf_h2c[page][idx] =3D cpu_to_le32((reg->addr << 20) | reg->data); info->curr_idx++; @@ -662,30 +668,29 @@ rtw89_phy_cofig_rf_reg_store(struct rtw89_dev *rtwdev, static int rtw89_phy_config_rf_reg_fw(struct rtw89_dev *rtwdev, struct rtw89_fw_h2c_rf_reg_info *info) { - u16 page =3D info->curr_idx / RTW89_H2C_RF_PAGE_SIZE; - u16 len =3D (info->curr_idx % RTW89_H2C_RF_PAGE_SIZE) * 4; + u16 remain =3D info->curr_idx; + u16 len =3D 0; u8 i; int ret =3D 0; =20 - if (page > RTW89_H2C_RF_PAGE_NUM) { + if (remain > RTW89_H2C_RF_PAGE_NUM * RTW89_H2C_RF_PAGE_SIZE) { rtw89_warn(rtwdev, - "rf reg h2c total page num %d larger than %d (RTW89_H2C_RF_PAGE_NUM)= \n", - page, RTW89_H2C_RF_PAGE_NUM); - return -EINVAL; + "rf reg h2c total len %d larger than %d\n", + remain, RTW89_H2C_RF_PAGE_NUM * RTW89_H2C_RF_PAGE_SIZE); + ret =3D -EINVAL; + goto out; } =20 - for (i =3D 0; i < page; i++) { - ret =3D rtw89_fw_h2c_rf_reg(rtwdev, info, - RTW89_H2C_RF_PAGE_SIZE * 4, i); + for (i =3D 0; i < RTW89_H2C_RF_PAGE_NUM && remain; i++, remain -=3D len) { + len =3D remain > RTW89_H2C_RF_PAGE_SIZE ? RTW89_H2C_RF_PAGE_SIZE : remai= n; + ret =3D rtw89_fw_h2c_rf_reg(rtwdev, info, len * 4, i); if (ret) - return ret; + goto out; } - ret =3D rtw89_fw_h2c_rf_reg(rtwdev, info, len, i); - if (ret) - return ret; +out: info->curr_idx =3D 0; =20 - return 0; + return ret; } =20 static void rtw89_phy_config_rf_reg(struct rtw89_dev *rtwdev, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49357C47082 for ; Mon, 24 Jan 2022 22:06:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579367AbiAXWFY (ORCPT ); Mon, 24 Jan 2022 17:05:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:39110 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451482AbiAXVXC (ORCPT ); Mon, 24 Jan 2022 16:23:02 -0500 Received: from smtp.kernel.org (relay.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 83116B8121C; Mon, 24 Jan 2022 21:23:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A73C8C340E4; Mon, 24 Jan 2022 21:22:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059380; bh=mMVMuisXCIt+zCi8F5XYc+fsmSAixmNaldXMRbfRe4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eH9J8kpq9zmAQ1r1gPtHdOCc53VTPLFY3+vsxDidQbN4wW4O3I0+YylNsanzEzrvl N+Y32WBLKGnjhSbb0Olz7bY/JAXXQGA5E/45TPuThqS/SBqIFf8VZTJuclRsSalR9v tlZ0++H1VG6gi9J2Ux1rmUujoDRRmzRV/+XHRIRc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brendan Dolan-Gavitt , Zekun Shen , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0597/1039] mwifiex: Fix skb_over_panic in mwifiex_usb_recv() Date: Mon, 24 Jan 2022 19:39:46 +0100 Message-Id: <20220124184145.402063070@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zekun Shen [ Upstream commit 04d80663f67ccef893061b49ec8a42ff7045ae84 ] Currently, with an unknown recv_type, mwifiex_usb_recv just return -1 without restoring the skb. Next time mwifiex_usb_rx_complete is invoked with the same skb, calling skb_put causes skb_over_panic. The bug is triggerable with a compromised/malfunctioning usb device. After applying the patch, skb_over_panic no longer shows up with the same input. Attached is the panic report from fuzzing. skbuff: skb_over_panic: text:000000003bf1b5fa len:2048 put:4 head:00000000dd6a115b data:000000000a9445d8 tail:0x844 end:0x840 dev: kernel BUG at net/core/skbuff.c:109! invalid opcode: 0000 [#1] SMP KASAN NOPTI CPU: 0 PID: 198 Comm: in:imklog Not tainted 5.6.0 #60 RIP: 0010:skb_panic+0x15f/0x161 Call Trace: ? mwifiex_usb_rx_complete+0x26b/0xfcd [mwifiex_usb] skb_put.cold+0x24/0x24 mwifiex_usb_rx_complete+0x26b/0xfcd [mwifiex_usb] __usb_hcd_giveback_urb+0x1e4/0x380 usb_giveback_urb_bh+0x241/0x4f0 ? __hrtimer_run_queues+0x316/0x740 ? __usb_hcd_giveback_urb+0x380/0x380 tasklet_action_common.isra.0+0x135/0x330 __do_softirq+0x18c/0x634 irq_exit+0x114/0x140 smp_apic_timer_interrupt+0xde/0x380 apic_timer_interrupt+0xf/0x20 Reported-by: Brendan Dolan-Gavitt Signed-off-by: Zekun Shen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YX4CqjfRcTa6bVL+@Zekuns-MBP-16.fios-router.= home Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/marvell/mwifiex/usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wirel= ess/marvell/mwifiex/usb.c index 9736aa0ab7fd4..8f01fcbe93961 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -130,7 +130,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *ada= pter, default: mwifiex_dbg(adapter, ERROR, "unknown recv_type %#x\n", recv_type); - return -1; + ret =3D -1; + goto exit_restore_skb; } break; case MWIFIEX_USB_EP_DATA: --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95C47C43217 for ; Mon, 24 Jan 2022 23:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366630AbiAXXxM (ORCPT ); Mon, 24 Jan 2022 18:53:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846073AbiAXXOW (ORCPT ); Mon, 24 Jan 2022 18:14:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46AF6C061748; Mon, 24 Jan 2022 13:23:04 -0800 (PST) Received: from smtp.kernel.org (relay.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 DC59A614B7; Mon, 24 Jan 2022 21:23:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7C66C340E4; Mon, 24 Jan 2022 21:23:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059383; bh=3qRhBNKvmScCvIXd2l25/NHmnMaxhw46rXHT+wEJ4FI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tqqjxlXRkJuzmdCP9zbhaJa3BMkgkAXPbl/kN/PEyJAATRu/m9ct8HvKlphw3CzYR o3iBvtm/Cs15ruFyVJzHaw1aJpndpiO4Tzje1mQ+0br4Ee3aphdtTrSlUpiYHPtSV6 kG9G9KDdKwLWETv92LaqY7ill68w8kbiBR0qZimA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brendan Dolan-Gavitt , Zekun Shen , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0598/1039] rsi: Fix use-after-free in rsi_rx_done_handler() Date: Mon, 24 Jan 2022 19:39:47 +0100 Message-Id: <20220124184145.439873933@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zekun Shen [ Upstream commit b07e3c6ebc0c20c772c0f54042e430acec2945c3 ] When freeing rx_cb->rx_skb, the pointer is not set to NULL, a later rsi_rx_done_handler call will try to read the freed address. This bug will very likley lead to double free, although detected early as use-after-free bug. The bug is triggerable with a compromised/malfunctional usb device. After applying the patch, the same input no longer triggers the use-after-free. Attached is the kasan report from fuzzing. BUG: KASAN: use-after-free in rsi_rx_done_handler+0x354/0x430 [rsi_usb] Read of size 4 at addr ffff8880188e5930 by task modprobe/231 Call Trace: dump_stack+0x76/0xa0 print_address_description.constprop.0+0x16/0x200 ? rsi_rx_done_handler+0x354/0x430 [rsi_usb] ? rsi_rx_done_handler+0x354/0x430 [rsi_usb] __kasan_report.cold+0x37/0x7c ? dma_direct_unmap_page+0x90/0x110 ? rsi_rx_done_handler+0x354/0x430 [rsi_usb] kasan_report+0xe/0x20 rsi_rx_done_handler+0x354/0x430 [rsi_usb] __usb_hcd_giveback_urb+0x1e4/0x380 usb_giveback_urb_bh+0x241/0x4f0 ? __usb_hcd_giveback_urb+0x380/0x380 ? apic_timer_interrupt+0xa/0x20 tasklet_action_common.isra.0+0x135/0x330 __do_softirq+0x18c/0x634 ? handle_irq_event+0xcd/0x157 ? handle_edge_irq+0x1eb/0x7b0 irq_exit+0x114/0x140 do_IRQ+0x91/0x1e0 common_interrupt+0xf/0xf Reported-by: Brendan Dolan-Gavitt Signed-off-by: Zekun Shen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YXxQL/vIiYcZUu/j@10-18-43-117.dynapool.wire= less.nyu.edu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/rsi/rsi_91x_usb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/= rsi/rsi_91x_usb.c index 6821ea9918956..3cca1823c458a 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -269,8 +269,12 @@ static void rsi_rx_done_handler(struct urb *urb) struct rsi_91x_usbdev *dev =3D (struct rsi_91x_usbdev *)rx_cb->data; int status =3D -EINVAL; =20 + if (!rx_cb->rx_skb) + return; + if (urb->status) { dev_kfree_skb(rx_cb->rx_skb); + rx_cb->rx_skb =3D NULL; return; } =20 @@ -294,8 +298,10 @@ out: if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num, GFP_ATOMIC)) rsi_dbg(ERR_ZONE, "%s: Failed in urb submission", __func__); =20 - if (status) + if (status) { dev_kfree_skb(rx_cb->rx_skb); + rx_cb->rx_skb =3D NULL; + } } =20 static void rsi_rx_urb_kill(struct rsi_hw *adapter, u8 ep_num) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E85B3C4707A for ; Mon, 24 Jan 2022 23:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366949AbiAXXxu (ORCPT ); Mon, 24 Jan 2022 18:53:50 -0500 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 S1846108AbiAXXO1 (ORCPT ); Mon, 24 Jan 2022 18:14:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44D7BC061760; Mon, 24 Jan 2022 13:23:07 -0800 (PST) Received: from smtp.kernel.org (relay.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 D6DD5611C8; Mon, 24 Jan 2022 21:23:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB83DC340E4; Mon, 24 Jan 2022 21:23:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059386; bh=tgMxk0poZY5zYAaPiVwW6ZLGXckdFm/KF9btJSEKfHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bxn8PyKZiRnSD0X41YCrwGyaXHgjXFJg7/Mo6+8o3fgjI4ZvmEyng0JpwfrI9E37C R8x4c+WZAcJNI5UYfEs99JSr9H4uIjZFfD68lPe4TeDRe+tHDEb9S+2jflxoebpwEA GLbw/G18vZkIdaYOqQscQND07U3WfrDRDpOEMzAw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brendan Dolan-Gavitt , Zekun Shen , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0599/1039] rsi: Fix out-of-bounds read in rsi_read_pkt() Date: Mon, 24 Jan 2022 19:39:48 +0100 Message-Id: <20220124184145.480831077@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zekun Shen [ Upstream commit f1cb3476e48b60c450ec3a1d7da0805bffc6e43a ] rsi_get_* functions rely on an offset variable from usb input. The size of usb input is RSI_MAX_RX_USB_PKT_SIZE(3000), while 2-byte offset can be up to 0xFFFF. Thus a large offset can cause out-of-bounds read. The patch adds a bound checking condition when rcv_pkt_len is 0, indicating it's USB. It's unclear whether this is triggerable from other type of bus. The following check might help in that case. offset > rcv_pkt_len - FRAME_DESC_SZ The bug is trigerrable with conpromised/malfunctioning USB devices. I tested the patch with the crashing input and got no more bug report. Attached is the KASAN report from fuzzing. BUG: KASAN: slab-out-of-bounds in rsi_read_pkt+0x42e/0x500 [rsi_91x] Read of size 2 at addr ffff888019439fdb by task RX-Thread/227 CPU: 0 PID: 227 Comm: RX-Thread Not tainted 5.6.0 #66 Call Trace: dump_stack+0x76/0xa0 print_address_description.constprop.0+0x16/0x200 ? rsi_read_pkt+0x42e/0x500 [rsi_91x] ? rsi_read_pkt+0x42e/0x500 [rsi_91x] __kasan_report.cold+0x37/0x7c ? rsi_read_pkt+0x42e/0x500 [rsi_91x] kasan_report+0xe/0x20 rsi_read_pkt+0x42e/0x500 [rsi_91x] rsi_usb_rx_thread+0x1b1/0x2fc [rsi_usb] ? rsi_probe+0x16a0/0x16a0 [rsi_usb] ? _raw_spin_lock_irqsave+0x7b/0xd0 ? _raw_spin_trylock_bh+0x120/0x120 ? __wake_up_common+0x10b/0x520 ? rsi_probe+0x16a0/0x16a0 [rsi_usb] kthread+0x2b5/0x3b0 ? kthread_create_on_node+0xd0/0xd0 ret_from_fork+0x22/0x40 Reported-by: Brendan Dolan-Gavitt Signed-off-by: Zekun Shen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YXxXS4wgu2OsmlVv@10-18-43-117.dynapool.wire= less.nyu.edu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/rsi/rsi_91x_main.c | 4 ++++ drivers/net/wireless/rsi/rsi_91x_usb.c | 1 - drivers/net/wireless/rsi/rsi_usb.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless= /rsi/rsi_91x_main.c index f1bf71e6c6081..5d1490fc32db4 100644 --- a/drivers/net/wireless/rsi/rsi_91x_main.c +++ b/drivers/net/wireless/rsi/rsi_91x_main.c @@ -23,6 +23,7 @@ #include "rsi_common.h" #include "rsi_coex.h" #include "rsi_hal.h" +#include "rsi_usb.h" =20 u32 rsi_zone_enabled =3D /* INFO_ZONE | INIT_ZONE | @@ -168,6 +169,9 @@ int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt,= s32 rcv_pkt_len) frame_desc =3D &rx_pkt[index]; actual_length =3D *(u16 *)&frame_desc[0]; offset =3D *(u16 *)&frame_desc[2]; + if (!rcv_pkt_len && offset > + RSI_MAX_RX_USB_PKT_SIZE - FRAME_DESC_SZ) + goto fail; =20 queueno =3D rsi_get_queueno(frame_desc, offset); length =3D rsi_get_length(frame_desc, offset); diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/= rsi/rsi_91x_usb.c index 3cca1823c458a..66fe386ec9cc6 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -330,7 +330,6 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8= ep_num, gfp_t mem_flags) struct sk_buff *skb; u8 dword_align_bytes =3D 0; =20 -#define RSI_MAX_RX_USB_PKT_SIZE 3000 skb =3D dev_alloc_skb(RSI_MAX_RX_USB_PKT_SIZE); if (!skb) return -ENOMEM; diff --git a/drivers/net/wireless/rsi/rsi_usb.h b/drivers/net/wireless/rsi/= rsi_usb.h index 254d19b664123..961851748bc4c 100644 --- a/drivers/net/wireless/rsi/rsi_usb.h +++ b/drivers/net/wireless/rsi/rsi_usb.h @@ -44,6 +44,8 @@ #define RSI_USB_BUF_SIZE 4096 #define RSI_USB_CTRL_BUF_SIZE 0x04 =20 +#define RSI_MAX_RX_USB_PKT_SIZE 3000 + struct rx_usb_ctrl_block { u8 *data; struct urb *rx_urb; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CC3CC4332F for ; Mon, 24 Jan 2022 22:04:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578032AbiAXWB2 (ORCPT ); Mon, 24 Jan 2022 17:01:28 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40324 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451595AbiAXVXM (ORCPT ); Mon, 24 Jan 2022 16:23:12 -0500 Received: from smtp.kernel.org (relay.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 C93EFB81188; Mon, 24 Jan 2022 21:23:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3D1CC340E5; Mon, 24 Jan 2022 21:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059389; bh=oFdvVlvLXbZXX4XWSa9QLTGZFtzreFcGxde9rBTrLdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2NUygbFYQ490/wyb7en+VG5z+kzAJPzCWnwWHr8lcFdaQtwvwthTP90lrmspBNzIQ pkzJwlYaikokh4fTvOMbfYFKfCZ+ZXMWQm1BWhFdKji4sC/Ng3CRUXfh5QApWa/yj/ B7d4b7KYkabOhEkoXM8/1oim61YAgyKZ5ykpfrNY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sriram R , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0600/1039] ath11k: Avoid NULL ptr access during mgmt tx cleanup Date: Mon, 24 Jan 2022 19:39:49 +0100 Message-Id: <20220124184145.512012358@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sriram R [ Upstream commit a93789ae541c7d5c1c2a4942013adb6bcc5e2848 ] Currently 'ar' reference is not added in skb_cb during WMI mgmt tx. Though this is generally not used during tx completion callbacks, on interface removal the remaining idr cleanup callback uses the ar ptr from skb_cb from mgmt txmgmt_idr. Hence fill them during tx call for proper usage. Also free the skb which is missing currently in these callbacks. Crash_info: [19282.489476] Unable to handle kernel NULL pointer dereference at virtual = address 00000000 [19282.489515] pgd =3D 91eb8000 [19282.496702] [00000000] *pgd=3D00000000 [19282.502524] Internal error: Oops: 5 [#1] PREEMPT SMP ARM [19282.783728] PC is at ath11k_mac_vif_txmgmt_idr_remove+0x28/0xd8 [ath11k] [19282.789170] LR is at idr_for_each+0xa0/0xc8 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-00729-QCAHKSWPL_SILICONZ-3 v2 Signed-off-by: Sriram R Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1637832614-13831-1-git-send-email-quic_srir= rama@quicinc.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/mac.c | 35 +++++++++++++++------------ 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index cb41c3e5708cb..a7400ade7a0cf 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. */ =20 #include @@ -4935,23 +4936,32 @@ static int __ath11k_set_antenna(struct ath11k *ar, = u32 tx_ant, u32 rx_ant) return 0; } =20 -int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx) +static void ath11k_mac_tx_mgmt_free(struct ath11k *ar, int buf_id) { - struct sk_buff *msdu =3D skb; + struct sk_buff *msdu; struct ieee80211_tx_info *info; - struct ath11k *ar =3D ctx; - struct ath11k_base *ab =3D ar->ab; =20 spin_lock_bh(&ar->txmgmt_idr_lock); - idr_remove(&ar->txmgmt_idr, buf_id); + msdu =3D idr_remove(&ar->txmgmt_idr, buf_id); spin_unlock_bh(&ar->txmgmt_idr_lock); - dma_unmap_single(ab->dev, ATH11K_SKB_CB(msdu)->paddr, msdu->len, + + if (!msdu) + return; + + dma_unmap_single(ar->ab->dev, ATH11K_SKB_CB(msdu)->paddr, msdu->len, DMA_TO_DEVICE); =20 info =3D IEEE80211_SKB_CB(msdu); memset(&info->status, 0, sizeof(info->status)); =20 ieee80211_free_txskb(ar->hw, msdu); +} + +int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx) +{ + struct ath11k *ar =3D ctx; + + ath11k_mac_tx_mgmt_free(ar, buf_id); =20 return 0; } @@ -4960,17 +4970,10 @@ static int ath11k_mac_vif_txmgmt_idr_remove(int buf= _id, void *skb, void *ctx) { struct ieee80211_vif *vif =3D ctx; struct ath11k_skb_cb *skb_cb =3D ATH11K_SKB_CB((struct sk_buff *)skb); - struct sk_buff *msdu =3D skb; struct ath11k *ar =3D skb_cb->ar; - struct ath11k_base *ab =3D ar->ab; =20 - if (skb_cb->vif =3D=3D vif) { - spin_lock_bh(&ar->txmgmt_idr_lock); - idr_remove(&ar->txmgmt_idr, buf_id); - spin_unlock_bh(&ar->txmgmt_idr_lock); - dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, - DMA_TO_DEVICE); - } + if (skb_cb->vif =3D=3D vif) + ath11k_mac_tx_mgmt_free(ar, buf_id); =20 return 0; } @@ -4985,6 +4988,8 @@ static int ath11k_mac_mgmt_tx_wmi(struct ath11k *ar, = struct ath11k_vif *arvif, int buf_id; int ret; =20 + ATH11K_SKB_CB(skb)->ar =3D ar; + spin_lock_bh(&ar->txmgmt_idr_lock); buf_id =3D idr_alloc(&ar->txmgmt_idr, skb, 0, ATH11K_TX_MGMT_NUM_PENDING_MAX, GFP_ATOMIC); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7F8CC4167D for ; Mon, 24 Jan 2022 22:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580965AbiAXWLC (ORCPT ); Mon, 24 Jan 2022 17:11:02 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40340 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451624AbiAXVXP (ORCPT ); Mon, 24 Jan 2022 16:23:15 -0500 Received: from smtp.kernel.org (relay.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 DFE44B81243; Mon, 24 Jan 2022 21:23:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BC30C340E4; Mon, 24 Jan 2022 21:23:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059392; bh=NBZwb+w58QMDjJ3m+I4ByKYJLaNzKx9svwiZth3P9Ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OPMbOortj3zWynw7aiJzJZsb0pfaZ8MC+KFH3aQDdgTQ748yqVCIXqRT97zS6vFfn 7hzSg7y/4M1cNnvPCbAenY7rkUlaKjnnTt5uHcEXpIdLCGKVoIBjjuI5gCUFjrBWi+ 23+ruUMC8/28DWG+bcVKTxWCRInbNv3sI69uSumk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mansur Alisha Shaik , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0601/1039] media: venus: avoid calling core_clk_setrate() concurrently during concurrent video sessions Date: Mon, 24 Jan 2022 19:39:50 +0100 Message-Id: <20220124184145.542235986@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mansur Alisha Shaik [ Upstream commit 91f2b7d269e5c885c38c7ffa261f5276bd42f907 ] In existing implementation, core_clk_setrate() is getting called concurrently in concurrent video sessions. Before the previous call to core_clk_setrate returns, new call to core_clk_setrate is invoked from another video session running concurrently. This results in latest calculated frequency being set (higher/lower) instead of actual frequency required for that video session. It also results in stability crashes mention below. These resources are specific to video core, hence keeping under core lock would ensure that they are estimated for all running video sessions and called once for the video core. Crash logs: [ 1.900089] WARNING: CPU: 4 PID: 1 at drivers/opp/debugfs.c:33 opp_debug= _remove_one+0x2c/0x48 [ 1.908493] Modules linked in: [ 1.911524] CPU: 4 PID: 1 Comm: swapper/0 Not tainted 5.10.67 #35 f8edb8= c30cf2dd6838495dd9ef9be47af7f5f60c [ 1.921036] Hardware name: Qualcomm Technologies, Inc. sc7280 IDP SKU2 p= latform (DT) [ 1.928673] pstate: 60800009 (nZCv daif -PAN +UAO -TCO BTYPE=3D--) [ 1.934608] pc : opp_debug_remove_one+0x2c/0x48 [ 1.939080] lr : opp_debug_remove_one+0x2c/0x48 [ 1.943560] sp : ffffffc011d7b7f0 [ 1.946836] pmr_save: 000000e0 [ 1.949854] x29: ffffffc011d7b7f0 x28: ffffffc010733bbc [ 1.955104] x27: ffffffc010733ba8 x26: ffffff8083cedd00 [ 1.960355] x25: 0000000000000001 x24: 0000000000000000 [ 1.965603] x23: ffffff8083cc2878 x22: ffffff8083ceb900 [ 1.970852] x21: ffffff8083ceb910 x20: ffffff8083cc2800 [ 1.976101] x19: ffffff8083ceb900 x18: 00000000ffff0a10 [ 1.981352] x17: ffffff80837a5620 x16: 00000000000000ec [ 1.986601] x15: ffffffc010519ad4 x14: 0000000000000003 [ 1.991849] x13: 0000000000000004 x12: 0000000000000001 [ 1.997100] x11: c0000000ffffdfff x10: 00000000ffffffff [ 2.002348] x9 : d2627c580300dc00 x8 : d2627c580300dc00 [ 2.007596] x7 : 0720072007200720 x6 : ffffff80802ecf00 [ 2.012845] x5 : 0000000000190004 x4 : 0000000000000000 [ 2.018094] x3 : ffffffc011d7b478 x2 : ffffffc011d7b480 [ 2.023343] x1 : 00000000ffffdfff x0 : 0000000000000017 [ 2.028594] Call trace: [ 2.031022] opp_debug_remove_one+0x2c/0x48 [ 2.035160] dev_pm_opp_put+0x94/0xb0 [ 2.038780] _opp_remove_all+0x7c/0xc8 [ 2.042486] _opp_remove_all_static+0x54/0x7c [ 2.046796] dev_pm_opp_remove_table+0x74/0x98 [ 2.051183] devm_pm_opp_of_table_release+0x18/0x24 [ 2.056001] devm_action_release+0x1c/0x28 [ 2.060053] release_nodes+0x23c/0x2b8 [ 2.063760] devres_release_group+0xcc/0xd0 [ 2.067900] component_bind+0xac/0x168 [ 2.071608] component_bind_all+0x98/0x124 [ 2.075664] msm_drm_bind+0x1e8/0x678 [ 2.079287] try_to_bring_up_master+0x60/0x134 [ 2.083674] component_master_add_with_match+0xd8/0x120 [ 2.088834] msm_pdev_probe+0x20c/0x2a0 [ 2.092629] platform_drv_probe+0x9c/0xbc [ 2.096598] really_probe+0x11c/0x46c [ 2.100217] driver_probe_device+0x8c/0xf0 [ 2.104270] device_driver_attach+0x54/0x78 [ 2.108407] __driver_attach+0x48/0x148 [ 2.112201] bus_for_each_dev+0x88/0xd4 [ 2.115998] driver_attach+0x2c/0x38 [ 2.119534] bus_add_driver+0x10c/0x200 [ 2.123330] driver_register+0x6c/0x104 [ 2.127122] __platform_driver_register+0x4c/0x58 [ 2.131767] msm_drm_register+0x6c/0x70 [ 2.135560] do_one_initcall+0x64/0x23c [ 2.139357] do_initcall_level+0xac/0x15c [ 2.143321] do_initcalls+0x5c/0x9c [ 2.146778] do_basic_setup+0x2c/0x38 [ 2.150401] kernel_init_freeable+0xf8/0x15c [ 2.154622] kernel_init+0x1c/0x11c [ 2.158079] ret_from_fork+0x10/0x30 [ 2.161615] ---[ end trace a2cc45a0f784b212 ]--- [ 2.166272] Removing OPP: 300000000 Signed-off-by: Mansur Alisha Shaik Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../media/platform/qcom/venus/pm_helpers.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media= /platform/qcom/venus/pm_helpers.c index 184f0cea2fdb8..cb48c5ff3dee2 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -163,14 +163,12 @@ static u32 load_per_type(struct venus_core *core, u32= session_type) struct venus_inst *inst =3D NULL; u32 mbs_per_sec =3D 0; =20 - mutex_lock(&core->lock); list_for_each_entry(inst, &core->instances, list) { if (inst->session_type !=3D session_type) continue; =20 mbs_per_sec +=3D load_per_instance(inst); } - mutex_unlock(&core->lock); =20 return mbs_per_sec; } @@ -219,14 +217,12 @@ static int load_scale_bw(struct venus_core *core) struct venus_inst *inst =3D NULL; u32 mbs_per_sec, avg, peak, total_avg =3D 0, total_peak =3D 0; =20 - mutex_lock(&core->lock); list_for_each_entry(inst, &core->instances, list) { mbs_per_sec =3D load_per_instance(inst); mbs_to_bw(inst, mbs_per_sec, &avg, &peak); total_avg +=3D avg; total_peak +=3D peak; } - mutex_unlock(&core->lock); =20 /* * keep minimum bandwidth vote for "video-mem" path, @@ -253,8 +249,9 @@ static int load_scale_v1(struct venus_inst *inst) struct device *dev =3D core->dev; u32 mbs_per_sec; unsigned int i; - int ret; + int ret =3D 0; =20 + mutex_lock(&core->lock); mbs_per_sec =3D load_per_type(core, VIDC_SESSION_TYPE_ENC) + load_per_type(core, VIDC_SESSION_TYPE_DEC); =20 @@ -279,17 +276,19 @@ set_freq: if (ret) { dev_err(dev, "failed to set clock rate %lu (%d)\n", freq, ret); - return ret; + goto exit; } =20 ret =3D load_scale_bw(core); if (ret) { dev_err(dev, "failed to set bandwidth (%d)\n", ret); - return ret; + goto exit; } =20 - return 0; +exit: + mutex_unlock(&core->lock); + return ret; } =20 static int core_get_v1(struct venus_core *core) @@ -1116,13 +1115,13 @@ static int load_scale_v4(struct venus_inst *inst) struct device *dev =3D core->dev; unsigned long freq =3D 0, freq_core1 =3D 0, freq_core2 =3D 0; unsigned long filled_len =3D 0; - int i, ret; + int i, ret =3D 0; =20 for (i =3D 0; i < inst->num_input_bufs; i++) filled_len =3D max(filled_len, inst->payloads[i]); =20 if (inst->session_type =3D=3D VIDC_SESSION_TYPE_DEC && !filled_len) - return 0; + return ret; =20 freq =3D calculate_inst_freq(inst, filled_len); inst->clk_data.freq =3D freq; @@ -1138,7 +1137,6 @@ static int load_scale_v4(struct venus_inst *inst) freq_core2 +=3D inst->clk_data.freq; } } - mutex_unlock(&core->lock); =20 freq =3D max(freq_core1, freq_core2); =20 @@ -1163,17 +1161,19 @@ set_freq: if (ret) { dev_err(dev, "failed to set clock rate %lu (%d)\n", freq, ret); - return ret; + goto exit; } =20 ret =3D load_scale_bw(core); if (ret) { dev_err(dev, "failed to set bandwidth (%d)\n", ret); - return ret; + goto exit; } =20 - return 0; +exit: + mutex_unlock(&core->lock); + return ret; } =20 static const struct venus_pm_ops pm_ops_v4 =3D { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 560E2C43217 for ; Mon, 24 Jan 2022 22:06:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579514AbiAXWFu (ORCPT ); Mon, 24 Jan 2022 17:05:50 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40378 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451683AbiAXVXV (ORCPT ); Mon, 24 Jan 2022 16:23:21 -0500 Received: from smtp.kernel.org (relay.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 14973B812A5; Mon, 24 Jan 2022 21:23:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CABFC340E4; Mon, 24 Jan 2022 21:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059398; bh=AXo2SKIfBrFl+rOiVbbS6B5EIC7YCr/SvPrUDVh/G4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gNk40HvlRwkbemebPbUe1fIVVztT8DPR/kxwCVbMwTEJF4WtpMKEMNSxxoJhygzcM 4yCp4vCO8ijXQrSvSKPzGXz6aGUm+D3ORZaUJcHq6fjn4BRqcbwSVRH6ajObM+vT2A dGQZG16nIX/ErapTrJFvsIt7ui6vmJdXRTX8Rvt0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Ward , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0602/1039] regulator: da9121: Prevent current limit change when enabled Date: Mon, 24 Jan 2022 19:39:51 +0100 Message-Id: <20220124184145.573533146@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adam Ward [ Upstream commit 24f0853228f3b98f1ef08d5824376c69bb8124d2 ] Prevent changing current limit when enabled as a precaution against possibile instability due to tight integration with switching cycle Signed-off-by: Adam Ward Link: https://lore.kernel.org/r/52ee682476004a1736c1e0293358987319c1c415.16= 38223185.git.Adam.Ward.opensource@diasemi.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/regulator/da9121-regulator.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da912= 1-regulator.c index e669250902580..0a4fd449c27d1 100644 --- a/drivers/regulator/da9121-regulator.c +++ b/drivers/regulator/da9121-regulator.c @@ -253,6 +253,11 @@ static int da9121_set_current_limit(struct regulator_d= ev *rdev, goto error; } =20 + if (rdev->desc->ops->is_enabled(rdev)) { + ret =3D -EBUSY; + goto error; + } + ret =3D da9121_ceiling_selector(rdev, min_ua, max_ua, &sel); if (ret < 0) goto error; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EC3AC433EF for ; Mon, 24 Jan 2022 23:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366983AbiAXXxy (ORCPT ); Mon, 24 Jan 2022 18:53:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846131AbiAXXOa (ORCPT ); Mon, 24 Jan 2022 18:14:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55802C06176A; Mon, 24 Jan 2022 13:23:24 -0800 (PST) Received: from smtp.kernel.org (relay.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 1E8ABB8105C; Mon, 24 Jan 2022 21:23:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 390B6C340E4; Mon, 24 Jan 2022 21:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059401; bh=6xvV/GFUTTbXguNm6jo1qvCc+irsly4Qs2GXu5oETWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nK/ebRQaPOnh0FR5f4BetNJ6LJHAVowJIeBiAjObhg9yIqermBih771VvJL6VSIqZ XZoYkfBCkXCRC/xlvXuFBzZIt3jCqMXNsjlEnzOgSa0hs821zkdS6bviCQnqbJ+4T4 bMsQZpBVh6zmx07soLfCbUKiFJXNmvmcq2ubf0pg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zack Rusin , Martin Krastev , Sasha Levin Subject: [PATCH 5.16 0603/1039] drm/vmwgfx: Release ttm memory if probe fails Date: Mon, 24 Jan 2022 19:39:52 +0100 Message-Id: <20220124184145.605920205@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zack Rusin [ Upstream commit 28b5f3b6121b7db2a44be499cfca0b6b801588b6 ] The ttm mem global state was leaking if the vmwgfx driver load failed. In case of a driver load failure we have to make sure we also release the ttm mem global state. Signed-off-by: Zack Rusin Reviewed-by: Martin Krastev Link: https://patchwork.freedesktop.org/patch/msgid/20211105193845.258816-3= -zackr@vmware.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/v= mwgfx_drv.c index bfd71c86faa58..68f46f9e032dd 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -1617,34 +1617,40 @@ static int vmw_probe(struct pci_dev *pdev, const st= ruct pci_device_id *ent) =20 ret =3D drm_aperture_remove_conflicting_pci_framebuffers(pdev, &driver); if (ret) - return ret; + goto out_error; =20 ret =3D pcim_enable_device(pdev); if (ret) - return ret; + goto out_error; =20 vmw =3D devm_drm_dev_alloc(&pdev->dev, &driver, struct vmw_private, drm); - if (IS_ERR(vmw)) - return PTR_ERR(vmw); + if (IS_ERR(vmw)) { + ret =3D PTR_ERR(vmw); + goto out_error; + } =20 pci_set_drvdata(pdev, &vmw->drm); =20 ret =3D ttm_mem_global_init(&ttm_mem_glob, &pdev->dev); if (ret) - return ret; + goto out_error; =20 ret =3D vmw_driver_load(vmw, ent->device); if (ret) - return ret; + goto out_release; =20 ret =3D drm_dev_register(&vmw->drm, 0); - if (ret) { - vmw_driver_unload(&vmw->drm); - return ret; - } + if (ret) + goto out_unload; =20 return 0; +out_unload: + vmw_driver_unload(&vmw->drm); +out_release: + ttm_mem_global_release(&ttm_mem_glob); +out_error: + return ret; } =20 static int __init vmwgfx_init(void) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A781C35276 for ; Mon, 24 Jan 2022 22:06:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579444AbiAXWFi (ORCPT ); Mon, 24 Jan 2022 17:05:38 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45234 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451717AbiAXVXZ (ORCPT ); Mon, 24 Jan 2022 16:23:25 -0500 Received: from smtp.kernel.org (relay.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 9441661490; Mon, 24 Jan 2022 21:23:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59B70C340E4; Mon, 24 Jan 2022 21:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059405; bh=0/piBAE8dmqsBAOKjJqyvdqAuQdvBacMgo2AT7dyjOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oNz0LJkEfaaF6qGV2aMmBSPXhnztZ3LLMZZsMhS5F7l5pZHtc3aja4YlM0zIJlYhy cB9Ej7xMiP5Bn9gBLsljMOthRlXVC9b7Q1RPm1S6rCnqbw1ZJRP93QEEIQ7aMbdvlA FFV+PPfXBjGN3B9Gacm1x46xIA7Fhnk+wLPNh9w0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zack Rusin , Martin Krastev , =?UTF-8?q?Christian=20K=C3=B6nig?= , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Sasha Levin Subject: [PATCH 5.16 0604/1039] drm/vmwgfx: Introduce a new placement for MOB page tables Date: Mon, 24 Jan 2022 19:39:53 +0100 Message-Id: <20220124184145.638061616@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Zack Rusin [ Upstream commit f6be23264bbac88d1e2bb39658e1b8a397e3f46d ] For larger (bigger than a page) and noncontiguous mobs we have to create page tables that allow the host to find the memory. Those page tables just used regular system memory. Unfortunately in TTM those BO's are not allowed to be busy thus can't be fenced and we have to fence those bo's because we don't want to destroy the page tables while the host is still executing the command buffers which might be accessing them. To solve it we introduce a new placement VMW_PL_SYSTEM which is very similar to TTM_PL_SYSTEM except that it allows fencing. This fixes kernel oops'es during unloading of the driver (and pci hot remove/add) which were caused by busy BO's in TTM_PL_SYSTEM being present in the delayed deletion list in TTM (TTM_PL_SYSTEM manager is destroyed before the delayed deletions are executed) Signed-off-by: Zack Rusin Reviewed-by: Martin Krastev Cc: Christian K=C3=B6nig Cc: Thomas Hellstr=C3=B6m Link: https://patchwork.freedesktop.org/patch/msgid/20211105193845.258816-5= -zackr@vmware.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vmwgfx/Makefile | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 14 ++- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 12 ++- .../gpu/drm/vmwgfx/vmwgfx_system_manager.c | 90 +++++++++++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 58 ++++++------ 5 files changed, 138 insertions(+), 38 deletions(-) create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_system_manager.c diff --git a/drivers/gpu/drm/vmwgfx/Makefile b/drivers/gpu/drm/vmwgfx/Makef= ile index bc323f7d40321..0188a312c38c2 100644 --- a/drivers/gpu/drm/vmwgfx/Makefile +++ b/drivers/gpu/drm/vmwgfx/Makefile @@ -9,7 +9,7 @@ vmwgfx-y :=3D vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vm= wgfx_drv.o \ vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o \ vmwgfx_simple_resource.o vmwgfx_va.o vmwgfx_blit.o \ vmwgfx_validation.o vmwgfx_page_dirty.o vmwgfx_streamoutput.o \ - vmwgfx_devcaps.o ttm_object.o ttm_memory.o + vmwgfx_devcaps.o ttm_object.o ttm_memory.o vmwgfx_system_manager.o =20 vmwgfx-$(CONFIG_DRM_FBDEV_EMULATION) +=3D vmwgfx_fb.o vmwgfx-$(CONFIG_TRANSPARENT_HUGEPAGE) +=3D vmwgfx_thp.o diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/v= mwgfx_drv.c index 68f46f9e032dd..117a7ad800502 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -1071,6 +1071,12 @@ static int vmw_driver_load(struct vmw_private *dev_p= riv, u32 pci_id) "3D will be disabled.\n"); dev_priv->has_mob =3D false; } + if (vmw_sys_man_init(dev_priv) !=3D 0) { + drm_info(&dev_priv->drm, + "No MOB page table memory available. " + "3D will be disabled.\n"); + dev_priv->has_mob =3D false; + } } =20 if (dev_priv->has_mob && (dev_priv->capabilities & SVGA_CAP_DX)) { @@ -1121,8 +1127,10 @@ out_no_fifo: vmw_overlay_close(dev_priv); vmw_kms_close(dev_priv); out_no_kms: - if (dev_priv->has_mob) + if (dev_priv->has_mob) { vmw_gmrid_man_fini(dev_priv, VMW_PL_MOB); + vmw_sys_man_fini(dev_priv); + } if (dev_priv->has_gmr) vmw_gmrid_man_fini(dev_priv, VMW_PL_GMR); vmw_devcaps_destroy(dev_priv); @@ -1172,8 +1180,10 @@ static void vmw_driver_unload(struct drm_device *dev) vmw_gmrid_man_fini(dev_priv, VMW_PL_GMR); =20 vmw_release_device_early(dev_priv); - if (dev_priv->has_mob) + if (dev_priv->has_mob) { vmw_gmrid_man_fini(dev_priv, VMW_PL_MOB); + vmw_sys_man_fini(dev_priv); + } vmw_devcaps_destroy(dev_priv); vmw_vram_manager_fini(dev_priv); ttm_device_fini(&dev_priv->bdev); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/v= mwgfx_drv.h index 858aff99a3fe5..645c18b267e6e 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h @@ -82,8 +82,9 @@ VMWGFX_NUM_GB_SURFACE +\ VMWGFX_NUM_GB_SCREEN_TARGET) =20 -#define VMW_PL_GMR (TTM_PL_PRIV + 0) -#define VMW_PL_MOB (TTM_PL_PRIV + 1) +#define VMW_PL_GMR (TTM_PL_PRIV + 0) +#define VMW_PL_MOB (TTM_PL_PRIV + 1) +#define VMW_PL_SYSTEM (TTM_PL_PRIV + 2) =20 #define VMW_RES_CONTEXT ttm_driver_type0 #define VMW_RES_SURFACE ttm_driver_type1 @@ -1039,7 +1040,6 @@ extern struct ttm_placement vmw_vram_placement; extern struct ttm_placement vmw_vram_sys_placement; extern struct ttm_placement vmw_vram_gmr_placement; extern struct ttm_placement vmw_sys_placement; -extern struct ttm_placement vmw_evictable_placement; extern struct ttm_placement vmw_srf_placement; extern struct ttm_placement vmw_mob_placement; extern struct ttm_placement vmw_nonfixed_placement; @@ -1251,6 +1251,12 @@ int vmw_overlay_num_free_overlays(struct vmw_private= *dev_priv); int vmw_gmrid_man_init(struct vmw_private *dev_priv, int type); void vmw_gmrid_man_fini(struct vmw_private *dev_priv, int type); =20 +/** + * System memory manager + */ +int vmw_sys_man_init(struct vmw_private *dev_priv); +void vmw_sys_man_fini(struct vmw_private *dev_priv); + /** * Prime - vmwgfx_prime.c */ diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_system_manager.c b/drivers/gpu/d= rm/vmwgfx/vmwgfx_system_manager.c new file mode 100644 index 0000000000000..b0005b03a6174 --- /dev/null +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_system_manager.c @@ -0,0 +1,90 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* + * Copyright 2021 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "vmwgfx_drv.h" + +#include +#include +#include +#include +#include + + +static int vmw_sys_man_alloc(struct ttm_resource_manager *man, + struct ttm_buffer_object *bo, + const struct ttm_place *place, + struct ttm_resource **res) +{ + *res =3D kzalloc(sizeof(**res), GFP_KERNEL); + if (!*res) + return -ENOMEM; + + ttm_resource_init(bo, place, *res); + return 0; +} + +static void vmw_sys_man_free(struct ttm_resource_manager *man, + struct ttm_resource *res) +{ + kfree(res); +} + +static const struct ttm_resource_manager_func vmw_sys_manager_func =3D { + .alloc =3D vmw_sys_man_alloc, + .free =3D vmw_sys_man_free, +}; + +int vmw_sys_man_init(struct vmw_private *dev_priv) +{ + struct ttm_device *bdev =3D &dev_priv->bdev; + struct ttm_resource_manager *man =3D + kzalloc(sizeof(*man), GFP_KERNEL); + + if (!man) + return -ENOMEM; + + man->use_tt =3D true; + man->func =3D &vmw_sys_manager_func; + + ttm_resource_manager_init(man, 0); + ttm_set_driver_manager(bdev, VMW_PL_SYSTEM, man); + ttm_resource_manager_set_used(man, true); + return 0; +} + +void vmw_sys_man_fini(struct vmw_private *dev_priv) +{ + struct ttm_resource_manager *man =3D ttm_manager_type(&dev_priv->bdev, + VMW_PL_SYSTEM); + + ttm_resource_manager_evict_all(&dev_priv->bdev, man); + + ttm_resource_manager_set_used(man, false); + ttm_resource_manager_cleanup(man); + + ttm_set_driver_manager(&dev_priv->bdev, VMW_PL_SYSTEM, NULL); + kfree(man); +} diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/v= mwgfx/vmwgfx_ttm_buffer.c index e899a936a42a0..b15228e7dbeb8 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c @@ -92,6 +92,13 @@ static const struct ttm_place gmr_vram_placement_flags[]= =3D { } }; =20 +static const struct ttm_place vmw_sys_placement_flags =3D { + .fpfn =3D 0, + .lpfn =3D 0, + .mem_type =3D VMW_PL_SYSTEM, + .flags =3D 0 +}; + struct ttm_placement vmw_vram_gmr_placement =3D { .num_placement =3D 2, .placement =3D vram_gmr_placement_flags, @@ -113,28 +120,11 @@ struct ttm_placement vmw_sys_placement =3D { .busy_placement =3D &sys_placement_flags }; =20 -static const struct ttm_place evictable_placement_flags[] =3D { - { - .fpfn =3D 0, - .lpfn =3D 0, - .mem_type =3D TTM_PL_SYSTEM, - .flags =3D 0 - }, { - .fpfn =3D 0, - .lpfn =3D 0, - .mem_type =3D TTM_PL_VRAM, - .flags =3D 0 - }, { - .fpfn =3D 0, - .lpfn =3D 0, - .mem_type =3D VMW_PL_GMR, - .flags =3D 0 - }, { - .fpfn =3D 0, - .lpfn =3D 0, - .mem_type =3D VMW_PL_MOB, - .flags =3D 0 - } +struct ttm_placement vmw_pt_sys_placement =3D { + .num_placement =3D 1, + .placement =3D &vmw_sys_placement_flags, + .num_busy_placement =3D 1, + .busy_placement =3D &vmw_sys_placement_flags }; =20 static const struct ttm_place nonfixed_placement_flags[] =3D { @@ -156,13 +146,6 @@ static const struct ttm_place nonfixed_placement_flags= [] =3D { } }; =20 -struct ttm_placement vmw_evictable_placement =3D { - .num_placement =3D 4, - .placement =3D evictable_placement_flags, - .num_busy_placement =3D 1, - .busy_placement =3D &sys_placement_flags -}; - struct ttm_placement vmw_srf_placement =3D { .num_placement =3D 1, .num_busy_placement =3D 2, @@ -484,6 +467,9 @@ static int vmw_ttm_bind(struct ttm_device *bdev, &vmw_be->vsgt, ttm->num_pages, vmw_be->gmr_id); break; + case VMW_PL_SYSTEM: + /* Nothing to be done for a system bind */ + break; default: BUG(); } @@ -507,6 +493,8 @@ static void vmw_ttm_unbind(struct ttm_device *bdev, case VMW_PL_MOB: vmw_mob_unbind(vmw_be->dev_priv, vmw_be->mob); break; + case VMW_PL_SYSTEM: + break; default: BUG(); } @@ -624,6 +612,7 @@ static int vmw_ttm_io_mem_reserve(struct ttm_device *bd= ev, struct ttm_resource * =20 switch (mem->mem_type) { case TTM_PL_SYSTEM: + case VMW_PL_SYSTEM: case VMW_PL_GMR: case VMW_PL_MOB: return 0; @@ -670,6 +659,11 @@ static void vmw_swap_notify(struct ttm_buffer_object *= bo) (void) ttm_bo_wait(bo, false, false); } =20 +static bool vmw_memtype_is_system(uint32_t mem_type) +{ + return mem_type =3D=3D TTM_PL_SYSTEM || mem_type =3D=3D VMW_PL_SYSTEM; +} + static int vmw_move(struct ttm_buffer_object *bo, bool evict, struct ttm_operation_ctx *ctx, @@ -680,7 +674,7 @@ static int vmw_move(struct ttm_buffer_object *bo, struct ttm_resource_manager *new_man =3D ttm_manager_type(bo->bdev, new_m= em->mem_type); int ret; =20 - if (new_man->use_tt && new_mem->mem_type !=3D TTM_PL_SYSTEM) { + if (new_man->use_tt && !vmw_memtype_is_system(new_mem->mem_type)) { ret =3D vmw_ttm_bind(bo->bdev, bo->ttm, new_mem); if (ret) return ret; @@ -689,7 +683,7 @@ static int vmw_move(struct ttm_buffer_object *bo, vmw_move_notify(bo, bo->resource, new_mem); =20 if (old_man->use_tt && new_man->use_tt) { - if (bo->resource->mem_type =3D=3D TTM_PL_SYSTEM) { + if (vmw_memtype_is_system(bo->resource->mem_type)) { ttm_bo_move_null(bo, new_mem); return 0; } @@ -736,7 +730,7 @@ int vmw_bo_create_and_populate(struct vmw_private *dev_= priv, int ret; =20 ret =3D vmw_bo_create_kernel(dev_priv, bo_size, - &vmw_sys_placement, + &vmw_pt_sys_placement, &bo); if (unlikely(ret !=3D 0)) return ret; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A2C2C35273 for ; Mon, 24 Jan 2022 23:58:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367133AbiAXXyN (ORCPT ); Mon, 24 Jan 2022 18:54:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846324AbiAXXPj (ORCPT ); Mon, 24 Jan 2022 18:15:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 891B2C06177C; Mon, 24 Jan 2022 13:23:30 -0800 (PST) Received: from smtp.kernel.org (relay.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 456E4B8105C; Mon, 24 Jan 2022 21:23:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BD7FC340E7; Mon, 24 Jan 2022 21:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059408; bh=PJa9pJriew9OaMlnsA9qTXusUtpxB4DAsf4xRVD7nJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iLJsVU1PwzfyydRJKhRk4O4oQIvUbnZDY8InpdT3DloyHV043lXYZPo9RHuwK5trp Jx5UUz7w8uJWiv2+tbd2Zq8yYL1fcL5hQwkDIxAi6s+fKiZOM3osZscZ9eVIpXkijP Aaw8yMIJUWJZl8rtYthCcRAUSdS15WcBrSr8Cbms= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0605/1039] ACPI / x86: Drop PWM2 device on Lenovo Yoga Book from always present table Date: Mon, 24 Jan 2022 19:39:54 +0100 Message-Id: <20220124184145.668191846@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit d431dfb764b145369be820fcdfd50f2159b9bbc2 ] It turns out that there is a WMI object which controls the PWM2 device used for the keyboard backlight and that WMI object also provides some other useful functionality. The upcoming lenovo-yogabook-wmi driver will offer both backlight control and the other functionality, so there no longer is a need to have the lpss-pwm driver binding to PWM2 for backlight control; and this is now actually undesirable because this will cause both the WMI code and the lpss-pwm driver to poke at the same PWM controller. Drop the always-present quirk for the PWM2 ACPI-device, so that the lpss-pwm controller will no longer bind to it. Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/x86/utils.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c index f22f23933063b..3bcac98f6eca6 100644 --- a/drivers/acpi/x86/utils.c +++ b/drivers/acpi/x86/utils.c @@ -54,10 +54,6 @@ static const struct always_present_id always_present_ids= [] =3D { ENTRY("80860F09", "1", X86_MATCH(ATOM_SILVERMONT), {}), ENTRY("80862288", "1", X86_MATCH(ATOM_AIRMONT), {}), =20 - /* Lenovo Yoga Book uses PWM2 for keyboard backlight control */ - ENTRY("80862289", "2", X86_MATCH(ATOM_AIRMONT), { - DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), - }), /* * The INT0002 device is necessary to clear wakeup interrupt sources * on Cherry Trail devices, without it we get nobody cared IRQ msgs. --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 293E9C433FE for ; Mon, 24 Jan 2022 22:14:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580922AbiAXWK6 (ORCPT ); Mon, 24 Jan 2022 17:10:58 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40466 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451757AbiAXVXd (ORCPT ); Mon, 24 Jan 2022 16:23:33 -0500 Received: from smtp.kernel.org (relay.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 3220CB81218; Mon, 24 Jan 2022 21:23:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59BF2C340E4; Mon, 24 Jan 2022 21:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059410; bh=QbywbAkiZZf7B4uSrLQeF2h38uZrBQBQWJ34uLHNb1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z1IDNVGNiszmyuJ3jsCwp6ht6Qnjn72AvDhXgAKDgBQAp3SGbLs1jw9/ns29gnPsV XjAqQKgTUsUx3vlKXSXC2Qpm8/oiGKbSo7pWcR20FSjWXPHYHN0waoGMWTBaWvGeB0 blEDMkcscTqyplD7XE8WEyf24dy/hDU3lDDnDXWg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0606/1039] ACPI: Change acpi_device_always_present() into acpi_device_override_status() Date: Mon, 24 Jan 2022 19:39:55 +0100 Message-Id: <20220124184145.702227161@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 1a68b346a2c9969c05e80a3b99a9ab160b5655c0 ] Currently, acpi_bus_get_status() calls acpi_device_always_present() to allow platform quirks to override the _STA return to report that a device is present (status =3D ACPI_STA_DEFAULT) independent of the _STA return. In some cases it might also be useful to have the opposite functionality and have a platform quirk which marks a device as not present (status =3D 0) to work around ACPI table bugs. Change acpi_device_always_present() into a more generic acpi_device_override_status() function to allow this. Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/bus.c | 4 +-- drivers/acpi/x86/utils.c | 64 +++++++++++++++++++++++----------------- include/acpi/acpi_bus.h | 5 ++-- 3 files changed, 42 insertions(+), 31 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index fa923a9292244..dd535b4b9a160 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -98,8 +98,8 @@ int acpi_bus_get_status(struct acpi_device *device) acpi_status status; unsigned long long sta; =20 - if (acpi_device_always_present(device)) { - acpi_set_device_status(device, ACPI_STA_DEFAULT); + if (acpi_device_override_status(device, &sta)) { + acpi_set_device_status(device, sta); return 0; } =20 diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c index 3bcac98f6eca6..edb4f3fd93dc3 100644 --- a/drivers/acpi/x86/utils.c +++ b/drivers/acpi/x86/utils.c @@ -22,54 +22,63 @@ * Some BIOS-es (temporarily) hide specific APCI devices to work around Wi= ndows * driver bugs. We use DMI matching to match known cases of this. * - * We work around this by always reporting ACPI_STA_DEFAULT for these - * devices. Note this MUST only be done for devices where this is safe. + * Likewise sometimes some not-actually present devices are sometimes + * reported as present, which may cause issues. * - * This forcing of devices to be present is limited to specific CPU (SoC) - * models both to avoid potentially causing trouble on other models and - * because some HIDs are re-used on different SoCs for completely - * different devices. + * We work around this by using the below quirk list to override the status + * reported by the _STA method with a fixed value (ACPI_STA_DEFAULT or 0). + * Note this MUST only be done for devices where this is safe. + * + * This status overriding is limited to specific CPU (SoC) models both to + * avoid potentially causing trouble on other models and because some HIDs + * are re-used on different SoCs for completely different devices. */ -struct always_present_id { +struct override_status_id { struct acpi_device_id hid[2]; struct x86_cpu_id cpu_ids[2]; struct dmi_system_id dmi_ids[2]; /* Optional */ const char *uid; + unsigned long long status; }; =20 -#define X86_MATCH(model) X86_MATCH_INTEL_FAM6_MODEL(model, NULL) - -#define ENTRY(hid, uid, cpu_models, dmi...) { \ +#define ENTRY(status, hid, uid, cpu_model, dmi...) { \ { { hid, }, {} }, \ - { cpu_models, {} }, \ + { X86_MATCH_INTEL_FAM6_MODEL(cpu_model, NULL), {} }, \ { { .matches =3D dmi }, {} }, \ uid, \ + status, \ } =20 -static const struct always_present_id always_present_ids[] =3D { +#define PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ + ENTRY(ACPI_STA_DEFAULT, hid, uid, cpu_model, dmi) + +#define NOT_PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ + ENTRY(0, hid, uid, cpu_model, dmi) + +static const struct override_status_id override_status_ids[] =3D { /* * Bay / Cherry Trail PWM directly poked by GPU driver in win10, * but Linux uses a separate PWM driver, harmless if not used. */ - ENTRY("80860F09", "1", X86_MATCH(ATOM_SILVERMONT), {}), - ENTRY("80862288", "1", X86_MATCH(ATOM_AIRMONT), {}), + PRESENT_ENTRY_HID("80860F09", "1", ATOM_SILVERMONT, {}), + PRESENT_ENTRY_HID("80862288", "1", ATOM_AIRMONT, {}), =20 /* * The INT0002 device is necessary to clear wakeup interrupt sources * on Cherry Trail devices, without it we get nobody cared IRQ msgs. */ - ENTRY("INT0002", "1", X86_MATCH(ATOM_AIRMONT), {}), + PRESENT_ENTRY_HID("INT0002", "1", ATOM_AIRMONT, {}), /* * On the Dell Venue 11 Pro 7130 and 7139, the DSDT hides * the touchscreen ACPI device until a certain time * after _SB.PCI0.GFX0.LCD.LCD1._ON gets called has passed * *and* _STA has been called at least 3 times since. */ - ENTRY("SYNA7500", "1", X86_MATCH(HASWELL_L), { + PRESENT_ENTRY_HID("SYNA7500", "1", HASWELL_L, { DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7130"), }), - ENTRY("SYNA7500", "1", X86_MATCH(HASWELL_L), { + PRESENT_ENTRY_HID("SYNA7500", "1", HASWELL_L, { DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7139"), }), @@ -85,19 +94,19 @@ static const struct always_present_id always_present_id= s[] =3D { * was copy-pasted from the GPD win, so it has a disabled KIOX000A * node which we should not enable, thus we also check the BIOS date. */ - ENTRY("KIOX000A", "1", X86_MATCH(ATOM_AIRMONT), { + PRESENT_ENTRY_HID("KIOX000A", "1", ATOM_AIRMONT, { DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_MATCH(DMI_BOARD_NAME, "Default string"), DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_BIOS_DATE, "02/21/2017") }), - ENTRY("KIOX000A", "1", X86_MATCH(ATOM_AIRMONT), { + PRESENT_ENTRY_HID("KIOX000A", "1", ATOM_AIRMONT, { DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_MATCH(DMI_BOARD_NAME, "Default string"), DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_BIOS_DATE, "03/20/2017") }), - ENTRY("KIOX000A", "1", X86_MATCH(ATOM_AIRMONT), { + PRESENT_ENTRY_HID("KIOX000A", "1", ATOM_AIRMONT, { DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_MATCH(DMI_BOARD_NAME, "Default string"), DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), @@ -105,26 +114,27 @@ static const struct always_present_id always_present_= ids[] =3D { }), }; =20 -bool acpi_device_always_present(struct acpi_device *adev) +bool acpi_device_override_status(struct acpi_device *adev, unsigned long l= ong *status) { bool ret =3D false; unsigned int i; =20 - for (i =3D 0; i < ARRAY_SIZE(always_present_ids); i++) { - if (acpi_match_device_ids(adev, always_present_ids[i].hid)) + for (i =3D 0; i < ARRAY_SIZE(override_status_ids); i++) { + if (acpi_match_device_ids(adev, override_status_ids[i].hid)) continue; =20 if (!adev->pnp.unique_id || - strcmp(adev->pnp.unique_id, always_present_ids[i].uid)) + strcmp(adev->pnp.unique_id, override_status_ids[i].uid)) continue; =20 - if (!x86_match_cpu(always_present_ids[i].cpu_ids)) + if (!x86_match_cpu(override_status_ids[i].cpu_ids)) continue; =20 - if (always_present_ids[i].dmi_ids[0].matches[0].slot && - !dmi_check_system(always_present_ids[i].dmi_ids)) + if (override_status_ids[i].dmi_ids[0].matches[0].slot && + !dmi_check_system(override_status_ids[i].dmi_ids)) continue; =20 + *status =3D override_status_ids[i].status; ret =3D true; break; } diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 480f9207a4c6b..d6fe27b695c3d 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -613,9 +613,10 @@ int acpi_enable_wakeup_device_power(struct acpi_device= *dev, int state); int acpi_disable_wakeup_device_power(struct acpi_device *dev); =20 #ifdef CONFIG_X86 -bool acpi_device_always_present(struct acpi_device *adev); +bool acpi_device_override_status(struct acpi_device *adev, unsigned long l= ong *status); #else -static inline bool acpi_device_always_present(struct acpi_device *adev) +static inline bool acpi_device_override_status(struct acpi_device *adev, + unsigned long long *status) { return false; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 381A5C4167E for ; Mon, 24 Jan 2022 22:07:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579584AbiAXWGB (ORCPT ); Mon, 24 Jan 2022 17:06:01 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40482 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451787AbiAXVXg (ORCPT ); Mon, 24 Jan 2022 16:23:36 -0500 Received: from smtp.kernel.org (relay.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 1B794B81257; Mon, 24 Jan 2022 21:23:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D091C340E4; Mon, 24 Jan 2022 21:23:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059413; bh=gHZDIl4ijtbPfwSZrWODXsLXyJ1ff7iEnfrh/2hqDMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CytcIZohEIc9zusP+zOgHcNusp83F9cdpBTB4nKM01e9YbZTGpCh8JyF33/CTy6bi Rt5fvd9xnIf+pGlnPG/Gs7tg3Ff8ZJicxTT2dt2Bq3Ns0z7BMXvsukEqreklnM+7IQ jJjVWIqncDATcKujhPmgsD1WvSwwjG+WhdKlaF4c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0607/1039] ACPI / x86: Allow specifying acpi_device_override_status() quirks by path Date: Mon, 24 Jan 2022 19:39:56 +0100 Message-Id: <20220124184145.735990249@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit ba46e42e925b5d09b4e441f8de3db119cc7df58f ] Not all ACPI-devices have a HID + UID, allow specifying quirks for acpi_device_override_status() by path too. Note this moves the path/HID+UID check to after the CPU + DMI checks since the path lookup is somewhat costly. This way this lookup is only done on devices where the other checks match. Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/x86/utils.c | 42 ++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c index edb4f3fd93dc3..190bfc2ab3f26 100644 --- a/drivers/acpi/x86/utils.c +++ b/drivers/acpi/x86/utils.c @@ -38,22 +38,30 @@ struct override_status_id { struct x86_cpu_id cpu_ids[2]; struct dmi_system_id dmi_ids[2]; /* Optional */ const char *uid; + const char *path; unsigned long long status; }; =20 -#define ENTRY(status, hid, uid, cpu_model, dmi...) { \ +#define ENTRY(status, hid, uid, path, cpu_model, dmi...) { \ { { hid, }, {} }, \ { X86_MATCH_INTEL_FAM6_MODEL(cpu_model, NULL), {} }, \ { { .matches =3D dmi }, {} }, \ uid, \ + path, \ status, \ } =20 #define PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ - ENTRY(ACPI_STA_DEFAULT, hid, uid, cpu_model, dmi) + ENTRY(ACPI_STA_DEFAULT, hid, uid, NULL, cpu_model, dmi) =20 #define NOT_PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ - ENTRY(0, hid, uid, cpu_model, dmi) + ENTRY(0, hid, uid, NULL, cpu_model, dmi) + +#define PRESENT_ENTRY_PATH(path, cpu_model, dmi...) \ + ENTRY(ACPI_STA_DEFAULT, "", NULL, path, cpu_model, dmi) + +#define NOT_PRESENT_ENTRY_PATH(path, cpu_model, dmi...) \ + ENTRY(0, "", NULL, path, cpu_model, dmi) =20 static const struct override_status_id override_status_ids[] =3D { /* @@ -120,13 +128,6 @@ bool acpi_device_override_status(struct acpi_device *a= dev, unsigned long long *s unsigned int i; =20 for (i =3D 0; i < ARRAY_SIZE(override_status_ids); i++) { - if (acpi_match_device_ids(adev, override_status_ids[i].hid)) - continue; - - if (!adev->pnp.unique_id || - strcmp(adev->pnp.unique_id, override_status_ids[i].uid)) - continue; - if (!x86_match_cpu(override_status_ids[i].cpu_ids)) continue; =20 @@ -134,6 +135,27 @@ bool acpi_device_override_status(struct acpi_device *a= dev, unsigned long long *s !dmi_check_system(override_status_ids[i].dmi_ids)) continue; =20 + if (override_status_ids[i].path) { + struct acpi_buffer path =3D { ACPI_ALLOCATE_BUFFER, NULL }; + bool match; + + if (acpi_get_name(adev->handle, ACPI_FULL_PATHNAME, &path)) + continue; + + match =3D strcmp((char *)path.pointer, override_status_ids[i].path) =3D= =3D 0; + kfree(path.pointer); + + if (!match) + continue; + } else { + if (acpi_match_device_ids(adev, override_status_ids[i].hid)) + continue; + + if (!adev->pnp.unique_id || + strcmp(adev->pnp.unique_id, override_status_ids[i].uid)) + continue; + } + *status =3D override_status_ids[i].status; ret =3D true; break; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10697C433F5 for ; Mon, 24 Jan 2022 23:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386414AbiAXX5P (ORCPT ); Mon, 24 Jan 2022 18:57:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846344AbiAXXPn (ORCPT ); Mon, 24 Jan 2022 18:15:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A9D1C06177D; Mon, 24 Jan 2022 13:23:39 -0800 (PST) Received: from smtp.kernel.org (relay.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 2453FB8105C; Mon, 24 Jan 2022 21:23:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E40EC340E4; Mon, 24 Jan 2022 21:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059416; bh=a3dFkuC1B1onUYYjOCkI8tMCtX9oDS/YpYKObjKeaao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UC6+XVhfuGX/FUZiRCl/hci9Jw8xjCBYSEyVImxP5V8YZktzCRr6+d+JP5u20Wvdv WVFqnKzGN4Mt4nhCLP9lvrwpqYn8wz1ooh5a1MAFMSL5F3vH1ZPppMKRSPU9dDxPT9 HVZo2atsanRPL1OG5secCTR07RfvoPY1sNpM2JCQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0608/1039] ACPI / x86: Add not-present quirk for the PCI0.SDHB.BRC1 device on the GPD win Date: Mon, 24 Jan 2022 19:39:57 +0100 Message-Id: <20220124184145.772042657@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 57d2dbf710d832841872fb15ebb79429cab90fae ] The GPD win and its sibling the GPD pocket (99% the same electronics in a different case) use a PCI wifi card. But the ACPI tables on both variants contain a bug where the SDIO MMC controller for SDIO wifi cards is enabled despite this. This SDIO MMC controller has a PCI0.SDHB.BRC1 child-device which _PS3 method sets a GPIO causing the PCI wifi card to turn off. At the moment there is a pretty ugly kludge in the sdhci-acpi.c code, just to work around the bug in the DSDT of this single design. This can be solved cleaner/simply with a quirk overriding the _STA return of the broken PCI0.SDHB.BRC1 PCI0.SDHB.BRC1 child with a status value of 0, so that its power_manageable flag gets cleared, avoiding this problem. Note that even though it is not used, the _STA method for the MMC controller is deliberately not overridden. If the status of the MMC controller were forced to 0 it would never get suspended, which would cause these mini-laptops to not reach S0i3 level when suspended. Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/x86/utils.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c index 190bfc2ab3f26..b3fb428461c6f 100644 --- a/drivers/acpi/x86/utils.c +++ b/drivers/acpi/x86/utils.c @@ -94,9 +94,10 @@ static const struct override_status_id override_status_i= ds[] =3D { /* * The GPD win BIOS dated 20170221 has disabled the accelerometer, the * drivers sometimes cause crashes under Windows and this is how the - * manufacturer has solved this :| Note that the the DMI data is less - * generic then it seems, a board_vendor of "AMI Corporation" is quite - * rare and a board_name of "Default String" also is rare. + * manufacturer has solved this :| The DMI match may not seem unique, + * but it is. In the 67000+ DMI decode dumps from linux-hardware.org + * only 116 have board_vendor set to "AMI Corporation" and of those 116 + * only the GPD win and pocket entries' board_name is "Default string". * * Unfortunately the GPD pocket also uses these strings and its BIOS * was copy-pasted from the GPD win, so it has a disabled KIOX000A @@ -120,6 +121,19 @@ static const struct override_status_id override_status= _ids[] =3D { DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_BIOS_DATE, "05/25/2017") }), + + /* + * The GPD win/pocket have a PCI wifi card, but its DSDT has the SDIO + * mmc controller enabled and that has a child-device which _PS3 + * method sets a GPIO causing the PCI wifi card to turn off. + * See above remark about uniqueness of the DMI match. + */ + NOT_PRESENT_ENTRY_PATH("\\_SB_.PCI0.SDHB.BRC1", ATOM_AIRMONT, { + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), + DMI_EXACT_MATCH(DMI_BOARD_SERIAL, "Default string"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"), + }), }; =20 bool acpi_device_override_status(struct acpi_device *adev, unsigned long l= ong *status) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA486C47082 for ; Mon, 24 Jan 2022 23:58:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367149AbiAXXyP (ORCPT ); Mon, 24 Jan 2022 18:54:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846348AbiAXXPn (ORCPT ); Mon, 24 Jan 2022 18:15:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED643C06177E; Mon, 24 Jan 2022 13:23:40 -0800 (PST) Received: from smtp.kernel.org (relay.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 89C6560C44; Mon, 24 Jan 2022 21:23:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F61AC340E4; Mon, 24 Jan 2022 21:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059420; bh=XqqZhZVVlX5olFQFKA/GsYEKRETBxCwomFV/uenBILs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HVPySKgXLd8qShyBcwbqgx5+sTLlyv85f0epauHbsoj/VbVpn1l414cqXTni4Ep2I sh0MnkQcYFI+VQekyj9cWboOZeuLb7Dd9GmTPJ0zHkefYkLWrmhcaMsU/IF2s0v+Pq Kk+7j7zyrQQvLJkp9RvxXLKj+YeUb95g3wOVUjEU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Steven Price , Maxime Ripard , Sasha Levin Subject: [PATCH 5.16 0609/1039] drm: Return error codes from struct drm_driver.gem_create_object Date: Mon, 24 Jan 2022 19:39:58 +0100 Message-Id: <20220124184145.811328797@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thomas Zimmermann [ Upstream commit 4ff22f487f8c26b99cbe1678344595734c001a39 ] GEM helper libraries use struct drm_driver.gem_create_object to let drivers override GEM object allocation. On failure, the call returns NULL. Change the semantics to make the calls return a pointer-encoded error. This aligns the callback with its callers. Fixes the ingenic driver, which already returns an error pointer. Also update the callers to handle the involved types more strictly. Signed-off-by: Thomas Zimmermann Reviewed-by: Steven Price Acked-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20211130095255.26710-1-= tzimmermann@suse.de Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/drm_gem_cma_helper.c | 17 ++++++++++------- drivers/gpu/drm/drm_gem_shmem_helper.c | 17 ++++++++++------- drivers/gpu/drm/drm_gem_vram_helper.c | 4 ++-- drivers/gpu/drm/lima/lima_gem.c | 2 +- drivers/gpu/drm/panfrost/panfrost_gem.c | 2 +- drivers/gpu/drm/v3d/v3d_bo.c | 4 ++-- drivers/gpu/drm/vgem/vgem_drv.c | 2 +- drivers/gpu/drm/virtio/virtgpu_object.c | 2 +- include/drm/drm_drv.h | 5 +++-- 9 files changed, 31 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem= _cma_helper.c index 9d05674550a4f..1e7e8cd64cb58 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -62,18 +62,21 @@ __drm_gem_cma_create(struct drm_device *drm, size_t siz= e, bool private) struct drm_gem_object *gem_obj; int ret =3D 0; =20 - if (drm->driver->gem_create_object) + if (drm->driver->gem_create_object) { gem_obj =3D drm->driver->gem_create_object(drm, size); - else - gem_obj =3D kzalloc(sizeof(*cma_obj), GFP_KERNEL); - if (!gem_obj) - return ERR_PTR(-ENOMEM); + if (IS_ERR(gem_obj)) + return ERR_CAST(gem_obj); + cma_obj =3D to_drm_gem_cma_obj(gem_obj); + } else { + cma_obj =3D kzalloc(sizeof(*cma_obj), GFP_KERNEL); + if (!cma_obj) + return ERR_PTR(-ENOMEM); + gem_obj =3D &cma_obj->base; + } =20 if (!gem_obj->funcs) gem_obj->funcs =3D &drm_gem_cma_default_funcs; =20 - cma_obj =3D container_of(gem_obj, struct drm_gem_cma_object, base); - if (private) { drm_gem_private_object_init(drm, gem_obj, size); =20 diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_g= em_shmem_helper.c index bca0de92802ef..fe157bf278347 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -51,14 +51,17 @@ __drm_gem_shmem_create(struct drm_device *dev, size_t s= ize, bool private) =20 size =3D PAGE_ALIGN(size); =20 - if (dev->driver->gem_create_object) + if (dev->driver->gem_create_object) { obj =3D dev->driver->gem_create_object(dev, size); - else - obj =3D kzalloc(sizeof(*shmem), GFP_KERNEL); - if (!obj) - return ERR_PTR(-ENOMEM); - - shmem =3D to_drm_gem_shmem_obj(obj); + if (IS_ERR(obj)) + return ERR_CAST(obj); + shmem =3D to_drm_gem_shmem_obj(obj); + } else { + shmem =3D kzalloc(sizeof(*shmem), GFP_KERNEL); + if (!shmem) + return ERR_PTR(-ENOMEM); + obj =3D &shmem->base; + } =20 if (!obj->funcs) obj->funcs =3D &drm_gem_shmem_funcs; diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_ge= m_vram_helper.c index bfa386b981346..3f00192215d11 100644 --- a/drivers/gpu/drm/drm_gem_vram_helper.c +++ b/drivers/gpu/drm/drm_gem_vram_helper.c @@ -197,8 +197,8 @@ struct drm_gem_vram_object *drm_gem_vram_create(struct = drm_device *dev, =20 if (dev->driver->gem_create_object) { gem =3D dev->driver->gem_create_object(dev, size); - if (!gem) - return ERR_PTR(-ENOMEM); + if (IS_ERR(gem)) + return ERR_CAST(gem); gbo =3D drm_gem_vram_of_gem(gem); } else { gbo =3D kzalloc(sizeof(*gbo), GFP_KERNEL); diff --git a/drivers/gpu/drm/lima/lima_gem.c b/drivers/gpu/drm/lima/lima_ge= m.c index 640acc060467c..54823bd701a4b 100644 --- a/drivers/gpu/drm/lima/lima_gem.c +++ b/drivers/gpu/drm/lima/lima_gem.c @@ -221,7 +221,7 @@ struct drm_gem_object *lima_gem_create_object(struct dr= m_device *dev, size_t siz =20 bo =3D kzalloc(sizeof(*bo), GFP_KERNEL); if (!bo) - return NULL; + return ERR_PTR(-ENOMEM); =20 mutex_init(&bo->lock); INIT_LIST_HEAD(&bo->va); diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panf= rost/panfrost_gem.c index 23377481f4e31..39ac031548954 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gem.c +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c @@ -221,7 +221,7 @@ struct drm_gem_object *panfrost_gem_create_object(struc= t drm_device *dev, size_t =20 obj =3D kzalloc(sizeof(*obj), GFP_KERNEL); if (!obj) - return NULL; + return ERR_PTR(-ENOMEM); =20 INIT_LIST_HEAD(&obj->mappings.list); mutex_init(&obj->mappings.lock); diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c index 6a8731ab9d7d0..9a1a92782524c 100644 --- a/drivers/gpu/drm/v3d/v3d_bo.c +++ b/drivers/gpu/drm/v3d/v3d_bo.c @@ -70,11 +70,11 @@ struct drm_gem_object *v3d_create_object(struct drm_dev= ice *dev, size_t size) struct drm_gem_object *obj; =20 if (size =3D=3D 0) - return NULL; + return ERR_PTR(-EINVAL); =20 bo =3D kzalloc(sizeof(*bo), GFP_KERNEL); if (!bo) - return NULL; + return ERR_PTR(-ENOMEM); obj =3D &bo->base.base; =20 obj->funcs =3D &v3d_gem_funcs; diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_dr= v.c index a87eafa89e9f4..c5e3e54577377 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -97,7 +97,7 @@ static struct drm_gem_object *vgem_gem_create_object(stru= ct drm_device *dev, siz =20 obj =3D kzalloc(sizeof(*obj), GFP_KERNEL); if (!obj) - return NULL; + return ERR_PTR(-ENOMEM); =20 /* * vgem doesn't have any begin/end cpu access ioctls, therefore must use diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virt= io/virtgpu_object.c index f648b0e24447b..4749c9303de05 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -140,7 +140,7 @@ struct drm_gem_object *virtio_gpu_create_object(struct = drm_device *dev, =20 shmem =3D kzalloc(sizeof(*shmem), GFP_KERNEL); if (!shmem) - return NULL; + return ERR_PTR(-ENOMEM); =20 dshmem =3D &shmem->base.base; dshmem->base.funcs =3D &virtio_gpu_shmem_funcs; diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 0cd95953cdf55..96c264c4be4fe 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -291,8 +291,9 @@ struct drm_driver { /** * @gem_create_object: constructor for gem objects * - * Hook for allocating the GEM object struct, for use by the CMA and - * SHMEM GEM helpers. + * Hook for allocating the GEM object struct, for use by the CMA + * and SHMEM GEM helpers. Returns a GEM object on success, or an + * ERR_PTR()-encoded error code otherwise. */ struct drm_gem_object *(*gem_create_object)(struct drm_device *dev, size_t size); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E324C4707F for ; Mon, 24 Jan 2022 22:06:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579607AbiAXWGE (ORCPT ); Mon, 24 Jan 2022 17:06:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45388 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451880AbiAXVXn (ORCPT ); Mon, 24 Jan 2022 16:23:43 -0500 Received: from smtp.kernel.org (relay.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 8B99C60C44; Mon, 24 Jan 2022 21:23:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E9B2C340E4; Mon, 24 Jan 2022 21:23:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059423; bh=+bH8S50HUOJv3r/LvFSv6imiapSYgEoH4Jcf7BfElYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zz71QydKz5+9oqVV3gNQrZ4Y3YEzcZsmU5Nj9h1VmB6Urbx8wcbuuxKv+cUsEvA6T aVDaTnurEGZMf+JAaOkDDP+7D5H/Yrm3ONwPD7g/LmUTNnmEzQiQiy5AEXFIRBZOyn H34SgBjDPMZMHIrvH0NWLL1g1lOoVg1F/dAuYL0s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Kazlauskas , Vlad Zahorodnii , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0610/1039] drm/amd/display: Use oriented source size when checking cursor scaling Date: Mon, 24 Jan 2022 19:39:59 +0100 Message-Id: <20220124184145.846608151@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vlad Zahorodnii [ Upstream commit 69cb56290d9d10cdcc461aa2685e67e540507a96 ] dm_check_crtc_cursor() doesn't take into account plane transforms when calculating plane scaling, this can result in false positives. For example, if there's an output with resolution 3840x2160 and the output is rotated 90 degrees, CRTC_W and CRTC_H will be 3840 and 2160, respectively, but SRC_W and SRC_H will be 2160 and 3840, respectively. Since the cursor plane usually has a square buffer attached to it, the dm_check_crtc_cursor() will think that there's a scale factor mismatch even though there isn't really. This fixes an issue where kwin fails to use hardware plane transforms. Changes since version 1: - s/orientated/oriented/g Reviewed-by: Nicholas Kazlauskas Signed-off-by: Vlad Zahorodnii Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gp= u/drm/amd/display/amdgpu_dm/amdgpu_dm.c index e12f841d1d110..46d38d528468c 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -10662,6 +10662,24 @@ static int dm_update_plane_state(struct dc *dc, return ret; } =20 +static void dm_get_oriented_plane_size(struct drm_plane_state *plane_state, + int *src_w, int *src_h) +{ + switch (plane_state->rotation & DRM_MODE_ROTATE_MASK) { + case DRM_MODE_ROTATE_90: + case DRM_MODE_ROTATE_270: + *src_w =3D plane_state->src_h >> 16; + *src_h =3D plane_state->src_w >> 16; + break; + case DRM_MODE_ROTATE_0: + case DRM_MODE_ROTATE_180: + default: + *src_w =3D plane_state->src_w >> 16; + *src_h =3D plane_state->src_h >> 16; + break; + } +} + static int dm_check_crtc_cursor(struct drm_atomic_state *state, struct drm_crtc *crtc, struct drm_crtc_state *new_crtc_state) @@ -10670,6 +10688,8 @@ static int dm_check_crtc_cursor(struct drm_atomic_s= tate *state, struct drm_plane_state *new_cursor_state, *new_underlying_state; int i; int cursor_scale_w, cursor_scale_h, underlying_scale_w, underlying_scale_= h; + int cursor_src_w, cursor_src_h; + int underlying_src_w, underlying_src_h; =20 /* On DCE and DCN there is no dedicated hardware cursor plane. We get a * cursor per pipe but it's going to inherit the scaling and @@ -10681,10 +10701,9 @@ static int dm_check_crtc_cursor(struct drm_atomic_= state *state, return 0; } =20 - cursor_scale_w =3D new_cursor_state->crtc_w * 1000 / - (new_cursor_state->src_w >> 16); - cursor_scale_h =3D new_cursor_state->crtc_h * 1000 / - (new_cursor_state->src_h >> 16); + dm_get_oriented_plane_size(new_cursor_state, &cursor_src_w, &cursor_src_h= ); + cursor_scale_w =3D new_cursor_state->crtc_w * 1000 / cursor_src_w; + cursor_scale_h =3D new_cursor_state->crtc_h * 1000 / cursor_src_h; =20 for_each_new_plane_in_state_reverse(state, underlying, new_underlying_sta= te, i) { /* Narrow down to non-cursor planes on the same CRTC as the cursor */ @@ -10695,10 +10714,10 @@ static int dm_check_crtc_cursor(struct drm_atomic= _state *state, if (!new_underlying_state->fb) continue; =20 - underlying_scale_w =3D new_underlying_state->crtc_w * 1000 / - (new_underlying_state->src_w >> 16); - underlying_scale_h =3D new_underlying_state->crtc_h * 1000 / - (new_underlying_state->src_h >> 16); + dm_get_oriented_plane_size(new_underlying_state, + &underlying_src_w, &underlying_src_h); + underlying_scale_w =3D new_underlying_state->crtc_w * 1000 / underlying_= src_w; + underlying_scale_h =3D new_underlying_state->crtc_h * 1000 / underlying_= src_h; =20 if (cursor_scale_w !=3D underlying_scale_w || cursor_scale_h !=3D underlying_scale_h) { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94ED4C3527B for ; Mon, 24 Jan 2022 22:07:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579708AbiAXWGO (ORCPT ); Mon, 24 Jan 2022 17:06:14 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42788 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451919AbiAXVXr (ORCPT ); Mon, 24 Jan 2022 16:23:47 -0500 Received: from smtp.kernel.org (relay.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 ADB0A614BE; Mon, 24 Jan 2022 21:23:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CCD6C340E4; Mon, 24 Jan 2022 21:23:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059426; bh=1VmxqRQqnMtNeL4jEfDUqZK8fk1huCUw/3YpBo2zpvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cZqDrV4+DBDHJOSeMnGBXoDjsUPUAklk4mRKJydgH7sX+e4c5JHbP+JuVlQVL9wjI tVhiLiQvzqBVIPqgx5sQFCtTOFQ34UP2R9ov9B8pTd0xKtOPJ8lFBJMe+y2+IU8JJG M+p6grlj6zNjTDHdHNLJWGOVaOI5ajZwETNmo+S4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kishon Vijay Abraham I , Aswath Govindraju , Vignesh Raghavendra , Sasha Levin Subject: [PATCH 5.16 0611/1039] arm64: dts: ti: j7200-main: Fix dtbs_check serdes_ln_ctrl node Date: Mon, 24 Jan 2022 19:40:00 +0100 Message-Id: <20220124184145.879252999@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kishon Vijay Abraham I [ Upstream commit 4d3984906397581dc0ccb6a02bf16b6ff82c9192 ] Fix 'dtbs_check' in serdes_ln_ctrl (serdes-ln-ctrl@4080) node by changing the node name to mux-controller@4080. Signed-off-by: Kishon Vijay Abraham I Reviewed-by: Aswath Govindraju Signed-off-by: Vignesh Raghavendra Link: https://lore.kernel.org/r/20211126084555.17797-2-kishon@ti.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/ti/k3-j7200-main.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi b/arch/arm64/boot/dt= s/ti/k3-j7200-main.dtsi index d60ef4f7dd0b7..05a627ad6cdc4 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi @@ -32,7 +32,7 @@ #size-cells =3D <1>; ranges =3D <0x00 0x00 0x00100000 0x1c000>; =20 - serdes_ln_ctrl: serdes-ln-ctrl@4080 { + serdes_ln_ctrl: mux-controller@4080 { compatible =3D "mmio-mux"; #mux-control-cells =3D <1>; mux-reg-masks =3D <0x4080 0x3>, <0x4084 0x3>, /* SERDES0 lane0/1 select= */ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30CC2C35274 for ; Mon, 24 Jan 2022 22:06:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579768AbiAXWGX (ORCPT ); Mon, 24 Jan 2022 17:06:23 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45470 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451973AbiAXVXx (ORCPT ); Mon, 24 Jan 2022 16:23:53 -0500 Received: from smtp.kernel.org (relay.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 8FA08614B8; Mon, 24 Jan 2022 21:23:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73272C340E4; Mon, 24 Jan 2022 21:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059432; bh=eSZLF44e1JuTOoRoJCqOdob9EQwzWM9kUjPky1IcxwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OeQeRdBItSkb61anOjkpJIxM/Q6u1Ms6Lgj1huez8Tl5Vu2VIwd5NEBpKNxsdZDo4 IUM02PADUBqQq6p1q//B+W+UOyzwyzI4WYGAgnn9AwoZTB2GoHNijuQDg5q1EIcHJC lng+SAdES+v8+2KnplWgY4J6kyddQDWAOO+MAYNg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kishon Vijay Abraham I , Aswath Govindraju , Vignesh Raghavendra , Sasha Levin Subject: [PATCH 5.16 0612/1039] arm64: dts: ti: j721e-main: Fix dtbs_check in serdes_ln_ctrl node Date: Mon, 24 Jan 2022 19:40:01 +0100 Message-Id: <20220124184145.911069683@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kishon Vijay Abraham I [ Upstream commit 3f92a5be6084b77f764a8bbb881ac0d12cb9e863 ] Fix 'dtbs_check' in serdes_ln_ctrl (mux@4080) node by changing the node name to mux-controller@4080. Signed-off-by: Kishon Vijay Abraham I Reviewed-by: Aswath Govindraju Signed-off-by: Vignesh Raghavendra Link: https://lore.kernel.org/r/20211126084555.17797-3-kishon@ti.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi b/arch/arm64/boot/dt= s/ti/k3-j721e-main.dtsi index 08c8d1b47dcd9..e85c89eebfa31 100644 --- a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi @@ -42,7 +42,7 @@ #size-cells =3D <1>; ranges =3D <0x0 0x0 0x00100000 0x1c000>; =20 - serdes_ln_ctrl: mux@4080 { + serdes_ln_ctrl: mux-controller@4080 { compatible =3D "mmio-mux"; reg =3D <0x00004080 0x50>; #mux-control-cells =3D <1>; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62352C4332F for ; Mon, 24 Jan 2022 22:14:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581101AbiAXWLM (ORCPT ); Mon, 24 Jan 2022 17:11:12 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40640 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452034AbiAXVX5 (ORCPT ); Mon, 24 Jan 2022 16:23:57 -0500 Received: from smtp.kernel.org (relay.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 80C7EB8105C; Mon, 24 Jan 2022 21:23:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E10FC340E4; Mon, 24 Jan 2022 21:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059435; bh=Wz1PAbR8+iIe/jPfTcBbjPHkLNB0RxFEi0fK8+Aossk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qjykP7M5h+P0t6FONbe5Y4Il+khgq8anEhWRnw95lwkybsstbqn7FUHtj5+rVu1GY Tw6MuYHnOV+HGcsPb+9Kzwnwf+wZekeKgdicUxlJF6RwclEHYpmBx0EYNS6ZjkYmwg DPST2mL7YTK/Yt3Kwk9U5ATAi8nXiKBqEMck9KhQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neal Liu , Sasha Levin Subject: [PATCH 5.16 0613/1039] usb: uhci: add aspeed ast2600 uhci support Date: Mon, 24 Jan 2022 19:40:02 +0100 Message-Id: <20220124184145.942021026@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Neal Liu [ Upstream commit 554abfe2eadec97d12c71d4a69da1518478f69eb ] Enable ast2600 uhci quirks. Signed-off-by: Neal Liu Link: https://lore.kernel.org/r/20211126100021.2331024-1-neal_liu@aspeedtec= h.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/host/uhci-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platf= orm.c index 70dbd95c3f063..be9e9db7cad10 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c @@ -113,7 +113,8 @@ static int uhci_hcd_platform_probe(struct platform_devi= ce *pdev) num_ports); } if (of_device_is_compatible(np, "aspeed,ast2400-uhci") || - of_device_is_compatible(np, "aspeed,ast2500-uhci")) { + of_device_is_compatible(np, "aspeed,ast2500-uhci") || + of_device_is_compatible(np, "aspeed,ast2600-uhci")) { uhci->is_aspeed =3D 1; dev_info(&pdev->dev, "Enabled Aspeed implementation workarounds\n"); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE4A9C3527A for ; Mon, 24 Jan 2022 22:07:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579785AbiAXWG0 (ORCPT ); Mon, 24 Jan 2022 17:06:26 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40648 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452068AbiAXVYA (ORCPT ); Mon, 24 Jan 2022 16:24:00 -0500 Received: from smtp.kernel.org (relay.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 69977B81061; Mon, 24 Jan 2022 21:23:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 978EFC340E4; Mon, 24 Jan 2022 21:23:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059438; bh=TUevLlaSeZ88VMn9sFIiIZszuttY6WAT23dC+cuSNSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tWjRy4ZUhvPzBxnsp6SO6V5In7UFCy7mZcANsNT/NzbZBWlNvMwmg3gP+H3LEtmwM WxDAYAIYIzudB68fpznJ57H9uupN8F00FwNG1jldbs+J3dxbGME2aSwBt7a77zF1FQ DDNXPEEKRTOk/3JLedyzm2wzsgmEqXWmMBqLEoic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+23a02c7df2cf2bc93fa2@syzkaller.appspotmail.com, Xiongwei Song , Denis Efremov , Jens Axboe , Sasha Levin Subject: [PATCH 5.16 0614/1039] floppy: Add max size check for user space request Date: Mon, 24 Jan 2022 19:40:03 +0100 Message-Id: <20220124184145.974975271@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiongwei Song [ Upstream commit 545a32498c536ee152331cd2e7d2416aa0f20e01 ] We need to check the max request size that is from user space before allocating pages. If the request size exceeds the limit, return -EINVAL. This check can avoid the warning below from page allocator. WARNING: CPU: 3 PID: 16525 at mm/page_alloc.c:5344 current_gfp_context incl= ude/linux/sched/mm.h:195 [inline] WARNING: CPU: 3 PID: 16525 at mm/page_alloc.c:5344 __alloc_pages+0x45d/0x50= 0 mm/page_alloc.c:5356 Modules linked in: CPU: 3 PID: 16525 Comm: syz-executor.3 Not tainted 5.15.0-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 RIP: 0010:__alloc_pages+0x45d/0x500 mm/page_alloc.c:5344 Code: be c9 00 00 00 48 c7 c7 20 4a 97 89 c6 05 62 32 a7 0b 01 e8 74 9a 42 = 07 e9 6a ff ff ff 0f 0b e9 a0 fd ff ff 40 80 e5 3f eb 88 <0f> 0b e9 18 ff f= f ff 4c 89 ef 44 89 e6 45 31 ed e8 1e 76 ff ff e9 RSP: 0018:ffffc90023b87850 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 1ffff92004770f0b RCX: dffffc0000000000 RDX: 0000000000000000 RSI: 0000000000000033 RDI: 0000000000010cc1 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001 R10: ffffffff81bb4686 R11: 0000000000000001 R12: ffffffff902c1960 R13: 0000000000000033 R14: 0000000000000000 R15: ffff88804cf64a30 FS: 0000000000000000(0000) GS:ffff88802cd00000(0063) knlGS:00000000f44b4b40 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 000000002c921000 CR3: 000000004f507000 CR4: 0000000000150ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191 __get_free_pages+0x8/0x40 mm/page_alloc.c:5418 raw_cmd_copyin drivers/block/floppy.c:3113 [inline] raw_cmd_ioctl drivers/block/floppy.c:3160 [inline] fd_locked_ioctl+0x12e5/0x2820 drivers/block/floppy.c:3528 fd_ioctl drivers/block/floppy.c:3555 [inline] fd_compat_ioctl+0x891/0x1b60 drivers/block/floppy.c:3869 compat_blkdev_ioctl+0x3b8/0x810 block/ioctl.c:662 __do_compat_sys_ioctl+0x1c7/0x290 fs/ioctl.c:972 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c Reported-by: syzbot+23a02c7df2cf2bc93fa2@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/20211116131033.27685-1-sxwjean@me.com Signed-off-by: Xiongwei Song Signed-off-by: Denis Efremov Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/block/floppy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 02ba1db5b8046..8026125037ae8 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3081,6 +3081,8 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr) } } =20 +#define MAX_LEN (1UL << MAX_ORDER << PAGE_SHIFT) + static int raw_cmd_copyin(int cmd, void __user *param, struct floppy_raw_cmd **rcmd) { @@ -3108,7 +3110,7 @@ loop: ptr->resultcode =3D 0; =20 if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { - if (ptr->length <=3D 0) + if (ptr->length <=3D 0 || ptr->length >=3D MAX_LEN) return -EINVAL; ptr->kernel_data =3D (char *)fd_dma_mem_alloc(ptr->length); fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EC18C4707E for ; Mon, 24 Jan 2022 22:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355247AbiAXWGh (ORCPT ); Mon, 24 Jan 2022 17:06:37 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44548 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452090AbiAXVYC (ORCPT ); Mon, 24 Jan 2022 16:24:02 -0500 Received: from smtp.kernel.org (relay.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 D357361028; Mon, 24 Jan 2022 21:24:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD9E6C340E4; Mon, 24 Jan 2022 21:24:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059441; bh=8viDxICTwBj3X3U5m2jJ0FeAwvjTGlqTSlf2o/uWmFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mQLzhIJjlcodCzw0JTf+UOP4S2aZw3S/L0GaDet4uIde67dr2yrV73FuBXJsbxyEm mDiq1UbKTHD09XnBnjh3JXq6fEx4GAYONbzoSd8jR9CS++G4DOhN697xWMJUknG3/P gB/cWBAH/6oy9heWodBhJGly9tOmEI3QhhrnFIoI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joerg Roedel , Borislav Petkov , Sasha Levin Subject: [PATCH 5.16 0615/1039] x86/mm: Flush global TLB when switching to trampoline page-table Date: Mon, 24 Jan 2022 19:40:04 +0100 Message-Id: <20220124184146.011973490@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joerg Roedel [ Upstream commit 71d5049b053876afbde6c3273250b76935494ab2 ] Move the switching code into a function so that it can be re-used and add a global TLB flush. This makes sure that usage of memory which is not mapped in the trampoline page-table is reliably caught. Also move the clearing of CR4.PCIDE before the CR3 switch because the cr4_clear_bits() function will access data not mapped into the trampoline page-table. Signed-off-by: Joerg Roedel Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20211202153226.22946-4-joro@8bytes.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/include/asm/realmode.h | 1 + arch/x86/kernel/reboot.c | 12 ++---------- arch/x86/realmode/init.c | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/asm/realmode.h b/arch/x86/include/asm/realmod= e.h index 5db5d083c8732..331474b150f16 100644 --- a/arch/x86/include/asm/realmode.h +++ b/arch/x86/include/asm/realmode.h @@ -89,6 +89,7 @@ static inline void set_real_mode_mem(phys_addr_t mem) } =20 void reserve_real_mode(void); +void load_trampoline_pgtable(void); =20 #endif /* __ASSEMBLY__ */ =20 diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 0a40df66a40de..fa700b46588e0 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c @@ -113,17 +113,9 @@ void __noreturn machine_real_restart(unsigned int type) spin_unlock(&rtc_lock); =20 /* - * Switch back to the initial page table. + * Switch to the trampoline page table. */ -#ifdef CONFIG_X86_32 - load_cr3(initial_page_table); -#else - write_cr3(real_mode_header->trampoline_pgd); - - /* Exiting long mode will fail if CR4.PCIDE is set. */ - if (boot_cpu_has(X86_FEATURE_PCID)) - cr4_clear_bits(X86_CR4_PCIDE); -#endif + load_trampoline_pgtable(); =20 /* Jump to the identity-mapped low memory code */ #ifdef CONFIG_X86_32 diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c index 38d24d2ab38b3..c5e29db02a469 100644 --- a/arch/x86/realmode/init.c +++ b/arch/x86/realmode/init.c @@ -17,6 +17,32 @@ u32 *trampoline_cr4_features; /* Hold the pgd entry used on booting additional CPUs */ pgd_t trampoline_pgd_entry; =20 +void load_trampoline_pgtable(void) +{ +#ifdef CONFIG_X86_32 + load_cr3(initial_page_table); +#else + /* + * This function is called before exiting to real-mode and that will + * fail with CR4.PCIDE still set. + */ + if (boot_cpu_has(X86_FEATURE_PCID)) + cr4_clear_bits(X86_CR4_PCIDE); + + write_cr3(real_mode_header->trampoline_pgd); +#endif + + /* + * The CR3 write above will not flush global TLB entries. + * Stale, global entries from previous page tables may still be + * present. Flush those stale entries. + * + * This ensures that memory accessed while running with + * trampoline_pgd is *actually* mapped into trampoline_pgd. + */ + __flush_tlb_all(); +} + void __init reserve_real_mode(void) { phys_addr_t mem; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50261C46467 for ; Mon, 24 Jan 2022 23:59:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367775AbiAXX4d (ORCPT ); Mon, 24 Jan 2022 18:56:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846413AbiAXXPz (ORCPT ); Mon, 24 Jan 2022 18:15:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50C84C0604CE; Mon, 24 Jan 2022 13:24:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 E3ABC61320; Mon, 24 Jan 2022 21:24:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7EB7C340E4; Mon, 24 Jan 2022 21:24:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059444; bh=TH+ekF/q/S4B463GdM+Q95pPIb/BpaQu6eM3YQyRVhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pT3VfVKn+sgdzUmeyzhbRHcY2h+F1/VLXHA43kjXuNp+NhAB7eKkCxlkSdkgI7fZi oStaB5PA2ov8Fy9ZtKTph5poREiNJzEX5JQAGMjABFKxkiB+3e6vkDw89ex2jHYfFh BqaEa6tm2mcA/Vgo8Ntcrtq8TTeoXrbKaF3/J7Jk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Pinchart , Sasha Levin Subject: [PATCH 5.16 0616/1039] drm: rcar-du: Fix CRTC timings when CMM is used Date: Mon, 24 Jan 2022 19:40:05 +0100 Message-Id: <20220124184146.042359307@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Pinchart [ Upstream commit f0ce591dc9a97067c6e783a2eaccd22c5476144d ] When the CMM is enabled, an offset of 25 pixels must be subtracted from the HDS (horizontal display start) and HDE (horizontal display end) registers. Fix the timings calculation, and take this into account in the mode validation. This fixes a visible horizontal offset in the image with VGA monitors. HDMI monitors seem to be generally more tolerant to incorrect timings, but may be affected too. Signed-off-by: Laurent Pinchart Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-= du/rcar_du_crtc.c index 5236f917cc68d..f361a604337f6 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -215,6 +215,7 @@ static void rcar_du_crtc_set_display_timing(struct rcar= _du_crtc *rcrtc) const struct drm_display_mode *mode =3D &rcrtc->crtc.state->adjusted_mode; struct rcar_du_device *rcdu =3D rcrtc->dev; unsigned long mode_clock =3D mode->clock * 1000; + unsigned int hdse_offset; u32 dsmr; u32 escr; =20 @@ -299,10 +300,15 @@ static void rcar_du_crtc_set_display_timing(struct rc= ar_du_crtc *rcrtc) | DSMR_DIPM_DISP | DSMR_CSPM; rcar_du_crtc_write(rcrtc, DSMR, dsmr); =20 + hdse_offset =3D 19; + if (rcrtc->group->cmms_mask & BIT(rcrtc->index % 2)) + hdse_offset +=3D 25; + /* Display timings */ - rcar_du_crtc_write(rcrtc, HDSR, mode->htotal - mode->hsync_start - 19); + rcar_du_crtc_write(rcrtc, HDSR, mode->htotal - mode->hsync_start - + hdse_offset); rcar_du_crtc_write(rcrtc, HDER, mode->htotal - mode->hsync_start + - mode->hdisplay - 19); + mode->hdisplay - hdse_offset); rcar_du_crtc_write(rcrtc, HSWR, mode->hsync_end - mode->hsync_start - 1); rcar_du_crtc_write(rcrtc, HCR, mode->htotal - 1); @@ -837,6 +843,7 @@ rcar_du_crtc_mode_valid(struct drm_crtc *crtc, struct rcar_du_crtc *rcrtc =3D to_rcar_crtc(crtc); struct rcar_du_device *rcdu =3D rcrtc->dev; bool interlaced =3D mode->flags & DRM_MODE_FLAG_INTERLACE; + unsigned int min_sync_porch; unsigned int vbp; =20 if (interlaced && !rcar_du_has(rcdu, RCAR_DU_FEATURE_INTERLACED)) @@ -844,9 +851,14 @@ rcar_du_crtc_mode_valid(struct drm_crtc *crtc, =20 /* * The hardware requires a minimum combined horizontal sync and back - * porch of 20 pixels and a minimum vertical back porch of 3 lines. + * porch of 20 pixels (when CMM isn't used) or 45 pixels (when CMM is + * used), and a minimum vertical back porch of 3 lines. */ - if (mode->htotal - mode->hsync_start < 20) + min_sync_porch =3D 20; + if (rcrtc->group->cmms_mask & BIT(rcrtc->index % 2)) + min_sync_porch +=3D 25; + + if (mode->htotal - mode->hsync_start < min_sync_porch) return MODE_HBLANK_NARROW; =20 vbp =3D (mode->vtotal - mode->vsync_end) / (interlaced ? 2 : 1); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86034C4707F for ; Mon, 24 Jan 2022 22:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581445AbiAXWLw (ORCPT ); Mon, 24 Jan 2022 17:11:52 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41684 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452683AbiAXV0M (ORCPT ); Mon, 24 Jan 2022 16:26:12 -0500 Received: from smtp.kernel.org (relay.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 99D40B8105C; Mon, 24 Jan 2022 21:26:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3D06C340E4; Mon, 24 Jan 2022 21:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059569; bh=5l4Rfm2PSSLWqX7qktkfzNpaICyo5Ne2QJRlsa438hU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ajETSFxKFWRHstAorkFtlX3JDZGxBrEXzQFs9b29q29T0m3Frl4HWe8zA0Oa8qOI PpmrIirjLbiVCvlc83QD++WUX5jDJmm8oM38w0EMPKPthGaLe9qqiW6/Rc0IkQbwNI CPGoYa9Qacv4xSPZvBYBjNNghXlBS+2rqypILYU4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Hilliard , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0617/1039] media: uvcvideo: Increase UVC_CTRL_CONTROL_TIMEOUT to 5 seconds. Date: Mon, 24 Jan 2022 19:40:06 +0100 Message-Id: <20220124184146.073526798@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hilliard [ Upstream commit c8ed7d2f614cd8b315981d116c7a2fb01829500d ] Some uvc devices appear to require the maximum allowed USB timeout for GET_CUR/SET_CUR requests. So lets just bump the UVC control timeout to 5 seconds which is the same as the usb ctrl get/set defaults: USB_CTRL_GET_TIMEOUT 5000 USB_CTRL_SET_TIMEOUT 5000 It fixes the following runtime warnings: Failed to query (GET_CUR) UVC control 11 on unit 2: -110 (exp. 1). Failed to query (SET_CUR) UVC control 3 on unit 2: -110 (exp. 2). Signed-off-by: James Hilliard Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/uvc/uvcvideo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvi= deo.h index 2e5366143b814..143230b3275b3 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -189,7 +189,7 @@ /* Maximum status buffer size in bytes of interrupt URB. */ #define UVC_MAX_STATUS_SIZE 16 =20 -#define UVC_CTRL_CONTROL_TIMEOUT 500 +#define UVC_CTRL_CONTROL_TIMEOUT 5000 #define UVC_CTRL_STREAMING_TIMEOUT 5000 =20 /* Maximum allowed number of control mappings per device */ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1F4BC35278 for ; Mon, 24 Jan 2022 23:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367762AbiAXX41 (ORCPT ); Mon, 24 Jan 2022 18:56:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846415AbiAXXPz (ORCPT ); Mon, 24 Jan 2022 18:15:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8572CC0604D2; Mon, 24 Jan 2022 13:24:30 -0800 (PST) Received: from smtp.kernel.org (relay.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 4E30CB812A8; Mon, 24 Jan 2022 21:24:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E974C340E4; Mon, 24 Jan 2022 21:24:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059468; bh=BybjXRdFrnNgucLm1SBhLKOfxFS0NwCWkQYWRha5CHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MoTELk0EuqWlLWeIGA+4AP9oPrtNc6S/kWkES21PtfdhYsO0t4K7RX1irGg/mDz/B d8GF7r+wVILnY0qWEIfJZ3v3bov2vR97KBzDKk6U+cZewzglGQsIAY9qPL5Uiu3U3o 5R4KypRrbGS+20L3PLE/1VjYbeXIjUXZfMmCXrQ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0618/1039] media: rcar-vin: Update format alignment constraints Date: Mon, 24 Jan 2022 19:40:07 +0100 Message-Id: <20220124184146.112090744@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Niklas S=C3=B6derlund [ Upstream commit da6911f330d40cfe115a37249e47643eff555e82 ] This change fixes two issues with the size constraints for buffers. - There is no width alignment constraint for RGB formats. Prior to this change they were treated as YUV and as a result were more restricted than needed. Add a new check to differentiate between the two. - The minimum width and height supported is 5x2, not 2x4, this is an artifact from the driver's soc-camera days. Fix this incorrect assumption. Signed-off-by: Niklas S=C3=B6derlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/pl= atform/rcar-vin/rcar-v4l2.c index a5bfa76fdac6e..2e60b9fce03b0 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -179,20 +179,27 @@ static void rvin_format_align(struct rvin_dev *vin, s= truct v4l2_pix_format *pix) break; } =20 - /* HW limit width to a multiple of 32 (2^5) for NV12/16 else 2 (2^1) */ + /* Hardware limits width alignment based on format. */ switch (pix->pixelformat) { + /* Multiple of 32 (2^5) for NV12/16. */ case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV16: walign =3D 5; break; - default: + /* Multiple of 2 (2^1) for YUV. */ + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_UYVY: walign =3D 1; break; + /* No multiple for RGB. */ + default: + walign =3D 0; + break; } =20 /* Limit to VIN capabilities */ - v4l_bound_align_image(&pix->width, 2, vin->info->max_width, walign, - &pix->height, 4, vin->info->max_height, 2, 0); + v4l_bound_align_image(&pix->width, 5, vin->info->max_width, walign, + &pix->height, 2, vin->info->max_height, 0, 0); =20 pix->bytesperline =3D rvin_format_bytesperline(vin, pix); pix->sizeimage =3D rvin_format_sizeimage(pix); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B969C433F5 for ; Mon, 24 Jan 2022 22:19:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582988AbiAXWQR (ORCPT ); Mon, 24 Jan 2022 17:16:17 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46086 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376842AbiAXVZD (ORCPT ); Mon, 24 Jan 2022 16:25:03 -0500 Received: from smtp.kernel.org (relay.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 8B643614D7; Mon, 24 Jan 2022 21:25:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 487FEC340E4; Mon, 24 Jan 2022 21:25:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059501; bh=JjoTPxcrsm13yYDz2X0aCGOrakWj/cvM4DjQzFBa75A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wrrUq68ZvNYSLXpCyMmmOEPt6S2nnndrN8C+8jeQ/0jNVxNEGP9wwgQz8x9PVL75g RlxhW9AxX2zweNq5xKo5iR40jt7r6lugyiKbvVs0qG+15fkJyCEfBavWUYVyzEgLFJ Iiu7JuxHN2LNUXlyNV0EtRsAJ+o0lfxjORgkRYCY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0619/1039] media: saa7146: hexium_orion: Fix a NULL pointer dereference in hexium_attach() Date: Mon, 24 Jan 2022 19:40:08 +0100 Message-Id: <20220124184146.146218978@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit 348df8035301dd212e3cc2860efe4c86cb0d3303 ] In hexium_attach(dev, info), saa7146_vv_init() is called to allocate a new memory for dev->vv_data. In hexium_detach(), saa7146_vv_release() will be called and there is a dereference of dev->vv_data in saa7146_vv_release(), which could lead to a NULL pointer dereference on failure of saa7146_vv_init() according to the following logic. Both hexium_attach() and hexium_detach() are callback functions of the variable 'extension', so there exists a possible call chain directly from hexium_attach() to hexium_detach(): hexium_attach(dev, info) -- fail to alloc memory to dev->vv_data | in saa7146_vv_init(). | | hexium_detach() -- a dereference of dev->vv_data in saa7146_vv_release() Fix this bug by adding a check of saa7146_vv_init(). This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_VIDEO_HEXIUM_ORION=3Dm show no new warnings, and our static analyzer no longer warns about this code. Signed-off-by: Zhou Qingyang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/pci/saa7146/hexium_orion.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/s= aa7146/hexium_orion.c index 39d14c179d229..2eb4bee16b71f 100644 --- a/drivers/media/pci/saa7146/hexium_orion.c +++ b/drivers/media/pci/saa7146/hexium_orion.c @@ -355,10 +355,16 @@ static struct saa7146_ext_vv vv_data; static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_exten= sion_data *info) { struct hexium *hexium =3D (struct hexium *) dev->ext_priv; + int ret; =20 DEB_EE("\n"); =20 - saa7146_vv_init(dev, &vv_data); + ret =3D saa7146_vv_init(dev, &vv_data); + if (ret) { + pr_err("Error in saa7146_vv_init()\n"); + return ret; + } + vv_data.vid_ops.vidioc_enum_input =3D vidioc_enum_input; vv_data.vid_ops.vidioc_g_input =3D vidioc_g_input; vv_data.vid_ops.vidioc_s_input =3D vidioc_s_input; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF17EC433F5 for ; Mon, 24 Jan 2022 22:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580873AbiAXWKz (ORCPT ); Mon, 24 Jan 2022 17:10:55 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46400 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452425AbiAXVZe (ORCPT ); Mon, 24 Jan 2022 16:25:34 -0500 Received: from smtp.kernel.org (relay.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 10E556136E; Mon, 24 Jan 2022 21:25:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F149EC340E4; Mon, 24 Jan 2022 21:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059533; bh=MwjSNMBDiKF0+H5jqz5A2By0pk1oW/OfxKi+IgH4XTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cfo0KKNNaNtE5Y9Xutoz1CTIeELoJPmKANksg10GCe4f6FdwgVevTd6hp6rB7zRrw v+cu9jdApbGgh5CxPdGM6kjWZvqRiGX7qPa3dp33x3cFCbQiO76/GyTPIyQnQt24v7 agMV4qz2iTKCdJQ8UyuueKc5k03gCrpX5ZSiKCJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Tsuchiya Yuto , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0620/1039] media: atomisp: fix "variable dereferenced before check asd" Date: Mon, 24 Jan 2022 19:40:09 +0100 Message-Id: <20220124184146.177661596@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tsuchiya Yuto [ Upstream commit ac56760a8bbb4e654b2fd54e5de79dd5d72f937d ] There are two occurrences where the variable 'asd' is dereferenced before check. Fix this issue by using the variable after the check. Link: https://lore.kernel.org/linux-media/20211122074122.GA6581@kili/ Link: https://lore.kernel.org/linux-media/20211201141904.47231-1-kitakar@gm= ail.com Reported-by: Dan Carpenter Signed-off-by: Tsuchiya Yuto Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 3 ++- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/stag= ing/media/atomisp/pci/atomisp_cmd.c index 1ddb9c815a3cb..ef0b0963cf930 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -5224,7 +5224,7 @@ static int atomisp_set_fmt_to_isp(struct video_device= *vdev, int (*configure_pp_input)(struct atomisp_sub_device *asd, unsigned int width, unsigned int height) =3D configure_pp_input_nop; - u16 stream_index =3D atomisp_source_pad_to_stream_id(asd, source_pad); + u16 stream_index; const struct atomisp_in_fmt_conv *fc; int ret, i; =20 @@ -5233,6 +5233,7 @@ static int atomisp_set_fmt_to_isp(struct video_device= *vdev, __func__, vdev->name); return -EINVAL; } + stream_index =3D atomisp_source_pad_to_stream_id(asd, source_pad); =20 v4l2_fh_init(&fh.vfh, vdev); =20 diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/st= aging/media/atomisp/pci/atomisp_ioctl.c index 54624f8814e04..b7dda4b96d49c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -1123,7 +1123,7 @@ int __atomisp_reqbufs(struct file *file, void *fh, struct ia_css_frame *frame; struct videobuf_vmalloc_memory *vm_mem; u16 source_pad =3D atomisp_subdev_source_pad(vdev); - u16 stream_id =3D atomisp_source_pad_to_stream_id(asd, source_pad); + u16 stream_id; int ret =3D 0, i =3D 0; =20 if (!asd) { @@ -1131,6 +1131,7 @@ int __atomisp_reqbufs(struct file *file, void *fh, __func__, vdev->name); return -EINVAL; } + stream_id =3D atomisp_source_pad_to_stream_id(asd, source_pad); =20 if (req->count =3D=3D 0) { mutex_lock(&pipe->capq.vb_lock); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF2D7C43217 for ; Mon, 24 Jan 2022 23:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2368006AbiAXX5g (ORCPT ); Mon, 24 Jan 2022 18:57:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847015AbiAXXSP (ORCPT ); Mon, 24 Jan 2022 18:18:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DC5CC0604EE; Mon, 24 Jan 2022 13:25:54 -0800 (PST) Received: from smtp.kernel.org (relay.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 CF857B81218; Mon, 24 Jan 2022 21:25:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02440C340E4; Mon, 24 Jan 2022 21:25:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059551; bh=aXgAlWjFhuTYaGo0IQrs5NxFaBkHUtQAgDjh1OBwC9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ro2tTWLdYBWodTRVoWxNoy0BcL28R00NgoBt6SNrGv3s8lR+3End87UEf257g56zl 2QRUih8jqJBV3d6sSblODJrFXj70+dX2hkIoAhnA1Kdh3O7G3ZhtQJrUtc07ILyqzF iEyvuqFvPshWaqUpk9cjOD84kuiJoBpUxGz3nnYo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, rkardell@mida.se, Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0621/1039] media: m920x: dont use stack on USB reads Date: Mon, 24 Jan 2022 19:40:10 +0100 Message-Id: <20220124184146.213169199@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit a2ab06d7c4d6bfd0b545a768247a70463e977e27 ] Using stack-allocated pointers for USB message data don't work. This driver is almost OK with that, except for the I2C read logic. Fix it by using a temporary read buffer, just like on all other calls to m920x_read(). Link: https://lore.kernel.org/all/ccc99e48-de4f-045e-0fe4-61e3118e3f74@mida= .se/ Reported-by: rkardell@mida.se Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/usb/dvb-usb/m920x.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb/m920x.c b/drivers/media/usb/dvb-usb/= m920x.c index 4bb5b82599a79..691e05833db19 100644 --- a/drivers/media/usb/dvb-usb/m920x.c +++ b/drivers/media/usb/dvb-usb/m920x.c @@ -274,6 +274,13 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, st= ruct i2c_msg msg[], int nu /* Should check for ack here, if we knew how. */ } if (msg[i].flags & I2C_M_RD) { + char *read =3D kmalloc(1, GFP_KERNEL); + if (!read) { + ret =3D -ENOMEM; + kfree(read); + goto unlock; + } + for (j =3D 0; j < msg[i].len; j++) { /* Last byte of transaction? * Send STOP, otherwise send ACK. */ @@ -281,9 +288,12 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, st= ruct i2c_msg msg[], int nu =20 if ((ret =3D m920x_read(d->udev, M9206_I2C, 0x0, 0x20 | stop, - &msg[i].buf[j], 1)) !=3D 0) + read, 1)) !=3D 0) goto unlock; + msg[i].buf[j] =3D read[0]; } + + kfree(read); } else { for (j =3D 0; j < msg[i].len; j++) { /* Last byte of transaction? Then send STOP. */ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 081D9C35274 for ; Tue, 25 Jan 2022 00:06:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2369321AbiAYABb (ORCPT ); Mon, 24 Jan 2022 19:01:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847012AbiAXXSP (ORCPT ); Mon, 24 Jan 2022 18:18:15 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B4E0C0604EF; Mon, 24 Jan 2022 13:25:55 -0800 (PST) Received: from smtp.kernel.org (relay.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 1CBD661305; Mon, 24 Jan 2022 21:25:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8121C340E4; Mon, 24 Jan 2022 21:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059554; bh=b1kuycPtIuGNh9eiV5SiIWKNRLWLaFZgezxgdv7TYmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z7nqdNvRs0/8L1TxKfRq705IedcPA65fo7aWfqXJkB2/BDtvJu7Tt1IEx1jrFqELw g1F13ciYc8iPeshDIYe4YiVmB6vQzhlG6SPyrkk4uuJaZtM3tdAqAtOLMtlxsX3fTP sPh4bnrYANe8I9ACdgEsax+obissgV0r6+tOyYNw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0622/1039] thunderbolt: Runtime PM activate both ends of the device link Date: Mon, 24 Jan 2022 19:40:11 +0100 Message-Id: <20220124184146.248815390@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mika Westerberg [ Upstream commit f3380cac0c0b3a6f49ab161e2a057c363962f48d ] If protocol tunnels are already up when the driver is loaded, for instance if the boot firmware implements connection manager of its own, runtime PM reference count of the consumer devices behind the tunnel might have been increased already before the device link is created but the supplier device runtime PM reference count is not. This leads to a situation where the supplier (the Thunderbolt driver) can runtime suspend even if it should not because the corresponding protocol tunnel needs to be up causing the devices to be removed from the corresponding native bus. Prevent this from happening by making both sides of the link runtime PM active briefly. The pm_runtime_put() for the consumer (PCIe root/downstream port, xHCI) then allows it to runtime suspend again but keeps the supplier runtime resumed the whole time it is runtime active. Signed-off-by: Mika Westerberg Reviewed-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/thunderbolt/acpi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/thunderbolt/acpi.c b/drivers/thunderbolt/acpi.c index b67e72d5644b3..7c9597a339295 100644 --- a/drivers/thunderbolt/acpi.c +++ b/drivers/thunderbolt/acpi.c @@ -7,6 +7,7 @@ */ =20 #include +#include =20 #include "tb.h" =20 @@ -74,8 +75,18 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, = u32 level, void *data, pci_pcie_type(pdev) =3D=3D PCI_EXP_TYPE_DOWNSTREAM))) { const struct device_link *link; =20 + /* + * Make them both active first to make sure the NHI does + * not runtime suspend before the consumer. The + * pm_runtime_put() below then allows the consumer to + * runtime suspend again (which then allows NHI runtime + * suspend too now that the device link is established). + */ + pm_runtime_get_sync(&pdev->dev); + link =3D device_link_add(&pdev->dev, &nhi->pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER | + DL_FLAG_RPM_ACTIVE | DL_FLAG_PM_RUNTIME); if (link) { dev_dbg(&nhi->pdev->dev, "created link from %s\n", @@ -84,6 +95,8 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u= 32 level, void *data, dev_warn(&nhi->pdev->dev, "device link creation from %s failed\n", dev_name(&pdev->dev)); } + + pm_runtime_put(&pdev->dev); } =20 out_put: --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C119C433EF for ; Mon, 24 Jan 2022 22:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581386AbiAXWLl (ORCPT ); Mon, 24 Jan 2022 17:11:41 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40640 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452629AbiAXVZ7 (ORCPT ); Mon, 24 Jan 2022 16:25:59 -0500 Received: from smtp.kernel.org (relay.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 B6B35B81188; Mon, 24 Jan 2022 21:25:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE34CC340E4; Mon, 24 Jan 2022 21:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059557; bh=4DGqvUVNgCI1oxIPLP0J8vXnSD8dR9XxMPl+oh1CnQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R4ZtlUJGu4MGWm/JUR3KszMiTA26doCPbL87CZZhuzGViU3fWakVR6K9/65Tc3MRK kDVca+pbQ6vN713/OYG7RvNlp6BeFQ+PIwvD9NjjoClSD7kczOoCg/hO4psIwuk7sl OWQx/odaSnTXflIra+FrZGu64DIBbI+7uAyfBZac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kieran Bingham , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.16 0623/1039] arm64: dts: renesas: Fix thermal bindings Date: Mon, 24 Jan 2022 19:40:12 +0100 Message-Id: <20220124184146.281546297@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Kieran Bingham [ Upstream commit 82ce79391d0ec25ec8aaae3c0617b71048ff0836 ] The binding node names for the thermal zones are not successfully validated by the dt-schemas. Fix the validation by changing from sensor-thermalN or thermal-sensor-N to sensorN-thermal. Provide node labels of the form sensorN_thermal to ensure consistency with the other platform implementations. Signed-off-by: Kieran Bingham Reviewed-by: Niklas S=C3=B6derlund Link: https://lore.kernel.org/r/20211104224033.3997504-1-kieran.bingham+ren= esas@ideasonboard.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/renesas/r8a774a1.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a774b1.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a774e1.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a77951.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a77960.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a77961.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a77965.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a77980.dtsi | 4 ++-- arch/arm64/boot/dts/renesas/r8a779a0.dtsi | 10 +++++----- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi b/arch/arm64/boot/dt= s/renesas/r8a774a1.dtsi index 6f4fffacfca21..e70aa5a087402 100644 --- a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi @@ -2784,7 +2784,7 @@ }; =20 thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 0>; @@ -2799,7 +2799,7 @@ }; }; =20 - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 1>; @@ -2814,7 +2814,7 @@ }; }; =20 - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 2>; diff --git a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi b/arch/arm64/boot/dt= s/renesas/r8a774b1.dtsi index 0f7bdfc90a0dc..6c5694fa66900 100644 --- a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi @@ -2629,7 +2629,7 @@ }; =20 thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 0>; @@ -2644,7 +2644,7 @@ }; }; =20 - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 1>; @@ -2659,7 +2659,7 @@ }; }; =20 - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 2>; diff --git a/arch/arm64/boot/dts/renesas/r8a774e1.dtsi b/arch/arm64/boot/dt= s/renesas/r8a774e1.dtsi index 379a1300272ba..62209ab6deb9a 100644 --- a/arch/arm64/boot/dts/renesas/r8a774e1.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a774e1.dtsi @@ -2904,7 +2904,7 @@ }; =20 thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 0>; @@ -2919,7 +2919,7 @@ }; }; =20 - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 1>; @@ -2934,7 +2934,7 @@ }; }; =20 - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 2>; diff --git a/arch/arm64/boot/dts/renesas/r8a77951.dtsi b/arch/arm64/boot/dt= s/renesas/r8a77951.dtsi index 1768a3e6bb8da..193d81be40fc4 100644 --- a/arch/arm64/boot/dts/renesas/r8a77951.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a77951.dtsi @@ -3375,7 +3375,7 @@ }; =20 thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 0>; @@ -3390,7 +3390,7 @@ }; }; =20 - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 1>; @@ -3405,7 +3405,7 @@ }; }; =20 - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 2>; diff --git a/arch/arm64/boot/dts/renesas/r8a77960.dtsi b/arch/arm64/boot/dt= s/renesas/r8a77960.dtsi index 2bd8169735d35..b526e4f0ee6a8 100644 --- a/arch/arm64/boot/dts/renesas/r8a77960.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a77960.dtsi @@ -2972,7 +2972,7 @@ }; =20 thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 0>; @@ -2987,7 +2987,7 @@ }; }; =20 - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 1>; @@ -3002,7 +3002,7 @@ }; }; =20 - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 2>; diff --git a/arch/arm64/boot/dts/renesas/r8a77961.dtsi b/arch/arm64/boot/dt= s/renesas/r8a77961.dtsi index 86d59e7e1a876..b1a00f5df4311 100644 --- a/arch/arm64/boot/dts/renesas/r8a77961.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a77961.dtsi @@ -2730,7 +2730,7 @@ }; =20 thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 0>; @@ -2745,7 +2745,7 @@ }; }; =20 - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 1>; @@ -2760,7 +2760,7 @@ }; }; =20 - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 2>; diff --git a/arch/arm64/boot/dts/renesas/r8a77965.dtsi b/arch/arm64/boot/dt= s/renesas/r8a77965.dtsi index 08df75606430b..f9679a4dd85fa 100644 --- a/arch/arm64/boot/dts/renesas/r8a77965.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a77965.dtsi @@ -2784,7 +2784,7 @@ }; =20 thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 0>; @@ -2799,7 +2799,7 @@ }; }; =20 - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 1>; @@ -2814,7 +2814,7 @@ }; }; =20 - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 2>; diff --git a/arch/arm64/boot/dts/renesas/r8a77980.dtsi b/arch/arm64/boot/dt= s/renesas/r8a77980.dtsi index 6347d15e66b64..21fe602bd25af 100644 --- a/arch/arm64/boot/dts/renesas/r8a77980.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a77980.dtsi @@ -1580,7 +1580,7 @@ }; =20 thermal-zones { - thermal-sensor-1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 0>; @@ -1599,7 +1599,7 @@ }; }; =20 - thermal-sensor-2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 1>; diff --git a/arch/arm64/boot/dts/renesas/r8a779a0.dtsi b/arch/arm64/boot/dt= s/renesas/r8a779a0.dtsi index 43bf2cbfbd8f7..770a23b769d86 100644 --- a/arch/arm64/boot/dts/renesas/r8a779a0.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a779a0.dtsi @@ -2607,7 +2607,7 @@ }; =20 thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 0>; @@ -2621,7 +2621,7 @@ }; }; =20 - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 1>; @@ -2635,7 +2635,7 @@ }; }; =20 - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 2>; @@ -2649,7 +2649,7 @@ }; }; =20 - sensor_thermal4: sensor-thermal4 { + sensor4_thermal: sensor4-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 3>; @@ -2663,7 +2663,7 @@ }; }; =20 - sensor_thermal5: sensor-thermal5 { + sensor5_thermal: sensor5-thermal { polling-delay-passive =3D <250>; polling-delay =3D <1000>; thermal-sensors =3D <&tsc 4>; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7604DC3526E for ; Mon, 24 Jan 2022 22:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581409AbiAXWLo (ORCPT ); Mon, 24 Jan 2022 17:11:44 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40648 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452646AbiAXV0C (ORCPT ); Mon, 24 Jan 2022 16:26:02 -0500 Received: from smtp.kernel.org (relay.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 BA4F8B81061; Mon, 24 Jan 2022 21:26:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE4FBC340E4; Mon, 24 Jan 2022 21:25:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059560; bh=02LVYUDW/mrOuwuMTZ8bCkojsOTTzLhDWhfOpPkpTUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yC07YOnhMlQ3Fm93NDeAhkzLk4r8QqqwpC/cqUZD/eYmhRCHugdXta8g7Uxq3AUQS lC4rmMqhc4UMu4xOkfdDrPcqCqVHppOSLBYdw1c9OT+MVf/gf+qyYEgqolufPaVq7Q jKk1PABQNzq5+SMWdGCp7Mjdg9x5R0F4/QgZE6J0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emmanuel Grumbach , Maximilian Ernestus , Johannes Berg , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0624/1039] iwlwifi: mvm: synchronize with FW after multicast commands Date: Mon, 24 Jan 2022 19:40:13 +0100 Message-Id: <20220124184146.311973043@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit db66abeea3aefed481391ecc564fb7b7fb31d742 ] If userspace installs a lot of multicast groups very quickly, then we may run out of command queue space as we send the updates in an asynchronous fashion (due to locking concerns), and the CPU can create them faster than the firmware can process them. This is true even when mac80211 has a work struct that gets scheduled. Fix this by synchronizing with the firmware after sending all those commands - outside of the iteration we can send a synchronous echo command that just has the effect of the CPU waiting for the prior asynchronous commands to finish. This also will cause fewer of the commands to be sent to the firmware overall, because the work will only run once when rescheduled multiple times while it's running. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D213649 Suggested-by: Emmanuel Grumbach Reported-by: Maximilian Ernestus Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211204083238.51aea5b79ea4.I88a447= 98efda16e9fe480fb3e94224931d311b29@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/ne= t/wireless/intel/iwlwifi/mvm/mac80211.c index 897e3b91ddb2f..9c5c10908f013 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1688,6 +1688,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *= mvm) struct iwl_mvm_mc_iter_data iter_data =3D { .mvm =3D mvm, }; + int ret; =20 lockdep_assert_held(&mvm->mutex); =20 @@ -1697,6 +1698,22 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm = *mvm) ieee80211_iterate_active_interfaces_atomic( mvm->hw, IEEE80211_IFACE_ITER_NORMAL, iwl_mvm_mc_iface_iterator, &iter_data); + + /* + * Send a (synchronous) ech command so that we wait for the + * multiple asynchronous MCAST_FILTER_CMD commands sent by + * the interface iterator. Otherwise, we might get here over + * and over again (by userspace just sending a lot of these) + * and the CPU can send them faster than the firmware can + * process them. + * Note that the CPU is still faster - but with this we'll + * actually send fewer commands overall because the CPU will + * not schedule the work in mac80211 as frequently if it's + * still running when rescheduled (possibly multiple times). + */ + ret =3D iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL); + if (ret) + IWL_ERR(mvm, "Failed to synchronize multicast groups update\n"); } =20 static u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36BB5C35270 for ; Tue, 25 Jan 2022 00:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2369300AbiAYAB3 (ORCPT ); Mon, 24 Jan 2022 19:01:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847011AbiAXXSP (ORCPT ); Mon, 24 Jan 2022 18:18:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4283C0604F0; Mon, 24 Jan 2022 13:26:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 AC391B811A2; Mon, 24 Jan 2022 21:26:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D54A1C340E4; Mon, 24 Jan 2022 21:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059563; bh=c7/XBWzsaYmWU+H2uCUZADGkTpa6wfvO5HYwbEXPfCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jbt3sKYYnGeIjkDukbneQlskK/8kdKI9OHGHLBjE2u/XyH4sFMeljUZfQRd6EFUmn hFgCnwo0eBF9IfJIxX+5RkaALLiC3qpMZAmKDIV7cRv8gN/kjZAW0krBz87+0nmXyo O618R4OZVyFUlk2Z7WuAjDVqJDV0pSuMyOnsisSA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shaul Triebitz , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0625/1039] iwlwifi: mvm: avoid clearing a just saved session protection id Date: Mon, 24 Jan 2022 19:40:14 +0100 Message-Id: <20220124184146.348656466@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shaul Triebitz [ Upstream commit 8e967c137df3b236d2075f9538cb888129425d1a ] When scheduling a session protection the id is saved but then it may be cleared when calling iwl_mvm_te_clear_data (if a previous session protection is currently active). Fix it by saving the id after calling iwl_mvm_te_clear_data. Signed-off-by: Shaul Triebitz Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211204130722.b0743a588d14.I098fef= 6677d0dab3ef1b6183ed206a10bab01eb2@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/mvm/time-event.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c b/drivers/= net/wireless/intel/iwlwifi/mvm/time-event.c index f93f15357a3f8..b8c645b9880fc 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c @@ -1167,15 +1167,10 @@ void iwl_mvm_schedule_session_protection(struct iwl= _mvm *mvm, cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)), .action =3D cpu_to_le32(FW_CTXT_ACTION_ADD), + .conf_id =3D cpu_to_le32(SESSION_PROTECT_CONF_ASSOC), .duration_tu =3D cpu_to_le32(MSEC_TO_TU(duration)), }; =20 - /* The time_event_data.id field is reused to save session - * protection's configuration. - */ - mvmvif->time_event_data.id =3D SESSION_PROTECT_CONF_ASSOC; - cmd.conf_id =3D cpu_to_le32(mvmvif->time_event_data.id); - lockdep_assert_held(&mvm->mutex); =20 spin_lock_bh(&mvm->time_event_lock); @@ -1189,6 +1184,11 @@ void iwl_mvm_schedule_session_protection(struct iwl_= mvm *mvm, } =20 iwl_mvm_te_clear_data(mvm, te_data); + /* + * The time_event_data.id field is reused to save session + * protection's configuration. + */ + te_data->id =3D le32_to_cpu(cmd.conf_id); te_data->duration =3D le32_to_cpu(cmd.duration_tu); te_data->vif =3D vif; spin_unlock_bh(&mvm->time_event_lock); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB3C1C4332F for ; Tue, 25 Jan 2022 00:09:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371172AbiAYAHI (ORCPT ); Mon, 24 Jan 2022 19:07:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847009AbiAXXSP (ORCPT ); Mon, 24 Jan 2022 18:18:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AB7AC06F8D2; Mon, 24 Jan 2022 13:26:08 -0800 (PST) Received: from smtp.kernel.org (relay.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 B7346B811A2; Mon, 24 Jan 2022 21:26:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9057C340E4; Mon, 24 Jan 2022 21:26:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059566; bh=+ssm34GG7w4RratDitFIfpR8USrSyhcfbr2ppoi86JE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=in+3hX30x2c0aTleor+8lXsVwU+HNLlG4ZAAr4XyqXyoxJvHz7QAuGwNGkBZRhzhe d90JhDGO9cT0ydqs3GCtWpDAKNIPUVz5nE0KZqRDTlvy75dHXbW5UcO0bNLEGo1R5M zhMDrwA6G1Cezf4s4TlErCkUXyYkQz+/c3bwvYdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miri Korenblit , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0626/1039] iwlwifi: acpi: fix wgds rev 3 size Date: Mon, 24 Jan 2022 19:40:15 +0100 Message-Id: <20220124184146.379991845@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miri Korenblit [ Upstream commit dc276ffd0754e94080565c10b964f3c211879fdd ] The exact size of WGDS revision 3 was calculated using the wrong parameters. Fix it. Signed-off-by: Miri Korenblit Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211204130722.12c5b0cffe52.I7f3425= 02f628f43a7e000189a699484bcef0f562@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c b/drivers/net/wir= eless/intel/iwlwifi/fw/acpi.c index bf431fa4fe81f..2e4590876bc33 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c @@ -789,7 +789,7 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt) * looking up in ACPI */ if (wifi_pkg->package.count !=3D - min_size + profile_size * num_profiles) { + hdr_size + profile_size * num_profiles) { ret =3D -EINVAL; goto out_free; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC028C433F5 for ; Mon, 24 Jan 2022 22:12:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580395AbiAXWJe (ORCPT ); Mon, 24 Jan 2022 17:09:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40878 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452302AbiAXVYe (ORCPT ); Mon, 24 Jan 2022 16:24:34 -0500 Received: from smtp.kernel.org (relay.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 5F642B815A2; Mon, 24 Jan 2022 21:24:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 673CBC340E8; Mon, 24 Jan 2022 21:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059471; bh=lt6mIJfzkqvFPg0u6qu+wckvaEO9qenNedKzRuOJshc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ruWElD5SgVjL03n8GuggldIq/EU9wvnokGMO0FClsGkszijv/KbLIJ9dhuC3Yj9q RwIvk1xQIjzH5LVPkKRkXxVGYisUp/XQwCDkgwPX4j3uFkIeVfoqZg2DsbPZRpawV9 PfjvZZpPcARJViAO9GZqkNfiriGQEUT8aTz5lDIY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wander Lairson Costa , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.16 0627/1039] rcutorture: Avoid soft lockup during cpu stall Date: Mon, 24 Jan 2022 19:40:16 +0100 Message-Id: <20220124184146.416346170@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wander Lairson Costa [ Upstream commit 5ff7c9f9d7e3e0f6db5b81945fa11b69d62f433a ] If we use the module stall_cpu option, we may get a soft lockup warning in case we also don't pass the stall_cpu_block option. Introduce the stall_no_softlockup option to avoid a soft lockup on cpu stall even if we don't use the stall_cpu_block option. Signed-off-by: Wander Lairson Costa Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/rcu/rcutorture.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 8b410d982990c..05e4d6c28d1f5 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -46,6 +46,7 @@ #include #include #include +#include =20 #include "rcu.h" =20 @@ -109,6 +110,8 @@ torture_param(int, shutdown_secs, 0, "Shutdown time (s)= , <=3D zero to disable."); torture_param(int, stall_cpu, 0, "Stall duration (s), zero to disable."); torture_param(int, stall_cpu_holdoff, 10, "Time to wait before starting stall (s)."); +torture_param(bool, stall_no_softlockup, false, + "Avoid softlockup warning during cpu stall."); torture_param(int, stall_cpu_irqsoff, 0, "Disable interrupts while stallin= g."); torture_param(int, stall_cpu_block, 0, "Sleep while stalling."); torture_param(int, stall_gp_kthread, 0, @@ -2052,6 +2055,8 @@ static int rcu_torture_stall(void *args) #else schedule_timeout_uninterruptible(HZ); #endif + } else if (stall_no_softlockup) { + touch_softlockup_watchdog(); } if (stall_cpu_irqsoff) local_irq_enable(); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87EB2C433EF for ; Mon, 24 Jan 2022 22:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580451AbiAXWJn (ORCPT ); Mon, 24 Jan 2022 17:09:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43196 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452318AbiAXVYf (ORCPT ); Mon, 24 Jan 2022 16:24:35 -0500 Received: from smtp.kernel.org (relay.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 B8E6B614C9; Mon, 24 Jan 2022 21:24:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E801C340E4; Mon, 24 Jan 2022 21:24:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059474; bh=CCXcUbv79c6OgRxLCfKNg69L1bZIn2FYzhbRijAZ03M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xTsSDThlHVeIOd6AN4cA9fTqovJN9joZmcsmZ34NIWOxWZyKrOdckfRSY4LA51xRT HnG52IaYqSnF6SQG/fXIDr8EUubugkTUNgmr3Lgt/H0zc79phkXKBW6pPN/gh6S6Xq TJDQcTAo8/TW7Wshrx6iIVO6DgerhILxSL3oaz+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gong , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0628/1039] ath11k: avoid deadlock by change ieee80211_queue_work for regd_update_work Date: Mon, 24 Jan 2022 19:40:17 +0100 Message-Id: <20220124184146.455345363@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wen Gong [ Upstream commit ed05c7cf1286d7e31e7623bce55ff135723591bf ] When enable debug config, it print below warning while shut down wlan interface shuh as run "ifconfig wlan0 down". The reason is because ar->regd_update_work is ran once, and it is will call wiphy_lock(ar->hw->wiphy) in function ath11k_regd_update() which is running in workqueue of ieee80211_local queued by ieee80211_queue_work(). Another thread from "ifconfig wlan0 down" will also accuqire the lock by wiphy_lock(sdata->local->hw.wiphy) in function ieee80211_stop(), and then it call ieee80211_stop_device() to flush_workqueue(local->workqueue), this will wait the workqueue of ieee80211_local finished. Then deadlock will happen easily if the two thread run meanwhile. Below warning disappeared after this change. [ 914.088798] ath11k_pci 0000:05:00.0: mac remove interface (vdev 0) [ 914.088806] ath11k_pci 0000:05:00.0: mac stop 11d scan [ 914.088810] ath11k_pci 0000:05:00.0: mac stop 11d vdev id 0 [ 914.088827] ath11k_pci 0000:05:00.0: htc ep 2 consumed 1 credits (total = 0) [ 914.088841] ath11k_pci 0000:05:00.0: send 11d scan stop vdev id 0 [ 914.088849] ath11k_pci 0000:05:00.0: htc insufficient credits ep 2 requi= red 1 available 0 [ 914.088856] ath11k_pci 0000:05:00.0: htc insufficient credits ep 2 requi= red 1 available 0 [ 914.096434] ath11k_pci 0000:05:00.0: rx ce pipe 2 len 16 [ 914.096442] ath11k_pci 0000:05:00.0: htc ep 2 got 1 credits (total 1) [ 914.096481] ath11k_pci 0000:05:00.0: htc ep 2 consumed 1 credits (total = 0) [ 914.096491] ath11k_pci 0000:05:00.0: WMI vdev delete id 0 [ 914.111598] ath11k_pci 0000:05:00.0: rx ce pipe 2 len 16 [ 914.111628] ath11k_pci 0000:05:00.0: htc ep 2 got 1 credits (total 1) [ 914.114659] ath11k_pci 0000:05:00.0: rx ce pipe 2 len 20 [ 914.114742] ath11k_pci 0000:05:00.0: htc rx completion ep 2 skb = pK-error [ 914.115977] ath11k_pci 0000:05:00.0: vdev delete resp for vdev id 0 [ 914.116685] ath11k_pci 0000:05:00.0: vdev 00:03:7f:29:61:11 deleted, vde= v_id 0 [ 914.117583] =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 [ 914.117592] WARNING: possible circular locking dependency detected [ 914.117600] 5.16.0-rc1-wt-ath+ #1 Tainted: G OE [ 914.117611] ------------------------------------------------------ [ 914.117618] ifconfig/2805 is trying to acquire lock: [ 914.117628] ffff9c00a62bb548 ((wq_completion)phy0){+.+.}-{0:0}, at: flus= h_workqueue+0x87/0x470 [ 914.117674] but task is already holding lock: [ 914.117682] ffff9c00baea07d0 (&rdev->wiphy.mtx){+.+.}-{4:4}, at: ieee802= 11_stop+0x38/0x180 [mac80211] [ 914.117872] which lock already depends on the new lock. [ 914.117880] the existing dependency chain (in reverse order) is: [ 914.117888] -> #3 (&rdev->wiphy.mtx){+.+.}-{4:4}: [ 914.117910] __mutex_lock+0xa0/0x9c0 [ 914.117930] mutex_lock_nested+0x1b/0x20 [ 914.117944] reg_process_self_managed_hints+0x3a/0xb0 [cfg80211] [ 914.118093] wiphy_regulatory_register+0x47/0x80 [cfg80211] [ 914.118229] wiphy_register+0x84f/0x9c0 [cfg80211] [ 914.118353] ieee80211_register_hw+0x6b1/0xd90 [mac80211] [ 914.118486] ath11k_mac_register+0x6af/0xb60 [ath11k] [ 914.118550] ath11k_core_qmi_firmware_ready+0x383/0x4a0 [ath11k] [ 914.118598] ath11k_qmi_driver_event_work+0x347/0x4a0 [ath11k] [ 914.118656] process_one_work+0x228/0x670 [ 914.118669] worker_thread+0x4d/0x440 [ 914.118680] kthread+0x16d/0x1b0 [ 914.118697] ret_from_fork+0x22/0x30 [ 914.118714] -> #2 (rtnl_mutex){+.+.}-{4:4}: [ 914.118736] __mutex_lock+0xa0/0x9c0 [ 914.118751] mutex_lock_nested+0x1b/0x20 [ 914.118767] rtnl_lock+0x17/0x20 [ 914.118783] ath11k_regd_update+0x15a/0x260 [ath11k] [ 914.118841] ath11k_regd_update_work+0x15/0x20 [ath11k] [ 914.118897] process_one_work+0x228/0x670 [ 914.118909] worker_thread+0x4d/0x440 [ 914.118920] kthread+0x16d/0x1b0 [ 914.118934] ret_from_fork+0x22/0x30 [ 914.118948] -> #1 ((work_completion)(&ar->regd_update_work)){+.+.}-{0:0}: [ 914.118972] process_one_work+0x1fa/0x670 [ 914.118984] worker_thread+0x4d/0x440 [ 914.118996] kthread+0x16d/0x1b0 [ 914.119010] ret_from_fork+0x22/0x30 [ 914.119023] -> #0 ((wq_completion)phy0){+.+.}-{0:0}: [ 914.119045] __lock_acquire+0x146d/0x1cf0 [ 914.119057] lock_acquire+0x19b/0x360 [ 914.119067] flush_workqueue+0xae/0x470 [ 914.119084] ieee80211_stop_device+0x3b/0x50 [mac80211] [ 914.119260] ieee80211_do_stop+0x5d7/0x830 [mac80211] [ 914.119409] ieee80211_stop+0x45/0x180 [mac80211] [ 914.119557] __dev_close_many+0xb3/0x120 [ 914.119573] __dev_change_flags+0xc3/0x1d0 [ 914.119590] dev_change_flags+0x29/0x70 [ 914.119605] devinet_ioctl+0x653/0x810 [ 914.119620] inet_ioctl+0x193/0x1e0 [ 914.119631] sock_do_ioctl+0x4d/0xf0 [ 914.119649] sock_ioctl+0x262/0x340 [ 914.119665] __x64_sys_ioctl+0x96/0xd0 [ 914.119678] do_syscall_64+0x3d/0xd0 [ 914.119694] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 914.119709] other info that might help us debug this: [ 914.119717] Chain exists of: (wq_completion)phy0 --> rtnl_mutex --> &rdev->wiphy.mtx [ 914.119745] Possible unsafe locking scenario: [ 914.119752] CPU0 CPU1 [ 914.119758] ---- ---- [ 914.119765] lock(&rdev->wiphy.mtx); [ 914.119778] lock(rtnl_mutex); [ 914.119792] lock(&rdev->wiphy.mtx); [ 914.119807] lock((wq_completion)phy0); [ 914.119819] *** DEADLOCK *** [ 914.119827] 2 locks held by ifconfig/2805: [ 914.119837] #0: ffffffffba3dc010 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_loc= k+0x17/0x20 [ 914.119872] #1: ffff9c00baea07d0 (&rdev->wiphy.mtx){+.+.}-{4:4}, at: ie= ee80211_stop+0x38/0x180 [mac80211] [ 914.120039] stack backtrace: [ 914.120048] CPU: 0 PID: 2805 Comm: ifconfig Tainted: G OE = 5.16.0-rc1-wt-ath+ #1 [ 914.120064] Hardware name: LENOVO 418065C/418065C, BIOS 83ET63WW (1.33 )= 07/29/2011 [ 914.120074] Call Trace: [ 914.120084] [ 914.120094] dump_stack_lvl+0x73/0xa4 [ 914.120119] dump_stack+0x10/0x12 [ 914.120135] print_circular_bug.isra.44+0x221/0x2e0 [ 914.120165] check_noncircular+0x106/0x150 [ 914.120203] __lock_acquire+0x146d/0x1cf0 [ 914.120215] ? __lock_acquire+0x146d/0x1cf0 [ 914.120245] lock_acquire+0x19b/0x360 [ 914.120259] ? flush_workqueue+0x87/0x470 [ 914.120286] ? lockdep_init_map_type+0x6b/0x250 [ 914.120310] flush_workqueue+0xae/0x470 [ 914.120327] ? flush_workqueue+0x87/0x470 [ 914.120344] ? lockdep_hardirqs_on+0xd7/0x150 [ 914.120391] ieee80211_stop_device+0x3b/0x50 [mac80211] [ 914.120565] ? ieee80211_stop_device+0x3b/0x50 [mac80211] [ 914.120736] ieee80211_do_stop+0x5d7/0x830 [mac80211] [ 914.120906] ieee80211_stop+0x45/0x180 [mac80211] [ 914.121060] __dev_close_many+0xb3/0x120 [ 914.121081] __dev_change_flags+0xc3/0x1d0 [ 914.121109] dev_change_flags+0x29/0x70 [ 914.121131] devinet_ioctl+0x653/0x810 [ 914.121149] ? __might_fault+0x77/0x80 [ 914.121179] inet_ioctl+0x193/0x1e0 [ 914.121194] ? inet_ioctl+0x193/0x1e0 [ 914.121218] ? __might_fault+0x77/0x80 [ 914.121238] ? _copy_to_user+0x68/0x80 [ 914.121266] sock_do_ioctl+0x4d/0xf0 [ 914.121283] ? inet_stream_connect+0x60/0x60 [ 914.121297] ? sock_do_ioctl+0x4d/0xf0 [ 914.121329] sock_ioctl+0x262/0x340 [ 914.121347] ? sock_ioctl+0x262/0x340 [ 914.121362] ? exit_to_user_mode_prepare+0x13b/0x280 [ 914.121388] ? syscall_enter_from_user_mode+0x20/0x50 [ 914.121416] __x64_sys_ioctl+0x96/0xd0 [ 914.121430] ? br_ioctl_call+0x90/0x90 [ 914.121445] ? __x64_sys_ioctl+0x96/0xd0 [ 914.121465] do_syscall_64+0x3d/0xd0 [ 914.121482] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 914.121497] RIP: 0033:0x7f0ed051737b [ 914.121513] Code: 0f 1e fa 48 8b 05 15 3b 0d 00 64 c7 00 26 00 00 00 48 = c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48= > 3d 01 f0 ff ff 73 01 c3 48 8b 0d e5 3a 0d 00 f7 d8 64 89 01 48 [ 914.121527] RSP: 002b:00007fff7be38b98 EFLAGS: 00000202 ORIG_RAX: 000000= 0000000010 [ 914.121544] RAX: ffffffffffffffda RBX: 00007fff7be38ba0 RCX: 00007f0ed05= 1737b [ 914.121555] RDX: 00007fff7be38ba0 RSI: 0000000000008914 RDI: 00000000000= 00004 [ 914.121566] RBP: 00007fff7be38c60 R08: 000000000000000a R09: 00000000000= 00001 [ 914.121576] R10: 0000000000000000 R11: 0000000000000202 R12: 00000000fff= ffffe [ 914.121586] R13: 0000000000000004 R14: 0000000000000000 R15: 00000000000= 00000 [ 914.121620] Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ= _LITE-1 Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211201071745.17746-2-quic_wgong@quicinc.c= om Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/a= th/ath11k/wmi.c index 621a63d6c8c6d..c3699bd0452c9 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -5912,7 +5912,7 @@ static int ath11k_reg_chan_list_event(struct ath11k_b= ase *ab, struct sk_buff *sk ar =3D ab->pdevs[pdev_idx].ar; kfree(ab->new_regd[pdev_idx]); ab->new_regd[pdev_idx] =3D regd; - ieee80211_queue_work(ar->hw, &ar->regd_update_work); + queue_work(ab->workqueue, &ar->regd_update_work); } else { /* This regd would be applied during mac registration and is * held constant throughout for regd intersection purpose --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34BD9C3527A for ; Mon, 24 Jan 2022 23:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367883AbiAXX4p (ORCPT ); Mon, 24 Jan 2022 18:56:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846420AbiAXXPz (ORCPT ); Mon, 24 Jan 2022 18:15:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5062C0604D3; Mon, 24 Jan 2022 13:24:39 -0800 (PST) Received: from smtp.kernel.org (relay.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 60567B81142; Mon, 24 Jan 2022 21:24:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86074C340E4; Mon, 24 Jan 2022 21:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059477; bh=dYHVgXTJBZ/3UowgSYH+o0QhZxf6PnFIxrfZXVMuKnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sHQAnnzrnGZ/p9VoJkgMgt4YI7kTo0DvwLutA8ofvtSOeT9ienx4C+EM9EarNVMkZ 7c4mMQ5TgZj/nUhEDxl1qgY7sViBR31Twg6CIUNlpMoMJiWYwjYGx3EFbxfa6NAf8S K4qo+++ShpShw4834901kvnFKxLTCjcKoxJQWkjg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Gottschall , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0629/1039] ath10k: Fix tx hanging Date: Mon, 24 Jan 2022 19:40:18 +0100 Message-Id: <20220124184146.493233124@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sebastian Gottschall [ Upstream commit e8a91863eba3966a447d2daa1526082d52b5db2a ] While running stress tests in roaming scenarios (switching ap's every 5 seconds, we discovered a issue which leads to tx hangings of exactly 5 seconds while or after scanning for new accesspoints. We found out that this hanging is triggered by ath10k_mac_wait_tx_complete since the empty_tx_wq was not wake when the num_tx_pending counter reaches zero. To fix this, we simply move the wake_up call to htt_tx_dec_pending, since this call was missed on several locations within the ath10k code. Signed-off-by: Sebastian Gottschall Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20210505085806.11474-1-s.gottschall@dd-wrt.= com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath10k/htt_tx.c | 3 +++ drivers/net/wireless/ath/ath10k/txrx.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireles= s/ath/ath10k/htt_tx.c index d6b8bdcef4160..b793eac2cfac8 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -147,6 +147,9 @@ void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt) htt->num_pending_tx--; if (htt->num_pending_tx =3D=3D htt->max_num_pending_tx - 1) ath10k_mac_tx_unlock(htt->ar, ATH10K_TX_PAUSE_Q_FULL); + + if (htt->num_pending_tx =3D=3D 0) + wake_up(&htt->empty_tx_wq); } =20 int ath10k_htt_tx_inc_pending(struct ath10k_htt *htt) diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/= ath/ath10k/txrx.c index 7c9ea0c073d8b..6f8b642188941 100644 --- a/drivers/net/wireless/ath/ath10k/txrx.c +++ b/drivers/net/wireless/ath/ath10k/txrx.c @@ -82,8 +82,6 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, flags =3D skb_cb->flags; ath10k_htt_tx_free_msdu_id(htt, tx_done->msdu_id); ath10k_htt_tx_dec_pending(htt); - if (htt->num_pending_tx =3D=3D 0) - wake_up(&htt->empty_tx_wq); spin_unlock_bh(&htt->tx_lock); =20 rcu_read_lock(); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C33A8C35276 for ; Mon, 24 Jan 2022 23:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367717AbiAXX4U (ORCPT ); Mon, 24 Jan 2022 18:56:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846417AbiAXXPz (ORCPT ); Mon, 24 Jan 2022 18:15:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E6ECC0604D4; Mon, 24 Jan 2022 13:24:42 -0800 (PST) Received: from smtp.kernel.org (relay.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 45C0CB81057; Mon, 24 Jan 2022 21:24:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76B06C340E4; Mon, 24 Jan 2022 21:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059480; bh=s5IjFqMJ/dT0kIt8h9WrHQlrzu3r9T+bGFdI2o8kycU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=faStgG3usJ/cAuKUTaCxnkhU0DChE5nEKJTr+TmFPi7QDGqs0jpdB5NavhR6aYywA uPZvHJlXTxMUDV64v4cCW8sZLoIyRwzSzyGAy3UP8Aye23iqBjGnCai0L9e7XS7PCr kTKZbWor4xBVieC93suXk0U2kyFqIZ/mTwegVmbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0630/1039] rtw89: dont kick off TX DMA if failed to write skb Date: Mon, 24 Jan 2022 19:40:19 +0100 Message-Id: <20220124184146.526481637@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ping-Ke Shih [ Upstream commit a58fdb7c843a37d6598204c6513961feefdadc6a ] This is found by Smatch static checker warning: drivers/net/wireless/realtek/rtw89/mac80211.c:31 rtw89_ops_tx() error: uninitialized symbol 'qsel'. The warning is because 'qsel' isn't filled by rtw89_core_tx_write() due to failed to write. The way to fix it is to avoid kicking off TX DMA, so add 'return' to the failure case. Reported-by: Dan Carpenter Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211201093816.13806-1-pkshih@realtek.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/realtek/rtw89/mac80211.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wi= reless/realtek/rtw89/mac80211.c index 16dc6fb7dbb0b..e9d61e55e2d92 100644 --- a/drivers/net/wireless/realtek/rtw89/mac80211.c +++ b/drivers/net/wireless/realtek/rtw89/mac80211.c @@ -27,6 +27,7 @@ static void rtw89_ops_tx(struct ieee80211_hw *hw, if (ret) { rtw89_err(rtwdev, "failed to transmit skb: %d\n", ret); ieee80211_free_txskb(hw, skb); + return; } rtw89_core_tx_kick_off(rtwdev, qsel); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B87CFC3527C for ; Mon, 24 Jan 2022 23:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386287AbiAXX5J (ORCPT ); Mon, 24 Jan 2022 18:57:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846418AbiAXXPz (ORCPT ); Mon, 24 Jan 2022 18:15:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80B05C0604D8; Mon, 24 Jan 2022 13:24:45 -0800 (PST) Received: from smtp.kernel.org (relay.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 4757AB8122A; Mon, 24 Jan 2022 21:24:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75869C340E4; Mon, 24 Jan 2022 21:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059483; bh=KnyhTXWyAhQ6+TJyfkCxRN8k4+AZ9shB9T5IiZSCg30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SLLIhh1JEZYVZQcPCcIHDWexNiPeIwyfJ7VvU83HWGlBj/OAKR6eKpwiFVKhcVNgb UsxVJtSsWcPIAqFwIoGHJ9TLNZHhGLkmDviIMkoZhrhjQhslgzx6tw/Xv8DjcFk3hP 3EmX944dv5RE0yFEHsS4zHDigI0WIqW5DmgRBm7Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antoine Tenart , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0631/1039] net-sysfs: update the queue counts in the unregistration path Date: Mon, 24 Jan 2022 19:40:20 +0100 Message-Id: <20220124184146.560054936@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antoine Tenart [ Upstream commit d7dac083414eb5bb99a6d2ed53dc2c1b405224e5 ] When updating Rx and Tx queue kobjects, the queue count should always be updated to match the queue kobjects count. This was not done in the net device unregistration path, fix it. Tracking all queue count updates will allow in a following up patch to detect illegal updates. Signed-off-by: Antoine Tenart Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/core/net-sysfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 9c01c642cf9ef..d7f9ee830d34c 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -1820,6 +1820,9 @@ static void remove_queue_kobjects(struct net_device *= dev) =20 net_rx_queue_update_kobjects(dev, real_rx, 0); netdev_queue_update_kobjects(dev, real_tx, 0); + + dev->real_num_rx_queues =3D 0; + dev->real_num_tx_queues =3D 0; #ifdef CONFIG_SYSFS kset_unregister(dev->queues_kset); #endif --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B704C35275 for ; Mon, 24 Jan 2022 23:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382994AbiAXXyS (ORCPT ); Mon, 24 Jan 2022 18:54:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846490AbiAXXQG (ORCPT ); Mon, 24 Jan 2022 18:16:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82C24C0604DF; Mon, 24 Jan 2022 13:24:48 -0800 (PST) Received: from smtp.kernel.org (relay.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 47FA3B81057; Mon, 24 Jan 2022 21:24:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67983C340E4; Mon, 24 Jan 2022 21:24:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059486; bh=sdOOB4UKo5fjVxrk5O+5GVl9Uq6JG4ZrtYrtaSgng6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FTDYZrkNpWH8h8XxGiNPQXTww6PE1AZfzNGY0YLdDayESdsjP+bg1xIajym3Csw7K yzOUv62VnlQuX/0+QKjbWr1roE96fl6yZ5mt4q6bCks1YE2gKk0xMI9DfjsCWVoYZk h5kBvVuQKUy+3yWMQHGzmc5ysdPc/rMNgTJiMsl4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gong , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0632/1039] ath10k: drop beacon and probe response which leak from other channel Date: Mon, 24 Jan 2022 19:40:21 +0100 Message-Id: <20220124184146.591001438@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wen Gong [ Upstream commit 3bf2537ec2e33310b431b53fd84be8833736c256 ] When scan request on channel 1, it also receive beacon from other channels, and the beacon also indicate to mac80211 and wpa_supplicant, and then the bss info appears in radio measurement report of radio measurement sent from wpa_supplicant, thus lead RRM case fail. This is to drop the beacon and probe response which is not the same channel of scanning. Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00049 Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211208061752.16564-1-quic_wgong@quicinc.c= om Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath10k/wmi.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/a= th/ath10k/wmi.c index 7c1c2658cb5f8..4733fd7fb169e 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -2611,9 +2611,30 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, stru= ct sk_buff *skb) ath10k_mac_handle_beacon(ar, skb); =20 if (ieee80211_is_beacon(hdr->frame_control) || - ieee80211_is_probe_resp(hdr->frame_control)) + ieee80211_is_probe_resp(hdr->frame_control)) { + struct ieee80211_mgmt *mgmt =3D (void *)skb->data; + u8 *ies; + int ies_ch; + status->boottime_ns =3D ktime_get_boottime_ns(); =20 + if (!ar->scan_channel) + goto drop; + + ies =3D mgmt->u.beacon.variable; + + ies_ch =3D cfg80211_get_ies_channel_number(mgmt->u.beacon.variable, + skb_tail_pointer(skb) - ies, + sband->band); + + if (ies_ch > 0 && ies_ch !=3D channel) { + ath10k_dbg(ar, ATH10K_DBG_MGMT, + "channel mismatched ds channel %d scan channel %d\n", + ies_ch, channel); + goto drop; + } + } + ath10k_dbg(ar, ATH10K_DBG_MGMT, "event mgmt rx skb %pK len %d ftype %02x stype %02x\n", skb, skb->len, @@ -2627,6 +2648,10 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, stru= ct sk_buff *skb) ieee80211_rx_ni(ar->hw, skb); =20 return 0; + +drop: + dev_kfree_skb(skb); + return 0; } =20 static int freq_to_idx(struct ath10k *ar, int freq) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89E9CC35270 for ; Mon, 24 Jan 2022 23:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367653AbiAXX4I (ORCPT ); Mon, 24 Jan 2022 18:56:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846497AbiAXXQH (ORCPT ); Mon, 24 Jan 2022 18:16:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0C42C0604E3; Mon, 24 Jan 2022 13:24:49 -0800 (PST) Received: from smtp.kernel.org (relay.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 8FF4C614D9; Mon, 24 Jan 2022 21:24:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67789C340E4; Mon, 24 Jan 2022 21:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059489; bh=cIVsYXY5t94PiqfXWViR/Oi0njjK/oBXtpCVnbK2xrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NL7fR9vJdIXDgEWKVO4GGU+Wb7F0dVDYpLT59bk88oVWpFMmBJFgZOwZC5aGCpaaN 5aRkCkEdvQTWAnIClYMCzBUqPae3dInm0ISmfZbIKNWgN+QpnuvQDdNG7zfKI9ehx8 kkd3f9hOFlZqybT1CjcwAMKaUSP5Vr5SVBM1QDeE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Lendacky , "Russell King (Oracle)" , Andrew Lunn , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0633/1039] net: phy: prefer 1000baseT over 1000baseKX Date: Mon, 24 Jan 2022 19:40:22 +0100 Message-Id: <20220124184146.628391804@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Russell King (Oracle) [ Upstream commit f20f94f7f52c4685c81754f489ffcc72186e8bdb ] The PHY settings table is supposed to be sorted by descending match priority - in other words, earlier entries are preferred over later entries. The order of 1000baseKX/Full and 1000baseT/Full is such that we prefer 1000baseKX/Full over 1000baseT/Full, but 1000baseKX/Full is a lot rarer than 1000baseT/Full, and thus is much less likely to be preferred. This causes phylink problems - it means a fixed link specifying a speed of 1G and full duplex gets an ethtool linkmode of 1000baseKX/Full rather than 1000baseT/Full as would be expected - and since we offer userspace a software emulation of a conventional copper PHY, we want to offer copper modes in preference to anything else. However, we do still want to allow the rarer modes as well. Hence, let's reorder these two modes to prefer copper. Tested-by: Tom Lendacky Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn Reported-by: Florian Fainelli Link: https://lore.kernel.org/r/E1muvFO-00F6jY-1K@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/phy/phy-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c index 2870c33b8975d..271fc01f7f7fd 100644 --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c @@ -162,11 +162,11 @@ static const struct phy_setting settings[] =3D { PHY_SETTING( 2500, FULL, 2500baseT_Full ), PHY_SETTING( 2500, FULL, 2500baseX_Full ), /* 1G */ - PHY_SETTING( 1000, FULL, 1000baseKX_Full ), PHY_SETTING( 1000, FULL, 1000baseT_Full ), PHY_SETTING( 1000, HALF, 1000baseT_Half ), PHY_SETTING( 1000, FULL, 1000baseT1_Full ), PHY_SETTING( 1000, FULL, 1000baseX_Full ), + PHY_SETTING( 1000, FULL, 1000baseKX_Full ), /* 100M */ PHY_SETTING( 100, FULL, 100baseT_Full ), PHY_SETTING( 100, FULL, 100baseT1_Full ), --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23B9CC4332F for ; Mon, 24 Jan 2022 22:19:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582965AbiAXWQP (ORCPT ); Mon, 24 Jan 2022 17:16:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41100 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376280AbiAXVYy (ORCPT ); Mon, 24 Jan 2022 16:24:54 -0500 Received: from smtp.kernel.org (relay.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 1F8D0B81142; Mon, 24 Jan 2022 21:24:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A85CC340E4; Mon, 24 Jan 2022 21:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059491; bh=JRwEwaQ2ghXjEgsdO+LW6h97cIMvCsKA8iS5G29TpR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l3DA5vKvf6apPnKOBnjpq9mPvNMlJWz4v2MsztzPhoDd4TbOTMnmONreqpiueX89i a/flODkk4i6PnzeZQKbG2DvCWHaCwlwR8pjIvtQ4uDzwbkAhHiL5mBPQQOJdn6rIwd eVrghSX8WEhVBsJLAdobvgSGvJOUqx4U5Ti2ekJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Iwona Winiarska , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.16 0634/1039] gpio: aspeed: Convert aspeed_gpio.lock to raw_spinlock Date: Mon, 24 Jan 2022 19:40:23 +0100 Message-Id: <20220124184146.664807169@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Iwona Winiarska [ Upstream commit 61a7904b6ace99b1bde0d0e867fa3097f5c8cee2 ] The gpio-aspeed driver implements an irq_chip which need to be invoked from hardirq context. Since spin_lock() can sleep with PREEMPT_RT, it is no longer legal to invoke it while interrupts are disabled. This also causes lockdep to complain about: [ 0.649797] [ BUG: Invalid wait context ] because aspeed_gpio.lock (spin_lock_t) is taken under irq_desc.lock (raw_spinlock_t). Let's use of raw_spinlock_t instead of spinlock_t. Signed-off-by: Iwona Winiarska Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpio/gpio-aspeed.c | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index 3c8f20c57695f..318a7d95a1a8b 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c @@ -53,7 +53,7 @@ struct aspeed_gpio_config { struct aspeed_gpio { struct gpio_chip chip; struct irq_chip irqc; - spinlock_t lock; + raw_spinlock_t lock; void __iomem *base; int irq; const struct aspeed_gpio_config *config; @@ -413,14 +413,14 @@ static void aspeed_gpio_set(struct gpio_chip *gc, uns= igned int offset, unsigned long flags; bool copro; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); copro =3D aspeed_gpio_copro_request(gpio, offset); =20 __aspeed_gpio_set(gc, offset, val); =20 if (copro) aspeed_gpio_copro_release(gpio, offset); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); } =20 static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) @@ -435,7 +435,7 @@ static int aspeed_gpio_dir_in(struct gpio_chip *gc, uns= igned int offset) if (!have_input(gpio, offset)) return -ENOTSUPP; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 reg =3D ioread32(addr); reg &=3D ~GPIO_BIT(offset); @@ -445,7 +445,7 @@ static int aspeed_gpio_dir_in(struct gpio_chip *gc, uns= igned int offset) if (copro) aspeed_gpio_copro_release(gpio, offset); =20 - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return 0; } @@ -463,7 +463,7 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc, if (!have_output(gpio, offset)) return -ENOTSUPP; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 reg =3D ioread32(addr); reg |=3D GPIO_BIT(offset); @@ -474,7 +474,7 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc, =20 if (copro) aspeed_gpio_copro_release(gpio, offset); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return 0; } @@ -492,11 +492,11 @@ static int aspeed_gpio_get_direction(struct gpio_chip= *gc, unsigned int offset) if (!have_output(gpio, offset)) return GPIO_LINE_DIRECTION_IN; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 val =3D ioread32(bank_reg(gpio, bank, reg_dir)) & GPIO_BIT(offset); =20 - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return val ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN; } @@ -539,14 +539,14 @@ static void aspeed_gpio_irq_ack(struct irq_data *d) =20 status_addr =3D bank_reg(gpio, bank, reg_irq_status); =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); copro =3D aspeed_gpio_copro_request(gpio, offset); =20 iowrite32(bit, status_addr); =20 if (copro) aspeed_gpio_copro_release(gpio, offset); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); } =20 static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) @@ -565,7 +565,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d= , bool set) =20 addr =3D bank_reg(gpio, bank, reg_irq_enable); =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); copro =3D aspeed_gpio_copro_request(gpio, offset); =20 reg =3D ioread32(addr); @@ -577,7 +577,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d= , bool set) =20 if (copro) aspeed_gpio_copro_release(gpio, offset); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); } =20 static void aspeed_gpio_irq_mask(struct irq_data *d) @@ -629,7 +629,7 @@ static int aspeed_gpio_set_type(struct irq_data *d, uns= igned int type) return -EINVAL; } =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); copro =3D aspeed_gpio_copro_request(gpio, offset); =20 addr =3D bank_reg(gpio, bank, reg_irq_type0); @@ -649,7 +649,7 @@ static int aspeed_gpio_set_type(struct irq_data *d, uns= igned int type) =20 if (copro) aspeed_gpio_copro_release(gpio, offset); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 irq_set_handler_locked(d, handler); =20 @@ -716,7 +716,7 @@ static int aspeed_gpio_reset_tolerance(struct gpio_chip= *chip, =20 treg =3D bank_reg(gpio, to_bank(offset), reg_tolerance); =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); copro =3D aspeed_gpio_copro_request(gpio, offset); =20 val =3D readl(treg); @@ -730,7 +730,7 @@ static int aspeed_gpio_reset_tolerance(struct gpio_chip= *chip, =20 if (copro) aspeed_gpio_copro_release(gpio, offset); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return 0; } @@ -856,7 +856,7 @@ static int enable_debounce(struct gpio_chip *chip, unsi= gned int offset, return rc; } =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 if (timer_allocation_registered(gpio, offset)) { rc =3D unregister_allocated_timer(gpio, offset); @@ -916,7 +916,7 @@ static int enable_debounce(struct gpio_chip *chip, unsi= gned int offset, configure_timer(gpio, offset, i); =20 out: - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return rc; } @@ -927,13 +927,13 @@ static int disable_debounce(struct gpio_chip *chip, u= nsigned int offset) unsigned long flags; int rc; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 rc =3D unregister_allocated_timer(gpio, offset); if (!rc) configure_timer(gpio, offset, 0); =20 - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return rc; } @@ -1015,7 +1015,7 @@ int aspeed_gpio_copro_grab_gpio(struct gpio_desc *des= c, return -EINVAL; bindex =3D offset >> 3; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 /* Sanity check, this shouldn't happen */ if (gpio->cf_copro_bankmap[bindex] =3D=3D 0xff) { @@ -1036,7 +1036,7 @@ int aspeed_gpio_copro_grab_gpio(struct gpio_desc *des= c, if (bit) *bit =3D GPIO_OFFSET(offset); bail: - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); return rc; } EXPORT_SYMBOL_GPL(aspeed_gpio_copro_grab_gpio); @@ -1060,7 +1060,7 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *= desc) return -EINVAL; bindex =3D offset >> 3; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 /* Sanity check, this shouldn't happen */ if (gpio->cf_copro_bankmap[bindex] =3D=3D 0) { @@ -1074,7 +1074,7 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *= desc) aspeed_gpio_change_cmd_source(gpio, bank, bindex, GPIO_CMDSRC_ARM); bail: - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); return rc; } EXPORT_SYMBOL_GPL(aspeed_gpio_copro_release_gpio); @@ -1148,7 +1148,7 @@ static int __init aspeed_gpio_probe(struct platform_d= evice *pdev) if (IS_ERR(gpio->base)) return PTR_ERR(gpio->base); =20 - spin_lock_init(&gpio->lock); + raw_spin_lock_init(&gpio->lock); =20 gpio_id =3D of_match_node(aspeed_gpio_of_table, pdev->dev.of_node); if (!gpio_id) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCACCC4332F for ; Mon, 24 Jan 2022 22:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580725AbiAXWKe (ORCPT ); Mon, 24 Jan 2022 17:10:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40176 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376356AbiAXVY5 (ORCPT ); Mon, 24 Jan 2022 16:24:57 -0500 Received: from smtp.kernel.org (relay.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 1A04EB81057; Mon, 24 Jan 2022 21:24:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 426EDC340E4; Mon, 24 Jan 2022 21:24:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059494; bh=zrGN/H7rq5Xkf0os/FChXmYJJlBZX3zxIDFjOnOwKh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ye0qDi+HUghnJT8y7yXv+FXt3YeR708dKCXd4LiJWe1K1bzby8VL7YDG3GJcC9exZ Z/Y6DRAtyzK3pE/9WKANfEVm+1wgDo5f4bOJGJRBJVUdSb/xn+tGuAU7hWJYYuOpYM uP5YPI6Q3qHaugq+SGwndyTkaVFRYUjm6xGrh82A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Iwona Winiarska , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.16 0635/1039] gpio: aspeed-sgpio: Convert aspeed_sgpio.lock to raw_spinlock Date: Mon, 24 Jan 2022 19:40:24 +0100 Message-Id: <20220124184146.694173115@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Iwona Winiarska [ Upstream commit ab39d6988dd53f354130438d8afa5596a2440fed ] The gpio-aspeed-sgpio driver implements an irq_chip which need to be invoked from hardirq context. Since spin_lock() can sleep with PREEMPT_RT, it is no longer legal to invoke it while interrupts are disabled. This also causes lockdep to complain about: [ 25.919465] [ BUG: Invalid wait context ] because aspeed_sgpio.lock (spin_lock_t) is taken under irq_desc.lock (raw_spinlock_t). Let's use of raw_spinlock_t instead of spinlock_t. Signed-off-by: Iwona Winiarska Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpio/gpio-aspeed-sgpio.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/gpio/gpio-aspeed-sgpio.c b/drivers/gpio/gpio-aspeed-sg= pio.c index b3a9b8488f11d..454cefbeecf0e 100644 --- a/drivers/gpio/gpio-aspeed-sgpio.c +++ b/drivers/gpio/gpio-aspeed-sgpio.c @@ -31,7 +31,7 @@ struct aspeed_sgpio { struct gpio_chip chip; struct irq_chip intc; struct clk *pclk; - spinlock_t lock; + raw_spinlock_t lock; void __iomem *base; int irq; }; @@ -173,12 +173,12 @@ static int aspeed_sgpio_get(struct gpio_chip *gc, uns= igned int offset) enum aspeed_sgpio_reg reg; int rc =3D 0; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 reg =3D aspeed_sgpio_is_input(offset) ? reg_val : reg_rdata; rc =3D !!(ioread32(bank_reg(gpio, bank, reg)) & GPIO_BIT(offset)); =20 - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return rc; } @@ -215,11 +215,11 @@ static void aspeed_sgpio_set(struct gpio_chip *gc, un= signed int offset, int val) struct aspeed_sgpio *gpio =3D gpiochip_get_data(gc); unsigned long flags; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 sgpio_set_value(gc, offset, val); =20 - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); } =20 static int aspeed_sgpio_dir_in(struct gpio_chip *gc, unsigned int offset) @@ -236,9 +236,9 @@ static int aspeed_sgpio_dir_out(struct gpio_chip *gc, u= nsigned int offset, int v /* No special action is required for setting the direction; we'll * error-out in sgpio_set_value if this isn't an output GPIO */ =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); rc =3D sgpio_set_value(gc, offset, val); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return rc; } @@ -277,11 +277,11 @@ static void aspeed_sgpio_irq_ack(struct irq_data *d) =20 status_addr =3D bank_reg(gpio, bank, reg_irq_status); =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 iowrite32(bit, status_addr); =20 - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); } =20 static void aspeed_sgpio_irq_set_mask(struct irq_data *d, bool set) @@ -296,7 +296,7 @@ static void aspeed_sgpio_irq_set_mask(struct irq_data *= d, bool set) irqd_to_aspeed_sgpio_data(d, &gpio, &bank, &bit, &offset); addr =3D bank_reg(gpio, bank, reg_irq_enable); =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 reg =3D ioread32(addr); if (set) @@ -306,7 +306,7 @@ static void aspeed_sgpio_irq_set_mask(struct irq_data *= d, bool set) =20 iowrite32(reg, addr); =20 - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); } =20 static void aspeed_sgpio_irq_mask(struct irq_data *d) @@ -355,7 +355,7 @@ static int aspeed_sgpio_set_type(struct irq_data *d, un= signed int type) return -EINVAL; } =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 addr =3D bank_reg(gpio, bank, reg_irq_type0); reg =3D ioread32(addr); @@ -372,7 +372,7 @@ static int aspeed_sgpio_set_type(struct irq_data *d, un= signed int type) reg =3D (reg & ~bit) | type2; iowrite32(reg, addr); =20 - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 irq_set_handler_locked(d, handler); =20 @@ -467,7 +467,7 @@ static int aspeed_sgpio_reset_tolerance(struct gpio_chi= p *chip, =20 reg =3D bank_reg(gpio, to_bank(offset), reg_tolerance); =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 val =3D readl(reg); =20 @@ -478,7 +478,7 @@ static int aspeed_sgpio_reset_tolerance(struct gpio_chi= p *chip, =20 writel(val, reg); =20 - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return 0; } @@ -575,7 +575,7 @@ static int __init aspeed_sgpio_probe(struct platform_de= vice *pdev) iowrite32(FIELD_PREP(ASPEED_SGPIO_CLK_DIV_MASK, sgpio_clk_div) | gpio_cnt= _regval | ASPEED_SGPIO_ENABLE, gpio->base + ASPEED_SGPIO_CTRL); =20 - spin_lock_init(&gpio->lock); + raw_spin_lock_init(&gpio->lock); =20 gpio->chip.parent =3D &pdev->dev; gpio->chip.ngpio =3D nr_gpios * 2; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF07DC43219 for ; Mon, 24 Jan 2022 22:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580748AbiAXWKi (ORCPT ); Mon, 24 Jan 2022 17:10:38 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46066 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376793AbiAXVZA (ORCPT ); Mon, 24 Jan 2022 16:25:00 -0500 Received: from smtp.kernel.org (relay.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 6613961469; Mon, 24 Jan 2022 21:24:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 335E1C340E4; Mon, 24 Jan 2022 21:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059497; bh=NsNmxlzJcp4bHdt1JVI79chzoIVKauwC5RQte6uzHu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YfETxqB4EkckEr6KgubzH4oOV2JDEYGuSE1mDs4hDozpoJHiNLomr+NQdTXaUN9hz YM5H3WAwwXR29AT2juotLcwA004u0bQHBsLDaPZEpHmWDM3Fzd6wHASuBZ3iyMdAOj +Zx1DPnauuScXjLHPJGOeU0HmwqI3hYVTMTbWRNM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Egorenkov , Heiko Carstens , Masami Hiramatsu , Shuah Khan , Sasha Levin Subject: [PATCH 5.16 0636/1039] selftests/ftrace: make kprobe profile testcase description unique Date: Mon, 24 Jan 2022 19:40:25 +0100 Message-Id: <20220124184146.724019608@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Heiko Carstens [ Upstream commit e5992f373c6eed6d09e5858e9623df1259b3ce30 ] Commit 32f6e5da83c7 ("selftests/ftrace: Add kprobe profile testcase") added a new kprobes testcase, but has a description which does not describe what the test case is doing and is duplicating the description of another test case. Therefore change the test case description, so it is unique and then allows easily to tell which test case actually passed or failed. Reported-by: Alexander Egorenkov Signed-off-by: Heiko Carstens Acked-by: Masami Hiramatsu Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/ftrace/test.d/kprobe/profile.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/profile.tc b/tool= s/testing/selftests/ftrace/test.d/kprobe/profile.tc index 98166fa3eb91c..34fb89b0c61fa 100644 --- a/tools/testing/selftests/ftrace/test.d/kprobe/profile.tc +++ b/tools/testing/selftests/ftrace/test.d/kprobe/profile.tc @@ -1,6 +1,6 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 -# description: Kprobe dynamic event - adding and removing +# description: Kprobe profile # requires: kprobe_events =20 ! grep -q 'myevent' kprobe_profile --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 106A7C433F5 for ; Mon, 24 Jan 2022 22:19:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582946AbiAXWQO (ORCPT ); Mon, 24 Jan 2022 17:16:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:39110 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441926AbiAXVZI (ORCPT ); Mon, 24 Jan 2022 16:25:08 -0500 Received: from smtp.kernel.org (relay.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 4C393B8121C; Mon, 24 Jan 2022 21:25:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 776FAC340E4; Mon, 24 Jan 2022 21:25:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059504; bh=ogVrOynjJInkjAmfKe6hnKYsopbVCDm3RpXJSJ1b72Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iGsW5KXwOI7h5ycHBEcdk5m3XwKoXgzNqh/OUwj2dWw07BtUNXQxbu5BulO56iVH1 ASmUbh/Pq3bjiOnIbzL1ppNcItM+Qk0jc8egeC2xlx9IjmH/FNarg2xaWsmdx51saY WUHxsIEjVrLw0ww3sUZx+MprpMwCWHgGO477tCJ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jagan Teki , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.16 0637/1039] arm64: dts: rockchip: Fix Bluetooth on ROCK Pi 4 boards Date: Mon, 24 Jan 2022 19:40:26 +0100 Message-Id: <20220124184146.756351667@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jagan Teki [ Upstream commit f471b1b2db0819917c54099ab68349ad6a7e9e19 ] This patch fixes the Bluetooth on ROCK Pi 4 boards. ROCK Pi 4 boards has BCM4345C5 and now it is supported on Mainline Linux, brcm,bcm43438-bt still working but observed the BT Audio issues with latest test. So, use the BCM4345C5 compatible and its associated properties like clock-names as lpo and max-speed. Attach vbat and vddio supply rails as well. Signed-off-by: Jagan Teki Link: https://lore.kernel.org/r/20211112142359.320798-1-jagan@amarulasoluti= ons.com Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b-plus.dts | 7 +++++-- arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts | 7 +++++-- arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b-plus.dts b/arch= /arm64/boot/dts/rockchip/rk3399-rock-pi-4b-plus.dts index dfad13d2ab249..5bd2b8db3d51a 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b-plus.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b-plus.dts @@ -35,13 +35,16 @@ status =3D "okay"; =20 bluetooth { - compatible =3D "brcm,bcm43438-bt"; + compatible =3D "brcm,bcm4345c5"; clocks =3D <&rk808 1>; - clock-names =3D "ext_clock"; + clock-names =3D "lpo"; device-wakeup-gpios =3D <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; host-wakeup-gpios =3D <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; shutdown-gpios =3D <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + max-speed =3D <1500000>; pinctrl-names =3D "default"; pinctrl-0 =3D <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply =3D <&vcc3v3_sys>; + vddio-supply =3D <&vcc_1v8>; }; }; diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts b/arch/arm6= 4/boot/dts/rockchip/rk3399-rock-pi-4b.dts index 6c63e617063c9..cf48746a3ad81 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts @@ -34,13 +34,16 @@ status =3D "okay"; =20 bluetooth { - compatible =3D "brcm,bcm43438-bt"; + compatible =3D "brcm,bcm4345c5"; clocks =3D <&rk808 1>; - clock-names =3D "ext_clock"; + clock-names =3D "lpo"; device-wakeup-gpios =3D <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; host-wakeup-gpios =3D <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; shutdown-gpios =3D <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + max-speed =3D <1500000>; pinctrl-names =3D "default"; pinctrl-0 =3D <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply =3D <&vcc3v3_sys>; + vddio-supply =3D <&vcc_1v8>; }; }; diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts b/arch/arm6= 4/boot/dts/rockchip/rk3399-rock-pi-4c.dts index 99169bcd51c03..57ddf55ee6930 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts @@ -35,14 +35,17 @@ status =3D "okay"; =20 bluetooth { - compatible =3D "brcm,bcm43438-bt"; + compatible =3D "brcm,bcm4345c5"; clocks =3D <&rk808 1>; - clock-names =3D "ext_clock"; + clock-names =3D "lpo"; device-wakeup-gpios =3D <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; host-wakeup-gpios =3D <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; shutdown-gpios =3D <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + max-speed =3D <1500000>; pinctrl-names =3D "default"; pinctrl-0 =3D <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply =3D <&vcc3v3_sys>; + vddio-supply =3D <&vcc_1v8>; }; }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BB13C47084 for ; Mon, 24 Jan 2022 23:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385730AbiAXXyT (ORCPT ); Mon, 24 Jan 2022 18:54:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846507AbiAXXQK (ORCPT ); Mon, 24 Jan 2022 18:16:10 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 705E3C0617AF; Mon, 24 Jan 2022 13:25:09 -0800 (PST) Received: from smtp.kernel.org (relay.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 2E7BCB80FA1; Mon, 24 Jan 2022 21:25:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64EF2C340E4; Mon, 24 Jan 2022 21:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059506; bh=95GCpHGKqrDOnTHDjBov/AgE51i+C6JljTvU42fCrk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z4NS6efURP0DlEy7fVX7+6b95kK3x930Tpc9r3mkRdBzpMtF7c7dDkVmWtTga40cg PsQwXa86ubDQhaPxa/nwCSL1korZiQbo61LMEooWgWoASVeVJTm+drQwokBmC6FLRD /ehP7Aj1FkXj8+3QfUb7B6EpkAgaT1qcyrMG+lNM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baochen Qiang , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0638/1039] ath11k: Avoid false DEADLOCK warning reported by lockdep Date: Mon, 24 Jan 2022 19:40:27 +0100 Message-Id: <20220124184146.802594787@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baochen Qiang [ Upstream commit 767c94caf0efad136157110787fe221b74cb5c8a ] With CONFIG_LOCKDEP=3Dy and CONFIG_DEBUG_SPINLOCK=3Dy, lockdep reports below warning: [ 166.059415] =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 [ 166.059416] WARNING: possible recursive locking detected [ 166.059418] 5.15.0-wt-ath+ #10 Tainted: G W O [ 166.059420] -------------------------------------------- [ 166.059421] kworker/0:2/116 is trying to acquire lock: [ 166.059423] ffff9905f2083160 (&srng->lock){+.-.}-{2:2}, at: ath11k_hal_r= eo_cmd_send+0x20/0x490 [ath11k] [ 166.059440] but task is already holding lock: [ 166.059442] ffff9905f2083230 (&srng->lock){+.-.}-{2:2}, at: ath11k_dp_pr= ocess_reo_status+0x95/0x2d0 [ath11k] [ 166.059491] other info that might help us debug this: [ 166.059492] Possible unsafe locking scenario: [ 166.059493] CPU0 [ 166.059494] ---- [ 166.059495] lock(&srng->lock); [ 166.059498] lock(&srng->lock); [ 166.059500] *** DEADLOCK *** [ 166.059501] May be due to missing lock nesting notation [ 166.059502] 3 locks held by kworker/0:2/116: [ 166.059504] #0: ffff9905c0081548 ((wq_completion)events){+.+.}-{0:0}, a= t: process_one_work+0x1f6/0x660 [ 166.059511] #1: ffff9d2400a5fe68 ((debug_obj_work).work){+.+.}-{0:0}, a= t: process_one_work+0x1f6/0x660 [ 166.059517] #2: ffff9905f2083230 (&srng->lock){+.-.}-{2:2}, at: ath11k_= dp_process_reo_status+0x95/0x2d0 [ath11k] [ 166.059532] stack backtrace: [ 166.059534] CPU: 0 PID: 116 Comm: kworker/0:2 Kdump: loaded Tainted: G = W O 5.15.0-wt-ath+ #10 [ 166.059537] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, = BIOS HNKBLi70.86A.0059.2019.1112.1124 11/12/2019 [ 166.059539] Workqueue: events free_obj_work [ 166.059543] Call Trace: [ 166.059545] [ 166.059547] dump_stack_lvl+0x56/0x7b [ 166.059552] __lock_acquire+0xb9a/0x1a50 [ 166.059556] lock_acquire+0x1e2/0x330 [ 166.059560] ? ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k] [ 166.059571] _raw_spin_lock_bh+0x33/0x70 [ 166.059574] ? ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k] [ 166.059584] ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k] [ 166.059594] ath11k_dp_tx_send_reo_cmd+0x3f/0x130 [ath11k] [ 166.059605] ath11k_dp_rx_tid_del_func+0x221/0x370 [ath11k] [ 166.059618] ath11k_dp_process_reo_status+0x22f/0x2d0 [ath11k] [ 166.059632] ? ath11k_dp_service_srng+0x2ea/0x2f0 [ath11k] [ 166.059643] ath11k_dp_service_srng+0x2ea/0x2f0 [ath11k] [ 166.059655] ath11k_pci_ext_grp_napi_poll+0x1c/0x70 [ath11k_pci] [ 166.059659] __napi_poll+0x28/0x230 [ 166.059664] net_rx_action+0x285/0x310 [ 166.059668] __do_softirq+0xe6/0x4d2 [ 166.059672] irq_exit_rcu+0xd2/0xf0 [ 166.059675] common_interrupt+0xa5/0xc0 [ 166.059678] [ 166.059679] [ 166.059680] asm_common_interrupt+0x1e/0x40 [ 166.059683] RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70 [ 166.059686] Code: 83 c7 18 e8 2a 95 43 ff 48 89 ef e8 22 d2 43 ff 81 e3 = 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 63 2e 40 ff 65 8b 05 8c 59 97 5c 85 c0 74 0a 5b 5d c3 e8 00 6a [ 166.059689] RSP: 0018:ffff9d2400a5fca0 EFLAGS: 00000206 [ 166.059692] RAX: 0000000000000002 RBX: 0000000000000200 RCX: 00000000000= 00006 [ 166.059694] RDX: 0000000000000000 RSI: ffffffffa404879b RDI: 00000000000= 00001 [ 166.059696] RBP: ffff9905c0053000 R08: 0000000000000001 R09: 00000000000= 00001 [ 166.059698] R10: ffff9d2400a5fc50 R11: 0000000000000001 R12: ffffe186c41= e2840 [ 166.059700] R13: 0000000000000001 R14: ffff9905c78a1c68 R15: 00000000000= 00001 [ 166.059704] free_debug_processing+0x257/0x3d0 [ 166.059708] ? free_obj_work+0x1f5/0x250 [ 166.059712] __slab_free+0x374/0x5a0 [ 166.059718] ? kmem_cache_free+0x2e1/0x370 [ 166.059721] ? free_obj_work+0x1f5/0x250 [ 166.059724] kmem_cache_free+0x2e1/0x370 [ 166.059727] free_obj_work+0x1f5/0x250 [ 166.059731] process_one_work+0x28b/0x660 [ 166.059735] ? process_one_work+0x660/0x660 [ 166.059738] worker_thread+0x37/0x390 [ 166.059741] ? process_one_work+0x660/0x660 [ 166.059743] kthread+0x176/0x1a0 [ 166.059746] ? set_kthread_struct+0x40/0x40 [ 166.059749] ret_from_fork+0x22/0x30 [ 166.059754] Since these two lockes are both initialized in ath11k_hal_srng_setup, they are assigned with the same key. As a result lockdep suspects that the task is trying to acquire the same lock (due to same key) while already holding it, and thus reports the DEADLOCK warning. However as they are different spinlock instances, the warning is false positive. On the other hand, even no dead lock indeed, this is a major issue for upstream regression testing as it disables lockdep functionality. Fix it by assigning separate lock class key for each srng->lock. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ= _LITE-1 Signed-off-by: Baochen Qiang Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211209011949.151472-1-quic_bqiang@quicinc= .com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/hal.c | 22 ++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/hal.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/a= th/ath11k/hal.c index f04edafbd0f15..1832d13654a87 100644 --- a/drivers/net/wireless/ath/ath11k/hal.c +++ b/drivers/net/wireless/ath/ath11k/hal.c @@ -971,6 +971,7 @@ int ath11k_hal_srng_setup(struct ath11k_base *ab, enum = hal_ring_type type, srng->msi_data =3D params->msi_data; srng->initialized =3D 1; spin_lock_init(&srng->lock); + lockdep_set_class(&srng->lock, hal->srng_key + ring_id); =20 for (i =3D 0; i < HAL_SRNG_NUM_REG_GRP; i++) { srng->hwreg_base[i] =3D srng_config->reg_start[i] + @@ -1257,6 +1258,24 @@ static int ath11k_hal_srng_create_config(struct ath1= 1k_base *ab) return 0; } =20 +static void ath11k_hal_register_srng_key(struct ath11k_base *ab) +{ + struct ath11k_hal *hal =3D &ab->hal; + u32 ring_id; + + for (ring_id =3D 0; ring_id < HAL_SRNG_RING_ID_MAX; ring_id++) + lockdep_register_key(hal->srng_key + ring_id); +} + +static void ath11k_hal_unregister_srng_key(struct ath11k_base *ab) +{ + struct ath11k_hal *hal =3D &ab->hal; + u32 ring_id; + + for (ring_id =3D 0; ring_id < HAL_SRNG_RING_ID_MAX; ring_id++) + lockdep_unregister_key(hal->srng_key + ring_id); +} + int ath11k_hal_srng_init(struct ath11k_base *ab) { struct ath11k_hal *hal =3D &ab->hal; @@ -1276,6 +1295,8 @@ int ath11k_hal_srng_init(struct ath11k_base *ab) if (ret) goto err_free_cont_rdp; =20 + ath11k_hal_register_srng_key(ab); + return 0; =20 err_free_cont_rdp: @@ -1290,6 +1311,7 @@ void ath11k_hal_srng_deinit(struct ath11k_base *ab) { struct ath11k_hal *hal =3D &ab->hal; =20 + ath11k_hal_unregister_srng_key(ab); ath11k_hal_free_cont_rdp(ab); ath11k_hal_free_cont_wrp(ab); kfree(hal->srng_config); diff --git a/drivers/net/wireless/ath/ath11k/hal.h b/drivers/net/wireless/a= th/ath11k/hal.h index 0f4f9ce74354b..a7d9b4c551ada 100644 --- a/drivers/net/wireless/ath/ath11k/hal.h +++ b/drivers/net/wireless/ath/ath11k/hal.h @@ -902,6 +902,8 @@ struct ath11k_hal { /* shadow register configuration */ u32 shadow_reg_addr[HAL_SHADOW_NUM_REGS]; int num_shadow_reg_configured; + + struct lock_class_key srng_key[HAL_SRNG_RING_ID_MAX]; }; =20 u32 ath11k_hal_reo_qdesc_size(u32 ba_window_size, u8 tid); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D753CC433EF for ; Mon, 24 Jan 2022 23:58:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1844719AbiAXXyk (ORCPT ); Mon, 24 Jan 2022 18:54:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846509AbiAXXQK (ORCPT ); Mon, 24 Jan 2022 18:16:10 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97CB9C0617B0; Mon, 24 Jan 2022 13:25:11 -0800 (PST) Received: from smtp.kernel.org (relay.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 3DB47B80FA1; Mon, 24 Jan 2022 21:25:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68FF0C340E4; Mon, 24 Jan 2022 21:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059510; bh=OLkQY0VqpEjqmsadHkfttEzD4OLRruEKHl2jmHWNBVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q6D14CEV7n50vz6/yI0ezWPfM3IhkRr4iFeaWfJUrycsrjqgBJMm4V//Gzs0LCc0w oMAbGiwK9eTKc04RICKZAodRhcOnIs84PWO+/KLseAntPzulAI6+6nD0COS4HK2t6/ sY91pU9KKdf3IPKZbQjajVWq2bWSsOqreejhR+4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Heidelberg , Manivannan Sadhasivam , Alex Elder , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0639/1039] ARM: dts: qcom: sdx55: fix IPA interconnect definitions Date: Mon, 24 Jan 2022 19:40:28 +0100 Message-Id: <20220124184146.834483881@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Elder [ Upstream commit c0d6316c238b1bd743108bd4b08eda364f47c7c9 ] The first two interconnects defined for IPA on the SDX55 SoC are really two parts of what should be represented as a single path between IPA and system memory. Fix this by combining the "memory-a" and "memory-b" interconnects into a single "memory" interconnect. Reported-by: David Heidelberg Tested-by: Manivannan Sadhasivam Signed-off-by: Alex Elder Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/boot/dts/qcom-sdx55.dtsi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/qcom-sdx55.dtsi b/arch/arm/boot/dts/qcom-sdx= 55.dtsi index 44526ad9d210b..eee2f63b9bbab 100644 --- a/arch/arm/boot/dts/qcom-sdx55.dtsi +++ b/arch/arm/boot/dts/qcom-sdx55.dtsi @@ -333,12 +333,10 @@ clocks =3D <&rpmhcc RPMH_IPA_CLK>; clock-names =3D "core"; =20 - interconnects =3D <&system_noc MASTER_IPA &system_noc SLAVE_SNOC_MEM_NO= C_GC>, - <&mem_noc MASTER_SNOC_GC_MEM_NOC &mc_virt SLAVE_EBI_CH0>, + interconnects =3D <&system_noc MASTER_IPA &mc_virt SLAVE_EBI_CH0>, <&system_noc MASTER_IPA &system_noc SLAVE_OCIMEM>, <&mem_noc MASTER_AMPSS_M0 &system_noc SLAVE_IPA_CFG>; - interconnect-names =3D "memory-a", - "memory-b", + interconnect-names =3D "memory", "imem", "config"; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35589C4707A for ; Mon, 24 Jan 2022 22:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581260AbiAXWLa (ORCPT ); Mon, 24 Jan 2022 17:11:30 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41240 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452346AbiAXVZR (ORCPT ); Mon, 24 Jan 2022 16:25:17 -0500 Received: from smtp.kernel.org (relay.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 459ABB811FB; Mon, 24 Jan 2022 21:25:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7276BC340E4; Mon, 24 Jan 2022 21:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059513; bh=DcWAn2JPOmd7HM4LptMNGkIDWokyu5A3HOzLpIINlwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=igMRjpDy0dDrG7eYEl2vIOL4kqSnB0PL7LsnLpwUuL6Y4c68Ji2OXuO4toShG2ATN kMyJnbauFhhVkHDWF6Entks63tpoxhWMYAlGNhSG5PNEhjza8mpSvl2gORz3yyf0zI 4Jy9XfgHTiU/Q01wMV/HQI0DYXAx1gcMuWner80c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Sasha Levin Subject: [PATCH 5.16 0640/1039] x86/mce: Allow instrumentation during task work queueing Date: Mon, 24 Jan 2022 19:40:29 +0100 Message-Id: <20220124184146.865221335@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Borislav Petkov [ Upstream commit 4fbce464db81a42f9a57ee242d6150ec7f996415 ] Fixes vmlinux.o: warning: objtool: do_machine_check()+0xdb1: call to queue_task= _work() leaves .noinstr.text section Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20211208111343.8130-6-bp@alien8.de Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/cpu/mce/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 6ed365337a3b1..70ec5685906b2 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1454,6 +1454,14 @@ noinstr void do_machine_check(struct pt_regs *regs) if (worst !=3D MCE_AR_SEVERITY && !kill_current_task) goto out; =20 + /* + * Enable instrumentation around the external facilities like + * task_work_add() (via queue_task_work()), fixup_exception() etc. + * For now, that is. Fixing this properly would need a lot more involved + * reorganization. + */ + instrumentation_begin(); + /* Fault was in user mode and we need to take some action */ if ((m.cs & 3) =3D=3D 3) { /* If this triggers there is no way to recover. Die hard. */ @@ -1482,6 +1490,9 @@ noinstr void do_machine_check(struct pt_regs *regs) if (m.kflags & MCE_IN_KERNEL_COPYIN) queue_task_work(&m, msg, kill_me_never); } + + instrumentation_end(); + out: mce_wrmsrl(MSR_IA32_MCG_STATUS, 0); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DD08C4321E for ; Mon, 24 Jan 2022 22:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580825AbiAXWKs (ORCPT ); Mon, 24 Jan 2022 17:10:48 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41262 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452372AbiAXVZU (ORCPT ); Mon, 24 Jan 2022 16:25:20 -0500 Received: from smtp.kernel.org (relay.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 1AD90B8123A; Mon, 24 Jan 2022 21:25:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4470AC340E4; Mon, 24 Jan 2022 21:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059515; bh=IuUQk7EuyxnlKJabLJmOzkPUFtwzZ9odlbaCsWfgiVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tAdfmr43wc/r5SPylpvW8pYhciVMejra9Od7IA0tDZ+jUuHUTQa2dAkxl+6klo/DC 1b+wci6C6GNV3RJ42ZpKNpsTAgIs3GILC9zwPf4vZ93WhNRU4fkc4VgpQwAd1FVfL3 CVcDWKfM22y7BMqTytJTeGNXfN+A1o6MSXkmNrm4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Sasha Levin Subject: [PATCH 5.16 0641/1039] x86/mce: Prevent severity computation from being instrumented Date: Mon, 24 Jan 2022 19:40:30 +0100 Message-Id: <20220124184146.898030990@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Borislav Petkov [ Upstream commit 0a5b288e85bbef5227bb6397e31fcf1d7ba9142a ] Mark all the MCE severity computation logic noinstr and allow instrumentation when it "calls out". Fixes vmlinux.o: warning: objtool: do_machine_check()+0xc5d: call to mce_severi= ty() leaves .noinstr.text section Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20211208111343.8130-7-bp@alien8.de Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/cpu/mce/severity.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/s= everity.c index bb019a594a2c9..171a1495111b1 100644 --- a/arch/x86/kernel/cpu/mce/severity.c +++ b/arch/x86/kernel/cpu/mce/severity.c @@ -263,24 +263,36 @@ static bool is_copy_from_user(struct pt_regs *regs) * distinguish an exception taken in user from from one * taken in the kernel. */ -static int error_context(struct mce *m, struct pt_regs *regs) +static noinstr int error_context(struct mce *m, struct pt_regs *regs) { + int fixup_type; + bool copy_user; + if ((m->cs & 3) =3D=3D 3) return IN_USER; + if (!mc_recoverable(m->mcgstatus)) return IN_KERNEL; =20 - switch (ex_get_fixup_type(m->ip)) { + /* Allow instrumentation around external facilities usage. */ + instrumentation_begin(); + fixup_type =3D ex_get_fixup_type(m->ip); + copy_user =3D is_copy_from_user(regs); + instrumentation_end(); + + switch (fixup_type) { case EX_TYPE_UACCESS: case EX_TYPE_COPY: - if (!regs || !is_copy_from_user(regs)) + if (!regs || !copy_user) return IN_KERNEL; m->kflags |=3D MCE_IN_KERNEL_COPYIN; fallthrough; + case EX_TYPE_FAULT_MCE_SAFE: case EX_TYPE_DEFAULT_MCE_SAFE: m->kflags |=3D MCE_IN_KERNEL_RECOV; return IN_KERNEL_RECOV; + default: return IN_KERNEL; } @@ -317,8 +329,8 @@ static int mce_severity_amd_smca(struct mce *m, enum co= ntext err_ctx) * See AMD Error Scope Hierarchy table in a newer BKDG. For example * 49125_15h_Models_30h-3Fh_BKDG.pdf, section "RAS Features" */ -static int mce_severity_amd(struct mce *m, struct pt_regs *regs, int toler= ant, - char **msg, bool is_excp) +static noinstr int mce_severity_amd(struct mce *m, struct pt_regs *regs, i= nt tolerant, + char **msg, bool is_excp) { enum context ctx =3D error_context(m, regs); =20 @@ -370,8 +382,8 @@ static int mce_severity_amd(struct mce *m, struct pt_re= gs *regs, int tolerant, return MCE_KEEP_SEVERITY; } =20 -static int mce_severity_intel(struct mce *m, struct pt_regs *regs, - int tolerant, char **msg, bool is_excp) +static noinstr int mce_severity_intel(struct mce *m, struct pt_regs *regs, + int tolerant, char **msg, bool is_excp) { enum exception excp =3D (is_excp ? EXCP_CONTEXT : NO_EXCP); enum context ctx =3D error_context(m, regs); @@ -407,8 +419,8 @@ static int mce_severity_intel(struct mce *m, struct pt_= regs *regs, } } =20 -int mce_severity(struct mce *m, struct pt_regs *regs, int tolerant, char *= *msg, - bool is_excp) +int noinstr mce_severity(struct mce *m, struct pt_regs *regs, int tolerant= , char **msg, + bool is_excp) { if (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_AMD || boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_HYGON) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDCD9C2BA4C for ; Mon, 24 Jan 2022 23:58:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367425AbiAXXzZ (ORCPT ); Mon, 24 Jan 2022 18:55:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846523AbiAXXQP (ORCPT ); Mon, 24 Jan 2022 18:16:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55D61C0617B1; Mon, 24 Jan 2022 13:25:21 -0800 (PST) Received: from smtp.kernel.org (relay.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 12649B81243; Mon, 24 Jan 2022 21:25:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A177C340E4; Mon, 24 Jan 2022 21:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059518; bh=76k952JqIoqnSJrdx/YN9ePOzNmgl602GkwnJ/y28TY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hX9abKQjqWcHi2yiscz10ufTLNOZl0NqPvd5BUL+xzD5g//faInXFfcp+4SVHzRj4 QGBhOac1SxLGb5bA/J3vcW3LVq2nve+ZTeobm/flfTg/eqy5HZYR1E2jHnQIKAWTEg HmGi4sSZbBpTTa0lvZ3R1KlgMuMpa/FOCX/n0fqA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Sasha Levin Subject: [PATCH 5.16 0642/1039] x86/mce: Mark mce_panic() noinstr Date: Mon, 24 Jan 2022 19:40:31 +0100 Message-Id: <20220124184146.936639036@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Borislav Petkov [ Upstream commit 3c7ce80a818fa7950be123cac80cd078e5ac1013 ] And allow instrumentation inside it because it does calls to other facilities which will not be tagged noinstr. Fixes vmlinux.o: warning: objtool: do_machine_check()+0xc73: call to mce_panic(= ) leaves .noinstr.text section Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20211208111343.8130-8-bp@alien8.de Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/cpu/mce/core.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 70ec5685906b2..9a52ec55e0555 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -267,11 +267,17 @@ static void wait_for_panic(void) panic("Panicing machine check CPU died"); } =20 -static void mce_panic(const char *msg, struct mce *final, char *exp) +static noinstr void mce_panic(const char *msg, struct mce *final, char *ex= p) { - int apei_err =3D 0; struct llist_node *pending; struct mce_evt_llist *l; + int apei_err =3D 0; + + /* + * Allow instrumentation around external facilities usage. Not that it + * matters a whole lot since the machine is going to panic anyway. + */ + instrumentation_begin(); =20 if (!fake_panic) { /* @@ -286,7 +292,7 @@ static void mce_panic(const char *msg, struct mce *fina= l, char *exp) } else { /* Don't log too much for fake panic */ if (atomic_inc_return(&mce_fake_panicked) > 1) - return; + goto out; } pending =3D mce_gen_pool_prepare_records(); /* First print corrected ones that are still unlogged */ @@ -324,6 +330,9 @@ static void mce_panic(const char *msg, struct mce *fina= l, char *exp) panic(msg); } else pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg); + +out: + instrumentation_end(); } =20 /* Support code for software error injection */ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F02FEC433F5 for ; Mon, 24 Jan 2022 23:58:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367176AbiAXXyq (ORCPT ); Mon, 24 Jan 2022 18:54:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846525AbiAXXQP (ORCPT ); Mon, 24 Jan 2022 18:16:15 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4F2CC0617B9; Mon, 24 Jan 2022 13:25:22 -0800 (PST) Received: from smtp.kernel.org (relay.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 51B1C614B4; Mon, 24 Jan 2022 21:25:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3215CC340E4; Mon, 24 Jan 2022 21:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059521; bh=3LV5DA4CunFmtMFjiRUINxyiWNUMTcXhYsN9cLaWweI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jyVN+TnWZ0RJ4OxTa1WTr2cRmaS2YLgDZ9DbDNU8WNhex+A5e4NpCgN5Ci5t/En+Z 6ZlxMoahAVwBTX999agP17o83ELYmcen4IfBrFR9eYx5oEYFpUBLQ8lQVdLS9bqzur sYFRNBp2HD+7AKmapQxg7qjCae62FKO9KKRJ3PuQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Sasha Levin Subject: [PATCH 5.16 0643/1039] x86/mce: Mark mce_end() noinstr Date: Mon, 24 Jan 2022 19:40:32 +0100 Message-Id: <20220124184146.973490807@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Borislav Petkov [ Upstream commit b4813539d37fa31fed62cdfab7bd2dd8929c5b2e ] It is called by the #MC handler which is noinstr. Fixes vmlinux.o: warning: objtool: do_machine_check()+0xbd6: call to memset() l= eaves .noinstr.text section Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20211208111343.8130-9-bp@alien8.de Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/cpu/mce/core.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 9a52ec55e0555..75095986e5eff 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1063,10 +1063,13 @@ static int mce_start(int *no_way_out) * Synchronize between CPUs after main scanning loop. * This invokes the bulk of the Monarch processing. */ -static int mce_end(int order) +static noinstr int mce_end(int order) { - int ret =3D -1; u64 timeout =3D (u64)mca_cfg.monarch_timeout * NSEC_PER_USEC; + int ret =3D -1; + + /* Allow instrumentation around external facilities. */ + instrumentation_begin(); =20 if (!timeout) goto reset; @@ -1110,7 +1113,8 @@ static int mce_end(int order) /* * Don't reset anything. That's done by the Monarch. */ - return 0; + ret =3D 0; + goto out; } =20 /* @@ -1126,6 +1130,10 @@ reset: * Let others run again. */ atomic_set(&mce_executing, 0); + +out: + instrumentation_end(); + return ret; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4C52C41535 for ; Mon, 24 Jan 2022 23:58:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367479AbiAXXze (ORCPT ); Mon, 24 Jan 2022 18:55:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846526AbiAXXQP (ORCPT ); Mon, 24 Jan 2022 18:16:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2389CC0617BA; Mon, 24 Jan 2022 13:25:27 -0800 (PST) Received: from smtp.kernel.org (relay.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 E0EAFB80FA1; Mon, 24 Jan 2022 21:25:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0960DC340E7; Mon, 24 Jan 2022 21:25:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059524; bh=6wrrJ7aDxIrQw2TbOvBal/FrCaDdQi8ycw415kthYKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xXBzi/AD4nBmViT04kMQ71g/g10lNhLJo3+T3ikECaW88oYsTWh27GwhpccalZfhA xr0SLaC8gxIxbqIRYzQGfjzKmpUW2u3TQ0+awzh4N2qCHTC/SSR76pFYroCzyMiZ4Z pHIZHQ0V21voyOrQZF3s397fdJHje5FqpTxfIkHE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Sasha Levin Subject: [PATCH 5.16 0644/1039] x86/mce: Mark mce_read_aux() noinstr Date: Mon, 24 Jan 2022 19:40:33 +0100 Message-Id: <20220124184147.005035525@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Borislav Petkov [ Upstream commit db6c996d6ce45dfb44891f0824a65ecec216f47a ] Fixes vmlinux.o: warning: objtool: do_machine_check()+0x681: call to mce_read_a= ux() leaves .noinstr.text section Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20211208111343.8130-10-bp@alien8.de Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/cpu/mce/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 75095986e5eff..69fd51a29278f 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -645,7 +645,7 @@ static struct notifier_block mce_default_nb =3D { /* * Read ADDR and MISC registers. */ -static void mce_read_aux(struct mce *m, int i) +static noinstr void mce_read_aux(struct mce *m, int i) { if (m->status & MCI_STATUS_MISCV) m->misc =3D mce_rdmsrl(mca_msr_reg(i, MCA_MISC)); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 125AEC433F5 for ; Mon, 24 Jan 2022 22:14:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580846AbiAXWKx (ORCPT ); Mon, 24 Jan 2022 17:10:53 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45234 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452401AbiAXVZ2 (ORCPT ); Mon, 24 Jan 2022 16:25:28 -0500 Received: from smtp.kernel.org (relay.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 59AAE61490; Mon, 24 Jan 2022 21:25:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32E06C340E9; Mon, 24 Jan 2022 21:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059527; bh=eFTZK+BDoNPOY/zrtFGms/hGWY8oU/F68SCn7MXvx3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lg49AQR9kaj636vLB9iCi3UZZr4F90hygygjKR32xiA8MiTlNwuDAb9X+OmfHBMfV gx6W37WQNeKc0paTVLytVg3XabQnvujL16/A1JKflAFNCm100e3/hzP07VuDmxbTMo aDc7PBvTDqBUsBkDYLcsCV5pgmZED2Wj2/Rst6rQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suresh Kumar , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0645/1039] net: bonding: debug: avoid printing debug logs when bond is not notifying peers Date: Mon, 24 Jan 2022 19:40:34 +0100 Message-Id: <20220124184147.033735836@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Suresh Kumar [ Upstream commit fee32de284ac277ba434a2d59f8ce46528ff3946 ] Currently "bond_should_notify_peers: slave ..." messages are printed whenev= er "bond_should_notify_peers" function is called. +++ Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: (slave enp0s25): Received LACPDU on po= rt 1 Dec 12 12:33:26 node1 kernel: bond0: (slave enp0s25): Rx Machine: Port=3D1,= Last State=3D6, Curr State=3D6 Dec 12 12:33:26 node1 kernel: bond0: (slave enp0s25): partner sync=3D1 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 ... Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:30 node1 kernel: bond0: (slave enp4s3): Received LACPDU on por= t 2 Dec 12 12:33:30 node1 kernel: bond0: (slave enp4s3): Rx Machine: Port=3D2, = Last State=3D6, Curr State=3D6 Dec 12 12:33:30 node1 kernel: bond0: (slave enp4s3): partner sync=3D1 Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 +++ This is confusing and can also clutter up debug logs. Print logs only when the peer notification happens. Signed-off-by: Suresh Kumar Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/bonding/bond_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_mai= n.c index ff8da720a33a7..0ac964359fbfe 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1096,9 +1096,6 @@ static bool bond_should_notify_peers(struct bonding *= bond) slave =3D rcu_dereference(bond->curr_active_slave); rcu_read_unlock(); =20 - netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", - slave ? slave->dev->name : "NULL"); - if (!slave || !bond->send_peer_notif || bond->send_peer_notif % max(1, bond->params.peer_notif_delay) !=3D 0 || @@ -1106,6 +1103,9 @@ static bool bond_should_notify_peers(struct bonding *= bond) test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) return false; =20 + netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", + slave ? slave->dev->name : "NULL"); + return true; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A610C4167E for ; Mon, 24 Jan 2022 23:58:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367383AbiAXXzR (ORCPT ); Mon, 24 Jan 2022 18:55:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846529AbiAXXQP (ORCPT ); Mon, 24 Jan 2022 18:16:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BB79C0617BB; Mon, 24 Jan 2022 13:25:33 -0800 (PST) Received: from smtp.kernel.org (relay.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 027AEB811A2; Mon, 24 Jan 2022 21:25:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FEF8C340E5; Mon, 24 Jan 2022 21:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059530; bh=l5m0JNrwApBjUgpOL2jCcyrk+wjkCLYERdR8P9Cx/Vw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AXEjFp9vPfYuvNSqweUSV5h6LJlR8Vx35kMrME0Ep3SnDqDTcvBxC8m9f4FCnJJhO Jn/lLoCmDErfWipqRlN6QoILlsGMVegnSbwN4gG4y/TDnQ8P7Nir65fOsP43uCRcLu /Jb9l9xXNMfA0NN18dG2P5S402XFh9M5z3ioR32U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Latypov , David Gow , Brendan Higgins , Shuah Khan , Sasha Levin Subject: [PATCH 5.16 0646/1039] kunit: Dont crash if no parameters are generated Date: Mon, 24 Jan 2022 19:40:35 +0100 Message-Id: <20220124184147.064749898@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Gow [ Upstream commit 37dbb4c7c7442dbfc9b651e4ddd4afe30b26afc9 ] It's possible that a parameterised test could end up with zero parameters. At the moment, the test function will nevertheless be called with NULL as the parameter. Instead, don't try to run the test code, and just mark the test as SKIPped. Reported-by: Daniel Latypov Signed-off-by: David Gow Reviewed-by: Daniel Latypov Reviewed-by: Brendan Higgins Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- lib/kunit/test.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/kunit/test.c b/lib/kunit/test.c index 3bd741e50a2d3..f96498ede2cc5 100644 --- a/lib/kunit/test.c +++ b/lib/kunit/test.c @@ -504,16 +504,18 @@ int kunit_run_tests(struct kunit_suite *suite) struct kunit_result_stats param_stats =3D { 0 }; test_case->status =3D KUNIT_SKIPPED; =20 - if (test_case->generate_params) { + if (!test_case->generate_params) { + /* Non-parameterised test. */ + kunit_run_case_catch_errors(suite, test_case, &test); + kunit_update_stats(¶m_stats, test.status); + } else { /* Get initial param. */ param_desc[0] =3D '\0'; test.param_value =3D test_case->generate_params(NULL, param_desc); - } =20 - do { - kunit_run_case_catch_errors(suite, test_case, &test); + while (test.param_value) { + kunit_run_case_catch_errors(suite, test_case, &test); =20 - if (test_case->generate_params) { if (param_desc[0] =3D=3D '\0') { snprintf(param_desc, sizeof(param_desc), "param-%d", test.param_index); @@ -530,11 +532,11 @@ int kunit_run_tests(struct kunit_suite *suite) param_desc[0] =3D '\0'; test.param_value =3D test_case->generate_params(test.param_value, para= m_desc); test.param_index++; - } =20 - kunit_update_stats(¶m_stats, test.status); + kunit_update_stats(¶m_stats, test.status); + } + } =20 - } while (test.param_value); =20 kunit_print_test_stats(&test, param_stats); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42791C433EF for ; Mon, 24 Jan 2022 22:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581324AbiAXWLd (ORCPT ); Mon, 24 Jan 2022 17:11:33 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40482 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452459AbiAXVZi (ORCPT ); Mon, 24 Jan 2022 16:25:38 -0500 Received: from smtp.kernel.org (relay.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 CA0C4B80FA1; Mon, 24 Jan 2022 21:25:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05E27C340E4; Mon, 24 Jan 2022 21:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059536; bh=61ceIHMJ+OldHwRLEtoYGl3BHB03bL4y4xAgQX2DcGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GLt7FMPRLJxVIECqaURW+ixqSPkloWoGB5Fmgdq6V0JowATSo4PA8p1B4As/DPF9j eAiaSxDxS6yRd3YzUdNNBx8nPpzdwXiQ4IeY2SNm8dFF5EXyxUHRFtq4fDDcR2+GYF tbdKs8nu4LETlRP37aV6BhCn5eBQvKNHxTMN2SiY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , Daniel Borkmann , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Sasha Levin Subject: [PATCH 5.16 0647/1039] bpf: Do not WARN in bpf_warn_invalid_xdp_action() Date: Mon, 24 Jan 2022 19:40:36 +0100 Message-Id: <20220124184147.096194625@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Paolo Abeni [ Upstream commit 2cbad989033bff0256675c38f96f5faab852af4b ] The WARN_ONCE() in bpf_warn_invalid_xdp_action() can be triggered by any bugged program, and even attaching a correct program to a NIC not supporting the given action. The resulting splat, beyond polluting the logs, fouls automated tools: e.g. a syzkaller reproducers using an XDP program returning an unsupported action will never pass validation. Replace the WARN_ONCE with a less intrusive pr_warn_once(). Signed-off-by: Paolo Abeni Signed-off-by: Daniel Borkmann Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen Link: https://lore.kernel.org/bpf/016ceec56e4817ebb2a9e35ce794d5c917df572c.= 1638189075.git.pabeni@redhat.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/core/filter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index 31147a4cfab30..5b82a817f65a6 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -8187,9 +8187,9 @@ void bpf_warn_invalid_xdp_action(u32 act) { const u32 act_max =3D XDP_REDIRECT; =20 - WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n", - act > act_max ? "Illegal" : "Driver unsupported", - act); + pr_warn_once("%s XDP return value %u, expect packet loss!\n", + act > act_max ? "Illegal" : "Driver unsupported", + act); } EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A91FC3526D for ; Mon, 24 Jan 2022 22:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581347AbiAXWLf (ORCPT ); Mon, 24 Jan 2022 17:11:35 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46448 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452467AbiAXVZk (ORCPT ); Mon, 24 Jan 2022 16:25:40 -0500 Received: from smtp.kernel.org (relay.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 29DA6614B4; Mon, 24 Jan 2022 21:25:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7115C340E4; Mon, 24 Jan 2022 21:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059539; bh=Z9z2k7+ea3Dsq7vTSGa3vYhfE6fXQi4kHtwHMBIPnx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VXamC/nZmF05uPxeTdFdWAT4J5vAeAK6Bp4fixSIsjISIzKPGerc7P/BHWbs3uEtn Hg9+Wp61Ttyy91dVdlpnDtFF+dwq6vMGjDMEfYWZJ3W98c356CIkLe+xQLQ9txDKbJ LN/ctKYQSCGBBa1owhCJAKae8Uy2+RkNzuhASr1w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Kuehling , Zhou Qingyang , Philip Yang , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0648/1039] drm/amdkfd: Fix error handling in svm_range_add Date: Mon, 24 Jan 2022 19:40:37 +0100 Message-Id: <20220124184147.136072350@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Felix Kuehling [ Upstream commit 726be40607264b180a2b336c81e1dcff941de618 ] Add null-pointer check after the last svm_range_new call. This was originally reported by Zhou Qingyang based on a static analyzer. To avoid duplicating the unwinding code from svm_range_handle_overlap, I merged the two functions into one. Signed-off-by: Felix Kuehling Cc: Zhou Qingyang Reviewed-by: Philip Yang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 138 ++++++++++----------------- 1 file changed, 49 insertions(+), 89 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amd= kfd/kfd_svm.c index 3cb4681c5f539..c0b8f4ff80b8a 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -943,7 +943,7 @@ svm_range_split(struct svm_range *prange, uint64_t star= t, uint64_t last, } =20 static int -svm_range_split_tail(struct svm_range *prange, struct svm_range *new, +svm_range_split_tail(struct svm_range *prange, uint64_t new_last, struct list_head *insert_list) { struct svm_range *tail; @@ -955,7 +955,7 @@ svm_range_split_tail(struct svm_range *prange, struct s= vm_range *new, } =20 static int -svm_range_split_head(struct svm_range *prange, struct svm_range *new, +svm_range_split_head(struct svm_range *prange, uint64_t new_start, struct list_head *insert_list) { struct svm_range *head; @@ -1764,49 +1764,54 @@ static struct svm_range *svm_range_clone(struct svm= _range *old) } =20 /** - * svm_range_handle_overlap - split overlap ranges - * @svms: svm range list header - * @new: range added with this attributes - * @start: range added start address, in pages - * @last: range last address, in pages - * @update_list: output, the ranges attributes are updated. For set_attr, = this - * will do validation and map to GPUs. For unmap, this will = be - * removed and unmap from GPUs - * @insert_list: output, the ranges will be inserted into svms, attributes= are - * not changes. For set_attr, this will add into svms. - * @remove_list:output, the ranges will be removed from svms - * @left: the remaining range after overlap, For set_attr, this will be ad= ded - * as new range. + * svm_range_add - add svm range and handle overlap + * @p: the range add to this process svms + * @start: page size aligned + * @size: page size aligned + * @nattr: number of attributes + * @attrs: array of attributes + * @update_list: output, the ranges need validate and update GPU mapping + * @insert_list: output, the ranges need insert to svms + * @remove_list: output, the ranges are replaced and need remove from svms * - * Total have 5 overlap cases. + * Check if the virtual address range has overlap with any existing ranges, + * split partly overlapping ranges and add new ranges in the gaps. All cha= nges + * should be applied to the range_list and interval tree transactionally. = If + * any range split or allocation fails, the entire update fails. Therefore= any + * existing overlapping svm_ranges are cloned and the original svm_ranges = left + * unchanged. * - * This function handles overlap of an address interval with existing - * struct svm_ranges for applying new attributes. This may require - * splitting existing struct svm_ranges. All changes should be applied to - * the range_list and interval tree transactionally. If any split operation - * fails, the entire update fails. Therefore the existing overlapping - * svm_ranges are cloned and the original svm_ranges left unchanged. If the - * transaction succeeds, the modified clones are added and the originals - * freed. Otherwise the clones are removed and the old svm_ranges remain. + * If the transaction succeeds, the caller can update and insert clones and + * new ranges, then free the originals. * - * Context: The caller must hold svms->lock + * Otherwise the caller can free the clones and new ranges, while the old + * svm_ranges remain unchanged. + * + * Context: Process context, caller must hold svms->lock + * + * Return: + * 0 - OK, otherwise error code */ static int -svm_range_handle_overlap(struct svm_range_list *svms, struct svm_range *ne= w, - unsigned long start, unsigned long last, - struct list_head *update_list, - struct list_head *insert_list, - struct list_head *remove_list, - unsigned long *left) +svm_range_add(struct kfd_process *p, uint64_t start, uint64_t size, + uint32_t nattr, struct kfd_ioctl_svm_attribute *attrs, + struct list_head *update_list, struct list_head *insert_list, + struct list_head *remove_list) { + unsigned long last =3D start + size - 1UL; + struct svm_range_list *svms =3D &p->svms; struct interval_tree_node *node; + struct svm_range new =3D {0}; struct svm_range *prange; struct svm_range *tmp; int r =3D 0; =20 + pr_debug("svms 0x%p [0x%llx 0x%lx]\n", &p->svms, start, last); + INIT_LIST_HEAD(update_list); INIT_LIST_HEAD(insert_list); INIT_LIST_HEAD(remove_list); + svm_range_apply_attrs(p, &new, nattr, attrs); =20 node =3D interval_tree_iter_first(&svms->objects, start, last); while (node) { @@ -1834,14 +1839,14 @@ svm_range_handle_overlap(struct svm_range_list *svm= s, struct svm_range *new, =20 if (node->start < start) { pr_debug("change old range start\n"); - r =3D svm_range_split_head(prange, new, start, + r =3D svm_range_split_head(prange, start, insert_list); if (r) goto out; } if (node->last > last) { pr_debug("change old range last\n"); - r =3D svm_range_split_tail(prange, new, last, + r =3D svm_range_split_tail(prange, last, insert_list); if (r) goto out; @@ -1853,7 +1858,7 @@ svm_range_handle_overlap(struct svm_range_list *svms,= struct svm_range *new, prange =3D old; } =20 - if (!svm_range_is_same_attrs(prange, new)) + if (!svm_range_is_same_attrs(prange, &new)) list_add(&prange->update_list, update_list); =20 /* insert a new node if needed */ @@ -1873,8 +1878,16 @@ svm_range_handle_overlap(struct svm_range_list *svms= , struct svm_range *new, start =3D next_start; } =20 - if (left && start <=3D last) - *left =3D last - start + 1; + /* add a final range at the end if needed */ + if (start <=3D last) { + prange =3D svm_range_new(svms, start, last); + if (!prange) { + r =3D -ENOMEM; + goto out; + } + list_add(&prange->insert_list, insert_list); + list_add(&prange->update_list, update_list); + } =20 out: if (r) @@ -2894,59 +2907,6 @@ svm_range_is_valid(struct kfd_process *p, uint64_t s= tart, uint64_t size) NULL); } =20 -/** - * svm_range_add - add svm range and handle overlap - * @p: the range add to this process svms - * @start: page size aligned - * @size: page size aligned - * @nattr: number of attributes - * @attrs: array of attributes - * @update_list: output, the ranges need validate and update GPU mapping - * @insert_list: output, the ranges need insert to svms - * @remove_list: output, the ranges are replaced and need remove from svms - * - * Check if the virtual address range has overlap with the registered rang= es, - * split the overlapped range, copy and adjust pages address and vram node= s in - * old and new ranges. - * - * Context: Process context, caller must hold svms->lock - * - * Return: - * 0 - OK, otherwise error code - */ -static int -svm_range_add(struct kfd_process *p, uint64_t start, uint64_t size, - uint32_t nattr, struct kfd_ioctl_svm_attribute *attrs, - struct list_head *update_list, struct list_head *insert_list, - struct list_head *remove_list) -{ - uint64_t last =3D start + size - 1UL; - struct svm_range_list *svms; - struct svm_range new =3D {0}; - struct svm_range *prange; - unsigned long left =3D 0; - int r =3D 0; - - pr_debug("svms 0x%p [0x%llx 0x%llx]\n", &p->svms, start, last); - - svm_range_apply_attrs(p, &new, nattr, attrs); - - svms =3D &p->svms; - - r =3D svm_range_handle_overlap(svms, &new, start, last, update_list, - insert_list, remove_list, &left); - if (r) - return r; - - if (left) { - prange =3D svm_range_new(svms, last - left + 1, last); - list_add(&prange->insert_list, insert_list); - list_add(&prange->update_list, update_list); - } - - return 0; -} - /** * svm_range_best_prefetch_location - decide the best prefetch location * @prange: svm range structure --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17902C46467 for ; Tue, 25 Jan 2022 00:09:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371111AbiAYAHA (ORCPT ); Mon, 24 Jan 2022 19:07:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847016AbiAXXSP (ORCPT ); Mon, 24 Jan 2022 18:18:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07035C0604EB; Mon, 24 Jan 2022 13:25:45 -0800 (PST) Received: from smtp.kernel.org (relay.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 C2B10B81218; Mon, 24 Jan 2022 21:25:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F12A0C340E4; Mon, 24 Jan 2022 21:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059542; bh=yqSwJVXMzPmSYPIZURiBbJ026IA9VE5I3L1uFRkpvjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NMJjnUd1tyn+EP3QLsF7pVs97o2cexlQt3C85OLh4KNb2ObbRpIw6L7RMbK+oqbGC 4AeGa72zy4eNlXJSGcNFepc3ssBLpMmX4hpQNL4XvMImDbNcrTDcjQ0AIlmnctjTLp TvBk7uVNZI6YXYRVPyXbA8yi/Ev1IgVtgIAK1drw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Isabella Basso , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0649/1039] drm/amdgpu: fix amdgpu_ras_mca_query_error_status scope Date: Mon, 24 Jan 2022 19:40:38 +0100 Message-Id: <20220124184147.173655735@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Isabella Basso [ Upstream commit 929bb8e200412da36aca4b61209ec26283f9c184 ] This commit fixes the compile-time warning below: warning: no previous prototype for =E2=80=98amdgpu_ras_mca_query_error_sta= tus=E2=80=99 [-Wmissing-prototypes] Changes since v1: - As suggested by Alexander Deucher: 1. Make function static instead of adding prototype. Signed-off-by: Isabella Basso Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_ras.c index 08133de21fdd6..26b7a4a0b44b7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -867,9 +867,9 @@ static int amdgpu_ras_enable_all_features(struct amdgpu= _device *adev, /* feature ctl end */ =20 =20 -void amdgpu_ras_mca_query_error_status(struct amdgpu_device *adev, - struct ras_common_if *ras_block, - struct ras_err_data *err_data) +static void amdgpu_ras_mca_query_error_status(struct amdgpu_device *adev, + struct ras_common_if *ras_block, + struct ras_err_data *err_data) { switch (ras_block->sub_block_index) { case AMDGPU_RAS_MCA_BLOCK__MP0: --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F6F9C43219 for ; Tue, 25 Jan 2022 00:09:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371202AbiAYAHM (ORCPT ); Mon, 24 Jan 2022 19:07:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847008AbiAXXSP (ORCPT ); Mon, 24 Jan 2022 18:18:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22224C0604EC; Mon, 24 Jan 2022 13:25:47 -0800 (PST) Received: from smtp.kernel.org (relay.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 BDFF7B81188; Mon, 24 Jan 2022 21:25:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3D95C340E4; Mon, 24 Jan 2022 21:25:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059545; bh=HoRFq8w8CiMPBLb0x+C92QMyIan+0WTQQNaMjjijmKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=egiejmGqv6lDbrE0N1VTrRoQ1eiGTcQAb91Oxj4bUm0dUGZEXBPzz1wru+zZo5a76 koywyaFu6iTxTUOd7X/7Vcd8BOcckoAfcASWzEbSWmxexmBcnoniBwKWin3dPNL6Ts Azv+zUfwVCPL4zZ1Pw9anBKcxBlEls/HdDLxx0H0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alistair Francis , Benjamin Tissoires , Sasha Levin Subject: [PATCH 5.16 0650/1039] HID: quirks: Allow inverting the absolute X/Y values Date: Mon, 24 Jan 2022 19:40:39 +0100 Message-Id: <20220124184147.211834175@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alistair Francis [ Upstream commit fd8d135b2c5e88662f2729e034913f183455a667 ] Add a HID_QUIRK_X_INVERT/HID_QUIRK_Y_INVERT quirk that can be used to invert the X/Y values. Signed-off-by: Alistair Francis [bentiss: silence checkpatch warning] Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/20211208124045.61815-2-alistair@alistair23.= me Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/hid-input.c | 6 ++++++ include/linux/hid.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index ca47682cc7307..87fee137ff65e 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -1335,6 +1335,12 @@ void hidinput_hid_event(struct hid_device *hid, stru= ct hid_field *field, struct =20 input =3D field->hidinput->input; =20 + if (usage->type =3D=3D EV_ABS && + (((*quirks & HID_QUIRK_X_INVERT) && usage->code =3D=3D ABS_X) || + ((*quirks & HID_QUIRK_Y_INVERT) && usage->code =3D=3D ABS_Y))) { + value =3D field->logical_maximum - value; + } + if (usage->hat_min < usage->hat_max || usage->hat_dir) { int hat_dir =3D usage->hat_dir; if (!hat_dir) diff --git a/include/linux/hid.h b/include/linux/hid.h index f453be385bd47..26742ca14609a 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -349,6 +349,8 @@ struct hid_item { /* BIT(9) reserved for backward compatibility, was NO_INIT_INPUT_REPORTS */ #define HID_QUIRK_ALWAYS_POLL BIT(10) #define HID_QUIRK_INPUT_PER_APP BIT(11) +#define HID_QUIRK_X_INVERT BIT(12) +#define HID_QUIRK_Y_INVERT BIT(13) #define HID_QUIRK_SKIP_OUTPUT_REPORTS BIT(16) #define HID_QUIRK_SKIP_OUTPUT_REPORT_ID BIT(17) #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92955C433F5 for ; Tue, 25 Jan 2022 00:09:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371141AbiAYAHE (ORCPT ); Mon, 24 Jan 2022 19:07:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847014AbiAXXSP (ORCPT ); Mon, 24 Jan 2022 18:18:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3275CC0604ED; Mon, 24 Jan 2022 13:25:51 -0800 (PST) Received: from smtp.kernel.org (relay.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 EE208B811A2; Mon, 24 Jan 2022 21:25:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20BABC340E4; Mon, 24 Jan 2022 21:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059548; bh=liI5oHo+hy1bS9c8mmeSTwJK7B/DrVx+fsHTX63n/SY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V/29Dm+zjJnXvr39d1LqRgO6Gj+LcDJonLLvGcQ/QVt+rwcJ+eYCce2HT2DZwlqM1 TuK2k9Wl4tAnivo+GaH/Bab2qlyUgEN1MyAEhuD5SSnNKfKkgt5lVql29SKrYPnSWw 0AKpA7qc+yyTXtRSN+bQYP0btWwyUDsv6T83KjLM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alistair Francis , Rob Herring , Benjamin Tissoires , Sasha Levin Subject: [PATCH 5.16 0651/1039] HID: i2c-hid-of: Expose the touchscreen-inverted properties Date: Mon, 24 Jan 2022 19:40:40 +0100 Message-Id: <20220124184147.243418951@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alistair Francis [ Upstream commit b60d3c803d7603432a08aeaf988aff53b3a5ec64 ] Allow the touchscreen-inverted-x/y device tree properties to control the HID_QUIRK_X_INVERT/HID_QUIRK_Y_INVERT quirks for the hid-input device. Signed-off-by: Alistair Francis Acked-by: Rob Herring [bentiss: silence checkpatch warnings] Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/20211208124045.61815-3-alistair@alistair23.= me Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../devicetree/bindings/input/hid-over-i2c.txt | 2 ++ drivers/hid/i2c-hid/i2c-hid-acpi.c | 2 +- drivers/hid/i2c-hid/i2c-hid-core.c | 4 +++- drivers/hid/i2c-hid/i2c-hid-of-goodix.c | 2 +- drivers/hid/i2c-hid/i2c-hid-of.c | 10 +++++++++- drivers/hid/i2c-hid/i2c-hid.h | 2 +- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/input/hid-over-i2c.txt b/Doc= umentation/devicetree/bindings/input/hid-over-i2c.txt index c76bafaf98d2f..34c43d3bddfd1 100644 --- a/Documentation/devicetree/bindings/input/hid-over-i2c.txt +++ b/Documentation/devicetree/bindings/input/hid-over-i2c.txt @@ -32,6 +32,8 @@ device-specific compatible properties, which should be us= ed in addition to the - vdd-supply: phandle of the regulator that provides the supply voltage. - post-power-on-delay-ms: time required by the device after enabling its r= egulators or powering it on, before it is ready for communication. +- touchscreen-inverted-x: See touchscreen.txt +- touchscreen-inverted-y: See touchscreen.txt =20 Example: =20 diff --git a/drivers/hid/i2c-hid/i2c-hid-acpi.c b/drivers/hid/i2c-hid/i2c-h= id-acpi.c index a6f0257a26de3..b96ae15e0ad91 100644 --- a/drivers/hid/i2c-hid/i2c-hid-acpi.c +++ b/drivers/hid/i2c-hid/i2c-hid-acpi.c @@ -111,7 +111,7 @@ static int i2c_hid_acpi_probe(struct i2c_client *client) } =20 return i2c_hid_core_probe(client, &ihid_acpi->ops, - hid_descriptor_address); + hid_descriptor_address, 0); } =20 static const struct acpi_device_id i2c_hid_acpi_match[] =3D { diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-h= id-core.c index 517141138b007..4804d71e5293a 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -912,7 +912,7 @@ static void i2c_hid_core_shutdown_tail(struct i2c_hid *= ihid) } =20 int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, - u16 hid_descriptor_address) + u16 hid_descriptor_address, u32 quirks) { int ret; struct i2c_hid *ihid; @@ -1009,6 +1009,8 @@ int i2c_hid_core_probe(struct i2c_client *client, str= uct i2chid_ops *ops, goto err_mem_free; } =20 + hid->quirks |=3D quirks; + return 0; =20 err_mem_free: diff --git a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c b/drivers/hid/i2c-hid/= i2c-hid-of-goodix.c index 52674149a2750..b4dad66fa954d 100644 --- a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c +++ b/drivers/hid/i2c-hid/i2c-hid-of-goodix.c @@ -150,7 +150,7 @@ static int i2c_hid_of_goodix_probe(struct i2c_client *c= lient, goodix_i2c_hid_deassert_reset(ihid_goodix, true); mutex_unlock(&ihid_goodix->regulator_mutex); =20 - return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001); + return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001, 0); } =20 static const struct goodix_i2c_hid_timing_data goodix_gt7375p_timing_data = =3D { diff --git a/drivers/hid/i2c-hid/i2c-hid-of.c b/drivers/hid/i2c-hid/i2c-hid= -of.c index 4bf7cea926379..97a27a803f58d 100644 --- a/drivers/hid/i2c-hid/i2c-hid-of.c +++ b/drivers/hid/i2c-hid/i2c-hid-of.c @@ -21,6 +21,7 @@ =20 #include #include +#include #include #include #include @@ -71,6 +72,7 @@ static int i2c_hid_of_probe(struct i2c_client *client, struct device *dev =3D &client->dev; struct i2c_hid_of *ihid_of; u16 hid_descriptor_address; + u32 quirks =3D 0; int ret; u32 val; =20 @@ -105,8 +107,14 @@ static int i2c_hid_of_probe(struct i2c_client *client, if (ret) return ret; =20 + if (device_property_read_bool(dev, "touchscreen-inverted-x")) + quirks |=3D HID_QUIRK_X_INVERT; + + if (device_property_read_bool(dev, "touchscreen-inverted-y")) + quirks |=3D HID_QUIRK_Y_INVERT; + return i2c_hid_core_probe(client, &ihid_of->ops, - hid_descriptor_address); + hid_descriptor_address, quirks); } =20 static const struct of_device_id i2c_hid_of_match[] =3D { diff --git a/drivers/hid/i2c-hid/i2c-hid.h b/drivers/hid/i2c-hid/i2c-hid.h index 05a7827d211af..236cc062d5ef8 100644 --- a/drivers/hid/i2c-hid/i2c-hid.h +++ b/drivers/hid/i2c-hid/i2c-hid.h @@ -32,7 +32,7 @@ struct i2chid_ops { }; =20 int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, - u16 hid_descriptor_address); + u16 hid_descriptor_address, u32 quirks); int i2c_hid_core_remove(struct i2c_client *client); =20 void i2c_hid_core_shutdown(struct i2c_client *client); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2C92C433F5 for ; Tue, 25 Jan 2022 00:09:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2370592AbiAYAFp (ORCPT ); Mon, 24 Jan 2022 19:05:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847608AbiAXXUH (ORCPT ); Mon, 24 Jan 2022 18:20:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7888AC073204; Mon, 24 Jan 2022 13:27:55 -0800 (PST) Received: from smtp.kernel.org (relay.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 1595D614B4; Mon, 24 Jan 2022 21:27:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE1EEC340E4; Mon, 24 Jan 2022 21:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059674; bh=WPTVkbAlftiPDcELrGcS+39e8k3c46GZhJ5lqBJBBQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oLuMTb9b2XCUT4uVdp3cCyoYvlnYIoIZthJnIOrvHSaEgeJW+4J8YvrL2PqxhAXMz 5TWO8frEH8k6roTwl4nEnrS+OIfIEf0NTySwcxvpK11XMN5lVQlHPN4WQBaivk5+3O v/ytmFmjwQkyi9DrgXV/xIJEI0thf135Ln0FX6EM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0652/1039] media: igorplugusb: receiver overflow should be reported Date: Mon, 24 Jan 2022 19:40:41 +0100 Message-Id: <20220124184147.276927311@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Young [ Upstream commit 8fede658e7ddb605bbd68ed38067ddb0af033db4 ] Without this, some IR will be missing mid-stream and we might decode something which never really occurred. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/rc/igorplugusb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c index effaa5751d6c9..3e9988ee785f0 100644 --- a/drivers/media/rc/igorplugusb.c +++ b/drivers/media/rc/igorplugusb.c @@ -64,9 +64,11 @@ static void igorplugusb_irdata(struct igorplugusb *ir, u= nsigned len) if (start >=3D len) { dev_err(ir->dev, "receive overflow invalid: %u", overflow); } else { - if (overflow > 0) + if (overflow > 0) { dev_warn(ir->dev, "receive overflow, at least %u lost", overflow); + ir_raw_event_reset(ir->rc); + } =20 do { rawir.duration =3D ir->buf_in[i] * 85; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94B6DC433FE for ; Mon, 24 Jan 2022 22:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581426AbiAXWLq (ORCPT ); Mon, 24 Jan 2022 17:11:46 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40736 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452694AbiAXV0O (ORCPT ); Mon, 24 Jan 2022 16:26:14 -0500 Received: from smtp.kernel.org (relay.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 B538CB8123D; Mon, 24 Jan 2022 21:26:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D213CC340E4; Mon, 24 Jan 2022 21:26:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059572; bh=s1+wA1K07F5Sne0E08ebjE9IXHWGC4ncgOKASX8xlfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KR9e1FktBstZNU5hntWtg5b3UdE9B8vQYoDWfhR0ScnNNOcxTJjUVnK2mPY6FAtlb PVG4xVyMpKmK34IM/ZslucWs3SLfukAvzOnh3XsIcZ2VDNtOBWdcD9Lgv5O5Pm1Ryt ljLj2/naK9/2VPmkurBElPB3XGyOO0j/9TDohLqQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikhail Rudenko , Ezequiel Garcia , Kieran Bingham , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0653/1039] media: rockchip: rkisp1: use device name for debugfs subdir name Date: Mon, 24 Jan 2022 19:40:42 +0100 Message-Id: <20220124184147.316019682@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikhail Rudenko [ Upstream commit c2611e479f5d9b05108270e1ab423955486b4457 ] While testing Rockchip RK3399 with both ISPs enabled, a dmesg error was observed: ``` [ 15.559141] debugfs: Directory 'rkisp1' with parent '/' already present! ``` Fix it by using the device name for the debugfs subdirectory name instead of the driver name, thus preventing name collision. Link: https://lore.kernel.org/linux-media/20211010175457.438627-1-mike.rude= nko@gmail.com Signed-off-by: Mikhail Rudenko Reviewed-by: Ezequiel Garcia Reviewed-by: Kieran Bingham Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/= media/platform/rockchip/rkisp1/rkisp1-dev.c index 50b166c49a03a..3f5cfa7eb9372 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c @@ -462,7 +462,7 @@ static void rkisp1_debug_init(struct rkisp1_device *rki= sp1) { struct rkisp1_debug *debug =3D &rkisp1->debug; =20 - debug->debugfs_dir =3D debugfs_create_dir(RKISP1_DRIVER_NAME, NULL); + debug->debugfs_dir =3D debugfs_create_dir(dev_name(rkisp1->dev), NULL); debugfs_create_ulong("data_loss", 0444, debug->debugfs_dir, &debug->data_loss); debugfs_create_ulong("outform_size_err", 0444, debug->debugfs_dir, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94BE4C4167D for ; Tue, 25 Jan 2022 00:09:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371075AbiAYAGz (ORCPT ); Mon, 24 Jan 2022 19:06:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847036AbiAXXSV (ORCPT ); Mon, 24 Jan 2022 18:18:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71479C06F8D8; Mon, 24 Jan 2022 13:26:45 -0800 (PST) Received: from smtp.kernel.org (relay.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 0F89161028; Mon, 24 Jan 2022 21:26:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E102FC340E4; Mon, 24 Jan 2022 21:26:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059604; bh=zzwXETvO8DRgU0B6/KjTgVdtgOFdMCxyOYkTNdKrc3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UVpETQ7TOlpTy252P0a3olzbOPfHP5z9r1eAhd2U9qf3TxGTUQVpG6DNjzpBBifW9 vh+8NI+2+wk2eovqUHOcUCRseHSeQg0hH4lU/U+LXEpcX8O7WCoPeDe7CEuEFyAdhb GWo5ChxIWnYQwtCTJ2i9Y8s8CLDxHdRLOlwXEcmQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0654/1039] media: saa7146: hexium_gemini: Fix a NULL pointer dereference in hexium_attach() Date: Mon, 24 Jan 2022 19:40:43 +0100 Message-Id: <20220124184147.347255773@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit 3af86b046933ba513d08399dba0d4d8b50d607d0 ] In hexium_attach(dev, info), saa7146_vv_init() is called to allocate a new memory for dev->vv_data. saa7146_vv_release() will be called on failure of saa7146_register_device(). There is a dereference of dev->vv_data in saa7146_vv_release(), which could lead to a NULL pointer dereference on failure of saa7146_vv_init(). Fix this bug by adding a check of saa7146_vv_init(). This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_VIDEO_HEXIUM_GEMINI=3Dm show no new warnings, and our static analyzer no longer warns about this code. Link: https://lore.kernel.org/linux-media/20211203154030.111210-1-zhou1615@= umn.edu Signed-off-by: Zhou Qingyang Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/common/saa7146/saa7146_fops.c | 2 +- drivers/media/pci/saa7146/hexium_gemini.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/co= mmon/saa7146/saa7146_fops.c index baf5772c52a96..be32159777142 100644 --- a/drivers/media/common/saa7146/saa7146_fops.c +++ b/drivers/media/common/saa7146/saa7146_fops.c @@ -521,7 +521,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa= 7146_ext_vv *ext_vv) ERR("out of memory. aborting.\n"); kfree(vv); v4l2_ctrl_handler_free(hdl); - return -1; + return -ENOMEM; } =20 saa7146_video_uops.init(dev,vv); diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/= saa7146/hexium_gemini.c index 2214c74bbbf15..3947701cd6c7e 100644 --- a/drivers/media/pci/saa7146/hexium_gemini.c +++ b/drivers/media/pci/saa7146/hexium_gemini.c @@ -284,7 +284,12 @@ static int hexium_attach(struct saa7146_dev *dev, stru= ct saa7146_pci_extension_d hexium_set_input(hexium, 0); hexium->cur_input =3D 0; =20 - saa7146_vv_init(dev, &vv_data); + ret =3D saa7146_vv_init(dev, &vv_data); + if (ret) { + i2c_del_adapter(&hexium->i2c_adapter); + kfree(hexium); + return ret; + } =20 vv_data.vid_ops.vidioc_enum_input =3D vidioc_enum_input; vv_data.vid_ops.vidioc_g_input =3D vidioc_g_input; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0ECAC433FE for ; Mon, 24 Jan 2022 22:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582315AbiAXWPG (ORCPT ); Mon, 24 Jan 2022 17:15:06 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42470 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452896AbiAXV1X (ORCPT ); Mon, 24 Jan 2022 16:27:23 -0500 Received: from smtp.kernel.org (relay.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 F21D2B812A7; Mon, 24 Jan 2022 21:27:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25F9AC340E4; Mon, 24 Jan 2022 21:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059636; bh=VugHGI8+6S85HjqW94JyGeLrIidA8ZW1E+7xFGmNbvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HwknhRKko4gRgnqWGES8sS/o3XUOfF0FeWg/QLttp1YG+Dnl3kOUJyB0xmjkP5hnj EMAAvrceKAeQ62XG4sh3aJjhPAtKvaKkp0y/6zQ2fynfsl4fNTj5bF+ZR4MrxUx3yd V/shXpUso9Ocw/1MzOTd9iOZ3ksblXJnUQTMyf3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , Biju Das , Ulf Hansson , Sasha Levin Subject: [PATCH 5.16 0655/1039] mmc: tmio: reinit card irqs in reset routine Date: Mon, 24 Jan 2022 19:40:44 +0100 Message-Id: <20220124184147.379482173@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Biju Das [ Upstream commit e315b1f3a170f368da5618f8a598e68880302ed1 ] Refactor the code so that card detect irqs are always reenabled after a reset. This avoids doing it manually all over the code or forgetting to do this in the future. Reported-by: Wolfram Sang Signed-off-by: Biju Das [wsa: added a comment when 'native_hotplug' has to be set] Signed-off-by: Wolfram Sang Link: https://lore.kernel.org/r/20211103122646.64422-1-wsa+renesas@sang-eng= ineering.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mmc/host/tmio_mmc_core.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_c= ore.c index e2affa52ef469..a5850d83908be 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -960,14 +960,8 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, str= uct mmc_ios *ios) case MMC_POWER_OFF: tmio_mmc_power_off(host); /* For R-Car Gen2+, we need to reset SDHI specific SCC */ - if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) { - host->reset(host); - - if (host->native_hotplug) - tmio_mmc_enable_mmc_irqs(host, - TMIO_STAT_CARD_REMOVE | - TMIO_STAT_CARD_INSERT); - } + if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) + tmio_mmc_reset(host); =20 host->set_clock(host, 0); break; @@ -1175,6 +1169,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) if (mmc_can_gpio_cd(mmc)) _host->ops.get_cd =3D mmc_gpio_get_cd; =20 + /* must be set before tmio_mmc_reset() */ _host->native_hotplug =3D !(mmc_can_gpio_cd(mmc) || mmc->caps & MMC_CAP_NEEDS_POLL || !mmc_card_is_removable(mmc)); @@ -1295,10 +1290,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev) if (host->clk_cache) host->set_clock(host, host->clk_cache); =20 - if (host->native_hotplug) - tmio_mmc_enable_mmc_irqs(host, - TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); - tmio_mmc_enable_dma(host, true); =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A9E0C433EF for ; Tue, 25 Jan 2022 00:05:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2368785AbiAYAAD (ORCPT ); Mon, 24 Jan 2022 19:00:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847520AbiAXXUA (ORCPT ); Mon, 24 Jan 2022 18:20:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0123DC06F8FA; Mon, 24 Jan 2022 13:27:38 -0800 (PST) Received: from smtp.kernel.org (relay.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 8E1FC6136E; Mon, 24 Jan 2022 21:27:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74362C340E4; Mon, 24 Jan 2022 21:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059657; bh=rYM9exfV6ZPmhtkluUdEqD0mCu5N6+8LDBYWPagDUt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LBK/NM46JX+w3eOofAdkUqVNGdQkhnEnAdEvhB6ktrrgc1fiGMS+nL7agJvXNAdFx greilT4ZRMA8s+dAPlOar3V4oPr7fDjYxuy7v11CptRIzzTr3i6+2I+TdmyrQx2v7+ K83G9ABDFoFTyBV3+2RKmPOwWTe5YTC2QktwZHM4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "H. Nikolaus Schaller" , Ulf Hansson , Sasha Levin Subject: [PATCH 5.16 0656/1039] mmc: core: Fixup storing of OCR for MMC_QUIRK_NONSTD_SDIO Date: Mon, 24 Jan 2022 19:40:45 +0100 Message-Id: <20220124184147.424248585@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ulf Hansson [ Upstream commit 8c3e5b74b9e2146f564905e50ca716591c76d4f1 ] The mmc core takes a specific path to support initializing of a non-standard SDIO card. This is triggered by looking for the card-quirk, MMC_QUIRK_NONSTD_SDIO. In mmc_sdio_init_card() this gets rather messy, as it causes the code to bail out earlier, compared to the usual path. This leads to that the OCR doesn't get saved properly in card->ocr. Fortunately, only omap_hsmmc has been using the MMC_QUIRK_NONSTD_SDIO and is dealing with the issue, by assigning a hardcoded value (0x80) to card->ocr from an ->init_card() ops. To make the behaviour consistent, let's instead rely on the core to save the OCR in card->ocr during initialization. Reported-by: H. Nikolaus Schaller Signed-off-by: Ulf Hansson Signed-off-by: H. Nikolaus Schaller Link: https://lore.kernel.org/r/e7936cff7fc24d187ef2680d3b4edb0ade58f293.16= 36564631.git.hns@goldelico.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mmc/core/sdio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 68edf7a615be5..5447c47157aa5 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -708,6 +708,8 @@ try_again: if (host->ops->init_card) host->ops->init_card(host, card); =20 + card->ocr =3D ocr_card; + /* * If the host and card support UHS-I mode request the card * to switch to 1.8V signaling level. No 1.8v signalling if @@ -820,7 +822,7 @@ try_again: goto mismatch; } } - card->ocr =3D ocr_card; + mmc_fixup_device(card, sdio_fixup_methods); =20 if (card->type =3D=3D MMC_TYPE_SD_COMBO) { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50942C433F5 for ; Tue, 25 Jan 2022 00:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2370655AbiAYAFu (ORCPT ); Mon, 24 Jan 2022 19:05:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847528AbiAXXUA (ORCPT ); Mon, 24 Jan 2022 18:20:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9047C06F8FB; Mon, 24 Jan 2022 13:27:40 -0800 (PST) Received: from smtp.kernel.org (relay.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 769A06136E; Mon, 24 Jan 2022 21:27:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 501CAC340E4; Mon, 24 Jan 2022 21:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059659; bh=wnlzurwnqQUQibaZHONoMred/MZWh5Vz2vdlyjP1zDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cRTetLi0fCNRZnNZUVPjgi2fHD5hyl/0jJAwL+Q+nGwdpHAeKASv2006WaA5skQYU F8X9PWrCkxp6a6Q9DbqQVEPTpQWLXB3zeNf8HYQ6Jh7GgCNq00xOC38cIuunH2R5bd ij5vO5nEND7Ke2UdOEwefqEMXMOuF7RYwKN+IUcM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "H. Nikolaus Schaller" , Ulf Hansson , Sasha Levin Subject: [PATCH 5.16 0657/1039] mmc: omap_hsmmc: Revert special init for wl1251 Date: Mon, 24 Jan 2022 19:40:46 +0100 Message-Id: <20220124184147.454092568@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: H. Nikolaus Schaller [ Upstream commit dfb654f1885f05baf506cdfdbc3f7efa1d847d54 ] Due to recent changes to the mmc core, card quirks can be applied based upon a compatible string in child OF node. The quirk needed for wl1251 (SDIO card) is managed in the core, therefore there is no longer any reason to deal with this in omap_hsmmc too, so let's remove it. Signed-off-by: H. Nikolaus Schaller Link: https://lore.kernel.org/r/77d313b97d1e18b0eb7ed2d88d718d960f329bb0.16= 36564631.git.hns@goldelico.com [Ulf: Re-wrote the commit message to make it more clear] Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mmc/host/omap_hsmmc.c | 36 ----------------------------------- 1 file changed, 36 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 9dafcbf969d96..fca30add563e9 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1499,41 +1499,6 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc,= struct mmc_ios *ios) omap_hsmmc_set_bus_mode(host); } =20 -static void omap_hsmmc_init_card(struct mmc_host *mmc, struct mmc_card *ca= rd) -{ - struct omap_hsmmc_host *host =3D mmc_priv(mmc); - - if (card->type =3D=3D MMC_TYPE_SDIO || card->type =3D=3D MMC_TYPE_SD_COMB= O) { - struct device_node *np =3D mmc_dev(mmc)->of_node; - - /* - * REVISIT: should be moved to sdio core and made more - * general e.g. by expanding the DT bindings of child nodes - * to provide a mechanism to provide this information: - * Documentation/devicetree/bindings/mmc/mmc-card.yaml - */ - - np =3D of_get_compatible_child(np, "ti,wl1251"); - if (np) { - /* - * We have TI wl1251 attached to MMC3. Pass this - * information to the SDIO core because it can't be - * probed by normal methods. - */ - - dev_info(host->dev, "found wl1251\n"); - card->quirks |=3D MMC_QUIRK_NONSTD_SDIO; - card->cccr.wide_bus =3D 1; - card->cis.vendor =3D 0x104c; - card->cis.device =3D 0x9066; - card->cis.blksize =3D 512; - card->cis.max_dtr =3D 24000000; - card->ocr =3D 0x80; - of_node_put(np); - } - } -} - static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable) { struct omap_hsmmc_host *host =3D mmc_priv(mmc); @@ -1660,7 +1625,6 @@ static struct mmc_host_ops omap_hsmmc_ops =3D { .set_ios =3D omap_hsmmc_set_ios, .get_cd =3D mmc_gpio_get_cd, .get_ro =3D mmc_gpio_get_ro, - .init_card =3D omap_hsmmc_init_card, .enable_sdio_irq =3D omap_hsmmc_enable_sdio_irq, }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 896EAC433FE for ; Tue, 25 Jan 2022 00:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2370838AbiAYAGS (ORCPT ); Mon, 24 Jan 2022 19:06:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847533AbiAXXT7 (ORCPT ); Mon, 24 Jan 2022 18:19:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAB45C06F8FD; Mon, 24 Jan 2022 13:27:43 -0800 (PST) Received: from smtp.kernel.org (relay.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 58A1661490; Mon, 24 Jan 2022 21:27:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32F10C340E4; Mon, 24 Jan 2022 21:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059662; bh=P6eFo3h9qX3r6YCHPSkuPE/RNoXMNV1Mnn7M6uecedU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N3lw26p6aQ1Hj4Z3y9cV57qYeVMJDllBK7VX0EoFPkiKtSKJZa1XN4XFha0CU6Y3Z C3AvWagQL10P9eidMGSNoS6odpK8QNHNc7kK6q0E+wrF+N4EfEIy+CXIOICROof+ST jivP42Ae9JZDq/K89YlD030tJFO07mzhyF1mSEXo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jingwen Chen , Horace Chen , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0658/1039] drm/amd/amdgpu: fix psp tmr bo pin count leak in SRIOV Date: Mon, 24 Jan 2022 19:40:47 +0100 Message-Id: <20220124184147.486025851@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jingwen Chen [ Upstream commit 85dfc1d692c9434c37842e610be37cd4ae4e0081 ] [Why] psp tmr bo will be pinned during loading amdgpu and reset in SRIOV while only unpinned in unload amdgpu [How] add amdgpu_in_reset and sriov judgement to skip pin bo v2: fix wrong judgement Signed-off-by: Jingwen Chen Reviewed-by: Horace Chen Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_psp.c index c641f84649d6b..d011ae7e50a54 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -2017,12 +2017,16 @@ static int psp_hw_start(struct psp_context *psp) return ret; } =20 + if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev)) + goto skip_pin_bo; + ret =3D psp_tmr_init(psp); if (ret) { DRM_ERROR("PSP tmr init failed!\n"); return ret; } =20 +skip_pin_bo: /* * For ASICs with DF Cstate management centralized * to PMFW, TMR setup should be performed after PMFW --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 160ADC4321E for ; Tue, 25 Jan 2022 00:09:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2370725AbiAYAGD (ORCPT ); Mon, 24 Jan 2022 19:06:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847527AbiAXXUA (ORCPT ); Mon, 24 Jan 2022 18:20:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40850C08E8AC; Mon, 24 Jan 2022 13:27:48 -0800 (PST) Received: from smtp.kernel.org (relay.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 F2C72B81257; Mon, 24 Jan 2022 21:27:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2492EC340E4; Mon, 24 Jan 2022 21:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059665; bh=I1V/IFg+vIvu92mF4fyATCy5Y+5SKhi/PFtWjx0XmD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PW9BXlYfoRcCqRYVO80Go9uCV5fX/SaW4b4DEGFGTihZZ6cZaoeg6+zMDiiCvNr4B O5M7N0isTqRZb8C3Kwv5y3CJGK99Z61VPoETuYXUTDnLqRCFAnSEf8R2Y21OW/ZmJo nqBM0g8klskmJfFcdulaLzs9LUlDWdxmSaX52UV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jingwen Chen , Horace Chen , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0659/1039] drm/amd/amdgpu: fix gmc bo pin count leak in SRIOV Date: Mon, 24 Jan 2022 19:40:48 +0100 Message-Id: <20220124184147.516227710@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jingwen Chen [ Upstream commit 948e7ce01413b71395723aaf846015062aea3a43 ] [Why] gmc bo will be pinned during loading amdgpu and reset in SRIOV while only unpinned in unload amdgpu [How] add amdgpu_in_reset and sriov judgement to skip pin bo v2: fix wrong judgement Signed-off-by: Jingwen Chen Reviewed-by: Horace Chen Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/a= mdgpu/gmc_v10_0.c index 3ec5ff5a6dbe6..61ec6145bbb16 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c @@ -992,10 +992,14 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device= *adev) return -EINVAL; } =20 + if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev)) + goto skip_pin_bo; + r =3D amdgpu_gart_table_vram_pin(adev); if (r) return r; =20 +skip_pin_bo: r =3D adev->gfxhub.funcs->gart_enable(adev); if (r) return r; diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/am= dgpu/gmc_v9_0.c index d84523cf5f759..4420c264c554c 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c @@ -1714,10 +1714,14 @@ static int gmc_v9_0_gart_enable(struct amdgpu_devic= e *adev) return -EINVAL; } =20 + if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev)) + goto skip_pin_bo; + r =3D amdgpu_gart_table_vram_pin(adev); if (r) return r; =20 +skip_pin_bo: r =3D adev->gfxhub.funcs->gart_enable(adev); if (r) return r; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91D42C4332F for ; Tue, 25 Jan 2022 00:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2370698AbiAYAF7 (ORCPT ); Mon, 24 Jan 2022 19:05:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847531AbiAXXUA (ORCPT ); Mon, 24 Jan 2022 18:20:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3C20C073200; Mon, 24 Jan 2022 13:27:49 -0800 (PST) Received: from smtp.kernel.org (relay.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 4467E614B4; Mon, 24 Jan 2022 21:27:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24592C340E4; Mon, 24 Jan 2022 21:27:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059668; bh=vNMezxssj6VcvR7r/jjQIM53BOA5+j+5fVwfrXZIJ98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d8gd01X5rBiDj5JKcrUWS+Sg37wFauSZdE1khSLIQOyIhkQEYGOHFNtcWPhbS97lR MlJ9q6vxgK8WDQcVWadtl4y4MfSd+EvOvD4rcXkF8lts89u2z/T6yqqweWxh+21Y/f wpQVec7VLJoLQxiNwNBArtvFiC5cpuR7UciQ06qw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gaosheng Cui , Richard Guy Briggs , Paul Moore , Sasha Levin Subject: [PATCH 5.16 0660/1039] audit: ensure userspace is penalized the same as the kernel when under pressure Date: Mon, 24 Jan 2022 19:40:49 +0100 Message-Id: <20220124184147.548711418@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Moore [ Upstream commit 8f110f530635af44fff1f4ee100ecef0bac62510 ] Due to the audit control mutex necessary for serializing audit userspace messages we haven't been able to block/penalize userspace processes that attempt to send audit records while the system is under audit pressure. The result is that privileged userspace applications have a priority boost with respect to audit as they are not bound by the same audit queue throttling as the other tasks on the system. This patch attempts to restore some balance to the system when under audit pressure by blocking these privileged userspace tasks after they have finished their audit processing, and dropped the audit control mutex, but before they return to userspace. Reported-by: Gaosheng Cui Tested-by: Gaosheng Cui Reviewed-by: Richard Guy Briggs Signed-off-by: Paul Moore Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/audit.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/kernel/audit.c b/kernel/audit.c index 4cebadb5f30db..eab7282668ab9 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1540,6 +1540,20 @@ static void audit_receive(struct sk_buff *skb) nlh =3D nlmsg_next(nlh, &len); } audit_ctl_unlock(); + + /* can't block with the ctrl lock, so penalize the sender now */ + if (audit_backlog_limit && + (skb_queue_len(&audit_queue) > audit_backlog_limit)) { + DECLARE_WAITQUEUE(wait, current); + + /* wake kauditd to try and flush the queue */ + wake_up_interruptible(&kauditd_wait); + + add_wait_queue_exclusive(&audit_backlog_wait, &wait); + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(audit_backlog_wait_time); + remove_wait_queue(&audit_backlog_wait, &wait); + } } =20 /* Log information about who is connecting to the audit multicast socket */ @@ -1824,7 +1838,9 @@ struct audit_buffer *audit_log_start(struct audit_con= text *ctx, gfp_t gfp_mask, * task_tgid_vnr() since auditd_pid is set in audit_receive_msg() * using a PID anchored in the caller's namespace * 2. generator holding the audit_cmd_mutex - we don't want to block - * while holding the mutex */ + * while holding the mutex, although we do penalize the sender + * later in audit_receive() when it is safe to block + */ if (!(auditd_test_task(current) || audit_ctl_owner_current())) { long stime =3D audit_backlog_wait_time; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C419C3526E for ; Tue, 25 Jan 2022 00:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2370798AbiAYAGN (ORCPT ); Mon, 24 Jan 2022 19:06:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847534AbiAXXT7 (ORCPT ); Mon, 24 Jan 2022 18:19:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8280CC073201; Mon, 24 Jan 2022 13:27:52 -0800 (PST) Received: from smtp.kernel.org (relay.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 1F52D61501; Mon, 24 Jan 2022 21:27:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04273C340E5; Mon, 24 Jan 2022 21:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059671; bh=rpmcbgRmo92CR8JccGNiGhKCTuJGoSWyJ8PiMq7HjvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vZeSLu9da6h/8ZMEfApDZtaNj5mf/b2RoaeVp4xOZZP2/pnBeM2r7NgpPFxawpghS tta/JZ/k0rguTQLFOGHBsbn2MBOVurR0Sersv2/r2EdtMjIit+sGYEyuUE+ei7f7uI usr/33CDbW8nRPmBNm9UHqPsfhZ0G0NlD7yhWWRk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biwen Li , Li Yang , Shawn Guo , Sasha Levin Subject: [PATCH 5.16 0661/1039] arm64: dts: ls1028a-qds: move rtc node to the correct i2c bus Date: Mon, 24 Jan 2022 19:40:50 +0100 Message-Id: <20220124184147.587438573@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Biwen Li [ Upstream commit cbe9d948eadfe352ad45495a7cc5bf20a1b29d90 ] The i2c rtc is on i2c2 bus not i2c1 bus, so fix it in dts. Signed-off-by: Biwen Li Signed-off-by: Li Yang Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts b/arch/arm64= /boot/dts/freescale/fsl-ls1028a-qds.dts index 6e2a1da662fb4..4597848598df0 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts @@ -272,11 +272,6 @@ vcc-supply =3D <&sb_3v3>; }; =20 - rtc@51 { - compatible =3D "nxp,pcf2129"; - reg =3D <0x51>; - }; - eeprom@56 { compatible =3D "atmel,24c512"; reg =3D <0x56>; @@ -318,6 +313,15 @@ =20 }; =20 +&i2c1 { + status =3D "okay"; + + rtc@51 { + compatible =3D "nxp,pcf2129"; + reg =3D <0x51>; + }; +}; + &enetc_port1 { phy-handle =3D <&qds_phy1>; phy-mode =3D "rgmii-id"; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28F11C41535 for ; Tue, 25 Jan 2022 00:05:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2369152AbiAYABF (ORCPT ); Mon, 24 Jan 2022 19:01:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847044AbiAXXSV (ORCPT ); Mon, 24 Jan 2022 18:18:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C46AEC06F8D3; Mon, 24 Jan 2022 13:26:17 -0800 (PST) Received: from smtp.kernel.org (relay.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 8E569B811A2; Mon, 24 Jan 2022 21:26:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4E20C340E4; Mon, 24 Jan 2022 21:26:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059575; bh=rMy+mi7jNEvulzKMTi5MapzWsKYo3YQPwDzQibfbXu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BR9Aw7yarBCUzEi655mUzsgx9FopA8AXC2ht1MiCdvZ/t69fIdgsOQ6ejYnbzysTo h4+DRy3sc/mMhgXVhKlpnexMewwtqxcxDUYfKmytTERQ3IfnObUgnh81Ft4CzDIYz4 rB94yn6DJ+95sF7mWZ85Mz4+x6erM0dC/X7mLLZk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thierry Reding , Sasha Levin Subject: [PATCH 5.16 0662/1039] arm64: tegra: Adjust length of CCPLEX cluster MMIO region Date: Mon, 24 Jan 2022 19:40:51 +0100 Message-Id: <20220124184147.619517876@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thierry Reding [ Upstream commit 2b14cbd643feea5fc17c6e8bead4e71088c69acd ] The Tegra186 CCPLEX cluster register region is 4 MiB is length, not 4 MiB - 1. This was likely presumed to be the "limit" rather than length. Fix it up. Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/nvidia/tegra186.dtsi b/arch/arm64/boot/dts= /nvidia/tegra186.dtsi index 9ac4f0140700f..8ab83b4ac0373 100644 --- a/arch/arm64/boot/dts/nvidia/tegra186.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra186.dtsi @@ -1199,7 +1199,7 @@ =20 ccplex@e000000 { compatible =3D "nvidia,tegra186-ccplex-cluster"; - reg =3D <0x0 0x0e000000 0x0 0x3fffff>; + reg =3D <0x0 0x0e000000 0x0 0x400000>; =20 nvidia,bpmp =3D <&bpmp>; }; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7092C4167B for ; Tue, 25 Jan 2022 00:05:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2369126AbiAYABA (ORCPT ); Mon, 24 Jan 2022 19:01:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847032AbiAXXSV (ORCPT ); Mon, 24 Jan 2022 18:18:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7F51C06F8D4; Mon, 24 Jan 2022 13:26:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 6BBA2B8122A; Mon, 24 Jan 2022 21:26:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A444C340E4; Mon, 24 Jan 2022 21:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059578; bh=gN8e4n+344COSfz2qoEkyox0kd95ormBrbUV3mZwg6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LGVpllKp7HJa1tcMMgYopNBb78GztmssoSTZxeDBrsQpIGTTq2SV/AIOY6o8LDoXw rEyp8c3MtSEEbqcvY03ahbgDVIuMGefRvZ48/7ZEamIW/kFAq00QbTQ1OCYT4d3QP9 mcndbU2bBNQUkQCLl3vfPzkyIe3gHG3E6xcCUpC4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Gonda , Marc Orr , David Rientjes , Tom Lendacky , Brijesh Singh , Joerg Roedel , Herbert Xu , John Allen , "David S. Miller" , Paolo Bonzini , linux-crypto@vger.kernel.org, Sasha Levin Subject: [PATCH 5.16 0663/1039] crypto: ccp - Move SEV_INIT retry for corrupted data Date: Mon, 24 Jan 2022 19:40:52 +0100 Message-Id: <20220124184147.658020922@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Gonda [ Upstream commit e423b9d75e779d921e6adf5ac3d0b59400d6ba7e ] Move the data corrupted retry of SEV_INIT into the __sev_platform_init_locked() function. This is for upcoming INIT_EX support as well as helping direct callers of __sev_platform_init_locked() which currently do not support the retry. Signed-off-by: Peter Gonda Reviewed-by: Marc Orr Acked-by: David Rientjes Acked-by: Tom Lendacky Acked-by: Brijesh Singh Cc: Tom Lendacky Cc: Brijesh Singh Cc: Marc Orr Cc: Joerg Roedel Cc: Herbert Xu Cc: David Rientjes Cc: John Allen Cc: "David S. Miller" Cc: Paolo Bonzini Cc: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/ccp/sev-dev.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index e09925d86bf36..581a1b13d5c3d 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -241,7 +241,7 @@ static int __sev_platform_init_locked(int *error) struct psp_device *psp =3D psp_master; struct sev_data_init data; struct sev_device *sev; - int rc =3D 0; + int psp_ret, rc =3D 0; =20 if (!psp || !psp->sev_data) return -ENODEV; @@ -266,7 +266,21 @@ static int __sev_platform_init_locked(int *error) data.tmr_len =3D SEV_ES_TMR_SIZE; } =20 - rc =3D __sev_do_cmd_locked(SEV_CMD_INIT, &data, error); + rc =3D __sev_do_cmd_locked(SEV_CMD_INIT, &data, &psp_ret); + if (rc && psp_ret =3D=3D SEV_RET_SECURE_DATA_INVALID) { + /* + * Initialization command returned an integrity check failure + * status code, meaning that firmware load and validation of SEV + * related persistent data has failed. Retrying the + * initialization function should succeed by replacing the state + * with a reset state. + */ + dev_dbg(sev->dev, "SEV: retrying INIT command"); + rc =3D __sev_do_cmd_locked(SEV_CMD_INIT, &data, &psp_ret); + } + if (error) + *error =3D psp_ret; + if (rc) return rc; =20 @@ -1091,18 +1105,6 @@ void sev_pci_init(void) =20 /* Initialize the platform */ rc =3D sev_platform_init(&error); - if (rc && (error =3D=3D SEV_RET_SECURE_DATA_INVALID)) { - /* - * INIT command returned an integrity check failure - * status code, meaning that firmware load and - * validation of SEV related persistent data has - * failed and persistent state has been erased. - * Retrying INIT command here should succeed. - */ - dev_dbg(sev->dev, "SEV: retrying INIT command"); - rc =3D sev_platform_init(&error); - } - if (rc) { dev_err(sev->dev, "SEV: failed to INIT error %#x\n", error); return; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6DF1C4332F for ; Mon, 24 Jan 2022 22:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581461AbiAXWLy (ORCPT ); Mon, 24 Jan 2022 17:11:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44732 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452725AbiAXV0W (ORCPT ); Mon, 24 Jan 2022 16:26:22 -0500 Received: from smtp.kernel.org (relay.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 B57BE60C44; Mon, 24 Jan 2022 21:26:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96497C340E4; Mon, 24 Jan 2022 21:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059581; bh=Dw55RYZD/DX3A6O8uk0ifo8PqWSjLQRn9YgpgdbiIv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zDRj38sS7wJolM/k8uFq+jJ0K4CBIFQyiqV22TFQ1oPdzllA66Qiuy+1pSjakejCT NT4ppXrSraSO8lvbb22kP5n3jfjHoJV9KdexP9r1Ir+U5PCGbsOCclEeaiUDddw2pC xMIDHOa3rUFCCchmeoTRsm6Y9jryzNBVqgcHBZcY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Weili Qian , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0664/1039] crypto: hisilicon/hpre - fix memory leak in hpre_curve25519_src_init() Date: Mon, 24 Jan 2022 19:40:53 +0100 Message-Id: <20220124184147.696415350@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Weili Qian [ Upstream commit 51fa916b81e5f406a74f14a31a3a228c3cc060ad ] hpre_curve25519_src_init() allocates memory for 'ptr' before calling memcmp(). If memcmp() returns 0, the function will return '-EINVAL' without freeing memory. Signed-off-by: Weili Qian Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b/drivers/crypto/h= isilicon/hpre/hpre_crypto.c index a032c192ef1d6..7ba7641723a0b 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_crypto.c +++ b/drivers/crypto/hisilicon/hpre/hpre_crypto.c @@ -1865,7 +1865,7 @@ static int hpre_curve25519_src_init(struct hpre_asym_= request *hpre_req, */ if (memcmp(ptr, p, ctx->key_sz) =3D=3D 0) { dev_err(dev, "gx is p!\n"); - return -EINVAL; + goto err; } else if (memcmp(ptr, p, ctx->key_sz) > 0) { hpre_curve25519_src_modulo_p(ptr); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC24FC433F5 for ; Mon, 24 Jan 2022 22:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581478AbiAXWLz (ORCPT ); Mon, 24 Jan 2022 17:11:55 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41884 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452736AbiAXV00 (ORCPT ); Mon, 24 Jan 2022 16:26:26 -0500 Received: from smtp.kernel.org (relay.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 17785B8122A; Mon, 24 Jan 2022 21:26:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 684BCC340E4; Mon, 24 Jan 2022 21:26:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059583; bh=0co8E5XKLYjxH3n0wc4rra2FJH6eQg6IaRzMkRhkBdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E37f8ZBqxnOHiYBTaOZ2ATbdaFDeNTBx+V2luRMf9AyWbO437kESJ0mrgOpqejzzs A/+WfQJjRmSzQHXS8dOIJw4gG/vqFeCon0M6vn8Ex8JzNsWZP5ISWsVqsGbbz817sc IkRerfu14AwOpf0bJUkOcbtydT9kdb7Z3IFh0P5g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Shen , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0665/1039] crypto: hisilicon/qm - fix deadlock for remove driver Date: Mon, 24 Jan 2022 19:40:54 +0100 Message-Id: <20220124184147.732689466@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Shen [ Upstream commit fc6c01f0cd10b89c4b01dd2940e0b0cda1bd82fb ] When remove the driver and executing the task occur at the same time, the following deadlock will be triggered: Chain exists of: sva_lock --> uacce_mutex --> &qm->qps_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&qm->qps_lock); lock(uacce_mutex); lock(&qm->qps_lock); lock(sva_lock); And the lock 'qps_lock' is used to protect qp. Therefore, it's reasonable cycle is to continue until the qp memory is released. So move the release lock infront of 'uacce_remove'. Signed-off-by: Yang Shen Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/hisilicon/qm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 70b0405494db5..1dc6a27ba0e0d 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -3399,6 +3399,7 @@ void hisi_qm_uninit(struct hisi_qm *qm) dma_free_coherent(dev, qm->qdma.size, qm->qdma.va, qm->qdma.dma); } + up_write(&qm->qps_lock); =20 qm_irq_unregister(qm); hisi_qm_pci_uninit(qm); @@ -3406,8 +3407,6 @@ void hisi_qm_uninit(struct hisi_qm *qm) uacce_remove(qm->uacce); qm->uacce =3D NULL; } - - up_write(&qm->qps_lock); } EXPORT_SYMBOL_GPL(hisi_qm_uninit); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7F28C35271 for ; Tue, 25 Jan 2022 00:09:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371043AbiAYAGw (ORCPT ); Mon, 24 Jan 2022 19:06:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847038AbiAXXSV (ORCPT ); Mon, 24 Jan 2022 18:18:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D2EFC06F8D5; Mon, 24 Jan 2022 13:26:29 -0800 (PST) Received: from smtp.kernel.org (relay.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 24019B81218; Mon, 24 Jan 2022 21:26:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37CFCC340E4; Mon, 24 Jan 2022 21:26:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059586; bh=H2yZ85oZdClgDcogorKnikqYs9clriqltHq6+8eKhf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qafCUr1A1e2l5mC3dgIR/+mBLC1JLwHbcwJd9d0j7O7V6fCJQJ7rKbSNmP9nzW6nl mR86jzm0a65SGcc7RnCpxVMviPAqxbpxOOxs65JJUqJYO6eRfmBtmK46CWL0o2tBZu 00JDBd86kQZ+KcJunPgPcoQrnaDd/IOsdIK8yvrk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Zijlstra , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0666/1039] PM: runtime: Add safety net to supplier device release Date: Mon, 24 Jan 2022 19:40:55 +0100 Message-Id: <20220124184147.764492642@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki [ Upstream commit d1579e61192e0e686faa4208500ef4c3b529b16c ] Because refcount_dec_not_one() returns true if the target refcount becomes saturated, it is generally unsafe to use its return value as a loop termination condition, but that is what happens when a device link's supplier device is released during runtime PM suspend operations and on device link removal. To address this, introduce pm_runtime_release_supplier() to be used in the above cases which will check the supplier device's runtime PM usage counter in addition to the refcount_dec_not_one() return value, so the loop can be terminated in case the rpm_active refcount value becomes invalid, and update the code in question to use it as appropriate. This change is not expected to have any visible functional impact. Reported-by: Peter Zijlstra Signed-off-by: Rafael J. Wysocki Acked-by: Greg Kroah-Hartman Acked-by: Peter Zijlstra (Intel) Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/base/core.c | 3 +-- drivers/base/power/runtime.c | 41 ++++++++++++++++++++++++++---------- include/linux/pm_runtime.h | 3 +++ 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index fd034d7424472..b191bd17de891 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -485,8 +485,7 @@ static void device_link_release_fn(struct work_struct *= work) /* Ensure that all references to the link object have been dropped. */ device_link_synchronize_removal(); =20 - while (refcount_dec_not_one(&link->rpm_active)) - pm_runtime_put(link->supplier); + pm_runtime_release_supplier(link, true); =20 put_device(link->consumer); put_device(link->supplier); diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index d504cd4ab3cbf..38c2e1892a00e 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -305,19 +305,40 @@ static int rpm_get_suppliers(struct device *dev) return 0; } =20 +/** + * pm_runtime_release_supplier - Drop references to device link's supplier. + * @link: Target device link. + * @check_idle: Whether or not to check if the supplier device is idle. + * + * Drop all runtime PM references associated with @link to its supplier de= vice + * and if @check_idle is set, check if that device is idle (and so it can = be + * suspended). + */ +void pm_runtime_release_supplier(struct device_link *link, bool check_idle) +{ + struct device *supplier =3D link->supplier; + + /* + * The additional power.usage_count check is a safety net in case + * the rpm_active refcount becomes saturated, in which case + * refcount_dec_not_one() would return true forever, but it is not + * strictly necessary. + */ + while (refcount_dec_not_one(&link->rpm_active) && + atomic_read(&supplier->power.usage_count) > 0) + pm_runtime_put_noidle(supplier); + + if (check_idle) + pm_request_idle(supplier); +} + static void __rpm_put_suppliers(struct device *dev, bool try_to_suspend) { struct device_link *link; =20 list_for_each_entry_rcu(link, &dev->links.suppliers, c_node, - device_links_read_lock_held()) { - - while (refcount_dec_not_one(&link->rpm_active)) - pm_runtime_put_noidle(link->supplier); - - if (try_to_suspend) - pm_request_idle(link->supplier); - } + device_links_read_lock_held()) + pm_runtime_release_supplier(link, try_to_suspend); } =20 static void rpm_put_suppliers(struct device *dev) @@ -1772,9 +1793,7 @@ void pm_runtime_drop_link(struct device_link *link) return; =20 pm_runtime_drop_link_count(link->consumer); - - while (refcount_dec_not_one(&link->rpm_active)) - pm_runtime_put(link->supplier); + pm_runtime_release_supplier(link, true); } =20 static bool pm_runtime_need_not_resume(struct device *dev) diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index eddd66d426caf..016de5776b6db 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -58,6 +58,7 @@ extern void pm_runtime_get_suppliers(struct device *dev); extern void pm_runtime_put_suppliers(struct device *dev); extern void pm_runtime_new_link(struct device *dev); extern void pm_runtime_drop_link(struct device_link *link); +extern void pm_runtime_release_supplier(struct device_link *link, bool che= ck_idle); =20 extern int devm_pm_runtime_enable(struct device *dev); =20 @@ -283,6 +284,8 @@ static inline void pm_runtime_get_suppliers(struct devi= ce *dev) {} static inline void pm_runtime_put_suppliers(struct device *dev) {} static inline void pm_runtime_new_link(struct device *dev) {} static inline void pm_runtime_drop_link(struct device_link *link) {} +static inline void pm_runtime_release_supplier(struct device_link *link, + bool check_idle) {} =20 #endif /* !CONFIG_PM */ =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6384C4707E for ; Tue, 25 Jan 2022 00:05:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2369188AbiAYABL (ORCPT ); Mon, 24 Jan 2022 19:01:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847031AbiAXXSV (ORCPT ); Mon, 24 Jan 2022 18:18:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40BAEC06F8D6; Mon, 24 Jan 2022 13:26:31 -0800 (PST) Received: from smtp.kernel.org (relay.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 D9215B81243; Mon, 24 Jan 2022 21:26:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3513CC340E4; Mon, 24 Jan 2022 21:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059589; bh=N5cFYl5qlbcsInQjVrE7IG8gddEZ3I2S9BMXo0GCtUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BzEp380x6h16gR8g8EOhKZv+NWfjAHNeDq1I0pAqYh+09nKOHVy3He2ojtly21bAW hbL5fy+rXRMRb4EEJI8s7PBIY2E+5Znc5Rpo8GMiuQcDR/0e/NEFQ8j++IcPUkRWmh YZrqcbt4rXhcDhQHF9Zb1oM2dqndvCMZIS57dRRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Pandruvada , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0667/1039] cpufreq: Fix initialization of min and max frequency QoS requests Date: Mon, 24 Jan 2022 19:40:56 +0100 Message-Id: <20220124184147.797717994@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki [ Upstream commit 521223d8b3ec078f670c7c35a1a04b1b2af07966 ] The min and max frequency QoS requests in the cpufreq core are initialized to whatever the current min and max frequency values are at the init time, but if any of these values change later (for example, cpuinfo.max_freq is updated by the driver), these initial request values will be limiting the CPU frequency unnecessarily unless they are changed by user space via sysfs. To address this, initialize min_freq_req and max_freq_req to FREQ_QOS_MIN_DEFAULT_VALUE and FREQ_QOS_MAX_DEFAULT_VALUE, respectively, so they don't really limit anything until user space updates them. Reported-by: Srinivas Pandruvada Tested-by: Srinivas Pandruvada Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/cpufreq/cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 096c3848fa415..76ffdaf8c8b5e 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1403,7 +1403,7 @@ static int cpufreq_online(unsigned int cpu) =20 ret =3D freq_qos_add_request(&policy->constraints, policy->min_freq_req, FREQ_QOS_MIN, - policy->min); + FREQ_QOS_MIN_DEFAULT_VALUE); if (ret < 0) { /* * So we don't call freq_qos_remove_request() for an @@ -1423,7 +1423,7 @@ static int cpufreq_online(unsigned int cpu) =20 ret =3D freq_qos_add_request(&policy->constraints, policy->max_freq_req, FREQ_QOS_MAX, - policy->max); + FREQ_QOS_MAX_DEFAULT_VALUE); if (ret < 0) { policy->max_freq_req =3D NULL; goto out_destroy_policy; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C25EAC433EF for ; Mon, 24 Jan 2022 22:14:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581503AbiAXWL4 (ORCPT ); Mon, 24 Jan 2022 17:11:56 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46886 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452772AbiAXV0d (ORCPT ); Mon, 24 Jan 2022 16:26:33 -0500 Received: from smtp.kernel.org (relay.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 31A3F61305; Mon, 24 Jan 2022 21:26:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2956C340E4; Mon, 24 Jan 2022 21:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059592; bh=iGXKZ32ebADZo9uL3I0kpvf3SEJ+MzjnQoFC482YF+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OSTtngvPIMC0mOFJRC/vKQDqDk3ufej/g6H7yhcXSIaxQrG/QZRRXiP/gOb/C0tT5 GxtoAh4NvFOPHUOlidsFVgaQh9R9YxET6tcvsJVLUX477r+gSFX8CDCvRI/7gUZXes UM+DVA+OdFb5Wjqeg8awC5rO55MqAUsIvoLseHI0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Kai-Heng Feng , Sasha Levin Subject: [PATCH 5.16 0668/1039] usb: hub: Add delay for SuperSpeed hub resume to let links transit to U0 Date: Mon, 24 Jan 2022 19:40:57 +0100 Message-Id: <20220124184147.829558688@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 00558586382891540c59c9febc671062425a6e47 ] When a new USB device gets plugged to nested hubs, the affected hub, which connects to usb 2-1.4-port2, doesn't report there's any change, hence the nested hubs go back to runtime suspend like nothing happened: [ 281.032951] usb usb2: usb wakeup-resume [ 281.032959] usb usb2: usb auto-resume [ 281.032974] hub 2-0:1.0: hub_resume [ 281.033011] usb usb2-port1: status 0263 change 0000 [ 281.033077] hub 2-0:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.049797] usb 2-1: usb wakeup-resume [ 281.069800] usb 2-1: Waited 0ms for CONNECT [ 281.069810] usb 2-1: finish resume [ 281.070026] hub 2-1:1.0: hub_resume [ 281.070250] usb 2-1-port4: status 0203 change 0000 [ 281.070272] usb usb2-port1: resume, status 0 [ 281.070282] hub 2-1:1.0: state 7 ports 4 chg 0010 evt 0000 [ 281.089813] usb 2-1.4: usb wakeup-resume [ 281.109792] usb 2-1.4: Waited 0ms for CONNECT [ 281.109801] usb 2-1.4: finish resume [ 281.109991] hub 2-1.4:1.0: hub_resume [ 281.110147] usb 2-1.4-port2: status 0263 change 0000 [ 281.110234] usb 2-1-port4: resume, status 0 [ 281.110239] usb 2-1-port4: status 0203, change 0000, 10.0 Gb/s [ 281.110266] hub 2-1.4:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.110426] hub 2-1.4:1.0: hub_suspend [ 281.110565] usb 2-1.4: usb auto-suspend, wakeup 1 [ 281.130998] hub 2-1:1.0: hub_suspend [ 281.137788] usb 2-1: usb auto-suspend, wakeup 1 [ 281.142935] hub 2-0:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.177828] usb 2-1: usb wakeup-resume [ 281.197839] usb 2-1: Waited 0ms for CONNECT [ 281.197850] usb 2-1: finish resume [ 281.197984] hub 2-1:1.0: hub_resume [ 281.198203] usb 2-1-port4: status 0203 change 0000 [ 281.198228] usb usb2-port1: resume, status 0 [ 281.198237] hub 2-1:1.0: state 7 ports 4 chg 0010 evt 0000 [ 281.217835] usb 2-1.4: usb wakeup-resume [ 281.237834] usb 2-1.4: Waited 0ms for CONNECT [ 281.237845] usb 2-1.4: finish resume [ 281.237990] hub 2-1.4:1.0: hub_resume [ 281.238067] usb 2-1.4-port2: status 0263 change 0000 [ 281.238148] usb 2-1-port4: resume, status 0 [ 281.238152] usb 2-1-port4: status 0203, change 0000, 10.0 Gb/s [ 281.238166] hub 2-1.4:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.238385] hub 2-1.4:1.0: hub_suspend [ 281.238523] usb 2-1.4: usb auto-suspend, wakeup 1 [ 281.258076] hub 2-1:1.0: hub_suspend [ 281.265744] usb 2-1: usb auto-suspend, wakeup 1 [ 281.285976] hub 2-0:1.0: hub_suspend [ 281.285988] usb usb2: bus auto-suspend, wakeup 1 USB 3.2 spec, 9.2.5.4 "Changing Function Suspend State" says that "If the link is in a non-U0 state, then the device must transition the link to U0 prior to sending the remote wake message", but the hub only transits the link to U0 after signaling remote wakeup. So be more forgiving and use a 20ms delay to let the link transit to U0 for remote wakeup. Suggested-by: Alan Stern Acked-by: Alan Stern Signed-off-by: Kai-Heng Feng Link: https://lore.kernel.org/r/20211215120108.336597-1-kai.heng.feng@canon= ical.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/core/hub.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 3bc4a86c3d0a5..ac6c5ccfe1cb7 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1110,7 +1110,10 @@ static void hub_activate(struct usb_hub *hub, enum h= ub_activation_type type) } else { hub_power_on(hub, true); } - } + /* Give some time on remote wakeup to let links to transit to U0 */ + } else if (hub_is_superspeed(hub->hdev)) + msleep(20); + init2: =20 /* --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7870C433F5 for ; Mon, 24 Jan 2022 22:14:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581525AbiAXWL6 (ORCPT ); Mon, 24 Jan 2022 17:11:58 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46924 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452794AbiAXV0h (ORCPT ); Mon, 24 Jan 2022 16:26:37 -0500 Received: from smtp.kernel.org (relay.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 1302661320; Mon, 24 Jan 2022 21:26:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20732C340E4; Mon, 24 Jan 2022 21:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059595; bh=syKAXgGkNN/cd6e1sptDYNJgaiCH3RcEKn5+Joj72mU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WwL7mIcRKNrtdRnVhXugrE7R6u7XLI+qBs6BWTgZ/D3IQFdBisEBlgxpnBqdhyJdI hETtNEJYu4nqYFijQ8INpb0BCw/lYycFgY/rKHcNiZ47Z8N0J5sl7Udymfuc5GOK1y k8quSd+1LKbTms3RLOtgFvoZfLi/tul/s34h5bUc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Chiu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0669/1039] mt76: mt7615: fix possible deadlock while mt7615_register_ext_phy() Date: Mon, 24 Jan 2022 19:40:58 +0100 Message-Id: <20220124184147.862142126@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Chiu [ Upstream commit 8c55516de3f9b76b9d9444e7890682ec2efc809f ] ieee80211_register_hw() is called with rtnl_lock held, and this could be caused lockdep from a work item that's on a workqueue that is flushed with the rtnl held. Move mt7615_register_ext_phy() outside the init_work(). Signed-off-by: Peter Chiu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c b/drivers= /net/wireless/mediatek/mt76/mt7615/pci_init.c index a2465b49ecd0c..87b4aa52ee0f9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c @@ -28,8 +28,6 @@ static void mt7615_pci_init_work(struct work_struct *work) return; =20 mt7615_init_work(dev); - if (dev->dbdc_support) - mt7615_register_ext_phy(dev); } =20 static int mt7615_init_hardware(struct mt7615_dev *dev) @@ -160,6 +158,12 @@ int mt7615_register_device(struct mt7615_dev *dev) mt7615_init_txpower(dev, &dev->mphy.sband_2g.sband); mt7615_init_txpower(dev, &dev->mphy.sband_5g.sband); =20 + if (dev->dbdc_support) { + ret =3D mt7615_register_ext_phy(dev); + if (ret) + return ret; + } + return mt7615_init_debugfs(dev); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17FC2C433FE for ; Mon, 24 Jan 2022 22:14:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581550AbiAXWMA (ORCPT ); Mon, 24 Jan 2022 17:12:00 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46944 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452815AbiAXV0l (ORCPT ); Mon, 24 Jan 2022 16:26:41 -0500 Received: from smtp.kernel.org (relay.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 E6D1560C60; Mon, 24 Jan 2022 21:26:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4675C340E4; Mon, 24 Jan 2022 21:26:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059598; bh=ziNTfB6MFkrrpKUiqMSsH39v3XYf+3hqHdG+XYLv7Ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tTry/dcazDUc616yY3zyuh1J/dRMC+6QeQC1+Tl/n89SvpWGyBLDJgLfIFbkmqWEA UPUnypGa2+m/VojYc6g/G0UmEo8+/BwU4LSIoQLr5Gkl6rr3Vt2Eag9wgYzDfRlr5S Obnim2d+bJfN6sXQC4/oVW10DMrud2QCwPTZIzJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fang Zhao , Ryder Lee , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0670/1039] mt76: mt7915: fix SMPS operation fail Date: Mon, 24 Jan 2022 19:40:59 +0100 Message-Id: <20220124184147.893810432@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ryder Lee [ Upstream commit 8f05835425ce3f669e4b6d7c2c39a9aa22e1506c ] TGn fails sending SM power save mode action frame to the AP to switch from dynamic SMPS mode to static mode. Reported-by: Fang Zhao Signed-off-by: Fang Zhao Signed-off-by: Ryder Lee Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 81 ++++++++++++------- .../net/wireless/mediatek/mt76/mt7915/mcu.h | 8 ++ 2 files changed, 61 insertions(+), 28 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7915/mcu.c index 852d5d97c70b1..8215b3d79bbdc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -1752,33 +1752,6 @@ int mt7915_mcu_sta_update_hdr_trans(struct mt7915_de= v *dev, true); } =20 -int mt7915_mcu_add_smps(struct mt7915_dev *dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct mt7915_vif *mvif =3D (struct mt7915_vif *)vif->drv_priv; - struct mt7915_sta *msta =3D (struct mt7915_sta *)sta->drv_priv; - struct wtbl_req_hdr *wtbl_hdr; - struct tlv *sta_wtbl; - struct sk_buff *skb; - - skb =3D mt7915_mcu_alloc_sta_req(dev, mvif, msta, - MT7915_STA_UPDATE_MAX_SIZE); - if (IS_ERR(skb)) - return PTR_ERR(skb); - - sta_wtbl =3D mt7915_mcu_add_tlv(skb, STA_REC_WTBL, sizeof(struct tlv)); - - wtbl_hdr =3D mt7915_mcu_alloc_wtbl_req(dev, msta, WTBL_SET, sta_wtbl, - &skb); - if (IS_ERR(wtbl_hdr)) - return PTR_ERR(wtbl_hdr); - - mt7915_mcu_wtbl_smps_tlv(skb, sta, sta_wtbl, wtbl_hdr); - - return mt76_mcu_skb_send_msg(&dev->mt76, skb, - MCU_EXT_CMD(STA_REC_UPDATE), true); -} - static inline bool mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif, struct ieee80211_sta *sta, bool bfee) @@ -2049,6 +2022,21 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, stru= ct sk_buff *skb, bfee->fb_identity_matrix =3D (nrow =3D=3D 1 && tx_ant =3D=3D 2); } =20 +static enum mcu_mmps_mode +mt7915_mcu_get_mmps_mode(enum ieee80211_smps_mode smps) +{ + switch (smps) { + case IEEE80211_SMPS_OFF: + return MCU_MMPS_DISABLE; + case IEEE80211_SMPS_STATIC: + return MCU_MMPS_STATIC; + case IEEE80211_SMPS_DYNAMIC: + return MCU_MMPS_DYNAMIC; + default: + return MCU_MMPS_DISABLE; + } +} + int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev, struct ieee80211_vif *vif, struct ieee80211_sta *sta, @@ -2076,7 +2064,11 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev= *dev, case RATE_PARAM_FIXED_MCS: case RATE_PARAM_FIXED_GI: case RATE_PARAM_FIXED_HE_LTF: - ra->phy =3D *phy; + if (phy) + ra->phy =3D *phy; + break; + case RATE_PARAM_MMPS_UPDATE: + ra->mmps_mode =3D mt7915_mcu_get_mmps_mode(sta->smps_mode); break; default: break; @@ -2087,6 +2079,39 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev= *dev, MCU_EXT_CMD(STA_REC_UPDATE), true); } =20 +int mt7915_mcu_add_smps(struct mt7915_dev *dev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta) +{ + struct mt7915_vif *mvif =3D (struct mt7915_vif *)vif->drv_priv; + struct mt7915_sta *msta =3D (struct mt7915_sta *)sta->drv_priv; + struct wtbl_req_hdr *wtbl_hdr; + struct tlv *sta_wtbl; + struct sk_buff *skb; + int ret; + + skb =3D mt7915_mcu_alloc_sta_req(dev, mvif, msta, + MT7915_STA_UPDATE_MAX_SIZE); + if (IS_ERR(skb)) + return PTR_ERR(skb); + + sta_wtbl =3D mt7915_mcu_add_tlv(skb, STA_REC_WTBL, sizeof(struct tlv)); + + wtbl_hdr =3D mt7915_mcu_alloc_wtbl_req(dev, msta, WTBL_SET, sta_wtbl, + &skb); + if (IS_ERR(wtbl_hdr)) + return PTR_ERR(wtbl_hdr); + + mt7915_mcu_wtbl_smps_tlv(skb, sta, sta_wtbl, wtbl_hdr); + + ret =3D mt76_mcu_skb_send_msg(&dev->mt76, skb, + MCU_EXT_CMD(STA_REC_UPDATE), true); + if (ret) + return ret; + + return mt7915_mcu_set_fixed_rate_ctrl(dev, vif, sta, NULL, + RATE_PARAM_MMPS_UPDATE); +} + static int mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, struct ieee80211_vif *vif, diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h b/drivers/net/= wireless/mediatek/mt76/mt7915/mcu.h index 1f5a64ba9b59d..628e90d0c394e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h @@ -365,6 +365,13 @@ enum { MCU_PHY_STATE_OFDMLQ_CNINFO, }; =20 +enum mcu_mmps_mode { + MCU_MMPS_STATIC, + MCU_MMPS_DYNAMIC, + MCU_MMPS_RSV, + MCU_MMPS_DISABLE, +}; + #define STA_TYPE_STA BIT(0) #define STA_TYPE_AP BIT(1) #define STA_TYPE_ADHOC BIT(2) @@ -960,6 +967,7 @@ struct sta_rec_ra_fixed { =20 enum { RATE_PARAM_FIXED =3D 3, + RATE_PARAM_MMPS_UPDATE =3D 5, RATE_PARAM_FIXED_HE_LTF =3D 7, RATE_PARAM_FIXED_MCS, RATE_PARAM_FIXED_GI =3D 11, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D32AC35270 for ; Tue, 25 Jan 2022 00:06:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2369256AbiAYABT (ORCPT ); Mon, 24 Jan 2022 19:01:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847039AbiAXXSV (ORCPT ); Mon, 24 Jan 2022 18:18:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E61DDC06F8D7; Mon, 24 Jan 2022 13:26:43 -0800 (PST) Received: from smtp.kernel.org (relay.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 AC560B81218; Mon, 24 Jan 2022 21:26:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE852C340E4; Mon, 24 Jan 2022 21:26:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059601; bh=xaOjFriQ6amaUUYsrE142p7G3EPJVhpiLBHT/0meCKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nFOTfOz/V69nN7vZgZ1AZ/i/S2GX9gJcpajAaWEfxHEvSyY1p1/PiMN0ZqFYBDK/6 rMWXvIYX+Kjd2xvD4nxv1wkKsvT56wGHShTr+673jMofdzbbblwzh9Hlp/129k9VCw Ejd+3SirqTmF4UP4FS39Bu/ADK6OLdXcbb9iJ5/I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0671/1039] mt76: connac: fix a theoretical NULL pointer dereference in mt76_connac_get_phy_mode Date: Mon, 24 Jan 2022 19:41:00 +0100 Message-Id: <20220124184147.929924729@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit c9dbeac4988f6d4c4211b3747ec9c9c75ea87967 ] Even if it is not a real bug since mt76_connac_get_phy_mode runs just for mt7921 where only STA is supported, fix a theoretical NULL pointer dereference if new added modes do not support HE Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers= /net/wireless/mediatek/mt76/mt76_connac_mcu.c index a5857a788da50..7733c8fad2413 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1180,7 +1180,7 @@ mt76_connac_get_phy_mode(struct mt76_phy *phy, struct= ieee80211_vif *vif, if (ht_cap->ht_supported) mode |=3D PHY_MODE_GN; =20 - if (he_cap->has_he) + if (he_cap && he_cap->has_he) mode |=3D PHY_MODE_AX_24G; } else if (band =3D=3D NL80211_BAND_5GHZ || band =3D=3D NL80211_BAND_6GHZ= ) { mode |=3D PHY_MODE_A; @@ -1191,7 +1191,7 @@ mt76_connac_get_phy_mode(struct mt76_phy *phy, struct= ieee80211_vif *vif, if (vht_cap->vht_supported) mode |=3D PHY_MODE_AC; =20 - if (he_cap->has_he) { + if (he_cap && he_cap->has_he) { if (band =3D=3D NL80211_BAND_6GHZ) mode |=3D PHY_MODE_AX_6G; else --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85956C47080 for ; Tue, 25 Jan 2022 00:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2369227AbiAYABQ (ORCPT ); Mon, 24 Jan 2022 19:01:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847043AbiAXXSV (ORCPT ); Mon, 24 Jan 2022 18:18:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08A4EC06F8DC; Mon, 24 Jan 2022 13:26:50 -0800 (PST) Received: from smtp.kernel.org (relay.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 C30F1B81218; Mon, 24 Jan 2022 21:26:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9932C340E4; Mon, 24 Jan 2022 21:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059607; bh=Ln5pXCPiLRQod5l8K2X8n7F8SxbEbRRMQFlbWA/g4/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NXHzSVZO/8C8HpyudxwZ2/Jixle9FKfEF4mBbYuA/L95TovHKS5hJFhESA7VUzj5o Ot2QjOQArAQy4vIjb+lb9+OQYRe7mfDulWlfjSUt9xr4NiJy5hESdj3SR3L3zOTjxY eWJe2mdg8LlaUpmBRBdX6fy1ftMHPLO8iqm3X4Vw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xing Song , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0672/1039] mt76: do not pass the received frame with decryption error Date: Mon, 24 Jan 2022 19:41:01 +0100 Message-Id: <20220124184147.961149629@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xing Song [ Upstream commit dd28dea52ad9376d2b243a8981726646e1f60b1a ] MAC80211 doesn't care any decryption error in 802.3 path, so received frame will be dropped if HW tell us that the cipher configuration is not matched as well as the header has been translated to 802.3. This case only appears when IEEE80211_FCTL_PROTECTED is 0 and cipher suit is not none in the corresponding HW entry. The received frame is only reported to monitor interface if HW decryption block tell us there is ICV error or CCMP/BIP/WPI MIC error. Note in this case the reported frame is decrypted 802.11 frame and the payload may be malformed due to mismatched key. Signed-off-by: Xing Song Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7603/mac.c | 4 ++++ drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 9 ++++++++- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 9 ++++++++- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 9 ++++++++- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/= wireless/mediatek/mt76/mt7603/mac.c index fe03e31989bb1..a9ac61b9f854a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c @@ -525,6 +525,10 @@ mt7603_mac_fill_rx(struct mt7603_dev *dev, struct sk_b= uff *skb) if (rxd2 & MT_RXD2_NORMAL_TKIP_MIC_ERR) status->flag |=3D RX_FLAG_MMIC_ERROR; =20 + /* ICV error or CCMP/BIP/WPI MIC error */ + if (rxd2 & MT_RXD2_NORMAL_ICV_ERR) + status->flag |=3D RX_FLAG_ONLY_MONITOR; + if (FIELD_GET(MT_RXD2_NORMAL_SEC_MODE, rxd2) !=3D 0 && !(rxd2 & (MT_RXD2_NORMAL_CLM | MT_RXD2_NORMAL_CM))) { status->flag |=3D RX_FLAG_DECRYPTED; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/= wireless/mediatek/mt76/mt7615/mac.c index 423f69015e3ec..c79abce543f3b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -286,9 +286,16 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, = struct sk_buff *skb) if (rxd2 & MT_RXD2_NORMAL_AMSDU_ERR) return -EINVAL; =20 + hdr_trans =3D rxd1 & MT_RXD1_NORMAL_HDR_TRANS; + if (hdr_trans && (rxd2 & MT_RXD2_NORMAL_CM)) + return -EINVAL; + + /* ICV error or CCMP/BIP/WPI MIC error */ + if (rxd2 & MT_RXD2_NORMAL_ICV_ERR) + status->flag |=3D RX_FLAG_ONLY_MONITOR; + unicast =3D (rxd1 & MT_RXD1_NORMAL_ADDR_TYPE) =3D=3D MT_RXD1_NORMAL_U2M; idx =3D FIELD_GET(MT_RXD2_NORMAL_WLAN_IDX, rxd2); - hdr_trans =3D rxd1 & MT_RXD1_NORMAL_HDR_TRANS; status->wcid =3D mt7615_rx_get_wcid(dev, idx, unicast); =20 if (status->wcid) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/= wireless/mediatek/mt76/mt7915/mac.c index 809dc18e5083c..38d66411444a1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -426,9 +426,16 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_b= uff *skb) if (rxd2 & MT_RXD2_NORMAL_AMSDU_ERR) return -EINVAL; =20 + hdr_trans =3D rxd2 & MT_RXD2_NORMAL_HDR_TRANS; + if (hdr_trans && (rxd1 & MT_RXD1_NORMAL_CM)) + return -EINVAL; + + /* ICV error or CCMP/BIP/WPI MIC error */ + if (rxd1 & MT_RXD1_NORMAL_ICV_ERR) + status->flag |=3D RX_FLAG_ONLY_MONITOR; + unicast =3D FIELD_GET(MT_RXD3_NORMAL_ADDR_TYPE, rxd3) =3D=3D MT_RXD3_NORM= AL_U2M; idx =3D FIELD_GET(MT_RXD1_NORMAL_WLAN_IDX, rxd1); - hdr_trans =3D rxd2 & MT_RXD2_NORMAL_HDR_TRANS; status->wcid =3D mt7915_rx_get_wcid(dev, idx, unicast); =20 if (status->wcid) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/= wireless/mediatek/mt76/mt7921/mac.c index 321d9f1d3f865..7228b34c66436 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -428,10 +428,17 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_= buff *skb) if (rxd2 & MT_RXD2_NORMAL_AMSDU_ERR) return -EINVAL; =20 + hdr_trans =3D rxd2 & MT_RXD2_NORMAL_HDR_TRANS; + if (hdr_trans && (rxd1 & MT_RXD1_NORMAL_CM)) + return -EINVAL; + + /* ICV error or CCMP/BIP/WPI MIC error */ + if (rxd1 & MT_RXD1_NORMAL_ICV_ERR) + status->flag |=3D RX_FLAG_ONLY_MONITOR; + chfreq =3D FIELD_GET(MT_RXD3_NORMAL_CH_FREQ, rxd3); unicast =3D FIELD_GET(MT_RXD3_NORMAL_ADDR_TYPE, rxd3) =3D=3D MT_RXD3_NORM= AL_U2M; idx =3D FIELD_GET(MT_RXD1_NORMAL_WLAN_IDX, rxd1); - hdr_trans =3D rxd2 & MT_RXD2_NORMAL_HDR_TRANS; status->wcid =3D mt7921_rx_get_wcid(dev, idx, unicast); =20 if (status->wcid) { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9E67C433F5 for ; Mon, 24 Jan 2022 22:24:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452198AbiAXWXh (ORCPT ); Mon, 24 Jan 2022 17:23:37 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47056 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359651AbiAXV0w (ORCPT ); Mon, 24 Jan 2022 16:26:52 -0500 Received: from smtp.kernel.org (relay.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 1313F614C7; Mon, 24 Jan 2022 21:26:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFAF0C340E4; Mon, 24 Jan 2022 21:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059610; bh=NQzJYw+ZcwRxHtulPkHp+iCaV8fwvy2mncxzli3v9QI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dDzIivjUfYKH+aZ8G7eUjKD66d7bLbWols2ypFASzB2iTfv4ul4BY8H/9oMH71uTn 4KrPtboYFSXwC5+/K9S4LGxge4BZA4ndW5oGOazPHZAQYkEEHXvhhfLbsKZsRcppKr Fik0fsnWTcTOTBmRn/kmyN15i/SJDaFROGt1iM30= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0673/1039] mt76: mt7615: improve wmm index allocation Date: Mon, 24 Jan 2022 19:41:02 +0100 Message-Id: <20220124184147.996738911@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Felix Fietkau [ Upstream commit 70fb028707c8871ef9e56b3ffa3d895e14956cc4 ] Typically all AP interfaces on a PHY will share the same WMM settings, while sta/mesh interfaces will usually inherit the settings from a remote device. In order minimize the likelihood of conflicting WMM settings, make all AP interfaces share one slot, and all non-AP interfaces another one. This also fixes running multiple AP interfaces on MT7613, which only has 3 WMM slots. Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net= /wireless/mediatek/mt76/mt7615/main.c index 24c23d4951432..1fdcada157d6b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -211,11 +211,9 @@ static int mt7615_add_interface(struct ieee80211_hw *h= w, mvif->mt76.omac_idx =3D idx; =20 mvif->mt76.band_idx =3D ext_phy; - if (mt7615_ext_phy(dev)) - mvif->mt76.wmm_idx =3D ext_phy * (MT7615_MAX_WMM_SETS / 2) + - mvif->mt76.idx % (MT7615_MAX_WMM_SETS / 2); - else - mvif->mt76.wmm_idx =3D mvif->mt76.idx % MT7615_MAX_WMM_SETS; + mvif->mt76.wmm_idx =3D vif->type !=3D NL80211_IFTYPE_AP; + if (ext_phy) + mvif->mt76.wmm_idx +=3D 2; =20 dev->mt76.vif_mask |=3D BIT(mvif->mt76.idx); dev->omac_mask |=3D BIT_ULL(mvif->mt76.omac_idx); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7645CC433EF for ; Mon, 24 Jan 2022 22:24:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1585390AbiAXWX3 (ORCPT ); Mon, 24 Jan 2022 17:23:29 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47072 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359668AbiAXV06 (ORCPT ); Mon, 24 Jan 2022 16:26:58 -0500 Received: from smtp.kernel.org (relay.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 EEC6361028; Mon, 24 Jan 2022 21:26:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA61BC340E4; Mon, 24 Jan 2022 21:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059613; bh=A1yCa7zVPJjMq59948eC6md/PSXKVMLzT/LBZ8zQ1oI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V0SBA2UqinZ2Ppcg7UnGwCQWKhXcsQbhKqXZJKNH0tySB8SJSroxI3ii8rmYmnC6v ZffIWNYLIxfQJ9l4dv/cFBELkaw16xfDxR7eCYQLttRPCFtjwRaF/2OawqCvr4WC05 61BEfZVx0nwWuIsYkD9fmoDNyf3fI53xKjnMwSPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Deren Wu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.16 0674/1039] mt76: mt7921: fix network buffer leak by txs missing Date: Mon, 24 Jan 2022 19:41:03 +0100 Message-Id: <20220124184148.027996090@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Deren Wu [ Upstream commit e0bf699ad8e52330d848144a9624a067ad588bd6 ] TXS in mt7921 may be forwared to tx_done event. Should try to catch TXS information in tx_done event as well. Signed-off-by: Deren Wu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../net/wireless/mediatek/mt76/mt7921/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 14 ++++++++++ .../net/wireless/mediatek/mt76/mt7921/mcu.h | 27 +++++++++++++++++++ .../wireless/mediatek/mt76/mt7921/mt7921.h | 1 + 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/= wireless/mediatek/mt76/mt7921/mac.c index 7228b34c66436..fc21a78b37c49 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -1072,7 +1072,7 @@ out: return !!skb; } =20 -static void mt7921_mac_add_txs(struct mt7921_dev *dev, void *data) +void mt7921_mac_add_txs(struct mt7921_dev *dev, void *data) { struct mt7921_sta *msta =3D NULL; struct mt76_wcid *wcid; diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7921/mcu.c index 1cc1c32ca258e..484a8c57b862e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -391,6 +391,17 @@ mt7921_mcu_low_power_event(struct mt7921_dev *dev, str= uct sk_buff *skb) trace_lp_event(dev, event->state); } =20 +static void +mt7921_mcu_tx_done_event(struct mt7921_dev *dev, struct sk_buff *skb) +{ + struct mt7921_mcu_tx_done_event *event; + + skb_pull(skb, sizeof(struct mt7921_mcu_rxd)); + event =3D (struct mt7921_mcu_tx_done_event *)skb->data; + + mt7921_mac_add_txs(dev, event->txs); +} + static void mt7921_mcu_rx_unsolicited_event(struct mt7921_dev *dev, struct sk_buff *sk= b) { @@ -418,6 +429,9 @@ mt7921_mcu_rx_unsolicited_event(struct mt7921_dev *dev,= struct sk_buff *skb) case MCU_EVENT_LP_INFO: mt7921_mcu_low_power_event(dev, skb); break; + case MCU_EVENT_TX_DONE: + mt7921_mcu_tx_done_event(dev, skb); + break; default: break; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h b/drivers/net/= wireless/mediatek/mt76/mt7921/mcu.h index edc0c73f8c01c..68cb0ce013dbd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h @@ -91,6 +91,33 @@ enum { MCU_EVENT_COREDUMP =3D 0xf0, }; =20 +struct mt7921_mcu_tx_done_event { + u8 pid; + u8 status; + __le16 seq; + + u8 wlan_idx; + u8 tx_cnt; + __le16 tx_rate; + + u8 flag; + u8 tid; + u8 rsp_rate; + u8 mcs; + + u8 bw; + u8 tx_pwr; + u8 reason; + u8 rsv0[1]; + + __le32 delay; + __le32 timestamp; + __le32 applied_flag; + u8 txs[28]; + + u8 rsv1[32]; +} __packed; + /* ext event table */ enum { MCU_EXT_EVENT_RATE_REPORT =3D 0x87, diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/n= et/wireless/mediatek/mt76/mt7921/mt7921.h index d6b823713ba33..96647801850a5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h @@ -464,4 +464,5 @@ int mt7921s_tx_prepare_skb(struct mt76_dev *mdev, void = *txwi_ptr, struct mt76_tx_info *tx_info); void mt7921s_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entr= y *e); bool mt7921s_tx_status_data(struct mt76_dev *mdev, u8 *update); +void mt7921_mac_add_txs(struct mt7921_dev *dev, void *data); #endif --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EFA3C4332F for ; Mon, 24 Jan 2022 22:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586400AbiAXW0X (ORCPT ); Mon, 24 Jan 2022 17:26:23 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41100 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359700AbiAXV07 (ORCPT ); Mon, 24 Jan 2022 16:26:59 -0500 Received: from smtp.kernel.org (relay.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 7F024B811A2; Mon, 24 Jan 2022 21:26:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B74DFC340E4; Mon, 24 Jan 2022 21:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059616; bh=0NPR2GEkXmlKshR2DCdw5F1yXLjr3XEZ5JAnE8LMcEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YlN9bp9oMRbjuGrcQktLgo20UfiOkYFRw0fqE8ITFyF+EaG4/8W2xIu7s5H4LdtKm mPCW/6NP1pmzF5fmoOOt0dtuuFR+Qm2sVZKUFsZpaAelv9InkIH2rxfpZPyRy9El+m aimCXK+ZweAMvKqnGkgEYYIfRiqhBymCLtX2IkUw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0675/1039] ath9k_htc: fix NULL pointer dereference at ath9k_htc_rxep() Date: Mon, 24 Jan 2022 19:41:04 +0100 Message-Id: <20220124184148.057636054@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa [ Upstream commit b0ec7e55fce65f125bd1d7f02e2dc4de62abee34 ] syzbot is reporting lockdep warning followed by kernel panic at ath9k_htc_rxep() [1], for ath9k_htc_rxep() depends on ath9k_rx_init() being already completed. Since ath9k_htc_rxep() is set by ath9k_htc_connect_svc(WMI_BEACON_SVC) from ath9k_init_htc_services(), it is possible that ath9k_htc_rxep() is called via timer interrupt before ath9k_rx_init() from ath9k_init_device() is called. Since we can't call ath9k_init_device() before ath9k_init_htc_services(), let's hold ath9k_htc_rxep() no-op until ath9k_rx_init() completes. Link: https://syzkaller.appspot.com/bug?extid=3D4d2d56175b934b9a7bf9 [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Tested-by: syzbot Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/2b88f416-b2cb-7a18-d688-951e6dc3fe92@i-love= .sakura.ne.jp Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath9k/htc.h | 1 + drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/at= h/ath9k/htc.h index 0a1634238e673..4f71e962279af 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h @@ -281,6 +281,7 @@ struct ath9k_htc_rxbuf { struct ath9k_htc_rx { struct list_head rxbuf; spinlock_t rxbuflock; + bool initialized; }; =20 #define ATH9K_HTC_TX_CLEANUP_INTERVAL 50 /* ms */ diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wi= reless/ath/ath9k/htc_drv_txrx.c index 8e69e8989f6d3..e7a21eaf3a68d 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c @@ -1130,6 +1130,10 @@ void ath9k_htc_rxep(void *drv_priv, struct sk_buff *= skb, struct ath9k_htc_rxbuf *rxbuf =3D NULL, *tmp_buf =3D NULL; unsigned long flags; =20 + /* Check if ath9k_rx_init() completed. */ + if (!data_race(priv->rx.initialized)) + goto err; + spin_lock_irqsave(&priv->rx.rxbuflock, flags); list_for_each_entry(tmp_buf, &priv->rx.rxbuf, list) { if (!tmp_buf->in_process) { @@ -1185,6 +1189,10 @@ int ath9k_rx_init(struct ath9k_htc_priv *priv) list_add_tail(&rxbuf->list, &priv->rx.rxbuf); } =20 + /* Allow ath9k_htc_rxep() to operate. */ + smp_wmb(); + priv->rx.initialized =3D true; + return 0; =20 err: --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0A6FC433FE for ; Tue, 25 Jan 2022 00:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2369074AbiAYAAx (ORCPT ); Mon, 24 Jan 2022 19:00:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847056AbiAXXSY (ORCPT ); Mon, 24 Jan 2022 18:18:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 291DEC06F8E3; Mon, 24 Jan 2022 13:27:00 -0800 (PST) Received: from smtp.kernel.org (relay.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 BA542614D8; Mon, 24 Jan 2022 21:26:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D0A0C340E4; Mon, 24 Jan 2022 21:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059619; bh=XOsj6tMeo3byH1VXmZp4CqHcytz5W+S7VP6NCTNikdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aAQw4PKpaRo9L1HWXQ4bAQh8Y9gCzbaelRDt8oAwWfEeTWJmE1gZI8OrJq1/CYYSf 8fFy+CxyF/wFWhXrWXXdGe644EqAb/FzJc68jtB3/qZ9HriWZIMcS5sfz60aPgq84l SiC4zTxpxHiovLPveo/MJan+p0HT/0lZur9L98/I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0676/1039] ath9k_htc: fix NULL pointer dereference at ath9k_htc_tx_get_packet() Date: Mon, 24 Jan 2022 19:41:05 +0100 Message-Id: <20220124184148.088458097@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa [ Upstream commit 8b3046abc99eefe11438090bcc4ec3a3994b55d0 ] syzbot is reporting lockdep warning at ath9k_wmi_event_tasklet() followed by kernel panic at get_htc_epid_queue() from ath9k_htc_tx_get_packet() from ath9k_htc_txstatus() [1], for ath9k_wmi_event_tasklet(WMI_TXSTATUS_EVENTID) depends on spin_lock_init() from ath9k_init_priv() being already completed. Since ath9k_wmi_event_tasklet() is set by ath9k_init_wmi() from ath9k_htc_probe_device(), it is possible that ath9k_wmi_event_tasklet() is called via tasklet interrupt before spin_lock_init() from ath9k_init_priv() from ath9k_init_device() from ath9k_htc_probe_device() is called. Let's hold ath9k_wmi_event_tasklet(WMI_TXSTATUS_EVENTID) no-op until ath9k_tx_init() completes. Link: https://syzkaller.appspot.com/bug?extid=3D31d54c60c5b254d6f75b [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Tested-by: syzbot Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/77b76ac8-2bee-6444-d26c-8c30858b8daa@i-love= .sakura.ne.jp Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath9k/htc.h | 1 + drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 5 +++++ drivers/net/wireless/ath/ath9k/wmi.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/at= h/ath9k/htc.h index 4f71e962279af..6b45e63fae4ba 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h @@ -306,6 +306,7 @@ struct ath9k_htc_tx { DECLARE_BITMAP(tx_slot, MAX_TX_BUF_NUM); struct timer_list cleanup_timer; spinlock_t tx_lock; + bool initialized; }; =20 struct ath9k_htc_tx_ctl { diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wi= reless/ath/ath9k/htc_drv_txrx.c index e7a21eaf3a68d..6a850a0bfa8ad 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c @@ -813,6 +813,11 @@ int ath9k_tx_init(struct ath9k_htc_priv *priv) skb_queue_head_init(&priv->tx.data_vi_queue); skb_queue_head_init(&priv->tx.data_vo_queue); skb_queue_head_init(&priv->tx.tx_failed); + + /* Allow ath9k_wmi_event_tasklet(WMI_TXSTATUS_EVENTID) to operate. */ + smp_wmb(); + priv->tx.initialized =3D true; + return 0; } =20 diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/at= h/ath9k/wmi.c index fe29ad4b9023c..f315c54bd3ac0 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.c +++ b/drivers/net/wireless/ath/ath9k/wmi.c @@ -169,6 +169,10 @@ void ath9k_wmi_event_tasklet(struct tasklet_struct *t) &wmi->drv_priv->fatal_work); break; case WMI_TXSTATUS_EVENTID: + /* Check if ath9k_tx_init() completed. */ + if (!data_race(priv->tx.initialized)) + break; + spin_lock_bh(&priv->tx.tx_lock); if (priv->tx.flags & ATH9K_HTC_OP_TX_DRAIN) { spin_unlock_bh(&priv->tx.tx_lock); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF741C433EF for ; Mon, 24 Jan 2022 22:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582734AbiAXWPl (ORCPT ); Mon, 24 Jan 2022 17:15:41 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42260 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378157AbiAXV1F (ORCPT ); Mon, 24 Jan 2022 16:27:05 -0500 Received: from smtp.kernel.org (relay.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 3BBDEB81243; Mon, 24 Jan 2022 21:27:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 745C1C340E4; Mon, 24 Jan 2022 21:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059622; bh=sr+Q2oFR8CNiUVEfQQFtfRQdkcamxTQq3ai2GqUz1MU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EiZpahilmKm4KfIY17mlG/CzChoT7XAfaktrKWUwGSYAzDO4JvgagPLg1cNzlxVzQ Kf/x9QCWvrHIsmW2b079HemF+dT6y/SZoVSnf988lSd5o45/rq20mq0j62w48GKOPa 7YtwkFi0En/msy6CKG1dDg2TcM7a4P4tuaL9e4vI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zekun Shen , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0677/1039] ath9k: Fix out-of-bound memcpy in ath9k_hif_usb_rx_stream Date: Mon, 24 Jan 2022 19:41:06 +0100 Message-Id: <20220124184148.121802759@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zekun Shen [ Upstream commit 6ce708f54cc8d73beca213cec66ede5ce100a781 ] Large pkt_len can lead to out-out-bound memcpy. Current ath9k_hif_usb_rx_stream allows combining the content of two urb inputs to one pkt. The first input can indicate the size of the pkt. Any remaining size is saved in hif_dev->rx_remain_len. While processing the next input, memcpy is used with rx_remain_len. 4-byte pkt_len can go up to 0xffff, while a single input is 0x4000 maximum in size (MAX_RX_BUF_SIZE). Thus, the patch adds a check for pkt_len which must not exceed 2 * MAX_RX_BUG_SIZE. BUG: KASAN: slab-out-of-bounds in ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_ht= c] Read of size 46393 at addr ffff888018798000 by task kworker/0:1/23 CPU: 0 PID: 23 Comm: kworker/0:1 Not tainted 5.6.0 #63 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.2-0-g5f4c7b1-prebuilt.qemu-project.org 04/01/2014 Workqueue: events request_firmware_work_func Call Trace: dump_stack+0x76/0xa0 print_address_description.constprop.0+0x16/0x200 ? ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] ? ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] __kasan_report.cold+0x37/0x7c ? ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] kasan_report+0xe/0x20 check_memory_region+0x15a/0x1d0 memcpy+0x20/0x50 ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] ? hif_usb_mgmt_cb+0x2d9/0x2d9 [ath9k_htc] ? _raw_spin_lock_irqsave+0x7b/0xd0 ? _raw_spin_trylock_bh+0x120/0x120 ? __usb_unanchor_urb+0x12f/0x210 __usb_hcd_giveback_urb+0x1e4/0x380 usb_giveback_urb_bh+0x241/0x4f0 ? __hrtimer_run_queues+0x316/0x740 ? __usb_hcd_giveback_urb+0x380/0x380 tasklet_action_common.isra.0+0x135/0x330 __do_softirq+0x18c/0x634 irq_exit+0x114/0x140 smp_apic_timer_interrupt+0xde/0x380 apic_timer_interrupt+0xf/0x20 I found the bug using a custome USBFuzz port. It's a research work to fuzz USB stack/drivers. I modified it to fuzz ath9k driver only, providing hand-crafted usb descriptors to QEMU. After fixing the value of pkt_tag to ATH_USB_RX_STREAM_MODE_TAG in QEMU emulation, I found the KASAN report. The bug is triggerable whenever pkt_len is above two MAX_RX_BUG_SIZE. I used the same input that crashes to test the driver works when applying the patch. Signed-off-by: Zekun Shen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YXsidrRuK6zBJicZ@10-18-43-117.dynapool.wire= less.nyu.edu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath9k/hif_usb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireles= s/ath/ath9k/hif_usb.c index 860da13bfb6ac..f06eec99de688 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -590,6 +590,13 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_= usb *hif_dev, return; } =20 + if (pkt_len > 2 * MAX_RX_BUF_SIZE) { + dev_err(&hif_dev->udev->dev, + "ath9k_htc: invalid pkt_len (%x)\n", pkt_len); + RX_STAT_INC(skb_dropped); + return; + } + pad_len =3D 4 - (pkt_len & 0x3); if (pad_len =3D=3D 4) pad_len =3D 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95BB7C433F5 for ; Mon, 24 Jan 2022 22:17:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582617AbiAXWPc (ORCPT ); Mon, 24 Jan 2022 17:15:32 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46086 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443867AbiAXV1F (ORCPT ); Mon, 24 Jan 2022 16:27:05 -0500 Received: from smtp.kernel.org (relay.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 54888614B8; Mon, 24 Jan 2022 21:27:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68BDBC340E4; Mon, 24 Jan 2022 21:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059624; bh=3+demyXxz1HqrShCU0iSOzn9gxlNu+2vJqtRcEcN270=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PbCyQZoc8f0Y383/1nFgVx77mt3c7kjcoEEYzTkhmoEdlup/xcghwqasj1c2TLfwl jofNxmJXfoaL+xQpAmw28Aisth4ooesYdStUSM+BJ3WZFoTloM7YPp9f4BCECvpeFv RrNFTTvl4CQ3Uciy1+I8OqQOBNeTaqAecmZ9GCuU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Po-Hao Huang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0678/1039] rtw88: 8822c: update rx settings to prevent potential hw deadlock Date: Mon, 24 Jan 2022 19:41:07 +0100 Message-Id: <20220124184148.153062248@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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-Hao Huang [ Upstream commit c1afb26727d9e507d3e17a9890e7aaf7fc85cd55 ] These settings enables mac to detect and recover when rx fifo circuit deadlock occurs. Previous version missed this, so we fix it. Signed-off-by: Po-Hao Huang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211217012708.8623-1-pkshih@realtek.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/realtek/rtw88/main.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw8821c.h | 2 +- drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw8822c.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wirele= ss/realtek/rtw88/main.c index a0d4d6e31fb49..dbf1ce3daeb8e 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1868,7 +1868,7 @@ int rtw_core_init(struct rtw_dev *rtwdev) =20 /* default rx filter setting */ rtwdev->hal.rcr =3D BIT_APP_FCS | BIT_APP_MIC | BIT_APP_ICV | - BIT_HTC_LOC_CTRL | BIT_APP_PHYSTS | + BIT_PKTCTL_DLEN | BIT_HTC_LOC_CTRL | BIT_APP_PHYSTS | BIT_AB | BIT_AM | BIT_APM; =20 ret =3D rtw_load_firmware(rtwdev, RTW_NORMAL_FW); diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.h b/drivers/net/wi= reless/realtek/rtw88/rtw8821c.h index 112faa60f653e..d9fbddd7b0f35 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8821c.h +++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.h @@ -131,7 +131,7 @@ _rtw_write32s_mask(struct rtw_dev *rtwdev, u32 addr, u3= 2 mask, u32 data) #define WLAN_TX_FUNC_CFG2 0x30 #define WLAN_MAC_OPT_NORM_FUNC1 0x98 #define WLAN_MAC_OPT_LB_FUNC1 0x80 -#define WLAN_MAC_OPT_FUNC2 0x30810041 +#define WLAN_MAC_OPT_FUNC2 0xb0810041 =20 #define WLAN_SIFS_CFG (WLAN_SIFS_CCK_CONT_TX | \ (WLAN_SIFS_OFDM_CONT_TX << BIT_SHIFT_SIFS_OFDM_CTX) | \ diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wi= reless/realtek/rtw88/rtw8822b.c index c409c8c29ec8b..e870ad7518342 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c @@ -205,7 +205,7 @@ static void rtw8822b_phy_set_param(struct rtw_dev *rtwd= ev) #define WLAN_TX_FUNC_CFG2 0x30 #define WLAN_MAC_OPT_NORM_FUNC1 0x98 #define WLAN_MAC_OPT_LB_FUNC1 0x80 -#define WLAN_MAC_OPT_FUNC2 0x30810041 +#define WLAN_MAC_OPT_FUNC2 0xb0810041 =20 #define WLAN_SIFS_CFG (WLAN_SIFS_CCK_CONT_TX | \ (WLAN_SIFS_OFDM_CONT_TX << BIT_SHIFT_SIFS_OFDM_CTX) | \ diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wi= reless/realtek/rtw88/rtw8822c.c index 46b881e8e4feb..0e1c5d95d4649 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c @@ -1962,7 +1962,7 @@ static void rtw8822c_phy_set_param(struct rtw_dev *rt= wdev) #define WLAN_TX_FUNC_CFG2 0x30 #define WLAN_MAC_OPT_NORM_FUNC1 0x98 #define WLAN_MAC_OPT_LB_FUNC1 0x80 -#define WLAN_MAC_OPT_FUNC2 0x30810041 +#define WLAN_MAC_OPT_FUNC2 0xb0810041 #define WLAN_MAC_INT_MIG_CFG 0x33330000 =20 #define WLAN_SIFS_CFG (WLAN_SIFS_CCK_CONT_TX | \ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4ADDC35270 for ; Mon, 24 Jan 2022 22:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581635AbiAXWMG (ORCPT ); Mon, 24 Jan 2022 17:12:06 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42338 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452837AbiAXV1N (ORCPT ); Mon, 24 Jan 2022 16:27:13 -0500 Received: from smtp.kernel.org (relay.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 23289B81057; Mon, 24 Jan 2022 21:27:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46776C340E4; Mon, 24 Jan 2022 21:27:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059627; bh=Zlb1GxZyQU5sZAlAtxJ1xvGbM1W1LxN/N01mLYXusvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fkynVlNmk8ARsfbZyPhxnKmXSXPiYaF/Ji3AKyV5Muwr3hQ8IVTAssM76TTDMopVk eg4zxuGJqDsW/fC9AvQzx/dCOGAfCB1/OTnVZWyfpm7+CQed+D6xSnYZ243bGt28tM 07Y+TA7p4xxBoFhu9LxnClUCyX6UTFKn5lTqt9cg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Changcheng Deng , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.16 0679/1039] PM: AVS: qcom-cpr: Use div64_ul instead of do_div Date: Mon, 24 Jan 2022 19:41:08 +0100 Message-Id: <20220124184148.185749635@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Changcheng Deng [ Upstream commit 92c550f9ffd2884bb5def52b5c0485a35e452784 ] do_div() does a 64-by-32 division. Here the divisor is an unsigned long which on some platforms is 64 bit wide. So use div64_ul instead of do_div to avoid a possible truncation. Reported-by: Zeal Robot Signed-off-by: Changcheng Deng Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211125014311.45942-1-deng.changcheng@zte.= com.cn Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/soc/qcom/cpr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/qcom/cpr.c b/drivers/soc/qcom/cpr.c index 1d818a8ba2089..e9b854ed1bdfd 100644 --- a/drivers/soc/qcom/cpr.c +++ b/drivers/soc/qcom/cpr.c @@ -1010,7 +1010,7 @@ static int cpr_interpolate(const struct corner *corne= r, int step_volt, return corner->uV; =20 temp =3D f_diff * (uV_high - uV_low); - do_div(temp, f_high - f_low); + temp =3D div64_ul(temp, f_high - f_low); =20 /* * max_volt_scale has units of uV/MHz while freq values --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 775BDC433EF for ; Mon, 24 Jan 2022 22:14:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581654AbiAXWMH (ORCPT ); Mon, 24 Jan 2022 17:12:07 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42362 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452840AbiAXV1N (ORCPT ); Mon, 24 Jan 2022 16:27:13 -0500 Received: from smtp.kernel.org (relay.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 F0B06B8121C; Mon, 24 Jan 2022 21:27:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 511E2C340E4; Mon, 24 Jan 2022 21:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059630; bh=3JX4NxME83wn+3Sx/vJIXU37WPkZe9zA5CufjNXYz9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GNkatMxy8fR61nQ4g5mdkTTZ4nzeaXS/JfuPgYmHsbWuYrIYH1l1eu0EjPluFtGJq 0hiCjEx0yI/5rFnn6I5YHh+PGW9WbuTJT/+rdWPl8/F6nW15JfXIj9Eb7vt2HoSQyg 7FEjWyzzJMGtww3pyn7AJL2irrf4ZglgHvyfGinA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Edwards , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0680/1039] iwlwifi: recognize missing PNVM data and then log filename Date: Mon, 24 Jan 2022 19:41:09 +0100 Message-Id: <20220124184148.222339339@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luca Coelho [ Upstream commit 1db385c668d3ccb04ccdb5f0f190fd17b2db29c6 ] We can detect that a FW SYSASSERT is due to missing PNVM data by checking the assertion code. When this happens, it's is useful for the user if we print the filename where the driver is looking for the data. Add the PNVM missing assertion code to the dump list and print out the name of the file we're looking for when this happens. Reported-by: Sam Edwards Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211210090244.1d8725b7518a.I0c3661= 7a7282bd445cda484d97ac4a83022706ee@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/fw/dump.c | 9 +++++++++ drivers/net/wireless/intel/iwlwifi/fw/img.c | 6 +++--- drivers/net/wireless/intel/iwlwifi/fw/img.h | 4 ++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dump.c b/drivers/net/wir= eless/intel/iwlwifi/fw/dump.c index 016b3a4c5f513..6a37933a02169 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/dump.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/dump.c @@ -12,6 +12,7 @@ #include "iwl-io.h" #include "iwl-prph.h" #include "iwl-csr.h" +#include "pnvm.h" =20 /* * Note: This structure is read from the device with IO accesses, @@ -147,6 +148,7 @@ static void iwl_fwrt_dump_umac_error_log(struct iwl_fw_= runtime *fwrt) struct iwl_trans *trans =3D fwrt->trans; struct iwl_umac_error_event_table table =3D {}; u32 base =3D fwrt->trans->dbg.umac_error_event_table; + char pnvm_name[MAX_PNVM_NAME]; =20 if (!base && !(fwrt->trans->dbg.error_event_table_tlv_status & @@ -164,6 +166,13 @@ static void iwl_fwrt_dump_umac_error_log(struct iwl_fw= _runtime *fwrt) fwrt->trans->status, table.valid); } =20 + if ((table.error_id & ~FW_SYSASSERT_CPU_MASK) =3D=3D + FW_SYSASSERT_PNVM_MISSING) { + iwl_pnvm_get_fs_name(trans, pnvm_name, sizeof(pnvm_name)); + IWL_ERR(fwrt, "PNVM data is missing, please install %s\n", + pnvm_name); + } + IWL_ERR(fwrt, "0x%08X | %s\n", table.error_id, iwl_fw_lookup_assert_desc(table.error_id)); IWL_ERR(fwrt, "0x%08X | umac branchlink1\n", table.blink1); diff --git a/drivers/net/wireless/intel/iwlwifi/fw/img.c b/drivers/net/wire= less/intel/iwlwifi/fw/img.c index 24a9666736913..530674a35eeb2 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/img.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/img.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* - * Copyright(c) 2019 - 2020 Intel Corporation + * Copyright(c) 2019 - 2021 Intel Corporation */ =20 #include "img.h" @@ -49,10 +49,9 @@ u8 iwl_fw_lookup_notif_ver(const struct iwl_fw *fw, u8 g= rp, u8 cmd, u8 def) } EXPORT_SYMBOL_GPL(iwl_fw_lookup_notif_ver); =20 -#define FW_SYSASSERT_CPU_MASK 0xf0000000 static const struct { const char *name; - u8 num; + u32 num; } advanced_lookup[] =3D { { "NMI_INTERRUPT_WDG", 0x34 }, { "SYSASSERT", 0x35 }, @@ -73,6 +72,7 @@ static const struct { { "NMI_INTERRUPT_ACTION_PT", 0x7C }, { "NMI_INTERRUPT_UNKNOWN", 0x84 }, { "NMI_INTERRUPT_INST_ACTION_PT", 0x86 }, + { "PNVM_MISSING", FW_SYSASSERT_PNVM_MISSING }, { "ADVANCED_SYSASSERT", 0 }, }; =20 diff --git a/drivers/net/wireless/intel/iwlwifi/fw/img.h b/drivers/net/wire= less/intel/iwlwifi/fw/img.h index 993bda17fa309..fa7b1780064c2 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/img.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/img.h @@ -279,4 +279,8 @@ u8 iwl_fw_lookup_cmd_ver(const struct iwl_fw *fw, u8 gr= p, u8 cmd, u8 def); =20 u8 iwl_fw_lookup_notif_ver(const struct iwl_fw *fw, u8 grp, u8 cmd, u8 def= ); const char *iwl_fw_lookup_assert_desc(u32 num); + +#define FW_SYSASSERT_CPU_MASK 0xf0000000 +#define FW_SYSASSERT_PNVM_MISSING 0x0010070d + #endif /* __iwl_fw_img_h__ */ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA2D1C3526E for ; Mon, 24 Jan 2022 23:59:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1846001AbiAXX6B (ORCPT ); Mon, 24 Jan 2022 18:58:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847427AbiAXXTr (ORCPT ); Mon, 24 Jan 2022 18:19:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4708C06F8F3; Mon, 24 Jan 2022 13:27:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 5682F614FA; Mon, 24 Jan 2022 21:27:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37E1BC340E8; Mon, 24 Jan 2022 21:27:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059633; bh=gdRe4QpHk0RWhNXsg0cQ8r/uaUlLlCnuVFMUVDFrVS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bL6y+2c+RTAlxEA+TNPhSJHMCULbebhiNOWUTpAUNgxd9DPl+OtGxSfYbvlxSiSfQ Ls2GLGu7wI4tnQmhKDGOKSJtTr8FdUMva5weLCyTu0HjNb4uQ0a8Xx0l/6ER1JoPFK gX2huGEO9mkDDyykzlSU31TuJE/JvBTCldD3ARg4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0681/1039] iwlwifi: fix leaks/bad data after failed firmware load Date: Mon, 24 Jan 2022 19:41:10 +0100 Message-Id: <20220124184148.254769778@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit ab07506b0454bea606095951e19e72c282bfbb42 ] If firmware load fails after having loaded some parts of the firmware, e.g. the IML image, then this would leak. For the host command list we'd end up running into a WARN on the next attempt to load another firmware image. Fix this by calling iwl_dealloc_ucode() on failures, and make that also clear the data so we start fresh on the next round. Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211210110539.1f742f0eb58a.I1315f2= 2f6aa632d94ae2069f85e1bca5e734dce0@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wir= eless/intel/iwlwifi/iwl-drv.c index 5cec467b995bb..ad94526a4e1e7 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -130,6 +130,9 @@ static void iwl_dealloc_ucode(struct iwl_drv *drv) =20 for (i =3D 0; i < IWL_UCODE_TYPE_MAX; i++) iwl_free_fw_img(drv, drv->fw.img + i); + + /* clear the data for the aborted load case */ + memset(&drv->fw, 0, sizeof(drv->fw)); } =20 static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc, @@ -1375,6 +1378,7 @@ static void iwl_req_fw_callback(const struct firmware= *ucode_raw, void *context) int i; bool load_module =3D false; bool usniffer_images =3D false; + bool failure =3D true; =20 fw->ucode_capa.max_probe_length =3D IWL_DEFAULT_MAX_PROBE_LENGTH; fw->ucode_capa.standard_phy_calibration_size =3D @@ -1644,6 +1648,7 @@ static void iwl_req_fw_callback(const struct firmware= *ucode_raw, void *context) op->name, err); #endif } + failure =3D false; goto free; =20 try_again: @@ -1659,6 +1664,9 @@ static void iwl_req_fw_callback(const struct firmware= *ucode_raw, void *context) complete(&drv->request_firmware_complete); device_release_driver(drv->trans->dev); free: + if (failure) + iwl_dealloc_ucode(drv); + if (pieces) { for (i =3D 0; i < ARRAY_SIZE(pieces->img); i++) kfree(pieces->img[i].sec); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC486C4332F for ; Mon, 24 Jan 2022 22:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584732AbiAXWVi (ORCPT ); Mon, 24 Jan 2022 17:21:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42502 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452905AbiAXV1W (ORCPT ); Mon, 24 Jan 2022 16:27:22 -0500 Received: from smtp.kernel.org (relay.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 F20BBB812A5; Mon, 24 Jan 2022 21:27:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19136C340E4; Mon, 24 Jan 2022 21:27:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059639; bh=Fx/sNdMmIck3JScTDW/y+z6oGo4OB0WD0tkuFaVyqCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KOAriap2AXEkGbgILJwbfOFs5ISwqa20a5ymCbuZ7vkMGo7RKz3sxpa8pzKgCp2tH SODtiyAbCmIUgY1kgjh8eHWJErzVh7Ylv5Dj+45gvHMAMrVMDWv0DKYSXQ6YwRLsey FWqU6Wn8gdv3uRd/BYtMIE9hHChPB4zjU4Sbjwn0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0682/1039] iwlwifi: remove module loading failure message Date: Mon, 24 Jan 2022 19:41:11 +0100 Message-Id: <20220124184148.283824646@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit 6518f83ffa51131daaf439b66094f684da3fb0ae ] When CONFIG_DEBUG_TEST_DRIVER_REMOVE is set, iwlwifi crashes when the opmode module cannot be loaded, due to completing the completion before using drv->dev, which can then already be freed. Fix this by removing the (fairly useless) message. Moving the completion later causes a deadlock instead, so that's not an option. Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/20211210091245.289008-2-luca@coelho.fi Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wir= eless/intel/iwlwifi/iwl-drv.c index ad94526a4e1e7..f53ce9c086947 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -1639,15 +1639,8 @@ static void iwl_req_fw_callback(const struct firmwar= e *ucode_raw, void *context) * else from proceeding if the module fails to load * or hangs loading. */ - if (load_module) { + if (load_module) request_module("%s", op->name); -#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR - if (err) - IWL_ERR(drv, - "failed to load module %s (error %d), is dynamic loading enabled?\n", - op->name, err); -#endif - } failure =3D false; goto free; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 955E9C433EF for ; Mon, 24 Jan 2022 22:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584685AbiAXWVd (ORCPT ); Mon, 24 Jan 2022 17:21:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47434 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452938AbiAXV12 (ORCPT ); Mon, 24 Jan 2022 16:27:28 -0500 Received: from smtp.kernel.org (relay.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 3FF9C61469; Mon, 24 Jan 2022 21:27:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C558C340E4; Mon, 24 Jan 2022 21:27:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059642; bh=slkzV2uCi161ff2FMYKOSO9pXjF+rfhmk/CRWGQotis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1k8O7klpE1iS54jCJvKfEfEdzJgSFTcTH/Lt6K+XjxqU5q0Nw4AiIn/FJE/yxHDOM QqbbX4C4sKoUhF45+OCB2VVjEs1z8e0TMe5dDcA1EMLWeU4X5PGt1FPagTizXju6JO ivzl+RoKlz5K7NSLsH/SZknyXUEW9oiVPF/mMh8o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilan Peer , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0683/1039] iwlwifi: mvm: Fix calculation of frame length Date: Mon, 24 Jan 2022 19:41:12 +0100 Message-Id: <20220124184148.313794057@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ilan Peer [ Upstream commit 40a0b38d7a7f91a6027287e0df54f5f547e8d27e ] The RADA might include in the Rx frame the MIC and CRC bytes. These bytes should be removed for non monitor interfaces and should not be passed to mac80211. Fix the Rx processing to remove the extra bytes on non monitor cases. Signed-off-by: Ilan Peer Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211219121514.098be12c801e.I1d8173= 3d8a75b84c3b20eb6e0d14ab3405ca6a86@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wi= reless/intel/iwlwifi/mvm/rxmq.c index e0601f802628c..1e2a55ccf1926 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c @@ -121,12 +121,39 @@ static int iwl_mvm_create_skb(struct iwl_mvm *mvm, st= ruct sk_buff *skb, struct iwl_rx_mpdu_desc *desc =3D (void *)pkt->data; unsigned int headlen, fraglen, pad_len =3D 0; unsigned int hdrlen =3D ieee80211_hdrlen(hdr->frame_control); + u8 mic_crc_len =3D u8_get_bits(desc->mac_flags1, + IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK) << 1; =20 if (desc->mac_flags2 & IWL_RX_MPDU_MFLG2_PAD) { len -=3D 2; pad_len =3D 2; } =20 + /* + * For non monitor interface strip the bytes the RADA might not have + * removed. As monitor interface cannot exist with other interfaces + * this removal is safe. + */ + if (mic_crc_len && !ieee80211_hw_check(mvm->hw, RX_INCLUDES_FCS)) { + u32 pkt_flags =3D le32_to_cpu(pkt->len_n_flags); + + /* + * If RADA was not enabled then decryption was not performed so + * the MIC cannot be removed. + */ + if (!(pkt_flags & FH_RSCSR_RADA_EN)) { + if (WARN_ON(crypt_len > mic_crc_len)) + return -EINVAL; + + mic_crc_len -=3D crypt_len; + } + + if (WARN_ON(mic_crc_len > len)) + return -EINVAL; + + len -=3D mic_crc_len; + } + /* If frame is small enough to fit in skb->head, pull it completely. * If not, only pull ieee80211_hdr (including crypto if present, and * an additional 8 bytes for SNAP/ethertype, see below) so that --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BF04C43219 for ; Mon, 24 Jan 2022 22:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580315AbiAXWO5 (ORCPT ); Mon, 24 Jan 2022 17:14:57 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47454 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452950AbiAXV12 (ORCPT ); Mon, 24 Jan 2022 16:27:28 -0500 Received: from smtp.kernel.org (relay.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 1AF28614D8; Mon, 24 Jan 2022 21:27:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0476C340E4; Mon, 24 Jan 2022 21:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059645; bh=TmhTFttc8Wf3beYe9Qj83vMhnXvOXEgoEjdWci6e82c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xufJA65QG6bAAcwp4gNkJeEe1rBp85oHkoGLMzwWQrfZWtFaIfuZE5YTMA1MkUps8 aa4iV6mxAgZJBY9N1x9jkCF8TBOrljliXOLRjnw3uF5cSZDxvFOWsibLZQBN0EZhIc Enn+hS99RpT6HYymrZEbTT26zDia3494/Ex+2pg8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avraham Stern , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0684/1039] iwlwifi: mvm: fix AUX ROC removal Date: Mon, 24 Jan 2022 19:41:13 +0100 Message-Id: <20220124184148.345357324@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Avraham Stern [ Upstream commit f0337cb48f3bf5f0bbccc985d8a0a8c4aa4934b7 ] When IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD is set, removing a time event always tries to cancel session protection. However, AUX ROC does not use session protection so it was never removed. As a result, if the driver tries to allocate another AUX ROC event right after cancelling the first one, it will fail with a warning. In addition, the time event data passed to iwl_mvm_remove_aux_roc_te() is incorrect. Fix it. Signed-off-by: Avraham Stern Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211219132536.915e1f69f062.Id837e9= 17f1c2beaca7c1eb33333d622548918a76@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/mvm/time-event.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c b/drivers/= net/wireless/intel/iwlwifi/mvm/time-event.c index b8c645b9880fc..ab06dcda1462a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c @@ -696,11 +696,14 @@ static bool __iwl_mvm_remove_time_event(struct iwl_mv= m *mvm, iwl_mvm_te_clear_data(mvm, te_data); spin_unlock_bh(&mvm->time_event_lock); =20 - /* When session protection is supported, the te_data->id field + /* When session protection is used, the te_data->id field * is reused to save session protection's configuration. + * For AUX ROC, HOT_SPOT_CMD is used and the te_data->id field is set + * to HOT_SPOT_CMD. */ if (fw_has_capa(&mvm->fw->ucode_capa, - IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD)) { + IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD) && + id !=3D HOT_SPOT_CMD) { if (mvmvif && id < SESSION_PROTECT_CONF_MAX_ID) { /* Session protection is still ongoing. Cancel it */ iwl_mvm_cancel_session_protection(mvm, mvmvif, id); @@ -1036,7 +1039,7 @@ void iwl_mvm_stop_roc(struct iwl_mvm *mvm, struct iee= e80211_vif *vif) iwl_mvm_p2p_roc_finished(mvm); } else { iwl_mvm_remove_aux_roc_te(mvm, mvmvif, - &mvmvif->time_event_data); + &mvmvif->hs_time_event_data); iwl_mvm_roc_finished(mvm); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDEF3C433FE for ; Mon, 24 Jan 2022 22:14:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581686AbiAXWMK (ORCPT ); Mon, 24 Jan 2022 17:12:10 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42586 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452970AbiAXV1b (ORCPT ); Mon, 24 Jan 2022 16:27:31 -0500 Received: from smtp.kernel.org (relay.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 9FCA2B81218; Mon, 24 Jan 2022 21:27:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6292C340E4; Mon, 24 Jan 2022 21:27:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059648; bh=t24xaTbX/YPgqubRwPSZulUBEsrmp1dBDxvvqQabvmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tg4X64ZC96dazK6u20I8v7YGFaxr/eyAldXPyzavse1p7mth+gc9hK/behkJ9xZCd fhTYm1mKFMqflsLDf+WcVpvrB2qPzAyVw6cw9JjQlanoKjV84Y3PefhTYApsTXL0wz ZlJAcwQbRo8M3ersHzwhujodAI+KI255FpmRyxt4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0685/1039] iwlwifi: pcie: make sure prph_info is set when treating wakeup IRQ Date: Mon, 24 Jan 2022 19:41:14 +0100 Message-Id: <20220124184148.376711013@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luca Coelho [ Upstream commit 459fc0f2c6b0f6e280bfa0f230c100c9dfe3a199 ] In some rare cases when the HW is in a bad state, we may get this interrupt when prph_info is not set yet. Then we will try to dereference it to check the sleep_notif element, which will cause an oops. Fix that by ignoring the interrupt if prph_info is not set yet. Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211219132536.0537aa562313.I183bb3= 36345b9b3da196ba9e596a6f189fbcbd09@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wir= eless/intel/iwlwifi/pcie/rx.c index 14602d6d6699f..8247014278f30 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c @@ -2266,7 +2266,12 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void = *dev_id) } } =20 - if (inta_hw & MSIX_HW_INT_CAUSES_REG_WAKEUP) { + /* + * In some rare cases when the HW is in a bad state, we may + * get this interrupt too early, when prph_info is still NULL. + * So make sure that it's not NULL to prevent crashing. + */ + if (inta_hw & MSIX_HW_INT_CAUSES_REG_WAKEUP && trans_pcie->prph_info) { u32 sleep_notif =3D le32_to_cpu(trans_pcie->prph_info->sleep_notif); if (sleep_notif =3D=3D IWL_D3_SLEEP_STATUS_SUSPEND || --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C34ADC35271 for ; Mon, 24 Jan 2022 22:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581670AbiAXWMI (ORCPT ); Mon, 24 Jan 2022 17:12:08 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42630 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452982AbiAXV1e (ORCPT ); Mon, 24 Jan 2022 16:27:34 -0500 Received: from smtp.kernel.org (relay.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 8864EB812A4; Mon, 24 Jan 2022 21:27:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD833C340E4; Mon, 24 Jan 2022 21:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059651; bh=xsfclcnth22emOhXnExQDbZEHeQPjA9k8JwPqBUjW/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n4r861l2MbFnMSWcVg9r9tzjUx8+7+9LIk8QYvKHuYcbfeE639m06Cm+EarP8SV78 iQhbk0PeuekaaqQ1amkkZy8BICGj+NzNLzBOoPyQVaBcx4P/U0tXkT/eyr4CJZIi9r AriZoxioNS523DF8MdXxsgwtN4uNXvc659WdVrws= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Hector Martin , Ulf Hansson , Sasha Levin Subject: [PATCH 5.16 0686/1039] mmc: sdhci-pci-gli: GL9755: Support for CD/WP inversion on OF platforms Date: Mon, 24 Jan 2022 19:41:15 +0100 Message-Id: <20220124184148.413659573@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 189f1d9bc3a5ea3e442e119e4a5deda63da8c462 ] This is required on some Apple ARM64 laptops using this controller. As is typical on DT platforms, pull these quirks from the device tree using the standard mmc bindings. See Documentation/devicetree/bindings/mmc/mmc-controller.yaml Acked-by: Adrian Hunter Signed-off-by: Hector Martin Link: https://lore.kernel.org/r/20211215161045.38843-2-marcan@marcan.st Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mmc/host/sdhci-pci-gli.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mmc/host/sdhci-pci-gli.c b/drivers/mmc/host/sdhci-pci-= gli.c index 4fd99c1e82ba3..ad50f16658fe2 100644 --- a/drivers/mmc/host/sdhci-pci-gli.c +++ b/drivers/mmc/host/sdhci-pci-gli.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "sdhci.h" #include "sdhci-pci.h" #include "cqhci.h" @@ -116,6 +117,8 @@ #define PCI_GLI_9755_PECONF 0x44 #define PCI_GLI_9755_LFCLK GENMASK(14, 12) #define PCI_GLI_9755_DMACLK BIT(29) +#define PCI_GLI_9755_INVERT_CD BIT(30) +#define PCI_GLI_9755_INVERT_WP BIT(31) =20 #define PCI_GLI_9755_CFG2 0x48 #define PCI_GLI_9755_CFG2_L1DLY GENMASK(28, 24) @@ -570,6 +573,14 @@ static void gl9755_hw_setting(struct sdhci_pci_slot *s= lot) gl9755_wt_on(pdev); =20 pci_read_config_dword(pdev, PCI_GLI_9755_PECONF, &value); + /* + * Apple ARM64 platforms using these chips may have + * inverted CD/WP detection. + */ + if (of_property_read_bool(pdev->dev.of_node, "cd-inverted")) + value |=3D PCI_GLI_9755_INVERT_CD; + if (of_property_read_bool(pdev->dev.of_node, "wp-inverted")) + value |=3D PCI_GLI_9755_INVERT_WP; value &=3D ~PCI_GLI_9755_LFCLK; value &=3D ~PCI_GLI_9755_DMACLK; pci_write_config_dword(pdev, PCI_GLI_9755_PECONF, value); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85E96C433F5 for ; Mon, 24 Jan 2022 22:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581708AbiAXWMM (ORCPT ); Mon, 24 Jan 2022 17:12:12 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47554 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452996AbiAXV1f (ORCPT ); Mon, 24 Jan 2022 16:27:35 -0500 Received: from smtp.kernel.org (relay.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 C1F60614C9; Mon, 24 Jan 2022 21:27:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4271C340E4; Mon, 24 Jan 2022 21:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059654; bh=UND6nXt7n9+NZjYujgAg5y31VQ9oBzFhCxZj4nu5wWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N4X6EQXZ0QFlxeNo3KxFYdrpLTVICAO7xlufT3AQ0lqIWKlit9/5Zu6yytPWiTGUO 0BOrz7lG6b6en7S7WzqQACHmZG4CIL0iIWfvplZKfsz2znRFf2jANvhdRpV7jFFQB/ KBLZmuY3IUMQU9p8jWoLw3BIJR8WYJo9c10Q1k78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, wangyangbo , Tetsuo Handa , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.16 0687/1039] block: check minor range in device_add_disk() Date: Mon, 24 Jan 2022 19:41:16 +0100 Message-Id: <20220124184148.446317970@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa [ Upstream commit e338924bd05d6e71574bc13e310c89e10e49a8a5 ] ioctl(fd, LOOP_CTL_ADD, 1048576) causes sysfs: cannot create duplicate filename '/dev/block/7:0' message because such request is treated as if ioctl(fd, LOOP_CTL_ADD, 0) due to MINORMASK =3D=3D 1048575. Verify that all minor numbers for that dev= ice fit in the minor range. Reported-by: wangyangbo Signed-off-by: Tetsuo Handa Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/b1b19379-23ee-5379-0eb5-94bf5f79f1b4@i-love= .sakura.ne.jp Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- block/genhd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/genhd.c b/block/genhd.c index 596e43764846b..5308e0920fa6f 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -425,6 +425,8 @@ int __must_check device_add_disk(struct device *parent,= struct gendisk *disk, DISK_MAX_PARTS); disk->minors =3D DISK_MAX_PARTS; } + if (disk->first_minor + disk->minors > MINORMASK + 1) + return -EINVAL; } else { if (WARN_ON(disk->minors)) return -EINVAL; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34209C433FE for ; Mon, 24 Jan 2022 22:13:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236811AbiAXWMx (ORCPT ); Mon, 24 Jan 2022 17:12:53 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50676 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451660AbiAXV3p (ORCPT ); Mon, 24 Jan 2022 16:29:45 -0500 Received: from smtp.kernel.org (relay.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 34B2C61305; Mon, 24 Jan 2022 21:29:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1343BC340E4; Mon, 24 Jan 2022 21:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059780; bh=SwHp8z8g4fBVnumYsGHPVujRk5tCwr58kzWwwIKJFhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VJD0xApYCYxxTwD3epLbrrLDHpNpOcV2rS8tXmNfd+mp2Mk6O0eC0FIUUaGspuzNd wfSv+m1YojXDXXiLJfuaTQJsWLZ7LYYxmLRO7pMYR5XeCJ/BhVKTm90/QjT6jUs6Zt F+Rsgi+vymIoOGjZN07e6XD9LDbX4fWpfaNcRTnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Jeff Dike , Richard Weinberger , Anton Ivanov , linux-um@lists.infradead.org, Sasha Levin Subject: [PATCH 5.16 0688/1039] um: registers: Rename function names to avoid conflicts and build problems Date: Mon, 24 Jan 2022 19:41:17 +0100 Message-Id: <20220124184148.478052926@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 077b7320942b64b0da182aefd83c374462a65535 ] The function names init_registers() and restore_registers() are used in several net/ethernet/ and gpu/drm/ drivers for other purposes (not calls to UML functions), so rename them. This fixes multiple build errors. Signed-off-by: Randy Dunlap Cc: Jeff Dike Cc: Richard Weinberger Cc: Anton Ivanov Cc: linux-um@lists.infradead.org Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/um/include/shared/registers.h | 4 ++-- arch/um/os-Linux/registers.c | 4 ++-- arch/um/os-Linux/start_up.c | 2 +- arch/x86/um/syscalls_64.c | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/um/include/shared/registers.h b/arch/um/include/shared/re= gisters.h index 0c50fa6e8a55b..fbb709a222839 100644 --- a/arch/um/include/shared/registers.h +++ b/arch/um/include/shared/registers.h @@ -16,8 +16,8 @@ extern int restore_fp_registers(int pid, unsigned long *f= p_regs); extern int save_fpx_registers(int pid, unsigned long *fp_regs); extern int restore_fpx_registers(int pid, unsigned long *fp_regs); extern int save_registers(int pid, struct uml_pt_regs *regs); -extern int restore_registers(int pid, struct uml_pt_regs *regs); -extern int init_registers(int pid); +extern int restore_pid_registers(int pid, struct uml_pt_regs *regs); +extern int init_pid_registers(int pid); extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs= ); extern unsigned long get_thread_reg(int reg, jmp_buf *buf); extern int get_fp_registers(int pid, unsigned long *regs); diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c index 2d9270508e156..b123955be7acc 100644 --- a/arch/um/os-Linux/registers.c +++ b/arch/um/os-Linux/registers.c @@ -21,7 +21,7 @@ int save_registers(int pid, struct uml_pt_regs *regs) return 0; } =20 -int restore_registers(int pid, struct uml_pt_regs *regs) +int restore_pid_registers(int pid, struct uml_pt_regs *regs) { int err; =20 @@ -36,7 +36,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs) static unsigned long exec_regs[MAX_REG_NR]; static unsigned long exec_fp_regs[FP_SIZE]; =20 -int init_registers(int pid) +int init_pid_registers(int pid) { int err; =20 diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index 8a72c99994eb1..e3ee4db58b40d 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c @@ -368,7 +368,7 @@ void __init os_early_checks(void) check_tmpexec(); =20 pid =3D start_ptraced_child(); - if (init_registers(pid)) + if (init_pid_registers(pid)) fatal("Failed to initialize default registers"); stop_ptraced_child(pid, 1, 1); } diff --git a/arch/x86/um/syscalls_64.c b/arch/x86/um/syscalls_64.c index 58f51667e2e4b..8249685b40960 100644 --- a/arch/x86/um/syscalls_64.c +++ b/arch/x86/um/syscalls_64.c @@ -11,6 +11,7 @@ #include #include /* XXX This should get the constants from libc */ #include +#include =20 long arch_prctl(struct task_struct *task, int option, unsigned long __user *arg2) @@ -35,7 +36,7 @@ long arch_prctl(struct task_struct *task, int option, switch (option) { case ARCH_SET_FS: case ARCH_SET_GS: - ret =3D restore_registers(pid, ¤t->thread.regs.regs); + ret =3D restore_pid_registers(pid, ¤t->thread.regs.regs); if (ret) return ret; break; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D51BFC35272 for ; Mon, 24 Jan 2022 22:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581723AbiAXWMO (ORCPT ); Mon, 24 Jan 2022 17:12:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42946 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453085AbiAXV2C (ORCPT ); Mon, 24 Jan 2022 16:28:02 -0500 Received: from smtp.kernel.org (relay.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 982E7B80FA1; Mon, 24 Jan 2022 21:27:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD1E2C340E4; Mon, 24 Jan 2022 21:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059677; bh=wvGjveaiDauudlfPDCVKE8+VhapA9ez4NKE2gofdcNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TfPSqpYg8iWAVjFXTa0bqOJAuINbVEeUzOrzbTNZSTIHalaY/++bsgOw2DmPmt1lw NmquuYng65gCqLhi3tAw3qUA0st/NM/oyPrz8go3dkWuvmPyAQxujG9s8gaTnAqxtJ kqrPu0HXb29PIru7DH7zIEwTzhMDTHmHV24ZE43I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Greear , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0689/1039] ath11k: Fix napi related hang Date: Mon, 24 Jan 2022 19:41:18 +0100 Message-Id: <20220124184148.509793510@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Greear [ Upstream commit d943fdad7589653065be0e20aadc6dff37725ed4 ] Similar to the same bug in ath10k, a napi disable w/out it being enabled will hang forever. I believe I saw this while trying rmmod after driver had some failure on startup. Fix it by keeping state on whether napi is enabled or not. And, remove un-used napi pointer in ath11k driver base struct. Signed-off-by: Ben Greear Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200903195254.29379-1-greearb@candelatech.= com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/ahb.c | 12 +++++++++--- drivers/net/wireless/ath/ath11k/core.h | 2 +- drivers/net/wireless/ath/ath11k/pci.c | 12 +++++++++--- 3 files changed, 19 insertions(+), 7 deletions(-) --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c @@ -175,8 +175,11 @@ static void __ath11k_ahb_ext_irq_disable =20 ath11k_ahb_ext_grp_disable(irq_grp); =20 - napi_synchronize(&irq_grp->napi); - napi_disable(&irq_grp->napi); + if (irq_grp->napi_enabled) { + napi_synchronize(&irq_grp->napi); + napi_disable(&irq_grp->napi); + irq_grp->napi_enabled =3D false; + } } } =20 @@ -300,7 +303,10 @@ static void ath11k_ahb_ext_irq_enable(st for (i =3D 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { struct ath11k_ext_irq_grp *irq_grp =3D &ab->ext_irq_grp[i]; =20 - napi_enable(&irq_grp->napi); + if (!irq_grp->napi_enabled) { + napi_enable(&irq_grp->napi); + irq_grp->napi_enabled =3D true; + } ath11k_ahb_ext_grp_enable(irq_grp); } } --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -141,6 +141,7 @@ struct ath11k_ext_irq_grp { u32 num_irq; u32 grp_id; u64 timestamp; + bool napi_enabled; struct napi_struct napi; struct net_device napi_ndev; }; @@ -718,7 +719,6 @@ struct ath11k_base { u32 wlan_init_status; int irq_num[ATH11K_IRQ_NUM_MAX]; struct ath11k_ext_irq_grp ext_irq_grp[ATH11K_EXT_IRQ_GRP_NUM_MAX]; - struct napi_struct *napi; struct ath11k_targ_cap target_caps; u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE]; bool pdevs_macaddr_valid; --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -638,8 +638,11 @@ static void __ath11k_pci_ext_irq_disable =20 ath11k_pci_ext_grp_disable(irq_grp); =20 - napi_synchronize(&irq_grp->napi); - napi_disable(&irq_grp->napi); + if (irq_grp->napi_enabled) { + napi_synchronize(&irq_grp->napi); + napi_disable(&irq_grp->napi); + irq_grp->napi_enabled =3D false; + } } } =20 @@ -658,7 +661,10 @@ static void ath11k_pci_ext_irq_enable(st for (i =3D 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { struct ath11k_ext_irq_grp *irq_grp =3D &ab->ext_irq_grp[i]; =20 - napi_enable(&irq_grp->napi); + if (!irq_grp->napi_enabled) { + napi_enable(&irq_grp->napi); + irq_grp->napi_enabled =3D true; + } ath11k_pci_ext_grp_enable(irq_grp); } } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9986EC433EF for ; Tue, 25 Jan 2022 00:05:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2368847AbiAYAAP (ORCPT ); Mon, 24 Jan 2022 19:00:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847701AbiAXXUX (ORCPT ); Mon, 24 Jan 2022 18:20:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC4CCC028BE4; Mon, 24 Jan 2022 13:28:31 -0800 (PST) Received: from smtp.kernel.org (relay.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 4996D614DD; Mon, 24 Jan 2022 21:28:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DA93C340E5; Mon, 24 Jan 2022 21:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059710; bh=S3oWCTD/UPBgHiBeKcRHNlnH9qKO6/9FriHWj32grDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jTuBxhcbIv9cIuCyHfTebxWS5HhMnY88IoQhs/NwHmdeDAXwZZFLpadRSvHZFhf43 1piDxRoY4aNWOCCWiJsTAFzt9E45qILz1lvyT/F2QZ193YUz1F00g9DR5O5E0R44TG itFjqPp6DyfwwQ9D5YDwIJ6k4wiEkT9NdxeWIquI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tedd Ho-Jeong An , Luiz Augusto von Dentz , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0690/1039] Bluetooth: btintel: Add missing quirks and msft ext for legacy bootloader Date: Mon, 24 Jan 2022 19:41:19 +0100 Message-Id: <20220124184148.539751242@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tedd Ho-Jeong An [ Upstream commit 3547a008c8962df2175db1e78b80f27e027ec549 ] This patch add missing HCI quirks and MSFT extension for legacy bootloader when it is running in the operational firmware. Signed-off-by: Tedd Ho-Jeong An Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bluetooth/btintel.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index b11567b0fd9ab..851a0c9b8fae5 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -2493,10 +2493,14 @@ static int btintel_setup_combined(struct hci_dev *h= dev) case 0x12: /* ThP */ case 0x13: /* HrP */ case 0x14: /* CcP */ - /* Some legacy bootloader devices from JfP supports both old - * and TLV based HCI_Intel_Read_Version command. But we don't - * want to use the TLV based setup routines for those legacy - * bootloader device. + /* Some legacy bootloader devices starting from JfP, + * the operational firmware supports both old and TLV based + * HCI_Intel_Read_Version command based on the command + * parameter. + * + * For upgrading firmware case, the TLV based version cannot + * be used because the firmware filename for legacy bootloader + * is based on the old format. * * Also, it is not easy to convert TLV based version from the * legacy version format. @@ -2508,6 +2512,20 @@ static int btintel_setup_combined(struct hci_dev *hd= ev) err =3D btintel_read_version(hdev, &ver); if (err) return err; + + /* Apply the device specific HCI quirks + * + * All Legacy bootloader devices support WBS + */ + set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); + + /* Valid LE States quirk for JfP/ThP familiy */ + if (ver.hw_variant =3D=3D 0x11 || ver.hw_variant =3D=3D 0x12) + set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); + + /* Setup MSFT Extension support */ + btintel_set_msft_opcode(hdev, ver.hw_variant); + err =3D btintel_bootloader_setup(hdev, &ver); break; case 0x17: --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25650C433F5 for ; Tue, 25 Jan 2022 00:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371976AbiAYAKR (ORCPT ); Mon, 24 Jan 2022 19:10:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848335AbiAXXWP (ORCPT ); Mon, 24 Jan 2022 18:22:15 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B897C01D7CF; Mon, 24 Jan 2022 13:29:03 -0800 (PST) Received: from smtp.kernel.org (relay.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 1801461500; Mon, 24 Jan 2022 21:29:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB4ACC33E60; Mon, 24 Jan 2022 21:29:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059742; bh=XEBpaPbYCRhgT9ik4uDmR4UvypnIw4Bm8lNnbHJKlNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T1Y8RKxcCcU0iivQgxXqKysMbS+DPvCgV4WCWzPZuHJ3gGyjZIHbJOHETjrYsd7OH Yv+9DzkFmaSU5fWnKOVaFPFEa4dJ+aEDQy3PXkdQt26/i3B1hepF2juYTRif0/6Tdx LlmaxZHbpwIoc1T837cN4JMSqPSRK8YCmpLggHtE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Pandruvada , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0691/1039] cpufreq: intel_pstate: Update cpuinfo.max_freq on HWP_CAP changes Date: Mon, 24 Jan 2022 19:41:20 +0100 Message-Id: <20220124184148.573035013@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki [ Upstream commit dfeeedc1bf5772226bddf51ed3f853e5a6707bf1 ] With HWP enabled, when the turbo range of performance levels is disabled by the platform firmware, the CPU capacity is given by the "guaranteed performance" field in MSR_HWP_CAPABILITIES which is generally dynamic. When it changes, the kernel receives an HWP notification interrupt handled by notify_hwp_interrupt(). When the "guaranteed performance" value changes in the above configuration, the CPU performance scaling needs to be adjusted so as to use the new CPU capacity in computations, which means that the cpuinfo.max_freq value needs to be updated for that CPU. Accordingly, modify intel_pstate_notify_work() to read MSR_HWP_CAPABILITIES and update cpuinfo.max_freq to reflect the new configuration (this update can be carried out even if the configuration doesn't actually change, because it simply doesn't matter then and it takes less time to update it than to do extra checks to decide whether or not a change has really occurred). Reported-by: Srinivas Pandruvada Tested-by: Srinivas Pandruvada Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/cpufreq/intel_pstate.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index dec2a5649ac1a..676edc580fd4f 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -1124,19 +1124,22 @@ static void intel_pstate_update_policies(void) cpufreq_update_policy(cpu); } =20 +static void __intel_pstate_update_max_freq(struct cpudata *cpudata, + struct cpufreq_policy *policy) +{ + policy->cpuinfo.max_freq =3D global.turbo_disabled_mf ? + cpudata->pstate.max_freq : cpudata->pstate.turbo_freq; + refresh_frequency_limits(policy); +} + static void intel_pstate_update_max_freq(unsigned int cpu) { struct cpufreq_policy *policy =3D cpufreq_cpu_acquire(cpu); - struct cpudata *cpudata; =20 if (!policy) return; =20 - cpudata =3D all_cpu_data[cpu]; - policy->cpuinfo.max_freq =3D global.turbo_disabled_mf ? - cpudata->pstate.max_freq : cpudata->pstate.turbo_freq; - - refresh_frequency_limits(policy); + __intel_pstate_update_max_freq(all_cpu_data[cpu], policy); =20 cpufreq_cpu_release(policy); } @@ -1584,8 +1587,15 @@ static void intel_pstate_notify_work(struct work_str= uct *work) { struct cpudata *cpudata =3D container_of(to_delayed_work(work), struct cpudata, hwp_notify_work); + struct cpufreq_policy *policy =3D cpufreq_cpu_acquire(cpudata->cpu); + + if (policy) { + intel_pstate_get_hwp_cap(cpudata); + __intel_pstate_update_max_freq(cpudata, policy); + + cpufreq_cpu_release(policy); + } =20 - cpufreq_update_policy(cpudata->cpu); wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_STATUS, 0); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E36EC43217 for ; Tue, 25 Jan 2022 00:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372811AbiAYAMd (ORCPT ); Mon, 24 Jan 2022 19:12:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384582AbiAXXYB (ORCPT ); Mon, 24 Jan 2022 18:24:01 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A21EC073090; Mon, 24 Jan 2022 13:29:25 -0800 (PST) Received: from smtp.kernel.org (relay.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 62454B8105C; Mon, 24 Jan 2022 21:29:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B7A2C36AE9; Mon, 24 Jan 2022 21:29:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059763; bh=PT9cOZRjZokQfTIoZoyk+ac+Lh97j0RFBNiuxEnwne8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hdDPTGiiq2swvGhWrDVDwnNYkp28PpotciFMI0U2UW1fiHAdIcC7/8hBoL9uEM2Ce BKUi7G2rCtej7Rz/cnAl8kGixMRL8S7A9mTG2uvG+rvRovK3VsvMeyIaJvsGYFULY+ PK6mniXRmZRsst/h8MrTdvHQfNa2qV45xI8bp/08= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0692/1039] Bluetooth: vhci: Set HCI_QUIRK_VALID_LE_STATES Date: Mon, 24 Jan 2022 19:41:21 +0100 Message-Id: <20220124184148.603873277@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luiz Augusto von Dentz [ Upstream commit cfb4c313be670fd4bd09650216620fa4514cdb93 ] This set HCI_QUIRK_VALID_LE_STATES quirk which is required for the likes of experimental LE simultaneous roles. Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bluetooth/hci_vhci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index 5fd91106e853d..95af01bdd02a2 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c @@ -239,6 +239,8 @@ static int __vhci_create_device(struct vhci_data *data,= __u8 opcode) if (opcode & 0x80) set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); =20 + set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); + if (hci_register_dev(hdev) < 0) { BT_ERR("Can't register HCI device"); hci_free_dev(hdev); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EF94C4167E for ; Tue, 25 Jan 2022 00:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372350AbiAYALP (ORCPT ); Mon, 24 Jan 2022 19:11:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385396AbiAXXYB (ORCPT ); Mon, 24 Jan 2022 18:24:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DA6EC073097; Mon, 24 Jan 2022 13:29:27 -0800 (PST) Received: from smtp.kernel.org (relay.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 83BA5614F3; Mon, 24 Jan 2022 21:29:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C455C36AEC; Mon, 24 Jan 2022 21:29:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059766; bh=hs/4BjS1c67sMV1LK+ukRvL6xXHdNnpzTCQnS+Lr54w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rU++z2M6vELPMqrZ3qDEf5flcyxrU7hlxMC44TYgPArrLvH6mTlmiyEe9k66FilaP HZwhW2tmg6Dqkauo9szbIk3knjGIphbARNbz6M8Nh6vsTv5+8fJXWo8l7krnI4GAPG b04wOLKTmz8qq9lej0sCseLiV/OaD/5RNcfn8rcY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Egerer , Antony Antony , Steffen Klassert , Sasha Levin Subject: [PATCH 5.16 0693/1039] xfrm: rate limit SA mapping change message to user space Date: Mon, 24 Jan 2022 19:41:22 +0100 Message-Id: <20220124184148.634792709@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antony Antony [ Upstream commit 4e484b3e969b52effd95c17f7a86f39208b2ccf4 ] Kernel generates mapping change message, XFRM_MSG_MAPPING, when a source port chage is detected on a input state with UDP encapsulation set. Kernel generates a message for each IPsec packet with new source port. For a high speed flow per packet mapping change message can be excessive, and can overload the user space listener. Introduce rate limiting for XFRM_MSG_MAPPING message to the user space. The rate limiting is configurable via netlink, when adding a new SA or updating it. Use the new attribute XFRMA_MTIMER_THRESH in seconds. v1->v2 change: update xfrm_sa_len() v2->v3 changes: use u32 insted unsigned long to reduce size of struct xfrm_state fix xfrm_ompat size Reported-by: kernel test robot accept XFRM_MSG_MAPPING only when XFRMA_ENCAP is present Co-developed-by: Thomas Egerer Signed-off-by: Thomas Egerer Signed-off-by: Antony Antony Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/net/xfrm.h | 5 +++++ include/uapi/linux/xfrm.h | 1 + net/xfrm/xfrm_compat.c | 6 ++++-- net/xfrm/xfrm_state.c | 23 ++++++++++++++++++++++- net/xfrm/xfrm_user.c | 18 +++++++++++++++++- 5 files changed, 49 insertions(+), 4 deletions(-) diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 2308210793a01..2589e4c0501bd 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -200,6 +200,11 @@ struct xfrm_state { struct xfrm_algo_aead *aead; const char *geniv; =20 + /* mapping change rate limiting */ + __be16 new_mapping_sport; + u32 new_mapping; /* seconds */ + u32 mapping_maxage; /* seconds for input SA */ + /* Data for encapsulator */ struct xfrm_encap_tmpl *encap; struct sock __rcu *encap_sk; diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h index eda0426ec4c2b..4e29d78518902 100644 --- a/include/uapi/linux/xfrm.h +++ b/include/uapi/linux/xfrm.h @@ -313,6 +313,7 @@ enum xfrm_attr_type_t { XFRMA_SET_MARK, /* __u32 */ XFRMA_SET_MARK_MASK, /* __u32 */ XFRMA_IF_ID, /* __u32 */ + XFRMA_MTIMER_THRESH, /* __u32 in seconds for input SA */ __XFRMA_MAX =20 #define XFRMA_OUTPUT_MARK XFRMA_SET_MARK /* Compatibility */ diff --git a/net/xfrm/xfrm_compat.c b/net/xfrm/xfrm_compat.c index 2bf2693901631..a0f62fa02e06e 100644 --- a/net/xfrm/xfrm_compat.c +++ b/net/xfrm/xfrm_compat.c @@ -127,6 +127,7 @@ static const struct nla_policy compat_policy[XFRMA_MAX+= 1] =3D { [XFRMA_SET_MARK] =3D { .type =3D NLA_U32 }, [XFRMA_SET_MARK_MASK] =3D { .type =3D NLA_U32 }, [XFRMA_IF_ID] =3D { .type =3D NLA_U32 }, + [XFRMA_MTIMER_THRESH] =3D { .type =3D NLA_U32 }, }; =20 static struct nlmsghdr *xfrm_nlmsg_put_compat(struct sk_buff *skb, @@ -274,9 +275,10 @@ static int xfrm_xlate64_attr(struct sk_buff *dst, cons= t struct nlattr *src) case XFRMA_SET_MARK: case XFRMA_SET_MARK_MASK: case XFRMA_IF_ID: + case XFRMA_MTIMER_THRESH: return xfrm_nla_cpy(dst, src, nla_len(src)); default: - BUILD_BUG_ON(XFRMA_MAX !=3D XFRMA_IF_ID); + BUILD_BUG_ON(XFRMA_MAX !=3D XFRMA_MTIMER_THRESH); pr_warn_once("unsupported nla_type %d\n", src->nla_type); return -EOPNOTSUPP; } @@ -431,7 +433,7 @@ static int xfrm_xlate32_attr(void *dst, const struct nl= attr *nla, int err; =20 if (type > XFRMA_MAX) { - BUILD_BUG_ON(XFRMA_MAX !=3D XFRMA_IF_ID); + BUILD_BUG_ON(XFRMA_MAX !=3D XFRMA_MTIMER_THRESH); NL_SET_ERR_MSG(extack, "Bad attribute"); return -EOPNOTSUPP; } diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index a2f4001221d16..78d51399a0f4b 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -1593,6 +1593,9 @@ static struct xfrm_state *xfrm_state_clone(struct xfr= m_state *orig, x->km.seq =3D orig->km.seq; x->replay =3D orig->replay; x->preplay =3D orig->preplay; + x->mapping_maxage =3D orig->mapping_maxage; + x->new_mapping =3D 0; + x->new_mapping_sport =3D 0; =20 return x; =20 @@ -2242,7 +2245,7 @@ int km_query(struct xfrm_state *x, struct xfrm_tmpl *= t, struct xfrm_policy *pol) } EXPORT_SYMBOL(km_query); =20 -int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sp= ort) +static int __km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, = __be16 sport) { int err =3D -EINVAL; struct xfrm_mgr *km; @@ -2257,6 +2260,24 @@ int km_new_mapping(struct xfrm_state *x, xfrm_addres= s_t *ipaddr, __be16 sport) rcu_read_unlock(); return err; } + +int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sp= ort) +{ + int ret =3D 0; + + if (x->mapping_maxage) { + if ((jiffies / HZ - x->new_mapping) > x->mapping_maxage || + x->new_mapping_sport !=3D sport) { + x->new_mapping_sport =3D sport; + x->new_mapping =3D jiffies / HZ; + ret =3D __km_new_mapping(x, ipaddr, sport); + } + } else { + ret =3D __km_new_mapping(x, ipaddr, sport); + } + + return ret; +} EXPORT_SYMBOL(km_new_mapping); =20 void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 por= tid) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index b571892fe10f5..c60441be883a8 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -282,6 +282,10 @@ static int verify_newsa_info(struct xfrm_usersa_info *= p, =20 err =3D 0; =20 + if (attrs[XFRMA_MTIMER_THRESH]) + if (!attrs[XFRMA_ENCAP]) + err =3D -EINVAL; + out: return err; } @@ -521,6 +525,7 @@ static void xfrm_update_ae_params(struct xfrm_state *x,= struct nlattr **attrs, struct nlattr *lt =3D attrs[XFRMA_LTIME_VAL]; struct nlattr *et =3D attrs[XFRMA_ETIMER_THRESH]; struct nlattr *rt =3D attrs[XFRMA_REPLAY_THRESH]; + struct nlattr *mt =3D attrs[XFRMA_MTIMER_THRESH]; =20 if (re) { struct xfrm_replay_state_esn *replay_esn; @@ -552,6 +557,9 @@ static void xfrm_update_ae_params(struct xfrm_state *x,= struct nlattr **attrs, =20 if (rt) x->replay_maxdiff =3D nla_get_u32(rt); + + if (mt) + x->mapping_maxage =3D nla_get_u32(mt); } =20 static void xfrm_smark_init(struct nlattr **attrs, struct xfrm_mark *m) @@ -1029,8 +1037,13 @@ static int copy_to_user_state_extra(struct xfrm_stat= e *x, if (ret) goto out; } - if (x->security) + if (x->security) { ret =3D copy_sec_ctx(x->security, skb); + if (ret) + goto out; + } + if (x->mapping_maxage) + ret =3D nla_put_u32(skb, XFRMA_MTIMER_THRESH, x->mapping_maxage); out: return ret; } @@ -3084,6 +3097,9 @@ static inline unsigned int xfrm_sa_len(struct xfrm_st= ate *x) /* Must count x->lastused as it may become non-zero behind our back. */ l +=3D nla_total_size_64bit(sizeof(u64)); =20 + if (x->mapping_maxage) + l +=3D nla_total_size(sizeof(x->mapping_maxage)); + return l; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C9B5C4167B for ; Tue, 25 Jan 2022 00:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372228AbiAYAKz (ORCPT ); Mon, 24 Jan 2022 19:10:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848903AbiAXXYP (ORCPT ); Mon, 24 Jan 2022 18:24:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AB02C0730A3; Mon, 24 Jan 2022 13:29:32 -0800 (PST) Received: from smtp.kernel.org (relay.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 2E6E1B81057; Mon, 24 Jan 2022 21:29:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62233C340E4; Mon, 24 Jan 2022 21:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059768; bh=F4q09PcjBgUukBysrwd15UYEG4A+dn6xaDs9qiOmli0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZSN6lnyJ1NF6lbDpwTyoTADAkdqDYoQd0AQWFTag0Yw7T6SkrSUX8mbrQyVTw/9w0 IhjONH+IajXpaRNVfliBs2Q4bDckUxwQHQEwJQ1sknWXKpEkZHXxMU3fFKBrJW92UF biSOPBlRy7OSKf1xVQRiaFbsIJxSUlpxi/iGtwEg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joerg Albert , Lucas Stach , Christian Gmeiner , Sasha Levin Subject: [PATCH 5.16 0694/1039] drm/etnaviv: consider completed fence seqno in hang check Date: Mon, 24 Jan 2022 19:41:23 +0100 Message-Id: <20220124184148.671759759@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lucas Stach [ Upstream commit cdd156955f946beaa5f3a00d8ccf90e5a197becc ] Some GPU heavy test programs manage to trigger the hangcheck quite often. If there are no other GPU users in the system and the test program exhibits a very regular structure in the commandstreams that are being submitted, we can end up with two distinct submits managing to trigger the hangcheck with the FE in a very similar address range. This leads the hangcheck to believe that the GPU is stuck, while in reality the GPU is already busy working on a different job. To avoid those spurious GPU resets, also remember and consider the last completed fence seqno in the hang check. Reported-by: Joerg Albert Signed-off-by: Lucas Stach Reviewed-by: Christian Gmeiner Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 1 + drivers/gpu/drm/etnaviv/etnaviv_sched.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h b/drivers/gpu/drm/etnavi= v/etnaviv_gpu.h index 1c75c8ed5bcea..85eddd492774d 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h @@ -130,6 +130,7 @@ struct etnaviv_gpu { =20 /* hang detection */ u32 hangcheck_dma_addr; + u32 hangcheck_fence; =20 void __iomem *mmio; int irq; diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c b/drivers/gpu/drm/etna= viv/etnaviv_sched.c index 180bb633d5c53..58f593b278c15 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c @@ -107,8 +107,10 @@ static enum drm_gpu_sched_stat etnaviv_sched_timedout_= job(struct drm_sched_job */ dma_addr =3D gpu_read(gpu, VIVS_FE_DMA_ADDRESS); change =3D dma_addr - gpu->hangcheck_dma_addr; - if (change < 0 || change > 16) { + if (gpu->completed_fence !=3D gpu->hangcheck_fence || + change < 0 || change > 16) { gpu->hangcheck_dma_addr =3D dma_addr; + gpu->hangcheck_fence =3D gpu->completed_fence; goto out_no_timeout; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C4F6C4321E for ; Tue, 25 Jan 2022 00:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372329AbiAYALL (ORCPT ); Mon, 24 Jan 2022 19:11:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848905AbiAXXYP (ORCPT ); Mon, 24 Jan 2022 18:24:15 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1B0AC0730A5; Mon, 24 Jan 2022 13:29:32 -0800 (PST) Received: from smtp.kernel.org (relay.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 7A27461320; Mon, 24 Jan 2022 21:29:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59922C340E4; Mon, 24 Jan 2022 21:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059771; bh=9zqniQmnmRj2EP7QeluyIKIoG9IT21ZtY1hW7QzQH5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qsEUu80EAG5imAhskZCeCnrNEQxTRaPTN1yT/Ro5v6VVWLbe8PZ4AVszRnCxWo8Lc hKzp2ud8+t5R+5I2SIDjSyKCKOlhlhh67975ncDfP8NjmY3LFXZw3qmkpP6P2S3XQ4 20tOcM1tAD6friGfqNCSuLWKXsDCy6TtCG4NKa68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kyeong Yoo , Richard Weinberger , Sasha Levin Subject: [PATCH 5.16 0695/1039] jffs2: GC deadlock reading a page that is used in jffs2_write_begin() Date: Mon, 24 Jan 2022 19:41:24 +0100 Message-Id: <20220124184148.702156206@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kyeong Yoo [ Upstream commit aa39cc675799bc92da153af9a13d6f969c348e82 ] GC task can deadlock in read_cache_page() because it may attempt to release a page that is actually allocated by another task in jffs2_write_begin(). The reason is that in jffs2_write_begin() there is a small window a cache page is allocated for use but not set Uptodate yet. This ends up with a deadlock between two tasks: 1) A task (e.g. file copy) - jffs2_write_begin() locks a cache page - jffs2_write_end() tries to lock "alloc_sem" from jffs2_reserve_space() <-- STUCK 2) GC task (jffs2_gcd_mtd3) - jffs2_garbage_collect_pass() locks "alloc_sem" - try to lock the same cache page in read_cache_page() <-- STUCK So to avoid this deadlock, hold "alloc_sem" in jffs2_write_begin() while reading data in a cache page. Signed-off-by: Kyeong Yoo Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/jffs2/file.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index 4fc8cd698d1a4..bd7d58d27bfc6 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c @@ -136,20 +136,15 @@ static int jffs2_write_begin(struct file *filp, struc= t address_space *mapping, struct page *pg; struct inode *inode =3D mapping->host; struct jffs2_inode_info *f =3D JFFS2_INODE_INFO(inode); + struct jffs2_sb_info *c =3D JFFS2_SB_INFO(inode->i_sb); pgoff_t index =3D pos >> PAGE_SHIFT; uint32_t pageofs =3D index << PAGE_SHIFT; int ret =3D 0; =20 - pg =3D grab_cache_page_write_begin(mapping, index, flags); - if (!pg) - return -ENOMEM; - *pagep =3D pg; - jffs2_dbg(1, "%s()\n", __func__); =20 if (pageofs > inode->i_size) { /* Make new hole frag from old EOF to new page */ - struct jffs2_sb_info *c =3D JFFS2_SB_INFO(inode->i_sb); struct jffs2_raw_inode ri; struct jffs2_full_dnode *fn; uint32_t alloc_len; @@ -160,7 +155,7 @@ static int jffs2_write_begin(struct file *filp, struct = address_space *mapping, ret =3D jffs2_reserve_space(c, sizeof(ri), &alloc_len, ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); if (ret) - goto out_page; + goto out_err; =20 mutex_lock(&f->sem); memset(&ri, 0, sizeof(ri)); @@ -190,7 +185,7 @@ static int jffs2_write_begin(struct file *filp, struct = address_space *mapping, ret =3D PTR_ERR(fn); jffs2_complete_reservation(c); mutex_unlock(&f->sem); - goto out_page; + goto out_err; } ret =3D jffs2_add_full_dnode_to_inode(c, f, fn); if (f->metadata) { @@ -205,13 +200,26 @@ static int jffs2_write_begin(struct file *filp, struc= t address_space *mapping, jffs2_free_full_dnode(fn); jffs2_complete_reservation(c); mutex_unlock(&f->sem); - goto out_page; + goto out_err; } jffs2_complete_reservation(c); inode->i_size =3D pageofs; mutex_unlock(&f->sem); } =20 + /* + * While getting a page and reading data in, lock c->alloc_sem until + * the page is Uptodate. Otherwise GC task may attempt to read the same + * page in read_cache_page(), which causes a deadlock. + */ + mutex_lock(&c->alloc_sem); + pg =3D grab_cache_page_write_begin(mapping, index, flags); + if (!pg) { + ret =3D -ENOMEM; + goto release_sem; + } + *pagep =3D pg; + /* * Read in the page if it wasn't already present. Cannot optimize away * the whole page write case until jffs2_write_end can handle the @@ -221,15 +229,17 @@ static int jffs2_write_begin(struct file *filp, struc= t address_space *mapping, mutex_lock(&f->sem); ret =3D jffs2_do_readpage_nolock(inode, pg); mutex_unlock(&f->sem); - if (ret) - goto out_page; + if (ret) { + unlock_page(pg); + put_page(pg); + goto release_sem; + } } jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags); - return ret; =20 -out_page: - unlock_page(pg); - put_page(pg); +release_sem: + mutex_unlock(&c->alloc_sem); +out_err: return ret; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51D6EC4167B for ; Mon, 24 Jan 2022 22:13:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359768AbiAXWNC (ORCPT ); Mon, 24 Jan 2022 17:13:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50556 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442444AbiAXV3f (ORCPT ); Mon, 24 Jan 2022 16:29:35 -0500 Received: from smtp.kernel.org (relay.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 44EB461320; Mon, 24 Jan 2022 21:29:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3089FC340E4; Mon, 24 Jan 2022 21:29:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059774; bh=hY4UWMyFSq0Q4bgph2NQBK7SyoqPgPe9sNmHDQXYo1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qhpAuxy3N/XCubNi1O8kk+FbRLJT08L9Ln4z0WQzYKNFGVezusoITVJhohW2AjSR9 VhAjP1P3UBA0CK90uUyMUajWOMBuGkrjyHvgjqmxQPVpx2t57aXo/y/RLc7Nuur9lj lJu7klDTqJ98NF2BE4MZEZpo4ywjfSNPQNUwcve4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Langsdorf , Bob Moore , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0696/1039] ACPICA: actypes.h: Expand the ACPI_ACCESS_ definitions Date: Mon, 24 Jan 2022 19:41:25 +0100 Message-Id: <20220124184148.736451659@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Langsdorf [ Upstream commit f81bdeaf816142e0729eea0cc84c395ec9673151 ] ACPICA commit bc02c76d518135531483dfc276ed28b7ee632ce1 The current ACPI_ACCESS_*_WIDTH defines do not provide a way to test that size is small enough to not cause an overflow when applied to a 32-bit integer. Rather than adding more magic numbers, add ACPI_ACCESS_*_SHIFT, ACPI_ACCESS_*_MAX, and ACPI_ACCESS_*_DEFAULT #defines and redefine ACPI_ACCESS_*_WIDTH in terms of the new #defines. This was inititally reported on Linux where a size of 102 in ACPI_ACCESS_BIT_WIDTH caused an overflow error in the SPCR initialization code. Link: https://github.com/acpica/acpica/commit/bc02c76d Signed-off-by: Mark Langsdorf Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/acpi/actypes.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index ff8b3c913f217..248242dca28d3 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -536,8 +536,14 @@ typedef u64 acpi_integer; * Can be used with access_width of struct acpi_generic_address and access= _size of * struct acpi_resource_generic_register. */ -#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2)) -#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) - 1)) +#define ACPI_ACCESS_BIT_SHIFT 2 +#define ACPI_ACCESS_BYTE_SHIFT -1 +#define ACPI_ACCESS_BIT_MAX (31 - ACPI_ACCESS_BIT_SHIFT) +#define ACPI_ACCESS_BYTE_MAX (31 - ACPI_ACCESS_BYTE_SHIFT) +#define ACPI_ACCESS_BIT_DEFAULT (8 - ACPI_ACCESS_BIT_SHIFT) +#define ACPI_ACCESS_BYTE_DEFAULT (8 - ACPI_ACCESS_BYTE_SHIFT) +#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BIT_SHIFT)) +#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BYTE_SHIF= T)) =20 /*************************************************************************= ****** * --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66ACAC433F5 for ; Mon, 24 Jan 2022 22:23:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584411AbiAXWVF (ORCPT ); Mon, 24 Jan 2022 17:21:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50630 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450178AbiAXV3i (ORCPT ); Mon, 24 Jan 2022 16:29:38 -0500 Received: from smtp.kernel.org (relay.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 4EFFE61469; Mon, 24 Jan 2022 21:29:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10D0FC340E4; Mon, 24 Jan 2022 21:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059777; bh=xZVrHsD0rPsj3VwK4y+uOU/PgOon9I3CUjgItIi+HoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jaCJCUV6apRBmvC/WRkmSRMmHPurcFQQun3IBROqSxFBfYDPhPhj8YyhHh/4lYuCd 3xzL3g22ARsRt2SERhR7sHCrORIqe/l1zOKxepIB+vqNS/RUPfRt7iV5iWYpdy2RKd x5GZZmIEHqx6Rhgc17U3tjHSO+wp+h1ALv+65ezc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Asselstine , "Rafael J. Wysocki" , Bob Moore , Sasha Levin Subject: [PATCH 5.16 0697/1039] ACPICA: Utilities: Avoid deleting the same object twice in a row Date: Mon, 24 Jan 2022 19:41:26 +0100 Message-Id: <20220124184148.772245819@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki [ Upstream commit 1cdfe9e346b4c5509ffe19ccde880fd259d9f7a3 ] ACPICA commit c11af67d8f7e3d381068ce7771322f2b5324d687 If original_count is 0 in acpi_ut_update_ref_count (), acpi_ut_delete_internal_obj () is invoked for the target object, which is incorrect, because that object has been deleted once already and the memory allocated to store it may have been reclaimed and allocated for a different purpose by the host OS. Moreover, a confusing debug message following the "Reference Count is already zero, cannot decrement" warning is printed in that case. To fix this issue, make acpi_ut_update_ref_count () return after finding that original_count is 0 and printing the above warning. Link: https://github.com/acpica/acpica/commit/c11af67d Link: https://github.com/acpica/acpica/pull/652 Reported-by: Mark Asselstine Signed-off-by: Rafael J. Wysocki Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/acpica/utdelete.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c index e5ba9795ec696..8d7736d2d2699 100644 --- a/drivers/acpi/acpica/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c @@ -422,6 +422,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *obj= ect, u32 action) ACPI_WARNING((AE_INFO, "Obj %p, Reference Count is already zero, cannot decrement\n", object)); + return; } =20 ACPI_DEBUG_PRINT_RAW((ACPI_DB_ALLOCATIONS, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB56CC47080 for ; Mon, 24 Jan 2022 22:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581753AbiAXWMQ (ORCPT ); Mon, 24 Jan 2022 17:12:16 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47980 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449094AbiAXV2C (ORCPT ); Mon, 24 Jan 2022 16:28:02 -0500 Received: from smtp.kernel.org (relay.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 CFFAB614B4; Mon, 24 Jan 2022 21:28:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFC35C340E4; Mon, 24 Jan 2022 21:27:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059680; bh=RrkQfr1N8/D9I56nK7YQ11YiOSyDN+pImc2mLPrVi0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wuGIVL+0mRpj1Lf2IG9e3KzNQ1MbJ9vL/sL3bGZ/ui+lKWnQaHdx5JpyP+uBWL4WA 859aJWjC9VHcs1YrV4MAIo8g3OXUKyaXt9qYrOuha0Jc2eqt+UvLAVEbeQqMl2xTVf 8F+wH9xAaXODLFRp6lbcC0uK/c0Tse6SkacJVd0o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lenny Szubowicz , "Rafael J. Wysocki" , Bob Moore , Sasha Levin Subject: [PATCH 5.16 0698/1039] ACPICA: Executer: Fix the REFCLASS_REFOF case in acpi_ex_opcode_1A_0T_1R() Date: Mon, 24 Jan 2022 19:41:27 +0100 Message-Id: <20220124184148.801945773@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki [ Upstream commit 24ea5f90ec9548044a6209685c5010edd66ffe8f ] ACPICA commit d984f12041392fa4156b52e2f7e5c5e7bc38ad9e If Operand[0] is a reference of the ACPI_REFCLASS_REFOF class, acpi_ex_opcode_1A_0T_1R () calls acpi_ns_get_attached_object () to obtain return_desc which may require additional resolution with the help of acpi_ex_read_data_from_field (). If the latter fails, the reference counter of the original return_desc is decremented which is incorrect, because acpi_ns_get_attached_object () does not increment the reference counter of the object returned by it. This issue may lead to premature deletion of the attached object while it is still attached and a use-after-free and crash in the host OS. For example, this may happen when on evaluation of ref_of() a local region field where there is no registered handler for the given Operation Region. Fix it by making acpi_ex_opcode_1A_0T_1R () return Status right away after a acpi_ex_read_data_from_field () failure. Link: https://github.com/acpica/acpica/commit/d984f120 Link: https://github.com/acpica/acpica/pull/685 Reported-by: Lenny Szubowicz Signed-off-by: Rafael J. Wysocki Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/acpica/exoparg1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c index b639e930d6429..44b7c350ed5ca 100644 --- a/drivers/acpi/acpica/exoparg1.c +++ b/drivers/acpi/acpica/exoparg1.c @@ -1007,7 +1007,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_= state *walk_state) (walk_state, return_desc, &temp_desc); if (ACPI_FAILURE(status)) { - goto cleanup; + return_ACPI_STATUS + (status); } =20 return_desc =3D temp_desc; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D885C433FE for ; Tue, 25 Jan 2022 00:05:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2368667AbiAXX7q (ORCPT ); Mon, 24 Jan 2022 18:59:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847648AbiAXXUP (ORCPT ); Mon, 24 Jan 2022 18:20:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1F0AC028C20; Mon, 24 Jan 2022 13:28:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 8FCF4B815A3; Mon, 24 Jan 2022 21:28:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5B7EC340EE; Mon, 24 Jan 2022 21:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059683; bh=F1XJP86QbRwonoLiEZokl4JXQQnS7jSJrjYRteoU7C4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IhJv4K+y+itXVmTW/IPX2R3xTRsxZKzqzvsFT1XxnQumOoKcGSjSlzUenPXYuaKX9 QHs9BVrVltbp+yXXck/g7ghtivFYx2snRnCNAiFPiY7ANYwRVLEER75nR7s1rOFcdg T/woezF9ZvbbDm5LDZ4pa4QpikhJkUUDbxv0OsCA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudeep Holla , Bob Moore , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0699/1039] ACPICA: Fix wrong interpretation of PCC address Date: Mon, 24 Jan 2022 19:41:28 +0100 Message-Id: <20220124184148.838374027@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 9a3b8655db1ada31c82189ae13f40eb25da48c35 ] ACPICA commit 41be6afacfdaec2dba3a5ed368736babc2a7aa5c With the PCC Opregion in the firmware and we are hitting below kernel crash: -->8 Unable to handle kernel NULL pointer dereference at virtual address 0000000= 000000010 Workqueue: pm pm_runtime_work pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : __memcpy+0x54/0x260 lr : acpi_ex_write_data_to_field+0xb8/0x194 Call trace: __memcpy+0x54/0x260 acpi_ex_store_object_to_node+0xa4/0x1d4 acpi_ex_store+0x44/0x164 acpi_ex_opcode_1A_1T_1R+0x25c/0x508 acpi_ds_exec_end_op+0x1b4/0x44c acpi_ps_parse_loop+0x3a8/0x614 acpi_ps_parse_aml+0x90/0x2f4 acpi_ps_execute_method+0x11c/0x19c acpi_ns_evaluate+0x1ec/0x2b0 acpi_evaluate_object+0x170/0x2b0 acpi_device_set_power+0x118/0x310 acpi_dev_suspend+0xd4/0x180 acpi_subsys_runtime_suspend+0x28/0x38 __rpm_callback+0x74/0x328 rpm_suspend+0x2d8/0x624 pm_runtime_work+0xa4/0xb8 process_one_work+0x194/0x25c worker_thread+0x260/0x49c kthread+0x14c/0x30c ret_from_fork+0x10/0x20 Code: f9000006 f81f80a7 d65f03c0 361000c2 (b9400026) ---[ end trace 24d8a032fa77b68a ]--- The reason for the crash is that the PCC channel index passed via region.ad= dress in acpi_ex_store_object_to_node is interpreted as the channel subtype incorrectly. Assuming the PCC op_region support is not used by any other type, let us remove the subtype check as the AML has no access to the subtype informatio= n. Once we remove it, the kernel crash disappears and correctly complains about missing PCC Opregion handler. ACPI Error: No handler for Region [PFRM] ((____ptrval____)) [PCC] (20210730= /evregion-130) ACPI Error: Region PCC (ID=3D10) has no handler (20210730/exfldio-261) ACPI Error: Aborting method \_SB.ETH0._PS3 due to previous error (AE_NOT_EX= IST) (20210730/psparse-531) Link: https://github.com/acpica/acpica/commit/41be6afa Signed-off-by: Sudeep Holla Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/acpica/exfield.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index 06f3c9df1e22d..8618500f23b39 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c @@ -330,12 +330,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object = *source_desc, obj_desc->field.base_byte_offset, source_desc->buffer.pointer, data_length); =20 - if ((obj_desc->field.region_obj->region.address =3D=3D - PCC_MASTER_SUBSPACE - && MASTER_SUBSPACE_COMMAND(obj_desc->field. - base_byte_offset)) - || GENERIC_SUBSPACE_COMMAND(obj_desc->field. - base_byte_offset)) { + if (MASTER_SUBSPACE_COMMAND(obj_desc->field.base_byte_offset)) { =20 /* Perform the write */ =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8643CC43217 for ; Mon, 24 Jan 2022 22:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586286AbiAXW0L (ORCPT ); Mon, 24 Jan 2022 17:26:11 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48094 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449160AbiAXV2I (ORCPT ); Mon, 24 Jan 2022 16:28:08 -0500 Received: from smtp.kernel.org (relay.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 C7E096131F; Mon, 24 Jan 2022 21:28:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A4D2C340E7; Mon, 24 Jan 2022 21:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059686; bh=6YAm3CPq34GvsX3b4vYCVruJOM6/PYsnnpJpjUe6TT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nCq6X5Wn5cr7GXQVCBQllI5oVo8Y64dfGPvDN55mZKlGSBlJps32bjE9pxeZJuPsc jnDmpTVP3efLZmGEm7TEktKplF1Sfo0YvNamqfykg4SvuBHpBvMxHB/csHsEzhtGtW 3B0M8nQt5iMcBgXHuLRN2Nvy0MeuL7CdlLNrTYHQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Kirill A. Shutemov" , "Rafael J. Wysocki" , Bob Moore , Sasha Levin Subject: [PATCH 5.16 0700/1039] ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5 Date: Mon, 24 Jan 2022 19:41:29 +0100 Message-Id: <20220124184148.869834985@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kirill A. Shutemov [ Upstream commit 1d4e0b3abb168b2ee1eca99c527cffa1b80b6161 ] ACPICA commit 3dd7e1f3996456ef81bfe14cba29860e8d42949e According to ACPI 6.4, Section 16.2, the CPU cache flushing is required on entering to S1, S2, and S3, but the ACPICA code flushes the CPU cache regardless of the sleep state. Blind cache flush on entering S5 causes problems for TDX. Flushing happens with WBINVD that is not supported in the TDX environment. TDX only supports S5 and adjusting ACPICA code to conform to the spec more strictly fixes the issue. Link: https://github.com/acpica/acpica/commit/3dd7e1f3 Signed-off-by: Kirill A. Shutemov [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/acpica/hwesleep.c | 4 +++- drivers/acpi/acpica/hwsleep.c | 4 +++- drivers/acpi/acpica/hwxfsleep.c | 2 -- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c index 808fdf54aeebf..7ee2939c08cd4 100644 --- a/drivers/acpi/acpica/hwesleep.c +++ b/drivers/acpi/acpica/hwesleep.c @@ -104,7 +104,9 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state) =20 /* Flush caches, as per ACPI specification */ =20 - ACPI_FLUSH_CPU_CACHE(); + if (sleep_state < ACPI_STATE_S4) { + ACPI_FLUSH_CPU_CACHE(); + } =20 status =3D acpi_os_enter_sleep(sleep_state, sleep_control, 0); if (status =3D=3D AE_CTRL_TERMINATE) { diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index 34a3825f25d37..5efa3d8e483e0 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c @@ -110,7 +110,9 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state) =20 /* Flush caches, as per ACPI specification */ =20 - ACPI_FLUSH_CPU_CACHE(); + if (sleep_state < ACPI_STATE_S4) { + ACPI_FLUSH_CPU_CACHE(); + } =20 status =3D acpi_os_enter_sleep(sleep_state, pm1a_control, pm1b_control); if (status =3D=3D AE_CTRL_TERMINATE) { diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfslee= p.c index e4cde23a29061..ba77598ee43e8 100644 --- a/drivers/acpi/acpica/hwxfsleep.c +++ b/drivers/acpi/acpica/hwxfsleep.c @@ -162,8 +162,6 @@ acpi_status acpi_enter_sleep_state_s4bios(void) return_ACPI_STATUS(status); } =20 - ACPI_FLUSH_CPU_CACHE(); - status =3D acpi_hw_write_port(acpi_gbl_FADT.smi_command, (u32)acpi_gbl_FADT.s4_bios_request, 8); if (ACPI_FAILURE(status)) { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 085F3C433EF for ; Mon, 24 Jan 2022 22:13:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581810AbiAXWMT (ORCPT ); Mon, 24 Jan 2022 17:12:19 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:43062 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359317AbiAXV2M (ORCPT ); Mon, 24 Jan 2022 16:28:12 -0500 Received: from smtp.kernel.org (relay.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 5899BB8123A; Mon, 24 Jan 2022 21:28:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85E30C340E4; Mon, 24 Jan 2022 21:28:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059689; bh=Y52+VQDFKWPukWVOcP0x5AwatEYKIO8IinShTBqBvuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RPtyIFWYk28NPxjWHjwsPFxi3rrfjaMBsgjYghWaNtaop48mi/44npOeG9W2mhGJv JavDS4Q3vwohdTPMSA5QV+XDP0uQ12uNCUR0LkdSn7xvETJZYimEYiR3XduxMY7YAG zc2tJroFm374XTwC2ZFO+YSjJY/A7saw9quAv4+Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Ulf Hansson , Sasha Levin Subject: [PATCH 5.16 0701/1039] mmc: mtk-sd: Use readl_poll_timeout instead of open-coded polling Date: Mon, 24 Jan 2022 19:41:30 +0100 Message-Id: <20220124184148.901333381@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: AngeloGioacchino Del Regno [ Upstream commit ffaea6ebfe9ce06ebb3a54811a47688f2b0893cd ] Replace all instances of open-coded while loops for polling registers with calls to readl_poll_timeout() and, while at it, also fix some possible infinite loop instances. Signed-off-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20211216125748.179602-1-angelogioacchino.de= lregno@collabora.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mmc/host/mtk-sd.c | 64 ++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 632775217d35c..d5a9c269d4926 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -636,12 +636,11 @@ static void msdc_reset_hw(struct msdc_host *host) u32 val; =20 sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_RST); - while (readl(host->base + MSDC_CFG) & MSDC_CFG_RST) - cpu_relax(); + readl_poll_timeout(host->base + MSDC_CFG, val, !(val & MSDC_CFG_RST), 0, = 0); =20 sdr_set_bits(host->base + MSDC_FIFOCS, MSDC_FIFOCS_CLR); - while (readl(host->base + MSDC_FIFOCS) & MSDC_FIFOCS_CLR) - cpu_relax(); + readl_poll_timeout(host->base + MSDC_FIFOCS, val, + !(val & MSDC_FIFOCS_CLR), 0, 0); =20 val =3D readl(host->base + MSDC_INT); writel(val, host->base + MSDC_INT); @@ -814,8 +813,9 @@ static void msdc_gate_clock(struct msdc_host *host) clk_disable_unprepare(host->h_clk); } =20 -static void msdc_ungate_clock(struct msdc_host *host) +static int msdc_ungate_clock(struct msdc_host *host) { + u32 val; int ret; =20 clk_prepare_enable(host->h_clk); @@ -825,11 +825,11 @@ static void msdc_ungate_clock(struct msdc_host *host) ret =3D clk_bulk_prepare_enable(MSDC_NR_CLOCKS, host->bulk_clks); if (ret) { dev_err(host->dev, "Cannot enable pclk/axi/ahb clock gates\n"); - return; + return ret; } =20 - while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB)) - cpu_relax(); + return readl_poll_timeout(host->base + MSDC_CFG, val, + (val & MSDC_CFG_CKSTB), 1, 20000); } =20 static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u3= 2 hz) @@ -840,6 +840,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsig= ned char timing, u32 hz) u32 div; u32 sclk; u32 tune_reg =3D host->dev_comp->pad_tune_reg; + u32 val; =20 if (!hz) { dev_dbg(host->dev, "set mclk to 0\n"); @@ -920,8 +921,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsig= ned char timing, u32 hz) else clk_prepare_enable(clk_get_parent(host->src_clk)); =20 - while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB)) - cpu_relax(); + readl_poll_timeout(host->base + MSDC_CFG, val, (val & MSDC_CFG_CKSTB), 0,= 0); sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_CKPDN); mmc->actual_clock =3D sclk; host->mclk =3D hz; @@ -1231,13 +1231,13 @@ static bool msdc_cmd_done(struct msdc_host *host, i= nt events, static inline bool msdc_cmd_is_ready(struct msdc_host *host, struct mmc_request *mrq, struct mmc_command *cmd) { - /* The max busy time we can endure is 20ms */ - unsigned long tmo =3D jiffies + msecs_to_jiffies(20); + u32 val; + int ret; =20 - while ((readl(host->base + SDC_STS) & SDC_STS_CMDBUSY) && - time_before(jiffies, tmo)) - cpu_relax(); - if (readl(host->base + SDC_STS) & SDC_STS_CMDBUSY) { + /* The max busy time we can endure is 20ms */ + ret =3D readl_poll_timeout_atomic(host->base + SDC_STS, val, + !(val & SDC_STS_CMDBUSY), 1, 20000); + if (ret) { dev_err(host->dev, "CMD bus busy detected\n"); host->error |=3D REQ_CMD_BUSY; msdc_cmd_done(host, MSDC_INT_CMDTMO, mrq, cmd); @@ -1245,12 +1245,10 @@ static inline bool msdc_cmd_is_ready(struct msdc_ho= st *host, } =20 if (mmc_resp_type(cmd) =3D=3D MMC_RSP_R1B || cmd->data) { - tmo =3D jiffies + msecs_to_jiffies(20); /* R1B or with data, should check SDCBUSY */ - while ((readl(host->base + SDC_STS) & SDC_STS_SDCBUSY) && - time_before(jiffies, tmo)) - cpu_relax(); - if (readl(host->base + SDC_STS) & SDC_STS_SDCBUSY) { + ret =3D readl_poll_timeout_atomic(host->base + SDC_STS, val, + !(val & SDC_STS_SDCBUSY), 1, 20000); + if (ret) { dev_err(host->dev, "Controller busy detected\n"); host->error |=3D REQ_CMD_BUSY; msdc_cmd_done(host, MSDC_INT_CMDTMO, mrq, cmd); @@ -1376,6 +1374,8 @@ static bool msdc_data_xfer_done(struct msdc_host *hos= t, u32 events, (MSDC_INT_XFER_COMPL | MSDC_INT_DATCRCERR | MSDC_INT_DATTMO | MSDC_INT_DMA_BDCSERR | MSDC_INT_DMA_GPDCSERR | MSDC_INT_DMA_PROTECT); + u32 val; + int ret; =20 spin_lock_irqsave(&host->lock, flags); done =3D !host->data; @@ -1392,8 +1392,14 @@ static bool msdc_data_xfer_done(struct msdc_host *ho= st, u32 events, readl(host->base + MSDC_DMA_CFG)); sdr_set_field(host->base + MSDC_DMA_CTRL, MSDC_DMA_CTRL_STOP, 1); - while (readl(host->base + MSDC_DMA_CFG) & MSDC_DMA_CFG_STS) - cpu_relax(); + + ret =3D readl_poll_timeout_atomic(host->base + MSDC_DMA_CFG, val, + !(val & MSDC_DMA_CFG_STS), 1, 20000); + if (ret) { + dev_dbg(host->dev, "DMA stop timed out\n"); + return false; + } + sdr_clr_bits(host->base + MSDC_INTEN, data_ints_mask); dev_dbg(host->dev, "DMA stop\n"); =20 @@ -2674,7 +2680,11 @@ static int msdc_drv_probe(struct platform_device *pd= ev) spin_lock_init(&host->lock); =20 platform_set_drvdata(pdev, mmc); - msdc_ungate_clock(host); + ret =3D msdc_ungate_clock(host); + if (ret) { + dev_err(&pdev->dev, "Cannot ungate clocks!\n"); + goto release_mem; + } msdc_init_hw(host); =20 if (mmc->caps2 & MMC_CAP2_CQE) { @@ -2833,8 +2843,12 @@ static int __maybe_unused msdc_runtime_resume(struct= device *dev) { struct mmc_host *mmc =3D dev_get_drvdata(dev); struct msdc_host *host =3D mmc_priv(mmc); + int ret; + + ret =3D msdc_ungate_clock(host); + if (ret) + return ret; =20 - msdc_ungate_clock(host); msdc_restore_reg(host); return 0; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 761E1C46467 for ; Mon, 24 Jan 2022 22:29:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586262AbiAXW0E (ORCPT ); Mon, 24 Jan 2022 17:26:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41684 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449207AbiAXV2W (ORCPT ); Mon, 24 Jan 2022 16:28:22 -0500 Received: from smtp.kernel.org (relay.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 34FA8B815B0; Mon, 24 Jan 2022 21:28:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 618C3C340E8; Mon, 24 Jan 2022 21:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059691; bh=35lOTX6cm3m1nD+3sw8XpEL6aINTmKJuCTuO6dclzwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQuRHEZcTqyNPV91LVDf3kYVGiB7f8brIbslg0f7Q5nWAZq2xohyGBdz8F4bzfeEu QqiF9FvyXiF/LUb1kJ/YNPhN3iVyt6uVR9OuVbZpo8hqJbr626/ftmqltGirqbB+w5 KuSi4k955uqne2Df+HpztccqaHZHKytO7Cg2aL8E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Kuehling , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Yat Sin , Rajneesh Bhardwaj , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0702/1039] drm/amdgpu: Dont inherit GEM object VMAs in child process Date: Mon, 24 Jan 2022 19:41:31 +0100 Message-Id: <20220124184148.931014095@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Rajneesh Bhardwaj [ Upstream commit fbcdbfde87509d523132b59f661a355c731139d0 ] When an application having open file access to a node forks, its shared mappings also get reflected in the address space of child process even though it cannot access them with the object permissions applied. With the existing permission checks on the gem objects, it might be reasonable to also create the VMAs with VM_DONTCOPY flag so a user space application doesn't need to explicitly call the madvise(addr, len, MADV_DONTFORK) system call to prevent the pages in the mapped range to appear in the address space of the child process. It also prevents the memory leaks due to additional reference counts on the mapped BOs in the child process that prevented freeing the memory in the parent for which we had worked around earlier in the user space inside the thunk library. Additionally, we faced this issue when using CRIU to checkpoint restore an application that had such inherited mappings in the child which confuse CRIU when it mmaps on restore. Having this flag set for the render node VMAs helps. VMAs mapped via KFD already take care of this so this is needed only for the render nodes. To limit the impact of the change to user space consumers such as OpenGL etc, limit it to KFD BOs only. Acked-by: Felix Kuehling Reviewed-by: Christian K=C3=B6nig Signed-off-by: David Yat Sin Signed-off-by: Rajneesh Bhardwaj Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_gem.c index a1e63ba4c54a5..630dc99e49086 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -264,6 +264,9 @@ static int amdgpu_gem_object_mmap(struct drm_gem_object= *obj, struct vm_area_str !(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))) vma->vm_flags &=3D ~VM_MAYWRITE; =20 + if (bo->kfd_bo) + vma->vm_flags |=3D VM_DONTCOPY; + return drm_gem_ttm_mmap(obj, vma); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04AACC433F5 for ; Mon, 24 Jan 2022 22:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584609AbiAXWV3 (ORCPT ); Mon, 24 Jan 2022 17:21:29 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40736 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449381AbiAXV2U (ORCPT ); Mon, 24 Jan 2022 16:28:20 -0500 Received: from smtp.kernel.org (relay.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 29B3AB811FB; Mon, 24 Jan 2022 21:28:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5509BC340E4; Mon, 24 Jan 2022 21:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059694; bh=Evjdvma7DpXHpludweJifTmE2JUT8KCAToNGDJW3x2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XgvY4r24ag3Y72DPmVku1cg4JeRGEOFz2mc20JSx0vKdGGM+Vj4fkxX5yCiI+h3Sw oUTuBRrGH3RmgxtQ47WoSMPlhXiJSScODSsDpbHzRs7xF+YoyP4FLk0OsinHl+fl2R 1q1mZ8z0XX9bgjbSJ2M4Dssam+ge1FDvCn6I+3wQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zongmin Zhou , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0703/1039] drm/amdgpu: fixup bad vram size on gmc v8 Date: Mon, 24 Jan 2022 19:41:32 +0100 Message-Id: <20220124184148.962296625@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zongmin Zhou [ Upstream commit 11544d77e3974924c5a9c8a8320b996a3e9b2f8b ] Some boards(like RX550) seem to have garbage in the upper 16 bits of the vram size register. Check for this and clamp the size properly. Fixes boards reporting bogus amounts of vram. after add this patch,the maximum GPU VRAM size is 64GB, otherwise only 64GB vram size will be used. Signed-off-by: Zongmin Zhou Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/am= dgpu/gmc_v8_0.c index 492ebed2915be..63b890f1e8afb 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c @@ -515,10 +515,10 @@ static void gmc_v8_0_mc_program(struct amdgpu_device = *adev) static int gmc_v8_0_mc_init(struct amdgpu_device *adev) { int r; + u32 tmp; =20 adev->gmc.vram_width =3D amdgpu_atombios_get_vram_width(adev); if (!adev->gmc.vram_width) { - u32 tmp; int chansize, numchan; =20 /* Get VRAM informations */ @@ -562,8 +562,15 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) adev->gmc.vram_width =3D numchan * chansize; } /* size in MB on si */ - adev->gmc.mc_vram_size =3D RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; - adev->gmc.real_vram_size =3D RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; + tmp =3D RREG32(mmCONFIG_MEMSIZE); + /* some boards may have garbage in the upper 16 bits */ + if (tmp & 0xffff0000) { + DRM_INFO("Probable bad vram size: 0x%08x\n", tmp); + if (tmp & 0xffff) + tmp &=3D 0xffff; + } + adev->gmc.mc_vram_size =3D tmp * 1024ULL * 1024ULL; + adev->gmc.real_vram_size =3D adev->gmc.mc_vram_size; =20 if (!(adev->flags & AMD_IS_APU)) { r =3D amdgpu_device_resize_fb_bar(adev); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9895EC4707A for ; Tue, 25 Jan 2022 00:09:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2370763AbiAYAGI (ORCPT ); Mon, 24 Jan 2022 19:06:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847659AbiAXXUQ (ORCPT ); Mon, 24 Jan 2022 18:20:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26ACAC028C2B; Mon, 24 Jan 2022 13:28:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 BB74F614D9; Mon, 24 Jan 2022 21:28:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35185C340E4; Mon, 24 Jan 2022 21:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059698; bh=WrmovBE7B/LPgIOvuDDD6clEs9gOydREBb19a2g3R1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=joqwttfsRBdHrpnOQLA2YVsxcbgcVUQ9Hpfx1hxooPXiJqxwhB4qRkw/FeI/T7KwN 04FnguvefEVSVsDmty0ab+Eyk7yi84UuAGwPHuvafUWNeTV/AYKJWcPW9+UmaKDm4H i3pcgV56xgnYGCaGESzwE8LRGAuhyqFYG7y532t8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Tsuchiya Yuto , Andy Shevchenko , Lee Jones , Sasha Levin Subject: [PATCH 5.16 0704/1039] mfd: intel_soc_pmic: Use CPU-id check instead of _HRV check to differentiate variants Date: Mon, 24 Jan 2022 19:41:33 +0100 Message-Id: <20220124184148.999559232@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 5b78223f55a0f516a1639dbe11cd4324d4aaee20 ] The Intel Crystal Cove PMIC has 2 different variants, one for use with Bay Trail (BYT) SoCs and one for use with Cherry Trail (CHT) SoCs. So far we have been using an ACPI _HRV check to differentiate between the 2, but at least on the Microsoft Surface 3, which is a CHT device, the wrong _HRV value is reported by ACPI. So instead switch to a CPU-ID check which prevents us from relying on the possibly wrong ACPI _HRV value. Signed-off-by: Hans de Goede Reported-by: Tsuchiya Yuto Reviewed-by: Andy Shevchenko Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211206174806.197772-2-hdegoede@redhat.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mfd/intel_soc_pmic_core.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic= _core.c index ddd64f9e3341e..47cb7f00dfcfc 100644 --- a/drivers/mfd/intel_soc_pmic_core.c +++ b/drivers/mfd/intel_soc_pmic_core.c @@ -14,15 +14,12 @@ #include #include #include +#include #include #include =20 #include "intel_soc_pmic_core.h" =20 -/* Crystal Cove PMIC shares same ACPI ID between different platforms */ -#define BYT_CRC_HRV 2 -#define CHT_CRC_HRV 3 - /* PWM consumed by the Intel GFX */ static struct pwm_lookup crc_pwm_lookup[] =3D { PWM_LOOKUP("crystal_cove_pwm", 0, "0000:00:02.0", "pwm_pmic_backlight", 0= , PWM_POLARITY_NORMAL), @@ -34,31 +31,12 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *= i2c, struct device *dev =3D &i2c->dev; struct intel_soc_pmic_config *config; struct intel_soc_pmic *pmic; - unsigned long long hrv; - acpi_status status; int ret; =20 - /* - * There are 2 different Crystal Cove PMICs a Bay Trail and Cherry - * Trail version, use _HRV to differentiate between the 2. - */ - status =3D acpi_evaluate_integer(ACPI_HANDLE(dev), "_HRV", NULL, &hrv); - if (ACPI_FAILURE(status)) { - dev_err(dev, "Failed to get PMIC hardware revision\n"); - return -ENODEV; - } - - switch (hrv) { - case BYT_CRC_HRV: + if (soc_intel_is_byt()) config =3D &intel_soc_pmic_config_byt_crc; - break; - case CHT_CRC_HRV: + else config =3D &intel_soc_pmic_config_cht_crc; - break; - default: - dev_warn(dev, "Unknown hardware rev %llu, assuming BYT\n", hrv); - config =3D &intel_soc_pmic_config_byt_crc; - } =20 pmic =3D devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); if (!pmic) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECFEFC3526E for ; Tue, 25 Jan 2022 00:08:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2368752AbiAXX77 (ORCPT ); Mon, 24 Jan 2022 18:59:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847663AbiAXXUQ (ORCPT ); Mon, 24 Jan 2022 18:20:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00BBEC028C2E; Mon, 24 Jan 2022 13:28:22 -0800 (PST) Received: from smtp.kernel.org (relay.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 9467E614CB; Mon, 24 Jan 2022 21:28:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B6A1C340E4; Mon, 24 Jan 2022 21:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059701; bh=o+qYG+ML9wHDSqQvfw0/Rdn3tY3nA8lbroLnq/hiesA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2BHq/qo/ro3EQOt/boZpPTtwPkT4CBYLkreqnoMnKroei294uHGSrQOGiEF40kxFn 0vJaCQI9TGLyEZDzn9EmuGJk3jUuCiQi6FsriyEm79ODoer0+gVRhvJFBo+JbfwfVd uYSyJY8tyigxSG74mavcy6VrwgdoGmPOy7mS5rxY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marina Nikolic , Evan Quan , Lijo Lazar , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0705/1039] amdgpu/pm: Make sysfs pm attributes as read-only for VFs Date: Mon, 24 Jan 2022 19:41:34 +0100 Message-Id: <20220124184149.031663994@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marina Nikolic [ Upstream commit 11c9cc95f818f0f187e9b579a7f136f532b42445 ] =3D=3D Description =3D=3D Setting values of pm attributes through sysfs should not be allowed in SRIOV mode. These calls will not be processed by FW anyway, but error handling on sysfs level should be improved. =3D=3D Changes =3D=3D This patch prohibits performing of all set commands in SRIOV mode on sysfs level. It offers better error handling as calls that are not allowed will not be propagated further. =3D=3D Test =3D=3D Writing to any sysfs file in passthrough mode will succeed. Writing to any sysfs file in ONEVF mode will yield error: "calling process does not have sufficient permission to execute a command". Signed-off-by: Marina Nikolic Acked-by: Evan Quan Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/am= dgpu_pm.c index 41472ed992530..f8370d54100e8 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -2123,6 +2123,12 @@ static int default_attr_update(struct amdgpu_device = *adev, struct amdgpu_device_ } } =20 + /* setting should not be allowed from VF */ + if (amdgpu_sriov_vf(adev)) { + dev_attr->attr.mode &=3D ~S_IWUGO; + dev_attr->store =3D NULL; + } + #undef DEVICE_ATTR_IS =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1214BC4167B for ; Tue, 25 Jan 2022 00:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2368917AbiAYAAd (ORCPT ); Mon, 24 Jan 2022 19:00:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847692AbiAXXUX (ORCPT ); Mon, 24 Jan 2022 18:20:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1523C028C33; Mon, 24 Jan 2022 13:28:25 -0800 (PST) Received: from smtp.kernel.org (relay.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 7003761583; Mon, 24 Jan 2022 21:28:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55749C340EC; Mon, 24 Jan 2022 21:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059704; bh=dXBOlCuoOPukKy5ijeo0ko66jl0mtrClLVGnUYITNaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2Lb6tpTZ09g38vloY7V9Uv0X9S458Gjse6J0F+D4l1++2kau3ynChQJB0Cwtg1psg /2k9ssOUCUzvHCNPGNKSBsAVpMWSRsdhUXgFNbKaYIWtPG6saemMfHop8VzABQzlxZ cUIZmLoxDEW2p3P/E6VNJOZO4bGa+6G53wEXQjpw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0706/1039] ACPI: battery: Add the ThinkPad "Not Charging" quirk Date: Mon, 24 Jan 2022 19:41:35 +0100 Message-Id: <20220124184149.069081921@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Thomas Wei=C3=9Fschuh [ Upstream commit e96c1197aca628f7d2480a1cc3214912b40b3414 ] The EC/ACPI firmware on Lenovo ThinkPads used to report a status of "Unknown" when the battery is between the charge start and charge stop thresholds. On Windows, it reports "Not Charging" so the quirk has been added to also report correctly. Now the "status" attribute returns "Not Charging" when the battery on ThinkPads is not physicaly charging. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/battery.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 8afa85d6eb6a7..ead0114f27c9f 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -53,6 +53,7 @@ static int battery_bix_broken_package; static int battery_notification_delay_ms; static int battery_ac_is_broken; static int battery_check_pmic =3D 1; +static int battery_quirk_notcharging; static unsigned int cache_time =3D 1000; module_param(cache_time, uint, 0644); MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); @@ -217,6 +218,8 @@ static int acpi_battery_get_property(struct power_suppl= y *psy, val->intval =3D POWER_SUPPLY_STATUS_CHARGING; else if (acpi_battery_is_charged(battery)) val->intval =3D POWER_SUPPLY_STATUS_FULL; + else if (battery_quirk_notcharging) + val->intval =3D POWER_SUPPLY_STATUS_NOT_CHARGING; else val->intval =3D POWER_SUPPLY_STATUS_UNKNOWN; break; @@ -1111,6 +1114,12 @@ battery_do_not_check_pmic_quirk(const struct dmi_sys= tem_id *d) return 0; } =20 +static int __init battery_quirk_not_charging(const struct dmi_system_id *d) +{ + battery_quirk_notcharging =3D 1; + return 0; +} + static const struct dmi_system_id bat_dmi_table[] __initconst =3D { { /* NEC LZ750/LS */ @@ -1155,6 +1164,19 @@ static const struct dmi_system_id bat_dmi_table[] __= initconst =3D { DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), }, }, + { + /* + * On Lenovo ThinkPads the BIOS specification defines + * a state when the bits for charging and discharging + * are both set to 0. That state is "Not Charging". + */ + .callback =3D battery_quirk_not_charging, + .ident =3D "Lenovo ThinkPad", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), + }, + }, {}, }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0BDAC43219 for ; Mon, 24 Jan 2022 22:29:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586224AbiAXWZy (ORCPT ); Mon, 24 Jan 2022 17:25:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48810 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358050AbiAXV2a (ORCPT ); Mon, 24 Jan 2022 16:28:30 -0500 Received: from smtp.kernel.org (relay.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 5C83A614CB; Mon, 24 Jan 2022 21:28:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41F6FC340E4; Mon, 24 Jan 2022 21:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059707; bh=g46A/5qUCfI59y4i02SYj+GUKatopABI5zCyp83hnhs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iPUp1UHDU6fjnaQGcG31JU1jfzms27x1NFpGMPkeuTeFKt7GNakGS5SHuOFWGvUDY 0VOPKQgvdBLBg2gcLvVBWZJpkTmSkX3m9dzCbmSAUJ1DGkE3l3rfmWRrC1kAyPfD1t YaItYf+OEBQVXhwI7bKmWPAOBqdB8yBpxLXe+6lw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jinzhou Su , Mario Limonciello , Huang Rui , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0707/1039] ACPI: CPPC: Check present CPUs for determining _CPC is valid Date: Mon, 24 Jan 2022 19:41:36 +0100 Message-Id: <20220124184149.100976704@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mario Limonciello [ Upstream commit 2aeca6bd02776d7f56a49a32be0dd184f204d888 ] As this is a static check, it should be based upon what is currently present on the system. This makes probeing more deterministic. While local APIC flags field (lapic_flags) of cpu core in MADT table is 0, then the cpu core won't be enabled. In this case, _CPC won't be found in this core, and return back to _CPC invalid with walking through possible cpus (include disable cpus). This is not expected, so switch to check present CPUs instead. Reported-by: Jinzhou Su Signed-off-by: Mario Limonciello Signed-off-by: Huang Rui Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/cppc_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index b62c87b8ce4a9..12a156d8283e6 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -411,7 +411,7 @@ bool acpi_cpc_valid(void) struct cpc_desc *cpc_ptr; int cpu; =20 - for_each_possible_cpu(cpu) { + for_each_present_cpu(cpu) { cpc_ptr =3D per_cpu(cpc_desc_ptr, cpu); if (!cpc_ptr) return false; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61907C433FE for ; Mon, 24 Jan 2022 22:13:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581832AbiAXWMY (ORCPT ); Mon, 24 Jan 2022 17:12:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:43504 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389446AbiAXV2g (ORCPT ); Mon, 24 Jan 2022 16:28:36 -0500 Received: from smtp.kernel.org (relay.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 E33E0B815F0; Mon, 24 Jan 2022 21:28:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 134E1C340E4; Mon, 24 Jan 2022 21:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059713; bh=znjJmoVJnraVGpkGuprtqsLw4qdshBWPmmtBakZY010=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YGtjB4CJcfIIqsFP+5alGYs7ELiRoit3CiGMSoZmjFY0ydlDEdEt9B2mHqvp0YPo+ LMDgysfJbIZdMiDlaBDb8EL53g6G4SiOLpeFFra9l6Rv/fr1Hu1CbPTL0NeKTI1csa EoCsQqE072lLKUXpI5KnF7X+9bMz4nl6baorv0i8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yevgeny Kliteynik , Sasha Levin Subject: [PATCH 5.16 0708/1039] net/mlx5: DR, Fix error flow in creating matcher Date: Mon, 24 Jan 2022 19:41:37 +0100 Message-Id: <20220124184149.132953758@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yevgeny Kliteynik [ Upstream commit 84dfac39c61fde04126e23723138128b50cd036f ] The error code of nic matcher init functions wasn't checked. This patch improves the matcher init function and fix error flow bug: the handling of match parameter is moved into a separate function and error flow is simplified. Signed-off-by: Yevgeny Kliteynik Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../mellanox/mlx5/core/steering/dr_matcher.c | 53 +++++++++++-------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c = b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c index 793365242e852..3d0cdc36a91ab 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c @@ -872,13 +872,12 @@ uninit_nic_rx: return ret; } =20 -static int dr_matcher_init(struct mlx5dr_matcher *matcher, - struct mlx5dr_match_parameters *mask) +static int dr_matcher_copy_param(struct mlx5dr_matcher *matcher, + struct mlx5dr_match_parameters *mask) { + struct mlx5dr_domain *dmn =3D matcher->tbl->dmn; struct mlx5dr_match_parameters consumed_mask; - struct mlx5dr_table *tbl =3D matcher->tbl; - struct mlx5dr_domain *dmn =3D tbl->dmn; - int i, ret; + int i, ret =3D 0; =20 if (matcher->match_criteria >=3D DR_MATCHER_CRITERIA_MAX) { mlx5dr_err(dmn, "Invalid match criteria attribute\n"); @@ -898,10 +897,36 @@ static int dr_matcher_init(struct mlx5dr_matcher *mat= cher, consumed_mask.match_sz =3D mask->match_sz; memcpy(consumed_mask.match_buf, mask->match_buf, mask->match_sz); mlx5dr_ste_copy_param(matcher->match_criteria, - &matcher->mask, &consumed_mask, - true); + &matcher->mask, &consumed_mask, true); + + /* Check that all mask data was consumed */ + for (i =3D 0; i < consumed_mask.match_sz; i++) { + if (!((u8 *)consumed_mask.match_buf)[i]) + continue; + + mlx5dr_dbg(dmn, + "Match param mask contains unsupported parameters\n"); + ret =3D -EOPNOTSUPP; + break; + } + + kfree(consumed_mask.match_buf); } =20 + return ret; +} + +static int dr_matcher_init(struct mlx5dr_matcher *matcher, + struct mlx5dr_match_parameters *mask) +{ + struct mlx5dr_table *tbl =3D matcher->tbl; + struct mlx5dr_domain *dmn =3D tbl->dmn; + int ret; + + ret =3D dr_matcher_copy_param(matcher, mask); + if (ret) + return ret; + switch (dmn->type) { case MLX5DR_DOMAIN_TYPE_NIC_RX: matcher->rx.nic_tbl =3D &tbl->rx; @@ -919,22 +944,8 @@ static int dr_matcher_init(struct mlx5dr_matcher *matc= her, default: WARN_ON(true); ret =3D -EINVAL; - goto free_consumed_mask; - } - - /* Check that all mask data was consumed */ - for (i =3D 0; i < consumed_mask.match_sz; i++) { - if (!((u8 *)consumed_mask.match_buf)[i]) - continue; - - mlx5dr_dbg(dmn, "Match param mask contains unsupported parameters\n"); - ret =3D -EOPNOTSUPP; - goto free_consumed_mask; } =20 - ret =3D 0; -free_consumed_mask: - kfree(consumed_mask.match_buf); return ret; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9249FC43217 for ; Tue, 25 Jan 2022 00:09:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2370869AbiAYAGY (ORCPT ); Mon, 24 Jan 2022 19:06:24 -0500 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 S1847754AbiAXXUc (ORCPT ); Mon, 24 Jan 2022 18:20:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A419EC09B052; Mon, 24 Jan 2022 13:28:37 -0800 (PST) Received: from smtp.kernel.org (relay.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 4138561569; Mon, 24 Jan 2022 21:28:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23530C33E6A; Mon, 24 Jan 2022 21:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059716; bh=nODJdLZgNtDJsYBxRp1SexhPYRVVlpVwxtcXBGJsMPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RldR6t/4lhZ5nJyZCddNWxuw6Iq3uL0lh5ARoxczngVT+dJaLIODANrFu1sbJJV0u lKy5J6bkD9Sf5WmCMc9ELK57UljmXi6JAgYWnfOduWQE63p181s0vwg0xT33MD4oSe Xnd7V3M9hLjhpdgQ0nkLaNF6xqpbGWBOGICDP+2Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 5.16 0709/1039] btrfs: remove BUG_ON() in find_parent_nodes() Date: Mon, 24 Jan 2022 19:41:38 +0100 Message-Id: <20220124184149.164631763@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit fcba0120edf88328524a4878d1d6f4ad39f2ec81 ] We search for an extent entry with .offset =3D -1, which shouldn't be a thing, but corruption happens. Add an ASSERT() for the developers, return -EUCLEAN for mortals. Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/backref.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index f735b8798ba12..6b4b0f105a572 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1214,7 +1214,12 @@ again: ret =3D btrfs_search_slot(NULL, fs_info->extent_root, &key, path, 0, 0); if (ret < 0) goto out; - BUG_ON(ret =3D=3D 0); + if (ret =3D=3D 0) { + /* This shouldn't happen, indicates a bug or fs corruption. */ + ASSERT(ret !=3D 0); + ret =3D -EUCLEAN; + goto out; + } =20 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS if (trans && likely(trans->type !=3D __TRANS_DUMMY) && --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29221C4332F for ; Mon, 24 Jan 2022 22:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581877AbiAXWMe (ORCPT ); Mon, 24 Jan 2022 17:12:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49188 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351709AbiAXV2k (ORCPT ); Mon, 24 Jan 2022 16:28:40 -0500 Received: from smtp.kernel.org (relay.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 0AC116151E; Mon, 24 Jan 2022 21:28:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E418DC33E64; Mon, 24 Jan 2022 21:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059719; bh=eZwEiXJyPGEonfCjOOp7aKHAaSn0sBKdsFPzaIWm9G4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hFinnNtjW1COtpuV08egxGh/CBiVPMcnYEt4DFSrqV9VXYgNG0GbmSQo0iw8XnHR5 brB3waaFaZD99eByS6s9IZ7MHKVyVDI7MCTBeNxVd1ioJNWlBw0Lk/YK9g9B82vGO6 Owvfw2t8hnEeNWi2ggE5uSGCXbKIPkKCxAiPUYMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 5.16 0710/1039] btrfs: remove BUG_ON(!eie) in find_parent_nodes Date: Mon, 24 Jan 2022 19:41:39 +0100 Message-Id: <20220124184149.204909875@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 9f05c09d6baef789726346397438cca4ec43c3ee ] If we're looking for leafs that point to a data extent we want to record the extent items that point at our bytenr. At this point we have the reference and we know for a fact that this leaf should have a reference to our bytenr. However if there's some sort of corruption we may not find any references to our leaf, and thus could end up with eie =3D=3D NULL. Replace this BUG_ON() with an ASSERT() and then return -EUCLEAN for the mortals. Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/backref.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 6b4b0f105a572..8b090c40daf77 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1365,10 +1365,18 @@ again: goto out; if (!ret && extent_item_pos) { /* - * we've recorded that parent, so we must extend - * its inode list here + * We've recorded that parent, so we must extend + * its inode list here. + * + * However if there was corruption we may not + * have found an eie, return an error in this + * case. */ - BUG_ON(!eie); + ASSERT(eie); + if (!eie) { + ret =3D -EUCLEAN; + goto out; + } while (eie->next) eie =3D eie->next; eie->next =3D ref->inode_list; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB277C433F5 for ; Mon, 24 Jan 2022 22:13:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581858AbiAXWMb (ORCPT ); Mon, 24 Jan 2022 17:12:31 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:43790 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453176AbiAXV2p (ORCPT ); Mon, 24 Jan 2022 16:28:45 -0500 Received: from smtp.kernel.org (relay.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 A6A11B815A3; Mon, 24 Jan 2022 21:28:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9504C33E61; Mon, 24 Jan 2022 21:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059722; bh=rpK3+TbL9U4gIt72SS2rJL1owWGxYC3tz1KHKjGihMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LUuhSjwaR30Iy4/Bpwi6jH1cNRQu2LIW3tc0hWzgVOta+Q6Rff9K8Bv3EhJvZFNtc xndKoOnRoTQt0OZ2wrlZSBLgxrqMPOx6WtkpemX8pdl77HdCfmykHcrnnjK0UNySBf 7bWvhgkxyfs8Mr08fM4Xw9WYI+KzQV7MOHf4MBYQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Bizon , Florian Fainelli , Andrew Lunn , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0711/1039] net: mdio: Demote probed message to debug print Date: Mon, 24 Jan 2022 19:41:40 +0100 Message-Id: <20220124184149.236630930@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 7590fc6f80ac2cbf23e6b42b668bbeded070850b ] On systems with large numbers of MDIO bus/muxes the message indicating that a given MDIO bus has been successfully probed is repeated for as many buses we have, which can eat up substantial boot time for no reason, demote to a debug print. Reported-by: Maxime Bizon Signed-off-by: Florian Fainelli Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220103194024.2620-1-f.fainelli@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/phy/mdio_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index c198722e4871d..3f7b93d5c76fe 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -594,7 +594,7 @@ int __mdiobus_register(struct mii_bus *bus, struct modu= le *owner) mdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device); =20 bus->state =3D MDIOBUS_REGISTERED; - pr_info("%s: probed\n", bus->name); + dev_dbg(&bus->dev, "probed\n"); return 0; =20 error: --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38368C43217 for ; Tue, 25 Jan 2022 00:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371336AbiAYAHh (ORCPT ); Mon, 24 Jan 2022 19:07:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848230AbiAXXWB (ORCPT ); Mon, 24 Jan 2022 18:22:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E59DC0258C0; Mon, 24 Jan 2022 13:28:46 -0800 (PST) Received: from smtp.kernel.org (relay.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 C3F9061320; Mon, 24 Jan 2022 21:28:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A91D1C33E61; Mon, 24 Jan 2022 21:28:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059725; bh=6Rc/Jh0n96J2clf1qa2snYTGrhhbmofQBPfgvlR57fg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l0vlyvlYIhJux9Z5pUqJbMbnrnavlbFuXjeZvUyu2/z/Ji16zdk3c4qn/aLGmKpbz I4gCzp6ddGnK2THf7bkKXJphdHp5zIcMw4nwQ7EzFCrp/Y1wlauonlDyuT/4/SUKjR OCO9lIlAEMH7SeTW8yAJvugz9Rn5m6EQNvDdHkPA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Goldwyn Rodrigues , Ping-Ke Shih , Johannes Berg , Sasha Levin Subject: [PATCH 5.16 0712/1039] mac80211: allow non-standard VHT MCS-10/11 Date: Mon, 24 Jan 2022 19:41:41 +0100 Message-Id: <20220124184149.270631865@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ping-Ke Shih [ Upstream commit 04be6d337d37400ad5b3d5f27ca87645ee5a18a3 ] Some AP can possibly try non-standard VHT rate and mac80211 warns and drops packets, and leads low TCP throughput. Rate marked as a VHT rate but data is invalid: MCS: 10, NSS: 2 WARNING: CPU: 1 PID: 7817 at net/mac80211/rx.c:4856 ieee80211_rx_list+0= x223/0x2f0 [mac8021 Since commit c27aa56a72b8 ("cfg80211: add VHT rate entries for MCS-10 and M= CS-11") has added, mac80211 adds this support as well. After this patch, throughput is good and iw can get the bitrate: rx bitrate: 975.1 MBit/s VHT-MCS 10 80MHz short GI VHT-NSS 2 or rx bitrate: 1083.3 MBit/s VHT-MCS 11 80MHz short GI VHT-NSS 2 Buglink: https://bugzilla.suse.com/show_bug.cgi?id=3D1192891 Reported-by: Goldwyn Rodrigues Signed-off-by: Ping-Ke Shih Link: https://lore.kernel.org/r/20220103013623.17052-1-pkshih@realtek.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/mac80211/rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 0544563ede522..d2e8b84ed2836 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -4924,7 +4924,7 @@ void ieee80211_rx_list(struct ieee80211_hw *hw, struc= t ieee80211_sta *pubsta, goto drop; break; case RX_ENC_VHT: - if (WARN_ONCE(status->rate_idx > 9 || + if (WARN_ONCE(status->rate_idx > 11 || !status->nss || status->nss > 8, "Rate marked as a VHT rate but data is invalid: MCS: %d, NSS: %d= \n", --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35F7FC35275 for ; Tue, 25 Jan 2022 00:09:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371322AbiAYAHf (ORCPT ); Mon, 24 Jan 2022 19:07:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848234AbiAXXWB (ORCPT ); Mon, 24 Jan 2022 18:22:01 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D8F9C0A02BE; Mon, 24 Jan 2022 13:28:50 -0800 (PST) Received: from smtp.kernel.org (relay.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 59F60B815E2; Mon, 24 Jan 2022 21:28:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83E87C33E61; Mon, 24 Jan 2022 21:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059728; bh=0W+efpgq1FlUhJyr6MfVSm/5wkWq3CVYrdrfGADKS5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dypMdqPLlrYW9BF7C471e2WcAvw9bYU6I5rDW7Zanomfdb7UbJVrkgYu6qOlBjF+I AAe9ntst8/TnTrL8TfJ9nLsm2kqjzPg8UN57ZSYhZAZ/rg0a0v/ZvY+taai9J6PvbI 6+A81a9NRxqZzCkF1n88a3gruJrasOC7HcWOlIds= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Thornber , Mike Snitzer , Sasha Levin Subject: [PATCH 5.16 0713/1039] dm btree: add a defensive bounds check to insert_at() Date: Mon, 24 Jan 2022 19:41:42 +0100 Message-Id: <20220124184149.302012944@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joe Thornber [ Upstream commit 85bca3c05b6cca31625437eedf2060e846c4bbad ] Corrupt metadata could trigger an out of bounds write. Signed-off-by: Joe Thornber Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/md/persistent-data/dm-btree.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-= data/dm-btree.c index 0703ca7a7d9a4..5ce64e93aae74 100644 --- a/drivers/md/persistent-data/dm-btree.c +++ b/drivers/md/persistent-data/dm-btree.c @@ -81,14 +81,16 @@ void inc_children(struct dm_transaction_manager *tm, st= ruct btree_node *n, } =20 static int insert_at(size_t value_size, struct btree_node *node, unsigned = index, - uint64_t key, void *value) - __dm_written_to_disk(value) + uint64_t key, void *value) + __dm_written_to_disk(value) { uint32_t nr_entries =3D le32_to_cpu(node->header.nr_entries); + uint32_t max_entries =3D le32_to_cpu(node->header.max_entries); __le64 key_le =3D cpu_to_le64(key); =20 if (index > nr_entries || - index >=3D le32_to_cpu(node->header.max_entries)) { + index >=3D max_entries || + nr_entries >=3D max_entries) { DMERR("too many entries in btree node for insert"); __dm_unbless_for_disk(value); return -ENOMEM; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78F07C4321E for ; Tue, 25 Jan 2022 00:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388779AbiAYAHn (ORCPT ); Mon, 24 Jan 2022 19:07:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848236AbiAXXWB (ORCPT ); Mon, 24 Jan 2022 18:22:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0388C0219E6; Mon, 24 Jan 2022 13:28:51 -0800 (PST) Received: from smtp.kernel.org (relay.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 7073E61320; Mon, 24 Jan 2022 21:28:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D476C33E61; Mon, 24 Jan 2022 21:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059730; bh=+j/hF9KUbkWpVpF0TWD+CJhI+JZR0eec5rq0R+03JEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jm7gwoBSmtArZ6qliUrCFMhWvZ1s7Zd0QK19u/VKyzZHPRYpcBk7I3CORfEBHFISd HnEPQPjBKiVRlbPeM5Xb/kh+yzbiM7PNM7knBL/ZwbWmNdBsjoZBmY8huuJpd38veN QUZW+lbujX2Z2xZ4m1DLHy8sW4uMAjfOjEMY6YlI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Thornber , Mike Snitzer , Sasha Levin Subject: [PATCH 5.16 0714/1039] dm space map common: add bounds check to sm_ll_lookup_bitmap() Date: Mon, 24 Jan 2022 19:41:43 +0100 Message-Id: <20220124184149.335514594@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joe Thornber [ Upstream commit cba23ac158db7f3cd48a923d6861bee2eb7a2978 ] Corrupted metadata could warrant returning error from sm_ll_lookup_bitmap(). Signed-off-by: Joe Thornber Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/md/persistent-data/dm-space-map-common.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/= persistent-data/dm-space-map-common.c index 4a6a2a9b4eb49..bfbfa750e0160 100644 --- a/drivers/md/persistent-data/dm-space-map-common.c +++ b/drivers/md/persistent-data/dm-space-map-common.c @@ -283,6 +283,11 @@ int sm_ll_lookup_bitmap(struct ll_disk *ll, dm_block_t= b, uint32_t *result) struct disk_index_entry ie_disk; struct dm_block *blk; =20 + if (b >=3D ll->nr_blocks) { + DMERR_LIMIT("metadata block out of bounds"); + return -EINVAL; + } + b =3D do_div(index, ll->entries_per_block); r =3D ll->load_ie(ll, index, &ie_disk); if (r < 0) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2032C46467 for ; Tue, 25 Jan 2022 00:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371338AbiAYAHu (ORCPT ); Mon, 24 Jan 2022 19:07:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848297AbiAXXWL (ORCPT ); Mon, 24 Jan 2022 18:22:11 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADF8FC0219BF; Mon, 24 Jan 2022 13:28:54 -0800 (PST) Received: from smtp.kernel.org (relay.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 3DB48614FD; Mon, 24 Jan 2022 21:28:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F06D9C33E62; Mon, 24 Jan 2022 21:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059733; bh=Ii8TjFP6sUxkq5/B7y2mgegtZFQNzDTCI1wNg9ur+ho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q5cQhjWnJMV8RGc2sO9K2s2mLvkbEw/q/tTdkyL6YXWk2mLQICPeF8h6gVm1KUg/K 6OhKAfOx2h+jBv/3ruIkbOAqZ9NJDshsSXLbZ4Bc+lzKJf2rb+o7+e7BoDFFTJnMu+ 2edKjcbf4TAZLYGIWC1Xrole6IfbL4AGofb2u8BA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , Chandrasekar Ramakrishnan , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Appana Durga Kedareswara rao , Naga Sureshkumar Relli , Michal Simek , Stephane Grosjean , Vincent Mailhol , Sasha Levin , Jimmy Assarsson , =?UTF-8?q?Stefan=20M=C3=A4tje?= Subject: [PATCH 5.16 0715/1039] can: do not increase rx statistics when generating a CAN rx error message frame Date: Mon, 24 Jan 2022 19:41:44 +0100 Message-Id: <20220124184149.368720537@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Vincent Mailhol [ Upstream commit 676068db69b847f06fe054fca15bf6b107bd24da ] The CAN error message frames (i.e. error skb) are an interface specific to socket CAN. The payload of the CAN error message frames does not correspond to any actual data sent on the wire. Only an error flag and a delimiter are transmitted when an error occurs (c.f. ISO 11898-1 section 10.4.4.2 "Error flag"). For this reason, it makes no sense to increment the rx_packets and rx_bytes fields of struct net_device_stats because no actual payload were transmitted on the wire. This patch fixes all the CAN drivers. Link: https://lore.kernel.org/all/20211207121531.42941-2-mailhol.vincent@wa= nadoo.fr CC: Marc Kleine-Budde CC: Nicolas Ferre CC: Alexandre Belloni CC: Ludovic Desroches CC: Chandrasekar Ramakrishnan CC: Maxime Ripard CC: Chen-Yu Tsai CC: Jernej Skrabec CC: Appana Durga Kedareswara rao CC: Naga Sureshkumar Relli CC: Michal Simek CC: Stephane Grosjean Tested-by: Jimmy Assarsson # kvaser Signed-off-by: Vincent Mailhol Acked-by: Stefan M=C3=A4tje # esd_usb2 Tested-by: Stefan M=C3=A4tje # esd_usb2 Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/can/at91_can.c | 6 ------ drivers/net/can/c_can/c_can_main.c | 5 ----- drivers/net/can/cc770/cc770.c | 3 --- drivers/net/can/dev/dev.c | 4 ---- drivers/net/can/dev/rx-offload.c | 6 ++++-- drivers/net/can/ifi_canfd/ifi_canfd.c | 5 ----- drivers/net/can/kvaser_pciefd.c | 5 ----- drivers/net/can/m_can/m_can.c | 7 ------- drivers/net/can/mscan/mscan.c | 9 +++++---- drivers/net/can/pch_can.c | 3 --- drivers/net/can/peak_canfd/peak_canfd.c | 4 ---- drivers/net/can/rcar/rcar_can.c | 6 +----- drivers/net/can/rcar/rcar_canfd.c | 4 ---- drivers/net/can/sja1000/sja1000.c | 2 -- drivers/net/can/sun4i_can.c | 7 ++----- drivers/net/can/usb/ems_usb.c | 2 -- drivers/net/can/usb/esd_usb2.c | 2 -- drivers/net/can/usb/etas_es58x/es58x_core.c | 7 ------- drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 2 -- drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 8 -------- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 4 ---- drivers/net/can/usb/peak_usb/pcan_usb.c | 2 -- drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 3 --- drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 2 -- drivers/net/can/usb/ucan.c | 6 ++++-- drivers/net/can/usb/usb_8dev.c | 2 -- drivers/net/can/xilinx_can.c | 9 +-------- 27 files changed, 17 insertions(+), 108 deletions(-) diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index 3aea32c9b108f..3cd872cf9be66 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c @@ -553,8 +553,6 @@ static void at91_rx_overflow_err(struct net_device *dev) cf->can_id |=3D CAN_ERR_CRTL; cf->data[1] =3D CAN_ERR_CRTL_RX_OVERFLOW; =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_receive_skb(skb); } =20 @@ -779,8 +777,6 @@ static int at91_poll_err(struct net_device *dev, int qu= ota, u32 reg_sr) =20 at91_poll_err_frame(dev, cf, reg_sr); =20 - dev->stats.rx_packets++; - dev->stats.rx_bytes +=3D cf->len; netif_receive_skb(skb); =20 return 1; @@ -1037,8 +1033,6 @@ static void at91_irq_err(struct net_device *dev) =20 at91_irq_err_state(dev, cf, new_state); =20 - dev->stats.rx_packets++; - dev->stats.rx_bytes +=3D cf->len; netif_rx(skb); =20 priv->can.state =3D new_state; diff --git a/drivers/net/can/c_can/c_can_main.c b/drivers/net/can/c_can/c_c= an_main.c index 52671d1ea17d5..670754a129846 100644 --- a/drivers/net/can/c_can/c_can_main.c +++ b/drivers/net/can/c_can/c_can_main.c @@ -920,7 +920,6 @@ static int c_can_handle_state_change(struct net_device = *dev, unsigned int reg_err_counter; unsigned int rx_err_passive; struct c_can_priv *priv =3D netdev_priv(dev); - struct net_device_stats *stats =3D &dev->stats; struct can_frame *cf; struct sk_buff *skb; struct can_berr_counter bec; @@ -996,8 +995,6 @@ static int c_can_handle_state_change(struct net_device = *dev, break; } =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_receive_skb(skb); =20 return 1; @@ -1064,8 +1061,6 @@ static int c_can_handle_bus_err(struct net_device *de= v, break; } =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_receive_skb(skb); return 1; } diff --git a/drivers/net/can/cc770/cc770.c b/drivers/net/can/cc770/cc770.c index f8a130f594e2e..a5fd8ccedec21 100644 --- a/drivers/net/can/cc770/cc770.c +++ b/drivers/net/can/cc770/cc770.c @@ -499,7 +499,6 @@ static void cc770_rx(struct net_device *dev, unsigned i= nt mo, u8 ctrl1) static int cc770_err(struct net_device *dev, u8 status) { struct cc770_priv *priv =3D netdev_priv(dev); - struct net_device_stats *stats =3D &dev->stats; struct can_frame *cf; struct sk_buff *skb; u8 lec; @@ -571,8 +570,6 @@ static int cc770_err(struct net_device *dev, u8 status) } =20 =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); =20 return 0; diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c index e3d840b81357d..4845ae6456e19 100644 --- a/drivers/net/can/dev/dev.c +++ b/drivers/net/can/dev/dev.c @@ -136,7 +136,6 @@ EXPORT_SYMBOL_GPL(can_change_state); static void can_restart(struct net_device *dev) { struct can_priv *priv =3D netdev_priv(dev); - struct net_device_stats *stats =3D &dev->stats; struct sk_buff *skb; struct can_frame *cf; int err; @@ -155,9 +154,6 @@ static void can_restart(struct net_device *dev) =20 cf->can_id |=3D CAN_ERR_RESTARTED; =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; - netif_rx_ni(skb); =20 restart: diff --git a/drivers/net/can/dev/rx-offload.c b/drivers/net/can/dev/rx-offl= oad.c index 37b0cc65237b7..7dbf46b9ca5dd 100644 --- a/drivers/net/can/dev/rx-offload.c +++ b/drivers/net/can/dev/rx-offload.c @@ -54,8 +54,10 @@ static int can_rx_offload_napi_poll(struct napi_struct *= napi, int quota) struct can_frame *cf =3D (struct can_frame *)skb->data; =20 work_done++; - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; + if (!(cf->can_id & CAN_ERR_FLAG)) { + stats->rx_packets++; + stats->rx_bytes +=3D cf->len; + } netif_receive_skb(skb); } =20 diff --git a/drivers/net/can/ifi_canfd/ifi_canfd.c b/drivers/net/can/ifi_ca= nfd/ifi_canfd.c index 5bb957a26bc69..e8318e984bf2f 100644 --- a/drivers/net/can/ifi_canfd/ifi_canfd.c +++ b/drivers/net/can/ifi_canfd/ifi_canfd.c @@ -430,8 +430,6 @@ static int ifi_canfd_handle_lec_err(struct net_device *= ndev) priv->base + IFI_CANFD_INTERRUPT); writel(IFI_CANFD_ERROR_CTR_ER_ENABLE, priv->base + IFI_CANFD_ERROR_CTR); =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_receive_skb(skb); =20 return 1; @@ -456,7 +454,6 @@ static int ifi_canfd_handle_state_change(struct net_dev= ice *ndev, enum can_state new_state) { struct ifi_canfd_priv *priv =3D netdev_priv(ndev); - struct net_device_stats *stats =3D &ndev->stats; struct can_frame *cf; struct sk_buff *skb; struct can_berr_counter bec; @@ -522,8 +519,6 @@ static int ifi_canfd_handle_state_change(struct net_dev= ice *ndev, break; } =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_receive_skb(skb); =20 return 1; diff --git a/drivers/net/can/kvaser_pciefd.c b/drivers/net/can/kvaser_pcief= d.c index eb74cdf26b88c..ab672c92ab078 100644 --- a/drivers/net/can/kvaser_pciefd.c +++ b/drivers/net/can/kvaser_pciefd.c @@ -1310,9 +1310,6 @@ static int kvaser_pciefd_rx_error_frame(struct kvaser= _pciefd_can *can, cf->data[6] =3D bec.txerr; cf->data[7] =3D bec.rxerr; =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; - netif_rx(skb); return 0; } @@ -1510,8 +1507,6 @@ static void kvaser_pciefd_handle_nack_packet(struct k= vaser_pciefd_can *can, =20 if (skb) { cf->can_id |=3D CAN_ERR_BUSERROR; - stats->rx_bytes +=3D cf->len; - stats->rx_packets++; netif_rx(skb); } else { stats->rx_dropped++; diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index c2a8421e7845c..30d94cb43113d 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -647,9 +647,6 @@ static int m_can_handle_lec_err(struct net_device *dev, break; } =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; - if (cdev->is_peripheral) timestamp =3D m_can_get_timestamp(cdev); =20 @@ -706,7 +703,6 @@ static int m_can_handle_state_change(struct net_device = *dev, enum can_state new_state) { struct m_can_classdev *cdev =3D netdev_priv(dev); - struct net_device_stats *stats =3D &dev->stats; struct can_frame *cf; struct sk_buff *skb; struct can_berr_counter bec; @@ -771,9 +767,6 @@ static int m_can_handle_state_change(struct net_device = *dev, break; } =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; - if (cdev->is_peripheral) timestamp =3D m_can_get_timestamp(cdev); =20 diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c index fa32e418eb296..9e1cce0260da6 100644 --- a/drivers/net/can/mscan/mscan.c +++ b/drivers/net/can/mscan/mscan.c @@ -401,13 +401,14 @@ static int mscan_rx_poll(struct napi_struct *napi, in= t quota) continue; } =20 - if (canrflg & MSCAN_RXF) + if (canrflg & MSCAN_RXF) { mscan_get_rx_frame(dev, frame); - else if (canrflg & MSCAN_ERR_IF) + stats->rx_packets++; + stats->rx_bytes +=3D frame->len; + } else if (canrflg & MSCAN_ERR_IF) { mscan_get_err_frame(dev, frame, canrflg); + } =20 - stats->rx_packets++; - stats->rx_bytes +=3D frame->len; work_done++; netif_receive_skb(skb); } diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index 964c8a09226a9..6b45840db1f9b 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c @@ -561,9 +561,6 @@ static void pch_can_error(struct net_device *ndev, u32 = status) =20 priv->can.state =3D state; netif_receive_skb(skb); - - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; } =20 static irqreturn_t pch_can_interrupt(int irq, void *dev_id) diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak= _canfd/peak_canfd.c index d08718e98e110..d5b8bc6d29804 100644 --- a/drivers/net/can/peak_canfd/peak_canfd.c +++ b/drivers/net/can/peak_canfd/peak_canfd.c @@ -409,8 +409,6 @@ static int pucan_handle_status(struct peak_canfd_priv *= priv, return -ENOMEM; } =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; pucan_netif_rx(skb, msg->ts_low, msg->ts_high); =20 return 0; @@ -438,8 +436,6 @@ static int pucan_handle_cache_critical(struct peak_canf= d_priv *priv) cf->data[6] =3D priv->bec.txerr; cf->data[7] =3D priv->bec.rxerr; =20 - stats->rx_bytes +=3D cf->len; - stats->rx_packets++; netif_rx(skb); =20 return 0; diff --git a/drivers/net/can/rcar/rcar_can.c b/drivers/net/can/rcar/rcar_ca= n.c index 8999ec9455ec2..f408ed9a6ccd1 100644 --- a/drivers/net/can/rcar/rcar_can.c +++ b/drivers/net/can/rcar/rcar_can.c @@ -223,7 +223,6 @@ static void tx_failure_cleanup(struct net_device *ndev) static void rcar_can_error(struct net_device *ndev) { struct rcar_can_priv *priv =3D netdev_priv(ndev); - struct net_device_stats *stats =3D &ndev->stats; struct can_frame *cf; struct sk_buff *skb; u8 eifr, txerr =3D 0, rxerr =3D 0; @@ -362,11 +361,8 @@ static void rcar_can_error(struct net_device *ndev) } } =20 - if (skb) { - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; + if (skb) netif_rx(skb); - } } =20 static void rcar_can_tx_done(struct net_device *ndev) diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_= canfd.c index 388521e70837f..137eea4c7bad8 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -1033,8 +1033,6 @@ static void rcar_canfd_error(struct net_device *ndev,= u32 cerfl, /* Clear channel error interrupts that are handled */ rcar_canfd_write(priv->base, RCANFD_CERFL(ch), RCANFD_CERFL_ERR(~cerfl)); - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); } =20 @@ -1174,8 +1172,6 @@ static void rcar_canfd_state_change(struct net_device= *ndev, rx_state =3D txerr <=3D rxerr ? state : 0; =20 can_change_state(ndev, cf, tx_state, rx_state); - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); } } diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sj= a1000.c index 3fad546467461..a65546ca94610 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c @@ -487,8 +487,6 @@ static int sja1000_err(struct net_device *dev, uint8_t = isrc, uint8_t status) can_bus_off(dev); } =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); =20 return 0; diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c index 54aa7c25c4de1..599174098883d 100644 --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c @@ -622,13 +622,10 @@ static int sun4i_can_err(struct net_device *dev, u8 i= src, u8 status) can_bus_off(dev); } =20 - if (likely(skb)) { - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; + if (likely(skb)) netif_rx(skb); - } else { + else return -ENOMEM; - } =20 return 0; } diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 2b5302e724353..7cf65936d02e5 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c @@ -397,8 +397,6 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct = ems_cpc_msg *msg) stats->rx_errors++; } =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); } =20 diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index c6068a251fbed..5f6915a27b3d9 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c @@ -293,8 +293,6 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv = *priv, priv->bec.txerr =3D txerr; priv->bec.rxerr =3D rxerr; =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); } } diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/= usb/etas_es58x/es58x_core.c index 24627ab146261..fb07c33ba0c3c 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.c +++ b/drivers/net/can/usb/etas_es58x/es58x_core.c @@ -849,13 +849,6 @@ int es58x_rx_err_msg(struct net_device *netdev, enum e= s58x_err error, break; } =20 - /* driver/net/can/dev.c:can_restart() takes in account error - * messages in the RX stats. Doing the same here for - * consistency. - */ - netdev->stats.rx_packets++; - netdev->stats.rx_bytes +=3D CAN_ERR_DLC; - if (cf) { if (cf->data[1]) cf->can_id |=3D CAN_ERR_CRTL; diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net= /can/usb/kvaser_usb/kvaser_usb_core.c index 0cc0fc866a2a9..3e682ef43f8ef 100644 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c @@ -279,8 +279,6 @@ int kvaser_usb_can_rx_over_error(struct net_device *net= dev) cf->can_id |=3D CAN_ERR_CRTL; cf->data[1] =3D CAN_ERR_CRTL_RX_OVERFLOW; =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); =20 return 0; diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/ne= t/can/usb/kvaser_usb/kvaser_usb_hydra.c index dcee8dc828ecc..3398da323126c 100644 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -869,7 +869,6 @@ static void kvaser_usb_hydra_update_state(struct kvaser= _usb_net_priv *priv, struct net_device *netdev =3D priv->netdev; struct can_frame *cf; struct sk_buff *skb; - struct net_device_stats *stats; enum can_state new_state, old_state; =20 old_state =3D priv->can.state; @@ -919,9 +918,6 @@ static void kvaser_usb_hydra_update_state(struct kvaser= _usb_net_priv *priv, cf->data[6] =3D bec->txerr; cf->data[7] =3D bec->rxerr; =20 - stats =3D &netdev->stats; - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); } =20 @@ -1074,8 +1070,6 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_pr= iv *priv, cf->data[6] =3D bec.txerr; cf->data[7] =3D bec.rxerr; =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); =20 priv->bec.txerr =3D bec.txerr; @@ -1109,8 +1103,6 @@ static void kvaser_usb_hydra_one_shot_fail(struct kva= ser_usb_net_priv *priv, } =20 stats->tx_errors++; - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); } =20 diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net= /can/usb/kvaser_usb/kvaser_usb_leaf.c index f7af1bf5ab46d..5434b7386a51e 100644 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -641,8 +641,6 @@ static void kvaser_usb_leaf_tx_acknowledge(const struct= kvaser_usb *dev, if (skb) { cf->can_id |=3D CAN_ERR_RESTARTED; =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); } else { netdev_err(priv->netdev, @@ -843,8 +841,6 @@ static void kvaser_usb_leaf_rx_error(const struct kvase= r_usb *dev, cf->data[6] =3D es->txerr; cf->data[7] =3D es->rxerr; =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); } =20 diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/= peak_usb/pcan_usb.c index 8762187527669..21b06a7385959 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c @@ -520,8 +520,6 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_co= ntext *mc, u8 n, &hwts->hwtstamp); } =20 - mc->netdev->stats.rx_packets++; - mc->netdev->stats.rx_bytes +=3D cf->len; netif_rx(skb); =20 return 0; diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/u= sb/peak_usb/pcan_usb_fd.c index 6bd12549f1014..185f5a98d2177 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c @@ -577,9 +577,6 @@ static int pcan_usb_fd_decode_status(struct pcan_usb_fd= _if *usb_if, if (!skb) return -ENOMEM; =20 - netdev->stats.rx_packets++; - netdev->stats.rx_bytes +=3D cf->len; - peak_usb_netif_rx_64(skb, le32_to_cpu(sm->ts_low), le32_to_cpu(sm->ts_high)); =20 diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/= usb/peak_usb/pcan_usb_pro.c index 858ab22708fcd..f6d19879bf404 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c @@ -660,8 +660,6 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pr= o_interface *usb_if, =20 hwts =3D skb_hwtstamps(skb); peak_usb_get_ts_time(&usb_if->time_ref, le32_to_cpu(er->ts32), &hwts->hwt= stamp); - netdev->stats.rx_packets++; - netdev->stats.rx_bytes +=3D can_frame->len; netif_rx(skb); =20 return 0; diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c index 1679cbe45ded2..d582c39fc8d0e 100644 --- a/drivers/net/can/usb/ucan.c +++ b/drivers/net/can/usb/ucan.c @@ -621,8 +621,10 @@ static void ucan_rx_can_msg(struct ucan_priv *up, stru= ct ucan_message_in *m) memcpy(cf->data, m->msg.can_msg.data, cf->len); =20 /* don't count error frames as real packets */ - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; + if (!(cf->can_id & CAN_ERR_FLAG)) { + stats->rx_packets++; + stats->rx_bytes +=3D cf->len; + } =20 /* pass it to Linux */ netif_rx(skb); diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c index d1b83bd1b3cb9..040324362b260 100644 --- a/drivers/net/can/usb/usb_8dev.c +++ b/drivers/net/can/usb/usb_8dev.c @@ -449,8 +449,6 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *p= riv, priv->bec.txerr =3D txerr; priv->bec.rxerr =3D rxerr; =20 - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; netif_rx(skb); } =20 diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index af4a2adc85983..e0525541b32a7 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -965,13 +965,8 @@ static void xcan_update_error_state_after_rxtx(struct = net_device *ndev) =20 xcan_set_error_state(ndev, new_state, skb ? cf : NULL); =20 - if (skb) { - struct net_device_stats *stats =3D &ndev->stats; - - stats->rx_packets++; - stats->rx_bytes +=3D cf->len; + if (skb) netif_rx(skb); - } } } =20 @@ -1095,8 +1090,6 @@ static void xcan_err_interrupt(struct net_device *nde= v, u32 isr) if (skb) { skb_cf->can_id |=3D cf.can_id; memcpy(skb_cf->data, cf.data, CAN_ERR_DLC); - stats->rx_packets++; - stats->rx_bytes +=3D CAN_ERR_DLC; netif_rx(skb); } } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB96CC4167D for ; Mon, 24 Jan 2022 22:29:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586159AbiAXWZr (ORCPT ); Mon, 24 Jan 2022 17:25:47 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49604 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453214AbiAXV26 (ORCPT ); Mon, 24 Jan 2022 16:28:58 -0500 Received: from smtp.kernel.org (relay.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 320A9614DE; Mon, 24 Jan 2022 21:28:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EA39C33E60; Mon, 24 Jan 2022 21:28:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059736; bh=UD6Ht1hPoWlejkDH/Gzpu/erG3jhCpBQYjkRtuiDRoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJqCFMmOABegN9HEYI4t/yZsW+cN3L/BxVaPY51UuS2I2CHL7Rw0S8SQJLS5TMhy/ omJSs6u29xr6bEvLFbi/or4bOqPXEIwllvJ+ObgIi627XlrxwXlMkt/idPapmLEdTr wnaspKGZW9HxYp11JGYqX9LezvEG37WnAwie6/Dg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangbin Liu , Jiri Olsa , Daniel Borkmann , Jussi Maki , Sasha Levin Subject: [PATCH 5.16 0716/1039] bpf/selftests: Fix namespace mount setup in tc_redirect Date: Mon, 24 Jan 2022 19:41:45 +0100 Message-Id: <20220124184149.401200286@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 5e22dd18626726028a93ff1350a8a71a00fd843d ] The tc_redirect umounts /sys in the new namespace, which can be mounted as shared and cause global umount. The lazy umount also takes down mounted trees under /sys like debugfs, which won't be available after sysfs mounts again and could cause fails in other tests. # cat /proc/self/mountinfo | grep debugfs 34 23 0:7 / /sys/kernel/debug rw,nosuid,nodev,noexec,relatime shared:14 -= debugfs debugfs rw # cat /proc/self/mountinfo | grep sysfs 23 86 0:22 / /sys rw,nosuid,nodev,noexec,relatime shared:2 - sysfs sysfs = rw # mount | grep debugfs debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatim= e) # ./test_progs -t tc_redirect #164 tc_redirect:OK Summary: 1/4 PASSED, 0 SKIPPED, 0 FAILED # mount | grep debugfs # cat /proc/self/mountinfo | grep debugfs # cat /proc/self/mountinfo | grep sysfs 25 86 0:22 / /sys rw,relatime shared:2 - sysfs sysfs rw Making the sysfs private under the new namespace so the umount won't trigger the global sysfs umount. Reported-by: Hangbin Liu Signed-off-by: Jiri Olsa Signed-off-by: Daniel Borkmann Cc: Jussi Maki Link: https://lore.kernel.org/bpf/20220104121030.138216-1-jolsa@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/bpf/prog_tests/tc_redirect.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c b/tools/t= esting/selftests/bpf/prog_tests/tc_redirect.c index 4b18b73df10b6..c2426df58e172 100644 --- a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c +++ b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c @@ -105,6 +105,13 @@ static int setns_by_fd(int nsfd) if (!ASSERT_OK(err, "unshare")) return err; =20 + /* Make our /sys mount private, so the following umount won't + * trigger the global umount in case it's shared. + */ + err =3D mount("none", "/sys", NULL, MS_PRIVATE, NULL); + if (!ASSERT_OK(err, "remount private /sys")) + return err; + err =3D umount2("/sys", MNT_DETACH); if (!ASSERT_OK(err, "umount2 /sys")) return err; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 962B5C4332F for ; Mon, 24 Jan 2022 22:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581895AbiAXWMh (ORCPT ); Mon, 24 Jan 2022 17:12:37 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49694 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378461AbiAXV3B (ORCPT ); Mon, 24 Jan 2022 16:29:01 -0500 Received: from smtp.kernel.org (relay.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 0653C61521; Mon, 24 Jan 2022 21:29:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1BC5C33E60; Mon, 24 Jan 2022 21:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059739; bh=Fl5rzd6FQiE4olvgjq95Hwc7BEQkLP+TG+oqGxrulSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S5AsVKMyVxkyfI8OiwnpF4ESGaKIP9+CNk9saiGuRpyctlvDyFsaEvxsjvCFjoRnV Orc2pm3fONc/4LZO8t7IZw25KAtyLxsBAH4E6IaIRqjS7o26KuFFHTvsYUjChRSubK 6jrjKIvlyyzR9UNZ1EkfKbjojcRbqhE5Kgw/dvRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Danielle Ratson , Ido Schimmel , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 0717/1039] mlxsw: pci: Avoid flow control for EMAD packets Date: Mon, 24 Jan 2022 19:41:46 +0100 Message-Id: <20220124184149.432272027@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Danielle Ratson [ Upstream commit d43e4271747ace01a27a49a97a397cb4219f6487 ] Locally generated packets ingress the device through its CPU port. When the CPU port is congested and there are not enough credits in its headroom buffer, packets can be dropped. While this might be acceptable for data packets that traverse the network, configuration packets exchanged between the host and the device (EMADs) should not be subjected to this flow control. The "sdq_lp" bit in the SDQ (Send Descriptor Queue) context allows the host to instruct the device to treat packets sent on this queue as "local processing" and always process them, regardless of the state of the CPU port's headroom. Add the definition of this bit and set it for the dedicated SDQ reserved for the transmission of EMAD packets. This makes the "local processing" bit in the WQE (Work Queue Element) redundant, so clear it. Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlxsw/cmd.h | 12 ++++++++++++ drivers/net/ethernet/mellanox/mlxsw/pci.c | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/cmd.h b/drivers/net/ethern= et/mellanox/mlxsw/cmd.h index 392ce3cb27f72..51b260d54237e 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/cmd.h +++ b/drivers/net/ethernet/mellanox/mlxsw/cmd.h @@ -935,6 +935,18 @@ static inline int mlxsw_cmd_sw2hw_rdq(struct mlxsw_cor= e *mlxsw_core, */ MLXSW_ITEM32(cmd_mbox, sw2hw_dq, cq, 0x00, 24, 8); =20 +enum mlxsw_cmd_mbox_sw2hw_dq_sdq_lp { + MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_WQE, + MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_IGNORE_WQE, +}; + +/* cmd_mbox_sw2hw_dq_sdq_lp + * SDQ local Processing + * 0: local processing by wqe.lp + * 1: local processing (ignoring wqe.lp) + */ +MLXSW_ITEM32(cmd_mbox, sw2hw_dq, sdq_lp, 0x00, 23, 1); + /* cmd_mbox_sw2hw_dq_sdq_tclass * SDQ: CPU Egress TClass * RDQ: Reserved diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethern= et/mellanox/mlxsw/pci.c index cd3331a077bbf..f91dde4df152b 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -285,6 +285,7 @@ static int mlxsw_pci_sdq_init(struct mlxsw_pci *mlxsw_p= ci, char *mbox, struct mlxsw_pci_queue *q) { int tclass; + int lp; int i; int err; =20 @@ -292,9 +293,12 @@ static int mlxsw_pci_sdq_init(struct mlxsw_pci *mlxsw_= pci, char *mbox, q->consumer_counter =3D 0; tclass =3D q->num =3D=3D MLXSW_PCI_SDQ_EMAD_INDEX ? MLXSW_PCI_SDQ_EMAD_TC= : MLXSW_PCI_SDQ_CTL_TC; + lp =3D q->num =3D=3D MLXSW_PCI_SDQ_EMAD_INDEX ? MLXSW_CMD_MBOX_SW2HW_DQ_S= DQ_LP_IGNORE_WQE : + MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_WQE; =20 /* Set CQ of same number of this SDQ. */ mlxsw_cmd_mbox_sw2hw_dq_cq_set(mbox, q->num); + mlxsw_cmd_mbox_sw2hw_dq_sdq_lp_set(mbox, lp); mlxsw_cmd_mbox_sw2hw_dq_sdq_tclass_set(mbox, tclass); mlxsw_cmd_mbox_sw2hw_dq_log2_dq_sz_set(mbox, 3); /* 8 pages */ for (i =3D 0; i < MLXSW_PCI_AQ_PAGES; i++) { @@ -1678,7 +1682,7 @@ static int mlxsw_pci_skb_transmit(void *bus_priv, str= uct sk_buff *skb, =20 wqe =3D elem_info->elem; mlxsw_pci_wqe_c_set(wqe, 1); /* always report completion */ - mlxsw_pci_wqe_lp_set(wqe, !!tx_info->is_emad); + mlxsw_pci_wqe_lp_set(wqe, 0); mlxsw_pci_wqe_type_set(wqe, MLXSW_PCI_WQE_TYPE_ETHERNET); =20 err =3D mlxsw_pci_wqe_frag_map(mlxsw_pci, wqe, 0, skb->data, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A0C6C4332F for ; Tue, 25 Jan 2022 00:14:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371810AbiAYAJq (ORCPT ); Mon, 24 Jan 2022 19:09:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848348AbiAXXWQ (ORCPT ); Mon, 24 Jan 2022 18:22:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0933FC01D7D2; Mon, 24 Jan 2022 13:29:06 -0800 (PST) Received: from smtp.kernel.org (relay.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 DF22361510; Mon, 24 Jan 2022 21:29:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8043C340EC; Mon, 24 Jan 2022 21:29:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059745; bh=PhaiHvgaJpNLluoQ655csgJdmKRf0MjZyKXxTOJ71MQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SUohNVkM2tCAg5yCcswPaJcijfJSAu9GLTtmh0zKPL7cD2tmKXbLrQ29fxCDzXCnw LJbviAKfjNRPC3jStv8TrNx1fJciFfxFJIDtHAJI/jDW9rxmKKIzw7lnZiixO4G/aj BcI2wlU8H4Y5CcP/39AL+DBhAFtUzyMgTN+cYBmM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Corentin Labbe , "Russell King (Oracle)" , Andrew Lunn , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0718/1039] net: phy: marvell: configure RGMII delays for 88E1118 Date: Mon, 24 Jan 2022 19:41:47 +0100 Message-Id: <20220124184149.464977724@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Russell King (Oracle) [ Upstream commit f22725c95ececb703c3f741e8f946d23705630b7 ] Corentin Labbe reports that the SSI 1328 does not work when allowing the PHY to operate at gigabit speeds, but does work with the generic PHY driver. This appears to be because m88e1118_config_init() writes a fixed value to the MSCR register, claiming that this is to enable 1G speeds. However, this always sets bits 4 and 5, enabling RGMII transmit and receive delays. The suspicion is that the original board this was added for required the delays to make 1G speeds work. Add the necessary configuration for RGMII delays for the 88E1118 to bring this into line with the requirements for RGMII support, and thus make the SSI 1328 work. Corentin Labbe has tested this on gemini-ssi1328 and gemini-ns2502. Reported-by: Corentin Labbe Tested-by: Corentin Labbe Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/phy/marvell.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -1244,6 +1244,12 @@ static int m88e1118_config_init(struct p if (err < 0) return err; =20 + if (phy_interface_is_rgmii(phydev)) { + err =3D m88e1121_config_aneg_rgmii_delays(phydev); + if (err < 0) + return err; + } + /* Adjust LED Control */ if (phydev->dev_flags & MARVELL_PHY_M1118_DNS323_LEDS) err =3D phy_write(phydev, 0x10, 0x1100); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E3ABC433EF for ; Mon, 24 Jan 2022 22:13:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581950AbiAXWMn (ORCPT ); Mon, 24 Jan 2022 17:12:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46086 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377233AbiAXV3J (ORCPT ); Mon, 24 Jan 2022 16:29:09 -0500 Received: from smtp.kernel.org (relay.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 DB37D614D9; Mon, 24 Jan 2022 21:29:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C41EFC340F8; Mon, 24 Jan 2022 21:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059748; bh=CZwN9XuDQUkbNMVEEIxVWPpXVAE2UgZwHjhnWnLbtBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bEkeCw1KDaLX3y0l/Mx19GMH+hOge4tM6E6UKj7SeD5Qt58TsQ++f9GiFaRkYhEUk UQfTqC8UX+MrR68+wRZNFwlfrTtMBJwwv5UiCZapSaHm59vxrBUjpfdAHD0Pc7wVTI U2P557Q5gqhhzXq12mtNa3XivpNGZxoylpDZPwiw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Russell King (Oracle)" , Linus Walleij , Corentin Labbe , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0719/1039] net: gemini: allow any RGMII interface mode Date: Mon, 24 Jan 2022 19:41:48 +0100 Message-Id: <20220124184149.498059748@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Russell King (Oracle) [ Upstream commit 4e4f325a0a55907b14f579e6b1a38c53755e3de2 ] The four RGMII interface modes take care of the required RGMII delay configuration at the PHY and should not be limited by the network MAC driver. Sadly, gemini was only permitting RGMII mode with no delays, which would require the required delay to be inserted via PCB tracking or by the MAC. However, there are designs that require the PHY to add the delay, which is impossible without Gemini permitting the other three PHY interface modes. Fix the driver to allow these. Signed-off-by: Russell King (Oracle) Reviewed-by: Linus Walleij Tested-by: Corentin Labbe Link: https://lore.kernel.org/r/E1n4mpT-002PLd-Ha@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/cortina/gemini.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/c= ortina/gemini.c index 941f175fb911e..0ff40a9b06cec 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -305,21 +305,21 @@ static void gmac_speed_set(struct net_device *netdev) switch (phydev->speed) { case 1000: status.bits.speed =3D GMAC_SPEED_1000; - if (phydev->interface =3D=3D PHY_INTERFACE_MODE_RGMII) + if (phy_interface_mode_is_rgmii(phydev->interface)) status.bits.mii_rmii =3D GMAC_PHY_RGMII_1000; netdev_dbg(netdev, "connect %s to RGMII @ 1Gbit\n", phydev_name(phydev)); break; case 100: status.bits.speed =3D GMAC_SPEED_100; - if (phydev->interface =3D=3D PHY_INTERFACE_MODE_RGMII) + if (phy_interface_mode_is_rgmii(phydev->interface)) status.bits.mii_rmii =3D GMAC_PHY_RGMII_100_10; netdev_dbg(netdev, "connect %s to RGMII @ 100 Mbit\n", phydev_name(phydev)); break; case 10: status.bits.speed =3D GMAC_SPEED_10; - if (phydev->interface =3D=3D PHY_INTERFACE_MODE_RGMII) + if (phy_interface_mode_is_rgmii(phydev->interface)) status.bits.mii_rmii =3D GMAC_PHY_RGMII_100_10; netdev_dbg(netdev, "connect %s to RGMII @ 10 Mbit\n", phydev_name(phydev)); @@ -389,6 +389,9 @@ static int gmac_setup_phy(struct net_device *netdev) status.bits.mii_rmii =3D GMAC_PHY_GMII; break; case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_TXID: + case PHY_INTERFACE_MODE_RGMII_RXID: netdev_dbg(netdev, "RGMII: set GMAC0 and GMAC1 to MII/RGMII mode\n"); status.bits.mii_rmii =3D GMAC_PHY_RGMII_100_10; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48AE0C4707E for ; Tue, 25 Jan 2022 00:09:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371461AbiAYAII (ORCPT ); Mon, 24 Jan 2022 19:08:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848385AbiAXXWY (ORCPT ); Mon, 24 Jan 2022 18:22:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B78DC01D7D8; Mon, 24 Jan 2022 13:29:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 B3C43B815A9; Mon, 24 Jan 2022 21:29:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D841FC341CD; Mon, 24 Jan 2022 21:29:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059751; bh=tSU0MFjA+b37pAV0ewReHHPuyh8v5uxwe8mm5fDoSuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NrWntcXY4qdBprKQ/xHRyZfsCj0fEzw20yMJJAOBftGxFOTpNaq1s6Tvu8K32ifIF vJCgYT6gdn0SzXeDWpgXbmHWCLS/2boSrwROKE0yHc5qMKPMG+PVOIrWAvD5SZAdS1 zzsPruM5sf8+FEXZFAU3b+9vJn1A++hMYdAaRf4U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0720/1039] regulator: qcom_smd: Align probe function with rpmh-regulator Date: Mon, 24 Jan 2022 19:41:49 +0100 Message-Id: <20220124184149.533581730@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 14e2976fbabdacb01335d7f91eeebbc89c67ddb1 ] The RPMh regulator driver is much newer and gets more attention, which in consequence makes it do a few things better. Update qcom_smd-regulator's probe function to mimic what rpmh-regulator does to address a couple of issues: - Probe defer now works correctly, before it used to, well, kinda just die.. This fixes reliable probing on (at least) PM8994, because Linux apparently cannot deal with supply map dependencies yet.. - Regulator data is now matched more sanely: regulator data is matched against each individual regulator node name and throwing an -EINVAL if data is missing, instead of just assuming everything is fine and iterating over all subsequent array members. - status =3D "disabled" will now work for disabling individual regulators in DT. Previously it didn't seem to do much if anything at all. Signed-off-by: Konrad Dybcio Link: https://lore.kernel.org/r/20211230023442.1123424-1-konrad.dybcio@soma= inline.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/regulator/qcom_smd-regulator.c | 100 +++++++++++++++++-------- 1 file changed, 70 insertions(+), 30 deletions(-) diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qco= m_smd-regulator.c index 8bac024dde8b4..9fc666107a06c 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c @@ -9,6 +9,7 @@ #include #include #include +#include #include =20 struct qcom_rpm_reg { @@ -1239,52 +1240,91 @@ static const struct of_device_id rpm_of_match[] =3D= { }; MODULE_DEVICE_TABLE(of, rpm_of_match); =20 -static int rpm_reg_probe(struct platform_device *pdev) +/** + * rpm_regulator_init_vreg() - initialize all attributes of a qcom_smd-reg= ulator + * @vreg: Pointer to the individual qcom_smd-regulator resource + * @dev: Pointer to the top level qcom_smd-regulator PMIC device + * @node: Pointer to the individual qcom_smd-regulator resource + * device node + * @rpm: Pointer to the rpm bus node + * @pmic_rpm_data: Pointer to a null-terminated array of qcom_smd-regulator + * resources defined for the top level PMIC device + * + * Return: 0 on success, errno on failure + */ +static int rpm_regulator_init_vreg(struct qcom_rpm_reg *vreg, struct devic= e *dev, + struct device_node *node, struct qcom_smd_rpm *rpm, + const struct rpm_regulator_data *pmic_rpm_data) { - const struct rpm_regulator_data *reg; - const struct of_device_id *match; - struct regulator_config config =3D { }; + struct regulator_config config =3D {}; + const struct rpm_regulator_data *rpm_data; struct regulator_dev *rdev; + int ret; + + for (rpm_data =3D pmic_rpm_data; rpm_data->name; rpm_data++) + if (of_node_name_eq(node, rpm_data->name)) + break; + + if (!rpm_data->name) { + dev_err(dev, "Unknown regulator %pOFn\n", node); + return -EINVAL; + } + + vreg->dev =3D dev; + vreg->rpm =3D rpm; + vreg->type =3D rpm_data->type; + vreg->id =3D rpm_data->id; + + memcpy(&vreg->desc, rpm_data->desc, sizeof(vreg->desc)); + vreg->desc.name =3D rpm_data->name; + vreg->desc.supply_name =3D rpm_data->supply; + vreg->desc.owner =3D THIS_MODULE; + vreg->desc.type =3D REGULATOR_VOLTAGE; + vreg->desc.of_match =3D rpm_data->name; + + config.dev =3D dev; + config.of_node =3D node; + config.driver_data =3D vreg; + + rdev =3D devm_regulator_register(dev, &vreg->desc, &config); + if (IS_ERR(rdev)) { + ret =3D PTR_ERR(rdev); + dev_err(dev, "%pOFn: devm_regulator_register() failed, ret=3D%d\n", node= , ret); + return ret; + } + + return 0; +} + +static int rpm_reg_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + const struct rpm_regulator_data *vreg_data; + struct device_node *node; struct qcom_rpm_reg *vreg; struct qcom_smd_rpm *rpm; + int ret; =20 rpm =3D dev_get_drvdata(pdev->dev.parent); if (!rpm) { - dev_err(&pdev->dev, "unable to retrieve handle to rpm\n"); + dev_err(&pdev->dev, "Unable to retrieve handle to rpm\n"); return -ENODEV; } =20 - match =3D of_match_device(rpm_of_match, &pdev->dev); - if (!match) { - dev_err(&pdev->dev, "failed to match device\n"); + vreg_data =3D of_device_get_match_data(dev); + if (!vreg_data) return -ENODEV; - } =20 - for (reg =3D match->data; reg->name; reg++) { + for_each_available_child_of_node(dev->of_node, node) { vreg =3D devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); if (!vreg) return -ENOMEM; =20 - vreg->dev =3D &pdev->dev; - vreg->type =3D reg->type; - vreg->id =3D reg->id; - vreg->rpm =3D rpm; - - memcpy(&vreg->desc, reg->desc, sizeof(vreg->desc)); - - vreg->desc.id =3D -1; - vreg->desc.owner =3D THIS_MODULE; - vreg->desc.type =3D REGULATOR_VOLTAGE; - vreg->desc.name =3D reg->name; - vreg->desc.supply_name =3D reg->supply; - vreg->desc.of_match =3D reg->name; - - config.dev =3D &pdev->dev; - config.driver_data =3D vreg; - rdev =3D devm_regulator_register(&pdev->dev, &vreg->desc, &config); - if (IS_ERR(rdev)) { - dev_err(&pdev->dev, "failed to register %s\n", reg->name); - return PTR_ERR(rdev); + ret =3D rpm_regulator_init_vreg(vreg, dev, node, rpm, vreg_data); + + if (ret < 0) { + of_node_put(node); + return ret; } } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1274C43217 for ; Tue, 25 Jan 2022 00:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371677AbiAYAJ2 (ORCPT ); Mon, 24 Jan 2022 19:09:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848451AbiAXXWc (ORCPT ); Mon, 24 Jan 2022 18:22:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDAE3C073083; Mon, 24 Jan 2022 13:29:15 -0800 (PST) Received: from smtp.kernel.org (relay.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 96229B81061; Mon, 24 Jan 2022 21:29:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA497C33EA1; Mon, 24 Jan 2022 21:29:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059754; bh=AouQkowWMbLpCiSc9HCHcAG0xZ3v+aO3HmXSlgFIZUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eqKxOf3FCPHldMv8tW7t82HItXUfqlWOdHkShvbgdqzuXn1A83moP43F7cmvv9MVv WocVstRxU7qYCXMexUToclehWQX38kx/kelRsnBwI6EkGnHU0TggMwyiaPzBSt8zjH LJzi5/StWAwbnXmc0HBaVTegPYcaqZf+39d3gSKU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Lukas Wunner , Sasha Levin Subject: [PATCH 5.16 0721/1039] serial: pl010: Drop CR register reset on set_termios Date: Mon, 24 Jan 2022 19:41:50 +0100 Message-Id: <20220124184149.564971629@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wunner [ Upstream commit 08a0c6dff91c965e39905cf200d22db989203ccb ] pl010_set_termios() briefly resets the CR register to zero. Where does this register write come from? The PL010 driver's IRQ handler ambauart_int() originally modified the CR register without holding the port spinlock. ambauart_set_termios() also modified that register. To prevent concurrent read-modify-writes by the IRQ handler and to prevent transmission while changing baudrate, ambauart_set_termios() had to disable interrupts. That is achieved by writing zero to the CR register. However in 2004 the PL010 driver was amended to acquire the port spinlock in the IRQ handler, obviating the need to disable interrupts in ->set_termios(): https://git.kernel.org/history/history/c/157c0342e591 That rendered the CR register write obsolete. Drop it. Cc: Russell King Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/fcaff16e5b1abb4cc3da5a2879ac13f278b99ed0.16= 41128728.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/amba-pl010.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl01= 0.c index e744b953ca346..47654073123d6 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c @@ -446,14 +446,11 @@ pl010_set_termios(struct uart_port *port, struct kter= mios *termios, if ((termios->c_cflag & CREAD) =3D=3D 0) uap->port.ignore_status_mask |=3D UART_DUMMY_RSR_RX; =20 - /* first, disable everything */ old_cr =3D readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; =20 if (UART_ENABLE_MS(port, termios->c_cflag)) old_cr |=3D UART010_CR_MSIE; =20 - writel(0, uap->port.membase + UART010_CR); - /* Set baud rate */ quot -=3D 1; writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1113FC433F5 for ; Tue, 25 Jan 2022 00:14:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350805AbiAYAI7 (ORCPT ); Mon, 24 Jan 2022 19:08:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848455AbiAXXWd (ORCPT ); Mon, 24 Jan 2022 18:22:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B7F9C073085; Mon, 24 Jan 2022 13:29:18 -0800 (PST) Received: from smtp.kernel.org (relay.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 EB9A3614B8; Mon, 24 Jan 2022 21:29:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C421FC340E4; Mon, 24 Jan 2022 21:29:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059757; bh=8FkV0WtrVsrhL39FmDN47upyPEIVbo4YCWDOsiA95Uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zszVLUT9hvZ78Q566Nnxxs3UgdNGOjMC3dKYjB98aEJt09rf85pB4Cu643Eldtocz cvztCZdzUYUTdVNiGVukQDw91sal2iMUWay9yMKsggU0xwBOWI1IIbtN+yh82dnN7R KHj+a55JTYxP3/8R4jmLklkb7VUNL8DsaHscFTa8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Lukas Wunner , Sasha Levin Subject: [PATCH 5.16 0722/1039] serial: pl011: Drop CR register reset on set_termios Date: Mon, 24 Jan 2022 19:41:51 +0100 Message-Id: <20220124184149.605385819@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wunner [ Upstream commit e368cc656fd6d0075f1c3ab9676e2001451e3e04 ] pl011_set_termios() briefly resets the CR register to zero, thereby glitching DTR/RTS signals. With rs485 this may result in the bus being occupied for no reason. Where does this register write originate from? The PL011 driver was forked from the PL010 driver in 2004: https://git.kernel.org/history/history/c/157c0342e591 Until this commit, the PL010 driver's IRQ handler ambauart_int() modified the CR register without holding the port spinlock. ambauart_set_termios() also modified that register. To prevent concurrent read-modify-writes by the IRQ handler and to prevent transmission while changing baudrate, ambauart_set_termios() had to disable interrupts. On the PL010, that is achieved by writing zero to the CR register. However, on the PL011, interrupts are disabled in the IMSC register, not in the CR register. Additionally, the commit amended both the PL010 and PL011 driver to acquire the port spinlock in the IRQ handler, obviating the need to disable interrupts in ->set_termios(). So the CR register write is obsolete for two reasons. Drop it. Cc: Russell King Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/f49f945375f5ccb979893c49f1129f51651ac738.16= 41129062.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/amba-pl011.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl01= 1.c index b831d4d64c0a2..6ec34260d6b18 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2105,9 +2105,7 @@ pl011_set_termios(struct uart_port *port, struct kter= mios *termios, if (port->rs485.flags & SER_RS485_ENABLED) termios->c_cflag &=3D ~CRTSCTS; =20 - /* first, disable everything */ old_cr =3D pl011_read(uap, REG_CR); - pl011_write(0, uap, REG_CR); =20 if (termios->c_cflag & CRTSCTS) { if (old_cr & UART011_CR_RTS) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CE03C4167B for ; Tue, 25 Jan 2022 00:14:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371607AbiAYAJS (ORCPT ); Mon, 24 Jan 2022 19:09:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848470AbiAXXWe (ORCPT ); Mon, 24 Jan 2022 18:22:34 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46BE0C073089; Mon, 24 Jan 2022 13:29:21 -0800 (PST) Received: from smtp.kernel.org (relay.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 D8EFB614DC; Mon, 24 Jan 2022 21:29:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA2A0C340ED; Mon, 24 Jan 2022 21:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059760; bh=AOczSnWdWced6oq1iyNUhjT2AeFnG/1hKhyVL7vUbzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hRzZEr5aQUszG5Ok3Yc2vzyJS5MGBvjbwu9FcFwJd4i8DpeE1Q2DwZ8rIpPv13Ufo E4Abacu6rWlzy2kv0dWl2JCU/ZYvMbX+SHfquP9gJSq/8as4Qu5bsa+ViYtBIGPnXG 303DEQ3kd6p8EopQnhmh2p+ThkeDrrU1mCVy5okM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Sasha Levin Subject: [PATCH 5.16 0723/1039] serial: core: Keep mctrl register state and cached copy in sync Date: Mon, 24 Jan 2022 19:41:52 +0100 Message-Id: <20220124184149.637956247@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wunner [ Upstream commit 93a770b7e16772530196674ffc79bb13fa927dc6 ] struct uart_port contains a cached copy of the Modem Control signals. It is used to skip register writes in uart_update_mctrl() if the new signal state equals the old signal state. It also avoids a register read to obtain the current state of output signals. When a uart_port is registered, uart_configure_port() changes signal state but neglects to keep the cached copy in sync. That may cause a subsequent register write to be incorrectly skipped. Fix it before it trips somebody up. This behavior has been present ever since the serial core was introduced in 2002: https://git.kernel.org/history/history/c/33c0d1b0c3eb So far it was never an issue because the cached copy is initialized to 0 by kzalloc() and when uart_configure_port() is executed, at most DTR has been set by uart_set_options() or sunsu_console_setup(). Therefore, a stable designation seems unnecessary. Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/bceeaba030b028ed810272d55d5fc6f3656ddddb.16= 41129752.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/serial_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index 61e3dd0222af1..9e7e624a6c9db 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2393,7 +2393,8 @@ uart_configure_port(struct uart_driver *drv, struct u= art_state *state, * We probably don't need a spinlock around this, but */ spin_lock_irqsave(&port->lock, flags); - port->ops->set_mctrl(port, port->mctrl & TIOCM_DTR); + port->mctrl &=3D TIOCM_DTR; + port->ops->set_mctrl(port, port->mctrl); spin_unlock_irqrestore(&port->lock, flags); =20 /* --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E24D9C433EF for ; Tue, 25 Jan 2022 00:18:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374305AbiAYAQq (ORCPT ); Mon, 24 Jan 2022 19:16:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383051AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A768CC01D7F3; Mon, 24 Jan 2022 13:31:24 -0800 (PST) Received: from smtp.kernel.org (relay.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 480A2614F3; Mon, 24 Jan 2022 21:31:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30D27C340E9; Mon, 24 Jan 2022 21:31:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059883; bh=OBTuXiREeeRTt0kQKSBldCdfbCJ4bnAco+QXL8c1owQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lUGvagDkcMAsSO7hKt1pFZDtAyzUCFiYiY6ofM7Hm+cSAHHUFLS8kxQrrN86XqKOj orG1xFw7XseDgT/FVZzn9mfk0j7r+pOMD4Pd9DIJD9SECRyk+8N/ERSgwnsjVZeycS crPTzo/6coEbwagCkuMRToZKVtc7lBgdFjf+UJnw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominik Brodowski , "Jason A. Donenfeld" , Sasha Levin Subject: [PATCH 5.16 0724/1039] random: do not throw away excess input to crng_fast_load Date: Mon, 24 Jan 2022 19:41:53 +0100 Message-Id: <20220124184149.668774250@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 73c7733f122e8d0107f88655a12011f68f69e74b ] When crng_fast_load() is called by add_hwgenerator_randomness(), we currently will advance to crng_init=3D=3D1 once we've acquired 64 bytes, and then throw away the rest of the buffer. Usually, that is not a problem: When add_hwgenerator_randomness() gets called via EFI or DT during setup_arch(), there won't be any IRQ randomness. Therefore, the 64 bytes passed by EFI exactly matches what is needed to advance to crng_init=3D=3D1. Usually, DT seems to pass 64 bytes as well -- with one notable exception being kexec, which hands over 128 bytes of entropy to the kexec'd kernel. In that case, we'll advance to crng_init=3D=3D1 once 64 of those bytes are consumed by crng_fast_load(), but won't continue onward feeding in bytes to progress to crng_init=3D=3D2. This commit fixes the issue by feeding any leftover bytes into the next phase in add_hwgenerator_randomness(). [linux@dominikbrodowski.net: rewrite commit message] Signed-off-by: Dominik Brodowski Signed-off-by: Jason A. Donenfeld Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/char/random.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 7470ee24db2f9..a27ae3999ff32 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -912,12 +912,14 @@ static struct crng_state *select_crng(void) =20 /* * crng_fast_load() can be called by code in the interrupt service - * path. So we can't afford to dilly-dally. + * path. So we can't afford to dilly-dally. Returns the number of + * bytes processed from cp. */ -static int crng_fast_load(const char *cp, size_t len) +static size_t crng_fast_load(const char *cp, size_t len) { unsigned long flags; char *p; + size_t ret =3D 0; =20 if (!spin_trylock_irqsave(&primary_crng.lock, flags)) return 0; @@ -928,7 +930,7 @@ static int crng_fast_load(const char *cp, size_t len) p =3D (unsigned char *) &primary_crng.state[4]; while (len > 0 && crng_init_cnt < CRNG_INIT_CNT_THRESH) { p[crng_init_cnt % CHACHA_KEY_SIZE] ^=3D *cp; - cp++; crng_init_cnt++; len--; + cp++; crng_init_cnt++; len--; ret++; } spin_unlock_irqrestore(&primary_crng.lock, flags); if (crng_init_cnt >=3D CRNG_INIT_CNT_THRESH) { @@ -936,7 +938,7 @@ static int crng_fast_load(const char *cp, size_t len) crng_init =3D 1; pr_notice("fast init done\n"); } - return 1; + return ret; } =20 /* @@ -1287,7 +1289,7 @@ void add_interrupt_randomness(int irq, int irq_flags) if (unlikely(crng_init =3D=3D 0)) { if ((fast_pool->count >=3D 64) && crng_fast_load((char *) fast_pool->pool, - sizeof(fast_pool->pool))) { + sizeof(fast_pool->pool)) > 0) { fast_pool->count =3D 0; fast_pool->last =3D now; } @@ -2295,8 +2297,11 @@ void add_hwgenerator_randomness(const char *buffer, = size_t count, struct entropy_store *poolp =3D &input_pool; =20 if (unlikely(crng_init =3D=3D 0)) { - crng_fast_load(buffer, count); - return; + size_t ret =3D crng_fast_load(buffer, count); + count -=3D ret; + buffer +=3D ret; + if (!count || crng_init =3D=3D 0) + return; } =20 /* Suspend writing if we're above the trickle threshold. --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10388C43219 for ; Tue, 25 Jan 2022 00:15:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372443AbiAYALa (ORCPT ); Mon, 24 Jan 2022 19:11:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848969AbiAXXY2 (ORCPT ); Mon, 24 Jan 2022 18:24:28 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B83BC0730BF; Mon, 24 Jan 2022 13:29:46 -0800 (PST) Received: from smtp.kernel.org (relay.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 CD588B80CCF; Mon, 24 Jan 2022 21:29:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 099B9C340E4; Mon, 24 Jan 2022 21:29:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059783; bh=1yXJMUXEkxTPzr5/L/0e1NWZ8NvwKPJ/QiqyCsCia7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yKVshzFceF4thddfMGGS7GyxSLNwHlAILduGpZA7mGQYt3Hq87wYUojG1URaqaU1I nh80ZBGzCIiboA+8rMpbyZ1wlEswSDi88oy4JIFzKaEKc5b9CAVWtMEJw9PgH8zF6F QHPAy2t9H+Ht34nxNomWandTLLgpQQAMhaTOuIrw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maher Sanalla , Maor Gottlieb , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.16 0725/1039] net/mlx5: Update log_max_qp value to FW max capability Date: Mon, 24 Jan 2022 19:41:54 +0100 Message-Id: <20220124184149.698711111@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maher Sanalla [ Upstream commit f79a609ea6bf54ad2d2c24e4de4524288b221666 ] log_max_qp in driver's default profile #2 was set to 18, but FW actually supports 17 at the most - a situation that led to the concerning print when the driver is loaded: "log_max_qp value in current profile is 18, changing to HCA capabaility limit (17)" The expected behavior from mlx5_profile #2 is to match the maximum FW capability in regards to log_max_qp. Thus, log_max_qp in profile #2 is initialized to a defined static value (0xff) - which basically means that when loading this profile, log_max_qp value will be what the currently installed FW supports at most. Signed-off-by: Maher Sanalla Reviewed-by: Maor Gottlieb Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/e= thernet/mellanox/mlx5/core/main.c index 65083496f9131..6e381111f1d2f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -98,6 +98,8 @@ enum { MLX5_ATOMIC_REQ_MODE_HOST_ENDIANNESS =3D 0x1, }; =20 +#define LOG_MAX_SUPPORTED_QPS 0xff + static struct mlx5_profile profile[] =3D { [0] =3D { .mask =3D 0, @@ -109,7 +111,7 @@ static struct mlx5_profile profile[] =3D { [2] =3D { .mask =3D MLX5_PROF_MASK_QP_SIZE | MLX5_PROF_MASK_MR_CACHE, - .log_max_qp =3D 18, + .log_max_qp =3D LOG_MAX_SUPPORTED_QPS, .mr_cache[0] =3D { .size =3D 500, .limit =3D 250 @@ -507,7 +509,9 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, vo= id *set_ctx) to_fw_pkey_sz(dev, 128)); =20 /* Check log_max_qp from HCA caps to set in current profile */ - if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < prof->log_max_qp) { + if (prof->log_max_qp =3D=3D LOG_MAX_SUPPORTED_QPS) { + prof->log_max_qp =3D MLX5_CAP_GEN_MAX(dev, log_max_qp); + } else if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < prof->log_max_qp) { mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing= it to HCA capability limit (%d)\n", prof->log_max_qp, MLX5_CAP_GEN_MAX(dev, log_max_qp)); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CB56C433F5 for ; Mon, 24 Jan 2022 22:24:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584566AbiAXWV0 (ORCPT ); Mon, 24 Jan 2022 17:21:26 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51098 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453514AbiAXVaQ (ORCPT ); Mon, 24 Jan 2022 16:30:16 -0500 Received: from smtp.kernel.org (relay.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 3BCB0614B4; Mon, 24 Jan 2022 21:30:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 201DEC340E4; Mon, 24 Jan 2022 21:30:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059815; bh=Py0Utb8K/TKDOXRe9hLUxo0KxcgvtJEQobvTI9y/7YQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IIU+zaC7/jrHb4F60RQY6TDm9ymPQATuHP4Gu4Q7GLepoOmbVloEicOZjZdpT+v2w omGQzId0P3uPk/VeruOuo1jXTEpjZtGwhTIw9Dok0TYJY2CXIUJYNJfnRxPLzeHTGc AsTI6jFTytwGuSDq55atGbKOL0KCGrNAj83GKv+g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maor Dickman , Roi Dayan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.16 0726/1039] net/mlx5e: Unblock setting vid 0 for VF in case PF isnt eswitch manager Date: Mon, 24 Jan 2022 19:41:55 +0100 Message-Id: <20220124184149.735208995@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Maor Dickman [ Upstream commit 7846665d3504812acaebf920d1141851379a7f37 ] When using libvirt to passthrough VF to VM it will always set the VF vlan to 0 even if user didn=E2=80=99t request it, this will cause libvirt to fai= l to boot in case the PF isn't eswitch owner. Example of such case is the DPU host PF which isn't eswitch manager, so any attempt to passthrough VF of it using libvirt will fail. Fix it by not returning error in case set VF vlan is called with vid 0. Signed-off-by: Maor Dickman Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c b/drivers= /net/ethernet/mellanox/mlx5/core/esw/legacy.c index df277a6cddc0b..0c4c743ca31e1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c @@ -431,7 +431,7 @@ int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *es= w, int err =3D 0; =20 if (!mlx5_esw_allowed(esw)) - return -EPERM; + return vlan ? -EPERM : 0; =20 if (vlan || qos) set_flags =3D SET_VLAN_STRIP | SET_VLAN_INSERT; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A46ACC433FE for ; Tue, 25 Jan 2022 00:18:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374615AbiAYARc (ORCPT ); Mon, 24 Jan 2022 19:17:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356245AbiAXX2B (ORCPT ); Mon, 24 Jan 2022 18:28:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F578C01D7EA; Mon, 24 Jan 2022 13:30:49 -0800 (PST) Received: from smtp.kernel.org (relay.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 2C07E614E1; Mon, 24 Jan 2022 21:30:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13E06C340E4; Mon, 24 Jan 2022 21:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059848; bh=G82Q4cPxhw81sOqVHOtuTQNejvoexVwt2CxtmuQC0No=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BMk23j49+M25zpb1nZbDz2RrMhlBclyk19FOHtoGkDKllBECsPvvDZ77RTqUf7WGB ZWNDoHMaAapDTYlAHpFJxp9Q/DpKwixVCN06d1GxPTK9imWxWlXIxA2YB0oJuhlWo6 sW8ZwVN58eiX5GnmJEyyJVe7u03wTCLpIDbXomZc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John David Anglin , Helge Deller , Sasha Levin Subject: [PATCH 5.16 0727/1039] parisc: Avoid calling faulthandler_disabled() twice Date: Mon, 24 Jan 2022 19:41:56 +0100 Message-Id: <20220124184149.768356308@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 David Anglin [ Upstream commit 9e9d4b460f23bab61672eae397417d03917d116c ] In handle_interruption(), we call faulthandler_disabled() to check whether = the fault handler is not disabled. If the fault handler is disabled, we immedia= tely call do_page_fault(). It then calls faulthandler_disabled(). If disabled, do_page_fault() attempts to fixup the exception by jumping to no_context: no_context: if (!user_mode(regs) && fixup_exception(regs)) { return; } parisc_terminate("Bad Address (null pointer deref?)", regs, code, a= ddress); Apart from the error messages, the two blocks of code perform the same function. We can avoid two calls to faulthandler_disabled() by a simple revision to the code in handle_interruption(). Note: I didn't try to fix the formatting of this code block. Signed-off-by: John David Anglin Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/parisc/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c index 892b7fc8f3c45..eb41fece19104 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c @@ -785,7 +785,7 @@ void notrace handle_interruption(int code, struct pt_re= gs *regs) * unless pagefault_disable() was called before. */ =20 - if (fault_space =3D=3D 0 && !faulthandler_disabled()) + if (faulthandler_disabled() || fault_space =3D=3D 0) { /* Clean up and return if in exception table. */ if (fixup_exception(regs)) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0BF7C3526D for ; Tue, 25 Jan 2022 00:18:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374212AbiAYAQ0 (ORCPT ); Mon, 24 Jan 2022 19:16:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382466AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62C19C01D7ED; Mon, 24 Jan 2022 13:31:08 -0800 (PST) Received: from smtp.kernel.org (relay.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 20BD5B8122A; Mon, 24 Jan 2022 21:31:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AFE4C340E4; Mon, 24 Jan 2022 21:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059865; bh=f3jC77ynaSTB8B4PFcxF+om2SUl/1JBzStOOMLauPeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jAa9fZ1MrMleXpEQU29xqnxt1FkF4bR8Y0tk92DaYDi2XgyvVsfpjgU1SVf5mPMro vGA3j8KAgNk7+Ey69GP/kBfwbMg7go/z3A8uGItiZmJhrDpJs0Qo/PNTm0kD3Dmoeh j/44CT4YbtpB7Rsq1PGMzxS90mDsLjpoIQNQARyQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Akira Yokosawa , Mauro Carvalho Chehab , Jonathan Corbet , Sasha Levin Subject: [PATCH 5.16 0728/1039] scripts: sphinx-pre-install: Fix ctex support on Debian Date: Mon, 24 Jan 2022 19:41:57 +0100 Message-Id: <20220124184149.801920838@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 87d6576ddf8ac25f36597bc93ca17f6628289c16 ] The name of the package with ctexhook.sty is different on Debian/Ubuntu. Reported-by: Akira Yokosawa Signed-off-by: Mauro Carvalho Chehab Tested-by: Akira Yokosawa Link: https://lore.kernel.org/r/63882425609a2820fac78f5e94620abeb7ed5f6f.16= 41429634.git.mchehab@kernel.org Signed-off-by: Jonathan Corbet Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- scripts/sphinx-pre-install | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install index 288e86a9d1e58..61a79ce705ccf 100755 --- a/scripts/sphinx-pre-install +++ b/scripts/sphinx-pre-install @@ -369,6 +369,9 @@ sub give_debian_hints() ); =20 if ($pdf) { + check_missing_file(["/usr/share/texlive/texmf-dist/tex/latex/ctex/ctexho= ok.sty"], + "texlive-lang-chinese", 2); + check_missing_file(["/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"], "fonts-dejavu", 2); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC766C433EF for ; Mon, 24 Jan 2022 22:31:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586494AbiAXW0k (ORCPT ); Mon, 24 Jan 2022 17:26:40 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51620 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453902AbiAXVbK (ORCPT ); Mon, 24 Jan 2022 16:31:10 -0500 Received: from smtp.kernel.org (relay.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 78ABF614D9; Mon, 24 Jan 2022 21:31:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44D71C340E4; Mon, 24 Jan 2022 21:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059868; bh=Hq1wqvum7lw/cCC4mXQ/aJ6Kmg5WlDw/CnZoJ5+pidM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rH6P20eR38KTsTCHkBFtcdqDJVOMg2l1Pltn0QeVmRxt4panbAoI+LHmpwzia8U/g xgISye03U1gukSgieaaAbaQcrY3IpCrIjIdaE0eBMC48uYcfj4tuN/HzU2av2IjEbq owVTk9wEClJjXPv/+mWbKw+isOoQKsbTw3HAV6vE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dario Binacchi , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.16 0729/1039] can: flexcan: allow to change quirks at runtime Date: Mon, 24 Jan 2022 19:41:58 +0100 Message-Id: <20220124184149.834300608@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dario Binacchi [ Upstream commit 01bb4dccd92b4dc21f6af3312e5696924e371111 ] This is a preparation patch for the upcoming support to change the rx-rtr capability via the ethtool API. Link: https://lore.kernel.org/all/20220107193105.1699523-3-mkl@pengutronix.= de Signed-off-by: Dario Binacchi Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/can/flexcan.c | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 12b60ad95b02a..26bf0a0a72f1d 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -369,7 +369,7 @@ struct flexcan_priv { =20 struct clk *clk_ipg; struct clk *clk_per; - const struct flexcan_devtype_data *devtype_data; + struct flexcan_devtype_data devtype_data; struct regulator *reg_xceiver; struct flexcan_stop_mode stm; =20 @@ -600,7 +600,7 @@ static inline int flexcan_enter_stop_mode(struct flexca= n_priv *priv) priv->write(reg_mcr, ®s->mcr); =20 /* enable stop request */ - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW) { ret =3D flexcan_stop_mode_enable_scfw(priv, true); if (ret < 0) return ret; @@ -619,7 +619,7 @@ static inline int flexcan_exit_stop_mode(struct flexcan= _priv *priv) int ret; =20 /* remove stop request */ - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW) { ret =3D flexcan_stop_mode_enable_scfw(priv, false); if (ret < 0) return ret; @@ -1022,7 +1022,7 @@ static struct sk_buff *flexcan_mailbox_read(struct ca= n_rx_offload *offload, =20 mb =3D flexcan_get_mb(priv, n); =20 - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { u32 code; =20 do { @@ -1087,7 +1087,7 @@ static struct sk_buff *flexcan_mailbox_read(struct ca= n_rx_offload *offload, } =20 mark_as_read: - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) flexcan_write64(priv, FLEXCAN_IFLAG_MB(n), ®s->iflag1); else priv->write(FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, ®s->iflag1); @@ -1113,7 +1113,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) enum can_state last_state =3D priv->can.state; =20 /* reception interrupt */ - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { u64 reg_iflag_rx; int ret; =20 @@ -1173,7 +1173,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) =20 /* state change interrupt or broken error state quirk fix is enabled */ if ((reg_esr & FLEXCAN_ESR_ERR_STATE) || - (priv->devtype_data->quirks & (FLEXCAN_QUIRK_BROKEN_WERR_STATE | + (priv->devtype_data.quirks & (FLEXCAN_QUIRK_BROKEN_WERR_STATE | FLEXCAN_QUIRK_BROKEN_PERR_STATE))) flexcan_irq_state(dev, reg_esr); =20 @@ -1195,11 +1195,11 @@ static irqreturn_t flexcan_irq(int irq, void *dev_i= d) * (1): enabled if FLEXCAN_QUIRK_BROKEN_WERR_STATE is enabled */ if ((last_state !=3D priv->can.state) && - (priv->devtype_data->quirks & FLEXCAN_QUIRK_BROKEN_PERR_STATE) && + (priv->devtype_data.quirks & FLEXCAN_QUIRK_BROKEN_PERR_STATE) && !(priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)) { switch (priv->can.state) { case CAN_STATE_ERROR_ACTIVE: - if (priv->devtype_data->quirks & + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_BROKEN_WERR_STATE) flexcan_error_irq_enable(priv); else @@ -1423,13 +1423,13 @@ static int flexcan_rx_offload_setup(struct net_devi= ce *dev) else priv->mb_size =3D sizeof(struct flexcan_mb) + CAN_MAX_DLEN; =20 - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_NR_MB_16) + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_MB_16) priv->mb_count =3D 16; else priv->mb_count =3D (sizeof(priv->regs->mb[0]) / priv->mb_size) + (sizeof(priv->regs->mb[1]) / priv->mb_size); =20 - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) priv->tx_mb_reserved =3D flexcan_get_mb(priv, FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP); else @@ -1441,7 +1441,7 @@ static int flexcan_rx_offload_setup(struct net_device= *dev) =20 priv->offload.mailbox_read =3D flexcan_mailbox_read; =20 - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { priv->offload.mb_first =3D FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST; priv->offload.mb_last =3D priv->mb_count - 2; =20 @@ -1506,7 +1506,7 @@ static int flexcan_chip_start(struct net_device *dev) if (err) goto out_chip_disable; =20 - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_ECC) + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SUPPORT_ECC) flexcan_ram_init(dev); =20 flexcan_set_bittiming(dev); @@ -1535,7 +1535,7 @@ static int flexcan_chip_start(struct net_device *dev) * - disable for timestamp mode * - enable for FIFO mode */ - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) reg_mcr &=3D ~FLEXCAN_MCR_FEN; else reg_mcr |=3D FLEXCAN_MCR_FEN; @@ -1586,7 +1586,7 @@ static int flexcan_chip_start(struct net_device *dev) * on most Flexcan cores, too. Otherwise we don't get * any error warning or passive interrupts. */ - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_BROKEN_WERR_STATE || + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_BROKEN_WERR_STATE || priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) reg_ctrl |=3D FLEXCAN_CTRL_ERR_MSK; else @@ -1599,7 +1599,7 @@ static int flexcan_chip_start(struct net_device *dev) netdev_dbg(dev, "%s: writing ctrl=3D0x%08x", __func__, reg_ctrl); priv->write(reg_ctrl, ®s->ctrl); =20 - if ((priv->devtype_data->quirks & FLEXCAN_QUIRK_ENABLE_EACEN_RRS)) { + if ((priv->devtype_data.quirks & FLEXCAN_QUIRK_ENABLE_EACEN_RRS)) { reg_ctrl2 =3D priv->read(®s->ctrl2); reg_ctrl2 |=3D FLEXCAN_CTRL2_EACEN | FLEXCAN_CTRL2_RRS; priv->write(reg_ctrl2, ®s->ctrl2); @@ -1631,7 +1631,7 @@ static int flexcan_chip_start(struct net_device *dev) priv->write(reg_fdctrl, ®s->fdctrl); } =20 - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { for (i =3D priv->offload.mb_first; i <=3D priv->offload.mb_last; i++) { mb =3D flexcan_get_mb(priv, i); priv->write(FLEXCAN_MB_CODE_RX_EMPTY, @@ -1659,7 +1659,7 @@ static int flexcan_chip_start(struct net_device *dev) priv->write(0x0, ®s->rx14mask); priv->write(0x0, ®s->rx15mask); =20 - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_DISABLE_RXFG) + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_DISABLE_RXFG) priv->write(0x0, ®s->rxfgmask); =20 /* clear acceptance filters */ @@ -1673,7 +1673,7 @@ static int flexcan_chip_start(struct net_device *dev) * This also works around errata e5295 which generates false * positive memory errors and put the device in freeze mode. */ - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_DISABLE_MECR) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_DISABLE_MECR) { /* Follow the protocol as described in "Detection * and Correction of Memory Errors" to write to * MECR register (step 1 - 5) @@ -1799,7 +1799,7 @@ static int flexcan_open(struct net_device *dev) if (err) goto out_can_rx_offload_disable; =20 - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_NR_IRQ_3) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_IRQ_3) { err =3D request_irq(priv->irq_boff, flexcan_irq, IRQF_SHARED, dev->name, dev); if (err) @@ -1845,7 +1845,7 @@ static int flexcan_close(struct net_device *dev) netif_stop_queue(dev); flexcan_chip_interrupts_disable(dev); =20 - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_NR_IRQ_3) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_IRQ_3) { free_irq(priv->irq_err, dev); free_irq(priv->irq_boff, dev); } @@ -2051,9 +2051,9 @@ static int flexcan_setup_stop_mode(struct platform_de= vice *pdev) =20 priv =3D netdev_priv(dev); =20 - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW) + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW) ret =3D flexcan_setup_stop_mode_scfw(pdev); - else if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR) + else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR) ret =3D flexcan_setup_stop_mode_gpr(pdev); else /* return 0 directly if doesn't support stop mode feature */ @@ -2181,9 +2181,10 @@ static int flexcan_probe(struct platform_device *pde= v) dev->flags |=3D IFF_ECHO; =20 priv =3D netdev_priv(dev); + priv->devtype_data =3D *devtype_data; =20 if (of_property_read_bool(pdev->dev.of_node, "big-endian") || - devtype_data->quirks & FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN) { + priv->devtype_data.quirks & FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN) { priv->read =3D flexcan_read_be; priv->write =3D flexcan_write_be; } else { @@ -2202,10 +2203,9 @@ static int flexcan_probe(struct platform_device *pde= v) priv->clk_ipg =3D clk_ipg; priv->clk_per =3D clk_per; priv->clk_src =3D clk_src; - priv->devtype_data =3D devtype_data; priv->reg_xceiver =3D reg_xceiver; =20 - if (devtype_data->quirks & FLEXCAN_QUIRK_NR_IRQ_3) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_IRQ_3) { priv->irq_boff =3D platform_get_irq(pdev, 1); if (priv->irq_boff <=3D 0) { err =3D -ENODEV; @@ -2218,7 +2218,7 @@ static int flexcan_probe(struct platform_device *pdev) } } =20 - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_FD) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SUPPORT_FD) { priv->can.ctrlmode_supported |=3D CAN_CTRLMODE_FD | CAN_CTRLMODE_FD_NON_ISO; priv->can.bittiming_const =3D &flexcan_fd_bittiming_const; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65280C4332F for ; Tue, 25 Jan 2022 00:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374396AbiAYAQ5 (ORCPT ); Mon, 24 Jan 2022 19:16:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382455AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A356BC01D7EE; Mon, 24 Jan 2022 13:31:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 38EF9B81233; Mon, 24 Jan 2022 21:31:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64F2BC340E7; Mon, 24 Jan 2022 21:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059871; bh=efwhqMUVu11F6VIjOBn0/lWVP3SRbyzArxdtcMX5RLU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WuKeuI7oA3x3AZOV74UCcJI4Ngpq5eSvd85WtIXw86ntpedCCmpJzkVkRnpirUHKf dOzMBfUcYY5kj79LQekUdVcMfqvRqKTTlKjyEOd4TwXgw8ifbfZ20+2gSPZ9u0v0uO gHJthpI5SPqZ5NbCb+SldXwqgkyTTXbyvivlRBKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.16 0730/1039] can: flexcan: rename RX modes Date: Mon, 24 Jan 2022 19:41:59 +0100 Message-Id: <20220124184149.866587888@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 34ea4e1c99f1f177f87e4ae7896caef238dd741a ] Most flexcan IP cores support 2 RX modes: - FIFO - mailbox The names for these modes were chosen to reflect the name of the rx-offload mode they are using. The name of the RX modes should better reflect their difference with regards the flexcan IP core. So this patch renames the various occurrences of OFF_FIFO to RX_FIFO and OFF_TIMESTAMP to RX_MAILBOX: | FLEXCAN_TX_MB_RESERVED_OFF_FIFO -> FLEXCAN_TX_MB_RESERVED_RX_FIFO | FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP -> FLEXCAN_TX_MB_RESERVED_RX_MAILBOX | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP -> FLEXCAN_QUIRK_USE_RX_MAILBOX Link: https://lore.kernel.org/all/20220107193105.1699523-4-mkl@pengutronix.= de Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/can/flexcan.c | 48 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 26bf0a0a72f1d..ba52e70d6a166 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -173,9 +173,9 @@ =20 /* FLEXCAN interrupt flag register (IFLAG) bits */ /* Errata ERR005829 step7: Reserve first valid MB */ -#define FLEXCAN_TX_MB_RESERVED_OFF_FIFO 8 -#define FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP 0 -#define FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST (FLEXCAN_TX_MB_RESERVED_OFF_TIME= STAMP + 1) +#define FLEXCAN_TX_MB_RESERVED_RX_FIFO 8 +#define FLEXCAN_TX_MB_RESERVED_RX_MAILBOX 0 +#define FLEXCAN_RX_MB_RX_MAILBOX_FIRST (FLEXCAN_TX_MB_RESERVED_RX_MAILBOX = + 1) #define FLEXCAN_IFLAG_MB(x) BIT_ULL(x) #define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) #define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) @@ -234,8 +234,8 @@ #define FLEXCAN_QUIRK_ENABLE_EACEN_RRS BIT(3) /* Disable non-correctable errors interrupt and freeze mode */ #define FLEXCAN_QUIRK_DISABLE_MECR BIT(4) -/* Use timestamp based offloading */ -#define FLEXCAN_QUIRK_USE_OFF_TIMESTAMP BIT(5) +/* Use mailboxes (not FIFO) for RX path */ +#define FLEXCAN_QUIRK_USE_RX_MAILBOX BIT(5) /* No interrupt for error passive */ #define FLEXCAN_QUIRK_BROKEN_PERR_STATE BIT(6) /* default to BE register access */ @@ -406,38 +406,38 @@ static const struct flexcan_devtype_data fsl_imx28_de= vtype_data =3D { =20 static const struct flexcan_devtype_data fsl_imx6q_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | - FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_BROKEN_PERR_STATE | + FLEXCAN_QUIRK_USE_RX_MAILBOX | FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR, }; =20 static const struct flexcan_devtype_data fsl_imx8qm_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | - FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_BROKEN_PERR_STATE | + FLEXCAN_QUIRK_USE_RX_MAILBOX | FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW, }; =20 static struct flexcan_devtype_data fsl_imx8mp_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | - FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | + FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_RX_MAILBOX | FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR | FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SUPPORT_ECC, }; =20 static const struct flexcan_devtype_data fsl_vf610_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | - FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | + FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_RX_MAILBOX | FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SUPPORT_ECC, }; =20 static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | - FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP, + FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_USE_RX_MAILBOX, }; =20 static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE | - FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_SUPPORT_FD | + FLEXCAN_QUIRK_USE_RX_MAILBOX | FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SUPPORT_ECC, }; =20 @@ -1022,7 +1022,7 @@ static struct sk_buff *flexcan_mailbox_read(struct ca= n_rx_offload *offload, =20 mb =3D flexcan_get_mb(priv, n); =20 - if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX) { u32 code; =20 do { @@ -1087,7 +1087,7 @@ static struct sk_buff *flexcan_mailbox_read(struct ca= n_rx_offload *offload, } =20 mark_as_read: - if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX) flexcan_write64(priv, FLEXCAN_IFLAG_MB(n), ®s->iflag1); else priv->write(FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, ®s->iflag1); @@ -1113,7 +1113,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) enum can_state last_state =3D priv->can.state; =20 /* reception interrupt */ - if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX) { u64 reg_iflag_rx; int ret; =20 @@ -1429,20 +1429,20 @@ static int flexcan_rx_offload_setup(struct net_devi= ce *dev) priv->mb_count =3D (sizeof(priv->regs->mb[0]) / priv->mb_size) + (sizeof(priv->regs->mb[1]) / priv->mb_size); =20 - if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX) priv->tx_mb_reserved =3D - flexcan_get_mb(priv, FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP); + flexcan_get_mb(priv, FLEXCAN_TX_MB_RESERVED_RX_MAILBOX); else priv->tx_mb_reserved =3D - flexcan_get_mb(priv, FLEXCAN_TX_MB_RESERVED_OFF_FIFO); + flexcan_get_mb(priv, FLEXCAN_TX_MB_RESERVED_RX_FIFO); priv->tx_mb_idx =3D priv->mb_count - 1; priv->tx_mb =3D flexcan_get_mb(priv, priv->tx_mb_idx); priv->tx_mask =3D FLEXCAN_IFLAG_MB(priv->tx_mb_idx); =20 priv->offload.mailbox_read =3D flexcan_mailbox_read; =20 - if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { - priv->offload.mb_first =3D FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST; + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX) { + priv->offload.mb_first =3D FLEXCAN_RX_MB_RX_MAILBOX_FIRST; priv->offload.mb_last =3D priv->mb_count - 2; =20 priv->rx_mask =3D GENMASK_ULL(priv->offload.mb_last, @@ -1532,10 +1532,10 @@ static int flexcan_chip_start(struct net_device *de= v) /* MCR * * FIFO: - * - disable for timestamp mode + * - disable for mailbox mode * - enable for FIFO mode */ - if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX) reg_mcr &=3D ~FLEXCAN_MCR_FEN; else reg_mcr |=3D FLEXCAN_MCR_FEN; @@ -1631,7 +1631,7 @@ static int flexcan_chip_start(struct net_device *dev) priv->write(reg_fdctrl, ®s->fdctrl); } =20 - if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX) { for (i =3D priv->offload.mb_first; i <=3D priv->offload.mb_last; i++) { mb =3D flexcan_get_mb(priv, i); priv->write(FLEXCAN_MB_CODE_RX_EMPTY, @@ -1639,7 +1639,7 @@ static int flexcan_chip_start(struct net_device *dev) } } else { /* clear and invalidate unused mailboxes first */ - for (i =3D FLEXCAN_TX_MB_RESERVED_OFF_FIFO; i < priv->mb_count; i++) { + for (i =3D FLEXCAN_TX_MB_RESERVED_RX_FIFO; i < priv->mb_count; i++) { mb =3D flexcan_get_mb(priv, i); priv->write(FLEXCAN_MB_CODE_RX_INACTIVE, &mb->can_ctrl); @@ -2164,7 +2164,7 @@ static int flexcan_probe(struct platform_device *pdev) return -ENODEV; =20 if ((devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_FD) && - !(devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP)) { + !(devtype_data->quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX)) { dev_err(&pdev->dev, "CAN-FD mode doesn't work with FIFO mode!\n"); return -EINVAL; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41838C4167D for ; Tue, 25 Jan 2022 00:18:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374138AbiAYAQO (ORCPT ); Mon, 24 Jan 2022 19:16:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382763AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 014C1C01D7F0; Mon, 24 Jan 2022 13:31:16 -0800 (PST) Received: from smtp.kernel.org (relay.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 954A1614DE; Mon, 24 Jan 2022 21:31:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54EC7C340E4; Mon, 24 Jan 2022 21:31:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059875; bh=PyUDj7NjAiWTUocF8frnXLOzu5jD+g0sSLunoBOVGXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ku/OrO5l8WxOO8RHcEUu7Yy03B46dYVfzj+L2YV22fb5nW13GVRBJmvWWWdoXbgh0 nq9Lhk+8zIfqthAE7qFPR6xzL2kfEzKaYX4HJ8V+e8UiZ3BF6sCLwhq6iDoBOyTbDY rstcAnDxRvqKupeO7Qi2ykQDefwRAjPgnXILum68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.16 0731/1039] can: flexcan: add more quirks to describe RX path capabilities Date: Mon, 24 Jan 2022 19:42:00 +0100 Message-Id: <20220124184149.898031977@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit c5c88591040ee7d84d037328eed9019d3ffab821 ] Most flexcan IP cores support 2 RX modes: - FIFO - mailbox Some IP core versions cannot receive CAN RTR messages via mailboxes. This patch adds quirks to document this. This information will be used in a later patch to switch from FIFO to more performant mailbox mode at the expense of losing the ability to receive RTR messages. This trade off is beneficial in certain use cases. Link: https://lore.kernel.org/all/20220107193105.1699523-5-mkl@pengutronix.= de Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/can/flexcan.c | 66 ++++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index ba52e70d6a166..57cebc4156616 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -252,6 +252,12 @@ #define FLEXCAN_QUIRK_NR_IRQ_3 BIT(12) /* Setup 16 mailboxes */ #define FLEXCAN_QUIRK_NR_MB_16 BIT(13) +/* Device supports RX via mailboxes */ +#define FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX BIT(14) +/* Device supports RTR reception via mailboxes */ +#define FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR BIT(15) +/* Device supports RX via FIFO */ +#define FLEXCAN_QUIRK_SUPPPORT_RX_FIFO BIT(16) =20 /* Structure of the message buffer */ struct flexcan_mb { @@ -386,59 +392,78 @@ struct flexcan_priv { =20 static const struct flexcan_devtype_data fsl_mcf5441x_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_BROKEN_PERR_STATE | - FLEXCAN_QUIRK_NR_IRQ_3 | FLEXCAN_QUIRK_NR_MB_16, + FLEXCAN_QUIRK_NR_IRQ_3 | FLEXCAN_QUIRK_NR_MB_16 | + FLEXCAN_QUIRK_SUPPPORT_RX_FIFO, }; =20 static const struct flexcan_devtype_data fsl_p1010_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_BROKEN_WERR_STATE | FLEXCAN_QUIRK_BROKEN_PERR_STATE | - FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN, + FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_FIFO, }; =20 static const struct flexcan_devtype_data fsl_imx25_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_BROKEN_WERR_STATE | - FLEXCAN_QUIRK_BROKEN_PERR_STATE, + FLEXCAN_QUIRK_BROKEN_PERR_STATE | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_FIFO, }; =20 static const struct flexcan_devtype_data fsl_imx28_devtype_data =3D { - .quirks =3D FLEXCAN_QUIRK_BROKEN_PERR_STATE, + .quirks =3D FLEXCAN_QUIRK_BROKEN_PERR_STATE | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_FIFO, }; =20 static const struct flexcan_devtype_data fsl_imx6q_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | FLEXCAN_QUIRK_USE_RX_MAILBOX | FLEXCAN_QUIRK_BROKEN_PERR_STATE | - FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR, + FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR, }; =20 static const struct flexcan_devtype_data fsl_imx8qm_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | FLEXCAN_QUIRK_USE_RX_MAILBOX | FLEXCAN_QUIRK_BROKEN_PERR_STATE | - FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW, + FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR, }; =20 static struct flexcan_devtype_data fsl_imx8mp_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_RX_MAILBOX | FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR | - FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SUPPORT_ECC, + FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SUPPORT_ECC | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR, }; =20 static const struct flexcan_devtype_data fsl_vf610_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_RX_MAILBOX | - FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SUPPORT_ECC, + FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SUPPORT_ECC | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR, }; =20 static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | - FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_USE_RX_MAILBOX, + FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_USE_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR, }; =20 static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data =3D { .quirks =3D FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_USE_RX_MAILBOX | FLEXCAN_QUIRK_SUPPORT_FD | - FLEXCAN_QUIRK_SUPPORT_ECC, + FLEXCAN_QUIRK_SUPPORT_ECC | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR, }; =20 static const struct can_bittiming_const flexcan_bittiming_const =3D { @@ -2164,8 +2189,25 @@ static int flexcan_probe(struct platform_device *pde= v) return -ENODEV; =20 if ((devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_FD) && - !(devtype_data->quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX)) { - dev_err(&pdev->dev, "CAN-FD mode doesn't work with FIFO mode!\n"); + !((devtype_data->quirks & + (FLEXCAN_QUIRK_USE_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR | + FLEXCAN_QUIRK_SUPPPORT_RX_FIFO)) =3D=3D + (FLEXCAN_QUIRK_USE_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR))) { + dev_err(&pdev->dev, "CAN-FD mode doesn't work in RX-FIFO mode!\n"); + return -EINVAL; + } + + if ((devtype_data->quirks & + (FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR)) =3D=3D + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR) { + dev_err(&pdev->dev, + "Quirks (0x%08x) inconsistent: RX_MAILBOX_RX supported but not RX_MAILB= OX\n", + devtype_data->quirks); return -EINVAL; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B21FC2BA4C for ; Tue, 25 Jan 2022 00:18:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374178AbiAYAQU (ORCPT ); Mon, 24 Jan 2022 19:16:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382995AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05D36C01D7F1; Mon, 24 Jan 2022 13:31:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 93851614F3; Mon, 24 Jan 2022 21:31:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 674CBC340E4; Mon, 24 Jan 2022 21:31:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059878; bh=5ND4c0WFizvbyzJNtRy1VuRdoEZMvxVRqMNu9KAXCrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M8mtHVw5RbMHWSSuq7TmsLnd2PYnOm2ENQAgX4/cWDYqLPRtBRAo6mjKgeeJ+oRZh hA+X7lIx7sW5Ij+J4vBT8VOfwa6I866zGgw33W+OSlQZwhSL/25QL8f4nXuymSgHxX +cOifRRn+lJLsyJczBvz1++qZ3okd/VxYNFOvr6E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Sasha Levin Subject: [PATCH 5.16 0732/1039] x86/kbuild: Enable CONFIG_KALLSYMS_ALL=y in the defconfigs Date: Mon, 24 Jan 2022 19:42:01 +0100 Message-Id: <20220124184149.928393193@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ingo Molnar [ Upstream commit b6aa86cff44cf099299d3a5e66348cb709cd7964 ] Most distro kernels have this option enabled, to improve debug output. Lockdep also selects it. Enable this in the defconfig kernel as well, to make it more representative of what people are using on x86. Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/YdTn7gssoMVDMgMw@gmail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/configs/i386_defconfig | 1 + arch/x86/configs/x86_64_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defcon= fig index e81885384f604..99398cbdae434 100644 --- a/arch/x86/configs/i386_defconfig +++ b/arch/x86/configs/i386_defconfig @@ -262,3 +262,4 @@ CONFIG_BLK_DEV_IO_TRACE=3Dy CONFIG_PROVIDE_OHCI1394_DMA_INIT=3Dy CONFIG_EARLY_PRINTK_DBGP=3Dy CONFIG_DEBUG_BOOT_PARAMS=3Dy +CONFIG_KALLSYMS_ALL=3Dy diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_de= fconfig index e8a7a0af2bdaa..d7298b104a456 100644 --- a/arch/x86/configs/x86_64_defconfig +++ b/arch/x86/configs/x86_64_defconfig @@ -258,3 +258,4 @@ CONFIG_BLK_DEV_IO_TRACE=3Dy CONFIG_PROVIDE_OHCI1394_DMA_INIT=3Dy CONFIG_EARLY_PRINTK_DBGP=3Dy CONFIG_DEBUG_BOOT_PARAMS=3Dy +CONFIG_KALLSYMS_ALL=3Dy --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D7D0C4167E for ; Tue, 25 Jan 2022 00:18:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374105AbiAYAQL (ORCPT ); Mon, 24 Jan 2022 19:16:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382508AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73851C01D7F2; Mon, 24 Jan 2022 13:31:23 -0800 (PST) Received: from smtp.kernel.org (relay.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 30823B81142; Mon, 24 Jan 2022 21:31:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AC05C340E4; Mon, 24 Jan 2022 21:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059881; bh=yXNyj5w8WPn/dUWK5qhdWXLoj5pVBSY3hqJPXa2z4tY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C1iIRh4avFjF9wnxFq3Q24y9mSOwrA2KpE5juBvr6b7OYofqY4ZJnw61guiE2VmEs Xx1hKwmLBnlD7Pw4irZhplA2FSApxtM8wSR9v439RT+2oUbZdwNTdr7PrDUlZULcUB ZeWU+vz9Kxu+Qw5TLygbdem+ZJlQ0wUeexS0wl9I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Protsenko , Sylwester Nawrocki , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.16 0733/1039] clk: samsung: exynos850: Register clocks early Date: Mon, 24 Jan 2022 19:42:02 +0100 Message-Id: <20220124184149.962049672@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sam Protsenko [ Upstream commit bcda841f9bf2cddcf2f000cba96f2e27f6f2bdbf ] Some clocks must be registered before init calls. For example MCT clock (from CMU_PERI) is needed for MCT timer driver, which is registered with TIMER_OF_DECLARE(). By the time we get to core_initcall() used for clk-exynos850 platform driver init, it's already too late. Inability to get "mct" clock in MCT driver leads to kernel panic, as functions registered with *_OF_DECLARE() can't do deferred calls. MCT timer driver can't be fixed either, as it's acting as a clock source and it's essential to register it in start_kernel() -> time_init(). Let's register CMU_PERI clocks early, using CLK_OF_DECLARE(). CMU_TOP generates clocks needed for CMU_PERI, but it's already registered early. While at it, let's cleanup the code a bit, by extracting everything related to CMU initialization and registration to the separate function. Similar issue was discussed at [1] and addressed in commit 1f7db7bbf031 ("clk: renesas: cpg-mssr: Add early clock support"), as well as in drivers/clk/mediatek/clk-mt2712.c. [1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/2018082913= 2954.64862-2-chris.brandt@renesas.com/ Signed-off-by: Sam Protsenko Signed-off-by: Sylwester Nawrocki Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20211122144206.23134-1-semen.protsenko@lina= ro.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/clk/samsung/clk-exynos850.c | 70 ++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos850.c b/drivers/clk/samsung/clk-= exynos850.c index 2294989e244c5..79cce8ba88831 100644 --- a/drivers/clk/samsung/clk-exynos850.c +++ b/drivers/clk/samsung/clk-exynos850.c @@ -60,6 +60,43 @@ static void __init exynos850_init_clocks(struct device_n= ode *np, iounmap(reg_base); } =20 +/** + * exynos850_register_cmu - Register specified Exynos850 CMU domain + * @dev: Device object; may be NULL if this function is not being + * called from platform driver probe function + * @np: CMU device tree node + * @cmu: CMU data + * + * Register specified CMU domain, which includes next steps: + * + * 1. Enable parent clock of @cmu CMU + * 2. Set initial registers configuration for @cmu CMU clocks + * 3. Register @cmu CMU clocks using Samsung clock framework API + */ +static void __init exynos850_register_cmu(struct device *dev, + struct device_node *np, const struct samsung_cmu_info *cmu) +{ + /* Keep CMU parent clock running (needed for CMU registers access) */ + if (cmu->clk_name) { + struct clk *parent_clk; + + if (dev) + parent_clk =3D clk_get(dev, cmu->clk_name); + else + parent_clk =3D of_clk_get_by_name(np, cmu->clk_name); + + if (IS_ERR(parent_clk)) { + pr_err("%s: could not find bus clock %s; err =3D %ld\n", + __func__, cmu->clk_name, PTR_ERR(parent_clk)); + } else { + clk_prepare_enable(parent_clk); + } + } + + exynos850_init_clocks(np, cmu->clk_regs, cmu->nr_clk_regs); + samsung_cmu_register_one(np, cmu); +} + /* ---- CMU_TOP ----------------------------------------------------------= --- */ =20 /* Register Offset definitions for CMU_TOP (0x120e0000) */ @@ -347,10 +384,10 @@ static const struct samsung_cmu_info top_cmu_info __i= nitconst =3D { =20 static void __init exynos850_cmu_top_init(struct device_node *np) { - exynos850_init_clocks(np, top_clk_regs, ARRAY_SIZE(top_clk_regs)); - samsung_cmu_register_one(np, &top_cmu_info); + exynos850_register_cmu(NULL, np, &top_cmu_info); } =20 +/* Register CMU_TOP early, as it's a dependency for other early domains */ CLK_OF_DECLARE(exynos850_cmu_top, "samsung,exynos850-cmu-top", exynos850_cmu_top_init); =20 @@ -615,6 +652,15 @@ static const struct samsung_cmu_info peri_cmu_info __i= nitconst =3D { .clk_name =3D "dout_peri_bus", }; =20 +static void __init exynos850_cmu_peri_init(struct device_node *np) +{ + exynos850_register_cmu(NULL, np, &peri_cmu_info); +} + +/* Register CMU_PERI early, as it's needed for MCT timer */ +CLK_OF_DECLARE(exynos850_cmu_peri, "samsung,exynos850-cmu-peri", + exynos850_cmu_peri_init); + /* ---- CMU_CORE ---------------------------------------------------------= --- */ =20 /* Register Offset definitions for CMU_CORE (0x12000000) */ @@ -779,24 +825,9 @@ static int __init exynos850_cmu_probe(struct platform_= device *pdev) { const struct samsung_cmu_info *info; struct device *dev =3D &pdev->dev; - struct device_node *np =3D dev->of_node; =20 info =3D of_device_get_match_data(dev); - exynos850_init_clocks(np, info->clk_regs, info->nr_clk_regs); - samsung_cmu_register_one(np, info); - - /* Keep bus clock running, so it's possible to access CMU registers */ - if (info->clk_name) { - struct clk *bus_clk; - - bus_clk =3D clk_get(dev, info->clk_name); - if (IS_ERR(bus_clk)) { - pr_err("%s: could not find bus clock %s; err =3D %ld\n", - __func__, info->clk_name, PTR_ERR(bus_clk)); - } else { - clk_prepare_enable(bus_clk); - } - } + exynos850_register_cmu(dev, dev->of_node, info); =20 return 0; } @@ -806,9 +837,6 @@ static const struct of_device_id exynos850_cmu_of_match= [] =3D { { .compatible =3D "samsung,exynos850-cmu-hsi", .data =3D &hsi_cmu_info, - }, { - .compatible =3D "samsung,exynos850-cmu-peri", - .data =3D &peri_cmu_info, }, { .compatible =3D "samsung,exynos850-cmu-core", .data =3D &core_cmu_info, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70A66C4332F for ; Tue, 25 Jan 2022 00:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372788AbiAYAMb (ORCPT ); Mon, 24 Jan 2022 19:12:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848976AbiAXXY3 (ORCPT ); Mon, 24 Jan 2022 18:24:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B769C07321A; Mon, 24 Jan 2022 13:29:47 -0800 (PST) Received: from smtp.kernel.org (relay.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 04D1560C44; Mon, 24 Jan 2022 21:29:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D292DC340E4; Mon, 24 Jan 2022 21:29:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059786; bh=GjXLsfRDL+vMnvwCNX4tCqIZuHwbl8YDD1glN2o18Y8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RU03oQyTTRlTzj5y40M2iHAjLO3/7Vl8786t5dDdIRcr3+uYQsc+0qDpIqfySrpEe OfXNhuyPKffp9IqS+kdXMgdbxoqlhkiUDGMoVfU7JxQC+cRpV4KblkLFVYY+5+Ryu9 OqQ6Y3lgbAKGwHvamao3aPcSPJPdF0UbFyKaWM/o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0734/1039] powerpc/6xx: add missing of_node_put Date: Mon, 24 Jan 2022 19:42:03 +0100 Message-Id: <20220124184149.999778545@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Julia Lawall [ Upstream commit f6e82647ff71d427d4148964b71f239fba9d7937 ] for_each_compatible_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ expression e; local idexpression n; @@ @@ local idexpression n; expression e; @@ for_each_compatible_node(n,...) { ... ( of_node_put(n); | e =3D n | + of_node_put(n); ? break; ) ... } ... when !=3D n // Signed-off-by: Julia Lawall Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1448051604-25256-2-git-send-email-Julia.Law= all@lip6.fr Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/p= latforms/embedded6xx/hlwd-pic.c index 15396333a90bd..a4b020e4b6af0 100644 --- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c +++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c @@ -214,6 +214,7 @@ void hlwd_pic_probe(void) irq_set_chained_handler(cascade_virq, hlwd_pic_irq_cascade); hlwd_irq_host =3D host; + of_node_put(np); break; } } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23328C433F5 for ; Mon, 24 Jan 2022 22:13:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581984AbiAXWMr (ORCPT ); Mon, 24 Jan 2022 17:12:47 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44874 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453305AbiAXV3w (ORCPT ); Mon, 24 Jan 2022 16:29:52 -0500 Received: from smtp.kernel.org (relay.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 ABBEEB80CCF; Mon, 24 Jan 2022 21:29:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1F57C340E4; Mon, 24 Jan 2022 21:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059789; bh=rfnii2i5sU04+NW982sp8A0gGiDGgjs8gxUSp7gBgk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tspMyoxbP3SCoSwMWHso/bDM9Ue/QNlyhNeLrTyPOMo16R7tstHFHsVm0c9Nyb0WE QvXRpVlFlqXmH0D8Mipz+kA0OTmjly6BxSXx4iHDdTQ1M34RE6ys2rpIG50+RxTpXR TSRjt2XYsFoflKRjVsGWc5yD8axwtjGf6qxNj1fU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0735/1039] powerpc/powernv: add missing of_node_put Date: Mon, 24 Jan 2022 19:42:04 +0100 Message-Id: <20220124184150.030797507@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Julia Lawall [ Upstream commit 7d405a939ca960162eb30c1475759cb2fdf38f8c ] for_each_compatible_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ local idexpression n; expression e; @@ for_each_compatible_node(n,...) { ... ( of_node_put(n); | e =3D n | + of_node_put(n); ? break; ) ... } ... when !=3D n // Signed-off-by: Julia Lawall Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1448051604-25256-4-git-send-email-Julia.Law= all@lip6.fr Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/platforms/powernv/opal-lpc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platf= orms/powernv/opal-lpc.c index 1e5d51db40f84..5390c888db162 100644 --- a/arch/powerpc/platforms/powernv/opal-lpc.c +++ b/arch/powerpc/platforms/powernv/opal-lpc.c @@ -396,6 +396,7 @@ void __init opal_lpc_init(void) if (!of_get_property(np, "primary", NULL)) continue; opal_lpc_chip_id =3D of_get_ibm_chip_id(np); + of_node_put(np); break; } if (opal_lpc_chip_id < 0) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8884C433FE for ; Tue, 25 Jan 2022 00:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372532AbiAYALw (ORCPT ); Mon, 24 Jan 2022 19:11:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849404AbiAXXZq (ORCPT ); Mon, 24 Jan 2022 18:25:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA448C07322A; Mon, 24 Jan 2022 13:29:54 -0800 (PST) Received: from smtp.kernel.org (relay.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 93B21B8105C; Mon, 24 Jan 2022 21:29:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C920EC340E4; Mon, 24 Jan 2022 21:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059792; bh=Tivkv/sFkps9YthhNWqLu2xQYDfifae22GMxPKEtHvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WvUMCe8byb7JMlJDgNC4ifbXOwiHWjYHh2XZJjGRjvzGJWzWz2oSLunUvhqqFcEGd AMbvHh3fZExSAvW7Qe8NxOOvYLE3gysRRTwtsNbH3Ybe5H+WihdpKm02sV9Swh+yZ0 mv26oKdSLx4z7rh7L3QNkAOeclvTFEioHZN3rIuY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0736/1039] powerpc/cell: add missing of_node_put Date: Mon, 24 Jan 2022 19:42:05 +0100 Message-Id: <20220124184150.069215755@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Julia Lawall [ Upstream commit a841fd009e51c8c0a8f07c942e9ab6bb48da8858 ] for_each_node_by_name performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ expression e,e1; local idexpression n; @@ for_each_node_by_name(n, e1) { ... when !=3D of_node_put(n) when !=3D e =3D n ( return n; | + of_node_put(n); ? return ...; ) ... } // Signed-off-by: Julia Lawall Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1448051604-25256-7-git-send-email-Julia.Law= all@lip6.fr Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/platforms/cell/iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/c= ell/iommu.c index fa08699aedeb8..d32f24de84798 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c @@ -977,6 +977,7 @@ static int __init cell_iommu_fixed_mapping_init(void) if (hbase < dbase || (hend > (dbase + dsize))) { pr_debug("iommu: hash window doesn't fit in" "real DMA window\n"); + of_node_put(np); return -1; } } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1837C43217 for ; Tue, 25 Jan 2022 00:14:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372605AbiAYAME (ORCPT ); Mon, 24 Jan 2022 19:12:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849510AbiAXX0B (ORCPT ); Mon, 24 Jan 2022 18:26:01 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF09FC073232; Mon, 24 Jan 2022 13:29:56 -0800 (PST) Received: from smtp.kernel.org (relay.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 87718B8105C; Mon, 24 Jan 2022 21:29:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B616CC340E4; Mon, 24 Jan 2022 21:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059795; bh=noPkjLggVRzhHtJtUyyY8AiSqQGvqU0JZkwRb0GYV3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pxv8rjPpV/6ZrQ5boOZf2hsy7EPGobqRaLYBOJxilQB7Jz7O4DN00LU+lFWBOOuH+ YILReWVU4I9AxjfzYpbPAJQU+rn1QB8shop4E/ReJwOvNqyDJEEyzp5yxht4T/P1pS nd935g9MHZz92Ozhd8HjZa6oSHoanFX5NDp50ckg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0737/1039] powerpc/btext: add missing of_node_put Date: Mon, 24 Jan 2022 19:42:06 +0100 Message-Id: <20220124184150.101609634@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Julia Lawall [ Upstream commit a1d2b210ffa52d60acabbf7b6af3ef7e1e69cda0 ] for_each_node_by_type performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ local idexpression n; expression e; @@ for_each_node_by_type(n,...) { ... ( of_node_put(n); | e =3D n | + of_node_put(n); ? break; ) ... } ... when !=3D n // Signed-off-by: Julia Lawall Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1448051604-25256-6-git-send-email-Julia.Law= all@lip6.fr Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kernel/btext.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index 803c2a45b22ac..1cffb5e7c38d6 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -241,8 +241,10 @@ int __init btext_find_display(int allow_nonstdout) rc =3D btext_initialize(np); printk("result: %d\n", rc); } - if (rc =3D=3D 0) + if (rc =3D=3D 0) { + of_node_put(np); break; + } } return rc; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC752C4332F for ; Tue, 25 Jan 2022 00:14:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372579AbiAYAMA (ORCPT ); Mon, 24 Jan 2022 19:12:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849518AbiAXX0B (ORCPT ); Mon, 24 Jan 2022 18:26:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73877C073238; Mon, 24 Jan 2022 13:29:59 -0800 (PST) Received: from smtp.kernel.org (relay.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 C8EED60C60; Mon, 24 Jan 2022 21:29:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A98F8C340E4; Mon, 24 Jan 2022 21:29:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059798; bh=tg8iEjvzYlmjjMbrWjc40apMLT5XKRdF0J/xCoow65U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EH3+w4BDIdn/dmvGyIhfVgmGxqBobhvADfi7GxxtEB7wNYKAUCeCNWXvECdzXREN7 Yjzpm4u4GIKICRbNEpN29sdb1hViKGDvzI9uh4qX43/PObAwYk9LAgabi0D4oyxRpX icUyBUDoJViYhMtZQ25ElpYtqn/2Wxs9na/xKirg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Laurent Dufour , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0738/1039] powerpc/watchdog: Fix missed watchdog reset due to memory ordering race Date: Mon, 24 Jan 2022 19:42:07 +0100 Message-Id: <20220124184150.132273919@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicholas Piggin [ Upstream commit 5dad4ba68a2483fc80d70b9dc90bbe16e1f27263 ] It is possible for all CPUs to miss the pending cpumask becoming clear, and then nobody resetting it, which will cause the lockup detector to stop working. It will eventually expire, but watchdog_smp_panic will avoid doing anything if the pending mask is clear and it will never be reset. Order the cpumask clear vs the subsequent test to close this race. Add an extra check for an empty pending mask when the watchdog fires and finds its bit still clear, to try to catch any other possible races or bugs here and keep the watchdog working. The extra test in arch_touch_nmi_watchdog is required to prevent the new warning from firing off. Signed-off-by: Nicholas Piggin Reviewed-by: Laurent Dufour Debugged-by: Laurent Dufour Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211110025056.2084347-2-npiggin@gmail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kernel/watchdog.c | 41 +++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c index 3fa6d240bade2..ad94a2c6b7337 100644 --- a/arch/powerpc/kernel/watchdog.c +++ b/arch/powerpc/kernel/watchdog.c @@ -135,6 +135,10 @@ static void set_cpumask_stuck(const struct cpumask *cp= umask, u64 tb) { cpumask_or(&wd_smp_cpus_stuck, &wd_smp_cpus_stuck, cpumask); cpumask_andnot(&wd_smp_cpus_pending, &wd_smp_cpus_pending, cpumask); + /* + * See wd_smp_clear_cpu_pending() + */ + smp_mb(); if (cpumask_empty(&wd_smp_cpus_pending)) { wd_smp_last_reset_tb =3D tb; cpumask_andnot(&wd_smp_cpus_pending, @@ -221,13 +225,44 @@ static void wd_smp_clear_cpu_pending(int cpu, u64 tb) =20 cpumask_clear_cpu(cpu, &wd_smp_cpus_stuck); wd_smp_unlock(&flags); + } else { + /* + * The last CPU to clear pending should have reset the + * watchdog so we generally should not find it empty + * here if our CPU was clear. However it could happen + * due to a rare race with another CPU taking the + * last CPU out of the mask concurrently. + * + * We can't add a warning for it. But just in case + * there is a problem with the watchdog that is causing + * the mask to not be reset, try to kick it along here. + */ + if (unlikely(cpumask_empty(&wd_smp_cpus_pending))) + goto none_pending; } return; } + cpumask_clear_cpu(cpu, &wd_smp_cpus_pending); + + /* + * Order the store to clear pending with the load(s) to check all + * words in the pending mask to check they are all empty. This orders + * with the same barrier on another CPU. This prevents two CPUs + * clearing the last 2 pending bits, but neither seeing the other's + * store when checking if the mask is empty, and missing an empty + * mask, which ends with a false positive. + */ + smp_mb(); if (cpumask_empty(&wd_smp_cpus_pending)) { unsigned long flags; =20 +none_pending: + /* + * Double check under lock because more than one CPU could see + * a clear mask with the lockless check after clearing their + * pending bits. + */ wd_smp_lock(&flags); if (cpumask_empty(&wd_smp_cpus_pending)) { wd_smp_last_reset_tb =3D tb; @@ -318,8 +353,12 @@ void arch_touch_nmi_watchdog(void) { unsigned long ticks =3D tb_ticks_per_usec * wd_timer_period_ms * 1000; int cpu =3D smp_processor_id(); - u64 tb =3D get_tb(); + u64 tb; =20 + if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) + return; + + tb =3D get_tb(); if (tb - per_cpu(wd_timer_tb, cpu) >=3D ticks) { per_cpu(wd_timer_tb, cpu) =3D tb; wd_smp_clear_cpu_pending(cpu, tb); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DAAFC433EF for ; Tue, 25 Jan 2022 00:14:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372688AbiAYAMM (ORCPT ); Mon, 24 Jan 2022 19:12:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849605AbiAXX0P (ORCPT ); Mon, 24 Jan 2022 18:26:15 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 144D8C01D7E1; Mon, 24 Jan 2022 13:30:02 -0800 (PST) Received: from smtp.kernel.org (relay.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 A652360C44; Mon, 24 Jan 2022 21:30:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8169BC340E4; Mon, 24 Jan 2022 21:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059801; bh=w4/sa6VIfwmLi3PNDuC9bjSMupcRF4wgztyNzCiHA9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wiM6+EOQsFwyxdw/ZK17hi5BiwdyYUdWOPs3HXGGdHDiUmydiYtTcA6OqjqavJX8N +bVg70eaPNMTLtdqdDJTQ6ILMVLYafbcQnddLakf8fB3+/1iMoJcndiYaVIPQW/FQh 6Cp9kENx2CLefwlDX36nyweuQSQ1AWjn3ZFc8EUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Ye Guojin , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0739/1039] ASoC: imx-hdmi: add put_device() after of_find_device_by_node() Date: Mon, 24 Jan 2022 19:42:08 +0100 Message-Id: <20220124184150.168629965@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Guojin [ Upstream commit f670b274f7f6f4b2722d7f08d0fddf606a727e92 ] This was found by coccicheck: ./sound/soc/fsl/imx-hdmi.c,209,1-7,ERROR missing put_device; call of_find_device_by_node on line 119, but without a corresponding object release within this function. Reported-by: Zeal Robot Signed-off-by: Ye Guojin Link: https://lore.kernel.org/r/20211110002910.134915-1-ye.guojin@zte.com.cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/fsl/imx-hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/fsl/imx-hdmi.c b/sound/soc/fsl/imx-hdmi.c index f10359a288005..929f69b758af4 100644 --- a/sound/soc/fsl/imx-hdmi.c +++ b/sound/soc/fsl/imx-hdmi.c @@ -145,6 +145,8 @@ static int imx_hdmi_probe(struct platform_device *pdev) data->dai.capture_only =3D false; data->dai.init =3D imx_hdmi_init; =20 + put_device(&cpu_pdev->dev); + if (of_node_name_eq(cpu_np, "sai")) { data->cpu_priv.sysclk_id[1] =3D FSL_SAI_CLK_MAST1; data->cpu_priv.sysclk_id[0] =3D FSL_SAI_CLK_MAST1; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87A2BC433FE for ; Mon, 24 Jan 2022 22:23:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584443AbiAXWVM (ORCPT ); Mon, 24 Jan 2022 17:21:12 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44990 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453413AbiAXVaI (ORCPT ); Mon, 24 Jan 2022 16:30:08 -0500 Received: from smtp.kernel.org (relay.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 5006BB8105C; Mon, 24 Jan 2022 21:30:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67E96C340E4; Mon, 24 Jan 2022 21:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059804; bh=P8uN7Qcdlnrf6K1w94rRAe6b7mk1wt3YZB943ppmnEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ee+6EdznbQGMeWMA3cysw69uuVJf6laigvy0HCqQKth3m2LJcuMrAYH1/mFG93oTc jRehgTDjv3C0SZ5FYyW1/3ayiuoExzgsIPl8WOKCMsGWKXUJYF+zyNhBmwx25N5YBP Te784DT9sNrpIWUx1FLBI9+exJ7Pv5d66p0m7mls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiner Kallweit , Jean Delvare , Wolfram Sang , Sasha Levin Subject: [PATCH 5.16 0740/1039] i2c: i801: Dont silently correct invalid transfer size Date: Mon, 24 Jan 2022 19:42:09 +0100 Message-Id: <20220124184150.202022295@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Heiner Kallweit [ Upstream commit effa453168a7eeb8a562ff4edc1dbf9067360a61 ] If an invalid block size is provided, reject it instead of silently changing it to a supported value. Especially critical I see the case of a write transfer with block length 0. In this case we have no guarantee that the byte we would write is valid. When silently reducing a read to 32 bytes then we don't return an error and the caller may falsely assume that we returned the full requested data. If this change should break any (broken) caller, then I think we should fix the caller. Signed-off-by: Heiner Kallweit Reviewed-by: Jean Delvare Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/i2c/busses/i2c-i801.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 41446f9cc52da..c87ea470eba98 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -775,6 +775,11 @@ static int i801_block_transaction(struct i801_priv *pr= iv, union i2c_smbus_data * int result =3D 0; unsigned char hostc; =20 + if (read_write =3D=3D I2C_SMBUS_READ && command =3D=3D I2C_SMBUS_BLOCK_DA= TA) + data->block[0] =3D I2C_SMBUS_BLOCK_MAX; + else if (data->block[0] < 1 || data->block[0] > I2C_SMBUS_BLOCK_MAX) + return -EPROTO; + if (command =3D=3D I2C_SMBUS_I2C_BLOCK_DATA) { if (read_write =3D=3D I2C_SMBUS_WRITE) { /* set I2C_EN bit in configuration register */ @@ -788,16 +793,6 @@ static int i801_block_transaction(struct i801_priv *pr= iv, union i2c_smbus_data * } } =20 - if (read_write =3D=3D I2C_SMBUS_WRITE - || command =3D=3D I2C_SMBUS_I2C_BLOCK_DATA) { - if (data->block[0] < 1) - data->block[0] =3D 1; - if (data->block[0] > I2C_SMBUS_BLOCK_MAX) - data->block[0] =3D I2C_SMBUS_BLOCK_MAX; - } else { - data->block[0] =3D 32; /* max for SMBus block reads */ - } - /* Experience has shown that the block buffer can only be used for SMBus (not I2C) block transactions, even though the datasheet doesn't mention this limitation. */ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6930CC4167D for ; Mon, 24 Jan 2022 22:13:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380574AbiAXWNG (ORCPT ); Mon, 24 Jan 2022 17:13:06 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45014 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453432AbiAXVaJ (ORCPT ); Mon, 24 Jan 2022 16:30:09 -0500 Received: from smtp.kernel.org (relay.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 4BB83B81057; Mon, 24 Jan 2022 21:30:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 780C6C340E4; Mon, 24 Jan 2022 21:30:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059807; bh=KWoGejEVrZUfkV1DJjO87i+BhLl7v3X3Zk9ndV6PkeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PtP9TKmsI7oRGIQ1JXQgkaaq3Ta/Z+DYhqtH7OSdeIxpe9r/GcMwQgARM5/vptU4o SnnmZr7lXTlSgjuCOsh/IHt0x3Tsspsx9z6KDzwztnmORy7i2x30yVCtMAv91kLyWO 2gPOGbIZ0JRbs4x2Rw5VBa+bI0cPgZgTN4LZ1SLc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0741/1039] powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING Date: Mon, 24 Jan 2022 19:42:10 +0100 Message-Id: <20220124184150.241591333@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Michael Ellerman [ Upstream commit a4ac0d249a5db80e79d573db9e4ad29354b643a8 ] setup_profiling_timer() is only needed when CONFIG_PROFILING is enabled. Fixes the following W=3D1 warning when CONFIG_PROFILING=3Dn: linux/arch/powerpc/kernel/smp.c:1638:5: error: no previous prototype for = =E2=80=98setup_profiling_timer=E2=80=99 Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211124093254.1054750-5-mpe@ellerman.id.au Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index c23ee842c4c33..aee3a7119f977 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -1635,10 +1635,12 @@ void start_secondary(void *unused) BUG(); } =20 +#ifdef CONFIG_PROFILING int setup_profiling_timer(unsigned int multiplier) { return 0; } +#endif =20 static void fixup_topology(void) { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48D05C433EF for ; Mon, 24 Jan 2022 22:23:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584532AbiAXWVX (ORCPT ); Mon, 24 Jan 2022 17:21:23 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48094 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453445AbiAXVaN (ORCPT ); Mon, 24 Jan 2022 16:30:13 -0500 Received: from smtp.kernel.org (relay.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 7E6676131F; Mon, 24 Jan 2022 21:30:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EC75C340E4; Mon, 24 Jan 2022 21:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059809; bh=VpOIpWuYU5r7PoaTzGcmVyr0EObttdwQ5irv2gBTbpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RsKG81PsWHtcehDMBI/G1ENtgHJGgiFnr5K/czvcZDdaTDy7MdEw9GbYW7TtG7e+V u4Rj33MVyN6OhWF8NBh+cdgE4ex0lkDKIDu/olk0j3o2IdAmOzWU6021YgULt7m44o kShtF6r2q/VlJCUYQa6kno4ezY3tEBBA+lICqhPg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joakim Tjernlund , Scott Wood , Wolfram Sang , Sasha Levin Subject: [PATCH 5.16 0742/1039] i2c: mpc: Correct I2C reset procedure Date: Mon, 24 Jan 2022 19:42:11 +0100 Message-Id: <20220124184150.271234597@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joakim Tjernlund [ Upstream commit ebe82cf92cd4825c3029434cabfcd2f1780e64be ] Current I2C reset procedure is broken in two ways: 1) It only generate 1 START instead of 9 STARTs and STOP. 2) It leaves the bus Busy so every I2C xfer after the first fixup calls the reset routine again, for every xfer there after. This fixes both errors. Signed-off-by: Joakim Tjernlund Acked-by: Scott Wood Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/i2c/busses/i2c-mpc.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index db26cc36e13fe..6c698c10d3cdb 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -119,23 +119,30 @@ static inline void writeccr(struct mpc_i2c *i2c, u32 = x) /* Sometimes 9th clock pulse isn't generated, and slave doesn't release * the bus, because it wants to send ACK. * Following sequence of enabling/disabling and sending start/stop generat= es - * the 9 pulses, so it's all OK. + * the 9 pulses, each with a START then ending with STOP, so it's all OK. */ static void mpc_i2c_fixup(struct mpc_i2c *i2c) { int k; - u32 delay_val =3D 1000000 / i2c->real_clk + 1; - - if (delay_val < 2) - delay_val =3D 2; + unsigned long flags; =20 for (k =3D 9; k; k--) { writeccr(i2c, 0); - writeccr(i2c, CCR_MSTA | CCR_MTX | CCR_MEN); + writeb(0, i2c->base + MPC_I2C_SR); /* clear any status bits */ + writeccr(i2c, CCR_MEN | CCR_MSTA); /* START */ + readb(i2c->base + MPC_I2C_DR); /* init xfer */ + udelay(15); /* let it hit the bus */ + local_irq_save(flags); /* should not be delayed further */ + writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSTA); /* delay SDA */ readb(i2c->base + MPC_I2C_DR); - writeccr(i2c, CCR_MEN); - udelay(delay_val << 1); + if (k !=3D 1) + udelay(5); + local_irq_restore(flags); } + writeccr(i2c, CCR_MEN); /* Initiate STOP */ + readb(i2c->base + MPC_I2C_DR); + udelay(15); /* Let STOP propagate */ + writeccr(i2c, 0); } =20 static int i2c_mpc_wait_sr(struct mpc_i2c *i2c, int mask) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CE18C4332F for ; Mon, 24 Jan 2022 22:23:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584503AbiAXWVS (ORCPT ); Mon, 24 Jan 2022 17:21:18 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:43062 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453477AbiAXVaP (ORCPT ); Mon, 24 Jan 2022 16:30:15 -0500 Received: from smtp.kernel.org (relay.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 0E6AFB81188; Mon, 24 Jan 2022 21:30:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4893EC340E5; Mon, 24 Jan 2022 21:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059812; bh=lwk4z1qF/+7RF7Vl9dzFXszBwZQtFzeHpBCcrjjmNeI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CDzHIx7M+pcqVfL8Siz3h+rOU/pbeUg/QVzBC2bGvtIeaLgXi0esdGkJ6zoFNHjqf dbpTJp6pL8QpDxTUhrCueGbvKfBxYkgwXVtk0CvNMCmn9ryvXKkj08GNh6eTNPNiZ6 m+ZQQolSqpniyo1oIbPWGpfFIedWhmLFHv9hBeTU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Hewitt , Martin Blumenstingl , Jerome Brunet , Sasha Levin Subject: [PATCH 5.16 0743/1039] clk: meson: gxbb: Fix the SDM_EN bit for MPLL0 on GXBB Date: Mon, 24 Jan 2022 19:42:12 +0100 Message-Id: <20220124184150.302947352@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Martin Blumenstingl [ Upstream commit ff54938dd190d85f740b9bf9dde59b550936b621 ] There are reports that 48kHz audio does not work on the WeTek Play 2 (which uses a GXBB SoC), while 44.1kHz audio works fine on the same board. There are also reports of 48kHz audio working fine on GXL and GXM SoCs, which are using an (almost) identical AIU (audio controller). Experimenting has shown that MPLL0 is causing this problem. In the .dts we have by default: assigned-clocks =3D <&clkc CLKID_MPLL0>, <&clkc CLKID_MPLL1>, <&clkc CLKID_MPLL2>; assigned-clock-rates =3D <294912000>, <270950400>, <393216000>; The MPLL0 rate is divisible by 48kHz without remainder and the MPLL1 rate is divisible by 44.1kHz without remainder. Swapping these two clock rates "fixes" 48kHz audio but breaks 44.1kHz audio. Everything looks normal when looking at the info provided by the common clock framework while playing 48kHz audio (via I2S with mclk-fs =3D 256): mpll_prediv 1 1 0 2000000000 mpll0_div 1 1 0 294909641 mpll0 1 1 0 294909641 cts_amclk_sel 1 1 0 294909641 cts_amclk_div 1 1 0 12287902 cts_amclk 1 1 0 12287902 meson-clk-msr however shows that the actual MPLL0 clock is off by more than 38MHz: mp0_out 333322917 +/-10416Hz The rate seen by meson-clk-msr is very close to what we would get when SDM (the fractional part) was ignored: (2000000000Hz * 16384) / ((16384 * 6) =3D 333.33MHz If SDM was considered the we should get close to: (2000000000Hz * 16384) / ((16384 * 6) + 12808) =3D 294.9MHz Further experimenting shows that HHI_MPLL_CNTL7[15] does not have any effect on the rate of MPLL0 as seen my meson-clk-msr (regardless of whether that bit is zero or one the rate is always the same according to meson-clk-msr). Using HHI_MPLL_CNTL[25] on the other hand as SDM_EN results in SDM being considered for the rate output by the hardware. The rate - as seen by meson-clk-msr - matches with what we expect when SDM_EN is enabled (fractional part is being considered, resulting in a 294.9MHz output) or disable (fractional part being ignored, resulting in a 333.33MHz output). Reported-by: Christian Hewitt Tested-by: Christian Hewitt Signed-off-by: Martin Blumenstingl Signed-off-by: Jerome Brunet Link: https://lore.kernel.org/r/20211031135006.1508796-1-martin.blumensting= l@googlemail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/clk/meson/gxbb.c | 44 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index d6eed760327d0..608e0e8ca49a8 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -713,6 +713,35 @@ static struct clk_regmap gxbb_mpll_prediv =3D { }; =20 static struct clk_regmap gxbb_mpll0_div =3D { + .data =3D &(struct meson_clk_mpll_data){ + .sdm =3D { + .reg_off =3D HHI_MPLL_CNTL7, + .shift =3D 0, + .width =3D 14, + }, + .sdm_en =3D { + .reg_off =3D HHI_MPLL_CNTL, + .shift =3D 25, + .width =3D 1, + }, + .n2 =3D { + .reg_off =3D HHI_MPLL_CNTL7, + .shift =3D 16, + .width =3D 9, + }, + .lock =3D &meson_clk_lock, + }, + .hw.init =3D &(struct clk_init_data){ + .name =3D "mpll0_div", + .ops =3D &meson_clk_mpll_ops, + .parent_hws =3D (const struct clk_hw *[]) { + &gxbb_mpll_prediv.hw + }, + .num_parents =3D 1, + }, +}; + +static struct clk_regmap gxl_mpll0_div =3D { .data =3D &(struct meson_clk_mpll_data){ .sdm =3D { .reg_off =3D HHI_MPLL_CNTL7, @@ -749,7 +778,16 @@ static struct clk_regmap gxbb_mpll0 =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "mpll0", .ops =3D &clk_regmap_gate_ops, - .parent_hws =3D (const struct clk_hw *[]) { &gxbb_mpll0_div.hw }, + .parent_data =3D &(const struct clk_parent_data) { + /* + * Note: + * GXL and GXBB have different SDM_EN registers. We + * fallback to the global naming string mechanism so + * mpll0_div picks up the appropriate one. + */ + .name =3D "mpll0_div", + .index =3D -1, + }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, }, @@ -3044,7 +3082,7 @@ static struct clk_hw_onecell_data gxl_hw_onecell_data= =3D { [CLKID_VAPB_1] =3D &gxbb_vapb_1.hw, [CLKID_VAPB_SEL] =3D &gxbb_vapb_sel.hw, [CLKID_VAPB] =3D &gxbb_vapb.hw, - [CLKID_MPLL0_DIV] =3D &gxbb_mpll0_div.hw, + [CLKID_MPLL0_DIV] =3D &gxl_mpll0_div.hw, [CLKID_MPLL1_DIV] =3D &gxbb_mpll1_div.hw, [CLKID_MPLL2_DIV] =3D &gxbb_mpll2_div.hw, [CLKID_MPLL_PREDIV] =3D &gxbb_mpll_prediv.hw, @@ -3439,7 +3477,7 @@ static struct clk_regmap *const gxl_clk_regmaps[] =3D= { &gxbb_mpll0, &gxbb_mpll1, &gxbb_mpll2, - &gxbb_mpll0_div, + &gxl_mpll0_div, &gxbb_mpll1_div, &gxbb_mpll2_div, &gxbb_cts_amclk_div, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F045FC433F5 for ; Tue, 25 Jan 2022 00:14:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372708AbiAYAMT (ORCPT ); Mon, 24 Jan 2022 19:12:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849617AbiAXX0Q (ORCPT ); Mon, 24 Jan 2022 18:26:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C473EC01D7E5; Mon, 24 Jan 2022 13:30:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 4F9C160C44; Mon, 24 Jan 2022 21:30:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 373D6C340E4; Mon, 24 Jan 2022 21:30:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059818; bh=uC02QHBoKcdv9ttW/OShKG68uyhUyvnpqZMr6byhIJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AlzLalvQqRHz7XlCccJVvgo+okXE+vE2qA1qC6xIbQxjWceuwQ84HyoYeJzRaESU3 j6nf54HXmGwf63uEdhbcUwd1LYbEuAK56oEBp8KgVnhDzng1aZNgALt7gI7QAPP4aX Ch6L0YSDVjiaEkYB62zgPH50Nlt29162fRRwlog0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erhard Furtner , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0744/1039] powerpc/powermac: Add missing lockdep_register_key() Date: Mon, 24 Jan 2022 19:42:13 +0100 Message-Id: <20220124184150.342455460@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 df1f679d19edb9eeb67cc2f96b29375f21991945 ] KeyWest i2c @0xf8001003 irq 42 /uni-n@f8000000/i2c@f8001000 BUG: key c2d00cbc has not been registered! Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz ------------[ cut here ]------------ DEBUG_LOCKS_WARN_ON(1) WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:4801 lockdep_init_map_ty= pe+0x4c0/0xb4c Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.5-gentoo-PowerMacG4 #9 NIP: c01a9428 LR: c01a9428 CTR: 00000000 REGS: e1033cf0 TRAP: 0700 Not tainted (5.15.5-gentoo-PowerMacG4) MSR: 00029032 CR: 24002002 XER: 00000000 GPR00: c01a9428 e1033db0 c2d1cf20 00000016 00000004 00000001 c01c0630 e1033= a73 GPR08: 00000000 00000000 00000000 e1033db0 24002004 00000000 f8729377 00000= 003 GPR16: c1829a9c 00000000 18305357 c1416fc0 c1416f80 c006ac60 c2d00ca8 c1416= f00 GPR24: 00000000 c21586f0 c2160000 00000000 c2d00cbc c2170000 c216e1a0 c2160= 000 NIP [c01a9428] lockdep_init_map_type+0x4c0/0xb4c LR [c01a9428] lockdep_init_map_type+0x4c0/0xb4c Call Trace: [e1033db0] [c01a9428] lockdep_init_map_type+0x4c0/0xb4c (unreliable) [e1033df0] [c1c177b8] kw_i2c_add+0x334/0x424 [e1033e20] [c1c18294] pmac_i2c_init+0x9ec/0xa9c [e1033e80] [c1c1a790] smp_core99_probe+0xbc/0x35c [e1033eb0] [c1c03cb0] kernel_init_freeable+0x190/0x5a4 [e1033f10] [c000946c] kernel_init+0x28/0x154 [e1033f30] [c0035148] ret_from_kernel_thread+0x14/0x1c Add missing lockdep_register_key() Reported-by: Erhard Furtner Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/69e4f55565bb45ebb0843977801b245af0c666fe.16= 38264741.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin --- arch/powerpc/platforms/powermac/low_i2c.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platf= orms/powermac/low_i2c.c index 09bfe4b8f25aa..df89d916236d9 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c @@ -582,6 +582,7 @@ static void __init kw_i2c_add(struct pmac_i2c_host_kw *= host, bus->close =3D kw_i2c_close; bus->xfer =3D kw_i2c_xfer; mutex_init(&bus->mutex); + lockdep_register_key(&bus->lock_key); lockdep_set_class(&bus->mutex, &bus->lock_key); if (controller =3D=3D busnode) bus->flags =3D pmac_i2c_multibus; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73974C433FE for ; Tue, 25 Jan 2022 00:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372729AbiAYAMY (ORCPT ); Mon, 24 Jan 2022 19:12:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849616AbiAXX0Q (ORCPT ); Mon, 24 Jan 2022 18:26:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8696EC01D7E6; Mon, 24 Jan 2022 13:30:22 -0800 (PST) Received: from smtp.kernel.org (relay.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 25DA061028; Mon, 24 Jan 2022 21:30:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0928EC340E4; Mon, 24 Jan 2022 21:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059821; bh=lllL1+YSQOwmnLAGhKuxtgJRcS5EeLGylTj5nvLlLTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WJ8/GY6sIcVe2o0US7HfiGCL3OO/A31BHmp3fjIwhfxXjnvqt75drupp3VL52GXp5 Fl2Jga4OUmwO2aXn5iRpGtMtP0edt+Ho8EY3Smoam4gGKaMEqGdzaQ7TzRypUYeL04 NdghAi6xK/AxEdGBqN+LQ883IjgKaE/0l+idwoT8= 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.16 0745/1039] KVM: PPC: Book3S: Suppress warnings when allocating too big memory slots Date: Mon, 24 Jan 2022 19:42:14 +0100 Message-Id: <20220124184150.376175438@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 511d25d6b789fffcb20a3eb71899cf974a31bd9d ] The userspace can trigger "vmalloc size %lu allocation failure: exceeds total pages" via the KVM_SET_USER_MEMORY_REGION ioctl. This silences the warning by checking the limit before calling vzalloc() and returns ENOMEM if failed. This does not call underlying valloc helpers as __vmalloc_node() is only exported when CONFIG_TEST_VMALLOC_MODULE and __vmalloc_node_range() is not exported at all. Spotted by syzkaller. Signed-off-by: Alexey Kardashevskiy [mpe: Use 'size' for the variable rather than 'cb'] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210901084512.1658628-1-aik@ozlabs.ru Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kvm/book3s_hv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 7b74fc0a986b8..94da0d25eb125 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -4861,8 +4861,12 @@ static int kvmppc_core_prepare_memory_region_hv(stru= ct kvm *kvm, unsigned long npages =3D mem->memory_size >> PAGE_SHIFT; =20 if (change =3D=3D KVM_MR_CREATE) { - slot->arch.rmap =3D vzalloc(array_size(npages, - sizeof(*slot->arch.rmap))); + unsigned long size =3D array_size(npages, sizeof(*slot->arch.rmap)); + + if ((size >> PAGE_SHIFT) > totalram_pages()) + return -ENOMEM; + + slot->arch.rmap =3D vzalloc(size); if (!slot->arch.rmap) return -ENOMEM; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 061C5C4167E for ; Tue, 25 Jan 2022 00:15:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372960AbiAYAMr (ORCPT ); Mon, 24 Jan 2022 19:12:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849613AbiAXX0Q (ORCPT ); Mon, 24 Jan 2022 18:26:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 835BEC01D7E7; Mon, 24 Jan 2022 13:30:25 -0800 (PST) Received: from smtp.kernel.org (relay.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 2357761028; Mon, 24 Jan 2022 21:30:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFFD9C340E4; Mon, 24 Jan 2022 21:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059824; bh=e9qHwmWQeW+I8N/3hk78hKYr7tPj2scOY6Gr/oCbo4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aaPhJ3NatLhxd4eWTlP9t+keC88q86wVpubGNn2gOtAJb5taosUKlP8nYQ/rRqnoR /bDeuxV+8nlaRTvrjpXSnCkhPMuEfi7oQMLtokNMwSdVfTQ423Bvi+C/HQb5NOg9y7 wnvkZrTFXTv3maseHCmu9vgqCffIJwsJbt+AAKJQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kardashevskiy , Fabiano Rosas , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0746/1039] KVM: PPC: Book3S: Suppress failed alloc warning in H_COPY_TOFROM_GUEST Date: Mon, 24 Jan 2022 19:42:15 +0100 Message-Id: <20220124184150.408457509@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 792020907b11c6f9246c21977cab3bad985ae4b6 ] H_COPY_TOFROM_GUEST is an hcall for an upper level VM to access its nested VMs memory. The userspace can trigger WARN_ON_ONCE(!(gfp & __GFP_NOWARN)) in __alloc_pages() by constructing a tiny VM which only does H_COPY_TOFROM_GUEST with a too big GPR9 (number of bytes to copy). This silences the warning by adding __GFP_NOWARN. Spotted by syzkaller. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Fabiano Rosas Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210901084550.1658699-1-aik@ozlabs.ru Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kvm/book3s_hv_nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_= hv_nested.c index ed8a2c9f56299..89295b52a97c3 100644 --- a/arch/powerpc/kvm/book3s_hv_nested.c +++ b/arch/powerpc/kvm/book3s_hv_nested.c @@ -582,7 +582,7 @@ long kvmhv_copy_tofrom_guest_nested(struct kvm_vcpu *vc= pu) if (eaddr & (0xFFFUL << 52)) return H_PARAMETER; =20 - buf =3D kzalloc(n, GFP_KERNEL); + buf =3D kzalloc(n, GFP_KERNEL | __GFP_NOWARN); if (!buf) return H_NO_MEM; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1357FC43219 for ; Tue, 25 Jan 2022 00:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372654AbiAYAMI (ORCPT ); Mon, 24 Jan 2022 19:12:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849615AbiAXX0Q (ORCPT ); Mon, 24 Jan 2022 18:26:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62D50C01D7E8; Mon, 24 Jan 2022 13:30:28 -0800 (PST) Received: from smtp.kernel.org (relay.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 0050561028; Mon, 24 Jan 2022 21:30:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D80A9C340E4; Mon, 24 Jan 2022 21:30:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059827; bh=6YKiuUS8IB5VXSiZrYfnABL7p33uLb807OzSPrmlgRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cx/ch0OTCEOhJbwGd1ToMSX1kL5NNtM7BtykpSMa2oQCS+OI84mWejURG9RX/uDsm 2PdG7vEuCIZClAwe7SvF3+qp5RAdEG2hoVlQydsyOTlgwWjymz9v2EvIEhxlvQWlyb jVpCteBCtCPlSosvGbt8x2J3S1fPY69RBaqqAKEw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Christophe Leroy , Sasha Levin Subject: [PATCH 5.16 0747/1039] w1: Misuse of get_user()/put_user() reported by sparse Date: Mon, 24 Jan 2022 19:42:16 +0100 Message-Id: <20220124184150.438766576@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 33dc3e3e99e626ce51f462d883b05856c6c30b1d ] sparse warnings: (new ones prefixed by >>) >> drivers/w1/slaves/w1_ds28e04.c:342:13: sparse: sparse: incorrect type in= initializer (different address spaces) @@ expected char [noderef] __us= er *_pu_addr @@ got char *buf @@ drivers/w1/slaves/w1_ds28e04.c:342:13: sparse: expected char [nodere= f] __user *_pu_addr drivers/w1/slaves/w1_ds28e04.c:342:13: sparse: got char *buf >> drivers/w1/slaves/w1_ds28e04.c:356:13: sparse: sparse: incorrect type in= initializer (different address spaces) @@ expected char const [noderef= ] __user *_gu_addr @@ got char const *buf @@ drivers/w1/slaves/w1_ds28e04.c:356:13: sparse: expected char const [= noderef] __user *_gu_addr drivers/w1/slaves/w1_ds28e04.c:356:13: sparse: got char const *buf The buffer buf is a failsafe buffer in kernel space, it's not user memory hence doesn't deserve the use of get_user() or put_user(). Access 'buf' content directly. Link: https://lore.kernel.org/lkml/202111190526.K5vb7NWC-lkp@intel.com/T/ Reported-by: kernel test robot Signed-off-by: Christophe Leroy Link: https://lore.kernel.org/r/d14ed8d71ad4372e6839ae427f91441d3ba0e94d.16= 37946316.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/w1/slaves/w1_ds28e04.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/w1/slaves/w1_ds28e04.c b/drivers/w1/slaves/w1_ds28e04.c index e4f336111edc6..6cef6e2edb892 100644 --- a/drivers/w1/slaves/w1_ds28e04.c +++ b/drivers/w1/slaves/w1_ds28e04.c @@ -32,7 +32,7 @@ static int w1_strong_pullup =3D 1; module_param_named(strong_pullup, w1_strong_pullup, int, 0); =20 /* enable/disable CRC checking on DS28E04-100 memory accesses */ -static char w1_enable_crccheck =3D 1; +static bool w1_enable_crccheck =3D true; =20 #define W1_EEPROM_SIZE 512 #define W1_PAGE_COUNT 16 @@ -339,32 +339,18 @@ static BIN_ATTR_RW(pio, 1); static ssize_t crccheck_show(struct device *dev, struct device_attribute *= attr, char *buf) { - if (put_user(w1_enable_crccheck + 0x30, buf)) - return -EFAULT; - - return sizeof(w1_enable_crccheck); + return sysfs_emit(buf, "%d\n", w1_enable_crccheck); } =20 static ssize_t crccheck_store(struct device *dev, struct device_attribute = *attr, const char *buf, size_t count) { - char val; - - if (count !=3D 1 || !buf) - return -EINVAL; + int err =3D kstrtobool(buf, &w1_enable_crccheck); =20 - if (get_user(val, buf)) - return -EFAULT; + if (err) + return err; =20 - /* convert to decimal */ - val =3D val - 0x30; - if (val !=3D 0 && val !=3D 1) - return -EINVAL; - - /* set the new value */ - w1_enable_crccheck =3D val; - - return sizeof(w1_enable_crccheck); + return count; } =20 static DEVICE_ATTR_RW(crccheck); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C92C9C43217 for ; Mon, 24 Jan 2022 22:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582022AbiAXWNZ (ORCPT ); Mon, 24 Jan 2022 17:13:25 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51250 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453615AbiAXVad (ORCPT ); Mon, 24 Jan 2022 16:30:33 -0500 Received: from smtp.kernel.org (relay.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 1337361028; Mon, 24 Jan 2022 21:30:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDE51C340E4; Mon, 24 Jan 2022 21:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059830; bh=Zy5v5fLQBLXnARGxYzyL5FpJcmsXb0/iPQFT4iszAW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wi5gInQVql5hu8dVh8s4mWxKPbz26p+IkeKKnU4Tcx/onmCfaEymZjWzhCb+6rRbt WSzz74wtWmV5/RmVHXDkMTFmzHVshVG7obztzKR3Xv/rZxiQC0x6N5s3GEjga3STEv 9LTmCQa8pLmstfENj2XWOqBHEhSa2A6KWXQGbJhE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gilles BULOZ , Srinivas Kandagatla , Sasha Levin Subject: [PATCH 5.16 0748/1039] nvmem: core: set size for sysfs bin file Date: Mon, 24 Jan 2022 19:42:17 +0100 Message-Id: <20220124184150.476108873@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 86192251033308bb42f1e9813c962989d8ed07ec ] For some reason we never set the size for nvmem sysfs binary file. Set this. Reported-by: Gilles BULOZ Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20211130133909.6154-1-srinivas.kandagatla@l= inaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/nvmem/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index e765d3d0542e5..23a38dcf0fc4d 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -312,6 +312,8 @@ static umode_t nvmem_bin_attr_is_visible(struct kobject= *kobj, struct device *dev =3D kobj_to_dev(kobj); struct nvmem_device *nvmem =3D to_nvmem_device(dev); =20 + attr->size =3D nvmem->size; + return nvmem_bin_attr_get_umode(nvmem); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30E74C433FE for ; Mon, 24 Jan 2022 22:31:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586308AbiAXW0N (ORCPT ); Mon, 24 Jan 2022 17:26:13 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45248 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453650AbiAXVag (ORCPT ); Mon, 24 Jan 2022 16:30:36 -0500 Received: from smtp.kernel.org (relay.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 ACF46B80FA1; Mon, 24 Jan 2022 21:30:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDA3EC340E5; Mon, 24 Jan 2022 21:30:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059833; bh=3Efeav5/jfwkBywK9Tb1QYQGO5lWAXrOAFpR3Rex+s8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=boMC0HAW1mo4sZ+EFMqoOBzfsG2Zzs6q2XDPc1Ns3rZlThkSdpkYEIumtuWlLwI+j 3OQnHkI4QmnsfJRxTwPjVJXSpOzfrUL8yufPGLqluGF/+SSAtYIXkna088Jt9ZXy45 TW3OYb4agbDVJnFjdnrArD6wh+FZRHf0i70cE5yc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Williams , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.16 0749/1039] dm: fix alloc_dax error handling in alloc_dev Date: Mon, 24 Jan 2022 19:42:18 +0100 Message-Id: <20220124184150.516686433@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit d751939235b9b7bc4af15f90a3e99288a8b844a7 ] Make sure ->dax_dev is NULL on error so that the cleanup path doesn't trip over an ERR_PTR. Reported-by: Dan Williams Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20211129102203.2243509-2-hch@lst.de Signed-off-by: Dan Williams Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/md/dm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 662742a310cbb..acc84dc1bded5 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1786,8 +1786,10 @@ static struct mapped_device *alloc_dev(int minor) if (IS_ENABLED(CONFIG_DAX_DRIVER)) { md->dax_dev =3D alloc_dax(md, md->disk->disk_name, &dm_dax_ops, 0); - if (IS_ERR(md->dax_dev)) + if (IS_ERR(md->dax_dev)) { + md->dax_dev =3D NULL; goto bad; + } } =20 format_dev_t(md->name, MKDEV(_major, minor)); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA6B9C4321E for ; Mon, 24 Jan 2022 22:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579897AbiAXWNs (ORCPT ); Mon, 24 Jan 2022 17:13:48 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:43504 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453682AbiAXVaj (ORCPT ); Mon, 24 Jan 2022 16:30:39 -0500 Received: from smtp.kernel.org (relay.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 1A9D5B811A2; Mon, 24 Jan 2022 21:30:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6065C340E4; Mon, 24 Jan 2022 21:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059836; bh=wpeCaTchYmxiHGGB/zd+aYB5oc+l/iumejBoL0k8dtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gi1m/iu8RiZOgVLWj48RzufUg7BqR84yD65DfIb571NM7KOFuDil7wbh7J9SY+AFh KLAkWA6IwBUP6sV+MkkfWVZLI+QYzsr5ndiHqNAcnf9IABf9nwLtUTRK5LtcH06H4F TuMHhCx5x1EOhz7ockqfVng7l8yxd4mC9TR7y1ns= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Mike Snitzer , Dan Williams , Sasha Levin Subject: [PATCH 5.16 0750/1039] dm: make the DAX support depend on CONFIG_FS_DAX Date: Mon, 24 Jan 2022 19:42:19 +0100 Message-Id: <20220124184150.549965594@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 5d2a228b9e1319ff188f9ea89006fbe575561921 ] The device mapper DAX support is all hanging off a block device and thus can't be used with device dax. Make it depend on CONFIG_FS_DAX instead of CONFIG_DAX_DRIVER. This also means that bdev_dax_pgoff only needs to be built under CONFIG_FS_DAX now. Signed-off-by: Christoph Hellwig Acked-by: Mike Snitzer Link: https://lore.kernel.org/r/20211129102203.2243509-3-hch@lst.de Signed-off-by: Dan Williams Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dax/super.c | 6 ++---- drivers/md/dm-linear.c | 2 +- drivers/md/dm-log-writes.c | 2 +- drivers/md/dm-stripe.c | 2 +- drivers/md/dm-writecache.c | 2 +- drivers/md/dm.c | 2 +- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index b882cf8106ea3..e20d0cef10a18 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -63,7 +63,7 @@ static int dax_host_hash(const char *host) return hashlen_hash(hashlen_string("DAX", host)) % DAX_HASH_SIZE; } =20 -#ifdef CONFIG_BLOCK +#if defined(CONFIG_BLOCK) && defined(CONFIG_FS_DAX) #include =20 int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, @@ -80,7 +80,6 @@ int bdev_dax_pgoff(struct block_device *bdev, sector_t se= ctor, size_t size, } EXPORT_SYMBOL(bdev_dax_pgoff); =20 -#if IS_ENABLED(CONFIG_FS_DAX) /** * dax_get_by_host() - temporary lookup mechanism for filesystem-dax * @host: alternate name for the device registered by a dax driver @@ -219,8 +218,7 @@ bool dax_supported(struct dax_device *dax_dev, struct b= lock_device *bdev, return ret; } EXPORT_SYMBOL_GPL(dax_supported); -#endif /* CONFIG_FS_DAX */ -#endif /* CONFIG_BLOCK */ +#endif /* CONFIG_BLOCK && CONFIG_FS_DAX */ =20 enum dax_device_flags { /* !alive + rcu grace period =3D=3D no new operations / mappings */ diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c index 66ba16713f696..0a260c35aeeed 100644 --- a/drivers/md/dm-linear.c +++ b/drivers/md/dm-linear.c @@ -162,7 +162,7 @@ static int linear_iterate_devices(struct dm_target *ti, return fn(ti, lc->dev, lc->start, ti->len, data); } =20 -#if IS_ENABLED(CONFIG_DAX_DRIVER) +#if IS_ENABLED(CONFIG_FS_DAX) static long linear_dax_direct_access(struct dm_target *ti, pgoff_t pgoff, long nr_pages, void **kaddr, pfn_t *pfn) { diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c index 0b3ef977ceeba..3155875d4e5b0 100644 --- a/drivers/md/dm-log-writes.c +++ b/drivers/md/dm-log-writes.c @@ -901,7 +901,7 @@ static void log_writes_io_hints(struct dm_target *ti, s= truct queue_limits *limit limits->io_min =3D limits->physical_block_size; } =20 -#if IS_ENABLED(CONFIG_DAX_DRIVER) +#if IS_ENABLED(CONFIG_FS_DAX) static int log_dax(struct log_writes_c *lc, sector_t sector, size_t bytes, struct iov_iter *i) { diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 6660b6b53d5bf..f084607220293 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c @@ -300,7 +300,7 @@ static int stripe_map(struct dm_target *ti, struct bio = *bio) return DM_MAPIO_REMAPPED; } =20 -#if IS_ENABLED(CONFIG_DAX_DRIVER) +#if IS_ENABLED(CONFIG_FS_DAX) static long stripe_dax_direct_access(struct dm_target *ti, pgoff_t pgoff, long nr_pages, void **kaddr, pfn_t *pfn) { diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index 4b8991cde223d..4f31591d2d25e 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -38,7 +38,7 @@ #define BITMAP_GRANULARITY PAGE_SIZE #endif =20 -#if IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API) && IS_ENABLED(CONFIG_DAX_DRIVER) +#if IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API) && IS_ENABLED(CONFIG_FS_DAX) #define DM_WRITECACHE_HAS_PMEM #endif =20 diff --git a/drivers/md/dm.c b/drivers/md/dm.c index acc84dc1bded5..b93fcc91176e5 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1783,7 +1783,7 @@ static struct mapped_device *alloc_dev(int minor) md->disk->private_data =3D md; sprintf(md->disk->disk_name, "dm-%d", minor); =20 - if (IS_ENABLED(CONFIG_DAX_DRIVER)) { + if (IS_ENABLED(CONFIG_FS_DAX)) { md->dax_dev =3D alloc_dax(md, md->disk->disk_name, &dm_dax_ops, 0); if (IS_ERR(md->dax_dev)) { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4F51C4332F for ; Tue, 25 Jan 2022 00:19:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374660AbiAYARi (ORCPT ); Mon, 24 Jan 2022 19:17:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385506AbiAXX17 (ORCPT ); Mon, 24 Jan 2022 18:27:59 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F4E9C01D7E9; Mon, 24 Jan 2022 13:30:42 -0800 (PST) Received: from smtp.kernel.org (relay.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 0E1E2B811FB; Mon, 24 Jan 2022 21:30:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29BDBC340E4; Mon, 24 Jan 2022 21:30:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059839; bh=cJPgM4GLpjqSaHg5vohVKKh1k0m1iDUXV+RF33JQnf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YINHEIXTrUjvPALOip075YZnYCIncvdv5s4Wkk318ySUwQk9rJJMpwFRwhJkIX5EU JLbBQSZOHZT86eKHsma28dZZE63HfAaythrf/xoGVLzW0UYAlsIXa5i00IeeeG1aCE VpsLKNv+UtN7Wh6f4l3mHH3tOcCzkqF576g2bAsE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ameer Hamza , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0751/1039] ASoC: test-component: fix null pointer dereference. Date: Mon, 24 Jan 2022 19:42:20 +0100 Message-Id: <20220124184150.581833869@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ameer Hamza [ Upstream commit c686316ec1210d43653c91e104c1e4cd0156dc89 ] Dereferncing of_id pointer will result in exception in current implementation since of_match_device() will assign it to NULL. Adding NULL check for protection. Signed-off-by: Ameer Hamza Link: https://lore.kernel.org/r/20211205204200.7852-1-amhamza.mgc@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/generic/test-component.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/generic/test-component.c b/sound/soc/generic/test-co= mponent.c index 85385a771d807..8fc97d3ff0110 100644 --- a/sound/soc/generic/test-component.c +++ b/sound/soc/generic/test-component.c @@ -532,13 +532,16 @@ static int test_driver_probe(struct platform_device *= pdev) struct device_node *node =3D dev->of_node; struct device_node *ep; const struct of_device_id *of_id =3D of_match_device(test_of_match, &pdev= ->dev); - const struct test_adata *adata =3D of_id->data; + const struct test_adata *adata; struct snd_soc_component_driver *cdriv; struct snd_soc_dai_driver *ddriv; struct test_dai_name *dname; struct test_priv *priv; int num, ret, i; =20 + if (!of_id) + return -EINVAL; + adata =3D of_id->data; num =3D of_graph_get_endpoint_count(node); if (!num) { dev_err(dev, "no port exits\n"); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E950BC43219 for ; Mon, 24 Jan 2022 22:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582112AbiAXWNz (ORCPT ); Mon, 24 Jan 2022 17:13:55 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45328 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453726AbiAXVar (ORCPT ); Mon, 24 Jan 2022 16:30:47 -0500 Received: from smtp.kernel.org (relay.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 111F0B8121C; Mon, 24 Jan 2022 21:30:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32098C340E5; Mon, 24 Jan 2022 21:30:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059842; bh=4RrGe9wr71LWzqgF6XSoStKYKDl1f6S25cA8dDWoh9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jRPM2FuHY04uZC7yGPukn7yAC5fiDjhNda7nD9KfDfDI2J7zB2J0vn1izh6OaI0ty wwKdhPG8uND/Yx+Rwvk6AgGdm/zxWkbxBEThQZ6Cib53iCRbSO4AtDXr5BiAlz1izb 26zGy3ln77P0/AT6ROxULvbt0n2eoCtAiOYTkuew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Gerhold , Georgi Djakov , Sasha Levin Subject: [PATCH 5.16 0752/1039] interconnect: qcom: rpm: Prevent integer overflow in rate Date: Mon, 24 Jan 2022 19:42:21 +0100 Message-Id: <20220124184150.612174636@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephan Gerhold [ Upstream commit a7d9436a6c85fcb8843c910fd323dcd7f839bf63 ] Using icc-rpm on ARM32 currently results in clk_set_rate() errors during boot, e.g. "bus clk_set_rate error: -22". This is very similar to commit 7381e27b1e56 ("interconnect: qcom: msm8974: Prevent integer overflow in rat= e") where the u64 is converted to a signed long during clock rate rounding, resulting in an overflow on 32-bit platforms. Let's fix it similarly by making sure that the rate does not exceed LONG_MAX. Such high clock rates will surely result in the maximum frequency of the bus anyway. Signed-off-by: Stephan Gerhold Link: https://lore.kernel.org/r/20211206114542.45325-1-stephan@gerhold.net Signed-off-by: Georgi Djakov Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/interconnect/qcom/icc-rpm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qco= m/icc-rpm.c index ef7999a08c8bf..8114295a83129 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -239,6 +239,7 @@ static int qcom_icc_set(struct icc_node *src, struct ic= c_node *dst) rate =3D max(sum_bw, max_peak_bw); =20 do_div(rate, qn->buswidth); + rate =3D min_t(u64, rate, LONG_MAX); =20 if (qn->rate =3D=3D rate) return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3344DC433EF for ; Mon, 24 Jan 2022 22:29:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586327AbiAXW0O (ORCPT ); Mon, 24 Jan 2022 17:26:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45348 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453740AbiAXVas (ORCPT ); Mon, 24 Jan 2022 16:30:48 -0500 Received: from smtp.kernel.org (relay.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 0921DB811FB; Mon, 24 Jan 2022 21:30:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20650C340E4; Mon, 24 Jan 2022 21:30:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059845; bh=B7cGSsiuqg4gQODx/pWR3gyLXkSyG0HwME+dWqp/SZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jDFhCR2Dcwo9zeivPEkSdyctHsnf/5aJNM6GvZ7OT8KRbsyTyVKJPe4dZcOsl29PQ 0YfZKA5EeNi4BwRX7tOgDniA72CrFmRP9Z/o+ZoSPBkreANOWFUfqHAoWnGmaM5nYH ZcYWfZTujFpTAeSYxLO6zV3uCQtrFFeFvG4KlgLI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bean Huo , Bart Van Assche , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 0753/1039] scsi: ufs: Fix a kernel crash during shutdown Date: Mon, 24 Jan 2022 19:42:22 +0100 Message-Id: <20220124184150.648170734@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit 3489c34bd02b73a72646037d673a122a53cee174 ] Fix the following kernel crash: Unable to handle kernel paging request at virtual address ffffffc91e735000 Call trace: __queue_work+0x26c/0x624 queue_work_on+0x6c/0xf0 ufshcd_hold+0x12c/0x210 __ufshcd_wl_suspend+0xc0/0x400 ufshcd_wl_shutdown+0xb8/0xcc device_shutdown+0x184/0x224 kernel_restart+0x4c/0x124 __arm64_sys_reboot+0x194/0x264 el0_svc_common+0xc8/0x1d4 do_el0_svc+0x30/0x8c el0_svc+0x20/0x30 el0_sync_handler+0x84/0xe4 el0_sync+0x1bc/0x1c0 Fix this crash by ungating the clock before destroying the work queue on which clock gating work is queued. Link: https://lore.kernel.org/r/20211203231950.193369-15-bvanassche@acm.org Tested-by: Bean Huo Reviewed-by: Bean Huo Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/ufs/ufshcd.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 4394081806978..c94377aa82739 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1666,7 +1666,8 @@ int ufshcd_hold(struct ufs_hba *hba, bool async) bool flush_result; unsigned long flags; =20 - if (!ufshcd_is_clkgating_allowed(hba)) + if (!ufshcd_is_clkgating_allowed(hba) || + !hba->clk_gating.is_initialized) goto out; spin_lock_irqsave(hba->host->host_lock, flags); hba->clk_gating.active_reqs++; @@ -1826,7 +1827,7 @@ static void __ufshcd_release(struct ufs_hba *hba) =20 if (hba->clk_gating.active_reqs || hba->clk_gating.is_suspended || hba->ufshcd_state !=3D UFSHCD_STATE_OPERATIONAL || - hba->outstanding_tasks || + hba->outstanding_tasks || !hba->clk_gating.is_initialized || hba->active_uic_cmd || hba->uic_async_done || hba->clk_gating.state =3D=3D CLKS_OFF) return; @@ -1961,11 +1962,15 @@ static void ufshcd_exit_clk_gating(struct ufs_hba *= hba) { if (!hba->clk_gating.is_initialized) return; + ufshcd_remove_clk_gating_sysfs(hba); - cancel_work_sync(&hba->clk_gating.ungate_work); - cancel_delayed_work_sync(&hba->clk_gating.gate_work); - destroy_workqueue(hba->clk_gating.clk_gating_workq); + + /* Ungate the clock if necessary. */ + ufshcd_hold(hba, false); hba->clk_gating.is_initialized =3D false; + ufshcd_release(hba); + + destroy_workqueue(hba->clk_gating.clk_gating_workq); } =20 /* Must be called with host lock acquired */ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC231C433F5 for ; Mon, 24 Jan 2022 22:29:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586352AbiAXW0S (ORCPT ); Mon, 24 Jan 2022 17:26:18 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51424 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453775AbiAXVay (ORCPT ); Mon, 24 Jan 2022 16:30:54 -0500 Received: from smtp.kernel.org (relay.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 0F71A614DD; Mon, 24 Jan 2022 21:30:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7A7FC340E7; Mon, 24 Jan 2022 21:30:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059851; bh=PVz8ZLaocFB/t0tWMTtejzI8NBaFzsQAP49wgSYBZck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OoMghYkZMvsWBRrs4lRyGxHTP0niN1mzwX7Slqele+2yX0yRFg3o/Jr2HRnV8W89v +a8+QdPzR9S0vbv14jTZj0ot7vCqf1IuFKO8dRpSrCCG5ztTYw2eyfUKy0syei6InN Q1OaCcnyRhEKuPFFEfbrmg+tKDfJjhhtelK5yIXk= 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.16 0754/1039] scsi: lpfc: Fix leaked lpfc_dmabuf mbox allocations with NPIV Date: Mon, 24 Jan 2022 19:42:23 +0100 Message-Id: <20220124184150.679689672@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 f0d3919697492950f57a26a1093aee53880d669d ] During rmmod testing, messages appeared indicating lpfc_mbuf_pool entries were still busy. This situation was only seen doing rmmod after at least 1 vport (NPIV) instance was created and destroyed. The number of messages scaled with the number of vports created. When a vport is created, it can receive a PLOGI from another initiator Nport. When this happens, the driver prepares to ack the PLOGI and prepares an RPI for registration (via mbx cmd) which includes an mbuf allocation. During the unsolicited PLOGI processing and after the RPI preparation, the driver recognizes it is one of the vport instances and decides to reject the PLOGI. During the LS_RJT preparation for the PLOGI, the mailbox struct allocated for RPI registration is freed, but the mbuf that was also allocated is not released. Fix by freeing the mbuf with the mailbox struct in the LS_RJT path. As part of the code review to figure the issue out a couple of other areas where found that also would not have released the mbuf. Those are cleaned up as well. Link: https://lore.kernel.org/r/20211204002644.116455-2-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: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc_els.c | 6 +++++- drivers/scsi/lpfc/lpfc_init.c | 8 ++++++-- drivers/scsi/lpfc/lpfc_nportdisc.c | 6 ++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index e83453bea2aee..5c10416c1c75a 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -6899,6 +6899,7 @@ static int lpfc_get_rdp_info(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_cont= ext) { LPFC_MBOXQ_t *mbox =3D NULL; + struct lpfc_dmabuf *mp; int rc; =20 mbox =3D mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); @@ -6914,8 +6915,11 @@ lpfc_get_rdp_info(struct lpfc_hba *phba, struct lpfc= _rdp_context *rdp_context) mbox->mbox_cmpl =3D lpfc_mbx_cmpl_rdp_page_a0; mbox->ctx_ndlp =3D (struct lpfc_rdp_context *)rdp_context; rc =3D lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); - if (rc =3D=3D MBX_NOT_FINISHED) + if (rc =3D=3D MBX_NOT_FINISHED) { + mp =3D (struct lpfc_dmabuf *)mbox->ctx_buf; + lpfc_mbuf_free(phba, mp->virt, mp->phys); goto issue_mbox_fail; + } =20 return 0; =20 diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index ba17a8f740a95..7628b0634c57a 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -5373,8 +5373,10 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, */ if (!(phba->hba_flag & HBA_FCOE_MODE)) { rc =3D lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); - if (rc =3D=3D MBX_NOT_FINISHED) + if (rc =3D=3D MBX_NOT_FINISHED) { + lpfc_mbuf_free(phba, mp->virt, mp->phys); goto out_free_dmabuf; + } return; } /* @@ -6337,8 +6339,10 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct= lpfc_acqe_fc_la *acqe_fc) } =20 rc =3D lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); - if (rc =3D=3D MBX_NOT_FINISHED) + if (rc =3D=3D MBX_NOT_FINISHED) { + lpfc_mbuf_free(phba, mp->virt, mp->phys); goto out_free_dmabuf; + } return; =20 out_free_dmabuf: diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_np= ortdisc.c index 27263f02ab9f6..7d717a4ac14d1 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -322,6 +322,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_no= delist *ndlp, { struct lpfc_hba *phba =3D vport->phba; struct lpfc_dmabuf *pcmd; + struct lpfc_dmabuf *mp; uint64_t nlp_portwwn =3D 0; uint32_t *lp; IOCB_t *icmd; @@ -571,6 +572,11 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_n= odelist *ndlp, * a default RPI. */ if (phba->sli_rev =3D=3D LPFC_SLI_REV4) { + mp =3D (struct lpfc_dmabuf *)login_mbox->ctx_buf; + if (mp) { + lpfc_mbuf_free(phba, mp->virt, mp->phys); + kfree(mp); + } mempool_free(login_mbox, phba->mbox_mem_pool); login_mbox =3D NULL; } else { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96C88C4167E for ; Mon, 24 Jan 2022 22:13:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578030AbiAXWNR (ORCPT ); Mon, 24 Jan 2022 17:13:17 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51444 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453792AbiAXVaz (ORCPT ); Mon, 24 Jan 2022 16:30:55 -0500 Received: from smtp.kernel.org (relay.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 D08A6614DC; Mon, 24 Jan 2022 21:30:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B93FBC340E4; Mon, 24 Jan 2022 21:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059854; bh=dFxVt+CCaKAIh5laUX5e+SmQL/wfV4Qkpyftoa/psZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTb+UifM6QbaUHnTzYu5gwxJL6zTUpdc8b2VkeVpIvmaazfsNTlLlNu2c1ImU9LJt zUYlgkdxIGvOkKthm8jJprTAJzEZJuPXwe+BAOOLqwQhzQool69tdXeEyU7gsvrLys vQ5cPJkWCw71Dv7NBhqEqGwTc1LxugAPk8wPiQGs= 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.16 0755/1039] scsi: lpfc: Trigger SLI4 firmware dump before doing driver cleanup Date: Mon, 24 Jan 2022 19:42:24 +0100 Message-Id: <20220124184150.717662764@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 7dd2e2a923173d637c272e483966be8e96a72b64 ] Extraneous teardown routines are present in the firmware dump path causing altered states in firmware captures. When a firmware dump is requested via sysfs, trigger the dump immediately without tearing down structures and changing adapter state. The driver shall rely on pre-existing firmware error state clean up handlers to restore the adapter. Link: https://lore.kernel.org/r/20211204002644.116455-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: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc.h | 2 +- drivers/scsi/lpfc/lpfc_attr.c | 62 ++++++++++++++++++++------------ drivers/scsi/lpfc/lpfc_hbadisc.c | 8 ++++- drivers/scsi/lpfc/lpfc_sli.c | 6 ---- 4 files changed, 48 insertions(+), 30 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 2f8e6d0a926fe..54c58392fd5d0 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1023,7 +1023,6 @@ struct lpfc_hba { #define HBA_DEVLOSS_TMO 0x2000 /* HBA in devloss timeout */ #define HBA_RRQ_ACTIVE 0x4000 /* process the rrq active list */ #define HBA_IOQ_FLUSH 0x8000 /* FCP/NVME I/O queues being flushed */ -#define HBA_FW_DUMP_OP 0x10000 /* Skips fn reset before FW dump */ #define HBA_RECOVERABLE_UE 0x20000 /* Firmware supports recoverable UE */ #define HBA_FORCED_LINK_SPEED 0x40000 /* * Firmware supports Forced Link Speed @@ -1040,6 +1039,7 @@ struct lpfc_hba { #define HBA_HBEAT_TMO 0x8000000 /* HBEAT initiated after timeout */ #define HBA_FLOGI_OUTSTANDING 0x10000000 /* FLOGI is outstanding */ =20 + struct completion *fw_dump_cmpl; /* cmpl event tracker for fw_dump */ uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/ struct lpfc_dmabuf slim2p; =20 diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index dd4c51b6ef4e2..7a7f17d71811b 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -1709,25 +1709,25 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, u= int32_t opcode) before_fc_flag =3D phba->pport->fc_flag; sriov_nr_virtfn =3D phba->cfg_sriov_nr_virtfn; =20 - /* Disable SR-IOV virtual functions if enabled */ - if (phba->cfg_sriov_nr_virtfn) { - pci_disable_sriov(pdev); - phba->cfg_sriov_nr_virtfn =3D 0; - } + if (opcode =3D=3D LPFC_FW_DUMP) { + init_completion(&online_compl); + phba->fw_dump_cmpl =3D &online_compl; + } else { + /* Disable SR-IOV virtual functions if enabled */ + if (phba->cfg_sriov_nr_virtfn) { + pci_disable_sriov(pdev); + phba->cfg_sriov_nr_virtfn =3D 0; + } =20 - if (opcode =3D=3D LPFC_FW_DUMP) - phba->hba_flag |=3D HBA_FW_DUMP_OP; + status =3D lpfc_do_offline(phba, LPFC_EVT_OFFLINE); =20 - status =3D lpfc_do_offline(phba, LPFC_EVT_OFFLINE); + if (status !=3D 0) + return status; =20 - if (status !=3D 0) { - phba->hba_flag &=3D ~HBA_FW_DUMP_OP; - return status; + /* wait for the device to be quiesced before firmware reset */ + msleep(100); } =20 - /* wait for the device to be quiesced before firmware reset */ - msleep(100); - reg_val =3D readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); =20 @@ -1756,24 +1756,42 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, u= int32_t opcode) lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "3153 Fail to perform the requested " "access: x%x\n", reg_val); + if (phba->fw_dump_cmpl) + phba->fw_dump_cmpl =3D NULL; return rc; } =20 /* keep the original port state */ - if (before_fc_flag & FC_OFFLINE_MODE) - goto out; - - init_completion(&online_compl); - job_posted =3D lpfc_workq_post_event(phba, &status, &online_compl, - LPFC_EVT_ONLINE); - if (!job_posted) + if (before_fc_flag & FC_OFFLINE_MODE) { + if (phba->fw_dump_cmpl) + phba->fw_dump_cmpl =3D NULL; goto out; + } =20 - wait_for_completion(&online_compl); + /* Firmware dump will trigger an HA_ERATT event, and + * lpfc_handle_eratt_s4 routine already handles bringing the port back + * online. + */ + if (opcode =3D=3D LPFC_FW_DUMP) { + wait_for_completion(phba->fw_dump_cmpl); + } else { + init_completion(&online_compl); + job_posted =3D lpfc_workq_post_event(phba, &status, &online_compl, + LPFC_EVT_ONLINE); + if (!job_posted) + goto out; =20 + wait_for_completion(&online_compl); + } out: /* in any case, restore the virtual functions enabled as before */ if (sriov_nr_virtfn) { + /* If fw_dump was performed, first disable to clean up */ + if (opcode =3D=3D LPFC_FW_DUMP) { + pci_disable_sriov(pdev); + phba->cfg_sriov_nr_virtfn =3D 0; + } + sriov_err =3D lpfc_sli_probe_sriov_nr_virtfn(phba, sriov_nr_virtfn); if (!sriov_err) diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbad= isc.c index 9fe6e5b386ce3..5e54ec503f18b 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -869,10 +869,16 @@ lpfc_work_done(struct lpfc_hba *phba) if (phba->pci_dev_grp =3D=3D LPFC_PCI_DEV_OC) lpfc_sli4_post_async_mbox(phba); =20 - if (ha_copy & HA_ERATT) + if (ha_copy & HA_ERATT) { /* Handle the error attention event */ lpfc_handle_eratt(phba); =20 + if (phba->fw_dump_cmpl) { + complete(phba->fw_dump_cmpl); + phba->fw_dump_cmpl =3D NULL; + } + } + if (ha_copy & HA_MBATT) lpfc_sli_handle_mb_event(phba); =20 diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 5dedb3de271d8..513a78d08b1d5 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -5046,12 +5046,6 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba) phba->fcf.fcf_flag =3D 0; spin_unlock_irq(&phba->hbalock); =20 - /* SLI4 INTF 2: if FW dump is being taken skip INIT_PORT */ - if (phba->hba_flag & HBA_FW_DUMP_OP) { - phba->hba_flag &=3D ~HBA_FW_DUMP_OP; - return rc; - } - /* Now physically reset the device */ lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0389 Performing PCI function reset!\n"); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30AC6C3526E for ; Tue, 25 Jan 2022 00:18:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374378AbiAYAQx (ORCPT ); Mon, 24 Jan 2022 19:16:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382263AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC59BC01D7EB; Mon, 24 Jan 2022 13:30:59 -0800 (PST) Received: from smtp.kernel.org (relay.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 74140B81233; Mon, 24 Jan 2022 21:30:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A080BC340E4; Mon, 24 Jan 2022 21:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059857; bh=vCWM391mahdHAJjL6H0oEHOo3B7sCwqL6vruq8eQ2u4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=epJQW/5dLqq5xLOX1hDMlPYk18IEdJNRtUvakL66vLeabl0JLNT2VkxqIpodGQCcT 8jJyhFiy4tHFELAl2pQvF5fwv5hx+cLk0uuNJIjCE9XGdYtSK5Bu4aJahsvbCO2uuQ UvtqtKjqRd/ID0tBxw/pFf0gggUoMzTDJS+j/Mp0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zqiang , syzbot+bb950e68b400ab4f65f8@syzkaller.appspotmail.com, Takashi Iwai , Sasha Levin Subject: [PATCH 5.16 0756/1039] ALSA: seq: Set upper limit of processed events Date: Mon, 24 Jan 2022 19:42:25 +0100 Message-Id: <20220124184150.747943551@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 6fadb494a638d8b8a55864ecc6ac58194f03f327 ] Currently ALSA sequencer core tries to process the queued events as much as possible when they become dispatchable. If applications try to queue too massive events to be processed at the very same timing, the sequencer core would still try to process such all events, either in the interrupt context or via some notifier; in either away, it might be a cause of RCU stall or such problems. As a potential workaround for those problems, this patch adds the upper limit of the amount of events to be processed. The remaining events are processed in the next batch, so they won't be lost. For the time being, it's limited up to 1000 events per queue, which should be high enough for any normal usages. Reported-by: Zqiang Reported-by: syzbot+bb950e68b400ab4f65f8@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/20211102033222.3849-1-qiang.zhang1211@gmail= .com Link: https://lore.kernel.org/r/20211207165146.2888-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/core/seq/seq_queue.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c index d6c02dea976c8..bc933104c3eea 100644 --- a/sound/core/seq/seq_queue.c +++ b/sound/core/seq/seq_queue.c @@ -235,12 +235,15 @@ struct snd_seq_queue *snd_seq_queue_find_name(char *n= ame) =20 /* -------------------------------------------------------- */ =20 +#define MAX_CELL_PROCESSES_IN_QUEUE 1000 + void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) { unsigned long flags; struct snd_seq_event_cell *cell; snd_seq_tick_time_t cur_tick; snd_seq_real_time_t cur_time; + int processed =3D 0; =20 if (q =3D=3D NULL) return; @@ -263,6 +266,8 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int a= tomic, int hop) if (!cell) break; snd_seq_dispatch_event(cell, atomic, hop); + if (++processed >=3D MAX_CELL_PROCESSES_IN_QUEUE) + goto out; /* the rest processed at the next batch */ } =20 /* Process time queue... */ @@ -272,14 +277,19 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int= atomic, int hop) if (!cell) break; snd_seq_dispatch_event(cell, atomic, hop); + if (++processed >=3D MAX_CELL_PROCESSES_IN_QUEUE) + goto out; /* the rest processed at the next batch */ } =20 + out: /* free lock */ spin_lock_irqsave(&q->check_lock, flags); if (q->check_again) { q->check_again =3D 0; - spin_unlock_irqrestore(&q->check_lock, flags); - goto __again; + if (processed < MAX_CELL_PROCESSES_IN_QUEUE) { + spin_unlock_irqrestore(&q->check_lock, flags); + goto __again; + } } q->check_blocked =3D 0; spin_unlock_irqrestore(&q->check_lock, flags); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C866C41535 for ; Tue, 25 Jan 2022 00:18:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374277AbiAYAQk (ORCPT ); Mon, 24 Jan 2022 19:16:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383050AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3B0DC01D7EC; Mon, 24 Jan 2022 13:31:01 -0800 (PST) Received: from smtp.kernel.org (relay.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 4AD71B8122A; Mon, 24 Jan 2022 21:31:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77A88C340E4; Mon, 24 Jan 2022 21:30:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059860; bh=9aUcXT3IAkm0wq9zoAJHhvROrGWTCBthzqq60iNgH8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CeQyGaISh2khsOeIiZXuAz4/KnypXx++/PLwgmGMlommWrLPTIx4Lcv4vMCD/7vnJ urLBio6qi9tajkZ9g5IHsUCYJtbNbTOG4y8MNNcFsdUvFq/NfZIQGAdg3hnG+EtlLF N6AKNazmOKq83djYHnmsAqAKOHuAqdso0aahNdw4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryutaroh Matsumoto , Nathan Chancellor , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.16 0757/1039] MIPS: Loongson64: Use three arguments for slti Date: Mon, 24 Jan 2022 19:42:26 +0100 Message-Id: <20220124184150.779947895@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 f2c6c22fa83ab2577619009057b3ebcb5305bb03 ] LLVM's integrated assembler does not support 'slti , ': :16:12: error: invalid operand for instruction slti $12, (0x6300 | 0x0008) ^ arch/mips/kernel/head.S:86:2: note: while in macro instantiation kernel_entry_setup # cpu specific setup ^ :16:12: error: invalid operand for instruction slti $12, (0x6300 | 0x0008) ^ arch/mips/kernel/head.S:150:2: note: while in macro instantiation smp_slave_setup ^ To increase compatibility with LLVM's integrated assembler, use the full form of 'slti , , ', which matches the rest of arch/mips/. This does not result in any change for GNU as. Link: https://github.com/ClangBuiltLinux/linux/issues/1526 Reported-by: Ryutaroh Matsumoto Signed-off-by: Nathan Chancellor Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/mips/include/asm/mach-loongson64/kernel-entry-init.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h b/ar= ch/mips/include/asm/mach-loongson64/kernel-entry-init.h index 13373c5144f89..efb41b3519747 100644 --- a/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h +++ b/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h @@ -32,7 +32,7 @@ nop /* Loongson-3A R2/R3 */ andi t0, (PRID_IMP_MASK | PRID_REV_MASK) - slti t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) + slti t0, t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) bnez t0, 2f nop 1: @@ -63,7 +63,7 @@ nop /* Loongson-3A R2/R3 */ andi t0, (PRID_IMP_MASK | PRID_REV_MASK) - slti t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) + slti t0, t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) bnez t0, 2f nop 1: --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43A00C433FE for ; Mon, 24 Jan 2022 22:17:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582758AbiAXWPo (ORCPT ); Mon, 24 Jan 2022 17:15:44 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49694 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453840AbiAXVbD (ORCPT ); Mon, 24 Jan 2022 16:31:03 -0500 Received: from smtp.kernel.org (relay.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 8631A60C60; Mon, 24 Jan 2022 21:31:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 618BCC340E7; Mon, 24 Jan 2022 21:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059863; bh=MRETdH0R/JG+t6ZDfa9LEIzPGElTchgZ8fjTDMT/5lk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1zc1pKfjKv7vnWb9z2J2vTtEV5vBZXkfceLR7vULQrameQ0zC5GXfFwfesq116SIS LKdYzTgqaPWMYGgngMvOefoPYQZX6sAmWDtbsywBWXkyfzMcCBlrSTUKQV4pE4b9Bw nAQgSNHVaczLGHpyQaYHXXFTf0li0d1jl0HaTRoc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0758/1039] powerpc/40x: Map 32Mbytes of memory at startup Date: Mon, 24 Jan 2022 19:42:27 +0100 Message-Id: <20220124184150.810213382@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 06e7cbc29e97b4713b4ea6def04ae8501a7d1a59 ] As reported by Carlo, 16Mbytes is not enough with modern kernels that tend to be a bit big, so map another 16M page at boot. Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/89b5f974a7fa5011206682cd092e2c905530ff46.16= 32755552.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kernel/head_40x.S | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S index 7d72ee5ab387c..e783860bea838 100644 --- a/arch/powerpc/kernel/head_40x.S +++ b/arch/powerpc/kernel/head_40x.S @@ -27,6 +27,7 @@ =20 #include #include +#include #include #include #include @@ -650,7 +651,7 @@ start_here: b . /* prevent prefetch past rfi */ =20 /* Set up the initial MMU state so we can do the first level of - * kernel initialization. This maps the first 16 MBytes of memory 1:1 + * kernel initialization. This maps the first 32 MBytes of memory 1:1 * virtual to physical and more importantly sets the cache mode. */ initial_mmu: @@ -687,6 +688,12 @@ initial_mmu: tlbwe r4,r0,TLB_DATA /* Load the data portion of the entry */ tlbwe r3,r0,TLB_TAG /* Load the tag portion of the entry */ =20 + li r0,62 /* TLB slot 62 */ + addis r4,r4,SZ_16M@h + addis r3,r3,SZ_16M@h + tlbwe r4,r0,TLB_DATA /* Load the data portion of the entry */ + tlbwe r3,r0,TLB_TAG /* Load the tag portion of the entry */ + isync =20 /* Establish the exception vector base --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F397BC433FE for ; Mon, 24 Jan 2022 22:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587059AbiAXW1l (ORCPT ); Mon, 24 Jan 2022 17:27:41 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46524 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454595AbiAXVdM (ORCPT ); Mon, 24 Jan 2022 16:33:12 -0500 Received: from smtp.kernel.org (relay.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 13D22B811A2; Mon, 24 Jan 2022 21:33:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DC72C340E4; Mon, 24 Jan 2022 21:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059989; bh=/+mI8nrRREij5JDaj6gEO/h76K+KA7kZdaVgSdBD+Fk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ffvYRmmz1BJ87zeF91rOMUXr4NP78YwEemb97a/a/XrLGLXJoO2q2B5ukTJPZsIYW fm3Tko9FpAyvnCVnJkFTfhj/kON1i/uAWH+XSN0OVLnLBDEeVG6oIWUwjLL5VEp4AS A6Ss25KrLbcjPZKcyufEoNbas5fa3TTz41VbMsmU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thadeu Lima de Souza Cascardo , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0759/1039] selftests/powerpc/spectre_v2: Return skip code when miss_percent is high Date: Mon, 24 Jan 2022 19:42:28 +0100 Message-Id: <20220124184150.840757878@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thadeu Lima de Souza Cascardo [ Upstream commit 3c42e9542050d49610077e083c7c3f5fd5e26820 ] A mis-match between reported and actual mitigation is not restricted to the Vulnerable case. The guest might also report the mitigation as "Software count cache flush" and the host will still mitigate with branch cache disabled. So, instead of skipping depending on the detected mitigation, simply skip whenever the detected miss_percent is the expected one for a fully mitigated system, that is, above 95%. Signed-off-by: Thadeu Lima de Souza Cascardo Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211207130557.40566-1-cascardo@canonical.c= om Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/powerpc/security/spectre_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/powerpc/security/spectre_v2.c b/tools/= testing/selftests/powerpc/security/spectre_v2.c index adc2b7294e5fd..83647b8277e7d 100644 --- a/tools/testing/selftests/powerpc/security/spectre_v2.c +++ b/tools/testing/selftests/powerpc/security/spectre_v2.c @@ -193,7 +193,7 @@ int spectre_v2_test(void) * We are not vulnerable and reporting otherwise, so * missing such a mismatch is safe. */ - if (state =3D=3D VULNERABLE) + if (miss_percent > 95) return 4; =20 return 1; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 061FEC433FE for ; Mon, 24 Jan 2022 22:19:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582403AbiAXWS5 (ORCPT ); Mon, 24 Jan 2022 17:18:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45652 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454033AbiAXVbd (ORCPT ); Mon, 24 Jan 2022 16:31:33 -0500 Received: from smtp.kernel.org (relay.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 CFA31B81233; Mon, 24 Jan 2022 21:31:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D55DC340E4; Mon, 24 Jan 2022 21:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059886; bh=SCgLEX0Kh7icKYxXAHJBDyBvz8vlCwfQ+JaNq8HYN6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SOhF7xS8wJxYAkrWC+6q6qMya6VLFnqVYIcbQ4ExHb8lzKNq1C8svLNm+j2fb10/y 4mWaVgiUkdXV6IooQ9oGC/uTPTdwJ/YlP9djBD/8zD7cbpdEd6/6PESB1lctCpJ0+M SfaxRg6WlLx/Hrq6ccwla8rsR5+9UUGlWUFmu+JE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Hari Bathini , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0760/1039] powerpc: handle kdump appropriately with crash_kexec_post_notifiers option Date: Mon, 24 Jan 2022 19:42:29 +0100 Message-Id: <20220124184150.870815207@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hari Bathini [ Upstream commit 219572d2fc4135b5ce65c735d881787d48b10e71 ] Kdump can be triggered after panic_notifers since commit f06e5153f4ae2 ("kernel/panic.c: add "crash_kexec_post_notifiers" option for kdump after panic_notifers") introduced crash_kexec_post_notifiers option. But using this option would mean smp_send_stop(), that marks all other CPUs as offline, gets called before kdump is triggered. As a result, kdump routines fail to save other CPUs' registers. To fix this, kdump friendly crash_smp_send_stop() function was introduced with kernel commit 0ee59413c967 ("x86/panic: replace smp_send_stop() with kdump friendly version in panic path"). Override this kdump friendly weak function to handle crash_kexec_post_notifiers option appropriately on powerpc. Reported-by: kernel test robot Signed-off-by: Hari Bathini [Fixed signature of crash_stop_this_cpu() - reported by lkp@intel.com] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211207103719.91117-1-hbathini@linux.ibm.c= om Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kernel/smp.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index aee3a7119f977..7201fdcf02f1c 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -620,6 +620,36 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct = pt_regs *)) } #endif =20 +#ifdef CONFIG_NMI_IPI +static void crash_stop_this_cpu(struct pt_regs *regs) +#else +static void crash_stop_this_cpu(void *dummy) +#endif +{ + /* + * Just busy wait here and avoid marking CPU as offline to ensure + * register data is captured appropriately. + */ + while (1) + cpu_relax(); +} + +void crash_smp_send_stop(void) +{ + static bool stopped =3D false; + + if (stopped) + return; + + stopped =3D true; + +#ifdef CONFIG_NMI_IPI + smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 1000000); +#else + smp_call_function(crash_stop_this_cpu, NULL, 0); +#endif /* CONFIG_NMI_IPI */ +} + #ifdef CONFIG_NMI_IPI static void nmi_stop_this_cpu(struct pt_regs *regs) { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51747C4167E for ; Mon, 24 Jan 2022 22:29:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1585864AbiAXWZI (ORCPT ); Mon, 24 Jan 2022 17:25:08 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45920 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454201AbiAXVcC (ORCPT ); Mon, 24 Jan 2022 16:32:02 -0500 Received: from smtp.kernel.org (relay.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 6C1A7B8122A; Mon, 24 Jan 2022 21:31:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3A0AC340E4; Mon, 24 Jan 2022 21:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059918; bh=IoB7Upsgx+3TaNkP2jKC4svaYwVImu5WjHntAS3c59E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XiYXDiGG/UZId/p9wcBtRK2+wi2bI3Iv/sSMwrFlru9TOQakXB5oPjJuJxFA3Op10 eyTEAvzPVPQl9HJKU/gQX/GyC3aTsmWUaotoWb6McSMpkAY0Ohy+NJ/+CxF2JGjgcr cMr/m8NRk+C9CPxnlvxMYtuaX9z/tD1xHuLu/q6s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hari Bathini , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0761/1039] powerpc/fadump: Fix inaccurate CPU state info in vmcore generated with panic Date: Mon, 24 Jan 2022 19:42:30 +0100 Message-Id: <20220124184150.901970198@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hari Bathini [ Upstream commit 06e629c25daa519be620a8c17359ae8fc7a2e903 ] In panic path, fadump is triggered via a panic notifier function. Before calling panic notifier functions, smp_send_stop() gets called, which stops all CPUs except the panic'ing CPU. Commit 8389b37dffdc ("powerpc: stop_this_cpu: remove the cpu from the online map.") and again commit bab26238bbd4 ("powerpc: Offline CPU in stop_this_cpu()") started marking CPUs as offline while stopping them. So, if a kernel has either of the above commits, vmcore captured with fadump via panic path would not process register data for all CPUs except the panic'ing CPU. Sample output of crash-utility with such vmcore: # crash vmlinux vmcore ... KERNEL: vmlinux DUMPFILE: vmcore [PARTIAL DUMP] CPUS: 1 DATE: Wed Nov 10 09:56:34 EST 2021 UPTIME: 00:00:42 LOAD AVERAGE: 2.27, 0.69, 0.24 TASKS: 183 NODENAME: XXXXXXXXX RELEASE: 5.15.0+ VERSION: #974 SMP Wed Nov 10 04:18:19 CST 2021 MACHINE: ppc64le (2500 Mhz) MEMORY: 8 GB PANIC: "Kernel panic - not syncing: sysrq triggered crash" PID: 3394 COMMAND: "bash" TASK: c0000000150a5f80 [THREAD_INFO: c0000000150a5f80] CPU: 1 STATE: TASK_RUNNING (PANIC) crash> p -x __cpu_online_mask __cpu_online_mask =3D $1 =3D { bits =3D {0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} } crash> crash> crash> p -x __cpu_active_mask __cpu_active_mask =3D $2 =3D { bits =3D {0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} } crash> While this has been the case since fadump was introduced, the issue was not identified for two probable reasons: - In general, the bulk of the vmcores analyzed were from crash due to exception. - The above did change since commit 8341f2f222d7 ("sysrq: Use panic() to force a crash") started using panic() instead of deferencing NULL pointer to force a kernel crash. But then commit de6e5d38417e ("powerpc: smp_send_stop do not offline stopped CPUs") stopped marking CPUs as offline till kernel commit bab26238bbd4 ("powerpc: Offline CPU in stop_this_cpu()") reverted that change. To ensure post processing register data of all other CPUs happens as intended, let panic() function take the crash friendly path (read crash_smp_send_stop()) with the help of crash_kexec_post_notifiers option. Also, as register data for all CPUs is captured by f/w, skip IPI callbacks here for fadump, to avoid any complications in finding the right backtraces. Signed-off-by: Hari Bathini Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211207103719.91117-2-hbathini@linux.ibm.c= om Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kernel/fadump.c | 8 ++++++++ arch/powerpc/kernel/smp.c | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index b7ceb041743c9..60f5fc14aa235 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -1641,6 +1641,14 @@ int __init setup_fadump(void) else if (fw_dump.reserve_dump_area_size) fw_dump.ops->fadump_init_mem_struct(&fw_dump); =20 + /* + * In case of panic, fadump is triggered via ppc_panic_event() + * panic notifier. Setting crash_kexec_post_notifiers to 'true' + * lets panic() function take crash friendly path before panic + * notifiers are invoked. + */ + crash_kexec_post_notifiers =3D true; + return 1; } subsys_initcall(setup_fadump); diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 7201fdcf02f1c..c338f9d8ab37a 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -61,6 +61,7 @@ #include #include #include +#include =20 #ifdef DEBUG #include @@ -638,6 +639,15 @@ void crash_smp_send_stop(void) { static bool stopped =3D false; =20 + /* + * In case of fadump, register data for all CPUs is captured by f/w + * on ibm,os-term rtas call. Skip IPI callbacks to other CPUs before + * this rtas call to avoid tricky post processing of those CPUs' + * backtraces. + */ + if (should_fadump_crash()) + return; + if (stopped) return; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 556EEC43217 for ; Mon, 24 Jan 2022 22:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586931AbiAXW1d (ORCPT ); Mon, 24 Jan 2022 17:27:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:52512 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454400AbiAXVcb (ORCPT ); Mon, 24 Jan 2022 16:32:31 -0500 Received: from smtp.kernel.org (relay.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 1B098614DC; Mon, 24 Jan 2022 21:32:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C92F2C340E4; Mon, 24 Jan 2022 21:32:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059950; bh=7bcSEZLz3ee9hcPWYNTolYzG/C+UFjH9TlCAQp+r2gA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ucSnbFTwnjrIewUo2lXvrRW/xTPbkKpjno666YDfl525K6khJ+GLD4K9TJBdeKNyU IWkTUHRE2AdnXW5SZ3fojNdt/yx1BOvBKUEiQWL2PMZvQ9Er98XpJSnkKh33qYxk79 Te1GoTxatiQRMbeUMCcFa/2G8/3kxmy/2mAn9kiI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Ranjani Sridharan , =?UTF-8?q?P=C3=A9ter=20Ujfalusi?= , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0762/1039] ASoC: SOF: Intel: hda: add quirks for HDAudio DMA position information Date: Mon, 24 Jan 2022 19:42:31 +0100 Message-Id: <20220124184150.932229356@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Pierre-Louis Bossart [ Upstream commit 288fad2f71fa0b989c075d4984879c26d47cfb06 ] The code inherited from the Skylake driver does not seem to follow any known hardware recommendations. The only two recommended options are a) use DPIB registers if VC1 traffic is not allowed b) use DPIB DDR update if VC1 traffic is used In all of SOF-based updated, VC1 is not supported so we can 'safely' move to using DPIB registers only. This patch keeps the legacy code, in case there was an undocumented issue lost to history, and adds the DPIB DDR update for additional debug. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: P=C3=A9ter Ujfalusi Link: https://lore.kernel.org/r/20211207193947.71080-6-pierre-louis.bossart= @linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/sof/intel/hda-pcm.c | 86 +++++++++++++++++++++++++---------- sound/soc/sof/intel/hda.c | 9 +++- sound/soc/sof/intel/hda.h | 6 +++ 3 files changed, 75 insertions(+), 26 deletions(-) diff --git a/sound/soc/sof/intel/hda-pcm.c b/sound/soc/sof/intel/hda-pcm.c index cc8ddef37f37b..41cb60955f5c1 100644 --- a/sound/soc/sof/intel/hda-pcm.c +++ b/sound/soc/sof/intel/hda-pcm.c @@ -172,38 +172,74 @@ snd_pcm_uframes_t hda_dsp_pcm_pointer(struct snd_sof_= dev *sdev, goto found; } =20 - /* - * DPIB/posbuf position mode: - * For Playback, Use DPIB register from HDA space which - * reflects the actual data transferred. - * For Capture, Use the position buffer for pointer, as DPIB - * is not accurate enough, its update may be completed - * earlier than the data written to DDR. - */ - if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK) { + switch (sof_hda_position_quirk) { + case SOF_HDA_POSITION_QUIRK_USE_SKYLAKE_LEGACY: + /* + * This legacy code, inherited from the Skylake driver, + * mixes DPIB registers and DPIB DDR updates and + * does not seem to follow any known hardware recommendations. + * It's not clear e.g. why there is a different flow + * for capture and playback, the only information that matters is + * what traffic class is used, and on all SOF-enabled platforms + * only VC0 is supported so the work-around was likely not necessary + * and quite possibly wrong. + */ + + /* DPIB/posbuf position mode: + * For Playback, Use DPIB register from HDA space which + * reflects the actual data transferred. + * For Capture, Use the position buffer for pointer, as DPIB + * is not accurate enough, its update may be completed + * earlier than the data written to DDR. + */ + if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK) { + pos =3D snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, + AZX_REG_VS_SDXDPIB_XBASE + + (AZX_REG_VS_SDXDPIB_XINTERVAL * + hstream->index)); + } else { + /* + * For capture stream, we need more workaround to fix the + * position incorrect issue: + * + * 1. Wait at least 20us before reading position buffer after + * the interrupt generated(IOC), to make sure position update + * happens on frame boundary i.e. 20.833uSec for 48KHz. + * 2. Perform a dummy Read to DPIB register to flush DMA + * position value. + * 3. Read the DMA Position from posbuf. Now the readback + * value should be >=3D period boundary. + */ + usleep_range(20, 21); + snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, + AZX_REG_VS_SDXDPIB_XBASE + + (AZX_REG_VS_SDXDPIB_XINTERVAL * + hstream->index)); + pos =3D snd_hdac_stream_get_pos_posbuf(hstream); + } + break; + case SOF_HDA_POSITION_QUIRK_USE_DPIB_REGISTERS: + /* + * In case VC1 traffic is disabled this is the recommended option + */ pos =3D snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, AZX_REG_VS_SDXDPIB_XBASE + (AZX_REG_VS_SDXDPIB_XINTERVAL * hstream->index)); - } else { + break; + case SOF_HDA_POSITION_QUIRK_USE_DPIB_DDR_UPDATE: /* - * For capture stream, we need more workaround to fix the - * position incorrect issue: - * - * 1. Wait at least 20us before reading position buffer after - * the interrupt generated(IOC), to make sure position update - * happens on frame boundary i.e. 20.833uSec for 48KHz. - * 2. Perform a dummy Read to DPIB register to flush DMA - * position value. - * 3. Read the DMA Position from posbuf. Now the readback - * value should be >=3D period boundary. + * This is the recommended option when VC1 is enabled. + * While this isn't needed for SOF platforms it's added for + * consistency and debug. */ - usleep_range(20, 21); - snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, - AZX_REG_VS_SDXDPIB_XBASE + - (AZX_REG_VS_SDXDPIB_XINTERVAL * - hstream->index)); pos =3D snd_hdac_stream_get_pos_posbuf(hstream); + break; + default: + dev_err_once(sdev->dev, "hda_position_quirk value %d not supported\n", + sof_hda_position_quirk); + pos =3D 0; + break; } =20 if (pos >=3D hstream->bufsize) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 2c0d4d06ab364..25200a0e1dc9d 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -440,6 +440,10 @@ MODULE_PARM_DESC(use_msi, "SOF HDA use PCI MSI mode"); #define hda_use_msi (1) #endif =20 +int sof_hda_position_quirk =3D SOF_HDA_POSITION_QUIRK_USE_DPIB_REGISTERS; +module_param_named(position_quirk, sof_hda_position_quirk, int, 0444); +MODULE_PARM_DESC(position_quirk, "SOF HDaudio position quirk"); + static char *hda_model; module_param(hda_model, charp, 0444); MODULE_PARM_DESC(hda_model, "Use the given HDA board model."); @@ -618,7 +622,10 @@ static int hda_init(struct snd_sof_dev *sdev) /* HDA bus init */ sof_hda_bus_init(bus, &pci->dev); =20 - bus->use_posbuf =3D 1; + if (sof_hda_position_quirk =3D=3D SOF_HDA_POSITION_QUIRK_USE_DPIB_REGISTE= RS) + bus->use_posbuf =3D 0; + else + bus->use_posbuf =3D 1; bus->bdl_pos_adj =3D 0; bus->sync_write =3D 1; =20 diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 1195018a1f4f5..dba4733ccf9ae 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -738,4 +738,10 @@ struct sof_ipc_dai_config; int hda_ctrl_dai_widget_setup(struct snd_soc_dapm_widget *w); int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w); =20 +#define SOF_HDA_POSITION_QUIRK_USE_SKYLAKE_LEGACY (0) /* previous implemen= tation */ +#define SOF_HDA_POSITION_QUIRK_USE_DPIB_REGISTERS (1) /* recommended if VC= 0 only */ +#define SOF_HDA_POSITION_QUIRK_USE_DPIB_DDR_UPDATE (2) /* recommended with= VC0 or VC1 */ + +extern int sof_hda_position_quirk; + #endif --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95E74C433FE for ; Tue, 25 Jan 2022 00:18:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373597AbiAYAO5 (ORCPT ); Mon, 24 Jan 2022 19:14:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574354AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5711EC0A54D9; Mon, 24 Jan 2022 13:32:54 -0800 (PST) Received: from smtp.kernel.org (relay.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 14576B80FA1; Mon, 24 Jan 2022 21:32:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D86C7C340E4; Mon, 24 Jan 2022 21:32:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059971; bh=GzbYbsXc5BwyTSbLqMt453HSpU4UrE4xgXx+YQpBbjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5ITBnkli9wJz6Uk5mClsU/jdyT5pdKGeI/lSITuKtuWjOVZoMaqBO08x8lCGdflM 4uFH4ovVnZEN2rE0L7stJfAdFXauUEOSD5BSGkgKl+dzp6vEB+1LeFgXWLB7Bc++lX 4CYpX7bqFM0ROFFb37BtlgOhnTJyjUei+a2F6dWM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+9ca499bb57a2b9e4c652@syzkaller.appspotmail.com, Jan Kara , Sasha Levin Subject: [PATCH 5.16 0763/1039] udf: Fix error handling in udf_new_inode() Date: Mon, 24 Jan 2022 19:42:32 +0100 Message-Id: <20220124184150.964657576@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit f05f2429eec60851b98bdde213de31dab697c01b ] When memory allocation of iinfo or block allocation fails, already allocated struct udf_inode_info gets freed with iput() and udf_evict_inode() may look at inode fields which are not properly initialized. Fix it by marking inode bad before dropping reference to it in udf_new_inode(). Reported-by: syzbot+9ca499bb57a2b9e4c652@syzkaller.appspotmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/udf/ialloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 2ecf0e87660e3..b5d611cee749c 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c @@ -77,6 +77,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mo= de) GFP_KERNEL); } if (!iinfo->i_data) { + make_bad_inode(inode); iput(inode); return ERR_PTR(-ENOMEM); } @@ -86,6 +87,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mo= de) dinfo->i_location.partitionReferenceNum, start, &err); if (err) { + make_bad_inode(inode); iput(inode); return ERR_PTR(err); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5C14C4332F for ; Tue, 25 Jan 2022 00:18:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373748AbiAYAPN (ORCPT ); Mon, 24 Jan 2022 19:15:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1581148AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 666E4C0A552A; Mon, 24 Jan 2022 13:32:55 -0800 (PST) Received: from smtp.kernel.org (relay.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 05BCE61028; Mon, 24 Jan 2022 21:32:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DECF1C340E4; Mon, 24 Jan 2022 21:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059974; bh=JiOVbM2qS81Tf9TfdFeLSOmQd6su6h5Fdx5wlgaihSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x+vByxuXPcDK4VHOid5r7IroSYktw8nN0VYIiWYtHf7nDO2b+SbmB5u3F03rETE9A kFDed1dQpHlby+gd6PmPZeqYORijPPKwTZdFN2szIggrAc/l/28o/7+26ZyjVh7V5V uP30WOUhnQow97k6cAhKFJa+076NjrwlG2MwRmjg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Ye Guojin , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.16 0764/1039] MIPS: OCTEON: add put_device() after of_find_device_by_node() Date: Mon, 24 Jan 2022 19:42:33 +0100 Message-Id: <20220124184150.994855214@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Guojin [ Upstream commit 858779df1c0787d3fec827fb705708df9ebdb15b ] This was found by coccicheck: ./arch/mips/cavium-octeon/octeon-platform.c, 332, 1-7, ERROR missing put_device; call of_find_device_by_node on line 324, but without a corresponding object release within this function. ./arch/mips/cavium-octeon/octeon-platform.c, 395, 1-7, ERROR missing put_device; call of_find_device_by_node on line 387, but without a corresponding object release within this function. ./arch/mips/cavium-octeon/octeon-usb.c, 512, 3-9, ERROR missing put_device; call of_find_device_by_node on line 515, but without a corresponding object release within this function. ./arch/mips/cavium-octeon/octeon-usb.c, 543, 1-7, ERROR missing put_device; call of_find_device_by_node on line 515, but without a corresponding object release within this function. Reported-by: Zeal Robot Signed-off-by: Ye Guojin Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/mips/cavium-octeon/octeon-platform.c | 2 ++ arch/mips/cavium-octeon/octeon-usb.c | 1 + 2 files changed, 3 insertions(+) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-o= cteon/octeon-platform.c index d56e9b9d2e434..a994022e32c9f 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -328,6 +328,7 @@ static int __init octeon_ehci_device_init(void) =20 pd->dev.platform_data =3D &octeon_ehci_pdata; octeon_ehci_hw_start(&pd->dev); + put_device(&pd->dev); =20 return ret; } @@ -391,6 +392,7 @@ static int __init octeon_ohci_device_init(void) =20 pd->dev.platform_data =3D &octeon_ohci_pdata; octeon_ohci_hw_start(&pd->dev); + put_device(&pd->dev); =20 return ret; } diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon= /octeon-usb.c index 6e4d3619137af..4df919d26b082 100644 --- a/arch/mips/cavium-octeon/octeon-usb.c +++ b/arch/mips/cavium-octeon/octeon-usb.c @@ -537,6 +537,7 @@ static int __init dwc3_octeon_device_init(void) devm_iounmap(&pdev->dev, base); devm_release_mem_region(&pdev->dev, res->start, resource_size(res)); + put_device(&pdev->dev); } } while (node !=3D NULL); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CCF5C433FE for ; Tue, 25 Jan 2022 00:15:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373409AbiAYANq (ORCPT ); Mon, 24 Jan 2022 19:13:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1583831AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF09BC0A8848; Mon, 24 Jan 2022 13:32:59 -0800 (PST) Received: from smtp.kernel.org (relay.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 9A3D8B80FA1; Mon, 24 Jan 2022 21:32:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF2EFC340E4; Mon, 24 Jan 2022 21:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059977; bh=qYDOpIwbffRx83ZsylOR2lWYM5jvsut86DHKdCbumBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OtubRWtarnD6d5BeVX5XYOxByDMjTpRpDshYajqECoVfbR0tJFQ96y2pXGumT3kyA b9dkqDZqlvMlH21pONLKyV5kEA8dH/1Ixtz7rJfOnEkjirAfYYd6jfSIIS1A39gekv 4eVFPkDBu3uUwgdajYPdLmrYjF7Kqzin9dHkU4Nk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jay Chen , Marc Zyngier , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0765/1039] irqchip/gic-v4: Disable redistributors view of the VPE table at boot time Date: Mon, 24 Jan 2022 19:42:34 +0100 Message-Id: <20220124184151.026668579@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Zyngier [ Upstream commit 79a7f77b9b154d572bd9d2f1eecf58c4d018d8e2 ] Jay Chen reported that using a kdump kernel on a GICv4.1 system results in a RAS error being delivered when the secondary kernel configures the ITS's view of the new VPE table. As it turns out, that's because each RD still has a pointer to the previous instance of the VPE table, and that particular implementation is very upset by seeing two bits of the HW that should point to the same table with different values. To solve this, let's invalidate any reference that any RD has to the VPE table when discovering the RDs. The ITS can then be programmed as expected. Reported-by: Jay Chen Signed-off-by: Marc Zyngier Cc: Lorenzo Pieralisi Link: https://lore.kernel.org/r/20211214064716.21407-1-jkchen@linux.alibaba= .com Link: https://lore.kernel.org/r/20211216144804.1578566-1-maz@kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/irqchip/irq-gic-v3.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index daec3309b014d..86397522e7864 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -920,6 +920,22 @@ static int __gic_update_rdist_properties(struct redist= _region *region, { u64 typer =3D gic_read_typer(ptr + GICR_TYPER); =20 + /* Boot-time cleanip */ + if ((typer & GICR_TYPER_VLPIS) && (typer & GICR_TYPER_RVPEID)) { + u64 val; + + /* Deactivate any present vPE */ + val =3D gicr_read_vpendbaser(ptr + SZ_128K + GICR_VPENDBASER); + if (val & GICR_VPENDBASER_Valid) + gicr_write_vpendbaser(GICR_VPENDBASER_PendingLast, + ptr + SZ_128K + GICR_VPENDBASER); + + /* Mark the VPE table as invalid */ + val =3D gicr_read_vpropbaser(ptr + SZ_128K + GICR_VPROPBASER); + val &=3D ~GICR_VPROPBASER_4_1_VALID; + gicr_write_vpropbaser(val, ptr + SZ_128K + GICR_VPROPBASER); + } + gic_data.rdists.has_vlpis &=3D !!(typer & GICR_TYPER_VLPIS); =20 /* RVPEID implies some form of DirectLPI, no matter what the doc says... = :-/ */ --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB6C4C433EF for ; Tue, 25 Jan 2022 00:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410788AbiAYAaX (ORCPT ); Mon, 24 Jan 2022 19:30:23 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:52794 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454509AbiAXVdB (ORCPT ); Mon, 24 Jan 2022 16:33:01 -0500 Received: from smtp.kernel.org (relay.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 ED07F614F1; Mon, 24 Jan 2022 21:33:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCD73C340E4; Mon, 24 Jan 2022 21:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059980; bh=/4ymQkPm05sQ9np1VxxhcptsSvkId83WEA1PyJ18I4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VQwHHWl0iRP9zfSQijm/Q/MEcCm18FwZaX/aOrnAXij4D6MCqLTOGI0Bc8D406zFo G2wqn2dhugrf2T5eeQjg4rNDJHWhPSXVv5ul+wVlohKL8D1LL6ZGrxl9uP/QBJMVAV AcZ85WSjgY8Di8OVuP0+yywfzYfIjpdd9cED6YGM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , Lakshmi Sowjanya D , Andy Shevchenko , Jarkko Nikula , Sasha Levin Subject: [PATCH 5.16 0766/1039] i2c: designware-pci: Fix to change data types of hcnt and lcnt parameters Date: Mon, 24 Jan 2022 19:42:35 +0100 Message-Id: <20220124184151.064536602@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lakshmi Sowjanya D [ Upstream commit d52097010078c1844348dc0e467305e5f90fd317 ] The data type of hcnt and lcnt in the struct dw_i2c_dev is of type u16. It's better to have same data type in struct dw_scl_sda_cfg as well. Reported-by: Wolfram Sang Signed-off-by: Lakshmi Sowjanya D Signed-off-by: Andy Shevchenko Signed-off-by: Jarkko Nikula Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/i2c/busses/i2c-designware-pcidrv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busse= s/i2c-designware-pcidrv.c index 0f409a4c2da0d..5b45941bcbddc 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -39,10 +39,10 @@ enum dw_pci_ctl_id_t { }; =20 struct dw_scl_sda_cfg { - u32 ss_hcnt; - u32 fs_hcnt; - u32 ss_lcnt; - u32 fs_lcnt; + u16 ss_hcnt; + u16 fs_hcnt; + u16 ss_lcnt; + u16 fs_lcnt; u32 sda_hold; }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D528FC43217 for ; Tue, 25 Jan 2022 01:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3411886AbiAYAfF (ORCPT ); Mon, 24 Jan 2022 19:35:05 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46378 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454535AbiAXVdG (ORCPT ); Mon, 24 Jan 2022 16:33:06 -0500 Received: from smtp.kernel.org (relay.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 A8912B81188; Mon, 24 Jan 2022 21:33:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6736C340E4; Mon, 24 Jan 2022 21:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059983; bh=UAjvnhTZ2Yn5EHOvdWzEPrFzvMqBIFWTeR/luTOCF24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TlfP+4xjHb3Z7W5gchzDF72Lrf7xEZDa6et5uscVWw9uGDttsCQAyAIwjFiIv/smj 9r72BWXzHyKLhlNfPoOzBbZ5Iqib9ZEQKr+YEyb0vEeeYIgKHIjztm8MkDgnl5gl3C 7fxkYkjz2sPSqFnPlTBHn5ExRy2sC/TxpO6ng+m4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qi Liu , John Garry , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 0767/1039] scsi: hisi_sas: Prevent parallel FLR and controller reset Date: Mon, 24 Jan 2022 19:42:36 +0100 Message-Id: <20220124184151.096712073@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qi Liu [ Upstream commit 16775db613c2bdea09705dcb876942c0641a1098 ] If we issue a controller reset command during executing a FLR a hung task may be found: Call trace: __switch_to+0x158/0x1cc __schedule+0x2e8/0x85c schedule+0x7c/0x110 schedule_timeout+0x190/0x1cc __down+0x7c/0xd4 down+0x5c/0x7c hisi_sas_task_exec+0x510/0x680 [hisi_sas_main] hisi_sas_queue_command+0x24/0x30 [hisi_sas_main] smp_execute_task_sg+0xf4/0x23c [libsas] sas_smp_phy_control+0x110/0x1e0 [libsas] transport_sas_phy_reset+0xc8/0x190 [libsas] phy_reset_work+0x2c/0x40 [libsas] process_one_work+0x1dc/0x48c worker_thread+0x15c/0x464 kthread+0x160/0x170 ret_from_fork+0x10/0x18 This is a race condition which occurs when the FLR completes first. Here the host HISI_SAS_RESETTING_BIT flag out gets of sync as HISI_SAS_RESETTING_BIT is not always cleared with the hisi_hba.sem held, so now only set/unset HISI_SAS_RESETTING_BIT under hisi_hba.sem . Link: https://lore.kernel.org/r/1639579061-179473-7-git-send-email-john.gar= ry@huawei.com Signed-off-by: Qi Liu Signed-off-by: John Garry Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/hisi_sas/hisi_sas_main.c | 8 +++++--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/= hisi_sas_main.c index f206c433de325..8a13bc08d6575 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1581,7 +1581,6 @@ void hisi_sas_controller_reset_prepare(struct hisi_hb= a *hisi_hba) { struct Scsi_Host *shost =3D hisi_hba->shost; =20 - down(&hisi_hba->sem); hisi_hba->phy_state =3D hisi_hba->hw->get_phys_state(hisi_hba); =20 scsi_block_requests(shost); @@ -1606,9 +1605,9 @@ void hisi_sas_controller_reset_done(struct hisi_hba *= hisi_hba) if (hisi_hba->reject_stp_links_msk) hisi_sas_terminate_stp_reject(hisi_hba); hisi_sas_reset_init_all_devices(hisi_hba); - up(&hisi_hba->sem); scsi_unblock_requests(shost); clear_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags); + up(&hisi_hba->sem); =20 hisi_sas_rescan_topology(hisi_hba, hisi_hba->phy_state); } @@ -1619,8 +1618,11 @@ static int hisi_sas_controller_prereset(struct hisi_= hba *hisi_hba) if (!hisi_hba->hw->soft_reset) return -1; =20 - if (test_and_set_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags)) + down(&hisi_hba->sem); + if (test_and_set_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags)) { + up(&hisi_hba->sem); return -1; + } =20 if (hisi_sas_debugfs_enable && hisi_hba->debugfs_itct[0].itct) hisi_hba->hw->debugfs_snapshot_regs(hisi_hba); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas= /hisi_sas_v3_hw.c index 0ef6c21bf0811..11a44d9dd9b2d 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -4848,6 +4848,7 @@ static void hisi_sas_reset_prepare_v3_hw(struct pci_d= ev *pdev) int rc; =20 dev_info(dev, "FLR prepare\n"); + down(&hisi_hba->sem); set_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags); hisi_sas_controller_reset_prepare(hisi_hba); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ED0CC433EF for ; Mon, 24 Jan 2022 22:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587084AbiAXW1n (ORCPT ); Mon, 24 Jan 2022 17:27:43 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46408 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454580AbiAXVdJ (ORCPT ); Mon, 24 Jan 2022 16:33:09 -0500 Received: from smtp.kernel.org (relay.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 200F3B8121C; Mon, 24 Jan 2022 21:33:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51206C340E4; Mon, 24 Jan 2022 21:33:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059986; bh=L5fMBsQ4GFTUWDax+L1PtBdZ0vB16WfrrFYjYR1GER4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UlZMnhP06SX2RZT2XsycRtsaAS3NL6anW+Vwd4Puv0IO/qbw8asMlu8v9jFbIVHHr JuYdXkjG0JvRi5zO5Il66rJAKt3qJtlGI6jPnPy4J+mUrMceTWXSQblIC4r2m4nu6z eMENmvbW4iDLWptMHtO8twOlWtBb/xYnHyJmstK0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ranjani Sridharan , Ajit Kumar Pandey , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0768/1039] ASoC: SOF: ipc: Add null pointer check for substream->runtime Date: Mon, 24 Jan 2022 19:42:37 +0100 Message-Id: <20220124184151.127977893@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ajit Kumar Pandey [ Upstream commit 182b682b9ab1348e07ea1bf9d8f2505cc67f9237 ] When pcm stream is stopped "substream->runtime" pointer will be set to NULL by ALSA core. In case host received an ipc msg from firmware of type IPC_STREAM_POSITION after pcm stream is stopped, there will be kernel NULL pointer exception in ipc_period_elapsed(). This patch fixes it by adding NULL pointer check for "substream->runtime". Reviewed-by: Ranjani Sridharan Signed-off-by: Ajit Kumar Pandey Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20211216232422.345164-3-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/sof/ipc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index e6c53c6c470e4..ca30c506a0fd6 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -547,7 +547,8 @@ static void ipc_period_elapsed(struct snd_sof_dev *sdev= , u32 msg_id) =20 if (spcm->pcm.compress) snd_sof_compr_fragment_elapsed(stream->cstream); - else if (!stream->substream->runtime->no_period_wakeup) + else if (stream->substream->runtime && + !stream->substream->runtime->no_period_wakeup) /* only inform ALSA for period_wakeup mode */ snd_sof_pcm_period_elapsed(stream->substream); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38BCBC433EF for ; Tue, 25 Jan 2022 00:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374258AbiAYAQi (ORCPT ); Mon, 24 Jan 2022 19:16:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383546AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 078F0C01D7F4; Mon, 24 Jan 2022 13:31:32 -0800 (PST) Received: from smtp.kernel.org (relay.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 B7411B8123A; Mon, 24 Jan 2022 21:31:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D92EDC340E4; Mon, 24 Jan 2022 21:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059889; bh=fgpNcpGwTQOlUCWiGZGZm/cuplCzU4SORglq/H8Knog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DOEPQTnoQ4QCsWO3YTxIGx5181+xQOzM0bMSKw/6O6vlvShj6yg1haeA5P+HslsY1 3VGf7kYQYvH9RHCAJau7g5o+wmXPtJkGxO/NJLhuB9m4DvYgcCOPbRhn3ywkZF/VJY 5nb0q+xixIcuL4X9oB6iEJCm9tu6tDTktM3d6Hrw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0769/1039] selftests/powerpc: Add a test of sigreturning to the kernel Date: Mon, 24 Jan 2022 19:42:38 +0100 Message-Id: <20220124184151.159121523@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit a8968521cfdc3e339fe69473d6632e0aa8d7202a ] We have a general signal fuzzer, sigfuz, which can modify the MSR & NIP before sigreturn. But the chance of it hitting a kernel address and also clearing MSR_PR is fairly slim. So add a specific test of sigreturn to a kernel address, both with and without attempting to clear MSR_PR (which the kernel must block). Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211209115944.4062384-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../selftests/powerpc/signal/.gitignore | 1 + .../testing/selftests/powerpc/signal/Makefile | 1 + .../powerpc/signal/sigreturn_kernel.c | 132 ++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 tools/testing/selftests/powerpc/signal/sigreturn_kernel= .c diff --git a/tools/testing/selftests/powerpc/signal/.gitignore b/tools/test= ing/selftests/powerpc/signal/.gitignore index ce3375cd8e73e..8f6c816099a48 100644 --- a/tools/testing/selftests/powerpc/signal/.gitignore +++ b/tools/testing/selftests/powerpc/signal/.gitignore @@ -4,3 +4,4 @@ signal_tm sigfuz sigreturn_vdso sig_sc_double_restart +sigreturn_kernel diff --git a/tools/testing/selftests/powerpc/signal/Makefile b/tools/testin= g/selftests/powerpc/signal/Makefile index d6ae54663aed7..84e201572466d 100644 --- a/tools/testing/selftests/powerpc/signal/Makefile +++ b/tools/testing/selftests/powerpc/signal/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 TEST_GEN_PROGS :=3D signal signal_tm sigfuz sigreturn_vdso sig_sc_double_r= estart +TEST_GEN_PROGS +=3D sigreturn_kernel =20 CFLAGS +=3D -maltivec $(OUTPUT)/signal_tm: CFLAGS +=3D -mhtm diff --git a/tools/testing/selftests/powerpc/signal/sigreturn_kernel.c b/to= ols/testing/selftests/powerpc/signal/sigreturn_kernel.c new file mode 100644 index 0000000000000..0a1b6e591eeed --- /dev/null +++ b/tools/testing/selftests/powerpc/signal/sigreturn_kernel.c @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Test that we can't sigreturn to kernel addresses, or to kernel mode. + */ + +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include + +#include "utils.h" + +#define MSR_PR (1ul << 14) + +static volatile unsigned long long sigreturn_addr; +static volatile unsigned long long sigreturn_msr_mask; + +static void sigusr1_handler(int signo, siginfo_t *si, void *uc_ptr) +{ + ucontext_t *uc =3D (ucontext_t *)uc_ptr; + + if (sigreturn_addr) + UCONTEXT_NIA(uc) =3D sigreturn_addr; + + if (sigreturn_msr_mask) + UCONTEXT_MSR(uc) &=3D sigreturn_msr_mask; +} + +static pid_t fork_child(void) +{ + pid_t pid; + + pid =3D fork(); + if (pid =3D=3D 0) { + raise(SIGUSR1); + exit(0); + } + + return pid; +} + +static int expect_segv(pid_t pid) +{ + int child_ret; + + waitpid(pid, &child_ret, 0); + FAIL_IF(WIFEXITED(child_ret)); + FAIL_IF(!WIFSIGNALED(child_ret)); + FAIL_IF(WTERMSIG(child_ret) !=3D 11); + + return 0; +} + +int test_sigreturn_kernel(void) +{ + struct sigaction act; + int child_ret, i; + pid_t pid; + + act.sa_sigaction =3D sigusr1_handler; + act.sa_flags =3D SA_SIGINFO; + sigemptyset(&act.sa_mask); + + FAIL_IF(sigaction(SIGUSR1, &act, NULL)); + + for (i =3D 0; i < 2; i++) { + // Return to kernel + sigreturn_addr =3D 0xcull << 60; + pid =3D fork_child(); + expect_segv(pid); + + // Return to kernel virtual + sigreturn_addr =3D 0xc008ull << 48; + pid =3D fork_child(); + expect_segv(pid); + + // Return out of range + sigreturn_addr =3D 0xc010ull << 48; + pid =3D fork_child(); + expect_segv(pid); + + // Return to no-man's land, just below PAGE_OFFSET + sigreturn_addr =3D (0xcull << 60) - (64 * 1024); + pid =3D fork_child(); + expect_segv(pid); + + // Return to no-man's land, above TASK_SIZE_4PB + sigreturn_addr =3D 0x1ull << 52; + pid =3D fork_child(); + expect_segv(pid); + + // Return to 0xd space + sigreturn_addr =3D 0xdull << 60; + pid =3D fork_child(); + expect_segv(pid); + + // Return to 0xe space + sigreturn_addr =3D 0xeull << 60; + pid =3D fork_child(); + expect_segv(pid); + + // Return to 0xf space + sigreturn_addr =3D 0xfull << 60; + pid =3D fork_child(); + expect_segv(pid); + + // Attempt to set PR=3D0 for 2nd loop (should be blocked by kernel) + sigreturn_msr_mask =3D ~MSR_PR; + } + + printf("All children killed as expected\n"); + + // Don't change address, just MSR, should return to user as normal + sigreturn_addr =3D 0; + sigreturn_msr_mask =3D ~MSR_PR; + pid =3D fork_child(); + waitpid(pid, &child_ret, 0); + FAIL_IF(!WIFEXITED(child_ret)); + FAIL_IF(WIFSIGNALED(child_ret)); + FAIL_IF(WEXITSTATUS(child_ret) !=3D 0); + + return 0; +} + +int main(void) +{ + return test_harness(test_sigreturn_kernel, "sigreturn_kernel"); +} --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C8CFC433EF for ; Tue, 25 Jan 2022 00:19:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374639AbiAYARf (ORCPT ); Mon, 24 Jan 2022 19:17:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383848AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41203C01D7F6; Mon, 24 Jan 2022 13:31:33 -0800 (PST) Received: from smtp.kernel.org (relay.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 D6A2A614F1; Mon, 24 Jan 2022 21:31:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEA9CC340E4; Mon, 24 Jan 2022 21:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059892; bh=7Tyt6TC2ggJRw3fF++QSOCLW9HU6iOd4lCmrV9XE4Cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vk2CcGYcohBge1czCKo2k+pV+/VRpgb7GuUDwwsRKNKZTLDy9Aa9T74PMkqcO/AkE s9jT/MIbMbaGwNvBzOpyot8sa+daSIpaTck9Pqm6BsqankTZD9TwUW/fUXN+5wDF9X It8mGaeEECdpwOCsAeo+Gdyh1X+yrW1GNrjv6l9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianjia Zhang , Nathan Chancellor , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.16 0770/1039] MIPS: Octeon: Fix build errors using clang Date: Mon, 24 Jan 2022 19:42:39 +0100 Message-Id: <20220124184151.193154018@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Tianjia Zhang [ Upstream commit 95339b70677dc6f9a2d669c4716058e71b8dc1c7 ] A large number of the following errors is reported when compiling with clang: cvmx-bootinfo.h:326:3: error: adding 'int' to a string does not append to= the string [-Werror,-Wstring-plus-int] ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NULL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cvmx-bootinfo.h:321:20: note: expanded from macro 'ENUM_BRD_TYPE_CASE' case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ ~~~^~~~ cvmx-bootinfo.h:326:3: note: use array indexing to silence this warning cvmx-bootinfo.h:321:20: note: expanded from macro 'ENUM_BRD_TYPE_CASE' case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ ^ Follow the prompts to use the address operator '&' to fix this error. Signed-off-by: Tianjia Zhang Reviewed-by: Nathan Chancellor Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/mips/include/asm/octeon/cvmx-bootinfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/inclu= de/asm/octeon/cvmx-bootinfo.h index 0e6bf220db618..6c61e0a639249 100644 --- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h +++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h @@ -318,7 +318,7 @@ enum cvmx_chip_types_enum { =20 /* Functions to return string based on type */ #define ENUM_BRD_TYPE_CASE(x) \ - case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ + case x: return (&#x[16]); /* Skip CVMX_BOARD_TYPE_ */ static inline const char *cvmx_board_type_to_string(enum cvmx_board_types_enum type) { @@ -410,7 +410,7 @@ static inline const char *cvmx_board_type_to_string(enum } =20 #define ENUM_CHIP_TYPE_CASE(x) \ - case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ + case x: return (&#x[15]); /* Skip CVMX_CHIP_TYPE */ static inline const char *cvmx_chip_type_to_string(enum cvmx_chip_types_enum type) { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09BF0C4167E for ; Mon, 24 Jan 2022 22:31:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586815AbiAXW1X (ORCPT ); Mon, 24 Jan 2022 17:27:23 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45714 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454060AbiAXVbn (ORCPT ); Mon, 24 Jan 2022 16:31:43 -0500 Received: from smtp.kernel.org (relay.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 767F1B81142; Mon, 24 Jan 2022 21:31:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0981C340E4; Mon, 24 Jan 2022 21:31:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059895; bh=hiKltHgWQoklyviP7j9xJYA49jfJQ7EKWXU3uv1sDos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KBUWlY4/7Jk6gq2+RLWMyPiMoP33/lvSUAMAL+JeXELANNO7sJNJyIOjYB1U7hz4s 9UT2LRN8Idaz+5HVHvrJdOLTfsGhvhjJUnhX3PUI4p3dn/gAm61e74efrvp9xEiVcG u6H0CeW2HAJ1i0n0iqW/T7CZd+39h7nlEj89cmcU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baoquan He , Christoph Hellwig , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 0771/1039] scsi: sr: Dont use GFP_DMA Date: Mon, 24 Jan 2022 19:42:40 +0100 Message-Id: <20220124184151.223382877@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit d94d94969a4ba07a43d62429c60372320519c391 ] The allocated buffers are used as a command payload, for which the block layer and/or DMA API do the proper bounce buffering if needed. Link: https://lore.kernel.org/r/20211222090842.920724-1-hch@lst.de Reported-by: Baoquan He Reviewed-by: Baoquan He Signed-off-by: Christoph Hellwig Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/sr.c | 2 +- drivers/scsi/sr_vendor.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 8e4af111c0787..f5a2eed543452 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -856,7 +856,7 @@ static void get_capabilities(struct scsi_cd *cd) =20 =20 /* allocate transfer buffer */ - buffer =3D kmalloc(512, GFP_KERNEL | GFP_DMA); + buffer =3D kmalloc(512, GFP_KERNEL); if (!buffer) { sr_printk(KERN_ERR, cd, "out of memory.\n"); return; diff --git a/drivers/scsi/sr_vendor.c b/drivers/scsi/sr_vendor.c index 1f988a1b9166f..a61635326ae0a 100644 --- a/drivers/scsi/sr_vendor.c +++ b/drivers/scsi/sr_vendor.c @@ -131,7 +131,7 @@ int sr_set_blocklength(Scsi_CD *cd, int blocklength) if (cd->vendor =3D=3D VENDOR_TOSHIBA) density =3D (blocklength > 2048) ? 0x81 : 0x83; =20 - buffer =3D kmalloc(512, GFP_KERNEL | GFP_DMA); + buffer =3D kmalloc(512, GFP_KERNEL); if (!buffer) return -ENOMEM; =20 @@ -179,7 +179,7 @@ int sr_cd_check(struct cdrom_device_info *cdi) if (cd->cdi.mask & CDC_MULTI_SESSION) return 0; =20 - buffer =3D kmalloc(512, GFP_KERNEL | GFP_DMA); + buffer =3D kmalloc(512, GFP_KERNEL); if (!buffer) return -ENOMEM; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C759C433FE for ; Tue, 25 Jan 2022 00:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374331AbiAYAQt (ORCPT ); Mon, 24 Jan 2022 19:16:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383889AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96038C01D7F7; Mon, 24 Jan 2022 13:31:40 -0800 (PST) Received: from smtp.kernel.org (relay.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 5DCA9B8123A; Mon, 24 Jan 2022 21:31:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9584DC340E4; Mon, 24 Jan 2022 21:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059898; bh=LTV0XAwMy9g8Y7DFWmRAMBCvbCPAanzUK5p1srS9zEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5O54t8Pl34vpujvHlusIuEnjBpuEVv95udKWuzp5/vpFjE3fkHEPFMoZ6JV/paL7 E/0POWvROMYS+Ne7HS2c+dEkZLU3UlnDe8bN9VBrn1LKkz/ORUXWFAAvzTSQ/OBi+C ULixIemiwRA7xMV/8+0coWn6CLJ5ar4M3/OaEaVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sreekanth Reddy , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 0772/1039] scsi: mpi3mr: Fixes around reply request queues Date: Mon, 24 Jan 2022 19:42:41 +0100 Message-Id: <20220124184151.254085952@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sreekanth Reddy [ Upstream commit 243bcc8efdb1f44b1a1d415e6821a246714c68ce ] Set reply queue depth of 1K for B0 and 4K for A0. While freeing the segmented request queues use the actual queue depth that is used while creating them. Link: https://lore.kernel.org/r/20211220141159.16117-25-sreekanth.reddy@bro= adcom.com Signed-off-by: Sreekanth Reddy Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/mpi3mr/mpi3mr.h | 3 ++- drivers/scsi/mpi3mr/mpi3mr_fw.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h index 9787b53a2b598..2cc42432bd0c0 100644 --- a/drivers/scsi/mpi3mr/mpi3mr.h +++ b/drivers/scsi/mpi3mr/mpi3mr.h @@ -79,7 +79,8 @@ extern int prot_mask; =20 /* Operational queue management definitions */ #define MPI3MR_OP_REQ_Q_QD 512 -#define MPI3MR_OP_REP_Q_QD 4096 +#define MPI3MR_OP_REP_Q_QD 1024 +#define MPI3MR_OP_REP_Q_QD4K 4096 #define MPI3MR_OP_REQ_Q_SEG_SIZE 4096 #define MPI3MR_OP_REP_Q_SEG_SIZE 4096 #define MPI3MR_MAX_SEG_LIST_SIZE 4096 diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_f= w.c index aa5d877df6f83..2daf633ea2955 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -1278,7 +1278,7 @@ static void mpi3mr_free_op_req_q_segments(struct mpi3= mr_ioc *mrioc, u16 q_idx) mrioc->op_reply_qinfo[q_idx].q_segment_list =3D NULL; } } else - size =3D mrioc->req_qinfo[q_idx].num_requests * + size =3D mrioc->req_qinfo[q_idx].segment_qd * mrioc->facts.op_req_sz; =20 for (j =3D 0; j < mrioc->req_qinfo[q_idx].num_segments; j++) { @@ -1565,6 +1565,8 @@ static int mpi3mr_create_op_reply_q(struct mpi3mr_ioc= *mrioc, u16 qidx) =20 reply_qid =3D qidx + 1; op_reply_q->num_replies =3D MPI3MR_OP_REP_Q_QD; + if (!mrioc->pdev->revision) + op_reply_q->num_replies =3D MPI3MR_OP_REP_Q_QD4K; op_reply_q->ci =3D 0; op_reply_q->ephase =3D 1; atomic_set(&op_reply_q->pend_ios, 0); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E066AC4167B for ; Tue, 25 Jan 2022 00:18:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374008AbiAYAPw (ORCPT ); Mon, 24 Jan 2022 19:15:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383884AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E8B2C01D7F8; Mon, 24 Jan 2022 13:31:42 -0800 (PST) Received: from smtp.kernel.org (relay.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 454EDB81243; Mon, 24 Jan 2022 21:31:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6572EC340E4; Mon, 24 Jan 2022 21:31:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059901; bh=vqm+l+et8fHmf+ZDrFYxAyjLbW9sX4AdX0B4LSjo1aY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WDqjz8PBkgRwG5qIHpG+2ahaUFKj7uLUHgfbppe02BElOKgcC5EJwPnxxkkiaMYL7 7ReP34JqmyAWOPA8jAcjFDmxLkYw0MKdWoVF5HGSNG+uaXnPeYUKy0jk5zRTq6QFvF D/Pl4tjq387Nr25zia2GS60O1jRwDySyiKZdawJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tzung-Bi Shih , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0773/1039] ASoC: mediatek: mt8192-mt6359: fix device_node leak Date: Mon, 24 Jan 2022 19:42:42 +0100 Message-Id: <20220124184151.286262603@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 4e28491a7a198c668437f2be8a91a76aa52f20eb ] The of_parse_phandle() document: >>> Use of_node_put() on it when done. The driver didn't call of_node_put(). Fixes the leak. Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20211214040028.2992627-1-tzungbi@google.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/soun= d/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c index a606133951b70..24a5d0adec1ba 100644 --- a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +++ b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c @@ -1172,7 +1172,11 @@ static int mt8192_mt6359_dev_probe(struct platform_d= evice *pdev) return ret; } =20 - return devm_snd_soc_register_card(&pdev->dev, card); + ret =3D devm_snd_soc_register_card(&pdev->dev, card); + + of_node_put(platform_node); + of_node_put(hdmi_codec); + return ret; } =20 #ifdef CONFIG_OF --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11191C4321E for ; Tue, 25 Jan 2022 00:18:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374040AbiAYAP6 (ORCPT ); Mon, 24 Jan 2022 19:15:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385520AbiAXX2E (ORCPT ); Mon, 24 Jan 2022 18:28:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9A61C01D7F9; Mon, 24 Jan 2022 13:31:44 -0800 (PST) Received: from smtp.kernel.org (relay.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 69363614DE; Mon, 24 Jan 2022 21:31:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46F07C340E7; Mon, 24 Jan 2022 21:31:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059903; bh=MQZNKsIA8dH2rECRUuLDz3Ofvj0Sz2YQD2ogUS2SVoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pq42pJcAqaDvavDnbXKucMSKLEjb2SKCcmsgrCcNxCc1lLxmONvSY/E0j9mXRs+Px GLqW8bJ84xSUjkhIgyx/xamhD/zqN0ZD0SbRZ/vDp40R8ALs0C65W1Mrc/pUKdp9Y5 NTxWBHQlObDfPu8QZF8vWqJ0W/yezdttUhGjmySI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , Vinod Koul , Sasha Levin Subject: [PATCH 5.16 0774/1039] phy: phy-mtk-tphy: add support efuse setting Date: Mon, 24 Jan 2022 19:42:43 +0100 Message-Id: <20220124184151.317875908@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chunfeng Yun [ Upstream commit 6f2b033cb883f64ad084a75f13634242c7e179a6 ] Due to some SoCs have a bit shift issue that will drop a bit for usb3 phy or pcie phy, fix it by adding software efuse reading and setting, but only support it optionally for version 2/3. Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/20211218082802.5256-2-chunfeng.yun@mediatek= .com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/phy/mediatek/phy-mtk-tphy.c | 162 ++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy= -mtk-tphy.c index cdcef865fe9e5..98a942c607a67 100644 --- a/drivers/phy/mediatek/phy-mtk-tphy.c +++ b/drivers/phy/mediatek/phy-mtk-tphy.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -41,6 +42,9 @@ #define SSUSB_SIFSLV_V2_U3PHYD 0x200 #define SSUSB_SIFSLV_V2_U3PHYA 0x400 =20 +#define U3P_MISC_REG1 0x04 +#define MR1_EFUSE_AUTO_LOAD_DIS BIT(6) + #define U3P_USBPHYACR0 0x000 #define PA0_RG_U2PLL_FORCE_ON BIT(15) #define PA0_USB20_PLL_PREDIV GENMASK(7, 6) @@ -133,6 +137,8 @@ #define P3C_RG_SWRST_U3_PHYD_FORCE_EN BIT(24) =20 #define U3P_U3_PHYA_REG0 0x000 +#define P3A_RG_IEXT_INTR GENMASK(15, 10) +#define P3A_RG_IEXT_INTR_VAL(x) ((0x3f & (x)) << 10) #define P3A_RG_CLKDRV_OFF GENMASK(3, 2) #define P3A_RG_CLKDRV_OFF_VAL(x) ((0x3 & (x)) << 2) =20 @@ -187,6 +193,19 @@ #define P3D_RG_FWAKE_TH GENMASK(21, 16) #define P3D_RG_FWAKE_TH_VAL(x) ((0x3f & (x)) << 16) =20 +#define U3P_U3_PHYD_IMPCAL0 0x010 +#define P3D_RG_FORCE_TX_IMPEL BIT(31) +#define P3D_RG_TX_IMPEL GENMASK(28, 24) +#define P3D_RG_TX_IMPEL_VAL(x) ((0x1f & (x)) << 24) + +#define U3P_U3_PHYD_IMPCAL1 0x014 +#define P3D_RG_FORCE_RX_IMPEL BIT(31) +#define P3D_RG_RX_IMPEL GENMASK(28, 24) +#define P3D_RG_RX_IMPEL_VAL(x) ((0x1f & (x)) << 24) + +#define U3P_U3_PHYD_RSV 0x054 +#define P3D_RG_EFUSE_AUTO_LOAD_DIS BIT(12) + #define U3P_U3_PHYD_CDR1 0x05c #define P3D_RG_CDR_BIR_LTD1 GENMASK(28, 24) #define P3D_RG_CDR_BIR_LTD1_VAL(x) ((0x1f & (x)) << 24) @@ -307,6 +326,11 @@ struct mtk_phy_pdata { * 48M PLL, fix it by switching PLL to 26M from default 48M */ bool sw_pll_48m_to_26m; + /* + * Some SoCs (e.g. mt8195) drop a bit when use auto load efuse, + * support sw way, also support it for v2/v3 optionally. + */ + bool sw_efuse_supported; enum mtk_phy_version version; }; =20 @@ -336,6 +360,10 @@ struct mtk_phy_instance { struct regmap *type_sw; u32 type_sw_reg; u32 type_sw_index; + u32 efuse_sw_en; + u32 efuse_intr; + u32 efuse_tx_imp; + u32 efuse_rx_imp; int eye_src; int eye_vrt; int eye_term; @@ -1040,6 +1068,130 @@ static int phy_type_set(struct mtk_phy_instance *in= stance) return 0; } =20 +static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *i= nstance) +{ + struct device *dev =3D &instance->phy->dev; + int ret =3D 0; + + /* tphy v1 doesn't support sw efuse, skip it */ + if (!tphy->pdata->sw_efuse_supported) { + instance->efuse_sw_en =3D 0; + return 0; + } + + /* software efuse is optional */ + instance->efuse_sw_en =3D device_property_read_bool(dev, "nvmem-cells"); + if (!instance->efuse_sw_en) + return 0; + + switch (instance->type) { + case PHY_TYPE_USB2: + ret =3D nvmem_cell_read_variable_le_u32(dev, "intr", &instance->efuse_in= tr); + if (ret) { + dev_err(dev, "fail to get u2 intr efuse, %d\n", ret); + break; + } + + /* no efuse, ignore it */ + if (!instance->efuse_intr) { + dev_warn(dev, "no u2 intr efuse, but dts enable it\n"); + instance->efuse_sw_en =3D 0; + break; + } + + dev_dbg(dev, "u2 efuse - intr %x\n", instance->efuse_intr); + break; + + case PHY_TYPE_USB3: + case PHY_TYPE_PCIE: + ret =3D nvmem_cell_read_variable_le_u32(dev, "intr", &instance->efuse_in= tr); + if (ret) { + dev_err(dev, "fail to get u3 intr efuse, %d\n", ret); + break; + } + + ret =3D nvmem_cell_read_variable_le_u32(dev, "rx_imp", &instance->efuse_= rx_imp); + if (ret) { + dev_err(dev, "fail to get u3 rx_imp efuse, %d\n", ret); + break; + } + + ret =3D nvmem_cell_read_variable_le_u32(dev, "tx_imp", &instance->efuse_= tx_imp); + if (ret) { + dev_err(dev, "fail to get u3 tx_imp efuse, %d\n", ret); + break; + } + + /* no efuse, ignore it */ + if (!instance->efuse_intr && + !instance->efuse_rx_imp && + !instance->efuse_rx_imp) { + dev_warn(dev, "no u3 intr efuse, but dts enable it\n"); + instance->efuse_sw_en =3D 0; + break; + } + + dev_dbg(dev, "u3 efuse - intr %x, rx_imp %x, tx_imp %x\n", + instance->efuse_intr, instance->efuse_rx_imp,instance->efuse_tx_imp); + break; + default: + dev_err(dev, "no sw efuse for type %d\n", instance->type); + ret =3D -EINVAL; + } + + return ret; +} + +static void phy_efuse_set(struct mtk_phy_instance *instance) +{ + struct device *dev =3D &instance->phy->dev; + struct u2phy_banks *u2_banks =3D &instance->u2_banks; + struct u3phy_banks *u3_banks =3D &instance->u3_banks; + u32 tmp; + + if (!instance->efuse_sw_en) + return; + + switch (instance->type) { + case PHY_TYPE_USB2: + tmp =3D readl(u2_banks->misc + U3P_MISC_REG1); + tmp |=3D MR1_EFUSE_AUTO_LOAD_DIS; + writel(tmp, u2_banks->misc + U3P_MISC_REG1); + + tmp =3D readl(u2_banks->com + U3P_USBPHYACR1); + tmp &=3D ~PA1_RG_INTR_CAL; + tmp |=3D PA1_RG_INTR_CAL_VAL(instance->efuse_intr); + writel(tmp, u2_banks->com + U3P_USBPHYACR1); + break; + case PHY_TYPE_USB3: + case PHY_TYPE_PCIE: + tmp =3D readl(u3_banks->phyd + U3P_U3_PHYD_RSV); + tmp |=3D P3D_RG_EFUSE_AUTO_LOAD_DIS; + writel(tmp, u3_banks->phyd + U3P_U3_PHYD_RSV); + + tmp =3D readl(u3_banks->phyd + U3P_U3_PHYD_IMPCAL0); + tmp &=3D ~P3D_RG_TX_IMPEL; + tmp |=3D P3D_RG_TX_IMPEL_VAL(instance->efuse_tx_imp); + tmp |=3D P3D_RG_FORCE_TX_IMPEL; + writel(tmp, u3_banks->phyd + U3P_U3_PHYD_IMPCAL0); + + tmp =3D readl(u3_banks->phyd + U3P_U3_PHYD_IMPCAL1); + tmp &=3D ~P3D_RG_RX_IMPEL; + tmp |=3D P3D_RG_RX_IMPEL_VAL(instance->efuse_rx_imp); + tmp |=3D P3D_RG_FORCE_RX_IMPEL; + writel(tmp, u3_banks->phyd + U3P_U3_PHYD_IMPCAL1); + + tmp =3D readl(u3_banks->phya + U3P_U3_PHYA_REG0); + tmp &=3D ~P3A_RG_IEXT_INTR; + tmp |=3D P3A_RG_IEXT_INTR_VAL(instance->efuse_intr); + writel(tmp, u3_banks->phya + U3P_U3_PHYA_REG0); + break; + default: + dev_warn(dev, "no sw efuse for type %d\n", instance->type); + break; + } +} + static int mtk_phy_init(struct phy *phy) { struct mtk_phy_instance *instance =3D phy_get_drvdata(phy); @@ -1050,6 +1202,8 @@ static int mtk_phy_init(struct phy *phy) if (ret) return ret; =20 + phy_efuse_set(instance); + switch (instance->type) { case PHY_TYPE_USB2: u2_phy_instance_init(tphy, instance); @@ -1134,6 +1288,7 @@ static struct phy *mtk_phy_xlate(struct device *dev, struct mtk_phy_instance *instance =3D NULL; struct device_node *phy_np =3D args->np; int index; + int ret; =20 if (args->args_count !=3D 1) { dev_err(dev, "invalid number of cells in 'phy' property\n"); @@ -1174,6 +1329,10 @@ static struct phy *mtk_phy_xlate(struct device *dev, return ERR_PTR(-EINVAL); } =20 + ret =3D phy_efuse_get(tphy, instance); + if (ret) + return ERR_PTR(ret); + phy_parse_property(tphy, instance); phy_type_set(instance); =20 @@ -1196,10 +1355,12 @@ static const struct mtk_phy_pdata tphy_v1_pdata =3D= { =20 static const struct mtk_phy_pdata tphy_v2_pdata =3D { .avoid_rx_sen_degradation =3D false, + .sw_efuse_supported =3D true, .version =3D MTK_PHY_V2, }; =20 static const struct mtk_phy_pdata tphy_v3_pdata =3D { + .sw_efuse_supported =3D true, .version =3D MTK_PHY_V3, }; =20 @@ -1210,6 +1371,7 @@ static const struct mtk_phy_pdata mt8173_pdata =3D { =20 static const struct mtk_phy_pdata mt8195_pdata =3D { .sw_pll_48m_to_26m =3D true, + .sw_efuse_supported =3D true, .version =3D MTK_PHY_V3, }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1953C4332F for ; Mon, 24 Jan 2022 22:23:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584270AbiAXWUb (ORCPT ); Mon, 24 Jan 2022 17:20:31 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50676 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454101AbiAXVbr (ORCPT ); Mon, 24 Jan 2022 16:31:47 -0500 Received: from smtp.kernel.org (relay.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 52C0E61469; Mon, 24 Jan 2022 21:31:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28907C340E4; Mon, 24 Jan 2022 21:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059906; bh=05g762syOAZvMLDp/pEL5fFOuow6W/nYQmSGkutZrFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YKi91/PBSZYYXjyVX8+kY162qubSpa8Q1ySGQK/H9f942GbGe9OxXiqGPuflVR3uh pXvjjkgzuFb9W1k/h0mIL7neR7I3mmiL8M07X2Qkg/JsS7JZTfsax3vJkEqVo8FMcD EpHiq/soEVJ63vWg3/ia+W+riwSS+UlbRyEWyavE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tzung-Bi Shih , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0775/1039] ASoC: mediatek: mt8173: fix device_node leak Date: Mon, 24 Jan 2022 19:42:44 +0100 Message-Id: <20220124184151.348249076@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 493433785df0075afc0c106ab65f10a605d0b35d ] Fixes the device_node leak. Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20211224064719.2031210-2-tzungbi@google.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/mediatek/mt8173/mt8173-max98090.c | 3 +++ sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 2 ++ sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 2 ++ sound/soc/mediatek/mt8173/mt8173-rt5650.c | 2 ++ 4 files changed, 9 insertions(+) diff --git a/sound/soc/mediatek/mt8173/mt8173-max98090.c b/sound/soc/mediat= ek/mt8173/mt8173-max98090.c index fc94314bfc02f..3bdd4931316cd 100644 --- a/sound/soc/mediatek/mt8173/mt8173-max98090.c +++ b/sound/soc/mediatek/mt8173/mt8173-max98090.c @@ -180,6 +180,9 @@ static int mt8173_max98090_dev_probe(struct platform_de= vice *pdev) if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); + + of_node_put(codec_node); + of_node_put(platform_node); return ret; } =20 diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/m= ediatek/mt8173/mt8173-rt5650-rt5514.c index 0f28dc2217c09..390da5bf727eb 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c @@ -218,6 +218,8 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platfo= rm_device *pdev) if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); + + of_node_put(platform_node); return ret; } =20 diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/m= ediatek/mt8173/mt8173-rt5650-rt5676.c index 077c6ee067806..c8e4e85e10575 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c @@ -285,6 +285,8 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platfo= rm_device *pdev) if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); + + of_node_put(platform_node); return ret; } =20 diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek= /mt8173/mt8173-rt5650.c index 2cbf679f5c74b..d8cf0802813a0 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -323,6 +323,8 @@ static int mt8173_rt5650_dev_probe(struct platform_devi= ce *pdev) if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); + + of_node_put(platform_node); return ret; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 638CEC433EF for ; Mon, 24 Jan 2022 22:23:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584308AbiAXWUj (ORCPT ); Mon, 24 Jan 2022 17:20:39 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:52186 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454132AbiAXVbu (ORCPT ); Mon, 24 Jan 2022 16:31:50 -0500 Received: from smtp.kernel.org (relay.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 1933D61320; Mon, 24 Jan 2022 21:31:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A4FDC340E7; Mon, 24 Jan 2022 21:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059909; bh=grTelnkSX6Y12cAJ2c2Z7iI+CF/lO3oFNnwSui4aYhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K10IUhma7e0Dilj+4D0vmFGEn/PJMFuESy31obxEicyklYfm5E4mvtKNpiYpnc4L8 fiSHu24nNLADyxodk4WhTPLFc5+FagtXmbY1gkV+ZsOJzsAV12XMyu9BQjjS2V8eUt xyy+r9c39Cp3rUWNFDVW2NV2Fd6+pZMNO0aN/iOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tzung-Bi Shih , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0776/1039] ASoC: mediatek: mt8183: fix device_node leak Date: Mon, 24 Jan 2022 19:42:45 +0100 Message-Id: <20220124184151.377915660@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 cb006006fe6221f092fadaffd3f219288304c9ad ] Fixes the device_node leak. Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20211224064719.2031210-3-tzungbi@google.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 6 +++++- sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc= /mediatek/mt8183/mt8183-da7219-max98357.c index a4d26a6fc8492..bda103211e0bd 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -781,7 +781,11 @@ static int mt8183_da7219_max98357_dev_probe(struct pla= tform_device *pdev) return ret; } =20 - return devm_snd_soc_register_card(&pdev->dev, card); + ret =3D devm_snd_soc_register_card(&pdev->dev, card); + + of_node_put(platform_node); + of_node_put(hdmi_codec); + return ret; } =20 #ifdef CONFIG_OF diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/s= ound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index aeb1af86047ef..9f0bf15fe465e 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -780,7 +780,12 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platfo= rm_device *pdev) __func__, ret); } =20 - return devm_snd_soc_register_card(&pdev->dev, card); + ret =3D devm_snd_soc_register_card(&pdev->dev, card); + + of_node_put(platform_node); + of_node_put(ec_codec); + of_node_put(hdmi_codec); + return ret; } =20 #ifdef CONFIG_OF --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF495C43219 for ; Tue, 25 Jan 2022 00:18:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373983AbiAYAPs (ORCPT ); Mon, 24 Jan 2022 19:15:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449269AbiAXX2P (ORCPT ); Mon, 24 Jan 2022 18:28:15 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7986FC01D7FA; Mon, 24 Jan 2022 13:31:53 -0800 (PST) Received: from smtp.kernel.org (relay.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 183DD614E1; Mon, 24 Jan 2022 21:31:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9F64C340E4; Mon, 24 Jan 2022 21:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059912; bh=JGviIA0qFo66pV1MrdQu8TN/MHhkm1Foo3NvPRqNvQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GQ0KFCC9wxpwK8A4hfh/6TwuJkzoN4YvMH5sx8a/yamBNAt3k4CHHYJRmJaRl2CQf +EbqezRtoxt+WGNaMMXaupUfd+sR2Jq69lgnD785HnQzPgpoxkBuoMcTflUdZVcTvx nngA84ms4Oc50zjbiNE0fuMC0lNR/VLSRDGx9aqw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dani Liberman , Oded Gabbay , Sasha Levin Subject: [PATCH 5.16 0777/1039] habanalabs: change wait for interrupt timeout to 64 bit Date: Mon, 24 Jan 2022 19:42:46 +0100 Message-Id: <20220124184151.409534616@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dani Liberman [ Upstream commit 48f31169830f589e4c7ac475ccc7414951ded3f0 ] In order to increase maximum wait-for-interrupt timeout, change it to 64 bit variable. This wait is used only by newer ASICs, so no problem in changing this interface at this time. Signed-off-by: Dani Liberman Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../habanalabs/common/command_submission.c | 22 ++++++++++++++----- include/uapi/misc/habanalabs.h | 18 +++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/drivers/misc/habanalabs/common/command_submission.c b/drivers/= misc/habanalabs/common/command_submission.c index 4c8000fd246cd..9451e4bae05df 100644 --- a/drivers/misc/habanalabs/common/command_submission.c +++ b/drivers/misc/habanalabs/common/command_submission.c @@ -2765,8 +2765,23 @@ static int hl_cs_wait_ioctl(struct hl_fpriv *hpriv, = void *data) return 0; } =20 +static inline unsigned long hl_usecs64_to_jiffies(const u64 usecs) +{ + if (usecs <=3D U32_MAX) + return usecs_to_jiffies(usecs); + + /* + * If the value in nanoseconds is larger than 64 bit, use the largest + * 64 bit value. + */ + if (usecs >=3D ((u64)(U64_MAX / NSEC_PER_USEC))) + return nsecs_to_jiffies(U64_MAX); + + return nsecs_to_jiffies(usecs * NSEC_PER_USEC); +} + static int _hl_interrupt_wait_ioctl(struct hl_device *hdev, struct hl_ctx = *ctx, - u32 timeout_us, u64 user_address, + u64 timeout_us, u64 user_address, u64 target_value, u16 interrupt_offset, enum hl_cs_wait_status *status, u64 *timestamp) @@ -2778,10 +2793,7 @@ static int _hl_interrupt_wait_ioctl(struct hl_device= *hdev, struct hl_ctx *ctx, long completion_rc; int rc =3D 0; =20 - if (timeout_us =3D=3D U32_MAX) - timeout =3D timeout_us; - else - timeout =3D usecs_to_jiffies(timeout_us); + timeout =3D hl_usecs64_to_jiffies(timeout_us); =20 hl_ctx_get(hdev, ctx); =20 diff --git a/include/uapi/misc/habanalabs.h b/include/uapi/misc/habanalabs.h index 00b3095904995..c5760acebdd1d 100644 --- a/include/uapi/misc/habanalabs.h +++ b/include/uapi/misc/habanalabs.h @@ -911,14 +911,18 @@ struct hl_wait_cs_in { */ __u32 flags; =20 - /* Multi CS API info- valid entries in multi-CS array */ - __u8 seq_arr_len; - __u8 pad[3]; + union { + struct { + /* Multi CS API info- valid entries in multi-CS array */ + __u8 seq_arr_len; + __u8 pad[7]; + }; =20 - /* Absolute timeout to wait for an interrupt in microseconds. - * Relevant only when HL_WAIT_CS_FLAGS_INTERRUPT is set - */ - __u32 interrupt_timeout_us; + /* Absolute timeout to wait for an interrupt in microseconds. + * Relevant only when HL_WAIT_CS_FLAGS_INTERRUPT is set + */ + __u64 interrupt_timeout_us; + }; }; =20 #define HL_WAIT_CS_STATUS_COMPLETED 0 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D8EEC433FE for ; Mon, 24 Jan 2022 22:29:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1585761AbiAXWY6 (ORCPT ); Mon, 24 Jan 2022 17:24:58 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45900 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454186AbiAXVb5 (ORCPT ); Mon, 24 Jan 2022 16:31:57 -0500 Received: from smtp.kernel.org (relay.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 82719B8123D; Mon, 24 Jan 2022 21:31:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3BB1C340E4; Mon, 24 Jan 2022 21:31:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059915; bh=79AneH/7hOkzkO4EM8/ZunoSg5Rcp9kmkH4jvoJ25uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pMOFjF6ckA/UcYmO5YQdwUq38yyfBd1is+M9TGWeq113CM29vRxi8aXLQLLyAqpH8 y5mLdIthrWk8JC5D5FzGxoN3i7FhJnOkQsgy+UYTKF44Qh+1kqL4c+FzzAYO/SLzoY sJOJHv8BKblv6QGRtrqdRtyPDMX49AFTg5TZUdqI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ohad Sharabi , Oded Gabbay , Sasha Levin Subject: [PATCH 5.16 0778/1039] habanalabs: skip read fw errors if dynamic descriptor invalid Date: Mon, 24 Jan 2022 19:42:47 +0100 Message-Id: <20220124184151.444777961@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ohad Sharabi [ Upstream commit 4fac990f604e6c10538026835a8a30f3c1b6fcf5 ] Reporting FW errors involves reading of the error registers. In case we have a corrupted FW descriptor we cannot do that since the dynamic scratchpad is potentially corrupted as well and may cause kernel crush when attempting access to a corrupted register offset. Signed-off-by: Ohad Sharabi Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/misc/habanalabs/common/firmware_if.c | 17 +++++++++++++++-- drivers/misc/habanalabs/common/habanalabs.h | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/misc/habanalabs/common/firmware_if.c b/drivers/misc/ha= banalabs/common/firmware_if.c index 4e68fb9d2a6bd..67a0be4573710 100644 --- a/drivers/misc/habanalabs/common/firmware_if.c +++ b/drivers/misc/habanalabs/common/firmware_if.c @@ -1703,6 +1703,9 @@ static int hl_fw_dynamic_validate_descriptor(struct h= l_device *hdev, return rc; } =20 + /* here we can mark the descriptor as valid as the content has been valid= ated */ + fw_loader->dynamic_loader.fw_desc_valid =3D true; + return 0; } =20 @@ -1759,7 +1762,13 @@ static int hl_fw_dynamic_read_and_validate_descripto= r(struct hl_device *hdev, return rc; } =20 - /* extract address copy the descriptor from */ + /* + * extract address to copy the descriptor from + * in addition, as the descriptor value is going to be over-ridden by new= data- we mark it + * as invalid. + * it will be marked again as valid once validated + */ + fw_loader->dynamic_loader.fw_desc_valid =3D false; src =3D hdev->pcie_bar[region->bar_id] + region->offset_in_bar + response->ram_offset; memcpy_fromio(fw_desc, src, sizeof(struct lkd_fw_comms_desc)); @@ -2247,6 +2256,9 @@ static int hl_fw_dynamic_init_cpu(struct hl_device *h= dev, dev_info(hdev->dev, "Loading firmware to device, may take some time...\n"); =20 + /* initialize FW descriptor as invalid */ + fw_loader->dynamic_loader.fw_desc_valid =3D false; + /* * In this stage, "cpu_dyn_regs" contains only LKD's hard coded values! * It will be updated from FW after hl_fw_dynamic_request_descriptor(). @@ -2333,7 +2345,8 @@ static int hl_fw_dynamic_init_cpu(struct hl_device *h= dev, return 0; =20 protocol_err: - fw_read_errors(hdev, le32_to_cpu(dyn_regs->cpu_boot_err0), + if (fw_loader->dynamic_loader.fw_desc_valid) + fw_read_errors(hdev, le32_to_cpu(dyn_regs->cpu_boot_err0), le32_to_cpu(dyn_regs->cpu_boot_err1), le32_to_cpu(dyn_regs->cpu_boot_dev_sts0), le32_to_cpu(dyn_regs->cpu_boot_dev_sts1)); diff --git a/drivers/misc/habanalabs/common/habanalabs.h b/drivers/misc/hab= analabs/common/habanalabs.h index a2002cbf794b5..ba0965667b182 100644 --- a/drivers/misc/habanalabs/common/habanalabs.h +++ b/drivers/misc/habanalabs/common/habanalabs.h @@ -1010,6 +1010,7 @@ struct fw_response { * @image_region: region to copy the FW image to * @fw_image_size: size of FW image to load * @wait_for_bl_timeout: timeout for waiting for boot loader to respond + * @fw_desc_valid: true if FW descriptor has been validated and hence the = data can be used */ struct dynamic_fw_load_mgr { struct fw_response response; @@ -1017,6 +1018,7 @@ struct dynamic_fw_load_mgr { struct pci_mem_region *image_region; size_t fw_image_size; u32 wait_for_bl_timeout; + bool fw_desc_valid; }; =20 /** --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4C43C43217 for ; Tue, 25 Jan 2022 00:31:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358920AbiAYAbC (ORCPT ); Mon, 24 Jan 2022 19:31:02 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45952 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454224AbiAXVcD (ORCPT ); Mon, 24 Jan 2022 16:32:03 -0500 Received: from smtp.kernel.org (relay.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 36E44B81257; Mon, 24 Jan 2022 21:32:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89F5AC340E4; Mon, 24 Jan 2022 21:32:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059920; bh=6V+sC1g13i8VXCbalZh08XyriymrAMskwoCmd6usGJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ymbCiTfKWaRcd/w0Sn2kxqr6VOQPok+qGeGLgqtCHDapVnVqyn5ihk6nzzh3lpfMN Rlujh0nMErbj7dYmQTBGMNskAfgNtv4CGP650sDOVimHMoxn6sFjKrS+eXfrCSssmh RLN7aIm4vSGDbv/HHZXw7yc/2y+dJNOlir7TYj7c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , AngeloGioacchino Del Regno , Vinod Koul , Sasha Levin Subject: [PATCH 5.16 0779/1039] phy: mediatek: Fix missing check in mtk_mipi_tx_probe Date: Mon, 24 Jan 2022 19:42:48 +0100 Message-Id: <20220124184151.474829701@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 399c91c3f30531593e5ff6ca7b53f47092128669 ] The of_device_get_match_data() function may return NULL. Add check to prevent potential null dereference. Signed-off-by: Miaoqian Lin Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20211224082103.7658-1-linmq006@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/phy/mediatek/phy-mtk-mipi-dsi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/phy/mediatek/phy-mtk-mipi-dsi.c b/drivers/phy/mediatek= /phy-mtk-mipi-dsi.c index 28ad9403c4414..67b005d5b9e35 100644 --- a/drivers/phy/mediatek/phy-mtk-mipi-dsi.c +++ b/drivers/phy/mediatek/phy-mtk-mipi-dsi.c @@ -146,6 +146,8 @@ static int mtk_mipi_tx_probe(struct platform_device *pd= ev) return -ENOMEM; =20 mipi_tx->driver_data =3D of_device_get_match_data(dev); + if (!mipi_tx->driver_data) + return -ENODEV; =20 mipi_tx->regs =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(mipi_tx->regs)) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8828FC433EF for ; Tue, 25 Jan 2022 00:31:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410858AbiAYAaf (ORCPT ); Mon, 24 Jan 2022 19:30:35 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:52292 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454264AbiAXVcE (ORCPT ); Mon, 24 Jan 2022 16:32:04 -0500 Received: from smtp.kernel.org (relay.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 5B34F614DE; Mon, 24 Jan 2022 21:32:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43453C340E4; Mon, 24 Jan 2022 21:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059923; bh=AGVkdtvLj/AXz77WxRuV1yF6BCr8p0lcB/5+6NNM0k0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yl1Dy72cdOOkd06OV2IHDa0lZl766YYnJ9BbNtg39Y7kzvjPLnP5VQGckF8Kx2y+l 1KH0w1ALGBZ0rKkv8olj9O0tE7VEVeUl0R3vxwdGTYOopEkBJTlJatkTUxqNNpRKTU 1PFBN8spq8qtiVEeFFlOLjQdANs1P6i9qCWW7ff4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Conor Dooley , Geert Uytterhoeven , Jassi Brar , Sasha Levin Subject: [PATCH 5.16 0780/1039] mailbox: change mailbox-mpfs compatible string Date: Mon, 24 Jan 2022 19:42:49 +0100 Message-Id: <20220124184151.506573906@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 f10b1fc0161cd99e54c5687fcc63368aa255e05e ] The Polarfire SoC is currently using two different compatible string prefixes. Fix this by changing "polarfire-soc-*" strings to "mpfs-*" in its system controller in order to match the compatible string used in the soc binding and device tree. Signed-off-by: Conor Dooley Reviewed-by: Geert Uytterhoeven Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mailbox/mailbox-mpfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mailbox/mailbox-mpfs.c b/drivers/mailbox/mailbox-mpfs.c index 0d6e2231a2c75..4e34854d12389 100644 --- a/drivers/mailbox/mailbox-mpfs.c +++ b/drivers/mailbox/mailbox-mpfs.c @@ -232,7 +232,7 @@ static int mpfs_mbox_probe(struct platform_device *pdev) } =20 static const struct of_device_id mpfs_mbox_of_match[] =3D { - {.compatible =3D "microchip,polarfire-soc-mailbox", }, + {.compatible =3D "microchip,mpfs-mailbox", }, {}, }; MODULE_DEVICE_TABLE(of, mpfs_mbox_of_match); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD020C433F5 for ; Tue, 25 Jan 2022 00:31:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358056AbiAYAa6 (ORCPT ); Mon, 24 Jan 2022 19:30:58 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:52320 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454274AbiAXVcI (ORCPT ); Mon, 24 Jan 2022 16:32:08 -0500 Received: from smtp.kernel.org (relay.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 22BAD614E1; Mon, 24 Jan 2022 21:32:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FE14C340E4; Mon, 24 Jan 2022 21:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059926; bh=Qo14H2WFM8vzQOp8leB6E2PM+33J6T1IeUDHX0WOzv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VrClL7tev6a3jX4b64q/McsUpZGnPC1Aei3ZLC/RMTnSmkJ5o6S0rQyYhyPqXiSah 6pJU3DHwtd0QljLLrNe5VlSNffASFCw0d9n8OhbHjN5QL9Y8NulFEhNQkbIgR7InQN IyjJlWOz38GpYg9HZEi1TuksnYZ+ChiVDo4VaDkc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , "Eric W. Biederman" , Sasha Levin Subject: [PATCH 5.16 0781/1039] signal: In get_signal test for signal_group_exit every time through the loop Date: Mon, 24 Jan 2022 19:42:50 +0100 Message-Id: <20220124184151.539020855@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric W. Biederman [ Upstream commit e7f7c99ba911f56bc338845c1cd72954ba591707 ] Recently while investigating a problem with rr and signals I noticed that siglock is dropped in ptrace_signal and get_signal does not jump to relock. Looking farther to see if the problem is anywhere else I see that do_signal_stop also returns if signal_group_exit is true. I believe that test can now never be true, but it is a bit hard to trace through and be certain. Testing signal_group_exit is not expensive, so move the test for signal_group_exit into the for loop inside of get_signal to ensure the test is never skipped improperly. This has been a potential problem since I added the test for signal_group_exit was added. Fixes: 35634ffa1751 ("signal: Always notice exiting tasks") Reviewed-by: Kees Cook Link: https://lkml.kernel.org/r/875yssekcd.fsf_-_@email.froward.int.ebieder= m.org Signed-off-by: "Eric W. Biederman" Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/signal.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index dfcee3888b00e..cf97b9c4d665a 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -2684,19 +2684,19 @@ relock: goto relock; } =20 - /* Has this task already been marked for death? */ - if (signal_group_exit(signal)) { - ksig->info.si_signo =3D signr =3D SIGKILL; - sigdelset(¤t->pending.signal, SIGKILL); - trace_signal_deliver(SIGKILL, SEND_SIG_NOINFO, - &sighand->action[SIGKILL - 1]); - recalc_sigpending(); - goto fatal; - } - for (;;) { struct k_sigaction *ka; =20 + /* Has this task already been marked for death? */ + if (signal_group_exit(signal)) { + ksig->info.si_signo =3D signr =3D SIGKILL; + sigdelset(¤t->pending.signal, SIGKILL); + trace_signal_deliver(SIGKILL, SEND_SIG_NOINFO, + &sighand->action[SIGKILL - 1]); + recalc_sigpending(); + goto fatal; + } + if (unlikely(current->jobctl & JOBCTL_STOP_PENDING) && do_signal_stop(0)) goto relock; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17597C433FE for ; Tue, 25 Jan 2022 00:31:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410845AbiAYAab (ORCPT ); Mon, 24 Jan 2022 19:30:31 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44990 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454296AbiAXVcL (ORCPT ); Mon, 24 Jan 2022 16:32:11 -0500 Received: from smtp.kernel.org (relay.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 C4CBDB81243; Mon, 24 Jan 2022 21:32:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7B0EC340E5; Mon, 24 Jan 2022 21:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059929; bh=fXl+KhFkFNVvhrHdnsaC4Mi8oIwGhOlNMCYqYf9MWAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W39tyQoXMDCNKjzUemHzN0lfVs5toboe4putFKZIOkm7drpJiN26tcEH/KF8umoJL UyMCPElxLtjOUSSRSzF1R3jZZW1OE+U0HUJFPLtkjYyezVGKcd7Zax0lRYOZBs1r7e fjU7+SuNjLLD5lSNiqkS+ARhnyFPdXu1J4hgRwH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qizhong Cheng , Jianjun Wang , Lorenzo Pieralisi , Tzung-Bi Shih , Matthias Brugger , Sasha Levin Subject: [PATCH 5.16 0782/1039] PCI: mediatek-gen3: Disable DVFSRC voltage request Date: Mon, 24 Jan 2022 19:42:51 +0100 Message-Id: <20220124184151.571970380@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jianjun Wang [ Upstream commit ab344fd43f2958726d17d651c0cb692c67dca382 ] When the DVFSRC (dynamic voltage and frequency scaling resource collector) feature is not implemented, the PCIe hardware will assert a voltage request signal when exit from the L1 PM Substates to request a specific Vcore voltage, but cannot receive the voltage ready signal, which will cause the link to fail to exit the L1 PM Substates. Disable DVFSRC voltage request by default, we need to find a common way to enable it in the future. Link: https://lore.kernel.org/r/20211015063602.29058-1-jianjun.wang@mediate= k.com Fixes: d3bf75b579b9 ("PCI: mediatek-gen3: Add MediaTek Gen3 driver for MT81= 92") Tested-by: Qizhong Cheng Signed-off-by: Jianjun Wang Signed-off-by: Lorenzo Pieralisi Reviewed-by: Tzung-Bi Shih Reviewed-by: Matthias Brugger Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pcie-mediatek-gen3.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/cont= roller/pcie-mediatek-gen3.c index 17c59b0d6978b..21207df680ccf 100644 --- a/drivers/pci/controller/pcie-mediatek-gen3.c +++ b/drivers/pci/controller/pcie-mediatek-gen3.c @@ -79,6 +79,9 @@ #define PCIE_ICMD_PM_REG 0x198 #define PCIE_TURN_OFF_LINK BIT(4) =20 +#define PCIE_MISC_CTRL_REG 0x348 +#define PCIE_DISABLE_DVFSRC_VLT_REQ BIT(1) + #define PCIE_TRANS_TABLE_BASE_REG 0x800 #define PCIE_ATR_SRC_ADDR_MSB_OFFSET 0x4 #define PCIE_ATR_TRSL_ADDR_LSB_OFFSET 0x8 @@ -297,6 +300,11 @@ static int mtk_pcie_startup_port(struct mtk_pcie_port = *port) val &=3D ~PCIE_INTX_ENABLE; writel_relaxed(val, port->base + PCIE_INT_ENABLE_REG); =20 + /* Disable DVFSRC voltage request */ + val =3D readl_relaxed(port->base + PCIE_MISC_CTRL_REG); + val |=3D PCIE_DISABLE_DVFSRC_VLT_REQ; + writel_relaxed(val, port->base + PCIE_MISC_CTRL_REG); + /* Assert all reset signals */ val =3D readl_relaxed(port->base + PCIE_RST_CTRL_REG); val |=3D PCIE_MAC_RSTB | PCIE_PHY_RSTB | PCIE_BRG_RSTB | PCIE_PE_RSTB; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5D70C4332F for ; Mon, 24 Jan 2022 22:31:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587044AbiAXW1k (ORCPT ); Mon, 24 Jan 2022 17:27:40 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51444 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454311AbiAXVcN (ORCPT ); Mon, 24 Jan 2022 16:32:13 -0500 Received: from smtp.kernel.org (relay.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 0C70B614F3; Mon, 24 Jan 2022 21:32:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4479C340E4; Mon, 24 Jan 2022 21:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059932; bh=2hF7BRGsfHYFsaSCRg8aq1TO5nuw7n7HAXgR4OfbIJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2Jq46nqN8oFpfSpVXfRX+s7uUVyEd9MnQ5aq7rsyezgei3CeP19hQ7vQSg5k6qblc +R9miQW+4yLNyOmMIdOYzUp6uLuzoyvmB2S1+4OkJXU3uIfwLguk61KB85fsHUbVN+ RaX+85UgSTdICtPQkhVCPiij3Da2/AS7CXtA00y4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Lorenzo Pieralisi , Stephen Boyd , Sasha Levin Subject: [PATCH 5.16 0783/1039] PCI: qcom: Fix an error handling path in qcom_pcie_probe() Date: Mon, 24 Jan 2022 19:42:52 +0100 Message-Id: <20220124184151.607878649@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 4e0e90539bb0e6c0ca3768c642df9eed2118a8bb ] If 'of_device_get_match_data()' fails, previous 'pm_runtime_get_sync()/ pm_runtime_enable()' should be undone. To fix it, the easiest is to move this block of code before the memory allocations and the pm_runtime_xxx calls. Link: https://lore.kernel.org/r/4d03c636193f64907c8dacb17fa71ed05fd5f60c.16= 36220582.git.christophe.jaillet@wanadoo.fr Fixes: b89ff410253d ("PCI: qcom: Replace ops with struct pcie_cfg in pcie m= atch data") Signed-off-by: Christophe JAILLET Signed-off-by: Lorenzo Pieralisi Reviewed-by: Stephen Boyd Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/dwc/pcie-qcom.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 1c3d1116bb60c..baae67f71ba82 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1534,6 +1534,12 @@ static int qcom_pcie_probe(struct platform_device *p= dev) const struct qcom_pcie_cfg *pcie_cfg; int ret; =20 + pcie_cfg =3D of_device_get_match_data(dev); + if (!pcie_cfg || !pcie_cfg->ops) { + dev_err(dev, "Invalid platform data\n"); + return -EINVAL; + } + pcie =3D devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); if (!pcie) return -ENOMEM; @@ -1553,12 +1559,6 @@ static int qcom_pcie_probe(struct platform_device *p= dev) =20 pcie->pci =3D pci; =20 - pcie_cfg =3D of_device_get_match_data(dev); - if (!pcie_cfg || !pcie_cfg->ops) { - dev_err(dev, "Invalid platform data\n"); - return -EINVAL; - } - pcie->ops =3D pcie_cfg->ops; pcie->pipe_clk_need_muxing =3D pcie_cfg->pipe_clk_need_muxing; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 983B6C43217 for ; Tue, 25 Jan 2022 00:15:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388393AbiAYAOG (ORCPT ); Mon, 24 Jan 2022 19:14:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457499AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDF52C01D7FB; Mon, 24 Jan 2022 13:32:17 -0800 (PST) Received: from smtp.kernel.org (relay.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 8ACCEB8105C; Mon, 24 Jan 2022 21:32:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BCD4C340E4; Mon, 24 Jan 2022 21:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059935; bh=kYzQ6x4/8WDwUsKjGgcujq30v/9ofPlAvon/fiopj00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oJrWUXi2vxbgCPV2sF5oWKv2H1PXleQVcB/lmwkr36GM0ZWY+on95eCMTO6IopfwV LlB9xqXfQHFmeArSRoYPph8oK2J7qDPdUUEHIjBC7+9+BmKV9A5eGS1r5kgf/8ygnf e3EqN0xw/HgOrCQ4r8yCTWBtiKxn36SQiW3/I+Hs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Lorenzo Pieralisi , Geert Uytterhoeven , Randy Dunlap , Arnd Bergmann , Bjorn Helgaas , Stephen Boyd , Wolfram Sang , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Sasha Levin Subject: [PATCH 5.16 0784/1039] PCI: rcar: Check if device is runtime suspended instead of __clk_is_enabled() Date: Mon, 24 Jan 2022 19:42:53 +0100 Message-Id: <20220124184151.639481546@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 d2a14b54989e9ccea8401895fdfbc213bd1f56af ] Replace __clk_is_enabled() with pm_runtime_suspended(), as __clk_is_enabled() was checking the wrong bus clock and caused the following build error too: arm-linux-gnueabi-ld: drivers/pci/controller/pcie-rcar-host.o: in functio= n `rcar_pcie_aarch32_abort_handler': pcie-rcar-host.c:(.text+0xdd0): undefined reference to `__clk_is_enabled' Link: https://lore.kernel.org/r/20211115204641.12941-1-marek.vasut@gmail.com Fixes: a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook= ") Signed-off-by: Marek Vasut Signed-off-by: Lorenzo Pieralisi Reviewed-by: Geert Uytterhoeven Acked-by: Randy Dunlap Cc: Arnd Bergmann Cc: Bjorn Helgaas Cc: Geert Uytterhoeven Cc: Lorenzo Pieralisi Cc: Stephen Boyd Cc: Wolfram Sang Cc: Yoshihiro Shimoda Cc: linux-renesas-soc@vger.kernel.org Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pcie-rcar-host.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controll= er/pcie-rcar-host.c index e12c2d8be05a3..780e60159993c 100644 --- a/drivers/pci/controller/pcie-rcar-host.c +++ b/drivers/pci/controller/pcie-rcar-host.c @@ -50,10 +50,10 @@ struct rcar_msi { */ static void __iomem *pcie_base; /* - * Static copy of bus clock pointer, so we can check whether the clock - * is enabled or not. + * Static copy of PCIe device pointer, so we can check whether the + * device is runtime suspended or not. */ -static struct clk *pcie_bus_clk; +static struct device *pcie_dev; #endif =20 /* Structure representing the PCIe interface */ @@ -792,7 +792,7 @@ static int rcar_pcie_get_resources(struct rcar_pcie_hos= t *host) #ifdef CONFIG_ARM /* Cache static copy for L1 link state fixup hook on aarch32 */ pcie_base =3D pcie->base; - pcie_bus_clk =3D host->bus_clk; + pcie_dev =3D pcie->dev; #endif =20 return 0; @@ -1062,7 +1062,7 @@ static int rcar_pcie_aarch32_abort_handler(unsigned l= ong addr, =20 spin_lock_irqsave(&pmsr_lock, flags); =20 - if (!pcie_base || !__clk_is_enabled(pcie_bus_clk)) { + if (!pcie_base || pm_runtime_suspended(pcie_dev)) { ret =3D 1; goto unlock_exit; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85AA4C4332F for ; Tue, 25 Jan 2022 00:18:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374593AbiAYAR3 (ORCPT ); Mon, 24 Jan 2022 19:17:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1458085AbiAXX2P (ORCPT ); Mon, 24 Jan 2022 18:28:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE344C01D7FC; Mon, 24 Jan 2022 13:32:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 934D2B8105C; Mon, 24 Jan 2022 21:32:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0C85C340E4; Mon, 24 Jan 2022 21:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059938; bh=EA7dMKNdQg24nhqA/oLL+3Ocd+cZ/ldxMW1D3CxdYDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pqFGKyYR7JYddE/dLIoxcTABiKng5hTcmFmNrIxhq3u706tAqsme+ybkJSXLIhaS4 +7ffZPwdHPUEwNZlYQHPYMcIn2XQ9wXALgsQJE8WVAsdCjqunf4kQwuMhOa8crUOJu 5Vik0YAwXhsBb2mwJo5qFILq4UFClwN2+YkE8qsc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Harvey , Lorenzo Pieralisi , Rob Herring , Richard Zhu , Sasha Levin Subject: [PATCH 5.16 0785/1039] PCI: dwc: Do not remap invalid res Date: Mon, 24 Jan 2022 19:42:54 +0100 Message-Id: <20220124184151.676819654@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tim Harvey [ Upstream commit 6e5ebc96ec651b67131f816d7e3bf286c635e749 ] On imx6 and perhaps others when pcie probes you get a: imx6q-pcie 33800000.pcie: invalid resource This occurs because the atu is not specified in the DT and as such it should not be remapped. Link: https://lore.kernel.org/r/20211101180243.23761-1-tharvey@gateworks.com Fixes: 281f1f99cf3a ("PCI: dwc: Detect number of iATU windows") Signed-off-by: Tim Harvey Signed-off-by: Lorenzo Pieralisi Reviewed-by: Rob Herring Acked-by: Richard Zhu Cc: Richard Zhu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/dwc/pcie-designware.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/con= troller/dwc/pcie-designware.c index 850b4533f4ef5..d92c8a25094fa 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -672,10 +672,11 @@ void dw_pcie_iatu_detect(struct dw_pcie *pci) if (!pci->atu_base) { struct resource *res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "atu"); - if (res) + if (res) { pci->atu_size =3D resource_size(res); - pci->atu_base =3D devm_ioremap_resource(dev, res); - if (IS_ERR(pci->atu_base)) + pci->atu_base =3D devm_ioremap_resource(dev, res); + } + if (!pci->atu_base || IS_ERR(pci->atu_base)) pci->atu_base =3D pci->dbi_base + DEFAULT_DBI_ATU_OFFSET; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87265C433F5 for ; Mon, 24 Jan 2022 22:31:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587017AbiAXW1i (ORCPT ); Mon, 24 Jan 2022 17:27:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46086 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454359AbiAXVcY (ORCPT ); Mon, 24 Jan 2022 16:32:24 -0500 Received: from smtp.kernel.org (relay.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 77397B812A5; Mon, 24 Jan 2022 21:32:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BF32C340E4; Mon, 24 Jan 2022 21:32:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059941; bh=txNX374nHenWS5fo70U4Ivs9K+G5lAxFBUkin4hVTmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=omGCVRbbvAfUUUYAIbh6dILPBtGnYnMxdwiU7QJWIxApwjtdjrxB0+TNWqZlQdidC aHac7PwHg59or0VwqvpYA84WeadFeTd1kJ8QbTehijawSM9PqC7hOSi3U68J2rqBfD 6u5bH+183a3itw0JQ6RILQJ6EoJsMlzvN4JWThhM= 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?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0786/1039] PCI: aardvark: Fix checking for MEM resource type Date: Mon, 24 Jan 2022 19:42:55 +0100 Message-Id: <20220124184151.709548250@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 2070b2ddea89f5b604fac3d27ade5cb6d19a5706 ] IORESOURCE_MEM_64 is not a resource type but a type flag. Remove incorrect check for type IORESOURCE_MEM_64. Link: https://lore.kernel.org/r/20211125160148.26029-2-kabel@kernel.org Fixes: 64f160e19e92 ("PCI: aardvark: Configure PCIe resources from 'ranges'= DT property") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Marek Beh=C3=BAn Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pci-aardvark.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller= /pci-aardvark.c index c3b725afa11fd..e3001b3b32930 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -1535,8 +1535,7 @@ static int advk_pcie_probe(struct platform_device *pd= ev) * only PIO for issuing configuration transfers which does * not use PCIe window configuration. */ - if (type !=3D IORESOURCE_MEM && type !=3D IORESOURCE_MEM_64 && - type !=3D IORESOURCE_IO) + if (type !=3D IORESOURCE_MEM && type !=3D IORESOURCE_IO) continue; =20 /* @@ -1544,8 +1543,7 @@ static int advk_pcie_probe(struct platform_device *pd= ev) * configuration is set to transparent memory access so it * does not need window configuration. */ - if ((type =3D=3D IORESOURCE_MEM || type =3D=3D IORESOURCE_MEM_64) && - entry->offset =3D=3D 0) + if (type =3D=3D IORESOURCE_MEM && entry->offset =3D=3D 0) continue; =20 /* --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B589C433EF for ; Tue, 25 Jan 2022 00:18:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357641AbiAYAOe (ORCPT ); Mon, 24 Jan 2022 19:14:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1572900AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D07FBC01D7FD; Mon, 24 Jan 2022 13:32:26 -0800 (PST) Received: from smtp.kernel.org (relay.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 98E1EB8105C; Mon, 24 Jan 2022 21:32:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC73BC340E4; Mon, 24 Jan 2022 21:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059944; bh=vqNbZ/QgN62kkNQGfD6HduBejctEmovphbmTpQUP7KY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p7fR+ZSS1Q2jhLpUR3LqYDADPC44hGRpt+x+T/MoQQaCXxQLKyCPuf97coRGlysDG S81rR5lTZeh0QyteKg7vk3flmz88MEYvCdek0t7OG66byPkGIQz4zSIiqHD2567cNc siH97xj94usC7Ezxpp/8eSc14CjI0aAjn38q2ECI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hector Martin , Lorenzo Pieralisi , Marc Zyngier , Sasha Levin Subject: [PATCH 5.16 0787/1039] PCI: apple: Fix REFCLK1 enable/poll logic Date: Mon, 24 Jan 2022 19:42:56 +0100 Message-Id: <20220124184151.746567209@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 75d36df6807838f3c826c21c0fa51cdc079667d1 ] REFCLK1 has req/ack bits that need to be programmed, just like REFCLK0. Link: https://lore.kernel.org/r/20211117140044.193865-1-marcan@marcan.st Fixes: 1e33888fbe44 ("PCI: apple: Add initial hardware bring-up") Signed-off-by: Hector Martin Signed-off-by: Lorenzo Pieralisi Acked-by: Marc Zyngier Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pcie-apple.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/p= cie-apple.c index b090924b41fee..537ac9fe2e842 100644 --- a/drivers/pci/controller/pcie-apple.c +++ b/drivers/pci/controller/pcie-apple.c @@ -42,8 +42,9 @@ #define CORE_FABRIC_STAT_MASK 0x001F001F #define CORE_LANE_CFG(port) (0x84000 + 0x4000 * (port)) #define CORE_LANE_CFG_REFCLK0REQ BIT(0) -#define CORE_LANE_CFG_REFCLK1 BIT(1) +#define CORE_LANE_CFG_REFCLK1REQ BIT(1) #define CORE_LANE_CFG_REFCLK0ACK BIT(2) +#define CORE_LANE_CFG_REFCLK1ACK BIT(3) #define CORE_LANE_CFG_REFCLKEN (BIT(9) | BIT(10)) #define CORE_LANE_CTL(port) (0x84004 + 0x4000 * (port)) #define CORE_LANE_CTL_CFGACC BIT(15) @@ -482,9 +483,9 @@ static int apple_pcie_setup_refclk(struct apple_pcie *p= cie, if (res < 0) return res; =20 - rmw_set(CORE_LANE_CFG_REFCLK1, pcie->base + CORE_LANE_CFG(port->idx)); + rmw_set(CORE_LANE_CFG_REFCLK1REQ, pcie->base + CORE_LANE_CFG(port->idx)); res =3D readl_relaxed_poll_timeout(pcie->base + CORE_LANE_CFG(port->idx), - stat, stat & CORE_LANE_CFG_REFCLK1, + stat, stat & CORE_LANE_CFG_REFCLK1ACK, 100, 50000); =20 if (res < 0) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6796CC433F5 for ; Mon, 24 Jan 2022 22:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586995AbiAXW1g (ORCPT ); Mon, 24 Jan 2022 17:27:36 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51250 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454382AbiAXVc2 (ORCPT ); Mon, 24 Jan 2022 16:32:28 -0500 Received: from smtp.kernel.org (relay.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 E11BA6131F; Mon, 24 Jan 2022 21:32:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD5CBC340E4; Mon, 24 Jan 2022 21:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059947; bh=+IC5SxFlPCTwimrhYxrbf0C6EBpcKCzs3MZ8Q9Z5Lf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RrXxvxxMikzF1qW3RXVQ15uB1IAMV+NxeXxnAnNUy1HjKqhIIpZ7hCaTu2O6UG6Ou p0ePgVNW59F3mApqOTOqHMBv25fFkx6tcUAXe/KAnnhHimteVjSZdmspBA0SV5jXUr Mf5graGyfCmYJjNSrGfwJMp8jURmj7uQcXbGufvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 0788/1039] KVM: VMX: Dont unblock vCPU w/ Posted IRQ if IRQs are disabled in guest Date: Mon, 24 Jan 2022 19:42:57 +0100 Message-Id: <20220124184151.781814654@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Bonzini [ Upstream commit 1831fa44df743a7cdffdf1c12c799bf6f3c12b8c ] Don't configure the wakeup handler when a vCPU is blocking with IRQs disabled, in which case any IRQ, posted or otherwise, should not be recognized and thus should not wake the vCPU. Fixes: bf9f6ac8d749 ("KVM: Update Posted-Interrupts Descriptor when vCPU is= blocked") Signed-off-by: Sean Christopherson Message-Id: <20211009021236.4122790-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kvm/vmx/posted_intr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c index 21ea58d25771f..696ad48ab5daa 100644 --- a/arch/x86/kvm/vmx/posted_intr.c +++ b/arch/x86/kvm/vmx/posted_intr.c @@ -147,7 +147,8 @@ int pi_pre_block(struct kvm_vcpu *vcpu) struct pi_desc old, new; struct pi_desc *pi_desc =3D vcpu_to_pi_desc(vcpu); =20 - if (!vmx_can_use_vtd_pi(vcpu->kvm)) + if (!vmx_can_use_vtd_pi(vcpu->kvm) || + vmx_interrupt_blocked(vcpu)) return 0; =20 WARN_ON(irqs_disabled()); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87BF8C43217 for ; Tue, 25 Jan 2022 00:18:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373898AbiAYAPb (ORCPT ); Mon, 24 Jan 2022 19:15:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1458146AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE822C01D7FE; Mon, 24 Jan 2022 13:32:35 -0800 (PST) Received: from smtp.kernel.org (relay.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 B6232B80CCF; Mon, 24 Jan 2022 21:32:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC25BC340E5; Mon, 24 Jan 2022 21:32:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059953; bh=hwKZ0mbwkBWAvdVxC0dHLJH2tEpOKFeWFTrJfS+VJ18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bPWNwwZ0/uE5b+0xdVTyO2QdZv3DKsO1LEThuoSe9pU7tNXTL7H1ZmGYu9BHtLq8c 3WdjXsoDcAOg65je6DGRiEuhwC2d+zmwPfrS6QSBhsQhY2ARjDLcEZFrT3XbVsCLdL sAsHFi0hFDxaTV7XW43/PP//HdC6Oo+D71YLTV+s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Borntraeger , Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 0789/1039] KVM: s390: Ensure kvm_arch_no_poll() is read once when blocking vCPU Date: Mon, 24 Jan 2022 19:42:58 +0100 Message-Id: <20220124184151.815314575@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 6f390916c4fb359507d9ac4bf1b28a4f8abee5c0 ] Wrap s390's halt_poll_max_steal with READ_ONCE and snapshot the result of kvm_arch_no_poll() in kvm_vcpu_block() to avoid a mostly-theoretical, largely benign bug on s390 where the result of kvm_arch_no_poll() could change due to userspace modifying halt_poll_max_steal while the vCPU is blocking. The bug is largely benign as it will either cause KVM to skip updating halt-polling times (no_poll toggles false=3D>true) or to update halt-polling times with a slightly flawed block_ns. Note, READ_ONCE is unnecessary in the current code, add it in case the arch hook is ever inlined, and to provide a hint that userspace can change the param at will. Fixes: 8b905d28ee17 ("KVM: s390: provide kvm_arch_no_poll function") Reviewed-by: Christian Borntraeger Signed-off-by: Sean Christopherson Message-Id: <20211009021236.4122790-4-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/s390/kvm/kvm-s390.c | 2 +- virt/kvm/kvm_main.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index ef299aad40090..8fc9c79c899b5 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -3449,7 +3449,7 @@ bool kvm_arch_no_poll(struct kvm_vcpu *vcpu) { /* do not poll with more than halt_poll_max_steal percent of steal time */ if (S390_lowcore.avg_steal_timer * 100 / (TICK_USEC << 12) >=3D - halt_poll_max_steal) { + READ_ONCE(halt_poll_max_steal)) { vcpu->stat.halt_no_poll_steal++; return true; } diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 72c4e6b393896..5bd62342c482b 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -3153,6 +3153,7 @@ update_halt_poll_stats(struct kvm_vcpu *vcpu, u64 pol= l_ns, bool waited) */ void kvm_vcpu_block(struct kvm_vcpu *vcpu) { + bool halt_poll_allowed =3D !kvm_arch_no_poll(vcpu); ktime_t start, cur, poll_end; bool waited =3D false; u64 block_ns; @@ -3160,7 +3161,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) kvm_arch_vcpu_blocking(vcpu); =20 start =3D cur =3D poll_end =3D ktime_get(); - if (vcpu->halt_poll_ns && !kvm_arch_no_poll(vcpu)) { + if (vcpu->halt_poll_ns && halt_poll_allowed) { ktime_t stop =3D ktime_add_ns(ktime_get(), vcpu->halt_poll_ns); =20 ++vcpu->stat.generic.halt_attempted_poll; @@ -3215,7 +3216,7 @@ out: update_halt_poll_stats( vcpu, ktime_to_ns(ktime_sub(poll_end, start)), waited); =20 - if (!kvm_arch_no_poll(vcpu)) { + if (halt_poll_allowed) { if (!vcpu_valid_wakeup(vcpu)) { shrink_halt_poll_ns(vcpu); } else if (vcpu->kvm->max_halt_poll_ns) { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA5C7C433EF for ; Mon, 24 Jan 2022 22:30:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586885AbiAXW12 (ORCPT ); Mon, 24 Jan 2022 17:27:28 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45328 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454428AbiAXVci (ORCPT ); Mon, 24 Jan 2022 16:32:38 -0500 Received: from smtp.kernel.org (relay.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 0A1B0B80CCF; Mon, 24 Jan 2022 21:32:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11AD8C340E4; Mon, 24 Jan 2022 21:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059956; bh=UMz2txwKo30Dyf7QnStl7t4dAxLp9RmLZ4ZsAfzY8d8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BW+JJHWkvjjwrIo9qMOMbmthLsfS//AexhoedBtm+KjWIjhhclNM4BCG/0cnzjVEp Gabisi7o3EoDcHEm3VVYWkphj3hwvXfcP30EbblGvM/ODe28IqUp2TsWNP9Q0Oj90L 8EdahUkErKbbnufRsU9Jhho7nJusLc6PPTaFnxn0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 0790/1039] KVM: VMX: Read Posted Interrupt "control" exactly once per loop iteration Date: Mon, 24 Jan 2022 19:42:59 +0100 Message-Id: <20220124184151.851685870@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit cfb0e1306a3790eb055ebf7cdb7b0ee8a23e9b6e ] Use READ_ONCE() when loading the posted interrupt descriptor control field to ensure "old" and "new" have the same base value. If the compiler emits separate loads, and loads into "new" before "old", KVM could theoretically drop the ON bit if it were set between the loads. Fixes: 28b835d60fcc ("KVM: Update Posted-Interrupts Descriptor when vCPU is= preempted") Signed-off-by: Sean Christopherson Message-Id: <20211009021236.4122790-27-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kvm/vmx/posted_intr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c index 696ad48ab5daa..46fb83d6a286e 100644 --- a/arch/x86/kvm/vmx/posted_intr.c +++ b/arch/x86/kvm/vmx/posted_intr.c @@ -51,7 +51,7 @@ void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu) =20 /* The full case. */ do { - old.control =3D new.control =3D pi_desc->control; + old.control =3D new.control =3D READ_ONCE(pi_desc->control); =20 dest =3D cpu_physical_id(cpu); =20 @@ -104,7 +104,7 @@ static void __pi_post_block(struct kvm_vcpu *vcpu) unsigned int dest; =20 do { - old.control =3D new.control =3D pi_desc->control; + old.control =3D new.control =3D READ_ONCE(pi_desc->control); WARN(old.nv !=3D POSTED_INTR_WAKEUP_VECTOR, "Wakeup handler not enabled while the VCPU is blocked\n"); =20 @@ -163,7 +163,7 @@ int pi_pre_block(struct kvm_vcpu *vcpu) } =20 do { - old.control =3D new.control =3D pi_desc->control; + old.control =3D new.control =3D READ_ONCE(pi_desc->control); =20 WARN((pi_desc->sn =3D=3D 1), "Warning: SN field of posted-interrupts " --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EC22C4332F for ; Mon, 24 Jan 2022 22:30:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586903AbiAXW1a (ORCPT ); Mon, 24 Jan 2022 17:27:30 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46210 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454452AbiAXVcm (ORCPT ); Mon, 24 Jan 2022 16:32:42 -0500 Received: from smtp.kernel.org (relay.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 E45C1B8105C; Mon, 24 Jan 2022 21:32:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21B72C340E4; Mon, 24 Jan 2022 21:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059959; bh=KTa5uE2Mb93sD38nS7uJSUFuBanTPcMxB9FmfumWRN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ykvS9Y8CfmY/MlQIb7n0BK7vq5gSZpNW6X+yNsBLYS6oNt9TyKB083+YOrg+KUFT6 C2Ft0CPE0k6puq+mi14rZvrFQ+t6HAQOps2b9vubMjTUF3o+Nl9S3QBo9qctm52fx6 BpyHN6AlGw+Ck0PUMy6u3G8BYg88nqNM66QwvInk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lai Jiangshan , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 0791/1039] KVM: X86: Ensure that dirty PDPTRs are loaded Date: Mon, 24 Jan 2022 19:43:00 +0100 Message-Id: <20220124184151.881561471@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lai Jiangshan [ Upstream commit 2c5653caecc4807b8abfe9c41880ac38417be7bf ] For VMX with EPT, dirty PDPTRs need to be loaded before the next vmentry via vmx_load_mmu_pgd() But not all paths that call load_pdptrs() will cause vmx_load_mmu_pgd() to be invoked. Normally, kvm_mmu_reset_context() is used to cause KVM_REQ_LOAD_MMU_PGD, but sometimes it is skipped: * commit d81135a57aa6("KVM: x86: do not reset mmu if CR0.CD and CR0.NW are changed") skips kvm_mmu_reset_context() after load_pdptrs() when changing CR0.CD and CR0.NW. * commit 21823fbda552("KVM: x86: Invalidate all PGDs for the current PCID on MOV CR3 w/ flush") skips KVM_REQ_LOAD_MMU_PGD after load_pdptrs() when rewriting the CR3 with the same value. * commit a91a7c709600("KVM: X86: Don't reset mmu context when toggling X86_CR4_PGE") skips kvm_mmu_reset_context() after load_pdptrs() when changing CR4.PGE. Fixes: d81135a57aa6 ("KVM: x86: do not reset mmu if CR0.CD and CR0.NW are c= hanged") Fixes: 21823fbda552 ("KVM: x86: Invalidate all PGDs for the current PCID on= MOV CR3 w/ flush") Fixes: a91a7c709600 ("KVM: X86: Don't reset mmu context when toggling X86_C= R4_PGE") Signed-off-by: Lai Jiangshan Message-Id: <20211108124407.12187-2-jiangshanlai@gmail.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kvm/x86.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0b5c61bb24a17..bb87f43cdc78c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -830,6 +830,7 @@ int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *= mmu, unsigned long cr3) =20 memcpy(mmu->pdptrs, pdpte, sizeof(mmu->pdptrs)); kvm_register_mark_dirty(vcpu, VCPU_EXREG_PDPTR); + kvm_make_request(KVM_REQ_LOAD_MMU_PGD, vcpu); vcpu->arch.pdptrs_from_userspace =3D false; =20 return 1; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3533CC433F5 for ; Tue, 25 Jan 2022 00:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388531AbiAYAOQ (ORCPT ); Mon, 24 Jan 2022 19:14:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1458150AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B51BC01D7FF; Mon, 24 Jan 2022 13:32:43 -0800 (PST) Received: from smtp.kernel.org (relay.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 2846E61305; Mon, 24 Jan 2022 21:32:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04D5CC340E4; Mon, 24 Jan 2022 21:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059962; bh=vV8dMG+wgDd6ixe70t0hx35EAlauBYI8+Djh336oDOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qMH8R9DYc4y8bIFCcdIeYFeHgBwmLMry5PmBmQl97k/VoQPaEOWg6MoDU7GEHIe4H psnYfLp8CXdQ0a7VcMVBbHzNWsqWOoxjvmCHdv2ozj8AJp3LQHWJB3VFK+zuXuZZRB 17gV8rRJVy2y4ZwTJqZ0RHdVFBlT0f/VvYMMvpNk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 0792/1039] KVM: x86: Handle 32-bit wrap of EIP for EMULTYPE_SKIP with flat code seg Date: Mon, 24 Jan 2022 19:43:01 +0100 Message-Id: <20220124184151.922433858@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 5e854864ee4384736f27a986633bae21731a4e4e ] Truncate the new EIP to a 32-bit value when handling EMULTYPE_SKIP as the decode phase does not truncate _eip. Wrapping the 32-bit boundary is legal if and only if CS is a flat code segment, but that check is implicitly handled in the form of limit checks in the decode phase. Opportunstically prepare for a future fix by storing the result of any truncation in "eip" instead of "_eip". Fixes: 1957aa63be53 ("KVM: VMX: Handle single-step #DB for EMULTYPE_SKIP on= EPT misconfig") Signed-off-by: Sean Christopherson Signed-off-by: Paolo Bonzini Message-Id: <093eabb1eab2965201c9b018373baf26ff256d85.1635842679.git.houwen= long93@linux.alibaba.com> Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kvm/x86.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bb87f43cdc78c..5d5a8e75edcb7 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8134,7 +8134,12 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, g= pa_t cr2_or_gpa, * updating interruptibility state and injecting single-step #DBs. */ if (emulation_type & EMULTYPE_SKIP) { - kvm_rip_write(vcpu, ctxt->_eip); + if (ctxt->mode !=3D X86EMUL_MODE_PROT64) + ctxt->eip =3D (u32)ctxt->_eip; + else + ctxt->eip =3D ctxt->_eip; + + kvm_rip_write(vcpu, ctxt->eip); if (ctxt->eflags & X86_EFLAGS_RF) kvm_set_rflags(vcpu, ctxt->eflags & ~X86_EFLAGS_RF); return 1; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49CA6C433F5 for ; Tue, 25 Jan 2022 00:18:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373845AbiAYAP0 (ORCPT ); Mon, 24 Jan 2022 19:15:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1458155AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B1E8C0A54D4; Mon, 24 Jan 2022 13:32:48 -0800 (PST) Received: from smtp.kernel.org (relay.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 C8343B80FA1; Mon, 24 Jan 2022 21:32:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01633C340E4; Mon, 24 Jan 2022 21:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059965; bh=tedjfVLlqp5z8Y5ric/qPSjsl1AyBDAz7qNYDDiK5L4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nk6hIkux0JOWPWMJ21SReA0vynFTuCVd7KqCw06+IidMnJK6RngqgFf/DmCk0IqUD Ah+re0Rc5T4/3NotpGnZCSWLRr9GreEHWY4wsIuarW7g7HwPyPzfeKmqhsEomnrOjG t6NOrFbBqez8Sc5fOdOkWTL0aV07VJmceuafoUF0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Wenlong , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 0793/1039] KVM: x86: Exit to userspace if emulation prepared a completion callback Date: Mon, 24 Jan 2022 19:43:02 +0100 Message-Id: <20220124184151.954250852@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wenlong [ Upstream commit adbfb12d4c4517a8adde23a7fc46538953d56eea ] em_rdmsr() and em_wrmsr() return X86EMUL_IO_NEEDED if MSR accesses required an exit to userspace. However, x86_emulate_insn() doesn't return X86EMUL_*, so x86_emulate_instruction() doesn't directly act on X86EMUL_IO_NEEDED; instead, it looks for other signals to differentiate between PIO, MMIO, etc. causing RDMSR/WRMSR emulation not to exit to userspace now. Nevertheless, if the userspace_msr_exit_test testcase in selftests is changed to test RDMSR/WRMSR with a forced emulation prefix, the test passes. What happens is that first userspace exit information is filled but the userspace exit does not happen. Because x86_emulate_instruction() returns 1, the guest retries the instruction---but this time RIP has already been adjusted past the forced emulation prefix, so the guest executes RDMSR/WRMSR and the userspace exit finally happens. Since the X86EMUL_IO_NEEDED path has provided a complete_userspace_io callback, x86_emulate_instruction() can just return 0 if the callback is not NULL. Then RDMSR/WRMSR instruction emulation will exit to userspace directly, without the RDMSR/WRMSR vmexit. Fixes: 1ae099540e8c7 ("KVM: x86: Allow deflecting unknown MSR accesses to u= ser space") Signed-off-by: Hou Wenlong Signed-off-by: Paolo Bonzini Message-Id: <56f9df2ee5c05a81155e2be366c9dc1f7adc8817.1635842679.git.houwen= long93@linux.alibaba.com> Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kvm/x86.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 5d5a8e75edcb7..00628031de98d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8203,6 +8203,9 @@ restart: writeback =3D false; r =3D 0; vcpu->arch.complete_userspace_io =3D complete_emulated_mmio; + } else if (vcpu->arch.complete_userspace_io) { + writeback =3D false; + r =3D 0; } else if (r =3D=3D EMULATION_RESTART) goto restart; else --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8278CC433F5 for ; Tue, 25 Jan 2022 00:18:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850578AbiAYAO1 (ORCPT ); Mon, 24 Jan 2022 19:14:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574952AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DB0CC0A54D8; Mon, 24 Jan 2022 13:32:49 -0800 (PST) Received: from smtp.kernel.org (relay.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 EFC34614B4; Mon, 24 Jan 2022 21:32:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D39C5C340E4; Mon, 24 Jan 2022 21:32:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059968; bh=VbmKCL72Oen/J1WzvyZ7/8kn5y0mhpkYsLrA1c3G/+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dVuXuEasMtNxKDtdlRqxosHouSm+fwkiO3xa+d9Cbc0cx15F+aGZj11IUP4A9SXWC Ol8sLlArhao7vbUmJ4dZeJ0xyMqee5C8PhBPA4pMyoO++Xl6hnSNQgnW5Ew4KqXfMJ 48v/r0aw6e51WXrAL7eFk13nPjURuj25mtNMCjnU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boris Brezillon , Alexandre Belloni , Jamie Iles , Sasha Levin Subject: [PATCH 5.16 0794/1039] i3c: fix incorrect address slot lookup on 64-bit Date: Mon, 24 Jan 2022 19:43:03 +0100 Message-Id: <20220124184151.985072196@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jamie Iles [ Upstream commit f18f98110f2b179792cb70d85cba697320a3790f ] The address slot bitmap is an array of unsigned long's which are the same size as an int on 32-bit platforms but not 64-bit. Loading the bitmap into an int could result in the incorrect status being returned for a slot and slots being reported as the wrong status. Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure") Cc: Boris Brezillon Cc: Alexandre Belloni Signed-off-by: Jamie Iles Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20210922165600.179394-1-quic_jiles@quicinc.= com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/i3c/master.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index c3b4c677b4429..dfe18dcd008d4 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -343,7 +343,8 @@ struct bus_type i3c_bus_type =3D { static enum i3c_addr_slot_status i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) { - int status, bitpos =3D addr * 2; + unsigned long status; + int bitpos =3D addr * 2; =20 if (addr > I2C_MAX_ADDR) return I3C_ADDR_SLOT_RSVD; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BDA1C433F5 for ; Tue, 25 Jan 2022 00:34:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3411640AbiAYAeN (ORCPT ); Mon, 24 Jan 2022 19:34:13 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47494 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455232AbiAXVfD (ORCPT ); Mon, 24 Jan 2022 16:35:03 -0500 Received: from smtp.kernel.org (relay.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 55991B8105C; Mon, 24 Jan 2022 21:34:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E888C340E4; Mon, 24 Jan 2022 21:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060098; bh=C1j676FUP8iWuGVMyB82H13nsJjOvitU5NC+K+waxcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/2Xr4gJqLYRpWTah8xtQIR0nqDKldX6fyJKow1kK2XmArf7Zj8fGx/UKOHvzMx7u zdqwG/9ciH6zgot3gbs/9bHpegkFLQab65YIA012cdPFBa2sq5ATdXA2Ux9BK5/PEH D+VmhkKecnnr+GAsFMIUx+YL0NhyMapFv6r1qyDI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Nicolas Pitre , Alexandre Belloni , Sasha Levin Subject: [PATCH 5.16 0795/1039] i3c/master/mipi-i3c-hci: Fix a potentially infinite loop in hci_dat_v1_get_index() Date: Mon, 24 Jan 2022 19:43:04 +0100 Message-Id: <20220124184152.025168739@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 3f43926f271287fb1744c9ac9ae1122497f2b0c2 ] The code in 'hci_dat_v1_get_index()' really looks like a hand coded version of 'for_each_set_bit()', except that a +1 is missing when searching for the next set bit. This really looks odd and it seems that it will loop until 'dat_w0_read()' returns the expected result. So use 'for_each_set_bit()' instead. It is less verbose and should be more correct. Fixes: 9ad9a52cce28 ("i3c/master: introduce the mipi-i3c-hci driver") Signed-off-by: Christophe JAILLET Acked-by: Nicolas Pitre Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/0cdf3cb10293ead1acd271fdb8a70369c298c082.16= 37186628.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/i3c/master/mipi-i3c-hci/dat_v1.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/dat_v1.c b/drivers/i3c/master/= mipi-i3c-hci/dat_v1.c index 783e551a2c85a..97bb49ff5b53b 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dat_v1.c +++ b/drivers/i3c/master/mipi-i3c-hci/dat_v1.c @@ -160,9 +160,7 @@ static int hci_dat_v1_get_index(struct i3c_hci *hci, u8= dev_addr) unsigned int dat_idx; u32 dat_w0; =20 - for (dat_idx =3D find_first_bit(hci->DAT_data, hci->DAT_entries); - dat_idx < hci->DAT_entries; - dat_idx =3D find_next_bit(hci->DAT_data, hci->DAT_entries, dat_idx))= { + for_each_set_bit(dat_idx, hci->DAT_data, hci->DAT_entries) { dat_w0 =3D dat_w0_read(dat_idx); if (FIELD_GET(DAT_0_DYNAMIC_ADDRESS, dat_w0) =3D=3D dev_addr) return dat_idx; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A6C6C433EF for ; Tue, 25 Jan 2022 00:15:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373384AbiAYANm (ORCPT ); Mon, 24 Jan 2022 19:13:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585430AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D882CC06137A; Mon, 24 Jan 2022 13:33:13 -0800 (PST) Received: from smtp.kernel.org (relay.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 766EA61305; Mon, 24 Jan 2022 21:33:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55D0FC340E4; Mon, 24 Jan 2022 21:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059992; bh=1gE0J90otQHDAvwfXnYKScuN2a71uYD8y8dwjg4ylJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KqUoJFtGiS6sb395vkGUK5NbzkXNDj6BO0UvNs9rkI/MKIq/wBVEWoBqJRq3LvFeX npw2vmYLaq9KrvJjTbLFMZLOid8iWXbciFOjUqNb8ZkWISmCOIu3/zjoF6P6Tf7eQh sL0kaTvsmZTV8CvA72j3ldShAm+iGiEPc2qZIrN0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Beau Belgrave , "Steven Rostedt (VMware)" , Sasha Levin Subject: [PATCH 5.16 0796/1039] tracing: Do not let synth_events block other dyn_event systems during create Date: Mon, 24 Jan 2022 19:43:05 +0100 Message-Id: <20220124184152.059694230@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Beau Belgrave [ Upstream commit 4f67cca70c0f615e9cfe6ac42244f3416ec60877 ] synth_events is returning -EINVAL if the dyn_event create command does not contain ' \t'. This prevents other systems from getting called back. synth_events needs to return -ECANCELED in these cases when the command is not targeting the synth_event system. Link: https://lore.kernel.org/linux-trace-devel/20210930223821.11025-1-beau= b@linux.microsoft.com Fixes: c9e759b1e8456 ("tracing: Rework synthetic event command parsing") Reviewed-by: Masami Hiramatsu Signed-off-by: Beau Belgrave Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/trace/trace_events_synth.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_= synth.c index ca9c13b2ecf4b..4b5a637d3ec00 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -2054,6 +2054,13 @@ static int create_synth_event(const char *raw_comman= d) =20 last_cmd_set(raw_command); =20 + name =3D raw_command; + + /* Don't try to process if not our system */ + if (name[0] !=3D 's' || name[1] !=3D ':') + return -ECANCELED; + name +=3D 2; + p =3D strpbrk(raw_command, " \t"); if (!p) { synth_err(SYNTH_ERR_INVALID_CMD, 0); @@ -2062,12 +2069,6 @@ static int create_synth_event(const char *raw_comman= d) =20 fields =3D skip_spaces(p); =20 - name =3D raw_command; - - if (name[0] !=3D 's' || name[1] !=3D ':') - return -ECANCELED; - name +=3D 2; - /* This interface accepts group name prefix */ if (strchr(name, '/')) { len =3D str_has_prefix(name, SYNTH_SYSTEM "/"); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8A9BC433F5 for ; Tue, 25 Jan 2022 00:15:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373029AbiAYAM6 (ORCPT ); Mon, 24 Jan 2022 19:12:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837174AbiAXX20 (ORCPT ); Mon, 24 Jan 2022 18:28:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A5DAC075941; Mon, 24 Jan 2022 13:33:47 -0800 (PST) Received: from smtp.kernel.org (relay.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 0CDFA614D9; Mon, 24 Jan 2022 21:33:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C59C9C340E4; Mon, 24 Jan 2022 21:33:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060026; bh=2obqsxI+/SH42dQ+X0D1aLLfemkok/28qdVTR7fdTIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h5nLtgJy5oDfiXuBdcZlChrL6S+/zcErlB2Or/2pERK1CioXUAPWuSOYT+jMgVDwI /RnI6acCo7YzDqfc6pmqRWhJ2KYWo+DPtimqWJk1W+oT+9Fojp81XsYLozl8J0t7Eb CUlPKRW9w/W5u0524C4d8xOWjS2GovmJlz2e4ki0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dario Binacchi , Dmitry Torokhov , Sasha Levin Subject: [PATCH 5.16 0797/1039] Input: ti_am335x_tsc - set ADCREFM for X configuration Date: Mon, 24 Jan 2022 19:43:06 +0100 Message-Id: <20220124184152.092668924@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dario Binacchi [ Upstream commit 73cca71a903202cddc8279fc76b2da4995da5bea ] As reported by the STEPCONFIG[1-16] registered field descriptions of the TI reference manual, for the ADC "in single ended, SEL_INM_SWC_3_0 must be 1xxx". Unlike the Y and Z coordinates, this bit has not been set for the step configuration registers used to sample the X coordinate. Fixes: 1b8be32e6914 ("Input: add support for TI Touchscreen controller") Signed-off-by: Dario Binacchi Link: https://lore.kernel.org/r/20211212125358.14416-2-dariobin@libero.it Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/input/touchscreen/ti_am335x_tsc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touc= hscreen/ti_am335x_tsc.c index 83e685557a197..fd3ffdd23470b 100644 --- a/drivers/input/touchscreen/ti_am335x_tsc.c +++ b/drivers/input/touchscreen/ti_am335x_tsc.c @@ -131,7 +131,8 @@ static void titsc_step_config(struct titsc *ts_dev) u32 stepenable; =20 config =3D STEPCONFIG_MODE_HWSYNC | - STEPCONFIG_AVG_16 | ts_dev->bit_xp; + STEPCONFIG_AVG_16 | ts_dev->bit_xp | + STEPCONFIG_INM_ADCREFM; switch (ts_dev->wires) { case 4: config |=3D STEPCONFIG_INP(ts_dev->inp_yp) | ts_dev->bit_xn; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00309C433F5 for ; Tue, 25 Jan 2022 00:15:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373151AbiAYANN (ORCPT ); Mon, 24 Jan 2022 19:13:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1842147AbiAXX2e (ORCPT ); Mon, 24 Jan 2022 18:28:34 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DED8EC075D02; Mon, 24 Jan 2022 13:34:20 -0800 (PST) Received: from smtp.kernel.org (relay.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 7C598614FE; Mon, 24 Jan 2022 21:34:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56D5EC340E4; Mon, 24 Jan 2022 21:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060059; bh=nwhDRCmxaQ9ylnl0o8WM7gB9W7pbXqOdwinkHErgie8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u9NeBzo2bVV7wgNir+PdvwDj57dhprLi4GR1Dhi6wmoD6zGkMatyYdJ/4xbOeLQe6 5pHqSpbe7Xn3K5FqyvubhQb1X60fOzzJJUkGS5kAeNorzSiy/wIRXzfs4vUuLW+fY3 /CXgJlxxK9S8QMQzx17GO+KJEvHHuo63nbB8sEio= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dario Binacchi , Dmitry Torokhov , Sasha Levin Subject: [PATCH 5.16 0798/1039] Input: ti_am335x_tsc - fix STEPCONFIG setup for Z2 Date: Mon, 24 Jan 2022 19:43:07 +0100 Message-Id: <20220124184152.124989565@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dario Binacchi [ Upstream commit 6bfeb6c21e1bdc11c328b7d996d20f0f73c6b9b0 ] The Z2 step configuration doesn't erase the SEL_INP_SWC_3_0 bit-field before setting the ADC channel. This way its value could be corrupted by the ADC channel selected for the Z1 coordinate. Fixes: 8c896308feae ("input: ti_am335x_adc: use only FIFO0 and clean up a l= ittle") Signed-off-by: Dario Binacchi Link: https://lore.kernel.org/r/20211212125358.14416-3-dariobin@libero.it Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/input/touchscreen/ti_am335x_tsc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touc= hscreen/ti_am335x_tsc.c index fd3ffdd23470b..cfc943423241f 100644 --- a/drivers/input/touchscreen/ti_am335x_tsc.c +++ b/drivers/input/touchscreen/ti_am335x_tsc.c @@ -196,7 +196,10 @@ static void titsc_step_config(struct titsc *ts_dev) STEPCONFIG_OPENDLY); =20 end_step++; - config |=3D STEPCONFIG_INP(ts_dev->inp_yn); + config =3D STEPCONFIG_MODE_HWSYNC | + STEPCONFIG_AVG_16 | ts_dev->bit_yp | + ts_dev->bit_xn | STEPCONFIG_INM_ADCREFM | + STEPCONFIG_INP(ts_dev->inp_yn); titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config); titsc_writel(ts_dev, REG_STEPDELAY(end_step), STEPCONFIG_OPENDLY); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 866ADC433F5 for ; Tue, 25 Jan 2022 00:18:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374413AbiAYARC (ORCPT ); Mon, 24 Jan 2022 19:17:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1850496AbiAXXaH (ORCPT ); Mon, 24 Jan 2022 18:30:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA355C0A8930; Mon, 24 Jan 2022 13:34:40 -0800 (PST) Received: from smtp.kernel.org (relay.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 6A87161469; Mon, 24 Jan 2022 21:34:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52050C340E4; Mon, 24 Jan 2022 21:34:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060079; bh=sLfxwkR7xnnWAPCDwvtlM2q9dCEaGfOBaWsBhM/oKzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z/ZMPbkKVltW7skwetVaT8o69LuL85zcQGUZ16S77OMIwfzxDGsI09O0iG/jnwTea pxYS85YfdRDERp0d7yBRPkv0ggSop67vtJap0qcWGzOuYXX+ixJxtpPYW3bTFHHMv/ JqAZkQlE4ar4OVEccRQLR4wUW4aqN0T6ULj5MsmQ= 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?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0799/1039] PCI: mvebu: Check for errors from pci_bridge_emul_init() call Date: Mon, 24 Jan 2022 19:43:08 +0100 Message-Id: <20220124184152.158416216@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 5d18d702e5c9309f4195653475c7a7fdde4ca71f ] Function pci_bridge_emul_init() may fail so correctly check for errors. Link: https://lore.kernel.org/r/20211125124605.25915-3-pali@kernel.org Fixes: 1f08673eef12 ("PCI: mvebu: Convert to PCI emulated bridge config spa= ce") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pci-mvebu.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pc= i-mvebu.c index ed13e81cd691d..e6d63ad4d23b8 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -570,7 +570,7 @@ static struct pci_bridge_emul_ops mvebu_pci_bridge_emul= _ops =3D { * Initialize the configuration space of the PCI-to-PCI bridge * associated with the given PCIe interface. */ -static void mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) +static int mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) { struct pci_bridge_emul *bridge =3D &port->bridge; =20 @@ -589,7 +589,7 @@ static void mvebu_pci_bridge_emul_init(struct mvebu_pci= e_port *port) bridge->data =3D port; bridge->ops =3D &mvebu_pci_bridge_emul_ops; =20 - pci_bridge_emul_init(bridge, PCI_BRIDGE_EMUL_NO_PREFETCHABLE_BAR); + return pci_bridge_emul_init(bridge, PCI_BRIDGE_EMUL_NO_PREFETCHABLE_BAR); } =20 static inline struct mvebu_pcie *sys_to_pcie(struct pci_sys_data *sys) @@ -1112,9 +1112,18 @@ static int mvebu_pcie_probe(struct platform_device *= pdev) continue; } =20 + ret =3D mvebu_pci_bridge_emul_init(port); + if (ret < 0) { + dev_err(dev, "%s: cannot init emulated bridge\n", + port->name); + devm_iounmap(dev, port->base); + port->base =3D NULL; + mvebu_pcie_powerdown(port); + continue; + } + mvebu_pcie_setup_hw(port); mvebu_pcie_set_local_dev_nr(port, 1); - mvebu_pci_bridge_emul_init(port); } =20 pcie->nports =3D i; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFCF9C433EF for ; Tue, 25 Jan 2022 00:15:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373214AbiAYANV (ORCPT ); Mon, 24 Jan 2022 19:13:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1850578AbiAXXaS (ORCPT ); Mon, 24 Jan 2022 18:30:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1EF6C0A893D; Mon, 24 Jan 2022 13:34:43 -0800 (PST) Received: from smtp.kernel.org (relay.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 8FFFB614CB; Mon, 24 Jan 2022 21:34:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57864C340E4; Mon, 24 Jan 2022 21:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060083; bh=Tv4PxFP5LAWncL+Y1W8hwk/yXQ3k+Pf7N6zUzlrRQMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qOgfOYSlA4By0zrl+pCiS1P3qkKDnEZkS+k2WQ5t7jOLfly4Gwz3QM2DOcLpPFSxZ iMpTY2sq5uKGn2Hu3ECg2rfB3rVXMFQovVXlfFp9t2uKoAhmjtqfhOJ5frc3VzNgX4 0v8LGM7MAAQbf32+RKwOlx5Po6+CPW7GxAxruNMU= 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?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0800/1039] PCI: mvebu: Do not modify PCI IO type bits in conf_write Date: Mon, 24 Jan 2022 19:43:09 +0100 Message-Id: <20220124184152.190339459@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 2cf150216e5b5619d7c25180ccf2cc8ac7bebc13 ] PCI IO type bits are already initialized in mvebu_pci_bridge_emul_init() function and only when IO support is enabled. These type bits are read-only and pci-bridge-emul.c code already does not allow to modify them from upper layers. When IO support is disabled then all IO registers should be read-only and return zeros. Therefore do not modify PCI IO type bits in mvebu_pci_bridge_emul_base_conf_write() callback. Link: https://lore.kernel.org/r/20211125124605.25915-8-pali@kernel.org Fixes: 1f08673eef12 ("PCI: mvebu: Convert to PCI emulated bridge config spa= ce") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pci-mvebu.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pc= i-mvebu.c index e6d63ad4d23b8..beae555b06bbc 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -497,13 +497,6 @@ mvebu_pci_bridge_emul_base_conf_write(struct pci_bridg= e_emul *bridge, } =20 case PCI_IO_BASE: - /* - * We keep bit 1 set, it is a read-only bit that - * indicates we support 32 bits addressing for the - * I/O - */ - conf->iobase |=3D PCI_IO_RANGE_TYPE_32; - conf->iolimit |=3D PCI_IO_RANGE_TYPE_32; mvebu_pcie_handle_iobase_change(port); break; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08603C433EF for ; Mon, 24 Jan 2022 22:31:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587485AbiAXW2a (ORCPT ); Mon, 24 Jan 2022 17:28:30 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47424 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455133AbiAXVes (ORCPT ); Mon, 24 Jan 2022 16:34:48 -0500 Received: from smtp.kernel.org (relay.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 3365AB81142; Mon, 24 Jan 2022 21:34:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D1D7C340E7; Mon, 24 Jan 2022 21:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060085; bh=Gj+/fEzo/MIrlAptBR6EwJeX40dJ6PyDWkKRNwcTaWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SegIXzSS2IAjx32mbozDlyz9LnoQL7p/2+YaRpssX1gAlUmAhZQVXp6bPxaiiKX65 0Ly+lyHdm/wNKiXPKww92hdCcbk+jU6KuX+LwPzp34xa9dVDbuhV1/v7r8k4mFIWyD xKoAg7e0OR9Nf++iJXF13OSh09HZaQHXKLS8OymI= 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?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0801/1039] PCI: mvebu: Fix support for bus mastering and PCI_COMMAND on emulated bridge Date: Mon, 24 Jan 2022 19:43:10 +0100 Message-Id: <20220124184152.227183950@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 e42b85583719adb87ab88dc7bcd41b38011f7d11 ] According to PCI specifications bits [0:2] of Command Register, this should be by default disabled on reset. So explicitly disable these bits at early beginning of driver initialization. Also remove code which unconditionally enables all 3 bits and let kernel code (via pci_set_master() function) to handle bus mastering of PCI Bridge via emulated PCI_COMMAND on emulated bridge. Adjust existing functions mvebu_pcie_handle_iobase_change() and mvebu_pcie_handle_membase_change() to handle PCI_IO_BASE and PCI_MEM_BASE registers correctly even when bus mastering on emulated bridge is disabled. Link: https://lore.kernel.org/r/20211125124605.25915-7-pali@kernel.org Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pci-mvebu.c | 52 ++++++++++++++++++------------ 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pc= i-mvebu.c index beae555b06bbc..326527f2d6f41 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -215,16 +215,14 @@ static void mvebu_pcie_setup_hw(struct mvebu_pcie_por= t *port) { u32 cmd, mask; =20 - /* Point PCIe unit MBUS decode windows to DRAM space. */ - mvebu_pcie_setup_wins(port); - - /* Master + slave enable. */ + /* Disable Root Bridge I/O space, memory space and bus mastering. */ cmd =3D mvebu_readl(port, PCIE_CMD_OFF); - cmd |=3D PCI_COMMAND_IO; - cmd |=3D PCI_COMMAND_MEMORY; - cmd |=3D PCI_COMMAND_MASTER; + cmd &=3D ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); mvebu_writel(port, cmd, PCIE_CMD_OFF); =20 + /* Point PCIe unit MBUS decode windows to DRAM space. */ + mvebu_pcie_setup_wins(port); + /* Enable interrupt lines A-D. */ mask =3D mvebu_readl(port, PCIE_MASK_OFF); mask |=3D PCIE_MASK_ENABLE_INTS; @@ -371,8 +369,7 @@ static void mvebu_pcie_handle_iobase_change(struct mveb= u_pcie_port *port) =20 /* Are the new iobase/iolimit values invalid? */ if (conf->iolimit < conf->iobase || - conf->iolimitupper < conf->iobaseupper || - !(conf->command & PCI_COMMAND_IO)) { + conf->iolimitupper < conf->iobaseupper) { mvebu_pcie_set_window(port, port->io_target, port->io_attr, &desired, &port->iowin); return; @@ -409,8 +406,7 @@ static void mvebu_pcie_handle_membase_change(struct mve= bu_pcie_port *port) struct pci_bridge_emul_conf *conf =3D &port->bridge.conf; =20 /* Are the new membase/memlimit values invalid? */ - if (conf->memlimit < conf->membase || - !(conf->command & PCI_COMMAND_MEMORY)) { + if (conf->memlimit < conf->membase) { mvebu_pcie_set_window(port, port->mem_target, port->mem_attr, &desired, &port->memwin); return; @@ -430,6 +426,24 @@ static void mvebu_pcie_handle_membase_change(struct mv= ebu_pcie_port *port) &port->memwin); } =20 +static pci_bridge_emul_read_status_t +mvebu_pci_bridge_emul_base_conf_read(struct pci_bridge_emul *bridge, + int reg, u32 *value) +{ + struct mvebu_pcie_port *port =3D bridge->data; + + switch (reg) { + case PCI_COMMAND: + *value =3D mvebu_readl(port, PCIE_CMD_OFF); + break; + + default: + return PCI_BRIDGE_EMUL_NOT_HANDLED; + } + + return PCI_BRIDGE_EMUL_HANDLED; +} + static pci_bridge_emul_read_status_t mvebu_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, int reg, u32 *value) @@ -484,17 +498,14 @@ mvebu_pci_bridge_emul_base_conf_write(struct pci_brid= ge_emul *bridge, =20 switch (reg) { case PCI_COMMAND: - { - if (!mvebu_has_ioport(port)) - conf->command &=3D ~PCI_COMMAND_IO; - - if ((old ^ new) & PCI_COMMAND_IO) - mvebu_pcie_handle_iobase_change(port); - if ((old ^ new) & PCI_COMMAND_MEMORY) - mvebu_pcie_handle_membase_change(port); + if (!mvebu_has_ioport(port)) { + conf->command =3D cpu_to_le16( + le16_to_cpu(conf->command) & ~PCI_COMMAND_IO); + new &=3D ~PCI_COMMAND_IO; + } =20 + mvebu_writel(port, new, PCIE_CMD_OFF); break; - } =20 case PCI_IO_BASE: mvebu_pcie_handle_iobase_change(port); @@ -554,6 +565,7 @@ mvebu_pci_bridge_emul_pcie_conf_write(struct pci_bridge= _emul *bridge, } =20 static struct pci_bridge_emul_ops mvebu_pci_bridge_emul_ops =3D { + .read_base =3D mvebu_pci_bridge_emul_base_conf_read, .write_base =3D mvebu_pci_bridge_emul_base_conf_write, .read_pcie =3D mvebu_pci_bridge_emul_pcie_conf_read, .write_pcie =3D mvebu_pci_bridge_emul_pcie_conf_write, --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 355AFC43219 for ; Tue, 25 Jan 2022 00:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373265AbiAYAN2 (ORCPT ); Mon, 24 Jan 2022 19:13:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1850673AbiAXXah (ORCPT ); Mon, 24 Jan 2022 18:30:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E614DC0AD19B; Mon, 24 Jan 2022 13:34:49 -0800 (PST) Received: from smtp.kernel.org (relay.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 83E2A61469; Mon, 24 Jan 2022 21:34:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AB6CC340E4; Mon, 24 Jan 2022 21:34:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060089; bh=uj/vlz7sng3h83daQU+iLntr8Q7hgEd1Y+KuiH5SAXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sSO5DLbhWU0WlkjZZ/gCr3p7x0vGAhhkmALi7SvqmX8pZQe4V6hRGNWrlAw8cwHJA 9txlk5zjcPWbS/facDOx9gh3m0kCot7Hzo8R9uPGPsBC/TOzEnjMgyTHdq8kHlo41+ xO5RXrVgzj40DylfF7xnL4O7mZgzkGCpA07rWUxo= 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?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0802/1039] PCI: mvebu: Fix configuring secondary bus of PCIe Root Port via emulated bridge Date: Mon, 24 Jan 2022 19:43:11 +0100 Message-Id: <20220124184152.266944706@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 91a8d79fc797d3486ae978beebdfc55261c7d65b ] It looks like that mvebu PCIe controller has for each PCIe link fully independent PCIe host bridge and so every PCIe Root Port is isolated not only on its own bus but also isolated from each others. But in past device tree structure was defined to put all PCIe Root Ports (as PCI Bridge devices) into one root bus 0 and this bus is emulated by pci-mvebu.c driver. Probably reason for this decision was incorrect understanding of PCIe topology of these Armada SoCs and also reason of misunderstanding how is PCIe controller generating Type 0 and Type 1 config requests (it is fully different compared to other drivers). Probably incorrect setup leaded to very surprised things like having PCIe Root Port (PCI Bridge device, with even incorrect Device Class set to Memory Controller) and the PCIe device behind the Root Port on the same PCI bus, which obviously was needed to somehow hack (as these two devices cannot be in reality on the same bus). Properly set mvebu local bus number and mvebu local device number based on PCI Bridge secondary bus number configuration. Also correctly report configured secondary bus number in config space. And explain in driver comment why this setup is correct. Link: https://lore.kernel.org/r/20211125124605.25915-12-pali@kernel.org Fixes: 1f08673eef12 ("PCI: mvebu: Convert to PCI emulated bridge config spa= ce") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pci-mvebu.c | 99 +++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pc= i-mvebu.c index 326527f2d6f41..abed58db56877 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -125,6 +125,11 @@ static bool mvebu_pcie_link_up(struct mvebu_pcie_port = *port) return !(mvebu_readl(port, PCIE_STAT_OFF) & PCIE_STAT_LINK_DOWN); } =20 +static u8 mvebu_pcie_get_local_bus_nr(struct mvebu_pcie_port *port) +{ + return (mvebu_readl(port, PCIE_STAT_OFF) & PCIE_STAT_BUS) >> 8; +} + static void mvebu_pcie_set_local_bus_nr(struct mvebu_pcie_port *port, int = nr) { u32 stat; @@ -437,6 +442,20 @@ mvebu_pci_bridge_emul_base_conf_read(struct pci_bridge= _emul *bridge, *value =3D mvebu_readl(port, PCIE_CMD_OFF); break; =20 + case PCI_PRIMARY_BUS: { + /* + * From the whole 32bit register we support reading from HW only + * secondary bus number which is mvebu local bus number. + * Other bits are retrieved only from emulated config buffer. + */ + __le32 *cfgspace =3D (__le32 *)&bridge->conf; + u32 val =3D le32_to_cpu(cfgspace[PCI_PRIMARY_BUS / 4]); + val &=3D ~0xff00; + val |=3D mvebu_pcie_get_local_bus_nr(port) << 8; + *value =3D val; + break; + } + default: return PCI_BRIDGE_EMUL_NOT_HANDLED; } @@ -520,7 +539,8 @@ mvebu_pci_bridge_emul_base_conf_write(struct pci_bridge= _emul *bridge, break; =20 case PCI_PRIMARY_BUS: - mvebu_pcie_set_local_bus_nr(port, conf->secondary_bus); + if (mask & 0xff00) + mvebu_pcie_set_local_bus_nr(port, conf->secondary_bus); break; =20 default: @@ -1127,8 +1147,83 @@ static int mvebu_pcie_probe(struct platform_device *= pdev) continue; } =20 + /* + * PCIe topology exported by mvebu hw is quite complicated. In + * reality has something like N fully independent host bridges + * where each host bridge has one PCIe Root Port (which acts as + * PCI Bridge device). Each host bridge has its own independent + * internal registers, independent access to PCI config space, + * independent interrupt lines, independent window and memory + * access configuration. But additionally there is some kind of + * peer-to-peer support between PCIe devices behind different + * host bridges limited just to forwarding of memory and I/O + * transactions (forwarding of error messages and config cycles + * is not supported). So we could say there are N independent + * PCIe Root Complexes. + * + * For this kind of setup DT should have been structured into + * N independent PCIe controllers / host bridges. But instead + * structure in past was defined to put PCIe Root Ports of all + * host bridges into one bus zero, like in classic multi-port + * Root Complex setup with just one host bridge. + * + * This means that pci-mvebu.c driver provides "virtual" bus 0 + * on which registers all PCIe Root Ports (PCI Bridge devices) + * specified in DT by their BDF addresses and virtually routes + * PCI config access of each PCI bridge device to specific PCIe + * host bridge. + * + * Normally PCI Bridge should choose between Type 0 and Type 1 + * config requests based on primary and secondary bus numbers + * configured on the bridge itself. But because mvebu PCI Bridge + * does not have registers for primary and secondary bus numbers + * in its config space, it determinates type of config requests + * via its own custom way. + * + * There are two options how mvebu determinate type of config + * request. + * + * 1. If Secondary Bus Number Enable bit is not set or is not + * available (applies for pre-XP PCIe controllers) then Type 0 + * is used if target bus number equals Local Bus Number (bits + * [15:8] in register 0x1a04) and target device number differs + * from Local Device Number (bits [20:16] in register 0x1a04). + * Type 1 is used if target bus number differs from Local Bus + * Number. And when target bus number equals Local Bus Number + * and target device equals Local Device Number then request is + * routed to Local PCI Bridge (PCIe Root Port). + * + * 2. If Secondary Bus Number Enable bit is set (bit 7 in + * register 0x1a2c) then mvebu hw determinate type of config + * request like compliant PCI Bridge based on primary bus number + * which is configured via Local Bus Number (bits [15:8] in + * register 0x1a04) and secondary bus number which is configured + * via Secondary Bus Number (bits [7:0] in register 0x1a2c). + * Local PCI Bridge (PCIe Root Port) is available on primary bus + * as device with Local Device Number (bits [20:16] in register + * 0x1a04). + * + * Secondary Bus Number Enable bit is disabled by default and + * option 2. is not available on pre-XP PCIe controllers. Hence + * this driver always use option 1. + * + * Basically it means that primary and secondary buses shares + * one virtual number configured via Local Bus Number bits and + * Local Device Number bits determinates if accessing primary + * or secondary bus. Set Local Device Number to 1 and redirect + * all writes of PCI Bridge Secondary Bus Number register to + * Local Bus Number (bits [15:8] in register 0x1a04). + * + * So when accessing devices on buses behind secondary bus + * number it would work correctly. And also when accessing + * device 0 at secondary bus number via config space would be + * correctly routed to secondary bus. Due to issues described + * in mvebu_pcie_setup_hw(), PCI Bridges at primary bus (zero) + * are not accessed directly via PCI config space but rarher + * indirectly via kernel emulated PCI bridge driver. + */ mvebu_pcie_setup_hw(port); - mvebu_pcie_set_local_dev_nr(port, 1); + mvebu_pcie_set_local_dev_nr(port, 0); } =20 pcie->nports =3D i; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE4D8C433F5 for ; Tue, 25 Jan 2022 00:18:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374504AbiAYARM (ORCPT ); Mon, 24 Jan 2022 19:17:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1850665AbiAXXag (ORCPT ); Mon, 24 Jan 2022 18:30:36 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 631B8C0AD1A2; Mon, 24 Jan 2022 13:34:54 -0800 (PST) Received: from smtp.kernel.org (relay.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 2AF5DB811FB; Mon, 24 Jan 2022 21:34:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A893C340E4; Mon, 24 Jan 2022 21:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060091; bh=zBueeHikAA85moR0e9cXIh0B9MY89d969ZB1EM1xt0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UFNAlSrXw5S74frSy/RhfRMDZjt1hpAK4SOpUhk+4Xqo/X+JZAlYC+vCmVTPeS4Iv iBB9Yrxj6VuVCcqbc6S7TRCS60lfsvx0qgHMoVEQK+43d1gXsWVNr/2PNhvnxLajew 8of75bl4NPONe4I0RlHDQYXjDkQ3jZV6sjQrB1hU= 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?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0803/1039] PCI: mvebu: Setup PCIe controller to Root Complex mode Date: Mon, 24 Jan 2022 19:43:12 +0100 Message-Id: <20220124184152.298163867@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 df08ac016124bd88b8598ac0599d7b89c0642774 ] This driver operates only in Root Complex mode, so ensure that hardware is properly configured in Root Complex mode. Link: https://lore.kernel.org/r/20211125124605.25915-10-pali@kernel.org Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pci-mvebu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pc= i-mvebu.c index abed58db56877..f279471e340ee 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -55,6 +55,7 @@ #define PCIE_MASK_ENABLE_INTS 0x0f000000 #define PCIE_CTRL_OFF 0x1a00 #define PCIE_CTRL_X1_MODE 0x0001 +#define PCIE_CTRL_RC_MODE BIT(1) #define PCIE_STAT_OFF 0x1a04 #define PCIE_STAT_BUS 0xff00 #define PCIE_STAT_DEV 0x1f0000 @@ -218,7 +219,12 @@ static void mvebu_pcie_setup_wins(struct mvebu_pcie_po= rt *port) =20 static void mvebu_pcie_setup_hw(struct mvebu_pcie_port *port) { - u32 cmd, mask; + u32 ctrl, cmd, mask; + + /* Setup PCIe controller to Root Complex mode. */ + ctrl =3D mvebu_readl(port, PCIE_CTRL_OFF); + ctrl |=3D PCIE_CTRL_RC_MODE; + mvebu_writel(port, ctrl, PCIE_CTRL_OFF); =20 /* Disable Root Bridge I/O space, memory space and bus mastering. */ cmd =3D mvebu_readl(port, PCIE_CMD_OFF); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BC14C433F5 for ; Mon, 24 Jan 2022 22:31:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587432AbiAXW2U (ORCPT ); Mon, 24 Jan 2022 17:28:20 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54158 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455200AbiAXVe4 (ORCPT ); Mon, 24 Jan 2022 16:34:56 -0500 Received: from smtp.kernel.org (relay.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 962E461320; Mon, 24 Jan 2022 21:34:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DA5FC340E4; Mon, 24 Jan 2022 21:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060095; bh=3i2XzHDZD3pXO+yiyPbt7hDEmvflOcH/cdCg0AQj2PA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VIOcCZrBv6EoXt/2KPu5op/U0qqdU7So9rHiNyZGOZOhhIum1o42MuzwU4gnc8UIp 6E/uzacCPucefmpBPxIWs6Rp2S5cRV3Mbx0j9tmMuUHxppw4hAbxWPHYxZZvc7S8mt JV3WngkIHRMtZwkA8R3UC7UVd23LYXgQoxvdXTCw= 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?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0804/1039] PCI: mvebu: Fix support for PCI_BRIDGE_CTL_BUS_RESET on emulated bridge Date: Mon, 24 Jan 2022 19:43:13 +0100 Message-Id: <20220124184152.336213477@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 d75404cc08832206f173668bd35391c581fea121 ] Hardware supports PCIe Hot Reset via PCIE_CTRL_OFF register. Use it for implementing PCI_BRIDGE_CTL_BUS_RESET bit of PCI_BRIDGE_CONTROL register on emulated bridge. With this change the function pci_reset_secondary_bus() starts working and can reset connected PCIe card. Link: https://lore.kernel.org/r/20211125124605.25915-13-pali@kernel.org Fixes: 1f08673eef12 ("PCI: mvebu: Convert to PCI emulated bridge config spa= ce") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pci-mvebu.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pc= i-mvebu.c index f279471e340ee..aaf6a226f6dba 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -56,6 +56,7 @@ #define PCIE_CTRL_OFF 0x1a00 #define PCIE_CTRL_X1_MODE 0x0001 #define PCIE_CTRL_RC_MODE BIT(1) +#define PCIE_CTRL_MASTER_HOT_RESET BIT(24) #define PCIE_STAT_OFF 0x1a04 #define PCIE_STAT_BUS 0xff00 #define PCIE_STAT_DEV 0x1f0000 @@ -462,6 +463,22 @@ mvebu_pci_bridge_emul_base_conf_read(struct pci_bridge= _emul *bridge, break; } =20 + case PCI_INTERRUPT_LINE: { + /* + * From the whole 32bit register we support reading from HW only + * one bit: PCI_BRIDGE_CTL_BUS_RESET. + * Other bits are retrieved only from emulated config buffer. + */ + __le32 *cfgspace =3D (__le32 *)&bridge->conf; + u32 val =3D le32_to_cpu(cfgspace[PCI_INTERRUPT_LINE / 4]); + if (mvebu_readl(port, PCIE_CTRL_OFF) & PCIE_CTRL_MASTER_HOT_RESET) + val |=3D PCI_BRIDGE_CTL_BUS_RESET << 16; + else + val &=3D ~(PCI_BRIDGE_CTL_BUS_RESET << 16); + *value =3D val; + break; + } + default: return PCI_BRIDGE_EMUL_NOT_HANDLED; } @@ -549,6 +566,17 @@ mvebu_pci_bridge_emul_base_conf_write(struct pci_bridg= e_emul *bridge, mvebu_pcie_set_local_bus_nr(port, conf->secondary_bus); break; =20 + case PCI_INTERRUPT_LINE: + if (mask & (PCI_BRIDGE_CTL_BUS_RESET << 16)) { + u32 ctrl =3D mvebu_readl(port, PCIE_CTRL_OFF); + if (new & (PCI_BRIDGE_CTL_BUS_RESET << 16)) + ctrl |=3D PCIE_CTRL_MASTER_HOT_RESET; + else + ctrl &=3D ~PCIE_CTRL_MASTER_HOT_RESET; + mvebu_writel(port, ctrl, PCIE_CTRL_OFF); + } + break; + default: break; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85B24C4332F for ; Tue, 25 Jan 2022 00:15:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353848AbiAYAN4 (ORCPT ); Mon, 24 Jan 2022 19:13:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587648AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFB32C0A8877; Mon, 24 Jan 2022 13:33:16 -0800 (PST) Received: from smtp.kernel.org (relay.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 6DCD061305; Mon, 24 Jan 2022 21:33:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E4B6C340E4; Mon, 24 Jan 2022 21:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059995; bh=yJKKoZqoeZsU/xnmPZ+NZhMnAgPh1Vr7l6l0WGRJ2cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UrjYebrhZ/JIqN67oM6sWsi7TrcuQRgB/A1Zy54d2+CZkoW/kQZ8EzqAnjoYTfV5P 74kz1De7m0rESCJzU6hzLZCSotz7Y7e9o7cmK1LopjjS1RiVQhRnVVoHB3ggJDRsi+ hXdy3TpfDIVZEWSxc5DDAruCdi4+bC2MH5DPDWLg= 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?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0805/1039] PCI: mvebu: Fix support for PCI_EXP_DEVCTL on emulated bridge Date: Mon, 24 Jan 2022 19:43:14 +0100 Message-Id: <20220124184152.374674254@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 ecae073e393e65ee7be7ebf3fdd5258ab99f1636 ] Comment in Armada 370 functional specification is misleading. PCI_EXP_DEVCTL_*RE bits are supported and configures receiving of error interrupts. Link: https://lore.kernel.org/r/20211125124605.25915-14-pali@kernel.org Fixes: 1f08673eef12 ("PCI: mvebu: Convert to PCI emulated bridge config spa= ce") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pci-mvebu.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pc= i-mvebu.c index aaf6a226f6dba..0052e83c95de9 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -498,9 +498,7 @@ mvebu_pci_bridge_emul_pcie_conf_read(struct pci_bridge_= emul *bridge, break; =20 case PCI_EXP_DEVCTL: - *value =3D mvebu_readl(port, PCIE_CAP_PCIEXP + PCI_EXP_DEVCTL) & - ~(PCI_EXP_DEVCTL_URRE | PCI_EXP_DEVCTL_FERE | - PCI_EXP_DEVCTL_NFERE | PCI_EXP_DEVCTL_CERE); + *value =3D mvebu_readl(port, PCIE_CAP_PCIEXP + PCI_EXP_DEVCTL); break; =20 case PCI_EXP_LNKCAP: @@ -590,13 +588,6 @@ mvebu_pci_bridge_emul_pcie_conf_write(struct pci_bridg= e_emul *bridge, =20 switch (reg) { case PCI_EXP_DEVCTL: - /* - * Armada370 data says these bits must always - * be zero when in root complex mode. - */ - new &=3D ~(PCI_EXP_DEVCTL_URRE | PCI_EXP_DEVCTL_FERE | - PCI_EXP_DEVCTL_NFERE | PCI_EXP_DEVCTL_CERE); - mvebu_writel(port, new, PCIE_CAP_PCIEXP + PCI_EXP_DEVCTL); break; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EED6C433F5 for ; Tue, 25 Jan 2022 00:15:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373447AbiAYANw (ORCPT ); Mon, 24 Jan 2022 19:13:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585459AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3CFDC06137B; Mon, 24 Jan 2022 13:33:22 -0800 (PST) Received: from smtp.kernel.org (relay.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 6FF85B81057; Mon, 24 Jan 2022 21:33:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F5EEC340E4; Mon, 24 Jan 2022 21:33:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060000; bh=83ctBQqKYvJoAd9wQ3c3uQz73mSpKbIn7Mp3jAIt8wo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZyX7FGeb8gKIl3u2pKw+5xa87vKm4QbyXrg1rvffkkKZ9WGWC8I84p9PfE6/F0xun rKkADoQGi3qGr0+aeGO3EsyzcGO4bQ7rWMT4TP49ka5BuQs/zqYC4espxdLiUSjCw3 UIJr+D3na7gb9jibxkQnBYkRLYJCSPk1LHoC4LXw= 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?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0806/1039] PCI: mvebu: Fix support for PCI_EXP_RTSTA on emulated bridge Date: Mon, 24 Jan 2022 19:43:15 +0100 Message-Id: <20220124184152.404506156@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 838ff44a398ff47fe9b924961d91aee325821220 ] PME Status bit in Root Status Register (PCIE_RC_RTSTA_OFF) is read-only and can be cleared only by writing 0b to the Interrupt Cause RW0C register (PCIE_INT_CAUSE_OFF). Link: https://lore.kernel.org/r/20211125124605.25915-15-pali@kernel.org Fixes: 1f08673eef12 ("PCI: mvebu: Convert to PCI emulated bridge config spa= ce") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pci-mvebu.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pc= i-mvebu.c index 0052e83c95de9..618c34e8879ec 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -51,6 +51,8 @@ PCIE_CONF_FUNC(PCI_FUNC(devfn)) | PCIE_CONF_REG(where) | \ PCIE_CONF_ADDR_EN) #define PCIE_CONF_DATA_OFF 0x18fc +#define PCIE_INT_CAUSE_OFF 0x1900 +#define PCIE_INT_PM_PME BIT(28) #define PCIE_MASK_OFF 0x1910 #define PCIE_MASK_ENABLE_INTS 0x0f000000 #define PCIE_CTRL_OFF 0x1a00 @@ -604,7 +606,14 @@ mvebu_pci_bridge_emul_pcie_conf_write(struct pci_bridg= e_emul *bridge, break; =20 case PCI_EXP_RTSTA: - mvebu_writel(port, new, PCIE_RC_RTSTA); + /* + * PME Status bit in Root Status Register (PCIE_RC_RTSTA) + * is read-only and can be cleared only by writing 0b to the + * Interrupt Cause RW0C register (PCIE_INT_CAUSE_OFF). So + * clear PME via Interrupt Cause. + */ + if (new & PCI_EXP_RTSTA_PME) + mvebu_writel(port, ~PCIE_INT_PM_PME, PCIE_INT_CAUSE_OFF); break; } } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F031C433EF for ; Tue, 25 Jan 2022 00:15:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373431AbiAYANt (ORCPT ); Mon, 24 Jan 2022 19:13:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587671AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06AD9C06137C; Mon, 24 Jan 2022 13:33:24 -0800 (PST) Received: from smtp.kernel.org (relay.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 9A16B61305; Mon, 24 Jan 2022 21:33:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B87FC340E4; Mon, 24 Jan 2022 21:33:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060003; bh=1JwUsDPGsn0+DgdjBcBpmV32LGvRqYu/Cx8GkXso3cM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T84VTGmrSEwEAsFE+UjQQRLYdaOYlXrJmeuU54KrCf0Jzb7DBfeWyDAKNlIm8VBhO 6yO+2jYzhrtUq3sUMRjtqixrhaCT+PGvJWccIs8gNEHUG1ruXD32o5QVDxJZJev26t hBb4uR7/QsSZISYNI1xuYtwoQQqs3OJGXjfQ9oy0= 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?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0807/1039] PCI: mvebu: Fix support for DEVCAP2, DEVCTL2 and LNKCTL2 registers on emulated bridge Date: Mon, 24 Jan 2022 19:43:16 +0100 Message-Id: <20220124184152.438249854@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 4ab34548c55fbbb3898306a47dfaccd4860e1ccb ] Armada XP and new hardware supports access to DEVCAP2, DEVCTL2 and LNKCTL2 configuration registers of PCIe core via PCIE_CAP_PCIEXP. So export them via emulated software root bridge. Pre-XP hardware does not support these registers and returns zeros. Link: https://lore.kernel.org/r/20211125124605.25915-16-pali@kernel.org Fixes: 1f08673eef12 ("PCI: mvebu: Convert to PCI emulated bridge config spa= ce") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pci-mvebu.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pc= i-mvebu.c index 618c34e8879ec..ffcbb8d1d09d5 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -524,6 +524,18 @@ mvebu_pci_bridge_emul_pcie_conf_read(struct pci_bridge= _emul *bridge, *value =3D mvebu_readl(port, PCIE_RC_RTSTA); break; =20 + case PCI_EXP_DEVCAP2: + *value =3D mvebu_readl(port, PCIE_CAP_PCIEXP + PCI_EXP_DEVCAP2); + break; + + case PCI_EXP_DEVCTL2: + *value =3D mvebu_readl(port, PCIE_CAP_PCIEXP + PCI_EXP_DEVCTL2); + break; + + case PCI_EXP_LNKCTL2: + *value =3D mvebu_readl(port, PCIE_CAP_PCIEXP + PCI_EXP_LNKCTL2); + break; + default: return PCI_BRIDGE_EMUL_NOT_HANDLED; } @@ -615,6 +627,17 @@ mvebu_pci_bridge_emul_pcie_conf_write(struct pci_bridg= e_emul *bridge, if (new & PCI_EXP_RTSTA_PME) mvebu_writel(port, ~PCIE_INT_PM_PME, PCIE_INT_CAUSE_OFF); break; + + case PCI_EXP_DEVCTL2: + mvebu_writel(port, new, PCIE_CAP_PCIEXP + PCI_EXP_DEVCTL2); + break; + + case PCI_EXP_LNKCTL2: + mvebu_writel(port, new, PCIE_CAP_PCIEXP + PCI_EXP_LNKCTL2); + break; + + default: + break; } } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EEBBC43217 for ; Tue, 25 Jan 2022 00:15:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373368AbiAYANj (ORCPT ); Mon, 24 Jan 2022 19:13:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835200AbiAXX2X (ORCPT ); Mon, 24 Jan 2022 18:28:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D4BBC06137D; Mon, 24 Jan 2022 13:33:28 -0800 (PST) Received: from smtp.kernel.org (relay.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 149FFB8123A; Mon, 24 Jan 2022 21:33:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69D7CC340E4; Mon, 24 Jan 2022 21:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060005; bh=6CwbdUP4ArC4/Ck5geh/sApqB5cTzwvQjDurpINfABc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hU3k0x9Zec7rdHcx652bIfCY0hHbKEq7oAPdJItOH51xaUl2f0RUxUS4gPZfsFJ6k MMfzMVLKTAHiJA6b+sh85RPItndC89tc0hyth2TH+hw0FEGPjLBqPwnY3e6unxjZBZ b7k5D93ptRxepU0y9Lhn9yUKyyjtYxlJaks0QRg4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Chen , Anup Patel , Sasha Levin Subject: [PATCH 5.16 0808/1039] KVM: RISC-V: Avoid spurious virtual interrupts after clearing hideleg CSR Date: Mon, 24 Jan 2022 19:43:17 +0100 Message-Id: <20220124184152.471697105@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Chen [ Upstream commit 33e5b5746cc2336660c8710ba109d9a3923627b5 ] When the last VM is terminated, the host kernel will invoke function hardware_disable_nolock() on each CPU to disable the related virtualization functions. Here, RISC-V currently only clears hideleg CSR and hedeleg CSR. This behavior will cause the host kernel to receive spurious interrupts if hvip CSR has pending interrupts and the corresponding enable bits in vsie CSR are asserted. To avoid it, hvip CSR and vsie CSR must be cleared before clearing hideleg CSR. Fixes: 99cdc6c18c2d ("RISC-V: Add initial skeletal KVM support") Signed-off-by: Vincent Chen Reviewed-by: Anup Patel Signed-off-by: Anup Patel Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/kvm/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/riscv/kvm/main.c b/arch/riscv/kvm/main.c index 421ecf4e6360b..2e5ca43c8c49e 100644 --- a/arch/riscv/kvm/main.c +++ b/arch/riscv/kvm/main.c @@ -58,6 +58,14 @@ int kvm_arch_hardware_enable(void) =20 void kvm_arch_hardware_disable(void) { + /* + * After clearing the hideleg CSR, the host kernel will receive + * spurious interrupts if hvip CSR has pending interrupts and the + * corresponding enable bits in vsie CSR are asserted. To avoid it, + * hvip CSR and vsie CSR must be cleared before clearing hideleg CSR. + */ + csr_write(CSR_VSIE, 0); + csr_write(CSR_HVIP, 0); csr_write(CSR_HEDELEG, 0); csr_write(CSR_HIDELEG, 0); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5EE9C43217 for ; Mon, 24 Jan 2022 22:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587171AbiAXW1x (ORCPT ); Mon, 24 Jan 2022 17:27:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46694 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454734AbiAXVdb (ORCPT ); Mon, 24 Jan 2022 16:33:31 -0500 Received: from smtp.kernel.org (relay.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 06320B81057; Mon, 24 Jan 2022 21:33:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 380ECC340E4; Mon, 24 Jan 2022 21:33:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060008; bh=7OxJk9zzdj4xIrQaDWWQlHUaJmsfEp+0ewrq52q3dwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SCxHRnJphGOsgIL8RQBFCmTPaf+otoHnubVjKI9dlYZsE6VHKTWkWrNcZ5eQ5qsfq VMjBSQeOhZQul+mFnIIimqYY7rNAZ7G8cCNVCxIO7bj1iO2CroMrCbYq5fz2CT2eXg VPRy+/O9LqtfGSPEjhlY+JGs1VJyGNQT7reZYqzk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rick Macklem , Chuck Lever , Sasha Levin Subject: [PATCH 5.16 0809/1039] NFSD: Fix verifier returned in stable WRITEs Date: Mon, 24 Jan 2022 19:43:18 +0100 Message-Id: <20220124184152.507995571@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit f11ad7aa653130b71e2e89bed207f387718216d5 ] RFC 8881 explains the purpose of the write verifier this way: > The final portion of the result is the field writeverf. This field > is the write verifier and is a cookie that the client can use to > determine whether a server has changed instance state (e.g., server > restart) between a call to WRITE and a subsequent call to either > WRITE or COMMIT. But then it says: > This cookie MUST be unchanged during a single instance of the > NFSv4.1 server and MUST be unique between instances of the NFSv4.1 > server. If the cookie changes, then the client MUST assume that > any data written with an UNSTABLE4 value for committed and an old > writeverf in the reply has been lost and will need to be > recovered. RFC 1813 has similar language for NFSv3. NFSv2 does not have a write verifier since it doesn't implement the COMMIT procedure. Since commit 19e0663ff9bc ("nfsd: Ensure sampling of the write verifier is atomic with the write"), the Linux NFS server has returned a boot-time-based verifier for UNSTABLE WRITEs, but a zero verifier for FILE_SYNC and DATA_SYNC WRITEs. FILE_SYNC and DATA_SYNC WRITEs are not followed up with a COMMIT, so there's no need for clients to compare verifiers for stable writes. However, by returning a different verifier for stable and unstable writes, the above commit puts the Linux NFS server a step farther out of compliance with the first MUST above. At least one NFS client (FreeBSD) noticed the difference, making this a potential regression. Reported-by: Rick Macklem Link: https://lore.kernel.org/linux-nfs/YQXPR0101MB096857EEACF04A6DF1FC6D9B= DD749@YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM/T/ Fixes: 19e0663ff9bc ("nfsd: Ensure sampling of the write verifier is atomic= with the write") Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/nfsd/vfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index c99857689e2c2..7f2472e4b88f9 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -987,6 +987,10 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *= fhp, struct nfsd_file *nf, iov_iter_kvec(&iter, WRITE, vec, vlen, *cnt); if (flags & RWF_SYNC) { down_write(&nf->nf_rwsem); + if (verf) + nfsd_copy_boot_verifier(verf, + net_generic(SVC_NET(rqstp), + nfsd_net_id)); host_err =3D vfs_iter_write(file, &iter, &pos, flags); if (host_err < 0) nfsd_reset_boot_verifier(net_generic(SVC_NET(rqstp), --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BD3FC433EF for ; Mon, 24 Jan 2022 22:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587151AbiAXW1v (ORCPT ); Mon, 24 Jan 2022 17:27:51 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53028 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454740AbiAXVdd (ORCPT ); Mon, 24 Jan 2022 16:33:33 -0500 Received: from smtp.kernel.org (relay.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 1BE3361028; Mon, 24 Jan 2022 21:33:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 272E6C340E4; Mon, 24 Jan 2022 21:33:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060011; bh=Hwn0nBZSSS2Ox64jgXZDFCc5FEy6ow4iGWRyL3BCMjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eKNQhUzEOyk49WXgykN/k42uBbMRNSeXbpHuWVGbn7LfcjfnKwzxUDNSjeQzi8UGM MV+hzW89MZF0IjjRqb9n1daYNjgWUBT/AC6nOThntBGILXIICMfKOeK+b+bpmUe4QN Uk6pBtoGkXKwg4oIH1EfHGi5FtapmPaC1Ic492oI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Sasha Levin Subject: [PATCH 5.16 0810/1039] Revert "nfsd: skip some unnecessary stats in the v4 case" Date: Mon, 24 Jan 2022 19:43:19 +0100 Message-Id: <20220124184152.541304852@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 58f258f65267542959487dbe8b5641754411843d ] On the wire, I observed NFSv4 OPEN(CREATE) operations sometimes returning a reasonable-looking value in the cinfo.before field and zero in the cinfo.after field. RFC 8881 Section 10.8.1 says: > When a client is making changes to a given directory, it needs to > determine whether there have been changes made to the directory by > other clients. It does this by using the change attribute as > reported before and after the directory operation in the associated > change_info4 value returned for the operation. and > ... The post-operation change > value needs to be saved as the basis for future change_info4 > comparisons. A good quality client implementation therefore saves the zero cinfo.after value. During a subsequent OPEN operation, it will receive a different non-zero value in the cinfo.before field for that directory, and it will incorrectly believe the directory has changed, triggering an undesirable directory cache invalidation. There are filesystem types where fs_supports_change_attribute() returns false, tmpfs being one. On NFSv4 mounts, this means the fh_getattr() call site in fill_pre_wcc() and fill_post_wcc() is never invoked. Subsequently, nfsd4_change_attribute() is invoked with an uninitialized @stat argument. In fill_pre_wcc(), @stat contains stale stack garbage, which is then placed on the wire. In fill_post_wcc(), ->fh_post_wc is all zeroes, so zero is placed on the wire. Both of these values are meaningless. This fix can be applied immediately to stable kernels. Once there are more regression tests in this area, this optimization can be attempted again. Fixes: 428a23d2bf0c ("nfsd: skip some unnecessary stats in the v4 case") Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/nfsd/nfs3xdr.c | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index c3ac1b6aa3aaa..84088581bbe09 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c @@ -487,11 +487,6 @@ neither: return true; } =20 -static bool fs_supports_change_attribute(struct super_block *sb) -{ - return sb->s_flags & SB_I_VERSION || sb->s_export_op->fetch_iversion; -} - /* * Fill in the pre_op attr for the wcc data */ @@ -500,26 +495,24 @@ void fill_pre_wcc(struct svc_fh *fhp) struct inode *inode; struct kstat stat; bool v4 =3D (fhp->fh_maxsize =3D=3D NFS4_FHSIZE); + __be32 err; =20 if (fhp->fh_no_wcc || fhp->fh_pre_saved) return; inode =3D d_inode(fhp->fh_dentry); - if (fs_supports_change_attribute(inode->i_sb) || !v4) { - __be32 err =3D fh_getattr(fhp, &stat); - - if (err) { - /* Grab the times from inode anyway */ - stat.mtime =3D inode->i_mtime; - stat.ctime =3D inode->i_ctime; - stat.size =3D inode->i_size; - } - fhp->fh_pre_mtime =3D stat.mtime; - fhp->fh_pre_ctime =3D stat.ctime; - fhp->fh_pre_size =3D stat.size; + err =3D fh_getattr(fhp, &stat); + if (err) { + /* Grab the times from inode anyway */ + stat.mtime =3D inode->i_mtime; + stat.ctime =3D inode->i_ctime; + stat.size =3D inode->i_size; } if (v4) fhp->fh_pre_change =3D nfsd4_change_attribute(&stat, inode); =20 + fhp->fh_pre_mtime =3D stat.mtime; + fhp->fh_pre_ctime =3D stat.ctime; + fhp->fh_pre_size =3D stat.size; fhp->fh_pre_saved =3D true; } =20 @@ -530,6 +523,7 @@ void fill_post_wcc(struct svc_fh *fhp) { bool v4 =3D (fhp->fh_maxsize =3D=3D NFS4_FHSIZE); struct inode *inode =3D d_inode(fhp->fh_dentry); + __be32 err; =20 if (fhp->fh_no_wcc) return; @@ -537,16 +531,12 @@ void fill_post_wcc(struct svc_fh *fhp) if (fhp->fh_post_saved) printk("nfsd: inode locked twice during operation.\n"); =20 - fhp->fh_post_saved =3D true; - - if (fs_supports_change_attribute(inode->i_sb) || !v4) { - __be32 err =3D fh_getattr(fhp, &fhp->fh_post_attr); - - if (err) { - fhp->fh_post_saved =3D false; - fhp->fh_post_attr.ctime =3D inode->i_ctime; - } - } + err =3D fh_getattr(fhp, &fhp->fh_post_attr); + if (err) { + fhp->fh_post_saved =3D false; + fhp->fh_post_attr.ctime =3D inode->i_ctime; + } else + fhp->fh_post_saved =3D true; if (v4) fhp->fh_post_change =3D nfsd4_change_attribute(&fhp->fh_post_attr, inode); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFF6CC433F5 for ; Tue, 25 Jan 2022 00:15:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373350AbiAYANf (ORCPT ); Mon, 24 Jan 2022 19:13:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835371AbiAXX2X (ORCPT ); Mon, 24 Jan 2022 18:28:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C7DAC06137E; Mon, 24 Jan 2022 13:33:37 -0800 (PST) Received: from smtp.kernel.org (relay.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 BED07B811FB; Mon, 24 Jan 2022 21:33:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6D9FC340E5; Mon, 24 Jan 2022 21:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060014; bh=AgnJz7sWVdzNBLyQVmv2Q5ZZKhnnlYEXfPsBXRUnz6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rbw1MWlsMXlk/y8GTGwP4rgg1C1L+oAvGUp8WaX+XgUFo+wVmkh5KvGMRYlI1oyoH fSq4BdgFlDXBLMhELZCqAFjaiKXg217AGQu6mLf4vjALECjK97tOm8QLQ5pLkfSwzt fLMuWc83FqYF7zW7ig2Fl8L4M7M2F0r1oKkooJiY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, rtm@csail.mit.edu, "J. Bruce Fields" , Chuck Lever , Olga Kornievskaia , Sasha Levin Subject: [PATCH 5.16 0811/1039] nfsd: fix crash on COPY_NOTIFY with special stateid Date: Mon, 24 Jan 2022 19:43:20 +0100 Message-Id: <20220124184152.573221726@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: J. Bruce Fields [ Upstream commit 074b07d94e0bb6ddce5690a9b7e2373088e8b33a ] RTM says "If the special ONE stateid is passed to nfs4_preprocess_stateid_op(), it returns status=3D0 but does not set *cstid. nfsd4_copy_notify() depends on stid being set if status=3D0, and thus can crash if the client sends the right COPY_NOTIFY RPC." RFC 7862 says "The cna_src_stateid MUST refer to either open or locking states provided earlier by the server. If it is invalid, then the operation MUST fail." The RFC doesn't specify an error, and the choice doesn't matter much as this is clearly illegal client behavior, but bad_stateid seems reasonable. Simplest is just to guarantee that nfs4_preprocess_stateid_op, called with non-NULL cstid, errors out if it can't return a stateid. Reported-by: rtm@csail.mit.edu Fixes: 624322f1adc5 ("NFSD add COPY_NOTIFY operation") Signed-off-by: J. Bruce Fields Signed-off-by: Chuck Lever Reviewed-by: Olga Kornievskaia Tested-by: Olga Kornievskaia Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/nfsd/nfs4state.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 1956d377d1a60..b94b3bb2b8a6e 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -6040,7 +6040,11 @@ nfs4_preprocess_stateid_op(struct svc_rqst *rqstp, *nfp =3D NULL; =20 if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) { - status =3D check_special_stateids(net, fhp, stateid, flags); + if (cstid) + status =3D nfserr_bad_stateid; + else + status =3D check_special_stateids(net, fhp, stateid, + flags); goto done; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE5C0C2BA4C for ; Tue, 25 Jan 2022 00:15:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373073AbiAYANC (ORCPT ); Mon, 24 Jan 2022 19:13:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835949AbiAXX20 (ORCPT ); Mon, 24 Jan 2022 18:28:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFFC0C075940; Mon, 24 Jan 2022 13:33:38 -0800 (PST) Received: from smtp.kernel.org (relay.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 93C07B80FA1; Mon, 24 Jan 2022 21:33:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 007F5C340E4; Mon, 24 Jan 2022 21:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060017; bh=ifDCbOlvlfDMlQSljIfCesPKWuSzZT3V2906vyaUncs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vsx3NpfSgi7qWnb05eNWT/kDcxcxJJN5TAbMdOtOzGTArC1+GZSNK5wlO5TFw1k6S zSzLEGMWRoMGD5Pp8e7w47XtUPkr8/UZ8Qz7F23ek5k5YuW31GUFOXm6ULPe+0v/qV 0gn1bEiKY/AgtD+Q+sOOiws1ZgzUlD30cyoqvuwM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vitaly Kuznetsov , Michael Kelley , Wei Liu , Sasha Levin Subject: [PATCH 5.16 0812/1039] x86/hyperv: Properly deal with empty cpumasks in hyperv_flush_tlb_multi() Date: Mon, 24 Jan 2022 19:43:21 +0100 Message-Id: <20220124184152.605053380@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov [ Upstream commit 51500b71d500f251037ed339047a4d9e7d7e295b ] KASAN detected the following issue: BUG: KASAN: slab-out-of-bounds in hyperv_flush_tlb_multi+0xf88/0x1060 Read of size 4 at addr ffff8880011ccbc0 by task kcompactd0/33 CPU: 1 PID: 33 Comm: kcompactd0 Not tainted 5.14.0-39.el9.x86_64+debug #1 Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.0 12/17/2019 Call Trace: dump_stack_lvl+0x57/0x7d print_address_description.constprop.0+0x1f/0x140 ? hyperv_flush_tlb_multi+0xf88/0x1060 __kasan_report.cold+0x7f/0x11e ? hyperv_flush_tlb_multi+0xf88/0x1060 kasan_report+0x38/0x50 hyperv_flush_tlb_multi+0xf88/0x1060 flush_tlb_mm_range+0x1b1/0x200 ptep_clear_flush+0x10e/0x150 ... Allocated by task 0: kasan_save_stack+0x1b/0x40 __kasan_kmalloc+0x7c/0x90 hv_common_init+0xae/0x115 hyperv_init+0x97/0x501 apic_intr_mode_init+0xb3/0x1e0 x86_late_time_init+0x92/0xa2 start_kernel+0x338/0x3eb secondary_startup_64_no_verify+0xc2/0xcb The buggy address belongs to the object at ffff8880011cc800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 960 bytes inside of 1024-byte region [ffff8880011cc800, ffff8880011ccc00) 'hyperv_flush_tlb_multi+0xf88/0x1060' points to hv_cpu_number_to_vp_number() and '960 bytes' means we're trying to get VP_INDEX for CPU#240. 'nr_cpus' here is exactly 240 so we're trying to access past hv_vp_index's last element. This can (and will) happen when 'cpus' mask is empty and cpumask_last() will return '>=3Dnr_cpus'. Commit ad0a6bad4475 ("x86/hyperv: check cpu mask after interrupt has been disabled") tried to deal with empty cpumask situation but apparently didn't fully fix the issue. 'cpus' cpumask which is passed to hyperv_flush_tlb_multi() is 'mm_cpumask(mm)' (which is '&mm->cpu_bitmap'). This mask changes every time the particular mm is scheduled/unscheduled on some CPU (see switch_mm_irqs_off()), disabling IRQs on the CPU which is performing remote TLB flush has zero influence on whether the particular process can get scheduled/unscheduled on _other_ CPUs so e.g. in the case where the mm was scheduled on one other CPU and got unscheduled during hyperv_flush_tlb_multi()'s execution will lead to cpumask becoming empty. It doesn't seem that there's a good way to protect 'mm_cpumask(mm)' from changing during hyperv_flush_tlb_multi()'s execution. It would be possible to copy it in the very beginning of the function but this is a waste. It seems we can deal with changing cpumask just fine. When 'cpus' cpumask changes during hyperv_flush_tlb_multi()'s execution, there are two possible issues: - 'Under-flushing': we will not flush TLB on a CPU which got added to the mask while hyperv_flush_tlb_multi() was already running. This is not a problem as this is equal to mm getting scheduled on that CPU right after TLB flush. - 'Over-flushing': we may flush TLB on a CPU which is already cleared from the mask. First, extra TLB flush preserves correctness. Second, Hyper-V's TLB flush hypercall takes 'mm->pgd' argument so Hyper-V may avoid the flush if CR3 doesn't match. Fix the immediate issue with cpumask_last()/hv_cpu_number_to_vp_number() and remove the pointless cpumask_empty() check from the beginning of the function as it really doesn't protect anything. Also, avoid the hypercall altogether when 'flush->processor_mask' ends up being empty. Fixes: ad0a6bad4475 ("x86/hyperv: check cpu mask after interrupt has been d= isabled") Signed-off-by: Vitaly Kuznetsov Reviewed-by: Michael Kelley Link: https://lore.kernel.org/r/20220106094611.1404218-1-vkuznets@redhat.com Signed-off-by: Wei Liu Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/hyperv/mmu.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c index bd13736d0c054..0ad2378fe6ad7 100644 --- a/arch/x86/hyperv/mmu.c +++ b/arch/x86/hyperv/mmu.c @@ -68,15 +68,6 @@ static void hyperv_flush_tlb_multi(const struct cpumask = *cpus, =20 local_irq_save(flags); =20 - /* - * Only check the mask _after_ interrupt has been disabled to avoid the - * mask changing under our feet. - */ - if (cpumask_empty(cpus)) { - local_irq_restore(flags); - return; - } - flush_pcpu =3D (struct hv_tlb_flush **) this_cpu_ptr(hyperv_pcpu_input_arg); =20 @@ -115,7 +106,9 @@ static void hyperv_flush_tlb_multi(const struct cpumask= *cpus, * must. We will also check all VP numbers when walking the * supplied CPU set to remain correct in all cases. */ - if (hv_cpu_number_to_vp_number(cpumask_last(cpus)) >=3D 64) + cpu =3D cpumask_last(cpus); + + if (cpu < nr_cpumask_bits && hv_cpu_number_to_vp_number(cpu) >=3D 64) goto do_ex_hypercall; =20 for_each_cpu(cpu, cpus) { @@ -131,6 +124,12 @@ static void hyperv_flush_tlb_multi(const struct cpumas= k *cpus, __set_bit(vcpu, (unsigned long *) &flush->processor_mask); } + + /* nothing to flush if 'processor_mask' ends up being empty */ + if (!flush->processor_mask) { + local_irq_restore(flags); + return; + } } =20 /* --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF574C433FE for ; Mon, 24 Jan 2022 22:31:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587205AbiAXW14 (ORCPT ); Mon, 24 Jan 2022 17:27:56 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46782 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454796AbiAXVdn (ORCPT ); Mon, 24 Jan 2022 16:33:43 -0500 Received: from smtp.kernel.org (relay.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 7F1D2B81233; Mon, 24 Jan 2022 21:33:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2FFAC340E4; Mon, 24 Jan 2022 21:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060020; bh=yg7nmv7uay7Pj6NDNSVSmBGl9495vlN68aIKhTtxQGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JryVdkoJskiRSaJ+mlp07iig0a9C2hpf0YIyOTXj15pRJWrr3icUdCjH46gx9j3p3 pGirozeVxzco9MaI9ckdMuv3x0YyhHCSSq0Swt9xvQcLj0P1g1iBr0WSe1eriwAEB/ 9x3EvICcTczPm9CRhKSCpUL1bVEGv2yCP55SrzD8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lee Shawn C , Juston Li , Daniele Ceraolo Spurio , John Harrison , Tvrtko Ursulin , Sasha Levin Subject: [PATCH 5.16 0813/1039] drm/i915/pxp: Hold RPM wakelock during PXP unbind Date: Mon, 24 Jan 2022 19:43:22 +0100 Message-Id: <20220124184152.635190440@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Juston Li [ Upstream commit f9535d28ac93c3cc326f7215fccd0abe1d3a6083 ] Similar to commit b8d8436840ca ("drm/i915/gt: Hold RPM wakelock during PXP suspend") but to fix the same warning for unbind during shutdown: Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz ------------[ cut here ]------------ RPM wakelock ref not held during HW access WARNING: CPU: 0 PID: 4139 at drivers/gpu/drm/i915/intel_runtime_pm.h:115 gen12_fwtable_write32+0x1b7/0 Modules linked in: 8021q ccm rfcomm cmac algif_hash algif_skcipher af_alg uinput snd_hda_codec_hdmi vf industrialio iwl7000_mac80211 cros_ec_sensorhub lzo_rle lzo_compress zram iwlwifi cfg80211 joydev CPU: 0 PID: 4139 Comm: halt Tainted: G U W 5.10.84 #13 344e11e079c4a03940d949e537eab645f6 RIP: 0010:gen12_fwtable_write32+0x1b7/0x200 Code: 48 c7 c7 fc b3 b5 89 31 c0 e8 2c f3 ad ff 0f 0b e9 04 ff ff ff c6 05 71 e9 1d 01 01 48 c7 c7 d67 RSP: 0018:ffffa09ec0bb3bb0 EFLAGS: 00010246 RAX: 12dde97bbd260300 RBX: 00000000000320f0 RCX: ffffffff89e60ea0 RDX: 0000000000000000 RSI: 00000000ffffdfff RDI: ffffffff89e60e70 RBP: ffffa09ec0bb3bd8 R08: 0000000000000000 R09: ffffa09ec0bb3950 R10: 00000000ffffdfff R11: ffffffff89e91160 R12: 0000000000000000 R13: 0000000028121969 R14: ffff9515c32f0990 R15: 0000000040000000 FS: 0000790dcf225740(0000) GS:ffff951737800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000058b25efae147 CR3: 0000000133ea6001 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff07f0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: intel_pxp_fini_hw+0x2f/0x39 i915_pxp_tee_component_unbind+0x1c/0x42 component_unbind+0x32/0x48 component_unbind_all+0x80/0x9d take_down_master+0x24/0x36 component_master_del+0x56/0x70 mei_pxp_remove+0x2c/0x68 mei_cl_device_remove+0x35/0x68 device_release_driver_internal+0x100/0x1a1 mei_cl_bus_remove_device+0x21/0x79 mei_cl_bus_remove_devices+0x3b/0x51 mei_stop+0x3b/0xae mei_me_shutdown+0x23/0x58 device_shutdown+0x144/0x1d3 kernel_power_off+0x13/0x4c __se_sys_reboot+0x1d4/0x1e9 do_syscall_64+0x43/0x55 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x790dcf316273 Code: 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 89 fa be 69 19 12 28 bf ad8 RSP: 002b:00007ffca0df9198 EFLAGS: 00000202 ORIG_RAX: 00000000000000a9 RAX: ffffffffffffffda RBX: 000000004321fedc RCX: 0000790dcf316273 RDX: 000000004321fedc RSI: 0000000028121969 RDI: 00000000fee1dead RBP: 00007ffca0df9200 R08: 0000000000000007 R09: 0000563ce8cd8970 R10: 0000000000000000 R11: 0000000000000202 R12: 00007ffca0df9308 R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000003 ---[ end trace 2f501b01b348f114 ]--- ACPI: Preparing to enter system sleep state S5 reboot: Power down Changes since v1: - Rebase to latest drm-tip Fixes: 0cfab4cb3c4e ("drm/i915/pxp: Enable PXP power management") Suggested-by: Lee Shawn C Signed-off-by: Juston Li Reviewed-by: Daniele Ceraolo Spurio Signed-off-by: John Harrison Link: https://patchwork.freedesktop.org/patch/msgid/20220106200236.489656-2= -juston.li@intel.com (cherry picked from commit 57ded5fc98b11d76dae505ca3591b61c9dbbbda7) Signed-off-by: Tvrtko Ursulin Signed-off-by: Sasha Levin --- drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c b/drivers/gpu/drm/i91= 5/pxp/intel_pxp_tee.c index 49508f31dcb73..d2980370d9297 100644 --- a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c @@ -103,9 +103,12 @@ static int i915_pxp_tee_component_bind(struct device *= i915_kdev, static void i915_pxp_tee_component_unbind(struct device *i915_kdev, struct device *tee_kdev, void *data) { + struct drm_i915_private *i915 =3D kdev_to_i915(i915_kdev); struct intel_pxp *pxp =3D i915_dev_to_pxp(i915_kdev); + intel_wakeref_t wakeref; =20 - intel_pxp_fini_hw(pxp); + with_intel_runtime_pm_if_in_use(&i915->runtime_pm, wakeref) + intel_pxp_fini_hw(pxp); =20 mutex_lock(&pxp->tee_mutex); pxp->pxp_component =3D NULL; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4B8DC4332F for ; Mon, 24 Jan 2022 22:31:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587221AbiAXW16 (ORCPT ); Mon, 24 Jan 2022 17:27:58 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45714 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454817AbiAXVdp (ORCPT ); Mon, 24 Jan 2022 16:33:45 -0500 Received: from smtp.kernel.org (relay.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 922CBB80FA1; Mon, 24 Jan 2022 21:33:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4ADDC340E5; Mon, 24 Jan 2022 21:33:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060023; bh=UmrV72hs4fkCPVZC9sUSZ23FItTS0o2fU/PF43t+HqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HQlSNmprdCr0FL/n0rtHqUGsYjVMJVCSWxyaLkaayugBTH7wrlNzm8zsIj6lXtNKx UGjI1aKCknebtw0AlBAkMbWFmYsKqxTB9iGBdPwJyHiVNJKGDSgJvpi+2ED7UCmcr/ XjY73pi/wp5gPpB/cHdGjx3rvWMqzVx0vLWHbWmA= 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?= , Tvrtko Ursulin , Sasha Levin Subject: [PATCH 5.16 0814/1039] drm/i915: dont call free_mmap_offset when purging Date: Mon, 24 Jan 2022 19:43:23 +0100 Message-Id: <20220124184152.665968323@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 4c2602ba8d74c35d550ed3d518809c697de08d88 ] The TTM backend is in theory the only user here(also purge should only be called once we have dropped the pages), where it is setup at object creation and is only removed once the object is destroyed. Also resetting the node here might be iffy since the ttm fault handler uses the stored fake offset to determine the page offset within the pages array. This also blows up in the dontneed-before-mmap test, since the expectation is that the vma_node will live on, until the object is destroyed: <2> [749.062902] kernel BUG at drivers/gpu/drm/i915/gem/i915_gem_ttm.c:943! <4> [749.062923] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI <4> [749.062928] CPU: 0 PID: 1643 Comm: gem_madvise Tainted: G U W = 5.16.0-rc8-CI-CI_DRM_11046+ #1 <4> [749.062933] Hardware name: Gigabyte Technology Co., Ltd. GB-Z390 Garud= a/GB-Z390 Garuda-CF, BIOS IG1c 11/19/2019 <4> [749.062937] RIP: 0010:i915_ttm_mmap_offset.cold.35+0x5b/0x5d [i915] <4> [749.063044] Code: 00 48 c7 c2 a0 23 4e a0 48 c7 c7 26 df 4a a0 e8 95 1= d d0 e0 bf 01 00 00 00 e8 8b ec cf e0 31 f6 bf 09 00 00 00 e8 5f 30 c0 e0 <= 0f> 0b 48 c7 c1 24 4b 56 a0 ba 5b 03 00 00 48 c7 c6 c0 23 4e a0 48 <4> [749.063052] RSP: 0018:ffffc90002ab7d38 EFLAGS: 00010246 <4> [749.063056] RAX: 0000000000000240 RBX: ffff88811f2e61c0 RCX: 000000000= 0000006 <4> [749.063060] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000000= 0000009 <4> [749.063063] RBP: ffffc90002ab7e58 R08: 0000000000000001 R09: 000000000= 0000001 <4> [749.063067] R10: 000000000123d0f8 R11: ffffc90002ab7b20 R12: ffff88811= 2a1a000 <4> [749.063071] R13: 0000000000000004 R14: ffff88811f2e61c0 R15: ffff88811= 2a1a000 <4> [749.063074] FS: 00007f6e5fcad500(0000) GS:ffff8884ad600000(0000) knlG= S:0000000000000000 <4> [749.063078] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 <4> [749.063081] CR2: 00007efd264e39f0 CR3: 0000000115fd6005 CR4: 000000000= 03706f0 <4> [749.063085] Call Trace: <4> [749.063087] <4> [749.063089] __assign_mmap_offset+0x41/0x300 [i915] <4> [749.063171] __assign_mmap_offset_handle+0x159/0x270 [i915] <4> [749.063248] ? i915_gem_dumb_mmap_offset+0x70/0x70 [i915] <4> [749.063325] drm_ioctl_kernel+0xae/0x140 <4> [749.063330] drm_ioctl+0x201/0x3d0 <4> [749.063333] ? i915_gem_dumb_mmap_offset+0x70/0x70 [i915] <4> [749.063409] ? do_user_addr_fault+0x200/0x670 <4> [749.063415] __x64_sys_ioctl+0x6d/0xa0 <4> [749.063419] do_syscall_64+0x3a/0xb0 <4> [749.063423] entry_SYSCALL_64_after_hwframe+0x44/0xae <4> [749.063428] RIP: 0033:0x7f6e5f100317 Testcase: igt/gem_madvise/dontneed-before-mmap Fixes: cf3e3e86d779 ("drm/i915: Use ttm mmap handling for ttm bo's.") Signed-off-by: Matthew Auld Cc: Thomas Hellstr=C3=B6m Reviewed-by: Thomas Hellstr=C3=B6m Link: https://patchwork.freedesktop.org/patch/msgid/20220106174910.280616-1= -matthew.auld@intel.com (cherry picked from commit 658a0c632625e1db51837ff754fe18a6a7f2ccf8) Signed-off-by: Tvrtko Ursulin Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i9= 15/gem/i915_gem_pages.c index 8eb1c3a6fc9cd..1d3f40abd0258 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c @@ -160,7 +160,6 @@ retry: /* Immediately discard the backing storage */ void i915_gem_object_truncate(struct drm_i915_gem_object *obj) { - drm_gem_free_mmap_offset(&obj->base); if (obj->ops->truncate) obj->ops->truncate(obj); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F243C433F5 for ; Mon, 24 Jan 2022 22:31:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587237AbiAXW17 (ORCPT ); Mon, 24 Jan 2022 17:27:59 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53228 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454827AbiAXVdy (ORCPT ); Mon, 24 Jan 2022 16:33:54 -0500 Received: from smtp.kernel.org (relay.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 4277B614D9; Mon, 24 Jan 2022 21:33:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 169A9C340E4; Mon, 24 Jan 2022 21:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060029; bh=V51i5NSzuvI4kZFN8M+AscwhplgJFBRBDz7wg7aMuqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sR09uEvQimogDHClWp0xGuX5xV4nh+J9S4T8mAsPbXp/Xflbr5dvxOqNJtJ2G4qm1 7tXmfCEZdKWnM35OfiRI73TnAdJvcfJrnaVRtYDqlmCaQTQl8tGeM6qjW8B8qWDLSB XbMTUGZ3xpQuaDjVRFc2R1LPxmapmtfAD7s51h/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Sasha Levin Subject: [PATCH 5.16 0815/1039] SUNRPC: Fix sockaddr handling in the svc_xprt_create_error trace point Date: Mon, 24 Jan 2022 19:43:24 +0100 Message-Id: <20220124184152.700408346@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit dc6c6fb3d639756a532bcc47d4a9bf9f3965881b ] While testing, I got an unexpected KASAN splat: Jan 08 13:50:27 oracle-102.nfsv4.dev kernel: BUG: KASAN: stack-out-of-bound= s in trace_event_raw_event_svc_xprt_create_err+0x190/0x210 [sunrpc] Jan 08 13:50:27 oracle-102.nfsv4.dev kernel: Read of size 28 at addr ffffc9= 000008f728 by task mount.nfs/4628 The memcpy() in the TP_fast_assign section of this trace point copies the size of the destination buffer in order that the buffer won't be overrun. In other similar trace points, the source buffer for this memcpy is a "struct sockaddr_storage" so the actual length of the source buffer is always long enough to prevent the memcpy from reading uninitialized or unallocated memory. However, for this trace point, the source buffer can be as small as a "struct sockaddr_in". For AF_INET sockaddrs, the memcpy() reads memory that follows the source buffer, which is not always valid memory. To avoid copying past the end of the passed-in sockaddr, make the source address's length available to the memcpy(). It would be a little nicer if the tracing infrastructure was more friendly about storing socket addresses that are not AF_INET, but I could not find a way to make printk("%pIS") work with a dynamic array. Reported-by: KASAN Fixes: 4b8f380e46e4 ("SUNRPC: Tracepoint to record errors in svc_xpo_create= ()") Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/trace/events/sunrpc.h | 5 +++-- net/sunrpc/svc_xprt.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h index 3a99358c262b4..52288f1c1b52d 100644 --- a/include/trace/events/sunrpc.h +++ b/include/trace/events/sunrpc.h @@ -1744,10 +1744,11 @@ TRACE_EVENT(svc_xprt_create_err, const char *program, const char *protocol, struct sockaddr *sap, + size_t salen, const struct svc_xprt *xprt ), =20 - TP_ARGS(program, protocol, sap, xprt), + TP_ARGS(program, protocol, sap, salen, xprt), =20 TP_STRUCT__entry( __field(long, error) @@ -1760,7 +1761,7 @@ TRACE_EVENT(svc_xprt_create_err, __entry->error =3D PTR_ERR(xprt); __assign_str(program, program); __assign_str(protocol, protocol); - memcpy(__entry->addr, sap, sizeof(__entry->addr)); + memcpy(__entry->addr, sap, min(salen, sizeof(__entry->addr))); ), =20 TP_printk("addr=3D%pISpc program=3D%s protocol=3D%s error=3D%ld", diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 1e99ba1b9d723..008f1b05a7a9f 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c @@ -243,7 +243,7 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xpr= t_class *xcl, xprt =3D xcl->xcl_ops->xpo_create(serv, net, sap, len, flags); if (IS_ERR(xprt)) trace_svc_xprt_create_err(serv->sv_program->pg_name, - xcl->xcl_name, sap, xprt); + xcl->xcl_name, sap, len, xprt); return xprt; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 888D9C4332F for ; Tue, 25 Jan 2022 00:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373334AbiAYANe (ORCPT ); Mon, 24 Jan 2022 19:13:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837811AbiAXX23 (ORCPT ); Mon, 24 Jan 2022 18:28:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71509C075944; Mon, 24 Jan 2022 13:33:55 -0800 (PST) Received: from smtp.kernel.org (relay.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 2F095B8123A; Mon, 24 Jan 2022 21:33:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5424C340E7; Mon, 24 Jan 2022 21:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060032; bh=ABEAfmidjsjbLbKwr52w0wjGu7YGjdn3QnaXSOEAMvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2NLrEb04sIQzcnspcYaHfORHQHYE7oxax7OtWHMi2hmh/mG08YiB9YoqxS3uKeSof FHefPtJbYIEvnLgJPGh5ZSUfBPO/l/HtO3VULk1+y2OaOqFkDAGsp7aLuMx25YpoYT 4dGI9delSaDrqWT7ngH0Mm1locVuqfCG7DiXSWlk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Sasha Levin Subject: [PATCH 5.16 0816/1039] SUNRPC: Fix sockaddr handling in svcsock_accept_class trace points Date: Mon, 24 Jan 2022 19:43:25 +0100 Message-Id: <20220124184152.731952293@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 16720861675393a35974532b3c837d9fd7bfe08c ] Avoid potentially hazardous memory copying and the needless use of "%pIS" -- in the kernel, an RPC service listener is always bound to ANYADDR. Having the network namespace is helpful when recording errors, though. Fixes: a0469f46faab ("SUNRPC: Replace dprintk call sites in TCP state chang= e callouts") Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/trace/events/sunrpc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h index 52288f1c1b52d..7b5dcff84cf27 100644 --- a/include/trace/events/sunrpc.h +++ b/include/trace/events/sunrpc.h @@ -2147,17 +2147,17 @@ DECLARE_EVENT_CLASS(svcsock_accept_class, TP_STRUCT__entry( __field(long, status) __string(service, service) - __array(unsigned char, addr, sizeof(struct sockaddr_in6)) + __field(unsigned int, netns_ino) ), =20 TP_fast_assign( __entry->status =3D status; __assign_str(service, service); - memcpy(__entry->addr, &xprt->xpt_local, sizeof(__entry->addr)); + __entry->netns_ino =3D xprt->xpt_net->ns.inum; ), =20 - TP_printk("listener=3D%pISpc service=3D%s status=3D%ld", - __entry->addr, __get_str(service), __entry->status + TP_printk("addr=3Dlistener service=3D%s status=3D%ld", + __get_str(service), __entry->status ) ); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62B4DC433EF for ; Tue, 25 Jan 2022 00:18:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374562AbiAYARW (ORCPT ); Mon, 24 Jan 2022 19:17:22 -0500 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 S1839675AbiAXX2d (ORCPT ); Mon, 24 Jan 2022 18:28:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1A57C075948; Mon, 24 Jan 2022 13:33:56 -0800 (PST) Received: from smtp.kernel.org (relay.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 6E44961305; Mon, 24 Jan 2022 21:33:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51596C340E4; Mon, 24 Jan 2022 21:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060035; bh=2E50KrbVkwR/nqccvG/b6nh+kvOETHtkUWtyTvxMPhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=daUYLoYmfrc/Hl+Erm14FufKXPamXWwdPgCQTKa2jFgPR45gGc9nvWEgoeG1+hDAM 1QIJecWBdPtK9Ysu8530v8rxGWg8DO++UVyKAaZNlBuo7cjQRbkU61yph3Q8wCyDj4 L77SZlvLocbADiaJu2a27mnry5DOoCBiyXWHgZRI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Maxime Ripard , Sasha Levin Subject: [PATCH 5.16 0817/1039] drm/sun4i: dw-hdmi: Fix missing put_device() call in sun8i_hdmi_phy_get Date: Mon, 24 Jan 2022 19:43:26 +0100 Message-Id: <20220124184152.769352289@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit c71af3dae3e34d2fde0c19623cf7f8483321f0e3 ] The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add the corresponding 'put_device()' in the error handling path. Fixes: 9bf3797796f5 ("drm/sun4i: dw-hdmi: Make HDMI PHY into a platform dev= ice") Signed-off-by: Miaoqian Lin Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20220107083633.20843-1-= linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i= /sun8i_hdmi_phy.c index b64d93da651d2..5e2b0175df36f 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -658,8 +658,10 @@ int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, str= uct device_node *node) return -EPROBE_DEFER; =20 phy =3D platform_get_drvdata(pdev); - if (!phy) + if (!phy) { + put_device(&pdev->dev); return -EPROBE_DEFER; + } =20 hdmi->phy =3D phy; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47AEFC43217 for ; Mon, 24 Jan 2022 22:31:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587308AbiAXW2E (ORCPT ); Mon, 24 Jan 2022 17:28:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45900 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454866AbiAXVeB (ORCPT ); Mon, 24 Jan 2022 16:34:01 -0500 Received: from smtp.kernel.org (relay.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 E870AB8123A; Mon, 24 Jan 2022 21:33:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B60EC340E4; Mon, 24 Jan 2022 21:33:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060038; bh=R8/1XpnUCRmWuxRq57W415mmpgzGhzNlkkynV5S82N0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONeBL5Gsat1wRL+yUfAG109shpgcP7hJC1dKEo5TaVH6BXZ34Iq22qnkggFbS53/k 56YAn1J814O525y6s2MK4XfXDQWHqLphJS5p0xGuLt9Qi9TC7ij2+aKbniRyjw/o53 QLi5oWqapXKdvmk4lyWexFlihdCmelatJdiBxa5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Paul , Rob Clark , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Alex Deucher , Liu Ying , Sasha Levin Subject: [PATCH 5.16 0818/1039] drm/atomic: Check new_crtc_state->active to determine if CRTC needs disable in self refresh mode Date: Mon, 24 Jan 2022 19:43:27 +0100 Message-Id: <20220124184152.800331782@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liu Ying [ Upstream commit 69e630016ef4e4a1745310c446f204dc6243e907 ] Actual hardware state of CRTC is controlled by the member 'active' in struct drm_crtc_state instead of the member 'enable', according to the kernel doc of the member 'enable'. In fact, the drm client modeset and atomic helpers are using the member 'active' to do the control. Referencing the member 'enable' of new_crtc_state, the function crtc_needs_disable() may fail to reflect if CRTC needs disable in self refresh mode, e.g., when the framebuffer emulation will be blanked through the client modeset helper with the next commit, the member 'enable' of new_crtc_state is still true while the member 'active' is false, hence the relevant potential encoder and bridges won't be disabled. So, let's check new_crtc_state->active to determine if CRTC needs disable in self refresh mode instead of new_crtc_state->enable. Fixes: 1452c25b0e60 ("drm: Add helpers to kick off self refresh mode in dri= vers") Cc: Sean Paul Cc: Rob Clark Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Reviewed-by: Alex Deucher Signed-off-by: Liu Ying Signed-off-by: Alex Deucher Link: https://patchwork.freedesktop.org/patch/msgid/20211230040626.646807-1= -victor.liu@nxp.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/drm_atomic_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atom= ic_helper.c index 2c0c6ec928200..ff2bc9a118011 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1001,7 +1001,7 @@ crtc_needs_disable(struct drm_crtc_state *old_state, * it's in self refresh mode and needs to be fully disabled. */ return old_state->active || - (old_state->self_refresh_active && !new_state->enable) || + (old_state->self_refresh_active && !new_state->active) || new_state->self_refresh_active; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4873BC3526D for ; Tue, 25 Jan 2022 00:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373302AbiAYANb (ORCPT ); Mon, 24 Jan 2022 19:13:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841162AbiAXX2d (ORCPT ); Mon, 24 Jan 2022 18:28:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FB87C075951; Mon, 24 Jan 2022 13:34:02 -0800 (PST) Received: from smtp.kernel.org (relay.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 2F88D61305; Mon, 24 Jan 2022 21:34:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DAC8C340E4; Mon, 24 Jan 2022 21:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060041; bh=ZRudVY4cCl8/MQQO5V8VjUC2mo62hikaH/uo7E/qylE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OQDubghmpfXcXk7zXNdKok0fI7mDKQpULL/tCqin1osYycLXS0Tr5MrDumPuVYclA CO97lsOmMeLAEnZNzFV717zS1xNzqnQ9MX/6nwymOhG7mSYoJ9EBZIxIRiLdhOKDwP PT4wSmodJw+umF4XDamUtAmRPtHKyF39qcN0L+xY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeremy Pallotta , Kelvin Cao , Jon Mason , Sasha Levin Subject: [PATCH 5.16 0819/1039] ntb_hw_switchtec: Fix pff ioread to read into mmio_part_cfg_all Date: Mon, 24 Jan 2022 19:43:28 +0100 Message-Id: <20220124184152.831999577@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeremy Pallotta [ Upstream commit 32c3d375b0ed84b6acb51ae5ebef35ff0d649d85 ] Array mmio_part_cfg_all holds the partition configuration of all partitions, with partition number as index. Fix this by reading into mmio_part_cfg_all for pff. Fixes: 0ee28f26f378 ("NTB: switchtec_ntb: Add link management") Signed-off-by: Jeremy Pallotta Signed-off-by: Kelvin Cao Signed-off-by: Jon Mason Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/n= tb_hw_switchtec.c index 4c6eb61a6ac62..6603c77c0a848 100644 --- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c +++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c @@ -419,8 +419,8 @@ static void switchtec_ntb_part_link_speed(struct switch= tec_ntb *sndev, enum ntb_width *width) { struct switchtec_dev *stdev =3D sndev->stdev; - - u32 pff =3D ioread32(&stdev->mmio_part_cfg[partition].vep_pff_inst_id); + u32 pff =3D + ioread32(&stdev->mmio_part_cfg_all[partition].vep_pff_inst_id); u32 linksta =3D ioread32(&stdev->mmio_pff_csr[pff].pci_cap_region[13]); =20 if (speed) --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C506C433EF for ; Tue, 25 Jan 2022 00:31:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410641AbiAYA3k (ORCPT ); Mon, 24 Jan 2022 19:29:40 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45920 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454930AbiAXVeP (ORCPT ); Mon, 24 Jan 2022 16:34:15 -0500 Received: from smtp.kernel.org (relay.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 CC226B81257; Mon, 24 Jan 2022 21:34:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02FBDC340E4; Mon, 24 Jan 2022 21:34:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060044; bh=PuPDInC1r/GLcY+Vi+sQObVdNBoB1cbEQ8SKVAlGUU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V2UAReNXan+TmlkIrx4VZj6ZYo1NdeshC46cTh6x5ry9jtGg2X5XaRxHcTag4njXk Z6FbmBmsNK/bZbClHDmajnH4F3WZrJQ27h2zLp3WLKEx1xi5afJ3BXd++RQ9akBgKg Yms/TgNhwfs9dQl4DXdgLsDdoLOScyx3zo7LFJf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wesley Sheng , Kelvin Cao , Jon Mason , Sasha Levin Subject: [PATCH 5.16 0820/1039] ntb_hw_switchtec: Fix bug with more than 32 partitions Date: Mon, 24 Jan 2022 19:43:29 +0100 Message-Id: <20220124184152.866189101@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wesley Sheng [ Upstream commit 7ff351c86b6b258f387502ab2c9b9d04f82c1c3d ] Switchtec could support as mush as 48 partitions, but ffs & fls are for 32 bit argument, in case of partition index larger than 31, the current code could not parse the peer partition index correctly. Change to the 64 bit version __ffs64 & fls64 accordingly to fix this bug. Fixes: 3df54c870f52 ("ntb_hw_switchtec: Allow using Switchtec NTB in multi-= partition setups") Signed-off-by: Wesley Sheng Signed-off-by: Kelvin Cao Signed-off-by: Jon Mason Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/n= tb_hw_switchtec.c index 6603c77c0a848..ec9cb6c81edae 100644 --- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c +++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c @@ -840,7 +840,6 @@ static int switchtec_ntb_init_sndev(struct switchtec_nt= b *sndev) u64 tpart_vec; int self; u64 part_map; - int bit; =20 sndev->ntb.pdev =3D sndev->stdev->pdev; sndev->ntb.topo =3D NTB_TOPO_SWITCH; @@ -861,29 +860,28 @@ static int switchtec_ntb_init_sndev(struct switchtec_= ntb *sndev) part_map =3D ioread64(&sndev->mmio_ntb->ep_map); part_map &=3D ~(1 << sndev->self_partition); =20 - if (!ffs(tpart_vec)) { + if (!tpart_vec) { if (sndev->stdev->partition_count !=3D 2) { dev_err(&sndev->stdev->dev, "ntb target partition not defined\n"); return -ENODEV; } =20 - bit =3D ffs(part_map); - if (!bit) { + if (!part_map) { dev_err(&sndev->stdev->dev, "peer partition is not NT partition\n"); return -ENODEV; } =20 - sndev->peer_partition =3D bit - 1; + sndev->peer_partition =3D __ffs64(part_map); } else { - if (ffs(tpart_vec) !=3D fls(tpart_vec)) { + if (__ffs64(tpart_vec) !=3D (fls64(tpart_vec) - 1)) { dev_err(&sndev->stdev->dev, "ntb driver only supports 1 pair of 1-1 ntb mapping\n"); return -ENODEV; } =20 - sndev->peer_partition =3D ffs(tpart_vec) - 1; + sndev->peer_partition =3D __ffs64(tpart_vec); if (!(part_map & (1ULL << sndev->peer_partition))) { dev_err(&sndev->stdev->dev, "ntb target partition is not NT partition\n"); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65485C3526C for ; Tue, 25 Jan 2022 00:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373317AbiAYANd (ORCPT ); Mon, 24 Jan 2022 19:13:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1839672AbiAXX2d (ORCPT ); Mon, 24 Jan 2022 18:28:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A79AC075955; Mon, 24 Jan 2022 13:34:08 -0800 (PST) Received: from smtp.kernel.org (relay.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 2BAD061305; Mon, 24 Jan 2022 21:34:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 103CCC340E4; Mon, 24 Jan 2022 21:34:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060047; bh=+gYox5gfMlmqNO1wkoe6FTEVu8N04dhY/8LJMhA6gtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AymDe3G0Zu2Myo6385zcKsllOXyiZ0Lj5vMfSmzGpX+gyatf+5k3u9LE8dFYNkZNs 5UrlDzct1VoLPqMKUFGfbY0jWNEf/DgjX5hb8zPTEB9I7LmZfFZB988lBJ5IWgif8y IXA3a84r+kbABDKJW1ifVEH1IIkwb6B+LAdNbXWc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Wentland , =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0821/1039] drm/amd/display: invalid parameter check in dmub_hpd_callback Date: Mon, 24 Jan 2022 19:43:30 +0100 Message-Id: <20220124184152.897816208@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit 978ffac878fd64039f95798b15b430032d2d89d5 ] The function performs a check on the "adev" input parameter, however, it is used before the check. Initialize the "dev" variable after the sanity check to avoid a possible NULL pointer dereference. Fixes: e27c41d5b0681 ("drm/amd/display: Support for DMUB HPD interrupt hand= ling") Addresses-Coverity-ID: 1493909 ("Null pointer dereference") Reviewed-by: Harry Wentland Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gp= u/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 46d38d528468c..3a227e9d8dfcb 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -656,7 +656,7 @@ void dmub_hpd_callback(struct amdgpu_device *adev, stru= ct dmub_notification *not struct drm_connector_list_iter iter; struct dc_link *link; uint8_t link_index =3D 0; - struct drm_device *dev =3D adev->dm.ddev; + struct drm_device *dev; =20 if (adev =3D=3D NULL) return; @@ -673,6 +673,7 @@ void dmub_hpd_callback(struct amdgpu_device *adev, stru= ct dmub_notification *not =20 link_index =3D notify->link_index; link =3D adev->dm.dc->links[link_index]; + dev =3D adev->dm.ddev; =20 drm_connector_list_iter_begin(dev, &iter); drm_for_each_connector_iter(connector, &iter) { --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C89D6C4332F for ; Mon, 24 Jan 2022 22:30:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587364AbiAXW2L (ORCPT ); Mon, 24 Jan 2022 17:28:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47052 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454982AbiAXVeQ (ORCPT ); Mon, 24 Jan 2022 16:34:16 -0500 Received: from smtp.kernel.org (relay.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 CC08DB8123D; Mon, 24 Jan 2022 21:34:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC18AC340E4; Mon, 24 Jan 2022 21:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060050; bh=zDHN0pvH5VbPZU6z9GYhPXlHtcv0MaHvgRH814qRAaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gqdRlHxtnuHtzvuK5LNvObnS9JU9UAw0zG4gjRz+V+udDzzXaW/sylwHwkKeuXBfK spGGOjseoLlEDZvyPBI+K9ADqnzfQ/LifdRUofFCCt7StR1qlNxjcChFNfDQJkBkFl FGgviaIH+zy/7FJczD3+MX5YoxqHVvHcqFVw/y1Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Felix Kuehling , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0822/1039] drm/amdkfd: Check for null pointer after calling kmemdup Date: Mon, 24 Jan 2022 19:43:31 +0100 Message-Id: <20220124184152.928542031@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit abfaf0eee97925905e742aa3b0b72e04a918fa9e ] As the possible failure of the allocation, kmemdup() may return NULL pointer. Therefore, it should be better to check the 'props2' in order to prevent the dereference of NULL pointer. Fixes: 3a87177eb141 ("drm/amdkfd: Add topology support for dGPUs") Signed-off-by: Jiasheng Jiang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/am= dkfd/kfd_crat.c index cfedfb1e8596c..c33d689f29e8e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c @@ -1060,6 +1060,9 @@ static int kfd_parse_subtype_iolink(struct crat_subty= pe_iolink *iolink, return -ENODEV; /* same everything but the other direction */ props2 =3D kmemdup(props, sizeof(*props2), GFP_KERNEL); + if (!props2) + return -ENOMEM; + props2->node_from =3D id_to; props2->node_to =3D id_from; props2->kobj =3D NULL; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F55AC433F5 for ; Mon, 24 Jan 2022 22:30:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587397AbiAXW2O (ORCPT ); Mon, 24 Jan 2022 17:28:14 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51444 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454974AbiAXVeP (ORCPT ); Mon, 24 Jan 2022 16:34:15 -0500 Received: from smtp.kernel.org (relay.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 ECD0B61305; Mon, 24 Jan 2022 21:34:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D10F6C340E4; Mon, 24 Jan 2022 21:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060053; bh=nRMkltgKgdbuMr9XsmL+FvkFhQmImYJklYWMTfuJkEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O2Uyj1b7qyl/d+Uh/DHLTlrgSwioi97jT5+7I2DDTgkJZ9v3Gq6MR8lLnp993oKgS 3mduPUVog7slhAgyAs/KeOubUCGh9eLQT2vtVj7+Q2GfNQ00uF/V0qCRjXcVzyDTxh xPyeBpesHE9DkFYBcbVp1Z5r+MFwEDn0o4t/Qvu0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guchun Chen , Alex Deucher , Kelly Zytaruk , Sasha Levin Subject: [PATCH 5.16 0823/1039] drm/amdgpu: use spin_lock_irqsave to avoid deadlock by local interrupt Date: Mon, 24 Jan 2022 19:43:32 +0100 Message-Id: <20220124184152.959306615@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guchun Chen [ Upstream commit 2096b74b1da5ca418827b54ac4904493bd9de89c ] This is observed in SRIOV case with virtual KMS as display. _raw_spin_lock_irqsave+0x37/0x40 drm_handle_vblank+0x69/0x350 [drm] ? try_to_wake_up+0x432/0x5c0 ? amdgpu_vkms_prepare_fb+0x1c0/0x1c0 [amdgpu] drm_crtc_handle_vblank+0x17/0x20 [drm] amdgpu_vkms_vblank_simulate+0x4d/0x80 [amdgpu] __hrtimer_run_queues+0xfb/0x230 hrtimer_interrupt+0x109/0x220 __sysvec_apic_timer_interrupt+0x64/0xe0 asm_call_irq_on_stack+0x12/0x20 Fixes: 84ec374bd580 ("drm/amdgpu: create amdgpu_vkms (v4)") Signed-off-by: Guchun Chen Acked-by: Alex Deucher Tested-by: Kelly Zytaruk Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c b/drivers/gpu/drm/amd= /amdgpu/amdgpu_vkms.c index ac9a8cd21c4b6..7d58bf410be05 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c @@ -142,15 +142,16 @@ static void amdgpu_vkms_crtc_atomic_disable(struct dr= m_crtc *crtc, static void amdgpu_vkms_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_atomic_state *state) { + unsigned long flags; if (crtc->state->event) { - spin_lock(&crtc->dev->event_lock); + spin_lock_irqsave(&crtc->dev->event_lock, flags); =20 if (drm_crtc_vblank_get(crtc) !=3D 0) drm_crtc_send_vblank_event(crtc, crtc->state->event); else drm_crtc_arm_vblank_event(crtc, crtc->state->event); =20 - spin_unlock(&crtc->dev->event_lock); + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); =20 crtc->state->event =3D NULL; } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6197CC433FE for ; Mon, 24 Jan 2022 22:31:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587382AbiAXW2N (ORCPT ); Mon, 24 Jan 2022 17:28:13 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53508 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352232AbiAXVeT (ORCPT ); Mon, 24 Jan 2022 16:34:19 -0500 Received: from smtp.kernel.org (relay.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 193CF614DE; Mon, 24 Jan 2022 21:34:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE9C1C340EF; Mon, 24 Jan 2022 21:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060056; bh=MFtwOZJoi2PSl+FnzFMrWI/ufCULKuJqp+VQy1Dt5CY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lf4D3wqpHO8qD53Ow7K1utZ3OZhA1ZjjW4CTKHgRMj4hhp16kV2UDF5TVmBDqHsgP FgMke566ierCfOemFRPEkfgXxNQAAik0mmfxOcYNQ1tc0R0xzZtETbLsdvCsmLkQf+ lnbw4MErIP3qCmMtyEq8pIl1j3KYU4WqXotb3pPc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yanteng Si , Sergio Paracuellos , Bjorn Helgaas , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Sasha Levin Subject: [PATCH 5.16 0824/1039] PCI: mt7621: Add missing MODULE_LICENSE() Date: Mon, 24 Jan 2022 19:43:33 +0100 Message-Id: <20220124184152.990526795@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Sergio Paracuellos [ Upstream commit e4b1cd02dc8d7967a79edccd510724831e5cdee8 ] The MT7621 PCIe host controller driver can be built as a module, but it lacks a MODULE_LICENSE(), which causes a build error: ERROR: modpost: missing MODULE_LICENSE() in drivers/pci/controller/pcie-m= t7621.o Add MODULE_LICENSE() to the driver. Fixes: 2bdd5238e756 ("PCI: mt7621: Add MediaTek MT7621 PCIe host controller= driver") Link: https://lore.kernel.org/r/20211207104924.21327-5-sergio.paracuellos@g= mail.com Signed-off-by: Yanteng Si Signed-off-by: Sergio Paracuellos Signed-off-by: Bjorn Helgaas Reviewed-by: Krzysztof Wilczy=C5=84ski Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pcie-mt7621.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/controller/pcie-mt7621.c b/drivers/pci/controller/= pcie-mt7621.c index b60dfb45ef7bd..73b91315c1656 100644 --- a/drivers/pci/controller/pcie-mt7621.c +++ b/drivers/pci/controller/pcie-mt7621.c @@ -598,3 +598,5 @@ static struct platform_driver mt7621_pci_driver =3D { }, }; builtin_platform_driver(mt7621_pci_driver); + +MODULE_LICENSE("GPL v2"); --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24C85C433FE for ; Tue, 25 Jan 2022 00:15:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373134AbiAYANK (ORCPT ); Mon, 24 Jan 2022 19:13:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1842314AbiAXX2e (ORCPT ); Mon, 24 Jan 2022 18:28:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F3C9C0A8879; Mon, 24 Jan 2022 13:34:25 -0800 (PST) Received: from smtp.kernel.org (relay.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 2CAE5B811FB; Mon, 24 Jan 2022 21:34:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F056C340E4; Mon, 24 Jan 2022 21:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060062; bh=03pwDSBP+lXwFiG1Ofa2EZe72cX38XTIjIzWaZXLmhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oLPouGICItox9sqtJ5AZ4RjANKPWQKmVSYbcPgy5Pg7NRSUT9ghWBFlpcmFryrqZo cLTBbEk3myb8x7PUSFguVvTXTI3ka+p10+5We5oeypqYMQE9lDlej5okGUdrcfELm+ i2uwBqj/2O2oByBGHbC7gX85e9ZreTrc6+u32xAI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Alexandre Belloni , Sasha Levin Subject: [PATCH 5.16 0825/1039] i3c: master: dw: check return of dw_i3c_master_get_free_pos() Date: Mon, 24 Jan 2022 19:43:34 +0100 Message-Id: <20220124184153.023358481@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 13462ba1815db5a96891293a9cfaa2451f7bd623 ] Clang static analysis reports this problem dw-i3c-master.c:799:9: warning: The result of the left shift is undefined because the left operand is negative COMMAND_PORT_DEV_INDEX(pos) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ pos can be negative because dw_i3c_master_get_free_pos() can return an error. So check for an error. Fixes: 1dd728f5d4d4 ("i3c: master: Add driver for Synopsys DesignWare IP") Signed-off-by: Tom Rix Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20220108150948.3988790-1-trix@redhat.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/i3c/master/dw-i3c-master.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c= -master.c index 03a368da51b95..51a8608203de7 100644 --- a/drivers/i3c/master/dw-i3c-master.c +++ b/drivers/i3c/master/dw-i3c-master.c @@ -793,6 +793,10 @@ static int dw_i3c_master_daa(struct i3c_master_control= ler *m) return -ENOMEM; =20 pos =3D dw_i3c_master_get_free_pos(master); + if (pos < 0) { + dw_i3c_master_free_xfer(xfer); + return pos; + } cmd =3D &xfer->cmds[0]; cmd->cmd_hi =3D 0x1; cmd->cmd_lo =3D COMMAND_PORT_DEV_COUNT(master->maxdevs - pos) | --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 036B0C3526D for ; Tue, 25 Jan 2022 00:15:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373110AbiAYANG (ORCPT ); Mon, 24 Jan 2022 19:13:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1842399AbiAXX2g (ORCPT ); Mon, 24 Jan 2022 18:28:36 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DB71C0A887B; Mon, 24 Jan 2022 13:34:27 -0800 (PST) Received: from smtp.kernel.org (relay.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 01076B811FB; Mon, 24 Jan 2022 21:34:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AF44C340E5; Mon, 24 Jan 2022 21:34:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060065; bh=yGF2yk0DciZXVKy44TwKN8EX+j1uAZ+XFwglFSQ1H9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NcAMyGDgSgqdbmsE9ZBstrmg0q8EPnHIFvV4TzH/RaV5Nce2jnfA+g+nPyRs4q3JI rZOZI6x0JU4/cEwME3/bZ6ESzy2qGcyj7chwlv5t/XD4L+w0yBI2N5lC4j5fK0kuNe /wOnW6Bzbx426ssSJK6qXP4bT/fGAFQUfE3LMfiA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Weizhao Ouyang , John Stultz , Sumit Semwal , Sasha Levin Subject: [PATCH 5.16 0826/1039] dma-buf: cma_heap: Fix mutex locking section Date: Mon, 24 Jan 2022 19:43:35 +0100 Message-Id: <20220124184153.055320874@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Weizhao Ouyang [ Upstream commit 54329e6f7beea6af56c1230da293acc97d6a6ee7 ] Fix cma_heap_buffer mutex locking critical section to protect vmap_cnt and vaddr. Fixes: a5d2d29e24be ("dma-buf: heaps: Move heap-helper logic into the cma_h= eap implementation") Signed-off-by: Weizhao Ouyang Acked-by: John Stultz Signed-off-by: Sumit Semwal Link: https://patchwork.freedesktop.org/patch/msgid/20220104073545.124244-1= -o451686892@gmail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dma-buf/heaps/cma_heap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_h= eap.c index 0c05b79870f96..83f02bd51dda6 100644 --- a/drivers/dma-buf/heaps/cma_heap.c +++ b/drivers/dma-buf/heaps/cma_heap.c @@ -124,10 +124,11 @@ static int cma_heap_dma_buf_begin_cpu_access(struct d= ma_buf *dmabuf, struct cma_heap_buffer *buffer =3D dmabuf->priv; struct dma_heap_attachment *a; =20 + mutex_lock(&buffer->lock); + if (buffer->vmap_cnt) invalidate_kernel_vmap_range(buffer->vaddr, buffer->len); =20 - mutex_lock(&buffer->lock); list_for_each_entry(a, &buffer->attachments, list) { if (!a->mapped) continue; @@ -144,10 +145,11 @@ static int cma_heap_dma_buf_end_cpu_access(struct dma= _buf *dmabuf, struct cma_heap_buffer *buffer =3D dmabuf->priv; struct dma_heap_attachment *a; =20 + mutex_lock(&buffer->lock); + if (buffer->vmap_cnt) flush_kernel_vmap_range(buffer->vaddr, buffer->len); =20 - mutex_lock(&buffer->lock); list_for_each_entry(a, &buffer->attachments, list) { if (!a->mapped) continue; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A17DC3526C for ; Tue, 25 Jan 2022 00:15:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373169AbiAYANQ (ORCPT ); Mon, 24 Jan 2022 19:13:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1850346AbiAXX3o (ORCPT ); Mon, 24 Jan 2022 18:29:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 244E4C0A887E; Mon, 24 Jan 2022 13:34:31 -0800 (PST) Received: from smtp.kernel.org (relay.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 D5036B812A5; Mon, 24 Jan 2022 21:34:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 070CBC36AE2; Mon, 24 Jan 2022 21:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060068; bh=hE1OjF1rUYQ93f+jl9N9Z+d4/F4G4HcNLRNh4ttkmPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HbgEWXaBinSdVQCi/jl1M6wII2/RDg+jyqz0/b0g9Qb9WB+pBf5R5vmr9G0lKkYyh F392H4l9K88tCtFldIAX8qsxsHSbeEcxRJJvh8ccCvHgWh9RqX1EIT08zoqiePQlAj +SXxPbpQ7MG4cPIdusXf8lAl+SAO9FW7hFaqdQMU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Xiaoke Wang , Steven Rostedt , Sasha Levin Subject: [PATCH 5.16 0827/1039] tracing/uprobes: Check the return value of kstrdup() for tu->filename Date: Mon, 24 Jan 2022 19:43:36 +0100 Message-Id: <20220124184153.088226680@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaoke Wang [ Upstream commit 8c7224245557707c613f130431cafbaaa4889615 ] kstrdup() returns NULL when some internal memory errors happen, it is better to check the return value of it so to catch the memory error in time. Link: https://lkml.kernel.org/r/tencent_3C2E330722056D7891D2C83F29C802734B0= 6@qq.com Acked-by: Masami Hiramatsu Fixes: 33ea4b24277b ("perf/core: Implement the 'perf_uprobe' PMU") Signed-off-by: Xiaoke Wang Signed-off-by: Steven Rostedt Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/trace/trace_uprobe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index f5f0039d31e5a..78ec1c16ccf4b 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1619,6 +1619,11 @@ create_local_trace_uprobe(char *name, unsigned long = offs, tu->path =3D path; tu->ref_ctr_offset =3D ref_ctr_offset; tu->filename =3D kstrdup(name, GFP_KERNEL); + if (!tu->filename) { + ret =3D -ENOMEM; + goto error; + } + init_trace_event_call(tu); =20 ptype =3D is_ret_probe(tu) ? PROBE_PRINT_RETURN : PROBE_PRINT_NORMAL; --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45E76C2BA4C for ; Tue, 25 Jan 2022 00:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373195AbiAYANT (ORCPT ); Mon, 24 Jan 2022 19:13:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1850382AbiAXX3w (ORCPT ); Mon, 24 Jan 2022 18:29:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BD16C0A8880; Mon, 24 Jan 2022 13:34:32 -0800 (PST) Received: from smtp.kernel.org (relay.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 0D639614CB; Mon, 24 Jan 2022 21:34:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7DA0C340E4; Mon, 24 Jan 2022 21:34:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060071; bh=7DerX0b8DALAtu6wevcGsJHv/dcYVQh4/h5h4IeCgWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hU0UN28UAz0bk/y0EyLR65JG//bYGiiHiev/4UbrxCoOlPTa7KJE0dPx29G/AVNgi LlIu/Cb9iUNVrfjE4BKgSqrvqDZ0UKf16qgBLYmql+kAcWLkA9Kwn393kpC9pDhedP UqqWbWGQCjkAypm5fc+u6LlRVjL3IrHCRKhhaLNM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Xiaoke Wang , Steven Rostedt , Sasha Levin Subject: [PATCH 5.16 0828/1039] tracing/probes: check the return value of kstrndup() for pbuf Date: Mon, 24 Jan 2022 19:43:37 +0100 Message-Id: <20220124184153.119249971@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaoke Wang [ Upstream commit 1c1857d400355e96f0fe8b32adc6fa7594d03b52 ] kstrndup() is a memory allocation-related function, it returns NULL when some internal memory errors happen. It is better to check the return value of it so to catch the memory error in time. Link: https://lkml.kernel.org/r/tencent_4D6E270731456EB88712ED7F13883C33490= 6@qq.com Acked-by: Masami Hiramatsu Fixes: a42e3c4de964 ("tracing/probe: Add immediate string parameter support= ") Signed-off-by: Xiaoke Wang Signed-off-by: Steven Rostedt Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/trace/trace_probe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c index 3ed2a3f372972..bb4605b60de79 100644 --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -356,6 +356,8 @@ static int __parse_imm_string(char *str, char **pbuf, i= nt offs) return -EINVAL; } *pbuf =3D kstrndup(str, len - 1, GFP_KERNEL); + if (!*pbuf) + return -ENOMEM; return 0; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA3FAC4332F for ; Tue, 25 Jan 2022 00:15:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373230AbiAYANX (ORCPT ); Mon, 24 Jan 2022 19:13:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1850471AbiAXXaH (ORCPT ); Mon, 24 Jan 2022 18:30:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E918C0A8883; Mon, 24 Jan 2022 13:34:35 -0800 (PST) Received: from smtp.kernel.org (relay.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 CB3AD614CB; Mon, 24 Jan 2022 21:34:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95670C340E7; Mon, 24 Jan 2022 21:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060074; bh=alfV7xZXWFEu1pXqmgOVZ7PBqmRabwtLaVbRZR62P5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UamSVyqNCp5bSDj3tHV9GvdL/c0j5vER3Lukb6rTyRADBenVOQd1Nv8A6j3j0rc/b m6Xf+xl0k+G6abDFAhenqT0HhigjEHlNLYa7+dOcebDW4oYoDpMqoOw/9rN/fPfucm 9Bwmvceda+BkK3KbYL7DjwPHyv6yDlQyxUvIb/p8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kefeng Wang , Yongqiang Liu , Andrey Konovalov , Andrey Ryabinin , Dmitry Vyukov , Catalin Marinas , Will Deacon , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Alexander Gordeev , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Alexander Potapenko , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.16 0829/1039] mm: defer kmemleak object creation of module_alloc() Date: Mon, 24 Jan 2022 19:43:38 +0100 Message-Id: <20220124184153.149771528@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kefeng Wang [ Upstream commit 60115fa54ad7b913b7cb5844e6b7ffeb842d55f2 ] Yongqiang reports a kmemleak panic when module insmod/rmmod with KASAN enabled(without KASAN_VMALLOC) on x86[1]. When the module area allocates memory, it's kmemleak_object is created successfully, but the KASAN shadow memory of module allocation is not ready, so when kmemleak scan the module's pointer, it will panic due to no shadow memory with KASAN check. module_alloc __vmalloc_node_range kmemleak_vmalloc kmemleak_scan update_checksum kasan_module_alloc kmemleak_ignore Note, there is no problem if KASAN_VMALLOC enabled, the modules area entire shadow memory is preallocated. Thus, the bug only exits on ARCH which supports dynamic allocation of module area per module load, for now, only x86/arm64/s390 are involved. Add a VM_DEFER_KMEMLEAK flags, defer vmalloc'ed object register of kmemleak in module_alloc() to fix this issue. [1] https://lore.kernel.org/all/6d41e2b9-4692-5ec4-b1cd-cbe29ae89739@huawei= .com/ [wangkefeng.wang@huawei.com: fix build] Link: https://lkml.kernel.org/r/20211125080307.27225-1-wangkefeng.wang@hu= awei.com [akpm@linux-foundation.org: simplify ifdefs, per Andrey] Link: https://lkml.kernel.org/r/CA+fCnZcnwJHUQq34VuRxpdoY6_XbJCDJ-jopksS5= Eia4PijPzw@mail.gmail.com Link: https://lkml.kernel.org/r/20211124142034.192078-1-wangkefeng.wang@hua= wei.com Fixes: 793213a82de4 ("s390/kasan: dynamic shadow mem allocation for modules= ") Fixes: 39d114ddc682 ("arm64: add KASAN support") Fixes: bebf56a1b176 ("kasan: enable instrumentation of global variables") Signed-off-by: Kefeng Wang Reported-by: Yongqiang Liu Cc: Andrey Konovalov Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Catalin Marinas Cc: Will Deacon Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger Cc: Alexander Gordeev Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: Alexander Potapenko Cc: Kefeng Wang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/kernel/module.c | 4 ++-- arch/s390/kernel/module.c | 5 +++-- arch/x86/kernel/module.c | 7 ++++--- include/linux/kasan.h | 4 ++-- include/linux/vmalloc.h | 7 +++++++ mm/kasan/shadow.c | 9 +++++++-- mm/vmalloc.c | 3 ++- 7 files changed, 27 insertions(+), 12 deletions(-) diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c index b5ec010c481f3..309a27553c875 100644 --- a/arch/arm64/kernel/module.c +++ b/arch/arm64/kernel/module.c @@ -36,7 +36,7 @@ void *module_alloc(unsigned long size) module_alloc_end =3D MODULES_END; =20 p =3D __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base, - module_alloc_end, gfp_mask, PAGE_KERNEL, 0, + module_alloc_end, gfp_mask, PAGE_KERNEL, VM_DEFER_KMEMLEAK, NUMA_NO_NODE, __builtin_return_address(0)); =20 if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) && @@ -58,7 +58,7 @@ void *module_alloc(unsigned long size) PAGE_KERNEL, 0, NUMA_NO_NODE, __builtin_return_address(0)); =20 - if (p && (kasan_module_alloc(p, size) < 0)) { + if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) { vfree(p); return NULL; } diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c index b01ba460b7cad..d52d85367bf73 100644 --- a/arch/s390/kernel/module.c +++ b/arch/s390/kernel/module.c @@ -37,14 +37,15 @@ =20 void *module_alloc(unsigned long size) { + gfp_t gfp_mask =3D GFP_KERNEL; void *p; =20 if (PAGE_ALIGN(size) > MODULES_LEN) return NULL; p =3D __vmalloc_node_range(size, MODULE_ALIGN, MODULES_VADDR, MODULES_END, - GFP_KERNEL, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE, + gfp_mask, PAGE_KERNEL_EXEC, VM_DEFER_KMEMLEAK, NUMA_NO_NODE, __builtin_return_address(0)); - if (p && (kasan_module_alloc(p, size) < 0)) { + if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) { vfree(p); return NULL; } diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c index 169fb6f4cd2ee..95fa745e310a5 100644 --- a/arch/x86/kernel/module.c +++ b/arch/x86/kernel/module.c @@ -67,6 +67,7 @@ static unsigned long int get_module_load_offset(void) =20 void *module_alloc(unsigned long size) { + gfp_t gfp_mask =3D GFP_KERNEL; void *p; =20 if (PAGE_ALIGN(size) > MODULES_LEN) @@ -74,10 +75,10 @@ void *module_alloc(unsigned long size) =20 p =3D __vmalloc_node_range(size, MODULE_ALIGN, MODULES_VADDR + get_module_load_offset(), - MODULES_END, GFP_KERNEL, - PAGE_KERNEL, 0, NUMA_NO_NODE, + MODULES_END, gfp_mask, + PAGE_KERNEL, VM_DEFER_KMEMLEAK, NUMA_NO_NODE, __builtin_return_address(0)); - if (p && (kasan_module_alloc(p, size) < 0)) { + if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) { vfree(p); return NULL; } diff --git a/include/linux/kasan.h b/include/linux/kasan.h index d8783b6826695..89c99e5e67de5 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h @@ -474,12 +474,12 @@ static inline void kasan_populate_early_vm_area_shado= w(void *start, * allocations with real shadow memory. With KASAN vmalloc, the special * case is unnecessary, as the work is handled in the generic case. */ -int kasan_module_alloc(void *addr, size_t size); +int kasan_module_alloc(void *addr, size_t size, gfp_t gfp_mask); void kasan_free_shadow(const struct vm_struct *vm); =20 #else /* (CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS) && !CONFIG_KASAN_V= MALLOC */ =20 -static inline int kasan_module_alloc(void *addr, size_t size) { return 0; } +static inline int kasan_module_alloc(void *addr, size_t size, gfp_t gfp_ma= sk) { return 0; } static inline void kasan_free_shadow(const struct vm_struct *vm) {} =20 #endif /* (CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS) && !CONFIG_KASAN_= VMALLOC */ diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 6e022cc712e61..880227b9f0440 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -28,6 +28,13 @@ struct notifier_block; /* in notifier.h */ #define VM_MAP_PUT_PAGES 0x00000200 /* put pages and free array in vfree */ #define VM_NO_HUGE_VMAP 0x00000400 /* force PAGE_SIZE pte mapping */ =20 +#if (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)) && \ + !defined(CONFIG_KASAN_VMALLOC) +#define VM_DEFER_KMEMLEAK 0x00000800 /* defer kmemleak object creation */ +#else +#define VM_DEFER_KMEMLEAK 0 +#endif + /* * VM_KASAN is used slightly differently depending on CONFIG_KASAN_VMALLOC. * diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c index 4a4929b29a237..94136f84b4497 100644 --- a/mm/kasan/shadow.c +++ b/mm/kasan/shadow.c @@ -498,7 +498,7 @@ void kasan_release_vmalloc(unsigned long start, unsigne= d long end, =20 #else /* CONFIG_KASAN_VMALLOC */ =20 -int kasan_module_alloc(void *addr, size_t size) +int kasan_module_alloc(void *addr, size_t size, gfp_t gfp_mask) { void *ret; size_t scaled_size; @@ -520,9 +520,14 @@ int kasan_module_alloc(void *addr, size_t size) __builtin_return_address(0)); =20 if (ret) { + struct vm_struct *vm =3D find_vm_area(addr); __memset(ret, KASAN_SHADOW_INIT, shadow_size); - find_vm_area(addr)->flags |=3D VM_KASAN; + vm->flags |=3D VM_KASAN; kmemleak_ignore(ret); + + if (vm->flags & VM_DEFER_KMEMLEAK) + kmemleak_vmalloc(vm, size, gfp_mask); + return 0; } =20 diff --git a/mm/vmalloc.c b/mm/vmalloc.c index d2a00ad4e1dd1..bf3c2fe8f5285 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -3074,7 +3074,8 @@ again: clear_vm_uninitialized_flag(area); =20 size =3D PAGE_ALIGN(size); - kmemleak_vmalloc(area, size, gfp_mask); + if (!(vm_flags & VM_DEFER_KMEMLEAK)) + kmemleak_vmalloc(area, size, gfp_mask); =20 return addr; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3747EC43217 for ; Mon, 24 Jan 2022 22:30:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587414AbiAXW2Q (ORCPT ); Mon, 24 Jan 2022 17:28:16 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53848 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455023AbiAXVei (ORCPT ); Mon, 24 Jan 2022 16:34:38 -0500 Received: from smtp.kernel.org (relay.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 76D396131F; Mon, 24 Jan 2022 21:34:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56670C340E4; Mon, 24 Jan 2022 21:34:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060076; bh=SmVEn4GoyNBFLoGjar7lW6qHLF92Ww9k0BA4JayBMZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qkv81Vm24chKsgTqfEHX5mcodchLieY+C+w2iw/461Psz0bZsrlFbs4OQwwQikg2K 28Xbym+QZzdGwNd8QX3HpzYEG6bMFp4wmUyJg/ln3ZN4PkgeIqMWAKENktmm57sVTq 5FthXt6wO0AJMMRNEqMN9SloA6DcF1B6jsegkBYQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Konovalov , Marco Elver , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.16 0830/1039] kasan: fix quarantine conflicting with init_on_free Date: Mon, 24 Jan 2022 19:43:39 +0100 Message-Id: <20220124184153.183232888@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Konovalov [ Upstream commit 26dca996ea7b1ac7008b6b6063fc88b849e3ac3e ] KASAN's quarantine might save its metadata inside freed objects. As this happens after the memory is zeroed by the slab allocator when init_on_free is enabled, the memory coming out of quarantine is not properly zeroed. This causes lib/test_meminit.c tests to fail with Generic KASAN. Zero the metadata when the object is removed from quarantine. Link: https://lkml.kernel.org/r/2805da5df4b57138fdacd671f5d227d58950ba54.16= 40037083.git.andreyknvl@google.com Fixes: 6471384af2a6 ("mm: security: introduce init_on_alloc=3D1 and init_on= _free=3D1 boot options") Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Dmitry Vyukov Cc: Andrey Ryabinin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- mm/kasan/quarantine.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c index d8ccff4c1275e..47ed4fc33a29e 100644 --- a/mm/kasan/quarantine.c +++ b/mm/kasan/quarantine.c @@ -132,11 +132,22 @@ static void *qlink_to_object(struct qlist_node *qlink= , struct kmem_cache *cache) static void qlink_free(struct qlist_node *qlink, struct kmem_cache *cache) { void *object =3D qlink_to_object(qlink, cache); + struct kasan_free_meta *meta =3D kasan_get_free_meta(cache, object); unsigned long flags; =20 if (IS_ENABLED(CONFIG_SLAB)) local_irq_save(flags); =20 + /* + * If init_on_free is enabled and KASAN's free metadata is stored in + * the object, zero the metadata. Otherwise, the object's memory will + * not be properly zeroed, as KASAN saves the metadata after the slab + * allocator zeroes the object. + */ + if (slab_want_init_on_free(cache) && + cache->kasan_info.free_meta_offset =3D=3D 0) + memzero_explicit(meta, sizeof(*meta)); + /* * As the object now gets freed from the quarantine, assume that its * free track is no longer valid. --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C3FBC433EF for ; Tue, 25 Jan 2022 00:23:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2375553AbiAYAU3 (ORCPT ); Mon, 24 Jan 2022 19:20:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849665AbiAXXej (ORCPT ); Mon, 24 Jan 2022 18:34:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7320C075D34; Mon, 24 Jan 2022 13:36:43 -0800 (PST) Received: from smtp.kernel.org (relay.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 562636131F; Mon, 24 Jan 2022 21:36:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C6D6C340E4; Mon, 24 Jan 2022 21:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060202; bh=KZ+PuEy7mAb5pB9eyH1/wpOvcih8ATnl/GdjS9UgtVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=etmoxNjnNwnQrD5SYRQ7uy0yLRofmBOim1BG2mBBtyHQrqgyr/lLzFjattoQFCC+z rfklxOWz+kciK9st2vG6dLP1TASRSNXgFfAwgwvUWNUlKVuXtSYP/Kc5gyVOTKZPr6 FkWTixVryJRMKLChn/Ti/2G/UVu18lMa1J+DcIfo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Waiman Long , Mina Almasry , Shuah Khan , Mike Kravetz , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.16 0831/1039] selftests/vm: make charge_reserved_hugetlb.sh work with existing cgroup setting Date: Mon, 24 Jan 2022 19:43:40 +0100 Message-Id: <20220124184153.217227973@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Waiman Long [ Upstream commit 209376ed2a8431ccb4c40fdcef11194fc1e749b0 ] The hugetlb cgroup reservation test charge_reserved_hugetlb.sh assume that no cgroup filesystems are mounted before running the test. That is not true in many cases. As a result, the test fails to run. Fix that by querying the current cgroup mount setting and using the existing cgroup setup instead before attempting to freshly mount a cgroup filesystem. Similar change is also made for hugetlb_reparenting_test.sh as well, though it still has problem if cgroup v2 isn't used. The patched test scripts were run on a centos 8 based system to verify that they ran properly. Link: https://lkml.kernel.org/r/20220106201359.1646575-1-longman@redhat.com Fixes: 29750f71a9b4 ("hugetlb_cgroup: add hugetlb_cgroup reservation tests") Signed-off-by: Waiman Long Acked-by: Mina Almasry Cc: Shuah Khan Cc: Mike Kravetz Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../selftests/vm/charge_reserved_hugetlb.sh | 34 +++++++++++-------- .../selftests/vm/hugetlb_reparenting_test.sh | 21 +++++++----- .../selftests/vm/write_hugetlb_memory.sh | 2 +- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/tools/testing/selftests/vm/charge_reserved_hugetlb.sh b/tools/= testing/selftests/vm/charge_reserved_hugetlb.sh index fe8fcfb334e06..a5cb4b09a46c4 100644 --- a/tools/testing/selftests/vm/charge_reserved_hugetlb.sh +++ b/tools/testing/selftests/vm/charge_reserved_hugetlb.sh @@ -24,19 +24,23 @@ if [[ "$1" =3D=3D "-cgroup-v2" ]]; then reservation_usage_file=3Drsvd.current fi =20 -cgroup_path=3D/dev/cgroup/memory -if [[ ! -e $cgroup_path ]]; then - mkdir -p $cgroup_path - if [[ $cgroup2 ]]; then +if [[ $cgroup2 ]]; then + cgroup_path=3D$(mount -t cgroup2 | head -1 | awk -e '{print $3}') + if [[ -z "$cgroup_path" ]]; then + cgroup_path=3D/dev/cgroup/memory mount -t cgroup2 none $cgroup_path - else + do_umount=3D1 + fi + echo "+hugetlb" >$cgroup_path/cgroup.subtree_control +else + cgroup_path=3D$(mount -t cgroup | grep ",hugetlb" | awk -e '{print $3}') + if [[ -z "$cgroup_path" ]]; then + cgroup_path=3D/dev/cgroup/memory mount -t cgroup memory,hugetlb $cgroup_path + do_umount=3D1 fi fi - -if [[ $cgroup2 ]]; then - echo "+hugetlb" >/dev/cgroup/memory/cgroup.subtree_control -fi +export cgroup_path =20 function cleanup() { if [[ $cgroup2 ]]; then @@ -108,7 +112,7 @@ function setup_cgroup() { =20 function wait_for_hugetlb_memory_to_get_depleted() { local cgroup=3D"$1" - local path=3D"/dev/cgroup/memory/$cgroup/hugetlb.${MB}MB.$reservation_us= age_file" + local path=3D"$cgroup_path/$cgroup/hugetlb.${MB}MB.$reservation_usage_fi= le" # Wait for hugetlbfs memory to get depleted. while [ $(cat $path) !=3D 0 ]; do echo Waiting for hugetlb memory to get depleted. @@ -121,7 +125,7 @@ function wait_for_hugetlb_memory_to_get_reserved() { local cgroup=3D"$1" local size=3D"$2" =20 - local path=3D"/dev/cgroup/memory/$cgroup/hugetlb.${MB}MB.$reservation_us= age_file" + local path=3D"$cgroup_path/$cgroup/hugetlb.${MB}MB.$reservation_usage_fi= le" # Wait for hugetlbfs memory to get written. while [ $(cat $path) !=3D $size ]; do echo Waiting for hugetlb memory reservation to reach size $size. @@ -134,7 +138,7 @@ function wait_for_hugetlb_memory_to_get_written() { local cgroup=3D"$1" local size=3D"$2" =20 - local path=3D"/dev/cgroup/memory/$cgroup/hugetlb.${MB}MB.$fault_usage_fi= le" + local path=3D"$cgroup_path/$cgroup/hugetlb.${MB}MB.$fault_usage_file" # Wait for hugetlbfs memory to get written. while [ $(cat $path) !=3D $size ]; do echo Waiting for hugetlb memory to reach size $size. @@ -574,5 +578,7 @@ for populate in "" "-o"; do done # populate done # method =20 -umount $cgroup_path -rmdir $cgroup_path +if [[ $do_umount ]]; then + umount $cgroup_path + rmdir $cgroup_path +fi diff --git a/tools/testing/selftests/vm/hugetlb_reparenting_test.sh b/tools= /testing/selftests/vm/hugetlb_reparenting_test.sh index 4a9a3afe9fd4d..bf2d2a684edfd 100644 --- a/tools/testing/selftests/vm/hugetlb_reparenting_test.sh +++ b/tools/testing/selftests/vm/hugetlb_reparenting_test.sh @@ -18,19 +18,24 @@ if [[ "$1" =3D=3D "-cgroup-v2" ]]; then usage_file=3Dcurrent fi =20 -CGROUP_ROOT=3D'/dev/cgroup/memory' -MNT=3D'/mnt/huge/' =20 -if [[ ! -e $CGROUP_ROOT ]]; then - mkdir -p $CGROUP_ROOT - if [[ $cgroup2 ]]; then +if [[ $cgroup2 ]]; then + CGROUP_ROOT=3D$(mount -t cgroup2 | head -1 | awk -e '{print $3}') + if [[ -z "$CGROUP_ROOT" ]]; then + CGROUP_ROOT=3D/dev/cgroup/memory mount -t cgroup2 none $CGROUP_ROOT - sleep 1 - echo "+hugetlb +memory" >$CGROUP_ROOT/cgroup.subtree_control - else + do_umount=3D1 + fi + echo "+hugetlb +memory" >$CGROUP_ROOT/cgroup.subtree_control +else + CGROUP_ROOT=3D$(mount -t cgroup | grep ",hugetlb" | awk -e '{print $3}') + if [[ -z "$CGROUP_ROOT" ]]; then + CGROUP_ROOT=3D/dev/cgroup/memory mount -t cgroup memory,hugetlb $CGROUP_ROOT + do_umount=3D1 fi fi +MNT=3D'/mnt/huge/' =20 function get_machine_hugepage_size() { hpz=3D$(grep -i hugepagesize /proc/meminfo) diff --git a/tools/testing/selftests/vm/write_hugetlb_memory.sh b/tools/tes= ting/selftests/vm/write_hugetlb_memory.sh index d3d0d108924d4..70a02301f4c27 100644 --- a/tools/testing/selftests/vm/write_hugetlb_memory.sh +++ b/tools/testing/selftests/vm/write_hugetlb_memory.sh @@ -14,7 +14,7 @@ want_sleep=3D$8 reserve=3D$9 =20 echo "Putting task in cgroup '$cgroup'" -echo $$ > /dev/cgroup/memory/"$cgroup"/cgroup.procs +echo $$ > ${cgroup_path:-/dev/cgroup/memory}/"$cgroup"/cgroup.procs =20 echo "Method is $method" =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58966C41535 for ; Tue, 25 Jan 2022 00:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373245AbiAYANZ (ORCPT ); Mon, 24 Jan 2022 19:13:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1850695AbiAXXah (ORCPT ); Mon, 24 Jan 2022 18:30:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C815EC0AD1AF; Mon, 24 Jan 2022 13:35:01 -0800 (PST) Received: from smtp.kernel.org (relay.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 65DB4614CB; Mon, 24 Jan 2022 21:35:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 765A0C340E4; Mon, 24 Jan 2022 21:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060100; bh=Y3b/AAusapEvGqBUnrjEZn2kCsA/rAJP2AKEvANrqow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zve/PpyJAOaHE0zIjdDplWV/Wj4t36U4Tz9hf/Tx+ygX+8/1ZaJryE1cq0LSYbe4I ViGtOkmwp5kd7dUfY43pffbMeFHj79RcKjVV5BhZ9ophpQ6YK3ftBnbhzgMeMiTHIT 5Da9xoGAMSoLvx/E0hKrBKV6ZJcuUFklYWS0dJSw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Wandun , Oscar Salvador , Vlastimil Babka , Joonsoo Kim , Wang Kefeng , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.16 0832/1039] mm/page_isolation: unset migratetype directly for non Buddy page Date: Mon, 24 Jan 2022 19:43:41 +0100 Message-Id: <20220124184153.249107968@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wandun [ Upstream commit 721fb891ad0b3956d5c168b2931e3e5e4fb7ca40 ] In unset_migratetype_isolate(), we can bypass the call to move_freepages_block() for non-buddy pages. It will save a few cpu cycles for some situations such as cma and hugetlb when allocating continue pages, in these situation function alloc_contig_pages will be called. alloc_contig_pages __alloc_contig_migrate_range isolate_freepages_range =3D=3D> pages has been remove from buddy undo_isolate_page_range unset_migratetype_isolate =3D=3D> can directly set migratetype [osalvador@suse.de: changelog tweak] Link: https://lkml.kernel.org/r/20211229033649.2760586-1-chenwandun@huawei.= com Fixes: 3c605096d315 ("mm/page_alloc: restrict max order of merging on isola= ted pageblock") Signed-off-by: Chen Wandun Reviewed-by: Oscar Salvador Cc: Vlastimil Babka Cc: Joonsoo Kim Cc: Wang Kefeng Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- mm/page_isolation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_isolation.c b/mm/page_isolation.c index f67c4c70f17f6..6a0ddda6b3c53 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page= , unsigned migratetype) * onlining - just onlined memory won't immediately be considered for * allocation. */ - if (!isolated_page) { + if (!isolated_page && PageBuddy(page)) { nr_pages =3D move_freepages_block(zone, page, migratetype, NULL); __mod_zone_freepage_state(zone, nr_pages, migratetype); } --=20 2.34.1 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D57DC433F5 for ; Tue, 25 Jan 2022 00:19:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374881AbiAYAS3 (ORCPT ); Mon, 24 Jan 2022 19:18:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385856AbiAXXdz (ORCPT ); Mon, 24 Jan 2022 18:33:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A53AC07596B; Mon, 24 Jan 2022 13:35:36 -0800 (PST) Received: from smtp.kernel.org (relay.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 1906FB81057; Mon, 24 Jan 2022 21:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 504F2C340E4; Mon, 24 Jan 2022 21:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060133; bh=a0YiCG/23n5Ij4udWEzbiqQJ3Zz1ama6V6tpi+vrVtk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VnHKxBOwKipeZPKX+BQpw9s4r9SLt+UoIvpsOZlmyZsusLd23S6AjKYE9fIqMK62N R0AhqEmrMV1DZK464xFpinFeCT5fTh1XllVjGImlZefwqXgQBFT126GUaMKliyyLeX VYytnGcfT+7mDF7MDiHiepcs1ldIN29W4BFMOtmM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , syzbot+4e697fe80a31aa7efe21@syzkaller.appspotmail.com, Mike Kravetz , Paolo Bonzini , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.16 0833/1039] hugetlbfs: fix off-by-one error in hugetlb_vmdelete_list() Date: Mon, 24 Jan 2022 19:43:42 +0100 Message-Id: <20220124184153.284397402@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit d6aba4c8e20d4d2bf65d589953f6d891c178f3a3 ] Pass "end - 1" instead of "end" when walking the interval tree in hugetlb_vmdelete_list() to fix an inclusive vs. exclusive bug. The two callers that pass a non-zero "end" treat it as exclusive, whereas the interval tree iterator expects an inclusive "last". E.g. punching a hole in a file that precisely matches the size of a single hugepage, with a vma starting right on the boundary, will result in unmap_hugepage_range() being called twice, with the second call having start=3D=3Dend. The off-by-one error doesn't cause functional problems as __unmap_hugepage_range() turns into a massive nop due to short-circuiting its for-loop on "address < end". But, the mmu_notifier invocations to invalid_range_{start,end}() are passed a bogus zero-sized range, which may be unexpected behavior for secondary MMUs. The bug was exposed by commit ed922739c919 ("KVM: Use interval tree to do fast hva lookup in memslots"), currently queued in the KVM tree for 5.17, which added a WARN to detect ranges with start=3D=3Dend. Link: https://lkml.kernel.org/r/20211228234257.1926057-1-seanjc@google.com Fixes: 1bfad99ab425 ("hugetlbfs: hugetlb_vmtruncate_list() needs to take a = range to delete") Signed-off-by: Sean Christopherson Reported-by: syzbot+4e697fe80a31aa7efe21@syzkaller.appspotmail.com Reviewed-by: Mike Kravetz Cc: Paolo Bonzini Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/hugetlbfs/inode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -409,10 +409,11 @@ hugetlb_vmdelete_list(struct rb_root_cac struct vm_area_struct *vma; =20 /* - * end =3D=3D 0 indicates that the entire range after - * start should be unmapped. + * end =3D=3D 0 indicates that the entire range after start should be + * unmapped. Note, end is exclusive, whereas the interval tree takes + * an inclusive "last". */ - vma_interval_tree_foreach(vma, root, start, end ? end : ULONG_MAX) { + vma_interval_tree_foreach(vma, root, start, end ? end - 1 : ULONG_MAX) { unsigned long v_offset; unsigned long v_end; =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AF8CC433EF for ; Tue, 25 Jan 2022 00:30:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3409916AbiAYA1x (ORCPT ); Mon, 24 Jan 2022 19:27:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47992 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455772AbiAXVgJ (ORCPT ); Mon, 24 Jan 2022 16:36:09 -0500 Received: from smtp.kernel.org (relay.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 4A6AEB80FA1; Mon, 24 Jan 2022 21:36:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B415C340E4; Mon, 24 Jan 2022 21:36:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060167; bh=p4uqq0J8lrcMHA5GOehhVPDPLiFSp/pB6kBhkItD9Ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ULTrhMrsRmqRWKvfuejuHVXnLT3dbLiCOq6LKmKs6EDi+bTRssoiGMlimjyaQhNo9 hrYFUt4XdI9XczvBL2WETHHv87vsuXf3C1dSGMD0OxIZebKlKrhtFHZ44MtyL6TpdZ HYogc0K6+TYjaJVPsFcXmrSKs17SiXltrsUlxe4g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Andersson , Arnaud Pouliquen , Mathieu Poirier Subject: [PATCH 5.16 0834/1039] rpmsg: core: Clean up resources on announce_create failure. Date: Mon, 24 Jan 2022 19:43:43 +0100 Message-Id: <20220124184153.323622703@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnaud Pouliquen commit 8066c615cb69b7da8a94f59379847b037b3a5e46 upstream. During the rpmsg_dev_probe, if rpdev->ops->announce_create returns an error, the rpmsg device and default endpoint should be freed before exiting the function. Fixes: 5e619b48677c ("rpmsg: Split rpmsg core and virtio backend") Suggested-by: Bjorn Andersson Signed-off-by: Arnaud Pouliquen Reviewed-by: Bjorn Andersson Cc: stable Link: https://lore.kernel.org/r/20211206190758.10004-1-arnaud.pouliquen@fos= s.st.com Signed-off-by: Mathieu Poirier Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/rpmsg/rpmsg_core.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) --- a/drivers/rpmsg/rpmsg_core.c +++ b/drivers/rpmsg/rpmsg_core.c @@ -540,13 +540,25 @@ static int rpmsg_dev_probe(struct device err =3D rpdrv->probe(rpdev); if (err) { dev_err(dev, "%s: failed: %d\n", __func__, err); - if (ept) - rpmsg_destroy_ept(ept); - goto out; + goto destroy_ept; } =20 - if (ept && rpdev->ops->announce_create) + if (ept && rpdev->ops->announce_create) { err =3D rpdev->ops->announce_create(rpdev); + if (err) { + dev_err(dev, "failed to announce creation\n"); + goto remove_rpdev; + } + } + + return 0; + +remove_rpdev: + if (rpdrv->remove) + rpdrv->remove(rpdev); +destroy_ept: + if (ept) + rpmsg_destroy_ept(ept); out: return err; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F931C433EF for ; Tue, 25 Jan 2022 00:19:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350705AbiAYATS (ORCPT ); Mon, 24 Jan 2022 19:19:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848498AbiAXXeV (ORCPT ); Mon, 24 Jan 2022 18:34:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F7ADC075D15; Mon, 24 Jan 2022 13:36:25 -0800 (PST) Received: from smtp.kernel.org (relay.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 3F3E6614DD; Mon, 24 Jan 2022 21:36:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1515FC340EC; Mon, 24 Jan 2022 21:36:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060184; bh=5JMG1VAIrUzkfh+/zGkCKSkeyXs9MnukOsGvjmTpIbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QiHnLEChcfub+XWNHIJ/kF8A1lqMFdvoiadm+lRoRZJg+XyqsomBm7Q+OjbnXhPKs Rak/YB9oh5Vu8MuruK62Mu3qdPAj6gfCfC7HJvQRGxWm3M6Kh9ZAJuVXe10DkQGXNZ zHtiydQ+jI/M9yRn/9Z4cNe/8Ncqw9/kif9M5Lf0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhu Lingshan , Stefano Garzarella , "Michael S. Tsirkin" Subject: [PATCH 5.16 0835/1039] ifcvf/vDPA: fix misuse virtio-net device config size for blk dev Date: Mon, 24 Jan 2022 19:43:44 +0100 Message-Id: <20220124184153.360622213@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhu Lingshan commit 0f420c383a2bb414ebccedf9289b5b815f1295fe upstream. This commit fixes a misuse of virtio-net device config size issue for virtio-block devices. A new member config_size in struct ifcvf_hw is introduced and would be initialized through vdpa_dev_add() to record correct device config size. To be more generic, rename ifcvf_hw.net_config to ifcvf_hw.dev_config, the helpers ifcvf_read/write_net_config() to ifcvf_read/write_dev_config() Signed-off-by: Zhu Lingshan Reported-and-suggested-by: Stefano Garzarella Reviewed-by: Stefano Garzarella Fixes: 6ad31d162a4e ("vDPA/ifcvf: enable Intel C5000X-PL virtio-block for v= DPA") Cc: Link: https://lore.kernel.org/r/20211201081255.60187-1-lingshan.zhu@intel.c= om Signed-off-by: Michael S. Tsirkin Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/vdpa/ifcvf/ifcvf_base.c | 41 ++++++++++++++++++++++++++++++-----= ----- drivers/vdpa/ifcvf/ifcvf_base.h | 9 +++++--- drivers/vdpa/ifcvf/ifcvf_main.c | 24 +++-------------------- 3 files changed, 41 insertions(+), 33 deletions(-) --- a/drivers/vdpa/ifcvf/ifcvf_base.c +++ b/drivers/vdpa/ifcvf/ifcvf_base.c @@ -143,8 +143,8 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, s IFCVF_DBG(pdev, "hw->isr =3D %p\n", hw->isr); break; case VIRTIO_PCI_CAP_DEVICE_CFG: - hw->net_cfg =3D get_cap_addr(hw, &cap); - IFCVF_DBG(pdev, "hw->net_cfg =3D %p\n", hw->net_cfg); + hw->dev_cfg =3D get_cap_addr(hw, &cap); + IFCVF_DBG(pdev, "hw->dev_cfg =3D %p\n", hw->dev_cfg); break; } =20 @@ -153,7 +153,7 @@ next: } =20 if (hw->common_cfg =3D=3D NULL || hw->notify_base =3D=3D NULL || - hw->isr =3D=3D NULL || hw->net_cfg =3D=3D NULL) { + hw->isr =3D=3D NULL || hw->dev_cfg =3D=3D NULL) { IFCVF_ERR(pdev, "Incomplete PCI capabilities\n"); return -EIO; } @@ -174,7 +174,7 @@ next: IFCVF_DBG(pdev, "PCI capability mapping: common cfg: %p, notify base: %p\n, isr cfg: %= p, device cfg: %p, multiplier: %u\n", hw->common_cfg, hw->notify_base, hw->isr, - hw->net_cfg, hw->notify_off_multiplier); + hw->dev_cfg, hw->notify_off_multiplier); =20 return 0; } @@ -242,33 +242,54 @@ int ifcvf_verify_min_features(struct ifc return 0; } =20 -void ifcvf_read_net_config(struct ifcvf_hw *hw, u64 offset, +u32 ifcvf_get_config_size(struct ifcvf_hw *hw) +{ + struct ifcvf_adapter *adapter; + u32 config_size; + + adapter =3D vf_to_adapter(hw); + switch (hw->dev_type) { + case VIRTIO_ID_NET: + config_size =3D sizeof(struct virtio_net_config); + break; + case VIRTIO_ID_BLOCK: + config_size =3D sizeof(struct virtio_blk_config); + break; + default: + config_size =3D 0; + IFCVF_ERR(adapter->pdev, "VIRTIO ID %u not supported\n", hw->dev_type); + } + + return config_size; +} + +void ifcvf_read_dev_config(struct ifcvf_hw *hw, u64 offset, void *dst, int length) { u8 old_gen, new_gen, *p; int i; =20 - WARN_ON(offset + length > sizeof(struct virtio_net_config)); + WARN_ON(offset + length > hw->config_size); do { old_gen =3D ifc_ioread8(&hw->common_cfg->config_generation); p =3D dst; for (i =3D 0; i < length; i++) - *p++ =3D ifc_ioread8(hw->net_cfg + offset + i); + *p++ =3D ifc_ioread8(hw->dev_cfg + offset + i); =20 new_gen =3D ifc_ioread8(&hw->common_cfg->config_generation); } while (old_gen !=3D new_gen); } =20 -void ifcvf_write_net_config(struct ifcvf_hw *hw, u64 offset, +void ifcvf_write_dev_config(struct ifcvf_hw *hw, u64 offset, const void *src, int length) { const u8 *p; int i; =20 p =3D src; - WARN_ON(offset + length > sizeof(struct virtio_net_config)); + WARN_ON(offset + length > hw->config_size); for (i =3D 0; i < length; i++) - ifc_iowrite8(*p++, hw->net_cfg + offset + i); + ifc_iowrite8(*p++, hw->dev_cfg + offset + i); } =20 static void ifcvf_set_features(struct ifcvf_hw *hw, u64 features) --- a/drivers/vdpa/ifcvf/ifcvf_base.h +++ b/drivers/vdpa/ifcvf/ifcvf_base.h @@ -71,12 +71,14 @@ struct ifcvf_hw { u64 hw_features; u32 dev_type; struct virtio_pci_common_cfg __iomem *common_cfg; - void __iomem *net_cfg; + void __iomem *dev_cfg; struct vring_info vring[IFCVF_MAX_QUEUES]; void __iomem * const *base; char config_msix_name[256]; struct vdpa_callback config_cb; unsigned int config_irq; + /* virtio-net or virtio-blk device config size */ + u32 config_size; }; =20 struct ifcvf_adapter { @@ -105,9 +107,9 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, s int ifcvf_start_hw(struct ifcvf_hw *hw); void ifcvf_stop_hw(struct ifcvf_hw *hw); void ifcvf_notify_queue(struct ifcvf_hw *hw, u16 qid); -void ifcvf_read_net_config(struct ifcvf_hw *hw, u64 offset, +void ifcvf_read_dev_config(struct ifcvf_hw *hw, u64 offset, void *dst, int length); -void ifcvf_write_net_config(struct ifcvf_hw *hw, u64 offset, +void ifcvf_write_dev_config(struct ifcvf_hw *hw, u64 offset, const void *src, int length); u8 ifcvf_get_status(struct ifcvf_hw *hw); void ifcvf_set_status(struct ifcvf_hw *hw, u8 status); @@ -120,4 +122,5 @@ u16 ifcvf_get_vq_state(struct ifcvf_hw * int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num); struct ifcvf_adapter *vf_to_adapter(struct ifcvf_hw *hw); int ifcvf_probed_virtio_net(struct ifcvf_hw *hw); +u32 ifcvf_get_config_size(struct ifcvf_hw *hw); #endif /* _IFCVF_H_ */ --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -366,24 +366,9 @@ static u32 ifcvf_vdpa_get_vq_align(struc =20 static size_t ifcvf_vdpa_get_config_size(struct vdpa_device *vdpa_dev) { - struct ifcvf_adapter *adapter =3D vdpa_to_adapter(vdpa_dev); struct ifcvf_hw *vf =3D vdpa_to_vf(vdpa_dev); - struct pci_dev *pdev =3D adapter->pdev; - size_t size; =20 - switch (vf->dev_type) { - case VIRTIO_ID_NET: - size =3D sizeof(struct virtio_net_config); - break; - case VIRTIO_ID_BLOCK: - size =3D sizeof(struct virtio_blk_config); - break; - default: - size =3D 0; - IFCVF_ERR(pdev, "VIRTIO ID %u not supported\n", vf->dev_type); - } - - return size; + return vf->config_size; } =20 static void ifcvf_vdpa_get_config(struct vdpa_device *vdpa_dev, @@ -392,8 +377,7 @@ static void ifcvf_vdpa_get_config(struct { struct ifcvf_hw *vf =3D vdpa_to_vf(vdpa_dev); =20 - WARN_ON(offset + len > sizeof(struct virtio_net_config)); - ifcvf_read_net_config(vf, offset, buf, len); + ifcvf_read_dev_config(vf, offset, buf, len); } =20 static void ifcvf_vdpa_set_config(struct vdpa_device *vdpa_dev, @@ -402,8 +386,7 @@ static void ifcvf_vdpa_set_config(struct { struct ifcvf_hw *vf =3D vdpa_to_vf(vdpa_dev); =20 - WARN_ON(offset + len > sizeof(struct virtio_net_config)); - ifcvf_write_net_config(vf, offset, buf, len); + ifcvf_write_dev_config(vf, offset, buf, len); } =20 static void ifcvf_vdpa_set_config_cb(struct vdpa_device *vdpa_dev, @@ -542,6 +525,7 @@ static int ifcvf_vdpa_dev_add(struct vdp vf->vring[i].irq =3D -EINVAL; =20 vf->hw_features =3D ifcvf_get_hw_features(vf); + vf->config_size =3D ifcvf_get_config_size(vf); =20 adapter->vdpa.mdev =3D &ifcvf_mgmt_dev->mdev; ret =3D _vdpa_register_device(&adapter->vdpa, vf->nr_vring); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 153E7C43219 for ; Tue, 25 Jan 2022 00:19:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357808AbiAYASo (ORCPT ); Mon, 24 Jan 2022 19:18:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2359649AbiAXXeV (ORCPT ); Mon, 24 Jan 2022 18:34:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23D9FC075D1E; Mon, 24 Jan 2022 13:36:30 -0800 (PST) Received: from smtp.kernel.org (relay.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 E06DCB81243; Mon, 24 Jan 2022 21:36:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C01FC340E4; Mon, 24 Jan 2022 21:36:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060187; bh=Vub3gPcbHXrEudD6mir+BV04nfHnrQJy1HXlwH2MdRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RBWuF3WFlG7PEZVMOdpNGjyZ2Ov2+t3yRo8Pviz4v3bbuMS1ZY5kmP+j0aLqZNPO0 X/4DilOsjh7sUKIvvQCJnQcnOp2NEqVkGag9J2YDZT7CfzZ5ddMoPeSbV2gQ/3agXl 07SS1ssBmLY+Q9lTi0h9ZPelka9tu36VbzqxT39w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiner Kallweit , Herbert Xu Subject: [PATCH 5.16 0836/1039] crypto: omap-aes - Fix broken pm_runtime_and_get() usage Date: Mon, 24 Jan 2022 19:43:45 +0100 Message-Id: <20220124184153.391678924@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Heiner Kallweit commit c2aec59be093bd44627bc4f6bc67e4614a93a7b6 upstream. This fix is basically the same as 3d6b661330a7 ("crypto: stm32 - Revert broken pm_runtime_resume_and_get changes"), just for the omap driver. If the return value isn't used, then pm_runtime_get_sync() has to be used for ensuring that the usage count is balanced. Fixes: 1f34cc4a8da3 ("crypto: omap-aes - Fix PM reference leak on omap-aes.= c") Cc: stable@vger.kernel.org Signed-off-by: Heiner Kallweit Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/omap-aes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/crypto/omap-aes.c +++ b/drivers/crypto/omap-aes.c @@ -1302,7 +1302,7 @@ static int omap_aes_suspend(struct devic =20 static int omap_aes_resume(struct device *dev) { - pm_runtime_resume_and_get(dev); + pm_runtime_get_sync(dev); return 0; } #endif From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C00BBC4332F for ; Tue, 25 Jan 2022 00:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2375220AbiAYATh (ORCPT ); Mon, 24 Jan 2022 19:19:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2359410AbiAXXeV (ORCPT ); Mon, 24 Jan 2022 18:34:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83F99C075D21; Mon, 24 Jan 2022 13:36:31 -0800 (PST) Received: from smtp.kernel.org (relay.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 14BB3614DD; Mon, 24 Jan 2022 21:36:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5F1DC340E4; Mon, 24 Jan 2022 21:36:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060190; bh=8FTpx20CPyOOXFtNwPoa4MCozejgitLRpKaNV6dHwN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VMrIBqjlt3uEmfRj14uqMHbdHycYDucZ/sG3ArIIgFpKthXHC9+SlYykH4sDS3Avi 5iUtOvF3QYECLLiS6zDPGx0+R8JdnykcYORMRc0i7NBrThEpaEXzYAhFpoZBkmnQQh 0uPW1BCK/X13wKQFrvMYJV90NRcQFN+/ZUel6BxA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Alexandre Torgue , Fabien Dessenne , Herbert Xu , Lionel Debieve , Nicolas Toromanoff , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Nicolas Toromanoff Subject: [PATCH 5.16 0837/1039] crypto: stm32/crc32 - Fix kernel BUG triggered in probe() Date: Mon, 24 Jan 2022 19:43:46 +0100 Message-Id: <20220124184153.426827249@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 29009604ad4e3ef784fd9b9fef6f23610ddf633d upstream. The include/linux/crypto.h struct crypto_alg field cra_driver_name descript= ion states "Unique name of the transformation provider. " ... " this contains t= he name of the chip or provider and the name of the transformation algorithm." In case of the stm32-crc driver, field cra_driver_name is identical for all registered transformation providers and set to the name of the driver itsel= f, which is incorrect. This patch fixes it by assigning a unique cra_driver_na= me to each registered transformation provider. The kernel crash is triggered when the driver calls crypto_register_shashes= () which calls crypto_register_shash(), which calls crypto_register_alg(), whi= ch calls __crypto_register_alg(), which returns -EEXIST, which is propagated back through this call chain. Upon -EEXIST from crypto_register_shash(), the crypto_register_shashes() starts unregistering the providers back, and calls crypto_unregister_shash(), which calls crypto_unregister_alg(), and this is where the BUG() triggers due to incorrect cra_refcnt. Fixes: b51dbe90912a ("crypto: stm32 - Support for STM32 CRC32 crypto module= ") Signed-off-by: Marek Vasut Cc: # 4.12+ Cc: Alexandre Torgue Cc: Fabien Dessenne Cc: Herbert Xu Cc: Lionel Debieve Cc: Nicolas Toromanoff Cc: linux-arm-kernel@lists.infradead.org Cc: linux-stm32@st-md-mailman.stormreply.com To: linux-crypto@vger.kernel.org Acked-by: Nicolas Toromanoff Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/stm32/stm32-crc32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/crypto/stm32/stm32-crc32.c +++ b/drivers/crypto/stm32/stm32-crc32.c @@ -279,7 +279,7 @@ static struct shash_alg algs[] =3D { .digestsize =3D CHKSUM_DIGEST_SIZE, .base =3D { .cra_name =3D "crc32", - .cra_driver_name =3D DRIVER_NAME, + .cra_driver_name =3D "stm32-crc32-crc32", .cra_priority =3D 200, .cra_flags =3D CRYPTO_ALG_OPTIONAL_KEY, .cra_blocksize =3D CHKSUM_BLOCK_SIZE, @@ -301,7 +301,7 @@ static struct shash_alg algs[] =3D { .digestsize =3D CHKSUM_DIGEST_SIZE, .base =3D { .cra_name =3D "crc32c", - .cra_driver_name =3D DRIVER_NAME, + .cra_driver_name =3D "stm32-crc32-crc32c", .cra_priority =3D 200, .cra_flags =3D CRYPTO_ALG_OPTIONAL_KEY, .cra_blocksize =3D CHKSUM_BLOCK_SIZE, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0749BC3527C for ; Tue, 25 Jan 2022 00:30:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3409856AbiAYA1i (ORCPT ); Mon, 24 Jan 2022 19:27:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48184 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389762AbiAXVgg (ORCPT ); Mon, 24 Jan 2022 16:36:36 -0500 Received: from smtp.kernel.org (relay.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 B9AF0B8121C; Mon, 24 Jan 2022 21:36:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC4D0C340E4; Mon, 24 Jan 2022 21:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060193; bh=llqmotql0dU1BNpAsfO0Bt9goMpDGsF/FGV07efugkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i9qnq/lDhbb59LbB5CmK6zDdxBbqt7rFN3ifeTA35257P33Cs6RpA8voh8gg7WoSv abaGI6EY5gZxOCmV8qobdSmy7SEY8OKNuozcM76veOqGo1pMK5MZC+kra2HaszvlLi LQ0sWk6wH40nC/HC5xa8YarfwttrNErDZ6I0lNew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Li , =?UTF-8?q?Horia=20Geant=C4=83?= , Herbert Xu Subject: [PATCH 5.16 0838/1039] crypto: caam - replace this_cpu_ptr with raw_cpu_ptr Date: Mon, 24 Jan 2022 19:43:47 +0100 Message-Id: <20220124184153.461557090@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Meng Li commit efd21e10fc3bf4c6da122470a5ae89ec4ed8d180 upstream. When enable the kernel debug config, there is below calltrace detected: BUG: using smp_processor_id() in preemptible [00000000] code: cryptomgr_tes= t/339 caller is debug_smp_processor_id+0x20/0x30 CPU: 9 PID: 339 Comm: cryptomgr_test Not tainted 5.10.63-yocto-standard #1 Hardware name: NXP Layerscape LX2160ARDB (DT) Call trace: dump_backtrace+0x0/0x1a0 show_stack+0x24/0x30 dump_stack+0xf0/0x13c check_preemption_disabled+0x100/0x110 debug_smp_processor_id+0x20/0x30 dpaa2_caam_enqueue+0x10c/0x25c ...... cryptomgr_test+0x38/0x60 kthread+0x158/0x164 ret_from_fork+0x10/0x38 According to the comment in commit ac5d15b4519f("crypto: caam/qi2 - use affine DPIOs "), because preemption is no longer disabled while trying to enqueue an FQID, it might be possible to run the enqueue on a different CPU(due to migration, when in process context), however this wouldn't be a functionality issue. But there will be above calltrace when enable kernel debug config. So, replace this_cpu_ptr with raw_cpu_ptr to avoid above call trace. Fixes: ac5d15b4519f ("crypto: caam/qi2 - use affine DPIOs") Cc: stable@vger.kernel.org Signed-off-by: Meng Li Reviewed-by: Horia Geant=C4=83 Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/caam/caamalg_qi2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/crypto/caam/caamalg_qi2.c +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -5470,7 +5470,7 @@ int dpaa2_caam_enqueue(struct device *de dpaa2_fd_set_len(&fd, dpaa2_fl_get_len(&req->fd_flt[1])); dpaa2_fd_set_flc(&fd, req->flc_dma); =20 - ppriv =3D this_cpu_ptr(priv->ppriv); + ppriv =3D raw_cpu_ptr(priv->ppriv); for (i =3D 0; i < (priv->dpseci_attr.num_tx_queues << 1); i++) { err =3D dpaa2_io_service_enqueue_fq(ppriv->dpio, ppriv->req_fqid, &fd); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AC4AC433EF for ; Mon, 24 Jan 2022 22:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1454734AbiAXW3M (ORCPT ); Mon, 24 Jan 2022 17:29:12 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48206 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455870AbiAXVgk (ORCPT ); Mon, 24 Jan 2022 16:36:40 -0500 Received: from smtp.kernel.org (relay.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 A7E0BB8123A; Mon, 24 Jan 2022 21:36:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D92C6C340E4; Mon, 24 Jan 2022 21:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060196; bh=BsOquwzcCQW5R6uppJmiiyzG8hpOx4nUbKNuwlUKS3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oly5jiwSc2TIgtATrUnekt14Yakhb3Z6cbTufGCM71Px7quAjD/WvnNx5tEyPYKUt kk8Ai5gdlJZj4ktHonor8YmNJAlxhMEyfyRXB4h6gX9AMrqqCttTXnLbo1QY0HCyXw GUTOuyETsjzePJxMUAVrt/rBk/uUxrnu/yGGaXD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Petr Cvachoucek , Richard Weinberger Subject: [PATCH 5.16 0839/1039] ubifs: Error path in ubifs_remount_rw() seems to wrongly free write buffers Date: Mon, 24 Jan 2022 19:43:48 +0100 Message-Id: <20220124184153.499980607@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Petr Cvachoucek commit 3fea4d9d160186617ff40490ae01f4f4f36b28ff upstream. it seems freeing the write buffers in the error path of the ubifs_remount_rw() is wrong. It leads later to a kernel oops like this: [10016.431274] UBIFS (ubi0:0): start fixing up free space [10090.810042] UBIFS (ubi0:0): free space fixup complete [10090.814623] UBIFS error (ubi0:0 pid 512): ubifs_remount_fs: cannot spawn "ubifs_bgt0_0", error -4 [10101.915108] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 517 [10105.275498] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000030 [10105.284352] Mem abort info: [10105.287160] ESR =3D 0x96000006 [10105.290252] EC =3D 0x25: DABT (current EL), IL =3D 32 bits [10105.295592] SET =3D 0, FnV =3D 0 [10105.298652] EA =3D 0, S1PTW =3D 0 [10105.301848] Data abort info: [10105.304723] ISV =3D 0, ISS =3D 0x00000006 [10105.308573] CM =3D 0, WnR =3D 0 [10105.311564] user pgtable: 4k pages, 48-bit VAs, pgdp=3D00000000f03d1000 [10105.318034] [0000000000000030] pgd=3D00000000f6cee003, pud=3D00000000f4884003, pmd=3D0000000000000000 [10105.326783] Internal error: Oops: 96000006 [#1] PREEMPT SMP [10105.332355] Modules linked in: ath10k_pci ath10k_core ath mac80211 libarc4 cfg80211 nvme nvme_core cryptodev(O) [10105.342468] CPU: 3 PID: 518 Comm: touch Tainted: G O 5.4.3 #1 [10105.349517] Hardware name: HYPEX CPU (DT) [10105.353525] pstate: 40000005 (nZcv daif -PAN -UAO) [10105.358324] pc : atomic64_try_cmpxchg_acquire.constprop.22+0x8/0x34 [10105.364596] lr : mutex_lock+0x1c/0x34 [10105.368253] sp : ffff000075633aa0 [10105.371563] x29: ffff000075633aa0 x28: 0000000000000001 [10105.376874] x27: ffff000076fa80c8 x26: 0000000000000004 [10105.382185] x25: 0000000000000030 x24: 0000000000000000 [10105.387495] x23: 0000000000000000 x22: 0000000000000038 [10105.392807] x21: 000000000000000c x20: ffff000076fa80c8 [10105.398119] x19: ffff000076fa8000 x18: 0000000000000000 [10105.403429] x17: 0000000000000000 x16: 0000000000000000 [10105.408741] x15: 0000000000000000 x14: fefefefefefefeff [10105.414052] x13: 0000000000000000 x12: 0000000000000fe0 [10105.419364] x11: 0000000000000fe0 x10: ffff000076709020 [10105.424675] x9 : 0000000000000000 x8 : 00000000000000a0 [10105.429986] x7 : ffff000076fa80f4 x6 : 0000000000000030 [10105.435297] x5 : 0000000000000000 x4 : 0000000000000000 [10105.440609] x3 : 0000000000000000 x2 : ffff00006f276040 [10105.445920] x1 : ffff000075633ab8 x0 : 0000000000000030 [10105.451232] Call trace: [10105.453676] atomic64_try_cmpxchg_acquire.constprop.22+0x8/0x34 [10105.459600] ubifs_garbage_collect+0xb4/0x334 [10105.463956] ubifs_budget_space+0x398/0x458 [10105.468139] ubifs_create+0x50/0x180 [10105.471712] path_openat+0x6a0/0x9b0 [10105.475284] do_filp_open+0x34/0x7c [10105.478771] do_sys_open+0x78/0xe4 [10105.482170] __arm64_sys_openat+0x1c/0x24 [10105.486180] el0_svc_handler+0x84/0xc8 [10105.489928] el0_svc+0x8/0xc [10105.492808] Code: 52800013 17fffffb d2800003 f9800011 (c85ffc05) [10105.498903] ---[ end trace 46b721d93267a586 ]--- To reproduce the problem: 1. Filesystem initially mounted read-only, free space fixup flag set. 2. mount -o remount,rw 3. it takes some time (free space fixup running) ... try to terminate running mount by CTRL-C ... does not respond, only after free space fixup is complete ... then "ubifs_remount_fs: cannot spawn "ubifs_bgt0_0", error -4" 4. mount -o remount,rw ... now finished instantly (fixup already done). 5. Create file or just unmount the filesystem and we get the oops. Cc: Fixes: b50b9f408502 ("UBIFS: do not free write-buffers when in R/O mode") Signed-off-by: Petr Cvachoucek Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ubifs/super.c | 1 - 1 file changed, 1 deletion(-) --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1853,7 +1853,6 @@ out: kthread_stop(c->bgt); c->bgt =3D NULL; } - free_wbufs(c); kfree(c->write_reserve_buf); c->write_reserve_buf =3D NULL; vfree(c->ileb_buf); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABBE3C433FE for ; Tue, 25 Jan 2022 00:32:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3411156AbiAYAcY (ORCPT ); Mon, 24 Jan 2022 19:32:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48228 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455879AbiAXVgm (ORCPT ); Mon, 24 Jan 2022 16:36:42 -0500 Received: from smtp.kernel.org (relay.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 76241B8123D; Mon, 24 Jan 2022 21:36:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0959C340E4; Mon, 24 Jan 2022 21:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060199; bh=ddcl4cBea324E6KzDBct/pV9ygz8c88MAFzgAN9niJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0I4TpHxm+HYQ6Ibu9Bzb0qd+8VuGgR2AbFu65EHkH2qSfLVHXXcAKzGEwUBlBNp89 +2MJmsumvntznRLUNYi1NFCJxvrGbpnuuOGvautVsw3Pw+UbEwLIqJBtOTMrKyPXJW xbIOiuHMB9KQbN3fs9fysZ00kP3cUtqy1pIfWg/w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lino Sanfilippo , Stefan Berger , Jarkko Sakkinen Subject: [PATCH 5.16 0840/1039] tpm: fix potential NULL pointer access in tpm_del_char_device Date: Mon, 24 Jan 2022 19:43:49 +0100 Message-Id: <20220124184153.532359847@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lino Sanfilippo commit eabad7ba2c752392ae50f24a795093fb115b686d upstream. Some SPI controller drivers unregister the controller in the shutdown handler (e.g. BCM2835). If such a controller is used with a TPM 2 slave chip->ops may be accessed when it is already NULL: At system shutdown the pre-shutdown handler tpm_class_shutdown() shuts down TPM 2 and sets chip->ops to NULL. Then at SPI controller unregistration tpm_tis_spi_remove() is called and eventually calls tpm_del_char_device() which tries to shut down TPM 2 again. Thereby it accesses chip->ops again: (tpm_del_char_device calls tpm_chip_start which calls tpm_clk_enable which calls chip->ops->clk_enable). Avoid the NULL pointer access by testing if chip->ops is valid and skipping the TPM 2 shutdown procedure in case it is NULL. Cc: stable@vger.kernel.org Signed-off-by: Lino Sanfilippo Fixes: 39d0099f9439 ("powerpc/pseries: Add shutdown() to vio_driver and vio= _bus") Reviewed-by: Stefan Berger Tested-by: Stefan Berger Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/char/tpm/tpm-chip.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c @@ -474,13 +474,21 @@ static void tpm_del_char_device(struct t =20 /* Make the driver uncallable. */ down_write(&chip->ops_sem); - if (chip->flags & TPM_CHIP_FLAG_TPM2) { - if (!tpm_chip_start(chip)) { - tpm2_shutdown(chip, TPM2_SU_CLEAR); - tpm_chip_stop(chip); + + /* + * Check if chip->ops is still valid: In case that the controller + * drivers shutdown handler unregisters the controller in its + * shutdown handler we are called twice and chip->ops to NULL. + */ + if (chip->ops) { + if (chip->flags & TPM_CHIP_FLAG_TPM2) { + if (!tpm_chip_start(chip)) { + tpm2_shutdown(chip, TPM2_SU_CLEAR); + tpm_chip_stop(chip); + } } + chip->ops =3D NULL; } - chip->ops =3D NULL; up_write(&chip->ops_sem); } =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B26AC433F5 for ; Mon, 24 Jan 2022 22:31:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587503AbiAXW2e (ORCPT ); Mon, 24 Jan 2022 17:28:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54276 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455265AbiAXVfF (ORCPT ); Mon, 24 Jan 2022 16:35:05 -0500 Received: from smtp.kernel.org (relay.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 587EF614CB; Mon, 24 Jan 2022 21:35:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CD02C340E4; Mon, 24 Jan 2022 21:35:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060103; bh=fKi7ZwPG8n0+BGVYMxk00IA52PoG1YjyUx5UZx1Vb/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CyfW4dx0pc5FES4nKvQR4mnD3JTTXE2D/wa0BIue+FuRULxdHE3FOkN6pXuD+7+Vw /suHcanx2ZVWRcsH96PN7M2jTmIxt/8fCvpKYhFg6gJcD+Fv3TfiOuu9n9Z+Tg3VuB AxpAIdfIaG6ahWQaXUc0JgDYNxfxInXXSNcQb1fE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrick Williams , Jarkko Sakkinen Subject: [PATCH 5.16 0841/1039] tpm: fix NPE on probe for missing device Date: Mon, 24 Jan 2022 19:43:50 +0100 Message-Id: <20220124184153.564796737@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Patrick Williams commit 84cc69589700b90a4c8d27b481a51fce8cca6051 upstream. When using the tpm_tis-spi driver on a system missing the physical TPM, a null pointer exception was observed. [ 0.938677] Unable to handle kernel NULL pointer dereference at virt= ual address 00000004 [ 0.939020] pgd =3D 10c753cb [ 0.939237] [00000004] *pgd=3D00000000 [ 0.939808] Internal error: Oops: 5 [#1] SMP ARM [ 0.940157] CPU: 0 PID: 48 Comm: kworker/u4:1 Not tainted 5.15.10-dd= 1e40c #1 [ 0.940364] Hardware name: Generic DT based system [ 0.940601] Workqueue: events_unbound async_run_entry_fn [ 0.941048] PC is at tpm_tis_remove+0x28/0xb4 [ 0.941196] LR is at tpm_tis_core_init+0x170/0x6ac This is due to an attempt in 'tpm_tis_remove' to use the drvdata, which was not initialized in 'tpm_tis_core_init' prior to the first error. Move the initialization of drvdata earlier so 'tpm_tis_remove' has access to it. Signed-off-by: Patrick Williams Fixes: 79ca6f74dae0 ("tpm: fix Atmel TPM crash caused by too frequent queri= es") Cc: stable@vger.kernel.org Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/char/tpm/tpm_tis_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -950,6 +950,8 @@ int tpm_tis_core_init(struct device *dev priv->timeout_max =3D TPM_TIMEOUT_USECS_MAX; priv->phy_ops =3D phy_ops; =20 + dev_set_drvdata(&chip->dev, priv); + rc =3D tpm_tis_read32(priv, TPM_DID_VID(0), &vendor); if (rc < 0) return rc; @@ -962,8 +964,6 @@ int tpm_tis_core_init(struct device *dev priv->timeout_max =3D TIS_TIMEOUT_MAX_ATML; } =20 - dev_set_drvdata(&chip->dev, priv); - if (is_bsw()) { priv->ilb_base_addr =3D ioremap(INTEL_LEGACY_BLK_BASE_ADDR, ILB_REMAP_SIZE); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F74EC433F5 for ; Tue, 25 Jan 2022 00:19:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374458AbiAYARF (ORCPT ); Mon, 24 Jan 2022 19:17:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1850701AbiAXXah (ORCPT ); Mon, 24 Jan 2022 18:30:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13DDAC07595C; Mon, 24 Jan 2022 13:35:09 -0800 (PST) Received: from smtp.kernel.org (relay.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 CAFD2B80CCF; Mon, 24 Jan 2022 21:35:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BC8AC340E4; Mon, 24 Jan 2022 21:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060106; bh=2XYLbk5nhzUYg8pfk+MC07Cy/191v7DzF5yYA5/9A2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2crNjcGraS2Qb0DqyzfY9o22BuSUa545pUfqggfpIhAijd6Lan9nnXq0mbwOmWyVN Ubts6YHatFNcvhZWstCpw1MGJPikvjQFdQNReaEgEe0MzuvLJnrfKlHL4/fpFLWa/R FR7dibf5rT6e4mal/qpTmgXkVoQyLk68QWWuO8sw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Lee Jones , Svyatoslav Ryhel Subject: [PATCH 5.16 0842/1039] mfd: tps65910: Set PWR_OFF bit during driver probe Date: Mon, 24 Jan 2022 19:43:51 +0100 Message-Id: <20220124184153.596841349@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Osipenko commit 7620ad0bdfac1efff4a1228cd36ae62a9d8206b0 upstream. The PWR_OFF bit needs to be set in order to power off properly, without hanging PMIC. This bit needs to be set early in order to allow thermal protection of NVIDIA Terga SoCs to power off hardware properly, otherwise a battery re-plug may be needed on some devices to recover after the hang. Cc: Signed-off-by: Dmitry Osipenko Tested-by: Svyatoslav Ryhel # ASUS TF201 Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211124190104.23554-1-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mfd/tps65910.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -436,15 +436,6 @@ static void tps65910_power_off(void) =20 tps65910 =3D dev_get_drvdata(&tps65910_i2c_client->dev); =20 - /* - * The PWR_OFF bit needs to be set separately, before transitioning - * to the OFF state. It enables the "sequential" power-off mode on - * TPS65911, it's a NO-OP on TPS65910. - */ - if (regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL, - DEVCTRL_PWR_OFF_MASK) < 0) - return; - regmap_update_bits(tps65910->regmap, TPS65910_DEVCTRL, DEVCTRL_DEV_OFF_MASK | DEVCTRL_DEV_ON_MASK, DEVCTRL_DEV_OFF_MASK); @@ -504,6 +495,19 @@ static int tps65910_i2c_probe(struct i2c tps65910_sleepinit(tps65910, pmic_plat_data); =20 if (pmic_plat_data->pm_off && !pm_power_off) { + /* + * The PWR_OFF bit needs to be set separately, before + * transitioning to the OFF state. It enables the "sequential" + * power-off mode on TPS65911, it's a NO-OP on TPS65910. + */ + ret =3D regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL, + DEVCTRL_PWR_OFF_MASK); + if (ret) { + dev_err(&i2c->dev, "failed to set power-off mode: %d\n", + ret); + return ret; + } + tps65910_i2c_client =3D i2c; pm_power_off =3D tps65910_power_off; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4221EC4332F for ; Tue, 25 Jan 2022 00:18:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374738AbiAYASL (ORCPT ); Mon, 24 Jan 2022 19:18:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1851039AbiAXXbp (ORCPT ); Mon, 24 Jan 2022 18:31:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23DADC07595E; Mon, 24 Jan 2022 13:35:11 -0800 (PST) Received: from smtp.kernel.org (relay.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 BFD10B80CCF; Mon, 24 Jan 2022 21:35:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFCEEC340E4; Mon, 24 Jan 2022 21:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060109; bh=9YkuKF8cpwuIWjIHtOGRypGioyQeoLf8mYpkm6MpMf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o16+2XEVQQ6+NYFbZbNWWzUNP05iATsvkeYuPUr8RQEW6CjHJm8BKZkfvnXs661of HVbV72gCo9m0L0cPB2OcdNjEcBmFOYb9TMt+CEMCQsDbWa4DghIavDgxEUnN9TTIbF ifkHWYcZGkhyGTfhZ/U334k1v6j43TVoOW0jVGUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kunihiko Hayashi , Mark Brown Subject: [PATCH 5.16 0843/1039] spi: uniphier: Fix a bug that doesnt point to private data correctly Date: Mon, 24 Jan 2022 19:43:52 +0100 Message-Id: <20220124184153.627105558@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kunihiko Hayashi commit 80bb73a9fbcde4ecc55e12f10c73fabbe68a24d1 upstream. In uniphier_spi_remove(), there is a wrong code to get private data from the platform device, so the driver can't be removed properly. The driver should get spi_master from the platform device and retrieve the private data from it. Cc: Fixes: 5ba155a4d4cc ("spi: add SPI controller driver for UniPhier SoC") Signed-off-by: Kunihiko Hayashi Link: https://lore.kernel.org/r/1640148492-32178-1-git-send-email-hayashi.k= unihiko@socionext.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/spi/spi-uniphier.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/drivers/spi/spi-uniphier.c +++ b/drivers/spi/spi-uniphier.c @@ -767,12 +767,13 @@ out_master_put: =20 static int uniphier_spi_remove(struct platform_device *pdev) { - struct uniphier_spi_priv *priv =3D platform_get_drvdata(pdev); + struct spi_master *master =3D platform_get_drvdata(pdev); + struct uniphier_spi_priv *priv =3D spi_master_get_devdata(master); =20 - if (priv->master->dma_tx) - dma_release_channel(priv->master->dma_tx); - if (priv->master->dma_rx) - dma_release_channel(priv->master->dma_rx); + if (master->dma_tx) + dma_release_channel(master->dma_tx); + if (master->dma_rx) + dma_release_channel(master->dma_rx); =20 clk_disable_unprepare(priv->clk); =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE18FC433EF for ; Tue, 25 Jan 2022 00:18:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374679AbiAYARk (ORCPT ); Mon, 24 Jan 2022 19:17:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1851079AbiAXXbx (ORCPT ); Mon, 24 Jan 2022 18:31:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B4F3C075D05; Mon, 24 Jan 2022 13:35:13 -0800 (PST) Received: from smtp.kernel.org (relay.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 DFAEA614DA; Mon, 24 Jan 2022 21:35:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F398EC340E4; Mon, 24 Jan 2022 21:35:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060112; bh=Ss+KyW9+v4+zPtZvCbZxmRTFAjt5mNV30rcy4WIJht8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yWNekzEQUQtqfBF5fITcfnD2mTnVfsxE84QV8hBwtkOu3Eb9Ej9/1DpOpzmw+aksj Nbkm6oyD1O4LwgU//ol81hQmwKtqbLk66WgCL/BawK3vTQJjVdg/Ou1qqfNAugcJOx JYE08hIMDtx5J+DcfxD8xO5ltwKE8SXr1AeHrqts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksandr Andrushchenko , Boris Ostrovsky , Juergen Gross Subject: [PATCH 5.16 0844/1039] xen/gntdev: fix unmap notification order Date: Mon, 24 Jan 2022 19:43:53 +0100 Message-Id: <20220124184153.659861284@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko commit ce2f46f3531a03781181b7f4bd1ff9f8c5086e7e upstream. While working with Xen's libxenvchan library I have faced an issue with unmap notifications sent in wrong order if both UNMAP_NOTIFY_SEND_EVENT and UNMAP_NOTIFY_CLEAR_BYTE were requested: first we send an event channel notification and then clear the notification byte which renders in the below inconsistency (cli_live is the byte which was requested to be cleared on un= map): [ 444.514243] gntdev_put_map UNMAP_NOTIFY_SEND_EVENT map->notify.event 6 libxenvchan_is_open cli_live 1 [ 444.515239] __unmap_grant_pages UNMAP_NOTIFY_CLEAR_BYTE at 14 Thus it is not possible to reliably implement the checks like - wait for the notification (UNMAP_NOTIFY_SEND_EVENT) - check the variable (UNMAP_NOTIFY_CLEAR_BYTE) because it is possible that the variable gets checked before it is cleared by the kernel. To fix that we need to re-order the notifications, so the variable is first gets cleared and then the event channel notification is sent. With this fix I can see the correct order of execution: [ 54.522611] __unmap_grant_pages UNMAP_NOTIFY_CLEAR_BYTE at 14 [ 54.537966] gntdev_put_map UNMAP_NOTIFY_SEND_EVENT map->notify.event 6 libxenvchan_is_open cli_live 0 Cc: stable@vger.kernel.org Signed-off-by: Oleksandr Andrushchenko Reviewed-by: Boris Ostrovsky Link: https://lore.kernel.org/r/20211210092817.580718-1-andr2000@gmail.com Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/xen/gntdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -250,13 +250,13 @@ void gntdev_put_map(struct gntdev_priv * if (!refcount_dec_and_test(&map->users)) return; =20 + if (map->pages && !use_ptemod) + unmap_grant_pages(map, 0, map->count); + if (map->notify.flags & UNMAP_NOTIFY_SEND_EVENT) { notify_remote_via_evtchn(map->notify.event); evtchn_put(map->notify.event); } - - if (map->pages && !use_ptemod) - unmap_grant_pages(map, 0, map->count); gntdev_free_map(map); } =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAD2DC433FE for ; Tue, 25 Jan 2022 00:31:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410018AbiAYA2Q (ORCPT ); Mon, 24 Jan 2022 19:28:16 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47594 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455357AbiAXVfS (ORCPT ); Mon, 24 Jan 2022 16:35:18 -0500 Received: from smtp.kernel.org (relay.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 819FAB811A2; Mon, 24 Jan 2022 21:35:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5B43C340E4; Mon, 24 Jan 2022 21:35:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060115; bh=KF6pibaRN3M5P+SzqEn0+NUk4vxB+N8QiQEVZWzxJhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p1cbTGywPSMm5LT87sIccUe0SOXQYjWx8v919h2JhaXkNFL77BSIdC69pBZvYdkmk mY0OcwL7s98xI+DzNWp03uQM4PiWdYf3mZiyntwNxGdWexcUzoxelzA5LniSN64v7b HYm1/IdWlmsjsXmuc4VH+lnB8Q8k4efDmA29neaI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guoqing Jiang , Xiao Ni , Song Liu Subject: [PATCH 5.16 0845/1039] md: Move alloc/free acct bioset in to personality Date: Mon, 24 Jan 2022 19:43:54 +0100 Message-Id: <20220124184153.690927004@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiao Ni commit 0c031fd37f69deb0cd8c43bbfcfccd62ebd7e952 upstream. bioset acct is only needed for raid0 and raid5. Therefore, md_run only allocates it for raid0 and raid5. However, this does not cover personality takeover, which may cause uninitialized bioset. For example, the following repro steps: mdadm -CR /dev/md0 -l1 -n2 /dev/loop0 /dev/loop1 mdadm --wait /dev/md0 mkfs.xfs /dev/md0 mdadm /dev/md0 --grow -l5 mount /dev/md0 /mnt causes panic like: [ 225.933939] BUG: kernel NULL pointer dereference, address: 0000000000000= 000 [ 225.934903] #PF: supervisor instruction fetch in kernel mode [ 225.935639] #PF: error_code(0x0010) - not-present page [ 225.936361] PGD 0 P4D 0 [ 225.936677] Oops: 0010 [#1] PREEMPT SMP DEBUG_PAGEALLOC KASAN PTI [ 225.937525] CPU: 27 PID: 1133 Comm: mount Not tainted 5.16.0-rc3+ #706 [ 225.938416] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS = 1.13.0-2.module_el8.4.0+547+a85d02ba 04/01/2014 [ 225.939922] RIP: 0010:0x0 [ 225.940289] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd= 6. [ 225.941196] RSP: 0018:ffff88815897eff0 EFLAGS: 00010246 [ 225.941897] RAX: 0000000000000000 RBX: 0000000000092800 RCX: ffffffff813= 70a39 [ 225.942813] RDX: dffffc0000000000 RSI: 0000000000000000 RDI: 00000000000= 92800 [ 225.943772] RBP: 1ffff1102b12fe04 R08: fffffbfff0b43c01 R09: fffffbfff0b= 43c01 [ 225.944807] R10: ffffffff85a1e007 R11: fffffbfff0b43c00 R12: ffff88810ea= aaf58 [ 225.945757] R13: 0000000000000000 R14: ffff88810eaaafb8 R15: ffff8881589= 7f040 [ 225.946709] FS: 00007ff3f2505080(0000) GS:ffff888fb5e00000(0000) knlGS:= 0000000000000000 [ 225.947814] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 225.948556] CR2: ffffffffffffffd6 CR3: 000000015aa5a006 CR4: 00000000003= 70ee0 [ 225.949537] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 00000000000= 00000 [ 225.950455] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 00000000000= 00400 [ 225.951414] Call Trace: [ 225.951787] [ 225.952120] mempool_alloc+0xe5/0x250 [ 225.952625] ? mempool_resize+0x370/0x370 [ 225.953187] ? rcu_read_lock_sched_held+0xa1/0xd0 [ 225.953862] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 225.954464] ? sched_clock_cpu+0x15/0x120 [ 225.955019] ? find_held_lock+0xac/0xd0 [ 225.955564] bio_alloc_bioset+0x1ed/0x2a0 [ 225.956080] ? lock_downgrade+0x3a0/0x3a0 [ 225.956644] ? bvec_alloc+0xc0/0xc0 [ 225.957135] bio_clone_fast+0x19/0x80 [ 225.957651] raid5_make_request+0x1370/0x1b70 [ 225.958286] ? sched_clock_cpu+0x15/0x120 [ 225.958797] ? __lock_acquire+0x8b2/0x3510 [ 225.959339] ? raid5_get_active_stripe+0xce0/0xce0 [ 225.959986] ? lock_is_held_type+0xd8/0x130 [ 225.960528] ? rcu_read_lock_sched_held+0xa1/0xd0 [ 225.961135] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 225.961703] ? sched_clock_cpu+0x15/0x120 [ 225.962232] ? lock_release+0x27a/0x6c0 [ 225.962746] ? do_wait_intr_irq+0x130/0x130 [ 225.963302] ? lock_downgrade+0x3a0/0x3a0 [ 225.963815] ? lock_release+0x6c0/0x6c0 [ 225.964348] md_handle_request+0x342/0x530 [ 225.964888] ? set_in_sync+0x170/0x170 [ 225.965397] ? blk_queue_split+0x133/0x150 [ 225.965988] ? __blk_queue_split+0x8b0/0x8b0 [ 225.966524] ? submit_bio_checks+0x3b2/0x9d0 [ 225.967069] md_submit_bio+0x127/0x1c0 [...] Fix this by moving alloc/free of acct bioset to pers->run and pers->free. While we are on this, properly handle md_integrity_register() error in raid0_run(). Fixes: daee2024715d (md: check level before create and exit io_acct_set) Cc: stable@vger.kernel.org Acked-by: Guoqing Jiang Signed-off-by: Xiao Ni Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/md/md.c | 27 +++++++++++++++++---------- drivers/md/md.h | 2 ++ drivers/md/raid0.c | 38 ++++++++++++++++++++++++++++---------- drivers/md/raid5.c | 41 ++++++++++++++++++++++++++++++----------- 4 files changed, 77 insertions(+), 31 deletions(-) --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5875,13 +5875,6 @@ int md_run(struct mddev *mddev) if (err) goto exit_bio_set; } - if (mddev->level !=3D 1 && mddev->level !=3D 10 && - !bioset_initialized(&mddev->io_acct_set)) { - err =3D bioset_init(&mddev->io_acct_set, BIO_POOL_SIZE, - offsetof(struct md_io_acct, bio_clone), 0); - if (err) - goto exit_sync_set; - } =20 spin_lock(&pers_lock); pers =3D find_pers(mddev->level, mddev->clevel); @@ -6058,9 +6051,6 @@ bitmap_abort: module_put(pers->owner); md_bitmap_destroy(mddev); abort: - if (mddev->level !=3D 1 && mddev->level !=3D 10) - bioset_exit(&mddev->io_acct_set); -exit_sync_set: bioset_exit(&mddev->sync_set); exit_bio_set: bioset_exit(&mddev->bio_set); @@ -8594,6 +8584,23 @@ void md_submit_discard_bio(struct mddev } EXPORT_SYMBOL_GPL(md_submit_discard_bio); =20 +int acct_bioset_init(struct mddev *mddev) +{ + int err =3D 0; + + if (!bioset_initialized(&mddev->io_acct_set)) + err =3D bioset_init(&mddev->io_acct_set, BIO_POOL_SIZE, + offsetof(struct md_io_acct, bio_clone), 0); + return err; +} +EXPORT_SYMBOL_GPL(acct_bioset_init); + +void acct_bioset_exit(struct mddev *mddev) +{ + bioset_exit(&mddev->io_acct_set); +} +EXPORT_SYMBOL_GPL(acct_bioset_exit); + static void md_end_io_acct(struct bio *bio) { struct md_io_acct *md_io_acct =3D bio->bi_private; --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -721,6 +721,8 @@ extern void md_error(struct mddev *mddev extern void md_finish_reshape(struct mddev *mddev); void md_submit_discard_bio(struct mddev *mddev, struct md_rdev *rdev, struct bio *bio, sector_t start, sector_t size); +int acct_bioset_init(struct mddev *mddev); +void acct_bioset_exit(struct mddev *mddev); void md_account_bio(struct mddev *mddev, struct bio **bio); =20 extern bool __must_check md_flush_request(struct mddev *mddev, struct bio = *bio); --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -356,7 +356,21 @@ static sector_t raid0_size(struct mddev return array_sectors; } =20 -static void raid0_free(struct mddev *mddev, void *priv); +static void free_conf(struct mddev *mddev, struct r0conf *conf) +{ + kfree(conf->strip_zone); + kfree(conf->devlist); + kfree(conf); + mddev->private =3D NULL; +} + +static void raid0_free(struct mddev *mddev, void *priv) +{ + struct r0conf *conf =3D priv; + + free_conf(mddev, conf); + acct_bioset_exit(mddev); +} =20 static int raid0_run(struct mddev *mddev) { @@ -370,11 +384,16 @@ static int raid0_run(struct mddev *mddev if (md_check_no_bitmap(mddev)) return -EINVAL; =20 + if (acct_bioset_init(mddev)) { + pr_err("md/raid0:%s: alloc acct bioset failed.\n", mdname(mddev)); + return -ENOMEM; + } + /* if private is not null, we are here after takeover */ if (mddev->private =3D=3D NULL) { ret =3D create_strip_zones(mddev, &conf); if (ret < 0) - return ret; + goto exit_acct_set; mddev->private =3D conf; } conf =3D mddev->private; @@ -413,17 +432,16 @@ static int raid0_run(struct mddev *mddev dump_zones(mddev); =20 ret =3D md_integrity_register(mddev); + if (ret) + goto free; =20 return ret; -} =20 -static void raid0_free(struct mddev *mddev, void *priv) -{ - struct r0conf *conf =3D priv; - - kfree(conf->strip_zone); - kfree(conf->devlist); - kfree(conf); +free: + free_conf(mddev, conf); +exit_acct_set: + acct_bioset_exit(mddev); + return ret; } =20 static void raid0_handle_discard(struct mddev *mddev, struct bio *bio) --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -7446,12 +7446,19 @@ static int raid5_run(struct mddev *mddev struct md_rdev *rdev; struct md_rdev *journal_dev =3D NULL; sector_t reshape_offset =3D 0; - int i; + int i, ret =3D 0; long long min_offset_diff =3D 0; int first =3D 1; =20 - if (mddev_init_writes_pending(mddev) < 0) + if (acct_bioset_init(mddev)) { + pr_err("md/raid456:%s: alloc acct bioset failed.\n", mdname(mddev)); return -ENOMEM; + } + + if (mddev_init_writes_pending(mddev) < 0) { + ret =3D -ENOMEM; + goto exit_acct_set; + } =20 if (mddev->recovery_cp !=3D MaxSector) pr_notice("md/raid:%s: not clean -- starting background reconstruction\n= ", @@ -7482,7 +7489,8 @@ static int raid5_run(struct mddev *mddev (mddev->bitmap_info.offset || mddev->bitmap_info.file)) { pr_notice("md/raid:%s: array cannot have both journal and bitmap\n", mdname(mddev)); - return -EINVAL; + ret =3D -EINVAL; + goto exit_acct_set; } =20 if (mddev->reshape_position !=3D MaxSector) { @@ -7507,13 +7515,15 @@ static int raid5_run(struct mddev *mddev if (journal_dev) { pr_warn("md/raid:%s: don't support reshape with journal - aborting.\n", mdname(mddev)); - return -EINVAL; + ret =3D -EINVAL; + goto exit_acct_set; } =20 if (mddev->new_level !=3D mddev->level) { pr_warn("md/raid:%s: unsupported reshape required - aborting.\n", mdname(mddev)); - return -EINVAL; + ret =3D -EINVAL; + goto exit_acct_set; } old_disks =3D mddev->raid_disks - mddev->delta_disks; /* reshape_position must be on a new-stripe boundary, and one @@ -7529,7 +7539,8 @@ static int raid5_run(struct mddev *mddev if (sector_div(here_new, chunk_sectors * new_data_disks)) { pr_warn("md/raid:%s: reshape_position not on a stripe boundary\n", mdname(mddev)); - return -EINVAL; + ret =3D -EINVAL; + goto exit_acct_set; } reshape_offset =3D here_new * chunk_sectors; /* here_new is the stripe we will write to */ @@ -7551,7 +7562,8 @@ static int raid5_run(struct mddev *mddev else if (mddev->ro =3D=3D 0) { pr_warn("md/raid:%s: in-place reshape must be started in read-only mod= e - aborting\n", mdname(mddev)); - return -EINVAL; + ret =3D -EINVAL; + goto exit_acct_set; } } else if (mddev->reshape_backwards ? (here_new * chunk_sectors + min_offset_diff <=3D @@ -7561,7 +7573,8 @@ static int raid5_run(struct mddev *mddev /* Reading from the same stripe as writing to - bad */ pr_warn("md/raid:%s: reshape_position too early for auto-recovery - abo= rting.\n", mdname(mddev)); - return -EINVAL; + ret =3D -EINVAL; + goto exit_acct_set; } pr_debug("md/raid:%s: reshape will continue\n", mdname(mddev)); /* OK, we should be able to continue; */ @@ -7585,8 +7598,10 @@ static int raid5_run(struct mddev *mddev else conf =3D mddev->private; =20 - if (IS_ERR(conf)) - return PTR_ERR(conf); + if (IS_ERR(conf)) { + ret =3D PTR_ERR(conf); + goto exit_acct_set; + } =20 if (test_bit(MD_HAS_JOURNAL, &mddev->flags)) { if (!journal_dev) { @@ -7783,7 +7798,10 @@ abort: free_conf(conf); mddev->private =3D NULL; pr_warn("md/raid:%s: failed to run raid set.\n", mdname(mddev)); - return -EIO; + ret =3D -EIO; +exit_acct_set: + acct_bioset_exit(mddev); + return ret; } =20 static void raid5_free(struct mddev *mddev, void *priv) @@ -7791,6 +7809,7 @@ static void raid5_free(struct mddev *mdd struct r5conf *conf =3D priv; =20 free_conf(conf); + acct_bioset_exit(mddev); mddev->to_remove =3D &raid5_attrs_group; } =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86330C4332F for ; Tue, 25 Jan 2022 00:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387785AbiAYARt (ORCPT ); Mon, 24 Jan 2022 19:17:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1851179AbiAXXcH (ORCPT ); Mon, 24 Jan 2022 18:32:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39B6BC075D0F; Mon, 24 Jan 2022 13:35:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 C97D6614DA; Mon, 24 Jan 2022 21:35:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A85BAC340E4; Mon, 24 Jan 2022 21:35:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060118; bh=96rE6TDrpIIZ1lVQxWZtDllQnUUU4B7R+pVb1uXRYLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1fueOis4oiOLchMyxq7SMGBxnkkC2+IZXDsoCNes8CI9xASljuP/SZAvNIAdGlq/S aQFFrzwBNtAhpeEJLdx8lmd7S7FLnSfq8YUVYJvE5Q2ffFiq56d3o7annZeS6xisjG LrUTxqBG826EnvuVEQaMs4F92JS7qCqYG5I4ixDs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , syzbot+a437546ec71b04dfb5ac@syzkaller.appspotmail.com, Jiri Kosina Subject: [PATCH 5.16 0846/1039] HID: magicmouse: Fix an error handling path in magicmouse_probe() Date: Mon, 24 Jan 2022 19:43:55 +0100 Message-Id: <20220124184153.721264012@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 JAILLET commit 33812fc7c8d77a43b7e2bf36a0d5a57c277a4b0c upstream. If the timer introduced by the commit below is started, then it must be deleted in the error handling of the probe. Otherwise it would trigger once the driver is no more. Fixes: 0b91b4e4dae6 ("HID: magicmouse: Report battery level over USB") Signed-off-by: Christophe JAILLET Tested-by: Jos=C3=A9 Exp=C3=B3sito Reported-by: Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/hid-magicmouse.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c @@ -873,6 +873,7 @@ static int magicmouse_probe(struct hid_d =20 return 0; err_stop_hw: + del_timer_sync(&msc->battery_timer); hid_hw_stop(hdev); return ret; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAFA5C433FE for ; Tue, 25 Jan 2022 00:31:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3409938AbiAYA2C (ORCPT ); Mon, 24 Jan 2022 19:28:02 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47644 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455421AbiAXVfY (ORCPT ); Mon, 24 Jan 2022 16:35:24 -0500 Received: from smtp.kernel.org (relay.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 D8F37B81188; Mon, 24 Jan 2022 21:35:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DBDDC340E4; Mon, 24 Jan 2022 21:35:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060121; bh=x1i3tJn8RukdvFNMi9ic1oCJIRWOznFLbUVdgmlY8RA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hfyJ5ae5VbX5nmYkJzEt4apwe65A/v/Gk7UeQBkLW1LubKBWGkikWO+YN+TaLvRkd NJ5pnzmbtP7arID/7QX12VtdD309yJrA0cY24pBin+3lk1WhEeEE5gCrDUNbsC9Kpn h4rvWuQqjfRNBSloqg5ZwLh8UkXS8o9bFeo1e2NM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Borislav Petkov , Tony Luck Subject: [PATCH 5.16 0847/1039] x86/mce: Check regs before accessing it Date: Mon, 24 Jan 2022 19:43:56 +0100 Message-Id: <20220124184153.757647457@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Borislav Petkov commit 1acd85feba81084fcef00b73fc1601e42b77c5d8 upstream. Commit in Fixes accesses pt_regs before checking whether it is NULL or not. Make sure the NULL pointer check happens first. Fixes: 0a5b288e85bb ("x86/mce: Prevent severity computation from being inst= rumented") Reported-by: Dan Carpenter Signed-off-by: Borislav Petkov Reviewed-by: Tony Luck Link: https://lore.kernel.org/r/20211217102029.GA29708@kili Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/cpu/mce/severity.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/arch/x86/kernel/cpu/mce/severity.c +++ b/arch/x86/kernel/cpu/mce/severity.c @@ -222,6 +222,9 @@ static bool is_copy_from_user(struct pt_ struct insn insn; int ret; =20 + if (!regs) + return false; + if (copy_from_kernel_nofault(insn_buf, (void *)regs->ip, MAX_INSN_SIZE)) return false; =20 @@ -283,7 +286,7 @@ static noinstr int error_context(struct switch (fixup_type) { case EX_TYPE_UACCESS: case EX_TYPE_COPY: - if (!regs || !copy_user) + if (!copy_user) return IN_KERNEL; m->kflags |=3D MCE_IN_KERNEL_COPYIN; fallthrough; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37EF1C43219 for ; Mon, 24 Jan 2022 22:31:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587540AbiAXW2j (ORCPT ); Mon, 24 Jan 2022 17:28:39 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54520 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455446AbiAXVfZ (ORCPT ); Mon, 24 Jan 2022 16:35:25 -0500 Received: from smtp.kernel.org (relay.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 48821614DC; Mon, 24 Jan 2022 21:35:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0869EC340E4; Mon, 24 Jan 2022 21:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060124; bh=nihZ6mRuEfw9Nm2odeKkItkBuY+SluAK7kkWNygtmr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYOnoRkkAsypJ3J3lu3A9PUpSZVHBt2rcGyAkbzM7GeO0XM72jPZK1hAdXEB8qE1s QbsSXGZm1sC98FN+LdAQvhfceoQa2dQN83ueCsMrCAZ83qp0xvuoYTSnz2l8/yTkQd 80t9BmihFYl4mOs/T9ktUVE4oRdx+tt7msx1NChk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xie Yongji , Miklos Szeredi Subject: [PATCH 5.16 0848/1039] fuse: Pass correct lend value to filemap_write_and_wait_range() Date: Mon, 24 Jan 2022 19:43:57 +0100 Message-Id: <20220124184153.789026336@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xie Yongji commit e388164ea385f04666c4633f5dc4f951fca71890 upstream. The acceptable maximum value of lend parameter in filemap_write_and_wait_range() is LLONG_MAX rather than -1. And there is also some logic depending on LLONG_MAX check in write_cache_pages(). So let's pass LLONG_MAX to filemap_write_and_wait_range() in fuse_writeback_range() instead. Fixes: 59bda8ecee2f ("fuse: flush extending writes") Signed-off-by: Xie Yongji Cc: # v5.15 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/fuse/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2910,7 +2910,7 @@ fuse_direct_IO(struct kiocb *iocb, struc =20 static int fuse_writeback_range(struct inode *inode, loff_t start, loff_t = end) { - int err =3D filemap_write_and_wait_range(inode->i_mapping, start, -1); + int err =3D filemap_write_and_wait_range(inode->i_mapping, start, LLONG_M= AX); =20 if (!err) fuse_sync_writes(inode); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7632CC433FE for ; Tue, 25 Jan 2022 00:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382263AbiAYARp (ORCPT ); Mon, 24 Jan 2022 19:17:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1851184AbiAXXcH (ORCPT ); Mon, 24 Jan 2022 18:32:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B62F5C075964; Mon, 24 Jan 2022 13:35:28 -0800 (PST) Received: from smtp.kernel.org (relay.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 55131612E5; Mon, 24 Jan 2022 21:35:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E651C340E4; Mon, 24 Jan 2022 21:35:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060127; bh=uAlWWnbqersf2Iz6eORks7ljC27rMrLewZjq8ZOs8Hw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=krJ+bgxcnC9Xu52KZWOiRgN1CxQdSu9jw187sxx+CTqmNQoyopK+2iHU8+3ib/rao TXI+eJ1NiMRuegy8oM9G4PaQEU5Vyqf1HoW3Tiw2bx+3ss7mppR7pEZ836MqZyGjKd it1UHERTICSAy7tlf/9DyJIduzsPTN6C29E5dcbA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Gago Castano , Jan Kiszka , Su Bao Cheng , Lukas Wunner Subject: [PATCH 5.16 0849/1039] serial: Fix incorrect rs485 polarity on uart open Date: Mon, 24 Jan 2022 19:43:58 +0100 Message-Id: <20220124184153.824378230@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wunner commit d3b3404df318504ec084213ab1065b73f49b0f1d upstream. Commit a6845e1e1b78 ("serial: core: Consider rs485 settings to drive RTS") sought to deassert RTS when opening an rs485-enabled uart port. That way, the transceiver does not occupy the bus until it transmits data. Unfortunately, the commit mixed up the logic and *asserted* RTS instead of *deasserting* it: The commit amended uart_port_dtr_rts(), which raises DTR and RTS when opening an rs232 port. "Raising" actually means lowering the signal that's coming out of the uart, because an rs232 transceiver not only changes a signal's voltage level, it also *inverts* the signal. See the simplified schematic in the MAX232 datasheet for an example: https://www.ti.com/lit/ds/symlink/max232.pdf So, to raise RTS on an rs232 port, TIOCM_RTS is *set* in port->mctrl and that results in the signal being driven low. In contrast to rs232, the signal level for rs485 Transmit Enable is the identity, not the inversion: If the transceiver expects a "high" RTS signal for Transmit Enable, the signal coming out of the uart must also be high, so TIOCM_RTS must be *cleared* in port->mctrl. The commit did the exact opposite, but it's easy to see why given the confusing semantics of rs232 and rs485. Fix it. Fixes: a6845e1e1b78 ("serial: core: Consider rs485 settings to drive RTS") Cc: stable@vger.kernel.org # v4.14+ Cc: Rafael Gago Castano Cc: Jan Kiszka Cc: Su Bao Cheng Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/9395767847833f2f3193c49cde38501eeb3b5669.16= 39821059.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/tty/serial/serial_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -162,7 +162,7 @@ static void uart_port_dtr_rts(struct uar int RTS_after_send =3D !!(uport->rs485.flags & SER_RS485_RTS_AFTER_SEND); =20 if (raise) { - if (rs485_on && !RTS_after_send) { + if (rs485_on && RTS_after_send) { uart_set_mctrl(uport, TIOCM_DTR); uart_clear_mctrl(uport, TIOCM_RTS); } else { @@ -171,7 +171,7 @@ static void uart_port_dtr_rts(struct uar } else { unsigned int clear =3D TIOCM_DTR; =20 - clear |=3D (!rs485_on || !RTS_after_send) ? TIOCM_RTS : 0; + clear |=3D (!rs485_on || RTS_after_send) ? TIOCM_RTS : 0; uart_clear_mctrl(uport, clear); } } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C33AC433F5 for ; Tue, 25 Jan 2022 00:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374714AbiAYARo (ORCPT ); Mon, 24 Jan 2022 19:17:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1851187AbiAXXcH (ORCPT ); Mon, 24 Jan 2022 18:32:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6FA5C075966; Mon, 24 Jan 2022 13:35:31 -0800 (PST) Received: from smtp.kernel.org (relay.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 65E8E612D6; Mon, 24 Jan 2022 21:35:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CA12C340E4; Mon, 24 Jan 2022 21:35:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060130; bh=LvKt4kNdalNrtHc1yjv9UoZIUONIbwelUZZZPp/IQas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HDtjA3mIWLLOrBLrbuwxi0Mis/DNj+l3IbJ9Vl8+rkT5kPZ7pbPqhmndbtkuIQ+lN GORxUFTvYsb7Pw6L2eMaGCALzF6GtBqAdI0Sjai05Jm1Cm4xkdv6gRvsChkmxm/GMJ pbz+Q0QFgzSvsyZA83pRTfdpJcy9IudRj0T4Argg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Ryabinin , "Peter Zijlstra (Intel)" , Daniel Jordan , Tejun Heo Subject: [PATCH 5.16 0850/1039] cputime, cpuacct: Include guest time in user time in cpuacct.stat Date: Mon, 24 Jan 2022 19:43:59 +0100 Message-Id: <20220124184153.855085884@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Ryabinin commit 9731698ecb9c851f353ce2496292ff9fcea39dff upstream. cpuacct.stat in no-root cgroups shows user time without guest time included int it. This doesn't match with user time shown in root cpuacct.stat and /proc//stat. This also affects cgroup2's cpu.stat in the same way. Make account_guest_time() to add user time to cgroup's cpustat to fix this. Fixes: ef12fefabf94 ("cpuacct: add per-cgroup utime/stime statistics") Signed-off-by: Andrey Ryabinin Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Daniel Jordan Acked-by: Tejun Heo Cc: Link: https://lore.kernel.org/r/20211115164607.23784-1-arbn@yandex-team.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/sched/cputime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -148,10 +148,10 @@ void account_guest_time(struct task_stru =20 /* Add guest time to cpustat. */ if (task_nice(p) > 0) { - cpustat[CPUTIME_NICE] +=3D cputime; + task_group_account_field(p, CPUTIME_NICE, cputime); cpustat[CPUTIME_GUEST_NICE] +=3D cputime; } else { - cpustat[CPUTIME_USER] +=3D cputime; + task_group_account_field(p, CPUTIME_USER, cputime); cpustat[CPUTIME_GUEST] +=3D cputime; } } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5661C4332F for ; Tue, 25 Jan 2022 00:23:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3408247AbiAYAWH (ORCPT ); Mon, 24 Jan 2022 19:22:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381874AbiAXXeJ (ORCPT ); Mon, 24 Jan 2022 18:34:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC343C07596F; Mon, 24 Jan 2022 13:35:37 -0800 (PST) Received: from smtp.kernel.org (relay.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 4C0A1612D6; Mon, 24 Jan 2022 21:35:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 313BFC340E4; Mon, 24 Jan 2022 21:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060136; bh=lwmo3Kp9Lf9a9yqto9dD7w/To7cLK85iygXK9u4mjjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iGncU4nnstaW734ZP1+sROy4zT2ybnsOkCfADf6BbMCjS6q+lBRk3Gj+VmgIU7CjR 9CJQ+4Wrx6zn8sNseO+bZ63mLxRfuv5M3ohB5qYCvNBR4/BmBIRIa818gqVsC67fon RZ7aUKL8Psu4V93n4pRFPnI28EktljofFTzcd9/U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Ryabinin , "Peter Zijlstra (Intel)" , Daniel Jordan , Tejun Heo Subject: [PATCH 5.16 0851/1039] sched/cpuacct: Fix user/system in shown cpuacct.usage* Date: Mon, 24 Jan 2022 19:44:00 +0100 Message-Id: <20220124184153.885119284@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Ryabinin commit dd02d4234c9a2214a81c57a16484304a1a51872a upstream. cpuacct has 2 different ways of accounting and showing user and system times. The first one uses cpuacct_account_field() to account times and cpuacct.stat file to expose them. And this one seems to work ok. The second one is uses cpuacct_charge() function for accounting and set of cpuacct.usage* files to show times. Despite some attempts to fix it in the past it still doesn't work. Sometimes while running KVM guest the cpuacct_charge() accounts most of the guest time as system time. This doesn't match with user&system times shown in cpuacct.stat or proc//stat. Demonstration: # git clone https://github.com/aryabinin/kvmsample # make # mkdir /sys/fs/cgroup/cpuacct/test # echo $$ > /sys/fs/cgroup/cpuacct/test/tasks # ./kvmsample & # for i in {1..5}; do cat /sys/fs/cgroup/cpuacct/test/cpuacct.usage_sys; s= leep 1; done 1976535645 2979839428 3979832704 4983603153 5983604157 Use cpustats accounted in cpuacct_account_field() as the source of user/sys times for cpuacct.usage* files. Make cpuacct_charge() to account only summary execution time. Fixes: d740037fac70 ("sched/cpuacct: Split usage accounting into user_usage= and sys_usage") Signed-off-by: Andrey Ryabinin Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Daniel Jordan Acked-by: Tejun Heo Cc: Link: https://lore.kernel.org/r/20211115164607.23784-3-arbn@yandex-team.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/sched/cpuacct.c | 79 +++++++++++++++++++-------------------------= ----- 1 file changed, 32 insertions(+), 47 deletions(-) --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c @@ -21,15 +21,11 @@ static const char * const cpuacct_stat_d [CPUACCT_STAT_SYSTEM] =3D "system", }; =20 -struct cpuacct_usage { - u64 usages[CPUACCT_STAT_NSTATS]; -}; - /* track CPU usage of a group of tasks and its child groups */ struct cpuacct { struct cgroup_subsys_state css; /* cpuusage holds pointer to a u64-type object on every CPU */ - struct cpuacct_usage __percpu *cpuusage; + u64 __percpu *cpuusage; struct kernel_cpustat __percpu *cpustat; }; =20 @@ -49,7 +45,7 @@ static inline struct cpuacct *parent_ca( return css_ca(ca->css.parent); } =20 -static DEFINE_PER_CPU(struct cpuacct_usage, root_cpuacct_cpuusage); +static DEFINE_PER_CPU(u64, root_cpuacct_cpuusage); static struct cpuacct root_cpuacct =3D { .cpustat =3D &kernel_cpustat, .cpuusage =3D &root_cpuacct_cpuusage, @@ -68,7 +64,7 @@ cpuacct_css_alloc(struct cgroup_subsys_s if (!ca) goto out; =20 - ca->cpuusage =3D alloc_percpu(struct cpuacct_usage); + ca->cpuusage =3D alloc_percpu(u64); if (!ca->cpuusage) goto out_free_ca; =20 @@ -99,7 +95,8 @@ static void cpuacct_css_free(struct cgro static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int cpu, enum cpuacct_stat_index index) { - struct cpuacct_usage *cpuusage =3D per_cpu_ptr(ca->cpuusage, cpu); + u64 *cpuusage =3D per_cpu_ptr(ca->cpuusage, cpu); + u64 *cpustat =3D per_cpu_ptr(ca->cpustat, cpu)->cpustat; u64 data; =20 /* @@ -115,14 +112,17 @@ static u64 cpuacct_cpuusage_read(struct raw_spin_rq_lock_irq(cpu_rq(cpu)); #endif =20 - if (index =3D=3D CPUACCT_STAT_NSTATS) { - int i =3D 0; - - data =3D 0; - for (i =3D 0; i < CPUACCT_STAT_NSTATS; i++) - data +=3D cpuusage->usages[i]; - } else { - data =3D cpuusage->usages[index]; + switch (index) { + case CPUACCT_STAT_USER: + data =3D cpustat[CPUTIME_USER] + cpustat[CPUTIME_NICE]; + break; + case CPUACCT_STAT_SYSTEM: + data =3D cpustat[CPUTIME_SYSTEM] + cpustat[CPUTIME_IRQ] + + cpustat[CPUTIME_SOFTIRQ]; + break; + case CPUACCT_STAT_NSTATS: + data =3D *cpuusage; + break; } =20 #ifndef CONFIG_64BIT @@ -132,10 +132,14 @@ static u64 cpuacct_cpuusage_read(struct return data; } =20 -static void cpuacct_cpuusage_write(struct cpuacct *ca, int cpu, u64 val) +static void cpuacct_cpuusage_write(struct cpuacct *ca, int cpu) { - struct cpuacct_usage *cpuusage =3D per_cpu_ptr(ca->cpuusage, cpu); - int i; + u64 *cpuusage =3D per_cpu_ptr(ca->cpuusage, cpu); + u64 *cpustat =3D per_cpu_ptr(ca->cpustat, cpu)->cpustat; + + /* Don't allow to reset global kernel_cpustat */ + if (ca =3D=3D &root_cpuacct) + return; =20 #ifndef CONFIG_64BIT /* @@ -143,9 +147,10 @@ static void cpuacct_cpuusage_write(struc */ raw_spin_rq_lock_irq(cpu_rq(cpu)); #endif - - for (i =3D 0; i < CPUACCT_STAT_NSTATS; i++) - cpuusage->usages[i] =3D val; + *cpuusage =3D 0; + cpustat[CPUTIME_USER] =3D cpustat[CPUTIME_NICE] =3D 0; + cpustat[CPUTIME_SYSTEM] =3D cpustat[CPUTIME_IRQ] =3D 0; + cpustat[CPUTIME_SOFTIRQ] =3D 0; =20 #ifndef CONFIG_64BIT raw_spin_rq_unlock_irq(cpu_rq(cpu)); @@ -196,7 +201,7 @@ static int cpuusage_write(struct cgroup_ return -EINVAL; =20 for_each_possible_cpu(cpu) - cpuacct_cpuusage_write(ca, cpu, 0); + cpuacct_cpuusage_write(ca, cpu); =20 return 0; } @@ -243,25 +248,10 @@ static int cpuacct_all_seq_show(struct s seq_puts(m, "\n"); =20 for_each_possible_cpu(cpu) { - struct cpuacct_usage *cpuusage =3D per_cpu_ptr(ca->cpuusage, cpu); - seq_printf(m, "%d", cpu); - - for (index =3D 0; index < CPUACCT_STAT_NSTATS; index++) { -#ifndef CONFIG_64BIT - /* - * Take rq->lock to make 64-bit read safe on 32-bit - * platforms. - */ - raw_spin_rq_lock_irq(cpu_rq(cpu)); -#endif - - seq_printf(m, " %llu", cpuusage->usages[index]); - -#ifndef CONFIG_64BIT - raw_spin_rq_unlock_irq(cpu_rq(cpu)); -#endif - } + for (index =3D 0; index < CPUACCT_STAT_NSTATS; index++) + seq_printf(m, " %llu", + cpuacct_cpuusage_read(ca, cpu, index)); seq_puts(m, "\n"); } return 0; @@ -339,16 +329,11 @@ static struct cftype files[] =3D { void cpuacct_charge(struct task_struct *tsk, u64 cputime) { struct cpuacct *ca; - int index =3D CPUACCT_STAT_SYSTEM; - struct pt_regs *regs =3D get_irq_regs() ? : task_pt_regs(tsk); - - if (regs && user_mode(regs)) - index =3D CPUACCT_STAT_USER; =20 rcu_read_lock(); =20 for (ca =3D task_ca(tsk); ca; ca =3D parent_ca(ca)) - __this_cpu_add(ca->cpuusage->usages[index], cputime); + __this_cpu_add(*ca->cpuusage, cputime); =20 rcu_read_unlock(); } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A57AC4167B for ; Tue, 25 Jan 2022 00:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410584AbiAYA3e (ORCPT ); Mon, 24 Jan 2022 19:29:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47772 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455590AbiAXVfm (ORCPT ); Mon, 24 Jan 2022 16:35:42 -0500 Received: from smtp.kernel.org (relay.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 0F85FB81057; Mon, 24 Jan 2022 21:35:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28AA6C340E4; Mon, 24 Jan 2022 21:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060139; bh=28iv+IlR6fG6foqJ96vlzt15jft0kK5kKyy556Qfa+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z6CmdiCUHFs85Zu9DIQ6UumaurjpZL4aSIYS3dZNusQhE+6Yiwp66S0XmrMNby3b6 pnF4EwBC8TjsbMI/Ne47mZUDRqne0Llsq2SXpj0dcwHMcBrnZfrgdld4Tag6dkGFxe KeeCQb1uYE10zR2Rl02dsFZrji5YE/seYYxPOh0Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Bristot de Oliveira , Nikita Yushchenko , Steven Rostedt Subject: [PATCH 5.16 0852/1039] tracing/osnoise: Properly unhook events if start_per_cpu_kthreads() fails Date: Mon, 24 Jan 2022 19:44:01 +0100 Message-Id: <20220124184153.916097176@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Yushchenko commit 0878355b51f5f26632e652c848a8e174bb02d22d upstream. If start_per_cpu_kthreads() called from osnoise_workload_start() returns error, event hooks are left in broken state: unhook_irq_events() called but unhook_thread_events() and unhook_softirq_events() not called, and trace_osnoise_callback_enabled flag not cleared. On the next tracer enable, hooks get not installed due to trace_osnoise_callback_enabled flag. And on the further tracer disable an attempt to remove non-installed hooks happened, hitting a WARN_ON_ONCE() in tracepoint_remove_func(). Fix the error path by adding the missing part of cleanup. While at this, introduce osnoise_unhook_events() to avoid code duplication between this error path and normal tracer disable. Link: https://lkml.kernel.org/r/20220109153459.3701773-1-nikita.yushchenko@= virtuozzo.com Cc: stable@vger.kernel.org Fixes: bce29ac9ce0b ("trace: Add osnoise tracer") Acked-by: Daniel Bristot de Oliveira Signed-off-by: Nikita Yushchenko Signed-off-by: Steven Rostedt Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/trace/trace_osnoise.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) --- a/kernel/trace/trace_osnoise.c +++ b/kernel/trace/trace_osnoise.c @@ -2123,6 +2123,13 @@ out_unhook_irq: return -EINVAL; } =20 +static void osnoise_unhook_events(void) +{ + unhook_thread_events(); + unhook_softirq_events(); + unhook_irq_events(); +} + /* * osnoise_workload_start - start the workload and hook to events */ @@ -2155,7 +2162,14 @@ static int osnoise_workload_start(void) =20 retval =3D start_per_cpu_kthreads(); if (retval) { - unhook_irq_events(); + trace_osnoise_callback_enabled =3D false; + /* + * Make sure that ftrace_nmi_enter/exit() see + * trace_osnoise_callback_enabled as false before continuing. + */ + barrier(); + + osnoise_unhook_events(); return retval; } =20 @@ -2186,9 +2200,7 @@ static void osnoise_workload_stop(void) =20 stop_per_cpu_kthreads(); =20 - unhook_irq_events(); - unhook_softirq_events(); - unhook_thread_events(); + osnoise_unhook_events(); } =20 static void osnoise_tracer_start(struct trace_array *tr) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C0C6C4321E for ; Tue, 25 Jan 2022 00:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410557AbiAYA3b (ORCPT ); Mon, 24 Jan 2022 19:29:31 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54650 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455612AbiAXVfo (ORCPT ); Mon, 24 Jan 2022 16:35:44 -0500 Received: from smtp.kernel.org (relay.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 D435A60C60; Mon, 24 Jan 2022 21:35:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B9A2C340E4; Mon, 24 Jan 2022 21:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060143; bh=5AGW86GgCVBdDSNiNAWaOndxhA3SdVsmWaD0uYtrEB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rk+cOvW0RlqNgsBqH5PvVSY0tYylQrmS62H4dnZr/Gy104A+5jh25ZAMjQS76BVQk GRtUiYih2dRUKHnH7YLHr4tdCldTgxvF9RlyaKsWxy0tKknoNOeuZ0TMlSvIAYTo/D 8YIIWaPk/38TimacOOxtPxgq9ANImC3g1fiqTviw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Xiangyang Zhang , Steven Rostedt Subject: [PATCH 5.16 0853/1039] tracing/kprobes: nmissed not showed correctly for kretprobe Date: Mon, 24 Jan 2022 19:44:02 +0100 Message-Id: <20220124184153.948925642@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiangyang Zhang commit dfea08a2116fe327f79d8f4d4b2cf6e0c88be11f upstream. The 'nmissed' column of the 'kprobe_profile' file for kretprobe is not showed correctly, kretprobe can be skipped by two reasons, shortage of kretprobe_instance which is counted by tk->rp.nmissed, and kprobe itself is missed by some reason, so to show the sum. Link: https://lkml.kernel.org/r/20220107150242.5019-1-xyz.sun.ok@gmail.com Cc: stable@vger.kernel.org Fixes: 4a846b443b4e ("tracing/kprobes: Cleanup kprobe tracer code") Acked-by: Masami Hiramatsu Signed-off-by: Xiangyang Zhang Signed-off-by: Steven Rostedt Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/trace/trace_kprobe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1175,15 +1175,18 @@ static int probes_profile_seq_show(struc { struct dyn_event *ev =3D v; struct trace_kprobe *tk; + unsigned long nmissed; =20 if (!is_trace_kprobe(ev)) return 0; =20 tk =3D to_trace_kprobe(ev); + nmissed =3D trace_kprobe_is_return(tk) ? + tk->rp.kp.nmissed + tk->rp.nmissed : tk->rp.kp.nmissed; seq_printf(m, " %-44s %15lu %15lu\n", trace_probe_name(&tk->tp), trace_kprobe_nhit(tk), - tk->rp.kp.nmissed); + nmissed); =20 return 0; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31226C43217 for ; Tue, 25 Jan 2022 00:30:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3409885AbiAYA1p (ORCPT ); Mon, 24 Jan 2022 19:27:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47836 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455642AbiAXVfs (ORCPT ); Mon, 24 Jan 2022 16:35:48 -0500 Received: from smtp.kernel.org (relay.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 B9D1FB80CCF; Mon, 24 Jan 2022 21:35:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1CD5C340E4; Mon, 24 Jan 2022 21:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060146; bh=RYKL0195HNgCJWuQDIBJ5AxoBVK81NvUTBgz1ofwYFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jqgolr7MBIkK6VwJNFfXZmKUk0AskFhjuZlWGJjyyg8N1oTWGlDoivsSWvIQ8Ve5/ IHNhgThfk50YiNJK6dol4MvVmlnZLZpKxOG+ZNvIknKwaqQjZtTgDtndUGY4vVDv8k QNj+bBjziJncuk/P1cWIJ5uJC+ouSv+0zYTbLSzU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , Tom Zanussi , Masami Hiramatsu , Steven Rostedt Subject: [PATCH 5.16 0854/1039] tracing: Have syscall trace events use trace_event_buffer_lock_reserve() Date: Mon, 24 Jan 2022 19:44:03 +0100 Message-Id: <20220124184153.986599946@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 3e2a56e6f639492311e0a8533f0a7aed60816308 upstream. Currently, the syscall trace events call trace_buffer_lock_reserve() directly, which means that it misses out on some of the filtering optimizations provided by the helper function trace_event_buffer_lock_reserve(). Have the syscall trace events call that instead, as it was missed when adding the update to use the temp buffer when filtering. Link: https://lkml.kernel.org/r/20220107225839.823118570@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Cc: Tom Zanussi Reviewed-by: Masami Hiramatsu Fixes: 0fc1b09ff1ff4 ("tracing: Use temp buffer when filtering events") Signed-off-by: Steven Rostedt Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/trace/trace_syscalls.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c @@ -323,8 +323,7 @@ static void ftrace_syscall_enter(void *d =20 trace_ctx =3D tracing_gen_ctx(); =20 - buffer =3D tr->array_buffer.buffer; - event =3D trace_buffer_lock_reserve(buffer, + event =3D trace_event_buffer_lock_reserve(&buffer, trace_file, sys_data->enter_event->event.type, size, trace_ctx); if (!event) return; @@ -367,8 +366,7 @@ static void ftrace_syscall_exit(void *da =20 trace_ctx =3D tracing_gen_ctx(); =20 - buffer =3D tr->array_buffer.buffer; - event =3D trace_buffer_lock_reserve(buffer, + event =3D trace_event_buffer_lock_reserve(&buffer, trace_file, sys_data->exit_event->event.type, sizeof(*entry), trace_ctx); if (!event) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DC26C433F5 for ; Mon, 24 Jan 2022 22:31:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356900AbiAXW2w (ORCPT ); Mon, 24 Jan 2022 17:28:52 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54704 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455653AbiAXVfu (ORCPT ); Mon, 24 Jan 2022 16:35:50 -0500 Received: from smtp.kernel.org (relay.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 E3644612D6; Mon, 24 Jan 2022 21:35:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3A71C340E4; Mon, 24 Jan 2022 21:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060149; bh=c+uXVpEUnHmPsK3iUyPSRcXmijXiLM2c/xPdjDxUO1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TQPehGL/13D+lqZaEZLMCljDNvkN+5+JvfAqODoh49DAxAzdLShFzkDPlN2aNgJcC pPtEHsu+fPfSjt5DaxbRyRb8GT7Li1Ez0/imZZp+pIqpN7e2a7zhry9PxgoLUCk4SW LSHRF2VQ9V1h4cdz/ghGdGjrySMJDFghov7Gi4m4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Peng Fan , Mathieu Poirier Subject: [PATCH 5.16 0855/1039] remoteproc: imx_rproc: Fix a resource leak in the remove function Date: Mon, 24 Jan 2022 19:44:04 +0100 Message-Id: <20220124184154.023924763@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 4da96175014be67c846fd274eace08066e525d75 upstream. 'priv->workqueue' is destroyed in the error handling path of the probe but not in the remove function. Add the missing call to release some resources. Cc: stable Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox") Signed-off-by: Christophe JAILLET Reviewed-by: Peng Fan Tested-by: Peng Fan Link: https://lore.kernel.org/r/d28ca94a4031bd7297d47c2164e18885a5a6ec19.16= 34366546.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mathieu Poirier Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/remoteproc/imx_rproc.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platf clk_disable_unprepare(priv->clk); rproc_del(rproc); imx_rproc_free_mbox(rproc); + destroy_workqueue(priv->workqueue); rproc_free(rproc); =20 return 0; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA7F9C433F5 for ; Tue, 25 Jan 2022 00:23:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3408279AbiAYAWM (ORCPT ); Mon, 24 Jan 2022 19:22:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385240AbiAXXeJ (ORCPT ); Mon, 24 Jan 2022 18:34:09 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D41A5C075976; Mon, 24 Jan 2022 13:35:54 -0800 (PST) Received: from smtp.kernel.org (relay.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 91195B80FA1; Mon, 24 Jan 2022 21:35:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1C92C340E4; Mon, 24 Jan 2022 21:35:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060152; bh=MzcL8GWYYD6H5MMCitI0DGJpbooKvMyxYFu1QudjLBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V7OuUnigMwIjtJkFAF9AAOk7K7CebLDpFA+QcGCFZtUkArrSLZpw38KeUHb1tKMCO /ZKLu+t7wvGgNFH2N6D0owgXfxbnfvKCuqXtIxjmzUEJY4z+aG35eKohELPiq1KgDN bh5sEeRbhJrtnS0itRy1KrmouKbMduKv0tDGLrVY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilan Peer , Luca Coelho Subject: [PATCH 5.16 0856/1039] iwlwifi: mvm: Increase the scan timeout guard to 30 seconds Date: Mon, 24 Jan 2022 19:44:05 +0100 Message-Id: <20220124184154.056088405@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ilan Peer commit ced50f1133af12f7521bb777fcf4046ca908fb77 upstream. With the introduction of 6GHz channels the scan guard timeout should be adjusted to account for the following extreme case: - All 6GHz channels are scanned passively: 58 channels. - The scan is fragmented with the following parameters: 3 fragments, 95 TUs suspend time, 44 TUs maximal out of channel time. The above would result with scan time of more than 24 seconds. Thus, set the timeout to 30 seconds. Cc: stable@vger.kernel.org Signed-off-by: Ilan Peer Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211210090244.3c851b93aef5.I346fa2= e1d79220a6770496e773c6f87a2ad9e6c4@changeid Signed-off-by: Luca Coelho Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -2495,7 +2495,7 @@ static int iwl_mvm_check_running_scans(s return -EIO; } =20 -#define SCAN_TIMEOUT 20000 +#define SCAN_TIMEOUT 30000 =20 void iwl_mvm_scan_timeout_wk(struct work_struct *work) { From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6421C433F5 for ; Tue, 25 Jan 2022 00:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1846126AbiAYAXN (ORCPT ); Mon, 24 Jan 2022 19:23:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381859AbiAXXeJ (ORCPT ); Mon, 24 Jan 2022 18:34:09 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32C9CC075977; Mon, 24 Jan 2022 13:35:57 -0800 (PST) Received: from smtp.kernel.org (relay.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 9B95AB80FA1; Mon, 24 Jan 2022 21:35:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C932BC340E4; Mon, 24 Jan 2022 21:35:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060155; bh=rKEnzmRNzR7KabDzJxbjdFEi1uqoOkavf2ooI37fkbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AmapsRBO/jCEo1I3xGJdSkxcVAR3nYlYW3Unb/IvOmIGikiSMUZ8Zlz6m2VO6BqmF +QEvl5p/Kn1i+zYBO/csIQ213Y68ChbKb+5gAGj17sUgd+JbOgsv4VQWpvn/ezsE4N Hlrxl6qOazmErOi5vPZG+fqbl5Cb1laLfNkKjeUQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vlastimil Babka , Gerald Schaefer , Alexander Gordeev , Heiko Carstens Subject: [PATCH 5.16 0857/1039] s390/mm: fix 2KB pgtable release race Date: Mon, 24 Jan 2022 19:44:06 +0100 Message-Id: <20220124184154.086990808@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev commit c2c224932fd0ee6854d6ebfc8d059c2bcad86606 upstream. There is a race on concurrent 2KB-pgtables release paths when both upper and lower halves of the containing parent page are freed, one via page_table_free_rcu() + __tlb_remove_table(), and the other via page_table_free(). The race might lead to a corruption as result of remove of list item in page_table_free() concurrently with __free_page() in __tlb_remove_table(). Let's assume first the lower and next the upper 2KB-pgtables are freed from a page. Since both halves of the page are allocated the tracking byte (bits 24-31 of the page _refcount) has value of 0x03 initially: CPU0 CPU1 Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz ---- ---- page_table_free_rcu() // lower half { // _refcount[31..24] =3D=3D 0x03 ... atomic_xor_bits(&page->_refcount, 0x11U << (0 + 24)); // _refcount[31..24] <=3D 0x12 ... table =3D table | (1U << 0); tlb_remove_table(tlb, table); } ... __tlb_remove_table() { // _refcount[31..24] =3D=3D 0x12 mask =3D _table & 3; // mask <=3D 0x01 ... page_table_free() // upper half { // _refcount[31..24] =3D=3D 0x12 ... atomic_xor_bits( &page->_refcount, 1U << (1 + 24)); // _refcount[31..24] <=3D 0x10 // mask <=3D 0x10 ... atomic_xor_bits(&page->_refcount, mask << (4 + 24)); // _refcount[31..24] <=3D 0x00 // mask <=3D 0x00 ... if (mask !=3D 0) // =3D=3D false break; fallthrough; ... if (mask & 3) // =3D=3D false ... else __free_page(page); list_del(&page->lru); ^^^^^^^^^^^^^^^^^^ RACE! ^^^^^^^^^^^^^^^^^^^^^ } ... } The problem is page_table_free() releases the page as result of lower nibble unset and __tlb_remove_table() observing zero too early. With this update page_table_free() will use the similar logic as page_table_free_rcu() + __tlb_remove_table(), and mark the fragment as pending for removal in the upper nibble until after the list_del(). In other words, the parent page is considered as unreferenced and safe to release only when the lower nibble is cleared already and unsetting a bit in upper nibble results in that nibble turned zero. Cc: stable@vger.kernel.org Suggested-by: Vlastimil Babka Reviewed-by: Gerald Schaefer Signed-off-by: Alexander Gordeev Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman --- arch/s390/mm/pgalloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -244,13 +244,15 @@ void page_table_free(struct mm_struct *m /* Free 2K page table fragment of a 4K page */ bit =3D ((unsigned long) table & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)= ); spin_lock_bh(&mm->context.lock); - mask =3D atomic_xor_bits(&page->_refcount, 1U << (bit + 24)); + mask =3D atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); mask >>=3D 24; if (mask & 3) list_add(&page->lru, &mm->context.pgtable_list); else list_del(&page->lru); spin_unlock_bh(&mm->context.lock); + mask =3D atomic_xor_bits(&page->_refcount, 0x10U << (bit + 24)); + mask >>=3D 24; if (mask !=3D 0) return; } else { From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45292C433FE for ; Tue, 25 Jan 2022 00:31:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410237AbiAYA2s (ORCPT ); Mon, 24 Jan 2022 19:28:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381862AbiAXXeJ (ORCPT ); Mon, 24 Jan 2022 18:34:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20B4AC07597A; Mon, 24 Jan 2022 13:35:59 -0800 (PST) Received: from smtp.kernel.org (relay.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 B5D2361028; Mon, 24 Jan 2022 21:35:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B32D4C340E5; Mon, 24 Jan 2022 21:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060158; bh=y2surFG9CF99niOXP/oloofbrzQ/roUtKTzGdU8adRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KTKNQqc/PUu1yYpsOUx1sxCLe9s80XRil/hWWFv3SUiDNfoMMNaNaZJWoEWJ9fLHQ FD+83/pjTyqoBjxvWifTsAvPuJ1J0vWWc4uuD9+ICc3sQuE6F2ZANRdZyd37fDndpf 33XZPmrkod4Gk35ZvMEowDHqTuxy9w0xct4kuXs4= 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.16 0858/1039] device property: Fix fwnode_graph_devcon_match() fwnode leak Date: Mon, 24 Jan 2022 19:44:07 +0100 Message-Id: <20220124184154.119883333@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 4a7f4110f79163fd53ea65438041994ed615e3af upstream. For each endpoint it encounters, fwnode_graph_devcon_match() checks whether the endpoint's remote port parent device is available. If it is not, it ignores the endpoint but does not put the reference to the remote endpoint port parent fwnode. For available devices the fwnode handle reference is put as expected. Put the reference for unavailable devices now. Fixes: 637e9e52b185 ("device connection: Find device connections also from = device graphs") Cc: 5.1+ # 5.1+ Signed-off-by: Sakari Ailus Reviewed-by: Andy Shevchenko Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/base/property.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -1206,8 +1206,10 @@ fwnode_graph_devcon_match(struct fwnode_ =20 fwnode_graph_for_each_endpoint(fwnode, ep) { node =3D fwnode_graph_get_remote_port_parent(ep); - if (!fwnode_device_is_available(node)) + if (!fwnode_device_is_available(node)) { + fwnode_handle_put(node); continue; + } =20 ret =3D match(node, con_id, data); fwnode_handle_put(node); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2314C433FE for ; Mon, 24 Jan 2022 22:31:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587600AbiAXW2s (ORCPT ); Mon, 24 Jan 2022 17:28:48 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54792 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455746AbiAXVgC (ORCPT ); Mon, 24 Jan 2022 16:36:02 -0500 Received: from smtp.kernel.org (relay.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 CFC3F61469; Mon, 24 Jan 2022 21:36:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E717C340E4; Mon, 24 Jan 2022 21:36:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060161; bh=tCklUFkTz/9x3T08B8bbRuJKvWtGxMtJjmqMXxKUWro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R2Q4hGZ5Dd70ks7O5cYrnaejs5x+tzqbPPs2iGKQUoSodizmQcOafpJJlykg4K3wk SkyOL1WeUzL2WsLF75MXem8h8CWrfiuS9dx79vATPQMyxH5mYyo+iPR8kHq1mpJ8Pa TPMlVM3rwpln7cHPo/dgQ02utm8x9IIF8e2CX3YI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ulf Hansson , Dmitry Osipenko , Thierry Reding Subject: [PATCH 5.16 0859/1039] drm/tegra: submit: Add missing pm_runtime_mark_last_busy() Date: Mon, 24 Jan 2022 19:44:08 +0100 Message-Id: <20220124184154.165277301@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Osipenko commit a21115dd38c6cf396ba39aefd561e7903ca6149d upstream. Runtime PM auto-suspension doesn't work without pm_runtime_mark_last_busy(), add it. Cc: Reviewed-by: Ulf Hansson Signed-off-by: Dmitry Osipenko Signed-off-by: Thierry Reding Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/tegra/submit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/tegra/submit.c +++ b/drivers/gpu/drm/tegra/submit.c @@ -475,8 +475,10 @@ static void release_job(struct host1x_jo kfree(job_data->used_mappings); kfree(job_data); =20 - if (pm_runtime_enabled(client->base.dev)) + if (pm_runtime_enabled(client->base.dev)) { + pm_runtime_mark_last_busy(client->base.dev); pm_runtime_put_autosuspend(client->base.dev); + } } =20 int tegra_drm_ioctl_channel_submit(struct drm_device *drm, void *data, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3AFEC433FE for ; Tue, 25 Jan 2022 00:23:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3408223AbiAYAWD (ORCPT ); Mon, 24 Jan 2022 19:22:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385259AbiAXXeJ (ORCPT ); Mon, 24 Jan 2022 18:34:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 112DDC07597B; Mon, 24 Jan 2022 13:36:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 A51B061028; Mon, 24 Jan 2022 21:36:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AB43C340E4; Mon, 24 Jan 2022 21:36:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060164; bh=A2EUI144kMYsLayEJBAsTA84cPoFnieVulthcDcdZcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CMNyH+U1Y1Iii6a0Cf4eJxXfhlY7TEJTLQjZVoVibRxmSF91hjny+zLCll5Lyz//b biwAeXW79WDqE6daTtJcRK9zm/iQqIdNLWR5ib6dgdR+MI/A0Gs34NFPj8hrhlAnYc jTYYZNfcgeobyVPdkSQrLdldHyU2vM+uY8VloFoA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Lucas Stach , Christian Gmeiner Subject: [PATCH 5.16 0860/1039] drm/etnaviv: limit submit sizes Date: Mon, 24 Jan 2022 19:44:09 +0100 Message-Id: <20220124184154.205642921@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lucas Stach commit 6dfa2fab8ddd46faa771a102672176bee7a065de upstream. Currently we allow rediculous amounts of kernel memory being allocated via the etnaviv GEM_SUBMIT ioctl, which is a pretty easy DoS vector. Put some reasonable limits in to fix this. The commandstream size is limited to 64KB, which was already a soft limit on older kernels after which the kernel only took submits on a best effort base, so there is no userspace that tries to submit commandstreams larger than this. Even if the whole commandstream is a single incrementing address load, the size limit also limits the number of potential relocs and referenced buffers to slightly under 64K, so use the same limit for those arguments. The performance monitoring infrastructure currently supports less than 50 performance counter signals, so limiting them to 128 on a single submit seems like a reasonably future-proof number for now. This number can be bumped if needed without breaking the interface. Cc: stable@vger.kernel.org Reported-by: Dan Carpenter Signed-off-by: Lucas Stach Reviewed-by: Christian Gmeiner Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -469,6 +469,12 @@ int etnaviv_ioctl_gem_submit(struct drm_ return -EINVAL; } =20 + if (args->stream_size > SZ_64K || args->nr_relocs > SZ_64K || + args->nr_bos > SZ_64K || args->nr_pmrs > 128) { + DRM_ERROR("submit arguments out of size limits\n"); + return -EINVAL; + } + /* * Copy the command submission and bo array to kernel space in * one go, and do this outside of any locks. From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31E8DC4321E for ; Tue, 25 Jan 2022 00:31:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410209AbiAYA2p (ORCPT ); Mon, 24 Jan 2022 19:28:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387192AbiAXXeJ (ORCPT ); Mon, 24 Jan 2022 18:34:09 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B2D7C07597F; Mon, 24 Jan 2022 13:36:12 -0800 (PST) Received: from smtp.kernel.org (relay.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 38C9DB8121C; Mon, 24 Jan 2022 21:36:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D8C2C340E4; Mon, 24 Jan 2022 21:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060170; bh=nlpsVFFBLXH+IEIkEIU95YTgMgVg2K0Hj1A5Aq2u94E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DC3y3AaZ+AbIaeAHwep9VUnqMyojbvA7GbjpAx6kay5AvrdZMlGq4iWGq1wNCP+Dk wpivzixp1pZANCBiKUM/chkn3BZXRXY3vm2yzxgQqNTbi6pPgsXH1tRAY83j7Cb5u1 2iejhdn89phDH/spQX24pZtxbQIBbwcylGT4Xzls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yizhuo Zhai , Alex Deucher Subject: [PATCH 5.16 0861/1039] drm/amd/display: Fix the uninitialized variable in enable_stream_features() Date: Mon, 24 Jan 2022 19:44:10 +0100 Message-Id: <20220124184154.238652206@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yizhuo Zhai commit 0726ed3065eeb910f9cea0c933bc021a848e00b3 upstream. In function enable_stream_features(), the variable "old_downspread.raw" could be uninitialized if core_link_read_dpcd() fails, however, it is used in the later if statement, and further, core_link_write_dpcd() may write random value, which is potentially unsafe. Fixes: 6016cd9dba0f ("drm/amd/display: add helper for enabling mst stream f= eatures") Cc: stable@vger.kernel.org Signed-off-by: Yizhuo Zhai Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -1844,6 +1844,8 @@ static void enable_stream_features(struc union down_spread_ctrl old_downspread; union down_spread_ctrl new_downspread; =20 + memset(&old_downspread, 0, sizeof(old_downspread)); + core_link_read_dpcd(link, DP_DOWNSPREAD_CTRL, &old_downspread.raw, sizeof(old_downspread)); =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C3FCC433EF for ; Tue, 25 Jan 2022 00:33:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3411305AbiAYAc5 (ORCPT ); Mon, 24 Jan 2022 19:32:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48032 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455782AbiAXVgQ (ORCPT ); Mon, 24 Jan 2022 16:36:16 -0500 Received: from smtp.kernel.org (relay.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 46D50B81233; Mon, 24 Jan 2022 21:36:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63AD5C340E4; Mon, 24 Jan 2022 21:36:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060173; bh=xI5hEJ3lhDIHA1QI9owRidjMV8Rm3Aur9/+X8usPUKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c9gSHT6RFJqkagUTkO5V6rLHtk5AikfZPhghrWzP6PU/+q6zkiUpvw3Fl2YtFy2fK Wi4BI50lf3tvgM3C53BkJeWkTdnv4+mJSbxgeA0m7+FGbbPzwZgOfcIhF/uyr/mA8S Ly0FJeTmEDCFW+vz7lnjwSSWJHDnEMvpwg1sg+3U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Nathan E. Egge" , Ilia Mirkin , Ben Skeggs , Karol Herbst Subject: [PATCH 5.16 0862/1039] drm/nouveau/kms/nv04: use vzalloc for nv04_display Date: Mon, 24 Jan 2022 19:44:11 +0100 Message-Id: <20220124184154.268640046@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ilia Mirkin commit bd6e07e72f37f34535bec7eebc807e5fcfe37b43 upstream. The struct is giant, and triggers an order-7 allocation (512K). There is no reason for this to be kmalloc-type memory, so switch to vmalloc. This should help loading nouveau on low-memory and/or long-running systems. Reported-by: Nathan E. Egge Signed-off-by: Ilia Mirkin Cc: stable@vger.kernel.org Signed-off-by: Ben Skeggs Reviewed-by: Karol Herbst Signed-off-by: Karol Herbst Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/10 Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/nouveau/dispnv04/disp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c @@ -205,7 +205,7 @@ nv04_display_destroy(struct drm_device * nvif_notify_dtor(&disp->flip); =20 nouveau_display(dev)->priv =3D NULL; - kfree(disp); + vfree(disp); =20 nvif_object_unmap(&drm->client.device.object); } @@ -223,7 +223,7 @@ nv04_display_create(struct drm_device *d struct nv04_display *disp; int i, ret; =20 - disp =3D kzalloc(sizeof(*disp), GFP_KERNEL); + disp =3D vzalloc(sizeof(*disp)); if (!disp) return -ENOMEM; =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46A0AC43217 for ; Mon, 24 Jan 2022 22:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1453740AbiAXW3F (ORCPT ); Mon, 24 Jan 2022 17:29:05 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47052 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455850AbiAXVgT (ORCPT ); Mon, 24 Jan 2022 16:36:19 -0500 Received: from smtp.kernel.org (relay.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 272A9B811FB; Mon, 24 Jan 2022 21:36:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53EECC340E4; Mon, 24 Jan 2022 21:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060175; bh=bhbsw2fwuvSCgvtAyFmTD1Pr4flVhlB9Zn5rPk5BPmc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jp7eubMoQOT0/kyQ7kOxJDT7JC2bTLXGHB7R/ZbdEsfSmTbUu9BODJUQggobB+oUZ 9DigAtqDdNsJjXtp77Qr1CXJvnivkeiyLBjgcrDf3ZFLAzNIEcqvQh0NAmZnEk2fmG Xm2yMxjdW4VX3uBfX+6TeWUFb03XHID1rMtK+pyw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zain Wang , Tomasz Figa , Heiko Stuebner , Sean Paul , Brian Norris , Robert Foss Subject: [PATCH 5.16 0863/1039] drm/bridge: analogix_dp: Make PSR-exit block less Date: Mon, 24 Jan 2022 19:44:12 +0100 Message-Id: <20220124184154.306579488@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris commit c4c6ef229593366ab593d4d424addc7025b54a76 upstream. Prior to commit 6c836d965bad ("drm/rockchip: Use the helpers for PSR"), "PSR exit" used non-blocking analogix_dp_send_psr_spd(). The refactor started using the blocking variant, for a variety of reasons -- quoting Sean Paul's potentially-faulty memory: """ - To avoid racing a subsequent PSR entry (if exit takes a long time) - To avoid racing disable/modeset - We're not displaying new content while exiting PSR anyways, so there is minimal utility in allowing frames to be submitted - We're lying to userspace telling them frames are on the screen when we're just dropping them on the floor """ However, I'm finding that this blocking transition is causing upwards of 60+ ms of unneeded latency on PSR-exit, to the point that initial cursor movements when leaving PSR are unbearably jumpy. It turns out that we need to meet in the middle somewhere: Sean is right that we were "lying to userspace" with a non-blocking PSR-exit, but the new blocking behavior is also waiting too long: According to the eDP specification, the sink device must support PSR entry transitions from both state 4 (ACTIVE_RESYNC) and state 0 (INACTIVE). It also states that in ACTIVE_RESYNC, "the Sink device must display the incoming active frames from the Source device with no visible glitches and/or artifacts." Thus, for our purposes, we only need to wait for ACTIVE_RESYNC before moving on; we are ready to display video, and subsequent PSR-entry is safe. Tested on a Samsung Chromebook Plus (i.e., Rockchip RK3399 Gru Kevin), where this saves about 60ms of latency, for PSR-exit that used to take about 80ms. Fixes: 6c836d965bad ("drm/rockchip: Use the helpers for PSR") Cc: Cc: Zain Wang Cc: Tomasz Figa Cc: Heiko Stuebner Cc: Sean Paul Signed-off-by: Brian Norris Reviewed-by: Sean Paul Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20211103135112.v3.1.I67= 612ea073c3306c71b46a87be894f79707082df@changeid Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -998,11 +998,21 @@ int analogix_dp_send_psr_spd(struct anal if (!blocking) return 0; =20 + /* + * db[1]!=3D0: entering PSR, wait for fully active remote frame buffer. + * db[1]=3D=3D0: exiting PSR, wait for either + * (a) ACTIVE_RESYNC - the sink "must display the + * incoming active frames from the Source device with no visible + * glitches and/or artifacts", even though timings may still be + * re-synchronizing; or + * (b) INACTIVE - the transition is fully complete. + */ ret =3D readx_poll_timeout(analogix_dp_get_psr_status, dp, psr_status, psr_status >=3D 0 && ((vsc->db[1] && psr_status =3D=3D DP_PSR_SINK_ACTIVE_RFB) || - (!vsc->db[1] && psr_status =3D=3D DP_PSR_SINK_INACTIVE)), 1500, - DP_TIMEOUT_PSR_LOOP_MS * 1000); + (!vsc->db[1] && (psr_status =3D=3D DP_PSR_SINK_ACTIVE_RESYNC || + psr_status =3D=3D DP_PSR_SINK_INACTIVE))), + 1500, DP_TIMEOUT_PSR_LOOP_MS * 1000); if (ret) { dev_warn(dp->dev, "Failed to apply PSR %d\n", ret); return ret; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BE91C433F5 for ; Tue, 25 Jan 2022 00:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410543AbiAYA3a (ORCPT ); Mon, 24 Jan 2022 19:29:30 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54920 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348012AbiAXVgU (ORCPT ); Mon, 24 Jan 2022 16:36:20 -0500 Received: from smtp.kernel.org (relay.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 72129612E5; Mon, 24 Jan 2022 21:36:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D0CEC340E4; Mon, 24 Jan 2022 21:36:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060178; bh=YljHBSu8U7fYgPuBxiqBxuJLS3a+IyXUlt9fCs6zb+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jhdVyAGHnYKXW+kAhEHKAXx7nmvKruB8Tph6SxwiYUsxSax1a4SonaGZDLkdDdG1o TVwWEWmAtr8eOfMDgk0GPE3cLMJa9hxZp8gLqN6yay2nEKwPQwOhFWq9M3lzCoz4TO pZWy2J+hycw03cwwntdc9qxpmG7GAHwtreoU+j9k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John David Anglin , Helge Deller Subject: [PATCH 5.16 0864/1039] parisc: Fix lpa and lpa_user defines Date: Mon, 24 Jan 2022 19:44:13 +0100 Message-Id: <20220124184154.337574400@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 David Anglin commit db19c6f1a2a353cc8dec35b4789733a3cf6e2838 upstream. While working on the rewrite to the light-weight syscall and futex code, I experimented with using a hash index based on the user physical address of atomic variable. This exposed two problems with the lpa and lpa_user define= s. Because of the copy instruction, the pa argument needs to be an early clobb= er argument. This prevents gcc from allocating the va and pa arguments to the = same register. Secondly, the lpa instruction can cause a page fault so we need to catch exceptions. Signed-off-by: John David Anglin Fixes: 116d753308cf ("parisc: Use lpa instruction to load physical addresse= s in driver code") Signed-off-by: Helge Deller Cc: stable@vger.kernel.org # v5.2+ Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/parisc/include/asm/special_insns.h | 44 +++++++++++++++++----------= ----- 1 file changed, 24 insertions(+), 20 deletions(-) --- a/arch/parisc/include/asm/special_insns.h +++ b/arch/parisc/include/asm/special_insns.h @@ -2,28 +2,32 @@ #ifndef __PARISC_SPECIAL_INSNS_H #define __PARISC_SPECIAL_INSNS_H =20 -#define lpa(va) ({ \ - unsigned long pa; \ - __asm__ __volatile__( \ - "copy %%r0,%0\n\t" \ - "lpa %%r0(%1),%0" \ - : "=3Dr" (pa) \ - : "r" (va) \ - : "memory" \ - ); \ - pa; \ +#define lpa(va) ({ \ + unsigned long pa; \ + __asm__ __volatile__( \ + "copy %%r0,%0\n" \ + "8:\tlpa %%r0(%1),%0\n" \ + "9:\n" \ + ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \ + : "=3D&r" (pa) \ + : "r" (va) \ + : "memory" \ + ); \ + pa; \ }) =20 -#define lpa_user(va) ({ \ - unsigned long pa; \ - __asm__ __volatile__( \ - "copy %%r0,%0\n\t" \ - "lpa %%r0(%%sr3,%1),%0" \ - : "=3Dr" (pa) \ - : "r" (va) \ - : "memory" \ - ); \ - pa; \ +#define lpa_user(va) ({ \ + unsigned long pa; \ + __asm__ __volatile__( \ + "copy %%r0,%0\n" \ + "8:\tlpa %%r0(%%sr3,%1),%0\n" \ + "9:\n" \ + ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \ + : "=3D&r" (pa) \ + : "r" (va) \ + : "memory" \ + ); \ + pa; \ }) =20 #define mfctl(reg) ({ \ From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C83D3C433EF for ; Tue, 25 Jan 2022 00:32:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359149AbiAYAcr (ORCPT ); Mon, 24 Jan 2022 19:32:47 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54946 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349082AbiAXVgX (ORCPT ); Mon, 24 Jan 2022 16:36:23 -0500 Received: from smtp.kernel.org (relay.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 48E0961028; Mon, 24 Jan 2022 21:36:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30647C340E4; Mon, 24 Jan 2022 21:36:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060181; bh=qBV1D0GmAnp/RCoOC9JnVrd06ImVEIRibKoLoL3oR0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V2buL2viMQZ9WW593S3rBrG30cDCUgIhC83ZVFaAsDYRgRhL9y8xudYy+AZM1n9Ot VG+uIe4cRWH+NPsBxTLatmzdn+B3Tigbw9BsdSdlJqAVJtqRav0zOyohdKpyp6nMS5 Ft/5vF1V12NFDa6xn8y8Lu9NFXk0TjFdUju9rSOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman Subject: [PATCH 5.16 0865/1039] powerpc/64s/radix: Fix huge vmap false positive Date: Mon, 24 Jan 2022 19:44:14 +0100 Message-Id: <20220124184154.370583784@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicholas Piggin commit 467ba14e1660b52a2f9338b484704c461bd23019 upstream. pmd_huge() is defined to false when HUGETLB_PAGE is not configured, but the vmap code still installs huge PMDs. This leads to false bad PMD errors when vunmapping because it is not seen as a huge PTE, and the bad PMD check catches it. The end result may not be much more serious than some bad pmd warning messages, because the pmd_none_or_clear_bad() does what we wanted and clears the huge PTE anyway. Fix this by checking pmd_is_leaf(), which checks for a PTE regardless of config options. The whole huge/large/leaf stuff is a tangled mess but that's kernel-wide and not something we can improve much in arch/powerpc code. pmd_page(), pud_page(), etc., called by vmalloc_to_page() on huge vmaps can similarly trigger a false VM_BUG_ON when CONFIG_HUGETLB_PAGE=3Dn, so those checks are adjusted. The checks were added by commit d6eacedd1f0e ("powerpc/book3s: Use config independent helpers for page table walk"), while implementing a similar fix for other page table walking functions. Fixes: d909f9109c30 ("powerpc/64s/radix: Enable HAVE_ARCH_HUGE_VMAP") Cc: stable@vger.kernel.org # v5.3+ Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211216103342.609192-1-npiggin@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/mm/book3s64/radix_pgtable.c | 4 ++-- arch/powerpc/mm/pgtable_64.c | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) --- a/arch/powerpc/mm/book3s64/radix_pgtable.c +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c @@ -1100,7 +1100,7 @@ int pud_set_huge(pud_t *pud, phys_addr_t =20 int pud_clear_huge(pud_t *pud) { - if (pud_huge(*pud)) { + if (pud_is_leaf(*pud)) { pud_clear(pud); return 1; } @@ -1147,7 +1147,7 @@ int pmd_set_huge(pmd_t *pmd, phys_addr_t =20 int pmd_clear_huge(pmd_t *pmd) { - if (pmd_huge(*pmd)) { + if (pmd_is_leaf(*pmd)) { pmd_clear(pmd); return 1; } --- a/arch/powerpc/mm/pgtable_64.c +++ b/arch/powerpc/mm/pgtable_64.c @@ -102,7 +102,8 @@ EXPORT_SYMBOL(__pte_frag_size_shift); struct page *p4d_page(p4d_t p4d) { if (p4d_is_leaf(p4d)) { - VM_WARN_ON(!p4d_huge(p4d)); + if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP)) + VM_WARN_ON(!p4d_huge(p4d)); return pte_page(p4d_pte(p4d)); } return virt_to_page(p4d_pgtable(p4d)); @@ -112,7 +113,8 @@ struct page *p4d_page(p4d_t p4d) struct page *pud_page(pud_t pud) { if (pud_is_leaf(pud)) { - VM_WARN_ON(!pud_huge(pud)); + if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP)) + VM_WARN_ON(!pud_huge(pud)); return pte_page(pud_pte(pud)); } return virt_to_page(pud_pgtable(pud)); @@ -125,7 +127,13 @@ struct page *pud_page(pud_t pud) struct page *pmd_page(pmd_t pmd) { if (pmd_is_leaf(pmd)) { - VM_WARN_ON(!(pmd_large(pmd) || pmd_huge(pmd))); + /* + * vmalloc_to_page may be called on any vmap address (not only + * vmalloc), and it uses pmd_page() etc., when huge vmap is + * enabled so these checks can't be used. + */ + if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP)) + VM_WARN_ON(!(pmd_large(pmd) || pmd_huge(pmd))); return pte_page(pmd_pte(pmd)); } return virt_to_page(pmd_page_vaddr(pmd)); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C3AAC4321E for ; Mon, 24 Jan 2022 22:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1588004AbiAXWa2 (ORCPT ); Mon, 24 Jan 2022 17:30:28 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48206 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378062AbiAXVio (ORCPT ); Mon, 24 Jan 2022 16:38:44 -0500 Received: from smtp.kernel.org (relay.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 B55CEB81188; Mon, 24 Jan 2022 21:38:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9EB0C340E4; Mon, 24 Jan 2022 21:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060321; bh=AZdeogpZIVfXj08F3oNVbYOQIuzVXxnygZlttam14NE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zl1T89EY4+98IcslDj/QAVT/46j/Agx3z1hkgNjSyKaxLdM05hunVmXfymHEaevvn X/7jSkAF3OqdGtl2S1Pin4QZKmr4d3foZBa6ys6Z54jUDp+zeTl3B7o5/uEdGOXrpo y8tEtUTS7YWhXE7IjP0c1rgABfBL/E1XDZbv9c9s= 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" Subject: [PATCH 5.16 0866/1039] scsi: lpfc: Fix lpfc_force_rscn ndlp kref imbalance Date: Mon, 24 Jan 2022 19:44:15 +0100 Message-Id: <20220124184154.404731249@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 7576d48c64f36f6fea9df2882f710a474fa35f40 upstream. Issuing lpfc_force_rscn twice results in an ndlp kref use-after-free call trace. A prior patch reworked the get/put handling by ensuring nlp_get was done before WQE submission and a put was done in the completion path. Unfortunately, the issue_els_rscn path had a piece of legacy code that did a nlp_put, causing an imbalance on the ref counts. Fixed by removing the unnecessary legacy code snippet. Link: https://lore.kernel.org/r/20211204002644.116455-4-jsmart2021@gmail.com Fixes: 4430f7fd09ec ("scsi: lpfc: Rework locations of ndlp reference taking= ") Cc: # v5.11+ Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc_els.c | 5 ----- 1 file changed, 5 deletions(-) --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -3538,11 +3538,6 @@ lpfc_issue_els_rscn(struct lpfc_vport *v return 1; } =20 - /* This will cause the callback-function lpfc_cmpl_els_cmd to - * trigger the release of node. - */ - if (!(vport->fc_flag & FC_PT2PT)) - lpfc_nlp_put(ndlp); return 0; } =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F2E6C433EF for ; Tue, 25 Jan 2022 00:23:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2375279AbiAYATl (ORCPT ); Mon, 24 Jan 2022 19:19:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849731AbiAXXej (ORCPT ); Mon, 24 Jan 2022 18:34:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA0E2C0AD1B9; Mon, 24 Jan 2022 13:36:51 -0800 (PST) Received: from smtp.kernel.org (relay.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 474946131F; Mon, 24 Jan 2022 21:36:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1407CC340E4; Mon, 24 Jan 2022 21:36:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060210; bh=j4CfaJ67L6Sih9eb4i6T6w8XsJayxWU/gOmexyDIggA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2uKnYvkLzNp/n+cDKHHbH4KLSeii4U0j+RxaX5qW+H+oLOmgN1LV8PvsBtMdo4B6m Z4YG4ZMC5cNyNWjP1pS9xTI9Y5+/d7uhARAKdODVjVXgEhpLE2sQaLqj53XJXoMnNk owjtLFxZOfgZz8PvWZrwq7fPkuSQ0DX8/tLAx0K4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Wentland , Huang Rui , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher Subject: [PATCH 5.16 0867/1039] drm/amdgpu: Use correct VIEWPORT_DIMENSION for DCN2 Date: Mon, 24 Jan 2022 19:44:16 +0100 Message-Id: <20220124184154.442512752@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Harry Wentland commit dc5d4aff2e99c312df8abbe1ee9a731d2913bc1b upstream. For some reason this file isn't using the appropriate register headers for DCN headers, which means that on DCN2 we're getting the VIEWPORT_DIMENSION offset wrong. This means that we're not correctly carving out the framebuffer memory correctly for a framebuffer allocated by EFI and therefore see corruption when loading amdgpu before the display driver takes over control of the framebuffer scanout. Fix this by checking the DCE_HWIP and picking the correct offset accordingly. Long-term we should expose this info from DC as GMC shouldn't need to know about DCN registers. Cc: stable@vger.kernel.org Signed-off-by: Harry Wentland Reviewed-by: Huang Rui Acked-by: Christian K=C3=B6nig Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c @@ -72,6 +72,9 @@ #define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0 = 0x049d #define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0_BASE_IDX = 2 =20 +#define mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_DCN2 = 0x05ea +#define mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_DCN2_BASE_IDX = 2 + =20 static const char *gfxhub_client_ids[] =3D { "CB", @@ -1105,6 +1108,8 @@ static unsigned gmc_v9_0_get_vbios_fb_si u32 d1vga_control =3D RREG32_SOC15(DCE, 0, mmD1VGA_CONTROL); unsigned size; =20 + /* TODO move to DC so GMC doesn't need to hard-code DCN registers */ + if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) { size =3D AMDGPU_VBIOS_VGA_ALLOCATION; } else { @@ -1113,11 +1118,18 @@ static unsigned gmc_v9_0_get_vbios_fb_si switch (adev->ip_versions[DCE_HWIP][0]) { case IP_VERSION(1, 0, 0): case IP_VERSION(1, 0, 1): - case IP_VERSION(2, 1, 0): viewport =3D RREG32_SOC15(DCE, 0, mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION= ); size =3D (REG_GET_FIELD(viewport, HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_HEIGHT) * REG_GET_FIELD(viewport, + HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_WIDTH) * + 4); + break; + case IP_VERSION(2, 1, 0): + viewport =3D RREG32_SOC15(DCE, 0, mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION= _DCN2); + size =3D (REG_GET_FIELD(viewport, + HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_HEIGHT) * + REG_GET_FIELD(viewport, HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_WIDTH) * 4); break; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 754ABC433F5 for ; Mon, 24 Jan 2022 22:47:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1837953AbiAXWpk (ORCPT ); Mon, 24 Jan 2022 17:45:40 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48590 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377411AbiAXVh3 (ORCPT ); Mon, 24 Jan 2022 16:37:29 -0500 Received: from smtp.kernel.org (relay.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 27F16B81249; Mon, 24 Jan 2022 21:37:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50BDAC340E7; Mon, 24 Jan 2022 21:37:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060243; bh=EGoeGKQZGN4rz6badnfdmxmFtuNPyW71vKWzKsfoxtw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OppixS0rpSNcq4UJuvM7PceDP7D+1db425qJU8vErx4cwRnN17wmjbHWAJP3yJEHQ 46rIxmXFaeemUQ+hp6t3h+t3isbGohsVwuTvztIARO9HZTQGk+mjiA/9S+jw7dDSve L9LbRmvGoVq8SuqF6RBys8eXopcRvl9/i453Bu8U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Fink , Alex Deucher Subject: [PATCH 5.16 0868/1039] drm/amdgpu: Fix rejecting Tahiti GPUs Date: Mon, 24 Jan 2022 19:44:17 +0100 Message-Id: <20220124184154.481629804@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Fink commit 3993a799fc971bc9b918bd969aa55864447b5dde upstream. eb4fd29afd4a ("drm/amdgpu: bind to any 0x1002 PCI diplay class device") add= ed generic bindings to amdgpu so that that it binds to all display class devic= es with VID 0x1002 and then rejects those in amdgpu_pci_probe. Unfortunately it reuses a driver_data value of 0 to detect those new bindin= gs, which is already used to denote CHIP_TAHITI ASICs. The driver_data value given to those new bindings was changed in dd0761fd24ea1 ("drm/amdgpu: set CHIP_IP_DISCOVERY as the asic type by defau= lt") to CHIP_IP_DISCOVERY (=3D36), but it seems that the check in amdgpu_pci_pro= be was forgotten to be changed. Therefore, it still rejects Tahiti GPUs. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1860 Fixes: eb4fd29afd4a ("drm/amdgpu: bind to any 0x1002 PCI diplay class devic= e") Cc: stable@vger.kernel.org Signed-off-by: Lukas Fink Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -1928,7 +1928,7 @@ static int amdgpu_pci_probe(struct pci_d return -ENODEV; } =20 - if (flags =3D=3D 0) { + if (flags =3D=3D CHIP_IP_DISCOVERY) { DRM_INFO("Unsupported asic. Remove me when IP discovery init is in plac= e.\n"); return -ENODEV; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FF38C433EF for ; Tue, 25 Jan 2022 00:31:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410160AbiAYA2k (ORCPT ); Mon, 24 Jan 2022 19:28:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360821AbiAXXiL (ORCPT ); Mon, 24 Jan 2022 18:38:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F558C05A199; Mon, 24 Jan 2022 13:37:58 -0800 (PST) Received: from smtp.kernel.org (relay.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 4243BB812A5; Mon, 24 Jan 2022 21:37:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 622F1C340E4; Mon, 24 Jan 2022 21:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060277; bh=d1hkeXXrifR0cTOtk0pASdzSQrHKudV+b+y9Amq7KG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nYopirBY1FuWjXxqbDes6b47X2T9foAntB9PGTtB8Vgzm9qVwxFO+LaKzFj9riYgp BwNH+qz0FcJtypPZQwvulZ4MZEv8BIzMoGdo2NBMoaC8t/3yDR22xYEOYzW2BAKq4d OU3lNiOHiVdYKeadiWGP+FOuFu8b1g+F8lNfqkbA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Deucher Subject: [PATCH 5.16 0869/1039] drm/amdgpu: dont do resets on APUs which dont support it Date: Mon, 24 Jan 2022 19:44:18 +0100 Message-Id: <20220124184154.513082811@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 e8309d50e97851ff135c4e33325d37b032666b94 upstream. It can cause a hang. This is normally not enabled for GPU hangs on these asics, but was recently enabled for handling aborted suspends. This causes hangs on some platforms on suspend. Fixes: daf8de0874ab5b ("drm/amdgpu: always reset the asic in suspend (v2)") Cc: stable@vger.kernel.org Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1858 Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/cik.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/vi.c | 4 ++++ 2 files changed, 8 insertions(+) --- a/drivers/gpu/drm/amd/amdgpu/cik.c +++ b/drivers/gpu/drm/amd/amdgpu/cik.c @@ -1428,6 +1428,10 @@ static int cik_asic_reset(struct amdgpu_ { int r; =20 + /* APUs don't have full asic reset */ + if (adev->flags & AMD_IS_APU) + return 0; + if (cik_asic_reset_method(adev) =3D=3D AMD_RESET_METHOD_BACO) { dev_info(adev->dev, "BACO reset\n"); r =3D amdgpu_dpm_baco_reset(adev); --- a/drivers/gpu/drm/amd/amdgpu/vi.c +++ b/drivers/gpu/drm/amd/amdgpu/vi.c @@ -956,6 +956,10 @@ static int vi_asic_reset(struct amdgpu_d { int r; =20 + /* APUs don't have full asic reset */ + if (adev->flags & AMD_IS_APU) + return 0; + if (vi_asic_reset_method(adev) =3D=3D AMD_RESET_METHOD_BACO) { dev_info(adev->dev, "BACO reset\n"); r =3D amdgpu_dpm_baco_reset(adev); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 644CEC433FE for ; Tue, 25 Jan 2022 00:23:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3408098AbiAYAVe (ORCPT ); Mon, 24 Jan 2022 19:21:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360963AbiAXXip (ORCPT ); Mon, 24 Jan 2022 18:38:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11129C07850B; Mon, 24 Jan 2022 13:38:26 -0800 (PST) Received: from smtp.kernel.org (relay.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 9E5CDB81243; Mon, 24 Jan 2022 21:38:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA800C340E4; Mon, 24 Jan 2022 21:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060303; bh=s05JzdmOxIzc9HaITbzO0W37kq6LqIy/2UOUNHkgETw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IPpjAhd0LRZ7STT5njLNk6TPvcRk5QbCFHZUSb4LOJjlNf0zRRbfHBRxwh8eubx2S 1PuHu2b2lWZqa98RBefN6C0wn9bz00ZbykezfcigP6tH5x5ijDzjq5egk/lEbc/c8u /q4Xrzhp3WinZ1hDsWHEoCbH7WmoJAaiieN2/4wo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qingqing Zhuo , Scott Bruce , Chris Hixon , spasswolf@web.de, Nicholas Kazlauskas , Mario Limonciello , Alex Deucher Subject: [PATCH 5.16 0870/1039] drm/amd/display: Revert W/A for hard hangs on DCN20/DCN21 Date: Mon, 24 Jan 2022 19:44:19 +0100 Message-Id: <20220124184154.546440522@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mario Limonciello commit c4849f88164b13dd141885e28210f599741b304b upstream. The WA from commit 2a50edbf10c8 ("drm/amd/display: Apply w/a for hard hang on HPD") and commit 1bd3bc745e7f ("drm/amd/display: Extend w/a for hard hang on HPD to dcn20") causes a regression in s0ix where the system will fail to resume properly on many laptops. Pull the workarounds out to avoid that s0ix regression in the common case. This HPD hang happens with an external device in special circumstances and a new W/A will need to be developed for this in the future. Cc: stable@vger.kernel.org Cc: Qingqing Zhuo Reported-by: Scott Bruce Reported-by: Chris Hixon Reported-by: spasswolf@web.de Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D215436 Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1821 Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1852 Fixes: 2a50edbf10c8 ("drm/amd/display: Apply w/a for hard hang on HPD") Fixes: 1bd3bc745e7f ("drm/amd/display: Extend w/a for hard hang on HPD to d= cn20") Reviewed-by: Nicholas Kazlauskas Signed-off-by: Mario Limonciello Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c | 11 ---- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 11 ---- drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c | 25 ------= ----- drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.h | 2=20 drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c | 25 ------= ----- drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.h | 2=20 drivers/gpu/drm/amd/display/dc/irq/irq_service.c | 2=20 drivers/gpu/drm/amd/display/dc/irq/irq_service.h | 4 - 8 files changed, 3 insertions(+), 79 deletions(-) --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c @@ -38,7 +38,6 @@ #include "clk/clk_11_0_0_offset.h" #include "clk/clk_11_0_0_sh_mask.h" =20 -#include "irq/dcn20/irq_service_dcn20.h" =20 #undef FN #define FN(reg_name, field_name) \ @@ -223,8 +222,6 @@ void dcn2_update_clocks(struct clk_mgr * bool force_reset =3D false; bool p_state_change_support; int total_plane_count; - int irq_src; - uint32_t hpd_state; =20 if (dc->work_arounds.skip_clock_update) return; @@ -242,13 +239,7 @@ void dcn2_update_clocks(struct clk_mgr * if (dc->res_pool->pp_smu) pp_smu =3D &dc->res_pool->pp_smu->nv_funcs; =20 - for (irq_src =3D DC_IRQ_SOURCE_HPD1; irq_src <=3D DC_IRQ_SOURCE_HPD6; irq= _src++) { - hpd_state =3D dc_get_hpd_state_dcn20(dc->res_pool->irqs, irq_src); - if (hpd_state) - break; - } - - if (display_count =3D=3D 0 && !hpd_state) + if (display_count =3D=3D 0) enter_display_off =3D true; =20 if (enter_display_off =3D=3D safe_to_lower) { --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c @@ -42,7 +42,6 @@ #include "clk/clk_10_0_2_sh_mask.h" #include "renoir_ip_offset.h" =20 -#include "irq/dcn21/irq_service_dcn21.h" =20 /* Constants */ =20 @@ -130,11 +129,9 @@ void rn_update_clocks(struct clk_mgr *cl struct dc_clocks *new_clocks =3D &context->bw_ctx.bw.dcn.clk; struct dc *dc =3D clk_mgr_base->ctx->dc; int display_count; - int irq_src; bool update_dppclk =3D false; bool update_dispclk =3D false; bool dpp_clock_lowered =3D false; - uint32_t hpd_state; =20 struct dmcu *dmcu =3D clk_mgr_base->ctx->dc->res_pool->dmcu; =20 @@ -151,14 +148,8 @@ void rn_update_clocks(struct clk_mgr *cl =20 display_count =3D rn_get_active_display_cnt_wa(dc, context); =20 - for (irq_src =3D DC_IRQ_SOURCE_HPD1; irq_src <=3D DC_IRQ_SOURCE_HPD5; i= rq_src++) { - hpd_state =3D dc_get_hpd_state_dcn21(dc->res_pool->irqs, irq_src); - if (hpd_state) - break; - } - /* if we can go lower, go lower */ - if (display_count =3D=3D 0 && !hpd_state) { + if (display_count =3D=3D 0) { rn_vbios_smu_set_dcn_low_power_state(clk_mgr, DCN_PWR_STATE_LOW_POWER); /* update power state */ clk_mgr_base->clks.pwr_state =3D DCN_PWR_STATE_LOW_POWER; --- a/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c @@ -132,31 +132,6 @@ enum dc_irq_source to_dal_irq_source_dcn } } =20 -uint32_t dc_get_hpd_state_dcn20(struct irq_service *irq_service, enum dc_i= rq_source source) -{ - const struct irq_source_info *info; - uint32_t addr; - uint32_t value; - uint32_t current_status; - - info =3D find_irq_source_info(irq_service, source); - if (!info) - return 0; - - addr =3D info->status_reg; - if (!addr) - return 0; - - value =3D dm_read_reg(irq_service->ctx, addr); - current_status =3D - get_reg_field_value( - value, - HPD0_DC_HPD_INT_STATUS, - DC_HPD_SENSE); - - return current_status; -} - static bool hpd_ack( struct irq_service *irq_service, const struct irq_source_info *info) --- a/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.h +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.h @@ -31,6 +31,4 @@ struct irq_service *dal_irq_service_dcn20_create( struct irq_service_init_data *init_data); =20 -uint32_t dc_get_hpd_state_dcn20(struct irq_service *irq_service, enum dc_i= rq_source source); - #endif --- a/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c @@ -135,31 +135,6 @@ enum dc_irq_source to_dal_irq_source_dcn return DC_IRQ_SOURCE_INVALID; } =20 -uint32_t dc_get_hpd_state_dcn21(struct irq_service *irq_service, enum dc_i= rq_source source) -{ - const struct irq_source_info *info; - uint32_t addr; - uint32_t value; - uint32_t current_status; - - info =3D find_irq_source_info(irq_service, source); - if (!info) - return 0; - - addr =3D info->status_reg; - if (!addr) - return 0; - - value =3D dm_read_reg(irq_service->ctx, addr); - current_status =3D - get_reg_field_value( - value, - HPD0_DC_HPD_INT_STATUS, - DC_HPD_SENSE); - - return current_status; -} - static bool hpd_ack( struct irq_service *irq_service, const struct irq_source_info *info) --- a/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.h +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.h @@ -31,6 +31,4 @@ struct irq_service *dal_irq_service_dcn21_create( struct irq_service_init_data *init_data); =20 -uint32_t dc_get_hpd_state_dcn21(struct irq_service *irq_service, enum dc_i= rq_source source); - #endif --- a/drivers/gpu/drm/amd/display/dc/irq/irq_service.c +++ b/drivers/gpu/drm/amd/display/dc/irq/irq_service.c @@ -79,7 +79,7 @@ void dal_irq_service_destroy(struct irq_ *irq_service =3D NULL; } =20 -const struct irq_source_info *find_irq_source_info( +static const struct irq_source_info *find_irq_source_info( struct irq_service *irq_service, enum dc_irq_source source) { --- a/drivers/gpu/drm/amd/display/dc/irq/irq_service.h +++ b/drivers/gpu/drm/amd/display/dc/irq/irq_service.h @@ -69,10 +69,6 @@ struct irq_service { const struct irq_service_funcs *funcs; }; =20 -const struct irq_source_info *find_irq_source_info( - struct irq_service *irq_service, - enum dc_irq_source source); - void dal_irq_service_construct( struct irq_service *irq_service, struct irq_service_init_data *init_data); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA6DBC433EF for ; Mon, 24 Jan 2022 22:31:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587962AbiAXWaT (ORCPT ); Mon, 24 Jan 2022 17:30:19 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56880 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377960AbiAXVia (ORCPT ); Mon, 24 Jan 2022 16:38:30 -0500 Received: from smtp.kernel.org (relay.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 2A4DB61469; Mon, 24 Jan 2022 21:38:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1038EC340E4; Mon, 24 Jan 2022 21:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060306; bh=0T2Vc/UzvRRhHVYcsjvuz/eDIClZM/9HVuwwhz9uwY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PBv0Tny9bJWfObtJDNF25CbtjUTU2nPVhwcyfztMFAjnhGz40/S5DW1OmoGa13+VL 37KtRmaerMgsGpPjtL/8U+uw/pmXHVxGnUiguGiAlyn0JnMOpG0dgpbgzZAWbWyOrR LjSvdQ0DmYviP9TUxlPXc5yUxai0LbNUyIsb6/D8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Clint Taylor , =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= , Clint Taylor , Tvrtko Ursulin Subject: [PATCH 5.16 0871/1039] drm/i915/display/ehl: Update voltage swing table Date: Mon, 24 Jan 2022 19:44:20 +0100 Message-Id: <20220124184154.579506707@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Jos=C3=A9 Roberto de Souza commit ef3ac01564067a4337bb798b8eddc6ea7b78fd10 upstream. EHL table was recently updated with some minor fixes. BSpec: 21257 Cc: stable@vger.kernel.org Cc: Clint Taylor Signed-off-by: Jos=C3=A9 Roberto de Souza Reviewed-by: Clint Taylor Link: https://patchwork.freedesktop.org/patch/msgid/20220113160437.49059-1-= jose.souza@intel.com (cherry picked from commit 5ec7baef52c367cdbda964aa662f7135c25bab1f) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c +++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c @@ -477,14 +477,14 @@ static const struct intel_ddi_buf_trans static const union intel_ddi_buf_trans_entry _ehl_combo_phy_trans_dp[] =3D= { /* NT mV Trans mV db */ { .icl =3D { 0xA, 0x33, 0x3F, 0x00, 0x00 } }, /* 350 350 0.0 */ - { .icl =3D { 0xA, 0x47, 0x36, 0x00, 0x09 } }, /* 350 500 3.1 */ - { .icl =3D { 0xC, 0x64, 0x34, 0x00, 0x0B } }, /* 350 700 6.0 */ - { .icl =3D { 0x6, 0x7F, 0x30, 0x00, 0x0F } }, /* 350 900 8.2 */ + { .icl =3D { 0xA, 0x47, 0x38, 0x00, 0x07 } }, /* 350 500 3.1 */ + { .icl =3D { 0xC, 0x64, 0x33, 0x00, 0x0C } }, /* 350 700 6.0 */ + { .icl =3D { 0x6, 0x7F, 0x2F, 0x00, 0x10 } }, /* 350 900 8.2 */ { .icl =3D { 0xA, 0x46, 0x3F, 0x00, 0x00 } }, /* 500 500 0.0 */ - { .icl =3D { 0xC, 0x64, 0x38, 0x00, 0x07 } }, /* 500 700 2.9 */ + { .icl =3D { 0xC, 0x64, 0x37, 0x00, 0x08 } }, /* 500 700 2.9 */ { .icl =3D { 0x6, 0x7F, 0x32, 0x00, 0x0D } }, /* 500 900 5.1 */ { .icl =3D { 0xC, 0x61, 0x3F, 0x00, 0x00 } }, /* 650 700 0.6 */ - { .icl =3D { 0x6, 0x7F, 0x38, 0x00, 0x07 } }, /* 600 900 3.5 */ + { .icl =3D { 0x6, 0x7F, 0x37, 0x00, 0x08 } }, /* 600 900 3.5 */ { .icl =3D { 0x6, 0x7F, 0x3F, 0x00, 0x00 } }, /* 900 900 0.0 */ }; =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3344C43217 for ; Tue, 25 Jan 2022 00:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410105AbiAYA22 (ORCPT ); Mon, 24 Jan 2022 19:28:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2361415AbiAXXkB (ORCPT ); Mon, 24 Jan 2022 18:40:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3F78C078512; Mon, 24 Jan 2022 13:38:30 -0800 (PST) Received: from smtp.kernel.org (relay.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 5045861502; Mon, 24 Jan 2022 21:38:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AFFBC340E4; Mon, 24 Jan 2022 21:38:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060309; bh=Ewihb/s7hmwafORVRqMeu0MC+lgGBymeShU96pQLBU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F+FATGPBITqPMUPhLka/fClfX4WLZXuy8M7RZlqCWBjcAbyrL+d1um89CjkVyaT/H t214J0EVRGpjPoC3iT/1b59ej96trrntM0ovYR5SObOpYfi2AEJDMo3q59HHbkW4/i PECknk+sOTrWrpU9YBH4101rFXPZEApv/GRcqC68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?St=C3=A9phane=20Graber?= , Rob Herring , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= Subject: [PATCH 5.16 0872/1039] PCI: xgene: Fix IB window setup Date: Mon, 24 Jan 2022 19:44:21 +0100 Message-Id: <20220124184154.612147474@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Rob Herring commit c7a75d07827a1f33d566e18e6098379cc2a0c2b2 upstream. Commit 6dce5aa59e0b ("PCI: xgene: Use inbound resources for setup") broke PCI support on XGene. The cause is the IB resources are now sorted in address order instead of being in DT dma-ranges order. The result is which inbound registers are used for each region are swapped. I don't know the details about this h/w, but it appears that IB region 0 registers can't handle a size greater than 4GB. In any case, limiting the size for region 0 is enough to get back to the original assignment of dma-ranges to regions. Link: https://lore.kernel.org/all/CA+enf=3Dv9rY_xnZML01oEgKLmvY1NGBUUhnSJaE= TmXtDtXfaczA@mail.gmail.com/ Link: https://lore.kernel.org/r/20211129173637.303201-1-robh@kernel.org Fixes: 6dce5aa59e0b ("PCI: xgene: Use inbound resources for setup") Reported-by: St=C3=A9phane Graber Tested-by: St=C3=A9phane Graber Signed-off-by: Rob Herring Signed-off-by: Lorenzo Pieralisi Reviewed-by: Krzysztof Wilczy=C5=84ski Cc: stable@vger.kernel.org # v5.5+ Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pci-xgene.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/pci/controller/pci-xgene.c +++ b/drivers/pci/controller/pci-xgene.c @@ -465,7 +465,7 @@ static int xgene_pcie_select_ib_reg(u8 * return 1; } =20 - if ((size > SZ_1K) && (size < SZ_1T) && !(*ib_reg_mask & (1 << 0))) { + if ((size > SZ_1K) && (size < SZ_4G) && !(*ib_reg_mask & (1 << 0))) { *ib_reg_mask |=3D (1 << 0); return 0; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30B47C433F5 for ; Tue, 25 Jan 2022 00:23:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3408054AbiAYAV1 (ORCPT ); Mon, 24 Jan 2022 19:21:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2361483AbiAXXkM (ORCPT ); Mon, 24 Jan 2022 18:40:12 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48E55C078521; Mon, 24 Jan 2022 13:38:35 -0800 (PST) Received: from smtp.kernel.org (relay.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 0FB70B80FA1; Mon, 24 Jan 2022 21:38:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AEE4C340E4; Mon, 24 Jan 2022 21:38:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060312; bh=NF5lkOBelGBSG7Nu/ygvh5DLxM3dmsWRSeyfgkNPk/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aiVcppDAcaEvU4SyZYFbP5zfLWoHq0nJ3le6ON6c2jweNDbg/w3fnkie2F/kKqZN2 UO0bfG3/W9NbCp2wvN41pc9nlyv1EZ7dnVYxrpSv0mU/OUcBIbDgbOsIrHONMtWafI txgPy7fmkBPNnQbVzF3CKLVlMrrApWjtOw1eZPRA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Theodore Tso" , Hans de Goede , Bjorn Helgaas , Lukas Wunner Subject: [PATCH 5.16 0873/1039] PCI: pciehp: Use down_read/write_nested(reset_lock) to fix lockdep errors Date: Mon, 24 Jan 2022 19:44:22 +0100 Message-Id: <20220124184154.642601971@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede commit 085a9f43433f30cbe8a1ade62d9d7827c3217f4d upstream. Use down_read_nested() and down_write_nested() when taking the ctrl->reset_lock rw-sem, passing the number of PCIe hotplug controllers in the path to the PCI root bus as lock subclass parameter. This fixes the following false-positive lockdep report when unplugging a Lenovo X1C8 from a Lenovo 2nd gen TB3 dock: pcieport 0000:06:01.0: pciehp: Slot(1): Link Down pcieport 0000:06:01.0: pciehp: Slot(1): Card not present =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 WARNING: possible recursive locking detected 5.16.0-rc2+ #621 Not tainted -------------------------------------------- irq/124-pciehp/86 is trying to acquire lock: ffff8e5ac4299ef8 (&ctrl->reset_lock){.+.+}-{3:3}, at: pciehp_check_presen= ce+0x23/0x80 but task is already holding lock: ffff8e5ac4298af8 (&ctrl->reset_lock){.+.+}-{3:3}, at: pciehp_ist+0xf3/0x1= 80 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&ctrl->reset_lock); lock(&ctrl->reset_lock); *** DEADLOCK *** May be due to missing lock nesting notation 3 locks held by irq/124-pciehp/86: #0: ffff8e5ac4298af8 (&ctrl->reset_lock){.+.+}-{3:3}, at: pciehp_ist+0xf= 3/0x180 #1: ffffffffa3b024e8 (pci_rescan_remove_lock){+.+.}-{3:3}, at: pciehp_un= configure_device+0x31/0x110 #2: ffff8e5ac1ee2248 (&dev->mutex){....}-{3:3}, at: device_release_drive= r+0x1c/0x40 stack backtrace: CPU: 4 PID: 86 Comm: irq/124-pciehp Not tainted 5.16.0-rc2+ #621 Hardware name: LENOVO 20U90SIT19/20U90SIT19, BIOS N2WET30W (1.20 ) 08/26/= 2021 Call Trace: dump_stack_lvl+0x59/0x73 __lock_acquire.cold+0xc5/0x2c6 lock_acquire+0xb5/0x2b0 down_read+0x3e/0x50 pciehp_check_presence+0x23/0x80 pciehp_runtime_resume+0x5c/0xa0 device_for_each_child+0x45/0x70 pcie_port_device_runtime_resume+0x20/0x30 pci_pm_runtime_resume+0xa7/0xc0 __rpm_callback+0x41/0x110 rpm_callback+0x59/0x70 rpm_resume+0x512/0x7b0 __pm_runtime_resume+0x4a/0x90 __device_release_driver+0x28/0x240 device_release_driver+0x26/0x40 pci_stop_bus_device+0x68/0x90 pci_stop_bus_device+0x2c/0x90 pci_stop_and_remove_bus_device+0xe/0x20 pciehp_unconfigure_device+0x6c/0x110 pciehp_disable_slot+0x5b/0xe0 pciehp_handle_presence_or_link_change+0xc3/0x2f0 pciehp_ist+0x179/0x180 This lockdep warning is triggered because with Thunderbolt, hotplug ports are nested. When removing multiple devices in a daisy-chain, each hotplug port's reset_lock may be acquired recursively. It's never the same lock, so the lockdep splat is a false positive. Because locks at the same hierarchy level are never acquired recursively, a per-level lockdep class is sufficient to fix the lockdep warning. The choice to use one lockdep subclass per pcie-hotplug controller in the path to the root-bus was made to conserve class keys because their number is limited and the complexity grows quadratically with number of keys according to Documentation/locking/lockdep-design.rst. Link: https://lore.kernel.org/linux-pci/20190402021933.GA2966@mit.edu/ Link: https://lore.kernel.org/linux-pci/de684a28-9038-8fc6-27ca-3f6f2f6400d= 7@redhat.com/ Link: https://lore.kernel.org/r/20211217141709.379663-1-hdegoede@redhat.com Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D208855 Reported-by: "Theodore Ts'o" Signed-off-by: Hans de Goede Signed-off-by: Bjorn Helgaas Reviewed-by: Lukas Wunner Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/hotplug/pciehp.h | 3 +++ drivers/pci/hotplug/pciehp_core.c | 2 +- drivers/pci/hotplug/pciehp_hpc.c | 21 ++++++++++++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h @@ -75,6 +75,8 @@ extern int pciehp_poll_time; * @reset_lock: prevents access to the Data Link Layer Link Active bit in = the * Link Status register and to the Presence Detect State bit in the Slot * Status register during a slot reset which may cause them to flap + * @depth: Number of additional hotplug ports in the path to the root bus, + * used as lock subclass for @reset_lock * @ist_running: flag to keep user request waiting while IRQ thread is run= ning * @request_result: result of last user request submitted to the IRQ thread * @requester: wait queue to wake up on completion of user request, @@ -106,6 +108,7 @@ struct controller { =20 struct hotplug_slot hotplug_slot; /* hotplug core interface */ struct rw_semaphore reset_lock; + unsigned int depth; unsigned int ist_running; int request_result; wait_queue_head_t requester; --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c @@ -166,7 +166,7 @@ static void pciehp_check_presence(struct { int occupied; =20 - down_read(&ctrl->reset_lock); + down_read_nested(&ctrl->reset_lock, ctrl->depth); mutex_lock(&ctrl->state_lock); =20 occupied =3D pciehp_card_present_or_link_active(ctrl); --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -583,7 +583,7 @@ static void pciehp_ignore_dpc_link_chang * the corresponding link change may have been ignored above. * Synthesize it to ensure that it is acted on. */ - down_read(&ctrl->reset_lock); + down_read_nested(&ctrl->reset_lock, ctrl->depth); if (!pciehp_check_link_active(ctrl)) pciehp_request(ctrl, PCI_EXP_SLTSTA_DLLSC); up_read(&ctrl->reset_lock); @@ -746,7 +746,7 @@ static irqreturn_t pciehp_ist(int irq, v * Disable requests have higher priority than Presence Detect Changed * or Data Link Layer State Changed events. */ - down_read(&ctrl->reset_lock); + down_read_nested(&ctrl->reset_lock, ctrl->depth); if (events & DISABLE_SLOT) pciehp_handle_disable_request(ctrl); else if (events & (PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_DLLSC)) @@ -906,7 +906,7 @@ int pciehp_reset_slot(struct hotplug_slo if (probe) return 0; =20 - down_write(&ctrl->reset_lock); + down_write_nested(&ctrl->reset_lock, ctrl->depth); =20 if (!ATTN_BUTTN(ctrl)) { ctrl_mask |=3D PCI_EXP_SLTCTL_PDCE; @@ -962,6 +962,20 @@ static inline void dbg_ctrl(struct contr =20 #define FLAG(x, y) (((x) & (y)) ? '+' : '-') =20 +static inline int pcie_hotplug_depth(struct pci_dev *dev) +{ + struct pci_bus *bus =3D dev->bus; + int depth =3D 0; + + while (bus->parent) { + bus =3D bus->parent; + if (bus->self && bus->self->is_hotplug_bridge) + depth++; + } + + return depth; +} + struct controller *pcie_init(struct pcie_device *dev) { struct controller *ctrl; @@ -975,6 +989,7 @@ struct controller *pcie_init(struct pcie return NULL; =20 ctrl->pcie =3D dev; + ctrl->depth =3D pcie_hotplug_depth(dev->port); pcie_capability_read_dword(pdev, PCI_EXP_SLTCAP, &slot_cap); =20 if (pdev->hotplug_user_indicators) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D726C433EF for ; Mon, 24 Jan 2022 22:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587971AbiAXWaV (ORCPT ); Mon, 24 Jan 2022 17:30:21 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50300 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456325AbiAXVio (ORCPT ); Mon, 24 Jan 2022 16:38:44 -0500 Received: from smtp.kernel.org (relay.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 DF872B81233; Mon, 24 Jan 2022 21:38:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19BB0C340E4; Mon, 24 Jan 2022 21:38:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060315; bh=4KnP9f2BG2N0gQWpClCCaBlbp1tyU3Pjw2Z1LPrgmQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cenakRCK9CnTOdZM4c2d6HdhVsNEiRteH3JRptVZhoBSyjlcYg5qKT4ZItgxIWzEO UbIHWjpr+Fm4/kYGYF39w89YLLunWLolbGoSGJ4DCmhGh0m/9bAsTIt5hQzlcyDjbH qhdNW8plCebWFm30/Fa64BW7a2w7CyPsQFw00MTw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joseph Bao , Lukas Wunner , Bjorn Helgaas , Stuart Hayes Subject: [PATCH 5.16 0874/1039] PCI: pciehp: Fix infinite loop in IRQ handler upon power fault Date: Mon, 24 Jan 2022 19:44:23 +0100 Message-Id: <20220124184154.674800632@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wunner commit 23584c1ed3e15a6f4bfab8dc5a88d94ab929ee12 upstream. The Power Fault Detected bit in the Slot Status register differs from all other hotplug events in that it is sticky: It can only be cleared after turning off slot power. Per PCIe r5.0, sec. 6.7.1.8: If a power controller detects a main power fault on the hot-plug slot, it must automatically set its internal main power fault latch [...]. The main power fault latch is cleared when software turns off power to the hot-plug slot. The stickiness used to cause interrupt storms and infinite loops which were fixed in 2009 by commits 5651c48cfafe ("PCI pciehp: fix power fault interrupt storm problem") and 99f0169c17f3 ("PCI: pciehp: enable software notification on empty slots"). Unfortunately in 2020 the infinite loop issue was inadvertently reintroduced by commit 8edf5332c393 ("PCI: pciehp: Fix MSI interrupt race"): The hardirq handler pciehp_isr() clears the PFD bit until pciehp's power_fault_detected flag is set. That happens in the IRQ thread pciehp_ist(), which never learns of the event because the hardirq handler is stuck in an infinite loop. Fix by setting the power_fault_detected flag already in the hardirq handler. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D214989 Link: https://lore.kernel.org/linux-pci/DM8PR11MB5702255A6A92F735D90A444686= 8B9@DM8PR11MB5702.namprd11.prod.outlook.com Fixes: 8edf5332c393 ("PCI: pciehp: Fix MSI interrupt race") Link: https://lore.kernel.org/r/66eaeef31d4997ceea357ad93259f290ededecfd.16= 37187226.git.lukas@wunner.de Reported-by: Joseph Bao Tested-by: Joseph Bao Signed-off-by: Lukas Wunner Signed-off-by: Bjorn Helgaas Cc: stable@vger.kernel.org # v4.19+ Cc: Stuart Hayes Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/hotplug/pciehp_hpc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -642,6 +642,8 @@ read_status: */ if (ctrl->power_fault_detected) status &=3D ~PCI_EXP_SLTSTA_PFD; + else if (status & PCI_EXP_SLTSTA_PFD) + ctrl->power_fault_detected =3D true; =20 events |=3D status; if (!events) { @@ -651,7 +653,7 @@ read_status: } =20 if (status) { - pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, events); + pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, status); =20 /* * In MSI mode, all event bits must be zero before the port @@ -725,8 +727,7 @@ static irqreturn_t pciehp_ist(int irq, v } =20 /* Check Power Fault Detected */ - if ((events & PCI_EXP_SLTSTA_PFD) && !ctrl->power_fault_detected) { - ctrl->power_fault_detected =3D 1; + if (events & PCI_EXP_SLTSTA_PFD) { ctrl_err(ctrl, "Slot(%s): Power fault\n", slot_name(ctrl)); pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF, PCI_EXP_SLTCTL_ATTN_IND_ON); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06832C4332F for ; Mon, 24 Jan 2022 22:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587990AbiAXWaZ (ORCPT ); Mon, 24 Jan 2022 17:30:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50334 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444812AbiAXVio (ORCPT ); Mon, 24 Jan 2022 16:38:44 -0500 Received: from smtp.kernel.org (relay.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 B699CB80FA1; Mon, 24 Jan 2022 21:38:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDEC7C340E4; Mon, 24 Jan 2022 21:38:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060318; bh=8kdnPAkKMFZeojypize7PQeSHKNwYqoEZAm1hMECNzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EZYUgsy+OHq0wpf4Q0ieotqbTSPSSySH2DxwCj+NvZ897tbHtxuBfZsOTtgfWd3Zt DGonPcs1NCvOxujY/hU4gnqKIfcVLi7s+8X0j/uGgjwrEakP8zlSpUpDndQuQD9gLb JK+Fgc3e6w/xxDr6owlgs042571KXB7hnnDZ+pGE= 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?= , Lorenzo Pieralisi Subject: [PATCH 5.16 0875/1039] PCI: pci-bridge-emul: Make expansion ROM Base Address register read-only Date: Mon, 24 Jan 2022 19:44:24 +0100 Message-Id: <20220124184154.707490250@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 commit 1c1a3b4d3e86b997a313ffb297c1129540882859 upstream. If expansion ROM is unsupported (which is the case of pci-bridge-emul.c driver) then ROM Base Address register must be implemented as read-only register that return 0 when read, same as for unused Base Address registers. Link: https://lore.kernel.org/r/20211124155944.1290-2-pali@kernel.org Fixes: 23a5fba4d941 ("PCI: Introduce PCI bridge emulated config space commo= n logic") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/pci-bridge-emul.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c @@ -139,8 +139,13 @@ struct pci_bridge_reg_behavior pci_regs_ .ro =3D GENMASK(7, 0), }, =20 + /* + * If expansion ROM is unsupported then ROM Base Address register must + * be implemented as read-only register that return 0 when read, same + * as for unused Base Address registers. + */ [PCI_ROM_ADDRESS1 / 4] =3D { - .rw =3D GENMASK(31, 11) | BIT(0), + .ro =3D ~0, }, =20 /* From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C42BC433F5 for ; Tue, 25 Jan 2022 00:23:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2375356AbiAYAT4 (ORCPT ); Mon, 24 Jan 2022 19:19:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2359669AbiAXXej (ORCPT ); Mon, 24 Jan 2022 18:34:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8626CC0AD1BF; Mon, 24 Jan 2022 13:36:56 -0800 (PST) Received: from smtp.kernel.org (relay.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 43490B811A9; Mon, 24 Jan 2022 21:36:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DABDC340E4; Mon, 24 Jan 2022 21:36:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060214; bh=O/8B47WCHt/7NggE2om+s/HBijeVuMCAcR01gd/vuYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zz1GW8nhs4ldg0CWX2QQGh7II+fj27PWeAmeFZ0CUDjfIY8gev/pc9qSSeYL5tCnp G/lof+yK+kk49xf2s+JMSrMxjuN8ImdMwQfdThKgHbJylrViHQm4R46noGIzazffGG Ryo0hFhhbR12K1cm+RCSQ3maqoPTSltvaUf8dWZw= 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?= , Lorenzo Pieralisi Subject: [PATCH 5.16 0876/1039] PCI: pci-bridge-emul: Properly mark reserved PCIe bits in PCI config space Date: Mon, 24 Jan 2022 19:44:25 +0100 Message-Id: <20220124184154.743263590@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 commit 7b067ac63a5730d2fae18399fed7e45f23d36912 upstream. Some bits in PCI config space are reserved when device is PCIe. Properly define behavior of PCI registers for PCIe emulated bridge and ensure that it would not be possible change these reserved bits. Link: https://lore.kernel.org/r/20211124155944.1290-3-pali@kernel.org Fixes: 23a5fba4d941 ("PCI: Introduce PCI bridge emulated config space commo= n logic") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/pci-bridge-emul.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c @@ -295,6 +295,27 @@ int pci_bridge_emul_init(struct pci_brid kfree(bridge->pci_regs_behavior); return -ENOMEM; } + /* These bits are applicable only for PCI and reserved on PCIe */ + bridge->pci_regs_behavior[PCI_CACHE_LINE_SIZE / 4].ro &=3D + ~GENMASK(15, 8); + bridge->pci_regs_behavior[PCI_COMMAND / 4].ro &=3D + ~((PCI_COMMAND_SPECIAL | PCI_COMMAND_INVALIDATE | + PCI_COMMAND_VGA_PALETTE | PCI_COMMAND_WAIT | + PCI_COMMAND_FAST_BACK) | + (PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK | + PCI_STATUS_DEVSEL_MASK) << 16); + bridge->pci_regs_behavior[PCI_PRIMARY_BUS / 4].ro &=3D + ~GENMASK(31, 24); + bridge->pci_regs_behavior[PCI_IO_BASE / 4].ro &=3D + ~((PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK | + PCI_STATUS_DEVSEL_MASK) << 16); + bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].rw &=3D + ~((PCI_BRIDGE_CTL_MASTER_ABORT | + BIT(8) | BIT(9) | BIT(11)) << 16); + bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].ro &=3D + ~((PCI_BRIDGE_CTL_FAST_BACK) << 16); + bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].w1c &=3D + ~(BIT(10) << 16); } =20 if (flags & PCI_BRIDGE_EMUL_NO_PREFETCHABLE_BAR) { From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9817C4321E for ; Mon, 24 Jan 2022 22:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455569AbiAXW3P (ORCPT ); Mon, 24 Jan 2022 17:29:15 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54158 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455961AbiAXVg7 (ORCPT ); Mon, 24 Jan 2022 16:36:59 -0500 Received: from smtp.kernel.org (relay.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 D6691614B4; Mon, 24 Jan 2022 21:36:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41F9FC340E4; Mon, 24 Jan 2022 21:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060217; bh=AaF7euI3kYHd/11AknQCQrpr2iggUpjasga3Y3juYgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JZTFl0QZnFwybEKqgHe74ZFvBraD/WktHl0/yrQr3dkvhtbLvJ8Z7XnXnuj9OJMsW i4OmpkE0FGx7kkFHB2CMZ3u58qeOKBG0ICiVeyUXRbMDspTBtJhU1+9tWGvUGf4x8+ I1PpUSy+Izm6PHoOjLzoNrGHU/BwWT9AwpbOplOM= 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?= , Lorenzo Pieralisi Subject: [PATCH 5.16 0877/1039] PCI: pci-bridge-emul: Fix definitions of reserved bits Date: Mon, 24 Jan 2022 19:44:26 +0100 Message-Id: <20220124184154.783323173@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 commit 12998087d9f48b66965b97412069c7826502cd7e upstream. Some bits in PCI_EXP registers are reserved for non-root ports. Driver pci-bridge-emul.c implements PCIe Root Port device therefore it should not allow setting reserved bits of registers. Properly define non-reserved bits for all PCI_EXP registers. Link: https://lore.kernel.org/r/20211124155944.1290-5-pali@kernel.org Fixes: 23a5fba4d941 ("PCI: Introduce PCI bridge emulated config space commo= n logic") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/pci-bridge-emul.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c @@ -176,41 +176,55 @@ struct pci_bridge_reg_behavior pcie_cap_ [PCI_CAP_LIST_ID / 4] =3D { /* * Capability ID, Next Capability Pointer and - * Capabilities register are all read-only. + * bits [14:0] of Capabilities register are all read-only. + * Bit 15 of Capabilities register is reserved. */ - .ro =3D ~0, + .ro =3D GENMASK(30, 0), }, =20 [PCI_EXP_DEVCAP / 4] =3D { - .ro =3D ~0, + /* + * Bits [31:29] and [17:16] are reserved. + * Bits [27:18] are reserved for non-upstream ports. + * Bits 28 and [14:6] are reserved for non-endpoint devices. + * Other bits are read-only. + */ + .ro =3D BIT(15) | GENMASK(5, 0), }, =20 [PCI_EXP_DEVCTL / 4] =3D { - /* Device control register is RW */ - .rw =3D GENMASK(15, 0), + /* + * Device control register is RW, except bit 15 which is + * reserved for non-endpoints or non-PCIe-to-PCI/X bridges. + */ + .rw =3D GENMASK(14, 0), =20 /* * Device status register has bits 6 and [3:0] W1C, [5:4] RO, - * the rest is reserved + * the rest is reserved. Also bit 6 is reserved for non-upstream + * ports. */ - .w1c =3D (BIT(6) | GENMASK(3, 0)) << 16, + .w1c =3D GENMASK(3, 0) << 16, .ro =3D GENMASK(5, 4) << 16, }, =20 [PCI_EXP_LNKCAP / 4] =3D { - /* All bits are RO, except bit 23 which is reserved */ - .ro =3D lower_32_bits(~BIT(23)), + /* + * All bits are RO, except bit 23 which is reserved and + * bit 18 which is reserved for non-upstream ports. + */ + .ro =3D lower_32_bits(~(BIT(23) | PCI_EXP_LNKCAP_CLKPM)), }, =20 [PCI_EXP_LNKCTL / 4] =3D { /* * Link control has bits [15:14], [11:3] and [1:0] RW, the - * rest is reserved. + * rest is reserved. Bit 8 is reserved for non-upstream ports. * * Link status has bits [13:0] RO, and bits [15:14] * W1C. */ - .rw =3D GENMASK(15, 14) | GENMASK(11, 3) | GENMASK(1, 0), + .rw =3D GENMASK(15, 14) | GENMASK(11, 9) | GENMASK(7, 3) | GENMASK(1, 0), .ro =3D GENMASK(13, 0) << 16, .w1c =3D GENMASK(15, 14) << 16, }, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5B41C433FE for ; Mon, 24 Jan 2022 22:31:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587617AbiAXW3S (ORCPT ); Mon, 24 Jan 2022 17:29:18 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55362 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455976AbiAXVhB (ORCPT ); Mon, 24 Jan 2022 16:37:01 -0500 Received: from smtp.kernel.org (relay.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 C41446150B; Mon, 24 Jan 2022 21:37:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A56F0C340E7; Mon, 24 Jan 2022 21:36:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060220; bh=SyNYiTwXVXJKE4VV1grcVx6e6PGFPM/ywr0MEph9OnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TBIqVi630kWP5W+JtB3jZwclUEdpMKl3sw2PXSlmeUU7A1II3WFNMN1gY+DcZsZb8 HMGWraIqhvBbfEzH8iCLOSESyxuB3gznUhgsZ2+nJd8MO8pPo5oTcflcR1B0RSHMzE 6EWbo/1JmYtCcBTABrEFT2pWDsYh7lU5o1D/ba9E= 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?= , Lorenzo Pieralisi Subject: [PATCH 5.16 0878/1039] PCI: pci-bridge-emul: Correctly set PCIe capabilities Date: Mon, 24 Jan 2022 19:44:27 +0100 Message-Id: <20220124184154.814356084@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 commit 1f1050c5e1fefb34ac90a506b43e9da803b5f8f7 upstream. Older mvebu hardware provides PCIe Capability structure only in version 1. New mvebu and aardvark hardware provides it in version 2. So do not force version to 2 in pci_bridge_emul_init() and rather allow drivers to set correct version. Drivers need to set version in pcie_conf.cap field without overwriting PCI_CAP_LIST_ID register. Both drivers (mvebu and aardvark) do not provide slot support yet, so do not set PCI_EXP_FLAGS_SLOT flag. Link: https://lore.kernel.org/r/20211124155944.1290-6-pali@kernel.org Fixes: 23a5fba4d941 ("PCI: Introduce PCI bridge emulated config space commo= n logic") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pci-aardvark.c | 4 +++- drivers/pci/controller/pci-mvebu.c | 8 ++++++++ drivers/pci/pci-bridge-emul.c | 5 +---- 3 files changed, 12 insertions(+), 5 deletions(-) --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -872,7 +872,6 @@ advk_pci_bridge_emul_pcie_conf_read(stru return PCI_BRIDGE_EMUL_HANDLED; } =20 - case PCI_CAP_LIST_ID: case PCI_EXP_DEVCAP: case PCI_EXP_DEVCTL: *value =3D advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg); @@ -953,6 +952,9 @@ static int advk_sw_pci_bridge_init(struc /* Support interrupt A for MSI feature */ bridge->conf.intpin =3D PCIE_CORE_INT_A_ASSERT_ENABLE; =20 + /* Aardvark HW provides PCIe Capability structure in version 2 */ + bridge->pcie_conf.cap =3D cpu_to_le16(2); + /* Indicates supports for Completion Retry Status */ bridge->pcie_conf.rootcap =3D cpu_to_le16(PCI_EXP_RTCAP_CRSVIS); =20 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -655,6 +655,8 @@ static struct pci_bridge_emul_ops mvebu_ static int mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) { struct pci_bridge_emul *bridge =3D &port->bridge; + u32 pcie_cap =3D mvebu_readl(port, PCIE_CAP_PCIEXP); + u8 pcie_cap_ver =3D ((pcie_cap >> 16) & PCI_EXP_FLAGS_VERS); =20 bridge->conf.vendor =3D PCI_VENDOR_ID_MARVELL; bridge->conf.device =3D mvebu_readl(port, PCIE_DEV_ID_OFF) >> 16; @@ -667,6 +669,12 @@ static int mvebu_pci_bridge_emul_init(st bridge->conf.iolimit =3D PCI_IO_RANGE_TYPE_32; } =20 + /* + * Older mvebu hardware provides PCIe Capability structure only in + * version 1. New hardware provides it in version 2. + */ + bridge->pcie_conf.cap =3D cpu_to_le16(pcie_cap_ver); + bridge->has_pcie =3D true; bridge->data =3D port; bridge->ops =3D &mvebu_pci_bridge_emul_ops; --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c @@ -297,10 +297,7 @@ int pci_bridge_emul_init(struct pci_brid if (bridge->has_pcie) { bridge->conf.capabilities_pointer =3D PCI_CAP_PCIE_START; bridge->pcie_conf.cap_id =3D PCI_CAP_ID_EXP; - /* Set PCIe v2, root port, slot support */ - bridge->pcie_conf.cap =3D - cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4 | 2 | - PCI_EXP_FLAGS_SLOT); + bridge->pcie_conf.cap |=3D cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4); bridge->pcie_cap_regs_behavior =3D kmemdup(pcie_cap_regs_behavior, sizeof(pcie_cap_regs_behavior), From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B7BAC433FE for ; Tue, 25 Jan 2022 00:31:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410176AbiAYA2o (ORCPT ); Mon, 24 Jan 2022 19:28:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360146AbiAXXgJ (ORCPT ); Mon, 24 Jan 2022 18:36:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E325C075D37; Mon, 24 Jan 2022 13:37:04 -0800 (PST) Received: from smtp.kernel.org (relay.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 BF7036150D; Mon, 24 Jan 2022 21:37:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB009C340E4; Mon, 24 Jan 2022 21:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060223; bh=YcFsUeslYa8xYA7haRFrlwUsZXiclWBMo3itOg4vcr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cxzcgK0v82+wCNtPNr9GT/vwBP0RXE3NPRHzJXsVncM6iBZOdDXbJFM0AZvuRa2Bb bvHSmxT50A6F6bYJOOmpz24MeH/Ulwq+gdcbPvGiAsIjX1ylIlasKe9ybGkWHMy6Jf VXwyczEWSO+f51eCj9nkeFvL8aEF1UtMV7s5hTzc= 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?= , Lorenzo Pieralisi Subject: [PATCH 5.16 0879/1039] PCI: pci-bridge-emul: Set PCI_STATUS_CAP_LIST for PCIe device Date: Mon, 24 Jan 2022 19:44:28 +0100 Message-Id: <20220124184154.845878511@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 commit 3be9d243b21724d49b65043d4520d688b6040b36 upstream. Since all PCI Express device Functions are required to implement the PCI Express Capability structure, Capabilities List bit in PCI Status Register must be hardwired to 1b. Capabilities Pointer register (which is already set by pci-bride-emul.c driver) is valid only when Capabilities List is set to 1b. Link: https://lore.kernel.org/r/20211124155944.1290-7-pali@kernel.org Fixes: 23a5fba4d941 ("PCI: Introduce PCI bridge emulated config space commo= n logic") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/pci-bridge-emul.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c @@ -296,6 +296,7 @@ int pci_bridge_emul_init(struct pci_brid =20 if (bridge->has_pcie) { bridge->conf.capabilities_pointer =3D PCI_CAP_PCIE_START; + bridge->conf.status |=3D cpu_to_le16(PCI_STATUS_CAP_LIST); bridge->pcie_conf.cap_id =3D PCI_CAP_ID_EXP; bridge->pcie_conf.cap |=3D cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4); bridge->pcie_cap_regs_behavior =3D From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AC01C43219 for ; Mon, 24 Jan 2022 22:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838685AbiAXWrH (ORCPT ); Mon, 24 Jan 2022 17:47:07 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48390 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349372AbiAXVhK (ORCPT ); Mon, 24 Jan 2022 16:37:10 -0500 Received: from smtp.kernel.org (relay.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 55ADBB811A9; Mon, 24 Jan 2022 21:37:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DC4CC340E4; Mon, 24 Jan 2022 21:37:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060226; bh=bO33B91w8GdPLiN34Gv8tmv6269wB+3MTPbgMjpdAfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eY+3F2vHOjLYwVc+nox2cFZhesR5D435CZYk+sAKZpWsXwxQI1OrvnEea39/Lv0mm T+Ryi4/BjxV9Peg9vbkyKYHhxGo7H2zBvbu/ftCLVb3pivAJjiLkfsos+KgbyUt4uD 6pRypY0zEbyWkvffZwRyFm230vb9LKgo1DycVp0I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ghalem Boudour , Nicolas Dichtel , Steffen Klassert Subject: [PATCH 5.16 0880/1039] xfrm: fix policy lookup for ipv6 gre packets Date: Mon, 24 Jan 2022 19:44:29 +0100 Message-Id: <20220124184154.879723129@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ghalem Boudour commit bcf141b2eb551b3477b24997ebc09c65f117a803 upstream. On egress side, xfrm lookup is called from __gre6_xmit() with the fl6_gre_key field not initialized leading to policies selectors check failure. Consequently, gre packets are sent without encryption. On ingress side, INET6_PROTO_NOPOLICY was set, thus packets were not checked against xfrm policies. Like for egress side, fl6_gre_key should be correctly set, this is now done in decode_session6(). Fixes: c12b395a4664 ("gre: Support GRE over IPv6") Cc: stable@vger.kernel.org Signed-off-by: Ghalem Boudour Signed-off-by: Nicolas Dichtel Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/ipv6/ip6_gre.c | 5 ++++- net/xfrm/xfrm_policy.c | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -755,6 +755,7 @@ static netdev_tx_t __gre6_xmit(struct sk fl6->daddr =3D key->u.ipv6.dst; fl6->flowlabel =3D key->label; fl6->flowi6_uid =3D sock_net_uid(dev_net(dev), NULL); + fl6->fl6_gre_key =3D tunnel_id_to_key32(key->tun_id); =20 dsfield =3D key->tos; flags =3D key->tun_flags & @@ -990,6 +991,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit fl6.daddr =3D key->u.ipv6.dst; fl6.flowlabel =3D key->label; fl6.flowi6_uid =3D sock_net_uid(dev_net(dev), NULL); + fl6.fl6_gre_key =3D tunnel_id_to_key32(key->tun_id); =20 dsfield =3D key->tos; if (!(tun_info->key.tun_flags & TUNNEL_ERSPAN_OPT)) @@ -1098,6 +1100,7 @@ static void ip6gre_tnl_link_config_commo fl6->flowi6_oif =3D p->link; fl6->flowlabel =3D 0; fl6->flowi6_proto =3D IPPROTO_GRE; + fl6->fl6_gre_key =3D t->parms.o_key; =20 if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS)) fl6->flowlabel |=3D IPV6_TCLASS_MASK & p->flowinfo; @@ -1544,7 +1547,7 @@ static void ip6gre_fb_tunnel_init(struct static struct inet6_protocol ip6gre_protocol __read_mostly =3D { .handler =3D gre_rcv, .err_handler =3D ip6gre_err, - .flags =3D INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, + .flags =3D INET6_PROTO_FINAL, }; =20 static void ip6gre_destroy_tunnels(struct net *net, struct list_head *head) --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -33,6 +33,7 @@ #include #include #include +#include #if IS_ENABLED(CONFIG_IPV6_MIP6) #include #endif @@ -3422,6 +3423,26 @@ decode_session6(struct sk_buff *skb, str } fl6->flowi6_proto =3D nexthdr; return; + case IPPROTO_GRE: + if (!onlyproto && + (nh + offset + 12 < skb->data || + pskb_may_pull(skb, nh + offset + 12 - skb->data))) { + struct gre_base_hdr *gre_hdr; + __be32 *gre_key; + + nh =3D skb_network_header(skb); + gre_hdr =3D (struct gre_base_hdr *)(nh + offset); + gre_key =3D (__be32 *)(gre_hdr + 1); + + if (gre_hdr->flags & GRE_KEY) { + if (gre_hdr->flags & GRE_CSUM) + gre_key++; + fl6->fl6_gre_key =3D *gre_key; + } + } + fl6->flowi6_proto =3D nexthdr; + return; + #if IS_ENABLED(CONFIG_IPV6_MIP6) case IPPROTO_MH: offset +=3D ipv6_optlen(exthdr); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49F6EC4707F for ; Mon, 24 Jan 2022 22:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838653AbiAXWrD (ORCPT ); Mon, 24 Jan 2022 17:47:03 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55434 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351335AbiAXVhL (ORCPT ); Mon, 24 Jan 2022 16:37:11 -0500 Received: from smtp.kernel.org (relay.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 6C6EC614CB; Mon, 24 Jan 2022 21:37:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77EC7C340E4; Mon, 24 Jan 2022 21:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060228; bh=6NOPhziuYypkTM6BA48wy+IPkpY4HrxLprlwRYabKag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2s8EQ5tDgKINW0xkfXCgv9EKE5NzrGTUKVIFw5i1C5cHEwUA0RD6dIIGznK0XgddG mlBZOw/k1z2hRLL6wv9zZhwECQK03C+mEA9VxPAZeZlv1liMm7xip3YVPFdT4G/I6J 3IXKt3hs2VsfOy17KRRxJNMcPh7y/7ezcbXmV1To= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Dichtel , Steffen Klassert Subject: [PATCH 5.16 0881/1039] xfrm: fix dflt policy check when there is no policy configured Date: Mon, 24 Jan 2022 19:44:30 +0100 Message-Id: <20220124184154.909528381@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Dichtel commit ec3bb890817e4398f2d46e12e2e205495b116be9 upstream. When there is no policy configured on the system, the default policy is checked in xfrm_route_forward. However, it was done with the wrong direction (XFRM_POLICY_FWD instead of XFRM_POLICY_OUT). The default policy for XFRM_POLICY_FWD was checked just before, with a call to xfrm[46]_policy_check(). CC: stable@vger.kernel.org Fixes: 2d151d39073a ("xfrm: Add possibility to set the default to block if = we have no policy") Signed-off-by: Nicolas Dichtel Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/net/xfrm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1167,7 +1167,7 @@ static inline int xfrm_route_forward(str { struct net *net =3D dev_net(skb->dev); =20 - if (xfrm_default_allow(net, XFRM_POLICY_FWD)) + if (xfrm_default_allow(net, XFRM_POLICY_OUT)) return !net->xfrm.policy_count[XFRM_POLICY_OUT] || (skb_dst(skb)->flags & DST_NOXFRM) || __xfrm_route_forward(skb, family); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 908C7C433EF for ; Tue, 25 Jan 2022 00:23:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3408202AbiAYAWB (ORCPT ); Mon, 24 Jan 2022 19:22:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360157AbiAXXgJ (ORCPT ); Mon, 24 Jan 2022 18:36:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED677C0612FC; Mon, 24 Jan 2022 13:37:12 -0800 (PST) Received: from smtp.kernel.org (relay.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 8D41461509; Mon, 24 Jan 2022 21:37:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F87DC340EE; Mon, 24 Jan 2022 21:37:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060232; bh=hfe/X2R1Opq4HzyJLzvdS46U19FqV7aHHRimDomOgMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jCRiaZzKVzKzA5BLPscqjlZVpqKlRksHF9tj9p8V3tx31rDJ8ONitMt7K2lVBN+BB PNPu02IBUcyeroAKm13uh/UT8VlapeLQLL4SED8S4t/BzlWfcUVjHhtMIWGbeiypS2 BaLo4ZgY9cVnp8/L31SbCNyuXpBV3k+H0V72vJyE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hao Sun , Qu Wenruo , Filipe Manana , David Sterba Subject: [PATCH 5.16 0882/1039] btrfs: fix deadlock between quota enable and other quota operations Date: Mon, 24 Jan 2022 19:44:31 +0100 Message-Id: <20220124184154.941989200@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 232796df8c1437c41d308d161007f0715bac0a54 upstream. When enabling quotas, we attempt to commit a transaction while holding the mutex fs_info->qgroup_ioctl_lock. This can result on a deadlock with other quota operations such as: - qgroup creation and deletion, ioctl BTRFS_IOC_QGROUP_CREATE; - adding and removing qgroup relations, ioctl BTRFS_IOC_QGROUP_ASSIGN. This is because these operations join a transaction and after that they attempt to lock the mutex fs_info->qgroup_ioctl_lock. Acquiring that mutex after joining or starting a transaction is a pattern followed everywhere in qgroups, so the quota enablement operation is the one at fault here, and should not commit a transaction while holding that mutex. Fix this by making the transaction commit while not holding the mutex. We are safe from two concurrent tasks trying to enable quotas because we are serialized by the rw semaphore fs_info->subvol_sem at btrfs_ioctl_quota_ctl(), which is the only call site for enabling quotas. When this deadlock happens, it produces a trace like the following: INFO: task syz-executor:25604 blocked for more than 143 seconds. Not tainted 5.15.0-rc6 #4 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:syz-executor state:D stack:24800 pid:25604 ppid: 24873 flags:0x00004= 004 Call Trace: context_switch kernel/sched/core.c:4940 [inline] __schedule+0xcd9/0x2530 kernel/sched/core.c:6287 schedule+0xd3/0x270 kernel/sched/core.c:6366 btrfs_commit_transaction+0x994/0x2e90 fs/btrfs/transaction.c:2201 btrfs_quota_enable+0x95c/0x1790 fs/btrfs/qgroup.c:1120 btrfs_ioctl_quota_ctl fs/btrfs/ioctl.c:4229 [inline] btrfs_ioctl+0x637e/0x7b70 fs/btrfs/ioctl.c:5010 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860 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+0x44/0xae RIP: 0033:0x7f86920b2c4d RSP: 002b:00007f868f61ac58 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f86921d90a0 RCX: 00007f86920b2c4d RDX: 0000000020005e40 RSI: 00000000c0109428 RDI: 0000000000000008 RBP: 00007f869212bd80 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f86921d90a0 R13: 00007fff6d233e4f R14: 00007fff6d233ff0 R15: 00007f868f61adc0 INFO: task syz-executor:25628 blocked for more than 143 seconds. Not tainted 5.15.0-rc6 #4 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:syz-executor state:D stack:29080 pid:25628 ppid: 24873 flags:0x00004= 004 Call Trace: context_switch kernel/sched/core.c:4940 [inline] __schedule+0xcd9/0x2530 kernel/sched/core.c:6287 schedule+0xd3/0x270 kernel/sched/core.c:6366 schedule_preempt_disabled+0xf/0x20 kernel/sched/core.c:6425 __mutex_lock_common kernel/locking/mutex.c:669 [inline] __mutex_lock+0xc96/0x1680 kernel/locking/mutex.c:729 btrfs_remove_qgroup+0xb7/0x7d0 fs/btrfs/qgroup.c:1548 btrfs_ioctl_qgroup_create fs/btrfs/ioctl.c:4333 [inline] btrfs_ioctl+0x683c/0x7b70 fs/btrfs/ioctl.c:5014 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860 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+0x44/0xae Reported-by: Hao Sun Link: https://lore.kernel.org/linux-btrfs/CACkBjsZQF19bQ1C6=3DyetF3BvL10OSO= RpFUcWXTP6HErshDB4dQ@mail.gmail.com/ Fixes: 340f1aa27f36 ("btrfs: qgroups: Move transaction management inside bt= rfs_quota_enable/disable") CC: stable@vger.kernel.org # 4.19 Reviewed-by: Qu Wenruo Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/qgroup.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -940,6 +940,14 @@ int btrfs_quota_enable(struct btrfs_fs_i int ret =3D 0; int slot; =20 + /* + * We need to have subvol_sem write locked, to prevent races between + * concurrent tasks trying to enable quotas, because we will unlock + * and relock qgroup_ioctl_lock before setting fs_info->quota_root + * and before setting BTRFS_FS_QUOTA_ENABLED. + */ + lockdep_assert_held_write(&fs_info->subvol_sem); + mutex_lock(&fs_info->qgroup_ioctl_lock); if (fs_info->quota_root) goto out; @@ -1117,8 +1125,19 @@ out_add_root: goto out_free_path; } =20 + mutex_unlock(&fs_info->qgroup_ioctl_lock); + /* + * Commit the transaction while not holding qgroup_ioctl_lock, to avoid + * a deadlock with tasks concurrently doing other qgroup operations, such + * adding/removing qgroups or adding/deleting qgroup relations for exampl= e, + * because all qgroup operations first start or join a transaction and th= en + * lock the qgroup_ioctl_lock mutex. + * We are safe from a concurrent task trying to enable quotas, by calling + * this function, since we are serialized by fs_info->subvol_sem. + */ ret =3D btrfs_commit_transaction(trans); trans =3D NULL; + mutex_lock(&fs_info->qgroup_ioctl_lock); if (ret) goto out_free_path; =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4988BC433EF for ; Mon, 24 Jan 2022 22:31:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587681AbiAXW30 (ORCPT ); Mon, 24 Jan 2022 17:29:26 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55524 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357782AbiAXVhQ (ORCPT ); Mon, 24 Jan 2022 16:37:16 -0500 Received: from smtp.kernel.org (relay.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 3D9DE6150E; Mon, 24 Jan 2022 21:37:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A42CC340E7; Mon, 24 Jan 2022 21:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060234; bh=B88h2m79idm4SYEPZYoS03HG4DAKQM2Ij5Q84oDfmyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3Da+9lGhOAKTn+KdBaCaxWg5UxZk1X2NtbuO2UKQgm5cnf7UI2YYbZRNmipKwa99 hIOvSxfipNKF4mZoRbFmt+zCv0R7sKSci/DfGWGFbe8h0ylnvXDAJQlkWQkZO92BY9 QYB+JR4wH0VjOsDAYObz4B82cOiFqcWEyLU78qU8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba Subject: [PATCH 5.16 0883/1039] btrfs: zoned: cache reported zone during mount Date: Mon, 24 Jan 2022 19:44:32 +0100 Message-Id: <20220124184154.976481441@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota commit 16beac87e95e2fb278b552397c8260637f8a63f7 upstream. When mounting a device, we are reporting the zones twice: once for checking the zone attributes in btrfs_get_dev_zone_info and once for loading block groups' zone info in btrfs_load_block_group_zone_info(). With a lot of block groups, that leads to a lot of REPORT ZONE commands and slows down the mount process. This patch introduces a zone info cache in struct btrfs_zoned_device_info. The cache is populated while in btrfs_get_dev_zone_info() and used for btrfs_load_block_group_zone_info() to reduce the number of REPORT ZONE commands. The zone cache is then released after loading the block groups, as it will not be much effective during the run time. Benchmark: Mount an HDD with 57,007 block groups Before patch: 171.368 seconds After patch: 64.064 seconds While it still takes a minute due to the slowness of loading all the block groups, the patch reduces the mount time by 1/3. Link: https://lore.kernel.org/linux-btrfs/CAHQ7scUiLtcTqZOMMY5kbWUBOhGRwKo6= J6wYPT5WY+C=3DcD49nQ@mail.gmail.com/ Fixes: 5b316468983d ("btrfs: get zone information of zoned block devices") CC: stable@vger.kernel.org Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/dev-replace.c | 2 - fs/btrfs/disk-io.c | 2 + fs/btrfs/volumes.c | 2 - fs/btrfs/zoned.c | 86 +++++++++++++++++++++++++++++++++++++++++++-= ----- fs/btrfs/zoned.h | 8 +++- 5 files changed, 87 insertions(+), 13 deletions(-) --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -322,7 +322,7 @@ static int btrfs_init_dev_replace_tgtdev set_blocksize(device->bdev, BTRFS_BDEV_BLOCKSIZE); device->fs_devices =3D fs_info->fs_devices; =20 - ret =3D btrfs_get_dev_zone_info(device); + ret =3D btrfs_get_dev_zone_info(device, false); if (ret) goto error; =20 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3571,6 +3571,8 @@ int __cold open_ctree(struct super_block goto fail_sysfs; } =20 + btrfs_free_zone_cache(fs_info); + if (!sb_rdonly(sb) && fs_info->fs_devices->missing_devices && !btrfs_check_rw_degradable(fs_info, NULL)) { btrfs_warn(fs_info, --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2643,7 +2643,7 @@ int btrfs_init_new_device(struct btrfs_f device->fs_info =3D fs_info; device->bdev =3D bdev; =20 - ret =3D btrfs_get_dev_zone_info(device); + ret =3D btrfs_get_dev_zone_info(device, false); if (ret) goto error_free_device; =20 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "ctree.h" #include "volumes.h" #include "zoned.h" @@ -213,6 +214,8 @@ static int emulate_report_zones(struct b static int btrfs_get_dev_zones(struct btrfs_device *device, u64 pos, struct blk_zone *zones, unsigned int *nr_zones) { + struct btrfs_zoned_device_info *zinfo =3D device->zone_info; + u32 zno; int ret; =20 if (!*nr_zones) @@ -224,6 +227,34 @@ static int btrfs_get_dev_zones(struct bt return 0; } =20 + /* Check cache */ + if (zinfo->zone_cache) { + unsigned int i; + + ASSERT(IS_ALIGNED(pos, zinfo->zone_size)); + zno =3D pos >> zinfo->zone_size_shift; + /* + * We cannot report zones beyond the zone end. So, it is OK to + * cap *nr_zones to at the end. + */ + *nr_zones =3D min_t(u32, *nr_zones, zinfo->nr_zones - zno); + + for (i =3D 0; i < *nr_zones; i++) { + struct blk_zone *zone_info; + + zone_info =3D &zinfo->zone_cache[zno + i]; + if (!zone_info->len) + break; + } + + if (i =3D=3D *nr_zones) { + /* Cache hit on all the zones */ + memcpy(zones, zinfo->zone_cache + zno, + sizeof(*zinfo->zone_cache) * *nr_zones); + return 0; + } + } + ret =3D blkdev_report_zones(device->bdev, pos >> SECTOR_SHIFT, *nr_zones, copy_zone_info_cb, zones); if (ret < 0) { @@ -237,6 +268,11 @@ static int btrfs_get_dev_zones(struct bt if (!ret) return -EIO; =20 + /* Populate cache */ + if (zinfo->zone_cache) + memcpy(zinfo->zone_cache + zno, zones, + sizeof(*zinfo->zone_cache) * *nr_zones); + return 0; } =20 @@ -300,7 +336,7 @@ int btrfs_get_dev_zone_info_all_devices( if (!device->bdev) continue; =20 - ret =3D btrfs_get_dev_zone_info(device); + ret =3D btrfs_get_dev_zone_info(device, true); if (ret) break; } @@ -309,7 +345,7 @@ int btrfs_get_dev_zone_info_all_devices( return ret; } =20 -int btrfs_get_dev_zone_info(struct btrfs_device *device) +int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cac= he) { struct btrfs_fs_info *fs_info =3D device->fs_info; struct btrfs_zoned_device_info *zone_info =3D NULL; @@ -339,6 +375,8 @@ int btrfs_get_dev_zone_info(struct btrfs if (!zone_info) return -ENOMEM; =20 + device->zone_info =3D zone_info; + if (!bdev_is_zoned(bdev)) { if (!fs_info->zone_size) { ret =3D calculate_emulated_zone_size(fs_info); @@ -407,6 +445,23 @@ int btrfs_get_dev_zone_info(struct btrfs goto out; } =20 + /* + * Enable zone cache only for a zoned device. On a non-zoned device, we + * fill the zone info with emulated CONVENTIONAL zones, so no need to + * use the cache. + */ + if (populate_cache && bdev_is_zoned(device->bdev)) { + zone_info->zone_cache =3D vzalloc(sizeof(struct blk_zone) * + zone_info->nr_zones); + if (!zone_info->zone_cache) { + btrfs_err_in_rcu(device->fs_info, + "zoned: failed to allocate zone cache for %s", + rcu_str_deref(device->name)); + ret =3D -ENOMEM; + goto out; + } + } + /* Get zones type */ nactive =3D 0; while (sector < nr_sectors) { @@ -505,8 +560,6 @@ int btrfs_get_dev_zone_info(struct btrfs =20 kfree(zones); =20 - device->zone_info =3D zone_info; - switch (bdev_zoned_model(bdev)) { case BLK_ZONED_HM: model =3D "host-managed zoned"; @@ -539,11 +592,7 @@ int btrfs_get_dev_zone_info(struct btrfs out: kfree(zones); out_free_zone_info: - bitmap_free(zone_info->active_zones); - bitmap_free(zone_info->empty_zones); - bitmap_free(zone_info->seq_zones); - kfree(zone_info); - device->zone_info =3D NULL; + btrfs_destroy_dev_zone_info(device); =20 return ret; } @@ -558,6 +607,7 @@ void btrfs_destroy_dev_zone_info(struct bitmap_free(zone_info->active_zones); bitmap_free(zone_info->seq_zones); bitmap_free(zone_info->empty_zones); + vfree(zone_info->zone_cache); kfree(zone_info); device->zone_info =3D NULL; } @@ -1975,3 +2025,21 @@ void btrfs_clear_data_reloc_bg(struct bt fs_info->data_reloc_bg =3D 0; spin_unlock(&fs_info->relocation_bg_lock); } + +void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info) +{ + struct btrfs_fs_devices *fs_devices =3D fs_info->fs_devices; + struct btrfs_device *device; + + if (!btrfs_is_zoned(fs_info)) + return; + + mutex_lock(&fs_devices->device_list_mutex); + list_for_each_entry(device, &fs_devices->devices, dev_list) { + if (device->zone_info) { + vfree(device->zone_info->zone_cache); + device->zone_info->zone_cache =3D NULL; + } + } + mutex_unlock(&fs_devices->device_list_mutex); +} --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -28,6 +28,7 @@ struct btrfs_zoned_device_info { unsigned long *seq_zones; unsigned long *empty_zones; unsigned long *active_zones; + struct blk_zone *zone_cache; struct blk_zone sb_zones[2 * BTRFS_SUPER_MIRROR_MAX]; }; =20 @@ -35,7 +36,7 @@ struct btrfs_zoned_device_info { int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos, struct blk_zone *zone); int btrfs_get_dev_zone_info_all_devices(struct btrfs_fs_info *fs_info); -int btrfs_get_dev_zone_info(struct btrfs_device *device); +int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cac= he); void btrfs_destroy_dev_zone_info(struct btrfs_device *device); int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info); int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info); @@ -76,6 +77,7 @@ bool btrfs_can_activate_zone(struct btrf void btrfs_zone_finish_endio(struct btrfs_fs_info *fs_info, u64 logical, u64 length); void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg); +void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info); #else /* CONFIG_BLK_DEV_ZONED */ static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos, struct blk_zone *zone) @@ -88,7 +90,8 @@ static inline int btrfs_get_dev_zone_inf return 0; } =20 -static inline int btrfs_get_dev_zone_info(struct btrfs_device *device) +static inline int btrfs_get_dev_zone_info(struct btrfs_device *device, + bool populate_cache) { return 0; } @@ -232,6 +235,7 @@ static inline void btrfs_zone_finish_end =20 static inline void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg)= { } =20 +static inline void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info) { } #endif =20 static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u6= 4 pos) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1794C433EF for ; Mon, 24 Jan 2022 22:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838000AbiAXWpp (ORCPT ); Mon, 24 Jan 2022 17:45:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47594 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377338AbiAXVh3 (ORCPT ); Mon, 24 Jan 2022 16:37:29 -0500 Received: from smtp.kernel.org (relay.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 F2D18B81142; Mon, 24 Jan 2022 21:37:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2393CC340E7; Mon, 24 Jan 2022 21:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060237; bh=NoAJVYw6CP/5wj4wKs43vSyyWuXkyI9r0CT4hhQoO8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N6ZV7o86rpTbcfpnGZu53diW3t1PDaPhohU46LfkhkXWEiTNcTAkI/DYrB7DpYPlP pRHjk2i0qC2tqVfV2lvBMYde8zeBIbkJD9I6+xivmOM7O3wsY/skzMlmUGdjzmkb91 00gaZZlrgNOnA7N4gBwX6YoCKIqwZATyUKcVMYZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , Josef Bacik , David Sterba Subject: [PATCH 5.16 0884/1039] btrfs: check the root node for uptodate before returning it Date: Mon, 24 Jan 2022 19:44:33 +0100 Message-Id: <20220124184155.007622603@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 120de408e4b97504a2d9b5ca534b383de2c73d49 upstream. Now that we clear the extent buffer uptodate if we fail to write it out we need to check to see if our root node is uptodate before we search down it. Otherwise we could return stale data (or potentially corrupt data that was caught by the write verification step) and think that the path is OK to search down. CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Nikolay Borisov Signed-off-by: Josef Bacik Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/ctree.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1570,12 +1570,9 @@ static struct extent_buffer *btrfs_searc { struct btrfs_fs_info *fs_info =3D root->fs_info; struct extent_buffer *b; - int root_lock; + int root_lock =3D 0; int level =3D 0; =20 - /* We try very hard to do read locks on the root */ - root_lock =3D BTRFS_READ_LOCK; - if (p->search_commit_root) { /* * The commit roots are read only so we always do read locks, @@ -1613,6 +1610,9 @@ static struct extent_buffer *btrfs_searc goto out; } =20 + /* We try very hard to do read locks on the root */ + root_lock =3D BTRFS_READ_LOCK; + /* * If the level is set to maximum, we can skip trying to get the read * lock. @@ -1639,6 +1639,17 @@ static struct extent_buffer *btrfs_searc level =3D btrfs_header_level(b); =20 out: + /* + * The root may have failed to write out at some point, and thus is no + * longer valid, return an error in this case. + */ + if (!extent_buffer_uptodate(b)) { + if (root_lock) + btrfs_tree_unlock_rw(b, root_lock); + free_extent_buffer(b); + return ERR_PTR(-EIO); + } + p->nodes[level] =3D b; if (!p->skip_locking) p->locks[level] =3D root_lock; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5511C433F5 for ; Tue, 25 Jan 2022 00:23:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2375591AbiAYAUk (ORCPT ); Mon, 24 Jan 2022 19:20:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360267AbiAXXgV (ORCPT ); Mon, 24 Jan 2022 18:36:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE788C0ADFD2; Mon, 24 Jan 2022 13:37:21 -0800 (PST) Received: from smtp.kernel.org (relay.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 5EE2761509; Mon, 24 Jan 2022 21:37:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F026C340E5; Mon, 24 Jan 2022 21:37:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060240; bh=iVBtmMFos7khpdpnzC8VC+3aCQSp2wxi7CJFJLIM1oE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G0elHKSM3KGtYDGBNFjTP1hsEGItoaPsHpGm8gRikaa+JdbB/L3FwWSHsrBGMPgEE wqQx4lxRhdWSNWJE8/M1oFuqrzcyETFuQJsR5/wnkw4IVW/Pcm0/qxohTt2tkfYNQf a3CnXEtYG8j5IuRg28t1AtFdFC5HgDXabPiC9R4E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba Subject: [PATCH 5.16 0885/1039] btrfs: add extent allocator hook to decide to allocate chunk or not Date: Mon, 24 Jan 2022 19:44:34 +0100 Message-Id: <20220124184155.038183447@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota commit 50475cd57706359d6cc652be88369dace7a4c2eb upstream. Introduce a new hook for an extent allocator policy. With the new hook, a policy can decide to allocate a new block group or not. If not, it will return -ENOSPC, so btrfs_reserve_extent() will cut the allocation size in half and retry the allocation if min_alloc_size is large enough. The hook has a place holder and will be replaced with the real implementation in the next patch. CC: stable@vger.kernel.org # 5.16 Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/extent-tree.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3947,6 +3947,19 @@ static void found_extent(struct find_fre } } =20 +static bool can_allocate_chunk(struct btrfs_fs_info *fs_info, + struct find_free_extent_ctl *ffe_ctl) +{ + switch (ffe_ctl->policy) { + case BTRFS_EXTENT_ALLOC_CLUSTERED: + return true; + case BTRFS_EXTENT_ALLOC_ZONED: + return true; + default: + BUG(); + } +} + static int chunk_allocation_failed(struct find_free_extent_ctl *ffe_ctl) { switch (ffe_ctl->policy) { @@ -4034,6 +4047,10 @@ static int find_free_extent_update_loop( struct btrfs_trans_handle *trans; int exist =3D 0; =20 + /*Check if allocation policy allows to create a new chunk */ + if (!can_allocate_chunk(fs_info, ffe_ctl)) + return -ENOSPC; + trans =3D current->journal_info; if (trans) exist =3D 1; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB025C433FE for ; Tue, 25 Jan 2022 00:23:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3407895AbiAYAVG (ORCPT ); Mon, 24 Jan 2022 19:21:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360320AbiAXXga (ORCPT ); Mon, 24 Jan 2022 18:36:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D0E5C0604F1; Mon, 24 Jan 2022 13:37:29 -0800 (PST) Received: from smtp.kernel.org (relay.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 3ACFCB812A7; Mon, 24 Jan 2022 21:37:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 622A7C340E7; Mon, 24 Jan 2022 21:37:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060247; bh=J08//W2RZ6z3pUMPIZc0DxIQ0L/ndbEORfINNcq+txY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uur736XDGFjDSWG5RIhR5334nuT1ECAIctsUb8wRnPLh3UKwnxr6BHBN9uhKHVpa2 WyXUlgGVFgVAoBPnBHnSFxD46uQ7EApuo3/xuW36bAZ2S8NIm2huPKkWwm9kyzudbU uzfzhNR2TKZRufD28jiwt5MipUgbf5Bxy9jdLkfk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba Subject: [PATCH 5.16 0886/1039] btrfs: zoned: unset dedicated block group on allocation failure Date: Mon, 24 Jan 2022 19:44:35 +0100 Message-Id: <20220124184155.069409458@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota commit 1ada69f61c88abb75a1038ee457633325658a183 upstream. Allocating an extent from a block group can fail for various reasons. When an allocation from a dedicated block group (for tree-log or relocation data) fails, we need to unregister it as a dedicated one so that we can allocate a new block group for the dedicated one. However, we are returning early when the block group in case it is read-only, fully used, or not be able to activate the zone. As a result, we keep the non-usable block group as a dedicated one, leading to further allocation failure. With many block groups, the allocator will iterate hopeless loop to find a free extent, results in a hung task. Fix the issue by delaying the return and doing the proper cleanups. CC: stable@vger.kernel.org # 5.16 Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/extent-tree.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3790,23 +3790,35 @@ static int do_allocation_zoned(struct bt spin_unlock(&fs_info->relocation_bg_lock); if (skip) return 1; + /* Check RO and no space case before trying to activate it */ spin_lock(&block_group->lock); if (block_group->ro || block_group->alloc_offset =3D=3D block_group->zone_capacity) { - spin_unlock(&block_group->lock); - return 1; + ret =3D 1; + /* + * May need to clear fs_info->{treelog,data_reloc}_bg. + * Return the error after taking the locks. + */ } spin_unlock(&block_group->lock); =20 - if (!btrfs_zone_activate(block_group)) - return 1; + if (!ret && !btrfs_zone_activate(block_group)) { + ret =3D 1; + /* + * May need to clear fs_info->{treelog,data_reloc}_bg. + * Return the error after taking the locks. + */ + } =20 spin_lock(&space_info->lock); spin_lock(&block_group->lock); spin_lock(&fs_info->treelog_bg_lock); spin_lock(&fs_info->relocation_bg_lock); =20 + if (ret) + goto out; + ASSERT(!ffe_ctl->for_treelog || block_group->start =3D=3D fs_info->treelog_bg || fs_info->treelog_bg =3D=3D 0); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13DE7C433EF for ; Mon, 24 Jan 2022 22:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835610AbiAXWhC (ORCPT ); Mon, 24 Jan 2022 17:37:02 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49116 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456018AbiAXVhe (ORCPT ); Mon, 24 Jan 2022 16:37:34 -0500 Received: from smtp.kernel.org (relay.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 26CC5B811A2; Mon, 24 Jan 2022 21:37:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B66BC340E4; Mon, 24 Jan 2022 21:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060249; bh=H9Cd36ES4vBtIfhbCdjJQJgnY58I/rp/a5KBhpw7fX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T8FznQkJ2iND11cPa+TxKhVA4iIJydGXqLOIY64NAgOXh5hm5fCLE4Y/V2dmOPyAJ RIrzIQSyuKmuSnq6O80n+WnXwEWsKtEMvh8sL+o93iY/1QjUi2P+7+HuDptovWp8P2 XyhARHiDOyHbU5iQZ6opBAPtLgIiXMZv+TbGUGL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba Subject: [PATCH 5.16 0887/1039] btrfs: zoned: fix chunk allocation condition for zoned allocator Date: Mon, 24 Jan 2022 19:44:36 +0100 Message-Id: <20220124184155.103243395@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota commit 82187d2ecdfb22ab7ee05f388402a39236d31428 upstream. The ZNS specification defines a limit on the number of "active" zones. That limit impose us to limit the number of block groups which can be used for an allocation at the same time. Not to exceed the limit, we reuse the existing active block groups as much as possible when we can't activate any other zones without sacrificing an already activated block group in commit a85f05e59bc1 ("btrfs: zoned: avoid chunk allocation if active block group has enough space"). However, the check is wrong in two ways. First, it checks the condition for every raid index (ffe_ctl->index). Even if it reaches the condition and "ffe_ctl->max_extent_size >=3D ffe_ctl->min_alloc_size" is met, there can be other block groups having enough space to hold ffe_ctl->num_bytes. (Actually, this won't happen in the current zoned code as it only supports SINGLE profile. But, it can happen once it enables other RAID types.) Second, it checks the active zone availability depending on the raid index. The raid index is just an index for space_info->block_groups, so it has nothing to do with chunk allocation. These mistakes are causing a faulty allocation in a certain situation. Consider we are running zoned btrfs on a device whose max_active_zone =3D=3D 0 (no limit). And, suppose no block group have a room to fit ffe_ctl->num_bytes but some room to meet ffe_ctl->min_alloc_size (i.e. max_extent_size > num_bytes >=3D min_alloc_size). In this situation, the following occur: - With SINGLE raid_index, it reaches the chunk allocation checking code - The check returns true because we can activate a new zone (no limit) - But, before allocating the chunk, it iterates to the next raid index (RAID5) - Since there are no RAID5 block groups on zoned mode, it again reaches the check code - The check returns false because of btrfs_can_activate_zone()'s "if (raid_index !=3D BTRFS_RAID_SINGLE)" part - That results in returning -ENOSPC without allocating a new chunk As a result, we end up hitting -ENOSPC too early. Move the check to the right place in the can_allocate_chunk() hook, and do the active zone check depending on the allocation flag, not on the raid index. CC: stable@vger.kernel.org # 5.16 Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/extent-tree.c | 21 +++++++++------------ fs/btrfs/zoned.c | 5 ++--- fs/btrfs/zoned.h | 5 ++--- 3 files changed, 13 insertions(+), 18 deletions(-) --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3966,6 +3966,15 @@ static bool can_allocate_chunk(struct bt case BTRFS_EXTENT_ALLOC_CLUSTERED: return true; case BTRFS_EXTENT_ALLOC_ZONED: + /* + * If we have enough free space left in an already + * active block group and we can't activate any other + * zone now, do not allow allocating a new chunk and + * let find_free_extent() retry with a smaller size. + */ + if (ffe_ctl->max_extent_size >=3D ffe_ctl->min_alloc_size && + !btrfs_can_activate_zone(fs_info->fs_devices, ffe_ctl->flags)) + return false; return true; default: BUG(); @@ -4012,18 +4021,6 @@ static int find_free_extent_update_loop( return 0; } =20 - if (ffe_ctl->max_extent_size >=3D ffe_ctl->min_alloc_size && - !btrfs_can_activate_zone(fs_info->fs_devices, ffe_ctl->index)) { - /* - * If we have enough free space left in an already active block - * group and we can't activate any other zone now, retry the - * active ones with a smaller allocation size. Returning early - * from here will tell btrfs_reserve_extent() to haven the - * size. - */ - return -ENOSPC; - } - if (ffe_ctl->loop >=3D LOOP_CACHING_WAIT && ffe_ctl->have_caching_bg) return 1; =20 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1934,7 +1934,7 @@ int btrfs_zone_finish(struct btrfs_block return ret; } =20 -bool btrfs_can_activate_zone(struct btrfs_fs_devices *fs_devices, int raid= _index) +bool btrfs_can_activate_zone(struct btrfs_fs_devices *fs_devices, u64 flag= s) { struct btrfs_device *device; bool ret =3D false; @@ -1943,8 +1943,7 @@ bool btrfs_can_activate_zone(struct btrf return true; =20 /* Non-single profiles are not supported yet */ - if (raid_index !=3D BTRFS_RAID_SINGLE) - return false; + ASSERT((flags & BTRFS_BLOCK_GROUP_PROFILE_MASK) =3D=3D 0); =20 /* Check if there is a device with active zones left */ mutex_lock(&fs_devices->device_list_mutex); --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -72,8 +72,7 @@ struct btrfs_device *btrfs_zoned_get_dev u64 logical, u64 length); bool btrfs_zone_activate(struct btrfs_block_group *block_group); int btrfs_zone_finish(struct btrfs_block_group *block_group); -bool btrfs_can_activate_zone(struct btrfs_fs_devices *fs_devices, - int raid_index); +bool btrfs_can_activate_zone(struct btrfs_fs_devices *fs_devices, u64 flag= s); void btrfs_zone_finish_endio(struct btrfs_fs_info *fs_info, u64 logical, u64 length); void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg); @@ -225,7 +224,7 @@ static inline int btrfs_zone_finish(stru } =20 static inline bool btrfs_can_activate_zone(struct btrfs_fs_devices *fs_dev= ices, - int raid_index) + u64 flags) { return true; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F056BC433EF for ; Tue, 25 Jan 2022 00:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3407958AbiAYAVR (ORCPT ); Mon, 24 Jan 2022 19:21:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360363AbiAXXgi (ORCPT ); Mon, 24 Jan 2022 18:36:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E69EC05A180; Mon, 24 Jan 2022 13:37:34 -0800 (PST) Received: from smtp.kernel.org (relay.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 C28636150D; Mon, 24 Jan 2022 21:37:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5DFAC340E4; Mon, 24 Jan 2022 21:37:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060253; bh=cLHPf/JCXUTYGxqtShabK2y0tmu9p4jwP5/5jvaPxHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hvajUePxWQrNOWB2mN6TaXXNGtyYKCltkRYk3ATrVnHziaCKU/JtJfU5DsPJ1zyEY P89fh2LmuOcs7YNHxycVtlJW5+AQ1aUm5tNKZzQTwW75AyuVlHWgPoiE3+kKJOjHfp GXUhYPjLWv9FXKoiStpukBIzzr6+uQA53Kd+eEDQ= 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.16 0888/1039] btrfs: respect the max size in the header when activating swap file Date: Mon, 24 Jan 2022 19:44:37 +0100 Message-Id: <20220124184155.141168606@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 c2f822635df873c510bda6fb7fd1b10b7c31be2d upstream. If we extended the size of a swapfile after its header was created (by the mkswap utility) and then try to activate it, we will map the entire file when activating the swap file, instead of limiting to the max size defined in the swap file's header. Currently test case generic/643 from fstests fails because we do not respect that size limit defined in the swap file's header. So fix this by not mapping file ranges beyond the max size defined in the swap header. This is the same type of bug that iomap used to have, and was fixed in commit 36ca7943ac18ae ("mm/swap: consider max pages in iomap_swapfile_add_extent"). Fixes: ed46ff3d423780 ("Btrfs: support swap files") CC: stable@vger.kernel.org # 5.4+ Reviewed-and-tested-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/inode.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -10595,9 +10595,19 @@ static int btrfs_add_swap_extent(struct struct btrfs_swap_info *bsi) { unsigned long nr_pages; + unsigned long max_pages; u64 first_ppage, first_ppage_reported, next_ppage; int ret; =20 + /* + * Our swapfile may have had its size extended after the swap header was + * written. In that case activating the swapfile should not go beyond + * the max size set in the swap header. + */ + if (bsi->nr_pages >=3D sis->max) + return 0; + + max_pages =3D sis->max - bsi->nr_pages; first_ppage =3D ALIGN(bsi->block_start, PAGE_SIZE) >> PAGE_SHIFT; next_ppage =3D ALIGN_DOWN(bsi->block_start + bsi->block_len, PAGE_SIZE) >> PAGE_SHIFT; @@ -10605,6 +10615,7 @@ static int btrfs_add_swap_extent(struct if (first_ppage >=3D next_ppage) return 0; nr_pages =3D next_ppage - first_ppage; + nr_pages =3D min(nr_pages, max_pages); =20 first_ppage_reported =3D first_ppage; if (bsi->start =3D=3D 0) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3651C433EF for ; Tue, 25 Jan 2022 00:23:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3408174AbiAYAVx (ORCPT ); Mon, 24 Jan 2022 19:21:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360379AbiAXXgk (ORCPT ); Mon, 24 Jan 2022 18:36:40 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 921E9C0ADFD7; Mon, 24 Jan 2022 13:37:38 -0800 (PST) Received: from smtp.kernel.org (relay.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 5BF4DB81188; Mon, 24 Jan 2022 21:37:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9303BC340E4; Mon, 24 Jan 2022 21:37:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060256; bh=0/1uQfnW40fQCtD/TrAwPiBVSZy/dooJp7W8kuvZi2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LTnhflvFVp5yUNAwUtJ3hmckzTjRuISdfT5/DOiE13nJy+R+uwzGcJRWJ4gGE8pKE SMsiLa92k4SgUD+FDrefAq9r7ozvSlGdqY9z0Ji5Zqny2SE0EcknGNG37gcpgMs/eH AdLZoeiNrKC2P6YKArIshDXXdxz3jEnzJ+yeuJGM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , stable@kernel.org, Theodore Tso , syzbot+3b6f9218b1301ddda3e2@syzkaller.appspotmail.com Subject: [PATCH 5.16 0889/1039] ext4: make sure to reset inode lockdep class when quota enabling fails Date: Mon, 24 Jan 2022 19:44:38 +0100 Message-Id: <20220124184155.174086253@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 4013d47a5307fdb5c13370b5392498b00fedd274 upstream. When we succeed in enabling some quota type but fail to enable another one with quota feature, we correctly disable all enabled quota types. However we forget to reset i_data_sem lockdep class. When the inode gets freed and reused, it will inherit this lockdep class (i_data_sem is initialized only when a slab is created) and thus eventually lockdep barfs about possible deadlocks. Reported-and-tested-by: syzbot+3b6f9218b1301ddda3e2@syzkaller.appspotmail.c= om Signed-off-by: Jan Kara Cc: stable@kernel.org Link: https://lore.kernel.org/r/20211007155336.12493-3-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/super.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -6361,8 +6361,19 @@ int ext4_enable_quotas(struct super_bloc "Failed to enable quota tracking " "(type=3D%d, err=3D%d). Please run " "e2fsck to fix.", type, err); - for (type--; type >=3D 0; type--) + for (type--; type >=3D 0; type--) { + struct inode *inode; + + inode =3D sb_dqopt(sb)->files[type]; + if (inode) + inode =3D igrab(inode); dquot_quota_off(sb, type); + if (inode) { + lockdep_set_quota_inode(inode, + I_DATA_SEM_NORMAL); + iput(inode); + } + } =20 return err; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19794C433F5 for ; Mon, 24 Jan 2022 22:41:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835575AbiAXWgz (ORCPT ); Mon, 24 Jan 2022 17:36:55 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55820 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377564AbiAXVhk (ORCPT ); Mon, 24 Jan 2022 16:37:40 -0500 Received: from smtp.kernel.org (relay.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 89AF261320; Mon, 24 Jan 2022 21:37:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F8D0C340E4; Mon, 24 Jan 2022 21:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060259; bh=UT/Dyl9nj/GkI8RbdJNJ6JJC4uuJhbXEjUEcFtXd0Bo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ERebD0CSw+APQ9s/XpSjt6C35Wpb0fd42IGcq6a9V2aBWJ+Ft4oL5dtpNIdDhdfFT IFejbMLFaSSwEf6gSvLHrCuSAiy1DU1G5j3Ha/0etyNCniJ9+RVYC6XzkIux63p8pM Wrc5shrI8ilPYyf8Mmb/ZVn6GhvDFsB7BSQbZ89U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , stable@kernel.org, Theodore Tso Subject: [PATCH 5.16 0890/1039] ext4: make sure quota gets properly shutdown on error Date: Mon, 24 Jan 2022 19:44:39 +0100 Message-Id: <20220124184155.205187963@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 15fc69bbbbbc8c72e5f6cc4e1be0f51283c5448e upstream. When we hit an error when enabling quotas and setting inode flags, we do not properly shutdown quota subsystem despite returning error from Q_QUOTAON quotactl. This can lead to some odd situations like kernel using quota file while it is still writeable for userspace. Make sure we properly cleanup the quota subsystem in case of error. Signed-off-by: Jan Kara Cc: stable@kernel.org Link: https://lore.kernel.org/r/20211007155336.12493-2-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -6275,10 +6275,7 @@ static int ext4_quota_on(struct super_bl =20 lockdep_set_quota_inode(path->dentry->d_inode, I_DATA_SEM_QUOTA); err =3D dquot_quota_on(sb, type, format_id, path); - if (err) { - lockdep_set_quota_inode(path->dentry->d_inode, - I_DATA_SEM_NORMAL); - } else { + if (!err) { struct inode *inode =3D d_inode(path->dentry); handle_t *handle; =20 @@ -6298,7 +6295,12 @@ static int ext4_quota_on(struct super_bl ext4_journal_stop(handle); unlock_inode: inode_unlock(inode); + if (err) + dquot_quota_off(sb, type); } + if (err) + lockdep_set_quota_inode(path->dentry->d_inode, + I_DATA_SEM_NORMAL); return err; } =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BE39C433FE for ; Mon, 24 Jan 2022 22:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587906AbiAXWaE (ORCPT ); Mon, 24 Jan 2022 17:30:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47772 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456084AbiAXVhs (ORCPT ); Mon, 24 Jan 2022 16:37:48 -0500 Received: from smtp.kernel.org (relay.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 4957CB812A7; Mon, 24 Jan 2022 21:37:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 617EAC340E4; Mon, 24 Jan 2022 21:37:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060262; bh=TrEyxXScUQN2ndIprFfTUzN2MsbyjUrfc//izk3BMCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DeJU6osTOOhIoC29NF3vjDJ+1aRVrQI/+NQV4Ch9H8YyHm4BN0hH4XRF8dGo8EOYI xWll1l4ba5KQWc89WyLa4qqqP6mA/E59T0daOW+FwkO8wbKOgkjjEjx+VCuY3vT1OE pBAt8+b5EqXrTtrHOPEhgSBW4nqJZhtytMUtvcDg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunguang Xu , kernel test robot , Jan Kara , Theodore Tso , stable@kernel.org Subject: [PATCH 5.16 0891/1039] ext4: fix a possible ABBA deadlock due to busy PA Date: Mon, 24 Jan 2022 19:44:40 +0100 Message-Id: <20220124184155.237744472@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chunguang Xu commit 8c80fb312d7abf8bcd66cca1d843a80318a2c522 upstream. We found on older kernel (3.10) that in the scenario of insufficient disk space, system may trigger an ABBA deadlock problem, it seems that this problem still exists in latest kernel, try to fix it here. The main process triggered by this problem is that task A occupies the PA and waits for the jbd2 transaction finish, the jbd2 transaction waits for the completion of task B's IO (plug_list), but task B waits for the release of PA by task A to finish discard, which indirectly forms an ABBA deadlock. The related calltrace is as follows: Task A vfs_write ext4_mb_new_blocks() ext4_mb_mark_diskspace_used() JBD2 jbd2_journal_get_write_access() -> jbd2_journal_commit_transaction() ->schedule() filemap_fdatawait() | | | Task B | | do_unlinkat() | | ext4_evict_inode() | | jbd2_journal_begin_ordered_truncate() | | filemap_fdatawrite_range() | | ext4_mb_new_blocks() | -ext4_mb_discard_group_preallocations() <----- Here, try to cancel ext4_mb_discard_group_preallocations() internal retry due to PA busy, and do a limited number of retries inside ext4_mb_discard_preallocations(), which can circumvent the above problems, but also has some advantages: 1. Since the PA is in a busy state, if other groups have free PAs, keeping the current PA may help to reduce fragmentation. 2. Continue to traverse forward instead of waiting for the current group PA to be released. In most scenarios, the PA discard time can be reduced. However, in the case of smaller free space, if only a few groups have space, then due to multiple traversals of the group, it may increase CPU overhead. But in contrast, I feel that the overall benefit is better than the cost. Signed-off-by: Chunguang Xu Reported-by: kernel test robot Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/1637630277-23496-1-git-send-email-brookxu.c= n@gmail.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/mballoc.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4814,7 +4814,7 @@ ext4_mb_release_group_pa(struct ext4_bud */ static noinline_for_stack int ext4_mb_discard_group_preallocations(struct super_block *sb, - ext4_group_t group, int needed) + ext4_group_t group, int *busy) { struct ext4_group_info *grp =3D ext4_get_group_info(sb, group); struct buffer_head *bitmap_bh =3D NULL; @@ -4822,8 +4822,7 @@ ext4_mb_discard_group_preallocations(str struct list_head list; struct ext4_buddy e4b; int err; - int busy =3D 0; - int free, free_total =3D 0; + int free =3D 0; =20 mb_debug(sb, "discard preallocation for group %u\n", group); if (list_empty(&grp->bb_prealloc_list)) @@ -4846,19 +4845,14 @@ ext4_mb_discard_group_preallocations(str goto out_dbg; } =20 - if (needed =3D=3D 0) - needed =3D EXT4_CLUSTERS_PER_GROUP(sb) + 1; - INIT_LIST_HEAD(&list); -repeat: - free =3D 0; ext4_lock_group(sb, group); list_for_each_entry_safe(pa, tmp, &grp->bb_prealloc_list, pa_group_list) { spin_lock(&pa->pa_lock); if (atomic_read(&pa->pa_count)) { spin_unlock(&pa->pa_lock); - busy =3D 1; + *busy =3D 1; continue; } if (pa->pa_deleted) { @@ -4898,22 +4892,13 @@ repeat: call_rcu(&(pa)->u.pa_rcu, ext4_mb_pa_callback); } =20 - free_total +=3D free; - - /* if we still need more blocks and some PAs were used, try again */ - if (free_total < needed && busy) { - ext4_unlock_group(sb, group); - cond_resched(); - busy =3D 0; - goto repeat; - } ext4_unlock_group(sb, group); ext4_mb_unload_buddy(&e4b); put_bh(bitmap_bh); out_dbg: mb_debug(sb, "discarded (%d) blocks preallocated for group %u bb_free (%d= )\n", - free_total, group, grp->bb_free); - return free_total; + free, group, grp->bb_free); + return free; } =20 /* @@ -5455,13 +5440,24 @@ static int ext4_mb_discard_preallocation { ext4_group_t i, ngroups =3D ext4_get_groups_count(sb); int ret; - int freed =3D 0; + int freed =3D 0, busy =3D 0; + int retry =3D 0; =20 trace_ext4_mb_discard_preallocations(sb, needed); + + if (needed =3D=3D 0) + needed =3D EXT4_CLUSTERS_PER_GROUP(sb) + 1; + repeat: for (i =3D 0; i < ngroups && needed > 0; i++) { - ret =3D ext4_mb_discard_group_preallocations(sb, i, needed); + ret =3D ext4_mb_discard_group_preallocations(sb, i, &busy); freed +=3D ret; needed -=3D ret; + cond_resched(); + } + + if (needed > 0 && busy && ++retry < 3) { + busy =3D 0; + goto repeat; } =20 return freed; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A1BBC433F5 for ; Mon, 24 Jan 2022 22:47:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1837837AbiAXWpZ (ORCPT ); Mon, 24 Jan 2022 17:45:25 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54650 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456098AbiAXVht (ORCPT ); Mon, 24 Jan 2022 16:37:49 -0500 Received: from smtp.kernel.org (relay.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 8872861510; Mon, 24 Jan 2022 21:37:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BFCEC340E4; Mon, 24 Jan 2022 21:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060265; bh=OLpI67k/l5+6Nfl6y5XUeykp7wBmqWj5duco+nik+zA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=doSjkcahvqQOPe8RDHA0Mb7Is1CQ49RP5R16Ywj+ATl9MECvluCiQxxH4M8rplJIy vf72SBpkrw4zPA7+Oy/V1c3WhQqqRdSI22oBBVKK+pVVw1VfcCDRDBp1fE0TO5PsNF cpQHucQhKNeiDzDXAh9ccBBa/0dIMUC8IekdC/yg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Harshad Shirwadkar , Theodore Tso , stable@kernel.org Subject: [PATCH 5.16 0892/1039] ext4: initialize err_blk before calling __ext4_get_inode_loc Date: Mon, 24 Jan 2022 19:44:41 +0100 Message-Id: <20220124184155.269572866@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Harshad Shirwadkar commit c27c29c6af4f3f4ce925a2111c256733c5a5b430 upstream. It is not guaranteed that __ext4_get_inode_loc will definitely set err_blk pointer when it returns EIO. To avoid using uninitialized variables, let's first set err_blk to 0. Reported-by: Dan Carpenter Signed-off-by: Harshad Shirwadkar Link: https://lore.kernel.org/r/20211201163421.2631661-1-harshads@google.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4523,7 +4523,7 @@ has_buffer: static int __ext4_get_inode_loc_noinmem(struct inode *inode, struct ext4_iloc *iloc) { - ext4_fsblk_t err_blk; + ext4_fsblk_t err_blk =3D 0; int ret; =20 ret =3D __ext4_get_inode_loc(inode->i_sb, inode->i_ino, NULL, iloc, @@ -4538,7 +4538,7 @@ static int __ext4_get_inode_loc_noinmem( =20 int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc) { - ext4_fsblk_t err_blk; + ext4_fsblk_t err_blk =3D 0; int ret; =20 ret =3D __ext4_get_inode_loc(inode->i_sb, inode->i_ino, inode, iloc, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36033C4321E for ; Tue, 25 Jan 2022 00:23:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3408152AbiAYAVt (ORCPT ); Mon, 24 Jan 2022 19:21:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360414AbiAXXgn (ORCPT ); Mon, 24 Jan 2022 18:36:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38358C0ADFDF; Mon, 24 Jan 2022 13:37:49 -0800 (PST) Received: from smtp.kernel.org (relay.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 CAD726151E; Mon, 24 Jan 2022 21:37:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EFB3C340E5; Mon, 24 Jan 2022 21:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060268; bh=aUqMRbesUG+fUwoezkLtVOmqh/MbsZg6evIG255zsv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P6g/cuid4NTAAyWiC2zQiPHPsuX4fWZ/kCzzgTxHKLrtMmphglcq50vkm9kYzJh/8 U7XZf4zYjE+zh/Ogze4UrX9yQlP4q9lDcu3xrnzDHtDtBsEMpYfOr2FZ8h8vQnRgtF ZVR6u1rKT9zJ9HCvLpmmFlAM5l+2pW0lAT/3gs1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Yin , Harshad Shirwadkar , Theodore Tso , stable@kernel.org Subject: [PATCH 5.16 0893/1039] ext4: fix fast commit may miss tracking range for FALLOC_FL_ZERO_RANGE Date: Mon, 24 Jan 2022 19:44:42 +0100 Message-Id: <20220124184155.301106304@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Yin commit 5e4d0eba1ccaf19f93222abdeda5a368be141785 upstream. when call falloc with FALLOC_FL_ZERO_RANGE, to set an range to unwritten, which has been already initialized. If the range is align to blocksize, fast commit will not track range for this change. Also track range for unwritten range in ext4_map_blocks(). Signed-off-by: Xin Yin Reviewed-by: Harshad Shirwadkar Link: https://lore.kernel.org/r/20211221022839.374606-1-yinxin.x@bytedance.= com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/extents.c | 2 -- fs/ext4/inode.c | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4647,8 +4647,6 @@ static long ext4_zero_range(struct file ret =3D ext4_mark_inode_dirty(handle, inode); if (unlikely(ret)) goto out_handle; - ext4_fc_track_range(handle, inode, offset >> inode->i_sb->s_blocksize_bit= s, - (offset + len - 1) >> inode->i_sb->s_blocksize_bits); /* Zero out partial block at the edges of the range */ ret =3D ext4_zero_partial_blocks(handle, inode, offset, len); if (ret >=3D 0) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -741,10 +741,11 @@ out_sem: if (ret) return ret; } - ext4_fc_track_range(handle, inode, map->m_lblk, - map->m_lblk + map->m_len - 1); } - + if (retval > 0 && (map->m_flags & EXT4_MAP_UNWRITTEN || + map->m_flags & EXT4_MAP_MAPPED)) + ext4_fc_track_range(handle, inode, map->m_lblk, + map->m_lblk + map->m_len - 1); if (retval < 0) ext_debug(inode, "failed with err %d\n", retval); return retval; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 730C1C433F5 for ; Mon, 24 Jan 2022 22:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835225AbiAXWfu (ORCPT ); Mon, 24 Jan 2022 17:35:50 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47836 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456141AbiAXVhy (ORCPT ); Mon, 24 Jan 2022 16:37:54 -0500 Received: from smtp.kernel.org (relay.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 6F1F6B81057; Mon, 24 Jan 2022 21:37:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D14AC340E4; Mon, 24 Jan 2022 21:37:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060271; bh=PBfU0sjDKHjPEXXIWzNxqIfWzz3fkDv5Yi5PMouzK2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oIjF/J5mId3BnWPHmy6wSoJ8S7tr0LInJNen2iOvYe8bSEEGm8nVOXPMZiWort9wQ HzxK+ekBFsAHxT7MBkN4v3Mcv6dQoHMWyJqiqKcF9Vipt/uz0dyoJ9UJJmafKf+Z1F LeztVQFN+HNH5l8ZQ0eewuYa9XMb9BmsIPeRQa4g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeroen van Wolffelaar , =?UTF-8?q?Lu=C3=ADs=20Henriques?= , Theodore Tso , stable@kernel.org Subject: [PATCH 5.16 0894/1039] ext4: set csum seed in tmp inode while migrating to extents Date: Mon, 24 Jan 2022 19:44:43 +0100 Message-Id: <20220124184155.332890868@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 e81c9302a6c3c008f5c30beb73b38adb0170ff2d upstream. When migrating to extents, the temporary inode will have it's own checksum seed. This means that, when swapping the inodes data, the inode checksums will be incorrect. This can be fixed by recalculating the extents checksums again. Or simply by copying the seed into the temporary inode. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D213357 Reported-by: Jeroen van Wolffelaar Signed-off-by: Lu=C3=ADs Henriques Link: https://lore.kernel.org/r/20211214175058.19511-1-lhenriques@suse.de Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/migrate.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c @@ -459,6 +459,17 @@ int ext4_ext_migrate(struct inode *inode ext4_journal_stop(handle); goto out_unlock; } + /* + * Use the correct seed for checksum (i.e. the seed from 'inode'). This + * is so that the metadata blocks will have the correct checksum after + * the migration. + * + * Note however that, if a crash occurs during the migration process, + * the recovery process is broken because the tmp_inode checksums will + * be wrong and the orphans cleanup will fail. + */ + ei =3D EXT4_I(inode); + EXT4_I(tmp_inode)->i_csum_seed =3D ei->i_csum_seed; i_size_write(tmp_inode, i_size_read(inode)); /* * Set the i_nlink to zero so it will be deleted later @@ -502,7 +513,6 @@ int ext4_ext_migrate(struct inode *inode goto out_tmp_inode; } =20 - ei =3D EXT4_I(inode); i_data =3D ei->i_data; memset(&lb, 0, sizeof(lb)); =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3C52C43219 for ; Tue, 25 Jan 2022 00:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410140AbiAYA2f (ORCPT ); Mon, 24 Jan 2022 19:28:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360830AbiAXXiL (ORCPT ); Mon, 24 Jan 2022 18:38:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A41C1C05A196; Mon, 24 Jan 2022 13:37:56 -0800 (PST) Received: from smtp.kernel.org (relay.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 5FFDDB815A3; Mon, 24 Jan 2022 21:37:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D0C0C340E7; Mon, 24 Jan 2022 21:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060274; bh=qVf6X/MyLwQb6dyX8oDw0ogwiwMI+qywgDAlFOV1Q30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w8x6A7/Gg6fnArTxzCIQqOuZZ8rP4f7M9iNQBAoU5x9KmS+2oqIi2yPyRGlbvd08p 83nrI9j7h8x77NppSHYW2McsmCOLXWD5g7go/yMRHjdV0x4nUUYPeQ04M54lR5U3oA AY7vN0/EMYztQwPvyN3fSunOR+M6ow7z8N43ilP8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Bin , Jan Kara , Theodore Tso , stable@kernel.org Subject: [PATCH 5.16 0895/1039] ext4: Fix BUG_ON in ext4_bread when write quota data Date: Mon, 24 Jan 2022 19:44:44 +0100 Message-Id: <20220124184155.370097086@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 380a0091cab482489e9b19e07f2a166ad2b76d5c upstream. We got issue as follows when run syzkaller: [ 167.936972] EXT4-fs error (device loop0): __ext4_remount:6314: comm rep:= Abort forced by user [ 167.938306] EXT4-fs (loop0): Remounting filesystem read-only [ 167.981637] Assertion failure in ext4_getblk() at fs/ext4/inode.c:847: '= (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY) || handle !=3D NULL = || create =3D=3D 0' [ 167.983601] ------------[ cut here ]------------ [ 167.984245] kernel BUG at fs/ext4/inode.c:847! [ 167.984882] invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI [ 167.985624] CPU: 7 PID: 2290 Comm: rep Tainted: G B 5.16.= 0-rc5-next-20211217+ #123 [ 167.986823] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS = ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.fc31 04/01/2014 [ 167.988590] RIP: 0010:ext4_getblk+0x17e/0x504 [ 167.989189] Code: c6 01 74 28 49 c7 c0 a0 a3 5c 9b b9 4f 03 00 00 48 c7 = c2 80 9c 5c 9b 48 c7 c6 40 b6 5c 9b 48 c7 c7 20 a4 5c 9b e8 77 e3 fd ff <0f= > 0b 8b 04 244 [ 167.991679] RSP: 0018:ffff8881736f7398 EFLAGS: 00010282 [ 167.992385] RAX: 0000000000000094 RBX: 1ffff1102e6dee75 RCX: 00000000000= 00000 [ 167.993337] RDX: 0000000000000001 RSI: ffffffff9b6e29e0 RDI: ffffed102e6= dee66 [ 167.994292] RBP: ffff88816a076210 R08: 0000000000000094 R09: ffffed10736= 3fa09 [ 167.995252] R10: ffff88839b1fd047 R11: ffffed107363fa08 R12: ffff88816a0= 761e8 [ 167.996205] R13: 0000000000000000 R14: 0000000000000021 R15: 00000000000= 00001 [ 167.997158] FS: 00007f6a1428c740(0000) GS:ffff88839b000000(0000) knlGS:= 0000000000000000 [ 167.998238] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 167.999025] CR2: 00007f6a140716c8 CR3: 0000000133216000 CR4: 00000000000= 006e0 [ 167.999987] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 00000000000= 00000 [ 168.000944] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 00000000000= 00400 [ 168.001899] Call Trace: [ 168.002235] [ 168.007167] ext4_bread+0xd/0x53 [ 168.007612] ext4_quota_write+0x20c/0x5c0 [ 168.010457] write_blk+0x100/0x220 [ 168.010944] remove_free_dqentry+0x1c6/0x440 [ 168.011525] free_dqentry.isra.0+0x565/0x830 [ 168.012133] remove_tree+0x318/0x6d0 [ 168.014744] remove_tree+0x1eb/0x6d0 [ 168.017346] remove_tree+0x1eb/0x6d0 [ 168.019969] remove_tree+0x1eb/0x6d0 [ 168.022128] qtree_release_dquot+0x291/0x340 [ 168.023297] v2_release_dquot+0xce/0x120 [ 168.023847] dquot_release+0x197/0x3e0 [ 168.024358] ext4_release_dquot+0x22a/0x2d0 [ 168.024932] dqput.part.0+0x1c9/0x900 [ 168.025430] __dquot_drop+0x120/0x190 [ 168.025942] ext4_clear_inode+0x86/0x220 [ 168.026472] ext4_evict_inode+0x9e8/0xa22 [ 168.028200] evict+0x29e/0x4f0 [ 168.028625] dispose_list+0x102/0x1f0 [ 168.029148] evict_inodes+0x2c1/0x3e0 [ 168.030188] generic_shutdown_super+0xa4/0x3b0 [ 168.030817] kill_block_super+0x95/0xd0 [ 168.031360] deactivate_locked_super+0x85/0xd0 [ 168.031977] cleanup_mnt+0x2bc/0x480 [ 168.033062] task_work_run+0xd1/0x170 [ 168.033565] do_exit+0xa4f/0x2b50 [ 168.037155] do_group_exit+0xef/0x2d0 [ 168.037666] __x64_sys_exit_group+0x3a/0x50 [ 168.038237] do_syscall_64+0x3b/0x90 [ 168.038751] entry_SYSCALL_64_after_hwframe+0x44/0xae In order to reproduce this problem, the following conditions need to be met: 1. Ext4 filesystem with no journal; 2. Filesystem image with incorrect quota data; 3. Abort filesystem forced by user; 4. umount filesystem; As in ext4_quota_write: ... if (EXT4_SB(sb)->s_journal && !handle) { ext4_msg(sb, KERN_WARNING, "Quota write (off=3D%llu, len= =3D%llu)" " cancelled because transaction is not started", (unsigned long long)off, (unsigned long long)len); return -EIO; } ... We only check handle if NULL when filesystem has journal. There is need check handle if NULL even when filesystem has no journal. Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20211223015506.297766-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -6479,7 +6479,7 @@ static ssize_t ext4_quota_write(struct s struct buffer_head *bh; handle_t *handle =3D journal_current_handle(); =20 - if (EXT4_SB(sb)->s_journal && !handle) { + if (!handle) { ext4_msg(sb, KERN_WARNING, "Quota write (off=3D%llu, len=3D%llu)" " cancelled because transaction is not started", (unsigned long long)off, (unsigned long long)len); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 450E9C433F5 for ; Mon, 24 Jan 2022 22:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346686AbiAXWai (ORCPT ); Mon, 24 Jan 2022 17:30:38 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56218 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456183AbiAXViC (ORCPT ); Mon, 24 Jan 2022 16:38:02 -0500 Received: from smtp.kernel.org (relay.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 B5A6961516; Mon, 24 Jan 2022 21:38:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B091C36AE7; Mon, 24 Jan 2022 21:37:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060280; bh=r3t9De6Vv16FA1XPz2GR0dzvGr6aoOUnk+n2LPMHXP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Leruon5Vc1bLKi1LU0j+/xKUOp/ZML3em0KVZ6A34MRWWM9CAI1abn5qZ2eFTuaBw rG7TTer68BTKA9gVTlwFp2334SixO1rbezxQ2+J1Viihr4h7JMyyfb4VXExRwkpe2m oLV76i/Lh6YUB6c1EXWhXp1BeT/wYUNhve0EB7O4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Yin , Harshad Shirwadkar , Theodore Tso , stable@kernel.org Subject: [PATCH 5.16 0896/1039] ext4: use ext4_ext_remove_space() for fast commit replay delete range Date: Mon, 24 Jan 2022 19:44:45 +0100 Message-Id: <20220124184155.406199813@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Yin commit 0b5b5a62b945a141e64011b2f90ee7e46f14be98 upstream. For now ,we use ext4_punch_hole() during fast commit replay delete range procedure. But it will be affected by inode->i_size, which may not correct during fast commit replay procedure. The following test will failed. -create & write foo (len 1000K) -falloc FALLOC_FL_ZERO_RANGE foo (range 400K - 600K) -create & fsync bar -falloc FALLOC_FL_PUNCH_HOLE foo (range 300K-500K) -fsync foo -crash before a full commit After the fast_commit reply procedure, the range 400K-500K will not be removed. Because in this case, when calling ext4_punch_hole() the inode->i_size is 0, and it just retruns with doing nothing. Change to use ext4_ext_remove_space() instead of ext4_punch_hole() to remove blocks of inode directly. Signed-off-by: Xin Yin Reviewed-by: Harshad Shirwadkar Link: https://lore.kernel.org/r/20211223032337.5198-2-yinxin.x@bytedance.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/fast_commit.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -1812,11 +1812,14 @@ ext4_fc_replay_del_range(struct super_bl } } =20 - ret =3D ext4_punch_hole(inode, - le32_to_cpu(lrange.fc_lblk) << sb->s_blocksize_bits, - le32_to_cpu(lrange.fc_len) << sb->s_blocksize_bits); - if (ret) - jbd_debug(1, "ext4_punch_hole returned %d", ret); + down_write(&EXT4_I(inode)->i_data_sem); + ret =3D ext4_ext_remove_space(inode, lrange.fc_lblk, + lrange.fc_lblk + lrange.fc_len - 1); + up_write(&EXT4_I(inode)->i_data_sem); + if (ret) { + iput(inode); + return 0; + } ext4_ext_replay_shrink_inode(inode, i_size_read(inode) >> sb->s_blocksize_bits); ext4_mark_inode_dirty(NULL, inode); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E131C4332F for ; Mon, 24 Jan 2022 22:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587932AbiAXWaL (ORCPT ); Mon, 24 Jan 2022 17:30:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49570 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456203AbiAXViF (ORCPT ); Mon, 24 Jan 2022 16:38:05 -0500 Received: from smtp.kernel.org (relay.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 3AB51B811FC; Mon, 24 Jan 2022 21:38:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91F62C340E4; Mon, 24 Jan 2022 21:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060282; bh=bl+wpAOxajNfbCxXMpblGOpg6qSCBaOLrG8Yk4M8wXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JY+v3yxPnR2AmIXHIpuxiGvdG6BcQ21bxBVir9ry/KSWdGiYdaKn+/E5OxeEHYU5j iZuh3Ccmyba6mgbAHzDLNMFzDoZQtXk3PDjmUem6PggMfy8E8gYBp9bzDs8xWb1IJx TP3WiflPrpDuVsVnm47trNPVc+bPZB1VQeVgeptg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Yin , Harshad Shirwadkar , Theodore Tso , stable@kernel.org Subject: [PATCH 5.16 0897/1039] ext4: fast commit may miss tracking unwritten range during ftruncate Date: Mon, 24 Jan 2022 19:44:46 +0100 Message-Id: <20220124184155.437667012@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Yin commit 9725958bb75cdfa10f2ec11526fdb23e7485e8e4 upstream. If use FALLOC_FL_KEEP_SIZE to alloc unwritten range at bottom, the inode->i_size will not include the unwritten range. When call ftruncate with fast commit enabled, it will miss to track the unwritten range. Change to trace the full range during ftruncate. Signed-off-by: Xin Yin Reviewed-by: Harshad Shirwadkar Link: https://lore.kernel.org/r/20211223032337.5198-3-yinxin.x@bytedance.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5428,8 +5428,7 @@ int ext4_setattr(struct user_namespace * ext4_fc_track_range(handle, inode, (attr->ia_size > 0 ? attr->ia_size - 1 : 0) >> inode->i_sb->s_blocksize_bits, - (oldsize > 0 ? oldsize - 1 : 0) >> - inode->i_sb->s_blocksize_bits); + EXT_MAX_BLOCKS - 1); else ext4_fc_track_range( handle, inode, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 630CFC43219 for ; Mon, 24 Jan 2022 22:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587945AbiAXWaO (ORCPT ); Mon, 24 Jan 2022 17:30:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49640 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377691AbiAXViK (ORCPT ); Mon, 24 Jan 2022 16:38:10 -0500 Received: from smtp.kernel.org (relay.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 29ACDB80CCF; Mon, 24 Jan 2022 21:38:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CFD6C340E7; Mon, 24 Jan 2022 21:38:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060285; bh=+vPETRdXCgc7mpp6NeH8A14wVlEizUIjhmcEMYurTaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YsQoo/gYBzJkODjyWXGh8Y4ifil88YoBA1dBUXvrS3UEAUsviC8/g04y8kRZBlAqH 8R1dwDAkd1/1yLbidbDRx9ReapfoEKQBJdVwTOuX9Kj20SRL4zGCMf+4NMJXYe7ACO M/05/qE0bglG21+k9oH6Gnz/XReRmJ0wT29lx8v8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Andrzej Siewior , Lukas Czerner , Harshad Shirwadkar , Theodore Tso , stable@kernel.org Subject: [PATCH 5.16 0898/1039] ext4: destroy ext4_fc_dentry_cachep kmemcache on module removal Date: Mon, 24 Jan 2022 19:44:47 +0100 Message-Id: <20220124184155.468603303@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sebastian Andrzej Siewior commit ab047d516dea72f011c15c04a929851e4d053109 upstream. The kmemcache for ext4_fc_dentry_cachep remains registered after module removal. Destroy ext4_fc_dentry_cachep kmemcache on module removal. Fixes: aa75f4d3daaeb ("ext4: main fast-commit commit path") Signed-off-by: Sebastian Andrzej Siewior Reviewed-by: Lukas Czerner Reviewed-by: Harshad Shirwadkar Link: https://lore.kernel.org/r/20211110134640.lyku5vklvdndw6uk@linutronix.= de Link: https://lore.kernel.org/r/YbiK3JetFFl08bd7@linutronix.de Link: https://lore.kernel.org/r/20211223164436.2628390-1-bigeasy@linutronix= .de Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/ext4.h | 1 + fs/ext4/fast_commit.c | 5 +++++ fs/ext4/super.c | 2 ++ 3 files changed, 8 insertions(+) --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2935,6 +2935,7 @@ bool ext4_fc_replay_check_excluded(struc void ext4_fc_replay_cleanup(struct super_block *sb); int ext4_fc_commit(journal_t *journal, tid_t commit_tid); int __init ext4_fc_init_dentry_cache(void); +void ext4_fc_destroy_dentry_cache(void); =20 /* mballoc.c */ extern const struct seq_operations ext4_mb_seq_groups_ops; --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -2195,3 +2195,8 @@ int __init ext4_fc_init_dentry_cache(voi =20 return 0; } + +void ext4_fc_destroy_dentry_cache(void) +{ + kmem_cache_destroy(ext4_fc_dentry_cachep); +} --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -6662,6 +6662,7 @@ static int __init ext4_init_fs(void) out: unregister_as_ext2(); unregister_as_ext3(); + ext4_fc_destroy_dentry_cache(); out05: destroy_inodecache(); out1: @@ -6688,6 +6689,7 @@ static void __exit ext4_exit_fs(void) unregister_as_ext2(); unregister_as_ext3(); unregister_filesystem(&ext4_fs_type); + ext4_fc_destroy_dentry_cache(); destroy_inodecache(); ext4_exit_mballoc(); ext4_exit_sysfs(); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DABDC433EF for ; Tue, 25 Jan 2022 00:23:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3408129AbiAYAVm (ORCPT ); Mon, 24 Jan 2022 19:21:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360934AbiAXXin (ORCPT ); Mon, 24 Jan 2022 18:38:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2389C014B57; Mon, 24 Jan 2022 13:38:09 -0800 (PST) Received: from smtp.kernel.org (relay.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 63D5761502; Mon, 24 Jan 2022 21:38:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45B61C340E7; Mon, 24 Jan 2022 21:38:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060288; bh=hXcoNs0eV+dMtxkq6Dw8eNgx0kpJ36Vku3/tBigUjX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SgCttLkVY7hEZOtnLbBNwlxjOKniPVcoJVK/h6HsvCIprjzuYiCiv3O7RmF1ahbHD fbBipsveLscdBTneYUxiMP/TI7svlfJfCzBZZ0Q1J4FcOL8uiSIlMvA1DnHDqF0DqT Q3CnIoQWBdquKmAHVk233MO8ru//zIvtt0nT7l6Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Theodore Tso Subject: [PATCH 5.16 0899/1039] ext4: fix null-ptr-deref in __ext4_journal_ensure_credits Date: Mon, 24 Jan 2022 19:44:48 +0100 Message-Id: <20220124184155.508817756@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 298b5c521746d69c07beb2757292fb5ccc1b0f85 upstream. We got issue as follows when run syzkaller test: [ 1901.130043] EXT4-fs error (device vda): ext4_remount:5624: comm syz-exec= utor.5: Abort forced by user [ 1901.130901] Aborting journal on device vda-8. [ 1901.131437] EXT4-fs error (device vda): ext4_journal_check_start:61: com= m syz-executor.16: Detected aborted journal [ 1901.131566] EXT4-fs error (device vda): ext4_journal_check_start:61: com= m syz-executor.11: Detected aborted journal [ 1901.132586] EXT4-fs error (device vda): ext4_journal_check_start:61: com= m syz-executor.18: Detected aborted journal [ 1901.132751] EXT4-fs error (device vda): ext4_journal_check_start:61: com= m syz-executor.9: Detected aborted journal [ 1901.136149] EXT4-fs error (device vda) in ext4_reserve_inode_write:6035:= Journal has aborted [ 1901.136837] EXT4-fs error (device vda): ext4_journal_check_start:61: com= m syz-fuzzer: Detected aborted journal [ 1901.136915] =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 [ 1901.138175] BUG: KASAN: null-ptr-deref in __ext4_journal_ensure_credits+= 0x74/0x140 [ext4] [ 1901.138343] EXT4-fs error (device vda): ext4_journal_check_start:61: com= m syz-executor.13: Detected aborted journal [ 1901.138398] EXT4-fs error (device vda): ext4_journal_check_start:61: com= m syz-executor.1: Detected aborted journal [ 1901.138808] Read of size 8 at addr 0000000000000000 by task syz-executor= .17/968 [ 1901.138817] [ 1901.138852] EXT4-fs error (device vda): ext4_journal_check_start:61: com= m syz-executor.30: Detected aborted journal [ 1901.144779] CPU: 1 PID: 968 Comm: syz-executor.17 Not tainted 4.19.90-vh= ulk2111.1.0.h893.eulerosv2r10.aarch64+ #1 [ 1901.146479] Hardware name: linux,dummy-virt (DT) [ 1901.147317] Call trace: [ 1901.147552] dump_backtrace+0x0/0x2d8 [ 1901.147898] show_stack+0x28/0x38 [ 1901.148215] dump_stack+0xec/0x15c [ 1901.148746] kasan_report+0x108/0x338 [ 1901.149207] __asan_load8+0x58/0xb0 [ 1901.149753] __ext4_journal_ensure_credits+0x74/0x140 [ext4] [ 1901.150579] ext4_xattr_delete_inode+0xe4/0x700 [ext4] [ 1901.151316] ext4_evict_inode+0x524/0xba8 [ext4] [ 1901.151985] evict+0x1a4/0x378 [ 1901.152353] iput+0x310/0x428 [ 1901.152733] do_unlinkat+0x260/0x428 [ 1901.153056] __arm64_sys_unlinkat+0x6c/0xc0 [ 1901.153455] el0_svc_common+0xc8/0x320 [ 1901.153799] el0_svc_handler+0xf8/0x160 [ 1901.154265] el0_svc+0x10/0x218 [ 1901.154682] =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 This issue may happens like this: Process1 Process2 ext4_evict_inode ext4_journal_start ext4_truncate ext4_ind_truncate ext4_free_branches ext4_ind_truncate_ensure_credits ext4_journal_ensure_credits_fn ext4_journal_restart handle->h_transaction =3D NULL; mount -o remount,abort /mnt -> trigger JBD abort start_this_handle -> will return failed ext4_xattr_delete_inode ext4_journal_ensure_credits ext4_journal_ensure_credits_fn __ext4_journal_ensure_credits jbd2_handle_buffer_credits journal =3D handle->h_transaction->t_journal; ->null-ptr-deref Now, indirect truncate process didn't handle error. To solve this issue maybe simply add check handle is abort in '__ext4_journal_ensure_credits' is enough, and i also think this is necessary. Cc: stable@kernel.org Signed-off-by: Ye Bin Link: https://lore.kernel.org/r/20211224100341.3299128-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/ext4_jbd2.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/ext4/ext4_jbd2.c +++ b/fs/ext4/ext4_jbd2.c @@ -162,6 +162,8 @@ int __ext4_journal_ensure_credits(handle { if (!ext4_handle_valid(handle)) return 0; + if (is_handle_aborted(handle)) + return -EROFS; if (jbd2_handle_buffer_credits(handle) >=3D check_cred && handle->h_revoke_credits >=3D revoke_cred) return 0; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C52CC433F5 for ; Tue, 25 Jan 2022 00:31:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410125AbiAYA2b (ORCPT ); Mon, 24 Jan 2022 19:28:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360928AbiAXXin (ORCPT ); Mon, 24 Jan 2022 18:38:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64D0CC0BD108; Mon, 24 Jan 2022 13:38:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 2D825B81243; Mon, 24 Jan 2022 21:38:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 570BBC340E5; Mon, 24 Jan 2022 21:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060291; bh=gQFqGG9/fSj/hQQshBDiTsv+zM3FhzzYSeDeoKFtb3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mu2eanA+qdyNZbso2V/188c5zwXiudQrQao3H+FYuMc2OsNwkm3S5FwV4FlM1bvJd EssmELlECClO25TH4OeH7693hNnqj0J+UNj9NwxhxSjQSxWMepyKJoYJv3HbYaLRvr 71ZoAZ5twPVGY4/WWP8Mp1SPIaWPOPXy8LB9Iur4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Yi , Theodore Tso Subject: [PATCH 5.16 0900/1039] ext4: fix an use-after-free issue about data=journal writeback mode Date: Mon, 24 Jan 2022 19:44:49 +0100 Message-Id: <20220124184155.545115512@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Yi commit 5c48a7df91499e371ef725895b2e2d21a126e227 upstream. Our syzkaller report an use-after-free issue that accessing the freed buffer_head on the writeback page in __ext4_journalled_writepage(). The problem is that if there was a truncate racing with the data=3Djournalled writeback procedure, the writeback length could become zero and bget_one() refuse to get buffer_head's refcount, then the truncate procedure release buffer once we drop page lock, finally, the last ext4_walk_page_buffers() trigger the use-after-free problem. sync truncate ext4_sync_file() file_write_and_wait_range() ext4_setattr(0) inode->i_size =3D 0 ext4_writepage() len =3D 0 __ext4_journalled_writepage() page_bufs =3D page_buffers(page) ext4_walk_page_buffers(bget_one) <- does not get refcount do_invalidatepage() free_buffer_head() ext4_walk_page_buffers(page_bufs) <- trigger use-after-free After commit bdf96838aea6 ("ext4: fix race between truncate and __ext4_journalled_writepage()"), we have already handled the racing case, so the bget_one() and bput_one() are not needed. So this patch simply remove these hunk, and recheck the i_size to make it safe. Fixes: bdf96838aea6 ("ext4: fix race between truncate and __ext4_journalled= _writepage()") Signed-off-by: Zhang Yi Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20211225090937.712867-1-yi.zhang@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/inode.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1845,30 +1845,16 @@ int ext4_da_get_block_prep(struct inode return 0; } =20 -static int bget_one(handle_t *handle, struct inode *inode, - struct buffer_head *bh) -{ - get_bh(bh); - return 0; -} - -static int bput_one(handle_t *handle, struct inode *inode, - struct buffer_head *bh) -{ - put_bh(bh); - return 0; -} - static int __ext4_journalled_writepage(struct page *page, unsigned int len) { struct address_space *mapping =3D page->mapping; struct inode *inode =3D mapping->host; - struct buffer_head *page_bufs =3D NULL; handle_t *handle =3D NULL; int ret =3D 0, err =3D 0; int inline_data =3D ext4_has_inline_data(inode); struct buffer_head *inode_bh =3D NULL; + loff_t size; =20 ClearPageChecked(page); =20 @@ -1878,14 +1864,6 @@ static int __ext4_journalled_writepage(s inode_bh =3D ext4_journalled_write_inline_data(inode, len, page); if (inode_bh =3D=3D NULL) goto out; - } else { - page_bufs =3D page_buffers(page); - if (!page_bufs) { - BUG(); - goto out; - } - ext4_walk_page_buffers(handle, inode, page_bufs, 0, len, - NULL, bget_one); } /* * We need to release the page lock before we start the @@ -1906,7 +1884,8 @@ static int __ext4_journalled_writepage(s =20 lock_page(page); put_page(page); - if (page->mapping !=3D mapping) { + size =3D i_size_read(inode); + if (page->mapping !=3D mapping || page_offset(page) > size) { /* The page got truncated from under us */ ext4_journal_stop(handle); ret =3D 0; @@ -1916,6 +1895,13 @@ static int __ext4_journalled_writepage(s if (inline_data) { ret =3D ext4_mark_inode_dirty(handle, inode); } else { + struct buffer_head *page_bufs =3D page_buffers(page); + + if (page->index =3D=3D size >> PAGE_SHIFT) + len =3D size & ~PAGE_MASK; + else + len =3D PAGE_SIZE; + ret =3D ext4_walk_page_buffers(handle, inode, page_bufs, 0, len, NULL, do_journal_get_write_access); =20 @@ -1936,9 +1922,6 @@ static int __ext4_journalled_writepage(s out: unlock_page(page); out_no_pagelock: - if (!inline_data && page_bufs) - ext4_walk_page_buffers(NULL, inode, page_bufs, 0, len, - NULL, bput_one); brelse(inode_bh); return ret; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDA19C4332F for ; Tue, 25 Jan 2022 00:23:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3408033AbiAYAVY (ORCPT ); Mon, 24 Jan 2022 19:21:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360899AbiAXXil (ORCPT ); Mon, 24 Jan 2022 18:38:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDC3FC078504; Mon, 24 Jan 2022 13:38:20 -0800 (PST) Received: from smtp.kernel.org (relay.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 8A86A61469; Mon, 24 Jan 2022 21:38:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F3A0C340E4; Mon, 24 Jan 2022 21:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060300; bh=TZn8Yh7VlVGc1UIog89OIJSotNjIoF9dA/3e+R3TaEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g7XFjzdeodfBfDCPBeehV2i5uVzjJps4FhKIYGroC6SAcFwmbxuqV6tAwSZ7dFXit tO64Vg2+2lK8WYg64a92zAvuMh9336HtH+q8omYDYFPIYCf4+tZ9JRnhjwYC2xog6b 9V93tx/HutOQplJ92hWb6uFUIqgDfFPTNNcgC5RI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , Lukas Czerner , stable@kernel.org Subject: [PATCH 5.16 0901/1039] ext4: dont use the orphan list when migrating an inode Date: Mon, 24 Jan 2022 19:44:50 +0100 Message-Id: <20220124184155.577831829@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Theodore Ts'o commit 6eeaf88fd586f05aaf1d48cb3a139d2a5c6eb055 upstream. We probably want to remove the indirect block to extents migration feature after a deprecation window, but until then, let's fix a potential data loss problem caused by the fact that we put the tmp_inode on the orphan list. In the unlikely case where we crash and do a journal recovery, the data blocks belonging to the inode being migrated are also represented in the tmp_inode on the orphan list --- and so its data blocks will get marked unallocated, and available for reuse. Instead, stop putting the tmp_inode on the oprhan list. So in the case where we crash while migrating the inode, we'll leak an inode, which is not a disaster. It will be easily fixed the next time we run fsck, and it's better than potentially having blocks getting claimed by two different files, and losing data as a result. Signed-off-by: Theodore Ts'o Reviewed-by: Lukas Czerner Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ext4/migrate.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c @@ -437,12 +437,12 @@ int ext4_ext_migrate(struct inode *inode percpu_down_write(&sbi->s_writepages_rwsem); =20 /* - * Worst case we can touch the allocation bitmaps, a bgd - * block, and a block to link in the orphan list. We do need - * need to worry about credits for modifying the quota inode. + * Worst case we can touch the allocation bitmaps and a block + * group descriptor block. We do need need to worry about + * credits for modifying the quota inode. */ handle =3D ext4_journal_start(inode, EXT4_HT_MIGRATE, - 4 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); + 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); =20 if (IS_ERR(handle)) { retval =3D PTR_ERR(handle); @@ -463,10 +463,6 @@ int ext4_ext_migrate(struct inode *inode * Use the correct seed for checksum (i.e. the seed from 'inode'). This * is so that the metadata blocks will have the correct checksum after * the migration. - * - * Note however that, if a crash occurs during the migration process, - * the recovery process is broken because the tmp_inode checksums will - * be wrong and the orphans cleanup will fail. */ ei =3D EXT4_I(inode); EXT4_I(tmp_inode)->i_csum_seed =3D ei->i_csum_seed; @@ -478,7 +474,6 @@ int ext4_ext_migrate(struct inode *inode clear_nlink(tmp_inode); =20 ext4_ext_tree_init(handle, tmp_inode); - ext4_orphan_add(handle, tmp_inode); ext4_journal_stop(handle); =20 /* @@ -503,12 +498,6 @@ int ext4_ext_migrate(struct inode *inode =20 handle =3D ext4_journal_start(inode, EXT4_HT_MIGRATE, 1); if (IS_ERR(handle)) { - /* - * It is impossible to update on-disk structures without - * a handle, so just rollback in-core changes and live other - * work to orphan_list_cleanup() - */ - ext4_orphan_del(NULL, tmp_inode); retval =3D PTR_ERR(handle); goto out_tmp_inode; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C727C433FE for ; Mon, 24 Jan 2022 22:47:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1837872AbiAXWp2 (ORCPT ); Mon, 24 Jan 2022 17:45:28 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56880 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456943AbiAXVkc (ORCPT ); Mon, 24 Jan 2022 16:40:32 -0500 Received: from smtp.kernel.org (relay.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 6D79B61469; Mon, 24 Jan 2022 21:40:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A861C340E4; Mon, 24 Jan 2022 21:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060430; bh=MpuM4LnY9B+O0T3OuYSyok+AoWxmtiacIkWoare4NoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0u8Uw0WM+bjxIerS49FlRfsRVS0GAzrZpHoz3rCtHPvw7emkxFHo1nppH3xUjpTJ+ 2cyuDV5aTddYM8Jnd7YPuMPlJaYW5fCTJfF64ukpTNPkQnk93vYgT1cciklRKrQrcz fu1vHYo664Bj3G/mEvpzzAEn5bzf7rE0ilPJJjJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Kuehling , Rajneesh Bhardwaj , Alex Deucher Subject: [PATCH 5.16 0902/1039] Revert "drm/amdgpu: Dont inherit GEM object VMAs in child process" Date: Mon, 24 Jan 2022 19:44:51 +0100 Message-Id: <20220124184155.609507835@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rajneesh Bhardwaj commit 8b5da5a458c95ad49571a6a6285800bf13409616 upstream. This reverts commit fbcdbfde87509d523132b59f661a355c731139d0. Reviewed-by: Felix Kuehling Signed-off-by: Rajneesh Bhardwaj Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 --- 1 file changed, 3 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -264,9 +264,6 @@ static int amdgpu_gem_object_mmap(struct !(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))) vma->vm_flags &=3D ~VM_MAYWRITE; =20 - if (bo->kfd_bo) - vma->vm_flags |=3D VM_DONTCOPY; - return drm_gem_ttm_mmap(obj, vma); } =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23414C43217 for ; Tue, 25 Jan 2022 00:23:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3408078AbiAYAVd (ORCPT ); Mon, 24 Jan 2022 19:21:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2361672AbiAXXko (ORCPT ); Mon, 24 Jan 2022 18:40:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14F10C0BD489; Mon, 24 Jan 2022 13:38:47 -0800 (PST) Received: from smtp.kernel.org (relay.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 C77D9B811FB; Mon, 24 Jan 2022 21:38:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F286BC36AE9; Mon, 24 Jan 2022 21:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060324; bh=ongecXjzHtP37xKEtMPAuQCBn6ybQCZN/W1veZ+7+ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kGPM/TQHUsdCQEbrx8xzQ3lfp87V/+QiTGk6yJvUQULDi+6+8knlVkAPyDQEeWIDB dp7v4dqSdVafrVDzPr5sk1N8jLayYDhmoDt+LUGRk+1oN4On6PMzU+UiiwUPy1yXPh ICtE0/3kuXxqn2VhTNf1vwI6w+GCBDzxsoEj8W+Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Jan Stancek , Borislav Petkov , Alex Deucher Subject: [PATCH 5.16 0903/1039] drm/radeon: fix error handling in radeon_driver_open_kms Date: Mon, 24 Jan 2022 19:44:52 +0100 Message-Id: <20220124184155.650242882@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Christian K=C3=B6nig commit 4722f463896cc0ef1a6f1c3cb2e171e949831249 upstream. The return value was never initialized so the cleanup code executed when it isn't even necessary. Just add proper error handling. Fixes: ab50cb9df889 ("drm/radeon/radeon_kms: Fix a NULL pointer dereference= in radeon_driver_open_kms()") Signed-off-by: Christian K=C3=B6nig Tested-by: Jan Stancek Tested-by: Borislav Petkov Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/radeon/radeon_kms.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -666,18 +666,18 @@ int radeon_driver_open_kms(struct drm_de fpriv =3D kzalloc(sizeof(*fpriv), GFP_KERNEL); if (unlikely(!fpriv)) { r =3D -ENOMEM; - goto out_suspend; + goto err_suspend; } =20 if (rdev->accel_working) { vm =3D &fpriv->vm; r =3D radeon_vm_init(rdev, vm); if (r) - goto out_fpriv; + goto err_fpriv; =20 r =3D radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); if (r) - goto out_vm_fini; + goto err_vm_fini; =20 /* map the ib pool buffer read only into * virtual address space */ @@ -685,7 +685,7 @@ int radeon_driver_open_kms(struct drm_de rdev->ring_tmp_bo.bo); if (!vm->ib_bo_va) { r =3D -ENOMEM; - goto out_vm_fini; + goto err_vm_fini; } =20 r =3D radeon_vm_bo_set_addr(rdev, vm->ib_bo_va, @@ -693,19 +693,21 @@ int radeon_driver_open_kms(struct drm_de RADEON_VM_PAGE_READABLE | RADEON_VM_PAGE_SNOOPED); if (r) - goto out_vm_fini; + goto err_vm_fini; } file_priv->driver_priv =3D fpriv; } =20 - if (!r) - goto out_suspend; + pm_runtime_mark_last_busy(dev->dev); + pm_runtime_put_autosuspend(dev->dev); + return 0; =20 -out_vm_fini: +err_vm_fini: radeon_vm_fini(rdev, vm); -out_fpriv: +err_fpriv: kfree(fpriv); -out_suspend: + +err_suspend: pm_runtime_mark_last_busy(dev->dev); pm_runtime_put_autosuspend(dev->dev); return r; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6482DC4332F for ; Tue, 25 Jan 2022 00:31:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410683AbiAYA3p (ORCPT ); Mon, 24 Jan 2022 19:29:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363445AbiAXXoc (ORCPT ); Mon, 24 Jan 2022 18:44:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A77DC0BD117; Mon, 24 Jan 2022 13:39:19 -0800 (PST) Received: from smtp.kernel.org (relay.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 C3E73B8105C; Mon, 24 Jan 2022 21:39:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F36E4C340E4; Mon, 24 Jan 2022 21:39:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060357; bh=Tw+KMUhqIdOfNxHiKbccYBjOLfhTZO6kFMaB64mcMAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GqJIAN/6zzHF7gJSRrB67gVZimiKfE6tw6o5JChZzKH+VUDOsMKtyutwCDUOYMase /XwKmB2vX8Ld9N4xWfPMnYvBhZckjoIW9gcnxDIK/JyHHSX2TmPGftN6WK72JcPnk8 QQoWYH9BYFbqIHaZ+9CaCA28jraUkTpKj9cPfBok= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Deucher , Harry Wentland , Nicholas Kazlauskas Subject: [PATCH 5.16 0904/1039] drm/amdgpu/display: Only set vblank_disable_immediate when PSR is not enabled Date: Mon, 24 Jan 2022 19:44:53 +0100 Message-Id: <20220124184155.680939976@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicholas Kazlauskas commit 70897848730470cc477d5d89e6222c0f6a9ac173 upstream. [Why] PSR currently relies on the kernel's delayed vblank on/off mechanism as an implicit bufferring mechanism to prevent excessive entry/exit. Without this delay the user experience is impacted since it can take a few frames to enter/exit. [How] Only allow vblank disable immediate for DC when psr is not supported. Leave a TODO indicating that this support should be extended in the future to delay independent of the vblank interrupt. Fixes: 92020e81ddbeac ("drm/amdgpu/display: set vblank_disable_immediate fo= r DC") Acked-by: Alex Deucher Reviewed-by: Harry Wentland Signed-off-by: Nicholas Kazlauskas Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1598,9 +1598,6 @@ static int amdgpu_dm_init(struct amdgpu_ adev_to_drm(adev)->mode_config.cursor_width =3D adev->dm.dc->caps.max_cur= sor_size; adev_to_drm(adev)->mode_config.cursor_height =3D adev->dm.dc->caps.max_cu= rsor_size; =20 - /* Disable vblank IRQs aggressively for power-saving */ - adev_to_drm(adev)->vblank_disable_immediate =3D true; - if (drm_vblank_init(adev_to_drm(adev), adev->dm.display_indexes_num)) { DRM_ERROR( "amdgpu: failed to initialize sw for display support.\n"); @@ -4285,6 +4282,14 @@ static int amdgpu_dm_initialize_drm_devi =20 } =20 + /* + * Disable vblank IRQs aggressively for power-saving. + * + * TODO: Fix vblank control helpers to delay PSR entry to allow this when= PSR + * is also supported. + */ + adev_to_drm(adev)->vblank_disable_immediate =3D !psr_feature_enabled; + /* Software is initialized. Now we can register interrupt handlers. */ switch (adev->asic_type) { #if defined(CONFIG_DRM_AMD_DC_SI) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4FD2C43219 for ; Mon, 24 Jan 2022 22:40:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835434AbiAXWg2 (ORCPT ); Mon, 24 Jan 2022 17:36:28 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58300 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456705AbiAXVjx (ORCPT ); Mon, 24 Jan 2022 16:39:53 -0500 Received: from smtp.kernel.org (relay.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 51D9E61502; Mon, 24 Jan 2022 21:39:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC49CC340E4; Mon, 24 Jan 2022 21:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060391; bh=Kg6lB8gyFX7ICKo3+KWCWKtc2SOVkFcVpBWAYHfLIk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CPaQzegC4FOhIIzzXRuKp51hdxz9lWl3LPqNyMTpc0ItpPr+VNZjUB0j8nyingvAA +gpozAC5lSZZAHxqY5C0Kmhd3XXwKrnE8lKyEciUk9kq1fV5tnxnoYmG4CQC4hz0bp jzTnR8mgURNjgMd1I9bPMGrst/V9ybigymhvpw9E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julius Werner , Ben Hutchings Subject: [PATCH 5.16 0905/1039] firmware: Update Kconfig help text for Google firmware Date: Mon, 24 Jan 2022 19:44:54 +0100 Message-Id: <20220124184155.711926419@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 d185a3466f0cd5af8f1c5c782c53bc0e6f2e7136 upstream. The help text for GOOGLE_FIRMWARE states that it should only be enabled when building a kernel for Google's own servers. However, many of the drivers dependent on it are also useful on Chromebooks or on any platform using coreboot. Update the help text to reflect this double duty. Fixes: d384d6f43d1e ("firmware: google memconsole: Add coreboot support") Reviewed-by: Julius Werner Signed-off-by: Ben Hutchings Link: https://lore.kernel.org/r/20180618225540.GD14131@decadent.org.uk Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/firmware/google/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/firmware/google/Kconfig +++ b/drivers/firmware/google/Kconfig @@ -3,9 +3,9 @@ menuconfig GOOGLE_FIRMWARE bool "Google Firmware Drivers" default n help - These firmware drivers are used by Google's servers. They are - only useful if you are working directly on one of their - proprietary servers. If in doubt, say "N". + These firmware drivers are used by Google servers, + Chromebooks and other devices using coreboot firmware. + If in doubt, say "N". =20 if GOOGLE_FIRMWARE =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C532C433EF for ; Mon, 24 Jan 2022 22:41:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835536AbiAXWgs (ORCPT ); Mon, 24 Jan 2022 17:36:48 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58572 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456846AbiAXVkN (ORCPT ); Mon, 24 Jan 2022 16:40:13 -0500 Received: from smtp.kernel.org (relay.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 8BB8461489; Mon, 24 Jan 2022 21:40:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EE6BC340E5; Mon, 24 Jan 2022 21:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060413; bh=60JLLZy+JtWGkK8II3PXJSB9hxxKXb/hbCzkUXWJsIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bIdFqgPO5yYSnNWdnpictXErJlbR1X0itFvbZutptjx1TyNxL6pF6jsyVy4YaUmAL XwrEcF+5BI4EUC+tCkSavpWf8P0ShWK+j8czm80xJhJtmjDdIctS+OzhcQ6Yr0Fw3W C8YzJOtci9e+cfZN9mMvsnU9SQfYERusvzegcnyA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde Subject: [PATCH 5.16 0906/1039] can: mcp251xfd: mcp251xfd_tef_obj_read(): fix typo in error message Date: Mon, 24 Jan 2022 19:44:55 +0100 Message-Id: <20220124184155.752086501@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 99e7cc3b3f85d9a583ab83f386315c59443509ae upstream. This patch fixes a typo in the error message in mcp251xfd_tef_obj_read(), if trying to read too many objects. Link: https://lore.kernel.org/all/20220105154300.1258636-3-mkl@pengutronix.= de Fixes: 55e5b97f003e ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SP= I CAN") Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c @@ -1336,7 +1336,7 @@ mcp251xfd_tef_obj_read(const struct mcp2 len > tx_ring->obj_num || offset + len > tx_ring->obj_num)) { netdev_err(priv->ndev, - "Trying to read to many TEF objects (max=3D%d, offset=3D%d, len=3D%d= ).\n", + "Trying to read too many TEF objects (max=3D%d, offset=3D%d, len=3D%= d).\n", tx_ring->obj_num, offset, len); return -ERANGE; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EACA9C433FE for ; Mon, 24 Jan 2022 22:41:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835552AbiAXWgu (ORCPT ); Mon, 24 Jan 2022 17:36:50 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58600 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456858AbiAXVkR (ORCPT ); Mon, 24 Jan 2022 16:40:17 -0500 Received: from smtp.kernel.org (relay.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 96E346151D; Mon, 24 Jan 2022 21:40:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DD59C340E4; Mon, 24 Jan 2022 21:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060416; bh=bp019RBoTTCh7yRBmXJPnGFc3pky8+XP4OrNPBx1/AM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oIOWU7J/EPdgH3JIiAAO0hDK8h0C06VTAVvQnXw7Y5mu7g/EBBCMl+OJEIR4/w6wJ /qnkrkBjLiw6B8DI8916L+hYleQnMr+kto03++fSilQ5Q4ua4BR9Kn/w9f3EWyWVzV BEXEg9N8ImAapw4PS6xptQ7OiIXmtMbH1IYAIC04= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suresh Udipi , Michael Rodin , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0907/1039] media: rcar-csi2: Optimize the selection PHTW register Date: Mon, 24 Jan 2022 19:44:56 +0100 Message-Id: <20220124184155.785926208@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Suresh Udipi commit 549cc89cd09a85aaa16dc07ef3db811d5cf9bcb1 upstream. PHTW register is selected based on default bit rate from Table[1]. for the bit rates less than or equal to 250. Currently first value of default bit rate which is greater than or equal to the caculated mbps is selected. This selection can be further improved by selecting the default bit rate which is nearest to the calculated value. [1] specs r19uh0105ej0200-r-car-3rd-generation.pdf [Table 25.12] Fixes: 769afd212b16 ("media: rcar-csi2: add Renesas R-Car MIPI CSI-2 receiv= er driver") Signed-off-by: Suresh Udipi Signed-off-by: Michael Rodin Reviewed-by: Niklas S=C3=B6derlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/rcar-vin/rcar-csi2.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/media/platform/rcar-vin/rcar-csi2.c +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c @@ -1104,10 +1104,17 @@ static int rcsi2_phtw_write_mbps(struct const struct rcsi2_mbps_reg *values, u16 code) { const struct rcsi2_mbps_reg *value; + const struct rcsi2_mbps_reg *prev_value =3D NULL; =20 - for (value =3D values; value->mbps; value++) + for (value =3D values; value->mbps; value++) { if (value->mbps >=3D mbps) break; + prev_value =3D value; + } + + if (prev_value && + ((mbps - prev_value->mbps) <=3D (value->mbps - mbps))) + value =3D prev_value; =20 if (!value->mbps) { dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 579AEC433EF for ; Tue, 25 Jan 2022 01:59:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413556AbiAYAjS (ORCPT ); Mon, 24 Jan 2022 19:39:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363973AbiAXXq1 (ORCPT ); Mon, 24 Jan 2022 18:46:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75AEAC05A1BD; Mon, 24 Jan 2022 13:40:21 -0800 (PST) Received: from smtp.kernel.org (relay.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 341E9B811FC; Mon, 24 Jan 2022 21:40:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E84DC340E4; Mon, 24 Jan 2022 21:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060419; bh=qGKPlBKi4dvM3k6D9aqxyYUFmALZfLKHSo5w9/UB2ys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qtCtCjlcvT0yNpTx5xw06rGH3Hd4i9Uy/fxpOkf9pKM5DGz164fHf9OI+5q54Xh6y AusBuoCyrigJ2doGul4Z5DOgBh33BPB1dmsDzKLbYMhlwYokghAur4ZIlt8sO3omRQ sOITUmPxddMwiuv9ZDFAPh48CjX0rXHuwrkDl7Pg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard Subject: [PATCH 5.16 0908/1039] drm/vc4: hdmi: Make sure the device is powered with CEC Date: Mon, 24 Jan 2022 19:44:57 +0100 Message-Id: <20220124184155.818941043@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard commit 20b0dfa86bef0e80b41b0e5ac38b92f23b6f27f9 upstream. Similarly to what we encountered with the detect hook with DRM, nothing actually prevents any of the CEC callback from being run while the HDMI output is disabled. However, this is an issue since any register access to the controller when it's powered down will result in a silent hang. Let's make sure we run the runtime_pm hooks when the CEC adapter is opened and closed by the userspace to avoid that issue. Fixes: 15b4511a4af6 ("drm/vc4: add HDMI CEC support") Reviewed-by: Dave Stevenson Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-6= -maxime@cerno.tech Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_hdmi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1736,8 +1736,14 @@ static int vc4_hdmi_cec_adap_enable(stru struct vc4_hdmi *vc4_hdmi =3D cec_get_drvdata(adap); /* clock period in microseconds */ const u32 usecs =3D 1000000 / CEC_CLOCK_FREQ; - u32 val =3D HDMI_READ(HDMI_CEC_CNTRL_5); + u32 val; + int ret; =20 + ret =3D pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); + if (ret) + return ret; + + val =3D HDMI_READ(HDMI_CEC_CNTRL_5); val &=3D ~(VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET | VC4_HDMI_CEC_CNT_TO_4700_US_MASK | VC4_HDMI_CEC_CNT_TO_4500_US_MASK); @@ -1883,6 +1889,8 @@ static int vc4_hdmi_cec_init(struct vc4_ if (ret < 0) goto err_remove_handlers; =20 + pm_runtime_put(&vc4_hdmi->pdev->dev); + return 0; =20 err_remove_handlers: From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3F33C4332F for ; Mon, 24 Jan 2022 22:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835592AbiAXWg6 (ORCPT ); Mon, 24 Jan 2022 17:36:58 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58642 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456908AbiAXVkW (ORCPT ); Mon, 24 Jan 2022 16:40:22 -0500 Received: from smtp.kernel.org (relay.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 5C73460917; Mon, 24 Jan 2022 21:40:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D54DC340E4; Mon, 24 Jan 2022 21:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060421; bh=ynCVUXTQ7FnnlhknExewIhvw4SXgBbC5W0Plz7G5ZNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qi+J/KVunaGM9jIRnboI5Tc741k0Vz0/MpwyywX+IORPvx7FYp/rOE86iIJfLkh8c WS9Z0zebgmxP/l6kIjI1EZUPO+AXoz9VDTD2W2No4Vxhnx07kS7Qs/UdCnZLZUKPdf awTklIUuaWW2S6IWZuBSSUhCTMKb0LB1CUeUbSrU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.16 0909/1039] media: correct MEDIA_TEST_SUPPORT help text Date: Mon, 24 Jan 2022 19:44:58 +0100 Message-Id: <20220124184155.851593460@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 09f4d1513267d0ab712f5d29e7bd136535748709 upstream. Fix grammar/wording in the help text for MEDIA_TEST_SUPPORT. Fixes: 4b32216adb01 ("media: split test drivers from platform directory") Signed-off-by: Randy Dunlap Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/Kconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -141,10 +141,10 @@ config MEDIA_TEST_SUPPORT prompt "Test drivers" if MEDIA_SUPPORT_FILTER default y if !MEDIA_SUPPORT_FILTER help - Those drivers should not be used on production Kernels, but - can be useful on debug ones. It enables several dummy drivers - that simulate a real hardware. Very useful to test userspace - applications and to validate if the subsystem core is doesn't + These drivers should not be used on production kernels, but + can be useful on debug ones. This option enables several dummy drivers + that simulate real hardware. Very useful to test userspace + applications and to validate if the subsystem core doesn't have regressions. =20 Say Y if you want to use some virtual test driver. From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F639C41535 for ; Tue, 25 Jan 2022 01:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413017AbiAYAiK (ORCPT ); Mon, 24 Jan 2022 19:38:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363972AbiAXXq1 (ORCPT ); Mon, 24 Jan 2022 18:46:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCC54C05A1BE; Mon, 24 Jan 2022 13:40:25 -0800 (PST) Received: from smtp.kernel.org (relay.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 5A2176150C; Mon, 24 Jan 2022 21:40:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E3F7C340E4; Mon, 24 Jan 2022 21:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060424; bh=ADWlPxviep3j3KSwqXUux5ntWlp2DypFvaeUKSbxgpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eafDJ19BJH5OyAfcoh06zFZIkP2gMU7XlZRvNbfgk4JYS2PSts4JQHQJntg3/i7Aj bHQPhdmMVfoAf8t6SkAcs2zIxzWScSnTrBxlZJ3zK8CVqT/Sic5yWvaqVzdz+dpQG1 SblOEQwD4TR9gdWfrpMoQWEaZe4OAk640sDEpzus= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, German Gomex , Mike Leach , Mathieu Poirier Subject: [PATCH 5.16 0910/1039] Documentation: coresight: Fix documentation issue Date: Mon, 24 Jan 2022 19:44:59 +0100 Message-Id: <20220124184155.889896289@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Leach commit 66bd1333abd7fa191f13b929c9119d6cd3df27b0 upstream. Fix the description of the directories and attributes used in cs_etm as used by perf. Drop the references to the 'configurations' sub-directory which had been removed in an earlier version of the patchset. Fixes: f71cd93d5ea4 ("Documentation: coresight: Add documentation for CoreS= ight config") Reported-by: German Gomex Signed-off-by: Mike Leach Link: https://lore.kernel.org/r/20211117164220.14883-1-mike.leach@linaro.org Signed-off-by: Mathieu Poirier Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- Documentation/trace/coresight/coresight-config.rst | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) --- a/Documentation/trace/coresight/coresight-config.rst +++ b/Documentation/trace/coresight/coresight-config.rst @@ -211,19 +211,13 @@ also declared in the perf 'cs_etm' event be selected when running trace under perf:: =20 $ ls /sys/devices/cs_etm - configurations format perf_event_mux_interval_ms sinks type - events nr_addr_filters power + cpu0 cpu2 events nr_addr_filters power subsystem uevent + cpu1 cpu3 format perf_event_mux_interval_ms sinks type =20 -Key directories here are 'configurations' - which lists the loaded -configurations, and 'events' - a generic perf directory which allows -selection on the perf command line.:: +The key directory here is 'events' - a generic perf directory which allows +selection on the perf command line. As with the sinks entries, this provid= es +a hash of the configuration name. =20 - $ ls configurations/ - autofdo - $ cat configurations/autofdo - 0xa7c3dddd - -As with the sinks entries, this provides a hash of the configuration name. The entry in the 'events' directory uses perfs built in syntax generator to substitute the syntax for the name when evaluating the command:: =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1D85C2BA4C for ; Tue, 25 Jan 2022 01:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412995AbiAYAiI (ORCPT ); Mon, 24 Jan 2022 19:38:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363969AbiAXXq1 (ORCPT ); Mon, 24 Jan 2022 18:46:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB619C0BD12C; Mon, 24 Jan 2022 13:40:28 -0800 (PST) Received: from smtp.kernel.org (relay.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 5A6CB6150C; Mon, 24 Jan 2022 21:40:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D35CC340E4; Mon, 24 Jan 2022 21:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060427; bh=Ss9cJ1xCoPXGKemzTHnuPgLOcrn/oCFFznA4VV3+pwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=njEzyAmWujt4QL+AHE7KThXJMlQ0xCsokcX73JfYIwhcWb29zbi5kaBJEMhkuunIL LOgesxLSGiwXFH2mqvOIZIB6asJ1IeOf3ji8Ftkr+gFCJrIQCCSzx48lAgCxUdPncJ tEc1D9UYJPY9kjEK+jV8Si4lVxmnTT8ufapgGFFE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Thompson , Vinod Koul Subject: [PATCH 5.16 0911/1039] Documentation: dmaengine: Correctly describe dmatest with channel unset Date: Mon, 24 Jan 2022 19:45:00 +0100 Message-Id: <20220124184155.927905050@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Thompson commit c61d7b2ef141abf81140756b45860a2306f395a2 upstream. Currently the documentation states that channels must be configured before running the dmatest. This has not been true since commit 6b41030fdc79 ("dmaengine: dmatest: Restore default for channel"). Fix accordingly. Fixes: 6b41030fdc79 ("dmaengine: dmatest: Restore default for channel") Signed-off-by: Daniel Thompson Link: https://lore.kernel.org/r/20211118100952.27268-3-daniel.thompson@lina= ro.org Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- Documentation/driver-api/dmaengine/dmatest.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/Documentation/driver-api/dmaengine/dmatest.rst +++ b/Documentation/driver-api/dmaengine/dmatest.rst @@ -143,13 +143,14 @@ Part 5 - Handling channel allocation Allocating Channels ------------------- =20 -Channels are required to be configured prior to starting the test run. -Attempting to run the test without configuring the channels will fail. +Channels do not need to be configured prior to starting a test run. Attemp= ting +to run the test without configuring the channels will result in testing any +channels that are available. =20 Example:: =20 % echo 1 > /sys/module/dmatest/parameters/run - dmatest: Could not start test, no channels configured + dmatest: No channels configured, continue with any =20 Channels are registered using the "channel" parameter. Channels can be req= uested by their name, once requested, the channel is registered and a pending thread is ad= ded to the test list. From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18938C4167B for ; Mon, 24 Jan 2022 22:31:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1588020AbiAXWae (ORCPT ); Mon, 24 Jan 2022 17:30:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50594 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377582AbiAXViv (ORCPT ); Mon, 24 Jan 2022 16:38:51 -0500 Received: from smtp.kernel.org (relay.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 CE3E2B815AC; Mon, 24 Jan 2022 21:38:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 056B6C36AEB; Mon, 24 Jan 2022 21:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060327; bh=/CkJZbBS/noqHTVzt9gb1OaMJAK407vUfQxtvkkrFfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0o463h19Qf/HjpGwKPT8ghXEAfITqpgz57SAWuZ/ySZMZk02aFm2Mhh54VEmL9FDe ge3h+ONg1TyJgVTcDL72YOzGLSQsxCMaKP5QJfLDfi/VGlLNnvJq0RAFoaUpzpPSOj 32h09wrtzyPPGOrjZ2bB3LFPvldQCb1O8YkKQJXU= 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.16 0912/1039] Documentation: ACPI: Fix data node reference documentation Date: Mon, 24 Jan 2022 19:45:01 +0100 Message-Id: <20220124184155.959228329@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 a11174952205d082f1658fab4314f0caf706e0a8 upstream. The data node reference documentation was missing a package that must contain the property values, instead property name and multiple values being present in a single package. This is not aligned with the _DSD spec. Fix it by adding the package for the values. Also add the missing "reg" properties to two numbered nodes. Fixes: b10134a3643d ("ACPI: property: Document hierarchical data extension = references") Signed-off-by: Sakari Ailus Reviewed-by: Andy Shevchenko Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- Documentation/firmware-guide/acpi/dsd/data-node-references.rst | 10 ++++= ++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/Documentation/firmware-guide/acpi/dsd/data-node-references.rst +++ b/Documentation/firmware-guide/acpi/dsd/data-node-references.rst @@ -5,7 +5,7 @@ Referencing hierarchical data nodes =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 =20 -:Copyright: |copy| 2018 Intel Corporation +:Copyright: |copy| 2018, 2021 Intel Corporation :Author: Sakari Ailus =20 ACPI in general allows referring to device objects in the tree only. @@ -52,12 +52,14 @@ the ANOD object which is also the final Name (NOD0, Package() { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { + Package () { "reg", 0 }, Package () { "random-property", 3 }, } }) Name (NOD1, Package() { ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), Package () { + Package () { "reg", 1 }, Package () { "anothernode", "ANOD" }, } }) @@ -74,7 +76,11 @@ the ANOD object which is also the final Name (_DSD, Package () { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { - Package () { "reference", ^DEV0, "node@1", "anothernode" }, + Package () { + "reference", Package () { + ^DEV0, "node@1", "anothernode" + } + }, } }) } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F7CDC4167B for ; Tue, 25 Jan 2022 00:31:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410871AbiAYAbJ (ORCPT ); Mon, 24 Jan 2022 19:31:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2362423AbiAXXmY (ORCPT ); Mon, 24 Jan 2022 18:42:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4521FC0BD4B3; Mon, 24 Jan 2022 13:38:53 -0800 (PST) Received: from smtp.kernel.org (relay.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 F38E5B8123D; Mon, 24 Jan 2022 21:38:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 291A8C340E4; Mon, 24 Jan 2022 21:38:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060330; bh=9VXSeQPj3bW/cw0fQE/GFo4vmyWAHlsa/ig/RPb23gY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eTFFtENCnCDNwGtd9jjBHtdH2bjx9T/AYsQ6b8H54AAT3sr6fRVx6wseGFVwXvMqw eA58z3hJGXVOF+99kHHA2jjfdoxddVqCxXsAE5TBdyO/Wuc610LHyka7A0oZ0IW0Go HXYKarmwlSEw8jgxdNCnnJ4c7XAAtVsVnBqXT/sk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandre Ghiti , Arnd Bergmann Subject: [PATCH 5.16 0913/1039] Documentation, arch: Remove leftovers from raw device Date: Mon, 24 Jan 2022 19:45:02 +0100 Message-Id: <20220124184155.990498529@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexandre Ghiti commit 473dcf0ffc31ce1135cd10578e7e06698cf51f4a upstream. Raw device interface was removed so remove all references to configs related to it. Fixes: 603e4922f1c8 ("remove the raw driver") Signed-off-by: Alexandre Ghiti Acked-by: Arnd Bergmann [arch/arm/configs] Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- Documentation/admin-guide/devices.txt | 8 +------- arch/arm/configs/spear13xx_defconfig | 1 - arch/arm/configs/spear3xx_defconfig | 1 - arch/arm/configs/spear6xx_defconfig | 1 - arch/powerpc/configs/pseries_defconfig | 1 - 5 files changed, 1 insertion(+), 11 deletions(-) --- a/Documentation/admin-guide/devices.txt +++ b/Documentation/admin-guide/devices.txt @@ -2339,13 +2339,7 @@ disks (see major number 3) except that the limit on partitions is 31. =20 - 162 char Raw block device interface - 0 =3D /dev/rawctl Raw I/O control device - 1 =3D /dev/raw/raw1 First raw I/O device - 2 =3D /dev/raw/raw2 Second raw I/O device - ... - max minor number of raw device is set by kernel config - MAX_RAW_DEVS or raw module parameter 'max_raw_devs' + 162 char Used for (now removed) raw block device interface =20 163 char =20 --- a/arch/arm/configs/spear13xx_defconfig +++ b/arch/arm/configs/spear13xx_defconfig @@ -61,7 +61,6 @@ CONFIG_SERIAL_AMBA_PL011=3Dy CONFIG_SERIAL_AMBA_PL011_CONSOLE=3Dy # CONFIG_HW_RANDOM is not set CONFIG_RAW_DRIVER=3Dy -CONFIG_MAX_RAW_DEVS=3D8192 CONFIG_I2C=3Dy CONFIG_I2C_DESIGNWARE_PLATFORM=3Dy CONFIG_SPI=3Dy --- a/arch/arm/configs/spear3xx_defconfig +++ b/arch/arm/configs/spear3xx_defconfig @@ -41,7 +41,6 @@ CONFIG_SERIAL_AMBA_PL011=3Dy CONFIG_SERIAL_AMBA_PL011_CONSOLE=3Dy # CONFIG_HW_RANDOM is not set CONFIG_RAW_DRIVER=3Dy -CONFIG_MAX_RAW_DEVS=3D8192 CONFIG_I2C=3Dy CONFIG_I2C_DESIGNWARE_PLATFORM=3Dy CONFIG_SPI=3Dy --- a/arch/arm/configs/spear6xx_defconfig +++ b/arch/arm/configs/spear6xx_defconfig @@ -36,7 +36,6 @@ CONFIG_INPUT_FF_MEMLESS=3Dy CONFIG_SERIAL_AMBA_PL011=3Dy CONFIG_SERIAL_AMBA_PL011_CONSOLE=3Dy CONFIG_RAW_DRIVER=3Dy -CONFIG_MAX_RAW_DEVS=3D8192 CONFIG_I2C=3Dy CONFIG_I2C_DESIGNWARE_PLATFORM=3Dy CONFIG_SPI=3Dy --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig @@ -189,7 +189,6 @@ CONFIG_HVCS=3Dm CONFIG_VIRTIO_CONSOLE=3Dm CONFIG_IBM_BSR=3Dm CONFIG_RAW_DRIVER=3Dy -CONFIG_MAX_RAW_DEVS=3D1024 CONFIG_I2C_CHARDEV=3Dy CONFIG_FB=3Dy CONFIG_FIRMWARE_EDID=3Dy From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34BD7C433F5 for ; Mon, 24 Jan 2022 22:31:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1588046AbiAXWag (ORCPT ); Mon, 24 Jan 2022 17:30:36 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50734 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456372AbiAXVi7 (ORCPT ); Mon, 24 Jan 2022 16:38:59 -0500 Received: from smtp.kernel.org (relay.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 15E88B811FB; Mon, 24 Jan 2022 21:38:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21B00C340E4; Mon, 24 Jan 2022 21:38:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060333; bh=tpCWaT3Bd7B0AOsiFmTZT3SF5MRyfmUBt4R9vgcOsE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xDku7ZZWOsxvCBu1B9Z1LI4N6j9uv44No8FlvNlCSvgaNTe2MYgSW18VV6yrIPXWV +TASSdMWAuptafsCHhxDEJGMdlNtui+8jn6cjGj39h3kBYA4Xjm2wcfHH2j/UvnFlk pBCBMRi+c40M7EO+S58SURc4+gXepUaIdWreYHxk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandre Ghiti , Steve French , Thomas Bogendoerfer , Arnd Bergmann Subject: [PATCH 5.16 0914/1039] Documentation, arch: Remove leftovers from CIFS_WEAK_PW_HASH Date: Mon, 24 Jan 2022 19:45:03 +0100 Message-Id: <20220124184156.022751489@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexandre Ghiti commit 2ac7069ad7647cd1d9ca5b08765a1e116e13cdc4 upstream. This config was removed so remove all references to it. Fixes: 76a3c92ec9e0 ("cifs: remove support for NTLM and weaker authenticati= on algorithms") Signed-off-by: Alexandre Ghiti Reviewed-by: Steve French Acked-by: Arnd Bergmann [arch/arm/configs] Acked-by: Thomas Bogendoerfer Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- Documentation/admin-guide/cifs/usage.rst | 7 +++---- arch/arm/configs/cm_x300_defconfig | 1 - arch/arm/configs/ezx_defconfig | 1 - arch/arm/configs/imote2_defconfig | 1 - arch/arm/configs/nhk8815_defconfig | 1 - arch/arm/configs/pxa_defconfig | 1 - arch/mips/configs/fuloong2e_defconfig | 1 - arch/mips/configs/malta_qemu_32r6_defconfig | 1 - arch/mips/configs/maltaaprp_defconfig | 1 - arch/mips/configs/maltasmvp_defconfig | 1 - arch/mips/configs/maltasmvp_eva_defconfig | 1 - arch/mips/configs/maltaup_defconfig | 1 - arch/powerpc/configs/ppc6xx_defconfig | 1 - arch/sh/configs/titan_defconfig | 1 - 14 files changed, 3 insertions(+), 17 deletions(-) --- a/Documentation/admin-guide/cifs/usage.rst +++ b/Documentation/admin-guide/cifs/usage.rst @@ -734,10 +734,9 @@ SecurityFlags Flags which control secur using weaker password hashes is 0x37037 (lanman, plaintext, ntlm, ntlmv2, signing allowed). Some SecurityFlags require the corresponding menuconfig - options to be enabled (lanman and plaintext require - CONFIG_CIFS_WEAK_PW_HASH for example). Enabling - plaintext authentication currently requires also - enabling lanman authentication in the security flags + options to be enabled. Enabling plaintext + authentication currently requires also enabling + lanman authentication in the security flags because the cifs module only supports sending laintext passwords using the older lanman dialect form of the session setup SMB. (e.g. for authentication --- a/arch/arm/configs/cm_x300_defconfig +++ b/arch/arm/configs/cm_x300_defconfig @@ -146,7 +146,6 @@ CONFIG_NFS_V3_ACL=3Dy CONFIG_NFS_V4=3Dy CONFIG_ROOT_NFS=3Dy CONFIG_CIFS=3Dm -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_PARTITION_ADVANCED=3Dy CONFIG_NLS_CODEPAGE_437=3Dm CONFIG_NLS_ISO8859_1=3Dm --- a/arch/arm/configs/ezx_defconfig +++ b/arch/arm/configs/ezx_defconfig @@ -314,7 +314,6 @@ CONFIG_NFSD_V3_ACL=3Dy CONFIG_SMB_FS=3Dm CONFIG_CIFS=3Dm CONFIG_CIFS_STATS=3Dy -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_CIFS_XATTR=3Dy CONFIG_CIFS_POSIX=3Dy CONFIG_NLS_CODEPAGE_437=3Dm --- a/arch/arm/configs/imote2_defconfig +++ b/arch/arm/configs/imote2_defconfig @@ -288,7 +288,6 @@ CONFIG_NFSD_V3_ACL=3Dy CONFIG_SMB_FS=3Dm CONFIG_CIFS=3Dm CONFIG_CIFS_STATS=3Dy -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_CIFS_XATTR=3Dy CONFIG_CIFS_POSIX=3Dy CONFIG_NLS_CODEPAGE_437=3Dm --- a/arch/arm/configs/nhk8815_defconfig +++ b/arch/arm/configs/nhk8815_defconfig @@ -127,7 +127,6 @@ CONFIG_NFS_FS=3Dy CONFIG_NFS_V3_ACL=3Dy CONFIG_ROOT_NFS=3Dy CONFIG_CIFS=3Dm -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_NLS_CODEPAGE_437=3Dy CONFIG_NLS_ASCII=3Dy CONFIG_NLS_ISO8859_1=3Dy --- a/arch/arm/configs/pxa_defconfig +++ b/arch/arm/configs/pxa_defconfig @@ -699,7 +699,6 @@ CONFIG_NFSD_V3_ACL=3Dy CONFIG_NFSD_V4=3Dy CONFIG_CIFS=3Dm CONFIG_CIFS_STATS=3Dy -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_CIFS_XATTR=3Dy CONFIG_CIFS_POSIX=3Dy CONFIG_NLS_DEFAULT=3D"utf8" --- a/arch/mips/configs/fuloong2e_defconfig +++ b/arch/mips/configs/fuloong2e_defconfig @@ -206,7 +206,6 @@ CONFIG_NFSD_V3_ACL=3Dy CONFIG_NFSD_V4=3Dy CONFIG_CIFS=3Dm CONFIG_CIFS_STATS2=3Dy -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_CIFS_XATTR=3Dy CONFIG_CIFS_POSIX=3Dy CONFIG_CIFS_DEBUG2=3Dy --- a/arch/mips/configs/malta_qemu_32r6_defconfig +++ b/arch/mips/configs/malta_qemu_32r6_defconfig @@ -165,7 +165,6 @@ CONFIG_TMPFS=3Dy CONFIG_NFS_FS=3Dy CONFIG_ROOT_NFS=3Dy CONFIG_CIFS=3Dm -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_CIFS_XATTR=3Dy CONFIG_CIFS_POSIX=3Dy CONFIG_NLS_CODEPAGE_437=3Dm --- a/arch/mips/configs/maltaaprp_defconfig +++ b/arch/mips/configs/maltaaprp_defconfig @@ -166,7 +166,6 @@ CONFIG_TMPFS=3Dy CONFIG_NFS_FS=3Dy CONFIG_ROOT_NFS=3Dy CONFIG_CIFS=3Dm -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_CIFS_XATTR=3Dy CONFIG_CIFS_POSIX=3Dy CONFIG_NLS_CODEPAGE_437=3Dm --- a/arch/mips/configs/maltasmvp_defconfig +++ b/arch/mips/configs/maltasmvp_defconfig @@ -167,7 +167,6 @@ CONFIG_TMPFS=3Dy CONFIG_NFS_FS=3Dy CONFIG_ROOT_NFS=3Dy CONFIG_CIFS=3Dm -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_CIFS_XATTR=3Dy CONFIG_CIFS_POSIX=3Dy CONFIG_NLS_CODEPAGE_437=3Dm --- a/arch/mips/configs/maltasmvp_eva_defconfig +++ b/arch/mips/configs/maltasmvp_eva_defconfig @@ -169,7 +169,6 @@ CONFIG_TMPFS=3Dy CONFIG_NFS_FS=3Dy CONFIG_ROOT_NFS=3Dy CONFIG_CIFS=3Dm -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_CIFS_XATTR=3Dy CONFIG_CIFS_POSIX=3Dy CONFIG_NLS_CODEPAGE_437=3Dm --- a/arch/mips/configs/maltaup_defconfig +++ b/arch/mips/configs/maltaup_defconfig @@ -165,7 +165,6 @@ CONFIG_TMPFS=3Dy CONFIG_NFS_FS=3Dy CONFIG_ROOT_NFS=3Dy CONFIG_CIFS=3Dm -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_CIFS_XATTR=3Dy CONFIG_CIFS_POSIX=3Dy CONFIG_NLS_CODEPAGE_437=3Dm --- a/arch/powerpc/configs/ppc6xx_defconfig +++ b/arch/powerpc/configs/ppc6xx_defconfig @@ -1022,7 +1022,6 @@ CONFIG_NFSD=3Dm CONFIG_NFSD_V3_ACL=3Dy CONFIG_NFSD_V4=3Dy CONFIG_CIFS=3Dm -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_CIFS_UPCALL=3Dy CONFIG_CIFS_XATTR=3Dy CONFIG_CIFS_POSIX=3Dy --- a/arch/sh/configs/titan_defconfig +++ b/arch/sh/configs/titan_defconfig @@ -242,7 +242,6 @@ CONFIG_NFSD=3Dy CONFIG_NFSD_V3=3Dy CONFIG_SMB_FS=3Dm CONFIG_CIFS=3Dm -CONFIG_CIFS_WEAK_PW_HASH=3Dy CONFIG_PARTITION_ADVANCED=3Dy CONFIG_NLS_CODEPAGE_437=3Dm CONFIG_NLS_ASCII=3Dm From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C1F1C433EF for ; Tue, 25 Jan 2022 00:30:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3409018AbiAYAYk (ORCPT ); Mon, 24 Jan 2022 19:24:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2362629AbiAXXmn (ORCPT ); Mon, 24 Jan 2022 18:42:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35906C0FCECE; Mon, 24 Jan 2022 13:38:59 -0800 (PST) Received: from smtp.kernel.org (relay.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 E89F3B8121C; Mon, 24 Jan 2022 21:38:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BBBEC340E4; Mon, 24 Jan 2022 21:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060336; bh=vwRGDU4N4TbEApmcUFKQ4hpx5acenT08Vv9AbCWceh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kWJo4+MXs8juUGHnYUcYkMd5YtKkvijh/4bnQE9AcPQ12km19/8UtpG6LN3uhCthI DW1cylHLOxiEa2It5YAuUOL8NXAbilCv2WiiTNoxqkhIZqb/vt1l2YMg0kDZYuVxqs GU2YTioeRAobYDGEF7dQ9vdp1+sRLaWHfmFYAqw8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Bulwahn , Jonathan Corbet Subject: [PATCH 5.16 0915/1039] Documentation: refer to config RANDOMIZE_BASE for kernel address-space randomization Date: Mon, 24 Jan 2022 19:45:04 +0100 Message-Id: <20220124184156.054826542@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Bulwahn commit 82ca67321f55a8d1da6ac3ed611da3c32818bb37 upstream. The config RANDOMIZE_SLAB does not exist, the authors probably intended to refer to the config RANDOMIZE_BASE, which provides kernel address-space randomization. They probably just confused SLAB with BASE (these two four-letter words coincidentally share three common letters), as they also point out the config SLAB_FREELIST_RANDOM as further randomization within the same sentence. Fix the reference of the config for kernel address-space randomization to the config that provides that. Fixes: 6e88559470f5 ("Documentation: Add section about CPU vulnerabilities = for Spectre") Signed-off-by: Lukas Bulwahn Link: https://lore.kernel.org/r/20211230171940.27558-1-lukas.bulwahn@gmail.= com Signed-off-by: Jonathan Corbet Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- Documentation/admin-guide/hw-vuln/spectre.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/Documentation/admin-guide/hw-vuln/spectre.rst +++ b/Documentation/admin-guide/hw-vuln/spectre.rst @@ -468,7 +468,7 @@ Spectre variant 2 before invoking any firmware code to prevent Spectre variant 2 exploits using the firmware. =20 - Using kernel address space randomization (CONFIG_RANDOMIZE_SLAB=3Dy + Using kernel address space randomization (CONFIG_RANDOMIZE_BASE=3Dy and CONFIG_SLAB_FREELIST_RANDOM=3Dy in the kernel configuration) makes attacks on the kernel generally more difficult. =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7141C433FE for ; Tue, 25 Jan 2022 00:31:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410382AbiAYA3H (ORCPT ); Mon, 24 Jan 2022 19:29:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2362636AbiAXXmo (ORCPT ); Mon, 24 Jan 2022 18:42:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 347E6C0FCED3; Mon, 24 Jan 2022 13:39:01 -0800 (PST) Received: from smtp.kernel.org (relay.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 CE47FB8123A; Mon, 24 Jan 2022 21:39:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A8FAC340E4; Mon, 24 Jan 2022 21:38:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060339; bh=9wTFvCDXsLGr2ff4ZSyAlfnhmj5VqNbcLjP9DYhL73E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mBgNh3yAdHUczciJxBxhQYcUIbwFzmPfGMz+AY5TJQ/Jwv0WlFeU0Cz8bnqur0OjI ppsNvQLcva3XaKSQ2H2um6u9MXJHiZbHs6Q039DC8eFHPLbOAn6LwboB+dckzd+yVN 3OraCji/JPHeCIeXCyBoN82akUTC8Sy3/cWRBZUs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Akira Yokosawa , Jonathan Corbet Subject: [PATCH 5.16 0916/1039] Documentation: fix firewire.rst ABI file path error Date: Mon, 24 Jan 2022 19:45:05 +0100 Message-Id: <20220124184156.084771133@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 b0ac702f3329cdc8a06dcaac73183d4b5a2b942d upstream. Adjust the path of the ABI files for firewire.rst to prevent a documentation build error. Prevents this problem: Sphinx parallel build error: docutils.utils.SystemMessage: Documentation/driver-api/firewire.rst:22: (SE= VERE/4) Problems with "include" directive path: InputError: [Errno 2] No such file or directory: '../Documentation/driver-a= pi/ABI/stable/firewire-cdev'. Fixes: 2f4830ef96d2 ("FireWire: add driver-api Introduction section") Signed-off-by: Randy Dunlap Tested-by: Akira Yokosawa Link: https://lore.kernel.org/r/20220119033905.4779-1-rdunlap@infradead.org Signed-off-by: Jonathan Corbet Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- Documentation/driver-api/firewire.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/Documentation/driver-api/firewire.rst +++ b/Documentation/driver-api/firewire.rst @@ -19,7 +19,7 @@ of kernel interfaces is available via ex Firewire char device data structures =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 =20 -.. include:: /ABI/stable/firewire-cdev +.. include:: ../ABI/stable/firewire-cdev :literal: =20 .. kernel-doc:: include/uapi/linux/firewire-cdev.h @@ -28,7 +28,7 @@ Firewire char device data structures Firewire device probing and sysfs interfaces =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 =20 -.. include:: /ABI/stable/sysfs-bus-firewire +.. include:: ../ABI/stable/sysfs-bus-firewire :literal: =20 .. kernel-doc:: drivers/firewire/core-device.c From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE784C433FE for ; Tue, 25 Jan 2022 00:31:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410314AbiAYA3B (ORCPT ); Mon, 24 Jan 2022 19:29:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2362669AbiAXXmp (ORCPT ); Mon, 24 Jan 2022 18:42:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19713C0BD10F; Mon, 24 Jan 2022 13:39:05 -0800 (PST) Received: from smtp.kernel.org (relay.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 C7DFBB8123D; Mon, 24 Jan 2022 21:39:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CF09C36B02; Mon, 24 Jan 2022 21:39:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060342; bh=q6x/bI0ZH2aNMZANdaqG3USj1WkC9T8TO3G2sZLfuoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HNs78kNM1HfuAFojoJFJL4w8qJpQARaqiAF+JCOarJ7vdBZ+htgHUBBal5gSihlRO 3zwnFrCOJeir1kOdZsb1mtVRJA5M7omOlHhRB/WMOPMnPdkjgN0xpczRdgU5IfqyDh +/ibjxzj9FPK4T8YipRDK4n/PEvvSAjVgBhgbJKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , Mark Chen , Marcel Holtmann Subject: [PATCH 5.16 0917/1039] Bluetooth: btusb: Return error code when getting patch status failed Date: Mon, 24 Jan 2022 19:45:06 +0100 Message-Id: <20220124184156.119846200@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Chen commit 995d948cf2e45834275f07afc1c9881a9902e73c upstream. If there are failure cases in getting patch status, it should return the error code (-EIO). Fixes: fc342c4dc4087 ("Bluetooth: btusb: Add protocol support for MediaTek = MT7921U USB devices") Co-developed-by: Sean Wang Signed-off-by: Sean Wang Signed-off-by: Mark Chen Signed-off-by: Marcel Holtmann Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2600,6 +2600,7 @@ static int btusb_mtk_setup_firmware_79xx } else { bt_dev_err(hdev, "Failed wmt patch dwnld status (%d)", status); + err =3D -EIO; goto err_release_fw; } } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E260C433FE for ; Mon, 24 Jan 2022 22:42:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587865AbiAXWmi (ORCPT ); Mon, 24 Jan 2022 17:42:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50934 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378386AbiAXVjU (ORCPT ); Mon, 24 Jan 2022 16:39:20 -0500 Received: from smtp.kernel.org (relay.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 DC0FAB8123D; Mon, 24 Jan 2022 21:39:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F19EFC340E4; Mon, 24 Jan 2022 21:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060345; bh=bPj+/VtfiWo0N44MEdLgqfeCoWwdaSWRHiXq8k/ovb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0CZzCyw6Sj65epi5f9E3DSPO6UAJS09tvnhTJb/gJefUXmzBUS0s2N7QGfFPEZ3nw zrhe02AoKjU7IReVe8jOUbUgQUvtSloyp/hnWlGgNXir4uvbmMV07PSP2s2IG+sDkL kprulooWGCMyldK1QWZI7QEB8/VRcag4Pd5oWFfw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gabriel Hojda , Markus Reichl , Alexander Stein , "David S. Miller" Subject: [PATCH 5.16 0918/1039] net: usb: Correct reset handling of smsc95xx Date: Mon, 24 Jan 2022 19:45:07 +0100 Message-Id: <20220124184156.151964131@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Markus Reichl commit 0bf3885324a8599e3af4c7379b8d4f621c9bbffa upstream. On boards with LAN9514 and no preconfigured MAC address we don't get an ip address from DHCP after commit a049a30fc27c ("net: usb: Correct PHY hand= ling of smsc95xx") anymore. Adding an explicit reset before starting the phy fixes the issue. [1] https://lore.kernel.org/netdev/199eebbd6b97f52b9119c9fa4fd8504f8a34de18.cam= el@collabora.com/ From: Gabriel Hojda Fixes: a049a30fc27c ("net: usb: Correct PHY handling of smsc95xx") Signed-off-by: Gabriel Hojda Signed-off-by: Markus Reichl Tested-by: Alexander Stein Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/usb/smsc95xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -1962,7 +1962,8 @@ static const struct driver_info smsc95xx .bind =3D smsc95xx_bind, .unbind =3D smsc95xx_unbind, .link_reset =3D smsc95xx_link_reset, - .reset =3D smsc95xx_start_phy, + .reset =3D smsc95xx_reset, + .check_connect =3D smsc95xx_start_phy, .stop =3D smsc95xx_stop, .rx_fixup =3D smsc95xx_rx_fixup, .tx_fixup =3D smsc95xx_tx_fixup, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CE8EC4167D for ; Mon, 24 Jan 2022 22:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350213AbiAXWaq (ORCPT ); Mon, 24 Jan 2022 17:30:46 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50960 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456450AbiAXVjU (ORCPT ); Mon, 24 Jan 2022 16:39:20 -0500 Received: from smtp.kernel.org (relay.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 B1676B8123A; Mon, 24 Jan 2022 21:39:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAB36C340E4; Mon, 24 Jan 2022 21:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060348; bh=eN+mCr4skE+vq5zxPwBpW4c7azPJ/28oHfu3vTochZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LRYQvcnZc45NxvW9bQD1ZoWvYAgN9DVLIzW86aRiLjuRZC55NTzxmLpkROXHLNyVB SPevsSnXmUIVAUv1bAnPZYHfqktXrXGcR9qAFLwbUB0rC86/L4vF04aQDsnT/GJr+Q wsP2Cuk42bjgoY3UssCjoq0egu/EQe+G0vsZV55o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Marcel Holtmann Subject: [PATCH 5.16 0919/1039] Bluetooth: hci_sync: Fix not setting adv set duration Date: Mon, 24 Jan 2022 19:45:08 +0100 Message-Id: <20220124184156.191792917@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luiz Augusto von Dentz commit f16a491c65d9eb19398b25aefc10c2d3313d17b3 upstream. 10bbffa3e88e attempted to fix the use of rotation duration as advertising duration but it didn't change the if condition which still uses the duration instead of the timeout. Fixes: 10bbffa3e88e ("Bluetooth: Fix using advertising instance duration as= timeout") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/bluetooth/hci_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -1935,7 +1935,7 @@ int __hci_req_enable_ext_advertising(str /* Set duration per instance since controller is responsible for * scheduling it. */ - if (adv_instance && adv_instance->duration) { + if (adv_instance && adv_instance->timeout) { u16 duration =3D adv_instance->timeout * MSEC_PER_SEC; =20 /* Time =3D N * 10 ms */ From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C093BC43219 for ; Tue, 25 Jan 2022 01:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3411785AbiAYAes (ORCPT ); Mon, 24 Jan 2022 19:34:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363403AbiAXXo0 (ORCPT ); Mon, 24 Jan 2022 18:44:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EEFBC0FE684; Mon, 24 Jan 2022 13:39:12 -0800 (PST) Received: from smtp.kernel.org (relay.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 1789E614B4; Mon, 24 Jan 2022 21:39:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFCA1C340E7; Mon, 24 Jan 2022 21:39:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060351; bh=T4NY8zqPRR6WKhwieFaRIRF4HrYhvq77oMAZe4cIyL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TJa/P/eLeqNLh85IoqBUP58tayy1wqIySTbigFHencJffqiyJ5cnPF5rYVYfLmTft m5i2Altt85dDt+AqVNkXeYFjvGseG0cMLCLLBpchKJkWeAQxd6BgI1DtzvA15Pq3WO WuOBSKqJv/JF6BA2SoEgu1cVGFH1azSGH37VKtKw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , "Martin K. Petersen" Subject: [PATCH 5.16 0920/1039] scsi: core: Show SCMD_LAST in text form Date: Mon, 24 Jan 2022 19:45:09 +0100 Message-Id: <20220124184156.224871831@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche commit 3369046e54ca8f82e0cb17740643da2d80d3cfa8 upstream. The SCSI debugfs code supports showing information about pending commands, including translating SCSI command flags from numeric into text format. Also convert the SCMD_LAST flag from numeric into text form. Link: https://lore.kernel.org/r/20211129194609.3466071-4-bvanassche@acm.org Fixes: 8930a6c20791 ("scsi: core: add support for request batching") Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/scsi_debugfs.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/scsi/scsi_debugfs.c +++ b/drivers/scsi/scsi_debugfs.c @@ -9,6 +9,7 @@ static const char *const scsi_cmd_flags[] =3D { SCSI_CMD_FLAG_NAME(TAGGED), SCSI_CMD_FLAG_NAME(INITIALIZED), + SCSI_CMD_FLAG_NAME(LAST), }; #undef SCSI_CMD_FLAG_NAME =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D880C433FE for ; Tue, 25 Jan 2022 00:31:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410663AbiAYA3n (ORCPT ); Mon, 24 Jan 2022 19:29:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363433AbiAXXoa (ORCPT ); Mon, 24 Jan 2022 18:44:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 049B2C0BD114; Mon, 24 Jan 2022 13:39:17 -0800 (PST) Received: from smtp.kernel.org (relay.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 BCFAEB811A9; Mon, 24 Jan 2022 21:39:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3361C340E4; Mon, 24 Jan 2022 21:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060354; bh=s3xyad9RRiZmE3AKrOXRTeSue6X8CTulLNtjvuwpiS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kxzr9Pg1mbn/NOleMD80Fd2Vt6A4ym33498lPpDtuN9bG+sSI9Li+kRM1yZ/DtcsW VnUJJOtFYOKBDpGajNsCcpQ1SqLUEDsMfy8R+KFssFpptIjgwSdVIoNzwEnibai6nU eafT9VMzNahFUdhV/0ljjx/7BHju4XZ5QNuRtIAc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baruch Siach , Rob Herring Subject: [PATCH 5.16 0921/1039] of: base: Improve argument length mismatch error Date: Mon, 24 Jan 2022 19:45:10 +0100 Message-Id: <20220124184156.256518367@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baruch Siach commit 5d05b811b5acb92fc581a7b328b36646c86f5ab9 upstream. The cells_name field of of_phandle_iterator might be NULL. Use the phandle name instead. With this change instead of: OF: /soc/pinctrl@1000000: (null) =3D 3 found 2 We get: OF: /soc/pinctrl@1000000: phandle pinctrl@1000000 needs 3, found 2 Which is a more helpful messages making DT debugging easier. In this particular example the phandle name looks like duplicate of the same node name. But note that the first node is the parent node (it->parent), while the second is the phandle target (it->node). They happen to be the same in the case that triggered this improvement. See commit 72cb4c48a46a ("arm64: dts: qcom: ipq6018: Fix gpio-ranges property"). Signed-off-by: Baruch Siach Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/f6a68e0088a552ea9dfd4d8e3b5b586d92594738.16= 40881913.git.baruch@tkos.co.il Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/of/base.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1349,9 +1349,14 @@ int of_phandle_iterator_next(struct of_p * property data length */ if (it->cur + count > it->list_end) { - pr_err("%pOF: %s =3D %d found %td\n", - it->parent, it->cells_name, - count, it->list_end - it->cur); + if (it->cells_name) + pr_err("%pOF: %s =3D %d found %td\n", + it->parent, it->cells_name, + count, it->list_end - it->cur); + else + pr_err("%pOF: phandle %s needs %d, found %td\n", + it->parent, of_node_full_name(it->node), + count, it->list_end - it->cur); goto err; } } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C83FC4167D for ; Tue, 25 Jan 2022 00:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410701AbiAYA3s (ORCPT ); Mon, 24 Jan 2022 19:29:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363495AbiAXXoo (ORCPT ); Mon, 24 Jan 2022 18:44:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17864C0FE687; Mon, 24 Jan 2022 13:39:23 -0800 (PST) Received: from smtp.kernel.org (relay.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 D41FBB8121C; Mon, 24 Jan 2022 21:39:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3EBAC340E4; Mon, 24 Jan 2022 21:39:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060360; bh=cg2dTilaFyJIJO06u5dnZECifYEUV5gg6BwU7cPzgHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zg7GN0UHCrQlsEqRSOHlv4qjZHLxyi2ec757OTfymuRcm30t4efvYEkaFVfCVLJ36 LGAsjQU2NHvStXwQCUG8s+M41ptqtuiO6+PtQL1zT3zkduUhNDKzWDjpR8BEC4elwc c7MuUIHwPQdCioQZsy7eXcBzTwXaWk7ckuL/MSzg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , "Martin K. Petersen" Subject: [PATCH 5.16 0922/1039] scsi: ufs: ufs-mediatek: Fix error checking in ufs_mtk_init_va09_pwr_ctrl() Date: Mon, 24 Jan 2022 19:45:11 +0100 Message-Id: <20220124184156.293502487@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 3ba880a12df5aa4488c18281701b5b1bc3d4531a upstream. The function regulator_get() returns an error pointer. Use IS_ERR() to validate the return value. Link: https://lore.kernel.org/r/20211222070930.9449-1-linmq006@gmail.com Fixes: cf137b3ea49a ("scsi: ufs-mediatek: Support VA09 regulator operations= ") Signed-off-by: Miaoqian Lin Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/ufs/ufs-mediatek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -557,7 +557,7 @@ static void ufs_mtk_init_va09_pwr_ctrl(s struct ufs_mtk_host *host =3D ufshcd_get_variant(hba); =20 host->reg_va09 =3D regulator_get(hba->dev, "va09"); - if (!host->reg_va09) + if (IS_ERR(host->reg_va09)) dev_info(hba->dev, "failed to get va09"); else host->caps |=3D UFS_MTK_CAP_VA09_PWR_CTRL; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D1CEC433FE for ; Mon, 24 Jan 2022 22:34:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1588877AbiAXWeR (ORCPT ); Mon, 24 Jan 2022 17:34:17 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51144 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456516AbiAXVj0 (ORCPT ); Mon, 24 Jan 2022 16:39:26 -0500 Received: from smtp.kernel.org (relay.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 EA597B8121C; Mon, 24 Jan 2022 21:39:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22A8BC340E4; Mon, 24 Jan 2022 21:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060363; bh=x7S04SykEtkNO6jyz+/ia/IfgXn8OU6ejHj5ebXM5TE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQLJ1GsVFYJCvPI7lxgqGbnHA6/NQTnycWzOSkw6+J1/QBT5jLh2gpDindsoUINZH 2g1KikLyWJ4vf0YGDRsD7YHF7cP1SPnMYGn11iKmsgkfmHl5VfmhyP1yHPSM+VCyC4 KU49ZW9IBeZ08zobOMXOwLND2RmE7XbaF5h7wdi4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kunihiko Hayashi , Vinod Koul Subject: [PATCH 5.16 0923/1039] dmaengine: uniphier-xdmac: Fix type of address variables Date: Mon, 24 Jan 2022 19:45:12 +0100 Message-Id: <20220124184156.323754976@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kunihiko Hayashi commit 105a8c525675bb7d4d64871f9b2edf39460de881 upstream. The variables src_addr and dst_addr handle DMA addresses, so these should be declared as dma_addr_t. Fixes: 667b9251440b ("dmaengine: uniphier-xdmac: Add UniPhier external DMA = controller driver") Signed-off-by: Kunihiko Hayashi Link: https://lore.kernel.org/r/1639456963-10232-1-git-send-email-hayashi.k= unihiko@socionext.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dma/uniphier-xdmac.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/dma/uniphier-xdmac.c +++ b/drivers/dma/uniphier-xdmac.c @@ -131,8 +131,9 @@ uniphier_xdmac_next_desc(struct uniphier static void uniphier_xdmac_chan_start(struct uniphier_xdmac_chan *xc, struct uniphier_xdmac_desc *xd) { - u32 src_mode, src_addr, src_width; - u32 dst_mode, dst_addr, dst_width; + u32 src_mode, src_width; + u32 dst_mode, dst_width; + dma_addr_t src_addr, dst_addr; u32 val, its, tnum; enum dma_slave_buswidth buswidth; =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 040AFC4332F for ; Mon, 24 Jan 2022 22:33:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1588507AbiAXWdD (ORCPT ); Mon, 24 Jan 2022 17:33:03 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58036 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444637AbiAXVjb (ORCPT ); Mon, 24 Jan 2022 16:39:31 -0500 Received: from smtp.kernel.org (relay.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 64EAD612E5; Mon, 24 Jan 2022 21:39:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D26AC340E4; Mon, 24 Jan 2022 21:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060366; bh=MwVDU5KHXsZMAwuTBPhjmF0Tyu+ExRo7B82mYWrX2lQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=icgJoUL/oGhuK3ZuQgraHVw/m+NO10p/fitA4OFn5NH3J/9IKJT5t4AtBTSRscZDb sZj62ylWqGyl8DiP2ssluTBrM534u8s18p1L+1IMA1lyPpdNAXCVVXUnbBsZqwzbpm nmpinDyeKaDd/iZdCQyEsnfy/+ORNYAY0yOLyXYs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Van , Dave Jiang , Vinod Koul Subject: [PATCH 5.16 0924/1039] dmaengine: idxd: fix wq settings post wq disable Date: Mon, 24 Jan 2022 19:45:13 +0100 Message-Id: <20220124184156.355071904@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Jiang commit 0f225705cf6536826318180831e18a74595efc8d upstream. By the spec, wq size and group association is not changeable unless device is disabled. Exclude clearing the shadow copy on wq disable/reset. This allows wq type to be changed after disable to be re-enabled. Move the size and group association to its own cleanup and only call it during device disable. Fixes: 0dcfe41e9a4c ("dmanegine: idxd: cleanup all device related bits afte= r disabling device") Reported-by: Lucas Van Tested-by: Lucas Van Signed-off-by: Dave Jiang Link: https://lore.kernel.org/r/163951291732.2987775.13576571320501115257.s= tgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dma/idxd/device.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- a/drivers/dma/idxd/device.c +++ b/drivers/dma/idxd/device.c @@ -382,8 +382,6 @@ static void idxd_wq_disable_cleanup(stru lockdep_assert_held(&wq->wq_lock); memset(wq->wqcfg, 0, idxd->wqcfg_size); wq->type =3D IDXD_WQT_NONE; - wq->size =3D 0; - wq->group =3D NULL; wq->threshold =3D 0; wq->priority =3D 0; wq->ats_dis =3D 0; @@ -392,6 +390,15 @@ static void idxd_wq_disable_cleanup(stru memset(wq->name, 0, WQ_NAME_SIZE); } =20 +static void idxd_wq_device_reset_cleanup(struct idxd_wq *wq) +{ + lockdep_assert_held(&wq->wq_lock); + + idxd_wq_disable_cleanup(wq); + wq->size =3D 0; + wq->group =3D NULL; +} + static void idxd_wq_ref_release(struct percpu_ref *ref) { struct idxd_wq *wq =3D container_of(ref, struct idxd_wq, wq_active); @@ -699,6 +706,7 @@ static void idxd_device_wqs_clear_state( =20 if (wq->state =3D=3D IDXD_WQ_ENABLED) { idxd_wq_disable_cleanup(wq); + idxd_wq_device_reset_cleanup(wq); wq->state =3D IDXD_WQ_DISABLED; } } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D4E9C43219 for ; Tue, 25 Jan 2022 00:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450302AbiAYA3y (ORCPT ); Mon, 24 Jan 2022 19:29:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363514AbiAXXop (ORCPT ); Mon, 24 Jan 2022 18:44:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4935C05A19B; Mon, 24 Jan 2022 13:39:30 -0800 (PST) Received: from smtp.kernel.org (relay.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 835F0614DC; Mon, 24 Jan 2022 21:39:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ED46C340E4; Mon, 24 Jan 2022 21:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060369; bh=YlEiyxyqTNYwmSha/fJ9ajhtW4rM+zQ7a+BoGfI6+YY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WHW7zCekR8ZIBPgNNZf60JqymO0IIKAM3DCEJAQMTwIGNPVLoVtk4o4uOZaNatWCn ezW6lgbAajHErGRCSICyyr3YwrX17RkWFKjgTDqX2VRTzMle/Y0tbUNEZTai5COETu KmykzZZrzirohQffqVZnRueQbdMK5C6q+0i9FK+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yixing Liu , Wenpeng Liang , Jason Gunthorpe Subject: [PATCH 5.16 0925/1039] RDMA/hns: Modify the mapping attribute of doorbell to device Date: Mon, 24 Jan 2022 19:45:14 +0100 Message-Id: <20220124184156.385374522@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yixing Liu commit 39d5534b1302189c809e90641ffae8cbdc42a8fc upstream. It is more general for ARM device drivers to use the device attribute to map PCI BAR spaces. Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver") Link: https://lore.kernel.org/r/20211206133652.27476-1-liangwenpeng@huawei.= com Signed-off-by: Yixing Liu Signed-off-by: Wenpeng Liang Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -442,7 +442,7 @@ static int hns_roce_mmap(struct ib_ucont prot =3D vma->vm_page_prot; =20 if (entry->mmap_type !=3D HNS_ROCE_MMAP_TYPE_TPTR) - prot =3D pgprot_noncached(prot); + prot =3D pgprot_device(prot); =20 ret =3D rdma_user_mmap_io(uctx, vma, pfn, rdma_entry->npages * PAGE_SIZE, prot, rdma_entry); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF78CC4332F for ; Mon, 24 Jan 2022 22:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356536AbiAXWcu (ORCPT ); Mon, 24 Jan 2022 17:32:50 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51208 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456592AbiAXVjf (ORCPT ); Mon, 24 Jan 2022 16:39:35 -0500 Received: from smtp.kernel.org (relay.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 4B8E0B8105C; Mon, 24 Jan 2022 21:39:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B87CC340E4; Mon, 24 Jan 2022 21:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060373; bh=Tc9AOZYZp2DQFZcIzTfoE35W2ly/fEgxYSyopAgJIBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2L6/8r7ZV1OCC0AEwbWXnX7FEBzN/Rto8GNZr6Qo9EwK8jzumXVT/d4MNq7RppVUI AGAG5I8E/nSuMjZBBArvDsUUMQS8OJTzGuYCxqp8sEGvGNj4DYLaS4XE8LetL78qhd NTVCbbSaMH+1E5qf6KaDuKyxQYNS8e/1r9plqMbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengguang Xu , Zhu Yanjun , Bob Pearson , Jason Gunthorpe Subject: [PATCH 5.16 0926/1039] RDMA/rxe: Fix a typo in opcode name Date: Mon, 24 Jan 2022 19:45:15 +0100 Message-Id: <20220124184156.418140518@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chengguang Xu commit 8d1cfb884e881efd69a3be4ef10772c71cb22216 upstream. There is a redundant ']' in the name of opcode IB_OPCODE_RC_SEND_MIDDLE, so just fix it. Fixes: 8700e3e7c485 ("Soft RoCE driver") Link: https://lore.kernel.org/r/20211218112320.3558770-1-cgxu519@mykernel.n= et Signed-off-by: Chengguang Xu Acked-by: Zhu Yanjun Reviewed-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/infiniband/sw/rxe/rxe_opcode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/sw/rxe/rxe_opcode.c +++ b/drivers/infiniband/sw/rxe/rxe_opcode.c @@ -117,7 +117,7 @@ struct rxe_opcode_info rxe_opcode[RXE_NU } }, [IB_OPCODE_RC_SEND_MIDDLE] =3D { - .name =3D "IB_OPCODE_RC_SEND_MIDDLE]", + .name =3D "IB_OPCODE_RC_SEND_MIDDLE", .mask =3D RXE_PAYLOAD_MASK | RXE_REQ_MASK | RXE_SEND_MASK | RXE_MIDDLE_MASK, .length =3D RXE_BTH_BYTES, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B48AC43217 for ; Tue, 25 Jan 2022 00:31:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360146AbiAYAaC (ORCPT ); Mon, 24 Jan 2022 19:30:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363529AbiAXXop (ORCPT ); Mon, 24 Jan 2022 18:44:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBB5BC05A1AF; Mon, 24 Jan 2022 13:39:36 -0800 (PST) Received: from smtp.kernel.org (relay.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 8BE1061028; Mon, 24 Jan 2022 21:39:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B6B0C340E4; Mon, 24 Jan 2022 21:39:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060376; bh=j8QhFAcoP5YnbewakrrigomulAjYONylTaD5Y1/NRwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a0P73G64fNbBi4o+BdjZ2itpM5/ahKOhX+msnVvqgwj/QHQzjT+GJCP6o6EE4VMTm xPJvJsDikfPDMT+FkbBrlDECg1fnpTcwow+FAc7k+PeO4yUhRILex8gwNtJVUgk5oH vLRHWWCKx1a44utKM7IBJ0lE09usuaoovSWAjhAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amelie Delaunay , Vinod Koul Subject: [PATCH 5.16 0927/1039] dmaengine: stm32-mdma: fix STM32_MDMA_CTBR_TSEL_MASK Date: Mon, 24 Jan 2022 19:45:16 +0100 Message-Id: <20220124184156.449877135@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit e7f110889a87307fb0fed408a5dee1707796ca04 upstream. This patch fixes STM32_MDMA_CTBR_TSEL_MASK, which is [5:0], not [7:0]. Fixes: a4ffb13c8946 ("dmaengine: Add STM32 MDMA driver") Signed-off-by: Amelie Delaunay Link: https://lore.kernel.org/r/20211220165827.1238097-1-amelie.delaunay@fo= ss.st.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dma/stm32-mdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/dma/stm32-mdma.c +++ b/drivers/dma/stm32-mdma.c @@ -184,7 +184,7 @@ #define STM32_MDMA_CTBR(x) (0x68 + 0x40 * (x)) #define STM32_MDMA_CTBR_DBUS BIT(17) #define STM32_MDMA_CTBR_SBUS BIT(16) -#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(7, 0) +#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(5, 0) #define STM32_MDMA_CTBR_TSEL(n) STM32_MDMA_SET(n, \ STM32_MDMA_CTBR_TSEL_MASK) =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8228EC433F5 for ; Mon, 24 Jan 2022 22:43:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382012AbiAXWnE (ORCPT ); Mon, 24 Jan 2022 17:43:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51242 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456632AbiAXVjl (ORCPT ); Mon, 24 Jan 2022 16:39:41 -0500 Received: from smtp.kernel.org (relay.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 3612EB811A2; Mon, 24 Jan 2022 21:39:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D679C340E7; Mon, 24 Jan 2022 21:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060379; bh=NXbbOAqjxfM9TnfaMkieLXY3+VHi8vLOfRI3YaR4YCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uZ7fi2g/B+UxNdkQU96oFS4+OGp+nBeohKR4rbsFPi4ih703pgCFWGR3oW9tYDALx 1zS0R1aeNroBq9xIokTtpz5GWIEwpWO37NxfRsWtV7/w8KH25bLJmZZf7BkMeuMSWu EOq+Zyo8ANi+wpsOiNRxAW+L/0tCA04o5AisC6mY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Moshe Shemesh , Eran Ben Elisha , Saeed Mahameed Subject: [PATCH 5.16 0928/1039] Revert "net/mlx5: Add retry mechanism to the command entry index allocation" Date: Mon, 24 Jan 2022 19:45:17 +0100 Message-Id: <20220124184156.482053296@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Moshe Shemesh commit 4f6626b0e140867fd6d5a2e9d4ceaef97f10f46a upstream. This reverts commit 410bd754cd73c4a2ac3856d9a03d7b08f9c906bf. The reverted commit had added a retry mechanism to the command entry index allocation. The previous patch ensures that there is a free command entry index once the command work handler holds the command semaphore. Thus the retry mechanism is not needed. Fixes: 410bd754cd73 ("net/mlx5: Add retry mechanism to the command entry in= dex allocation") Signed-off-by: Moshe Shemesh Reviewed-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -904,25 +904,6 @@ static bool opcode_allowed(struct mlx5_c return cmd->allowed_opcode =3D=3D opcode; } =20 -static int cmd_alloc_index_retry(struct mlx5_cmd *cmd) -{ - unsigned long alloc_end =3D jiffies + msecs_to_jiffies(1000); - int idx; - -retry: - idx =3D cmd_alloc_index(cmd); - if (idx < 0 && time_before(jiffies, alloc_end)) { - /* Index allocation can fail on heavy load of commands. This is a tempor= ary - * situation as the current command already holds the semaphore, meaning= that - * another command completion is being handled and it is expected to rel= ease - * the entry index soon. - */ - cpu_relax(); - goto retry; - } - return idx; -} - bool mlx5_cmd_is_down(struct mlx5_core_dev *dev) { return pci_channel_offline(dev->pdev) || @@ -950,7 +931,7 @@ static void cmd_work_handler(struct work sem =3D ent->page_queue ? &cmd->pages_sem : &cmd->sem; down(sem); if (!ent->page_queue) { - alloc_ret =3D cmd_alloc_index_retry(cmd); + alloc_ret =3D cmd_alloc_index(cmd); if (alloc_ret < 0) { mlx5_core_err_rl(dev, "failed to allocate command entry\n"); if (ent->callback) { From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 729ACC433F5 for ; Mon, 24 Jan 2022 22:43:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380376AbiAXWnc (ORCPT ); Mon, 24 Jan 2022 17:43:32 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58172 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456656AbiAXVjp (ORCPT ); Mon, 24 Jan 2022 16:39:45 -0500 Received: from smtp.kernel.org (relay.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 C57F961320; Mon, 24 Jan 2022 21:39:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C0D1C340E4; Mon, 24 Jan 2022 21:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060382; bh=+BDUmWzDpbNKA6uaUxFGDtNlu/yX6lufH5trVT1hoQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hZdl742s60GrL+W/FNMoCM0YsskyQimzX1d/RkPOy4SFCInSEj/fYZW/Hp0wrDtHC l1SLUnQtZw2j35YBLX1JK6KyPNfQTez7TqivhdV23rogdz8yoOKmjzpsnqtpuYblLE JKCITLp2pxtScglynkYt/yxH/uJpDMc2yVz2G7bE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naresh Kamboju , Anders Roxell , Nathan Chancellor , Arnd Bergmann , Michael Ellerman Subject: [PATCH 5.16 0929/1039] powerpc/cell: Fix clang -Wimplicit-fallthrough warning Date: Mon, 24 Jan 2022 19:45:18 +0100 Message-Id: <20220124184156.519856258@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Anders Roxell commit e89257e28e844f5d1d39081bb901d9f1183a7705 upstream. Clang warns: arch/powerpc/platforms/cell/pervasive.c:81:2: error: unannotated fall-throu= gh between switch labels case SRR1_WAKEEE: ^ arch/powerpc/platforms/cell/pervasive.c:81:2: note: insert 'break;' to avoi= d fall-through case SRR1_WAKEEE: ^ break; 1 error generated. Clang is more pedantic than GCC, which does not warn when failing through to a case that is just break or return. Clang's version is more in line with the kernel's own stance in deprecated.rst. Add athe missing break to silence the warning. Fixes: 6e83985b0f6e ("powerpc/cbe: Do not process external or decremeter in= terrupts from sreset") Reported-by: Naresh Kamboju Signed-off-by: Anders Roxell Reviewed-by: Nathan Chancellor Reviewed-by: Arnd Bergmann Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211207110228.698956-1-anders.roxell@linar= o.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/platforms/cell/pervasive.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/powerpc/platforms/cell/pervasive.c +++ b/arch/powerpc/platforms/cell/pervasive.c @@ -78,6 +78,7 @@ static int cbe_system_reset_exception(st switch (regs->msr & SRR1_WAKEMASK) { case SRR1_WAKEDEC: set_dec(1); + break; case SRR1_WAKEEE: /* * Handle these when interrupts get re-enabled and we take From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FACCC433EF for ; Tue, 25 Jan 2022 01:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413617AbiAYAj3 (ORCPT ); Mon, 24 Jan 2022 19:39:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849642AbiAXXqQ (ORCPT ); Mon, 24 Jan 2022 18:46:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C611C0BD128; Mon, 24 Jan 2022 13:39:46 -0800 (PST) Received: from smtp.kernel.org (relay.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 BDA8E6131F; Mon, 24 Jan 2022 21:39:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6795C340E4; Mon, 24 Jan 2022 21:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060385; bh=3U9VP1OuruVXeNmVCUIDrfmA01G3vDMoXgFxbdOhwwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AlMIlEO7Af1qLHNbVAXz8FGDynWurUVU4mWl7pJ5ntf5SZ0I/bNa8aIxjRsSK7nn3 vhXoITg6RvfQQ5uMdj+cdB/2lRnIvdRHd9up4turejEPYyYBH9h0fCdeYvlmqQKMGq yFG/xvcvTIErHLRmKc4Z0KMcg++PenXPzIK3/Ee4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tobias Waldekranz , Jakub Kicinski Subject: [PATCH 5.16 0930/1039] powerpc/fsl/dts: Enable WA for erratum A-009885 on fman3l MDIO buses Date: Mon, 24 Jan 2022 19:45:19 +0100 Message-Id: <20220124184156.551389666@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tobias Waldekranz commit 0d375d610fa96524e2ee2b46830a46a7bfa92a9f upstream. This block is used in (at least) T1024 and T1040, including their variants like T1023 etc. Fixes: d55ad2967d89 ("powerpc/mpc85xx: Create dts components for the FSL Qo= rIQ DPAA FMan") Signed-off-by: Tobias Waldekranz Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi @@ -79,6 +79,7 @@ fman0: fman@400000 { #size-cells =3D <0>; compatible =3D "fsl,fman-memac-mdio", "fsl,fman-xmdio"; reg =3D <0xfc000 0x1000>; + fsl,erratum-a009885; }; =20 xmdio0: mdio@fd000 { @@ -86,6 +87,7 @@ fman0: fman@400000 { #size-cells =3D <0>; compatible =3D "fsl,fman-memac-mdio", "fsl,fman-xmdio"; reg =3D <0xfd000 0x1000>; + fsl,erratum-a009885; }; }; =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3D66C4167D for ; Tue, 25 Jan 2022 01:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412969AbiAYAiF (ORCPT ); Mon, 24 Jan 2022 19:38:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363960AbiAXXq1 (ORCPT ); Mon, 24 Jan 2022 18:46:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43BB3C0BD12A; Mon, 24 Jan 2022 13:39:49 -0800 (PST) Received: from smtp.kernel.org (relay.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 D7F4C61502; Mon, 24 Jan 2022 21:39:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF6E9C340E4; Mon, 24 Jan 2022 21:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060388; bh=/kC4rX8Klpu5BbDCsn6PjAeVixyISa74Au70dZmqzAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L41wTcZsxSpAfaYVxj04sOpQQUQGZvJRY25Q9bN+4MMGBUZ6JM2A4KtlOrp5SmR3y y8aux2JwCZfS1C660RFb1yWgEfQQ0w+iB26xFF9eLY+8jVPullu2rZ+gBCTyMaujcD MHimMTJifkH7Vmnn/6ARc2Ls6w8aIdj2kW1Z+g3c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Jens Axboe Subject: [PATCH 5.16 0931/1039] block: fix async_depth sysfs interface for mq-deadline Date: Mon, 24 Jan 2022 19:45:20 +0100 Message-Id: <20220124184156.582876833@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jens Axboe commit 46cdc45acb089c811d9a54fd50af33b96e5fae9d upstream. A previous commit added this feature, but it inadvertently used the wrong variable to show/store the setting from/to, victimized by copy/paste. Fix it up so that the async_depth sysfs interface reads and writes from the right setting. Fixes: 07757588e507 ("block/mq-deadline: Reserve 25% of scheduler tags for = synchronous requests") Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D215485 Reviewed-by: Bart Van Assche Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- block/mq-deadline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/block/mq-deadline.c +++ b/block/mq-deadline.c @@ -865,7 +865,7 @@ SHOW_JIFFIES(deadline_write_expire_show, SHOW_JIFFIES(deadline_prio_aging_expire_show, dd->prio_aging_expire); SHOW_INT(deadline_writes_starved_show, dd->writes_starved); SHOW_INT(deadline_front_merges_show, dd->front_merges); -SHOW_INT(deadline_async_depth_show, dd->front_merges); +SHOW_INT(deadline_async_depth_show, dd->async_depth); SHOW_INT(deadline_fifo_batch_show, dd->fifo_batch); #undef SHOW_INT #undef SHOW_JIFFIES @@ -895,7 +895,7 @@ STORE_JIFFIES(deadline_write_expire_stor STORE_JIFFIES(deadline_prio_aging_expire_store, &dd->prio_aging_expire, 0,= INT_MAX); STORE_INT(deadline_writes_starved_store, &dd->writes_starved, INT_MIN, INT= _MAX); STORE_INT(deadline_front_merges_store, &dd->front_merges, 0, 1); -STORE_INT(deadline_async_depth_store, &dd->front_merges, 1, INT_MAX); +STORE_INT(deadline_async_depth_store, &dd->async_depth, 1, INT_MAX); STORE_INT(deadline_fifo_batch_store, &dd->fifo_batch, 0, INT_MAX); #undef STORE_FUNCTION #undef STORE_INT From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E9DDC433FE for ; Mon, 24 Jan 2022 22:47:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1837605AbiAXWow (ORCPT ); Mon, 24 Jan 2022 17:44:52 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47836 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456752AbiAXVj7 (ORCPT ); Mon, 24 Jan 2022 16:39:59 -0500 Received: from smtp.kernel.org (relay.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 088C7B811A9; Mon, 24 Jan 2022 21:39:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38CB3C340E4; Mon, 24 Jan 2022 21:39:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060394; bh=nCkMqPq7aczurCyrAgJsTR6iIJRd5PJT1ENTZ16rmAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UPtAo4FZCDwfOa8d/9kUqQJij8+/i5QSYszF5PUb+Gx8oKT53zvsrhzn5UD4x0tP9 EZ+2AZWdYeep6p0NjWs7QGYyEy//fZNsJ+GXNcb/UhpqSHzzGO4Lxg5Ur8igh3pWq7 M/VD0PziYRtDD/B44ZfaJ9wS1juOQ94nmqt4Pfis= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Bin , Ming Lei , Jens Axboe Subject: [PATCH 5.16 0932/1039] block: Fix fsync always failed if once failed Date: Mon, 24 Jan 2022 19:45:21 +0100 Message-Id: <20220124184156.613988305@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 8a7518931baa8ea023700987f3db31cb0a80610b upstream. We do test with inject error fault base on v4.19, after test some time we f= ound sync /dev/sda always failed. [root@localhost] sync /dev/sda sync: error syncing '/dev/sda': Input/output error scsi log as follows: [19069.812296] sd 0:0:0:0: [sda] tag#64 Send: scmd 0x00000000d03a0b6b [19069.812302] sd 0:0:0:0: [sda] tag#64 CDB: Synchronize Cache(10) 35 00 00= 00 00 00 00 00 00 00 [19069.812533] sd 0:0:0:0: [sda] tag#64 Done: SUCCESS Result: hostbyte=3DDI= D_OK driverbyte=3DDRIVER_OK [19069.812536] sd 0:0:0:0: [sda] tag#64 CDB: Synchronize Cache(10) 35 00 00= 00 00 00 00 00 00 00 [19069.812539] sd 0:0:0:0: [sda] tag#64 scsi host busy 1 failed 0 [19069.812542] sd 0:0:0:0: Notifying upper driver of completion (result 0) [19069.812546] sd 0:0:0:0: [sda] tag#64 sd_done: completed 0 of 0 bytes [19069.812549] sd 0:0:0:0: [sda] tag#64 0 sectors total, 0 bytes done. [19069.812564] print_req_error: I/O error, dev sda, sector 0 ftrace log as follows: rep-306069 [007] .... 19654.923315: block_bio_queue: 8,0 FWS 0 + 0 [rep] rep-306069 [007] .... 19654.923333: block_getrq: 8,0 FWS 0 + 0 [rep] kworker/7:1H-250 [007] .... 19654.923352: block_rq_issue: 8,0 FF 0 () 0 = + 0 [kworker/7:1H] -0 [007] ..s. 19654.923562: block_rq_complete: 8,0 FF () 1844674= 4073709551615 + 0 [0] -0 [007] d.s. 19654.923576: block_rq_complete: 8,0 WS () 0 + 0 [= -5] As 8d6996630c03 introduce 'fq->rq_status', this data only update when 'flus= h_rq' reference count isn't zero. If flush request once failed and record error c= ode in 'fq->rq_status'. If there is no chance to update 'fq->rq_status',then do= fsync will always failed. To address this issue reset 'fq->rq_status' after return error code to uppe= r layer. Fixes: 8d6996630c03("block: fix null pointer dereference in blk_mq_rq_timed= _out()") Signed-off-by: Ye Bin Reviewed-by: Ming Lei Link: https://lore.kernel.org/r/20211129012659.1553733-1-yebin10@huawei.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- block/blk-flush.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -235,8 +235,10 @@ static void flush_end_io(struct request * avoiding use-after-free. */ WRITE_ONCE(flush_rq->state, MQ_RQ_IDLE); - if (fq->rq_status !=3D BLK_STS_OK) + if (fq->rq_status !=3D BLK_STS_OK) { error =3D fq->rq_status; + fq->rq_status =3D BLK_STS_OK; + } =20 if (!q->elevator) { flush_rq->tag =3D BLK_MQ_NO_TAG; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BD24C433FE for ; Tue, 25 Jan 2022 01:59:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413572AbiAYAjW (ORCPT ); Mon, 24 Jan 2022 19:39:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363962AbiAXXq1 (ORCPT ); Mon, 24 Jan 2022 18:46:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F0FBC05A1B8; Mon, 24 Jan 2022 13:39:58 -0800 (PST) Received: from smtp.kernel.org (relay.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 3DEB961491; Mon, 24 Jan 2022 21:39:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22288C340E4; Mon, 24 Jan 2022 21:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060397; bh=q7ihR5Snu2W1wGEKLmd6hmJZ58qgPjBl7VGdE/uxV+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v1C8hbOsZ2GcszqahXsaeLkNHyFOcn3ClA1PT7wS5k5JV/Lxtr6fzB9a1hDrhJ1tQ DFqZzUGa7lF73adRGrd06EtMWVV3ceLYjNcLIXW+/2pxcEhz5FiBpHukCX5EWZ56xB y1mJ1RlnNy1k7ZiJVxwz1OKGn0tN8m8ZvEooO6WQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Maxime Ripard Subject: [PATCH 5.16 0933/1039] drm/vc4: crtc: Drop feed_txp from state Date: Mon, 24 Jan 2022 19:45:22 +0100 Message-Id: <20220124184156.652900148@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard commit a16c66401fd831f70a02d33e9bcaac585637c29f upstream. Accessing the crtc->state pointer from outside the modesetting context is not allowed. We thus need to copy whatever we need from the KMS state to our structure in order to access it. In VC4, a number of users of that pointers have crept in over the years, the first one being whether or not the downstream controller of the pixelvalve is our writeback controller. Fortunately for us, Since commit 39fcb2808376 ("drm/vc4: txp: Turn the TXP into a CRTC of its own") this is no longer something that can change from one commit to the other and is hardcoded. Let's set this flag in struct vc4_crtc if we happen to be the TXP, and drop the flag from our private state structure. Link: https://lore.kernel.org/all/YWgteNaNeaS9uWDe@phenom.ffwll.local/ Link: https://lore.kernel.org/r/20211025141113.702757-2-maxime@cerno.tech Fixes: 008095e065a8 ("drm/vc4: Add support for the transposer block") Acked-by: Daniel Vetter Signed-off-by: Maxime Ripard Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_crtc.c | 3 +-- drivers/gpu/drm/vc4/vc4_drv.h | 6 +++++- drivers/gpu/drm/vc4/vc4_hvs.c | 7 +++---- drivers/gpu/drm/vc4/vc4_kms.c | 3 ++- drivers/gpu/drm/vc4/vc4_txp.c | 3 +-- 5 files changed, 12 insertions(+), 10 deletions(-) --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -715,7 +715,7 @@ static void vc4_crtc_handle_page_flip(st spin_lock_irqsave(&dev->event_lock, flags); if (vc4_crtc->event && (vc4_state->mm.start =3D=3D HVS_READ(SCALER_DISPLACTX(chan)) || - vc4_state->feed_txp)) { + vc4_crtc->feeds_txp)) { drm_crtc_send_vblank_event(crtc, vc4_crtc->event); vc4_crtc->event =3D NULL; drm_crtc_vblank_put(crtc); @@ -893,7 +893,6 @@ struct drm_crtc_state *vc4_crtc_duplicat return NULL; =20 old_vc4_state =3D to_vc4_crtc_state(crtc->state); - vc4_state->feed_txp =3D old_vc4_state->feed_txp; vc4_state->margins =3D old_vc4_state->margins; vc4_state->assigned_channel =3D old_vc4_state->assigned_channel; =20 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -495,6 +495,11 @@ struct vc4_crtc { struct drm_pending_vblank_event *event; =20 struct debugfs_regset32 regset; + + /** + * @feeds_txp: True if the CRTC feeds our writeback controller. + */ + bool feeds_txp; }; =20 static inline struct vc4_crtc * @@ -521,7 +526,6 @@ struct vc4_crtc_state { struct drm_crtc_state base; /* Dlist area for this CRTC configuration. */ struct drm_mm_node mm; - bool feed_txp; bool txp_armed; unsigned int assigned_channel; =20 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -375,7 +375,7 @@ static void vc4_hvs_update_dlist(struct =20 spin_lock_irqsave(&dev->event_lock, flags); =20 - if (!vc4_state->feed_txp || vc4_state->txp_armed) { + if (!vc4_crtc->feeds_txp || vc4_state->txp_armed) { vc4_crtc->event =3D crtc->state->event; crtc->state->event =3D NULL; } @@ -395,10 +395,9 @@ void vc4_hvs_atomic_enable(struct drm_cr { struct drm_device *dev =3D crtc->dev; struct vc4_dev *vc4 =3D to_vc4_dev(dev); - struct drm_crtc_state *new_crtc_state =3D drm_atomic_get_new_crtc_state(s= tate, crtc); - struct vc4_crtc_state *vc4_state =3D to_vc4_crtc_state(new_crtc_state); struct drm_display_mode *mode =3D &crtc->state->adjusted_mode; - bool oneshot =3D vc4_state->feed_txp; + struct vc4_crtc *vc4_crtc =3D to_vc4_crtc(crtc); + bool oneshot =3D vc4_crtc->feeds_txp; =20 vc4_hvs_update_dlist(crtc); vc4_hvs_init_channel(vc4, crtc, mode, oneshot); --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -233,6 +233,7 @@ static void vc4_hvs_pv_muxing_commit(str unsigned int i; =20 for_each_new_crtc_in_state(state, crtc, crtc_state, i) { + struct vc4_crtc *vc4_crtc =3D to_vc4_crtc(crtc); struct vc4_crtc_state *vc4_state =3D to_vc4_crtc_state(crtc_state); u32 dispctrl; u32 dsp3_mux; @@ -253,7 +254,7 @@ static void vc4_hvs_pv_muxing_commit(str * TXP IP, and we need to disable the FIFO2 -> pixelvalve1 * route. */ - if (vc4_state->feed_txp) + if (vc4_crtc->feeds_txp) dsp3_mux =3D VC4_SET_FIELD(3, SCALER_DISPCTRL_DSP3_MUX); else dsp3_mux =3D VC4_SET_FIELD(2, SCALER_DISPCTRL_DSP3_MUX); --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -391,7 +391,6 @@ static int vc4_txp_atomic_check(struct d { struct drm_crtc_state *crtc_state =3D drm_atomic_get_new_crtc_state(state, crtc); - struct vc4_crtc_state *vc4_state =3D to_vc4_crtc_state(crtc_state); int ret; =20 ret =3D vc4_hvs_atomic_check(crtc, state); @@ -399,7 +398,6 @@ static int vc4_txp_atomic_check(struct d return ret; =20 crtc_state->no_vblank =3D true; - vc4_state->feed_txp =3D true; =20 return 0; } @@ -482,6 +480,7 @@ static int vc4_txp_bind(struct device *d =20 vc4_crtc->pdev =3D pdev; vc4_crtc->data =3D &vc4_txp_crtc_data; + vc4_crtc->feeds_txp =3D true; =20 txp->pdev =3D pdev; =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58002C4321E for ; Mon, 24 Jan 2022 22:40:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835409AbiAXWgU (ORCPT ); Mon, 24 Jan 2022 17:36:20 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58390 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456791AbiAXVkC (ORCPT ); Mon, 24 Jan 2022 16:40:02 -0500 Received: from smtp.kernel.org (relay.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 2CE736150B; Mon, 24 Jan 2022 21:40:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13F90C340E4; Mon, 24 Jan 2022 21:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060400; bh=erMBbhktD/e8ZzmhSjqjLHdeMwvuoTg8BFvNKzz4T5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gkRvDXrrIfXvJaA0nr77GUWNNcV8TeOlOgL7hVP04jB8fsVZWJ6nF4Sek3Hp43deK /5d5xM7gQPJ6JstqZ1n9s9HXIF6LU2/DUzDCz6DwCuy0Wuf9Bm734f3uJrovCPTOf9 wqrG1qWaY6ZVfo/T9xG2pGfU7Kr4EZlYJwwfPiQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Maxime Ripard Subject: [PATCH 5.16 0934/1039] drm/vc4: Fix non-blocking commit getting stuck forever Date: Mon, 24 Jan 2022 19:45:23 +0100 Message-Id: <20220124184156.685114259@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard commit 0c250c150c74a90db298bf2a8bcd0a1dabed2e2f upstream. In some situation, we can end up being stuck on a non-blocking that went through properly. The situation that seems to trigger it reliably is to first start a non-blocking commit, and then right after, and before we had any vblank interrupt), start a blocking commit. This will lead to the first commit workqueue to be scheduled, setup the display, while the second commit is waiting for the first one to be completed. The vblank interrupt will then be raised, vc4_crtc_handle_vblank() will run and will compare the active dlist in the HVS channel to the one associated with the crtc->state. However, at that point, the second commit is waiting using drm_atomic_helper_wait_for_dependencies that occurs after drm_atomic_helper_swap_state has been called, so crtc->state points to the second commit state. vc4_crtc_handle_vblank() will compare the two dlist addresses and since they don't match will ignore the interrupt. The vblank event will never be reported, and the first and second commit will wait for the first commit completion until they timeout. The underlying reason is that it was never safe to do so. Indeed, accessing the ->state pointer access synchronization is based on ownership guarantees that can only occur within the functions and hooks defined as part of the KMS framework, and obviously the irq handler isn't one of them. The rework to move to generic helpers only uncovered the underlying issue. However, since the code path between drm_atomic_helper_wait_for_dependencies() and drm_atomic_helper_wait_for_vblanks() is serialised and we can't get two commits in that path at the same time, we can work around this issue by setting a variable associated to struct drm_crtc to the dlist we expect, and then using it from the vc4_crtc_handle_vblank() function. Since that state is shared with the modesetting path, we also need to introduce a spinlock to protect the code shared between the interrupt handler and the modesetting path, protecting only our new variable for now. Link: https://lore.kernel.org/all/YWgteNaNeaS9uWDe@phenom.ffwll.local/ Link: https://lore.kernel.org/r/20211025141113.702757-3-maxime@cerno.tech Fixes: 56d1fe0979dc ("drm/vc4: Make pageflip completion handling more robus= t.") Acked-by: Daniel Vetter Signed-off-by: Maxime Ripard Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_crtc.c | 5 ++++- drivers/gpu/drm/vc4/vc4_drv.h | 14 ++++++++++++++ drivers/gpu/drm/vc4/vc4_hvs.c | 7 +++++-- 3 files changed, 23 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -713,8 +713,9 @@ static void vc4_crtc_handle_page_flip(st unsigned long flags; =20 spin_lock_irqsave(&dev->event_lock, flags); + spin_lock(&vc4_crtc->irq_lock); if (vc4_crtc->event && - (vc4_state->mm.start =3D=3D HVS_READ(SCALER_DISPLACTX(chan)) || + (vc4_crtc->current_dlist =3D=3D HVS_READ(SCALER_DISPLACTX(chan)) || vc4_crtc->feeds_txp)) { drm_crtc_send_vblank_event(crtc, vc4_crtc->event); vc4_crtc->event =3D NULL; @@ -728,6 +729,7 @@ static void vc4_crtc_handle_page_flip(st */ vc4_hvs_unmask_underrun(dev, chan); } + spin_unlock(&vc4_crtc->irq_lock); spin_unlock_irqrestore(&dev->event_lock, flags); } =20 @@ -1127,6 +1129,7 @@ int vc4_crtc_init(struct drm_device *drm return PTR_ERR(primary_plane); } =20 + spin_lock_init(&vc4_crtc->irq_lock); drm_crtc_init_with_planes(drm, crtc, primary_plane, NULL, crtc_funcs, NULL); drm_crtc_helper_add(crtc, crtc_helper_funcs); --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -500,6 +500,20 @@ struct vc4_crtc { * @feeds_txp: True if the CRTC feeds our writeback controller. */ bool feeds_txp; + + /** + * @irq_lock: Spinlock protecting the resources shared between + * the atomic code and our vblank handler. + */ + spinlock_t irq_lock; + + /** + * @current_dlist: Start offset of the display list currently + * set in the HVS for that CRTC. Protected by @irq_lock, and + * copied in vc4_hvs_update_dlist() for the CRTC interrupt + * handler to have access to that value. + */ + unsigned int current_dlist; }; =20 static inline struct vc4_crtc * --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -365,10 +365,9 @@ static void vc4_hvs_update_dlist(struct struct vc4_dev *vc4 =3D to_vc4_dev(dev); struct vc4_crtc *vc4_crtc =3D to_vc4_crtc(crtc); struct vc4_crtc_state *vc4_state =3D to_vc4_crtc_state(crtc->state); + unsigned long flags; =20 if (crtc->state->event) { - unsigned long flags; - crtc->state->event->pipe =3D drm_crtc_index(crtc); =20 WARN_ON(drm_crtc_vblank_get(crtc) !=3D 0); @@ -388,6 +387,10 @@ static void vc4_hvs_update_dlist(struct HVS_WRITE(SCALER_DISPLISTX(vc4_state->assigned_channel), vc4_state->mm.start); } + + spin_lock_irqsave(&vc4_crtc->irq_lock, flags); + vc4_crtc->current_dlist =3D vc4_state->mm.start; + spin_unlock_irqrestore(&vc4_crtc->irq_lock, flags); } =20 void vc4_hvs_atomic_enable(struct drm_crtc *crtc, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99FD6C4332F for ; Tue, 25 Jan 2022 01:59:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413486AbiAYAjL (ORCPT ); Mon, 24 Jan 2022 19:39:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363964AbiAXXq1 (ORCPT ); Mon, 24 Jan 2022 18:46:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9715EC05A1B9; Mon, 24 Jan 2022 13:40:04 -0800 (PST) Received: from smtp.kernel.org (relay.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 384F36150F; Mon, 24 Jan 2022 21:40:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 126E1C340E4; Mon, 24 Jan 2022 21:40:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060403; bh=NYew2eLHnOVBJzWS0JUQya8E9KMDLrukBSAFBS4kna0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SUa+wJcQp/cwSvWoEV0Cu+UpbdIN6GCRF8tct1O9jXO9bIIutOisSU8ctgACfDhhl 0m11cNhYFmtJyAlLu+BAmh0LV5AD0UncC2uyT9zEqEhXQqm5Ang1cIgeQi3vft+FJx n6jEHBXkC3H2nl+9GwxA0MN3qfuUPg5L2xZEmtl4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Maxime Ripard Subject: [PATCH 5.16 0935/1039] drm/vc4: crtc: Copy assigned channel to the CRTC Date: Mon, 24 Jan 2022 19:45:24 +0100 Message-Id: <20220124184156.717792487@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard commit eeb6ab4639590130d25670204ab7b6011333d685 upstream. Accessing the crtc->state pointer from outside the modesetting context is not allowed. We thus need to copy whatever we need from the KMS state to our structure in order to access it. In VC4, a number of users of that pointers have crept in over the years, and the previous commits removed them all but the HVS channel a CRTC has been assigned. Let's move this channel in struct vc4_crtc at atomic_begin() time, drop it from our private state structure, and remove our use of crtc->state from our vblank handler entirely. Link: https://lore.kernel.org/all/YWgteNaNeaS9uWDe@phenom.ffwll.local/ Link: https://lore.kernel.org/r/20211025141113.702757-4-maxime@cerno.tech Fixes: 87ebcd42fb7b ("drm/vc4: crtc: Assign output to channel automatically= ") Acked-by: Daniel Vetter Signed-off-by: Maxime Ripard Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_crtc.c | 4 ++-- drivers/gpu/drm/vc4/vc4_drv.h | 9 +++++++++ drivers/gpu/drm/vc4/vc4_hvs.c | 12 ++++++++++++ drivers/gpu/drm/vc4/vc4_txp.c | 1 + 4 files changed, 24 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -708,8 +708,7 @@ static void vc4_crtc_handle_page_flip(st struct drm_crtc *crtc =3D &vc4_crtc->base; struct drm_device *dev =3D crtc->dev; struct vc4_dev *vc4 =3D to_vc4_dev(dev); - struct vc4_crtc_state *vc4_state =3D to_vc4_crtc_state(crtc->state); - u32 chan =3D vc4_state->assigned_channel; + u32 chan =3D vc4_crtc->current_hvs_channel; unsigned long flags; =20 spin_lock_irqsave(&dev->event_lock, flags); @@ -955,6 +954,7 @@ static const struct drm_crtc_funcs vc4_c static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs =3D { .mode_valid =3D vc4_crtc_mode_valid, .atomic_check =3D vc4_crtc_atomic_check, + .atomic_begin =3D vc4_hvs_atomic_begin, .atomic_flush =3D vc4_hvs_atomic_flush, .atomic_enable =3D vc4_crtc_atomic_enable, .atomic_disable =3D vc4_crtc_atomic_disable, --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -514,6 +514,14 @@ struct vc4_crtc { * handler to have access to that value. */ unsigned int current_dlist; + + /** + * @current_hvs_channel: HVS channel currently assigned to the + * CRTC. Protected by @irq_lock, and copied in + * vc4_hvs_atomic_begin() for the CRTC interrupt handler to have + * access to that value. + */ + unsigned int current_hvs_channel; }; =20 static inline struct vc4_crtc * @@ -926,6 +934,7 @@ extern struct platform_driver vc4_hvs_dr void vc4_hvs_stop_channel(struct drm_device *dev, unsigned int output); int vc4_hvs_get_fifo_from_output(struct drm_device *dev, unsigned int outp= ut); int vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *s= tate); +void vc4_hvs_atomic_begin(struct drm_crtc *crtc, struct drm_atomic_state *= state); void vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state = *state); void vc4_hvs_atomic_disable(struct drm_crtc *crtc, struct drm_atomic_state= *state); void vc4_hvs_atomic_flush(struct drm_crtc *crtc, struct drm_atomic_state *= state); --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -393,6 +393,18 @@ static void vc4_hvs_update_dlist(struct spin_unlock_irqrestore(&vc4_crtc->irq_lock, flags); } =20 +void vc4_hvs_atomic_begin(struct drm_crtc *crtc, + struct drm_atomic_state *state) +{ + struct vc4_crtc *vc4_crtc =3D to_vc4_crtc(crtc); + struct vc4_crtc_state *vc4_state =3D to_vc4_crtc_state(crtc->state); + unsigned long flags; + + spin_lock_irqsave(&vc4_crtc->irq_lock, flags); + vc4_crtc->current_hvs_channel =3D vc4_state->assigned_channel; + spin_unlock_irqrestore(&vc4_crtc->irq_lock, flags); +} + void vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state) { --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -435,6 +435,7 @@ static void vc4_txp_atomic_disable(struc =20 static const struct drm_crtc_helper_funcs vc4_txp_crtc_helper_funcs =3D { .atomic_check =3D vc4_txp_atomic_check, + .atomic_begin =3D vc4_hvs_atomic_begin, .atomic_flush =3D vc4_hvs_atomic_flush, .atomic_enable =3D vc4_txp_atomic_enable, .atomic_disable =3D vc4_txp_atomic_disable, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 577C6C433EF for ; Tue, 25 Jan 2022 01:59:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413430AbiAYAjE (ORCPT ); Mon, 24 Jan 2022 19:39:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363971AbiAXXq1 (ORCPT ); Mon, 24 Jan 2022 18:46:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0A95C05A1BA; Mon, 24 Jan 2022 13:40:07 -0800 (PST) Received: from smtp.kernel.org (relay.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 3D52D6150F; Mon, 24 Jan 2022 21:40:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DFADC340E4; Mon, 24 Jan 2022 21:40:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060406; bh=GEPTA5WbQg+7Raj5vrdh/6V20f+eelTVgqL11f2YC6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i2MXvWyqMgkcDVmujtTsxFAm7n/OBwPo7Em9DpzIhJqnmsRaxpebtB5lPPJ5yVCMB Ikzup0xjtQ1zMsM15oT/c7d7OGwaXiHxpMx0DQ0p85bIGsePEzXvKQa+xEGQxMCaFI WabjAlsgXeFipsutH/vSI8HZtPMf7qA/HLxxcV9E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Dave Marchevsky Subject: [PATCH 5.16 0936/1039] libbpf: Remove deprecation attribute from struct bpf_prog_prep_result Date: Mon, 24 Jan 2022 19:45:25 +0100 Message-Id: <20220124184156.752157099@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko commit 5c5edcdebfcf3a95257b0d8ef27a60af0e0ea03a upstream. This deprecation annotation has no effect because for struct deprecation attribute has to be declared after struct definition. But instead of moving it to the end of struct definition, remove it. When deprecation will go in effect at libbpf v0.7, this deprecation attribute will cause libbpf's own source code compilation to trigger deprecation warnings, which is unavoidable because libbpf still has to support that API. So keep deprecation of APIs, but don't mark structs used in API as deprecated. Fixes: e21d585cb3db ("libbpf: Deprecate multi-instance bpf_program APIs") Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Acked-by: Dave Marchevsky Link: https://lore.kernel.org/bpf/20211103220845.2676888-8-andrii@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/libbpf.h | 1 - 1 file changed, 1 deletion(-) --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h @@ -431,7 +431,6 @@ bpf_program__attach_iter(const struct bp * one instance. In this case bpf_program__fd(prog) is equal to * bpf_program__nth_fd(prog, 0). */ -LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_program__insns() for getting bpf_pr= ogram instructions") struct bpf_prog_prep_result { /* * If not NULL, load new instruction array. From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCDDCC4167B for ; Mon, 24 Jan 2022 22:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1837813AbiAXWpY (ORCPT ); Mon, 24 Jan 2022 17:45:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49640 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456836AbiAXVkM (ORCPT ); Mon, 24 Jan 2022 16:40:12 -0500 Received: from smtp.kernel.org (relay.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 1EB0EB81057; Mon, 24 Jan 2022 21:40:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5206C340E4; Mon, 24 Jan 2022 21:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060409; bh=j7uZC0EMg6IOGQI/zK2ZT99oLEwNN8GGLHuqvCfKBrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xuThfJM5hw7ZfMJ/sBO/R1zw+2wqYMTefaqDTwcVENDJRH0vqQl+XR3xMqp15z8Xl uLcSuj0gWV+H4mN9XNBBLSdAIShLNQlhH7ZQzzebPMcTxgkES6KjgTSmHJzU5atEor zStdVhu8xdMnRPRMJsMXLFwcszX4eXsbvrvG04XI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Russell King , Daniel Borkmann , Alan Maguire Subject: [PATCH 5.16 0937/1039] arm64/bpf: Remove 128MB limit for BPF JIT programs Date: Mon, 24 Jan 2022 19:45:26 +0100 Message-Id: <20220124184156.781671254@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Russell King commit b89ddf4cca43f1269093942cf5c4e457fd45c335 upstream. Commit 91fc957c9b1d ("arm64/bpf: don't allocate BPF JIT programs in module memory") restricts BPF JIT program allocation to a 128MB region to ensure BPF programs are still in branching range of each other. However this restriction should not apply to the aarch64 JIT, since BPF_JMP | BPF_CALL are implemented as a 64-bit move into a register and then a BLR instruction= - which has the effect of being able to call anything without proximity limitation. The practical reason to relax this restriction on JIT memory is that 128MB = of JIT memory can be quickly exhausted, especially where PAGE_SIZE is 64KB - o= ne page is needed per program. In cases where seccomp filters are applied to multiple VMs on VM launch - such filters are classic BPF but converted to BPF - this can severely limit the number of VMs that can be launched. In a world where we support BPF JIT always on, turning off the JIT isn't always = an option either. Fixes: 91fc957c9b1d ("arm64/bpf: don't allocate BPF JIT programs in module = memory") Suggested-by: Ard Biesheuvel Signed-off-by: Russell King Signed-off-by: Daniel Borkmann Tested-by: Alan Maguire Link: https://lore.kernel.org/bpf/1636131046-5982-2-git-send-email-alan.mag= uire@oracle.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/include/asm/extable.h | 9 --------- arch/arm64/include/asm/memory.h | 5 +---- arch/arm64/kernel/traps.c | 2 +- arch/arm64/mm/ptdump.c | 2 -- arch/arm64/net/bpf_jit_comp.c | 7 ++----- 5 files changed, 4 insertions(+), 21 deletions(-) --- a/arch/arm64/include/asm/extable.h +++ b/arch/arm64/include/asm/extable.h @@ -33,15 +33,6 @@ do { \ (b)->data =3D (tmp).data; \ } while (0) =20 -static inline bool in_bpf_jit(struct pt_regs *regs) -{ - if (!IS_ENABLED(CONFIG_BPF_JIT)) - return false; - - return regs->pc >=3D BPF_JIT_REGION_START && - regs->pc < BPF_JIT_REGION_END; -} - #ifdef CONFIG_BPF_JIT bool ex_handler_bpf(const struct exception_table_entry *ex, struct pt_regs *regs); --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -44,11 +44,8 @@ #define _PAGE_OFFSET(va) (-(UL(1) << (va))) #define PAGE_OFFSET (_PAGE_OFFSET(VA_BITS)) #define KIMAGE_VADDR (MODULES_END) -#define BPF_JIT_REGION_START (_PAGE_END(VA_BITS_MIN)) -#define BPF_JIT_REGION_SIZE (SZ_128M) -#define BPF_JIT_REGION_END (BPF_JIT_REGION_START + BPF_JIT_REGION_SIZE) #define MODULES_END (MODULES_VADDR + MODULES_VSIZE) -#define MODULES_VADDR (BPF_JIT_REGION_END) +#define MODULES_VADDR (_PAGE_END(VA_BITS_MIN)) #define MODULES_VSIZE (SZ_128M) #define VMEMMAP_START (-(UL(1) << (VA_BITS - VMEMMAP_SHIFT))) #define VMEMMAP_END (VMEMMAP_START + VMEMMAP_SIZE) --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -994,7 +994,7 @@ static struct break_hook bug_break_hook static int reserved_fault_handler(struct pt_regs *regs, unsigned int esr) { pr_err("%s generated an invalid instruction at %pS!\n", - in_bpf_jit(regs) ? "BPF JIT" : "Kernel text patching", + "Kernel text patching", (void *)instruction_pointer(regs)); =20 /* We cannot handle this */ --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -41,8 +41,6 @@ static struct addr_marker address_marker { 0 /* KASAN_SHADOW_START */, "Kasan shadow start" }, { KASAN_SHADOW_END, "Kasan shadow end" }, #endif - { BPF_JIT_REGION_START, "BPF start" }, - { BPF_JIT_REGION_END, "BPF end" }, { MODULES_VADDR, "Modules start" }, { MODULES_END, "Modules end" }, { VMALLOC_START, "vmalloc() area" }, --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -1145,15 +1145,12 @@ out: =20 u64 bpf_jit_alloc_exec_limit(void) { - return BPF_JIT_REGION_SIZE; + return VMALLOC_END - VMALLOC_START; } =20 void *bpf_jit_alloc_exec(unsigned long size) { - return __vmalloc_node_range(size, PAGE_SIZE, BPF_JIT_REGION_START, - BPF_JIT_REGION_END, GFP_KERNEL, - PAGE_KERNEL, 0, NUMA_NO_NODE, - __builtin_return_address(0)); + return vmalloc(size); } =20 void bpf_jit_free_exec(void *addr) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FB7EC433EF for ; Mon, 24 Jan 2022 22:42:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836804AbiAXWkv (ORCPT ); Mon, 24 Jan 2022 17:40:51 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58572 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457765AbiAXVmQ (ORCPT ); Mon, 24 Jan 2022 16:42:16 -0500 Received: from smtp.kernel.org (relay.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 DE3A361489; Mon, 24 Jan 2022 21:42:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B26B8C340E4; Mon, 24 Jan 2022 21:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060535; bh=qlfGHbOjwuWJJj7g3mrICRmEQ360zRztaKRh34ZW7F8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J/aNb2FBxNe3L+0C0Jb2kpm7l+7juKlhlE3+hZ1hW+lX6IzVZ3XWkb1o+MTp2ZV8T eaxHGu1ZsUiYZ903AqACDJit6xf+zkcrusH5uuemYlVsLooQnOBZcqF/5OIrZXFPk9 8145XprSQsE51S+dfUSsSo/B3gAwWIfcmquKC5DU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Monnet , Andrii Nakryiko Subject: [PATCH 5.16 0938/1039] bpftool: Remove inclusion of utilities.mak from Makefiles Date: Mon, 24 Jan 2022 19:45:27 +0100 Message-Id: <20220124184156.816502323@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quentin Monnet commit 48f5aef4c458c19ab337eed8c95a6486cc014aa3 upstream. Bpftool's Makefile, and the Makefile for its documentation, both include scripts/utilities.mak, but they use none of the items defined in this file. Remove the includes. Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool") Signed-off-by: Quentin Monnet Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20211110114632.24537-3-quentin@isovalent.= com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/bpf/bpftool/Documentation/Makefile | 1 - tools/bpf/bpftool/Makefile | 1 - 2 files changed, 2 deletions(-) --- a/tools/bpf/bpftool/Documentation/Makefile +++ b/tools/bpf/bpftool/Documentation/Makefile @@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only include ../../../scripts/Makefile.include -include ../../../scripts/utilities.mak =20 INSTALL ?=3D install RM ?=3D rm -f --- a/tools/bpf/bpftool/Makefile +++ b/tools/bpf/bpftool/Makefile @@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only include ../../scripts/Makefile.include -include ../../scripts/utilities.mak =20 ifeq ($(srctree),) srctree :=3D $(patsubst %/,%,$(dir $(CURDIR))) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FE6CC433F5 for ; Tue, 25 Jan 2022 01:59:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413499AbiAYAjN (ORCPT ); Mon, 24 Jan 2022 19:39:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363952AbiAXXq1 (ORCPT ); Mon, 24 Jan 2022 18:46:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFFCAC0BD12D; Mon, 24 Jan 2022 13:40:34 -0800 (PST) Received: from smtp.kernel.org (relay.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 7EC166150E; Mon, 24 Jan 2022 21:40:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FC27C340E7; Mon, 24 Jan 2022 21:40:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060433; bh=Bf7idONjgD/oBEZ0+ZWnrASVJYEbrOEFixMhi+GyhwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HusHj/c4eu3BgWBYAJDqbUZ4jRbcyIvLbVeVUH64doxBevSKo9/+6fy6HirQDp/74 p1ti1UNhBdGmnjHDfRLvhsXJTYhi8/clqDA1I/e3OesQBmkpJRidsFLnWJdoWkgli5 Z64f08CgB/7Pc1e1qdywWVt7U7jiWbSEFBdkrvow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Monnet , Andrii Nakryiko Subject: [PATCH 5.16 0939/1039] bpftool: Fix indent in option lists in the documentation Date: Mon, 24 Jan 2022 19:45:28 +0100 Message-Id: <20220124184156.849678945@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quentin Monnet commit 986dec18bbf41f50edc2e0aa4ac5ef8e0f64f328 upstream. Mixed indentation levels in the lists of options in bpftool's documentation produces some unexpected results. For the "bpftool" man page, it prints a warning: $ make -C bpftool.8 GEN bpftool.8 :26: (ERROR/3) Unexpected indentation. For other pages, there is no warning, but it results in a line break appearing in the option lists in the generated man pages. RST paragraphs should have a uniform indentation level. Let's fix it. Fixes: c07ba629df97 ("tools: bpftool: Update and synchronise option list in= doc and help msg") Fixes: 8cc8c6357c8f ("tools: bpftool: Document and add bash completion for = -L, -B options") Signed-off-by: Quentin Monnet Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20211110114632.24537-5-quentin@isovalent.= com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/bpf/bpftool/Documentation/bpftool-btf.rst | 2 +- tools/bpf/bpftool/Documentation/bpftool-cgroup.rst | 2 +- tools/bpf/bpftool/Documentation/bpftool-gen.rst | 2 +- tools/bpf/bpftool/Documentation/bpftool-link.rst | 2 +- tools/bpf/bpftool/Documentation/bpftool-map.rst | 6 +++--- tools/bpf/bpftool/Documentation/bpftool-prog.rst | 8 ++++---- tools/bpf/bpftool/Documentation/bpftool.rst | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-) --- a/tools/bpf/bpftool/Documentation/bpftool-btf.rst +++ b/tools/bpf/bpftool/Documentation/bpftool-btf.rst @@ -13,7 +13,7 @@ SYNOPSIS **bpftool** [*OPTIONS*] **btf** *COMMAND* =20 *OPTIONS* :=3D { { **-j** | **--json** } [{ **-p** | **--pretty** }] | {*= *-d** | **--debug** } | - { **-B** | **--base-btf** } } + { **-B** | **--base-btf** } } =20 *COMMANDS* :=3D { **dump** | **help** } =20 --- a/tools/bpf/bpftool/Documentation/bpftool-cgroup.rst +++ b/tools/bpf/bpftool/Documentation/bpftool-cgroup.rst @@ -13,7 +13,7 @@ SYNOPSIS **bpftool** [*OPTIONS*] **cgroup** *COMMAND* =20 *OPTIONS* :=3D { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { = **-d** | **--debug** } | - { **-f** | **--bpffs** } } + { **-f** | **--bpffs** } } =20 *COMMANDS* :=3D { **show** | **list** | **tree** | **attach** | **detach** | **help** } --- a/tools/bpf/bpftool/Documentation/bpftool-gen.rst +++ b/tools/bpf/bpftool/Documentation/bpftool-gen.rst @@ -13,7 +13,7 @@ SYNOPSIS **bpftool** [*OPTIONS*] **gen** *COMMAND* =20 *OPTIONS* :=3D { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { = **-d** | **--debug** } | - { **-L** | **--use-loader** } } + { **-L** | **--use-loader** } } =20 *COMMAND* :=3D { **object** | **skeleton** | **help** } =20 --- a/tools/bpf/bpftool/Documentation/bpftool-link.rst +++ b/tools/bpf/bpftool/Documentation/bpftool-link.rst @@ -13,7 +13,7 @@ SYNOPSIS **bpftool** [*OPTIONS*] **link** *COMMAND* =20 *OPTIONS* :=3D { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { = **-d** | **--debug** } | - { **-f** | **--bpffs** } | { **-n** | **--nomount** } } + { **-f** | **--bpffs** } | { **-n** | **--nomount** } } =20 *COMMANDS* :=3D { **show** | **list** | **pin** | **help** } =20 --- a/tools/bpf/bpftool/Documentation/bpftool-map.rst +++ b/tools/bpf/bpftool/Documentation/bpftool-map.rst @@ -13,11 +13,11 @@ SYNOPSIS **bpftool** [*OPTIONS*] **map** *COMMAND* =20 *OPTIONS* :=3D { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { = **-d** | **--debug** } | - { **-f** | **--bpffs** } | { **-n** | **--nomount** } } + { **-f** | **--bpffs** } | { **-n** | **--nomount** } } =20 *COMMANDS* :=3D - { **show** | **list** | **create** | **dump** | **update** | **lookup** |= **getnext** - | **delete** | **pin** | **help** } + { **show** | **list** | **create** | **dump** | **update** | **lookup** |= **getnext** | + **delete** | **pin** | **help** } =20 MAP COMMANDS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst +++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst @@ -13,12 +13,12 @@ SYNOPSIS **bpftool** [*OPTIONS*] **prog** *COMMAND* =20 *OPTIONS* :=3D { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { = **-d** | **--debug** } | - { **-f** | **--bpffs** } | { **-m** | **--mapcompat** } | { **-n** | **-= -nomount** } | - { **-L** | **--use-loader** } } + { **-f** | **--bpffs** } | { **-m** | **--mapcompat** } | { **-n** | **--= nomount** } | + { **-L** | **--use-loader** } } =20 *COMMANDS* :=3D - { **show** | **list** | **dump xlated** | **dump jited** | **pin** | **lo= ad** - | **loadall** | **help** } + { **show** | **list** | **dump xlated** | **dump jited** | **pin** | **lo= ad** | + **loadall** | **help** } =20 PROG COMMANDS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- a/tools/bpf/bpftool/Documentation/bpftool.rst +++ b/tools/bpf/bpftool/Documentation/bpftool.rst @@ -19,14 +19,14 @@ SYNOPSIS *OBJECT* :=3D { **map** | **program** | **cgroup** | **perf** | **net** |= **feature** } =20 *OPTIONS* :=3D { { **-V** | **--version** } | - { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--deb= ug** } } + { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debu= g** } } =20 *MAP-COMMANDS* :=3D { **show** | **list** | **create** | **dump** | **update** | **lookup** |= **getnext** | - **delete** | **pin** | **event_pipe** | **help** } + **delete** | **pin** | **event_pipe** | **help** } =20 *PROG-COMMANDS* :=3D { **show** | **list** | **dump jited** | **dump xlat= ed** | **pin** | - **load** | **attach** | **detach** | **help** } + **load** | **attach** | **detach** | **help** } =20 *CGROUP-COMMANDS* :=3D { **show** | **list** | **attach** | **detach** | = **help** } =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF193C433F5 for ; Mon, 24 Jan 2022 22:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838506AbiAXWqn (ORCPT ); Mon, 24 Jan 2022 17:46:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59074 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457174AbiAXVlH (ORCPT ); Mon, 24 Jan 2022 16:41:07 -0500 Received: from smtp.kernel.org (relay.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 29D006151E; Mon, 24 Jan 2022 21:41:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3879EC340E4; Mon, 24 Jan 2022 21:41:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060466; bh=gZXY/vjiqQc7fhVYSbfkUerxw0714FNVQzxq8TQcFeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SpXQwbTL9v9pUkMYn52xWdtoYiyIgeYRBIRSIQ2xkur5+hp38X6HlYsEfWy/sTJNy NkNicLwdrTHV1l48mPTYVTqIrEwgRLyfoMmAiPl4GoTHddzgB1TF6dX0RmkDSZ5TST IpKmdQAHnRA66zW7gvY60c1uKsVh+sJCikmPtoEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+983941aa85af6ded1fd9@syzkaller.appspotmail.com, Andrii Nakryiko , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Alexei Starovoitov Subject: [PATCH 5.16 0940/1039] xdp: check prog type before updating BPF link Date: Mon, 24 Jan 2022 19:45:29 +0100 Message-Id: <20220124184156.881999296@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Toke H=C3=B8iland-J=C3=B8rgensen commit 382778edc8262b7535f00523e9eb22edba1b9816 upstream. The bpf_xdp_link_update() function didn't check the program type before updating the program, which made it possible to install any program type as an XDP program, which is obviously not good. Syzbot managed to trigger this by swapping in an LWT program on the XDP hook which would crash in a helper call. Fix this by adding a check and bailing out if the types don't match. Fixes: 026a4c28e1db ("bpf, xdp: Implement LINK_UPDATE for BPF XDP link") Reported-by: syzbot+983941aa85af6ded1fd9@syzkaller.appspotmail.com Acked-by: Andrii Nakryiko Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen Link: https://lore.kernel.org/r/20220107221115.326171-1-toke@redhat.com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/core/dev.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -9656,6 +9656,12 @@ static int bpf_xdp_link_update(struct bp goto out_unlock; } old_prog =3D link->prog; + if (old_prog->type !=3D new_prog->type || + old_prog->expected_attach_type !=3D new_prog->expected_attach_type) { + err =3D -EINVAL; + goto out_unlock; + } + if (old_prog =3D=3D new_prog) { /* no-op, don't disturb drivers */ bpf_prog_put(new_prog); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0F32C43217 for ; Mon, 24 Jan 2022 22:42:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836639AbiAXWk2 (ORCPT ); Mon, 24 Jan 2022 17:40:28 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59720 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457446AbiAXVlk (ORCPT ); Mon, 24 Jan 2022 16:41:40 -0500 Received: from smtp.kernel.org (relay.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 2A3AB61523; Mon, 24 Jan 2022 21:41:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04019C340E4; Mon, 24 Jan 2022 21:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060499; bh=alN1nGi9d01VTi67hSzdh6Vdn9Sl4cPFqezMOL+KxcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ymHtSzLFJxFp1ta+zgmHrQuy9wty/+BaYr93cGG+JgLCuhrj0bKjdXxYbux7RVKf8 PtEpgKweek7JTm38UhYOK4UwftFxqQvpo6VeZsg3R9uUskcX/egbx2u3p0av7bkxMN vXEwp+KYCDVLMTtahOMZ9bf9HOT7NG1Yb3Q7OMfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Borkmann , Yafang Shao , Christian Brauner , David Howells , Al Viro Subject: [PATCH 5.16 0941/1039] bpf: Fix mount source show for bpffs Date: Mon, 24 Jan 2022 19:45:30 +0100 Message-Id: <20220124184156.918367031@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yafang Shao commit 1e9d74660d4df625b0889e77018f9e94727ceacd upstream. We noticed our tc ebpf tools can't start after we upgrade our in-house kern= el version from 4.19 to 5.10. That is because of the behaviour change in bpffs caused by commit d2935de7e4fd ("vfs: Convert bpf to use the new mount API"). In our tc ebpf tools, we do strict environment check. If the environment is not matched, we won't allow to start the ebpf progs. One of the check is wh= ether bpffs is properly mounted. The mount information of bpffs in kernel-4.19 and kernel-5.10 are as follows: - kernel 4.19 $ mount -t bpf bpffs /sys/fs/bpf $ mount -t bpf bpffs on /sys/fs/bpf type bpf (rw,relatime) - kernel 5.10 $ mount -t bpf bpffs /sys/fs/bpf $ mount -t bpf none on /sys/fs/bpf type bpf (rw,relatime) The device name in kernel-5.10 is displayed as none instead of bpffs, then = our environment check fails. Currently we modify the tools to adopt to the kern= el behaviour change, but I think we'd better change the kernel code to keep the behavior consistent. After this change, the mount information will be displayed the same with the behavior in kernel-4.19, for example: $ mount -t bpf bpffs /sys/fs/bpf $ mount -t bpf bpffs on /sys/fs/bpf type bpf (rw,relatime) Fixes: d2935de7e4fd ("vfs: Convert bpf to use the new mount API") Suggested-by: Daniel Borkmann Signed-off-by: Yafang Shao Signed-off-by: Daniel Borkmann Acked-by: Christian Brauner Cc: David Howells Cc: Al Viro Link: https://lore.kernel.org/bpf/20220108134623.32467-1-laoar.shao@gmail.c= om Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/bpf/inode.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/kernel/bpf/inode.c +++ b/kernel/bpf/inode.c @@ -648,12 +648,22 @@ static int bpf_parse_param(struct fs_con int opt; =20 opt =3D fs_parse(fc, bpf_fs_parameters, param, &result); - if (opt < 0) + if (opt < 0) { /* We might like to report bad mount options here, but * traditionally we've ignored all mount options, so we'd * better continue to ignore non-existing options for bpf. */ - return opt =3D=3D -ENOPARAM ? 0 : opt; + if (opt =3D=3D -ENOPARAM) { + opt =3D vfs_parse_fs_param_source(fc, param); + if (opt !=3D -ENOPARAM) + return opt; + + return 0; + } + + if (opt < 0) + return opt; + } =20 switch (opt) { case OPT_MODE: From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD399C433EF for ; Mon, 24 Jan 2022 22:42:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836868AbiAXWlF (ORCPT ); Mon, 24 Jan 2022 17:41:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60054 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457624AbiAXVl6 (ORCPT ); Mon, 24 Jan 2022 16:41:58 -0500 Received: from smtp.kernel.org (relay.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 1567F61320; Mon, 24 Jan 2022 21:41:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCEE6C340E4; Mon, 24 Jan 2022 21:41:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060517; bh=G9DGqFM3J6+IZWyQueHkSzbTE2a7MnnhPz7w4RWVOFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dYi/gA8fAKu+CuU3AxAi8uUf2AxbxW/hvcahtnnN1vlZ5MXqYCVPzhkJN6tJ1kqGX 4AhVJrjkt3lC1qPosNo0Z1iUCKnCWOgmGy7EKAX76C52ObP4XhfiGYhW+P4JxIAEKb 4K1AR5jfby/RRxKZ1oSquR73UsaLG2zAM34p4LNg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Borkmann , John Fastabend , Alexei Starovoitov Subject: [PATCH 5.16 0942/1039] bpf: Mark PTR_TO_FUNC register initially with zero offset Date: Mon, 24 Jan 2022 19:45:31 +0100 Message-Id: <20220124184156.957782600@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Borkmann commit d400a6cf1c8a57cdf10f35220ead3284320d85ff upstream. Similar as with other pointer types where we use ldimm64, clear the register content to zero first, and then populate the PTR_TO_FUNC type and subprogno number. Currently this is not done, and leads to reuse of stale register tracking data. Given for special ldimm64 cases we always clear the register offset, make it common for all cases, so it won't be forgotten in future. Fixes: 69c087ba6225 ("bpf: Add bpf_for_each_map_elem() helper") Signed-off-by: Daniel Borkmann Acked-by: John Fastabend Acked-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/bpf/verifier.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -9389,9 +9389,13 @@ static int check_ld_imm(struct bpf_verif return 0; } =20 - if (insn->src_reg =3D=3D BPF_PSEUDO_BTF_ID) { - mark_reg_known_zero(env, regs, insn->dst_reg); + /* All special src_reg cases are listed below. From this point onwards + * we either succeed and assign a corresponding dst_reg->type after + * zeroing the offset, or fail and reject the program. + */ + mark_reg_known_zero(env, regs, insn->dst_reg); =20 + if (insn->src_reg =3D=3D BPF_PSEUDO_BTF_ID) { dst_reg->type =3D aux->btf_var.reg_type; switch (dst_reg->type) { case PTR_TO_MEM: @@ -9429,7 +9433,6 @@ static int check_ld_imm(struct bpf_verif } =20 map =3D env->used_maps[aux->map_index]; - mark_reg_known_zero(env, regs, insn->dst_reg); dst_reg->map_ptr =3D map; =20 if (insn->src_reg =3D=3D BPF_PSEUDO_MAP_VALUE || From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E9B9C4167B for ; Tue, 25 Jan 2022 01:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412913AbiAYAh7 (ORCPT ); Mon, 24 Jan 2022 19:37:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364073AbiAXXqo (ORCPT ); Mon, 24 Jan 2022 18:46:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C400C0613B2; Mon, 24 Jan 2022 13:42:01 -0800 (PST) Received: from smtp.kernel.org (relay.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 0C15F6150E; Mon, 24 Jan 2022 21:42:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0449C340E4; Mon, 24 Jan 2022 21:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060520; bh=bZB8LXzuRpRqd1OdmxiHwhFIwlaujiAsLxkUGVGfxqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nymYwyfvy6p62pEdV4oxB9yEl7aA72qMZTqyki7Vu8K9OL9yk8q8tieh5cGHg+hLD apqBqd6b25oesLzGaR9TW4ExBYCPIjDM/5xPaRWN1ZHyFAxMr09Xqm5Ym8AYzwvil3 +HdgwuNVxgtlVT6o4+0h3h9S3oxbsvBVRgJ5dFho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chase Conklin , German Gomez , Alexander Shishkin , Ian Rogers , Jiri Olsa , John Fastabend , KP Singh , Mark Rutland , Martin KaFai Lau , Namhyung Kim , Song Liu , Stephane Eranian , Yonghong Song , bpf@vger.kernel.org, netdev@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 5.16 0943/1039] perf evsel: Override attr->sample_period for non-libpfm4 events Date: Mon, 24 Jan 2022 19:45:32 +0100 Message-Id: <20220124184156.987692281@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: German Gomez commit 3606c0e1a1050d397ad759a62607e419fd8b0ccb upstream. A previous patch preventing "attr->sample_period" values from being overridden in pfm events changed a related behaviour in arm-spe. Before said patch: perf record -c 10000 -e arm_spe_0// -- sleep 1 Would yield an SPE event with period=3D10000. After the patch, the period in "-c 10000" was being ignored because the arm-spe code initializes sample_period to a non-zero value. This patch restores the previous behaviour for non-libpfm4 events. Fixes: ae5dcc8abe31 (=E2=80=9Cperf record: Prevent override of attr->sample= _period for libpfm4 events=E2=80=9D) Reported-by: Chase Conklin Signed-off-by: German Gomez Cc: Alexander Shishkin Cc: Ian Rogers Cc: Jiri Olsa Cc: John Fastabend Cc: KP Singh Cc: Mark Rutland Cc: Martin KaFai Lau Cc: Namhyung Kim Cc: Song Liu Cc: Stephane Eranian Cc: Yonghong Song Cc: bpf@vger.kernel.org Cc: netdev@vger.kernel.org Link: http://lore.kernel.org/lkml/20220118144054.2541-1-german.gomez@arm.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/perf/util/evsel.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1064,6 +1064,17 @@ void __weak arch_evsel__fixup_new_cycles { } =20 +static void evsel__set_default_freq_period(struct record_opts *opts, + struct perf_event_attr *attr) +{ + if (opts->freq) { + attr->freq =3D 1; + attr->sample_freq =3D opts->freq; + } else { + attr->sample_period =3D opts->default_interval; + } +} + /* * The enable_on_exec/disabled value strategy: * @@ -1130,14 +1141,12 @@ void evsel__config(struct evsel *evsel, * We default some events to have a default interval. But keep * it a weak assumption overridable by the user. */ - if (!attr->sample_period) { - if (opts->freq) { - attr->freq =3D 1; - attr->sample_freq =3D opts->freq; - } else { - attr->sample_period =3D opts->default_interval; - } - } + if ((evsel->is_libpfm_event && !attr->sample_period) || + (!evsel->is_libpfm_event && (!attr->sample_period || + opts->user_freq !=3D UINT_MAX || + opts->user_interval !=3D ULLONG_MAX))) + evsel__set_default_freq_period(opts, attr); + /* * If attr->freq was set (here or earlier), ask for period * to be sampled. From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C47BC433F5 for ; Mon, 24 Jan 2022 22:42:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836844AbiAXWk6 (ORCPT ); Mon, 24 Jan 2022 17:40:58 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60172 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457664AbiAXVmE (ORCPT ); Mon, 24 Jan 2022 16:42:04 -0500 Received: from smtp.kernel.org (relay.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 1E27D6150B; Mon, 24 Jan 2022 21:42:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1393C340E4; Mon, 24 Jan 2022 21:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060523; bh=ekvhrQOAS/MQjky6nakGfLKJtqZG6H3R4/eM51qJ2aw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CcPXzt7jKkle+gtVDQcbZSQFnpwce55GDHNST4BVsCktDiCoxWTUPQzmb6c/oLFhF /h5y6j8RtFjU0W5Y4vSyuDiZwbg2BKSVVLn83nSP0bDLGzdqSNSsBDOGHAndgBsGAJ lq/oaCH/BzmxG3zOCEtCNAtCrI8jtrYxA2yjZ39k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , syzbot , David Laight , Ido Schimmel , Jiri Pirko , Ido Schimmel , "David S. Miller" Subject: [PATCH 5.16 0944/1039] ipv4: update fib_info_cnt under spinlock protection Date: Mon, 24 Jan 2022 19:45:33 +0100 Message-Id: <20220124184157.026797303@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit 0a6e6b3c7db6c34e3d149f09cd714972f8753e3f upstream. In the past, free_fib_info() was supposed to be called under RTNL protection. This eventually was no longer the case. Instead of enforcing RTNL it seems we simply can move fib_info_cnt changes to occur when fib_info_lock is held. v2: David Laight suggested to update fib_info_cnt only when an entry is added/deleted to/from the hash table, as fib_info_cnt is used to make sure hash table size is optimal. BUG: KCSAN: data-race in fib_create_info / free_fib_info write to 0xffffffff86e243a0 of 4 bytes by task 26429 on cpu 0: fib_create_info+0xe78/0x3440 net/ipv4/fib_semantics.c:1428 fib_table_insert+0x148/0x10c0 net/ipv4/fib_trie.c:1224 fib_magic+0x195/0x1e0 net/ipv4/fib_frontend.c:1087 fib_add_ifaddr+0xd0/0x2e0 net/ipv4/fib_frontend.c:1109 fib_netdev_event+0x178/0x510 net/ipv4/fib_frontend.c:1466 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0x53/0xb0 kernel/notifier.c:391 __dev_notify_flags+0x1d3/0x3b0 dev_change_flags+0xa2/0xc0 net/core/dev.c:8872 do_setlink+0x810/0x2410 net/core/rtnetlink.c:2719 rtnl_group_changelink net/core/rtnetlink.c:3242 [inline] __rtnl_newlink net/core/rtnetlink.c:3396 [inline] rtnl_newlink+0xb10/0x13b0 net/core/rtnetlink.c:3506 rtnetlink_rcv_msg+0x745/0x7e0 net/core/rtnetlink.c:5571 netlink_rcv_skb+0x14e/0x250 net/netlink/af_netlink.c:2496 rtnetlink_rcv+0x18/0x20 net/core/rtnetlink.c:5589 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x5fc/0x6c0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x726/0x840 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2409 ___sys_sendmsg net/socket.c:2463 [inline] __sys_sendmsg+0x195/0x230 net/socket.c:2492 __do_sys_sendmsg net/socket.c:2501 [inline] __se_sys_sendmsg net/socket.c:2499 [inline] __x64_sys_sendmsg+0x42/0x50 net/socket.c:2499 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae read to 0xffffffff86e243a0 of 4 bytes by task 31505 on cpu 1: free_fib_info+0x35/0x80 net/ipv4/fib_semantics.c:252 fib_info_put include/net/ip_fib.h:575 [inline] nsim_fib4_rt_destroy drivers/net/netdevsim/fib.c:294 [inline] nsim_fib4_rt_replace drivers/net/netdevsim/fib.c:403 [inline] nsim_fib4_rt_insert drivers/net/netdevsim/fib.c:431 [inline] nsim_fib4_event drivers/net/netdevsim/fib.c:461 [inline] nsim_fib_event drivers/net/netdevsim/fib.c:881 [inline] nsim_fib_event_work+0x15ca/0x2cf0 drivers/net/netdevsim/fib.c:1477 process_one_work+0x3fc/0x980 kernel/workqueue.c:2298 process_scheduled_works kernel/workqueue.c:2361 [inline] worker_thread+0x7df/0xa70 kernel/workqueue.c:2447 kthread+0x2c7/0x2e0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 value changed: 0x00000d2d -> 0x00000d2e Reported by Kernel Concurrency Sanitizer on: CPU: 1 PID: 31505 Comm: kworker/1:21 Not tainted 5.16.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Goo= gle 01/01/2011 Workqueue: events nsim_fib_event_work Fixes: 48bb9eb47b27 ("netdevsim: fib: Add dummy implementation for FIB offl= oad") Signed-off-by: Eric Dumazet Reported-by: syzbot Cc: David Laight Cc: Ido Schimmel Cc: Jiri Pirko Reviewed-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/ipv4/fib_semantics.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -249,7 +249,6 @@ void free_fib_info(struct fib_info *fi) pr_warn("Freeing alive fib_info %p\n", fi); return; } - fib_info_cnt--; =20 call_rcu(&fi->rcu, free_fib_info_rcu); } @@ -260,6 +259,10 @@ void fib_release_info(struct fib_info *f spin_lock_bh(&fib_info_lock); if (fi && refcount_dec_and_test(&fi->fib_treeref)) { hlist_del(&fi->fib_hash); + + /* Paired with READ_ONCE() in fib_create_info(). */ + WRITE_ONCE(fib_info_cnt, fib_info_cnt - 1); + if (fi->fib_prefsrc) hlist_del(&fi->fib_lhash); if (fi->nh) { @@ -1430,7 +1433,9 @@ struct fib_info *fib_create_info(struct #endif =20 err =3D -ENOBUFS; - if (fib_info_cnt >=3D fib_info_hash_size) { + + /* Paired with WRITE_ONCE() in fib_release_info() */ + if (READ_ONCE(fib_info_cnt) >=3D fib_info_hash_size) { unsigned int new_size =3D fib_info_hash_size << 1; struct hlist_head *new_info_hash; struct hlist_head *new_laddrhash; @@ -1462,7 +1467,6 @@ struct fib_info *fib_create_info(struct return ERR_PTR(err); } =20 - fib_info_cnt++; fi->fib_net =3D net; fi->fib_protocol =3D cfg->fc_protocol; fi->fib_scope =3D cfg->fc_scope; @@ -1589,6 +1593,7 @@ link_it: refcount_set(&fi->fib_treeref, 1); refcount_set(&fi->fib_clntref, 1); spin_lock_bh(&fib_info_lock); + fib_info_cnt++; hlist_add_head(&fi->fib_hash, &fib_info_hash[fib_info_hashfn(fi)]); if (fi->fib_prefsrc) { From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7BAFC433F5 for ; Mon, 24 Jan 2022 22:42:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836825AbiAXWkz (ORCPT ); Mon, 24 Jan 2022 17:40:55 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60198 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457683AbiAXVmI (ORCPT ); Mon, 24 Jan 2022 16:42:08 -0500 Received: from smtp.kernel.org (relay.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 006B76150E; Mon, 24 Jan 2022 21:42:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F74DC340E4; Mon, 24 Jan 2022 21:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060526; bh=JR+CIPlwPm4CxYIFpJ+ZR7WBCsiaKJG3Bzl/6RlkOPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QtN0Cyto/FFNsImIHEEq8ymMMOeGg89PSrS8htN3KXvTPFrgcIwfEu5rY7HRjVlf9 xZJkhu35Yn2pasCcFwBov6BGLFwNlJ2ySod70YU9NyKLZl3fVxJSVCIldZJooqZ92K 6ss03ueZOMvfL4iBsItUdu5UIveDIbxL1XlCEr9Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , David Ahern , Jakub Kicinski Subject: [PATCH 5.16 0945/1039] ipv4: avoid quadratic behavior in netns dismantle Date: Mon, 24 Jan 2022 19:45:34 +0100 Message-Id: <20220124184157.064140950@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit d07418afea8f1d9896aaf9dc5ae47ac4f45b220c upstream. net/ipv4/fib_semantics.c uses an hash table of 256 slots, keyed by device ifindexes: fib_info_devhash[DEVINDEX_HASHSIZE] Problem is that with network namespaces, devices tend to use the same ifindex. lo device for instance has a fixed ifindex of one, for all network namespaces. This means that hosts with thousands of netns spend a lot of time looking at some hash buckets with thousands of elements, notably at netns dismantle. Simply add a per netns perturbation (net_hash_mix()) to spread elements more uniformely. Also change fib_devindex_hashfn() to use more entropy. Fixes: aa79e66eee5d ("net: Make ifindex generation per-net namespace") Signed-off-by: Eric Dumazet Reviewed-by: David Ahern Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/ipv4/fib_semantics.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -29,6 +29,7 @@ #include #include #include +#include =20 #include #include @@ -319,11 +320,15 @@ static inline int nh_comp(struct fib_inf =20 static inline unsigned int fib_devindex_hashfn(unsigned int val) { - unsigned int mask =3D DEVINDEX_HASHSIZE - 1; + return hash_32(val, DEVINDEX_HASHBITS); +} + +static struct hlist_head * +fib_info_devhash_bucket(const struct net_device *dev) +{ + u32 val =3D net_hash_mix(dev_net(dev)) ^ dev->ifindex; =20 - return (val ^ - (val >> DEVINDEX_HASHBITS) ^ - (val >> (DEVINDEX_HASHBITS * 2))) & mask; + return &fib_info_devhash[fib_devindex_hashfn(val)]; } =20 static unsigned int fib_info_hashfn_1(int init_val, u8 protocol, u8 scope, @@ -433,12 +438,11 @@ int ip_fib_check_default(__be32 gw, stru { struct hlist_head *head; struct fib_nh *nh; - unsigned int hash; =20 spin_lock(&fib_info_lock); =20 - hash =3D fib_devindex_hashfn(dev->ifindex); - head =3D &fib_info_devhash[hash]; + head =3D fib_info_devhash_bucket(dev); + hlist_for_each_entry(nh, head, nh_hash) { if (nh->fib_nh_dev =3D=3D dev && nh->fib_nh_gw4 =3D=3D gw && @@ -1607,12 +1611,10 @@ link_it: } else { change_nexthops(fi) { struct hlist_head *head; - unsigned int hash; =20 if (!nexthop_nh->fib_nh_dev) continue; - hash =3D fib_devindex_hashfn(nexthop_nh->fib_nh_dev->ifindex); - head =3D &fib_info_devhash[hash]; + head =3D fib_info_devhash_bucket(nexthop_nh->fib_nh_dev); hlist_add_head(&nexthop_nh->nh_hash, head); } endfor_nexthops(fi) } @@ -1964,8 +1966,7 @@ void fib_nhc_update_mtu(struct fib_nh_co =20 void fib_sync_mtu(struct net_device *dev, u32 orig_mtu) { - unsigned int hash =3D fib_devindex_hashfn(dev->ifindex); - struct hlist_head *head =3D &fib_info_devhash[hash]; + struct hlist_head *head =3D fib_info_devhash_bucket(dev); struct fib_nh *nh; =20 hlist_for_each_entry(nh, head, nh_hash) { @@ -1984,12 +1985,11 @@ void fib_sync_mtu(struct net_device *dev */ int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool fo= rce) { - int ret =3D 0; - int scope =3D RT_SCOPE_NOWHERE; + struct hlist_head *head =3D fib_info_devhash_bucket(dev); struct fib_info *prev_fi =3D NULL; - unsigned int hash =3D fib_devindex_hashfn(dev->ifindex); - struct hlist_head *head =3D &fib_info_devhash[hash]; + int scope =3D RT_SCOPE_NOWHERE; struct fib_nh *nh; + int ret =3D 0; =20 if (force) scope =3D -1; @@ -2134,7 +2134,6 @@ out: int fib_sync_up(struct net_device *dev, unsigned char nh_flags) { struct fib_info *prev_fi; - unsigned int hash; struct hlist_head *head; struct fib_nh *nh; int ret; @@ -2150,8 +2149,7 @@ int fib_sync_up(struct net_device *dev, } =20 prev_fi =3D NULL; - hash =3D fib_devindex_hashfn(dev->ifindex); - head =3D &fib_info_devhash[hash]; + head =3D fib_info_devhash_bucket(dev); ret =3D 0; =20 hlist_for_each_entry(nh, head, nh_hash) { From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 908FDC43219 for ; Tue, 25 Jan 2022 01:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412936AbiAYAiB (ORCPT ); Mon, 24 Jan 2022 19:38:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364075AbiAXXqo (ORCPT ); Mon, 24 Jan 2022 18:46:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69D12C061341; Mon, 24 Jan 2022 13:42:10 -0800 (PST) Received: from smtp.kernel.org (relay.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 0794161502; Mon, 24 Jan 2022 21:42:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1BA0C340E4; Mon, 24 Jan 2022 21:42:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060529; bh=3gCsW3Bzejtk0VzmibWuV4DlZ1YanDbwS2MEgP2bdzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ANO0HvrLUVzHNLYlaAxKKFzMb5l21Yt3r5WYR3Rm4apozDZ3xIOWdOxe0B86Q60Ik o9kRAzmPR1eOsufLe+/Buk++nVC92baJcmoADiijk+s9HImv8RVX8sPm9uRSPK2Ffn ejucKZ0t+HxG9abW/4ap711yPKRwCwYbXCK3ExdE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Jakub Kicinski Subject: [PATCH 5.16 0946/1039] mlx5: Dont accidentally set RTO_ONLINK before mlx5e_route_lookup_ipv4_get() Date: Mon, 24 Jan 2022 19:45:35 +0100 Message-Id: <20220124184157.094780705@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guillaume Nault commit 48d67543e01d73292e0bb66d3f10fc422e79e031 upstream. Mask the ECN bits before calling mlx5e_route_lookup_ipv4_get(). The tunnel key might have the last ECN bit set. This interferes with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope). Found by code inspection, compile tested only. Fixes: c7b9038d8af6 ("net/mlx5e: TC preparation refactoring for routing upd= ate event") Fixes: 9a941117fb76 ("net/mlx5e: Maximize ip tunnel key usage on the TC off= loading path") Signed-off-by: Guillaume Nault Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 5 +++-- 1 file changed, 3 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 @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ /* Copyright (c) 2018 Mellanox Technologies. */ =20 +#include #include #include #include @@ -235,7 +236,7 @@ int mlx5e_tc_tun_create_header_ipv4(stru int err; =20 /* add the IP fields */ - attr.fl.fl4.flowi4_tos =3D tun_key->tos; + attr.fl.fl4.flowi4_tos =3D tun_key->tos & ~INET_ECN_MASK; attr.fl.fl4.daddr =3D tun_key->u.ipv4.dst; attr.fl.fl4.saddr =3D tun_key->u.ipv4.src; attr.ttl =3D tun_key->ttl; @@ -350,7 +351,7 @@ int mlx5e_tc_tun_update_header_ipv4(stru int err; =20 /* add the IP fields */ - attr.fl.fl4.flowi4_tos =3D tun_key->tos; + attr.fl.fl4.flowi4_tos =3D tun_key->tos & ~INET_ECN_MASK; attr.fl.fl4.daddr =3D tun_key->u.ipv4.dst; attr.fl.fl4.saddr =3D tun_key->u.ipv4.src; attr.ttl =3D tun_key->ttl; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57AB8C43217 for ; Tue, 25 Jan 2022 01:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412870AbiAYAh5 (ORCPT ); Mon, 24 Jan 2022 19:37:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364080AbiAXXqp (ORCPT ); Mon, 24 Jan 2022 18:46:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E366C061343; Mon, 24 Jan 2022 13:42:13 -0800 (PST) Received: from smtp.kernel.org (relay.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 D109C61525; Mon, 24 Jan 2022 21:42:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C81BCC340E4; Mon, 24 Jan 2022 21:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060532; bh=fMqlVqRgLmA4ReuZh+yK8Z44tWXTuoUX2Gh4m1hyshQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eeYzd6n16O0odMWFRbzHeDIUEuBmTObB4u1DwyOQsU+laH7Bu+KR8Q0LdpZacyhH+ +/9n7r6SlUs3uJQHRzcnTM9AHxX9YB6Mxz5M5wwlkq6RQkVlomJvjQUvshtDjhSbL5 Y1N5CzoPIyXVrf74ygWsilq2DE/KjrLaaNqUcTqA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tobias Waldekranz , Andrew Lunn , Jakub Kicinski Subject: [PATCH 5.16 0947/1039] net/fsl: xgmac_mdio: Add workaround for erratum A-009885 Date: Mon, 24 Jan 2022 19:45:36 +0100 Message-Id: <20220124184157.125419120@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tobias Waldekranz commit 6198c722019774d38018457a8bfb9ba3ed8c931e upstream. Once an MDIO read transaction is initiated, we must read back the data register within 16 MDC cycles after the transaction completes. Outside of this window, reads may return corrupt data. Therefore, disable local interrupts in the critical section, to maximize the probability that we can satisfy this requirement. Fixes: d55ad2967d89 ("powerpc/mpc85xx: Create dts components for the FSL Qo= rIQ DPAA FMan") Signed-off-by: Tobias Waldekranz Reviewed-by: Andrew Lunn Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/freescale/xgmac_mdio.c | 25 +++++++++++++++++++----= -- 1 file changed, 19 insertions(+), 6 deletions(-) --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -51,6 +51,7 @@ struct tgec_mdio_controller { struct mdio_fsl_priv { struct tgec_mdio_controller __iomem *mdio_base; bool is_little_endian; + bool has_a009885; bool has_a011043; }; =20 @@ -186,10 +187,10 @@ static int xgmac_mdio_read(struct mii_bu { struct mdio_fsl_priv *priv =3D (struct mdio_fsl_priv *)bus->priv; struct tgec_mdio_controller __iomem *regs =3D priv->mdio_base; + unsigned long flags; uint16_t dev_addr; uint32_t mdio_stat; uint32_t mdio_ctl; - uint16_t value; int ret; bool endian =3D priv->is_little_endian; =20 @@ -221,12 +222,18 @@ static int xgmac_mdio_read(struct mii_bu return ret; } =20 + if (priv->has_a009885) + /* Once the operation completes, i.e. MDIO_STAT_BSY clears, we + * must read back the data register within 16 MDC cycles. + */ + local_irq_save(flags); + /* Initiate the read */ xgmac_write32(mdio_ctl | MDIO_CTL_READ, ®s->mdio_ctl, endian); =20 ret =3D xgmac_wait_until_done(&bus->dev, regs, endian); if (ret) - return ret; + goto irq_restore; =20 /* Return all Fs if nothing was there */ if ((xgmac_read32(®s->mdio_stat, endian) & MDIO_STAT_RD_ER) && @@ -234,13 +241,17 @@ static int xgmac_mdio_read(struct mii_bu dev_dbg(&bus->dev, "Error while reading PHY%d reg at %d.%hhu\n", phy_id, dev_addr, regnum); - return 0xffff; + ret =3D 0xffff; + } else { + ret =3D xgmac_read32(®s->mdio_data, endian) & 0xffff; + dev_dbg(&bus->dev, "read %04x\n", ret); } =20 - value =3D xgmac_read32(®s->mdio_data, endian) & 0xffff; - dev_dbg(&bus->dev, "read %04x\n", value); +irq_restore: + if (priv->has_a009885) + local_irq_restore(flags); =20 - return value; + return ret; } =20 static int xgmac_mdio_probe(struct platform_device *pdev) @@ -287,6 +298,8 @@ static int xgmac_mdio_probe(struct platf priv->is_little_endian =3D device_property_read_bool(&pdev->dev, "little-endian"); =20 + priv->has_a009885 =3D device_property_read_bool(&pdev->dev, + "fsl,erratum-a009885"); priv->has_a011043 =3D device_property_read_bool(&pdev->dev, "fsl,erratum-a011043"); =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 017D5C433FE for ; Mon, 24 Jan 2022 22:41:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835646AbiAXWhF (ORCPT ); Mon, 24 Jan 2022 17:37:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58780 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456978AbiAXVki (ORCPT ); Mon, 24 Jan 2022 16:40:38 -0500 Received: from smtp.kernel.org (relay.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 A68686146A; Mon, 24 Jan 2022 21:40:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 707C8C340E4; Mon, 24 Jan 2022 21:40:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060437; bh=y08BoJsvT23llfRHmxQAYEFNIoccmXlZdRTEGoZXIFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ie96XdMQ08jK0+N3kPicPgaMJxrWeGGNi3ub5E5iI7IyNxTafQkv8n3wDNgPTfLer endsri4wfhmc/LgqMiqb5vFI+23fs4cA4V+Mv0In0dlpJKHn/JyW9PH6ePwFOC/1E0 Fm9Uf+TJMk/kfzn1wdqyIxiDUbUVFNhPjXQ6APX4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tobias Waldekranz , Andrew Lunn , Jakub Kicinski Subject: [PATCH 5.16 0948/1039] net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module Date: Mon, 24 Jan 2022 19:45:37 +0100 Message-Id: <20220124184157.157800630@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tobias Waldekranz commit 3f7c239c7844d2044ed399399d97a5f1c6008e1b upstream. As reported by sparse: In the remove path, the driver would attempt to unmap its own priv pointer - instead of the io memory that it mapped in probe. Fixes: 9f35a7342cff ("net/fsl: introduce Freescale 10G MDIO driver") Signed-off-by: Tobias Waldekranz Reviewed-by: Andrew Lunn Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/freescale/xgmac_mdio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -331,9 +331,10 @@ err_ioremap: static int xgmac_mdio_remove(struct platform_device *pdev) { struct mii_bus *bus =3D platform_get_drvdata(pdev); + struct mdio_fsl_priv *priv =3D bus->priv; =20 mdiobus_unregister(bus); - iounmap(bus->priv); + iounmap(priv->mdio_base); mdiobus_free(bus); =20 return 0; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30190C3525A for ; Mon, 24 Jan 2022 22:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838099AbiAXWpx (ORCPT ); Mon, 24 Jan 2022 17:45:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51662 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457005AbiAXVkn (ORCPT ); Mon, 24 Jan 2022 16:40:43 -0500 Received: from smtp.kernel.org (relay.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 4BF7DB80CCF; Mon, 24 Jan 2022 21:40:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73803C340E4; Mon, 24 Jan 2022 21:40:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060440; bh=x1ittnNsJWwt1zDpNreQd8A+qpmVXaypmHKKZugegkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bh6g7Swy7+QKD5BvqGnelkT4dWbxl1tArGk37YWxFkrrzccW0ebvR2BSoraRx2xiy jzD6Nt/JVdVOIHz43A71pudtjQZpL+Xey0B+Ej4MX/l2K090bIG5khl3U2LKBI24Os xdt69CRnriyXuRkUjQ/3+hFsvKOpdNH/L7rmb7I4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Helge Deller Subject: [PATCH 5.16 0949/1039] parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries Date: Mon, 24 Jan 2022 19:45:38 +0100 Message-Id: <20220124184157.188315636@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Miaoqian Lin commit d24846a4246b6e61ecbd036880a4adf61681d241 upstream. kobject_init_and_add() takes reference even when it fails. According to the doc of kobject_init_and_add()=EF=BC=9A If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object. Fix memory leak by calling kobject_put(). Fixes: 73f368cf679b ("Kobject: change drivers/parisc/pdc_stable.c to use ko= bject_init_and_add") Signed-off-by: Miaoqian Lin Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/parisc/pdc_stable.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -979,8 +979,10 @@ pdcs_register_pathentries(void) entry->kobj.kset =3D paths_kset; err =3D kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL, "%s", entry->name); - if (err) + if (err) { + kobject_put(&entry->kobj); return err; + } =20 /* kobject is now registered */ write_lock(&entry->rw_lock); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AF69C4332F for ; Mon, 24 Jan 2022 22:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838524AbiAXWqo (ORCPT ); Mon, 24 Jan 2022 17:46:44 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58842 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457024AbiAXVko (ORCPT ); Mon, 24 Jan 2022 16:40:44 -0500 Received: from smtp.kernel.org (relay.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 9D03061519; Mon, 24 Jan 2022 21:40:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72DA2C340E4; Mon, 24 Jan 2022 21:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060443; bh=m4BNfYQYC4dEYNrO6HUF/i8ht6RJdxFTmGaSFBrmAO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gd8LoQLJVHvw6TgNDOjI/is9zJypsvjTi0Wg4/1Q2IJDQxIjb/NIhX7f25F68RtEY IpbX5hknXv90D9GOphjTqf2bSUxITuL/ttapBSEn9aOYJIu06khgSmOIx5M2my+I/+ PwmT54Ljp2a8KmPLCnqqCMY5nxzRQxMs9dk8ivvg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anup Patel , Palmer Dabbelt Subject: [PATCH 5.16 0950/1039] RISC-V: defconfigs: Set CONFIG_FB=y, for FB console Date: Mon, 24 Jan 2022 19:45:39 +0100 Message-Id: <20220124184157.220884764@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Palmer Dabbelt commit 3d12b634fe8206ea974c6061a3f3eea529ffbc48 upstream. We have CONFIG_FRAMEBUFFER_CONSOLE=3Dy in the defconfigs, but that depends on CONFIG_FB so it's not actually getting set. I'm assuming most users on real systems want a framebuffer console, so this enables CONFIG_FB to allow that to take effect. Fixes: 33c57c0d3c67 ("RISC-V: Add a basic defconfig") Reviewed-by: Anup Patel Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/configs/defconfig | 1 + arch/riscv/configs/rv32_defconfig | 1 + 2 files changed, 2 insertions(+) --- a/arch/riscv/configs/defconfig +++ b/arch/riscv/configs/defconfig @@ -78,6 +78,7 @@ CONFIG_DRM=3Dm CONFIG_DRM_RADEON=3Dm CONFIG_DRM_NOUVEAU=3Dm CONFIG_DRM_VIRTIO_GPU=3Dm +CONFIG_FB=3Dy CONFIG_FRAMEBUFFER_CONSOLE=3Dy CONFIG_USB=3Dy CONFIG_USB_XHCI_HCD=3Dy --- a/arch/riscv/configs/rv32_defconfig +++ b/arch/riscv/configs/rv32_defconfig @@ -73,6 +73,7 @@ CONFIG_POWER_RESET=3Dy CONFIG_DRM=3Dy CONFIG_DRM_RADEON=3Dy CONFIG_DRM_VIRTIO_GPU=3Dy +CONFIG_FB=3Dy CONFIG_FRAMEBUFFER_CONSOLE=3Dy CONFIG_USB=3Dy CONFIG_USB_XHCI_HCD=3Dy From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47EAEC46467 for ; Mon, 24 Jan 2022 22:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838122AbiAXWpy (ORCPT ); Mon, 24 Jan 2022 17:45:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58872 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457043AbiAXVkr (ORCPT ); Mon, 24 Jan 2022 16:40:47 -0500 Received: from smtp.kernel.org (relay.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 AE6836150C; Mon, 24 Jan 2022 21:40:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8340EC340E5; Mon, 24 Jan 2022 21:40:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060446; bh=waB+9LUVqnckRupSe5o4AhePh0a/nlEjGKrVjtO3D4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sr4q5+2MEXM8YEePp/OcKga3dmCWG0JSBPVtHZoDznXVfq+nRYz8yH/Gfo5xqUjID TEeqE3CdoODsUK8bcOqKsq6WxzfBoA49wdR6iJN2LPUB5s4JtNWfXEWkOKofz0oscU e/AgqlJZYnfVOcOAeFIxW3lpVBKZFs05MXC8jKMQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Conor Dooley , Krzysztof Kozlowski , Palmer Dabbelt Subject: [PATCH 5.16 0951/1039] riscv: dts: microchip: mpfs: Drop empty chosen node Date: Mon, 24 Jan 2022 19:45:40 +0100 Message-Id: <20220124184157.255161107@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 53ef07326ad0d6ae7fefded22bc53b427d542761 upstream. It does not make sense to have an (empty) chosen node in an SoC-specific .dtsi, as chosen is meant for system-specific configuration. It is already provided in microchip-mpfs-icicle-kit.dts anyway. Fixes: 0fa6107eca4186ad ("RISC-V: Initial DTS for Microchip ICICLE board") Signed-off-by: Geert Uytterhoeven Reviewed-by: Conor Dooley Tested-by: Conor Dooley Reviewed-by: Krzysztof Kozlowski Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi | 3 --- 1 file changed, 3 deletions(-) --- a/arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi +++ b/arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi @@ -9,9 +9,6 @@ model =3D "Microchip PolarFire SoC"; compatible =3D "microchip,mpfs"; =20 - chosen { - }; - cpus { #address-cells =3D <1>; #size-cells =3D <0>; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45DF3C46467 for ; Tue, 25 Jan 2022 01:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413076AbiAYAiR (ORCPT ); Mon, 24 Jan 2022 19:38:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363954AbiAXXq1 (ORCPT ); Mon, 24 Jan 2022 18:46:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B815C0BD130; Mon, 24 Jan 2022 13:40:51 -0800 (PST) Received: from smtp.kernel.org (relay.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 57F2FB81142; Mon, 24 Jan 2022 21:40:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F90FC340E7; Mon, 24 Jan 2022 21:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060449; bh=+BUX2ce92f50v3eT6BDPKhljeKXX+4pxIuGRPS/+NDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=biEKpIVoeraIRuB0HWO5tkozG9BWf3L1wwxggc/IORlk/XdkFr+uGCTJVOey36kt3 BFIhRGHMQ8yOV7tp1NeDApATP+O9HsSE1O2IZEZkeCmjP31qY6rhUPmL8Dp15m6nVa reW84Xev46/F7Kz8qSaQd37rIJZZvLXE+h9RP6U8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zack Rusin , Jason Gunthorpe , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , =?UTF-8?q?Christian=20K=C3=B6nig?= , Daniel Vetter , Martin Krastev , Maaz Mombasawala , Thomas Zimmermann Subject: [PATCH 5.16 0952/1039] drm/vmwgfx: Remove explicit transparent hugepages support Date: Mon, 24 Jan 2022 19:45:41 +0100 Message-Id: <20220124184157.286756514@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Zack Rusin commit bc701a28c74e78d7b5aa2b8628cb3608d4785d14 upstream. Old versions of the svga device used to export virtual vram, handling of which was optimized on top of transparent hugepages support. Only very old devices (OpenGL 2.1 support and earlier) used this code and at this point performance differences are negligible. Because the code requires very old hardware versions to run it has been largely untested and unused for a long time. Furthermore removal of the ttm hugepages support in: commit 0d979509539e ("drm/ttm: remove ttm_bo_vm_insert_huge()") broke the coherency mode in vmwgfx when running with hugepages. Fixes: 0d979509539e ("drm/ttm: remove ttm_bo_vm_insert_huge()") Signed-off-by: Zack Rusin Cc: Jason Gunthorpe Cc: Thomas Hellstr=C3=B6m Cc: Christian K=C3=B6nig Cc: Daniel Vetter Reviewed-by: Martin Krastev Reviewed-by: Maaz Mombasawala Link: https://patchwork.freedesktop.org/patch/msgid/20211215184147.3688785-= 2-zack@kde.org (cherry picked from commit 49d535d64d52945e2c874f380705675e20a02b6a) Signed-off-by: Thomas Zimmermann Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vmwgfx/Makefile | 1=20 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 8 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 5=20 drivers/gpu/drm/vmwgfx/vmwgfx_thp.c | 184 -------------------------------= ----- 4 files changed, 198 deletions(-) delete mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_thp.c --- a/drivers/gpu/drm/vmwgfx/Makefile +++ b/drivers/gpu/drm/vmwgfx/Makefile @@ -12,6 +12,5 @@ vmwgfx-y :=3D vmwgfx_execbuf.o vmwgfx_gmr. vmwgfx_devcaps.o ttm_object.o ttm_memory.o vmwgfx_system_manager.o =20 vmwgfx-$(CONFIG_DRM_FBDEV_EMULATION) +=3D vmwgfx_fb.o -vmwgfx-$(CONFIG_TRANSPARENT_HUGEPAGE) +=3D vmwgfx_thp.o =20 obj-$(CONFIG_DRM_VMWGFX) :=3D vmwgfx.o --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -707,23 +707,15 @@ static int vmw_dma_masks(struct vmw_priv static int vmw_vram_manager_init(struct vmw_private *dev_priv) { int ret; -#ifdef CONFIG_TRANSPARENT_HUGEPAGE - ret =3D vmw_thp_init(dev_priv); -#else ret =3D ttm_range_man_init(&dev_priv->bdev, TTM_PL_VRAM, false, dev_priv->vram_size >> PAGE_SHIFT); -#endif ttm_resource_manager_set_used(ttm_manager_type(&dev_priv->bdev, TTM_PL_VR= AM), false); return ret; } =20 static void vmw_vram_manager_fini(struct vmw_private *dev_priv) { -#ifdef CONFIG_TRANSPARENT_HUGEPAGE - vmw_thp_fini(dev_priv); -#else ttm_range_man_fini(&dev_priv->bdev, TTM_PL_VRAM); -#endif } =20 static int vmw_setup_pci_resources(struct vmw_private *dev, --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h @@ -1557,11 +1557,6 @@ void vmw_bo_dirty_unmap(struct vmw_buffe vm_fault_t vmw_bo_vm_fault(struct vm_fault *vmf); vm_fault_t vmw_bo_vm_mkwrite(struct vm_fault *vmf); =20 -/* Transparent hugepage support - vmwgfx_thp.c */ -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -extern int vmw_thp_init(struct vmw_private *dev_priv); -void vmw_thp_fini(struct vmw_private *dev_priv); -#endif =20 /** * VMW_DEBUG_KMS - Debug output for kernel mode-setting --- a/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c +++ /dev/null @@ -1,184 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR MIT -/* - * Huge page-table-entry support for IO memory. - * - * Copyright (C) 2007-2019 Vmware, Inc. All rights reservedd. - */ -#include "vmwgfx_drv.h" -#include -#include -#include - -/** - * struct vmw_thp_manager - Range manager implementing huge page alignment - * - * @manager: TTM resource manager. - * @mm: The underlying range manager. Protected by @lock. - * @lock: Manager lock. - */ -struct vmw_thp_manager { - struct ttm_resource_manager manager; - struct drm_mm mm; - spinlock_t lock; -}; - -static struct vmw_thp_manager *to_thp_manager(struct ttm_resource_manager = *man) -{ - return container_of(man, struct vmw_thp_manager, manager); -} - -static const struct ttm_resource_manager_func vmw_thp_func; - -static int vmw_thp_insert_aligned(struct ttm_buffer_object *bo, - struct drm_mm *mm, struct drm_mm_node *node, - unsigned long align_pages, - const struct ttm_place *place, - struct ttm_resource *mem, - unsigned long lpfn, - enum drm_mm_insert_mode mode) -{ - if (align_pages >=3D bo->page_alignment && - (!bo->page_alignment || align_pages % bo->page_alignment =3D=3D 0)) { - return drm_mm_insert_node_in_range(mm, node, - mem->num_pages, - align_pages, 0, - place->fpfn, lpfn, mode); - } - - return -ENOSPC; -} - -static int vmw_thp_get_node(struct ttm_resource_manager *man, - struct ttm_buffer_object *bo, - const struct ttm_place *place, - struct ttm_resource **res) -{ - struct vmw_thp_manager *rman =3D to_thp_manager(man); - struct drm_mm *mm =3D &rman->mm; - struct ttm_range_mgr_node *node; - unsigned long align_pages; - unsigned long lpfn; - enum drm_mm_insert_mode mode =3D DRM_MM_INSERT_BEST; - int ret; - - node =3D kzalloc(struct_size(node, mm_nodes, 1), GFP_KERNEL); - if (!node) - return -ENOMEM; - - ttm_resource_init(bo, place, &node->base); - - lpfn =3D place->lpfn; - if (!lpfn) - lpfn =3D man->size; - - mode =3D DRM_MM_INSERT_BEST; - if (place->flags & TTM_PL_FLAG_TOPDOWN) - mode =3D DRM_MM_INSERT_HIGH; - - spin_lock(&rman->lock); - if (IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)) { - align_pages =3D (HPAGE_PUD_SIZE >> PAGE_SHIFT); - if (node->base.num_pages >=3D align_pages) { - ret =3D vmw_thp_insert_aligned(bo, mm, &node->mm_nodes[0], - align_pages, place, - &node->base, lpfn, mode); - if (!ret) - goto found_unlock; - } - } - - align_pages =3D (HPAGE_PMD_SIZE >> PAGE_SHIFT); - if (node->base.num_pages >=3D align_pages) { - ret =3D vmw_thp_insert_aligned(bo, mm, &node->mm_nodes[0], - align_pages, place, &node->base, - lpfn, mode); - if (!ret) - goto found_unlock; - } - - ret =3D drm_mm_insert_node_in_range(mm, &node->mm_nodes[0], - node->base.num_pages, - bo->page_alignment, 0, - place->fpfn, lpfn, mode); -found_unlock: - spin_unlock(&rman->lock); - - if (unlikely(ret)) { - kfree(node); - } else { - node->base.start =3D node->mm_nodes[0].start; - *res =3D &node->base; - } - - return ret; -} - -static void vmw_thp_put_node(struct ttm_resource_manager *man, - struct ttm_resource *res) -{ - struct ttm_range_mgr_node *node =3D to_ttm_range_mgr_node(res); - struct vmw_thp_manager *rman =3D to_thp_manager(man); - - spin_lock(&rman->lock); - drm_mm_remove_node(&node->mm_nodes[0]); - spin_unlock(&rman->lock); - - kfree(node); -} - -int vmw_thp_init(struct vmw_private *dev_priv) -{ - struct vmw_thp_manager *rman; - - rman =3D kzalloc(sizeof(*rman), GFP_KERNEL); - if (!rman) - return -ENOMEM; - - ttm_resource_manager_init(&rman->manager, - dev_priv->vram_size >> PAGE_SHIFT); - - rman->manager.func =3D &vmw_thp_func; - drm_mm_init(&rman->mm, 0, rman->manager.size); - spin_lock_init(&rman->lock); - - ttm_set_driver_manager(&dev_priv->bdev, TTM_PL_VRAM, &rman->manager); - ttm_resource_manager_set_used(&rman->manager, true); - return 0; -} - -void vmw_thp_fini(struct vmw_private *dev_priv) -{ - struct ttm_resource_manager *man =3D ttm_manager_type(&dev_priv->bdev, TT= M_PL_VRAM); - struct vmw_thp_manager *rman =3D to_thp_manager(man); - struct drm_mm *mm =3D &rman->mm; - int ret; - - ttm_resource_manager_set_used(man, false); - - ret =3D ttm_resource_manager_evict_all(&dev_priv->bdev, man); - if (ret) - return; - spin_lock(&rman->lock); - drm_mm_clean(mm); - drm_mm_takedown(mm); - spin_unlock(&rman->lock); - ttm_resource_manager_cleanup(man); - ttm_set_driver_manager(&dev_priv->bdev, TTM_PL_VRAM, NULL); - kfree(rman); -} - -static void vmw_thp_debug(struct ttm_resource_manager *man, - struct drm_printer *printer) -{ - struct vmw_thp_manager *rman =3D to_thp_manager(man); - - spin_lock(&rman->lock); - drm_mm_print(&rman->mm, printer); - spin_unlock(&rman->lock); -} - -static const struct ttm_resource_manager_func vmw_thp_func =3D { - .alloc =3D vmw_thp_get_node, - .free =3D vmw_thp_put_node, - .debug =3D vmw_thp_debug -}; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD727C4167E for ; Mon, 24 Jan 2022 22:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1449475AbiAXWrZ (ORCPT ); Mon, 24 Jan 2022 17:47:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50594 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457082AbiAXVky (ORCPT ); Mon, 24 Jan 2022 16:40:54 -0500 Received: from smtp.kernel.org (relay.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 4723BB81142; Mon, 24 Jan 2022 21:40:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C79AC340E4; Mon, 24 Jan 2022 21:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060452; bh=RCV48ZSlTzuCqmHvJn71DlSzI5sKqDQyg1UX/Fny5Jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cJ9Dv7h7XZRNywSIHsHCGsuakQYS1PrxWt4Xi1qncrhJhKIWspWpFQzrRY2iCM0aN WPIgt4WLvhpNfYZ2onJcdq7LgPUcrMK4f88t4mLJsrudlgQavBYkWIM5oQX2nmmTmY qCGwJL/XHWN51mNKeDCR1KllTjLHbL6XLO6qP/SU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zack Rusin , Martin Krastev , Thomas Zimmermann Subject: [PATCH 5.16 0953/1039] drm/vmwgfx: Remove unused compile options Date: Mon, 24 Jan 2022 19:45:42 +0100 Message-Id: <20220124184157.318282671@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zack Rusin commit 50ca8cc7c0fdd9ab16b8b66ffb301fface101fac upstream. Before the driver had screen targets support we had to disable explicit bringup of its infrastructure because it was breaking screen objects support. Since the implementation of screen targets landed there hasn't been a reason to explicitly disable it and the options were never used. Remove of all that unused code. Signed-off-by: Zack Rusin Fixes: d80efd5cb3de ("drm/vmwgfx: Initial DX support") Reviewed-by: Martin Krastev Link: https://patchwork.freedesktop.org/patch/msgid/20211215184147.3688785-= 3-zack@kde.org (cherry picked from commit 11343099d5ae6c7411da1425b6b162c89fb5bf10) Signed-off-by: Thomas Zimmermann Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 12 +++--------- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 ++-- 3 files changed, 5 insertions(+), 14 deletions(-) --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h @@ -59,11 +59,8 @@ #define VMWGFX_DRIVER_MINOR 19 #define VMWGFX_DRIVER_PATCHLEVEL 0 #define VMWGFX_FIFO_STATIC_SIZE (1024*1024) -#define VMWGFX_MAX_RELOCATIONS 2048 -#define VMWGFX_MAX_VALIDATIONS 2048 #define VMWGFX_MAX_DISPLAYS 16 #define VMWGFX_CMD_BOUNCE_INIT_SIZE 32768 -#define VMWGFX_ENABLE_SCREEN_TARGET_OTABLE 1 =20 #define VMWGFX_PCI_ID_SVGA2 0x0405 #define VMWGFX_PCI_ID_SVGA3 0x0406 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 OR MIT /************************************************************************** * - * Copyright 2012-2015 VMware, Inc., Palo Alto, CA., USA + * Copyright 2012-2021 VMware, Inc., Palo Alto, CA., USA * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the @@ -29,12 +29,6 @@ =20 #include "vmwgfx_drv.h" =20 -/* - * If we set up the screen target otable, screen objects stop working. - */ - -#define VMW_OTABLE_SETUP_SUB ((VMWGFX_ENABLE_SCREEN_TARGET_OTABLE ? 0 : 1)) - #ifdef CONFIG_64BIT #define VMW_PPN_SIZE 8 #define VMW_MOBFMT_PTDEPTH_0 SVGA3D_MOBFMT_PT64_0 @@ -75,7 +69,7 @@ static const struct vmw_otable pre_dx_ta {VMWGFX_NUM_GB_CONTEXT * sizeof(SVGAOTableContextEntry), NULL, true}, {VMWGFX_NUM_GB_SHADER * sizeof(SVGAOTableShaderEntry), NULL, true}, {VMWGFX_NUM_GB_SCREEN_TARGET * sizeof(SVGAOTableScreenTargetEntry), - NULL, VMWGFX_ENABLE_SCREEN_TARGET_OTABLE} + NULL, true} }; =20 static const struct vmw_otable dx_tables[] =3D { @@ -84,7 +78,7 @@ static const struct vmw_otable dx_tables {VMWGFX_NUM_GB_CONTEXT * sizeof(SVGAOTableContextEntry), NULL, true}, {VMWGFX_NUM_GB_SHADER * sizeof(SVGAOTableShaderEntry), NULL, true}, {VMWGFX_NUM_GB_SCREEN_TARGET * sizeof(SVGAOTableScreenTargetEntry), - NULL, VMWGFX_ENABLE_SCREEN_TARGET_OTABLE}, + NULL, true}, {VMWGFX_NUM_DXCONTEXT * sizeof(SVGAOTableDXContextEntry), NULL, true}, }; =20 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c @@ -1872,8 +1872,8 @@ int vmw_kms_stdu_init_display(struct vmw int i, ret; =20 =20 - /* Do nothing if Screen Target support is turned off */ - if (!VMWGFX_ENABLE_SCREEN_TARGET_OTABLE || !dev_priv->has_mob) + /* Do nothing if there's no support for MOBs */ + if (!dev_priv->has_mob) return -ENOSYS; =20 if (!(dev_priv->capabilities & SVGA_CAP_GBOBJECTS)) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52266C43217 for ; Mon, 24 Jan 2022 22:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838543AbiAXWqr (ORCPT ); Mon, 24 Jan 2022 17:46:47 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58950 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457107AbiAXVk4 (ORCPT ); Mon, 24 Jan 2022 16:40:56 -0500 Received: from smtp.kernel.org (relay.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 7EAFE61520; Mon, 24 Jan 2022 21:40:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F33DC340E4; Mon, 24 Jan 2022 21:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060454; bh=bA2NVkNRdfsC9+kYNk0cI6zBu7bM2DrL1aL/zdydw6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2mDkXYxnyETnsdBw8AXCEXW5ryjJ2yJwRgeDaHYyT2Vnro/9XtmKcatE4cTOVw4ur claEytLSE5YhOcIom6EFQqztk1wvpmHmg6nXqLIFZBkgD+E2WTl8s5DvOKtcfgVqKd yda34lqzuAyknNIWti4OgqNuSQtGT3AgCiKF2x1k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fengnan Chang , Chao Yu , Jaegeuk Kim Subject: [PATCH 5.16 0954/1039] f2fs: fix remove page failed in invalidate compress pages Date: Mon, 24 Jan 2022 19:45:43 +0100 Message-Id: <20220124184157.355359360@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fengnan Chang commit d1917865a7906baf6b687e15e8e6195a295a3992 upstream. Since compress inode not a regular file, generic_error_remove_page in f2fs_invalidate_compress_pages will always be failed, set compress inode as a regular file to fix it. Fixes: 6ce19aff0b8c ("f2fs: compress: add compress_inode to cache compresse= d blocks") Signed-off-by: Fengnan Chang Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/f2fs/inode.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -516,6 +516,11 @@ make_now: } else if (ino =3D=3D F2FS_COMPRESS_INO(sbi)) { #ifdef CONFIG_F2FS_FS_COMPRESSION inode->i_mapping->a_ops =3D &f2fs_compress_aops; + /* + * generic_error_remove_page only truncates pages of regular + * inode + */ + inode->i_mode |=3D S_IFREG; #endif mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS | __GFP_HIGHMEM | __GFP_MOVABLE); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F2DDC433F5 for ; Tue, 25 Jan 2022 01:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413595AbiAYAj0 (ORCPT ); Mon, 24 Jan 2022 19:39:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363961AbiAXXq1 (ORCPT ); Mon, 24 Jan 2022 18:46:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 822B5C0BD131; Mon, 24 Jan 2022 13:41:00 -0800 (PST) Received: from smtp.kernel.org (relay.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 3EFF6B811FC; Mon, 24 Jan 2022 21:40:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 689E9C340E4; Mon, 24 Jan 2022 21:40:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060458; bh=W4KbRk8KStS1Cen/vo17BeVo9TAlDXgRj6zyPHssjsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IULL+BMIOO6KI6SZghSCPjxYpWi9X2NXs1d5xCABRSL2ZrveHnc+8tJZhDOjAY+Fe u8rj6JbVsy2jD1J5fc9EwwnqCaL0VYZ1y4XTMPKGkGuhAyC7JsQ5JMyj/DUPLnsV9Y vMhhYZnmpaAGrHlKSIlXS2yU1z2dfVEk11v9l/L4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 5.16 0955/1039] f2fs: fix to avoid panic in is_alive() if metadata is inconsistent Date: Mon, 24 Jan 2022 19:45:44 +0100 Message-Id: <20220124184157.388411875@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit f6db43076d190d9bf75559dec28e18b9d12e4ce5 upstream. As report by Wenqing Liu in bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=3D215231 If we enable CONFIG_F2FS_CHECK_FS config, and with fuzzed image attached in above link, we will encounter panic when executing below script: 1. mkdir mnt 2. mount -t f2fs tmp1.img mnt 3. touch tmp F2FS-fs (loop11): mismatched blkaddr 5765 (source_blkaddr 1) in seg 3 kernel BUG at fs/f2fs/gc.c:1042! do_garbage_collect+0x90f/0xa80 [f2fs] f2fs_gc+0x294/0x12a0 [f2fs] f2fs_balance_fs+0x2c5/0x7d0 [f2fs] f2fs_create+0x239/0xd90 [f2fs] lookup_open+0x45e/0xa90 open_last_lookups+0x203/0x670 path_openat+0xae/0x490 do_filp_open+0xbc/0x160 do_sys_openat2+0x2f1/0x500 do_sys_open+0x5e/0xa0 __x64_sys_openat+0x28/0x40 Previously, f2fs tries to catch data inconcistency exception in between SSA and SIT table during GC, however once the exception is caught, it will call f2fs_bug_on to hang kernel, it's not needed, instead, let's set SBI_NEED_FSCK flag and skip migrating current block. Fixes: bbf9f7d90f21 ("f2fs: Fix indefinite loop in f2fs_gc()") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/f2fs/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1042,7 +1042,7 @@ static bool is_alive(struct f2fs_sb_info if (!test_and_set_bit(segno, SIT_I(sbi)->invalid_segmap)) { f2fs_err(sbi, "mismatched blkaddr %u (source_blkaddr %u) in seg %u", blkaddr, source_blkaddr, segno); - f2fs_bug_on(sbi, 1); + set_sbi_flag(sbi, SBI_NEED_FSCK); } } #endif From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FA0FC3526C for ; Tue, 25 Jan 2022 01:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413037AbiAYAiN (ORCPT ); Mon, 24 Jan 2022 19:38:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363957AbiAXXq1 (ORCPT ); Mon, 24 Jan 2022 18:46:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D63C8C0BD132; Mon, 24 Jan 2022 13:41:01 -0800 (PST) Received: from smtp.kernel.org (relay.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 73A4161491; Mon, 24 Jan 2022 21:41:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E9B3C340E4; Mon, 24 Jan 2022 21:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060460; bh=A8mCzVHjPZZwWQCBoyVgsJnoQV5scK0Tz7tQPUo1T9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sQINjDx5LpfX9FfSeocTwhfkvH8AtPsd+DR1SOP4Fj/oMQwWNhmVaoFBpLHHMYyiK AtRqhRM4d0abwxqp8CSmc8rpMbn5EjdH8Fy7LOMSUYfzFlss8frDDaCzvIGFCwjphZ chZlK71J26Pd7rdA2sYbLsG2gIJ6wgUfc3CB/zfw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyeong-Jun Kim , Sungjong Seo , Youngjin Gil , Chao Yu , Jaegeuk Kim Subject: [PATCH 5.16 0956/1039] f2fs: compress: fix potential deadlock of compress file Date: Mon, 24 Jan 2022 19:45:45 +0100 Message-Id: <20220124184157.419187208@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hyeong-Jun Kim commit 7377e853967ba45bf409e3b5536624d2cbc99f21 upstream. There is a potential deadlock between writeback process and a process performing write_begin() or write_cache_pages() while trying to write same compress file, but not compressable, as below: [Process A] - doing checkpoint [Process B] [Process C] f2fs_write_cache_pages() - lock_page() [all pages in cluster, 0-31] - f2fs_write_multi_pages() - f2fs_write_raw_pages() - f2fs_write_single_data_page() - f2fs_do_write_data_page() - return -EAGAIN [f2fs_trylock_op() failed] - unlock_page(page) [e.g., page 0] - generic_perform_write() - f2fs_write_begin() - f2fs_prepare_compress_overwrite() - prepare_compress_overwrite() - lock_page() [e.g., page 0] - lock_page() [e.g., page 1] - lock_page(page) [e.g., page 0] Since there is no compress process, it is no longer necessary to hold locks on every pages in cluster within f2fs_write_raw_pages(). This patch changes f2fs_write_raw_pages() to release all locks first and then perform write same as the non-compress file in f2fs_write_cache_pages(). Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Hyeong-Jun Kim Signed-off-by: Sungjong Seo Signed-off-by: Youngjin Gil Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/f2fs/compress.c | 50 ++++++++++++++++++++++--------------------------= -- 1 file changed, 22 insertions(+), 28 deletions(-) --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1468,25 +1468,38 @@ static int f2fs_write_raw_pages(struct c enum iostat_type io_type) { struct address_space *mapping =3D cc->inode->i_mapping; - int _submitted, compr_blocks, ret; - int i =3D -1, err =3D 0; + int _submitted, compr_blocks, ret, i; =20 compr_blocks =3D f2fs_compressed_blocks(cc); - if (compr_blocks < 0) { - err =3D compr_blocks; - goto out_err; + + for (i =3D 0; i < cc->cluster_size; i++) { + if (!cc->rpages[i]) + continue; + + redirty_page_for_writepage(wbc, cc->rpages[i]); + unlock_page(cc->rpages[i]); } =20 + if (compr_blocks < 0) + return compr_blocks; + for (i =3D 0; i < cc->cluster_size; i++) { if (!cc->rpages[i]) continue; retry_write: + lock_page(cc->rpages[i]); + if (cc->rpages[i]->mapping !=3D mapping) { +continue_unlock: unlock_page(cc->rpages[i]); continue; } =20 - BUG_ON(!PageLocked(cc->rpages[i])); + if (!PageDirty(cc->rpages[i])) + goto continue_unlock; + + if (!clear_page_dirty_for_io(cc->rpages[i])) + goto continue_unlock; =20 ret =3D f2fs_write_single_data_page(cc->rpages[i], &_submitted, NULL, NULL, wbc, io_type, @@ -1501,26 +1514,15 @@ retry_write: * avoid deadlock caused by cluster update race * from foreground operation. */ - if (IS_NOQUOTA(cc->inode)) { - err =3D 0; - goto out_err; - } + if (IS_NOQUOTA(cc->inode)) + return 0; ret =3D 0; cond_resched(); congestion_wait(BLK_RW_ASYNC, DEFAULT_IO_TIMEOUT); - lock_page(cc->rpages[i]); - - if (!PageDirty(cc->rpages[i])) { - unlock_page(cc->rpages[i]); - continue; - } - - clear_page_dirty_for_io(cc->rpages[i]); goto retry_write; } - err =3D ret; - goto out_err; + return ret; } =20 *submitted +=3D _submitted; @@ -1529,14 +1531,6 @@ retry_write: f2fs_balance_fs(F2FS_M_SB(mapping), true); =20 return 0; -out_err: - for (++i; i < cc->cluster_size; i++) { - if (!cc->rpages[i]) - continue; - redirty_page_for_writepage(wbc, cc->rpages[i]); - unlock_page(cc->rpages[i]); - } - return err; } =20 int f2fs_write_multi_pages(struct compress_ctx *cc, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1590BC433F5 for ; Mon, 24 Jan 2022 22:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838180AbiAXWqC (ORCPT ); Mon, 24 Jan 2022 17:46:02 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51830 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457169AbiAXVlH (ORCPT ); Mon, 24 Jan 2022 16:41:07 -0500 Received: from smtp.kernel.org (relay.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 1AB1BB811FB; Mon, 24 Jan 2022 21:41:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47E15C340E4; Mon, 24 Jan 2022 21:41:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060463; bh=YNh9wod2Ccya1/N3xPQytCYqAj6iSH52glEdm7TViB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XgvRhUR/va+inSAMOPmwaZLalqWdXKJcQSDtl5uWgoUN2QM0zUxdxA0wrTze1eCbN paNICceVD8txxd+jNUsmu+cBNf3KHA1muH+Wf1keq04Zr1Sjuwq/rBRr3CPRwX5gS0 j0yvixULX8tTIHYQohF/YR/Bviylo48iyGVkUgnE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org Subject: [PATCH 5.16 0957/1039] f2fs: fix to reserve space for IO align feature Date: Mon, 24 Jan 2022 19:45:46 +0100 Message-Id: <20220124184157.460240113@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 300a842937fbcfb5a189cea9ba15374fdb0b5c6b upstream. https://bugzilla.kernel.org/show_bug.cgi?id=3D204137 With below script, we will hit panic during new segment allocation: DISK=3Dbingo.img MOUNT_DIR=3D/mnt/f2fs dd if=3D/dev/zero of=3D$DISK bs=3D1M count=3D105 mkfs.f2fe -a 1 -o 19 -t 1 -z 1 -f -q $DISK mount -t f2fs $DISK $MOUNT_DIR -o "noinline_dentry,flush_merge,noextent_cac= he,mode=3Dlfs,io_bits=3D7,fsync_mode=3Dstrict" for (( i =3D 0; i < 4096; i++ )); do name=3D`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 10` mkdir $MOUNT_DIR/$name done umount $MOUNT_DIR rm $DISK Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/f2fs/f2fs.h | 11 +++++++++++ fs/f2fs/segment.h | 3 ++- fs/f2fs/super.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ fs/f2fs/sysfs.c | 4 +++- 4 files changed, 60 insertions(+), 2 deletions(-) --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1018,6 +1018,7 @@ struct f2fs_sm_info { unsigned int segment_count; /* total # of segments */ unsigned int main_segments; /* # of segments in main area */ unsigned int reserved_segments; /* # of reserved segments */ + unsigned int additional_reserved_segments;/* reserved segs for IO align f= eature */ unsigned int ovp_segments; /* # of overprovision segments */ =20 /* a threshold to reclaim prefree segments */ @@ -2198,6 +2199,11 @@ static inline int inc_valid_block_count( =20 if (!__allow_reserved_blocks(sbi, inode, true)) avail_user_block_count -=3D F2FS_OPTION(sbi).root_reserved_blocks; + + if (F2FS_IO_ALIGNED(sbi)) + avail_user_block_count -=3D sbi->blocks_per_seg * + SM_I(sbi)->additional_reserved_segments; + if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) { if (avail_user_block_count > sbi->unusable_block_count) avail_user_block_count -=3D sbi->unusable_block_count; @@ -2444,6 +2450,11 @@ static inline int inc_valid_node_count(s =20 if (!__allow_reserved_blocks(sbi, inode, false)) valid_block_count +=3D F2FS_OPTION(sbi).root_reserved_blocks; + + if (F2FS_IO_ALIGNED(sbi)) + valid_block_count +=3D sbi->blocks_per_seg * + SM_I(sbi)->additional_reserved_segments; + user_block_count =3D sbi->user_block_count; if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) user_block_count -=3D sbi->unusable_block_count; --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -538,7 +538,8 @@ static inline unsigned int free_segments =20 static inline unsigned int reserved_segments(struct f2fs_sb_info *sbi) { - return SM_I(sbi)->reserved_segments; + return SM_I(sbi)->reserved_segments + + SM_I(sbi)->additional_reserved_segments; } =20 static inline unsigned int free_sections(struct f2fs_sb_info *sbi) --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -328,6 +328,46 @@ static inline void limit_reserve_root(st F2FS_OPTION(sbi).s_resgid)); } =20 +static inline int adjust_reserved_segment(struct f2fs_sb_info *sbi) +{ + unsigned int sec_blks =3D sbi->blocks_per_seg * sbi->segs_per_sec; + unsigned int avg_vblocks; + unsigned int wanted_reserved_segments; + block_t avail_user_block_count; + + if (!F2FS_IO_ALIGNED(sbi)) + return 0; + + /* average valid block count in section in worst case */ + avg_vblocks =3D sec_blks / F2FS_IO_SIZE(sbi); + + /* + * we need enough free space when migrating one section in worst case + */ + wanted_reserved_segments =3D (F2FS_IO_SIZE(sbi) / avg_vblocks) * + reserved_segments(sbi); + wanted_reserved_segments -=3D reserved_segments(sbi); + + avail_user_block_count =3D sbi->user_block_count - + sbi->current_reserved_blocks - + F2FS_OPTION(sbi).root_reserved_blocks; + + if (wanted_reserved_segments * sbi->blocks_per_seg > + avail_user_block_count) { + f2fs_err(sbi, "IO align feature can't grab additional reserved segment: = %u, available segments: %u", + wanted_reserved_segments, + avail_user_block_count >> sbi->log_blocks_per_seg); + return -ENOSPC; + } + + SM_I(sbi)->additional_reserved_segments =3D wanted_reserved_segments; + + f2fs_info(sbi, "IO align feature needs additional reserved segment: %u", + wanted_reserved_segments); + + return 0; +} + static inline void adjust_unusable_cap_perc(struct f2fs_sb_info *sbi) { if (!F2FS_OPTION(sbi).unusable_cap_perc) @@ -4180,6 +4220,10 @@ try_onemore: goto free_nm; } =20 + err =3D adjust_reserved_segment(sbi); + if (err) + goto free_nm; + /* For write statistics */ sbi->sectors_written_start =3D f2fs_get_sectors_written(sbi); =20 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -415,7 +415,9 @@ out: if (a->struct_type =3D=3D RESERVED_BLOCKS) { spin_lock(&sbi->stat_lock); if (t > (unsigned long)(sbi->user_block_count - - F2FS_OPTION(sbi).root_reserved_blocks)) { + F2FS_OPTION(sbi).root_reserved_blocks - + sbi->blocks_per_seg * + SM_I(sbi)->additional_reserved_segments)) { spin_unlock(&sbi->stat_lock); return -EINVAL; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5160FC433FE for ; Tue, 25 Jan 2022 01:59:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413514AbiAYAjP (ORCPT ); Mon, 24 Jan 2022 19:39:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2363975AbiAXXq1 (ORCPT ); Mon, 24 Jan 2022 18:46:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C997C034004; Mon, 24 Jan 2022 13:41:10 -0800 (PST) Received: from smtp.kernel.org (relay.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 28E0661491; Mon, 24 Jan 2022 21:41:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F31F5C340E4; Mon, 24 Jan 2022 21:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060469; bh=clJKJIMLveFPr341YCQwA2mBwhvvUxBYHR+Sa1luDz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=joH1g3i3h+XhkHuOmqoqDlVDfsPGDrEKPUOpqi3eBUeyd4yW7shZB6Lzd9u4fh1zD 7XDKAwevdZ7PXBSOMKi2nBAUK7Fbri2g4HrmpGYGlgmOfdXkw2ZsbMT9NKksFT8Lbz EJNpyIaWiKg2Ab3Moh1tqkLYs1E1BgjQvzgkAQAw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 5.16 0958/1039] f2fs: fix to check available space of CP area correctly in update_ckpt_flags() Date: Mon, 24 Jan 2022 19:45:47 +0100 Message-Id: <20220124184157.498540022@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit b702c83e2eaa2fa2d72e957c55c0321535cc8b9f upstream. Otherwise, nat_bit area may be persisted across boundary of CP area during nat_bit rebuilding. Fixes: 94c821fb286b ("f2fs: rebuild nat_bits during umount") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/f2fs/checkpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1302,8 +1302,8 @@ static void update_ckpt_flags(struct f2f unsigned long flags; =20 if (cpc->reason & CP_UMOUNT) { - if (le32_to_cpu(ckpt->cp_pack_total_block_count) > - sbi->blocks_per_seg - NM_I(sbi)->nat_bits_blocks) { + if (le32_to_cpu(ckpt->cp_pack_total_block_count) + + NM_I(sbi)->nat_bits_blocks > sbi->blocks_per_seg) { clear_ckpt_flags(sbi, CP_NAT_BITS_FLAG); f2fs_notice(sbi, "Disable nat_bits due to no space"); } else if (!is_set_ckpt_flags(sbi, CP_NAT_BITS_FLAG) && From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DB25C4332F for ; Mon, 24 Jan 2022 22:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838197AbiAXWqE (ORCPT ); Mon, 24 Jan 2022 17:46:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51902 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457231AbiAXVlP (ORCPT ); Mon, 24 Jan 2022 16:41:15 -0500 Received: from smtp.kernel.org (relay.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 53A2EB80FA1; Mon, 24 Jan 2022 21:41:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71380C340E5; Mon, 24 Jan 2022 21:41:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060473; bh=vtrHks515mWWDB8VUuf53R07+1bjr6PyWKO1q/bUdAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MJr4evXSCfy6Y7me42GLRX+GY/tXtGApTzG12Bo3Bu21oOzRlHbwyLMrQBFLWoY8O o0qNntsyeKgpiaXhhWLgDbc7A8ifSdgrkqJymvdEcAJqkUBC52noQtIOclfCGrFtzP HGHKbuLKG0RqBi8xCq4gKifBvDsVFw1UXJt6QeQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Herbert Xu Subject: [PATCH 5.16 0959/1039] crypto: octeontx2 - uninitialized variable in kvf_limits_store() Date: Mon, 24 Jan 2022 19:45:48 +0100 Message-Id: <20220124184157.530557206@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 0ea275df84c389e910a3575a9233075118c173ee upstream. If kstrtoint() fails then "lfs_num" is uninitialized and the warning doesn't make any sense. Just delete it. Fixes: 8ec8015a3168 ("crypto: octeontx2 - add support to process the crypto= request") Signed-off-by: Dan Carpenter Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c +++ b/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c @@ -494,12 +494,11 @@ static ssize_t kvf_limits_store(struct d { struct otx2_cptpf_dev *cptpf =3D dev_get_drvdata(dev); int lfs_num; + int ret; =20 - if (kstrtoint(buf, 0, &lfs_num)) { - dev_err(dev, "lfs count %d must be in range [1 - %d]\n", - lfs_num, num_online_cpus()); - return -EINVAL; - } + ret =3D kstrtoint(buf, 0, &lfs_num); + if (ret) + return ret; if (lfs_num < 1 || lfs_num > num_online_cpus()) { dev_err(dev, "lfs count %d must be in range [1 - %d]\n", lfs_num, num_online_cpus()); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA3ECC3526F for ; Mon, 24 Jan 2022 22:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838481AbiAXWql (ORCPT ); Mon, 24 Jan 2022 17:46:41 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51920 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457260AbiAXVlS (ORCPT ); Mon, 24 Jan 2022 16:41:18 -0500 Received: from smtp.kernel.org (relay.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 600E0B81188; Mon, 24 Jan 2022 21:41:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D7E0C340E4; Mon, 24 Jan 2022 21:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060476; bh=vaHrpZuT0SEiaCkxFuZmfH+VWUjcQY23cDzjyVIvb5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=buFIDdYovvdFdRrmxUcyaw2brz2we9rR8rZYgm3kJQ7Veph3C1By8lg7ckawHpXqX twoUC0Cbnd2e97iMHi7YIuMchrbM1UI+dflnCsFEtnJb+CHl18aqyyZtloX4Xw7Vqq tdZ+1rZCq8NEfhYTxExW5+0BzcrADnQErBDAtWp4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , syzbot , Jakub Kicinski Subject: [PATCH 5.16 0960/1039] af_unix: annote lockless accesses to unix_tot_inflight & gc_in_progress Date: Mon, 24 Jan 2022 19:45:49 +0100 Message-Id: <20220124184157.563363721@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit 9d6d7f1cb67cdee15f1a0e85aacfb924e0e02435 upstream. wait_for_unix_gc() reads unix_tot_inflight & gc_in_progress without synchronization. Adds READ_ONCE()/WRITE_ONCE() and their associated comments to better document the intent. BUG: KCSAN: data-race in unix_inflight / wait_for_unix_gc write to 0xffffffff86e2b7c0 of 4 bytes by task 9380 on cpu 0: unix_inflight+0x1e8/0x260 net/unix/scm.c:63 unix_attach_fds+0x10c/0x1e0 net/unix/scm.c:121 unix_scm_to_skb net/unix/af_unix.c:1674 [inline] unix_dgram_sendmsg+0x679/0x16b0 net/unix/af_unix.c:1817 unix_seqpacket_sendmsg+0xcc/0x110 net/unix/af_unix.c:2258 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2409 ___sys_sendmsg net/socket.c:2463 [inline] __sys_sendmmsg+0x267/0x4c0 net/socket.c:2549 __do_sys_sendmmsg net/socket.c:2578 [inline] __se_sys_sendmmsg net/socket.c:2575 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2575 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae read to 0xffffffff86e2b7c0 of 4 bytes by task 9375 on cpu 1: wait_for_unix_gc+0x24/0x160 net/unix/garbage.c:196 unix_dgram_sendmsg+0x8e/0x16b0 net/unix/af_unix.c:1772 unix_seqpacket_sendmsg+0xcc/0x110 net/unix/af_unix.c:2258 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2409 ___sys_sendmsg net/socket.c:2463 [inline] __sys_sendmmsg+0x267/0x4c0 net/socket.c:2549 __do_sys_sendmmsg net/socket.c:2578 [inline] __se_sys_sendmmsg net/socket.c:2575 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2575 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae value changed: 0x00000002 -> 0x00000004 Reported by Kernel Concurrency Sanitizer on: CPU: 1 PID: 9375 Comm: syz-executor.1 Not tainted 5.16.0-rc7-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Goo= gle 01/01/2011 Fixes: 9915672d4127 ("af_unix: limit unix_tot_inflight") Signed-off-by: Eric Dumazet Reported-by: syzbot Link: https://lore.kernel.org/r/20220114164328.2038499-1-eric.dumazet@gmail= .com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/unix/garbage.c | 14 +++++++++++--- net/unix/scm.c | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-) --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -192,8 +192,11 @@ void wait_for_unix_gc(void) { /* If number of inflight sockets is insane, * force a garbage collect right now. + * Paired with the WRITE_ONCE() in unix_inflight(), + * unix_notinflight() and gc_in_progress(). */ - if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) + if (READ_ONCE(unix_tot_inflight) > UNIX_INFLIGHT_TRIGGER_GC && + !READ_ONCE(gc_in_progress)) unix_gc(); wait_event(unix_gc_wait, gc_in_progress =3D=3D false); } @@ -213,7 +216,9 @@ void unix_gc(void) if (gc_in_progress) goto out; =20 - gc_in_progress =3D true; + /* Paired with READ_ONCE() in wait_for_unix_gc(). */ + WRITE_ONCE(gc_in_progress, true); + /* First, select candidates for garbage collection. Only * in-flight sockets are considered, and from those only ones * which don't have any external reference. @@ -299,7 +304,10 @@ void unix_gc(void) =20 /* All candidates should have been detached by now. */ BUG_ON(!list_empty(&gc_candidates)); - gc_in_progress =3D false; + + /* Paired with READ_ONCE() in wait_for_unix_gc(). */ + WRITE_ONCE(gc_in_progress, false); + wake_up(&unix_gc_wait); =20 out: --- a/net/unix/scm.c +++ b/net/unix/scm.c @@ -60,7 +60,8 @@ void unix_inflight(struct user_struct *u } else { BUG_ON(list_empty(&u->link)); } - unix_tot_inflight++; + /* Paired with READ_ONCE() in wait_for_unix_gc() */ + WRITE_ONCE(unix_tot_inflight, unix_tot_inflight + 1); } user->unix_inflight++; spin_unlock(&unix_gc_lock); @@ -80,7 +81,8 @@ void unix_notinflight(struct user_struct =20 if (atomic_long_dec_and_test(&u->inflight)) list_del_init(&u->link); - unix_tot_inflight--; + /* Paired with READ_ONCE() in wait_for_unix_gc() */ + WRITE_ONCE(unix_tot_inflight, unix_tot_inflight - 1); } user->unix_inflight--; spin_unlock(&unix_gc_lock); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7E26C433F5 for ; Mon, 24 Jan 2022 22:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838422AbiAXWqg (ORCPT ); Mon, 24 Jan 2022 17:46:36 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59280 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457281AbiAXVlW (ORCPT ); Mon, 24 Jan 2022 16:41:22 -0500 Received: from smtp.kernel.org (relay.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 BBED961522; Mon, 24 Jan 2022 21:41:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2B23C340E4; Mon, 24 Jan 2022 21:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060479; bh=XbyaGW1gqADsww7T0qAFwZ8XUk1w+jGvXRbXA7KpCY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0NVjfvdm11zK8XjuAP8GvrlNm+KA60Iqcm0QINtafydYLw0vEdF18La9k8G1oevWK 9r2l+Nu692HocUMtAZRLb0Iaz4Xt6HZApHCSrD9plXYFJLQeimiM4YrGZ+srH0Xxu+ h5uf6HnpTOLJoCmDQnwWZrmtownsKPsWSKq5J1eU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Stephen Boyd Subject: [PATCH 5.16 0961/1039] clk: Emit a stern warning with writable debugfs enabled Date: Mon, 24 Jan 2022 19:45:50 +0100 Message-Id: <20220124184157.595793021@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephen Boyd commit 489a71964f9d74e697a12cd0ace20ed829eb1f93 upstream. We don't want vendors to be enabling this part of the clk code and shipping it to customers. Exposing the ability to change clk frequencies and parents via debugfs is potentially damaging to the system if folks don't know what they're doing. Emit a strong warning so that the message is clear: don't enable this outside of development systems. Fixes: 37215da5553e ("clk: Add support for setting clk_rate via debugfs") Cc: Geert Uytterhoeven Link: https://lore.kernel.org/r/20211210014237.2130300-1-sboyd@kernel.org Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/clk/clk.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3343,6 +3343,24 @@ static int __init clk_debug_init(void) { struct clk_core *core; =20 +#ifdef CLOCK_ALLOW_WRITE_DEBUGFS + pr_warn("\n"); + pr_warn("****************************************************************= ****\n"); + pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE = **\n"); + pr_warn("** = **\n"); + pr_warn("** WRITEABLE clk DebugFS SUPPORT HAS BEEN ENABLED IN THIS KERNE= L **\n"); + pr_warn("** = **\n"); + pr_warn("** This means that this kernel is built to expose clk operations= **\n"); + pr_warn("** such as parent or rate setting, enabling, disabling, etc. = **\n"); + pr_warn("** to userspace, which may compromise security on your system. = **\n"); + pr_warn("** = **\n"); + pr_warn("** If you see this message and you are not debugging the = **\n"); + pr_warn("** kernel, report this immediately to your vendor! = **\n"); + pr_warn("** = **\n"); + pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE = **\n"); + pr_warn("****************************************************************= ****\n"); +#endif + rootdir =3D debugfs_create_dir("clk", NULL); =20 debugfs_create_file("clk_summary", 0444, rootdir, &all_lists, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAF52C433FE for ; Tue, 25 Jan 2022 01:59:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413415AbiAYAjC (ORCPT ); Mon, 24 Jan 2022 19:39:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364000AbiAXXqc (ORCPT ); Mon, 24 Jan 2022 18:46:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18C91C034003; Mon, 24 Jan 2022 13:41:23 -0800 (PST) Received: from smtp.kernel.org (relay.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 AA7DA61523; Mon, 24 Jan 2022 21:41:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91DD5C340E4; Mon, 24 Jan 2022 21:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060482; bh=c2qXLrMSjxDS76K9hZdCjkLK1zTrQr41ndm8rdt8eUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=urY9Ppkth5aXOYe9g/F5L7hhOB9HF+jQ+C9R9cvehKPyPuZiTe/KiMJyLqN5meRCx xtQtDZi2Ha+jKstelLU/2c/sSpfDzf+OdfGxJCPCr2cLT3s36Wu3HqdECz7M8xQ4ZL fhCP6p+2EpDJUrqWc8f3WilFTZj5FAUrwB7jAjdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , Stephen Boyd Subject: [PATCH 5.16 0962/1039] clk: si5341: Fix clock HW provider cleanup Date: Mon, 24 Jan 2022 19:45:51 +0100 Message-Id: <20220124184157.628221160@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hancock commit 49a8f2bc8d88702783c7e163ec84374e9a022f71 upstream. The call to of_clk_add_hw_provider was not undone on remove or on probe failure, which could cause an oops on a subsequent attempt to retrieve clocks for the removed device. Switch to the devm version of the function to avoid this issue. Fixes: 3044a860fd09 ("clk: Add Si5341/Si5340 driver") Signed-off-by: Robert Hancock Link: https://lore.kernel.org/r/20220112203816.1784610-1-robert.hancock@cal= ian.com Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/clk/clk-si5341.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/clk/clk-si5341.c +++ b/drivers/clk/clk-si5341.c @@ -1740,7 +1740,7 @@ static int si5341_probe(struct i2c_clien clk_prepare(data->clk[i].hw.clk); } =20 - err =3D of_clk_add_hw_provider(client->dev.of_node, of_clk_si5341_get, + err =3D devm_of_clk_add_hw_provider(&client->dev, of_clk_si5341_get, data); if (err) { dev_err(&client->dev, "unable to add clk provider\n"); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B149EC4167E for ; Tue, 25 Jan 2022 01:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412951AbiAYAiD (ORCPT ); Mon, 24 Jan 2022 19:38:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364001AbiAXXqc (ORCPT ); Mon, 24 Jan 2022 18:46:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD7A2C034005; Mon, 24 Jan 2022 13:41:25 -0800 (PST) Received: from smtp.kernel.org (relay.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 7C50461491; Mon, 24 Jan 2022 21:41:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EEE2C340E4; Mon, 24 Jan 2022 21:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060484; bh=ZFkvLrbQuEXn14yPP2X0Q5NlzUl9AI4o2OqopNOvoAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tOknDXBzs0yWGCSsfb8nVgbaXKREO3zRsYJp+vShykxfJGkCih9BPXx8bFnF5B2NL WfB/9xlhZg6x1eshtMzZrTCScFoxTUaHeyaemW/a2Y1sXitkABxEilWgeRrP7qpyg+ M/IrF6JDFr6/0XhG3/qyNn4+rPgb+cajVSj71UnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Keeping , Linus Walleij Subject: [PATCH 5.16 0963/1039] pinctrl/rockchip: fix gpio device creation Date: Mon, 24 Jan 2022 19:45:52 +0100 Message-Id: <20220124184157.658285320@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Keeping commit bceb6732f3fd2a55d8f2e518cced1c7555e216b6 upstream. GPIO nodes are not themselves busses, so passing rockchip_bank_match here is wrong. Passing NULL instead uses the standard bus match table which is more appropriate. devm_of_platform_populate() shows that this is the normal way to call of_platform_populate() from a device driver, so in order to match that more closely also add the pinctrl device as the parent for the newly created GPIO controllers. Specifically, using the wrong match here can break dynamic GPIO hogs as marking the GPIO bank as a bus means that of_platform_notify() will set OF_POPULATED on new child nodes and if this happens before of_gpio_notify() is called then the new hog will be skipped as OF_POPULATED is already set. Fixes: 9ce9a02039de ("pinctrl/rockchip: drop the gpio related codes") Signed-off-by: John Keeping Link: https://lore.kernel.org/r/20211126151352.1509583-1-john@metanate.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pinctrl/pinctrl-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -2748,7 +2748,7 @@ static int rockchip_pinctrl_probe(struct =20 platform_set_drvdata(pdev, info); =20 - ret =3D of_platform_populate(np, rockchip_bank_match, NULL, NULL); + ret =3D of_platform_populate(np, NULL, NULL, &pdev->dev); if (ret) { dev_err(&pdev->dev, "failed to register gpio device\n"); return ret; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A89BAC433EF for ; Tue, 25 Jan 2022 01:59:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413399AbiAYAi7 (ORCPT ); Mon, 24 Jan 2022 19:38:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364010AbiAXXqc (ORCPT ); Mon, 24 Jan 2022 18:46:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FE70C0617A8; Mon, 24 Jan 2022 13:41:30 -0800 (PST) Received: from smtp.kernel.org (relay.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 48029B81233; Mon, 24 Jan 2022 21:41:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73B20C340E4; Mon, 24 Jan 2022 21:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060488; bh=RU9LPponh3x6LDCbLu8EQDIpjKNBT5b5AgJqXCNloFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y4sPFk93mlJ9DxmxIxBnAHY1e0J8/FmqqbDVPQZFs1Ed72rOPbGPaj5CsL7i2Uovn dMehCfw2KatUHKlUbRHsLwYw1XLTJAYZVwltmzXzQ9E4oit50+xk7oE+ibEzDVk9Y+ jj+CSAIEyF5xRSAKjWPyImGmOS/30xoQjFDYHe8E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Bartosz Golaszewski Subject: [PATCH 5.16 0964/1039] gpio: mpc8xxx: Fix IRQ check in mpc8xxx_probe Date: Mon, 24 Jan 2022 19:45:53 +0100 Message-Id: <20220124184157.689790247@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 0b39536cc699db6850c426db7f9cb45923de40c5 upstream. platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example: int irq =3D platform_get_irq(pdev, 0); if (irq < 0) return irq; Fix the check of return value to catch errors correctly. Fixes: 76c47d1449fc ("gpio: mpc8xxx: Add ACPI support") Signed-off-by: Miaoqian Lin Reviewed-by: Linus Walleij Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpio/gpio-mpc8xxx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -388,8 +388,8 @@ static int mpc8xxx_probe(struct platform } =20 mpc8xxx_gc->irqn =3D platform_get_irq(pdev, 0); - if (!mpc8xxx_gc->irqn) - return 0; + if (mpc8xxx_gc->irqn < 0) + return mpc8xxx_gc->irqn; =20 mpc8xxx_gc->irq =3D irq_domain_create_linear(fwnode, MPC8XXX_GPIO_PINS, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59384C3526D for ; Mon, 24 Jan 2022 22:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838218AbiAXWqF (ORCPT ); Mon, 24 Jan 2022 17:46:05 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52066 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457381AbiAXVld (ORCPT ); Mon, 24 Jan 2022 16:41:33 -0500 Received: from smtp.kernel.org (relay.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 2A81BB811FC; Mon, 24 Jan 2022 21:41:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 804F2C340E4; Mon, 24 Jan 2022 21:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060490; bh=EtWA7L7BqdpMoJktY/5B7XDbMJPG7DdHQWCd5GNvgoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c6comMHNeu4CT1rHyCM3kaHIu63EOlQfy/T2qE31EGGVrRivTFWz34SQAQU6c/CLJ 5rceZjERHwYfCBp8ATYsLGzA6mQvlwKbzoFhZA0XmvOKaDwx6auq5PZy2A8xHpuBpE 8NqpcdfpUgG7cc1VSHmmwZiAejeFdxIx2xN+2VfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Bartosz Golaszewski Subject: [PATCH 5.16 0965/1039] gpio: idt3243x: Fix IRQ check in idt_gpio_probe Date: Mon, 24 Jan 2022 19:45:54 +0100 Message-Id: <20220124184157.726618119@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 30fee1d7462a446ade399c0819717a830cbdca69 upstream. platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example: int irq =3D platform_get_irq(pdev, 0); if (irq < 0) return irq; Fix the check of return value to catch errors correctly. Fixes: 4195926aedca ("gpio: Add support for IDT 79RC3243x GPIO controller") Signed-off-by: Miaoqian Lin Reviewed-by: Linus Walleij Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpio/gpio-idt3243x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpio/gpio-idt3243x.c +++ b/drivers/gpio/gpio-idt3243x.c @@ -164,8 +164,8 @@ static int idt_gpio_probe(struct platfor return PTR_ERR(ctrl->pic); =20 parent_irq =3D platform_get_irq(pdev, 0); - if (!parent_irq) - return -EINVAL; + if (parent_irq < 0) + return parent_irq; =20 girq =3D &ctrl->gc.irq; girq->chip =3D &idt_gpio_irqchip; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C5DCC4167B for ; Mon, 24 Jan 2022 22:42:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836721AbiAXWkk (ORCPT ); Mon, 24 Jan 2022 17:40:40 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59604 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457406AbiAXVlf (ORCPT ); Mon, 24 Jan 2022 16:41:35 -0500 Received: from smtp.kernel.org (relay.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 7A7A4612E5; Mon, 24 Jan 2022 21:41:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6263CC340E4; Mon, 24 Jan 2022 21:41:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060493; bh=Vh3Qu6x8QyubpqhLHnKB1MKyOTmTneYTQS/GwGEp5z8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hWou1DMIPjOnETDaY6ZQWJlkQBtHEyWWRYgx4Coj4v6efrhsX2L8ZpXqqGYgRSNII gjnmGNR39qzQ5soFfVuoR0OQQwV/ZzyTnTo+UyMOhs1tgrZwRQJNe40P5dilRy5/bJ oCiQL5tZj+Gl7mFYW3XAoj4YaKxd0qO5K60r+6Qk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gu , "David S. Miller" Subject: [PATCH 5.16 0966/1039] net/smc: Fix hung_task when removing SMC-R devices Date: Mon, 24 Jan 2022 19:45:55 +0100 Message-Id: <20220124184157.760163768@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wen Gu commit 56d99e81ecbc997a5f984684d0eeb583992b2072 upstream. A hung_task is observed when removing SMC-R devices. Suppose that a link group has two active links(lnk_A, lnk_B) associated with two different SMC-R devices(dev_A, dev_B). When dev_A is removed, the link group will be removed from smc_lgr_list and added into lgr_linkdown_list. lnk_A will be cleared and smcibdev(A)->lnk_cnt will reach to zero. However, when dev_B is removed then, the link group can't be found in smc_lgr_list and lnk_B won't be cleared, making smcibdev->lnk_cnt never reaches zero, which causes a hung_task. This patch fixes this issue by restoring the implementation of smc_smcr_terminate_all() to what it was before commit 349d43127dac ("net/smc: fix kernel panic caused by race of smc_sock"). The original implementation also satisfies the intention that make sure QP destroy earlier than CQ destroy because we will always wait for smcibdev->lnk_cnt reaches zero, which guarantees QP has been destroyed. Fixes: 349d43127dac ("net/smc: fix kernel panic caused by race of smc_sock") Signed-off-by: Wen Gu Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/smc/smc_core.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -1459,16 +1459,11 @@ void smc_smcd_terminate_all(struct smcd_ /* Called when an SMCR device is removed or the smc module is unloaded. * If smcibdev is given, all SMCR link groups using this device are termin= ated. * If smcibdev is NULL, all SMCR link groups are terminated. - * - * We must wait here for QPs been destroyed before we destroy the CQs, - * or we won't received any CQEs and cdc_pend_tx_wr cannot reach 0 thus - * smc_sock cannot be released. */ void smc_smcr_terminate_all(struct smc_ib_device *smcibdev) { struct smc_link_group *lgr, *lg; LIST_HEAD(lgr_free_list); - LIST_HEAD(lgr_linkdown_list); int i; =20 spin_lock_bh(&smc_lgr_list.lock); @@ -1480,7 +1475,7 @@ void smc_smcr_terminate_all(struct smc_i list_for_each_entry_safe(lgr, lg, &smc_lgr_list.list, list) { for (i =3D 0; i < SMC_LINKS_PER_LGR_MAX; i++) { if (lgr->lnk[i].smcibdev =3D=3D smcibdev) - list_move_tail(&lgr->list, &lgr_linkdown_list); + smcr_link_down_cond_sched(&lgr->lnk[i]); } } } @@ -1492,16 +1487,6 @@ void smc_smcr_terminate_all(struct smc_i __smc_lgr_terminate(lgr, false); } =20 - list_for_each_entry_safe(lgr, lg, &lgr_linkdown_list, list) { - for (i =3D 0; i < SMC_LINKS_PER_LGR_MAX; i++) { - if (lgr->lnk[i].smcibdev =3D=3D smcibdev) { - mutex_lock(&lgr->llc_conf_mutex); - smcr_link_down_cond(&lgr->lnk[i]); - mutex_unlock(&lgr->llc_conf_mutex); - } - } - } - if (smcibdev) { if (atomic_read(&smcibdev->lnk_cnt)) wait_event(smcibdev->lnks_deleted, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DEB1C4332F for ; Mon, 24 Jan 2022 22:42:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836606AbiAXWkS (ORCPT ); Mon, 24 Jan 2022 17:40:18 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52096 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457434AbiAXVlj (ORCPT ); Mon, 24 Jan 2022 16:41:39 -0500 Received: from smtp.kernel.org (relay.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 EC971B8121C; Mon, 24 Jan 2022 21:41:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59FE3C340E4; Mon, 24 Jan 2022 21:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060496; bh=QQYbblQ35leF5mIDeINDGQFfwan87gWS7LaQi2QXxZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xC5WVIK8pP/qk/JZV2filScwsAFq1NL7Ail9Nbm0hdyks/GUzkUEO1yvJfF0DEctd RnNqfyffKmu8/2QS1GMhbpuNhYcKtqzUHu4rBnKDaRj1SC0wd9askaPFiclmnLv5Z0 RpRNjv+KK6jDVsLOEjR2T548foj+VSYRJQ3q2W14= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , Andrew Lunn , "David S. Miller" Subject: [PATCH 5.16 0967/1039] net: axienet: increase reset timeout Date: Mon, 24 Jan 2022 19:45:56 +0100 Message-Id: <20220124184157.789743232@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hancock commit 2e5644b1bab2ccea9cfc7a9520af95b94eb0dbf1 upstream. The previous timeout of 1ms was too short to handle some cases where the core is reset just after the input clocks were started, which will be introduced in an upcoming patch. Increase the timeout to 50ms. Also simplify the reset timeout checking to use read_poll_timeout. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethern= et driver") Signed-off-by: Robert Hancock Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 19 +++++++++--------= -- 1 file changed, 9 insertions(+), 10 deletions(-) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -496,7 +496,8 @@ static void axienet_setoptions(struct ne =20 static int __axienet_device_reset(struct axienet_local *lp) { - u32 timeout; + u32 value; + int ret; =20 /* Reset Axi DMA. This would reset Axi Ethernet core as well. The reset * process of Axi DMA takes a while to complete as all pending @@ -506,15 +507,13 @@ static int __axienet_device_reset(struct * they both reset the entire DMA core, so only one needs to be used. */ axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, XAXIDMA_CR_RESET_MASK); - timeout =3D DELAY_OF_ONE_MILLISEC; - while (axienet_dma_in32(lp, XAXIDMA_TX_CR_OFFSET) & - XAXIDMA_CR_RESET_MASK) { - udelay(1); - if (--timeout =3D=3D 0) { - netdev_err(lp->ndev, "%s: DMA reset timeout!\n", - __func__); - return -ETIMEDOUT; - } + ret =3D read_poll_timeout(axienet_dma_in32, value, + !(value & XAXIDMA_CR_RESET_MASK), + DELAY_OF_ONE_MILLISEC, 50000, false, lp, + XAXIDMA_TX_CR_OFFSET); + if (ret) { + dev_err(lp->dev, "%s: DMA reset timeout!\n", __func__); + return ret; } =20 return 0; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70C29C2BA4C for ; Mon, 24 Jan 2022 22:42:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836761AbiAXWkp (ORCPT ); Mon, 24 Jan 2022 17:40:45 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59772 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457483AbiAXVln (ORCPT ); Mon, 24 Jan 2022 16:41:43 -0500 Received: from smtp.kernel.org (relay.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 11C7C61526; Mon, 24 Jan 2022 21:41:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED0F0C340E4; Mon, 24 Jan 2022 21:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060502; bh=hgTMhcKXn0qipvk81yvlR5VaiWMS55P9EIckJyt9sxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GdO2GWewTxxGm2rMqqELfQ++O/fS7YKP2+9gy+z4GMFfM1bC1ndCrbJFalFlXQxaf mgDl8rA+MRwmY7mQNv8PiQo3ZnqdBlLuIh/HohkOHZfp1GDZ9TmREilxVJVizORs4B dFdZQC4wB0mLeNIkgaGtAorpp+TATUbhs9Ih8If4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , Andrew Lunn , "David S. Miller" Subject: [PATCH 5.16 0968/1039] net: axienet: Wait for PhyRstCmplt after core reset Date: Mon, 24 Jan 2022 19:45:57 +0100 Message-Id: <20220124184157.828788785@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hancock commit b400c2f4f4c53c86594dd57098970d97d488bfde upstream. When resetting the device, wait for the PhyRstCmplt bit to be set in the interrupt status register before continuing initialization, to ensure that the core is actually ready. When using an external PHY, this also ensures we do not start trying to access the PHY while it is still in reset. The PHY reset is initiated by the core reset which is triggered just above, but remains asserted for 5ms after the core is reset according to the documentation. The MgtRdy bit could also be waited for, but unfortunately when using 7-series devices, the bit does not appear to work as documented (it seems to behave as some sort of link state indication and not just an indication the transceiver is ready) so it can't really be relied on for this purpose. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethern= et driver") Signed-off-by: Robert Hancock Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -516,6 +516,16 @@ static int __axienet_device_reset(struct return ret; } =20 + /* Wait for PhyRstCmplt bit to be set, indicating the PHY reset has finis= hed */ + ret =3D read_poll_timeout(axienet_ior, value, + value & XAE_INT_PHYRSTCMPLT_MASK, + DELAY_OF_ONE_MILLISEC, 50000, false, lp, + XAE_IS_OFFSET); + if (ret) { + dev_err(lp->dev, "%s: timeout waiting for PhyRstCmplt\n", __func__); + return ret; + } + return 0; } =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA490C4167B for ; Tue, 25 Jan 2022 01:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3411947AbiAYAfO (ORCPT ); Mon, 24 Jan 2022 19:35:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364046AbiAXXqi (ORCPT ); Mon, 24 Jan 2022 18:46:38 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CDADC0613A7; Mon, 24 Jan 2022 13:41:48 -0800 (PST) Received: from smtp.kernel.org (relay.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 DDB88B8105C; Mon, 24 Jan 2022 21:41:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08A12C340E4; Mon, 24 Jan 2022 21:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060505; bh=+xKvTa4o3uapaDC5MbBlg9DwFPgbwt6w97UiymgDyMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qbau/ox+x+9oAWI2Z2qOTLOi9gth4ZR6jh8swySEZpL2vd9kXEOH64QSJd+kZ/K1B Nxyevixh5w5B3RpvA07XWFSZef3Z9sOsVWu6VKI6RsiW4jfD4jkQHx9gJFyEeOLxmx rAmT1tYC6ePFWWcTjuyGhuHQnthxTtO6Kkk0bH5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , Andrew Lunn , "David S. Miller" Subject: [PATCH 5.16 0969/1039] net: axienet: reset core on initialization prior to MDIO access Date: Mon, 24 Jan 2022 19:45:58 +0100 Message-Id: <20220124184157.863231207@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hancock commit 04cc2da39698efd7eb2e30c112538922d26f848e upstream. In some cases where the Xilinx Ethernet core was used in 1000Base-X or SGMII modes, which use the internal PCS/PMA PHY, and the MGT transceiver clock source for the PCS was not running at the time the FPGA logic was loaded, the core would come up in a state where the PCS could not be found on the MDIO bus. To fix this, the Ethernet core (including the PCS) should be reset after enabling the clocks, prior to attempting to access the PCS using of_mdio_find_device. Fixes: 1a02556086fc (net: axienet: Properly handle PCS/PMA PHY for 1000Base= X mode) Signed-off-by: Robert Hancock Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2089,6 +2089,11 @@ static int axienet_probe(struct platform lp->coalesce_count_rx =3D XAXIDMA_DFT_RX_THRESHOLD; lp->coalesce_count_tx =3D XAXIDMA_DFT_TX_THRESHOLD; =20 + /* Reset core now that clocks are enabled, prior to accessing MDIO */ + ret =3D __axienet_device_reset(lp); + if (ret) + goto cleanup_clk; + lp->phy_node =3D of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); if (lp->phy_node) { ret =3D axienet_mdio_setup(lp); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6418C433FE for ; Mon, 24 Jan 2022 22:42:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836906AbiAXWlQ (ORCPT ); Mon, 24 Jan 2022 17:41:16 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59902 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457543AbiAXVlt (ORCPT ); Mon, 24 Jan 2022 16:41:49 -0500 Received: from smtp.kernel.org (relay.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 135F761521; Mon, 24 Jan 2022 21:41:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28FE8C340E4; Mon, 24 Jan 2022 21:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060508; bh=DKaIZ44jXhAHBBxgsqnKrT5Vc0etjfMDYpjpcuu0RIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ql+Go9qqWBq3vYFCFyXv76g828PV4MfEnkDRF/d40rXvgyEQk+YLUw773IL3PtaxP wTS1jTmQp24Zg3QsNln2zjyVk2imGvkzgGq/30w4p0ltFDe3LtBh7FUbV2Ui+EH5+O WAdL/JD852UzPybkVxomo62TZG+n+AG7rjPOxHtE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , "David S. Miller" Subject: [PATCH 5.16 0970/1039] net: axienet: add missing memory barriers Date: Mon, 24 Jan 2022 19:45:59 +0100 Message-Id: <20220124184157.899224815@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hancock commit 95978df6fa328df619c15312e65ece469c2be2d2 upstream. This driver was missing some required memory barriers: Use dma_rmb to ensure we see all updates to the descriptor after we see that an entry has been completed. Use wmb and rmb to avoid stale descriptor status between the TX path and TX complete IRQ path. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethern= et driver") Signed-off-by: Robert Hancock Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -632,6 +632,8 @@ static int axienet_free_tx_chain(struct if (nr_bds =3D=3D -1 && !(status & XAXIDMA_BD_STS_COMPLETE_MASK)) break; =20 + /* Ensure we see complete descriptor update */ + dma_rmb(); phys =3D desc_get_phys_addr(lp, cur_p); dma_unmap_single(ndev->dev.parent, phys, (cur_p->cntrl & XAXIDMA_BD_CTRL_LENGTH_MASK), @@ -645,8 +647,10 @@ static int axienet_free_tx_chain(struct cur_p->app1 =3D 0; cur_p->app2 =3D 0; cur_p->app4 =3D 0; - cur_p->status =3D 0; cur_p->skb =3D NULL; + /* ensure our transmit path and device don't prematurely see status clea= red */ + wmb(); + cur_p->status =3D 0; =20 if (sizep) *sizep +=3D status & XAXIDMA_BD_STS_ACTUAL_LEN_MASK; @@ -704,6 +708,9 @@ static inline int axienet_check_tx_bd_sp int num_frag) { struct axidma_bd *cur_p; + + /* Ensure we see all descriptor updates from device or TX IRQ path */ + rmb(); cur_p =3D &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; if (cur_p->status & XAXIDMA_BD_STS_ALL_MASK) return NETDEV_TX_BUSY; @@ -843,6 +850,8 @@ static void axienet_recv(struct net_devi =20 tail_p =3D lp->rx_bd_p + sizeof(*lp->rx_bd_v) * lp->rx_bd_ci; =20 + /* Ensure we see complete descriptor update */ + dma_rmb(); phys =3D desc_get_phys_addr(lp, cur_p); dma_unmap_single(ndev->dev.parent, phys, lp->max_frm_size, DMA_FROM_DEVICE); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1808EC433FE for ; Tue, 25 Jan 2022 01:58:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412002AbiAYAf2 (ORCPT ); Mon, 24 Jan 2022 19:35:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364062AbiAXXqn (ORCPT ); Mon, 24 Jan 2022 18:46:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10003C0613A8; Mon, 24 Jan 2022 13:41:54 -0800 (PST) Received: from smtp.kernel.org (relay.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 CB19DB8105C; Mon, 24 Jan 2022 21:41:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02551C340E4; Mon, 24 Jan 2022 21:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060511; bh=qEjckpQvRmxcTRNa+OgIplbRP5NSdJP2K0D8QWEZUBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mBxC5oWjT+Lj7cRzeyPhlkxo8DrYc4UX+EUZSZl9gincvlCzc62g+z7f1CzP5Ok4N GZDJigELz1ia09k168OCHIGVsnxNmV3UVXHIBW3oTWfe9ty9g4xW02XJSpveDxeLB7 BnpwJZuy8ObEbpkTF9s5+/LZQiTG/V9bL5QHKnfg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , "David S. Miller" Subject: [PATCH 5.16 0971/1039] net: axienet: limit minimum TX ring size Date: Mon, 24 Jan 2022 19:46:00 +0100 Message-Id: <20220124184157.930377306@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hancock commit 70f5817deddbc6ef3faa35841cab83c280cc653a upstream. The driver will not work properly if the TX ring size is set to below MAX_SKB_FRAGS + 1 since it needs to hold at least one full maximally fragmented packet in the TX ring. Limit setting the ring size to below this value. Fixes: 8b09ca823ffb4 ("net: axienet: Make RX/TX ring sizes configurable") Signed-off-by: Robert Hancock Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -43,6 +43,7 @@ /* Descriptors defines for Tx and Rx DMA */ #define TX_BD_NUM_DEFAULT 64 #define RX_BD_NUM_DEFAULT 1024 +#define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1) #define TX_BD_NUM_MAX 4096 #define RX_BD_NUM_MAX 4096 =20 @@ -1364,7 +1365,8 @@ static int axienet_ethtools_set_ringpara if (ering->rx_pending > RX_BD_NUM_MAX || ering->rx_mini_pending || ering->rx_jumbo_pending || - ering->rx_pending > TX_BD_NUM_MAX) + ering->tx_pending < TX_BD_NUM_MIN || + ering->tx_pending > TX_BD_NUM_MAX) return -EINVAL; =20 if (netif_running(ndev)) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D8DCC4321E for ; Tue, 25 Jan 2022 01:58:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412095AbiAYAfo (ORCPT ); Mon, 24 Jan 2022 19:35:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364068AbiAXXqo (ORCPT ); Mon, 24 Jan 2022 18:46:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26D10C0613AB; Mon, 24 Jan 2022 13:41:56 -0800 (PST) Received: from smtp.kernel.org (relay.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 C1F7FB811A2; Mon, 24 Jan 2022 21:41:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25606C340E4; Mon, 24 Jan 2022 21:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060514; bh=z/kUukaJylcFxGt8AABs3R9KeYEcCOvB/8aKXDK3HDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZBvJgj0Dmi3qHFTcbfbUFioC5B18frerxn/ta61Yxtwxw8Xm/OpwOxSh2AkcAc7SG v8KWKOPC35e/6eoibY9C2gDx/X2VzNjeaAEadnk7MZCy4KkGjV7zvZuhD5MfifwvKT aF+a+W3aFqynKljaZosbQLOnVIEtIbxQU+GNzHtk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , "David S. Miller" Subject: [PATCH 5.16 0972/1039] net: axienet: Fix TX ring slot available check Date: Mon, 24 Jan 2022 19:46:01 +0100 Message-Id: <20220124184157.963023294@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hancock commit 996defd7f8b5dafc1d480b7585c7c62437f80c3c upstream. The check for whether a TX ring slot was available was incorrect, since a slot which had been loaded with transmit data but the device had not started transmitting would be treated as available, potentially causing non-transmitted slots to be overwritten. The control field in the descriptor should be checked, rather than the status field (which may only be updated when the device completes the entry). Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethern= et driver") Signed-off-by: Robert Hancock Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -643,7 +643,6 @@ static int axienet_free_tx_chain(struct if (cur_p->skb && (status & XAXIDMA_BD_STS_COMPLETE_MASK)) dev_consume_skb_irq(cur_p->skb); =20 - cur_p->cntrl =3D 0; cur_p->app0 =3D 0; cur_p->app1 =3D 0; cur_p->app2 =3D 0; @@ -651,6 +650,7 @@ static int axienet_free_tx_chain(struct cur_p->skb =3D NULL; /* ensure our transmit path and device don't prematurely see status clea= red */ wmb(); + cur_p->cntrl =3D 0; cur_p->status =3D 0; =20 if (sizep) @@ -713,7 +713,7 @@ static inline int axienet_check_tx_bd_sp /* Ensure we see all descriptor updates from device or TX IRQ path */ rmb(); cur_p =3D &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; - if (cur_p->status & XAXIDMA_BD_STS_ALL_MASK) + if (cur_p->cntrl) return NETDEV_TX_BUSY; return 0; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 601C3C43219 for ; Mon, 24 Jan 2022 22:54:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839768AbiAXWvz (ORCPT ); Mon, 24 Jan 2022 17:51:55 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33356 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378927AbiAXVoF (ORCPT ); Mon, 24 Jan 2022 16:44:05 -0500 Received: from smtp.kernel.org (relay.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 D176B61574; Mon, 24 Jan 2022 21:44:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97D3EC340E4; Mon, 24 Jan 2022 21:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060644; bh=EjBx6VLc9soLrs83ucHSAMI+i/H49AZLt1t7DcmUv5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qjcw02vLYpzpJFse8CcxgCPB5+vAav3XWy7mAcQUHOaM+bRmNJg9Nq6PrAWtDR/vA EvWiQplnt3R32TBHn45bRTaX7qmp72c+3ggXurtLZ++t0WIgZE5WxDQYXRRWuzSfNb jk1gX9vV02inD7BztUfpjB5GDDCGldoMcreUPNn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , "David S. Miller" Subject: [PATCH 5.16 0973/1039] net: axienet: fix number of TX ring slots for available check Date: Mon, 24 Jan 2022 19:46:02 +0100 Message-Id: <20220124184158.001190784@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hancock commit aba57a823d2985a2cc8c74a2535f3a88e68d9424 upstream. The check for the number of available TX ring slots was off by 1 since a slot is required for the skb header as well as each fragment. This could result in overwriting a TX ring slot that was still in use. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethern= et driver") Signed-off-by: Robert Hancock Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -747,7 +747,7 @@ axienet_start_xmit(struct sk_buff *skb, num_frag =3D skb_shinfo(skb)->nr_frags; cur_p =3D &lp->tx_bd_v[lp->tx_bd_tail]; =20 - if (axienet_check_tx_bd_space(lp, num_frag)) { + if (axienet_check_tx_bd_space(lp, num_frag + 1)) { if (netif_queue_stopped(ndev)) return NETDEV_TX_BUSY; =20 @@ -757,7 +757,7 @@ axienet_start_xmit(struct sk_buff *skb, smp_mb(); =20 /* Space might have just been freed - check again */ - if (axienet_check_tx_bd_space(lp, num_frag)) + if (axienet_check_tx_bd_space(lp, num_frag + 1)) return NETDEV_TX_BUSY; =20 netif_wake_queue(ndev); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BFFCC433F5 for ; Mon, 24 Jan 2022 22:42:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836783AbiAXWkt (ORCPT ); Mon, 24 Jan 2022 17:40:49 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58600 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457813AbiAXVmT (ORCPT ); Mon, 24 Jan 2022 16:42:19 -0500 Received: from smtp.kernel.org (relay.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 15ACF6151F; Mon, 24 Jan 2022 21:42:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD9E6C340E4; Mon, 24 Jan 2022 21:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060538; bh=br/iQTyRsURcetzVqnQpSl1GiGq29hfg10350Q/e9Ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LT9NMilNvK65VPfi2LgoPQm/Jsl7Q5wNQpMZ006eyAiuLAwsDDb590xnwUZvojBDQ nv8gvQslaL3jASMQNbpl/QPpa/MdztC7AsiJHpivrPjVKEhKcQvY9Koz5FzzGtjs6E CRz2o8/UCnBgVqRXlJXh38cdk5tbd+YPsMdMlZkQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , "David S. Miller" Subject: [PATCH 5.16 0974/1039] net: axienet: fix for TX busy handling Date: Mon, 24 Jan 2022 19:46:03 +0100 Message-Id: <20220124184158.033689682@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hancock commit bb193e3db8b86a63f26889c99e14fd30c9ebd72a upstream. Network driver documentation indicates we should be avoiding returning NETDEV_TX_BUSY from ndo_start_xmit in normal cases, since it requires the packets to be requeued. Instead the queue should be stopped after a packet is added to the TX ring when there may not be enough room for an additional one. Also, when TX ring entries are completed, we should only wake the queue if we know there is room for another full maximally fragmented packet. Print a warning if there is insufficient space at the start of start_xmit, since this should no longer happen. Combined with increasing the default TX ring size (in a subsequent patch), this appears to recover the TX performance lost by previous changes to actually manage the TX ring state properly. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethern= et driver") Signed-off-by: Robert Hancock Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 86 ++++++++++++-----= ----- 1 file changed, 47 insertions(+), 39 deletions(-) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -661,6 +661,32 @@ static int axienet_free_tx_chain(struct } =20 /** + * axienet_check_tx_bd_space - Checks if a BD/group of BDs are currently b= usy + * @lp: Pointer to the axienet_local structure + * @num_frag: The number of BDs to check for + * + * Return: 0, on success + * NETDEV_TX_BUSY, if any of the descriptors are not free + * + * This function is invoked before BDs are allocated and transmission star= ts. + * This function returns 0 if a BD or group of BDs can be allocated for + * transmission. If the BD or any of the BDs are not free the function + * returns a busy status. This is invoked from axienet_start_xmit. + */ +static inline int axienet_check_tx_bd_space(struct axienet_local *lp, + int num_frag) +{ + struct axidma_bd *cur_p; + + /* Ensure we see all descriptor updates from device or TX IRQ path */ + rmb(); + cur_p =3D &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; + if (cur_p->cntrl) + return NETDEV_TX_BUSY; + return 0; +} + +/** * axienet_start_xmit_done - Invoked once a transmit is completed by the * Axi DMA Tx channel. * @ndev: Pointer to the net_device structure @@ -689,33 +715,8 @@ static void axienet_start_xmit_done(stru /* Matches barrier in axienet_start_xmit */ smp_mb(); =20 - netif_wake_queue(ndev); -} - -/** - * axienet_check_tx_bd_space - Checks if a BD/group of BDs are currently b= usy - * @lp: Pointer to the axienet_local structure - * @num_frag: The number of BDs to check for - * - * Return: 0, on success - * NETDEV_TX_BUSY, if any of the descriptors are not free - * - * This function is invoked before BDs are allocated and transmission star= ts. - * This function returns 0 if a BD or group of BDs can be allocated for - * transmission. If the BD or any of the BDs are not free the function - * returns a busy status. This is invoked from axienet_start_xmit. - */ -static inline int axienet_check_tx_bd_space(struct axienet_local *lp, - int num_frag) -{ - struct axidma_bd *cur_p; - - /* Ensure we see all descriptor updates from device or TX IRQ path */ - rmb(); - cur_p =3D &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; - if (cur_p->cntrl) - return NETDEV_TX_BUSY; - return 0; + if (!axienet_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) + netif_wake_queue(ndev); } =20 /** @@ -748,19 +749,14 @@ axienet_start_xmit(struct sk_buff *skb, cur_p =3D &lp->tx_bd_v[lp->tx_bd_tail]; =20 if (axienet_check_tx_bd_space(lp, num_frag + 1)) { - if (netif_queue_stopped(ndev)) - return NETDEV_TX_BUSY; - + /* Should not happen as last start_xmit call should have + * checked for sufficient space and queue should only be + * woken when sufficient space is available. + */ netif_stop_queue(ndev); - - /* Matches barrier in axienet_start_xmit_done */ - smp_mb(); - - /* Space might have just been freed - check again */ - if (axienet_check_tx_bd_space(lp, num_frag + 1)) - return NETDEV_TX_BUSY; - - netif_wake_queue(ndev); + if (net_ratelimit()) + netdev_warn(ndev, "TX ring unexpectedly full\n"); + return NETDEV_TX_BUSY; } =20 if (skb->ip_summed =3D=3D CHECKSUM_PARTIAL) { @@ -821,6 +817,18 @@ axienet_start_xmit(struct sk_buff *skb, if (++lp->tx_bd_tail >=3D lp->tx_bd_num) lp->tx_bd_tail =3D 0; =20 + /* Stop queue if next transmit may not have space */ + if (axienet_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) { + netif_stop_queue(ndev); + + /* Matches barrier in axienet_start_xmit_done */ + smp_mb(); + + /* Space might have just been freed - check again */ + if (!axienet_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) + netif_wake_queue(ndev); + } + return NETDEV_TX_OK; } =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6E9EC4332F for ; Mon, 24 Jan 2022 22:53:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839259AbiAXWuP (ORCPT ); Mon, 24 Jan 2022 17:50:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52656 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1572973AbiAXVmy (ORCPT ); Mon, 24 Jan 2022 16:42:54 -0500 Received: from smtp.kernel.org (relay.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 CDED1B81142; Mon, 24 Jan 2022 21:42:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09DD3C340E4; Mon, 24 Jan 2022 21:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060571; bh=GQv7LOP06zbfKaH6OrGhewLZ8+JM8W6ZxwkO/Q4Zfm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fHU4htTiDmgIeuBeGBTeCJUnZEClcA7xJTWYzSL0nIMF06O4LWGk1KjoPi7c8dD1a vHKVconUHZPWUhJc8qmOvPU809TSArwunqwRu+MSw+Zn+HPpOzkbn38D+v+/WubXE+ dpSLg6By+2qcbuyv3eLF67+qch1dVc5ZoT4azasI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , "David S. Miller" Subject: [PATCH 5.16 0975/1039] net: axienet: increase default TX ring size to 128 Date: Mon, 24 Jan 2022 19:46:04 +0100 Message-Id: <20220124184158.065796695@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Hancock commit 2d19c3fd80178160dd505ccd7fed1643831227a5 upstream. With previous changes to make the driver handle the TX ring size more correctly, the default TX ring size of 64 appears to significantly bottleneck TX performance to around 600 Mbps on a 1 Gbps link on ZynqMP. Increasing this to 128 seems to bring performance up to near line rate and shouldn't cause excess bufferbloat (this driver doesn't yet support modern byte-based queue management). Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethern= et driver") Signed-off-by: Robert Hancock Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -41,7 +41,7 @@ #include "xilinx_axienet.h" =20 /* Descriptors defines for Tx and Rx DMA */ -#define TX_BD_NUM_DEFAULT 64 +#define TX_BD_NUM_DEFAULT 128 #define RX_BD_NUM_DEFAULT 1024 #define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1) #define TX_BD_NUM_MAX 4096 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FA09C433F5 for ; Mon, 24 Jan 2022 22:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839032AbiAXWtl (ORCPT ); Mon, 24 Jan 2022 17:49:41 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52876 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378515AbiAXVn2 (ORCPT ); Mon, 24 Jan 2022 16:43:28 -0500 Received: from smtp.kernel.org (relay.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 4E394B81136; Mon, 24 Jan 2022 21:43:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7ECDC340E4; Mon, 24 Jan 2022 21:43:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060604; bh=RAhbsxxG8YhgiPxl2yWSUjm73nfsyol775fPunTAP7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LrnqEJJTXaywBKoR/lrwN4feGPfxBOGY3xIf2oQdPqXVFg7K/nfCcA6i0h34cBgaT Wu01sdb9wfQRDkqAa7rC4uVFi+AfuDhpjlwL9iuyxNywAJRoPGmkVQlaXjPoc+s2tm RCuLNDn2jsoV51FWV8oIo8KDd43Txlr5RRiXtqkc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yury Norov , kernel test robot , Wolfram Sang Subject: [PATCH 5.16 0976/1039] bitops: protect find_first_{,zero}_bit properly Date: Mon, 24 Jan 2022 19:46:05 +0100 Message-Id: <20220124184158.097950996@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yury Norov commit b7ec62d7ee0f0b8af6ba190501dff7f9ee6545ca upstream. find_first_bit() and find_first_zero_bit() are not protected with ifdefs as other functions in find.h. It causes build errors on some platforms if CONFIG_GENERIC_FIND_FIRST_BIT is enabled. Signed-off-by: Yury Norov Fixes: 2cc7b6a44ac2 ("lib: add fast path for find_first_*_bit() and find_la= st_bit()") Reported-by: kernel test robot Tested-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/asm-generic/bitops/find.h | 5 +++++ 1 file changed, 5 insertions(+) --- a/include/asm-generic/bitops/find.h +++ b/include/asm-generic/bitops/find.h @@ -97,6 +97,7 @@ unsigned long find_next_zero_bit(const u =20 #ifdef CONFIG_GENERIC_FIND_FIRST_BIT =20 +#ifndef find_first_bit /** * find_first_bit - find the first set bit in a memory region * @addr: The address to start the search at @@ -116,7 +117,9 @@ unsigned long find_first_bit(const unsig =20 return _find_first_bit(addr, size); } +#endif =20 +#ifndef find_first_zero_bit /** * find_first_zero_bit - find the first cleared bit in a memory region * @addr: The address to start the search at @@ -136,6 +139,8 @@ unsigned long find_first_zero_bit(const =20 return _find_first_zero_bit(addr, size); } +#endif + #else /* CONFIG_GENERIC_FIND_FIRST_BIT */ =20 #ifndef find_first_bit From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A8BEC433FE for ; Mon, 24 Jan 2022 22:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839455AbiAXWuu (ORCPT ); Mon, 24 Jan 2022 17:50:50 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53122 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347213AbiAXVns (ORCPT ); Mon, 24 Jan 2022 16:43:48 -0500 Received: from smtp.kernel.org (relay.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 D98B8B812A5; Mon, 24 Jan 2022 21:43:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FC6FC340E4; Mon, 24 Jan 2022 21:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060625; bh=cEeNf3jmmVOl8gPLt5Ntuzx6bXre2UP5a4Q4MpBvFYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nWaedE3lJAvY7xjZ1UPQ0iRhEdOCuvNRU5S6UTbygjpScg10kx7pxPQEQTM1CSkll JQgGABBgB/Q9haBF5vvjkZFQMVgbxocuB0wKKnD+8f2MlaR/0wi+3ywkYecD12Y9wu X2pe8rZI93X5g49UyeYZ7r7Acps41nXRgzbzHhbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , anton.ivanov@cambridgegreys.com, Richard Weinberger Subject: [PATCH 5.16 0977/1039] um: gitignore: Add kernel/capflags.c Date: Mon, 24 Jan 2022 19:46:06 +0100 Message-Id: <20220124184158.126983696@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg commit 4b86366fdfbedec42f8f7ee037775f2839921d34 upstream. This file is generated, we should ignore it. Fixes: d8fb32f4790f ("um: Add support for host CPU flags and alignment") Signed-off-by: Johannes Berg Acked-By: anton.ivanov@cambridgegreys.com Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/um/.gitignore | 1 + 1 file changed, 1 insertion(+) --- a/arch/um/.gitignore +++ b/arch/um/.gitignore @@ -2,3 +2,4 @@ kernel/config.c kernel/config.tmp kernel/vmlinux.lds +kernel/capflags.c From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20662C433FE for ; Tue, 25 Jan 2022 01:59:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413246AbiAYAil (ORCPT ); Mon, 24 Jan 2022 19:38:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364654AbiAXXsq (ORCPT ); Mon, 24 Jan 2022 18:48:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 324CFC0419C0; Mon, 24 Jan 2022 13:43:51 -0800 (PST) Received: from smtp.kernel.org (relay.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 E0EC4B812A7; Mon, 24 Jan 2022 21:43:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0767FC340E4; Mon, 24 Jan 2022 21:43:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060628; bh=n3qzIhkJTs5Zt29pol17QM7Ob/p00R3z1XaX+um3/So=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TGHqDCxsdV5qyCYeU/jSX+S4JPzkJ5gGjcETTC3sMSoh9pDdXlbwMAGVAykIWeEFh 4C+AGe78Vuj9CyJtM20QIGYTi3tj5GgtU6CqWe+Piw1ukGhE6uyc4YQlgcOO85LDdA VnPRNtMJou8uklS5cjC7LCAVhX9DlosV2AmzabaM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Torokhov , Jiri Kosina , Stephen Boyd Subject: [PATCH 5.16 0978/1039] HID: vivaldi: fix handling devices not using numbered reports Date: Mon, 24 Jan 2022 19:46:07 +0100 Message-Id: <20220124184158.161854494@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Torokhov commit 3fe6acd4dc922237b30e55473c9349c6ce0690f3 upstream. Unfortunately details of USB HID transport bled into HID core and handling of numbered/unnumbered reports is quite a mess, with hid_report_len() calculating the length according to USB rules, and hid_hw_raw_request() adding report ID to the buffer for both numbered and unnumbered reports. Untangling it all requres a lot of changes in HID, so for now let's handle this in the driver. [jkosina@suse.cz: microoptimize field->report->id to report->id] Fixes: 14c9c014babe ("HID: add vivaldi HID driver") Signed-off-by: Dmitry Torokhov Tested-by: Stephen Boyd # CoachZ Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/hid-vivaldi.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) --- a/drivers/hid/hid-vivaldi.c +++ b/drivers/hid/hid-vivaldi.c @@ -74,10 +74,11 @@ static void vivaldi_feature_mapping(stru struct hid_usage *usage) { struct vivaldi_data *drvdata =3D hid_get_drvdata(hdev); + struct hid_report *report =3D field->report; int fn_key; int ret; u32 report_len; - u8 *buf; + u8 *report_data, *buf; =20 if (field->logical !=3D HID_USAGE_FN_ROW_PHYSMAP || (usage->hid & HID_USAGE_PAGE) !=3D HID_UP_ORDINAL) @@ -89,12 +90,24 @@ static void vivaldi_feature_mapping(stru if (fn_key > drvdata->max_function_row_key) drvdata->max_function_row_key =3D fn_key; =20 - buf =3D hid_alloc_report_buf(field->report, GFP_KERNEL); - if (!buf) + report_data =3D buf =3D hid_alloc_report_buf(report, GFP_KERNEL); + if (!report_data) return; =20 - report_len =3D hid_report_len(field->report); - ret =3D hid_hw_raw_request(hdev, field->report->id, buf, + report_len =3D hid_report_len(report); + if (!report->id) { + /* + * hid_hw_raw_request() will stuff report ID (which will be 0) + * into the first byte of the buffer even for unnumbered + * reports, so we need to account for this to avoid getting + * -EOVERFLOW in return. + * Note that hid_alloc_report_buf() adds 7 bytes to the size + * so we can safely say that we have space for an extra byte. + */ + report_len++; + } + + ret =3D hid_hw_raw_request(hdev, report->id, report_data, report_len, HID_FEATURE_REPORT, HID_REQ_GET_REPORT); if (ret < 0) { @@ -103,7 +116,16 @@ static void vivaldi_feature_mapping(stru goto out; } =20 - ret =3D hid_report_raw_event(hdev, HID_FEATURE_REPORT, buf, + if (!report->id) { + /* + * Undo the damage from hid_hw_raw_request() for unnumbered + * reports. + */ + report_data++; + report_len--; + } + + ret =3D hid_report_raw_event(hdev, HID_FEATURE_REPORT, report_data, report_len, 0); if (ret) { dev_warn(&hdev->dev, "failed to report feature %d\n", From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3ECDC4707F for ; Tue, 25 Jan 2022 01:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413210AbiAYAih (ORCPT ); Mon, 24 Jan 2022 19:38:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364657AbiAXXsq (ORCPT ); Mon, 24 Jan 2022 18:48:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A18C8C0419C3; Mon, 24 Jan 2022 13:43:52 -0800 (PST) Received: from smtp.kernel.org (relay.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 3F2406150C; Mon, 24 Jan 2022 21:43:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E9E8C340E4; Mon, 24 Jan 2022 21:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060631; bh=CebMge8ZokDceHnQirwT/xJla2PRMXWsgU00AcpgTGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qvtm+dGydx3j/ulWAcEoK0XwN+Q6aqBUwniOFcPPyM91r3cxBS0AMJKlRHd8h96Vp tDNVFJzeJCWPAcu68l5jdIhjPbvirMPB6qtr+VVMKZL+u6bJHbH/OSjr9i+OwDKe+o yw8fj/ftf5vhsRXOfSi0oSpPzv+IKfzT2qvkNoKQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matt Johnston , Jakub Kicinski Subject: [PATCH 5.16 0979/1039] mctp: test: zero out sockaddr Date: Mon, 24 Jan 2022 19:46:08 +0100 Message-Id: <20220124184158.194479211@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matt Johnston commit 284a4d94e8e74fbd731ee67e29196656ca823423 upstream. MCTP now requires that padding bytes are zero. Signed-off-by: Matt Johnston Fixes: 1e4b50f06d97 ("mctp: handle the struct sockaddr_mctp padding fields") Link: https://lore.kernel.org/r/20220110021806.2343023-1-matt@codeconstruct= .com.au Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/mctp/test/route-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/mctp/test/route-test.c +++ b/net/mctp/test/route-test.c @@ -285,7 +285,7 @@ static void __mctp_route_test_init(struc struct mctp_test_route **rtp, struct socket **sockp) { - struct sockaddr_mctp addr; + struct sockaddr_mctp addr =3D {0}; struct mctp_test_route *rt; struct mctp_test_dev *dev; struct socket *sock; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 005E1C47080 for ; Tue, 25 Jan 2022 01:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413228AbiAYAij (ORCPT ); Mon, 24 Jan 2022 19:38:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364663AbiAXXsq (ORCPT ); Mon, 24 Jan 2022 18:48:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6853C0419C7; Mon, 24 Jan 2022 13:43:55 -0800 (PST) Received: from smtp.kernel.org (relay.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 67C5061502; Mon, 24 Jan 2022 21:43:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28B8DC340E4; Mon, 24 Jan 2022 21:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060634; bh=dKelhVWUvz4ApohNdesXTvFVNa5aDTyUP3bnUOpRi+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KBJp4gea+PDzTs9nJF/widWMElGhbfQikLF0ki5vMyMtevaoxmI8PhTHmZNydpg8f xkyqMWnsmfI+NSHYt+zAUvPoWLYtb8WGMQTLWWti0zASb1oMkH1WHwSGPjPToSRbir SXBAXDwEZxLx3FGXmkZwv42J1fMNcbs0iRG/8uyY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , "Gustavo A. R. Silva" , Alexandre Belloni Subject: [PATCH 5.16 0980/1039] rtc: Move variable into switch case statement Date: Mon, 24 Jan 2022 19:46:09 +0100 Message-Id: <20220124184158.226111508@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kees Cook commit ba52eac083e1598e748811ff58d259f77e4c5c4d upstream. When building with automatic stack variable initialization, GCC 12 complains about variables defined outside of switch case statements. Move the variable into the case that uses it, which silences the warning: drivers/rtc/dev.c: In function 'rtc_dev_ioctl': drivers/rtc/dev.c:394:30: warning: statement will never be executed [-Wswit= ch-unreachable] 394 | long offset; | ^~~~~~ Fixes: 6a8af1b6568a ("rtc: add parameter ioctl") Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20211209043915.1378393-1-keescook@chromium.= org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/rtc/dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/rtc/dev.c +++ b/drivers/rtc/dev.c @@ -391,14 +391,14 @@ static long rtc_dev_ioctl(struct file *f } =20 switch(param.param) { - long offset; case RTC_PARAM_FEATURES: if (param.index !=3D 0) err =3D -EINVAL; param.uvalue =3D rtc->features[0]; break; =20 - case RTC_PARAM_CORRECTION: + case RTC_PARAM_CORRECTION: { + long offset; mutex_unlock(&rtc->ops_lock); if (param.index !=3D 0) return -EINVAL; @@ -407,7 +407,7 @@ static long rtc_dev_ioctl(struct file *f if (err =3D=3D 0) param.svalue =3D offset; break; - + } default: if (rtc->ops->param_get) err =3D rtc->ops->param_get(rtc->dev.parent, ¶m); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE144C43217 for ; Mon, 24 Jan 2022 22:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839721AbiAXWvq (ORCPT ); Mon, 24 Jan 2022 17:51:46 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53240 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378618AbiAXVoA (ORCPT ); Mon, 24 Jan 2022 16:44:00 -0500 Received: from smtp.kernel.org (relay.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 18B40B8123A; Mon, 24 Jan 2022 21:43:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A6C0C340E4; Mon, 24 Jan 2022 21:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060637; bh=t36Qf7OqaHp5mhLh63Ejubt/7CRwFd48SoJJMeaqkEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VwzbQcLF2W87QpR//XjxHNw7jM9G8kGeHB772m3LI9cB/0N8QSGfqipduRA1ncehP JAXxL1vRaPm2MFDw+tZz35gKUeSjdbT198exSxvM0YRjYSH2YFyjZCLIypjwi2Tmld gu3OxcuIgOzOsYiakuK7ULCGX+BBzdsWiUAkTPao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurence de Bruxelles , Alexandre Belloni Subject: [PATCH 5.16 0981/1039] rtc: pxa: fix null pointer dereference Date: Mon, 24 Jan 2022 19:46:10 +0100 Message-Id: <20220124184158.258239040@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Laurence de Bruxelles commit 34127b3632b21e5c391756e724b1198eb9917981 upstream. With the latest stable kernel versions the rtc on the PXA based Zaurus does not work, when booting I see the following kernel messages: pxa-rtc pxa-rtc: failed to find rtc clock source pxa-rtc pxa-rtc: Unable to init SA1100 RTC sub-device pxa-rtc: probe of pxa-rtc failed with error -2 hctosys: unable to open rtc device (rtc0) I think this is because commit f2997775b111 ("rtc: sa1100: fix possible race condition") moved the allocation of the rtc_device struct out of sa1100_rtc_init and into sa1100_rtc_probe. This means that pxa_rtc_probe also needs to do allocation for the rtc_device struct, otherwise sa1100_rtc_init will try to dereference a null pointer. This patch adds that allocation by copying how sa1100_rtc_probe in drivers/rtc/rtc-sa1100.c does it; after the IRQs are set up a managed rtc_device is allocated. I've tested this patch with `qemu-system-arm -machine akita` and with a real Zaurus SL-C1000 applied to 4.19, 5.4, and 5.10. Signed-off-by: Laurence de Bruxelles Fixes: f2997775b111 ("rtc: sa1100: fix possible race condition") Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20220101154149.12026-1-lfdebrux@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/rtc/rtc-pxa.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/rtc/rtc-pxa.c +++ b/drivers/rtc/rtc-pxa.c @@ -330,6 +330,10 @@ static int __init pxa_rtc_probe(struct p if (sa1100_rtc->irq_alarm < 0) return -ENXIO; =20 + sa1100_rtc->rtc =3D devm_rtc_allocate_device(&pdev->dev); + if (IS_ERR(sa1100_rtc->rtc)) + return PTR_ERR(sa1100_rtc->rtc); + pxa_rtc->base =3D devm_ioremap(dev, pxa_rtc->ress->start, resource_size(pxa_rtc->ress)); if (!pxa_rtc->base) { From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEAC0C433FE for ; Mon, 24 Jan 2022 22:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839657AbiAXWvh (ORCPT ); Mon, 24 Jan 2022 17:51:37 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53258 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378844AbiAXVoD (ORCPT ); Mon, 24 Jan 2022 16:44:03 -0500 Received: from smtp.kernel.org (relay.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 3D439B811FC; Mon, 24 Jan 2022 21:44:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49527C340E4; Mon, 24 Jan 2022 21:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060641; bh=toS2nEL/HovX5hqVgGICDP1uLl/XeY10V55n1+2q4Mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mK3kCltUOeNehVC9TStqaJT6nH3aqZdCkJSog0K56fv8KhyrieVxnkzoTxzg8hErR oLnsj0xmlxTerWi0LzTG9kP04p4oHx3O3KKhHVS6ftaC/y8tnBy77XGc/aNvvnwsoo GuF/TtS9+LJE1XFGzUSqqKyW/eamoHzx4G1dvMyQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eli Cohen , "Michael S. Tsirkin" , Parav Pandit , Jason Wang , Si-Wei Liu Subject: [PATCH 5.16 0982/1039] vdpa/mlx5: Fix wrong configuration of virtio_version_1_0 Date: Mon, 24 Jan 2022 19:46:11 +0100 Message-Id: <20220124184158.288162031@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eli Cohen commit 97143b70aa847f2b0a1f959dde126b76ff7b5376 upstream. Remove overriding of virtio_version_1_0 which forced the virtqueue object to version 1. Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices= ") Signed-off-by: Eli Cohen Link: https://lore.kernel.org/r/20211230142024.142979-1-elic@nvidia.com Signed-off-by: Michael S. Tsirkin Reviewed-by: Parav Pandit Acked-by: Jason Wang Reviewed-by: Si-Wei Liu Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 -- 1 file changed, 2 deletions(-) --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -876,8 +876,6 @@ static int create_virtqueue(struct mlx5_ MLX5_SET(virtio_q, vq_ctx, umem_3_id, mvq->umem3.id); MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem3.size); MLX5_SET(virtio_q, vq_ctx, pd, ndev->mvdev.res.pdn); - if (MLX5_CAP_DEV_VDPA_EMULATION(ndev->mvdev.mdev, eth_frame_offload_type)) - MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, 1); =20 err =3D mlx5_cmd_exec(ndev->mvdev.mdev, in, inlen, out, sizeof(out)); if (err) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB8EBC4167D for ; Mon, 24 Jan 2022 22:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377411AbiAXWrP (ORCPT ); Mon, 24 Jan 2022 17:47:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52408 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457859AbiAXVmY (ORCPT ); Mon, 24 Jan 2022 16:42:24 -0500 Received: from smtp.kernel.org (relay.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 DAE16B811A9; Mon, 24 Jan 2022 21:42:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15A74C340E4; Mon, 24 Jan 2022 21:42:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060541; bh=Gl0jy4PB5R5wa6o52whfL1Em2AKbbEFdXHfbPfhrtME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K49rSfobpH8tJuU7To1ke4zDHyldQjk99jmZ0hcpUfXMIw8Y4jA846+2ZvGjBHiRW zKROg6rw1iklVmejWfugQpI9JE496I3SDOSkShj4oJIXBN/wRzLaJtyAE83vOhMXmc GzTIzcZNyi+ua65jvuZgq1KmPNgQ3wmfx2U2+ylw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Xuan Zhuo" , Jiasheng Jiang , "Michael S. Tsirkin" Subject: [PATCH 5.16 0983/1039] virtio_ring: mark ring unused on error Date: Mon, 24 Jan 2022 19:46:12 +0100 Message-Id: <20220124184158.318703837@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 1861ba626ae9b98136f3e504208cdef6b29cd3ec upstream. A recently added error path does not mark ring unused when exiting on OOM, which will lead to BUG on the next entry in debug builds. TODO: refactor code so we have START_USE and END_USE in the same function. Fixes: fc6d70f40b3d ("virtio_ring: check desc =3D=3D NULL when using indire= ct with packed") Cc: "Xuan Zhuo" Cc: Jiasheng Jiang Reviewed-by: Xuan Zhuo Signed-off-by: Michael S. Tsirkin Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/virtio/virtio_ring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -1197,8 +1197,10 @@ static inline int virtqueue_add_packed(s if (virtqueue_use_indirect(_vq, total_sg)) { err =3D virtqueue_add_indirect_packed(vq, sgs, total_sg, out_sgs, in_sgs, data, gfp); - if (err !=3D -ENOMEM) + if (err !=3D -ENOMEM) { + END_USE(vq); return err; + } =20 /* fall back on direct */ } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68465C4321E for ; Tue, 25 Jan 2022 01:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412890AbiAYAh6 (ORCPT ); Mon, 24 Jan 2022 19:37:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364082AbiAXXqp (ORCPT ); Mon, 24 Jan 2022 18:46:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B07C2C0612B2; Mon, 24 Jan 2022 13:42:25 -0800 (PST) Received: from smtp.kernel.org (relay.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 4F2C460917; Mon, 24 Jan 2022 21:42:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 210FCC340E4; Mon, 24 Jan 2022 21:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060544; bh=OLGhyBE3yYUeUqi46/+gVKgkTva0eh9cbOByjskd/PM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QU1Vt/+bGGqrbdJxxqryg9INuKTWr1rpUID7XPQKOeFTqcem6r044qd0/JRk0AmS1 0D23XOOsJKDDMUxbsxBeXsnr5tMiSBsFVoWpusWAtfJVSuWNCeqBBnMW0siq97i18l Qjzmtbxi4OIdiprFdNj3Zgmrg9S9FTDS0VZpy4Fc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Balbir Singh , "Eric W. Biederman" Subject: [PATCH 5.16 0984/1039] taskstats: Cleanup the use of task->exit_code Date: Mon, 24 Jan 2022 19:46:13 +0100 Message-Id: <20220124184158.349632089@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric W. Biederman commit 1b5a42d9c85f0e731f01c8d1129001fd8531a8a0 upstream. In the function bacct_add_task the code reading task->exit_code was introduced in commit f3cef7a99469 ("[PATCH] csa: basic accounting over taskstats"), and it is not entirely clear what the taskstats interface is trying to return as only returning the exit_code of the first task in a process doesn't make a lot of sense. As best as I can figure the intent is to return task->exit_code after a task exits. The field is returned with per task fields, so the exit_code of the entire process is not wanted. Only the value of the first task is returned so this is not a useful way to get the per task ptrace stop code. The ordinary case of returning this value is returning after a task exits, which also precludes use for getting a ptrace value. It is common to for the first task of a process to also be the last task of a process so this field may have done something reasonable by accident in testing. Make ac_exitcode a reliable per task value by always returning it for every exited task. Setting ac_exitcode in a sensible mannter makes it possible to continue to provide this value going forward. Cc: Balbir Singh Fixes: f3cef7a99469 ("[PATCH] csa: basic accounting over taskstats") Link: https://lkml.kernel.org/r/20220103213312.9144-5-ebiederm@xmission.com Signed-off-by: "Eric W. Biederman" Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/tsacct.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/kernel/tsacct.c +++ b/kernel/tsacct.c @@ -38,11 +38,10 @@ void bacct_add_tsk(struct user_namespace stats->ac_btime =3D clamp_t(time64_t, btime, 0, U32_MAX); stats->ac_btime64 =3D btime; =20 - if (thread_group_leader(tsk)) { + if (tsk->flags & PF_EXITING) stats->ac_exitcode =3D tsk->exit_code; - if (tsk->flags & PF_FORKNOEXEC) - stats->ac_flag |=3D AFORK; - } + if (thread_group_leader(tsk) && (tsk->flags & PF_FORKNOEXEC)) + stats->ac_flag |=3D AFORK; if (tsk->flags & PF_SUPERPRIV) stats->ac_flag |=3D ASU; if (tsk->flags & PF_DUMPCORE) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 257BEC433F5 for ; Tue, 25 Jan 2022 01:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412835AbiAYAhx (ORCPT ); Mon, 24 Jan 2022 19:37:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364097AbiAXXqp (ORCPT ); Mon, 24 Jan 2022 18:46:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA47BC061250; Mon, 24 Jan 2022 13:42:28 -0800 (PST) Received: from smtp.kernel.org (relay.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 7AB1360917; Mon, 24 Jan 2022 21:42:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5783BC340E4; Mon, 24 Jan 2022 21:42:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060547; bh=8gIy0nFAgB03VCQxnZfvFcSa3D+U6k63cyxwaTXRIKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RKYoqIt/WXqc87JcD8d2UG6UPsFtnp/aA2S4LS5Do95BXAkvI9/7MeHmyq/bSZlAw FGJyuyCAZ/77KkLHR8msHqQ0J+OAyCGcWCBBMHR6ya3jMztywBdVvyz5vqEhCGv2g/ E5hdIDikBZeuN+0If/YHhCQw2MNJuIKZb8u+20zQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" Subject: [PATCH 5.16 0985/1039] inet: frags: annotate races around fqdir->dead and fqdir->high_thresh Date: Mon, 24 Jan 2022 19:46:14 +0100 Message-Id: <20220124184158.385942525@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit 91341fa0003befd097e190ec2a4bf63ad957c49a upstream. Both fields can be read/written without synchronization, add proper accessors and documentation. Fixes: d5dd88794a13 ("inet: fix various use-after-free in defrags units") Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/net/inet_frag.h | 11 +++++++++-- include/net/ipv6_frag.h | 3 ++- net/ipv4/inet_fragment.c | 8 +++++--- net/ipv4/ip_fragment.c | 3 ++- 4 files changed, 18 insertions(+), 7 deletions(-) --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h @@ -117,8 +117,15 @@ int fqdir_init(struct fqdir **fqdirp, st =20 static inline void fqdir_pre_exit(struct fqdir *fqdir) { - fqdir->high_thresh =3D 0; /* prevent creation of new frags */ - fqdir->dead =3D true; + /* Prevent creation of new frags. + * Pairs with READ_ONCE() in inet_frag_find(). + */ + WRITE_ONCE(fqdir->high_thresh, 0); + + /* Pairs with READ_ONCE() in inet_frag_kill(), ip_expire() + * and ip6frag_expire_frag_queue(). + */ + WRITE_ONCE(fqdir->dead, true); } void fqdir_exit(struct fqdir *fqdir); =20 --- a/include/net/ipv6_frag.h +++ b/include/net/ipv6_frag.h @@ -67,7 +67,8 @@ ip6frag_expire_frag_queue(struct net *ne struct sk_buff *head; =20 rcu_read_lock(); - if (fq->q.fqdir->dead) + /* Paired with the WRITE_ONCE() in fqdir_pre_exit(). */ + if (READ_ONCE(fq->q.fqdir->dead)) goto out_rcu_unlock; spin_lock(&fq->q.lock); =20 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c @@ -235,9 +235,9 @@ void inet_frag_kill(struct inet_frag_que /* The RCU read lock provides a memory barrier * guaranteeing that if fqdir->dead is false then * the hash table destruction will not start until - * after we unlock. Paired with inet_frags_exit_net(). + * after we unlock. Paired with fqdir_pre_exit(). */ - if (!fqdir->dead) { + if (!READ_ONCE(fqdir->dead)) { rhashtable_remove_fast(&fqdir->rhashtable, &fq->node, fqdir->f->rhash_params); refcount_dec(&fq->refcnt); @@ -352,9 +352,11 @@ static struct inet_frag_queue *inet_frag /* TODO : call from rcu_read_lock() and no longer use refcount_inc_not_zer= o() */ struct inet_frag_queue *inet_frag_find(struct fqdir *fqdir, void *key) { + /* This pairs with WRITE_ONCE() in fqdir_pre_exit(). */ + long high_thresh =3D READ_ONCE(fqdir->high_thresh); struct inet_frag_queue *fq =3D NULL, *prev; =20 - if (!fqdir->high_thresh || frag_mem_limit(fqdir) > fqdir->high_thresh) + if (!high_thresh || frag_mem_limit(fqdir) > high_thresh) return NULL; =20 rcu_read_lock(); --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c @@ -144,7 +144,8 @@ static void ip_expire(struct timer_list =20 rcu_read_lock(); =20 - if (qp->q.fqdir->dead) + /* Paired with WRITE_ONCE() in fqdir_pre_exit(). */ + if (READ_ONCE(qp->q.fqdir->dead)) goto out_rcu_unlock; =20 spin_lock(&qp->q.lock); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C9AFC35271 for ; Mon, 24 Jan 2022 22:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582367AbiAXWrh (ORCPT ); Mon, 24 Jan 2022 17:47:37 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52516 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457934AbiAXVmd (ORCPT ); Mon, 24 Jan 2022 16:42:33 -0500 Received: from smtp.kernel.org (relay.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 26F89B81233; Mon, 24 Jan 2022 21:42:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F548C340E4; Mon, 24 Jan 2022 21:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060550; bh=q67Yuv2lFh5A7efPX2bOzffmmlUvGKImDLhXNGY13OQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1B1CY8MmRhfRH1IuG2pIvz52Y69m+dAH2gzsZCHpelREg99sbT/aST3QvTzoNVjrt pSgT5OQxznzJYwL5aQVjqbVucs3uDgWZQgyANomYFpa4SSM2VB1LNFu2bycOiNEL8e rPCKmWirBKzp2Z21xdaThM91UlKgr2lfQ7WycOy4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "Eric W. Biederman" , "David S. Miller" Subject: [PATCH 5.16 0986/1039] netns: add schedule point in ops_exit_list() Date: Mon, 24 Jan 2022 19:46:15 +0100 Message-Id: <20220124184158.418801561@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit 2836615aa22de55b8fca5e32fe1b27a67cda625e upstream. When under stress, cleanup_net() can have to dismantle netns in big numbers. ops_exit_list() currently calls many helpers [1] that have no schedule point, and we can end up with soft lockups, particularly on hosts with many cpus. Even for moderate amount of netns processed by cleanup_net() this patch avoids latency spikes. [1] Some of these helpers like fib_sync_up() and fib_sync_down_dev() are very slow because net/ipv4/fib_semantics.c uses host-wide hash tables, and ifindex is used as the only input of two hash functions. ifindexes tend to be the same for all netns (lo.ifindex=3D=3D1 per inst= ance) This will be fixed in a separate patch. Fixes: 72ad937abd0a ("net: Add support for batching network namespace clean= ups") Signed-off-by: Eric Dumazet Cc: Eric W. Biederman Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/core/net_namespace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -164,8 +164,10 @@ static void ops_exit_list(const struct p { struct net *net; if (ops->exit) { - list_for_each_entry(net, net_exit_list, exit_list) + list_for_each_entry(net, net_exit_list, exit_list) { ops->exit(net); + cond_resched(); + } } if (ops->exit_batch) ops->exit_batch(net_exit_list); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37F94C4332F for ; Tue, 25 Jan 2022 01:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412852AbiAYAhz (ORCPT ); Mon, 24 Jan 2022 19:37:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364101AbiAXXqp (ORCPT ); Mon, 24 Jan 2022 18:46:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56571C07E300; Mon, 24 Jan 2022 13:42:36 -0800 (PST) Received: from smtp.kernel.org (relay.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 1CFDAB8123D; Mon, 24 Jan 2022 21:42:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47FD4C340E4; Mon, 24 Jan 2022 21:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060553; bh=2PTn4U8QrvFxiZVeAWyU4GTHX3jAXc7OZFieR3may00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QnbD6aNZom/jj+y0Gys3aKKHwLlmhEsKS9JGgz8ST0uAfVFGrWaJ2Y50u890SR+jf YNyG0ofIapwp7Si90igGRGhewO16mMEm/FbSWmBkv2nKtvcH9qp+yo/3ypUDBfydz7 EhBaMVMafzA7mk38DiETsk2AcCt+MOkCywl9PXhs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Luca Coelho Subject: [PATCH 5.16 0987/1039] iwlwifi: fix Bz NMI behaviour Date: Mon, 24 Jan 2022 19:46:16 +0100 Message-Id: <20220124184158.456652014@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg commit fdfde0cb79264f88992e72b5a056a3a3284fcaad upstream. Contrary to what was stated before, the hardware hasn't changed the bits here yet. In any case, the new CSR is also directly (lower 16 bits) connected to UREG_DOORBELL_TO_ISR6, so if it still changes the changes would be there. Adjust the code and comments accordingly. Signed-off-by: Johannes Berg Fixes: 6c0795f1a524 ("iwlwifi: implement Bz NMI behaviour") Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211210090244.75b6207536e3.I7d170a= 48a9096e6b7269c3a9f447c326f929b171@changeid Signed-off-by: Luca Coelho Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/iwl-csr.h | 5 +++-- drivers/net/wireless/intel/iwlwifi/iwl-io.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) --- a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h @@ -105,9 +105,10 @@ /* GIO Chicken Bits (PCI Express bus link power management) */ #define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) =20 -/* Doorbell NMI (since Bz) */ +/* Doorbell - since Bz + * connected to UREG_DOORBELL_TO_ISR6 (lower 16 bits only) + */ #define CSR_DOORBELL_VECTOR (CSR_BASE + 0x130) -#define CSR_DOORBELL_VECTOR_NMI BIT(1) =20 /* host chicken bits */ #define CSR_HOST_CHICKEN (CSR_BASE + 0x204) --- a/drivers/net/wireless/intel/iwlwifi/iwl-io.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-io.c @@ -218,7 +218,7 @@ void iwl_force_nmi(struct iwl_trans *tra UREG_DOORBELL_TO_ISR6_NMI_BIT); else iwl_write32(trans, CSR_DOORBELL_VECTOR, - CSR_DOORBELL_VECTOR_NMI); + UREG_DOORBELL_TO_ISR6_NMI_BIT); } IWL_EXPORT_SYMBOL(iwl_force_nmi); =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05493C433FE for ; Tue, 25 Jan 2022 01:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412811AbiAYAhv (ORCPT ); Mon, 24 Jan 2022 19:37:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364099AbiAXXqp (ORCPT ); Mon, 24 Jan 2022 18:46:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64E78C07E301; Mon, 24 Jan 2022 13:42:39 -0800 (PST) Received: from smtp.kernel.org (relay.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 22CDAB8123A; Mon, 24 Jan 2022 21:42:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 537A4C340E4; Mon, 24 Jan 2022 21:42:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060556; bh=yBgjbG95xYBaKYlqVCGbOh+SNsixA6Cot1PJPTtTCS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oUY0+8PgwjAMifumK/gJ+VS1YUOXWfN3STbfsXAHdVrEzUS6PX+t7CuFZ0AsHjBlT RHwulWYVmDeM/JhAE/oOZqWJM9olfPVza6TB+5D3IxYqbO1x5mgLLxEITHNLiLN+++ iF7RStvTsMEzxBp4si7y80QYPMRryFi2KO4XSwUU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Jakub Kicinski Subject: [PATCH 5.16 0988/1039] xfrm: Dont accidentally set RTO_ONLINK in decode_session4() Date: Mon, 24 Jan 2022 19:46:17 +0100 Message-Id: <20220124184158.486374487@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guillaume Nault commit 23e7b1bfed61e301853b5e35472820d919498278 upstream. Similar to commit 94e2238969e8 ("xfrm4: strip ECN bits from tos field"), clear the ECN bits from iph->tos when setting ->flowi4_tos. This ensures that the last bit of ->flowi4_tos is cleared, so ip_route_output_key_hash() isn't going to restrict the scope of the route lookup. Use ~INET_ECN_MASK instead of IPTOS_RT_MASK, because we have no reason to clear the high order bits. Found by code inspection, compile tested only. Fixes: 4da3089f2b58 ("[IPSEC]: Use TOS when doing tunnel lookups") Signed-off-by: Guillaume Nault Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/xfrm/xfrm_policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -3295,7 +3296,7 @@ decode_session4(struct sk_buff *skb, str fl4->flowi4_proto =3D iph->protocol; fl4->daddr =3D reverse ? iph->saddr : iph->daddr; fl4->saddr =3D reverse ? iph->daddr : iph->saddr; - fl4->flowi4_tos =3D iph->tos; + fl4->flowi4_tos =3D iph->tos & ~INET_ECN_MASK; =20 if (!ip_is_fragment(iph)) { switch (iph->protocol) { From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46A06C433F5 for ; Tue, 25 Jan 2022 00:32:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358703AbiAYAcM (ORCPT ); Mon, 24 Jan 2022 19:32:12 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52556 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1458000AbiAXVmm (ORCPT ); Mon, 24 Jan 2022 16:42:42 -0500 Received: from smtp.kernel.org (relay.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 0E774B8105C; Mon, 24 Jan 2022 21:42:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B5ECC340E4; Mon, 24 Jan 2022 21:42:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060559; bh=Ot15rwWFhC5Y9Tgc2XIb408EAx4V0xwHo7eIlUuZ344=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a88W/WAEGQc0xVS2o1qz7WV6Pvf7nKOvy98M8VINfssLqBv2RY3+rz//Fsj7wkLC4 eStPEJueuzx58o70hAptdSnbZT6k65oWDip8wxLcVfvR1QiiM77NL4lra7xFtrWk57 8jt2Wo+01roojwZSh8QaHAFlW0X8GQyV/jWvqj94= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Si-Wei Liu , Jason Wang , Eli Cohen , "Michael S. Tsirkin" Subject: [PATCH 5.16 0989/1039] vdpa/mlx5: Fix config_attr_mask assignment Date: Mon, 24 Jan 2022 19:46:18 +0100 Message-Id: <20220124184158.520054075@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eli Cohen commit e3137056e6dedee205fccd06da031a285c6e34f5 upstream. Fix VDPA_ATTR_DEV_NET_CFG_MACADDR assignment to be explicit 64 bit assignment. No issue was seen since the value is well below 64 bit max value. Nevertheless it needs to be fixed. Fixes: a007d940040c ("vdpa/mlx5: Support configuration of MAC") Reviewed-by: Si-Wei Liu Acked-by: Jason Wang Signed-off-by: Eli Cohen Link: https://lore.kernel.org/r/20220105114646.577224-7-elic@nvidia.com Signed-off-by: Michael S. Tsirkin Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2674,7 +2674,7 @@ static int mlx5v_probe(struct auxiliary_ mgtdev->mgtdev.ops =3D &mdev_ops; mgtdev->mgtdev.device =3D mdev->device; mgtdev->mgtdev.id_table =3D id_table; - mgtdev->mgtdev.config_attr_mask =3D (1 << VDPA_ATTR_DEV_NET_CFG_MACADDR); + mgtdev->mgtdev.config_attr_mask =3D BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR= ); mgtdev->madev =3D madev; =20 err =3D vdpa_mgmtdev_register(&mgtdev->mgtdev); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09409C433EF for ; Mon, 24 Jan 2022 22:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839736AbiAXWvt (ORCPT ); Mon, 24 Jan 2022 17:51:49 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50594 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1458060AbiAXVmp (ORCPT ); Mon, 24 Jan 2022 16:42:45 -0500 Received: from smtp.kernel.org (relay.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 E869DB8123D; Mon, 24 Jan 2022 21:42:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21676C340E4; Mon, 24 Jan 2022 21:42:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060562; bh=zn1/vkIKSsHHShRtUDmM69UDuNQVHj7HCPJ6GFMa9Z4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=blaPTSwNxyduXVjzx/ZF9rfpvfSo/NqqP9IQfGpuwyvrUrh6MWcPzrelwgtlLWjDJ mAEs4LQqGrIHnftydi7evgRPjq6MM4P9Rm2oWXt9Oy+pLQeL8f9SwhuJPqgEZReD7w fEumhSyAnLvlOdSQGaizXrcpX7fJ8oA+RTtzRW7U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Si-Wei Liu , Jason Wang , Eli Cohen , "Michael S. Tsirkin" Subject: [PATCH 5.16 0990/1039] vdpa/mlx5: Restore cur_num_vqs in case of failure in change_num_qps() Date: Mon, 24 Jan 2022 19:46:19 +0100 Message-Id: <20220124184158.565151475@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eli Cohen commit 37e07e705888e4c3502f204e9c6785c9c2d6d86a upstream. Restore ndev->cur_num_vqs to the original value in case change_num_qps() fails. Fixes: 52893733f2c5 ("vdpa/mlx5: Add multiqueue support") Reviewed-by: Si-Wei Liu Acked-by: Jason Wang Signed-off-by: Eli Cohen Link: https://lore.kernel.org/r/20220105114646.577224-10-elic@nvidia.com Signed-off-by: Michael S. Tsirkin Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1552,9 +1552,11 @@ static int change_num_qps(struct mlx5_vd return 0; =20 clean_added: - for (--i; i >=3D cur_qps; --i) + for (--i; i >=3D 2 * cur_qps; --i) teardown_vq(ndev, &ndev->vqs[i]); =20 + ndev->cur_num_vqs =3D 2 * cur_qps; + return err; } =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4EBAC433FE for ; Mon, 24 Jan 2022 22:53:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839611AbiAXWva (ORCPT ); Mon, 24 Jan 2022 17:51:30 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59280 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1458117AbiAXVmq (ORCPT ); Mon, 24 Jan 2022 16:42:46 -0500 Received: from smtp.kernel.org (relay.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 2ADE76146A; Mon, 24 Jan 2022 21:42:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1618C340E4; Mon, 24 Jan 2022 21:42:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060565; bh=HMgHsusz66jvKUn2q1i3T3oRyyk+TIy9VI2jBQLzg/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lsXUEg5Z5zTxBRQhKox9l0VoJyq3XKxX+Z/oPLkfO3PovbqouYYvFY8AkaMJkuJkj 6b5Z0jRIokp+BR7+SGPyYqPEuy6rpGZTShd50p5NWrKNVyC8yx6bo31DsY4EkIkxe+ uEyvXh1Mfff6aEE+KfxcqMugX1btaCUQfLk6Eesc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Jakub Kicinski Subject: [PATCH 5.16 0991/1039] gre: Dont accidentally set RTO_ONLINK in gre_fill_metadata_dst() Date: Mon, 24 Jan 2022 19:46:20 +0100 Message-Id: <20220124184158.599754506@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guillaume Nault commit f7716b318568b22fbf0e3be99279a979e217cf71 upstream. Mask the ECN bits before initialising ->flowi4_tos. The tunnel key may have the last ECN bit set, which will interfere with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope). Found by code inspection, compile tested only. Fixes: 962924fa2b7a ("ip_gre: Refactor collect metatdata mode tunnel xmit t= o ip_md_tunnel_xmit") Signed-off-by: Guillaume Nault Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/ipv4/ip_gre.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -604,8 +604,9 @@ static int gre_fill_metadata_dst(struct =20 key =3D &info->key; ip_tunnel_init_flow(&fl4, IPPROTO_GRE, key->u.ipv4.dst, key->u.ipv4.src, - tunnel_id_to_key32(key->tun_id), key->tos, 0, - skb->mark, skb_get_hash(skb)); + tunnel_id_to_key32(key->tun_id), + key->tos & ~INET_ECN_MASK, 0, skb->mark, + skb_get_hash(skb)); rt =3D ip_route_output_key(dev_net(dev), &fl4); if (IS_ERR(rt)) return PTR_ERR(rt); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C516FC433EF for ; Tue, 25 Jan 2022 01:59:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413375AbiAYAiz (ORCPT ); Mon, 24 Jan 2022 19:38:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364092AbiAXXqp (ORCPT ); Mon, 24 Jan 2022 18:46:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 252F1C07A945; Mon, 24 Jan 2022 13:42:51 -0800 (PST) Received: from smtp.kernel.org (relay.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 E35F9B81142; Mon, 24 Jan 2022 21:42:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FDBAC340E4; Mon, 24 Jan 2022 21:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060568; bh=DthYjh+AUf6U0msGHmNsk3EuOaLtsWRn1QyFhfakDLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ksX1h0/zfO9OHobYtuSOCQOyLdUqnP1WcsIsMA6WJ7JPXx3xepEeNmO85ndydcQC1 VtF238wBH9wM19Maz7kIptyAnPpOQXlB0fjlV5wgURpiXVh6/Glgi0qmUIUSz3dviT deVKy+Acru37OvX41FI4hFaVaIu468jToC6vZaMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Jakub Kicinski Subject: [PATCH 5.16 0992/1039] libcxgb: Dont accidentally set RTO_ONLINK in cxgb_find_route() Date: Mon, 24 Jan 2022 19:46:21 +0100 Message-Id: <20220124184158.638161873@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guillaume Nault commit a915deaa9abe4fb3a440312c954253a6a733608e upstream. Mask the ECN bits before calling ip_route_output_ports(). The tos variable might be passed directly from an IPv4 header, so it may have the last ECN bit set. This interferes with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope). Found by code inspection, compile tested only. Fixes: 804c2f3e36ef ("libcxgb,iw_cxgb4,cxgbit: add cxgb_find_route()") Signed-off-by: Guillaume Nault Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c @@ -32,6 +32,7 @@ =20 #include #include +#include #include #include =20 @@ -99,7 +100,7 @@ cxgb_find_route(struct cxgb4_lld_info *l =20 rt =3D ip_route_output_ports(&init_net, &fl4, NULL, peer_ip, local_ip, peer_port, local_port, IPPROTO_TCP, - tos, 0); + tos & ~INET_ECN_MASK, 0); if (IS_ERR(rt)) return NULL; n =3D dst_neigh_lookup(&rt->dst, &peer_ip); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58889C433F5 for ; Mon, 24 Jan 2022 22:48:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1453881AbiAXWs3 (ORCPT ); Mon, 24 Jan 2022 17:48:29 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52676 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573040AbiAXVm5 (ORCPT ); Mon, 24 Jan 2022 16:42:57 -0500 Received: from smtp.kernel.org (relay.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 C9146B80CCF; Mon, 24 Jan 2022 21:42:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F051DC340E4; Mon, 24 Jan 2022 21:42:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060574; bh=X24xw2mD4tZTlOt+v1NYqsBi5NtBEk4lzJIRzF3aMqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zyHutr7z8UURwPEUTlHN4ZGqgCXErOqj5WjYbuSVXbVZA9bmFVf/BIUVCUYnwmMru U94o4KXb2adYhVyYzr9k/eT3bjWLiLUrLGvWbRY2jgMI/tMCMh6sdizG0896Ew9nmY 1rQFqZYZIfu1NlVhdOlKuaVZJejI6Iq8LNdvzh0g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 5.16 0993/1039] perf script: Fix hex dump character output Date: Mon, 24 Jan 2022 19:46:22 +0100 Message-Id: <20220124184158.668119314@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 62942e9fda9fd1def10ffcbd5e1c025b3c9eec17 upstream. Using grep -C with perf script -D can give erroneous results as grep loses lines due to non-printable characters, for example, below the 0020, 0060 and 0070 lines are missing: $ perf script -D | grep -C10 AUX | head . 0010: 08 00 00 00 00 00 00 00 1f 00 00 00 00 00 00 00 ................ . 0030: 01 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 ................ . 0040: 00 08 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0050: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ . 0080: 02 00 00 00 00 00 00 00 1b 00 00 00 00 00 00 00 ................ . 0090: 00 00 00 00 00 00 00 00 ........ 0 0 0x450 [0x98]: PERF_RECORD_AUXTRACE_INFO type: 1 PMU Type 8 Time Shift 31 perf's isprint() is a custom implementation from the kernel, but the kernel's _ctype appears to include characters from Latin-1 Supplement which is not compatible with, for example, UTF-8. Fix by checking also isascii(). After: $ tools/perf/perf script -D | grep -C10 AUX | head . 0010: 08 00 00 00 00 00 00 00 1f 00 00 00 00 00 00 00 ................ . 0020: 03 84 32 2f 00 00 00 00 63 7c 4f d2 fa ff ff ff ..2/....c|O..... . 0030: 01 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 ................ . 0040: 00 08 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0050: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ . 0060: 00 02 00 00 00 00 00 00 00 c0 03 00 00 00 00 00 ................ . 0070: e2 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0080: 02 00 00 00 00 00 00 00 1b 00 00 00 00 00 00 00 ................ . 0090: 00 00 00 00 00 00 00 00 ........ Fixes: 3052ba56bcb58904 ("tools perf: Move from sane_ctype.h obtained from = git to the Linux's original") Signed-off-by: Adrian Hunter Cc: Jiri Olsa Link: http://lore.kernel.org/lkml/20220112085057.277205-1-adrian.hunter@int= el.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/perf/util/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -179,7 +179,7 @@ static int trace_event_printer(enum bina break; case BINARY_PRINT_CHAR_DATA: printed +=3D color_fprintf(fp, color, "%c", - isprint(ch) ? ch : '.'); + isprint(ch) && isascii(ch) ? ch : '.'); break; case BINARY_PRINT_CHAR_PAD: printed +=3D color_fprintf(fp, color, " "); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06828C433EF for ; Mon, 24 Jan 2022 22:49:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838817AbiAXWsu (ORCPT ); Mon, 24 Jan 2022 17:48:50 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52686 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345225AbiAXVnB (ORCPT ); Mon, 24 Jan 2022 16:43:01 -0500 Received: from smtp.kernel.org (relay.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 402C2B80FA1; Mon, 24 Jan 2022 21:42:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8C4FC340E4; Mon, 24 Jan 2022 21:42:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060578; bh=OdssgiM79/9ocsj19OPaOx7QxpE2D+RAnAHhWTYflIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vFAg8qexBYg1kyaVcoiWRnbhWV9zu0r6/XZnFTd63uF2h8lVH2v3C681B3XO2Gtyl dUbiArOrFsc+NL4H2/FRlayT0QqLf6Cr8Wt58P96Tq6QuGICOLdrXoYJPc2JmjsTue upQE2QA2aqBi0YyE9thlrsacQzfWtHWmaEaXmmks= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Vinod Koul Subject: [PATCH 5.16 0994/1039] dmaengine: at_xdmac: Dont start transactions at tx_submit level Date: Mon, 24 Jan 2022 19:46:23 +0100 Message-Id: <20220124184158.705229643@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus commit bccfb96b59179d4f96cbbd1ddff8fac6d335eae4 upstream. tx_submit is supposed to push the current transaction descriptor to a pending queue, waiting for issue_pending() to be called. issue_pending() must start the transfer, not tx_submit(), thus remove at_xdmac_start_xfer() from at_xdmac_tx_submit(). Clients of at_xdmac that assume that tx_submit() starts the transfer must be updated and call dma_async_issue_pending() if they miss to call it (one example is atmel_serial). As the at_xdmac_start_xfer() is now called only from at_xdmac_advance_work() when !at_xdmac_chan_is_enabled(), the at_xdmac_chan_is_enabled() check is no longer needed in at_xdmac_start_xfer(), thus remove it. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended D= MA Controller driver") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211215110115.191749-2-tudor.ambarus@micro= chip.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dma/at_xdmac.c | 6 ------ 1 file changed, 6 deletions(-) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -385,9 +385,6 @@ static void at_xdmac_start_xfer(struct a =20 dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, first); =20 - if (at_xdmac_chan_is_enabled(atchan)) - return; - /* Set transfer as active to not try to start it again. */ first->active_xfer =3D true; =20 @@ -479,9 +476,6 @@ static dma_cookie_t at_xdmac_tx_submit(s dev_vdbg(chan2dev(tx->chan), "%s: atchan 0x%p, add desc 0x%p to xfers_lis= t\n", __func__, atchan, desc); list_add_tail(&desc->xfer_node, &atchan->xfers_list); - if (list_is_singular(&atchan->xfers_list)) - at_xdmac_start_xfer(atchan, desc); - spin_unlock_irqrestore(&atchan->lock, irqflags); return cookie; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38486C433EF for ; Mon, 24 Jan 2022 22:49:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587766AbiAXWtL (ORCPT ); Mon, 24 Jan 2022 17:49:11 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60674 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349038AbiAXVnC (ORCPT ); Mon, 24 Jan 2022 16:43:02 -0500 Received: from smtp.kernel.org (relay.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 4339860917; Mon, 24 Jan 2022 21:43:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50AB4C340E5; Mon, 24 Jan 2022 21:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060580; bh=W9rtOjKHBw6hBibNcxr0t32NfHgPu+2J1i1+BKiQQuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U1ppR6Wsoy4+tyxR47st3tirPug++TBtgLgCEbmYw12aJ/pIcq2pjSgPM36O/fn/O epsIq53vQRira/9xAJNGM2pEhHgdezcY39OIGzi6lPbggaAsHTlD/JE49gFagbV18z 1hPenuWWy2ce6eu6h6A9DJJ6pPJOYFNxhWGtANYc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Vinod Koul Subject: [PATCH 5.16 0995/1039] dmaengine: at_xdmac: Start transfer for cyclic channels in issue_pending Date: Mon, 24 Jan 2022 19:46:24 +0100 Message-Id: <20220124184158.736305404@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus commit e6af9b05bec63cd4d1de2a33968cd0be2a91282a upstream. Cyclic channels must too call issue_pending in order to start a transfer. Start the transfer in issue_pending regardless of the type of channel. This wrongly worked before, because in the past the transfer was started at tx_submit level when only a desc in the transfer list. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended D= MA Controller driver") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211215110115.191749-3-tudor.ambarus@micro= chip.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dma/at_xdmac.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1778,11 +1778,9 @@ static void at_xdmac_issue_pending(struc =20 dev_dbg(chan2dev(&atchan->chan), "%s\n", __func__); =20 - if (!at_xdmac_chan_is_cyclic(atchan)) { - spin_lock_irqsave(&atchan->lock, flags); - at_xdmac_advance_work(atchan); - spin_unlock_irqrestore(&atchan->lock, flags); - } + spin_lock_irqsave(&atchan->lock, flags); + at_xdmac_advance_work(atchan); + spin_unlock_irqrestore(&atchan->lock, flags); =20 return; } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01EC6C433EF for ; Mon, 24 Jan 2022 22:49:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838874AbiAXWtI (ORCPT ); Mon, 24 Jan 2022 17:49:08 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60708 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352128AbiAXVnE (ORCPT ); Mon, 24 Jan 2022 16:43:04 -0500 Received: from smtp.kernel.org (relay.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 2EAA7612E5; Mon, 24 Jan 2022 21:43:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17D7DC340E4; Mon, 24 Jan 2022 21:43:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060583; bh=qUzPwoD8luyL20rDQ9zTz7gFj1WnVztB4linAqs+gbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yxcMkqH0v2u0S4FUmM2bK8IJK9hDvOnQWg/g+x6c4yTdkbri6VQDY4IstRCLm0ENy AO0MSVxv27hsgqNg9uKyqREB8Jdq4fm98xSWffByStILP0dOZ3LiN1wXTCgu4ZM135 AzXw0TV8pg7s2dgUPp1wiVWVGBuvvILOZu7ksVnk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Vinod Koul Subject: [PATCH 5.16 0996/1039] dmaengine: at_xdmac: Print debug message after realeasing the lock Date: Mon, 24 Jan 2022 19:46:25 +0100 Message-Id: <20220124184158.767643944@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus commit 5edc24ac876a928f36f407a0fcdb33b94a3a210f upstream. It is desirable to do the prints without the lock held if possible, so move the print after the lock is released. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended D= MA Controller driver") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211215110115.191749-4-tudor.ambarus@micro= chip.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dma/at_xdmac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -473,10 +473,12 @@ static dma_cookie_t at_xdmac_tx_submit(s spin_lock_irqsave(&atchan->lock, irqflags); cookie =3D dma_cookie_assign(tx); =20 - dev_vdbg(chan2dev(tx->chan), "%s: atchan 0x%p, add desc 0x%p to xfers_lis= t\n", - __func__, atchan, desc); list_add_tail(&desc->xfer_node, &atchan->xfers_list); spin_unlock_irqrestore(&atchan->lock, irqflags); + + dev_vdbg(chan2dev(tx->chan), "%s: atchan 0x%p, add desc 0x%p to xfers_lis= t\n", + __func__, atchan, desc); + return cookie; } =20 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3363C35274 for ; Tue, 25 Jan 2022 01:59:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413358AbiAYAix (ORCPT ); Mon, 24 Jan 2022 19:38:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364408AbiAXXsI (ORCPT ); Mon, 24 Jan 2022 18:48:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDC81C07E307; Mon, 24 Jan 2022 13:43:08 -0800 (PST) Received: from smtp.kernel.org (relay.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 A56BAB8119E; Mon, 24 Jan 2022 21:43:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 138CEC340E4; Mon, 24 Jan 2022 21:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060586; bh=p0y5hJByeFplk5ECbWCT3NibhmV/f6yWSLLTnzSRmkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d/Pv5e3YmPVi8W8EmUqHE1E5vpGZ/YRBtMG3ZjZx0VPKAH44vvBPZOCduwSiNTr3/ GKz+PET6Q0KHY5GC0MAYtuJMvVAM91k7Feo2h4Ko8/0M21VJ8R85tCghsYFcNRCRs+ dZbeCKGx1QTzBLzJSsX2kbwpoNVAqMUfsRg7bweg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Vinod Koul Subject: [PATCH 5.16 0997/1039] dmaengine: at_xdmac: Fix concurrency over xfers_list Date: Mon, 24 Jan 2022 19:46:26 +0100 Message-Id: <20220124184158.799631516@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus commit 18deddea9184b62941395889ff7659529c877326 upstream. Since tx_submit can be called from a hard IRQ, xfers_list must be protected with a lock to avoid concurency on the list's elements. Since at_xdmac_handle_cyclic() is called from a tasklet, spin_lock_irq is enough to protect from a hard IRQ. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended D= MA Controller driver") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211215110115.191749-8-tudor.ambarus@micro= chip.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dma/at_xdmac.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1619,14 +1619,17 @@ static void at_xdmac_handle_cyclic(struc struct at_xdmac_desc *desc; struct dma_async_tx_descriptor *txd; =20 - if (!list_empty(&atchan->xfers_list)) { - desc =3D list_first_entry(&atchan->xfers_list, - struct at_xdmac_desc, xfer_node); - txd =3D &desc->tx_dma_desc; - - if (txd->flags & DMA_PREP_INTERRUPT) - dmaengine_desc_get_callback_invoke(txd, NULL); + spin_lock_irq(&atchan->lock); + if (list_empty(&atchan->xfers_list)) { + spin_unlock_irq(&atchan->lock); + return; } + desc =3D list_first_entry(&atchan->xfers_list, struct at_xdmac_desc, + xfer_node); + spin_unlock_irq(&atchan->lock); + txd =3D &desc->tx_dma_desc; + if (txd->flags & DMA_PREP_INTERRUPT) + dmaengine_desc_get_callback_invoke(txd, NULL); } =20 static void at_xdmac_handle_error(struct at_xdmac_chan *atchan) From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20F09C433F5 for ; Mon, 24 Jan 2022 22:53:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838940AbiAXWt2 (ORCPT ); Mon, 24 Jan 2022 17:49:28 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60776 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354114AbiAXVnN (ORCPT ); Mon, 24 Jan 2022 16:43:13 -0500 Received: from smtp.kernel.org (relay.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 EDAB361320; Mon, 24 Jan 2022 21:43:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA4D0C340E4; Mon, 24 Jan 2022 21:43:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060589; bh=+O6Zta3ruIVFCjjsQEmorm5Dt7LAqB65TAvz9UppKls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Is6zTwPFTsCqxpJCZdVgeCSxX/SwEOGfKWNL6jR4s7MvigJblbgtyG/BsSmIRWH1E hQESr9NGV7hgBGvPBL/VbiyIzTUYV5I2rh4AhU4Bbiw00OU2vjkov/X0zix2ldhDnO jdB2rd4lagFU23yzNB06vUY/vk50OVinBtq5mfAA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Vinod Koul Subject: [PATCH 5.16 0998/1039] dmaengine: at_xdmac: Fix lld view setting Date: Mon, 24 Jan 2022 19:46:27 +0100 Message-Id: <20220124184158.832161985@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus commit 1385eb4d14d447cc5d744bc2ac34f43be66c9963 upstream. AT_XDMAC_CNDC_NDVIEW_NDV3 was set even for AT_XDMAC_MBR_UBC_NDV2, because of the wrong bit handling. Fix it. Fixes: ee0fe35c8dcd ("dmaengine: xdmac: Handle descriptor's view 3 register= s") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211215110115.191749-10-tudor.ambarus@micr= ochip.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dma/at_xdmac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -99,6 +99,7 @@ #define AT_XDMAC_CNDC_NDE (0x1 << 0) /* Channel x Next Descriptor Enabl= e */ #define AT_XDMAC_CNDC_NDSUP (0x1 << 1) /* Channel x Next Descriptor Sou= rce Update */ #define AT_XDMAC_CNDC_NDDUP (0x1 << 2) /* Channel x Next Descriptor Des= tination Update */ +#define AT_XDMAC_CNDC_NDVIEW_MASK GENMASK(28, 27) #define AT_XDMAC_CNDC_NDVIEW_NDV0 (0x0 << 3) /* Channel x Next Descripto= r View 0 */ #define AT_XDMAC_CNDC_NDVIEW_NDV1 (0x1 << 3) /* Channel x Next Descripto= r View 1 */ #define AT_XDMAC_CNDC_NDVIEW_NDV2 (0x2 << 3) /* Channel x Next Descripto= r View 2 */ @@ -402,7 +403,8 @@ static void at_xdmac_start_xfer(struct a */ if (at_xdmac_chan_is_cyclic(atchan)) reg =3D AT_XDMAC_CNDC_NDVIEW_NDV1; - else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) + else if ((first->lld.mbr_ubc & + AT_XDMAC_CNDC_NDVIEW_MASK) =3D=3D AT_XDMAC_MBR_UBC_NDV3) reg =3D AT_XDMAC_CNDC_NDVIEW_NDV3; else reg =3D AT_XDMAC_CNDC_NDVIEW_NDV2; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CB55C35273 for ; Tue, 25 Jan 2022 01:59:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413343AbiAYAiw (ORCPT ); Mon, 24 Jan 2022 19:38:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364459AbiAXXsO (ORCPT ); Mon, 24 Jan 2022 18:48:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABA18C07E30C; Mon, 24 Jan 2022 13:43:14 -0800 (PST) Received: from smtp.kernel.org (relay.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 69A16B81136; Mon, 24 Jan 2022 21:43:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C420DC340E4; Mon, 24 Jan 2022 21:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060592; bh=NxXNBQpf4dvv8gbQ9BWxfIxyWCwIsLResc7PmWo2IHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLNU2K/21+IbMoEBtyR2mdm47qHNKNDolN7VGqKMzt4vun84uVOp1TelR3k5NNY4S l8XdyuIKCIblijASjtdaLbLIcjIODRYgLRYLOpyf3zThQNP3XMINovGJe7BvN3tiBE dfDdk+GEltGLQZnebmif7D0qD0A5Zfm7SqgO9BnY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Vinod Koul Subject: [PATCH 5.16 0999/1039] dmaengine: at_xdmac: Fix at_xdmac_lld struct definition Date: Mon, 24 Jan 2022 19:46:28 +0100 Message-Id: <20220124184158.864895172@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus commit 912f7c6f7fac273f40e621447cf17d14b50d6e5b upstream. The hardware channel next descriptor view structure contains just fields of 32 bits, while dma_addr_t can be of type u64 or u32 depending on CONFIG_ARCH_DMA_ADDR_T_64BIT. Force u32 to comply with what the hardware expects. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended D= MA Controller driver") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211215110115.191749-11-tudor.ambarus@micr= ochip.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/dma/at_xdmac.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -253,15 +253,15 @@ struct at_xdmac { =20 /* Linked List Descriptor */ struct at_xdmac_lld { - dma_addr_t mbr_nda; /* Next Descriptor Member */ - u32 mbr_ubc; /* Microblock Control Member */ - dma_addr_t mbr_sa; /* Source Address Member */ - dma_addr_t mbr_da; /* Destination Address Member */ - u32 mbr_cfg; /* Configuration Register */ - u32 mbr_bc; /* Block Control Register */ - u32 mbr_ds; /* Data Stride Register */ - u32 mbr_sus; /* Source Microblock Stride Register */ - u32 mbr_dus; /* Destination Microblock Stride Register */ + u32 mbr_nda; /* Next Descriptor Member */ + u32 mbr_ubc; /* Microblock Control Member */ + u32 mbr_sa; /* Source Address Member */ + u32 mbr_da; /* Destination Address Member */ + u32 mbr_cfg; /* Configuration Register */ + u32 mbr_bc; /* Block Control Register */ + u32 mbr_ds; /* Data Stride Register */ + u32 mbr_sus; /* Source Microblock Stride Register */ + u32 mbr_dus; /* Destination Microblock Stride Register */ }; =20 /* 64-bit alignment needed to update CNDA and CUBC registers in an atomic = way. */ From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6927CC47081 for ; Tue, 25 Jan 2022 01:59:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413308AbiAYAis (ORCPT ); Mon, 24 Jan 2022 19:38:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364468AbiAXXsP (ORCPT ); Mon, 24 Jan 2022 18:48:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDF07C07E30F; Mon, 24 Jan 2022 13:43:16 -0800 (PST) Received: from smtp.kernel.org (relay.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 6394FB81136; Mon, 24 Jan 2022 21:43:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 860B4C340E4; Mon, 24 Jan 2022 21:43:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060595; bh=4ABbKYiiDxKwGitVr08/1AJL/S5WC4/EA9Zq2J99dIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MsDVrIewpK0Cq9Rml56lTAyyef1v+s31oIybBkrMdJ7Z6/OsK3VhUjMroaHF0wZbX TQ1MxDnc2poaJsX0l4TTzDpy8wQxHf0FT/McJPOyo/o7BNQgI58FFzjGKhB0PsJTtF QeeZ8Z2byoi2x91jr1SB97Qip2vH4/4PjuLNxzX4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Thomas Richter , Heiko Carstens , Sumanth Korikkar , Sven Schnelle , Vasily Gorbik , Arnaldo Carvalho de Melo Subject: [PATCH 5.16 1000/1039] perf cputopo: Fix CPU topology reading on s/390 Date: Mon, 24 Jan 2022 19:46:29 +0100 Message-Id: <20220124184158.895209300@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thomas Richter commit a6e62743621ea29bea461774c0bcc68e5de59068 upstream. Commit fdf1e29b6118c18f ("perf expr: Add metric literals for topology.") fails on s390: # ./perf test -Fv 7 ... # FAILED tests/expr.c:173 #num_dies >=3D #num_packages ---- end ---- Simple expression parser: FAILED! # Investigating this issue leads to these functions: build_cpu_topology() +--> has_die_topology(void) { struct utsname uts; if (uname(&uts) < 0) return false; if (strncmp(uts.machine, "x86_64", 6)) return false; .... } which always returns false on s390. The caller build_cpu_topology() checks has_die_topology() return value. On false the the struct cpu_topology::die_cpu_list is not contructed and has zero entries. This leads to the failing comparison: #num_dies >=3D #num_packages. s390 of course has a positive number of packages. Fix this by adding s390 architecture to support CPU die list. Output after: # ./perf test -Fv 7 7: Simple expression parser : --- start --- division by zero syntax error ---- end ---- Simple expression parser: Ok # Fixes: fdf1e29b6118c18f ("perf expr: Add metric literals for topology.") Reviewed-by: Ian Rogers Signed-off-by: Thomas Richter Cc: Heiko Carstens Cc: Ian Rogers Cc: Sumanth Korikkar Cc: Sven Schnelle Cc: Vasily Gorbik Link: https://lore.kernel.org/r/20211124090343.9436-1-tmricht@linux.ibm.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/perf/util/cputopo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/tools/perf/util/cputopo.c +++ b/tools/perf/util/cputopo.c @@ -165,7 +165,8 @@ static bool has_die_topology(void) if (uname(&uts) < 0) return false; =20 - if (strncmp(uts.machine, "x86_64", 6)) + if (strncmp(uts.machine, "x86_64", 6) && + strncmp(uts.machine, "s390x", 5)) return false; =20 scnprintf(filename, MAXPATHLEN, DIE_CPUS_FMT, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B87C3C433FE for ; Mon, 24 Jan 2022 22:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839893AbiAXWwG (ORCPT ); Mon, 24 Jan 2022 17:52:06 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52814 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359781AbiAXVnY (ORCPT ); Mon, 24 Jan 2022 16:43:24 -0500 Received: from smtp.kernel.org (relay.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 5F0EBB811A2; Mon, 24 Jan 2022 21:43:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 826F0C340E4; Mon, 24 Jan 2022 21:43:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060598; bh=fhcehs13K324S4NcYX+VvjBRl1SSEGNfMfH7EvgCHdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2YEfBIsJmChaWyJWJeyJ1/ODb2a+6fEVafLWI/hwXtK/4VTSu0GWl1z5m0DdviLqi oWmlaWBbywz6G26BWgTt2Ox1LgyK/PRwvEu8mDgpaWypcxg95dzNXFWLXanSPmGVou 1N9n7++DJznG9mzeLSC6DQdmWDc5h0wztUiucREI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Clark , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Adrian Bunk , Alexander Shishkin , Branislav Rankov , Diederik de Haas , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 5.16 1001/1039] perf tools: Drop requirement for libstdc++.so for libopencsd check Date: Mon, 24 Jan 2022 19:46:30 +0100 Message-Id: <20220124184158.935216954@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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 ed17b1914978eddb2b01f2d34577f1c82518c650 upstream. It's possible to link against libopencsd_c_api without having libstdc++.so available, only libstdc++.so.6.0.28 (or whatever version is in use) needs to be available. The same holds true for libopencsd.so. When -lstdc++ (or -lopencsd) is explicitly passed to the linker however the .so file must be available. So wrap adding the dependencies into a check for static linking that actually requires adding them all. The same construct is already used for some other tests in the same file to reduce dependencies in the dynamic linking case. Fixes: 573cf5c9a152 ("perf build: Add missing -lstdc++ when linking with li= bopencsd") Reviewed-by: James Clark Signed-off-by: Uwe Kleine-K=C3=B6nig Cc: Adrian Bunk Cc: Alexander Shishkin Cc: Branislav Rankov Cc: Diederik de Haas Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: https://lore.kernel.org/all/20211203210544.1137935-1-uwe@kleine-koeni= g.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/perf/Makefile.config | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -143,7 +143,10 @@ FEATURE_CHECK_LDFLAGS-libcrypto =3D -lcryp ifdef CSINCLUDES LIBOPENCSD_CFLAGS :=3D -I$(CSINCLUDES) endif -OPENCSDLIBS :=3D -lopencsd_c_api -lopencsd -lstdc++ +OPENCSDLIBS :=3D -lopencsd_c_api +ifeq ($(findstring -static,${LDFLAGS}),-static) + OPENCSDLIBS +=3D -lopencsd -lstdc++ +endif ifdef CSLIBS LIBOPENCSD_LDFLAGS :=3D -L$(CSLIBS) endif From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44C80C35271 for ; Tue, 25 Jan 2022 01:59:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413293AbiAYAio (ORCPT ); Mon, 24 Jan 2022 19:38:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364531AbiAXXs2 (ORCPT ); Mon, 24 Jan 2022 18:48:28 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26F17C07E317; Mon, 24 Jan 2022 13:43:22 -0800 (PST) Received: from smtp.kernel.org (relay.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 BC7FF6150B; Mon, 24 Jan 2022 21:43:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64B82C340E5; Mon, 24 Jan 2022 21:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060601; bh=JTTDe9f3qMJahSvlrR4RZimV75aBNE+Q8blwnO21DLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FxKqOfVus/eM2tSe7TKpjLdBok1fiafJuIFg6dt7IvR8sOhqP8vx0hlke63Y4DQ/I maSTa8Lnmk33+1gEGh7+FwS9Zgei7YqSEPDcZ0gjqIcG4VoND+7ssYRcDD/4ADUxTZ r5tutyDt8B+XpFMIE9rd/FyUExOVMgvXxVMUilXs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Alexander Shishkin , Andi Kleen , Ian Rogers , Jiri Olsa , John Garry , Mark Rutland , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 5.16 1002/1039] perf metricgroup: Fix use after free in metric__new() Date: Mon, 24 Jan 2022 19:46:31 +0100 Message-Id: <20220124184158.967660423@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Jos=C3=A9 Exp=C3=B3sito commit e000ea0beffb5497425054b151369fe37a792ece upstream. We shouldn't free() something that will be used in the next line, fix it. Fixes: b85a4d61d3022608 ("perf metric: Allow modifiers on metrics") Addresses-Coverity-ID: 1494000 Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Cc: Alexander Shishkin Cc: Andi Kleen Cc: Ian Rogers Cc: Jiri Olsa Cc: John Garry Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20211208171113.22089-1-jose.exposito89@gm= ail.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/perf/util/metricgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -209,8 +209,8 @@ static struct metric *metric__new(const m->metric_name =3D pe->metric_name; m->modifier =3D modifier ? strdup(modifier) : NULL; if (modifier && !m->modifier) { - free(m); expr__ctx_free(m->pctx); + free(m); return NULL; } m->metric_expr =3D pe->metric_expr; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F457C433EF for ; Tue, 25 Jan 2022 01:59:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412769AbiAYAho (ORCPT ); Mon, 24 Jan 2022 19:37:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364547AbiAXXsb (ORCPT ); Mon, 24 Jan 2022 18:48:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6061FC07E320; Mon, 24 Jan 2022 13:43:29 -0800 (PST) Received: from smtp.kernel.org (relay.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 27E91B8119E; Mon, 24 Jan 2022 21:43:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F60DC340E4; Mon, 24 Jan 2022 21:43:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060606; bh=d5sDqEx7QCzukP98QrCD6x9n7LBmYQ6aePoyYZryyVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A8ucc/uqrMxuzrKhFNiXJ5YsKSE6soMtwCNbR1o7ry2/+SUDMir+L8udNk7kvfY6v zrqdCyIE2mXRsAPJ0Lvs5Y4xcv7CfnznVCifqrCGjkw2He1qmUEUU1kUZwaFdJacJ4 EzHJAkOEpzf/zVvxYNSLCSBlXMUsRPwRI1V6hjrc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Arnaldo Carvalho de Melo , Alexander Shishkin , Andi Kleen , Ingo Molnar , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , Stephane Eranian Subject: [PATCH 5.16 1003/1039] perf test: Enable system wide for metricgroups test Date: Mon, 24 Jan 2022 19:46:32 +0100 Message-Id: <20220124184159.008232832@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ian Rogers commit 0046686da0ef692a6381260c3aa44291187eafc9 upstream. Uncore events as group leaders fail in per-thread mode causing exit errors. Enable system-wide for metricgroup testing. This fixes the HPC metric group when tested on skylakex. Fixes: 4a87dea9e60fe100 ("perf test: Workload test of metric and metricgrou= ps") Signed-off-by: Ian Rogers Tested-by: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Andi Kleen Cc: Ingo Molnar Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: https://lore.kernel.org/r/20211223183948.3423989-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/perf/tests/shell/stat_all_metricgroups.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/tests/shell/stat_all_metricgroups.sh +++ b/tools/perf/tests/shell/stat_all_metricgroups.sh @@ -6,7 +6,7 @@ set -e =20 for m in $(perf list --raw-dump metricgroups); do echo "Testing $m" - perf stat -M "$m" true + perf stat -M "$m" -a true done =20 exit 0 From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0E95C433EF for ; Mon, 24 Jan 2022 22:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839166AbiAXWt5 (ORCPT ); Mon, 24 Jan 2022 17:49:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52952 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445206AbiAXVng (ORCPT ); Mon, 24 Jan 2022 16:43:36 -0500 Received: from smtp.kernel.org (relay.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 1F4E3B8119E; Mon, 24 Jan 2022 21:43:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23521C340E4; Mon, 24 Jan 2022 21:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060609; bh=xi4KJIaJwSCkynoxCcarqiM8KPP5W/cAYIZDLYrFnBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O9krJI8xsM2S5QNE6Aw2IuCATZOgoMbs8wBe7VSujvoGSQ+DD7gJDVKP1wHauRJId WUN6Up3OIB6mFG1Wo21dSyGU+aCH2HGhMchR8vkYuvVa1L4vohi1mTd8d+fwY6+U/x KhGqXLo+KqHs0tts/WNorz0G32PJff+/rPf29Qd0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zechuan Chen , Masami Hiramatsu , Alexander Shishkin , Ingo Molnar , Jianlin Lv , Jin Yao , Jiri Olsa , Mark Rutland , Michael Ellerman , Namhyung Kim , "Naveen N. Rao" , Peter Zijlstra , Ravi Bangoria , Yang Jihong , Arnaldo Carvalho de Melo Subject: [PATCH 5.16 1004/1039] perf probe: Fix ppc64 perf probe add events failed case Date: Mon, 24 Jan 2022 19:46:33 +0100 Message-Id: <20220124184159.039062305@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zechuan Chen commit 4624f199327a704dd1069aca1c3cadb8f2a28c6f upstream. Because of commit bf794bf52a80c627 ("powerpc/kprobes: Fix kallsyms lookup across powerpc ABIv1 and ABIv2"), in ppc64 ABIv1, our perf command eliminates the need to use the prefix "." at the symbol name. But when the command "perf probe -a schedule" is executed on ppc64 ABIv1, it obtains two symbol address information through /proc/kallsyms, for example: cat /proc/kallsyms | grep -w schedule c000000000657020 T .schedule c000000000d4fdb8 D schedule The symbol "D schedule" is not a function symbol, and perf will print: "p:probe/schedule _text+13958584"Failed to write event: Invalid argument Therefore, when searching symbols from map and adding probe point for them, a symbol type check is added. If the type of symbol is not a function, skip it. Fixes: bf794bf52a80c627 ("powerpc/kprobes: Fix kallsyms lookup across power= pc ABIv1 and ABIv2") Signed-off-by: Zechuan Chen Acked-by: Masami Hiramatsu Cc: Alexander Shishkin Cc: Ingo Molnar Cc: Jianlin Lv Cc: Jin Yao Cc: Jiri Olsa Cc: Mark Rutland Cc: Michael Ellerman Cc: Namhyung Kim Cc: Naveen N. Rao Cc: Peter Zijlstra Cc: Ravi Bangoria Cc: Yang Jihong Link: https://lore.kernel.org/r/20211228111338.218602-1-chenzechuan1@huawei= .com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/perf/util/probe-event.c | 3 +++ 1 file changed, 3 insertions(+) --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -3083,6 +3083,9 @@ static int find_probe_trace_events_from_ for (j =3D 0; j < num_matched_functions; j++) { sym =3D syms[j]; =20 + if (sym->type !=3D STT_FUNC) + continue; + /* There can be duplicated symbols in the map */ for (i =3D 0; i < j; i++) if (sym->start =3D=3D syms[i]->start) { From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2870FC433EF for ; Tue, 25 Jan 2022 01:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412168AbiAYAgB (ORCPT ); Mon, 24 Jan 2022 19:36:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364552AbiAXXsc (ORCPT ); Mon, 24 Jan 2022 18:48:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 532DDC07E326; Mon, 24 Jan 2022 13:43:35 -0800 (PST) Received: from smtp.kernel.org (relay.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 1A95CB8121C; Mon, 24 Jan 2022 21:43:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 296D2C340E4; Mon, 24 Jan 2022 21:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060612; bh=mfblvG5kbnlq85+nsOP4KlAoMqaul5WTuSLJfi8bZrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gB1VINutbeE6D++QOK0uQDfdN9+j3h0xYDCwvA5cBlWszvPhNbAX3P1JEsQjk3l+t l8ThK7MhrD0QILl0z8qV+JeZIBd9e0hXxGhKuoX9to6Nw4pbt/FYWwoyt30NCT8TcJ Nb04sQiPz6MN047TtBvvIofvdozt8j3YUnRM5K0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Alexander Shishkin , Andi Kleen , Jiri Olsa , John Garry , Mark Rutland , Namhyung Kim , Peter Zijlstra , Stephane Eranian , Arnaldo Carvalho de Melo Subject: [PATCH 5.16 1005/1039] perf metric: Fix metric_leader Date: Mon, 24 Jan 2022 19:46:34 +0100 Message-Id: <20220124184159.078107727@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ian Rogers commit d3e2bb4359f70c8b1d09a6f8e2f57240aab0da3f upstream. Multiple events may have a metric_leader to aggregate into. This happens for uncore events where, for example, uncore_imc is expanded into uncore_imc_0, uncore_imc_1, etc. Such events all have the same metric_id and should aggregate into the first event. The change introducing metric_ids had a bug where the metric_id was compared to itself, creating an always true condition. Correct this by comparing the event in the metric_evlist and the metric_leader. Fixes: ec5c5b3d2c21b3f3 ("perf metric: Encode and use metric-id as qualifie= r") Signed-off-by: Ian Rogers Cc: Alexander Shishkin Cc: Andi Kleen Cc: Jiri Olsa Cc: John Garry Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lore.kernel.org/lkml/20220115062852.1959424-1-irogers@google.c= om Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/perf/util/metricgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -314,7 +314,7 @@ static int setup_metric_events(struct ha */ metric_id =3D evsel__metric_id(ev); evlist__for_each_entry_continue(metric_evlist, ev) { - if (!strcmp(evsel__metric_id(metric_events[i]), metric_id)) + if (!strcmp(evsel__metric_id(ev), metric_id)) ev->metric_leader =3D metric_events[i]; } } From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F18CBC4332F for ; Mon, 24 Jan 2022 22:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839956AbiAXWwT (ORCPT ); Mon, 24 Jan 2022 17:52:19 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33010 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445470AbiAXVnh (ORCPT ); Mon, 24 Jan 2022 16:43:37 -0500 Received: from smtp.kernel.org (relay.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 90CB46150B; Mon, 24 Jan 2022 21:43:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69CF2C340E4; Mon, 24 Jan 2022 21:43:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060616; bh=F0Fefbr5CTrGbQwVRWajkOardZ0wutxowsrDiXU7x6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1agiTswl8NpVBX90LJm7fjUXvboe2qqPr/PsxwO2P3UtiwyATfwYs8t96lATbSuR6 DXPvcgPAUz5LsROFRvLDYgc37RtGfxz0tMzxv5/EzFOVipJxg5UNnVwt1AhcpfS6f+ YKzLItPliJ17eSicmb5kdtpCBHvxBqoypVMd9ZtQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leon Romanovsky , "David S. Miller" Subject: [PATCH 5.16 1006/1039] devlink: Remove misleading internal_flags from health reporter dump Date: Mon, 24 Jan 2022 19:46:35 +0100 Message-Id: <20220124184159.107965939@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Leon Romanovsky commit e9538f8270db24d272659e15841854c7ea11119e upstream. DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET command doesn't have .doit callback and has no use in internal_flags at all. Remove this misleading assignment. Fixes: e44ef4e4516c ("devlink: Hang reporter's dump method on a dumpit cb") Signed-off-by: Leon Romanovsky Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/core/devlink.c | 2 -- 1 file changed, 2 deletions(-) --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -8840,8 +8840,6 @@ static const struct genl_small_ops devli GENL_DONT_VALIDATE_DUMP_STRICT, .dumpit =3D devlink_nl_cmd_health_reporter_dump_get_dumpit, .flags =3D GENL_ADMIN_PERM, - .internal_flags =3D DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT | - DEVLINK_NL_FLAG_NO_LOCK, }, { .cmd =3D DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR, From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDD2CC433EF for ; Mon, 24 Jan 2022 22:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839935AbiAXWwN (ORCPT ); Mon, 24 Jan 2022 17:52:13 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53064 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445711AbiAXVnl (ORCPT ); Mon, 24 Jan 2022 16:43:41 -0500 Received: from smtp.kernel.org (relay.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 46E9AB8121C; Mon, 24 Jan 2022 21:43:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CCD9C340E4; Mon, 24 Jan 2022 21:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060619; bh=GGcYcClawHlbWWb5kpfU7Hq1ToMG9DJgl8z6mCAN5VY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2nDw1BJcMIcKN2uaUX5lwtFamKB0G3jQwM4K+0Z+3FBcUBgOOIVg+srXrpqUYp4AL gmy4UT81oFQE8KVswX011myPy6rUelkItRueiT1YJ+Xfbjm4jrKK7TmYMA82pzcT58 37/vMVp7Co32/WULNxa1ZQR8w09HH/KchmWdg5Ds= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Heidelberg , Bjorn Andersson Subject: [PATCH 5.16 1007/1039] arm64: dts: qcom: msm8996: drop not documented adreno properties Date: Mon, 24 Jan 2022 19:46:36 +0100 Message-Id: <20220124184159.140727335@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Heidelberg commit c41910f257a22dc406c60d8826b4a3b5398003a3 upstream. These properties aren't documented nor implemented in the driver. Drop them. Fixes warnings as: $ make dtbs_check DT_SCHEMA_FILES=3DDocumentation/devicetree/bindings/displ= ay/msm/gpu.yaml ... arch/arm64/boot/dts/qcom/msm8996-mtp.dt.yaml: gpu@b00000: 'qcom,gpu-quirk-f= ault-detect-mask', 'qcom,gpu-quirk-two-pass-use-wfi' do not match any of th= e regexes: 'pinctrl-[0-9]+' From schema: Documentation/devicetree/bindings/display/msm/gpu.yaml ... Fixes: 69cc3114ab0f ("arm64: dts: Add Adreno GPU definitions") Signed-off-by: David Heidelberg Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211030100413.28370-1-david@ixit.cz Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/qcom/msm8996.dtsi | 3 --- 1 file changed, 3 deletions(-) --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi @@ -987,9 +987,6 @@ nvmem-cells =3D <&speedbin_efuse>; nvmem-cell-names =3D "speed_bin"; =20 - qcom,gpu-quirk-two-pass-use-wfi; - qcom,gpu-quirk-fault-detect-mask; - operating-points-v2 =3D <&gpu_opp_table>; =20 status =3D "disabled"; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35DA7C35272 for ; Tue, 25 Jan 2022 01:59:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413263AbiAYAin (ORCPT ); Mon, 24 Jan 2022 19:38:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364587AbiAXXse (ORCPT ); Mon, 24 Jan 2022 18:48:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2982C07E32C; Mon, 24 Jan 2022 13:43:44 -0800 (PST) Received: from smtp.kernel.org (relay.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 68BB8B812A5; Mon, 24 Jan 2022 21:43:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FD08C340E5; Mon, 24 Jan 2022 21:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060622; bh=T7Qh6ncURuM95zleYtc/I17OlL/HQAyS5maJpXJereo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B24HB/VInSjEUzu1V/eOMNp09xh0p0tJDMUVR8qNcy+p9LwDp7MUuU9HMvnWTzs7F dwDuoRoJ9w/iamWdeJKfQlvzyU/e3KcVh8gY8lfwcEioZqgz7ju6i56Q98WyhhkkVK eMgpPkQqIhFut9o0eRvTiUE+A7MXQi0UIzeTSZIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miroslav Lichvar , Yangbo Lu , "David S. Miller" Subject: [PATCH 5.16 1008/1039] net: fix sock_timestamping_bind_phc() to release device Date: Mon, 24 Jan 2022 19:46:37 +0100 Message-Id: <20220124184159.173240015@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miroslav Lichvar commit 2a4d75bfe41232608f5596a6d1369f92ccb20817 upstream. Don't forget to release the device in sock_timestamping_bind_phc() after it was used to get the vclock indices. Fixes: d463126e23f1 ("net: sock: extend SO_TIMESTAMPING for PHC binding") Signed-off-by: Miroslav Lichvar Cc: Yangbo Lu Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/core/sock.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/core/sock.c +++ b/net/core/sock.c @@ -843,6 +843,8 @@ static int sock_timestamping_bind_phc(st } =20 num =3D ethtool_get_phc_vclocks(dev, &vclock_index); + dev_put(dev); + for (i =3D 0; i < num; i++) { if (*(vclock_index + i) =3D=3D phc_index) { match =3D true; From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCA7DC433EF for ; Tue, 25 Jan 2022 01:59:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412617AbiAYAhU (ORCPT ); Mon, 24 Jan 2022 19:37:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2366256AbiAXXwd (ORCPT ); Mon, 24 Jan 2022 18:52:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A099AC0419D9; Mon, 24 Jan 2022 13:45:41 -0800 (PST) Received: from smtp.kernel.org (relay.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 45538B8119E; Mon, 24 Jan 2022 21:45:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5206DC340E4; Mon, 24 Jan 2022 21:45:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060740; bh=50Ir92TQOFxSdBGUViRw6ImhL/CgOB1Kfhjsy+Ly+iM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oWBr1KHcf2MWXLBBfXxYGMEkDQBRbIf+QF+2xTppVvbiz/ZeBruFm8mrI8K+ZhsMB FBoWGxlcUzoGBr/wUon08Tk8+6hiK7+WcdJT7VTWlC5rVmTun2OCS6G2ywnr0ZNh2Q 4JljHLpcXj4w9MPui0EBY5najiDcqfJrtErPcRiU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Wang , Guangbin Huang , "David S. Miller" Subject: [PATCH 5.16 1009/1039] net: bonding: fix bond_xmit_broadcast return value error bug Date: Mon, 24 Jan 2022 19:46:38 +0100 Message-Id: <20220124184159.210894789@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jie Wang commit 4e5bd03ae34652cd932ab4c91c71c511793df75c upstream. In Linux bonding scenario, one packet is copied to several copies and sent by all slave device of bond0 in mode 3(broadcast mode). The mode 3 xmit function bond_xmit_broadcast() only ueses the last slave device's tx result as the final result. In this case, if the last slave device is down, then it always return NET_XMIT_DROP, even though the other slave devices xmit success. It may cause the tx statistics error, and cause the application (e.g. scp) consider the network is unreachable. For example, use the following command to configure server A. echo 3 > /sys/class/net/bond0/bonding/mode ifconfig bond0 up ifenslave bond0 eth0 eth1 ifconfig bond0 192.168.1.125 ifconfig eth0 up ifconfig eth1 down The slave device eth0 and eth1 are connected to server B(192.168.1.107). Run the ping 192.168.1.107 -c 3 -i 0.2 command, the following information is displayed. PING 192.168.1.107 (192.168.1.107) 56(84) bytes of data. 64 bytes from 192.168.1.107: icmp_seq=3D1 ttl=3D64 time=3D0.077 ms 64 bytes from 192.168.1.107: icmp_seq=3D2 ttl=3D64 time=3D0.056 ms 64 bytes from 192.168.1.107: icmp_seq=3D3 ttl=3D64 time=3D0.051 ms 192.168.1.107 ping statistics 0 packets transmitted, 3 received Actually, the slave device eth0 of the bond successfully sends three ICMP packets, but the result shows that 0 packets are transmitted. Also if we use scp command to get remote files, the command end with the following printings. ssh_exchange_identification: read: Connection timed out So this patch modifies the bond_xmit_broadcast to return NET_XMIT_SUCCESS if one slave device in the bond sends packets successfully. If all slave devices send packets fail, the discarded packets stats is increased. The skb is released when there is no slave device in the bond or the last slave device is down. Fixes: ae46f184bc1f ("bonding: propagate transmit status") Signed-off-by: Jie Wang Signed-off-by: Guangbin Huang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/bonding/bond_main.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -4843,25 +4843,39 @@ static netdev_tx_t bond_xmit_broadcast(s struct bonding *bond =3D netdev_priv(bond_dev); struct slave *slave =3D NULL; struct list_head *iter; + bool xmit_suc =3D false; + bool skb_used =3D false; =20 bond_for_each_slave_rcu(bond, slave, iter) { - if (bond_is_last_slave(bond, slave)) - break; - if (bond_slave_is_up(slave) && slave->link =3D=3D BOND_LINK_UP) { - struct sk_buff *skb2 =3D skb_clone(skb, GFP_ATOMIC); + struct sk_buff *skb2; =20 + if (!(bond_slave_is_up(slave) && slave->link =3D=3D BOND_LINK_UP)) + continue; + + if (bond_is_last_slave(bond, slave)) { + skb2 =3D skb; + skb_used =3D true; + } else { + skb2 =3D skb_clone(skb, GFP_ATOMIC); if (!skb2) { net_err_ratelimited("%s: Error: %s: skb_clone() failed\n", bond_dev->name, __func__); continue; } - bond_dev_queue_xmit(bond, skb2, slave->dev); } + + if (bond_dev_queue_xmit(bond, skb2, slave->dev) =3D=3D NETDEV_TX_OK) + xmit_suc =3D true; } - if (slave && bond_slave_is_up(slave) && slave->link =3D=3D BOND_LINK_UP) - return bond_dev_queue_xmit(bond, skb, slave->dev); =20 - return bond_tx_drop(bond_dev, skb); + if (!skb_used) + dev_kfree_skb_any(skb); + + if (xmit_suc) + return NETDEV_TX_OK; + + atomic_long_inc(&bond_dev->tx_dropped); + return NET_XMIT_DROP; } =20 /*------------------------- Device initialization ------------------------= ---*/ From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC2FCC433F5 for ; Mon, 24 Jan 2022 22:54:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839868AbiAXWwC (ORCPT ); Mon, 24 Jan 2022 17:52:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33472 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379034AbiAXVoI (ORCPT ); Mon, 24 Jan 2022 16:44:08 -0500 Received: from smtp.kernel.org (relay.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 D638C61534; Mon, 24 Jan 2022 21:44:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6A88C340E4; Mon, 24 Jan 2022 21:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060647; bh=157YON3ewFpZewgxjqxaCDDdcCeplABo9eTS1EJvvBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yjb5nDQIzmgEnWMfvXCY5T83twSZlgWVp1wP8nLDiqHlXJQifdBl4ap9K6191/t6g tpI/5J/6DKWb2QC5Vvoo0syn949KYc+q6cQVMDlvaiMR5iXoarB+hE454j6UNqsbgX kUCXKEzBcL8Yve7Xen/wK5NTCCv+bqP8+cUlZOeU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Kaehlcke , Alex Elder , "David S. Miller" Subject: [PATCH 5.16 1010/1039] net: ipa: fix atomic update in ipa_endpoint_replenish() Date: Mon, 24 Jan 2022 19:46:39 +0100 Message-Id: <20220124184159.242299257@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Elder commit 6c0e3b5ce94947b311348c367db9e11dcb2ccc93 upstream. In ipa_endpoint_replenish(), if an error occurs when attempting to replenish a receive buffer, we just quit and try again later. In that case we increment the backlog count to reflect that the attempt was unsuccessful. Then, if the add_one flag was true we increment the backlog again. This second increment is not included in the backlog local variable though, and its value determines whether delayed work should be scheduled. This is a bug. Fix this by determining whether 1 or 2 should be added to the backlog before adding it in a atomic_add_return() call. Reviewed-by: Matthias Kaehlcke Fixes: 84f9bd12d46db ("soc: qcom: ipa: IPA endpoints") Signed-off-by: Alex Elder Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ipa/ipa_endpoint.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1067,6 +1067,7 @@ static void ipa_endpoint_replenish(struc { struct gsi *gsi; u32 backlog; + int delta; =20 if (!endpoint->replenish_enabled) { if (add_one) @@ -1084,10 +1085,8 @@ static void ipa_endpoint_replenish(struc =20 try_again_later: /* The last one didn't succeed, so fix the backlog */ - backlog =3D atomic_inc_return(&endpoint->replenish_backlog); - - if (add_one) - atomic_inc(&endpoint->replenish_backlog); + delta =3D add_one ? 2 : 1; + backlog =3D atomic_add_return(delta, &endpoint->replenish_backlog); =20 /* Whenever a receive buffer transaction completes we'll try to * replenish again. It's unlikely, but if we fail to supply even From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6845C3527B for ; Tue, 25 Jan 2022 00:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3409819AbiAYA1c (ORCPT ); Mon, 24 Jan 2022 19:27:32 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33836 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573185AbiAXVom (ORCPT ); Mon, 24 Jan 2022 16:44:42 -0500 Received: from smtp.kernel.org (relay.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 DDC2D61028; Mon, 24 Jan 2022 21:44:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7929C340E4; Mon, 24 Jan 2022 21:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060681; bh=JNwS8rvOAZ9MJWG3PwlVIQDvsxfM1Ms9jinjbJNnnNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xDfsEBoTwYiC/SidBz5i88Bgme9DTul+2wdckOFPdTfJzArd9O+dg7AN1l1skoHWS YTwjHC5LpGhxxpuSmY4Zxx4phAsCoOHRypwF1kYGgNVvpp09veNSLjYFQS2FuKzK/G klsuBrLMWytx3RqgU3joyhqwblAF1z2QUQyJcuUY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kevin Bracey , Eric Dumazet , Jiri Pirko , Vimalkumar , Jakub Kicinski Subject: [PATCH 5.16 1011/1039] net_sched: restore "mpu xxx" handling Date: Mon, 24 Jan 2022 19:46:40 +0100 Message-Id: <20220124184159.274733167@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kevin Bracey commit fb80445c438c78b40b547d12b8d56596ce4ccfeb upstream. commit 56b765b79e9a ("htb: improved accuracy at high rates") broke "overhead X", "linklayer atm" and "mpu X" attributes. "overhead X" and "linklayer atm" have already been fixed. This restores the "mpu X" handling, as might be used by DOCSIS or Ethernet shaping: tc class add ... htb rate X overhead 4 mpu 64 The code being fixed is used by htb, tbf and act_police. Cake has its own mpu handling. qdisc_calculate_pkt_len still uses the size table containing values adjusted for mpu by user space. iproute2 tc has always passed mpu into the kernel via a tc_ratespec structure, but the kernel never directly acted on it, merely stored it so that it could be read back by `tc class show`. Rather, tc would generate length-to-time tables that included the mpu (and linklayer) in their construction, and the kernel used those tables. Since v3.7, the tables were no longer used. Along with "mpu", this also broke "overhead" and "linklayer" which were fixed in 01cb71d2d47b ("net_sched: restore "overhead xxx" handling", v3.10) and 8a8e3d84b171 ("net_sched: restore "linklayer atm" handling", v3.11). "overhead" was fixed by simply restoring use of tc_ratespec::overhead - this had originally been used by the kernel but was initially omitted from the new non-table-based calculations. "linklayer" had been handled in the table like "mpu", but the mode was not originally passed in tc_ratespec. The new implementation was made to handle it by getting new versions of tc to pass the mode in an extended tc_ratespec, and for older versions of tc the table contents were analysed at load time to deduce linklayer. As "mpu" has always been given to the kernel in tc_ratespec, accompanying the mpu-based table, we can restore system functionality with no userspace change by making the kernel act on the tc_ratespec value. Fixes: 56b765b79e9a ("htb: improved accuracy at high rates") Signed-off-by: Kevin Bracey Cc: Eric Dumazet Cc: Jiri Pirko Cc: Vimalkumar Link: https://lore.kernel.org/r/20220112170210.1014351-1-kevin@bracey.fi Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/net/sch_generic.h | 5 +++++ net/sched/sch_generic.c | 1 + 2 files changed, 6 insertions(+) --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -1244,6 +1244,7 @@ struct psched_ratecfg { u64 rate_bytes_ps; /* bytes per second */ u32 mult; u16 overhead; + u16 mpu; u8 linklayer; u8 shift; }; @@ -1253,6 +1254,9 @@ static inline u64 psched_l2t_ns(const st { len +=3D r->overhead; =20 + if (len < r->mpu) + len =3D r->mpu; + if (unlikely(r->linklayer =3D=3D TC_LINKLAYER_ATM)) return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift; =20 @@ -1275,6 +1279,7 @@ static inline void psched_ratecfg_getrat res->rate =3D min_t(u64, r->rate_bytes_ps, ~0U); =20 res->overhead =3D r->overhead; + res->mpu =3D r->mpu; res->linklayer =3D (r->linklayer & TC_LINKLAYER_MASK); } =20 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -1474,6 +1474,7 @@ void psched_ratecfg_precompute(struct ps { memset(r, 0, sizeof(*r)); r->overhead =3D conf->overhead; + r->mpu =3D conf->mpu; r->rate_bytes_ps =3D max_t(u64, conf->rate, rate64); r->linklayer =3D (conf->linklayer & TC_LINKLAYER_MASK); psched_ratecfg_precompute__(r->rate_bytes_ps, &r->mult, &r->shift); From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FF1AC4167D for ; Mon, 24 Jan 2022 22:54:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1840087AbiAXWwf (ORCPT ); Mon, 24 Jan 2022 17:52:35 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60776 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573576AbiAXVpP (ORCPT ); Mon, 24 Jan 2022 16:45:15 -0500 Received: from smtp.kernel.org (relay.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 9867961320; Mon, 24 Jan 2022 21:45:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60B57C340E4; Mon, 24 Jan 2022 21:45:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060715; bh=TomM5/zNbvP8Y6ADovDptTISBPYpvN9S8HOB+kRGEio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n129BOGy76FWKo/8wfPtTDuPRJyc9K/sb/3N13LdsMCxyQvq1vMZU5rKci5cnND4a 3DTrRiebPmGMiHlL6rYlDa/CV1U45GHU+zVboB6iSVXRFKwAEH/5P3hz9VwGvVpBB5 9MeGuXvrvEn+X6mrqT8jDnRs06b86eGo6hvDQH0Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaoliang Yang , Vladimir Oltean , Florian Fainelli , "David S. Miller" Subject: [PATCH 5.16 1012/1039] net: mscc: ocelot: dont let phylink re-enable TX PAUSE on the NPI port Date: Mon, 24 Jan 2022 19:46:41 +0100 Message-Id: <20220124184159.306281184@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 33cb0ff30cff104e753f7882c99e54cf67ea7903 upstream. Since commit b39648079db4 ("net: mscc: ocelot: disable flow control on NPI interface"), flow control should be disabled on the DSA CPU port when used in NPI mode. However, the commit blamed in the Fixes: tag below broke this, because it allowed felix_phylink_mac_link_up() to overwrite SYS_PAUSE_CFG_PAUSE_ENA for the DSA CPU port. This issue became noticeable since the device tree update from commit 8fcea7be5736 ("arm64: dts: ls1028a: mark internal links between Felix and ENETC as capable of flow control"). The solution is to check whether this is the currently configured NPI port from ocelot_phylink_mac_link_up(), and to not modify the statically disabled PAUSE frame transmission if it is. When the port is configured for lossless mode as opposed to tail drop mode, but the link partner (DSA master) doesn't observe the transmitted PAUSE frames, the switch termination throughput is much worse, as can be seen below. Before: root@debian:~# iperf3 -c 192.168.100.2 Connecting to host 192.168.100.2, port 5201 [ 5] local 192.168.100.1 port 37504 connected to 192.168.100.2 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 28.4 MBytes 238 Mbits/sec 357 22.6 KBytes [ 5] 1.00-2.00 sec 33.6 MBytes 282 Mbits/sec 426 19.8 KBytes [ 5] 2.00-3.00 sec 34.0 MBytes 285 Mbits/sec 343 21.2 KBytes [ 5] 3.00-4.00 sec 32.9 MBytes 276 Mbits/sec 354 22.6 KBytes [ 5] 4.00-5.00 sec 32.3 MBytes 271 Mbits/sec 297 18.4 KBytes ^C[ 5] 5.00-5.06 sec 2.05 MBytes 270 Mbits/sec 45 19.8 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-5.06 sec 163 MBytes 271 Mbits/sec 1822 send= er [ 5] 0.00-5.06 sec 0.00 Bytes 0.00 bits/sec receiver After: root@debian:~# iperf3 -c 192.168.100.2 Connecting to host 192.168.100.2, port 5201 [ 5] local 192.168.100.1 port 49470 connected to 192.168.100.2 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 112 MBytes 941 Mbits/sec 259 143 KBytes [ 5] 1.00-2.00 sec 110 MBytes 920 Mbits/sec 329 144 KBytes [ 5] 2.00-3.00 sec 112 MBytes 936 Mbits/sec 255 144 KBytes [ 5] 3.00-4.00 sec 110 MBytes 927 Mbits/sec 355 105 KBytes [ 5] 4.00-5.00 sec 110 MBytes 926 Mbits/sec 350 156 KBytes [ 5] 5.00-6.00 sec 110 MBytes 925 Mbits/sec 305 148 KBytes [ 5] 6.00-7.00 sec 110 MBytes 924 Mbits/sec 320 143 KBytes [ 5] 7.00-8.00 sec 110 MBytes 925 Mbits/sec 273 97.6 KBytes [ 5] 8.00-9.00 sec 109 MBytes 913 Mbits/sec 299 141 KBytes [ 5] 9.00-10.00 sec 110 MBytes 922 Mbits/sec 287 146 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 1.08 GBytes 926 Mbits/sec 3032 send= er [ 5] 0.00-10.00 sec 1.08 GBytes 925 Mbits/sec recei= ver Fixes: de274be32cb2 ("net: dsa: felix: set TX flow control according to the= phylink_mac_link_up resolution") Reported-by: Xiaoliang Yang Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mscc/ocelot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -692,7 +692,10 @@ void ocelot_phylink_mac_link_up(struct o =20 ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port); =20 - ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, tx_pause); + /* Don't attempt to send PAUSE frames on the NPI port, it's broken */ + if (port !=3D ocelot->npi) + ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, + tx_pause); =20 /* Undo the effects of ocelot_phylink_mac_link_down: * enable MAC module From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FDE7C433FE for ; Tue, 25 Jan 2022 01:59:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412706AbiAYAhh (ORCPT ); Mon, 24 Jan 2022 19:37:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2366208AbiAXXwa (ORCPT ); Mon, 24 Jan 2022 18:52:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A1B6C07A960; Mon, 24 Jan 2022 13:45:22 -0800 (PST) Received: from smtp.kernel.org (relay.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 0529960917; Mon, 24 Jan 2022 21:45:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA44EC340E4; Mon, 24 Jan 2022 21:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060721; bh=50IGVVTLdTnXb61ETsYNp6mE39BCkHix8fK1hsjK62U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=auocqY5XBhFkKGv7W3HFBDC7CvKpdI6RkcJTjtU55p3+lyQTSv5B44iURuYwTQ4sd ClT7exzAQZM2/H87wBKTFRhGN45OeP2WnpwbpOt+2WHxawJaOk7LYzsP4vgcTGXOc0 aoKQ+srQVFCEJmdxF68dBeGwg1s/vfmxNWrwHVTg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Florian Fainelli , "David S. Miller" Subject: [PATCH 5.16 1013/1039] bcmgenet: add WOL IRQ check Date: Mon, 24 Jan 2022 19:46:42 +0100 Message-Id: <20220124184159.344664381@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Shtylyov commit 9deb48b53e7f4056c2eaa2dc2ee3338df619e4f6 upstream. The driver neglects to check the result of platform_get_irq_optional()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL. Stop calling devm_request_irq() with the invalid IRQ #s. Fixes: 8562056f267d ("net: bcmgenet: request Wake-on-LAN interrupt") Signed-off-by: Sergey Shtylyov Acked-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -4020,10 +4020,12 @@ static int bcmgenet_probe(struct platfor =20 /* Request the WOL interrupt and advertise suspend if available */ priv->wol_irq_disabled =3D true; - err =3D devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0, - dev->name, priv); - if (!err) - device_set_wakeup_capable(&pdev->dev, 1); + if (priv->wol_irq > 0) { + err =3D devm_request_irq(&pdev->dev, priv->wol_irq, + bcmgenet_wol_isr, 0, dev->name, priv); + if (!err) + device_set_wakeup_capable(&pdev->dev, 1); + } =20 /* Set the needed headroom to account for any possible * features enabling/disabling at runtime From nobody Tue Jun 30 05:22:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D91EC4321E for ; Mon, 24 Jan 2022 22:54:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1840108AbiAXWwk (ORCPT ); Mon, 24 Jan 2022 17:52:40 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52814 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573632AbiAXVp1 (ORCPT ); Mon, 24 Jan 2022 16:45:27 -0500 Received: from smtp.kernel.org (relay.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 B3AA1B81142; Mon, 24 Jan 2022 21:45:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9F03C340E4; Mon, 24 Jan 2022 21:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060724; bh=Na2LqFnocrrciGh3URNev+L8WFIemNTWltVKqlnZUVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N10CC9Wm8JRm/uYORiqQOBISvFYkiSWQhzuVA82WVMFpUod7mW/CoM5DSZBhXICxI NBg81sPcjLZ0klst11lvfeOb38F3Nj6fgikj1vp8kqOvlwRlh1Y+cNvd7OwyBRnaxS YG84eou+JDYE8zBk7Cczjt/gRMLAOUzOKym/mLcg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , "David S. Miller" Subject: [PATCH 5.16 1014/1039] net: mscc: ocelot: dont dereference NULL pointers with shared tc filters Date: Mon, 24 Jan 2022 19:46:43 +0100 Message-Id: <20220124184159.379780388@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 80f15f3bef9e9c2cc29888a6773df44de0a0c65f upstream. The following command sequence: tc qdisc del dev swp0 clsact tc qdisc add dev swp0 ingress_block 1 clsact tc qdisc add dev swp1 ingress_block 1 clsact tc filter add block 1 flower action drop tc qdisc del dev swp0 clsact produces the following NPD: Unable to handle kernel NULL pointer dereference at virtual address 0000000= 000000014 pc : vcap_entry_set+0x14/0x70 lr : ocelot_vcap_filter_del+0x198/0x234 Call trace: vcap_entry_set+0x14/0x70 ocelot_vcap_filter_del+0x198/0x234 ocelot_cls_flower_destroy+0x94/0xe4 felix_cls_flower_del+0x70/0x84 dsa_slave_setup_tc_block_cb+0x13c/0x60c dsa_slave_setup_tc_block_cb_ig+0x20/0x30 tc_setup_cb_reoffload+0x44/0x120 fl_reoffload+0x280/0x320 tcf_block_playback_offloads+0x6c/0x184 tcf_block_unbind+0x80/0xe0 tcf_block_setup+0x174/0x214 tcf_block_offload_cmd.isra.0+0x100/0x13c tcf_block_offload_unbind+0x5c/0xa0 __tcf_block_put+0x54/0x174 tcf_block_put_ext+0x5c/0x74 clsact_destroy+0x40/0x60 qdisc_destroy+0x4c/0x150 qdisc_put+0x70/0x90 qdisc_graft+0x3f0/0x4c0 tc_get_qdisc+0x1cc/0x364 rtnetlink_rcv_msg+0x124/0x340 The reason is that the driver isn't prepared to receive two tc filters with the same cookie. It unconditionally creates a new struct ocelot_vcap_filter for each tc filter, and it adds all filters with the same identifier (cookie) to the ocelot_vcap_block. The problem is here, in ocelot_vcap_filter_del(): /* Gets index of the filter */ index =3D ocelot_vcap_block_get_filter_index(block, filter); if (index < 0) return index; /* Delete filter */ ocelot_vcap_block_remove_filter(ocelot, block, filter); /* Move up all the blocks over the deleted filter */ for (i =3D index; i < block->count; i++) { struct ocelot_vcap_filter *tmp; tmp =3D ocelot_vcap_block_find_filter_by_index(block, i); vcap_entry_set(ocelot, i, tmp); } what will happen is ocelot_vcap_block_get_filter_index() will return the index (@index) of the first filter found with that cookie. This is _not_ the index of _this_ filter, but the other one with the same cookie, because ocelot_vcap_filter_equal() gets fooled. Then later, ocelot_vcap_block_remove_filter() is coded to remove all filters that are ocelot_vcap_filter_equal() with the passed @filter. So unexpectedly, both filters get deleted from the list. Then ocelot_vcap_filter_del() will attempt to move all the other filters up, again finding them by index (@i). The block count is 2, @index was 0, so it will attempt to move up filter @i=3D0 and @i=3D1. It assigns tmp =3D ocelot_vcap_block_find_filter_by_index(block, i), which is now a NULL pointer because ocelot_vcap_block_remove_filter() has removed more than one filter. As far as I can see, this problem has been there since the introduction of tc offload support, however I cannot test beyond the blamed commit due to hardware availability. In any case, any fix cannot be backported that far, due to lots of changes to the code base. Therefore, let's go for the correct solution, which is to not call ocelot_vcap_filter_add() and ocelot_vcap_filter_del(), unless the filter is actually unique and not shared. For the shared filters, we should just modify the ingress port mask and call ocelot_vcap_filter_replace(), a function introduced by commit 95706be13b9f ("net: mscc: ocelot: create a function that replaces an existing VCAP filter"). This way, block->rules will only contain filters with unique cookies, by design. Fixes: 07d985eef073 ("net: dsa: felix: Wire up the ocelot cls_flower method= s") Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mscc/ocelot_flower.c | 29 +++++++++++++++++++++++++= +++- 1 file changed, 28 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/mscc/ocelot_flower.c +++ b/drivers/net/ethernet/mscc/ocelot_flower.c @@ -763,13 +763,34 @@ int ocelot_cls_flower_replace(struct oce struct netlink_ext_ack *extack =3D f->common.extack; struct ocelot_vcap_filter *filter; int chain =3D f->common.chain_index; - int ret; + int block_id, ret; =20 if (chain && !ocelot_find_vcap_filter_that_points_at(ocelot, chain)) { NL_SET_ERR_MSG_MOD(extack, "No default GOTO action points to this chain"= ); return -EOPNOTSUPP; } =20 + block_id =3D ocelot_chain_to_block(chain, ingress); + if (block_id < 0) { + NL_SET_ERR_MSG_MOD(extack, "Cannot offload to this chain"); + return -EOPNOTSUPP; + } + + filter =3D ocelot_vcap_block_find_filter_by_id(&ocelot->block[block_id], + f->cookie, true); + if (filter) { + /* Filter already exists on other ports */ + if (!ingress) { + NL_SET_ERR_MSG_MOD(extack, "VCAP ES0 does not support shared filters"); + return -EOPNOTSUPP; + } + + filter->ingress_port_mask |=3D BIT(port); + + return ocelot_vcap_filter_replace(ocelot, filter); + } + + /* Filter didn't exist, create it now */ filter =3D ocelot_vcap_filter_create(ocelot, port, ingress, f); if (!filter) return -ENOMEM; @@ -816,6 +837,12 @@ int ocelot_cls_flower_destroy(struct oce if (filter->type =3D=3D OCELOT_VCAP_FILTER_DUMMY) return ocelot_vcap_dummy_filter_del(ocelot, filter); =20 + if (ingress) { + filter->ingress_port_mask &=3D ~BIT(port); + if (filter->ingress_port_mask) + return ocelot_vcap_filter_replace(ocelot, filter); + } + return ocelot_vcap_filter_del(ocelot, filter); } EXPORT_SYMBOL_GPL(ocelot_cls_flower_destroy); From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 321D9C433F5 for ; Tue, 25 Jan 2022 01:59:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412664AbiAYAh2 (ORCPT ); Mon, 24 Jan 2022 19:37:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2366209AbiAXXwa (ORCPT ); Mon, 24 Jan 2022 18:52:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 960EBC07A961; Mon, 24 Jan 2022 13:45:28 -0800 (PST) Received: from smtp.kernel.org (relay.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 3443C60917; Mon, 24 Jan 2022 21:45:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E76FDC340E7; Mon, 24 Jan 2022 21:45:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060727; bh=U9D2LDGgbCHgBmgg2XL78R/VmCn/04O+TxeC8NuJNJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XWmW4FTvwnZ6SLJoetVnPCEisw8xvs7vsMGqiSRZzJSIa+jUU/+ECelTEV+plGwDE iNsrTlcp8kqSkTHU0uWpWiScERQI44HPoNscCIIT++EwZJ5plPfZZwYU4sBx6gZSzr UPI3bjx7ejskLemKrk8wBjuOBR8qvReUFygfl/aA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shujun Wang , Slark Xiao , Loic Poulain , "David S. Miller" Subject: [PATCH 5.16 1015/1039] net: wwan: Fix MRU mismatch issue which may lead to data connection lost Date: Mon, 24 Jan 2022 19:46:44 +0100 Message-Id: <20220124184159.412744533@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Slark Xiao commit f542cdfa3083a309e3caafbbdf41490c4935492a upstream. In pci_generic.c there is a 'mru_default' in struct mhi_pci_dev_info. This value shall be used for whole mhi if it's given a value for a specific= product. But in function mhi_net_rx_refill_work(), it's still using hard code value = MHI_DEFAULT_MRU. 'mru_default' shall have higher priority than MHI_DEFAULT_MRU. And after checking, this change could help fix a data connection lost issue. Fixes: 5c2c85315948 ("bus: mhi: pci-generic: configurable network interface= MRU") Signed-off-by: Shujun Wang Signed-off-by: Slark Xiao Reviewed-by: Loic Poulain Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wwan/mhi_wwan_mbim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/wwan/mhi_wwan_mbim.c +++ b/drivers/net/wwan/mhi_wwan_mbim.c @@ -385,13 +385,13 @@ static void mhi_net_rx_refill_work(struc int err; =20 while (!mhi_queue_is_full(mdev, DMA_FROM_DEVICE)) { - struct sk_buff *skb =3D alloc_skb(MHI_DEFAULT_MRU, GFP_KERNEL); + struct sk_buff *skb =3D alloc_skb(mbim->mru, GFP_KERNEL); =20 if (unlikely(!skb)) break; =20 err =3D mhi_queue_skb(mdev, DMA_FROM_DEVICE, skb, - MHI_DEFAULT_MRU, MHI_EOT); + mbim->mru, MHI_EOT); if (unlikely(err)) { kfree_skb(skb); break; From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3738DC4332F for ; Tue, 25 Jan 2022 01:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412428AbiAYAg4 (ORCPT ); Mon, 24 Jan 2022 19:36:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2366246AbiAXXwd (ORCPT ); Mon, 24 Jan 2022 18:52:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E1B0C047CFC; Mon, 24 Jan 2022 13:45:31 -0800 (PST) Received: from smtp.kernel.org (relay.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 3C68B60917; Mon, 24 Jan 2022 21:45:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 243C2C340E4; Mon, 24 Jan 2022 21:45:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060730; bh=Fr/LKWtC4UyTPQgHsHi1fEAW/E12tFtoUubYw4q27BA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HO/slpzrqBNDA/9Zn8+FjhamuHxH0vSK5IMXIv2W4xUARQCFvc4A/NHOcuztWcNph NioWHizEP/8QSJguwrtULXW6/FVZdBBk/w2CsaV6aEeZp7QsPbVzTgX8G+60PsIGIO 8oWFJoZ3SwRShgIsKuMbdhwoLmMwBtddl0gs/1ac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , "David S. Miller" Subject: [PATCH 5.16 1016/1039] net: ethernet: mtk_eth_soc: fix error checking in mtk_mac_config() Date: Mon, 24 Jan 2022 19:46:45 +0100 Message-Id: <20220124184159.451000912@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 214b3369ab9b0a6f28d6c970220c209417edbc65 upstream. Clang static analysis reports this problem mtk_eth_soc.c:394:7: warning: Branch condition evaluates to a garbage value if (err) ^~~ err is not initialized and only conditionally set. So intitialize err. Fixes: 7e538372694b ("net: ethernet: mediatek: Re-add support SGMII") Signed-off-by: Tom Rix Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -224,7 +224,7 @@ static void mtk_mac_config(struct phylin phylink_config); struct mtk_eth *eth =3D mac->hw; u32 mcr_cur, mcr_new, sid, i; - int val, ge_mode, err; + int val, ge_mode, err =3D 0; =20 /* MT76x8 has no hardware settings between for the MAC */ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12043C433FE for ; Mon, 24 Jan 2022 22:54:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1840144AbiAXWwp (ORCPT ); Mon, 24 Jan 2022 17:52:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52876 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573671AbiAXVpg (ORCPT ); Mon, 24 Jan 2022 16:45:36 -0500 Received: from smtp.kernel.org (relay.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 2694CB80FA1; Mon, 24 Jan 2022 21:45:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 244AEC340E5; Mon, 24 Jan 2022 21:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060733; bh=uyerVO+UteF3ZIZcetYXxzLHy9BxVQRYWe9gb8chIxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYaJF6mKTujXVkF00S0VJt32QmhX0oQpnf52i8xK1cfEnx0bwPr8Ezje61NchESpw FHyJx19L4WjTqScOPO41cXLy4NAyNP89/TVpTyStMibGUBcJn9HXGl158Bhp+002Y5 LPsr4ETpT8wYT1rj5eCloJCZCuKjh28dHFjIk4Ik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Horatiu Vultur , Vladimir Oltean , "David S. Miller" Subject: [PATCH 5.16 1017/1039] net: ocelot: Fix the call to switchdev_bridge_port_offload Date: Mon, 24 Jan 2022 19:46:46 +0100 Message-Id: <20220124184159.481452009@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Horatiu Vultur commit c0b7f7d7e0ad44f35745c01964b3fa2833e298cb upstream. In the blamed commit, the call to the function switchdev_bridge_port_offload was passing the wrong argument for atomic_nb. It was ocelot_netdevice_nb instead of ocelot_swtchdev_nb. This patch fixes this issue. Fixes: 4e51bf44a03af6 ("net: bridge: move the switchdev object replay helpe= rs to "push" mode") Signed-off-by: Horatiu Vultur Reviewed-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mscc/ocelot_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -1168,7 +1168,7 @@ static int ocelot_netdevice_bridge_join( ocelot_port_bridge_join(ocelot, port, bridge); =20 err =3D switchdev_bridge_port_offload(brport_dev, dev, priv, - &ocelot_netdevice_nb, + &ocelot_switchdev_nb, &ocelot_switchdev_blocking_nb, false, extack); if (err) @@ -1182,7 +1182,7 @@ static int ocelot_netdevice_bridge_join( =20 err_switchdev_sync: switchdev_bridge_port_unoffload(brport_dev, priv, - &ocelot_netdevice_nb, + &ocelot_switchdev_nb, &ocelot_switchdev_blocking_nb); err_switchdev_offload: ocelot_port_bridge_leave(ocelot, port, bridge); @@ -1195,7 +1195,7 @@ static void ocelot_netdevice_pre_bridge_ struct ocelot_port_private *priv =3D netdev_priv(dev); =20 switchdev_bridge_port_unoffload(brport_dev, priv, - &ocelot_netdevice_nb, + &ocelot_switchdev_nb, &ocelot_switchdev_blocking_nb); } =20 From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDFF0C433F5 for ; Tue, 25 Jan 2022 01:59:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412649AbiAYAhY (ORCPT ); Mon, 24 Jan 2022 19:37:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2366247AbiAXXwd (ORCPT ); Mon, 24 Jan 2022 18:52:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67A39C047CFE; Mon, 24 Jan 2022 13:45:39 -0800 (PST) Received: from smtp.kernel.org (relay.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 24814B8119E; Mon, 24 Jan 2022 21:45:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46C03C340E4; Mon, 24 Jan 2022 21:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060736; bh=b9l0gqvoTDt6A/0QvDZYMLVha/WUwb9rjfjzdWEXvYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TCWDIm27rgeqmYEuIs4j5I57MelnxAAxMujpSo9DvFgoU6jMi85H5xGHkEu+FPiMR 4JHhGC6R99mu7TXD9v0+8uaz464nuGsLOT2Agv6H1Qsh5u3WrraLSr7RCBe1C2YBcj oLwzaBdE36NXoaOSm2sRCWuIEIFgCjRyZ06DbVn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?=E7=85=A7=E5=B1=B1=E5=91=A8=E4=B8=80=E9=83=8E?= , "Russell King (Oracle)" , "David S. Miller" Subject: [PATCH 5.16 1018/1039] net: sfp: fix high power modules without diagnostic monitoring Date: Mon, 24 Jan 2022 19:46:47 +0100 Message-Id: <20220124184159.511708556@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 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: Russell King (Oracle) commit 5765cee119bf5a36c94d20eceb37c445508934be upstream. Commit 7cfa9c92d0a3 ("net: sfp: avoid power switch on address-change modules") unintetionally changed the semantics for high power modules without the digital diagnostics monitoring. We repeatedly attempt to read the power status from the non-existing 0xa2 address in a futile hope this failure is temporary: [ 8.856051] sfp sfp-eth3: module NTT 0000000000000000 rev 0= 000 sn 0000000000000000 dc 160408 [ 8.865843] mvpp2 f4000000.ethernet eth3: switched to inband/1000base-x = link mode [ 8.873469] sfp sfp-eth3: Failed to read EEPROM: -5 [ 8.983251] sfp sfp-eth3: Failed to read EEPROM: -5 [ 9.103250] sfp sfp-eth3: Failed to read EEPROM: -5 We previosuly assumed such modules were powered up in the correct mode, continuing without further configuration as long as the required power class was supported by the host. Restore this behaviour, while preserving the intent of subsequent patches to avoid the "Address Change Sequence not supported" warning if we are not going to be accessing the DDM address. Fixes: 7cfa9c92d0a3 ("net: sfp: avoid power switch on address-change module= s") Reported-by: =E7=85=A7=E5=B1=B1=E5=91=A8=E4=B8=80=E9=83=8E Tested-by: =E7=85=A7=E5=B1=B1=E5=91=A8=E4=B8=80=E9=83=8E Signed-off-by: Russell King (Oracle) Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/phy/sfp.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -1641,17 +1641,20 @@ static int sfp_sm_probe_for_phy(struct s static int sfp_module_parse_power(struct sfp *sfp) { u32 power_mW =3D 1000; + bool supports_a2; =20 if (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_POWER_DECL)) power_mW =3D 1500; if (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_HIGH_POWER_LEVEL)) power_mW =3D 2000; =20 + supports_a2 =3D sfp->id.ext.sff8472_compliance !=3D + SFP_SFF8472_COMPLIANCE_NONE || + sfp->id.ext.diagmon & SFP_DIAGMON_DDM; + if (power_mW > sfp->max_power_mW) { /* Module power specification exceeds the allowed maximum. */ - if (sfp->id.ext.sff8472_compliance =3D=3D - SFP_SFF8472_COMPLIANCE_NONE && - !(sfp->id.ext.diagmon & SFP_DIAGMON_DDM)) { + if (!supports_a2) { /* The module appears not to implement bus address * 0xa2, so assume that the module powers up in the * indicated mode. @@ -1668,11 +1671,25 @@ static int sfp_module_parse_power(struct } } =20 + if (power_mW <=3D 1000) { + /* Modules below 1W do not require a power change sequence */ + sfp->module_power_mW =3D power_mW; + return 0; + } + + if (!supports_a2) { + /* The module power level is below the host maximum and the + * module appears not to implement bus address 0xa2, so assume + * that the module powers up in the indicated mode. + */ + return 0; + } + /* If the module requires a higher power mode, but also requires * an address change sequence, warn the user that the module may * not be functional. */ - if (sfp->id.ext.diagmon & SFP_DIAGMON_ADDRMODE && power_mW > 1000) { + if (sfp->id.ext.diagmon & SFP_DIAGMON_ADDRMODE) { dev_warn(sfp->dev, "Address Change Sequence not supported but module requires %u.%uW, mod= ule may not be functional\n", power_mW / 1000, (power_mW / 100) % 10); From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F623C4332F for ; Tue, 25 Jan 2022 01:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412261AbiAYAgX (ORCPT ); Mon, 24 Jan 2022 19:36:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2365132AbiAXXuS (ORCPT ); Mon, 24 Jan 2022 18:50:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2895AC0417CF; Mon, 24 Jan 2022 13:44:11 -0800 (PST) Received: from smtp.kernel.org (relay.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 BBD7461491; Mon, 24 Jan 2022 21:44:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2722C340E4; Mon, 24 Jan 2022 21:44:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060650; bh=eXynGo+KjFto3C/Buumq3unNrllJ5PYHTL/A30vhd9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uTJvxR8tndHQ8hHZNn5J3kBbn+sHhDLWn/1SfINzoTerSf1V108tpkCK5T2SNeNjP 25pa23UjZqUIahRYB612FwCQB24rbSUqzIi8OVILf9ikx3+waa8LDQjpFdOAkJFoK6 BF5z/yW5jKHAN8SG1/1kq+UAU3fXAryjNU71wOm0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Grygorii Strashko , Ilias Apalodimas , Ard Biesheuvel , "David S. Miller" Subject: [PATCH 5.16 1019/1039] net: cpsw: avoid alignment faults by taking NET_IP_ALIGN into account Date: Mon, 24 Jan 2022 19:46:48 +0100 Message-Id: <20220124184159.548689447@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel commit 1771afd47430f5e95c9c3a2e3a8a63e67402d3fe upstream. Both versions of the CPSW driver declare a CPSW_HEADROOM_NA macro that takes NET_IP_ALIGN into account, but fail to use it appropriately when storing incoming packets in memory. This results in the IPv4 source and destination addresses to appear misaligned in memory, which causes aligment faults that need to be fixed up in software. So let's switch from CPSW_HEADROOM to CPSW_HEADROOM_NA where needed. This gets rid of any alignment faults on the RX path on a Beaglebone White. Fixes: 9ed4050c0d75 ("net: ethernet: ti: cpsw: add XDP support") Cc: Grygorii Strashko Cc: Ilias Apalodimas Signed-off-by: Ard Biesheuvel Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/ti/cpsw.c | 6 +++--- drivers/net/ethernet/ti/cpsw_new.c | 6 +++--- drivers/net/ethernet/ti/cpsw_priv.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -349,7 +349,7 @@ static void cpsw_rx_handler(void *token, struct cpsw_common *cpsw =3D ndev_to_cpsw(xmeta->ndev); int pkt_size =3D cpsw->rx_packet_max; int ret =3D 0, port, ch =3D xmeta->ch; - int headroom =3D CPSW_HEADROOM; + int headroom =3D CPSW_HEADROOM_NA; struct net_device *ndev =3D xmeta->ndev; struct cpsw_priv *priv; struct page_pool *pool; @@ -392,7 +392,7 @@ static void cpsw_rx_handler(void *token, } =20 if (priv->xdp_prog) { - int headroom =3D CPSW_HEADROOM, size =3D len; + int size =3D len; =20 xdp_init_buff(&xdp, PAGE_SIZE, &priv->xdp_rxq[ch]); if (status & CPDMA_RX_VLAN_ENCAP) { @@ -442,7 +442,7 @@ requeue: xmeta->ndev =3D ndev; xmeta->ch =3D ch; =20 - dma =3D page_pool_get_dma_addr(new_page) + CPSW_HEADROOM; + dma =3D page_pool_get_dma_addr(new_page) + CPSW_HEADROOM_NA; ret =3D cpdma_chan_submit_mapped(cpsw->rxv[ch].ch, new_page, dma, pkt_size, 0); if (ret < 0) { --- a/drivers/net/ethernet/ti/cpsw_new.c +++ b/drivers/net/ethernet/ti/cpsw_new.c @@ -283,7 +283,7 @@ static void cpsw_rx_handler(void *token, { struct page *new_page, *page =3D token; void *pa =3D page_address(page); - int headroom =3D CPSW_HEADROOM; + int headroom =3D CPSW_HEADROOM_NA; struct cpsw_meta_xdp *xmeta; struct cpsw_common *cpsw; struct net_device *ndev; @@ -336,7 +336,7 @@ static void cpsw_rx_handler(void *token, } =20 if (priv->xdp_prog) { - int headroom =3D CPSW_HEADROOM, size =3D len; + int size =3D len; =20 xdp_init_buff(&xdp, PAGE_SIZE, &priv->xdp_rxq[ch]); if (status & CPDMA_RX_VLAN_ENCAP) { @@ -386,7 +386,7 @@ requeue: xmeta->ndev =3D ndev; xmeta->ch =3D ch; =20 - dma =3D page_pool_get_dma_addr(new_page) + CPSW_HEADROOM; + dma =3D page_pool_get_dma_addr(new_page) + CPSW_HEADROOM_NA; ret =3D cpdma_chan_submit_mapped(cpsw->rxv[ch].ch, new_page, dma, pkt_size, 0); if (ret < 0) { --- a/drivers/net/ethernet/ti/cpsw_priv.c +++ b/drivers/net/ethernet/ti/cpsw_priv.c @@ -1120,7 +1120,7 @@ int cpsw_fill_rx_channels(struct cpsw_pr xmeta->ndev =3D priv->ndev; xmeta->ch =3D ch; =20 - dma =3D page_pool_get_dma_addr(page) + CPSW_HEADROOM; + dma =3D page_pool_get_dma_addr(page) + CPSW_HEADROOM_NA; ret =3D cpdma_chan_idle_submit_mapped(cpsw->rxv[ch].ch, page, dma, cpsw->rx_packet_max, From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48C99C4321E for ; Mon, 24 Jan 2022 22:54:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1840057AbiAXWwb (ORCPT ); Mon, 24 Jan 2022 17:52:31 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33532 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449799AbiAXVoO (ORCPT ); Mon, 24 Jan 2022 16:44:14 -0500 Received: from smtp.kernel.org (relay.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 BD3916150C; Mon, 24 Jan 2022 21:44:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 917DAC340E4; Mon, 24 Jan 2022 21:44:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060653; bh=gR/N5qZK1VxOw5l/WNDdjtOvBhxoOw2tbdxKt3r7zlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qcGtQNoYQcPKqwVNPPpe3ZIUfnxUiLWYn3k94JDKag518QBpyZb9dIHYvPya5mnhK H2uG6PMyj3n2Oh1MJtqtdyrNT4COBZtwOohxz4VL32MjMhZNOGEnjJt3YsPMO7a+BR 4ofIDk/P2a3gcS7qC1gHFYijCUwwHNTjEdnIpDnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Andrew Lunn , "David S. Miller" Subject: [PATCH 5.16 1020/1039] net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices Date: Mon, 24 Jan 2022 19:46:49 +0100 Message-Id: <20220124184159.586360232@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea commit f1131b9c23fb4a3540a774828ff49f421619f902 upstream. On a setup with KSZ9131 and MACB drivers it happens on suspend path, from time to time, that the PHY interrupt arrives after PHY and MACB were suspended (PHY via genphy_suspend(), MACB via macb_suspend()). In this case the phy_read() at the beginning of kszphy_handle_interrupt() will fail (as MACB driver is suspended at this time) leading to phy_error() being called and a stack trace being displayed on console. To solve this .suspend/.resume functions for all KSZ devices implementing .handle_interrupt were replaced with kszphy_suspend()/kszphy_resume() which disable/enable interrupt before/after calling genphy_suspend()/genphy_resume(). The fix has been adapted for all KSZ devices which implements .handle_interrupt but it has been tested only on KSZ9131. Fixes: 59ca4e58b917 ("net: phy: micrel: implement generic .handle_interrupt= () callback") Signed-off-by: Claudiu Beznea Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/phy/micrel.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -1630,8 +1630,8 @@ static struct phy_driver ksphy_driver[] .config_init =3D kszphy_config_init, .config_intr =3D kszphy_config_intr, .handle_interrupt =3D kszphy_handle_interrupt, - .suspend =3D genphy_suspend, - .resume =3D genphy_resume, + .suspend =3D kszphy_suspend, + .resume =3D kszphy_resume, }, { .phy_id =3D PHY_ID_KSZ8021, .phy_id_mask =3D 0x00ffffff, @@ -1645,8 +1645,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count =3D kszphy_get_sset_count, .get_strings =3D kszphy_get_strings, .get_stats =3D kszphy_get_stats, - .suspend =3D genphy_suspend, - .resume =3D genphy_resume, + .suspend =3D kszphy_suspend, + .resume =3D kszphy_resume, }, { .phy_id =3D PHY_ID_KSZ8031, .phy_id_mask =3D 0x00ffffff, @@ -1660,8 +1660,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count =3D kszphy_get_sset_count, .get_strings =3D kszphy_get_strings, .get_stats =3D kszphy_get_stats, - .suspend =3D genphy_suspend, - .resume =3D genphy_resume, + .suspend =3D kszphy_suspend, + .resume =3D kszphy_resume, }, { .phy_id =3D PHY_ID_KSZ8041, .phy_id_mask =3D MICREL_PHY_ID_MASK, @@ -1692,8 +1692,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count =3D kszphy_get_sset_count, .get_strings =3D kszphy_get_strings, .get_stats =3D kszphy_get_stats, - .suspend =3D genphy_suspend, - .resume =3D genphy_resume, + .suspend =3D kszphy_suspend, + .resume =3D kszphy_resume, }, { .name =3D "Micrel KSZ8051", /* PHY_BASIC_FEATURES */ @@ -1706,8 +1706,8 @@ static struct phy_driver ksphy_driver[] .get_strings =3D kszphy_get_strings, .get_stats =3D kszphy_get_stats, .match_phy_device =3D ksz8051_match_phy_device, - .suspend =3D genphy_suspend, - .resume =3D genphy_resume, + .suspend =3D kszphy_suspend, + .resume =3D kszphy_resume, }, { .phy_id =3D PHY_ID_KSZ8001, .name =3D "Micrel KSZ8001 or KS8721", @@ -1721,8 +1721,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count =3D kszphy_get_sset_count, .get_strings =3D kszphy_get_strings, .get_stats =3D kszphy_get_stats, - .suspend =3D genphy_suspend, - .resume =3D genphy_resume, + .suspend =3D kszphy_suspend, + .resume =3D kszphy_resume, }, { .phy_id =3D PHY_ID_KSZ8081, .name =3D "Micrel KSZ8081 or KSZ8091", @@ -1752,8 +1752,8 @@ static struct phy_driver ksphy_driver[] .config_init =3D ksz8061_config_init, .config_intr =3D kszphy_config_intr, .handle_interrupt =3D kszphy_handle_interrupt, - .suspend =3D genphy_suspend, - .resume =3D genphy_resume, + .suspend =3D kszphy_suspend, + .resume =3D kszphy_resume, }, { .phy_id =3D PHY_ID_KSZ9021, .phy_id_mask =3D 0x000ffffe, @@ -1768,8 +1768,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count =3D kszphy_get_sset_count, .get_strings =3D kszphy_get_strings, .get_stats =3D kszphy_get_stats, - .suspend =3D genphy_suspend, - .resume =3D genphy_resume, + .suspend =3D kszphy_suspend, + .resume =3D kszphy_resume, .read_mmd =3D genphy_read_mmd_unsupported, .write_mmd =3D genphy_write_mmd_unsupported, }, { @@ -1787,7 +1787,7 @@ static struct phy_driver ksphy_driver[] .get_sset_count =3D kszphy_get_sset_count, .get_strings =3D kszphy_get_strings, .get_stats =3D kszphy_get_stats, - .suspend =3D genphy_suspend, + .suspend =3D kszphy_suspend, .resume =3D kszphy_resume, }, { .phy_id =3D PHY_ID_LAN8814, @@ -1829,7 +1829,7 @@ static struct phy_driver ksphy_driver[] .get_sset_count =3D kszphy_get_sset_count, .get_strings =3D kszphy_get_strings, .get_stats =3D kszphy_get_stats, - .suspend =3D genphy_suspend, + .suspend =3D kszphy_suspend, .resume =3D kszphy_resume, }, { .phy_id =3D PHY_ID_KSZ8873MLL, From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E9EFC433EF for ; Tue, 25 Jan 2022 01:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412243AbiAYAgU (ORCPT ); Mon, 24 Jan 2022 19:36:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2365244AbiAXXud (ORCPT ); Mon, 24 Jan 2022 18:50:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9B83C0BD137; Mon, 24 Jan 2022 13:44:18 -0800 (PST) Received: from smtp.kernel.org (relay.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 AE7A0B811FB; Mon, 24 Jan 2022 21:44:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3B27C340E4; Mon, 24 Jan 2022 21:44:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060656; bh=8BwMz/lVkIQoaU4oqrABV29zgT16dVE3kgd8cvvmA8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xvkQmoT70hcF7BfRT41jJeE8VCKsgfYTnXcxMIQRFjFP9AOCN2KkgHurYY555YX03 g26FiuVPkbEjjlc6eESdSPnwpQLk9PyyaiMKMcWrCz1z+HDeKq5SNKOD6f0iZcXHTu nfiakTZxMMXurPOJSTUTE7kEGmFDR+tGWdTV60Q4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , "David S. Miller" Subject: [PATCH 5.16 1021/1039] net: mscc: ocelot: fix using match before it is set Date: Mon, 24 Jan 2022 19:46:50 +0100 Message-Id: <20220124184159.618850150@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 baa59504c1cd0cca7d41954a45ee0b3dc78e41a0 upstream. Clang static analysis reports this issue ocelot_flower.c:563:8: warning: 1st function call argument is an uninitialized value !is_zero_ether_addr(match.mask->dst)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The variable match is used before it is set. So move the block. Fixes: 75944fda1dfe ("net: mscc: ocelot: offload ingress skbedit and vlan a= ctions to VCAP IS1") Signed-off-by: Tom Rix Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mscc/ocelot_flower.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) --- a/drivers/net/ethernet/mscc/ocelot_flower.c +++ b/drivers/net/ethernet/mscc/ocelot_flower.c @@ -521,13 +521,6 @@ ocelot_flower_parse_key(struct ocelot *o return -EOPNOTSUPP; } =20 - if (filter->block_id =3D=3D VCAP_IS1 && - !is_zero_ether_addr(match.mask->dst)) { - NL_SET_ERR_MSG_MOD(extack, - "Key type S1_NORMAL cannot match on destination MAC"); - return -EOPNOTSUPP; - } - /* The hw support mac matches only for MAC_ETYPE key, * therefore if other matches(port, tcp flags, etc) are added * then just bail out @@ -542,6 +535,14 @@ ocelot_flower_parse_key(struct ocelot *o return -EOPNOTSUPP; =20 flow_rule_match_eth_addrs(rule, &match); + + if (filter->block_id =3D=3D VCAP_IS1 && + !is_zero_ether_addr(match.mask->dst)) { + NL_SET_ERR_MSG_MOD(extack, + "Key type S1_NORMAL cannot match on destination MAC"); + return -EOPNOTSUPP; + } + filter->key_type =3D OCELOT_VCAP_KEY_ETYPE; ether_addr_copy(filter->key.etype.dmac.value, match.key->dst); From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51B54C433FE for ; Tue, 25 Jan 2022 01:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412280AbiAYAg3 (ORCPT ); Mon, 24 Jan 2022 19:36:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2365258AbiAXXud (ORCPT ); Mon, 24 Jan 2022 18:50:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80D54C0BD13C; Mon, 24 Jan 2022 13:44:20 -0800 (PST) Received: from smtp.kernel.org (relay.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 2058A61491; Mon, 24 Jan 2022 21:44:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E71D9C340E4; Mon, 24 Jan 2022 21:44:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060659; bh=A61Mjq671YKWOXyCgRwXP22r5uuFJFRpViFWZVpV9aU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fbeoeLPF7rzD/QGLoDpXByiOW2iI0S2rY7Fpo4rHKGBdLzrKFSNXMpT5rOnP+5Gwb sDevKBFm4ikiIexf3NMjceEH7goAWwYfSjjfPPyntnDCotMihl1yC+2DX4DxSY2XJp PIIzJwWM1kvfFUXKeFJGG3v9wtVrovrCqGcYifTs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Neil Armstrong Subject: [PATCH 5.16 1022/1039] dt-bindings: display: meson-dw-hdmi: add missing sound-name-prefix property Date: Mon, 24 Jan 2022 19:46:51 +0100 Message-Id: <20220124184159.649803943@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein commit 22bf4047d26980807611b7e2030803db375afd87 upstream. This is used in meson-gx and meson-g12. Add the property to the binding. This fixes the dtschema warning: hdmi-tx@c883a000: 'sound-name-prefix' does not match any of the regexes: 'pinctrl-[0-9]+' Signed-off-by: Alexander Stein Fixes: 376bf52deef5 ("dt-bindings: display: amlogic, meson-dw-hdmi: convert= to yaml") Acked-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20211223122434.39378-2-= alexander.stein@mailbox.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml | = 5 +++++ 1 file changed, 5 insertions(+) --- a/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml +++ b/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml @@ -10,6 +10,9 @@ title: Amlogic specific extensions to th maintainers: - Neil Armstrong =20 +allOf: + - $ref: /schemas/sound/name-prefix.yaml# + description: | The Amlogic Meson Synopsys Designware Integration is composed of - A Synopsys DesignWare HDMI Controller IP @@ -99,6 +102,8 @@ properties: "#sound-dai-cells": const: 0 =20 + sound-name-prefix: true + required: - compatible - reg From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEBD8C433F5 for ; Tue, 25 Jan 2022 00:31:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3410523AbiAYA31 (ORCPT ); Mon, 24 Jan 2022 19:29:27 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53744 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573122AbiAXVo3 (ORCPT ); Mon, 24 Jan 2022 16:44:29 -0500 Received: from smtp.kernel.org (relay.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 A81BFB815A2; Mon, 24 Jan 2022 21:44:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAC2AC340E4; Mon, 24 Jan 2022 21:44:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060662; bh=Q+kbtrSzN3sW0F+y05oRP18A4WGq9IVLlwKWgshlVIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1GbOkb+G5A3W13F6hvzJOQoSf18AaT+/IX74meYhGZGsrQEC+oACTuhJVB5GUwCjQ lJCXv3v1Ek8ax/sLmuBux3A+Jzew7SxGRCOxFY2+rTglAvC9Rsc810HMCHb8391PHz yH+bSlZ19Nv1KP0H8HoCRUFa+ZqeWSNdF9BLzcsU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Rob Herring , Neil Armstrong , Martin Blumenstingl Subject: [PATCH 5.16 1023/1039] dt-bindings: display: meson-vpu: Add missing amlogic,canvas property Date: Mon, 24 Jan 2022 19:46:52 +0100 Message-Id: <20220124184159.682617668@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein commit 640f35b871d29cd685ce0ea0762636381beeb98a upstream. This property was already mentioned in the old textual bindings amlogic,meson-vpu.txt, but got dropped during conversion. Adding it back similar to amlogic,gx-vdec.yaml. Fixes: 6b9ebf1e0e67 ("dt-bindings: display: amlogic, meson-vpu: convert to = yaml") Signed-off-by: Alexander Stein Acked-by: Rob Herring Reviewed-by: Neil Armstrong Reviewed-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20211219094155.177206-1= -alexander.stein@mailbox.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml | 6 ++= ++++ 1 file changed, 6 insertions(+) --- a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml +++ b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml @@ -78,6 +78,10 @@ properties: interrupts: maxItems: 1 =20 + amlogic,canvas: + description: should point to a canvas provider node + $ref: /schemas/types.yaml#/definitions/phandle + power-domains: maxItems: 1 description: phandle to the associated power domain @@ -106,6 +110,7 @@ required: - port@1 - "#address-cells" - "#size-cells" + - amlogic,canvas =20 additionalProperties: false =20 @@ -118,6 +123,7 @@ examples: interrupts =3D <3>; #address-cells =3D <1>; #size-cells =3D <0>; + amlogic,canvas =3D <&canvas>; =20 /* CVBS VDAC output port */ port@0 { From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72D5DC43217 for ; Tue, 25 Jan 2022 01:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412313AbiAYAge (ORCPT ); Mon, 24 Jan 2022 19:36:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2365272AbiAXXud (ORCPT ); Mon, 24 Jan 2022 18:50:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3DF0C0FE691; Mon, 24 Jan 2022 13:44:26 -0800 (PST) Received: from smtp.kernel.org (relay.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 92FCD61526; Mon, 24 Jan 2022 21:44:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0C87C340E4; Mon, 24 Jan 2022 21:44:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060666; bh=RwgNWwgC6tm4OmIYkTg6If1aFsmpPow52E85Zp5Xwvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CcuA0oRm11UPQ+Ivbsj4U4R54noHGWee7+NZQfNJia6cz5B4ATTm3ysJz/QraVr4I qT5Z6GrCEm3yNP6/A97MKhGUxmZ7lq/CmeKaypgdGKXu5XCohiPUZjDieef+PI+QNa MolSbwjy3XRR2rT+Lysw+8zMa4a+5f7UKmHitaQE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Protsenko , Krzysztof Kozlowski , Rob Herring , Guenter Roeck , Wim Van Sebroeck Subject: [PATCH 5.16 1024/1039] dt-bindings: watchdog: Require samsung,syscon-phandle for Exynos7 Date: Mon, 24 Jan 2022 19:46:53 +0100 Message-Id: <20220124184159.713735310@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sam Protsenko commit 33950f9a36aca55c2b1e6062d9b29f3e97f91c40 upstream. Exynos7 watchdog driver is clearly indicating that its dts node must define syscon phandle property. That was probably forgotten, so add it. Signed-off-by: Sam Protsenko Fixes: 2b9366b66967 ("watchdog: s3c2410_wdt: Add support for Watchdog devic= e on Exynos7") Reviewed-by: Krzysztof Kozlowski Reviewed-by: Rob Herring Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20211107202943.8859-2-semen.protsenko@linar= o.org Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml +++ b/Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml @@ -39,8 +39,8 @@ properties: samsung,syscon-phandle: $ref: /schemas/types.yaml#/definitions/phandle description: - Phandle to the PMU system controller node (in case of Exynos5250 - and Exynos5420). + Phandle to the PMU system controller node (in case of Exynos5250, + Exynos5420 and Exynos7). =20 required: - compatible @@ -58,6 +58,7 @@ allOf: enum: - samsung,exynos5250-wdt - samsung,exynos5420-wdt + - samsung,exynos7-wdt then: required: - samsung,syscon-phandle From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40D51C43217 for ; Tue, 25 Jan 2022 03:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1322360AbiAYDVh (ORCPT ); Mon, 24 Jan 2022 22:21:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1319411AbiAYDIt (ORCPT ); Mon, 24 Jan 2022 22:08:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93500C0FE698; Mon, 24 Jan 2022 13:44:31 -0800 (PST) Received: from smtp.kernel.org (relay.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 596DFB811FB; Mon, 24 Jan 2022 21:44:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 740D0C340E4; Mon, 24 Jan 2022 21:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060669; bh=jHBt4D2LHkfF9t7FKzh7y8T3seROGWJIg2IRNcojcvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ucyyQiGOdoiSgLTnPHBAKn6Jgualeyrd7DjNcaryeIkLqdUgucHF0yt4DzG1DWly4 6INCzf4oLHUsnbxgTjP/2PjWGfXO9NCscTscSMeB07GMFEOtzrFSEzkH3XFfUtRMII Gp+dZOXAjDQaNa3LMGf2pKy3wgnOqntR3FSsKNy4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Eric Dumazet , "David S. Miller" Subject: [PATCH 5.16 1025/1039] sch_api: Dont skip qdisc attach on ingress Date: Mon, 24 Jan 2022 19:46:54 +0100 Message-Id: <20220124184159.746106739@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Mikityanskiy commit de2d807b294d3d2ce5e59043ae2634016765d076 upstream. The attach callback of struct Qdisc_ops is used by only a few qdiscs: mq, mqprio and htb. qdisc_graft() contains the following logic (pseudocode): if (!qdisc->ops->attach) { if (ingress) do ingress stuff; else do egress stuff; } if (!ingress) { ... if (qdisc->ops->attach) qdisc->ops->attach(qdisc); } else { ... } As we see, the attach callback is not called if the qdisc is being attached to ingress (TC_H_INGRESS). That wasn't a problem for mq and mqprio, since they contain a check that they are attached to TC_H_ROOT, and they can't be attached to TC_H_INGRESS anyway. However, the commit cited below added the attach callback to htb. It is needed for the hardware offload, but in the non-offload mode it simulates the "do egress stuff" part of the pseudocode above. The problem is that when htb is attached to ingress, neither "do ingress stuff" nor attach() is called. It results in an inconsistency, and the following message is printed to dmesg: unregister_netdevice: waiting for lo to become free. Usage count =3D 2 This commit addresses the issue by running "do ingress stuff" in the ingress flow even in the attach callback is present, which is fine, because attach isn't going to be called afterwards. The bug was found by syzbot and reported by Eric. Fixes: d03b195b5aa0 ("sch_htb: Hierarchical QoS hardware offload") Signed-off-by: Maxim Mikityanskiy Reported-by: Eric Dumazet Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/sched/sch_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -1062,7 +1062,7 @@ static int qdisc_graft(struct net_device =20 qdisc_offload_graft_root(dev, new, old, extack); =20 - if (new && new->ops->attach) + if (new && new->ops->attach && !ingress) goto skip; =20 for (i =3D 0; i < num_q; i++) { From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0B86C433F5 for ; Tue, 25 Jan 2022 01:58:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412338AbiAYAgm (ORCPT ); Mon, 24 Jan 2022 19:36:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2365349AbiAXXuo (ORCPT ); Mon, 24 Jan 2022 18:50:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF8BCC0FE69D; Mon, 24 Jan 2022 13:44:33 -0800 (PST) Received: from smtp.kernel.org (relay.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 56EAAB812A8; Mon, 24 Jan 2022 21:44:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86A5FC340E4; Mon, 24 Jan 2022 21:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060672; bh=KDHPJEHAYeXSMpSHwjV/lw8lFBlxY4PWJ6Lx4gorkLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fr2fn9SmZglpruVbetn7C52DmqVblRKDVIO9takNaKDPKezCivR1FOrikm6yWzNYv 4QGKreh8wnXM1mnvu4qNv+gdbKrzEOePbJQXP6/iYpCgmIZgvBEw/opsuQDJkLbJtn qmzQa/cg/VowC3vIA/2BnWtdbH+bzf9FWfb4ajFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Lei , John Garry , Laibin Qiu , Andy Shevchenko , Jens Axboe Subject: [PATCH 5.16 1026/1039] blk-mq: fix tag_get wait task cant be awakened Date: Mon, 24 Jan 2022 19:46:55 +0100 Message-Id: <20220124184159.785093232@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Laibin Qiu commit 180dccb0dba4f5e84a4a70c1be1d34cbb6528b32 upstream. In case of shared tags, there might be more than one hctx which allocates from the same tags, and each hctx is limited to allocate at most: hctx_max_depth =3D max((bt->sb.depth + users - 1) / users, 4U); tag idle detection is lazy, and may be delayed for 30sec, so there could be just one real active hctx(queue) but all others are actually idle and still accounted as active because of the lazy idle detection. Then if wake_batch is > hctx_max_depth, driver tag allocation may wait forever on this real active hctx. Fix this by recalculating wake_batch when inc or dec active_queues. Fixes: 0d2602ca30e41 ("blk-mq: improve support for shared tags maps") Suggested-by: Ming Lei Suggested-by: John Garry Signed-off-by: Laibin Qiu Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220113025536.1479653-1-qiulaibin@huawei.c= om Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- block/blk-mq-tag.c | 40 +++++++++++++++++++++++++++++++++------- include/linux/sbitmap.h | 11 +++++++++++ lib/sbitmap.c | 25 ++++++++++++++++++++++--- 3 files changed, 66 insertions(+), 10 deletions(-) --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -17,6 +17,21 @@ #include "blk-mq-tag.h" =20 /* + * Recalculate wakeup batch when tag is shared by hctx. + */ +static void blk_mq_update_wake_batch(struct blk_mq_tags *tags, + unsigned int users) +{ + if (!users) + return; + + sbitmap_queue_recalculate_wake_batch(&tags->bitmap_tags, + users); + sbitmap_queue_recalculate_wake_batch(&tags->breserved_tags, + users); +} + +/* * If a previously inactive queue goes active, bump the active user count. * We need to do this before try to allocate driver tag, then even if fail * to get tag when first time, the other shared-tag users could reserve @@ -24,18 +39,26 @@ */ bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx) { + unsigned int users; + if (blk_mq_is_shared_tags(hctx->flags)) { struct request_queue *q =3D hctx->queue; =20 - if (!test_bit(QUEUE_FLAG_HCTX_ACTIVE, &q->queue_flags) && - !test_and_set_bit(QUEUE_FLAG_HCTX_ACTIVE, &q->queue_flags)) - atomic_inc(&hctx->tags->active_queues); + if (test_bit(QUEUE_FLAG_HCTX_ACTIVE, &q->queue_flags) || + test_and_set_bit(QUEUE_FLAG_HCTX_ACTIVE, &q->queue_flags)) { + return true; + } } else { - if (!test_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state) && - !test_and_set_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state)) - atomic_inc(&hctx->tags->active_queues); + if (test_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state) || + test_and_set_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state)) { + return true; + } } =20 + users =3D atomic_inc_return(&hctx->tags->active_queues); + + blk_mq_update_wake_batch(hctx->tags, users); + return true; } =20 @@ -56,6 +79,7 @@ void blk_mq_tag_wakeup_all(struct blk_mq void __blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx) { struct blk_mq_tags *tags =3D hctx->tags; + unsigned int users; =20 if (blk_mq_is_shared_tags(hctx->flags)) { struct request_queue *q =3D hctx->queue; @@ -68,7 +92,9 @@ void __blk_mq_tag_idle(struct blk_mq_hw_ return; } =20 - atomic_dec(&tags->active_queues); + users =3D atomic_dec_return(&tags->active_queues); + + blk_mq_update_wake_batch(tags, users); =20 blk_mq_tag_wakeup_all(tags, false); } --- a/include/linux/sbitmap.h +++ b/include/linux/sbitmap.h @@ -416,6 +416,17 @@ static inline void sbitmap_queue_free(st } =20 /** + * sbitmap_queue_recalculate_wake_batch() - Recalculate wake batch + * @sbq: Bitmap queue to recalculate wake batch. + * @users: Number of shares. + * + * Like sbitmap_queue_update_wake_batch(), this will calculate wake batch + * by depth. This interface is for HCTX shared tags or queue shared tags. + */ +void sbitmap_queue_recalculate_wake_batch(struct sbitmap_queue *sbq, + unsigned int users); + +/** * sbitmap_queue_resize() - Resize a &struct sbitmap_queue. * @sbq: Bitmap queue to resize. * @depth: New number of bits to resize to. --- a/lib/sbitmap.c +++ b/lib/sbitmap.c @@ -457,10 +457,9 @@ int sbitmap_queue_init_node(struct sbitm } EXPORT_SYMBOL_GPL(sbitmap_queue_init_node); =20 -static void sbitmap_queue_update_wake_batch(struct sbitmap_queue *sbq, - unsigned int depth) +static inline void __sbitmap_queue_update_wake_batch(struct sbitmap_queue = *sbq, + unsigned int wake_batch) { - unsigned int wake_batch =3D sbq_calc_wake_batch(sbq, depth); int i; =20 if (sbq->wake_batch !=3D wake_batch) { @@ -476,6 +475,26 @@ static void sbitmap_queue_update_wake_ba } } =20 +static void sbitmap_queue_update_wake_batch(struct sbitmap_queue *sbq, + unsigned int depth) +{ + unsigned int wake_batch; + + wake_batch =3D sbq_calc_wake_batch(sbq, depth); + __sbitmap_queue_update_wake_batch(sbq, wake_batch); +} + +void sbitmap_queue_recalculate_wake_batch(struct sbitmap_queue *sbq, + unsigned int users) +{ + unsigned int wake_batch; + + wake_batch =3D clamp_val((sbq->sb.depth + users - 1) / + users, 4, SBQ_WAKE_BATCH); + __sbitmap_queue_update_wake_batch(sbq, wake_batch); +} +EXPORT_SYMBOL_GPL(sbitmap_queue_recalculate_wake_batch); + void sbitmap_queue_resize(struct sbitmap_queue *sbq, unsigned int depth) { sbitmap_queue_update_wake_batch(sbq, depth); From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1AB3C433EF for ; Tue, 25 Jan 2022 01:58:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412372AbiAYAgp (ORCPT ); Mon, 24 Jan 2022 19:36:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2365366AbiAXXuq (ORCPT ); Mon, 24 Jan 2022 18:50:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83383C0FE6A4; Mon, 24 Jan 2022 13:44:37 -0800 (PST) Received: from smtp.kernel.org (relay.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 4AE98B811A9; Mon, 24 Jan 2022 21:44:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84918C340E4; Mon, 24 Jan 2022 21:44:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060675; bh=yu+IE5+gItyP4e2FuDlpjTgxMD8d6Lf0tXsdlecCLis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dvcUD1Dk9ZSL/l+2y58bpKVv6JAsBry7YQngUj3ZLtqWkdq/0hzSPAKVhulOKkejM d7pUHZmxLtLzaIoZDpk9VvjGa4bjgB6UQ14WR1gws6tf7a2fXk/hrIfSb61AnsSr6i gpTkonziGbhjGdjvJqYSAv1xm8FWub/K9zgnzXKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Schiffer , Frank Rowand , Rob Herring Subject: [PATCH 5.16 1027/1039] scripts/dtc: dtx_diff: remove broken example from help text Date: Mon, 24 Jan 2022 19:46:56 +0100 Message-Id: <20220124184159.816262393@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Schiffer commit d8adf5b92a9d2205620874d498c39923ecea8749 upstream. dtx_diff suggests to use <(...) syntax to pipe two inputs into it, but this has never worked: The /proc/self/fds/... paths passed by the shell will fail the `[ -f "${dtx}" ] && [ -r "${dtx}" ]` check in compile_to_dts, but even with this check removed, the function cannot work: hexdump will eat up the DTB magic, making the subsequent dtc call fail, as a pipe cannot be rewound. Simply remove this broken example, as there is already an alternative one that works fine. Fixes: 10eadc253ddf ("dtc: create tool to diff device trees") Signed-off-by: Matthias Schiffer Reviewed-by: Frank Rowand Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20220113081918.10387-1-matthias.schiffer@ew= .tq-group.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- scripts/dtc/dtx_diff | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/scripts/dtc/dtx_diff +++ b/scripts/dtc/dtx_diff @@ -59,12 +59,8 @@ Otherwise DTx is treated as a dts source or '/include/' to be processed. =20 If DTx_1 and DTx_2 are in different architectures, then this script - may not work since \${ARCH} is part of the include path. Two possible - workarounds: - - `basename $0` \\ - <(ARCH=3Darch_of_dtx_1 `basename $0` DTx_1) \\ - <(ARCH=3Darch_of_dtx_2 `basename $0` DTx_2) + may not work since \${ARCH} is part of the include path. The following + workaround can be used: =20 `basename $0` ARCH=3Darch_of_dtx_1 DTx_1 >tmp_dtx_1.dts `basename $0` ARCH=3Darch_of_dtx_2 DTx_2 >tmp_dtx_2.dts From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26EB6C433FE for ; Tue, 25 Jan 2022 01:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412410AbiAYAgx (ORCPT ); Mon, 24 Jan 2022 19:36:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2365364AbiAXXuq (ORCPT ); Mon, 24 Jan 2022 18:50:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E480C0FE6A7; Mon, 24 Jan 2022 13:44:39 -0800 (PST) Received: from smtp.kernel.org (relay.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 B11C561491; Mon, 24 Jan 2022 21:44:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91751C340E4; Mon, 24 Jan 2022 21:44:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060678; bh=CqvvbWfk9xwC8WTepgsm14BUMfW2AL5e1e4ceJFL41U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iWBhZzXJesCxojYqjf9lx32yL5ka+co20ZN7vQeUClCEwQ+b2iYFaMgJW8Vi7TUjG inxB5h5tKnEaR7pDkdh2DK4m5K/qHWt9CRb6x5cFpxAdV4XynoewUj2dyp0UdYPhLO aGqv1IeibNa2IX/qKBleI2AQL1nIztzEZ3GnWDYI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , "David S. Miller" Subject: [PATCH 5.16 1028/1039] lib82596: Fix IRQ check in sni_82596_probe Date: Mon, 24 Jan 2022 19:46:57 +0100 Message-Id: <20220124184159.847083815@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 99218cbf81bf21355a3de61cd46a706d36e900e6 upstream. platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example: int irq =3D platform_get_irq(pdev, 0); if (irq < 0) return irq; Fix the check of return value to catch errors correctly. Fixes: 115978859272 ("i825xx: Move the Intel 82586/82593/82596 based driver= s") Signed-off-by: Miaoqian Lin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/i825xx/sni_82596.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/i825xx/sni_82596.c +++ b/drivers/net/ethernet/i825xx/sni_82596.c @@ -117,9 +117,10 @@ static int sni_82596_probe(struct platfo netdevice->dev_addr[5] =3D readb(eth_addr + 0x06); iounmap(eth_addr); =20 - if (!netdevice->irq) { + if (netdevice->irq < 0) { printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n", __FILE__, netdevice->base_addr); + retval =3D netdevice->irq; goto probe_failed; } =20 From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C15F6C3527A for ; Tue, 25 Jan 2022 00:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3409797AbiAYA11 (ORCPT ); Mon, 24 Jan 2022 19:27:27 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53888 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573266AbiAXVor (ORCPT ); Mon, 24 Jan 2022 16:44:47 -0500 Received: from smtp.kernel.org (relay.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 6EA90B811FB; Mon, 24 Jan 2022 21:44:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0017C340E4; Mon, 24 Jan 2022 21:44:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060684; bh=CBSmpTy8BQRuv+gcU8xAePtBCAbRQFnKYA0/kmR6vTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOa/ro2p9kjvdz7ZuBU4yItXnf2WIhEUymHBUHS57v/aZvaTrewL37zmMex0DhIyU NK38b4KtvxWfEFHwFFFj9EV5aMOIJN8YNsDDy6WHyHvMDA8Ewe9EtghzWqWu5HHpJv h9GdhZocXEQVW6U6rokdA0zjvCcQHw/DOtM2p6jE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alistair Popple , Jason Gunthorpe , Jerome Glisse , John Hubbard , Zi Yan , Ralph Campbell , Felix Kuehling , Andrew Morton , Linus Torvalds Subject: [PATCH 5.16 1029/1039] mm/hmm.c: allow VM_MIXEDMAP to work with hmm_range_fault Date: Mon, 24 Jan 2022 19:46:58 +0100 Message-Id: <20220124184159.879804543@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alistair Popple commit 87c01d57fa23de82fff593a7d070933d08755801 upstream. hmm_range_fault() can be used instead of get_user_pages() for devices which allow faulting however unlike get_user_pages() it will return an error when used on a VM_MIXEDMAP range. To make hmm_range_fault() more closely match get_user_pages() remove this restriction. This requires dealing with the !ARCH_HAS_PTE_SPECIAL case in hmm_vma_handle_pte(). Rather than replicating the logic of vm_normal_page() call it directly and do a check for the zero pfn similar to what get_user_pages() currently does. Also add a test to hmm selftest to verify functionality. Link: https://lkml.kernel.org/r/20211104012001.2555676-1-apopple@nvidia.com Fixes: da4c3c735ea4 ("mm/hmm/mirror: helper to snapshot CPU page table") Signed-off-by: Alistair Popple Reviewed-by: Jason Gunthorpe Cc: Jerome Glisse Cc: John Hubbard Cc: Zi Yan Cc: Ralph Campbell Cc: Felix Kuehling Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- lib/test_hmm.c | 24 ++++++++++++++++++ mm/hmm.c | 5 ++- tools/testing/selftests/vm/hmm-tests.c | 42 ++++++++++++++++++++++++++++= +++++ 3 files changed, 69 insertions(+), 2 deletions(-) --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -1086,9 +1086,33 @@ static long dmirror_fops_unlocked_ioctl( return 0; } =20 +static int dmirror_fops_mmap(struct file *file, struct vm_area_struct *vma) +{ + unsigned long addr; + + for (addr =3D vma->vm_start; addr < vma->vm_end; addr +=3D PAGE_SIZE) { + struct page *page; + int ret; + + page =3D alloc_page(GFP_KERNEL | __GFP_ZERO); + if (!page) + return -ENOMEM; + + ret =3D vm_insert_page(vma, addr, page); + if (ret) { + __free_page(page); + return ret; + } + put_page(page); + } + + return 0; +} + static const struct file_operations dmirror_fops =3D { .open =3D dmirror_fops_open, .release =3D dmirror_fops_release, + .mmap =3D dmirror_fops_mmap, .unlocked_ioctl =3D dmirror_fops_unlocked_ioctl, .llseek =3D default_llseek, .owner =3D THIS_MODULE, --- a/mm/hmm.c +++ b/mm/hmm.c @@ -300,7 +300,8 @@ static int hmm_vma_handle_pte(struct mm_ * Since each architecture defines a struct page for the zero page, just * fall through and treat it like a normal page. */ - if (pte_special(pte) && !pte_devmap(pte) && + if (!vm_normal_page(walk->vma, addr, pte) && + !pte_devmap(pte) && !is_zero_pfn(pte_pfn(pte))) { if (hmm_pte_need_fault(hmm_vma_walk, pfn_req_flags, 0)) { pte_unmap(ptep); @@ -518,7 +519,7 @@ static int hmm_vma_walk_test(unsigned lo struct hmm_range *range =3D hmm_vma_walk->range; struct vm_area_struct *vma =3D walk->vma; =20 - if (!(vma->vm_flags & (VM_IO | VM_PFNMAP | VM_MIXEDMAP)) && + if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)) && vma->vm_flags & VM_READ) return 0; =20 --- a/tools/testing/selftests/vm/hmm-tests.c +++ b/tools/testing/selftests/vm/hmm-tests.c @@ -1251,6 +1251,48 @@ TEST_F(hmm, anon_teardown) /* * Test memory snapshot without faulting in pages accessed by the device. */ +TEST_F(hmm, mixedmap) +{ + struct hmm_buffer *buffer; + unsigned long npages; + unsigned long size; + unsigned char *m; + int ret; + + npages =3D 1; + size =3D npages << self->page_shift; + + buffer =3D malloc(sizeof(*buffer)); + ASSERT_NE(buffer, NULL); + + buffer->fd =3D -1; + buffer->size =3D size; + buffer->mirror =3D malloc(npages); + ASSERT_NE(buffer->mirror, NULL); + + + /* Reserve a range of addresses. */ + buffer->ptr =3D mmap(NULL, size, + PROT_READ | PROT_WRITE, + MAP_PRIVATE, + self->fd, 0); + ASSERT_NE(buffer->ptr, MAP_FAILED); + + /* Simulate a device snapshotting CPU pagetables. */ + ret =3D hmm_dmirror_cmd(self->fd, HMM_DMIRROR_SNAPSHOT, buffer, npages); + ASSERT_EQ(ret, 0); + ASSERT_EQ(buffer->cpages, npages); + + /* Check what the device saw. */ + m =3D buffer->mirror; + ASSERT_EQ(m[0], HMM_DMIRROR_PROT_READ); + + hmm_buffer_free(buffer); +} + +/* + * Test memory snapshot without faulting in pages accessed by the device. + */ TEST_F(hmm2, snapshot) { struct hmm_buffer *buffer; From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE17DC47082 for ; Tue, 25 Jan 2022 00:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3409774AbiAYA1X (ORCPT ); Mon, 24 Jan 2022 19:27:23 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53904 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573325AbiAXVou (ORCPT ); Mon, 24 Jan 2022 16:44:50 -0500 Received: from smtp.kernel.org (relay.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 6D0E3B8105C; Mon, 24 Jan 2022 21:44:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FE1FC340E4; Mon, 24 Jan 2022 21:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060687; bh=cMFAZwDQpgjABQ2Q/fX+54tfhOManCJbXO3VeKI8TMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hmpGdyrx9bwPeeVzRdkFfeYc6fkrVve81IzlTEa7Hy5PBq+16A0kyW5wwLL5wzeGC jJYZlerHqA9JCM2KwjZMGQYPCbMflSzYVOZf9cwyid91GSUtWh8FguePCJM+ocCTCU k4myKoZ23plLH9i8RJaXxfjV+mY/+g/fAS43laL4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jussi Maki , Saeed Mahameed , Gal Pressman , Moshe Tal , Jay Vosburgh , "David S. Miller" Subject: [PATCH 5.16 1030/1039] bonding: Fix extraction of ports from the packet headers Date: Mon, 24 Jan 2022 19:46:59 +0100 Message-Id: <20220124184159.911513508@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Moshe Tal commit 429e3d123d9a50cc9882402e40e0ac912d88cfcf upstream. Wrong hash sends single stream to multiple output interfaces. The offset calculation was relative to skb->head, fix it to be relative to skb->data. Fixes: a815bde56b15 ("net, bonding: Refactor bond_xmit_hash for use with xdp_buff") Reviewed-by: Jussi Maki Reviewed-by: Saeed Mahameed Reviewed-by: Gal Pressman Signed-off-by: Moshe Tal Acked-by: Jay Vosburgh Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/bonding/bond_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -3872,8 +3872,8 @@ u32 bond_xmit_hash(struct bonding *bond, skb->l4_hash) return skb->hash; =20 - return __bond_xmit_hash(bond, skb, skb->head, skb->protocol, - skb->mac_header, skb->network_header, + return __bond_xmit_hash(bond, skb, skb->data, skb->protocol, + skb_mac_offset(skb), skb_network_offset(skb), skb_headlen(skb)); } =20 From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B602C35278 for ; Tue, 25 Jan 2022 00:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3409730AbiAYA1Q (ORCPT ); Mon, 24 Jan 2022 19:27:16 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33936 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573366AbiAXVoy (ORCPT ); Mon, 24 Jan 2022 16:44:54 -0500 Received: from smtp.kernel.org (relay.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 9BCFF61530; Mon, 24 Jan 2022 21:44:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CEFCC340E4; Mon, 24 Jan 2022 21:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060690; bh=MHmC5G+aOd3jIodOwStGtnsuWl6x1s8Ye8y6waVER78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GVxkupgk8Jqk2LO/LN798YajnKUlYf0ukfICEqnnhAAoEPhPtAHdqeo/4DOU4HSTc aoUqO8rutJh2ei+uiBZE2l6Ma/Ue44B7u9ymZsAbRICUd24Tipc8J1SIw0Av15ZVKY wGtaQNwY3HsRFrgs2qQ5c1/IG03/ESB9IYmTngGo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , Andrew Morton , Linus Torvalds Subject: [PATCH 5.16 1031/1039] lib/test_meminit: destroy cache in kmem_cache_alloc_bulk() test Date: Mon, 24 Jan 2022 19:47:00 +0100 Message-Id: <20220124184159.948287040@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Konovalov commit e073e5ef90298d2d6e5e7f04b545a0815e92110c upstream. Make do_kmem_cache_size_bulk() destroy the cache it creates. Link: https://lkml.kernel.org/r/aced20a94bf04159a139f0846e41d38a1537debb.16= 40018297.git.andreyknvl@google.com Fixes: 03a9349ac0e0 ("lib/test_meminit: add a kmem_cache_alloc_bulk() test") Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: Andrey Ryabinin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- lib/test_meminit.c | 1 + 1 file changed, 1 insertion(+) --- a/lib/test_meminit.c +++ b/lib/test_meminit.c @@ -337,6 +337,7 @@ static int __init do_kmem_cache_size_bul if (num) kmem_cache_free_bulk(c, num, objects); } + kmem_cache_destroy(c); *total_failures +=3D fail; return 1; } From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21C11C35273 for ; Tue, 25 Jan 2022 00:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3409448AbiAYA0O (ORCPT ); Mon, 24 Jan 2022 19:26:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53938 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573435AbiAXVo5 (ORCPT ); Mon, 24 Jan 2022 16:44:57 -0500 Received: from smtp.kernel.org (relay.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 59005B81233; Mon, 24 Jan 2022 21:44:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AABFC340E4; Mon, 24 Jan 2022 21:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060693; bh=0m840cvT6xgkDwj13KN7JfbNhkL66SG8ih2oD6QU2Js=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OkK4MrL60YvQ/ebZz/jNMVsSg+e2lD3cX76tNJtv6Hfhs4+8C78sF1ISGury/i4pm zoBmG1sky5sUULgcB2jc9YE0l6oLrfo5N+Mo+6hbb9RsWqnwGyQhnSYUMqYWWdFFaF mmngd6Cs8qoGllv4m5zJJg/GBxejvGQ6tzqMGVvs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Vitaly Kuznetsov , Paolo Bonzini Subject: [PATCH 5.16 1032/1039] KVM: x86: Do runtime CPUID update before updating vcpu->arch.cpuid_entries Date: Mon, 24 Jan 2022 19:47:01 +0100 Message-Id: <20220124184159.980048786@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov commit ee3a5f9e3d9bf94159f3cc80da542fbe83502dd8 upstream. kvm_update_cpuid_runtime() mangles CPUID data coming from userspace VMM after updating 'vcpu->arch.cpuid_entries', this makes it impossible to compare an update with what was previously supplied. Introduce __kvm_update_cpuid_runtime() version which can be used to tweak the input before it goes to 'vcpu->arch.cpuid_entries' so the upcoming update check can compare tweaked data. No functional change intended. Signed-off-by: Vitaly Kuznetsov Message-Id: <20220117150542.2176196-2-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Vitaly Kuznetsov Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kvm/cpuid.c | 54 ++++++++++++++++++++++++++++++++--------------= ----- 1 file changed, 34 insertions(+), 20 deletions(-) --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -125,14 +125,21 @@ static void kvm_update_kvm_cpuid_base(st } } =20 -static struct kvm_cpuid_entry2 *kvm_find_kvm_cpuid_features(struct kvm_vcp= u *vcpu) +static struct kvm_cpuid_entry2 *__kvm_find_kvm_cpuid_features(struct kvm_v= cpu *vcpu, + struct kvm_cpuid_entry2 *entries, int nent) { u32 base =3D vcpu->arch.kvm_cpuid_base; =20 if (!base) return NULL; =20 - return kvm_find_cpuid_entry(vcpu, base | KVM_CPUID_FEATURES, 0); + return cpuid_entry2_find(entries, nent, base | KVM_CPUID_FEATURES, 0); +} + +static struct kvm_cpuid_entry2 *kvm_find_kvm_cpuid_features(struct kvm_vcp= u *vcpu) +{ + return __kvm_find_kvm_cpuid_features(vcpu, vcpu->arch.cpuid_entries, + vcpu->arch.cpuid_nent); } =20 void kvm_update_pv_runtime(struct kvm_vcpu *vcpu) @@ -147,11 +154,12 @@ void kvm_update_pv_runtime(struct kvm_vc vcpu->arch.pv_cpuid.features =3D best->eax; } =20 -void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu) +static void __kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu, struct kvm_c= puid_entry2 *entries, + int nent) { struct kvm_cpuid_entry2 *best; =20 - best =3D kvm_find_cpuid_entry(vcpu, 1, 0); + best =3D cpuid_entry2_find(entries, nent, 1, 0); if (best) { /* Update OSXSAVE bit */ if (boot_cpu_has(X86_FEATURE_XSAVE)) @@ -162,33 +170,38 @@ void kvm_update_cpuid_runtime(struct kvm vcpu->arch.apic_base & MSR_IA32_APICBASE_ENABLE); } =20 - best =3D kvm_find_cpuid_entry(vcpu, 7, 0); + best =3D cpuid_entry2_find(entries, nent, 7, 0); if (best && boot_cpu_has(X86_FEATURE_PKU) && best->function =3D=3D 0x7) cpuid_entry_change(best, X86_FEATURE_OSPKE, kvm_read_cr4_bits(vcpu, X86_CR4_PKE)); =20 - best =3D kvm_find_cpuid_entry(vcpu, 0xD, 0); + best =3D cpuid_entry2_find(entries, nent, 0xD, 0); if (best) best->ebx =3D xstate_required_size(vcpu->arch.xcr0, false); =20 - best =3D kvm_find_cpuid_entry(vcpu, 0xD, 1); + best =3D cpuid_entry2_find(entries, nent, 0xD, 1); if (best && (cpuid_entry_has(best, X86_FEATURE_XSAVES) || cpuid_entry_has(best, X86_FEATURE_XSAVEC))) best->ebx =3D xstate_required_size(vcpu->arch.xcr0, true); =20 - best =3D kvm_find_kvm_cpuid_features(vcpu); + best =3D __kvm_find_kvm_cpuid_features(vcpu, entries, nent); if (kvm_hlt_in_guest(vcpu->kvm) && best && (best->eax & (1 << KVM_FEATURE_PV_UNHALT))) best->eax &=3D ~(1 << KVM_FEATURE_PV_UNHALT); =20 if (!kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT)) { - best =3D kvm_find_cpuid_entry(vcpu, 0x1, 0); + best =3D cpuid_entry2_find(entries, nent, 0x1, 0); if (best) cpuid_entry_change(best, X86_FEATURE_MWAIT, vcpu->arch.ia32_misc_enable_msr & MSR_IA32_MISC_ENABLE_MWAIT); } } + +void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu) +{ + __kvm_update_cpuid_runtime(vcpu, vcpu->arch.cpuid_entries, vcpu->arch.cpu= id_nent); +} EXPORT_SYMBOL_GPL(kvm_update_cpuid_runtime); =20 static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) @@ -276,21 +289,22 @@ u64 kvm_vcpu_reserved_gpa_bits_raw(struc static int kvm_set_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid_entry2 *e= 2, int nent) { - int r; + int r; + + __kvm_update_cpuid_runtime(vcpu, e2, nent); =20 - r =3D kvm_check_cpuid(e2, nent); - if (r) - return r; + r =3D kvm_check_cpuid(e2, nent); + if (r) + return r; =20 - kvfree(vcpu->arch.cpuid_entries); - vcpu->arch.cpuid_entries =3D e2; - vcpu->arch.cpuid_nent =3D nent; + kvfree(vcpu->arch.cpuid_entries); + vcpu->arch.cpuid_entries =3D e2; + vcpu->arch.cpuid_nent =3D nent; =20 - kvm_update_kvm_cpuid_base(vcpu); - kvm_update_cpuid_runtime(vcpu); - kvm_vcpu_after_set_cpuid(vcpu); + kvm_update_kvm_cpuid_base(vcpu); + kvm_vcpu_after_set_cpuid(vcpu); =20 - return 0; + return 0; } =20 /* when an old userspace process fills a new kernel module */ From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E2CEC433EF for ; Mon, 24 Jan 2022 22:54:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1840124AbiAXWwm (ORCPT ); Mon, 24 Jan 2022 17:52:42 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52676 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573482AbiAXVo6 (ORCPT ); Mon, 24 Jan 2022 16:44:58 -0500 Received: from smtp.kernel.org (relay.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 8842FB80CCF; Mon, 24 Jan 2022 21:44:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CBF5C340E4; Mon, 24 Jan 2022 21:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060696; bh=93huczeIyL5LcJsflgRKmCn63D+6drfz/04KRlXSC0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yEJy/fSU0ZwRBJnByBi4HS+eiUHXLIq8Ej3yBk4ORxom3J/FAfo8HVNicVC4bc3NF PX9e3Lvts57LoNTcCtamDwggCazlz1o0qE5859AOjwUSckvYX2+VDMs5otT12+XShe PucH1dnFVjSUOUsMSW31Au5isiWQlRup40lkOi4A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Igor Mammedov , Vitaly Kuznetsov , Paolo Bonzini Subject: [PATCH 5.16 1033/1039] KVM: x86: Partially allow KVM_SET_CPUID{,2} after KVM_RUN Date: Mon, 24 Jan 2022 19:47:02 +0100 Message-Id: <20220124184200.012351266@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov commit c6617c61e8fe44b9e9fdfede921f61cac6b5149d upstream. Commit feb627e8d6f6 ("KVM: x86: Forbid KVM_SET_CPUID{,2} after KVM_RUN") forbade changing CPUID altogether but unfortunately this is not fully compatible with existing VMMs. In particular, QEMU reuses vCPU fds for CPU hotplug after unplug and it calls KVM_SET_CPUID2. Instead of full ban, check whether the supplied CPUID data is equal to what was previously set. Reported-by: Igor Mammedov Fixes: feb627e8d6f6 ("KVM: x86: Forbid KVM_SET_CPUID{,2} after KVM_RUN") Signed-off-by: Vitaly Kuznetsov Message-Id: <20220117150542.2176196-3-vkuznets@redhat.com> Cc: stable@vger.kernel.org [Do not call kvm_find_cpuid_entry repeatedly. - Paolo] Signed-off-by: Paolo Bonzini Signed-off-by: Vitaly Kuznetsov Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kvm/cpuid.c | 36 ++++++++++++++++++++++++++++++++++++ arch/x86/kvm/x86.c | 19 ------------------- 2 files changed, 36 insertions(+), 19 deletions(-) --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -99,6 +99,28 @@ static int kvm_check_cpuid(struct kvm_cp return 0; } =20 +/* Check whether the supplied CPUID data is equal to what is already set f= or the vCPU. */ +static int kvm_cpuid_check_equal(struct kvm_vcpu *vcpu, struct kvm_cpuid_e= ntry2 *e2, + int nent) +{ + struct kvm_cpuid_entry2 *orig; + int i; + + if (nent !=3D vcpu->arch.cpuid_nent) + return -EINVAL; + + for (i =3D 0; i < nent; i++) { + orig =3D &vcpu->arch.cpuid_entries[i]; + if (e2[i].function !=3D orig->function || + e2[i].index !=3D orig->index || + e2[i].eax !=3D orig->eax || e2[i].ebx !=3D orig->ebx || + e2[i].ecx !=3D orig->ecx || e2[i].edx !=3D orig->edx) + return -EINVAL; + } + + return 0; +} + static void kvm_update_kvm_cpuid_base(struct kvm_vcpu *vcpu) { u32 function; @@ -293,6 +315,20 @@ static int kvm_set_cpuid(struct kvm_vcpu =20 __kvm_update_cpuid_runtime(vcpu, e2, nent); =20 + /* + * KVM does not correctly handle changing guest CPUID after KVM_RUN, as + * MAXPHYADDR, GBPAGES support, AMD reserved bit behavior, etc.. aren't + * tracked in kvm_mmu_page_role. As a result, KVM may miss guest page + * faults due to reusing SPs/SPTEs. In practice no sane VMM mucks with + * the core vCPU model on the fly. It would've been better to forbid any + * KVM_SET_CPUID{,2} calls after KVM_RUN altogether but unfortunately + * some VMMs (e.g. QEMU) reuse vCPU fds for CPU hotplug/unplug and do + * KVM_SET_CPUID{,2} again. To support this legacy behavior, check + * whether the supplied CPUID data is equal to what's already set. + */ + if (vcpu->arch.last_vmentry_cpu !=3D -1) + return kvm_cpuid_check_equal(vcpu, e2, nent); + r =3D kvm_check_cpuid(e2, nent); if (r) return r; --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5149,17 +5149,6 @@ long kvm_arch_vcpu_ioctl(struct file *fi struct kvm_cpuid __user *cpuid_arg =3D argp; struct kvm_cpuid cpuid; =20 - /* - * KVM does not correctly handle changing guest CPUID after KVM_RUN, as - * MAXPHYADDR, GBPAGES support, AMD reserved bit behavior, etc.. aren't - * tracked in kvm_mmu_page_role. As a result, KVM may miss guest page - * faults due to reusing SPs/SPTEs. In practice no sane VMM mucks with - * the core vCPU model on the fly, so fail. - */ - r =3D -EINVAL; - if (vcpu->arch.last_vmentry_cpu !=3D -1) - goto out; - r =3D -EFAULT; if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid))) goto out; @@ -5170,14 +5159,6 @@ long kvm_arch_vcpu_ioctl(struct file *fi struct kvm_cpuid2 __user *cpuid_arg =3D argp; struct kvm_cpuid2 cpuid; =20 - /* - * KVM_SET_CPUID{,2} after KVM_RUN is forbidded, see the comment in - * KVM_SET_CPUID case above. - */ - r =3D -EINVAL; - if (vcpu->arch.last_vmentry_cpu !=3D -1) - goto out; - r =3D -EFAULT; if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid))) goto out; From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A679C43217 for ; Tue, 25 Jan 2022 01:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412447AbiAYAg7 (ORCPT ); Mon, 24 Jan 2022 19:36:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2366198AbiAXXwa (ORCPT ); Mon, 24 Jan 2022 18:52:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F62DC07A95A; Mon, 24 Jan 2022 13:45:00 -0800 (PST) Received: from smtp.kernel.org (relay.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 E22EA61526; Mon, 24 Jan 2022 21:44:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C544DC340E4; Mon, 24 Jan 2022 21:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060699; bh=8bENf6cNn8iSqukolOSktTCl4u7Y/tJUsqjzNi6sVk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XPnEWuA8QNaeeQqqZQC7BsppBpqD6WeiZeJT8rCj7X/tnUBaggyL0TfmPw4rvr+yB PgZfK67DVoz2vBx5dnzs/K5EDKQzUt0grHgeztQPSszesuFR2B+CWS14qXH36yKV3W LuAKOSVtn1HoXFVR/IUSrVDMN/riMeQIGaWFlowU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Vitaly Kuznetsov , Paolo Bonzini Subject: [PATCH 5.16 1034/1039] KVM: selftests: Rename get_cpuid_test to cpuid_test Date: Mon, 24 Jan 2022 19:47:03 +0100 Message-Id: <20220124184200.043291349@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov commit 9e6d484f9991176269607bb3c54a494e32eab27a upstream. In preparation to reusing the existing 'get_cpuid_test' for testing "KVM_SET_CPUID{,2} after KVM_RUN" rename it to 'cpuid_test' to avoid the confusion. No functional change intended. Signed-off-by: Vitaly Kuznetsov Message-Id: <20220117150542.2176196-4-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Vitaly Kuznetsov Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/kvm/.gitignore | 2 +- tools/testing/selftests/kvm/Makefile | 4 ++-- .../selftests/kvm/x86_64/{get_cpuid_test.c =3D> cpuid_test.c} | 0 tools/testing/selftests/kvm/.gitignore | 2=20 tools/testing/selftests/kvm/Makefile | 4=20 tools/testing/selftests/kvm/x86_64/cpuid_test.c | 179 +++++++++++++++= +++++ tools/testing/selftests/kvm/x86_64/get_cpuid_test.c | 179 ---------------= ----- 4 files changed, 182 insertions(+), 182 deletions(-) rename tools/testing/selftests/kvm/x86_64/{get_cpuid_test.c =3D> cpuid_tes= t.c} (100%) --- a/tools/testing/selftests/kvm/.gitignore +++ b/tools/testing/selftests/kvm/.gitignore @@ -7,11 +7,11 @@ /s390x/memop /s390x/resets /s390x/sync_regs_test +/x86_64/cpuid_test /x86_64/cr4_cpuid_sync_test /x86_64/debug_regs /x86_64/evmcs_test /x86_64/emulator_error_test -/x86_64/get_cpuid_test /x86_64/get_msr_index_features /x86_64/kvm_clock_test /x86_64/kvm_pv_test --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -38,11 +38,11 @@ LIBKVM_x86_64 =3D lib/x86_64/apic.c lib/x8 LIBKVM_aarch64 =3D lib/aarch64/processor.c lib/aarch64/ucall.c lib/aarch64= /handlers.S lib/aarch64/spinlock.c lib/aarch64/gic.c lib/aarch64/gic_v3.c l= ib/aarch64/vgic.c LIBKVM_s390x =3D lib/s390x/processor.c lib/s390x/ucall.c lib/s390x/diag318= _test_handler.c =20 -TEST_GEN_PROGS_x86_64 =3D x86_64/cr4_cpuid_sync_test +TEST_GEN_PROGS_x86_64 =3D x86_64/cpuid_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/cr4_cpuid_sync_test TEST_GEN_PROGS_x86_64 +=3D x86_64/get_msr_index_features TEST_GEN_PROGS_x86_64 +=3D x86_64/evmcs_test TEST_GEN_PROGS_x86_64 +=3D x86_64/emulator_error_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/get_cpuid_test TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_clock TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_cpuid TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_features --- /dev/null +++ b/tools/testing/selftests/kvm/x86_64/cpuid_test.c @@ -0,0 +1,179 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2021, Red Hat Inc. + * + * Generic tests for KVM CPUID set/get ioctls + */ +#include +#include +#include + +#include "test_util.h" +#include "kvm_util.h" +#include "processor.h" + +#define VCPU_ID 0 + +/* CPUIDs known to differ */ +struct { + u32 function; + u32 index; +} mangled_cpuids[] =3D { + /* + * These entries depend on the vCPU's XCR0 register and IA32_XSS MSR, + * which are not controlled for by this test. + */ + {.function =3D 0xd, .index =3D 0}, + {.function =3D 0xd, .index =3D 1}, +}; + +static void test_guest_cpuids(struct kvm_cpuid2 *guest_cpuid) +{ + int i; + u32 eax, ebx, ecx, edx; + + for (i =3D 0; i < guest_cpuid->nent; i++) { + eax =3D guest_cpuid->entries[i].function; + ecx =3D guest_cpuid->entries[i].index; + + cpuid(&eax, &ebx, &ecx, &edx); + + GUEST_ASSERT(eax =3D=3D guest_cpuid->entries[i].eax && + ebx =3D=3D guest_cpuid->entries[i].ebx && + ecx =3D=3D guest_cpuid->entries[i].ecx && + edx =3D=3D guest_cpuid->entries[i].edx); + } + +} + +static void test_cpuid_40000000(struct kvm_cpuid2 *guest_cpuid) +{ + u32 eax =3D 0x40000000, ebx, ecx =3D 0, edx; + + cpuid(&eax, &ebx, &ecx, &edx); + + GUEST_ASSERT(eax =3D=3D 0x40000001); +} + +static void guest_main(struct kvm_cpuid2 *guest_cpuid) +{ + GUEST_SYNC(1); + + test_guest_cpuids(guest_cpuid); + + GUEST_SYNC(2); + + test_cpuid_40000000(guest_cpuid); + + GUEST_DONE(); +} + +static bool is_cpuid_mangled(struct kvm_cpuid_entry2 *entrie) +{ + int i; + + for (i =3D 0; i < sizeof(mangled_cpuids); i++) { + if (mangled_cpuids[i].function =3D=3D entrie->function && + mangled_cpuids[i].index =3D=3D entrie->index) + return true; + } + + return false; +} + +static void check_cpuid(struct kvm_cpuid2 *cpuid, struct kvm_cpuid_entry2 = *entrie) +{ + int i; + + for (i =3D 0; i < cpuid->nent; i++) { + if (cpuid->entries[i].function =3D=3D entrie->function && + cpuid->entries[i].index =3D=3D entrie->index) { + if (is_cpuid_mangled(entrie)) + return; + + TEST_ASSERT(cpuid->entries[i].eax =3D=3D entrie->eax && + cpuid->entries[i].ebx =3D=3D entrie->ebx && + cpuid->entries[i].ecx =3D=3D entrie->ecx && + cpuid->entries[i].edx =3D=3D entrie->edx, + "CPUID 0x%x.%x differ: 0x%x:0x%x:0x%x:0x%x vs 0x%x:0x%x:0x%x:0x%x", + entrie->function, entrie->index, + cpuid->entries[i].eax, cpuid->entries[i].ebx, + cpuid->entries[i].ecx, cpuid->entries[i].edx, + entrie->eax, entrie->ebx, entrie->ecx, entrie->edx); + return; + } + } + + TEST_ASSERT(false, "CPUID 0x%x.%x not found", entrie->function, entrie->i= ndex); +} + +static void compare_cpuids(struct kvm_cpuid2 *cpuid1, struct kvm_cpuid2 *c= puid2) +{ + int i; + + for (i =3D 0; i < cpuid1->nent; i++) + check_cpuid(cpuid2, &cpuid1->entries[i]); + + for (i =3D 0; i < cpuid2->nent; i++) + check_cpuid(cpuid1, &cpuid2->entries[i]); +} + +static void run_vcpu(struct kvm_vm *vm, uint32_t vcpuid, int stage) +{ + struct ucall uc; + + _vcpu_run(vm, vcpuid); + + switch (get_ucall(vm, vcpuid, &uc)) { + case UCALL_SYNC: + TEST_ASSERT(!strcmp((const char *)uc.args[0], "hello") && + uc.args[1] =3D=3D stage + 1, + "Stage %d: Unexpected register values vmexit, got %lx", + stage + 1, (ulong)uc.args[1]); + return; + case UCALL_DONE: + return; + case UCALL_ABORT: + TEST_ASSERT(false, "%s at %s:%ld\n\tvalues: %#lx, %#lx", (const char *)u= c.args[0], + __FILE__, uc.args[1], uc.args[2], uc.args[3]); + default: + TEST_ASSERT(false, "Unexpected exit: %s", + exit_reason_str(vcpu_state(vm, vcpuid)->exit_reason)); + } +} + +struct kvm_cpuid2 *vcpu_alloc_cpuid(struct kvm_vm *vm, vm_vaddr_t *p_gva, = struct kvm_cpuid2 *cpuid) +{ + int size =3D sizeof(*cpuid) + cpuid->nent * sizeof(cpuid->entries[0]); + vm_vaddr_t gva =3D vm_vaddr_alloc(vm, size, KVM_UTIL_MIN_VADDR); + struct kvm_cpuid2 *guest_cpuids =3D addr_gva2hva(vm, gva); + + memcpy(guest_cpuids, cpuid, size); + + *p_gva =3D gva; + return guest_cpuids; +} + +int main(void) +{ + struct kvm_cpuid2 *supp_cpuid, *cpuid2; + vm_vaddr_t cpuid_gva; + struct kvm_vm *vm; + int stage; + + vm =3D vm_create_default(VCPU_ID, 0, guest_main); + + supp_cpuid =3D kvm_get_supported_cpuid(); + cpuid2 =3D vcpu_get_cpuid(vm, VCPU_ID); + + compare_cpuids(supp_cpuid, cpuid2); + + vcpu_alloc_cpuid(vm, &cpuid_gva, cpuid2); + + vcpu_args_set(vm, VCPU_ID, 1, cpuid_gva); + + for (stage =3D 0; stage < 3; stage++) + run_vcpu(vm, VCPU_ID, stage); + + kvm_vm_free(vm); +} --- a/tools/testing/selftests/kvm/x86_64/get_cpuid_test.c +++ /dev/null @@ -1,179 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (C) 2021, Red Hat Inc. - * - * Generic tests for KVM CPUID set/get ioctls - */ -#include -#include -#include - -#include "test_util.h" -#include "kvm_util.h" -#include "processor.h" - -#define VCPU_ID 0 - -/* CPUIDs known to differ */ -struct { - u32 function; - u32 index; -} mangled_cpuids[] =3D { - /* - * These entries depend on the vCPU's XCR0 register and IA32_XSS MSR, - * which are not controlled for by this test. - */ - {.function =3D 0xd, .index =3D 0}, - {.function =3D 0xd, .index =3D 1}, -}; - -static void test_guest_cpuids(struct kvm_cpuid2 *guest_cpuid) -{ - int i; - u32 eax, ebx, ecx, edx; - - for (i =3D 0; i < guest_cpuid->nent; i++) { - eax =3D guest_cpuid->entries[i].function; - ecx =3D guest_cpuid->entries[i].index; - - cpuid(&eax, &ebx, &ecx, &edx); - - GUEST_ASSERT(eax =3D=3D guest_cpuid->entries[i].eax && - ebx =3D=3D guest_cpuid->entries[i].ebx && - ecx =3D=3D guest_cpuid->entries[i].ecx && - edx =3D=3D guest_cpuid->entries[i].edx); - } - -} - -static void test_cpuid_40000000(struct kvm_cpuid2 *guest_cpuid) -{ - u32 eax =3D 0x40000000, ebx, ecx =3D 0, edx; - - cpuid(&eax, &ebx, &ecx, &edx); - - GUEST_ASSERT(eax =3D=3D 0x40000001); -} - -static void guest_main(struct kvm_cpuid2 *guest_cpuid) -{ - GUEST_SYNC(1); - - test_guest_cpuids(guest_cpuid); - - GUEST_SYNC(2); - - test_cpuid_40000000(guest_cpuid); - - GUEST_DONE(); -} - -static bool is_cpuid_mangled(struct kvm_cpuid_entry2 *entrie) -{ - int i; - - for (i =3D 0; i < sizeof(mangled_cpuids); i++) { - if (mangled_cpuids[i].function =3D=3D entrie->function && - mangled_cpuids[i].index =3D=3D entrie->index) - return true; - } - - return false; -} - -static void check_cpuid(struct kvm_cpuid2 *cpuid, struct kvm_cpuid_entry2 = *entrie) -{ - int i; - - for (i =3D 0; i < cpuid->nent; i++) { - if (cpuid->entries[i].function =3D=3D entrie->function && - cpuid->entries[i].index =3D=3D entrie->index) { - if (is_cpuid_mangled(entrie)) - return; - - TEST_ASSERT(cpuid->entries[i].eax =3D=3D entrie->eax && - cpuid->entries[i].ebx =3D=3D entrie->ebx && - cpuid->entries[i].ecx =3D=3D entrie->ecx && - cpuid->entries[i].edx =3D=3D entrie->edx, - "CPUID 0x%x.%x differ: 0x%x:0x%x:0x%x:0x%x vs 0x%x:0x%x:0x%x:0x%x", - entrie->function, entrie->index, - cpuid->entries[i].eax, cpuid->entries[i].ebx, - cpuid->entries[i].ecx, cpuid->entries[i].edx, - entrie->eax, entrie->ebx, entrie->ecx, entrie->edx); - return; - } - } - - TEST_ASSERT(false, "CPUID 0x%x.%x not found", entrie->function, entrie->i= ndex); -} - -static void compare_cpuids(struct kvm_cpuid2 *cpuid1, struct kvm_cpuid2 *c= puid2) -{ - int i; - - for (i =3D 0; i < cpuid1->nent; i++) - check_cpuid(cpuid2, &cpuid1->entries[i]); - - for (i =3D 0; i < cpuid2->nent; i++) - check_cpuid(cpuid1, &cpuid2->entries[i]); -} - -static void run_vcpu(struct kvm_vm *vm, uint32_t vcpuid, int stage) -{ - struct ucall uc; - - _vcpu_run(vm, vcpuid); - - switch (get_ucall(vm, vcpuid, &uc)) { - case UCALL_SYNC: - TEST_ASSERT(!strcmp((const char *)uc.args[0], "hello") && - uc.args[1] =3D=3D stage + 1, - "Stage %d: Unexpected register values vmexit, got %lx", - stage + 1, (ulong)uc.args[1]); - return; - case UCALL_DONE: - return; - case UCALL_ABORT: - TEST_ASSERT(false, "%s at %s:%ld\n\tvalues: %#lx, %#lx", (const char *)u= c.args[0], - __FILE__, uc.args[1], uc.args[2], uc.args[3]); - default: - TEST_ASSERT(false, "Unexpected exit: %s", - exit_reason_str(vcpu_state(vm, vcpuid)->exit_reason)); - } -} - -struct kvm_cpuid2 *vcpu_alloc_cpuid(struct kvm_vm *vm, vm_vaddr_t *p_gva, = struct kvm_cpuid2 *cpuid) -{ - int size =3D sizeof(*cpuid) + cpuid->nent * sizeof(cpuid->entries[0]); - vm_vaddr_t gva =3D vm_vaddr_alloc(vm, size, KVM_UTIL_MIN_VADDR); - struct kvm_cpuid2 *guest_cpuids =3D addr_gva2hva(vm, gva); - - memcpy(guest_cpuids, cpuid, size); - - *p_gva =3D gva; - return guest_cpuids; -} - -int main(void) -{ - struct kvm_cpuid2 *supp_cpuid, *cpuid2; - vm_vaddr_t cpuid_gva; - struct kvm_vm *vm; - int stage; - - vm =3D vm_create_default(VCPU_ID, 0, guest_main); - - supp_cpuid =3D kvm_get_supported_cpuid(); - cpuid2 =3D vcpu_get_cpuid(vm, VCPU_ID); - - compare_cpuids(supp_cpuid, cpuid2); - - vcpu_alloc_cpuid(vm, &cpuid_gva, cpuid2); - - vcpu_args_set(vm, VCPU_ID, 1, cpuid_gva); - - for (stage =3D 0; stage < 3; stage++) - run_vcpu(vm, VCPU_ID, stage); - - kvm_vm_free(vm); -} From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61288C4167E for ; Mon, 24 Jan 2022 22:54:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1840075AbiAXWwd (ORCPT ); Mon, 24 Jan 2022 17:52:33 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52686 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573520AbiAXVpF (ORCPT ); Mon, 24 Jan 2022 16:45:05 -0500 Received: from smtp.kernel.org (relay.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 B0E54B811A9; Mon, 24 Jan 2022 21:45:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6216C340E4; Mon, 24 Jan 2022 21:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060702; bh=oA0SrxgSf2DHn1f9C5JzgLmAYlmqZ8cXWCLRmdb5jC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZ2b1LZ6nOzTUqF7SoZ8nfn8dQg0gkRV/JK1FdrjtPN62WwJk6z9WtgLMtLiQeCYq tzftQnpVolJgZdtmW4jbExgs93q0DY7sywmyzj3hPoAO/yfIe4d3ap8FWouLlN3huT 1z1xqHRBm29f1Y60VlxQqarnOf1o+mCReTAj7mdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Vitaly Kuznetsov , Paolo Bonzini Subject: [PATCH 5.16 1035/1039] KVM: selftests: Test KVM_SET_CPUID2 after KVM_RUN Date: Mon, 24 Jan 2022 19:47:04 +0100 Message-Id: <20220124184200.082019564@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov commit ecebb966acaab2466d9857d1cc435ee1fc9eee50 upstream. KVM forbids KVM_SET_CPUID2 after KVM_RUN was performed on a vCPU unless the supplied CPUID data is equal to what was previously set. Test this. Signed-off-by: Vitaly Kuznetsov Message-Id: <20220117150542.2176196-5-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Vitaly Kuznetsov Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/kvm/include/x86_64/processor.h | 7 +++ tools/testing/selftests/kvm/lib/x86_64/processor.c | 33 ++++++++++++= ++--- tools/testing/selftests/kvm/x86_64/cpuid_test.c | 30 ++++++++++++= +++ 3 files changed, 66 insertions(+), 4 deletions(-) --- a/tools/testing/selftests/kvm/include/x86_64/processor.h +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h @@ -358,6 +358,8 @@ uint64_t kvm_get_feature_msr(uint64_t ms struct kvm_cpuid2 *kvm_get_supported_cpuid(void); =20 struct kvm_cpuid2 *vcpu_get_cpuid(struct kvm_vm *vm, uint32_t vcpuid); +int __vcpu_set_cpuid(struct kvm_vm *vm, uint32_t vcpuid, + struct kvm_cpuid2 *cpuid); void vcpu_set_cpuid(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_cpuid2 *cpuid); =20 @@ -402,6 +404,11 @@ void vm_set_page_table_entry(struct kvm_ uint64_t pte); =20 /* + * get_cpuid() - find matching CPUID entry and return pointer to it. + */ +struct kvm_cpuid_entry2 *get_cpuid(struct kvm_cpuid2 *cpuid, uint32_t func= tion, + uint32_t index); +/* * set_cpuid() - overwrites a matching cpuid entry with the provided value. * matches based on ent->function && ent->index. returns true * if a match was found and successfully overwritten. --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -847,6 +847,17 @@ kvm_get_supported_cpuid_index(uint32_t f return entry; } =20 + +int __vcpu_set_cpuid(struct kvm_vm *vm, uint32_t vcpuid, + struct kvm_cpuid2 *cpuid) +{ + struct vcpu *vcpu =3D vcpu_find(vm, vcpuid); + + TEST_ASSERT(vcpu !=3D NULL, "vcpu not found, vcpuid: %u", vcpuid); + + return ioctl(vcpu->fd, KVM_SET_CPUID2, cpuid); +} + /* * VM VCPU CPUID Set * @@ -864,12 +875,9 @@ kvm_get_supported_cpuid_index(uint32_t f void vcpu_set_cpuid(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_cpuid2 *cpuid) { - struct vcpu *vcpu =3D vcpu_find(vm, vcpuid); int rc; =20 - TEST_ASSERT(vcpu !=3D NULL, "vcpu not found, vcpuid: %u", vcpuid); - - rc =3D ioctl(vcpu->fd, KVM_SET_CPUID2, cpuid); + rc =3D __vcpu_set_cpuid(vm, vcpuid, cpuid); TEST_ASSERT(rc =3D=3D 0, "KVM_SET_CPUID2 failed, rc: %i errno: %i", rc, errno); =20 @@ -1337,6 +1345,23 @@ void assert_on_unhandled_exception(struc } } =20 +struct kvm_cpuid_entry2 *get_cpuid(struct kvm_cpuid2 *cpuid, uint32_t func= tion, + uint32_t index) +{ + int i; + + for (i =3D 0; i < cpuid->nent; i++) { + struct kvm_cpuid_entry2 *cur =3D &cpuid->entries[i]; + + if (cur->function =3D=3D function && cur->index =3D=3D index) + return cur; + } + + TEST_FAIL("CPUID function 0x%x index 0x%x not found ", function, index); + + return NULL; +} + bool set_cpuid(struct kvm_cpuid2 *cpuid, struct kvm_cpuid_entry2 *ent) { --- a/tools/testing/selftests/kvm/x86_64/cpuid_test.c +++ b/tools/testing/selftests/kvm/x86_64/cpuid_test.c @@ -154,6 +154,34 @@ struct kvm_cpuid2 *vcpu_alloc_cpuid(stru return guest_cpuids; } =20 +static void set_cpuid_after_run(struct kvm_vm *vm, struct kvm_cpuid2 *cpui= d) +{ + struct kvm_cpuid_entry2 *ent; + int rc; + u32 eax, ebx, x; + + /* Setting unmodified CPUID is allowed */ + rc =3D __vcpu_set_cpuid(vm, VCPU_ID, cpuid); + TEST_ASSERT(!rc, "Setting unmodified CPUID after KVM_RUN failed: %d", rc); + + /* Changing CPU features is forbidden */ + ent =3D get_cpuid(cpuid, 0x7, 0); + ebx =3D ent->ebx; + ent->ebx--; + rc =3D __vcpu_set_cpuid(vm, VCPU_ID, cpuid); + TEST_ASSERT(rc, "Changing CPU features should fail"); + ent->ebx =3D ebx; + + /* Changing MAXPHYADDR is forbidden */ + ent =3D get_cpuid(cpuid, 0x80000008, 0); + eax =3D ent->eax; + x =3D eax & 0xff; + ent->eax =3D (eax & ~0xffu) | (x - 1); + rc =3D __vcpu_set_cpuid(vm, VCPU_ID, cpuid); + TEST_ASSERT(rc, "Changing MAXPHYADDR should fail"); + ent->eax =3D eax; +} + int main(void) { struct kvm_cpuid2 *supp_cpuid, *cpuid2; @@ -175,5 +203,7 @@ int main(void) for (stage =3D 0; stage < 3; stage++) run_vcpu(vm, VCPU_ID, stage); =20 + set_cpuid_after_run(vm, cpuid2); + kvm_vm_free(vm); } From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0B70C433FE for ; Tue, 25 Jan 2022 01:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412595AbiAYAhS (ORCPT ); Mon, 24 Jan 2022 19:37:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2366201AbiAXXwa (ORCPT ); Mon, 24 Jan 2022 18:52:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60820C07A95C; Mon, 24 Jan 2022 13:45:08 -0800 (PST) Received: from smtp.kernel.org (relay.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 1C206B8123D; Mon, 24 Jan 2022 21:45:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24E85C340E4; Mon, 24 Jan 2022 21:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060705; bh=X6bcEQhAVYDXS9HjNJEQEd9zlEK1/veNAwt54lPKiSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sban9Tv8XNy6OX76M66EjlQydFZycyrvkUV75Ab0jXg081qv1Qh+XXx3a6C/8SBzj jYJ+5+QSSzoCRS77bClpb0yPvus1XslbuYOtX2p3FTB5jCT6DzRftpvwUwYZwLtn4f BKM29p1CRsfe49Xo2W0sOyfmKlySEiQlbhH8bNPU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ranjani Sridharan , Guennadi Liakhovetski , Pierre-Louis Bossart , Kai Vehmanen , Mark Brown Subject: [PATCH 5.16 1036/1039] ASoC: SOF: topology: remove sof_load_pipeline_ipc() Date: Mon, 24 Jan 2022 19:47:05 +0100 Message-Id: <20220124184200.112391921@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ranjani Sridharan commit 7cc7b9ba21d4978d19f0e3edc2b00d44c9d66ff6 upstream. Remove the function sof_load_pipeline_ipc() and directly send the IPC instead. The pipeline core is already enabled with the call to sof_pipeline_core_enable() in sof_widget_setup(). Signed-off-by: Ranjani Sridharan Reviewed-by: Guennadi Liakhovetski Reviewed-by: Pierre-Louis Bossart Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20211119192621.4096077-7-kai.vehmanen@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/sof/sof-audio.c | 3 ++- sound/soc/sof/sof-audio.h | 4 ---- sound/soc/sof/topology.c | 17 ----------------- 3 files changed, 2 insertions(+), 22 deletions(-) --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -203,7 +203,8 @@ int sof_widget_setup(struct snd_sof_dev break; case snd_soc_dapm_scheduler: pipeline =3D swidget->private; - ret =3D sof_load_pipeline_ipc(sdev, pipeline, &r); + ret =3D sof_ipc_tx_message(sdev->ipc, pipeline->hdr.cmd, pipeline, + sizeof(*pipeline), &r, sizeof(r)); break; default: hdr =3D swidget->private; --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -184,10 +184,6 @@ void snd_sof_control_notify(struct snd_s int snd_sof_load_topology(struct snd_soc_component *scomp, const char *fil= e); int snd_sof_complete_pipeline(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget); - -int sof_load_pipeline_ipc(struct snd_sof_dev *sdev, - struct sof_ipc_pipe_new *pipeline, - struct sof_ipc_comp_reply *r); int sof_pipeline_core_enable(struct snd_sof_dev *sdev, const struct snd_sof_widget *swidget); =20 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1690,23 +1690,6 @@ err: /* * Pipeline Topology */ -int sof_load_pipeline_ipc(struct snd_sof_dev *sdev, - struct sof_ipc_pipe_new *pipeline, - struct sof_ipc_comp_reply *r) -{ - int ret =3D sof_core_enable(sdev, pipeline->core); - - if (ret < 0) - return ret; - - ret =3D sof_ipc_tx_message(sdev->ipc, pipeline->hdr.cmd, pipeline, - sizeof(*pipeline), r, sizeof(*r)); - if (ret < 0) - dev_err(sdev->dev, "error: load pipeline ipc failure\n"); - - return ret; -} - static int sof_widget_load_pipeline(struct snd_soc_component *scomp, int i= ndex, struct snd_sof_widget *swidget, struct snd_soc_tplg_dapm_widget *tw) From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E06EEC433EF for ; Tue, 25 Jan 2022 01:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412542AbiAYAhN (ORCPT ); Mon, 24 Jan 2022 19:37:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2366197AbiAXXwa (ORCPT ); Mon, 24 Jan 2022 18:52:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 717ABC07A95D; Mon, 24 Jan 2022 13:45:11 -0800 (PST) Received: from smtp.kernel.org (relay.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 2D3B4B81142; Mon, 24 Jan 2022 21:45:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53345C340E4; Mon, 24 Jan 2022 21:45:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060708; bh=nf9RogTdgf5rF0q38xnhspYQQDGnFe/Ue5b2fTj9+SU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lX5NfEs7uY3tpE/kkWgJPZsa1KP+ccqEJoRLpnr4IN/+sNYkN4VYSRr86bb5jsRWq 1W2P3nuElQEHus5UG9aQ3j22s9mkn0y0d/h5guUdqq0sOxTMettM7IZ2T4SiAmCxcA NnJjFBXKAj2RgR8izBkWz/oJ65Zji3QPZ5BTHs4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ranjani Sridharan , Guennadi Liakhovetski , Pierre-Louis Bossart , Kai Vehmanen , Mark Brown Subject: [PATCH 5.16 1037/1039] ASoC: SOF: free widgets in sof_tear_down_pipelines() for static pipelines Date: Mon, 24 Jan 2022 19:47:06 +0100 Message-Id: <20220124184200.145139407@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ranjani Sridharan commit b2ebcf42a48f4560862bb811f3268767d17ebdcd upstream. Free widgets for static pipelines in sof_tear_down_pipelines(). But this feature is unavailable in older firmware with ABI < 3.19. Just reset widget use_count's for this case. This would ensure that the secondary cores enabled required for topology setup are powered down properly before the primary core is powered off during system suspend. Signed-off-by: Ranjani Sridharan Reviewed-by: Guennadi Liakhovetski Reviewed-by: Pierre-Louis Bossart Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20211119192621.4096077-8-kai.vehmanen@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/sof/sof-audio.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -665,11 +665,12 @@ int sof_set_up_pipelines(struct snd_sof_ } =20 /* - * This function doesn't free widgets during suspend. It only resets the s= et up status for all - * routes and use_count for all widgets. + * For older firmware, this function doesn't free widgets for static pipel= ines during suspend. + * It only resets use_count for all widgets. */ int sof_tear_down_pipelines(struct snd_sof_dev *sdev, bool verify) { + struct sof_ipc_fw_version *v =3D &sdev->fw_ready.version; struct snd_sof_widget *swidget; struct snd_sof_route *sroute; int ret; @@ -681,8 +682,14 @@ int sof_tear_down_pipelines(struct snd_s * loading the sound card unavailable to open PCMs. */ list_for_each_entry_reverse(swidget, &sdev->widget_list, list) { - if (!verify) { + if (swidget->dynamic_pipeline_widget) + continue; + + /* Do not free widgets for static pipelines with FW ABI older than 3.19 = */ + if (!verify && !swidget->dynamic_pipeline_widget && + v->abi_version < SOF_ABI_VER(3, 19, 0)) { swidget->use_count =3D 0; + swidget->complete =3D 0; continue; } =20 From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83FF1C433EF for ; Tue, 25 Jan 2022 01:59:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412719AbiAYAhk (ORCPT ); Mon, 24 Jan 2022 19:37:40 -0500 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 S2366202AbiAXXwa (ORCPT ); Mon, 24 Jan 2022 18:52:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECE79C07A95E; Mon, 24 Jan 2022 13:45:12 -0800 (PST) Received: from smtp.kernel.org (relay.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 8E75A612E5; Mon, 24 Jan 2022 21:45:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75912C340E4; Mon, 24 Jan 2022 21:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060712; bh=SOfb4C2ObNwB0Fx6quXOL5rM5gjVI3KB+Of+5+kXXrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BOWLDC0dZFBqo8zIK/cI1QityxP0Kxts4s1oqV6aCqo4Ue/Jzhknodkr6ha1dudeq kjYpZstZe8ryned15u9NfzTS0C1lmc+6u6f3ErulOwLPRaub5bUXj/QklLpqIfhnYT YI0k0vpDaUPiI47ONFLjBl4dOlXZWHSYcqP1Sg0k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Ranjani Sridharan , Kai Vehmanen , Mark Brown Subject: [PATCH 5.16 1038/1039] ASoC: SOF: sof-audio: setup sched widgets during pipeline complete step Date: Mon, 24 Jan 2022 19:47:07 +0100 Message-Id: <20220124184200.174533144@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 01429183f479c54c1b5d15453a8ce574ea43e525 upstream. Older firmware prior to ABI 3.19 has a dependency where the scheduler widgets need to be setup last. Moving the call to sof_widget_setup() before the pipeline_complete() call also helps remove the need for the 'reverse' direction when walking through the widget list - this was only working because of the topology macros but the topology does not require any order. Fixes: 5fcdbb2d45df ("ASoC: SOF: Add support for dynamic pipelines") Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20211123171606.129350-1-kai.vehmanen@linux.= intel.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/sof/sof-audio.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -596,16 +596,25 @@ const struct sof_ipc_pipe_new *snd_sof_p =20 int sof_set_up_pipelines(struct snd_sof_dev *sdev, bool verify) { + struct sof_ipc_fw_version *v =3D &sdev->fw_ready.version; struct snd_sof_widget *swidget; struct snd_sof_route *sroute; int ret; =20 /* restore pipeline components */ - list_for_each_entry_reverse(swidget, &sdev->widget_list, list) { + list_for_each_entry(swidget, &sdev->widget_list, list) { /* only set up the widgets belonging to static pipelines */ if (!verify && swidget->dynamic_pipeline_widget) continue; =20 + /* + * For older firmware, skip scheduler widgets in this loop, + * sof_widget_setup() will be called in the 'complete pipeline' loop + */ + if (v->abi_version < SOF_ABI_VER(3, 19, 0) && + swidget->id =3D=3D snd_soc_dapm_scheduler) + continue; + /* update DAI config. The IPC will be sent in sof_widget_setup() */ if (WIDGET_IS_DAI(swidget->id)) { struct snd_sof_dai *dai =3D swidget->private; @@ -653,6 +662,12 @@ int sof_set_up_pipelines(struct snd_sof_ if (!verify && swidget->dynamic_pipeline_widget) continue; =20 + if (v->abi_version < SOF_ABI_VER(3, 19, 0)) { + ret =3D sof_widget_setup(sdev, swidget); + if (ret < 0) + return ret; + } + swidget->complete =3D snd_sof_complete_pipeline(sdev, swidget); break; @@ -681,7 +696,7 @@ int sof_tear_down_pipelines(struct snd_s * sroute->setup because during suspend all streams are suspended and dur= ing topology * loading the sound card unavailable to open PCMs. */ - list_for_each_entry_reverse(swidget, &sdev->widget_list, list) { + list_for_each_entry(swidget, &sdev->widget_list, list) { if (swidget->dynamic_pipeline_widget) continue; =20 From nobody Tue Jun 30 05:22:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BBCAC4321E for ; Tue, 25 Jan 2022 01:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412522AbiAYAhM (ORCPT ); Mon, 24 Jan 2022 19:37:12 -0500 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 S2366200AbiAXXwa (ORCPT ); Mon, 24 Jan 2022 18:52:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06BEEC07A95F; Mon, 24 Jan 2022 13:45:21 -0800 (PST) Received: from smtp.kernel.org (relay.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 91A53B81142; Mon, 24 Jan 2022 21:45:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8569C340E4; Mon, 24 Jan 2022 21:45:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060718; bh=iDFeLzaEtK0aETLPn/3Aj15BXnZkxD+Yg9u0RfYTh2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2lmojvs4cXXpwKXACm9iWn9IUQdDV993HmRk4T6YDX3XLvA3KNrvlFMQZfXSro7o2 iPB+PPx0KzJMYAEgyA4n30ZCPg2mqIzo+jguZkJebNbsmA04H7/EWWVhR+7thcgl/J 16dAPA+IR7ToK5IFEDoK0QfneMC2815p3hY0cQdI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ranjani Sridharan , Paul Olaru , Bard Liao , Pierre-Louis Bossart , Kai Vehmanen , Mark Brown Subject: [PATCH 5.16 1039/1039] ASoC: SOF: handle paused streams during system suspend Date: Mon, 24 Jan 2022 19:47:08 +0100 Message-Id: <20220124184200.208540069@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ranjani Sridharan commit 96da174024b9c63bd5d3358668d0bc12677be877 upstream. During system suspend, paused streams do not get suspended. Therefore, we need to explicitly free these PCMs in the DSP and free the associated DAPM widgets so that they can be set up again during resume. Fixes: 5fcdbb2d45df ("ASoC: SOF: Add support for dynamic pipelines") Signed-off-by: Ranjani Sridharan Reviewed-by: Paul Olaru Reviewed-by: Bard Liao Reviewed-by: Pierre-Louis Bossart Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20211123171606.129350-3-kai.vehmanen@linux.= intel.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/sof/pcm.c | 5 +-- sound/soc/sof/sof-audio.c | 74 +++++++++++++++++++++++++++++++++++++++++= +++-- sound/soc/sof/sof-audio.h | 2 + 3 files changed, 76 insertions(+), 5 deletions(-) --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -100,9 +100,8 @@ void snd_sof_pcm_period_elapsed(struct s } EXPORT_SYMBOL(snd_sof_pcm_period_elapsed); =20 -static int sof_pcm_dsp_pcm_free(struct snd_pcm_substream *substream, - struct snd_sof_dev *sdev, - struct snd_sof_pcm *spcm) +int sof_pcm_dsp_pcm_free(struct snd_pcm_substream *substream, struct snd_s= of_dev *sdev, + struct snd_sof_pcm *spcm) { struct sof_ipc_stream stream; struct sof_ipc_reply reply; --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -122,6 +122,14 @@ int sof_widget_free(struct snd_sof_dev * case snd_soc_dapm_buffer: ipc_free.hdr.cmd |=3D SOF_IPC_TPLG_BUFFER_FREE; break; + case snd_soc_dapm_dai_in: + case snd_soc_dapm_dai_out: + { + struct snd_sof_dai *dai =3D swidget->private; + + dai->configured =3D false; + fallthrough; + } default: ipc_free.hdr.cmd |=3D SOF_IPC_TPLG_COMP_FREE; break; @@ -680,6 +688,55 @@ int sof_set_up_pipelines(struct snd_sof_ } =20 /* + * Free the PCM, its associated widgets and set the prepared flag to false= for all PCMs that + * did not get suspended(ex: paused streams) so the widgets can be set up = again during resume. + */ +static int sof_tear_down_left_over_pipelines(struct snd_sof_dev *sdev) +{ + struct snd_sof_widget *swidget; + struct snd_sof_pcm *spcm; + int dir, ret; + + /* + * free all PCMs and their associated DAPM widgets if their connected DAP= M widget + * list is not NULL. This should only be true for paused streams at this = point. + * This is equivalent to the handling of FE DAI suspend trigger for runni= ng streams. + */ + list_for_each_entry(spcm, &sdev->pcm_list, list) + for_each_pcm_streams(dir) { + struct snd_pcm_substream *substream =3D spcm->stream[dir].substream; + + if (!substream || !substream->runtime) + continue; + + if (spcm->stream[dir].list) { + ret =3D sof_pcm_dsp_pcm_free(substream, sdev, spcm); + if (ret < 0) + return ret; + + ret =3D sof_widget_list_free(sdev, spcm, dir); + if (ret < 0) { + dev_err(sdev->dev, "failed to free widgets during suspend\n"); + return ret; + } + } + } + + /* + * free any left over DAI widgets. This is equivalent to the handling of = suspend trigger + * for the BE DAI for running streams. + */ + list_for_each_entry(swidget, &sdev->widget_list, list) + if (WIDGET_IS_DAI(swidget->id) && swidget->use_count =3D=3D 1) { + ret =3D sof_widget_free(sdev, swidget); + if (ret < 0) + return ret; + } + + return 0; +} + +/* * For older firmware, this function doesn't free widgets for static pipel= ines during suspend. * It only resets use_count for all widgets. */ @@ -693,8 +750,8 @@ int sof_tear_down_pipelines(struct snd_s /* * This function is called during suspend and for one-time topology verif= ication during * first boot. In both cases, there is no need to protect swidget->use_co= unt and - * sroute->setup because during suspend all streams are suspended and dur= ing topology - * loading the sound card unavailable to open PCMs. + * sroute->setup because during suspend all running streams are suspended= and during + * topology loading the sound card unavailable to open PCMs. */ list_for_each_entry(swidget, &sdev->widget_list, list) { if (swidget->dynamic_pipeline_widget) @@ -713,6 +770,19 @@ int sof_tear_down_pipelines(struct snd_s return ret; } =20 + /* + * Tear down all pipelines associated with PCMs that did not get suspended + * and unset the prepare flag so that they can be set up again during res= ume. + * Skip this step for older firmware. + */ + if (!verify && v->abi_version >=3D SOF_ABI_VER(3, 19, 0)) { + ret =3D sof_tear_down_left_over_pipelines(sdev); + if (ret < 0) { + dev_err(sdev->dev, "failed to tear down paused pipelines\n"); + return ret; + } + } + list_for_each_entry(sroute, &sdev->route_list, list) sroute->setup =3D false; =20 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -267,4 +267,6 @@ int sof_widget_free(struct snd_sof_dev * /* PCM */ int sof_widget_list_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *sp= cm, int dir); int sof_widget_list_free(struct snd_sof_dev *sdev, struct snd_sof_pcm *spc= m, int dir); +int sof_pcm_dsp_pcm_free(struct snd_pcm_substream *substream, struct snd_s= of_dev *sdev, + struct snd_sof_pcm *spcm); #endif