From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCF11C4321E for ; Mon, 24 Jan 2022 23:57:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366129AbiAXXwW (ORCPT ); Mon, 24 Jan 2022 18:52:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356656AbiAXW4A (ORCPT ); Mon, 24 Jan 2022 17:56: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 2C89AC00366B; Mon, 24 Jan 2022 11:41: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 DC990B8125C; Mon, 24 Jan 2022 19:41:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0229AC340E5; Mon, 24 Jan 2022 19:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053262; bh=6fZMCQloQ2t3ladZ5ITB1GxhYi5y6jBkCeqwFsjnSLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sSaiSNeN18djYK1Kfi9YOhXxhiUxNpmIX4tMVBqqzBBy/EFqc/cdBs7d+On1ZJ27d +yjp/2QEs3Nvfas+xIPTe9O+8BRrBJNi2lqHedSoMPlQwhy16H+BQE44GM+hy3Xlud 4Za+bCPpKx/QHj7zlTsRynzbgOxURJ90hPJvEUHk= 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.10 001/563] KVM: VMX: switch blocked_vcpu_on_cpu_lock to raw spinlock Date: Mon, 24 Jan 2022 19:36:06 +0100 Message-Id: <20220124184024.464020334@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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: 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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FF51C4167B for ; Mon, 24 Jan 2022 19:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358262AbiAXTyp (ORCPT ); Mon, 24 Jan 2022 14:54:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33954 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355509AbiAXTlj (ORCPT ); Mon, 24 Jan 2022 14: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 2D3ECB8124C; Mon, 24 Jan 2022 19:41:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 446FEC340E5; Mon, 24 Jan 2022 19:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053296; bh=vSGR6VHbNUyq1gjucRiTGoZ958d6JifO3hYpyr6RMI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VAen/YtkLGJrpIsbxQE9qnIYxk6DZ8Z0ENXv17dbbIyfetQxwc+ZhS/MD2Aeo+6XV ZSS3zlJlCsJNX6uKRPKIAtNtVEUn6KQO9QtMpDy2+7bR4Oz+f+ILiQrpllDkwMFJCs Q3kDdKpS1H4pHXYw9u6g0txs3IRS1t79luoRvhLo= 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.10 002/563] HID: uhid: Fix worker destroying device without any protection Date: Mon, 24 Jan 2022 19:36:07 +0100 Message-Id: <20220124184024.495331693@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F144C43219 for ; Mon, 24 Jan 2022 20:53:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441815AbiAXUvl (ORCPT ); Mon, 24 Jan 2022 15:51:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378024AbiAXU2e (ORCPT ); Mon, 24 Jan 2022 15: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 6D575C082566; Mon, 24 Jan 2022 11:42: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 8CC81B81142; Mon, 24 Jan 2022 19:42:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADF77C340E5; Mon, 24 Jan 2022 19:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053332; bh=3CEz9ODacc9jEscmMETRWxB3JPYlvQ03a39mjOKa3f8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YnPdVRkV3Ix/me3cZjTtWOgdjihegYSPiiWkVvkqzyjSqXK0c2CGJPP5QIFnuj226 /SnaCN0jdhknQ8u3sb0cwClXoh3nuvLG+wPrhcg3VAnBPZbt4ilz3qmoQ+rgvQ6adK k1/r7tVUCMiLBu4OvzmQmEiUvbpO/it8Omt2BkhY= 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.10 003/563] HID: wacom: Reset expected and received contact counts at the same time Date: Mon, 24 Jan 2022 19:36:08 +0100 Message-Id: <20220124184024.526771179@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -2664,11 +2664,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 @@ -2692,6 +2695,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8CF5C433EF for ; Mon, 24 Jan 2022 19:53:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351897AbiAXTxN (ORCPT ); Mon, 24 Jan 2022 14:53:13 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34448 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346320AbiAXTm2 (ORCPT ); Mon, 24 Jan 2022 14:42: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 33301B81142; Mon, 24 Jan 2022 19:42:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51722C340E5; Mon, 24 Jan 2022 19:42:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053345; bh=6d29mTJvh2GOvub6qrgiH29qIyJhZWECLVUAyxaXSJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DnwInM1ZH9q16KkQPUMf1Ray8GQRZ3s9feio/k6go7PAmHbmJNU1LifCVa/NIEzxE DdshhDMMDZum1qIitS0JNsJ7ChkE00aX2gtSJD5I9pH61wJ9N+Oxxbkt63E4DgLzmW S+U+wBlTpGiZRcbJ6HptXiqFhfFDvS11HneuQ1ks= 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.10 004/563] HID: wacom: Ignore the confidence flag when a touch is removed Date: Mon, 24 Jan 2022 19:36:09 +0100 Message-Id: <20220124184024.558854900@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -2566,6 +2566,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) { @@ -2613,9 +2631,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A9C0C433EF for ; Tue, 25 Jan 2022 02:36:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3423368AbiAYCet (ORCPT ); Mon, 24 Jan 2022 21:34:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384357AbiAXU3e (ORCPT ); Mon, 24 Jan 2022 15:29: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 F2954C07A960; Mon, 24 Jan 2022 11:42: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 945E26141C; Mon, 24 Jan 2022 19:42:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 754A7C340E5; Mon, 24 Jan 2022 19:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053349; bh=fyqEQBVglc5pdAIBij1r7tV5jKgJ1Mfni7cnBdPz3dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wiaKvf1t0nxCb+sJR0nDCqee/WBID/zwdnKZwybUP5Q9eAmNMtxbpDSl1wQp+LrVu zlfwNJXhDCBoyfRzwSTQ03LRn8W5E8eVgzKCvBzHpmRHtGcUajBKY9Z0LIfbRf7h2H SBoL/fWN6BBbs8w8r39NAx652Z5RdKDAI9UjAczw= 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.10 005/563] HID: wacom: Avoid using stale array indicies to read contact count Date: Mon, 24 Jan 2022 19:36:10 +0100 Message-Id: <20220124184024.594123453@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/hid/wacom_wac.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2654,6 +2654,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44CB1C433FE for ; Mon, 24 Jan 2022 19:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351746AbiAXTxi (ORCPT ); Mon, 24 Jan 2022 14:53:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60392 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347600AbiAXTmh (ORCPT ); Mon, 24 Jan 2022 14:42: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 58126B8119D; Mon, 24 Jan 2022 19:42:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F5DFC340E5; Mon, 24 Jan 2022 19:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053352; bh=SyEdvlIgdapcfev2ctZErMQFIAJu2b7NoRGv//Ys/ak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJwYLrta7qz5RQZF7fLEKwfZj/wrJHQcbN2QNlagzK9jcKTSSVWlIBiPuGfCmXemJ aDz0HOzymOZL18vR9/n8BqMisRxbkygbtdjh6dxu3fai09ese6vZPRfhqZ6ykVStoL mLEYH2RFiCtL6ynN7uWNaEmnMviqCsP3gyxnZgXc= 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.10 006/563] f2fs: fix to do sanity check in is_alive() Date: Mon, 24 Jan 2022 19:36:11 +0100 Message-Id: <20220124184024.626499753@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/f2fs/gc.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -998,6 +998,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7F77C4707E for ; Tue, 25 Jan 2022 02:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3423611AbiAYCfd (ORCPT ); Mon, 24 Jan 2022 21:35:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384459AbiAXU3t (ORCPT ); Mon, 24 Jan 2022 15:29: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 CADE2C08B4C8; Mon, 24 Jan 2022 11:42: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 AC3F161298; Mon, 24 Jan 2022 19:42:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B21EC340E5; Mon, 24 Jan 2022 19:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053355; bh=DJ/cYkr8MzqT7hAfv92BLVMqYFrXoXo4x8FHMhWFLhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t+7/CjYsdyE+YA7sG8NX6ob2ZHHpbpbKT4ZwadMqnZXDE7VoSZRwC+NTv0nN9vfT2 WnKPr1uyPbH6EkVK4zlr/0u/FTBtVYeE603HzGN2LcH+m80D/GwbdV8qgS8WhEXAcK ZKKLN2hE1FKnjHSSp+OE9boTnxzwfgwvXtAK9Buk= 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.10 007/563] nfc: llcp: fix NULL error pointer dereference on sendmsg() after failed bind() Date: Mon, 24 Jan 2022 19:36:12 +0100 Message-Id: <20220124184024.666216547@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A87C7C433EF for ; Tue, 25 Jan 2022 02:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3423652AbiAYCfh (ORCPT ); Mon, 24 Jan 2022 21:35:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384588AbiAXUaL (ORCPT ); Mon, 24 Jan 2022 15:30: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 8E35FC0613DE; Mon, 24 Jan 2022 11:42: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 498DEB811F9; Mon, 24 Jan 2022 19:42:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F71EC340E7; Mon, 24 Jan 2022 19:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053358; bh=2wqemdBhRCvxGE1/NkEV8uh8nqmCvoNL63XiO1PJdlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJgZw1+23xn0nFgmv6SxGgpvrnXybDWuPPVcNxsJ7nQDD6vTwtlPtgDsGxSdb4Xw9 lKbZFxWe6B03hT7NxkgD5heUpos14pDwr2ttJa+PDkaLifjKhdlo1A6Fk/dhDqB7DU O36UpKUHslpyfqIMojIHFjcnOC/GSXXn0R0mwQGA= 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.10 008/563] mtd: rawnand: gpmi: Add ERR007117 protection for nfc_apply_timings Date: Mon, 24 Jan 2022 19:36:13 +0100 Message-Id: <20220124184024.705445026@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -711,14 +711,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); @@ -737,6 +755,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCBDAC3526D for ; Tue, 25 Jan 2022 02:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3423630AbiAYCff (ORCPT ); Mon, 24 Jan 2022 21:35:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384590AbiAXUaL (ORCPT ); Mon, 24 Jan 2022 15:30: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 177E5C07A962; Mon, 24 Jan 2022 11:42: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 AAE4461298; Mon, 24 Jan 2022 19:42:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AE69C340E5; Mon, 24 Jan 2022 19:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053361; bh=50brnauWdiAtjqcwyntiqDSwqdYnjzoEqcJ97b19AFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TYEquD6OudC1uL3djaJMpSSBjT+7nCnmsSORefKl8Snv2sVSmbHNiaNesHNm0PTNw TjAYxTRgcR5mpbbevS80+89MurnfiJQFyCeZupu6MoiPNdVIvWtOENZP9NqKu0fK/H YfqY6vfx7fWh3DZGdFs7TuvMtVlPbfkAhE9L2VbU= 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.10 009/563] mtd: rawnand: gpmi: Remove explicit default gpmi clock setting for i.MX6 Date: Mon, 24 Jan 2022 19:36:14 +0100 Message-Id: <20220124184024.742251646@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47E39C433FE for ; Mon, 24 Jan 2022 20:52:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388660AbiAXUto (ORCPT ); Mon, 24 Jan 2022 15:49:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382143AbiAXUZP (ORCPT ); Mon, 24 Jan 2022 15:25: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 37741C0D9401; Mon, 24 Jan 2022 11:41: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 00438B81188; Mon, 24 Jan 2022 19:41:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D60FC340E7; Mon, 24 Jan 2022 19:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053265; bh=Hu92IHuIu7s4YMY6zsMPO0Pu53VdOmAY8WOxRWr2+s0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jrcrmInZ3HwJ1sjuuco4N097n5uHUEszy7cEd8AyT5GoW/sWOX45lSeBL+/zM0pcl NavxtRxMFYbjLzu7LLPVHqWU0DhXNWvxgcPDIL9uTmOJ/6B8UIOw5rTBINZ2CAs1KD tIsVTYUr/cRKJYvUObzPv0S+QVMcvwImkgnpq4to= 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.10 010/563] mtd: Fixed breaking list in __mtd_del_partition. Date: Mon, 24 Jan 2022 19:36:15 +0100 Message-Id: <20220124184024.772483033@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/mtd/mtdpart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -313,7 +313,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26568C433EF for ; Mon, 24 Jan 2022 20:44:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245366AbiAXUoF (ORCPT ); Mon, 24 Jan 2022 15:44:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382154AbiAXUZQ (ORCPT ); Mon, 24 Jan 2022 15:25: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 57A07C07E303; Mon, 24 Jan 2022 11:41: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 201F5B81229; Mon, 24 Jan 2022 19:41:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39E93C340E5; Mon, 24 Jan 2022 19:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053268; bh=iC3yFsiXLxji/n8wtnpCQ/0JmVUjZqt5fHAV9bJWQ+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DfJwQRwJTcgrSMFt6CGi68c7sGMAsfO9d3WM1xd1vIySWaFLhFT9QJLj85kbAxreU g6/6Rn0O4Xkg63MRSXkRWoPNn5d/ZWoH4N45QYwrNxq3hL1TPPtTYCbCJNBxiC+Sai riLz20tPtut4/uxIoShBvoeqQgBgnMkIbFGyoPS8= 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.10 011/563] mtd: rawnand: davinci: Dont calculate ECC when reading page Date: Mon, 24 Jan 2022 19:36:16 +0100 Message-Id: <20220124184024.803953330@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4175C433FE for ; Mon, 24 Jan 2022 20:00:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359451AbiAXT7o (ORCPT ); Mon, 24 Jan 2022 14:59:44 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33536 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355396AbiAXTlP (ORCPT ); Mon, 24 Jan 2022 14: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 476F9B81188; Mon, 24 Jan 2022 19:41:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71137C340E5; Mon, 24 Jan 2022 19:41:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053272; bh=zzKbzuFubpHHemI4OYJIDmPJ6QVU/JspdXhTqkh54ZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r42CB+yRBaSLtLXxwqHD8ZzoHHei3Bfz8XEqz7tQH5+J7NNp9ShGtWuI/wDbb4sRc kV5z+zl7VYqSG27/2tIGjCbAzenfTqxuLE/kXbgw7FkluYUynRTgIF/v6d27NybeI5 q1yBkd48Fp3/0uI1loz6aqVsqAQEbjUjPw8PAeoU= 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.10 012/563] mtd: rawnand: davinci: Avoid duplicated page read Date: Mon, 24 Jan 2022 19:36:17 +0100 Message-Id: <20220124184024.842019649@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28E0CC433F5 for ; Mon, 24 Jan 2022 20:48:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389861AbiAXUob (ORCPT ); Mon, 24 Jan 2022 15:44:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382294AbiAXUZZ (ORCPT ); Mon, 24 Jan 2022 15: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 833ACC07E30E; Mon, 24 Jan 2022 11:41: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 4B5EFB8121A; Mon, 24 Jan 2022 19:41:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 711EDC340E5; Mon, 24 Jan 2022 19:41:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053275; bh=+UqKwQ35sgQOM9w62WCDHOz/u6Y8TNzdLyjcPKVz5Ac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ei+an6+S5xCdwhGVinUoVmViDVUflm7KmNrjJQq4n7vlqxHCiQip9Tfm5Ot/1xCtP 9M3UOa85URiEWFQy36iwX4N4EWuOPZoXku2JEh8awUylRjgV0faCEmhX3hrcXl+3vB gazGFAuhrX9I3atpWh8Q5eu3bh67ZUVglMVv3Tv8= 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.10 013/563] mtd: rawnand: davinci: Rewrite function description Date: Mon, 24 Jan 2022 19:36:18 +0100 Message-Id: <20220124184024.874787464@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CEC3C3526F for ; Mon, 24 Jan 2022 19:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358445AbiAXTzO (ORCPT ); Mon, 24 Jan 2022 14:55:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33730 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355426AbiAXTlX (ORCPT ); Mon, 24 Jan 2022 14:41: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 56AAEB81229; Mon, 24 Jan 2022 19:41:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80FF2C340E5; Mon, 24 Jan 2022 19:41:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053278; bh=H0WDixWq1G9g12I0MwbrOEaV0Q3A4KaDbq65bdNHOcY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CxRRgGb/moBju43CN2N2iKsBtkP98OffwHvzJwvyjZQB7Uj16I81wW1A/ZkEEy5XA j5lGTfWk0/jeZ4qmuGFElshBAShSa9SHcaVa/OKnOk6TeuVomksyUTMzw7zzcE+2tv IdSpHBuA8pMIYsI9vNszJKeRZZUxOXsl20UqfBpI= 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.10 014/563] x86/gpu: Reserve stolen memory for first integrated Intel GPU Date: Mon, 24 Jan 2022 19:36:19 +0100 Message-Id: <20220124184024.911676383@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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), @@ -588,6 +589,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++) { @@ -700,7 +708,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA7DFC433FE for ; Mon, 24 Jan 2022 19:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352144AbiAXTwh (ORCPT ); Mon, 24 Jan 2022 14:52:37 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33804 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355453AbiAXTlY (ORCPT ); Mon, 24 Jan 2022 14:41: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 35FDBB8122A; Mon, 24 Jan 2022 19:41:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9099EC340E5; Mon, 24 Jan 2022 19:41:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053280; bh=oBieQZ3SwdWDNJAbWyZOdHNTR2Z5uh3/Q1LKFni/fOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H040+lF+JPzXkXO4p86+BqVwTAwGcA0p1ZEcoZL/etVns62zScvRey3eYZdoUldgT 0XkdRN6AEQM4A+THy8GUkLN/u33FYkVnAbuZB29cTA8u67kiipzb4dacW+nH4MT5Tp jZm91U1l+rQiyGeq9G3Dydu17MLb888K7WoMxa/s= 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.10 015/563] tools/nolibc: x86-64: Fix startup code bug Date: Mon, 24 Jan 2022 19:36:20 +0100 Message-Id: <20220124184024.942825013@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -422,14 +422,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF036C433F5 for ; Mon, 24 Jan 2022 19:52:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351662AbiAXTw3 (ORCPT ); Mon, 24 Jan 2022 14:52:29 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37046 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349011AbiAXTlZ (ORCPT ); Mon, 24 Jan 2022 14:41: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 B7623614B8; Mon, 24 Jan 2022 19:41:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E3E6C340E5; Mon, 24 Jan 2022 19:41:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053284; bh=KPoA4CJ44t2LfAsR757OJdlzVPP+4sLlen+NDQtwD7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lUQBM3y7w52KSFutkVOopTqC+vgTSZAdad0w6nedEfDgB+1jh5UDWxEj5wq/roetQ H+D9/LOqAK6umNSaeJJTJU9rXwal98900Un7nh57i9cvcsy6PwDE1CPHiJgKnbAV/L R6tzvb1qza7xt8OhxIevzkpYkFvki/HWI1YkRV0c= 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.10 016/563] tools/nolibc: i386: fix initial stack alignment Date: Mon, 24 Jan 2022 19:36:21 +0100 Message-Id: <20220124184024.981263898@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -606,13 +606,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74754C4167E for ; Mon, 24 Jan 2022 19:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358333AbiAXTy5 (ORCPT ); Mon, 24 Jan 2022 14:54:57 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38902 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349293AbiAXTla (ORCPT ); Mon, 24 Jan 2022 14:41: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 C121B6155C; Mon, 24 Jan 2022 19:41:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B352C340E5; Mon, 24 Jan 2022 19:41:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053287; bh=tnquIfwjFSaSHoBT6nlIb3zGDOprX5TOViH63Z84QzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y2jZAx3rQ5qVRlwSOEM0UGIriHrFQTOen+ZoMr20sSL3gXdykNlSasgeswguUMnnm +YpAOKnTWFXabfaoynDiKhAXQZjssW0hRB4f8Lc29ypaccfqaO6r6hGiNBNCQdZKfm UJUVopA2n7nn9l4DyDpgqMe8YBbjN9w1WhwHkWFA= 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.10 017/563] tools/nolibc: fix incorrect truncation of exit code Date: Mon, 24 Jan 2022 19:36:22 +0100 Message-Id: <20220124184025.017542623@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -437,7 +437,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 @@ -625,9 +625,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 @@ -811,7 +811,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" ""); @@ -1008,7 +1007,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" ""); @@ -1213,7 +1211,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" @@ -1411,7 +1409,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44597C433EF for ; Mon, 24 Jan 2022 20:48:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390492AbiAXUpc (ORCPT ); Mon, 24 Jan 2022 15:45:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382937AbiAXU0c (ORCPT ); Mon, 24 Jan 2022 15:26: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 94260C07E32E; Mon, 24 Jan 2022 11:41: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 52461B8121A; Mon, 24 Jan 2022 19:41:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4799C340E5; Mon, 24 Jan 2022 19:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053290; bh=Q3d16Erybi8ks3P6I31MKaCH6TV11ACxsCvMgjcQY2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bvYTvkpFZ/QlxS159i2MpHNGjNGcu5akkQpNqqmGguT+4C5kKDwTn0UVDEewPMtT4 7cJYm/QdoOMTRcm0GiZ1xN21+anzpepo6WN+yMwQsofwGyWBlTaOhyhU6qdVbI9ZDO izrh7l0Wn3/FWTX3CXTVqh/yK2pfMS+pCRSU2B08= 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.10 018/563] rtc: cmos: take rtc_lock while reading from CMOS Date: Mon, 24 Jan 2022 19:36:23 +0100 Message-Id: <20220124184025.048026288@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/rtc/rtc-cmos.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -463,7 +463,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51D64C41535 for ; Mon, 24 Jan 2022 19:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358318AbiAXTyy (ORCPT ); Mon, 24 Jan 2022 14:54:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34990 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349360AbiAXTle (ORCPT ); Mon, 24 Jan 2022 14:41: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 B2CC660909; Mon, 24 Jan 2022 19:41:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 921A3C340E5; Mon, 24 Jan 2022 19:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053293; bh=YjlPCUQsX6ZOi4P4YXnLzathnCSeTn8OqQk/kDirQX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EXnAgrr4NYgsYjODuLP8D477icX5JHmlseOTNg5keQjrsJeuTFAIIw/XHbYaa5o6A ZfYqD5siDWHQaLkSCRUsFFqfvce+U8eW4pOsi/kq3Jk1UMQDA/cOw4vgQtNePEUgI7 NvTcNGoKgx/O+1hPxbg1Qp/zPXTqmvOMv0hYH3bY= 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.10 019/563] media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE Date: Mon, 24 Jan 2022 19:36:24 +0100 Message-Id: <20220124184025.078488823@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -2127,6 +2127,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); @@ -2138,7 +2139,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B695C4167D for ; Mon, 24 Jan 2022 19:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358242AbiAXTyn (ORCPT ); Mon, 24 Jan 2022 14:54:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37238 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349652AbiAXTll (ORCPT ); Mon, 24 Jan 2022 14:41: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 996BD6152B; Mon, 24 Jan 2022 19:41:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FBB0C340E5; Mon, 24 Jan 2022 19:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053300; bh=NK+mLdWP7UGRRHa1nOQH/HEHr/3rropPGAQJvjrO/bs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWu6/q1umbHNmSZPedBs6MpnMO4ZiWEUYH7W8VPsRqNThIi7elEWYHewX6c4O7baG PveAQBkVZSFvUTLIQCB6JqZwAeAvtwF56g+z3EFCnEDLjmcxtiT9ssnv3YHYYQDrA1 uAKKAgogzmJ3xNV2oEB7DZLkyTzRdF//atsjyLCU= 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.10 020/563] media: flexcop-usb: fix control-message timeouts Date: Mon, 24 Jan 2022 19:36:25 +0100 Message-Id: <20220124184025.108810999@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -249,13 +249,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: @@ -282,7 +282,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 812EFC433F5 for ; Tue, 25 Jan 2022 02:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3423271AbiAYCdX (ORCPT ); Mon, 24 Jan 2022 21:33:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383467AbiAXU1Q (ORCPT ); Mon, 24 Jan 2022 15:27: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 4A844C110F2F; Mon, 24 Jan 2022 11:41: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 DBC166131E; Mon, 24 Jan 2022 19:41:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95279C340E5; Mon, 24 Jan 2022 19:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053303; bh=oj5Je4hEdh8UvrPiv7Hw9okiM1qi3n2AsOBeJ6hgeSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tPQg/M5pVT4KdSYzPbZwxqgbqpfYcoWj8y6yOzWR3YEt8kQFiGcC0ZtoEgrhgu/yZ ztp/6fTTo6jdOc+3v4DacY4fp8VgYxiQP9SoMWJlqftx60+HJ+J6hMN1TFnj0JzW4S vhPCqXB3zvGvgFd+8K7nbEgXDxyB236Aq355a3LU= 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.10 021/563] media: mceusb: fix control-message timeouts Date: Mon, 24 Jan 2022 19:36:26 +0100 Message-Id: <20220124184025.146504982@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E2C8C2BA4C for ; Mon, 24 Jan 2022 20:52:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392269AbiAXUu5 (ORCPT ); Mon, 24 Jan 2022 15:50:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383657AbiAXU1e (ORCPT ); Mon, 24 Jan 2022 15:27: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 9F799C08254D; Mon, 24 Jan 2022 11:41: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 3FAF261551; Mon, 24 Jan 2022 19:41:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06C37C340E5; Mon, 24 Jan 2022 19:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053306; bh=lDnMZdm1qIoBNi8zGpb9L19ogrWHp8r6Rf4WFn0gvus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kb4XDSzvDrg9iabil5PzGCxkFqC7UxkzNGEKZ3HqgV2AqNdqhuhUotTKhLKr3WUVK sQoh6e6PDfn3IMVKxJ21W0PNANn2h97V+OkiZiK1eg5qRCjXKUFMxyqMzeOc1IyY3G OOi9U2OWEztgYbItzuMmBJbnScZD4nCie1hcEjWQ= 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.10 022/563] media: em28xx: fix control-message timeouts Date: Mon, 24 Jan 2022 19:36:27 +0100 Message-Id: <20220124184025.187005090@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55C2AC4167B for ; Mon, 24 Jan 2022 20:53:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392517AbiAXUvY (ORCPT ); Mon, 24 Jan 2022 15:51:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347217AbiAXU2J (ORCPT ); Mon, 24 Jan 2022 15:28: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 2BEBEC082554; Mon, 24 Jan 2022 11:41: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 ams.source.kernel.org (Postfix) with ESMTPS id E94F4B811F9; Mon, 24 Jan 2022 19:41:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25789C340E5; Mon, 24 Jan 2022 19:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053309; bh=qfAGAbyPTg3olyE7z+5FG/FBdquTGx9E7vNPDPs2aZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QMY9bwONWpsN897sJ5kfF+kqkvZ0b7NHEWzhsUW7pJu9psTMMBPJau9ebfc+xec0+ ETRDqRl9Sata5Uzn07EcxxMQF/oPuPcZX9ahsduvmiTnnBiGHr3ehbHpbuPh7c7Ie6 wac6b7P3+a6XGTcPFX5Ad7qmW838YceSRBvULPYs= 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.10 023/563] media: cpia2: fix control-message timeouts Date: Mon, 24 Jan 2022 19:36:28 +0100 Message-Id: <20220124184025.226832463@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67073C433EF for ; Mon, 24 Jan 2022 19:58:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347641AbiAXT6y (ORCPT ); Mon, 24 Jan 2022 14:58:54 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60170 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355575AbiAXTlz (ORCPT ); Mon, 24 Jan 2022 14:41: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 2F301B810BD; Mon, 24 Jan 2022 19:41:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51B35C340E5; Mon, 24 Jan 2022 19:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053312; bh=UQ1kjsQKUztbG+mC2ezX3DTEhk+4oW25wpr9eV2E+4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=boIcQFx4say9+X4vfIVtRa75+Ber3MzPsXkssRxcOOnL8T3qpQgk+Pu0DSxD2gYIO FXowpTDnDgGQCfVaZkIX0Qzav4oSQJVrpJpg8V5RUPrRe3vz++TFmz62FDIGz8/MRq U+Rktg0+p4zV/gfuQU3DuvoCDjxGu11EK7VTdYNA= 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.10 024/563] media: s2255: fix control-message timeouts Date: Mon, 24 Jan 2022 19:36:29 +0100 Message-Id: <20220124184025.266304041@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1884,7 +1884,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); @@ -1893,7 +1893,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FFF6C433F5 for ; Mon, 24 Jan 2022 19:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347487AbiAXT6n (ORCPT ); Mon, 24 Jan 2022 14:58:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:39434 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235030AbiAXTl6 (ORCPT ); Mon, 24 Jan 2022 14: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 07DDB61531; Mon, 24 Jan 2022 19:41:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86EE5C340E5; Mon, 24 Jan 2022 19:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053316; bh=R3SYvAKMvIzdD7gfCpbP1XBCEPkDA2vnynlCBsHNGkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rkZK7Zcf3WQ8VeGS05zSWVUQIAMb8aHPCg6Q5bYhxklt9jSki9TEdaOIBa6GXbLEF n7ZJqK+GzntK9ROiBxG36wi67Md6mrt7Pmc6wkWx9BFQf+v+zsYAUsGth58MriSZ8t xGJ2lUZZGQ6Dy0ylekSkmHFr55zJIAZ/AB8+ztw0= 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.10 025/563] media: dib0700: fix undefined behavior in tuner shutdown Date: Mon, 24 Jan 2022 19:36:30 +0100 Message-Id: <20220124184025.297665168@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95D87C433F5 for ; Mon, 24 Jan 2022 20:53:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392563AbiAXUva (ORCPT ); Mon, 24 Jan 2022 15:51:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351395AbiAXU2Q (ORCPT ); Mon, 24 Jan 2022 15: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 16260C0612A7; Mon, 24 Jan 2022 11:42: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 C65CEB81142; Mon, 24 Jan 2022 19:42:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D72E7C340E5; Mon, 24 Jan 2022 19:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053319; bh=4gyB6Qv06tdS2Y/R6K7VxixzmD3znTGhfuyIXYLQd0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mgmzW+P/Pwj18vDVEa8X3XePSLK/cG3lEr8pYOXcy1bSq+sMgkkhGFplvw/hs9oPO Jb99+zhi8UJy0tD/sv5czwu2lCXKi3kc0nUkVMkHxopiHUbXMhLA3kG8ncVoYxNsjk VB4Yz/ZJcQgDSixHRIajpQhoTzCc4kYis0ygyqck= 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.10 026/563] media: redrat3: fix control-message timeouts Date: Mon, 24 Jan 2022 19:36:31 +0100 Message-Id: <20220124184025.329801638@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEF32C433FE for ; Mon, 24 Jan 2022 20:53:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358702AbiAXUwF (ORCPT ); Mon, 24 Jan 2022 15:52:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353254AbiAXU2Y (ORCPT ); Mon, 24 Jan 2022 15:28: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 9ECB8C0612AC; Mon, 24 Jan 2022 11:42: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 30B3E61488; Mon, 24 Jan 2022 19:42:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13F3CC36AE3; Mon, 24 Jan 2022 19:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053322; bh=PSnOz8+2zdvBrxOTMHC/DW/3Ey4OxIgreWCpGuumD1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UAPvHRBoU9iZqIXP16QJAVGKX3Zrmr7IMVEqXzOGfPI39xi2CyK8n2W9U+WRclkjG 0IVHAuPwe3889ehtNfmXaZ/9Binqh13dt9gL/c3hXWTwBaipWaT/MuQVXE/RwXTmwO ErSozNMbCCAzsZQUpK3gk63zfH9bQYOXiRAP+jzU= 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.10 027/563] media: pvrusb2: fix control-message timeouts Date: Mon, 24 Jan 2022 19:36:32 +0100 Message-Id: <20220124184025.371505746@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F732C433FE for ; Tue, 25 Jan 2022 02:36:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3423317AbiAYCd2 (ORCPT ); Mon, 24 Jan 2022 21:33:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356859AbiAXU2c (ORCPT ); Mon, 24 Jan 2022 15:28: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 C506CC07A959; Mon, 24 Jan 2022 11:42: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 6508661488; Mon, 24 Jan 2022 19:42:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23C3FC340E5; Mon, 24 Jan 2022 19:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053325; bh=237rbF9pS7DmapYAq12bvUaL8GTC3vSFTf2z40fMX3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IB3dskKLnVy6YOh7m0W8tuvJYu84V7J2D8EWRwIsRrrjSJy3W3OOl0RoxGAfNogKm i8Af/a11VSttHdQtilwl8cpq6uNx6JiPiVJaeVCKV3sx1NViUQ9U3T+nPo46M+YZRY 2QPvm6SooX+VUOQTWPRLBEFiWDjFGdTx3RT5CGWQ= 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.10 028/563] media: stk1160: fix control-message timeouts Date: Mon, 24 Jan 2022 19:36:33 +0100 Message-Id: <20220124184025.402106800@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07CE5C433EF for ; Mon, 24 Jan 2022 20:53:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358888AbiAXUwK (ORCPT ); Mon, 24 Jan 2022 15:52:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359401AbiAXU2c (ORCPT ); Mon, 24 Jan 2022 15:28: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 D6410C08255D; Mon, 24 Jan 2022 11:42: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 604BA614BB; Mon, 24 Jan 2022 19:42:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32E19C340E5; Mon, 24 Jan 2022 19:42:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053328; bh=bd/N2cLIIyZKGPaNuTPqhxCMHdyWjib1d+RJWqvsz/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B1CnQY/46BAcieSEx7V8isKRQkMmdCgTxqS9l4YXZMqqkcrwu2ioaki+zauJn34gm oAOrFdB0L+oz9qUVk+aDxUnpn71eSFAL86qzZhsMucztwg5nI4WW4X93EUm5Ybw1nJ AVMRxegdzmvAlKIgpac1zkmXhUvWsSReONsN2dV8= 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.10 029/563] media: cec-pin: fix interrupt en/disable handling Date: Mon, 24 Jan 2022 19:36:34 +0100 Message-Id: <20220124184025.434318930@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE939C433FE for ; Mon, 24 Jan 2022 20:53:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392635AbiAXUvj (ORCPT ); Mon, 24 Jan 2022 15:51:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383988AbiAXU2e (ORCPT ); Mon, 24 Jan 2022 15: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 D22B7C082569; Mon, 24 Jan 2022 11:42: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 742046131E; Mon, 24 Jan 2022 19:42:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D8DBC340E5; Mon, 24 Jan 2022 19:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053335; bh=iQYvZKOwn04GejAiJzx17eTC96LSLpLWKisII9IwQuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=myuPjuFjk4rSHMOiV2h3t49InYLtldPliquCn41QxdUa5Dyb+i5DTelQrQ7lOnd3I KF5nz6nRhU/SKS3wb7l4w24w2hOeUrukbxk1ed4ZstWDntB5wgVGhTUzIMx6kws7ap P3hSdBLkx+5q5401ApFxa87YtnlnlCYpJTQJGAqU= 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.10 030/563] can: softing_cs: softingcs_probe(): fix memleak on registration failure Date: Mon, 24 Jan 2022 19:36:35 +0100 Message-Id: <20220124184025.465893806@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83C02C43217 for ; Tue, 25 Jan 2022 02:36:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353329AbiAYCdu (ORCPT ); Mon, 24 Jan 2022 21:33:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384162AbiAXU3T (ORCPT ); Mon, 24 Jan 2022 15:29:19 -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 C0D52C082571; Mon, 24 Jan 2022 11:42: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 7CD32B80FA1; Mon, 24 Jan 2022 19:42:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B23CC340E5; Mon, 24 Jan 2022 19:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053339; bh=uwBEOBweT8nlFVJJg0CeubIROq7ixtblezKhAsWjI78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ouLjJSPP9nvx2WNcfXshbJPIHnc3Z13uxOexjRFiC99z7S7wu/d3UdgBYI3GdBhkp j87PmjwbNQT2v9INa9txKy4VmXqPkBms9g+j1xUD99ZCH+cX2NUqf5zDNReZnqR+2r uvUm0QY1/0/8Kq0tpsgTulPy9xWBQ2QGSVtTcUXw= 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.10 031/563] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs Date: Mon, 24 Jan 2022 19:36:36 +0100 Message-Id: <20220124184025.503755457@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -151,13 +152,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) @@ -224,10 +228,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); @@ -236,6 +247,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, .remove =3D adc081c_remove, From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7590CC433EF for ; Mon, 24 Jan 2022 19:53:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355414AbiAXTxE (ORCPT ); Mon, 24 Jan 2022 14:53:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35862 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345396AbiAXTmX (ORCPT ); Mon, 24 Jan 2022 14:42: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 42B7061031; Mon, 24 Jan 2022 19:42:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F61AC340E5; Mon, 24 Jan 2022 19:42:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053342; bh=V+le2JyJO4eaQ2u2wi+xJ2j42OxrRL3YiITO6FyFsQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tUB8XIQUT7pjBHXwg9O4Kx+RaEv8ohO4uti8S/HOHt46KVsniVxITrqsERRYfxiz8 gHndP1l51YLzHfX5BtHGOj7ndX9aqfA2GLlZCt5t46iwT3DtcMrIohvpmbXMg8fDIB zufZmb5FcgfCbUE3FZe28wgxuyvyMOGFTmKKKPQQ= 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.10 032/563] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing() Date: Mon, 24 Jan 2022 19:36:37 +0100 Message-Id: <20220124184025.541909855@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/misc/lkdtm/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/misc/lkdtm/Makefile +++ b/drivers/misc/lkdtm/Makefile @@ -16,7 +16,7 @@ KCOV_INSTRUMENT_rodata.o :=3D n =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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 975F4C433F5 for ; Tue, 25 Jan 2022 00:08:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2369352AbiAYABf (ORCPT ); Mon, 24 Jan 2022 19:01:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1584585AbiAXXSO (ORCPT ); Mon, 24 Jan 2022 18:18: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 16ABFC07E28A; Mon, 24 Jan 2022 11: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 dfw.source.kernel.org (Postfix) with ESMTPS id AA8DE61554; Mon, 24 Jan 2022 19:44:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80E67C340E5; Mon, 24 Jan 2022 19:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053470; bh=4nEF6vs37MRNU+7bIdqhL7iZYdxIXNA2Bc+gWhM3i0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KFywy1OsKymUSsCEd3KQY/9tjWJHvDyAIlnJTrsSgDoIVEgjLgPYuCusFvikENExL QOQPPdtKSXeK+te8fqGnTbmy+AiB8iDOylJQ5mkkuYKlN+zZiQ0giHaFljDgJMotCQ tk2+23Ik2qkQcGZp8IJ+ytz/wophWDyiMvxju7Dk= 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.10 033/563] iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure Date: Mon, 24 Jan 2022 19:36:38 +0100 Message-Id: <20220124184025.573063034@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -242,13 +242,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 310B8C433EF for ; Mon, 24 Jan 2022 20:54:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442116AbiAXUxO (ORCPT ); Mon, 24 Jan 2022 15:53:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384757AbiAXUad (ORCPT ); Mon, 24 Jan 2022 15:30: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 C92E1C08B4D5; Mon, 24 Jan 2022 11:42: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 865F2B80FA1; Mon, 24 Jan 2022 19:42:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9A43C340E5; Mon, 24 Jan 2022 19:42:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053367; bh=FeZZ+ingMMeS9llhA0tL7fmg4FwHfTx7PJX3YvByI6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h7JAahBvBFk8l/NZOpIEsvDjsdWUUXaLyEEKLapyXt0YF1RyjQ8uG0lbjH9lKx7Jo UArvXGoyOmc1vDvwKArdzvGMDiyMasroJnGiBOmGW4DzOYcZt+feF+fafgRUUuHrtm ng+hLd8qAs+tXDRP3wcBttFO1EQW2+5Xs8Hfa8mQ= 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.10 034/563] gpu: host1x: Add back arm_iommu_detach_device() Date: Mon, 24 Jan 2022 19:36:39 +0100 Message-Id: <20220124184025.606765771@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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" @@ -232,6 +236,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D209DC433F5 for ; Tue, 25 Jan 2022 02:37:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345775AbiAYCgg (ORCPT ); Mon, 24 Jan 2022 21:36:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385152AbiAXUba (ORCPT ); Mon, 24 Jan 2022 15:31: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 17A34C061770; Mon, 24 Jan 2022 11: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 ams.source.kernel.org (Postfix) with ESMTPS id B12D8B811FB; Mon, 24 Jan 2022 19:43:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF20BC340E5; Mon, 24 Jan 2022 19:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053400; bh=N7iqN2dtcEyo4qkf5F6uhGxw3W2pDTN7WGAfMlTzNYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YEb/uNPJdAMv0TcET6taoAGqFUwT7eddseuBadkveWtDCUg5XV6zvz/09XQeN8H86 AN5Xl3vuC/s6YirB7KRI1T604aZh2EumlpW2KIRN9n7fLHRCxmlVDp8EXo/H8iVV6G qoakHZkT44kZE0n3J6dkuK2yS8iVTx5dhwsbiVlI= 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.10 035/563] dma_fence_array: Fix PENDING_ERROR leak in dma_fence_array_signaled() Date: Mon, 24 Jan 2022 19:36:40 +0100 Message-Id: <20220124184025.645252287@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21E8BC4707E for ; Mon, 24 Jan 2022 19:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358675AbiAXTzi (ORCPT ); Mon, 24 Jan 2022 14:55:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:35808 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344460AbiAXToA (ORCPT ); Mon, 24 Jan 2022 14: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 F2084B80FA1; Mon, 24 Jan 2022 19:43:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D43BC340E7; Mon, 24 Jan 2022 19:43:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053433; bh=yXIFEi0hrJpSznLM8N/k1ZoZ5zdtMovx27QVj/OKBf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X50Lv/Ti5Fgva732kJp81uPt2SK0gkHCbEyybT0bcL/Co92lfyv7quZI0yf0or1J1 h6RPbhl3bCan7ZrvaE8YHHs04o72Ts/drm8pbn1rB7DhhuqtEXo/8GCZRU78ZmH2+v 74Od2aPDewPn2lKoerO+r3Gti/sR7fj5nxq4+ytY= 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.10 036/563] PCI: Add function 1 DMA alias quirk for Marvell 88SE9125 SATA controller Date: Mon, 24 Jan 2022 19:36:41 +0100 Message-Id: <20220124184025.677502576@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/pci/quirks.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4077,6 +4077,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F35DC433FE for ; Tue, 25 Jan 2022 02:44:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358106AbiAYCmg (ORCPT ); Mon, 24 Jan 2022 21:42:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382269AbiAXUcf (ORCPT ); Mon, 24 Jan 2022 15:32: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 95533C08ED7B; Mon, 24 Jan 2022 11:44: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 46DABB8121A; Mon, 24 Jan 2022 19:44:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C89AC340E5; Mon, 24 Jan 2022 19:44:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053452; bh=HPU6B4LkNNfAkyxrkiRX2MkNEsV29ToffHA5yP+bd3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X5qGUFalCY9pk2PXcQaAXOfJOCGE8onsHP3xEShVW9X6Ih3YiRSMEaLGq05GLgf6D bC4M2Tnqw68RbgYWOi1gJiRue+X2ue+xY/aTwjcPtp6VAjVAw0JxR4BlkKkeSKvUZj u1HreWraIY4GdB4Yvil95tvFM9nIwbC3p26fuI88= 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.10 037/563] mm_zone: add function to check if managed dma zone exists Date: Mon, 24 Jan 2022 19:36:42 +0100 Message-Id: <20220124184025.708988453@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -938,6 +938,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 @@ -8903,3 +8903,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBAE2C4332F for ; Tue, 25 Jan 2022 02:44:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378864AbiAYCmy (ORCPT ); Mon, 24 Jan 2022 21:42:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356798AbiAXUcg (ORCPT ); Mon, 24 Jan 2022 15:32: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 515C0C07E282; Mon, 24 Jan 2022 11:44: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 EDAF2B81188; Mon, 24 Jan 2022 19:44:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D72DC340E5; Mon, 24 Jan 2022 19:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053454; bh=Bg7anAB4uQgzVMybOL3Xzqrol0AtHIVBdb6VcLuiqKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ay0wv7gNwOPSOHbU7MPCadBGSM63HTABPI50O/DF5n64odCLIgvl3ojB/k/9+90Fv +38l7DP6ldjBqX/J7adsUWjSJ8kIa2aZpW7dtg+bBB5SbUA+QPjtAfIDXWYaFKQ8Fe KnqxkF8uQEkk9BZ2ebSqIaXRsieY64NaDI3qMQ/0= 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.10 038/563] dma/pool: create dma atomic pool only if dma zone has managed pages Date: Mon, 24 Jan 2022 19:36:43 +0100 Message-Id: <20220124184025.748160672@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- kernel/dma/pool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/dma/pool.c +++ b/kernel/dma/pool.c @@ -206,7 +206,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) @@ -229,7 +229,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9C1DC35273 for ; Mon, 24 Jan 2022 19:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358935AbiAXT4D (ORCPT ); Mon, 24 Jan 2022 14:56:03 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:36048 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345983AbiAXToU (ORCPT ); Mon, 24 Jan 2022 14:44: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 1A20FB81215; Mon, 24 Jan 2022 19:44:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5DCFC340E5; Mon, 24 Jan 2022 19:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053457; bh=Lht58LNI8KdoxzRSF1qDz20MWcfbNF8A5zAHYBz8diQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Juf/LJDlgakA+hD2fISYbRWn/+dz2aIWLQOtAjx+kDIZ6JlCQmMXn6hWDktM8x/qx fowvxE6kYYS+usYc3TD0odkq0QCijLAcAZen1GkKUuNXrGIWeEOkx7hdO1sOEz5+AP l9G5/Wjolwfukfck6ZYVKNVtr7QB6JAsjJEi6SCE= 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.10 039/563] mm/page_alloc.c: do not warn allocation failure on zone DMA if no managed pages Date: Mon, 24 Jan 2022 19:36:44 +0100 Message-Id: <20220124184025.779821957@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- mm/page_alloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3964,7 +3964,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD066C433EF for ; Tue, 25 Jan 2022 02:44:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359395AbiAYCml (ORCPT ); Mon, 24 Jan 2022 21:42:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382509AbiAXUcg (ORCPT ); Mon, 24 Jan 2022 15:32: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 483FEC07E286; Mon, 24 Jan 2022 11:44: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 0FFC4B8121C; Mon, 24 Jan 2022 19:44:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BA94C340E5; Mon, 24 Jan 2022 19:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053460; bh=QhyT2bS2KUOxuRjcFZtcIPFGFLrQN5ZORdtoOHjRbOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YDK+xjSnbQLZMKS5w3FvvXMlJPlxh2vWl+d7QlI60HtfBCDrGnf1df91r25McJkGC 6xvnfWxdphYERRHAjKj4wAeXLOwZuR8z9L06l2ekl7MwQ/GhbZlz0d5IKncmYP5gOy AlKS0jDGJOjafIAhFUektZh0aC7V27onmHccKiag= 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.10 040/563] shmem: fix a race between shmem_unused_huge_shrink and shmem_evict_inode Date: Mon, 24 Jan 2022 19:36:45 +0100 Message-Id: <20220124184025.818939676@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- mm/shmem.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) --- a/mm/shmem.c +++ b/mm/shmem.c @@ -527,7 +527,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; @@ -542,7 +542,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 @@ -550,12 +549,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; } @@ -575,7 +574,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); @@ -589,38 +588,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E71E3C43217 for ; Mon, 24 Jan 2022 20:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348841AbiAXUAh (ORCPT ); Mon, 24 Jan 2022 15:00:37 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41942 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345039AbiAXToY (ORCPT ); Mon, 24 Jan 2022 14:44: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 688F661553; Mon, 24 Jan 2022 19:44:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42230C340E5; Mon, 24 Jan 2022 19:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053463; bh=a7QTSgbPCTGqbAutw257ceXltTtvuBEN4Cd5NrFUNCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DzXojJV8cwnYo0SEDqiiJP7oNDJBmvG0bGdBvLafWuQGmE7ArX7oMN6t7cqDJSoOa RWilv1L894MX6+kEnni4y+bsMsO1aLg/rK6h0NMwmvJmOyGcimZSE3KIJy70mskVaa gxGxgUNuiHTrs2a1l1N14tQka+OzYzJFmSvfvbXo= 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.10 041/563] drm/ttm: Put BO in its memory managers lru list Date: Mon, 24 Jan 2022 19:36:46 +0100 Message-Id: <20220124184025.849169194@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -789,6 +789,8 @@ int ttm_mem_evict_first(struct ttm_bo_de 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A922C433F5 for ; Mon, 24 Jan 2022 20:00:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353617AbiAXUAq (ORCPT ); Mon, 24 Jan 2022 15:00:46 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41998 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344056AbiAXTo2 (ORCPT ); Mon, 24 Jan 2022 14:44: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 9320961031; Mon, 24 Jan 2022 19:44:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 712D1C340E5; Mon, 24 Jan 2022 19:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053467; bh=U3wisKp1DQL3P73XQGZFVVCkj4o+R4Zq2mDuqeIwGBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iIXTNFha3khsigCnX+V7RuCwcSijYlXGMl7aqPKYsIq9BqOxify275iHYP8EqIgb0 HQC5oVn/4p8pIlIHZBzhe2GjfwRzypdLpLo8xZMSLTuVj+FC7bYtPV2FFanB+lWlkB OnhwPtuNIpjmgLaJEpOdqb4Gc7I06RFRaR/kXcHw= 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.10 042/563] Bluetooth: L2CAP: Fix not initializing sk_peer_pid Date: Mon, 24 Jan 2022 19:36:47 +0100 Message-Id: <20220124184025.878730397@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19975C433EF for ; Mon, 24 Jan 2022 19:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351936AbiAXTx5 (ORCPT ); Mon, 24 Jan 2022 14:53:57 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38000 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350666AbiAXTmw (ORCPT ); Mon, 24 Jan 2022 14:42: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 C704E61482; Mon, 24 Jan 2022 19:42:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B8B1C340E5; Mon, 24 Jan 2022 19:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053370; bh=ixjdja7ZV8c6BZ81vUfCtuM7LebAtBUhgDp4H5GYMis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZxG2uV6pL1dBK1Pj1USmAm0MfwoeXa7rYhqslEQZ714j1JHJznUYMzgpqDxDMqHu RPp+ue6jFFUnhxMCBLtvOwv6Z2rDAN8hFZj7R0Rutpq1MV+/1DFz5KuxJOr7J4FORm NguooX6mnJ8xud8YLBjJfWgLx7y+fun+UzMzzOzE= 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.10 043/563] drm/bridge: display-connector: fix an uninitialized pointer in probe() Date: Mon, 24 Jan 2022 19:36:48 +0100 Message-Id: <20220124184025.907593866@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 4d278573cdb99..544a47335cac4 100644 --- a/drivers/gpu/drm/bridge/display-connector.c +++ b/drivers/gpu/drm/bridge/display-connector.c @@ -104,7 +104,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E07DDC433F5 for ; Mon, 24 Jan 2022 20:54:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442143AbiAXUxZ (ORCPT ); Mon, 24 Jan 2022 15:53:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384767AbiAXUad (ORCPT ); Mon, 24 Jan 2022 15:30: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 542D0C08B4D9; Mon, 24 Jan 2022 11:42: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 D2BE36135E; Mon, 24 Jan 2022 19:42:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4073C340E5; Mon, 24 Jan 2022 19:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053373; bh=q06pqYo6uEXuUELP82UDgfcUYfD4+EybH2C9KbzgQ4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GcacAnTQH76Ha4NCVjylc/LJ/dIeHx73uBkXPtSUGhUvm9N+GcklEHii2GXzY18L8 Y7YTNYIcarxf2/KtWea6e4zCriTEQ9HJrg8iDNxohR1eQ8myCaSHA3jAwbXIq852Y9 q5Mcxr6J4fUCh6SHwZPL6o02BzyV0F1vt9+jVTQg= 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.10 044/563] drm: fix null-ptr-deref in drm_dev_init_release() Date: Mon, 24 Jan 2022 19:36:49 +0100 Message-Id: <20220124184025.937609654@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 cd162d406078a..006e3b896caea 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -577,6 +577,7 @@ static int drm_dev_init(struct drm_device *dev, struct drm_driver *driver, struct device *parent) { + struct inode *inode; int ret; =20 if (!drm_core_init_complete) { @@ -613,13 +614,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72096C433EF for ; Mon, 24 Jan 2022 19:54:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346696AbiAXTyF (ORCPT ); Mon, 24 Jan 2022 14:54:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40436 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355625AbiAXTnC (ORCPT ); Mon, 24 Jan 2022 14: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 D6A606135E; Mon, 24 Jan 2022 19:42:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0F33C340E5; Mon, 24 Jan 2022 19:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053376; bh=H/tPH33St1gFh5Gacd8JGf5OOGlFWqNnI4EL4xPm4mc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i+cX1YA652ZuRjNUDOAn1mDfKvWGzIqcS93vKaSISLVzl7fDwylVbstk0ycp8MtI/ EOlvuaAkJUiNlmB8KuJ4bKNXQk5SWc6qVdDXC/sNBlt75f0QohsZjMdND7OSTN/b/+ NzTYSFCR7Ar4xuYAqdZN98bTVBE7S+rFnbwt2jrE= 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.10 045/563] drm/panel: kingdisplay-kd097d04: Delete panel on attach() failure Date: Mon, 24 Jan 2022 19:36:50 +0100 Message-Id: <20220124184025.969267910@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 559E6C4332F for ; Mon, 24 Jan 2022 19:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347786AbiAXT7A (ORCPT ); Mon, 24 Jan 2022 14:59:00 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40486 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355651AbiAXTnC (ORCPT ); Mon, 24 Jan 2022 14: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 E0F8D614BB; Mon, 24 Jan 2022 19:42:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3C7BC340E5; Mon, 24 Jan 2022 19:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053379; bh=IyH1Lh56yH9JDasMVhjm5n150Kxj6K6Tx0L9VwNIBGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UbmEdiZwjQB5AwDcnWbwgK3SoILutKd9KHpHllGvZoJAXj+52xhpfRoxtw7jsPdPb b+0k4ZXM7NLpAyylfIyXf3rMxbQADzrwOaNrAz1OPJssWhLRRlTDK5hNcFPpNOM7hZ KzPm4vULMd46Umu0S9nbJZvvLyPGuVzXYOy8LIw0= 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.10 046/563] drm/panel: innolux-p079zca: Delete panel on attach() failure Date: Mon, 24 Jan 2022 19:36:51 +0100 Message-Id: <20220124184026.007769115@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A006C433F5 for ; Mon, 24 Jan 2022 19:54:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351972AbiAXTyA (ORCPT ); Mon, 24 Jan 2022 14:54:00 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33092 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346385AbiAXTnG (ORCPT ); Mon, 24 Jan 2022 14:43: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 9FA85B810AF; Mon, 24 Jan 2022 19:43:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5281C340E5; Mon, 24 Jan 2022 19:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053382; bh=3+Q1qqp470v+gEM0d91TJ6IrB2l1J253vXc0zAZHbcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rusgf2Vg0mGAwMcU5OvFuIAE8iK0yQe/t3dFYclkDCG/QtYul49QsSyDCTU5kA+3h NlUNowTK/q7Dn/hfrHe0g/X1M7lsYhotlbVPMxrZkNwllzp1ZacAq9nJfqNskFoFrB V2IhF/2Ku09Yt08rKgC96OwR7dho+0Tl7JI+si24= 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.10 047/563] drm/rockchip: dsi: Fix unbalanced clock on probe error Date: Mon, 24 Jan 2022 19:36:52 +0100 Message-Id: <20220124184026.039348000@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/= drm/rockchip/dw-mipi-dsi-rockchip.c index d0c9610ad2202..433b2f459a7d9 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -1126,14 +1126,10 @@ static int dw_mipi_dsi_rockchip_probe(struct platfo= rm_device *pdev) 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) --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D311C4321E for ; Mon, 24 Jan 2022 20:54:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359321AbiAXUyE (ORCPT ); Mon, 24 Jan 2022 15:54:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384815AbiAXUaf (ORCPT ); Mon, 24 Jan 2022 15:30: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 16F33C07A968; Mon, 24 Jan 2022 11: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 C6F79B8122F; Mon, 24 Jan 2022 19:43:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7D91C340EA; Mon, 24 Jan 2022 19:43:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053385; bh=PqqgOMdQYsjVK+c5rEKxPaFKwUlR+y4hoxNyhmOITC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g9KUG/hdbiBkuL/OMM0UyxuSG5B6dZNNeEIaiMRdI1Rgh07MWzXJMUForknH2E7a9 ZO3GBGkrKyqu+iQtE5dq/WYgEfQyJQ/CDuU+mNg1rnuWvXw4E9z8rs1Rdrhr8llOd0 DB7QowVmhDgVYalPQhAIGC4dzELH8dI1SSE8xM2A= 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.10 048/563] drm/rockchip: dsi: Hold pm-runtime across bind/unbind Date: Mon, 24 Jan 2022 19:36:53 +0100 Message-Id: <20220124184026.078735949@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -753,10 +753,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, @@ -775,20 +771,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, @@ -918,10 +904,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 /* @@ -933,7 +923,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); @@ -945,16 +935,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, @@ -969,6 +966,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36FD4C4167B for ; Tue, 25 Jan 2022 02:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3423717AbiAYCgA (ORCPT ); Mon, 24 Jan 2022 21:36:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385055AbiAXUbZ (ORCPT ); Mon, 24 Jan 2022 15: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 1BABAC07A96D; Mon, 24 Jan 2022 11:43: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 B4BCDB811FB; Mon, 24 Jan 2022 19:43:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBE84C340EA; Mon, 24 Jan 2022 19:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053388; bh=4RUcMj1GoLMRgwa1w50kVg3OcRDZyoHyt2bFDIJJZb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VHdSzKk/RHT40JtqLLfiiAl6yHbOYIUqiBYzCb+OuXKUGxht4qVhOkxznM4/v5z7f mfguVqrFhgW0lmhQq69PKiNgLSmcfLlqAbFyV53v/2O903l3/pK9YlPwyUSnpQIwY/ pWXozx2ayk736W+ZPQh1/ei1VxNJqRduSJ55pDMA= 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.10 049/563] drm/rockchip: dsi: Disable PLL clock on bind error Date: Mon, 24 Jan 2022 19:36:54 +0100 Message-Id: <20220124184026.116047314@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/= drm/rockchip/dw-mipi-dsi-rockchip.c index d3cea42dde436..6691e45230126 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -923,7 +923,7 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev, 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); @@ -935,17 +935,19 @@ static int dw_mipi_dsi_rockchip_bind(struct device *d= ev, 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 return 0; =20 +out_pll_clk: + clk_disable_unprepare(dsi->pllref_clk); out_pm_runtime: pm_runtime_put(dsi->dev); if (dsi->slave) --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4697DC41535 for ; Tue, 25 Jan 2022 02:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3423799AbiAYCgP (ORCPT ); Mon, 24 Jan 2022 21:36:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385053AbiAXUbZ (ORCPT ); Mon, 24 Jan 2022 15:31: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 45844C07A96F; Mon, 24 Jan 2022 11:43: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 D7FD66153B; Mon, 24 Jan 2022 19:43:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0592C340E8; Mon, 24 Jan 2022 19:43:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053391; bh=RSMJmFAYFn44dqCpz6Ef7WGavdzCauuu95FS6ErIU1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kvsgo2YtIWJ/mJfmTDqMNCQOXHevbyS90knen1gBpfnR+OyZ+LLvIgjo6A5VEEqY4 f1+EshkVXWf0Pb5eAA6KmCdFkyoKjHFfl8+t7h9cfubbpQUenAevsSaBX+9mc35ANY 2y8lxFPnYxGkX/CuPFMdLRMfd7tOtQl0F8SZRZrM= 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.10 050/563] drm/rockchip: dsi: Reconfigure hardware on resume() Date: Mon, 24 Jan 2022 19:36:55 +0100 Message-Id: <20220124184026.156578432@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -243,6 +243,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 { @@ -944,6 +946,8 @@ static int dw_mipi_dsi_rockchip_bind(str goto out_pll_clk; } =20 + dsi->dsi_bound =3D true; + return 0; =20 out_pll_clk: @@ -965,6 +969,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); @@ -1029,6 +1035,36 @@ static const struct dw_mipi_dsi_host_ops .detach =3D dw_mipi_dsi_rockchip_host_detach, }; =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; @@ -1248,6 +1284,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99019C433F5 for ; Mon, 24 Jan 2022 19:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353094AbiAXT7Q (ORCPT ); Mon, 24 Jan 2022 14:59:16 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34996 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355380AbiAXTnR (ORCPT ); Mon, 24 Jan 2022 14:43: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 8C6BFB8122F; Mon, 24 Jan 2022 19:43:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B442EC340E5; Mon, 24 Jan 2022 19:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053394; bh=5mn8xY2Rw2yKpuokmAWh9/JaNI4qxPL/snAS97h6juY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t5SGBHZ69m7cnE/Sb+cN4p4cvdwSjYL3U6dSJ0g7NNCiuz+o1rilw6aICK8cRlpOn b0wI0DmDqIJSVvedvmFbiR9nNhpX5JjCuKtiQIf7sMMXQvYVRIVye2Vln8syWWtjw6 TQixsHEWZMU3pxR1TbAmLdnNN0LTZGhZz9Bznbr4= 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.10 051/563] Bluetooth: cmtp: fix possible panic when cmtp_init_sockets() fails Date: Mon, 24 Jan 2022 19:36:56 +0100 Message-Id: <20220124184026.193971287@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan ------------[ 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 933B4C3526C for ; Tue, 25 Jan 2022 02:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236286AbiAYCgV (ORCPT ); Mon, 24 Jan 2022 21:36:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385105AbiAXUb0 (ORCPT ); Mon, 24 Jan 2022 15:31: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 DFEBCC06175E; Mon, 24 Jan 2022 11:43: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 9CF3EB811FB; Mon, 24 Jan 2022 19:43:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB211C340E8; Mon, 24 Jan 2022 19:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053397; bh=qLM9D+upM06dDkWRzpDwXfJwaCBmj2fiCs77Q3WGh3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdVXV5UmIW3ISshZUc/toBLR3nY4fi2vIFte7Shrq91BlVFZFtXdHCX1i4Gx35jMO pN2Ii8ldv1ehi5tZ44NXeC1PwW62JZqzwkq9dycnuKWX8WEOqj0GPijORWB3R+chOa RFZ0xMvzaeDDN1PpF3ZKSbrogTLe+IdAzhF2SpfM= 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.10 052/563] clk: bcm-2835: Pick the closest clock rate Date: Mon, 24 Jan 2022 19:36:57 +0100 Message-Id: <20220124184026.223043474@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 1ac803e14fa3e..a919ee9c3fcb8 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -1217,7 +1217,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD9B8C3526E for ; Mon, 24 Jan 2022 19:57:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358198AbiAXTyg (ORCPT ); Mon, 24 Jan 2022 14:54:36 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40916 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350024AbiAXTn0 (ORCPT ); Mon, 24 Jan 2022 14:43: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 18E186157F; Mon, 24 Jan 2022 19:43:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5D72C340E5; Mon, 24 Jan 2022 19:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053403; bh=CLs7t2yEWFzRD/JatkASUixMZjlfHYgMd0AFgAr4RcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gTOSmYC+re10eV1EPgC/TBiRfT/cJ8g8uI7P2ETJbgOqprUtIue9fSmcIHCbph0qf m+QXkILY0RbCOZYnFH/qbDvxS7C2t4zbAWHjAZr1xbj2PvyL5uYzPqJ+kgQC7s4v7T qVvjGagb5XIKTSC67aH/PuMAkxkSXPrxfDV7gXpI= 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.10 053/563] clk: bcm-2835: Remove rounding up the dividers Date: Mon, 24 Jan 2022 19:36:58 +0100 Message-Id: <20220124184026.255498322@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a919ee9c3fcb8..178886823b90c 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -933,8 +933,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; @@ -946,10 +945,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 */ @@ -1080,7 +1075,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); @@ -1131,7 +1126,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10074C43219 for ; Mon, 24 Jan 2022 19:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358226AbiAXTyj (ORCPT ); Mon, 24 Jan 2022 14:54:39 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40964 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244676AbiAXTn2 (ORCPT ); Mon, 24 Jan 2022 14: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 dfw.source.kernel.org (Postfix) with ESMTPS id 2EA99614B8; Mon, 24 Jan 2022 19:43:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05A1EC340E5; Mon, 24 Jan 2022 19:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053406; bh=w+VyngdW9N3dWCPVF+tKJ1n0N9r4Bcc/n6v1odHf5TQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uhGyC1zvPHUP8xj9GGV7kvYGhSSVaSrqWgzZIVUOhdarXEfRcbmUB6au/llGIxerH Zx3QXbfESg4e1Jag1UDymrNh+gtmFMAHD+V1sjnv9LqTRnBn5XtP0CcuO02nl0DxON 4Ab/AsB9nKbb7hntvx6Tw5M9Xaoq0hU85dokYgfQ= 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.10 054/563] drm/vc4: hdmi: Set a default HSM rate Date: Mon, 24 Jan 2022 19:36:59 +0100 Message-Id: <20220124184026.285848868@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ee293f061f0a8..5d5c4e9a86218 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -79,6 +79,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 #define VC4_HSM_MID_CLOCK 149985000 =20 @@ -1806,6 +1807,19 @@ static int vc4_hdmi_bind(struct device *dev, struct = device *master, void *data) vc4_hdmi->disable_wifi_frequencies =3D of_property_read_bool(dev->of_node, "wifi-2.4ghz-coexistence"); =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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5B2DC41535 for ; Tue, 25 Jan 2022 00:06:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2369411AbiAYABn (ORCPT ); Mon, 24 Jan 2022 19:01:43 -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 S1384807AbiAXXR7 (ORCPT ); Mon, 24 Jan 2022 18:17: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 6E8C6C08B4E9; Mon, 24 Jan 2022 11:43: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 10015B81188; Mon, 24 Jan 2022 19:43:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C465C340E8; Mon, 24 Jan 2022 19:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053409; bh=2w476mOJU7MWM/BdfYpZC7AEg+AEjB5Orgrjn+jLcw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N7t81xr7wTSmyktLnV/CnCMVKSVatHp+f6j9hnL5S7ReOe8TsKF6bo20OywWyvsgF oHrfGNC9zB+cXYjpSRQ3clXmnN1pyShXlbqIZYdwJ2muZrnqZYf9h3YgZ2DKR5DOVn f8quT+m3babc2vjhOWqg+KmOFxTzWJujsLIRKuCg= 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.10 055/563] wcn36xx: ensure pairing of init_scan/finish_scan and start_scan/end_scan Date: Mon, 24 Jan 2022 19:37:00 +0100 Message-Id: <20220124184026.315778418@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 629ddfd74da1a..9aaf6f7473333 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -397,6 +397,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 @@ -412,17 +413,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); } @@ -709,7 +724,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 3793907ace92e..ad312e17f7a3c 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -730,6 +730,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; @@ -760,6 +761,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; @@ -790,6 +792,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; @@ -831,6 +834,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 9b4dee2fc6483..5c40d0bdee245 100644 --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -231,6 +231,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF240C4321E for ; Tue, 25 Jan 2022 00:09:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371220AbiAYAHO (ORCPT ); Mon, 24 Jan 2022 19:07:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1582576AbiAXXSL (ORCPT ); Mon, 24 Jan 2022 18:18: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 5B154C07A978; Mon, 24 Jan 2022 11:43: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 03036B811F3; Mon, 24 Jan 2022 19:43:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37959C340E5; Mon, 24 Jan 2022 19:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053412; bh=XF7IXFHWIZ5snVq0dmj81vyVcFGPfrqkqClUT0lXLl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QZHXJ7nHnt9yqtzEglR0rabHAW5v/7cX0yV4WRDPDAQp1yhn8xB3TLHYIr+68ZdSr dvSIlDSS8LCKQpowpXlqdT3E163UPqp/0/mxOpu6pPBsCGyXmN+B5/5tQK2nV9fzWK qhClpHVrs2G/UyIdm3H/iXQBNVZC53/v+lA33Low= 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.10 056/563] wcn36xx: Indicate beacon not connection loss on MISSED_BEACON_IND Date: Mon, 24 Jan 2022 19:37:01 +0100 Message-Id: <20220124184026.349185407@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ad312e17f7a3c..7f00cb6f5e16b 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2607,7 +2607,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; } @@ -2622,7 +2622,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B36EC433F5 for ; Tue, 25 Jan 2022 02:44:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3423894AbiAYCiP (ORCPT ); Mon, 24 Jan 2022 21:38:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356569AbiAXUcS (ORCPT ); Mon, 24 Jan 2022 15:32: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 BD64AC08B4ED; Mon, 24 Jan 2022 11:43: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 5DC15612E9; Mon, 24 Jan 2022 19:43:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EBE0C340E5; Mon, 24 Jan 2022 19:43:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053415; bh=8r/XJeSI7KQi3vSVnflKjR5XFdHnpyEreex20ky/SVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ET1d2WikVBi4mC6PsijcqG7runvNikjM10RQrc8v8nANon41KLu+20QSyadApyQyF A7eQQUcP+YWu2TwlH/Rqc3dfEP4DaVk16Jcwmcv82oXccrOxt8Eb2HzTZU0dtWjaBs wyrcGvaiyxGMG6jBwnuuaMQVVSdTZC+sIs5qK89o= 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.10 057/563] wcn36xx: Fix DMA channel enable/disable cycle Date: Mon, 24 Jan 2022 19:37:02 +0100 Message-Id: <20220124184026.379548584@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 cf4eb0fb28151..0909d0c423cbb 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8172C433FE for ; Mon, 24 Jan 2022 19:59:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358405AbiAXT7X (ORCPT ); Mon, 24 Jan 2022 14:59:23 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33954 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355765AbiAXTnl (ORCPT ); Mon, 24 Jan 2022 14: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 E0A85B811F3; Mon, 24 Jan 2022 19:43:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DB43C340E5; Mon, 24 Jan 2022 19:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053418; bh=UO5roCH2zYZALs8rtmhmOHSCw7I+ibAjMZTVl8sl7RU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TqgrLfkLNZpQwpqjjZM4Pw4Sjyyxi62VA4XwUicpoowGk/776pC6Y2wAZEZh8pcmQ QqOmPUvBiq9iUtSIleu3TB6pQh0UKG8BQoSytzK3SW68Yck3Xefg6ug4VVgDOQwxAy aG7y1eSD9WaVVkeFqQPoCA61rINyYHGxixxa5Ox4= 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.10 058/563] wcn36xx: Release DMA channel descriptor allocations Date: Mon, 24 Jan 2022 19:37:03 +0100 Message-Id: <20220124184026.419341918@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 0909d0c423cbb..b117d8a0f446f 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5F01C433F5 for ; Tue, 25 Jan 2022 00:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2370540AbiAYAFX (ORCPT ); Mon, 24 Jan 2022 19:05:23 -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 S1846542AbiAXXQT (ORCPT ); Mon, 24 Jan 2022 18:16:19 -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 97816C08B4F4; Mon, 24 Jan 2022 11:43: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 351A06153E; Mon, 24 Jan 2022 19:43:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17F54C340E5; Mon, 24 Jan 2022 19:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053421; bh=PkwYfJNj13eKaScjRBJkbBJh0gjPuH/Z/VPnCw8A9+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QGPeIYh1FI07cNbIQNE81Hbx2VCTbLRYCX6lBs8uW+aL09KHqKyxlG1y7u2qHOxI7 TuIuiDEuGUhiNhPSVWuXBqh9ZiHcJjT2rRW5Ef0akwsGugL4MMJYpVpGGBkJDpq/Vc vEAFp6J25oAsALLbhx5iRLuX13AW3i9ylnV1mLn4= 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.10 059/563] wcn36xx: Put DXE block into reset before freeing memory Date: Mon, 24 Jan 2022 19:37:04 +0100 Message-Id: <20220124184026.455111306@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 b117d8a0f446f..6c62ffc799a2b 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87A5DC46467 for ; Mon, 24 Jan 2022 19:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358396AbiAXTzI (ORCPT ); Mon, 24 Jan 2022 14:55:08 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41252 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355789AbiAXTnp (ORCPT ); Mon, 24 Jan 2022 14:43: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 2DB0561523; Mon, 24 Jan 2022 19:43:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F437C340E5; Mon, 24 Jan 2022 19:43:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053424; bh=hu1gV17cDebv5tvImuJ6Tjz/Hjil7NJhsdqGiuZJLm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rO1BYi4an3xTJPV5sLC/vDv5pJsgf976cUIo+0RaSLpwIBykWExUu+O4v16BC9xtp 4IA05iw7WvXZlNDf2uzr3HFkywrqERzu+Qw8PrVylatFEOA2bHyaWYif00McsTCrru T5TkDOUx497jAT1UphnviLzSb0ZORFKxrkk00Fsc= 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.10 060/563] wcn36xx: populate band before determining rate on RX Date: Mon, 24 Jan 2022 19:37:05 +0100 Message-Id: <20220124184026.490498079@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 bbd7194c82e27..f76de106570d2 100644 --- a/drivers/net/wireless/ath/wcn36xx/txrx.c +++ b/drivers/net/wireless/ath/wcn36xx/txrx.c @@ -259,8 +259,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; @@ -272,6 +270,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; @@ -298,22 +315,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A632C4167E for ; Tue, 25 Jan 2022 02:44:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3424009AbiAYCi3 (ORCPT ); Mon, 24 Jan 2022 21:38:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385328AbiAXUcZ (ORCPT ); Mon, 24 Jan 2022 15:32: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 AEFB4C07A97D; Mon, 24 Jan 2022 11:43: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 4310861553; Mon, 24 Jan 2022 19:43:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21517C340E5; Mon, 24 Jan 2022 19:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053427; bh=bk5v1u8Hg9MWexuPCgwEWZSSVhmQfiM7lztRzglm+zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nyPX1znAdYpyT2NccgFosXeAjQRt532Y/v3EtlzfBqYzHb6ZMjGFwweYSh3vIMvi0 g/Ru8+pSzM5uNs3bk+0E+q5BKim8gMtzKdfjmdWd2fi4GrSO0DAiKmjXCPcGNMdzlV qrfqNx+R+h2IEm3+nHLZIHn3XDxzfU16+Yna5dBI= 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.10 061/563] wcn36xx: fix RX BD rate mapping for 5GHz legacy rates Date: Mon, 24 Jan 2022 19:37:06 +0100 Message-Id: <20220124184026.529150093@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 f76de106570d2..f33e7228a1010 100644 --- a/drivers/net/wireless/ath/wcn36xx/txrx.c +++ b/drivers/net/wireless/ath/wcn36xx/txrx.c @@ -237,7 +237,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 /* @@ -295,12 +294,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 008A5C433F5 for ; Tue, 25 Jan 2022 02:44:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3424109AbiAYCiw (ORCPT ); Mon, 24 Jan 2022 21:38:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356726AbiAXUce (ORCPT ); Mon, 24 Jan 2022 15:32: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 306DDC08B4FC; Mon, 24 Jan 2022 11:43: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 EA24DB81215; Mon, 24 Jan 2022 19:43:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19548C340E5; Mon, 24 Jan 2022 19:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053430; bh=+GQuL4BuFI+r25AhMeGmdBP+JMbKMCMcrj8kpNcaSFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FZm8GvRMEHKvST9MeBGes8bhJM1wc0G4sl6kASEy30PZl4vIXdTsNqMZidPrAqYJH PxxhNVUZof1TOaLjBRV6OAfnqGk3Ufh1cq6NU32DXAEkrRqPhfk5tbt8R1jaHoB5RM QohEKz2GCsGSSMWrIL7M/hJaVIq+Gdq9K9Pr5UfY= 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.10 062/563] ath11k: Send PPDU_STATS_CFG with proper pdev mask to firmware Date: Mon, 24 Jan 2022 19:37:07 +0100 Message-Id: <20220124184026.560291742@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ee8db812589b3..c4972233149f4 100644 --- a/drivers/net/wireless/ath/ath11k/dp.h +++ b/drivers/net/wireless/ath/ath11k/dp.h @@ -514,7 +514,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 21dfd08d3debb..092eee735da29 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -894,7 +894,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E57DC4321E for ; Mon, 24 Jan 2022 20:00:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359636AbiAXT76 (ORCPT ); Mon, 24 Jan 2022 14:59:58 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41458 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345383AbiAXToA (ORCPT ); Mon, 24 Jan 2022 14: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 dfw.source.kernel.org (Postfix) with ESMTPS id 79DFA6153B; Mon, 24 Jan 2022 19:43:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55C7FC340E5; Mon, 24 Jan 2022 19:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053436; bh=UhT0JaI55mgQA7ptyJJ/KmDglLAZ1One7Pak05Uef7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TK6izvzpgciGi1Vdu2gZB9GhUD2roEZ6vMPvWSASP/d8j4ICgK+pTyfC9w5vM/1fi JyeHC2SxfcpFYX7RJvtx/cwxCNUPRZ/FsK06OMGUCRZs4W9NxVGh96kMAQBZo8QFF+ kkwR38F8KCHdduydG4EQ4b1YoOAxEXEd0v2oT0R8= 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.10 063/563] mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init() Date: Mon, 24 Jan 2022 19:37:08 +0100 Message-Id: <20220124184026.590890267@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A20FEC433EF for ; Mon, 24 Jan 2022 20:00:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359744AbiAXUAI (ORCPT ); Mon, 24 Jan 2022 15:00:08 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:39434 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355810AbiAXToB (ORCPT ); Mon, 24 Jan 2022 14:44: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 7EAB961551; Mon, 24 Jan 2022 19:44:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B611C340E5; Mon, 24 Jan 2022 19:43:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053439; bh=6QMkhBO2A5xRflXt1DL3EZsmSg63ySjvEOpDd53WQDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=00//uaMMfHT9pOlNg+UzgBTfkhWXJkjkG/NTcFR0piyPQCBZcmjq6BhJaytBRkzgp QfmTbegaLXEZigDycrYOg17cPKfMIULqhksedhbDYUzfW+NKCvhG0ZJqBZDnnvKIkn CnIufwUDDFqN3w34wbfZoeTyIHlefjP9WNvqgOrE= 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.10 064/563] media: videobuf2: Fix the size printk format Date: Mon, 24 Jan 2022 19:37:09 +0100 Message-Id: <20220124184026.623024397@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2f3a5996d3fc9..fe626109ef4db 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c @@ -150,7 +150,7 @@ static void *vb2_dc_alloc(struct device *dev, unsigned = long attrs, buf->cookie =3D dma_alloc_attrs(dev, size, &buf->dma_addr, GFP_KERNEL | gfp_flags, buf->attrs); if (!buf->cookie) { - dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size); + dev_err(dev, "dma_alloc_coherent of size %lu failed\n", size); kfree(buf); return ERR_PTR(-ENOMEM); } @@ -196,9 +196,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30B8CC433FE for ; Mon, 24 Jan 2022 23:58:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367331AbiAXXzI (ORCPT ); Mon, 24 Jan 2022 18:55: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 S1846533AbiAXXQP (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 077FDC07E5FE; Mon, 24 Jan 2022 11:44: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 994D6612E9; Mon, 24 Jan 2022 19:44:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69C1DC340E5; Mon, 24 Jan 2022 19:44:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053443; bh=TUZoR2a6e6D4ye3CC8JKRwNZAcvr5X0v2R8sXMbQqKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A7t7JzNi4kgFqKQroBRWprrk15DOxcSmYhvqGLc+aNm0DfejS9RtsgBFlL1dYLcN7 95ahyGvyZoA4rS1VG2wBjJh9QI4jjChyZ/RoO2G6piUER2C2yfLElyjQyJghLiBbAD b3f+zB5hTFmch+fiDlp/CIMH25o+31XBNp/JU5cY= 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.10 065/563] media: atomisp: add missing media_device_cleanup() in atomisp_unregister_entities() Date: Mon, 24 Jan 2022 19:37:10 +0100 Message-Id: <20220124184026.656495527@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 fa1bd99cd6f17..d35506f643609 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E4FEC3526D for ; Tue, 25 Jan 2022 02:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234666AbiAYCmY (ORCPT ); Mon, 24 Jan 2022 21:42:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356738AbiAXUce (ORCPT ); Mon, 24 Jan 2022 15:32: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 E33F9C07E5FF; Mon, 24 Jan 2022 11:44: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 7FCDD6131E; Mon, 24 Jan 2022 19:44:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B22FC340E5; Mon, 24 Jan 2022 19:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053446; bh=3FxDnd5tdF3uG58BoU/HCrS2q0GC+iXbM6f0zyUjWJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z0OO7gRHPku2WuFIeJ6uI49TU335lnRs11KvnaTiSxE9yvcabTRm9TKeueXMwJMdv IOCiPxna8Huis2su7vCgps4y//kD03tnNKkbHsjv7oVGj3jVRHx0qCsjpQ5unr+fGa R5E6AFKxCfDBce/vzj2aTZaO22bM/uXfn6lo055Y= 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.10 066/563] media: atomisp: fix punit_ddr_dvfs_enable() argument for mrfld_power up case Date: Mon, 24 Jan 2022 19:37:11 +0100 Message-Id: <20220124184026.696478758@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 d35506f643609..687e94e8b6ce5 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2B8FC47082 for ; Mon, 24 Jan 2022 19:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358916AbiAXT4B (ORCPT ); Mon, 24 Jan 2022 14:56:01 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41648 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235574AbiAXToK (ORCPT ); Mon, 24 Jan 2022 14:44: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 A13F1612E9; Mon, 24 Jan 2022 19:44:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CBE4C340E5; Mon, 24 Jan 2022 19:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053449; bh=M0w/j3fopbUJv1GW0IRWTpurdgBProxxkpcgN9gt3wY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HAuGK29lqpbxv+5TyZE5aeUnMFZaQf4KYCa7gH7EH7b0D/U2quGTIv6kQ+/sjN8w4 g0QkOOcUDq93Q/KxAR2sYe/361j6TcATIRMpChkHyWfwHJW90UYPS27jlS3aMXQSVe hXtn8jAKSGnH2ytX+mbZxsIWSCLpyyYtDKE9nWos= 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.10 067/563] media: atomisp: fix inverted logic in buffers_needed() Date: Mon, 24 Jan 2022 19:37:12 +0100 Message-Id: <20220124184026.731329166@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 d5ae7f0b5864b..e18c0cfb4ce3a 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -389,17 +389,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67209C4167B for ; Mon, 24 Jan 2022 21:03:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444036AbiAXU7v (ORCPT ); Mon, 24 Jan 2022 15:59:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385528AbiAXUdd (ORCPT ); Mon, 24 Jan 2022 15:33: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 D0D1CC07E2A5; Mon, 24 Jan 2022 11:46: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 8D835B80FA1; Mon, 24 Jan 2022 19:46:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33416C340E5; Mon, 24 Jan 2022 19:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053576; bh=6q7akMoOu7vZzPEsqF6Fg9WZTu96aoc/XxkwCOP9z9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p2IHbHHoKHhB3GTgOkuwjytvyC3N1l8kQZDPiuciK7OaRLFrB49zptVv0xSoHloAs bQ62CLekAf7OxV/7ntSnRSgjuo/bz1auHX5LwjMMpIbpQgkHS+QdhGXGnzumuBRmjx aQZF+6T9WLJqcFzD9x7xI1Uxsi1mbKSOqTGOnwD0= 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.10 068/563] media: atomisp: do not use err var when checking port validity for ISP2400 Date: Mon, 24 Jan 2022 19:37:13 +0100 Message-Id: <20220124184026.761506784@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 e18c0cfb4ce3a..34b71c1b7c1ec 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -446,7 +446,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); @@ -578,7 +579,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); @@ -690,7 +692,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D2CFC433FE for ; Mon, 24 Jan 2022 20:57:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442884AbiAXUzh (ORCPT ); Mon, 24 Jan 2022 15:55:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385437AbiAXUdZ (ORCPT ); Mon, 24 Jan 2022 15:33: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 8FAC4C07E28D; Mon, 24 Jan 2022 11:44: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 4C7B6B81188; Mon, 24 Jan 2022 19:44:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 801D1C340E5; Mon, 24 Jan 2022 19:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053473; bh=DZ4Jp7C3DdKT3ZEr59HlmA50ha8hspxA4zx5neyeWA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fCOqmgjec7yZFZHloUnCOcALZPxRGkFZY+QsMuM7iMnSHMF1sHuUiPZ7T11vZkZoZ D8OLftCLJST5On+zSFYET84Cl8o08qplheG/KhE/sPAJ4EUbs1DCb+L3r7GeeItBcK cGCAzm53Wgxaca2ynBom++6F7UpY/ZfZY8ODfYyY= 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.10 069/563] media: atomisp: fix inverted error check for ia_css_mipi_is_source_port_valid() Date: Mon, 24 Jan 2022 19:37:14 +0100 Message-Id: <20220124184026.792914310@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../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 34b71c1b7c1ec..651eda0469b23 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -439,10 +439,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 @@ -572,10 +574,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 @@ -685,10 +689,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97911C41535 for ; Mon, 24 Jan 2022 19:57:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352417AbiAXT5Y (ORCPT ); Mon, 24 Jan 2022 14:57:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33092 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356057AbiAXTpK (ORCPT ); Mon, 24 Jan 2022 14:45: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 06209B8119D; Mon, 24 Jan 2022 19:45:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 220C7C340E5; Mon, 24 Jan 2022 19:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053506; bh=6oShnav0XEb7H1YaxcQhmuRS9xKP6Df8LCApCyXbdIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CQteU0QqMJmwKWpoRRi7RnAOnOP2cesYnQxxe8q0yC1kF7EJrd4Livh0bsT+8HQIU i3MtfR5e/OCPqpTMtr6VfPLhwym9kACS89AAIDgiHnyLfJUNy7ZQtAucCGmfVFG3wS MMjitEMpBAzyfw0D1vn92rtU4gLaMDLjH6bamuHk= 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.10 070/563] media: atomisp: fix ifdefs in sh_css.c Date: Mon, 24 Jan 2022 19:37:15 +0100 Message-Id: <20220124184026.832725144@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ddee04c8248d0..54a18921fbd15 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -527,6 +527,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) @@ -579,12 +580,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"); @@ -1019,16 +1016,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; } @@ -1451,7 +1446,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C0EFC3526E for ; Mon, 24 Jan 2022 23:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367637AbiAXX4D (ORCPT ); Mon, 24 Jan 2022 18:56:03 -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 S1846544AbiAXXQT (ORCPT ); Mon, 24 Jan 2022 18:16:19 -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 089DEC07E29E; Mon, 24 Jan 2022 11: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 dfw.source.kernel.org (Postfix) with ESMTPS id 9AFD261574; Mon, 24 Jan 2022 19:45:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C679C340E5; Mon, 24 Jan 2022 19:45:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053540; bh=HIAkzRqMWe56mqAJ9L6yapuAdhj1TTnDOc4KMkX8+Pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B2gHicUbZaTIestuWESUE+v+3BQYYl/jnDO3y2ccBNaA4aW6kcg1dKQi+sDo+TGle fiFZ+j5EH9MPy18T7kOKGJYV5AL9gcBb3aV2PgkSwgsRSXFP22WMbLNG3tuKb++yCl vltPmszj59MBgGw6+h7thcj4ezEFEzA5eT7PY7eQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aline Santana Cordeiro , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 071/563] media: staging: media: atomisp: pci: Balance braces around conditional statements in file atomisp_cmd.c Date: Mon, 24 Jan 2022 19:37:16 +0100 Message-Id: <20220124184026.861147087@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Aline Santana Cordeiro [ Upstream commit 0a016c35a326c6b2f558ede58ff08da7ef1da1a8 ] Balance braces around conditional statements. Issue detected by checkpatch.pl. It happens in if-else statements where one of the commands uses braces around a block of code and the other command does not since it has just a single line of code. Signed-off-by: Aline Santana Cordeiro Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../staging/media/atomisp/pci/atomisp_cmd.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/stag= ing/media/atomisp/pci/atomisp_cmd.c index 592ea990d4ca4..21cd03f06291d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -1138,9 +1138,10 @@ void atomisp_buf_done(struct atomisp_sub_device *asd= , int error, asd->frame_status[vb->i] =3D ATOMISP_FRAME_STATUS_OK; } - } else + } else { asd->frame_status[vb->i] =3D ATOMISP_FRAME_STATUS_OK; + } } else { asd->frame_status[vb->i] =3D ATOMISP_FRAME_STATUS_OK; } @@ -4945,9 +4946,9 @@ atomisp_try_fmt_file(struct atomisp_device *isp, stru= ct v4l2_format *f) =20 depth =3D get_pixel_depth(pixelformat); =20 - if (field =3D=3D V4L2_FIELD_ANY) + if (field =3D=3D V4L2_FIELD_ANY) { field =3D V4L2_FIELD_NONE; - else if (field !=3D V4L2_FIELD_NONE) { + } else if (field !=3D V4L2_FIELD_NONE) { dev_err(isp->dev, "Wrong output field\n"); return -EINVAL; } @@ -6587,17 +6588,17 @@ static int atomisp_get_pipe_id(struct atomisp_video= _pipe *pipe) { struct atomisp_sub_device *asd =3D pipe->asd; =20 - if (ATOMISP_USE_YUVPP(asd)) + if (ATOMISP_USE_YUVPP(asd)) { return IA_CSS_PIPE_ID_YUVPP; - else if (asd->vfpp->val =3D=3D ATOMISP_VFPP_DISABLE_SCALER) + } else if (asd->vfpp->val =3D=3D ATOMISP_VFPP_DISABLE_SCALER) { return IA_CSS_PIPE_ID_VIDEO; - else if (asd->vfpp->val =3D=3D ATOMISP_VFPP_DISABLE_LOWLAT) + } else if (asd->vfpp->val =3D=3D ATOMISP_VFPP_DISABLE_LOWLAT) { return IA_CSS_PIPE_ID_CAPTURE; - else if (pipe =3D=3D &asd->video_out_video_capture) + } else if (pipe =3D=3D &asd->video_out_video_capture) { return IA_CSS_PIPE_ID_VIDEO; - else if (pipe =3D=3D &asd->video_out_vf) + } else if (pipe =3D=3D &asd->video_out_vf) { return IA_CSS_PIPE_ID_CAPTURE; - else if (pipe =3D=3D &asd->video_out_preview) { + } else if (pipe =3D=3D &asd->video_out_preview) { if (asd->run_mode->val =3D=3D ATOMISP_RUN_MODE_VIDEO) return IA_CSS_PIPE_ID_VIDEO; else --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EA6EC43217 for ; Tue, 25 Jan 2022 00:07:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2369436AbiAYABp (ORCPT ); Mon, 24 Jan 2022 19:01:45 -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 S1384822AbiAXXR7 (ORCPT ); Mon, 24 Jan 2022 18:17: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 A723FC07E2A3; Mon, 24 Jan 2022 11:46: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 3E63EB8121A; Mon, 24 Jan 2022 19:45:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58D6FC340E5; Mon, 24 Jan 2022 19:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053558; bh=CvI9vnW7NM1a6sjHdHl4du6S2GHQ65vt/rNhml4gor0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ppRGhlpWTYL2sEdHnVE5Dh0X3o1tqruDfW3R9NIpBKoNsPDCbsESKYfGLyndBYLCA K13tD++MtGY7mEBWr+KH4qPjXliFOshudAJ+Q5H5IPBZnhSJYZbJPTIX9ZZ0qn3PVx HCjwt4zkQB+IKLEUv8C7QjqjXnN+fioX6n87eAEA= 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.10 072/563] media: atomisp: add NULL check for asd obtained from atomisp_video_pipe Date: Mon, 24 Jan 2022 19:37:17 +0100 Message-Id: <20220124184026.897865658@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../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 21cd03f06291d..90d50a693ce57 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; @@ -4856,6 +4880,12 @@ int atomisp_try_fmt(struct video_device *vdev, struc= t v4l2_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 @@ -5202,6 +5232,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( @@ -5513,6 +5549,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_format vformat =3D { @@ -5528,6 +5565,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); @@ -5618,6 +5661,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 @@ -6051,6 +6100,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", @@ -6375,6 +6430,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 @@ -6588,6 +6649,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) { @@ -6625,6 +6692,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 f1e6b25978534..52d24c1ca0d64 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 9da82855552de..35717a91cbd15 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0209EC433EF for ; Mon, 24 Jan 2022 20:07:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376921AbiAXUEf (ORCPT ); Mon, 24 Jan 2022 15:04:35 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41458 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356357AbiAXTqB (ORCPT ); Mon, 24 Jan 2022 14:46: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 6404361523; Mon, 24 Jan 2022 19:46:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71CA5C340E5; Mon, 24 Jan 2022 19:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053560; bh=7j4QYyMjm/9sgur3HyUzCNJo7/u+AvcMqUm5RnpUKDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YebtX/4f0QvuJGtFq6hjRKvuLArz7hN+eR5mtDbJrcaLAD4uFBIAujy+glhYAsdUG fdiEdxhTb8B4NczpKnjwktT7tRkafloBMb9FyisiWgf74KNQ6BS0Uw2xI6+jvMn1d7 EqfI8aZxwVNkllNXRF9zyFH26dU5z1aKjPP3ufTY= 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.10 073/563] media: atomisp: fix enum formats logic Date: Mon, 24 Jan 2022 19:37:18 +0100 Message-Id: <20220124184026.929304775@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../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 35717a91cbd15..830df02626634 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3478C433EF for ; Mon, 24 Jan 2022 20:04:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353138AbiAXUEO (ORCPT ); Mon, 24 Jan 2022 15:04:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:36948 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356391AbiAXTqG (ORCPT ); Mon, 24 Jan 2022 14:46: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 ED4EFB8121A; Mon, 24 Jan 2022 19:46:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DF38C340E5; Mon, 24 Jan 2022 19:46:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053563; bh=6ip6A0h5hrMAi23ynIfiqNaHv6NylR563ug94IIyhyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b6ZvJpVVXj+jpLSq2/Q7cTVxfB/ir2EWme5o7Rn+6qnbDGjC2NDCTzfD//T6gRJJo 0b9SJx3/pGwvSZrsAFM0F+petkRoU7aOPWUEl385wAzKOqMJxjtX31JMOuFXl6KTxf +rGW+5fgQKrg+FovNjM/yafoQGU1bvmoLTmmJcqs= 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.10 074/563] media: atomisp: fix uninitialized bug in gmin_get_pmic_id_and_addr() Date: Mon, 24 Jan 2022 19:37:19 +0100 Message-Id: <20220124184026.960692562@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 135994d44802c..34480ca164746 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5608DC433EF for ; Mon, 24 Jan 2022 20:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443239AbiAXU4c (ORCPT ); Mon, 24 Jan 2022 15:56:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348495AbiAXUdd (ORCPT ); Mon, 24 Jan 2022 15:33: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 B6510C07E2A4; Mon, 24 Jan 2022 11:46: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 53F9D614BB; Mon, 24 Jan 2022 19:46:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AB7FC340E5; Mon, 24 Jan 2022 19:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053566; bh=nkRbVp2W10K033deshM2ceJteFE6A6KthK5vUO20h1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m4RcX5T7eP7DrQh29Q5oSSF4NcGcRVZN3eyv8u2I89JegiLwl8ASuEN7cCSl6QgaY ceXzorXhbyDwH3JZ565zYB8498EY9Pi+2UmVtwi3m3dlp4C6oVGqvNBizUt6fqUBD1 QWHiMWbKzoRTCMkWeGZ7H1yf3w3hmu+HR+o0I/E0= 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.10 075/563] media: aspeed: fix mode-detect always time out at 2nd run Date: Mon, 24 Jan 2022 19:37:20 +0100 Message-Id: <20220124184026.991814372@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 7bb6babdcade0..23c41c545c536 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -500,6 +500,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); } @@ -786,10 +790,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D229C433EF for ; Mon, 24 Jan 2022 20:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345717AbiAXUD6 (ORCPT ); Mon, 24 Jan 2022 15:03:58 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37030 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356421AbiAXTqM (ORCPT ); Mon, 24 Jan 2022 14:46: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 1EC4DB8122A; Mon, 24 Jan 2022 19:46:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FE1BC340E5; Mon, 24 Jan 2022 19:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053569; bh=CilhLBgCJlcnOoNau8LRQawIH8ihBF0Ww7tvfGee2IE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eXTV7CBzCoErAJqo6OG23lobKpM1MafxaWHLujdKmyx6C0iSNUu1uT1J9it30XQfy DfIUNQBdXi5J4DxwlcPsTNZ1d6+t6M+MQUbafsuW7PUMzgPt7/kwEB7AKdbH4Rd+lB QAjy/s4g7WaMLg3YNjTkccJKIUFlPvTP1kzQ/YeA= 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.10 076/563] media: em28xx: fix memory leak in em28xx_init_dev Date: Mon, 24 Jan 2022 19:37:21 +0100 Message-Id: <20220124184027.022405066@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 cf45cc566cbe2..87e375562dbb2 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -3575,8 +3575,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; @@ -3595,7 +3597,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 */ @@ -3611,9 +3613,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 @@ -3621,6 +3621,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48C14C433F5 for ; Mon, 24 Jan 2022 20:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376810AbiAXUEF (ORCPT ); Mon, 24 Jan 2022 15:04:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43560 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356432AbiAXTqP (ORCPT ); Mon, 24 Jan 2022 14:46: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 56D88614BB; Mon, 24 Jan 2022 19:46:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 658C6C340E5; Mon, 24 Jan 2022 19:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053572; bh=k3U219NtxpqvwwJsFdcR9puEAbmjM0wOQedBtfEhGzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zfouQ9pJwVnbpRd8KTwVPyxtqMyQeMdK98wHZ2xskwb2m1L3m6S17Mi4XGO748JnR R3qr7glQZPFNXjk7xArWVmhAcEtMsKVP24gxUBmk9FhX6RqBtiDKK36WrwsgRPOF1h tQfW6M98ClyLMqXpnLxkkY37zyn99GLGTZ0+/yoo= 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.10 077/563] media: aspeed: Update signal status immediately to ensure sane hw state Date: Mon, 24 Jan 2022 19:37:22 +0100 Message-Id: <20220124184027.052803371@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 23c41c545c536..debc7509c173c 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -556,6 +556,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 @@ -1337,7 +1339,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 @@ -1350,8 +1351,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FB41C41535 for ; Mon, 24 Jan 2022 23:59:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367577AbiAXXzz (ORCPT ); Mon, 24 Jan 2022 18:55:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846536AbiAXXQT (ORCPT ); Mon, 24 Jan 2022 18:16:19 -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 9C8C9C061776; Mon, 24 Jan 2022 11:44: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 63AADB81188; Mon, 24 Jan 2022 19:44:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89A6DC340E5; Mon, 24 Jan 2022 19:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053476; bh=QoKvG1rlfkeJTxGZcwcVqHKO30I0UMzibYlNdPulq9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Djphgox4RyKxVMLn3zWItsgd0et0rAZJVQWsJoUXTx+o2P7zzRhyq/Skv1GrJaO/I BLwWKw2b6/W9hBxqrEQobLACHUpBXGNy0yL6i+O0XrcW7XuG5eOz8hf8Pzp9ooroXG yBYPXwQ/gwwifN+I/n2m7WOWqxpqIOv1pz5XkGzo= 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.10 078/563] arm64: dts: amlogic: meson-g12: Fix GPU operating point table node name Date: Mon, 24 Jan 2022 19:37:23 +0100 Message-Id: <20220124184027.090788992@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 959b299344e54..7342c8a2b322d 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi @@ -52,7 +52,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24581C433EF for ; Mon, 24 Jan 2022 20:57:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442943AbiAXUzs (ORCPT ); Mon, 24 Jan 2022 15:55:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385438AbiAXUdZ (ORCPT ); Mon, 24 Jan 2022 15:33: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 99F15C061778; Mon, 24 Jan 2022 11:44: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 41BF6B811F9; Mon, 24 Jan 2022 19:44:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 728DEC340E5; Mon, 24 Jan 2022 19:44:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053479; bh=pvYtC9heZmM5zQOv9q7on2eqOlXb2uSoAf+0nnGKKhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LdHQX2LUybndc6dnFgiE+7H2H7Ciq7BC2CXBtdgpjmrbXOM+HnomuCJTXmcKMfLRL 3sQsQfWv+UbLjQmcc+k8WVTPtoLhiJZpq7gYBSbhbk/h7Q1nyuxal50P5WEkXlaXxf bbMIgGkscT+5tYIifwzt3KKIv4uJsSDXLC4zOJx4= 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.10 079/563] arm64: dts: amlogic: Fix SPI NOR flash node name for ODROID N2/N2+ Date: Mon, 24 Jan 2022 19:37:24 +0100 Message-Id: <20220124184027.122575755@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 59b5f39088757..b9b8cd4b5ba9d 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi @@ -543,7 +543,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA3F7C47081 for ; Mon, 24 Jan 2022 19:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358984AbiAXT4H (ORCPT ); Mon, 24 Jan 2022 14:56:07 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42216 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351146AbiAXToo (ORCPT ); Mon, 24 Jan 2022 14:44: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 B1CA06153F; Mon, 24 Jan 2022 19:44:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E5AFC340E5; Mon, 24 Jan 2022 19:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053482; bh=m1F5fWtgDM8E6XKmaqCuV0mNrGXhTgIpzHKN+ItcTok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BuhWMXcfaCx2Do6tF3X+S/6OHP76J9g7cKEAv+8cm5engwBoMPFxeJ7wZAtpCZUg7 WCQtaOwOGaRRiIYNusOSr7fjHu3gn/lgaJWJmylE/NISTYN/ZA1jyau/j75xBs9bJQ 0HAPUnSZp296lS4drlywgLmmkPi06mH3rIU1Uxoc= 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.10 080/563] arm64: dts: meson-gxbb-wetek: fix HDMI in early boot Date: Mon, 24 Jan 2022 19:37:25 +0100 Message-Id: <20220124184027.154017982@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A640BC433F5 for ; Mon, 24 Jan 2022 20:57:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442915AbiAXUzn (ORCPT ); Mon, 24 Jan 2022 15:55:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385441AbiAXUdZ (ORCPT ); Mon, 24 Jan 2022 15:33: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 D14A9C07E290; Mon, 24 Jan 2022 11:44: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 98983B811F9; Mon, 24 Jan 2022 19:44:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AEBCC340E5; Mon, 24 Jan 2022 19:44:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053485; bh=V3QOwk8IW3ZkXrK9Ww4HIPJ27Oj/Lc/7eiEjo3TghfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rtxeIdxAQEIM9Nv6xRJF8kgLefuT/gV5EGqFruzRrLY0ZC9IRkLpW7+Ux79Z8TrXT e1Zn2Ps7+951XoiuHRBuoA4SpiikV8jHwShKmltNT3qV2F5Gz8g7Xwuk6rkpjI8oCF RwoLh/zb871gRX+5xVwTeCxHQulbO4cde7Uq3uAg= 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.10 081/563] arm64: dts: meson-gxbb-wetek: fix missing GPIO binding Date: Mon, 24 Jan 2022 19:37:26 +0100 Message-Id: <20220124184027.185132482@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB69DC4167E for ; Mon, 24 Jan 2022 19:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359099AbiAXT4U (ORCPT ); Mon, 24 Jan 2022 14:56:20 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42288 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355616AbiAXTot (ORCPT ); Mon, 24 Jan 2022 14:44: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 D281F6131E; Mon, 24 Jan 2022 19:44:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B42F0C340E5; Mon, 24 Jan 2022 19:44:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053488; bh=NnJCk13Goff3H48BL/psmetMcVRnOhKs9tjpoNimvyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Llk8SmJq92rKeW6AZaHFsfJdltP6EGS6M6H3VK+b5avkxSssInGvzbXeaRF7zxPzO zStG3xtS4YUsuif39s8fVIRDW9rFFoiQurU4AV4PRsu9fXHlinzcPhug7vJNwObaVe Nw5z2swwxhPtNLBCTttXnE1zvKWiuaOVr/AVLOmU= 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.10 082/563] fs: dlm: use sk->sk_socket instead of con->sock Date: Mon, 24 Jan 2022 19:37:27 +0100 Message-Id: <20220124184027.228849912@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 feb704bd17786c8ff52a49d7759b8ee4f3a5aaac ] Instead of dereference "con->sock" we can get the socket structure over "sk->sk_socket" as well. This patch will switch to this behaviour. Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/dlm/lowcomms.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 0c78fdfb1f6fa..0a8645ed4b2d6 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -480,8 +480,7 @@ static void lowcomms_error_report(struct sock *sk) goto out; =20 orig_report =3D listen_sock.sk_error_report; - if (con->sock =3D=3D NULL || - kernel_getpeername(con->sock, (struct sockaddr *)&saddr) < 0) { + 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(), --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08B44C35274 for ; Mon, 24 Jan 2022 19:57:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359120AbiAXT4Y (ORCPT ); Mon, 24 Jan 2022 14:56:24 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42338 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355904AbiAXTow (ORCPT ); Mon, 24 Jan 2022 14:44: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 D41D261580; Mon, 24 Jan 2022 19:44:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD5B7C340E5; Mon, 24 Jan 2022 19:44:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053491; bh=ty/c4Xr/kZ4MbTdJky40oPoCWuNTe/37Omk9gFOa5/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K/oGMa7GywjgpGXtaZTZI+2LkOiKvVURSL/cDWY/+fGjn80HFCE4pb1r3EzMlK2Qn tRoJvEhMQDYBPEKoxd6IxItCJ0Ew5zur6eUUW5mYF4QjXREwpdg0IKfczSlQZ99TA0 NtysqZjzo1iTxbRfooIzC+BUSk0SMvC5wDK/UCMk= 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.10 083/563] fs: dlm: dont call kernel_getpeername() in error_report() Date: Mon, 24 Jan 2022 19:37:28 +0100 Message-Id: <20220124184027.266714053@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 0a8645ed4b2d6..904855fa20655 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -471,8 +471,8 @@ int dlm_lowcomms_connect_node(int nodeid) 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); @@ -480,33 +480,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; } out: read_unlock_bh(&sk->sk_callback_lock); --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A719C2BA4C for ; Mon, 24 Jan 2022 23:59:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367605AbiAXX4A (ORCPT ); Mon, 24 Jan 2022 18:56:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846559AbiAXXQT (ORCPT ); Mon, 24 Jan 2022 18:16:19 -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 C9CCBC07E291; Mon, 24 Jan 2022 11:44: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 854D7B81188; Mon, 24 Jan 2022 19:44:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B728C340E5; Mon, 24 Jan 2022 19:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053494; bh=XkwDeNlHci496NYmFmsJJ6uvx9eXXONCTwinhOIY5r4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SFAuqllBdpTTuMW232PXkvT+5rgm49lZi5wMGf11jpdQOPSNMGHSpHYVOSk8JoTBL lMVr3exZE5IPc5tsCyRUiAY+kMvEJvmrJqBY6OqrrqvNctyJRQAXT8m3xsoQ2nuYOP 3DZwEpUNSoe1IFqMTxl8WdJRuSxRQFctR7p2Exnk= 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.10 084/563] memory: renesas-rpc-if: Return error in case devm_ioremap_resource() fails Date: Mon, 24 Jan 2022 19:37:29 +0100 Message-Id: <20220124184027.303523032@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a760ab08256ff..9019121a80f53 100644 --- a/drivers/memory/renesas-rpc-if.c +++ b/drivers/memory/renesas-rpc-if.c @@ -245,7 +245,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25FEDC2BA4C for ; Mon, 24 Jan 2022 19:57:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359187AbiAXT4e (ORCPT ); Mon, 24 Jan 2022 14:56:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42426 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355942AbiAXTo6 (ORCPT ); Mon, 24 Jan 2022 14: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 dfw.source.kernel.org (Postfix) with ESMTPS id F1E3F60909; Mon, 24 Jan 2022 19:44:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC4EBC340E5; Mon, 24 Jan 2022 19:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053497; bh=QjC/tPhb2AT1wpeW0EUSSIwTPy+Ku5oRwIix5WNNPZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gfw4wwqNSDk1Yo+1wG1rHIJMUFb1VHvo0fwEE5AKOUfF+RZzQFAFXwcMr3RGqLKGE qQv4aueoz4PpP9oaPjhp8hN1uZrIgAkjMuhUsUrRX8USLwyWSujKLgWaxPNODezTbT QlMP7heA6C7lIjuyEycwETVgFaNNYVYqC332ywCM= 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.10 085/563] Bluetooth: stop proccessing malicious adv data Date: Mon, 24 Jan 2022 19:37:30 +0100 Message-Id: <20220124184027.342260846@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 9f52145bb7b76..7ffcca9ae82a1 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -5661,7 +5661,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, @@ -5671,6 +5672,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAB5CC433FE for ; Tue, 25 Jan 2022 00:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2370580AbiAYAFe (ORCPT ); Mon, 24 Jan 2022 19:05:34 -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 S1846538AbiAXXQT (ORCPT ); Mon, 24 Jan 2022 18:16:19 -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 98003C07E292; Mon, 24 Jan 2022 11:45: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 36E6A61482; Mon, 24 Jan 2022 19:45:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05D33C340E5; Mon, 24 Jan 2022 19:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053500; bh=KNMqk2/v7Cqb3mKBohF9ykocCHVkYYWvinM/tQw+06A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OcUtSl0sfffGp8Nnu7XhPh5z4QFcEHs5GTRNdSiD1jl62diX86UjWRdxuYVbiVeFo Mjr8CY8sGx1hXfQNDFljYF3KbVLufCtzMIQVYuMNi4FjkRIrbyNLf44bViTQcIxm5M F/mU1v/pWbkLO/Q77kcFl+CwzxaZiF16+p+QrZqY= 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.10 086/563] ath11k: Fix ETSI regd with weather radar overlap Date: Mon, 24 Jan 2022 19:37:31 +0100 Message-Id: <20220124184027.375883183@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 b8f9f34408879..e34311516b958 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95A1EC3525A for ; Mon, 24 Jan 2022 21:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444426AbiAXVA4 (ORCPT ); Mon, 24 Jan 2022 16:00:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385440AbiAXUdZ (ORCPT ); Mon, 24 Jan 2022 15:33: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 13F94C07E293; Mon, 24 Jan 2022 11:45: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 D09A6B81188; Mon, 24 Jan 2022 19:45:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05E06C340E5; Mon, 24 Jan 2022 19:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053503; bh=cyEpis7cdHp2yQhSzlz5kj4WBDYG6wah1Bg5GbBcldQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sN0blTtYlIOxxty8vxeSVJeTSguuAnZ4vj0hy8fAkxuYQNUNMarQQWWmYmmXX5/8k HbP9H789XMwcWKIp77YcKAcPPo3hrQf1UBQx9ruGRXuLg5shrZ4+OqMrpEphpOfbAI Q514LlppqjaHAB3TI62bRAmWse2OLvmCFFTrJJhM= 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.10 087/563] ath11k: clear the keys properly via DISABLE_KEY Date: Mon, 24 Jan 2022 19:37:32 +0100 Message-Id: <20220124184027.407123622@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 0924bc8b35205..304e158f09751 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -2395,9 +2395,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 e84127165d858..acf1641ce88fd 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -1665,7 +1665,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12E56C433EF for ; Mon, 24 Jan 2022 21:03:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444394AbiAXVAu (ORCPT ); Mon, 24 Jan 2022 16:00:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385443AbiAXUdZ (ORCPT ); Mon, 24 Jan 2022 15:33: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 CBD2BC07E294; Mon, 24 Jan 2022 11:45: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 6861261482; Mon, 24 Jan 2022 19:45:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29597C340E5; Mon, 24 Jan 2022 19:45:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053509; bh=WCqmV5V7bA9Ezs5dDtJnZCm+j+H3lnDU0oaDy3hIKIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QnGnXvNoylRzfJge4HSOq5tlA7cfwyuBCZ4VqET7tJgWkLgDXxWPQQR8lHoI6kAzz Q8DGzxvORENUE6X+sbRgzB9hMNehrsTcEQXwHcd77X5SiBwl5pSOeTZgzdj2wm1KxX G0bHa8Gon9oHj2L/GbaIKRnWyRHUchylSxYBowMs= 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.10 088/563] ath11k: reset RSN/WPA present state for open BSS Date: Mon, 24 Jan 2022 19:37:33 +0100 Message-Id: <20220124184027.439684369@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 304e158f09751..b4f8494e3c707 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -792,11 +792,15 @@ static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vi= f *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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FE3EC433EF for ; Mon, 24 Jan 2022 19:57:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352621AbiAXT5a (ORCPT ); Mon, 24 Jan 2022 14:57:30 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:36504 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356100AbiAXTpP (ORCPT ); Mon, 24 Jan 2022 14: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 ams.source.kernel.org (Postfix) with ESMTPS id 2780FB810AF; Mon, 24 Jan 2022 19:45:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 494DCC340E5; Mon, 24 Jan 2022 19:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053512; bh=ZtKeDD/iUB+vymXfA70PorhyhrKwFGMPyIFP8fSH8eU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YNNwpqZVCeuVVzZ45zdatq7U4goI4tTy1JrWn0TQWFSkxzhcDsx+BrPCt7rdno3CB okDd2HI2a9afiWICQ93fIptc/xSVUno6cGTFSzJDrreBBcjY9bsMLQbMj4NJ7Mfoph EZNbfJsU0ZkFfUIX6RLisLvjcYitHSTPKM+/BP1E= 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.10 089/563] tee: fix put order in teedev_close_context() Date: Mon, 24 Jan 2022 19:37:34 +0100 Message-Id: <20220124184027.476119292@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 6ade4a5c48407..dfc239c64ce3c 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 295F1C433EF for ; Mon, 24 Jan 2022 20:58:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443643AbiAXU5z (ORCPT ); Mon, 24 Jan 2022 15:57:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385447AbiAXUdZ (ORCPT ); Mon, 24 Jan 2022 15:33: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 58718C07E295; Mon, 24 Jan 2022 11:45: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 1E811B811F9; Mon, 24 Jan 2022 19:45:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A8B1C340E5; Mon, 24 Jan 2022 19:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053515; bh=gcY9DkbISMBEQVO3JWGLuPtvD2jNfR5mUs7pmMfGqp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XQq/i58M3cRtCSrXbkHYImmDkdBrv1QJxoiTsHiFF1sLePUyH3FBsgzA5o+knmRYz 52QCbxoJkPeHcV4C97s5jdzMEIbmdvRuAzXPbUmdoQeAz/3Nas6AWCFc3BZ/R2asDt BRujlyTUHPlD91okkbehwe0+yYUjLCuZW+65knR0= 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.10 090/563] fs: dlm: fix build with CONFIG_IPV6 disabled Date: Mon, 24 Jan 2022 19:37:35 +0100 Message-Id: <20220124184027.507660188@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/dlm/lowcomms.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 904855fa20655..68b765369c928 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -491,6 +491,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, " @@ -499,6 +500,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D7E6C2BA4C for ; Mon, 24 Jan 2022 20:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357838AbiAXU6F (ORCPT ); Mon, 24 Jan 2022 15:58:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385446AbiAXUdZ (ORCPT ); Mon, 24 Jan 2022 15:33: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 593A9C07E296; Mon, 24 Jan 2022 11: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 15C62B81188; Mon, 24 Jan 2022 19:45:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DE49C340E5; Mon, 24 Jan 2022 19:45:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053518; bh=7X518gYPa/yoX6heLriG4edfkEp/un6Wnm5Rw2reZr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pz/sUKi7kgIpgWuPsYXsV8nCcCcs6CeJNBrGJo3wWn0a0alescDULptnE05ABuYZd aqfvaRl5XZ6tcxqC0cJGo3/c8v/xWzyj8XC+JcTJACPDV8IQBtHF5oaticY9uRONIE F7Y47iZKWt5Q3AxYQUpWjunFb2XKupSpdgib9xQc= 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.10 091/563] drm/vboxvideo: fix a NULL vs IS_ERR() check Date: Mon, 24 Jan 2022 19:37:36 +0100 Message-Id: <20220124184027.538833367@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 d68d9bad76747..c5ea880d17b29 100644 --- a/drivers/gpu/drm/vboxvideo/vbox_main.c +++ b/drivers/gpu/drm/vboxvideo/vbox_main.c @@ -123,8 +123,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C127C433EF for ; Mon, 24 Jan 2022 20:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347015AbiAXUCm (ORCPT ); Mon, 24 Jan 2022 15:02:42 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:36580 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356163AbiAXTpZ (ORCPT ); Mon, 24 Jan 2022 14:45: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 685D2B811FB; Mon, 24 Jan 2022 19:45:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53B33C340E5; Mon, 24 Jan 2022 19:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053522; bh=lvp0Le3VVEXhImapXju5LURgBY2c/1oUn9iXm9ZTrnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xrodRqKGzMmsSPIgwegH+berXkU3AxZCFsqXI0ZJr6E8NvAmiH/sJIwntkAXp5Koq OWw6VYmVWKLGn00YJeqBikK6/3u9x6x69uvhSM9Aaw6AdrayMGp5wBfI7EKeYkljn9 BRgpbboYUXklPq2c6ZaO2qn5rbAsaLpX5eSNRDD8= 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.10 092/563] arm64: dts: renesas: cat875: Add rx/tx delays Date: Mon, 24 Jan 2022 19:37:37 +0100 Message-Id: <20220124184027.576429720@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 801ea54b027c4..20f8adc635e72 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 737C7C2BA4C for ; Mon, 24 Jan 2022 21:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444353AbiAXVAn (ORCPT ); Mon, 24 Jan 2022 16:00:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385459AbiAXUd0 (ORCPT ); Mon, 24 Jan 2022 15:33: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 B9036C07E297; Mon, 24 Jan 2022 11:45: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 75097B8121A; Mon, 24 Jan 2022 19:45:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 839AAC340E5; Mon, 24 Jan 2022 19:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053525; bh=qne+I7FLNYBtN/84TB3R3SwarzcOPorxaSIPNuVN8VA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RFBFuJKrTjct5kM2obhGF6dcGWsM782nIl9sjwBaVBFSJHVzdAJFpu4IzFGBOZvRv HRy5n8U3eFf2B9e6JLS8rUO4VZRGufnNChC1t2fDFoFrwvhmsbDec0XSLAaCI8LL2i DPnNx5GNkspOP642pJXITSLHBGY0ckDHWfixfDY4= 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.10 093/563] media: dmxdev: fix UAF when dvb_register_device() fails Date: Mon, 24 Jan 2022 19:37:38 +0100 Message-Id: <20220124184027.608351413@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 f14a872d12687..e58cb8434dafe 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BE0FC4332F for ; Mon, 24 Jan 2022 20:58:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386157AbiAXU5x (ORCPT ); Mon, 24 Jan 2022 15:57:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385460AbiAXUdZ (ORCPT ); Mon, 24 Jan 2022 15:33: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 C0709C07E298; Mon, 24 Jan 2022 11:45: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 63F9CB8121C; Mon, 24 Jan 2022 19:45:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B47BC340E5; Mon, 24 Jan 2022 19:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053528; bh=pE1XdxEVbHz1gSf4Rh3y/sVw7bmiKe/EQ7YVF+zJq5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FKkgEJFzRGEL57v35D7eUeYWLHv/a1VTyX8kXeAix1+XuntmjBi8wVIK93vUJi/7s ghlGMWZxbkHq8QOER5NpQnSi4Yaqkjz4fEQ4gHxVmjx2GvWfQ/Plhn4+SkvU8qHFQw AvXsUQ2n5qIKpqkYZ2Y4Y5hJKVCXYZgLLuKQ2w98= 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.10 094/563] crypto: qce - fix uaf on qce_ahash_register_one Date: Mon, 24 Jan 2022 19:37:39 +0100 Message-Id: <20220124184027.640121536@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 87be96a0b0bba..8b4e79d882af4 100644 --- a/drivers/crypto/qce/sha.c +++ b/drivers/crypto/qce/sha.c @@ -533,8 +533,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A78D8C433EF for ; Mon, 24 Jan 2022 21:03:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444252AbiAXVAa (ORCPT ); Mon, 24 Jan 2022 16:00:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385496AbiAXUd2 (ORCPT ); Mon, 24 Jan 2022 15:33: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 39485C07E29B; Mon, 24 Jan 2022 11:45: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 CAB1E614BB; Mon, 24 Jan 2022 19:45:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85CC6C340E5; Mon, 24 Jan 2022 19:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053531; bh=3iWwg8e1KuopegIVmxifFJj+LtngWeTGHSKF5ocX5MU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rtA4i7Ycp8qRBza/IQjL9h1aVYn+XPtxXoSD66emV0zxbNGyaGfp97sv7//mEbEQC wnEGEmImZgaQnZ6vbyfQkrmkSMitMiJPops1BmPTB8GUsGe+noK58dycsKyWYyKs7p MIeFx2tSyoHqB+JChSapVduMxrVxUnQlu7jWKVuk= 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.10 095/563] crypto: qce - fix uaf on qce_skcipher_register_one Date: Mon, 24 Jan 2022 19:37:40 +0100 Message-Id: <20220124184027.676965026@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 d8053789c8828..89c7fc3efbd71 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c @@ -433,8 +433,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 453CCC433FE for ; Mon, 24 Jan 2022 20:57:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443037AbiAXU4J (ORCPT ); Mon, 24 Jan 2022 15:56:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385519AbiAXUd3 (ORCPT ); Mon, 24 Jan 2022 15:33: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 AD6C6C07E29C; Mon, 24 Jan 2022 11:45: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 75015B8121C; Mon, 24 Jan 2022 19:45:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1FDCC340E7; Mon, 24 Jan 2022 19:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053534; bh=fDKZb5ZOGOoDpGNIT4AzWS/7B5dYfdm2X4IfhgXunug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oUICPZLcKgdJfChlXS8m6A2zomMTIkFzTd0C9bZjWsyXNXw93OJqeWE8nPz5Q0IBB AjcZEAxtbeTOhtznPG7ZdGIkB9TN7ecxQa2pw6TTzRWHKq0eBx2Ny5aFjRv/1SiU7V uMI/bm/dTa4uUjET5jVWw0xEzrxm+5XJydqclrB4= 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.10 096/563] mtd: hyperbus: rpc-if: fix bug in rpcif_hb_remove Date: Mon, 24 Jan 2022 19:37:41 +0100 Message-Id: <20220124184027.714831597@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 392D1C433FE for ; Tue, 25 Jan 2022 00:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371294AbiAYAH1 (ORCPT ); Mon, 24 Jan 2022 19:07:27 -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 S1384835AbiAXXR5 (ORCPT ); Mon, 24 Jan 2022 18:17: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 AD13AC07E29D; Mon, 24 Jan 2022 11:45: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 532CFB811F9; Mon, 24 Jan 2022 19:45:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96353C340E7; Mon, 24 Jan 2022 19:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053537; bh=zLZtC7ypmlhH1omlZOAIcSh+uqnfUwqd1cdnR2k5tXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XAwG/kpC3nqnV8BAj6RaC34rh20c/qVQ0Iu00D5xToecRFIG7nbSwojILj3zrLuBa Jp3yankdjIq/QPgB6lnWo6mzr1u1ncwP1gG7yYsOI/BNU4J5zXytQaoiNYCTQOp373 2hqfJG0ByNgYTtuQHBpNFNtnQypypcKbUwdi8uJI= 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.10 097/563] ARM: dts: stm32: fix dtbs_check warning on ili9341 dts binding on stm32f429 disco Date: Mon, 24 Jan 2022 19:37:42 +0100 Message-Id: <20220124184027.754939919@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62E22C433F5 for ; Mon, 24 Jan 2022 20:57:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443019AbiAXU4E (ORCPT ); Mon, 24 Jan 2022 15:56:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385518AbiAXUd3 (ORCPT ); Mon, 24 Jan 2022 15:33: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 30F8DC07E2A0; Mon, 24 Jan 2022 11:45: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 BDFD96135E; Mon, 24 Jan 2022 19:45:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CD21C340E5; Mon, 24 Jan 2022 19:45:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053543; bh=xRnyQmwYcD9vW2Ti96mi22e8rUe5cVVNvbs1/irgqsc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UnXDZXPKm8O758/O6CbmKUw8mw5pfs8wjU0OrIdL+jPB+JPLFBn+/qHWNwW0nEYDJ 3Neaoy6j4dKE1sZ7KhRa10TnvN3rR/TM9ZhuYTcbBl3q1ZCcizaOfL0Urw3Kna5JTk KiDntC9pxVo5p7ztVVbzI1rYIdOKxedl1uGhpuEk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bhaskar Chowdhury , Giovanni Cabiddu , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 098/563] crypto: qat - fix spelling mistake: "messge" -> "message" Date: Mon, 24 Jan 2022 19:37:43 +0100 Message-Id: <20220124184027.789163111@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bhaskar Chowdhury [ Upstream commit f17a25cb1776c5712e950aaf326528ae652a086c ] Trivial fix to spelling mistake in adf_pf2vf_msg.c and adf_vf2pf_msg.c. s/messge/message/ Signed-off-by: Bhaskar Chowdhury Signed-off-by: Giovanni Cabiddu Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 2 +- drivers/crypto/qat/qat_common/adf_vf2pf_msg.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto= /qat/qat_common/adf_pf2vf_msg.c index d7ca222f0df18..e3da97286980e 100644 --- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c @@ -176,7 +176,7 @@ out: * @msg: Message to send * @vf_nr: VF number to which the message will be sent * - * Function sends a messge from the PF to a VF + * Function sends a message from the PF to a VF * * Return: 0 on success, error code otherwise. */ diff --git a/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c b/drivers/crypto= /qat/qat_common/adf_vf2pf_msg.c index 54b738da829d8..3e25fac051b25 100644 --- a/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c +++ b/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c @@ -8,7 +8,7 @@ * adf_vf2pf_notify_init() - send init msg to PF * @accel_dev: Pointer to acceleration VF device. * - * Function sends an init messge from the VF to a PF + * Function sends an init message from the VF to a PF * * Return: 0 on success, error code otherwise. */ @@ -31,7 +31,7 @@ EXPORT_SYMBOL_GPL(adf_vf2pf_notify_init); * adf_vf2pf_notify_shutdown() - send shutdown msg to PF * @accel_dev: Pointer to acceleration VF device. * - * Function sends a shutdown messge from the VF to a PF + * Function sends a shutdown message from the VF to a PF * * Return: void */ --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48E85C433EF for ; Mon, 24 Jan 2022 20:57:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442998AbiAXU4A (ORCPT ); Mon, 24 Jan 2022 15:56:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385517AbiAXUd3 (ORCPT ); Mon, 24 Jan 2022 15:33: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 CF816C07E2A1; Mon, 24 Jan 2022 11:45: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 8A2C1B811F9; Mon, 24 Jan 2022 19:45:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA6F8C340E5; Mon, 24 Jan 2022 19:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053546; bh=Hf36ntOYAnKrh82bMACnxeu8gNHCeUCilXw7+onLIuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cvloL0rqGFmtYY2Nb2rQfe54ESQocfr5+M65dvmGgHItY5fcb86QBw/pgPoS4nffO cnpeNI03GJ6/MDkJqRbnwFTkpusml8Z/FyLyD41AfRlGkf8PIRuNHV+sI/Lg+3hToJ 9qJ+p898kRoDbj7wb4EZ50Lw5nn/y0aqlPxayJE8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marco Chiappero , Giovanni Cabiddu , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 099/563] crypto: qat - remove unnecessary collision prevention step in PFVF Date: Mon, 24 Jan 2022 19:37:44 +0100 Message-Id: <20220124184027.824746602@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marco Chiappero [ Upstream commit e17f49bb244a281fe39bfdad0306a38b3a02e7bf ] The initial version of the PFVF protocol included an initial "carrier sensing" to get ownership of the channel. Collisions can happen anyway, the extra wait and test does not prevent collisions, it instead slows the communication down, so remove it. Signed-off-by: Marco Chiappero Reviewed-by: Giovanni Cabiddu Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto= /qat/qat_common/adf_pf2vf_msg.c index e3da97286980e..d1dbf6216de57 100644 --- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c @@ -120,28 +120,10 @@ static int __adf_iov_putmsg(struct adf_accel_dev *acc= el_dev, u32 msg, u8 vf_nr) goto out; } =20 - /* Attempt to get ownership of PF2VF CSR */ msg &=3D ~local_in_use_mask; msg |=3D local_in_use_pattern; - ADF_CSR_WR(pmisc_bar_addr, pf2vf_offset, msg); =20 - /* Wait in case remote func also attempting to get ownership */ - msleep(ADF_IOV_MSG_COLLISION_DETECT_DELAY); - - val =3D ADF_CSR_RD(pmisc_bar_addr, pf2vf_offset); - if ((val & local_in_use_mask) !=3D local_in_use_pattern) { - dev_dbg(&GET_DEV(accel_dev), - "PF2VF CSR in use by remote - collision detected\n"); - ret =3D -EBUSY; - goto out; - } - - /* - * This function now owns the PV2VF CSR. The IN_USE_BY pattern must - * remain in the PF2VF CSR for all writes including ACK from remote - * until this local function relinquishes the CSR. Send the message - * by interrupting the remote. - */ + /* Attempt to get ownership of the PF2VF CSR */ ADF_CSR_WR(pmisc_bar_addr, pf2vf_offset, msg | int_bit); =20 /* Wait for confirmation from remote func it received the message */ --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D540C433FE for ; Mon, 24 Jan 2022 20:57:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442966AbiAXUzx (ORCPT ); Mon, 24 Jan 2022 15:55:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385516AbiAXUda (ORCPT ); Mon, 24 Jan 2022 15:33: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 39031C07E2A2; Mon, 24 Jan 2022 11:45: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 B14006135E; Mon, 24 Jan 2022 19:45:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD30FC340E5; Mon, 24 Jan 2022 19:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053549; bh=bMP6poSSRt5WVXutbv5fXRkoaoHGAUitGkuYuUN9upE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qdvIJ/e3Z4M0nIMlPm+bvqhJHgmOcDQzOPSpYvZ7kQXGQSjfZ0NLNi9O2ePmpS19Y B6zHB5tmKeNuFPNrkniNlP7zpItpZT/t0Pkp9zhNXbppX7q5edZ6Tb8WG7vod/HBGJ jmyGN5pfFiP2ejHrGebKfF+M1jGj3y3mv+7niVdc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marco Chiappero , Giovanni Cabiddu , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 100/563] crypto: qat - make pfvf send message direction agnostic Date: Mon, 24 Jan 2022 19:37:45 +0100 Message-Id: <20220124184027.856214978@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marco Chiappero [ Upstream commit 6e680f94bc31d0fd0ff01123c964d895ea8040fa ] The functions adf_iov_putmsg() and __adf_iov_putmsg() are shared by both PF and VF. Any logging or documentation should not refer to any specific direction. Make comments and log messages direction agnostic by replacing PF2VF with PFVF. Also fix the wording for some related comments. Signed-off-by: Marco Chiappero Co-developed-by: Giovanni Cabiddu Signed-off-by: Giovanni Cabiddu Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto= /qat/qat_common/adf_pf2vf_msg.c index d1dbf6216de57..7b34273d18937 100644 --- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c @@ -111,11 +111,11 @@ static int __adf_iov_putmsg(struct adf_accel_dev *acc= el_dev, u32 msg, u8 vf_nr) =20 mutex_lock(lock); =20 - /* Check if PF2VF CSR is in use by remote function */ + /* Check if the PFVF CSR is in use by remote function */ val =3D ADF_CSR_RD(pmisc_bar_addr, pf2vf_offset); if ((val & remote_in_use_mask) =3D=3D remote_in_use_pattern) { dev_dbg(&GET_DEV(accel_dev), - "PF2VF CSR in use by remote function\n"); + "PFVF CSR in use by remote function\n"); ret =3D -EBUSY; goto out; } @@ -123,7 +123,7 @@ static int __adf_iov_putmsg(struct adf_accel_dev *accel= _dev, u32 msg, u8 vf_nr) msg &=3D ~local_in_use_mask; msg |=3D local_in_use_pattern; =20 - /* Attempt to get ownership of the PF2VF CSR */ + /* Attempt to get ownership of the PFVF CSR */ ADF_CSR_WR(pmisc_bar_addr, pf2vf_offset, msg | int_bit); =20 /* Wait for confirmation from remote func it received the message */ @@ -145,7 +145,7 @@ static int __adf_iov_putmsg(struct adf_accel_dev *accel= _dev, u32 msg, u8 vf_nr) ret =3D -EIO; } =20 - /* Finished with PF2VF CSR; relinquish it and leave msg in CSR */ + /* 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: mutex_unlock(lock); @@ -153,12 +153,13 @@ out: } =20 /** - * adf_iov_putmsg() - send PF2VF message + * adf_iov_putmsg() - send PFVF message * @accel_dev: Pointer to acceleration device. * @msg: Message to send - * @vf_nr: VF number to which the message will be sent + * @vf_nr: VF number to which the message will be sent if on PF, ignored + * otherwise * - * Function sends a message from the PF to a VF + * Function sends a message through the PFVF channel * * Return: 0 on success, error code otherwise. */ --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0153C433F5 for ; Mon, 24 Jan 2022 20:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352023AbiAXUDi (ORCPT ); Mon, 24 Jan 2022 15:03:38 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43278 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356318AbiAXTpx (ORCPT ); Mon, 24 Jan 2022 14:45: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 AD9A961298; Mon, 24 Jan 2022 19:45:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8216EC340E5; Mon, 24 Jan 2022 19:45:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053552; bh=H+uq4ZVZklWR33YUhdiDaf9uMY5fP9Hv3t8Qu8VlFXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zYZTZPCFCHzHcQ0TOgS1tMiTtoMgRelFCq4zxyE4axTlD8XhvvqqwtHBy9mwThz8x KEq/1WST9x6qwDPXgwhVyLmexrK+Bw7hkgj/1iWe3WE/0MrQkZ0fi5ZtvI0Oq4qzYr +a5P7EoRypogWuTP1LcYJfERcFRtOmpgcfVAl+ps= 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.10 101/563] crypto: qat - fix undetected PFVF timeout in ACK loop Date: Mon, 24 Jan 2022 19:37:46 +0100 Message-Id: <20220124184027.892805700@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 7b34273d18937..74afafc84c716 100644 --- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c @@ -132,6 +132,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_IOV_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"); @@ -139,12 +145,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6F01C433EF for ; Mon, 24 Jan 2022 20:03:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376727AbiAXUDq (ORCPT ); Mon, 24 Jan 2022 15:03:46 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:36884 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356340AbiAXTp7 (ORCPT ); Mon, 24 Jan 2022 14:45: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 2C9ABB811F3; Mon, 24 Jan 2022 19:45:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86615C340E5; Mon, 24 Jan 2022 19:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053554; bh=IWzOIoTZw/gXMYGd/lGaAkXkX9/htrEeJ4WV3BjbluY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FenG9DDybWxt4X8JpEkhNByIdDHMiElalxLlHiabwrXU45/MibAqg38eiO2tdyRAb bvDtXCKmMvby+/DVCSwQPYOJm9xo6q3c026yOxsAkXOJpYitmKCTtiDYobNboiOvub CdrE07qX30YlQjQ/SU8VJKcb2YQkvtLBsN4xkUjI= 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.10 102/563] ath11k: Use host CE parameters for CE interrupts configuration Date: Mon, 24 Jan 2022 19:37:47 +0100 Message-Id: <20220124184027.926264230@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 430723c64adce..e8cca58e18ffc 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A37CEC43219 for ; Mon, 24 Jan 2022 20:07:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377709AbiAXUFv (ORCPT ); Mon, 24 Jan 2022 15:05:51 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45408 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234697AbiAXTsO (ORCPT ); Mon, 24 Jan 2022 14:48: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 124176159E; Mon, 24 Jan 2022 19:48:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5EF2C340EC; Mon, 24 Jan 2022 19:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053692; bh=GDL5/qHmTlCExEwaF9eBCmfkh9P9BFI0UW3VqrG8rL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nCpwnJRCwzYU4UDf9StKxiy+pkmWXm80Kl0UYITq5i+CXjMM4ewFjcL2bkta4a2I0 Nk8tQHRJitBmU3OaGLV+3upsvbffO5izQclWYUL70lqvfeFTDmWjn9TI/NNXjdYRyw tunlXvN7uUiIgXqkzxYI17rdT9dWAGBz+HFFiH1g= 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.10 103/563] arm64: dts: ti: k3-j721e: correct cache-sets info Date: Mon, 24 Jan 2022 19:37:48 +0100 Message-Id: <20220124184027.959325002@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 cc483f7344af3..d1ef9fbe4981d 100644 --- a/arch/arm64/boot/dts/ti/k3-j721e.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j721e.dtsi @@ -61,7 +61,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 @@ -75,7 +75,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09792C4167E for ; Mon, 24 Jan 2022 20:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443451AbiAXU46 (ORCPT ); Mon, 24 Jan 2022 15:56:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385529AbiAXUdd (ORCPT ); Mon, 24 Jan 2022 15:33: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 4C33EC07E2A6; Mon, 24 Jan 2022 11:46: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 B92276154E; Mon, 24 Jan 2022 19:46:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1E8FC340E5; Mon, 24 Jan 2022 19:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053579; bh=lLAkhTF9mn3pG3+LBJokmhIVH1QLXwMkT+mZu/HSBUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SLdDwTeSNGiydRxGenViheksmLFiwnQw7dUiN1At38EIwYf93XPS2GgXre9s8pCx+ XtVXFajazqVNzLCnwzoZb1MazbmblrDz/rZtfwLA5/VsPGUe2y62IZxY67uKsOy/Rl pB4acwaS0HH61HemsFCRgLPYEiJi19g/7rl6U38w= 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.10 104/563] tty: serial: atmel: Check return code of dmaengine_submit() Date: Mon, 24 Jan 2022 19:37:49 +0100 Message-Id: <20220124184027.996894655@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a24e5c2b30bc9..396fe8c51f93b 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) @@ -1264,6 +1269,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7312BC433F5 for ; Mon, 24 Jan 2022 21:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444026AbiAXU7t (ORCPT ); Mon, 24 Jan 2022 15:59:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385569AbiAXUdg (ORCPT ); Mon, 24 Jan 2022 15:33: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 CB2F9C07E2AC; Mon, 24 Jan 2022 11:46: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 685C86131E; Mon, 24 Jan 2022 19:46:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49974C340E5; Mon, 24 Jan 2022 19:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053617; bh=H1hFsvuFf55B6JVRQj672EgOQJOv6pp5Kk5rrycgc9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gZ2if9Uhajqg6wITfg7Nj0uDMIXSIDsxMdAB9Zsbtn9iStWpgXM07/WAOpIYPCNM/ +m/hFHEJSoMizZLXFYp8CEMXDlLnt88Yy/1bR0+65twGC2lsY1vmCPLVSBy83UQ6ap OjR5jxCKYBK5TwyK7hRsXbLx3HaIK7b1w23febtA= 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.10 105/563] tty: serial: atmel: Call dma_async_issue_pending() Date: Mon, 24 Jan 2022 19:37:50 +0100 Message-Id: <20220124184028.030130227@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 396fe8c51f93b..602065bfc9bb8 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) @@ -1275,6 +1277,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CB6CC3526E for ; Mon, 24 Jan 2022 20:07:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377639AbiAXUFq (ORCPT ); Mon, 24 Jan 2022 15:05:46 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37646 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356884AbiAXTre (ORCPT ); Mon, 24 Jan 2022 14:47: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 7E235B811F9; Mon, 24 Jan 2022 19:47:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4E81C340E5; Mon, 24 Jan 2022 19:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053651; bh=LQFQXJKh8AgcmpSq95ncbAZc/m3gURnAWKojwDiSKVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1qjyD6sR31A7LDQtQwGAMuTngWSrBFdwQqIaKcsO8NmKuROi/WSm2n5/GQ1h1UnUm Kkpao9CVU4XmHWXtDn1GRLV1e5uq3ZTmEe3zsWF4l6lXEpE0VgYBuW/U9E0r0xVMAg NNpmZI90MZW1gAsPxpjbtrSgq+FWuSHvp3GY9LC0= 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.10 106/563] mfd: atmel-flexcom: Remove #ifdef CONFIG_PM_SLEEP Date: Mon, 24 Jan 2022 19:37:51 +0100 Message-Id: <20220124184028.069622903@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E02C9C4321E for ; Mon, 24 Jan 2022 20:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443400AbiAXU4x (ORCPT ); Mon, 24 Jan 2022 15:56:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348182AbiAXUeT (ORCPT ); Mon, 24 Jan 2022 15:34:19 -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 0B048C07E2B8; Mon, 24 Jan 2022 11:47: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 E267E61298; Mon, 24 Jan 2022 19:47:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC5BAC340E5; Mon, 24 Jan 2022 19:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053673; bh=2oPRCzvY5dsRKRC7+16mS3DHzsCSSWf7cRER46nZmQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gTVI4neVPrEmO8wQtd94+QPR4VQIpZazoV1HofX0pRVtjz7JJqErf8777ct5EJh4I e90DTH2kAChrewpiMT9wL8q7lrOk06Oyk0U/2m4nRU22piNs8AgxWRwjMMje3ZBhEW zQDLjnQyxKUviRhaxys9gs6tEPCsWKnsx80s/lgw= 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.10 107/563] mfd: atmel-flexcom: Use .resume_noirq Date: Mon, 24 Jan 2022 19:37:52 +0100 Message-Id: <20220124184028.102081221@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 851E8C433EF for ; Mon, 24 Jan 2022 20:07:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377510AbiAXUFe (ORCPT ); Mon, 24 Jan 2022 15:05:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37800 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354097AbiAXTsA (ORCPT ); Mon, 24 Jan 2022 14:48: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 29C77B8119D; Mon, 24 Jan 2022 19:47:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D17BC340E5; Mon, 24 Jan 2022 19:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053676; bh=/vz12Y+4kCw+FJnjP4uwJIwY0vpUaKSJwMXMfs4kA/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vltYa7x/HUPJXlOU193E8ZIP4kZCHA22a0S1cEFz7lGZMtMC+VR1kNG4p8bywlD6n sS0u6UBd+9+UkHRbM+7qBHPD6PW80aWQwz5A0lu146lq0iPX8gaNZFnVbj20i7W25H XTDroPvtWpOfKbktzcIeaviddlzmfQPYM9jQEOok= 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.10 108/563] media: rcar-csi2: Correct the selection of hsfreqrange Date: Mon, 24 Jan 2022 19:37:53 +0100 Message-Id: <20220124184028.138439005@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 d2d87a204e918..6fb8efcb40444 100644 --- a/drivers/media/platform/rcar-vin/rcar-csi2.c +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c @@ -436,16 +436,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9993CC433F5 for ; Mon, 24 Jan 2022 20:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377693AbiAXUFu (ORCPT ); Mon, 24 Jan 2022 15:05:50 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45162 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354186AbiAXTsK (ORCPT ); Mon, 24 Jan 2022 14:48: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 6A9B96157F; Mon, 24 Jan 2022 19:48:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 378D8C340E5; Mon, 24 Jan 2022 19:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053679; bh=DOUbC5NwTfQs8OCJ5GeilertBelbbCvPE6vP7xpinn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uo4xGu46UhfXt7/W/Hd5AqlFmX0CuLQ37bgaRCHPdw2gILxEZGAJLUzOuoWz9PpGl GlNF2vbok8kK/D7RGJ/o5d/SsbI/P6HJJSH0E4nN9yQEtGs/EDthNjM+ou7M66tc1T ERAOsp/Qejl0c/OSFEV/qFw6tso95toQ5Exdt2Cc= 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.10 109/563] media: imx-pxp: Initialize the spinlock prior to using it Date: Mon, 24 Jan 2022 19:37:54 +0100 Message-Id: <20220124184028.181892798@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 08d76eb05ed1a..62356adebc39e 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -1664,6 +1664,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) { @@ -1681,8 +1683,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A168FC43219 for ; Mon, 24 Jan 2022 20:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443370AbiAXU4p (ORCPT ); Mon, 24 Jan 2022 15:56:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348276AbiAXUeT (ORCPT ); Mon, 24 Jan 2022 15:34:19 -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 76045C07E2BC; Mon, 24 Jan 2022 11:48: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 3F81DB811FB; Mon, 24 Jan 2022 19:48:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 699C7C340E5; Mon, 24 Jan 2022 19:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053683; bh=fntRpshkPH1kBf19IZiQRtlhXjIeJ4hCEiSlfehiMwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U23bKL5fsGRndt9amdc0pDIfynUYC9QYRnJJPSZ3uKfFiABYw9n26Rhx98iBKPKI+ YiNRoFemHLboxzkIFqOjbKoYtQaJjoDhfAxo9Wj2gezFN+P040wAEZykp/r2FlDrUq d8yPhiKKSnX2frzHsG6hB/PULz9LBFvlj0VWiPF4= 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.10 110/563] media: si470x-i2c: fix possible memory leak in si470x_i2c_probe() Date: Mon, 24 Jan 2022 19:37:55 +0100 Message-Id: <20220124184028.219961437@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AE52C433FE for ; Mon, 24 Jan 2022 23:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387591AbiAXX5U (ORCPT ); Mon, 24 Jan 2022 18:57:20 -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 S1358273AbiAXXRp (ORCPT ); Mon, 24 Jan 2022 18:17: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 3DD69C07E2BF; Mon, 24 Jan 2022 11:48: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 D184061574; Mon, 24 Jan 2022 19:48:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91D1BC340E5; Mon, 24 Jan 2022 19:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053686; bh=hSPmmAxsvGfVUsGYIQ1clq+bMrnZsXvoyVNZsG9SmHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LsfqYTc7YhErehljNMq/OBO2dEMjFmVBDZS2HYKOaQ9kDsNQyoNGPzu7zNOkpKjb0 NTlkDzDxuke2JSIUyCeOAQX93vHVpeHmtjIQ+FtrL1KSPhM1g5q3EM2e152cKps0o1 1ho2+Xu5GaaaXV7NfsKNlGTxYPHabqq4wci+uVds= 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.10 111/563] media: mtk-vcodec: call v4l2_m2m_ctx_release first when file is released Date: Mon, 24 Jan 2022 19:37:56 +0100 Message-Id: <20220124184028.260388985@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 219c2c5b78efc..5f93bc670edb2 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -237,11 +237,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AA6DC433EF for ; Tue, 25 Jan 2022 02:33:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421012AbiAYCZ5 (ORCPT ); Mon, 24 Jan 2022 21:25:57 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45332 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357011AbiAXTsM (ORCPT ); Mon, 24 Jan 2022 14:48: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 D915D61298; Mon, 24 Jan 2022 19:48:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4364C340E7; Mon, 24 Jan 2022 19:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053689; bh=0QUssqJNsNALCtFHI2M4tOyb+toYMUWbwPGQqJ03+fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BH4nad/5ePNung0vySifG8mbrPJ3e06Vt2mkJjA4FvavH3LL3r8rR1W7aKTo4IlPd pS7GpSa1jqPDefFNuaxFJPGoyjzh4JIDe9yMMC5EODqM4fhM0JWzhFgGUCvSmbnas/ jS+tzk5jFlAL6dRLclxYuHqXReTn91Pha6UCVdPI= 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.10 112/563] media: coda: fix CODA960 JPEG encoder buffer overflow Date: Mon, 24 Jan 2022 19:37:57 +0100 Message-Id: <20220124184028.293601037@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 87a2c706f7477..1eed69d29149f 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 141ACC433F5 for ; Mon, 24 Jan 2022 20:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353785AbiAXUET (ORCPT ); Mon, 24 Jan 2022 15:04:19 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43778 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356497AbiAXTq3 (ORCPT ); Mon, 24 Jan 2022 14:46: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 E1A976153B; Mon, 24 Jan 2022 19:46:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5CECC340E5; Mon, 24 Jan 2022 19:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053587; bh=hSnyDgOnkCgKuwYcR+1NOauOe0CVhqfyNm4Nyh+3WZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tyhmd3pzfwQ9m8UqOHfyQzb6Uddcpm5GvY7bC9hkhoIwSy5g5S0QwrrL/bMXl3qt5 53H+rkwPn6pvrR+lucQJF6pWA15If97/ZOraN06Fn18rm/QSgE6JfKH1ZqDvg+dlsd 9jKf7EW0AvD05g1UJnN/lPGkKMQ5ELfDaw7dLvnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fritz Koenig , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 113/563] media: venus: pm_helpers: Control core power domain manually Date: Mon, 24 Jan 2022 19:37:58 +0100 Message-Id: <20220124184028.332819166@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stanimir Varbanov [ Upstream commit a76f43a490542ecb8c57176730b6eb665d716139 ] Presently we use device_link to control core power domain. But this leads to issues because the genpd doesn't guarantee synchronous on/off for supplier devices. Switch to manually control by pmruntime calls. Tested-by: Fritz Koenig Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/media/platform/qcom/venus/core.h | 2 -- .../media/platform/qcom/venus/pm_helpers.c | 36 ++++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platf= orm/qcom/venus/core.h index 05c9fbd51f0c0..f2a0ef9ee884e 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -123,7 +123,6 @@ struct venus_caps { * @clks: an array of struct clk pointers * @vcodec0_clks: an array of vcodec0 struct clk pointers * @vcodec1_clks: an array of vcodec1 struct clk pointers - * @pd_dl_venus: pmdomain device-link for venus domain * @pmdomains: an array of pmdomains struct device pointers * @vdev_dec: a reference to video device structure for decoder instances * @vdev_enc: a reference to video device structure for encoder instances @@ -161,7 +160,6 @@ struct venus_core { struct icc_path *cpucfg_path; struct opp_table *opp_table; bool has_opp_table; - struct device_link *pd_dl_venus; struct device *pmdomains[VIDC_PMDOMAINS_NUM_MAX]; struct device_link *opp_dl_venus; struct device *opp_pmdomain; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media= /platform/qcom/venus/pm_helpers.c index 2946547a0df4a..bce9a370015fb 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -773,13 +773,6 @@ static int vcodec_domains_get(struct device *dev) core->pmdomains[i] =3D pd; } =20 - core->pd_dl_venus =3D device_link_add(dev, core->pmdomains[0], - DL_FLAG_PM_RUNTIME | - DL_FLAG_STATELESS | - DL_FLAG_RPM_ACTIVE); - if (!core->pd_dl_venus) - return -ENODEV; - skip_pmdomains: if (!core->has_opp_table) return 0; @@ -806,14 +799,12 @@ skip_pmdomains: opp_dl_add_err: dev_pm_opp_detach_genpd(core->opp_table); opp_attach_err: - if (core->pd_dl_venus) { - device_link_del(core->pd_dl_venus); - for (i =3D 0; i < res->vcodec_pmdomains_num; i++) { - if (IS_ERR_OR_NULL(core->pmdomains[i])) - continue; - dev_pm_domain_detach(core->pmdomains[i], true); - } + for (i =3D 0; i < res->vcodec_pmdomains_num; i++) { + if (IS_ERR_OR_NULL(core->pmdomains[i])) + continue; + dev_pm_domain_detach(core->pmdomains[i], true); } + return ret; } =20 @@ -826,9 +817,6 @@ static void vcodec_domains_put(struct device *dev) if (!res->vcodec_pmdomains_num) goto skip_pmdomains; =20 - if (core->pd_dl_venus) - device_link_del(core->pd_dl_venus); - for (i =3D 0; i < res->vcodec_pmdomains_num; i++) { if (IS_ERR_OR_NULL(core->pmdomains[i])) continue; @@ -916,16 +904,30 @@ static void core_put_v4(struct device *dev) static int core_power_v4(struct device *dev, int on) { struct venus_core *core =3D dev_get_drvdata(dev); + struct device *pmctrl =3D core->pmdomains[0]; int ret =3D 0; =20 if (on =3D=3D POWER_ON) { + if (pmctrl) { + ret =3D pm_runtime_get_sync(pmctrl); + if (ret < 0) { + pm_runtime_put_noidle(pmctrl); + return ret; + } + } + ret =3D core_clks_enable(core); + if (ret < 0 && pmctrl) + pm_runtime_put_sync(pmctrl); } else { /* Drop the performance state vote */ if (core->opp_pmdomain) dev_pm_opp_set_rate(dev, 0); =20 core_clks_disable(core); + + if (pmctrl) + pm_runtime_put_sync(pmctrl); } =20 return ret; --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22E50C433F5 for ; Mon, 24 Jan 2022 20:04:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353844AbiAXUEZ (ORCPT ); Mon, 24 Jan 2022 15:04:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37190 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356508AbiAXTqd (ORCPT ); Mon, 24 Jan 2022 14:46: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 BAAB6B81142; Mon, 24 Jan 2022 19:46:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD543C340E7; Mon, 24 Jan 2022 19:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053590; bh=/Bn2b5Me1W2LVtHE9oXQZpnca875ifPrsY/ztqa5e34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ysamgb6qDDBpSf6fQ64DGlyUBoTpEBQGjRI4E3lwr8nBixmjotcWI8qes6yO6PJqS iLIOUH+FLRcihgmIMrxEVBW5K7CHIkk+ZjqtWaKtScvudo//FEQm6BXX1Miq9iXCxL cka3b7Mdkz/gNVLz2IglgFC2fayPlPASdX1j7Ra0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Bryan ODonoghue , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 114/563] media: venus: core, venc, vdec: Fix probe dependency error Date: Mon, 24 Jan 2022 19:37:59 +0100 Message-Id: <20220124184028.363198382@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 08b1cf474b7f72750adebe0f0a35f8e9a3eb75f6 ] Commit aaaa93eda64b ("media] media: venus: venc: add video encoder files") is the last in a series of three commits to add core.c vdec.c and venc.c adding core, encoder and decoder. The encoder and decoder check for core drvdata as set and return -EPROBE_DE= FER if it has not been set, however both the encoder and decoder rely on core.v4l2_dev as valid. core.v4l2_dev will not be valid until v4l2_device_register() has completed in core.c's probe(). Normally this is never seen however, Dmitry reported the following backtrace when compiling drivers and firmware directly into a kernel image. [ 5.259968] Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) [ 5.269850] sd 0:0:0:3: [sdd] Optimal transfer size 524288 bytes [ 5.275505] Workqueue: events deferred_probe_work_func [ 5.275513] pstate: 60400005 (nZCv daif +PAN -UAO -TCO BTYPE=3D--) [ 5.441211] usb 2-1: new SuperSpeedPlus Gen 2 USB device number 2 using = xhci-hcd [ 5.442486] pc : refcount_warn_saturate+0x140/0x148 [ 5.493756] hub 2-1:1.0: USB hub found [ 5.496266] lr : refcount_warn_saturate+0x140/0x148 [ 5.500982] hub 2-1:1.0: 4 ports detected [ 5.503440] sp : ffff80001067b730 [ 5.503442] x29: ffff80001067b730 [ 5.592660] usb 1-1: new high-speed USB device number 2 using xhci-hcd [ 5.598478] x28: ffff6c6bc1c379b8 [ 5.598480] x27: ffffa5c673852960 x26: ffffa5c673852000 [ 5.598484] x25: ffff6c6bc1c37800 x24: 0000000000000001 [ 5.810652] x23: 0000000000000000 x22: ffffa5c673bc7118 [ 5.813777] hub 1-1:1.0: USB hub found [ 5.816108] x21: ffffa5c674440000 x20: 0000000000000001 [ 5.820846] hub 1-1:1.0: 4 ports detected [ 5.825415] x19: ffffa5c6744f4000 x18: ffffffffffffffff [ 5.825418] x17: 0000000000000000 x16: 0000000000000000 [ 5.825421] x15: 00000a4810c193ba x14: 0000000000000000 [ 5.825424] x13: 00000000000002b8 x12: 000000000000f20a [ 5.825427] x11: 000000000000f20a x10: 0000000000000038 [ 5.845447] usb 2-1.1: new SuperSpeed Gen 1 USB device number 3 using xh= ci-hcd [ 5.845904] [ 5.845905] x9 : 0000000000000000 x8 : ffff6c6d36fae780 [ 5.871208] x7 : ffff6c6d36faf240 x6 : 0000000000000000 [ 5.876664] x5 : 0000000000000004 x4 : 0000000000000085 [ 5.882121] x3 : 0000000000000119 x2 : ffffa5c6741ef478 [ 5.887578] x1 : 3acbb3926faf5f00 x0 : 0000000000000000 [ 5.893036] Call trace: [ 5.895551] refcount_warn_saturate+0x140/0x148 [ 5.900202] __video_register_device+0x64c/0xd10 [ 5.904944] venc_probe+0xc4/0x148 [ 5.908444] platform_probe+0x68/0xe0 [ 5.912210] really_probe+0x118/0x3e0 [ 5.915977] driver_probe_device+0x5c/0xc0 [ 5.920187] __device_attach_driver+0x98/0xb8 [ 5.924661] bus_for_each_drv+0x68/0xd0 [ 5.928604] __device_attach+0xec/0x148 [ 5.932547] device_initial_probe+0x14/0x20 [ 5.936845] bus_probe_device+0x9c/0xa8 [ 5.940788] device_add+0x3e8/0x7c8 [ 5.944376] of_device_add+0x4c/0x60 [ 5.948056] of_platform_device_create_pdata+0xbc/0x140 [ 5.953425] of_platform_bus_create+0x17c/0x3c0 [ 5.958078] of_platform_populate+0x80/0x110 [ 5.962463] venus_probe+0x2ec/0x4d8 [ 5.966143] platform_probe+0x68/0xe0 [ 5.969907] really_probe+0x118/0x3e0 [ 5.973674] driver_probe_device+0x5c/0xc0 [ 5.977882] __device_attach_driver+0x98/0xb8 [ 5.982356] bus_for_each_drv+0x68/0xd0 [ 5.986298] __device_attach+0xec/0x148 [ 5.990242] device_initial_probe+0x14/0x20 [ 5.994539] bus_probe_device+0x9c/0xa8 [ 5.998481] deferred_probe_work_func+0x74/0xb0 [ 6.003132] process_one_work+0x1e8/0x360 [ 6.007254] worker_thread+0x208/0x478 [ 6.011106] kthread+0x150/0x158 [ 6.014431] ret_from_fork+0x10/0x30 [ 6.018111] ---[ end trace f074246b1ecdb466 ]--- This patch fixes by - Only setting drvdata after v4l2_device_register() completes - Moving v4l2_device_register() so that suspend/reume in core::probe() stays as-is - Changes pm_ops->core_function() to take struct venus_core not struct device - Minimal rework of v4l2_device_*register in probe/remove Reported-by: Dmitry Baryshkov Signed-off-by: Bryan O'Donoghue Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/media/platform/qcom/venus/core.c | 30 +++++++++++-------- .../media/platform/qcom/venus/pm_helpers.c | 30 ++++++++----------- .../media/platform/qcom/venus/pm_helpers.h | 7 +++-- 3 files changed, 34 insertions(+), 33 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platf= orm/qcom/venus/core.c index 58ddebbb84468..bad553bf9f304 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -222,7 +222,6 @@ static int venus_probe(struct platform_device *pdev) return -ENOMEM; =20 core->dev =3D dev; - platform_set_drvdata(pdev, core); =20 r =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); core->base =3D devm_ioremap_resource(dev, r); @@ -252,7 +251,7 @@ static int venus_probe(struct platform_device *pdev) return -ENODEV; =20 if (core->pm_ops->core_get) { - ret =3D core->pm_ops->core_get(dev); + ret =3D core->pm_ops->core_get(core); if (ret) return ret; } @@ -277,6 +276,12 @@ static int venus_probe(struct platform_device *pdev) if (ret) goto err_core_put; =20 + ret =3D v4l2_device_register(dev, &core->v4l2_dev); + if (ret) + goto err_core_deinit; + + platform_set_drvdata(pdev, core); + pm_runtime_enable(dev); =20 ret =3D pm_runtime_get_sync(dev); @@ -311,10 +316,6 @@ static int venus_probe(struct platform_device *pdev) if (ret) goto err_venus_shutdown; =20 - ret =3D v4l2_device_register(dev, &core->v4l2_dev); - if (ret) - goto err_core_deinit; - ret =3D pm_runtime_put_sync(dev); if (ret) { pm_runtime_get_noresume(dev); @@ -327,8 +328,6 @@ static int venus_probe(struct platform_device *pdev) =20 err_dev_unregister: v4l2_device_unregister(&core->v4l2_dev); -err_core_deinit: - hfi_core_deinit(core, false); err_venus_shutdown: venus_shutdown(core); err_runtime_disable: @@ -336,9 +335,11 @@ err_runtime_disable: pm_runtime_set_suspended(dev); pm_runtime_disable(dev); hfi_destroy(core); +err_core_deinit: + hfi_core_deinit(core, false); err_core_put: if (core->pm_ops->core_put) - core->pm_ops->core_put(dev); + core->pm_ops->core_put(core); return ret; } =20 @@ -364,11 +365,14 @@ static int venus_remove(struct platform_device *pdev) pm_runtime_disable(dev); =20 if (pm_ops->core_put) - pm_ops->core_put(dev); + pm_ops->core_put(core); + + v4l2_device_unregister(&core->v4l2_dev); =20 hfi_destroy(core); =20 v4l2_device_unregister(&core->v4l2_dev); + mutex_destroy(&core->pm_lock); mutex_destroy(&core->lock); venus_dbgfs_deinit(core); @@ -387,7 +391,7 @@ static __maybe_unused int venus_runtime_suspend(struct = device *dev) return ret; =20 if (pm_ops->core_power) { - ret =3D pm_ops->core_power(dev, POWER_OFF); + ret =3D pm_ops->core_power(core, POWER_OFF); if (ret) return ret; } @@ -405,7 +409,7 @@ 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(dev, POWER_ON); + pm_ops->core_power(core, POWER_ON); =20 return ret; } @@ -425,7 +429,7 @@ static __maybe_unused int venus_runtime_resume(struct d= evice *dev) return ret; =20 if (pm_ops->core_power) { - ret =3D pm_ops->core_power(dev, POWER_ON); + ret =3D pm_ops->core_power(core, POWER_ON); if (ret) return ret; } diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media= /platform/qcom/venus/pm_helpers.c index bce9a370015fb..63095d70f8d82 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -276,16 +276,13 @@ set_freq: return 0; } =20 -static int core_get_v1(struct device *dev) +static int core_get_v1(struct venus_core *core) { - struct venus_core *core =3D dev_get_drvdata(dev); - return core_clks_get(core); } =20 -static int core_power_v1(struct device *dev, int on) +static int core_power_v1(struct venus_core *core, int on) { - struct venus_core *core =3D dev_get_drvdata(dev); int ret =3D 0; =20 if (on =3D=3D POWER_ON) @@ -752,12 +749,12 @@ static int venc_power_v4(struct device *dev, int on) return ret; } =20 -static int vcodec_domains_get(struct device *dev) +static int vcodec_domains_get(struct venus_core *core) { int ret; struct opp_table *opp_table; struct device **opp_virt_dev; - struct venus_core *core =3D dev_get_drvdata(dev); + struct device *dev =3D core->dev; const struct venus_resources *res =3D core->res; struct device *pd; unsigned int i; @@ -808,9 +805,8 @@ opp_attach_err: return ret; } =20 -static void vcodec_domains_put(struct device *dev) +static void vcodec_domains_put(struct venus_core *core) { - struct venus_core *core =3D dev_get_drvdata(dev); const struct venus_resources *res =3D core->res; unsigned int i; =20 @@ -833,9 +829,9 @@ skip_pmdomains: dev_pm_opp_detach_genpd(core->opp_table); } =20 -static int core_get_v4(struct device *dev) +static int core_get_v4(struct venus_core *core) { - struct venus_core *core =3D dev_get_drvdata(dev); + struct device *dev =3D core->dev; const struct venus_resources *res =3D core->res; int ret; =20 @@ -874,7 +870,7 @@ static int core_get_v4(struct device *dev) } } =20 - ret =3D vcodec_domains_get(dev); + ret =3D vcodec_domains_get(core); if (ret) { if (core->has_opp_table) dev_pm_opp_of_remove_table(dev); @@ -885,14 +881,14 @@ static int core_get_v4(struct device *dev) return 0; } =20 -static void core_put_v4(struct device *dev) +static void core_put_v4(struct venus_core *core) { - struct venus_core *core =3D dev_get_drvdata(dev); + struct device *dev =3D core->dev; =20 if (legacy_binding) return; =20 - vcodec_domains_put(dev); + vcodec_domains_put(core); =20 if (core->has_opp_table) dev_pm_opp_of_remove_table(dev); @@ -901,9 +897,9 @@ static void core_put_v4(struct device *dev) =20 } =20 -static int core_power_v4(struct device *dev, int on) +static int core_power_v4(struct venus_core *core, int on) { - struct venus_core *core =3D dev_get_drvdata(dev); + struct device *dev =3D core->dev; struct device *pmctrl =3D core->pmdomains[0]; int ret =3D 0; =20 diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media= /platform/qcom/venus/pm_helpers.h index aa2f6afa23544..a492c50c5543c 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -4,14 +4,15 @@ #define __VENUS_PM_HELPERS_H__ =20 struct device; +struct venus_core; =20 #define POWER_ON 1 #define POWER_OFF 0 =20 struct venus_pm_ops { - int (*core_get)(struct device *dev); - void (*core_put)(struct device *dev); - int (*core_power)(struct device *dev, int on); + int (*core_get)(struct venus_core *core); + void (*core_put)(struct venus_core *core); + int (*core_power)(struct venus_core *core, int on); =20 int (*vdec_get)(struct device *dev); void (*vdec_put)(struct device *dev); --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CEEFC41535 for ; Mon, 24 Jan 2022 20:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343564AbiAXU5E (ORCPT ); Mon, 24 Jan 2022 15:57:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385530AbiAXUdc (ORCPT ); Mon, 24 Jan 2022 15:33: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 EDAB6C07E2A7; Mon, 24 Jan 2022 11:46: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 B6194B81188; Mon, 24 Jan 2022 19:46:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22042C340E5; Mon, 24 Jan 2022 19:46:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053593; bh=b/XKnwgrf/3JVxrGhXaG0paMM3UjEM9CNjrHDaPdecY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GS8ExaIeMwBuUZ63HUIDjN85dlVkzGWGLxSSAngMws0nExxGDm29T1USXkQE3wMWK qSzCpSLvOUKFuRgoNYJBpAmLDSs6i8ZvQ+CdQCuGGVgHy5Qvl3+bh7xSz6sD0ENdBU 8zEBnGLqGKFwoDZAxavarDvfb8fnpD2MH7zgsqeY= 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.10 115/563] media: venus: core: Fix a potential NULL pointer dereference in an error handling path Date: Mon, 24 Jan 2022 19:38:00 +0100 Message-Id: <20220124184028.401899285@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 bad553bf9f304..791ed1b1bbbd3 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -409,7 +409,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E4CEC4167D for ; Mon, 24 Jan 2022 20:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443461AbiAXU5B (ORCPT ); Mon, 24 Jan 2022 15:57:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385532AbiAXUdd (ORCPT ); Mon, 24 Jan 2022 15:33: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 5E855C07E2A8; Mon, 24 Jan 2022 11:46: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 F272A61482; Mon, 24 Jan 2022 19:46:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2E01C340E5; Mon, 24 Jan 2022 19:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053596; bh=/2RqlihE1x2dCaNhiMm97oLev/9P+gs0JBMsdtsmUIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J5M67QxNf2wCRsEemlc7dCMAc3ly0VncIF6enz2gHYV3wpYhxUjd87CNKWXJ85gn7 yrtOV5cXjSjm6HrmTNOB6Rex7GOWmEMd8bEvauGS9yI84CIq13rcFSBgWazw1PjUwm niGGHGfn0L5yyxDyNiotOCY5OXND7AeE9FTdNADs= 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.10 116/563] media: venus: core: Fix a resource leak in the error handling path of venus_probe() Date: Mon, 24 Jan 2022 19:38:01 +0100 Message-Id: <20220124184028.432876496@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 791ed1b1bbbd3..1d621f7769035 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -294,11 +294,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) @@ -330,6 +330,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A5C6C433EF for ; Mon, 24 Jan 2022 20:07:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376962AbiAXUEl (ORCPT ); Mon, 24 Jan 2022 15:04:41 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37244 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356567AbiAXTql (ORCPT ); Mon, 24 Jan 2022 14:46: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 930DDB81229; Mon, 24 Jan 2022 19:46:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB5A9C340E7; Mon, 24 Jan 2022 19:46:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053599; bh=GSPw2tC2/aZH08CgCYUriKjqTe1XdPeZhekrHeV1OJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XgE7S6a8Z6NGVc9R2SfmGrjYos9ly1WslKonY0uKj3cuE4+JhOjeQqIXlCordyxHM h6OrBSaBXsWI6ERYpryvLd87AJ5zemirUbX2+D5f9lBo0ThfqOL5oKQJKUGn6GSe4V SM6JGiieQPIYovwE1NDIOXj30zzCYg9dCHPQtTUE= 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.10 117/563] thermal/drivers/imx: Implement runtime PM support Date: Mon, 24 Jan 2022 19:38:02 +0100 Message-Id: <20220124184028.461979914@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FC77C4321E for ; Mon, 24 Jan 2022 21:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444003AbiAXU7p (ORCPT ); Mon, 24 Jan 2022 15:59:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385571AbiAXUdg (ORCPT ); Mon, 24 Jan 2022 15:33: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 1785CC07E2A9; Mon, 24 Jan 2022 11:46: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 C8051B8122F; Mon, 24 Jan 2022 19:46:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE064C340E5; Mon, 24 Jan 2022 19:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053602; bh=HQ6B0uKdxL/T2Pekmm6f9Rm+C360B4Crjd3KMEbBmYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b+mBNKsnK7zi3GY5PlMIffyBvBXiayVO//CGFQIFXzqcPys0ISHpeNiDUp4hzZ7bo Asr/lOUQBYFyZYAoUAWZHNsdo8LMwnfqb/5ntG4QyvoTdHCqubUegZuq4vTUy81r2T v37sA9Cs4zZsZ+GyBLcDE/JXIBc1fSaZLV9jbePI= 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.10 118/563] netfilter: bridge: add support for pppoe filtering Date: Mon, 24 Jan 2022 19:38:03 +0100 Message-Id: <20220124184028.496002608@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8edfb98ae1d58..68c0d0f928908 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48487C43217 for ; Mon, 24 Jan 2022 20:57:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443120AbiAXU4T (ORCPT ); Mon, 24 Jan 2022 15:56:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385570AbiAXUdg (ORCPT ); Mon, 24 Jan 2022 15:33: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 16CDAC07E2AA; Mon, 24 Jan 2022 11:46: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 B0D8FB8122C; Mon, 24 Jan 2022 19:46:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D65F1C340E7; Mon, 24 Jan 2022 19:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053605; bh=YGKYsF4QIvwkbyNNnfubN109Rd59um3bHJir9fWNhzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jq0SafI9bx5TRycYTkD+JofM7XbDR09rOQIqNPRf5HChVW530Cw4Z1MZcSH3LodmR 0yYF4dlbkuQZd4a8AGysPSbXwmxgYfoeF3RMbvwNbz5qT8JMdyBorAqVI0Yf+PXaMh UBNcxkV33OG1Rc9tz5z0Ud2Luw28rnm3vsVszYBo= 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.10 119/563] arm64: dts: qcom: msm8916: fix MMC controller aliases Date: Mon, 24 Jan 2022 19:38:04 +0100 Message-Id: <20220124184028.533315113@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 b1ffc056eea0b..291276a38d7cd 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -18,8 +18,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69406C3526F for ; Mon, 24 Jan 2022 20:57:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443135AbiAXU4V (ORCPT ); Mon, 24 Jan 2022 15:56:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385574AbiAXUdg (ORCPT ); Mon, 24 Jan 2022 15:33: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 76D39C07E2AB; Mon, 24 Jan 2022 11:46: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 15C7261031; Mon, 24 Jan 2022 19:46:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF094C340E7; Mon, 24 Jan 2022 19:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053608; bh=v6/FXpNGzXAE6TYf3fSLBuAkE9l9oQwNd47fnT/FRjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=omRAysdzy2nY/CC5ca+U1Sfgyzt+CE2lyN/T5Ky9CWbjXrYOs/cQvgAbqYDiOL84o X3Rf4WEFChFi/zfwoG/3KMZtvP7sMuKbtfLbUXaXoXDDVcDrTsXWA2txFx+EF0UarK nghcLMpLWMlpZ7siEwoU4tA6sJcSQ8Y/pHJq5P3g= 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.10 120/563] cgroup: Trace event cgroup id fields should be u64 Date: Mon, 24 Jan 2022 19:38:05 +0100 Message-Id: <20220124184028.564699291@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E7A4C433F5 for ; Mon, 24 Jan 2022 20:07:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376999AbiAXUEq (ORCPT ); Mon, 24 Jan 2022 15:04:46 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44108 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356637AbiAXTqw (ORCPT ); Mon, 24 Jan 2022 14:46: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 311DA6153F; Mon, 24 Jan 2022 19:46:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0158EC340E5; Mon, 24 Jan 2022 19:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053611; bh=+foyvL7izzsuiv8nrfS8Meoqvb9x4WJelribnKioMGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IuxQwtSvkA8sl1rm0bhpFsRlIO3Sjle2GTkGSlwNhXMnJMXv4DE55HgRTGlSi4D7y lr4+w6/F5rYroTzP253Ztz85i4U/8o0soDabtHxwKYx2Ca0SzSl0chkiT40TJsVNRb eG2Ot+MARKSb05iE352wb1ssO8q0wFfFPWY5Rois= 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.10 121/563] ACPI: EC: Rework flushing of EC work while suspended to idle Date: Mon, 24 Jan 2022 19:38:06 +0100 Message-Id: <20220124184028.594728190@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 be3e0921a6c00..3f2e5ea9ab6b7 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); @@ -469,6 +470,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); } } @@ -535,7 +537,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 @@ -1116,7 +1118,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; @@ -1124,11 +1126,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 @@ -1145,13 +1149,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 @@ -1161,7 +1173,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 @@ -1183,19 +1195,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) @@ -1253,6 +1266,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) @@ -2034,6 +2051,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) @@ -2054,8 +2072,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 a958ad60a3394..125e4901c9b47 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -184,6 +184,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05562C46467 for ; Mon, 24 Jan 2022 20:07:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376980AbiAXUEo (ORCPT ); Mon, 24 Jan 2022 15:04:44 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37400 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356659AbiAXTq5 (ORCPT ); Mon, 24 Jan 2022 14:46: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 075E7B81188; Mon, 24 Jan 2022 19:46:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 372BBC340E5; Mon, 24 Jan 2022 19:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053614; bh=YioIrWK00eK8p4E8Z+3YF3PMoxCkuzp94Hg/WoDjCC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SgJd+FCXYpQtynSqcUofE8ELr2sTiHyIJX3v1cD+8LwjbSRG4vwnbVsYfHgWXEoPU GKoBxSZBH3GOu3fyVRy3S3nIY8htkVaOYnfYL3KJAL6+RA7RAB6jJrOLqzhhGzFxid Qm4Thsk1f3VmG4fiJ/br058//HI+EsLVZ/IaiRlE= 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.10 122/563] thermal/drivers/imx8mm: Enable ADC when enabling monitor Date: Mon, 24 Jan 2022 19:38:07 +0100 Message-Id: <20220124184028.624462702@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a1e4f9bb4cb01..0f4cabd2a8c62 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45AA6C433EF for ; Mon, 24 Jan 2022 20:07:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377028AbiAXUEu (ORCPT ); Mon, 24 Jan 2022 15:04:50 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44236 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356679AbiAXTrC (ORCPT ); Mon, 24 Jan 2022 14:47: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 7F1196154E; Mon, 24 Jan 2022 19:47:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58F1EC340E5; Mon, 24 Jan 2022 19:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053620; bh=FCtfFY34iZEwAr7Qu9zfh7qbShfAkumL+e4sa31RBqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i4eWQ5Uzipr0o2KXi+umApYeWrZQQozPShsC/iTD1jhjzm5n1KpX92u1+8vS9y0kc c2XaLwKYTDVYlduJI92zKqwz/RW3vlpds/UFzqcePD3wJW4wQ4Vy/sgDWrNA9VHGge /mxM1aZq82t19UHlKUZtFKD+PVZ3kL7nm2eMfJjk= 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.10 123/563] drm/amdgpu: Fix a NULL pointer dereference in amdgpu_connector_lcd_native_mode() Date: Mon, 24 Jan 2022 19:38:08 +0100 Message-Id: <20220124184028.654486911@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78F48C4332F for ; Mon, 24 Jan 2022 20:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443256AbiAXU4e (ORCPT ); Mon, 24 Jan 2022 15:56:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385587AbiAXUdl (ORCPT ); Mon, 24 Jan 2022 15: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 DB847C07E2AD; Mon, 24 Jan 2022 11:47: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 7A193614B8; Mon, 24 Jan 2022 19:47:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D653C340E5; Mon, 24 Jan 2022 19:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053623; bh=jx1N4Rd3GlsC3NaUvDqMpAjvLpvG+Fd4xSC4Sv7bXzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=euQz5/cS34Xjzu+LSNRvpP8ohKDv3PpKTidhbJ3NtBg2xZuiAvQYoMWXh2uGKWZYL WAWjIPxj+9QDWL5ebOMQkv32E7cHjIZEzGVqZr7gYY/+/tuMf7CDmTxhvx9oPrqGH3 zWpcZMZwfv11JyB+CWiFBGHbGyx0Djky98k1+DQU= 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.10 124/563] drm/radeon/radeon_kms: Fix a NULL pointer dereference in radeon_driver_open_kms() Date: Mon, 24 Jan 2022 19:38:09 +0100 Message-Id: <20220124184028.691188732@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8c0a572940e82..204634b239283 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -634,6 +634,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; @@ -646,8 +648,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)) { @@ -658,35 +658,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04A67C35270 for ; Mon, 24 Jan 2022 20:57:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443294AbiAXU4i (ORCPT ); Mon, 24 Jan 2022 15:56:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385588AbiAXUdl (ORCPT ); Mon, 24 Jan 2022 15: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 B3EB2C07E2AE; Mon, 24 Jan 2022 11:47: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 542DB61551; Mon, 24 Jan 2022 19:47:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A3BFC340E7; Mon, 24 Jan 2022 19:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053626; bh=07SQja4q26FSn9m5TJNZ35JcTZjsRPx9B2FJoLg8HXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u+CUE/la9GPjxvhKLIjDFwtv4v85g749Sn7EX/X4WrKvjNzLTpz0xsfrtjjQLWRWu g77j9caucFu2zVdc3GETub1T3/AzNTENh+Zuh+yKyEzLiBWwV/vRZ2mCoC7y2hUYpW WceG5qQ9z1oEDxdvC3F1fWLBMgH35RrzFk3cAWUk= 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.10 125/563] arm64: dts: ti: k3-j7200: Fix the L2 cache sets Date: Mon, 24 Jan 2022 19:38:10 +0100 Message-Id: <20220124184028.727668425@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 66169bcf7c9a4..081b8f3d44c44 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j7200.dtsi @@ -84,7 +84,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA2F7C43217 for ; Mon, 24 Jan 2022 20:07:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377155AbiAXUFB (ORCPT ); Mon, 24 Jan 2022 15:05:01 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44358 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356753AbiAXTrM (ORCPT ); Mon, 24 Jan 2022 14:47: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 9FAD761551; Mon, 24 Jan 2022 19:47:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 608F1C340E5; Mon, 24 Jan 2022 19:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053630; bh=XcbVDpUyqUjXzOpF11EmDexo/J+zpZ7p9ony6TMOSco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wa2JzQUj5zJXXL8Tqn7lvC+evRFi56KmwXGMIanUlvFj9ms3qau6I/aCl8Yj/90w1 aeDzADkuS3xfW/vrDbAAoJefb/gVxWEmOoDgpnSiL4mSrgT4cwqf7uAyjlzQImrptd lOVY80/p8+ToPJJxDJikqEGAu0ULEqEdNjIdumi0= 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.10 126/563] arm64: dts: ti: k3-j721e: Fix the L2 cache sets Date: Mon, 24 Jan 2022 19:38:11 +0100 Message-Id: <20220124184028.760865545@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 d1ef9fbe4981d..a199227327ed2 100644 --- a/arch/arm64/boot/dts/ti/k3-j721e.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j721e.dtsi @@ -85,7 +85,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FEA9C47080 for ; Mon, 24 Jan 2022 20:57:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443311AbiAXU4l (ORCPT ); Mon, 24 Jan 2022 15:56:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385663AbiAXUdy (ORCPT ); Mon, 24 Jan 2022 15:33: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 6B955C07E2AF; Mon, 24 Jan 2022 11:47: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 35680B8119D; Mon, 24 Jan 2022 19:47:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69EEEC340E5; Mon, 24 Jan 2022 19:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053633; bh=4itlxwBn5EdSktaGF08AngWq/0212fQDk0X/qUiyCQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NG+rqSsKpVaUGEblEKQpWEVZyOsAauCPJhZGiu2PUMJG4vhX8JEBku4VzcuVMb2cM n0cFOb0yqtZAljlAZK80IogWM2O4fRTvEUI1wC65dK+5le4WTonOlIRlmIxD6N67Z3 MVx025LhPJZ2WL8xBF4vjWh3yjm3uAaQI9Kv/jng= 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.10 127/563] arm64: dts: ti: k3-j7200: Correct the d-cache-sets info Date: Mon, 24 Jan 2022 19:38:12 +0100 Message-Id: <20220124184028.796715914@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 081b8f3d44c44..03a9623f0f956 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j7200.dtsi @@ -60,7 +60,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 @@ -74,7 +74,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C005C35272 for ; Mon, 24 Jan 2022 20:57:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443434AbiAXU4z (ORCPT ); Mon, 24 Jan 2022 15:56:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346411AbiAXUdy (ORCPT ); Mon, 24 Jan 2022 15:33: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 B1FCEC07E2B0; Mon, 24 Jan 2022 11:47: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 582E2B811F9; Mon, 24 Jan 2022 19:47:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BC77C340E5; Mon, 24 Jan 2022 19:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053636; bh=OHhwjXkBsD5R4QcwYkR1d17e/ZJhJIHy3HA4FGFsKoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GsvC99UCzd/1n+Z2JJZdAlMsyBYTDveoWL1llMW8IP0vMvx/BguaIM6x5oR9267JU UJudlHFCwl4d/z5ZMEWgtSmYpCnnkx0sTPe49uOoIhSagg28xL2dxIFPE6+Vg7pD+b TCMuS1Ibjtr7VI/QSbXCVtp2mvZFCKTLOKK4SsM0= 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.10 128/563] tty: serial: uartlite: allow 64 bit address Date: Mon, 24 Jan 2022 19:38:13 +0100 Message-Id: <20220124184028.827395757@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 7081ab322b402..48923cd8c07d1 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -615,7 +615,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BC4FC4332F for ; Mon, 24 Jan 2022 20:07:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377179AbiAXUFE (ORCPT ); Mon, 24 Jan 2022 15:05:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37574 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356796AbiAXTrV (ORCPT ); Mon, 24 Jan 2022 14:47: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 4D81EB810AF; Mon, 24 Jan 2022 19:47:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 660A6C340E7; Mon, 24 Jan 2022 19:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053639; bh=6PLOMSkgW1QeNaVTsN6D0t/E044TpfIWC22pcVa6glg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=07yfp474Niyd6C82E+iy/fC5GwcED+Jt4yqmjxFD5Fuj2qyE8/H4AixR/5HHguuZd fbQLin77HpcqNYc8ioNqiswVdsDUebywON56kKxpkbGICSplP8DbSv2DiCt7ueSHK4 92sGFIiN6eweD6V54QEc4PKpQQ9tsmr1jE0fSVRc= 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.10 129/563] serial: amba-pl011: do not request memory region twice Date: Mon, 24 Jan 2022 19:38:14 +0100 Message-Id: <20220124184028.859500549@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 b3cddcdcbdad0..61183e7ff0097 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2083,32 +2083,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 /* @@ -2123,6 +2104,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 @@ -2140,8 +2123,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 @@ -2171,8 +2152,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B13D9C4332F for ; Mon, 24 Jan 2022 21:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444154AbiAXVAI (ORCPT ); Mon, 24 Jan 2022 16:00:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385755AbiAXUeR (ORCPT ); Mon, 24 Jan 2022 15:34:17 -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 161F3C07E2B1; Mon, 24 Jan 2022 11:47: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 A6F8360909; Mon, 24 Jan 2022 19:47:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B5AFC340E5; Mon, 24 Jan 2022 19:47:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053642; bh=JN2ZtrlZZq+lwbPgYdIfw0YhHsPwbNVgX/I78M3ZIJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jha/f0B6gv2A7Pi19Hhp9PxoCokJI8cCxWPUDTFW2Q2Ybk53/Ouz57xplWfOsc3qs Bqkj6P/ln0I0dD/ctuG5z7+KlCg6ub86fxl4U86OXItb20Qje+S+HGYZZjCUVuaJaF ezGzot8m8bNwfNm8DRisUk3ApFJIMSm/m149cH2U= 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.10 130/563] floppy: Fix hang in watchdog when disk is ejected Date: Mon, 24 Jan 2022 19:38:15 +0100 Message-Id: <20220124184028.889999633@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 7df79ae6b0a1e..eb4f841902aee 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91F36C43217 for ; Mon, 24 Jan 2022 20:07:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377658AbiAXUFs (ORCPT ); Mon, 24 Jan 2022 15:05:48 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44556 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356825AbiAXTr0 (ORCPT ); Mon, 24 Jan 2022 14:47: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 B71A0614B8; Mon, 24 Jan 2022 19:47:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DE9DC340E5; Mon, 24 Jan 2022 19:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053645; bh=oBOWS0qSB6my7suxv9Ogc5k8rMLJFocX8CChj6AC7Rs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=isNRp2DzAMwGmFOzswwxySklLLEyf3CVn+mcUuCSCsuVtr3ueTuH29abXRO+lyWA2 /Lf28kdT90gEI+RMrszDqh9L7GYzWLuE6qVQ1Crgal3ZzrVqXwtFE2gM9Sy55U45WB BeY7J4JG1WCOoylbPJ+DS2jQPbORafAmECm4GivI= 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.10 131/563] staging: rtl8192e: return error code from rtllib_softmac_init() Date: Mon, 24 Jan 2022 19:38:16 +0100 Message-Id: <20220124184028.929857277@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 4cabaf21c1ca0..367db4acc7852 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1982,7 +1982,7 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, stru= ct rtllib_device *ieee); void rtllib_stop_send_beacons(struct rtllib_device *ieee); void notify_wx_assoc_event(struct rtllib_device *ieee); 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 2c752ba5a802a..e8e72f79ca007 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2953,7 +2953,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 @@ -2964,7 +2964,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; @@ -3030,6 +3031,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0496FC4167B for ; Mon, 24 Jan 2022 20:07:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377309AbiAXUFQ (ORCPT ); Mon, 24 Jan 2022 15:05:16 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44612 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356866AbiAXTr3 (ORCPT ); Mon, 24 Jan 2022 14:47: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 E670361482; Mon, 24 Jan 2022 19:47:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C74C8C340E5; Mon, 24 Jan 2022 19:47:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053648; bh=TVOUWNBzfDhAxoXUMjAv2R95FzmE2kWLWGzml5e+0xM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JbLA4cTt8OEPknGbSms3QHQP5pqakfNiDNzoADlSLFCkk53foMvDhNcnuh/xyeNRD g60yiejIc3/XesE/NN1MPD4+2mv0c022H2yzSh8DALaGHqNHvnBdevdGqj5hNt8DH2 gLiyMk6lXaeaDiVGcHhoZCl6eaeXEpJ14RXSqfQ4= 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.10 132/563] staging: rtl8192e: rtllib_module: fix error handle case in alloc_rtllib() Date: Mon, 24 Jan 2022 19:38:17 +0100 Message-Id: <20220124184028.961332004@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CC22C433FE for ; Mon, 24 Jan 2022 21:03:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444185AbiAXVAO (ORCPT ); Mon, 24 Jan 2022 16:00:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385753AbiAXUeR (ORCPT ); Mon, 24 Jan 2022 15:34:17 -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 2973AC07E2B2; Mon, 24 Jan 2022 11:47: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 B72E061031; Mon, 24 Jan 2022 19:47:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86BFFC340E5; Mon, 24 Jan 2022 19:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053654; bh=ggla/Yz+ITzSU4ztgRFW2D+JIRyY7XHV0g+QPadtVBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CX33/SZAJ5lsuVVXSsGcEpUlN79614YqBsEWFfutFE778afME7+6Dam51ojGvTKYR DsqoPW8AOrrN5RxmW514gLCcQqkzT6IRVOKZLhbsTRz/UPqmMZlAwzZ62BInHqBwNP 8d2hDe3WsaK6Sm35I/MNOIaN7ew9JZEdZiLv/P7E= 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.10 133/563] Bluetooth: btmtksdio: fix resume failure Date: Mon, 24 Jan 2022 19:38:18 +0100 Message-Id: <20220124184028.990244432@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/bluetooth/btmtksdio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c index 5f9f027956317..74856a5862162 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0ECC5C4167D for ; Mon, 24 Jan 2022 23:59:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367459AbiAXXzc (ORCPT ); Mon, 24 Jan 2022 18:55:32 -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 S1846531AbiAXXQP (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 27FA1C07E2B3; Mon, 24 Jan 2022 11:47: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 B9F2D60909; Mon, 24 Jan 2022 19:47:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A645C340E5; Mon, 24 Jan 2022 19:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053657; bh=mmvAoJjg43JXHo+H49l9ox+6UY5dyipU5KxhAj68wNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uERMQBz8ZculV3aWLnga7v0AiuZQLXmzuWs1SlULGNvrjakjH3CTCHIaulu+sDK/i ZY3Qa5VgDl/33ja+KiBGvILh/mkggkKJQC9DGThBx3E46Gf8CFu6Q6ZfPavGWdLLYK nS/Jkl/ChyVZcxrLyrtmnhG94z+QeJdjWeUASwbY= 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.10 134/563] sched/fair: Fix detection of per-CPU kthreads waking a task Date: Mon, 24 Jan 2022 19:38:19 +0100 Message-Id: <20220124184029.032288957@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- kernel/sched/fair.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c004e3b89c324..a7589552be5fc 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6284,6 +6284,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2EC2C4167B for ; Mon, 24 Jan 2022 20:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443385AbiAXU4s (ORCPT ); Mon, 24 Jan 2022 15:56:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345513AbiAXUeT (ORCPT ); Mon, 24 Jan 2022 15:34:19 -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 D5453C07E2B4; Mon, 24 Jan 2022 11:47: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 9BDE7B811FB; Mon, 24 Jan 2022 19:47:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1E04C340E5; Mon, 24 Jan 2022 19:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053660; bh=dKB+66OEFYLtY2vwiuFxKSq1TWOn9R5HhTm/Y3CAfr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=izDFkG76I3zTbg+mc/rLPGSR2EwHESwlZttb0cL3tEHFX6cvCyzD1BKwpxg3c423I NMoKrYq4flAoPspGu0JxGvkKYYMT5AWxZtAUhOW2mHXaGGpuVkayfAwK/ac5m1A/re kMa5rKKi9521l+mzaosrjbyao0thAnMbe3Sk6VgE= 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.10 135/563] sched/fair: Fix per-CPU kthread and wakee stacking for asym CPU capacity Date: Mon, 24 Jan 2022 19:38:20 +0100 Message-Id: <20220124184029.069413824@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a7589552be5fc..2a33cb5a10e59 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6286,7 +6286,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89BDDC43217 for ; Mon, 24 Jan 2022 20:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377534AbiAXUFg (ORCPT ); Mon, 24 Jan 2022 15:05:36 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44854 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356961AbiAXTrp (ORCPT ); Mon, 24 Jan 2022 14:47: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 F2F916131E; Mon, 24 Jan 2022 19:47:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D28F9C340E5; Mon, 24 Jan 2022 19:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053663; bh=CK6VH06TPdfkCC62W0JQK2cm9ehLj5Fn/1ycjcQy56A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KYT7yEsaYx1I/rEOAu6v3yqkqdooAt9xf3LR2cKnbH2M5DkXjITWEXijryNpuWZnI XJCZgBPG5kFVThPz/ksZcrW/4OBHA4zPsjWQrjt7GsJooZbDHKaIDeUoSGku/zvW67 0nrLhtvuiUZWVDT/d98y0Vkh/iDZ8/2EEI5WyoXE= 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.10 136/563] bpf: Adjust BTF log size limit. Date: Mon, 24 Jan 2022 19:38:21 +0100 Message-Id: <20220124184029.099971589@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 aaf2fbaa0cc76..72534a6f4b96e 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -4135,7 +4135,7 @@ static struct btf *btf_parse(void __user *btf_data, u= 32 btf_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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1AECC433EF for ; Tue, 25 Jan 2022 00:08:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2369381AbiAYABi (ORCPT ); Mon, 24 Jan 2022 19:01:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1582577AbiAXXSL (ORCPT ); Mon, 24 Jan 2022 18:18: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 5F57DC07E2B6; Mon, 24 Jan 2022 11:47: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 2921AB811FB; Mon, 24 Jan 2022 19:47:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB6CCC340E5; Mon, 24 Jan 2022 19:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053666; bh=NIojz0mwTHuakUmqbFqSQLDvgevWrG2IYU8Sb4U4LNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TlTs+cbkx0l4wm+GjDh3NlYKU/RiGbYxErmGbmAiIify5E8oTrJXNSuUvPFgJJpkp EPlTYYUI2XiOKxPuuG6pVDOmT2gOjJB27WzSxvIhFVGWSpSez5xIxMxWOUagjXjN2i HZ1uPpSIj0JuIGrRM+rj+yuGQwOvh5lpW6uwp9Fg= 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.10 137/563] bpf: Disallow BPF_LOG_KERNEL log level for bpf(BPF_BTF_LOAD) Date: Mon, 24 Jan 2022 19:38:22 +0100 Message-Id: <20220124184029.137867989@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 6e330ff2f28df..391bc1480dfb1 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -367,6 +367,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 72534a6f4b96e..dc497eaf22663 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -4135,8 +4135,7 @@ static struct btf *btf_parse(void __user *btf_data, u= 32 btf_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 b43c9de34a2c2..c623c3e549210 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -12349,11 +12349,11 @@ int bpf_check(struct bpf_prog **prog, union bpf_a= ttr *attr, 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42A67C35271 for ; Mon, 24 Jan 2022 20:57:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443353AbiAXU4o (ORCPT ); Mon, 24 Jan 2022 15:56:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384954AbiAXUeT (ORCPT ); Mon, 24 Jan 2022 15:34:19 -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 074F1C07E2B7; Mon, 24 Jan 2022 11:47: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 A203B61031; Mon, 24 Jan 2022 19:47:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77A19C340E5; Mon, 24 Jan 2022 19:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053670; bh=H0Nf65V8r/RvVEwCt8j9T0Es3uLNGZIIW5tsXERlElY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uFbLQqYVtTq0HCRZxhcyWur1rEeVYSBSTA+aXuejyY6QTORT4/2JdiM06gTgTi5dm BjC6OdNVXYvpJBb75NhY5bXNttV1hVAJozAJcdRWswcRTf3CHog0YE5PmHu8Vdro0H RTU53KGEb3O5iR8GYX9kucUMGtyEuxwNnLJdYqpQ= 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.10 138/563] bpf: Remove config check to enable bpf support for branch records Date: Mon, 24 Jan 2022 19:38:23 +0100 Message-Id: <20220124184029.173197383@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ba644760f5076..a9e074769881f 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -1517,9 +1517,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; @@ -1528,7 +1525,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; @@ -1540,7 +1537,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 439FCC4332F for ; Tue, 25 Jan 2022 02:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233707AbiAYCn4 (ORCPT ); Mon, 24 Jan 2022 21:43:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387518AbiAXUgy (ORCPT ); Mon, 24 Jan 2022 15:36: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 398A6C038AF5; Mon, 24 Jan 2022 11:50: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 CEC6760A28; Mon, 24 Jan 2022 19:50:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9462C340E7; Mon, 24 Jan 2022 19:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053801; bh=7Gn/6wz8LMSKYolBvf8PNaQwMzarikHb90OTHazhURw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MqoJ/xQmo/QPmoh1g4Be8RQ/SiPYLl1U/XkUVvjoMtySUuhZzlPZjlg4qXu3yteb5 A+hbJag3OuslgvnJ9oiko2t+SBRSah8vU09h+hZWXHPET/pV79G/OC9GEP7mJ16Wg6 Pu8fD6boxtq1vpdGyZqDDMJcplVDNjCD98y3hXho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Quentin Perret , Marc Zyngier , Sasha Levin Subject: [PATCH 5.10 139/563] arm64: lib: Annotate {clear, copy}_page() as position-independent Date: Mon, 24 Jan 2022 19:38:24 +0100 Message-Id: <20220124184029.214159326@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Will Deacon [ Upstream commit 8d9902055c57548bb342dc3ca78caa21e9643024 ] clear_page() and copy_page() are suitable for use outside of the kernel address space, so annotate them as position-independent code. Signed-off-by: Will Deacon Signed-off-by: Quentin Perret Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20210319100146.1149909-2-qperret@google.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- arch/arm64/lib/clear_page.S | 4 ++-- arch/arm64/lib/copy_page.S | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/lib/clear_page.S b/arch/arm64/lib/clear_page.S index 073acbf02a7c8..b84b179edba3a 100644 --- a/arch/arm64/lib/clear_page.S +++ b/arch/arm64/lib/clear_page.S @@ -14,7 +14,7 @@ * Parameters: * x0 - dest */ -SYM_FUNC_START(clear_page) +SYM_FUNC_START_PI(clear_page) mrs x1, dczid_el0 and w1, w1, #0xf mov x2, #4 @@ -25,5 +25,5 @@ SYM_FUNC_START(clear_page) tst x0, #(PAGE_SIZE - 1) b.ne 1b ret -SYM_FUNC_END(clear_page) +SYM_FUNC_END_PI(clear_page) EXPORT_SYMBOL(clear_page) diff --git a/arch/arm64/lib/copy_page.S b/arch/arm64/lib/copy_page.S index e7a793961408d..29144f4cd4492 100644 --- a/arch/arm64/lib/copy_page.S +++ b/arch/arm64/lib/copy_page.S @@ -17,7 +17,7 @@ * x0 - dest * x1 - src */ -SYM_FUNC_START(copy_page) +SYM_FUNC_START_PI(copy_page) alternative_if ARM64_HAS_NO_HW_PREFETCH // Prefetch three cache lines ahead. prfm pldl1strm, [x1, #128] @@ -75,5 +75,5 @@ alternative_else_nop_endif stnp x16, x17, [x0, #112 - 256] =20 ret -SYM_FUNC_END(copy_page) +SYM_FUNC_END_PI(copy_page) EXPORT_SYMBOL(copy_page) --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7128C433F5 for ; Tue, 25 Jan 2022 02:33:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421030AbiAYC0A (ORCPT ); Mon, 24 Jan 2022 21:26:00 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37996 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244239AbiAXTsT (ORCPT ); Mon, 24 Jan 2022 14:48: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 CE296B81215; Mon, 24 Jan 2022 19:48:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFFD6C340E5; Mon, 24 Jan 2022 19:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053695; bh=16LNaUCzIzb/T+JoyZ/ziwN0gPqMj0yFnQdm07T7pxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=shcIEfWvnM0gbpdkALGEjXiDVd3xiWRmKG35WGE8uVqi+u762JnRbPFx6TpIANYbA uZ9OuijgvGMpkD1Ec6q+TMgA+NeYwywhh/SdwjWQ0aok3IhDEgJsjbJqnhUAs5SSoc kRu/YdOSaT7QNgMqLFxG7alHqNqiIr5o0Pm2yRno= 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.10 140/563] arm64: clear_page() shouldnt use DC ZVA when DCZID_EL0.DZP == 1 Date: Mon, 24 Jan 2022 19:38:25 +0100 Message-Id: <20220124184029.244698891@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87F73C46467 for ; Mon, 24 Jan 2022 20:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443536AbiAXU5O (ORCPT ); Mon, 24 Jan 2022 15:57:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386440AbiAXUfa (ORCPT ); Mon, 24 Jan 2022 15:35: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 54643C02C308; Mon, 24 Jan 2022 11:48: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 ams.source.kernel.org (Postfix) with ESMTPS id 111B9B8122A; Mon, 24 Jan 2022 19:48:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DCFAC340E7; Mon, 24 Jan 2022 19:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053729; bh=Yp1NnFfvlH+1ASCwb2Hc7AdUpcyrvhhExdH1MabsrVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Re8pzJ5qsdd6Si+w4sXiRmwzAOLqOLAhxtB4X99mO6WfcSizoPfrKgoHc4U9ztXO+ Ey5qkzr/OQLL47Z+RkdZKxVKiJesKO2JuCa5DpiaVUtkQa/+Z0osfZT3htz8Hrf5ys oX6VSLBagNl/N5EhjXVhe1N8nJGntQnJjcPrNMYs= 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.10 141/563] media: dib8000: Fix a memleak in dib8000_init() Date: Mon, 24 Jan 2022 19:38:26 +0100 Message-Id: <20220124184029.274901219@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6234BC4332F for ; Mon, 24 Jan 2022 20:08:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347547AbiAXUH6 (ORCPT ); Mon, 24 Jan 2022 15:07:58 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38688 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356754AbiAXTt0 (ORCPT ); Mon, 24 Jan 2022 14:49: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 8267DB8121A; Mon, 24 Jan 2022 19:49:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B83FC340E5; Mon, 24 Jan 2022 19:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053763; bh=awbqRVaIUfFP7Xv7D24AO89VIJbRkobad3YVxWh0VP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HO7PeqamNdX1ocAGL7wOB66aa9B8a6LaEWihrdvhNkjCrAbS9Ak/F22G/lyabDCNW McRzimx6rZYgM3Pj/OXp5qnbCO+FKkEM3qB4rWaN525BjuTGGo99tG00ut/HFwAqMD G63cb9YP/YKjx0v4kQcvpF5gKusAkELBNe+4F1bI= 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.10 142/563] media: saa7146: mxb: Fix a NULL pointer dereference in mxb_attach() Date: Mon, 24 Jan 2022 19:38:27 +0100 Message-Id: <20220124184029.315256898@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07D1FC43217 for ; Tue, 25 Jan 2022 02:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1312566AbiAYCn0 (ORCPT ); Mon, 24 Jan 2022 21:43:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387488AbiAXUgw (ORCPT ); Mon, 24 Jan 2022 15:36: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 87A9AC061796; Mon, 24 Jan 2022 11:49: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 4F6F4B811F9; Mon, 24 Jan 2022 19:49:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 766B8C340E5; Mon, 24 Jan 2022 19:49:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053781; bh=ipc7IAl6/w4aJnjz2NcJSJkZF0EoOSK7yODQSB9i+8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WDs71H1Uvvk2ECfvxaTmYQ+xYe24cC6J7gpDmey41bITqFKwSDACfjyzTHdgPBVao 8hYJED8IdtU8PIcV1T6bppJt3rI/A4t+Ie4rZwXqBUK7Tnj7m4RXhOX+EGBy3rxXKk C+87Os4UiTDmdCzF5tckbB9/gxNjwKFueSxNnDyI= 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.10 143/563] media: si2157: Fix "warm" tuner state detection Date: Mon, 24 Jan 2022 19:38:28 +0100 Message-Id: <20220124184029.349318252@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0734C433FE for ; Mon, 24 Jan 2022 20:08:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359855AbiAXUIV (ORCPT ); Mon, 24 Jan 2022 15:08:21 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46872 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357288AbiAXTtp (ORCPT ); Mon, 24 Jan 2022 14:49: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 9BD2D60918; Mon, 24 Jan 2022 19:49:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 783AEC340E5; Mon, 24 Jan 2022 19:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053784; bh=NME2bflPx5hxDRxQHfuwV9nyDf/2Q6iYYa/VJjCsh4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SaYaOrUcmGYH8e0fIKRQd4Xgw5JfsfWOuLR19DdJGgfRPreZj2dLZPKFurTyXV931 MxbUhQ9YenDR7ZxJ/OTkCvKOLWAN4Nq/Fjmb4ljjAeXd4PS5hro128EHeu4mrRX1/G JwxOjiNifkVm3/vy1q5nrlygCanM3DdFEI+7WGmc= 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.10 144/563] wireless: iwlwifi: Fix a double free in iwl_txq_dyn_alloc_dma Date: Mon, 24 Jan 2022 19:38:29 +0100 Message-Id: <20220124184029.380871878@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 9181221a2434d..0136df00ff6a6 100644 --- a/drivers/net/wireless/intel/iwlwifi/queue/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/queue/tx.c @@ -1148,6 +1148,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E401C4321E for ; Tue, 25 Jan 2022 02:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1312728AbiAYCnt (ORCPT ); Mon, 24 Jan 2022 21:43:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387510AbiAXUgx (ORCPT ); Mon, 24 Jan 2022 15:36: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 04B17C02B8CC; Mon, 24 Jan 2022 11:49: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 9648660989; Mon, 24 Jan 2022 19:49:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F529C340E5; Mon, 24 Jan 2022 19:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053787; bh=zC2koczZ0VUmYS5Z+Ioxhq+/po4DCrtzwVL/2B+YlmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LRoUY7tF+/fLueG1Q1hxyZGzmn82+Yz392E+dmd+hmswTjShoRR9Mgb0phEaDSGib 5XaesjozojW0o4LxDxZkc2SoidZ2ZcRUHf2tgaGIh4HVPtHq4gUZK4JMlHcjvd4d2h BHIEm7+DD3ljEi7zFkItOxwnhhLrbWvFZBEfitOQ= 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.10 145/563] sched/rt: Try to restart rt period timer when rt runtime exceeded Date: Mon, 24 Jan 2022 19:38:30 +0100 Message-Id: <20220124184029.412445053@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 b5cf418e2e3fe..41b14d9242039 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; @@ -1022,13 +1027,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)); } } } @@ -2727,8 +2736,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44F19C433FE for ; Mon, 24 Jan 2022 20:08:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353569AbiAXUIn (ORCPT ); Mon, 24 Jan 2022 15:08:43 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38884 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357360AbiAXTtw (ORCPT ); Mon, 24 Jan 2022 14:49: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 8CBBAB810AF; Mon, 24 Jan 2022 19:49:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D847C340E5; Mon, 24 Jan 2022 19:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053790; bh=Hh8VGhYGSCAAIyMqk/0C8kJdzgofq8D1WaPueErDi4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xvpXk4zjsBudtHWXmKClfPpYGFft4RVNuvkOT3RC85RHskFbpmdQ4SgwG198qGXUy hRrq8ljouMLlzHD/mTK2d+iolETRlX4YHbKopIlmtiMCeeAQpR4AbMYEq4cHyzCuuE y1UXP38m72e0OO3dH7zYUmTdKHwwt2rrvjjl0uUY= 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.10 146/563] drm/msm/dp: displayPort driver need algorithm rational Date: Mon, 24 Jan 2022 19:38:31 +0100 Message-Id: <20220124184029.449876198@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 dabb4a1ccdcf7..1aad34b5ffd7f 100644 --- a/drivers/gpu/drm/msm/Kconfig +++ b/drivers/gpu/drm/msm/Kconfig @@ -60,6 +60,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DC08C433EF for ; Mon, 24 Jan 2022 20:08:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378708AbiAXUI1 (ORCPT ); Mon, 24 Jan 2022 15:08:27 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38908 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357411AbiAXTt6 (ORCPT ); Mon, 24 Jan 2022 14:49: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 5EE24B81229; Mon, 24 Jan 2022 19:49:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEE6DC340E7; Mon, 24 Jan 2022 19:49:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053795; bh=q0f3Kyn2K6gkI2P9btt0obaREPOGXLT3e/syK84A8O4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LeOTfpnEoJnfDqfCRQNQIouJC8n+BpE4TXRj2TUE/Jouo84+RgMuPQqMn2EKAh1tF +IZl9Cmx/i7v/MxCWbd27VTzZ1109JtsNZhOS1IS/p3dZ5RFUYRX9H2jGGOxeCktvY 5r5RIzx4hVp2XrX51/RdnnvKFuo0+QLY5MGmw1c4= 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.10 147/563] rcu/exp: Mark current CPU as exp-QS in IPI loop second pass Date: Mon, 24 Jan 2022 19:38:32 +0100 Message-Id: <20220124184029.484611296@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 0ffe185c1f46a..0dc16345e668c 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2938FC433EF for ; Mon, 24 Jan 2022 21:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448954AbiAXV1u (ORCPT ); Mon, 24 Jan 2022 16:27:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387515AbiAXUgy (ORCPT ); Mon, 24 Jan 2022 15:36: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 2E636C038AF4; Mon, 24 Jan 2022 11:49: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 BFAE960B03; Mon, 24 Jan 2022 19:49:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F85EC340E5; Mon, 24 Jan 2022 19:49:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053798; bh=YDjUoVyK2QZHgahWsrbWXcshySCqkSFQvmka6DxA3K4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vhCEmZrulHGMkwqp6JqpLEiIbt69llL16z3++VfXtC8iZ2QCQ4VgQOIv4ahvolkZl NhQVoZjfyDyDH20tkM7agiAxREBIaUNLAdLc1FhahufIUST2avfOYVUpY2h+9H/+aq MAB4FGznnzD2DajFTv6cCVQnfg1bB085rWGIs6WQ= 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.10 148/563] mwifiex: Fix possible ABBA deadlock Date: Mon, 24 Jan 2022 19:38:33 +0100 Message-Id: <20220124184029.520070168@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 bc79ca4cb803c..753458628f86a 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -364,10 +364,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 @@ -399,11 +401,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A738BC46467 for ; Mon, 24 Jan 2022 23:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367687AbiAXX4Q (ORCPT ); Mon, 24 Jan 2022 18:56:16 -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 S1846611AbiAXXQb (ORCPT ); Mon, 24 Jan 2022 18:16: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 4BAB5C08EE6E; Mon, 24 Jan 2022 11:48: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 08A07B811F3; Mon, 24 Jan 2022 19:48:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C7A0C340E7; Mon, 24 Jan 2022 19:48:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053698; bh=0sWFuJFbcEAODzI6BQVR4P305YINCtGmvnWNLVcfTuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1BJvAY89w82OS4HdaXKBSdsd5mFHQYZYSt1SML5IQOdvok+FwgfPCbi26qtgjTUhk 2jLRp7FHRk6kLBQa7ehMRgLdaVcYIftuIQOwYXa8jC2lv8G3mtxd+0Ga8KVGn3MaoS 5VET+1wX/x8BqgxaNygcm2iolxFUIgnpbSEZlLds= 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.10 149/563] xfrm: fix a small bug in xfrm_sa_len() Date: Mon, 24 Jan 2022 19:38:34 +0100 Message-Id: <20220124184029.559356236@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 6f97665b632ed..97f7ebf5324e7 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -2898,7 +2898,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4977FC41535 for ; Mon, 24 Jan 2022 20:07:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377620AbiAXUFp (ORCPT ); Mon, 24 Jan 2022 15:05:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38076 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346919AbiAXTsY (ORCPT ); Mon, 24 Jan 2022 14:48: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 1EF3BB811FB; Mon, 24 Jan 2022 19:48:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BFC2C340E5; Mon, 24 Jan 2022 19:48:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053701; bh=w+al1ds14mD9E7dlVSEZTS3IUW3zxxoIo+M8eVMaPqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lDr/dDKdAl14w/jJHFiXwBzduGlfWtbM9gb+ZvPtkZTe3N6EotN4VQLT0q0cuPQ/E 13rBNpR5ouPI8/dJF1AiPZqSYOGiGj+mEqWH7DsB8lVbqbCuUAj3Gvi1lDgfreYy/G dn+aE/xnLehjYvn2IOy3u05PYyjKTPf8v5S4At7A= 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.10 150/563] x86/uaccess: Move variable into switch case statement Date: Mon, 24 Jan 2022 19:38:35 +0100 Message-Id: <20220124184029.597819962@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 5c95d242f38d7..bb1430283c726 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFDD4C433FE for ; Tue, 25 Jan 2022 02:33:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421048AbiAYC0C (ORCPT ); Mon, 24 Jan 2022 21:26:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45628 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347817AbiAXTs0 (ORCPT ); Mon, 24 Jan 2022 14:48: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 6F97C612E9; Mon, 24 Jan 2022 19:48:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57B78C340E5; Mon, 24 Jan 2022 19:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053704; bh=485Pel/umrmGTI7pbf0TizhUtAcoT/WJdPbsQcA5Gb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w7pCNwDnkVRmKWv9J8izLv8/dX856/Axt+/B8OvTIXYtCj8t9HY0IVkbYjxlA6VRX ii2HxKlztTU4CRuzubEsFWwjr3vzF841HCHDV6Ul9KLcY/SjtMGEq4UjcMlIVwaNZd HspaySBgkNRxKFvN/WS7637AYD3yFsaLYNeL+wvg= 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.10 151/563] selftests: clone3: clone3: add case CLONE3_ARGS_NO_TEST Date: Mon, 24 Jan 2022 19:38:36 +0100 Message-Id: <20220124184029.628320367@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49A08C3526C for ; Mon, 24 Jan 2022 23:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367560AbiAXXzv (ORCPT ); Mon, 24 Jan 2022 18:55:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846539AbiAXXQT (ORCPT ); Mon, 24 Jan 2022 18:16:19 -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 EAAA2C09425A; Mon, 24 Jan 2022 11:48: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 86A4F61523; Mon, 24 Jan 2022 19:48:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C56EC340E5; Mon, 24 Jan 2022 19:48:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053708; bh=Y/PntOGbeKcLkcguD4MJEGdYfgJmLyuZlGDpwaQ0Bg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WSWoQNzauf1IPAHuR7RiWReDobLQ/HuT+ZXPaFUp2EVIABorKWJqSkja3IIEwAquS +jyNLl66GY8WCkLzTmCla1WZSMzznHzNYYgzFADVUnqp4r97oay4PK6LdLNJ1Qsxj1 GVFuhi3+gdVoy5xtRH8vqZ8LYJT0e2hdZRp+MhIQ= 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.10 152/563] selftests: harness: avoid false negatives if test has no ASSERTs Date: Mon, 24 Jan 2022 19:38:37 +0100 Message-Id: <20220124184029.661119362@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 edce85420d193..5ecb9718e1616 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -965,7 +965,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A55BC433FE for ; Mon, 24 Jan 2022 20:07:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377734AbiAXUFy (ORCPT ); Mon, 24 Jan 2022 15:05:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45688 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349931AbiAXTse (ORCPT ); Mon, 24 Jan 2022 14:48: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 9862E61523; Mon, 24 Jan 2022 19:48:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F6E6C340E5; Mon, 24 Jan 2022 19:48:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053711; bh=Ta3/1LLC6DwEG0sQyMUdKfg8TkHsYZQsq1+TVOjRIwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MhyOhbMqhyCT9G+k1P89DP9zEyt0Su+Jij8psdXAjNHqvViWM32FdfljUJqNAMQbn whBZrEGvUR7mFxenIyL16lqwA/MwmJnSHMtU9/I4AM+Zkimy3H7f6FpQefOG1KZu2A rlEu80YBX9AZndlYyHaf98oyLodk/SwToeTKI6+Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 153/563] crypto: stm32 - Fix last sparse warning in stm32_cryp_check_ctr_counter Date: Mon, 24 Jan 2022 19:38:38 +0100 Message-Id: <20220124184029.691958504@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 81064c96d88180ad6995d52419e94a78968308a2 ] This patch changes the cast in stm32_cryp_check_ctr_counter from u32 to __be32 to match the prototype of stm32_cryp_hw_write_iv correctly. Reported-by: kernel test robot Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 7999b26a16ed0..7389a0536ff02 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -1229,7 +1229,7 @@ static void stm32_cryp_check_ctr_counter(struct stm32= _cryp *cryp) cr =3D stm32_cryp_read(cryp, CRYP_CR); stm32_cryp_write(cryp, CRYP_CR, cr & ~CR_CRYPEN); =20 - stm32_cryp_hw_write_iv(cryp, (u32 *)cryp->last_ctr); + stm32_cryp_hw_write_iv(cryp, (__be32 *)cryp->last_ctr); =20 stm32_cryp_write(cryp, CRYP_CR, cr); } --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F904C43217 for ; Mon, 24 Jan 2022 23:58:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366517AbiAXXw7 (ORCPT ); Mon, 24 Jan 2022 18:52:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1845987AbiAXXOJ (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 148CDC09425D; Mon, 24 Jan 2022 11:48: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 A77FE614BB; Mon, 24 Jan 2022 19:48:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63C47C340E5; Mon, 24 Jan 2022 19:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053714; bh=f21MzGFvooadYexLUcwxb1T6t4IyhWjyJE0ILpkgpd8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O8SVuJYM1jxrOJ2Z4g3sQ4ijb0UCKmXO0XvDZ438zozri5UuvDBIncKfsbGsUZczC InIflB162PkT5DZEuEUaUvITL0NxjUgl/NbJnzab+UrYD060m+1eesCWYwsitBLZXo 5wxykPTK/J+UbsUHkUP1pAS8HlfpFw/eHwSVbchg= 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.10 154/563] crypto: stm32/cryp - fix CTR counter carry Date: Mon, 24 Jan 2022 19:38:39 +0100 Message-Id: <20220124184029.722778646@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD880C433EF for ; Tue, 25 Jan 2022 02:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421185AbiAYC01 (ORCPT ); Mon, 24 Jan 2022 21:26:27 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38266 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344431AbiAXTsk (ORCPT ); Mon, 24 Jan 2022 14:48: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 75973B8124C; Mon, 24 Jan 2022 19:48:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94E18C340EF; Mon, 24 Jan 2022 19:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053717; bh=1Xu0fY9+VgGKTdVcFCdBa37F4Om7SvBXrvrP+wodbko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mGcgHpsmMPkru30ejAkt5iQCm9opDL1FJFCiTerXg+XQoOozmP1+qb0vM5nNjXgWs 3eyr+uVS229MnJAMT7kg28P3djciYumER3/9NAkI5GRW1mNKDLpAfA/Ax+AXTbX4ml aHWH1pvLBJFLVfn9p9O2b4WmhRjdYaeVNuBT/yZ4= 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.10 155/563] crypto: stm32/cryp - fix xts and race condition in crypto_engine requests Date: Mon, 24 Jan 2022 19:38:40 +0100 Message-Id: <20220124184029.752812235@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B206DC4321E for ; Mon, 24 Jan 2022 20:07:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353116AbiAXUHR (ORCPT ); Mon, 24 Jan 2022 15:07:17 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38296 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346805AbiAXTsm (ORCPT ); Mon, 24 Jan 2022 14:48: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 4E4AAB81142; Mon, 24 Jan 2022 19:48:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8241EC340E5; Mon, 24 Jan 2022 19:48:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053720; bh=po8e2/5PZlaR1L4ebFA+7hbiUKq4RTDZucpG7BuzS80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=URNNM7f5X/6z6x6I6CT/BbKGNrOvF0crskxICMnPS2zepDgEoVMtSYfNYJQlPy3Mv orIjllDKPhSvWAjdaPVzWv0rI32e151C4pi3gqLj9Hnqh6fyv/dwnlmcjkYDrL4enW XqAl3gyQV8rSncM3bSlY+8fRkhUj08Bu/M+ta9jE= 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.10 156/563] crypto: stm32/cryp - check early input data Date: Mon, 24 Jan 2022 19:38:41 +0100 Message-Id: <20220124184029.782338718@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3651C4167E for ; Tue, 25 Jan 2022 02:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421220AbiAYC0b (ORCPT ); Mon, 24 Jan 2022 21:26:31 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38346 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348252AbiAXTsr (ORCPT ); Mon, 24 Jan 2022 14:48: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 CF7D9B811F3; Mon, 24 Jan 2022 19:48:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82EB3C340E7; Mon, 24 Jan 2022 19:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053723; bh=SW3LaOTkedTk7adcIdVcisEywFdafNAxlRBLboYCbE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fVlkDS7q14p6OMljUSKcEZMsX+qlyQXnl9Z9XclEV+AlhAFGw7IUx4VvLhMg5BBs4 pNKbbnA8oE6QLFpj8jhtG0zB9+pseEc4knOrMRMDDTBDHZxULWMbRiU9F9OonsneIl 48eYAcl1F/K2uV/m6g2JcMnwmtGKUB72iYnSKq2M= 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.10 157/563] crypto: stm32/cryp - fix double pm exit Date: Mon, 24 Jan 2022 19:38:42 +0100 Message-Id: <20220124184029.822661198@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1BE3C35274 for ; Mon, 24 Jan 2022 20:57:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443597AbiAXU5b (ORCPT ); Mon, 24 Jan 2022 15:57:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386438AbiAXUfa (ORCPT ); Mon, 24 Jan 2022 15:35: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 346EAC02C3EF; Mon, 24 Jan 2022 11:48: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 E4326B81239; Mon, 24 Jan 2022 19:48:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17880C340E5; Mon, 24 Jan 2022 19:48:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053726; bh=Im0F7TeBzMVqLpyKF0wuta0Ts2zCgNoPJI3BvjCBY7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hN64lJdia7tRV5Lcr1DZuefAzYiXZyzKE+EBaAfEoFQ6ESFd+NTmiA/hDWCcx++kC R7Zg5wxyXRpJgfRYo4LLY22kxU9dkh1mXzpHkxXHGOlpaopfVuUR5kHh11HV4flMW8 jjjqqKdpGoPajyJCK4+ryMrGrXsFfo0hww3f68DQ= 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.10 158/563] crypto: stm32/cryp - fix lrw chaining mode Date: Mon, 24 Jan 2022 19:38:43 +0100 Message-Id: <20220124184029.861362732@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16791C433FE for ; Tue, 25 Jan 2022 02:33:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421261AbiAYC0f (ORCPT ); Mon, 24 Jan 2022 21:26:35 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38438 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351021AbiAXTs6 (ORCPT ); Mon, 24 Jan 2022 14:48: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 507B2B8122C; Mon, 24 Jan 2022 19:48:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46ADCC340E5; Mon, 24 Jan 2022 19:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053733; bh=07t6tUlxdf4guaoKPDTCTVGpGkBUBUAcsyVNPd1k+Ps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qAnxEGQWJwWgs1ibCVpuTKRqhMhaJ6spYhqwi0WLMFAmPNASz/T4z5gWgbYVaZinT AWDpdQ/1v4AN4m/QWELLu0dTAzKVG9MjMfxMOUtp+lKmEtB2JWHAvcZiRhd4MwJzzN XBoa5bXX20GN99ojlD8zfhK18dvZMPBydOUYBka8= 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.10 159/563] crypto: stm32/cryp - fix bugs and crash in tests Date: Mon, 24 Jan 2022 19:38:44 +0100 Message-Id: <20220124184029.893626081@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AFBEC433EF for ; Tue, 25 Jan 2022 02:33:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421240AbiAYC0d (ORCPT ); Mon, 24 Jan 2022 21:26:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46130 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351078AbiAXTs5 (ORCPT ); Mon, 24 Jan 2022 14:48: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 944E1601B6; Mon, 24 Jan 2022 19:48:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7176DC340E5; Mon, 24 Jan 2022 19:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053736; bh=qmKODafzn0xTB1HxAA7mC+0HKJowUFd9fWKDNtYGq94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rSlOggtwDSwsYd1B8bmxp2EJvIH1mtVhtXNNoXCHFI+Yg6Wau9yGk+AKV3Zg3De9H muU6BwebHBAmZzzTcky3su14oV6xySMEKaUHEGnoxnmJcVnq/24xCK86UWaJzvo1CJ 4Eo+3Blm5GjtIoBqdCD+TVT/KulrJRxApbcGqEig= 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.10 160/563] crypto: stm32 - Revert broken pm_runtime_resume_and_get changes Date: Mon, 24 Jan 2022 19:38:45 +0100 Message-Id: <20220124184029.923441972@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ff5362da118d8..16bb52836b28d 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -812,7 +812,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); @@ -961,7 +961,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(); @@ -999,7 +999,7 @@ static int stm32_hash_import(struct ahash_request *req,= 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F235FC433EF for ; Tue, 25 Jan 2022 02:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421305AbiAYC0j (ORCPT ); Mon, 24 Jan 2022 21:26:39 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46178 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351224AbiAXTtA (ORCPT ); Mon, 24 Jan 2022 14:49: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 A6D6F6090A; Mon, 24 Jan 2022 19:48:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6119BC340E5; Mon, 24 Jan 2022 19:48:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053739; bh=7DouWf9uGC+LpZdejRaEUyJvPvE7gEqFBc8S1BS3xPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gY9OUyy24ac2hw3eIoYSRaJ4Jpti/o8vzBos1zxTEwPok/kQDZm0xTCHYGo7VCx+z XyErVYn5eiMdp7z/N3hfRSGtc/ZePSXcX4H447BBtcNcwpT+mUOPh1nMPdDVI6y1X4 5rYYd7y5ca2IOihuOc7mffAq0prWhwApbewoz+ks= 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.10 161/563] ath11k: Fix deleting uninitialized kernel timer during fragment cache flush Date: Mon, 24 Jan 2022 19:38:46 +0100 Message-Id: <20220124184029.963599583@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 b4f8494e3c707..835ce805b63ec 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -2531,7 +2531,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB836C3526D for ; Mon, 24 Jan 2022 20:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443565AbiAXU5V (ORCPT ); Mon, 24 Jan 2022 15:57:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386453AbiAXUfa (ORCPT ); Mon, 24 Jan 2022 15:35: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 0FB05C02B8C0; Mon, 24 Jan 2022 11:49: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 9DFBC60989; Mon, 24 Jan 2022 19:49:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BE3CC340E5; Mon, 24 Jan 2022 19:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053742; bh=gpWjQ0VaBNniP4xA1fEF6HlyF6wN8PjRmBVxu/REmpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BU5NIXXtueqWxk8+c8bj1b0mkh2llS3dMNt7cpWhmeqac845T4ln5PwD6AJqNKQuM DJifHqM8FbzL7TX3psHqYYOOH5ZCROLILkPzyOBNEpxqoBqLqM4op3I6ODvpS40oXV OlTkSWNA5Ltp5HvTeT1Ggx59abD8hnX1prDqE3cw= 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.10 162/563] ARM: dts: gemini: NAS4220-B: fis-index-block with 128 KiB sectors Date: Mon, 24 Jan 2022 19:38:47 +0100 Message-Id: <20220124184030.001834241@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26C52C3526D for ; Mon, 24 Jan 2022 23:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367533AbiAXXzo (ORCPT ); Mon, 24 Jan 2022 18:55:44 -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 S1846534AbiAXXQT (ORCPT ); Mon, 24 Jan 2022 18:16:19 -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 215B9C061782; Mon, 24 Jan 2022 11:49: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 B64446090C; Mon, 24 Jan 2022 19:49:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81743C340E7; Mon, 24 Jan 2022 19:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053745; bh=T0FPNymCAN8k/yoVmKFGjUu17l0MP2sercr6kWrpFfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mS2lhCSwgoioYSw9EtbmaD0RpWsZwv2fRTliw9G+XRRafKkxlTStf68bjV8nlLUqZ OEWF0Id6cVTKwoL6AQifOWCZhEJ2acmVqJITlp/a7CgN2/mYk+1a1WljwW/7G7fwvv Zie+/Pml/OwtrwmQe/8ctyJ4azHty6GORA12qFDg= 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.10 163/563] media: dw2102: Fix use after free Date: Mon, 24 Jan 2022 19:38:48 +0100 Message-Id: <20220124184030.037105414@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a27a684403252..aa929db56db1f 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -2148,46 +2148,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 { @@ -2267,6 +2374,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, @@ -2384,101 +2544,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3BC1C46467 for ; Tue, 25 Jan 2022 02:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421323AbiAYC0n (ORCPT ); Mon, 24 Jan 2022 21:26:43 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38584 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355704AbiAXTtL (ORCPT ); Mon, 24 Jan 2022 14:49: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 70291B8121C; Mon, 24 Jan 2022 19:49:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98068C340E5; Mon, 24 Jan 2022 19:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053748; bh=dqbWfEMlNE/Ni041E7Yb6Yct9cWyfdGrWOafYB2jzak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nQ1X82DEufzGluepNQ7xT4TQDkp1BsveTbz9jF5alwWhU848KHF8qY+EcXckdeyFQ 459/RqjPvhHjUqz7baBaOwHPJvaCXRuv08Scf/5f9vZ4BlepQypCUL1IzKMKUKcUYo oMH3ln2dHS9lFlp/mFwhI6ohiFrOhcGvg7+354Uw= 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.10 164/563] media: msi001: fix possible null-ptr-deref in msi001_probe() Date: Mon, 24 Jan 2022 19:38:49 +0100 Message-Id: <20220124184030.067356671@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA8D6C433FE for ; Mon, 24 Jan 2022 20:58:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359588AbiAXU60 (ORCPT ); Mon, 24 Jan 2022 15:58:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386521AbiAXUfg (ORCPT ); Mon, 24 Jan 2022 15:35: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 89B12C038ADF; Mon, 24 Jan 2022 11:49: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 53B49B81229; Mon, 24 Jan 2022 19:49:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EDF8C340E5; Mon, 24 Jan 2022 19:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053751; bh=9o48Je1F87lDwxkuT1N6YQqhnrPGRVS42N5wlSw4AZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yu+7Zk1yW7AYhzm206V2SkQCd1xXtEDdP0Bu9wVAQtMw0EKG69QOamY3b5O/1UVaC NLNbyma2o3RQIoAHg1y9fgWVChCcYQLTOI5bOFDLiRhd+4PiMmpa2LnFG0bBrnmBA/ XYJ2rnq2k08VB+OcaS219aO+9N9Wu8ebsH1WnTqs= 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.10 165/563] media: coda/imx-vdoa: Handle dma_set_coherent_mask error codes Date: Mon, 24 Jan 2022 19:38:50 +0100 Message-Id: <20220124184030.107024827@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8bc0d83718193..dd6e2e320264e 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07F01C433FE for ; Mon, 24 Jan 2022 20:08:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378610AbiAXUHp (ORCPT ); Mon, 24 Jan 2022 15:07:45 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44358 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356153AbiAXTtP (ORCPT ); Mon, 24 Jan 2022 14:49: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 CCD4F6090C; Mon, 24 Jan 2022 19:49:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9148C340E5; Mon, 24 Jan 2022 19:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053754; bh=G0jmp0hanQ0WSDwgNBwHNuNpg0lD0ReR5+DUtfY/cWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WbNkXD+mXG2OSKtCp55mmIrckr4CKiXbtiCG7v1A71hQZqCuO+Z2dMv3MPsXWAYO/ Mu3+ic/8gu3BB1PrLeq44ayp/ilLOggSiPnaygcp5GcxYvutzNixID2VcMjpkMzCB+ H2JxaqqljTNKU2oSnbUa1uoAMbaHj1NgZocupK6Q= 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.10 166/563] ath11k: Fix a NULL pointer dereference in ath11k_mac_op_hw_scan() Date: Mon, 24 Jan 2022 19:38:51 +0100 Message-Id: <20220124184030.146413635@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 835ce805b63ec..18e841e1a016d 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -2320,9 +2320,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BEBCC433F5 for ; Tue, 25 Jan 2022 02:44:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3411322AbiAYCnC (ORCPT ); Mon, 24 Jan 2022 21:43:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386940AbiAXUgK (ORCPT ); Mon, 24 Jan 2022 15:36: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 00339C038AE5; Mon, 24 Jan 2022 11:49: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 90EF7B81188; Mon, 24 Jan 2022 19:49:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3381C340E5; Mon, 24 Jan 2022 19:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053757; bh=7YyOM7VdATn/fg3G6KlcXEwxLFCFISDdhKejS+MmA9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yawm2nGOFkXKYy/9nAAd3bU+ILtMEI4lTDO6+hjONWijnfFMHOFyggdx59G+Dyppb Ft7eT/UUtJCGJMZoDdQQIUrfaQNwbimXudbnbTd9FqR7a5kf9E3VAqLiboYTbiTYtZ 80JyVlnZ9yCA+KK2t0G6WbDBsGCPQLFDqmxJOqRg= 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.10 167/563] arm64: dts: qcom: c630: Fix soundcard setup Date: Mon, 24 Jan 2022 19:38:52 +0100 Message-Id: <20220124184030.178934142@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../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 ad6561843ba28..e080c317b5e3d 100644 --- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts +++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts @@ -365,6 +365,10 @@ dai@1 { reg =3D <1>; }; + + dai@2 { + reg =3D <2>; + }; }; =20 &sound { @@ -377,6 +381,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 { @@ -393,6 +398,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 { @@ -422,6 +434,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9813C433EF for ; Mon, 24 Jan 2022 21:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443883AbiAXU70 (ORCPT ); Mon, 24 Jan 2022 15:59:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386944AbiAXUgK (ORCPT ); Mon, 24 Jan 2022 15:36: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 D6E3FC02B8C9; Mon, 24 Jan 2022 11:49: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 7C70FB8121A; Mon, 24 Jan 2022 19:49:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACE39C340E5; Mon, 24 Jan 2022 19:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053760; bh=uWJ6f9HmEck56EkrCU4g63WGKcQ3HJigV9j5BtctmOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PjCX4VWuZ2I5RUzlywxDY5KCTAUdB5Re6SLfUWYHokECb/X07rVCP7a09hRLgMJww 8a2DmR848f0vWRZf8pM9WLp6kAvq2hjvbc2AenP9wB5cP14KzGdqUivA2/ctjll0O3 EiYPu4lvbcraHUNmDcIIUDTx315/lf6wzsuNftDY= 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.10 168/563] arm64: dts: qcom: ipq6018: Fix gpio-ranges property Date: Mon, 24 Jan 2022 19:38:53 +0100 Message-Id: <20220124184030.219942235@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 9cb8f7a052df9..2a1f03cdb52c7 100644 --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi @@ -221,7 +221,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43F55C43219 for ; Mon, 24 Jan 2022 21:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443952AbiAXU7i (ORCPT ); Mon, 24 Jan 2022 15:59:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387016AbiAXUgO (ORCPT ); Mon, 24 Jan 2022 15:36: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 D2227C061793; Mon, 24 Jan 2022 11:49: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 8FB57B81229; Mon, 24 Jan 2022 19:49:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDE97C340E7; Mon, 24 Jan 2022 19:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053766; bh=55bT+W5IzbYWV6wdiB5BwYZCsiDz0MdjVCXygfKPdB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n659OKQRGgFzuMsMAJ39JA6HNKSR3qWvoYrZxPTyUWyUtxNy13J5xZAy1p5/u0VxU +2cm6akxyzqSrKb4mNlItlhF/eJNj2D6LQ+yJrQFCkBWJZ/EL7KNNGABxePpEtEX4M YXo4nYX8jwdfkafKQiMYFiImVml+K9Rz089TecXo= 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.10 169/563] drm/msm/dpu: fix safe status debugfs file Date: Mon, 24 Jan 2022 19:38:54 +0100 Message-Id: <20220124184030.256612367@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 b4a2e8eb35dd2..08e082d0443af 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -71,8 +71,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 183C9C3526C for ; Tue, 25 Jan 2022 02:34:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421345AbiAYC0o (ORCPT ); Mon, 24 Jan 2022 21:26:44 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:44612 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357182AbiAXTta (ORCPT ); Mon, 24 Jan 2022 14:49: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 D0AFB6090B; Mon, 24 Jan 2022 19:49:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8DEFC340E8; Mon, 24 Jan 2022 19:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053769; bh=CLLAa3KRYtUtrOCmUpY1ensPN6KX3tszgWRlsKu2Gqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZmQT3va2LIKrEsHfKKjq5fMRdCiv3Sb5ovxN1IHPeHeuBp07K7oWZ51dXk4PoHzoA 7Ok8WnxXcwJeupksC160dQYynvB+MxEuJkUWeI1oeNiQyBkklGI+fefeVI+6tv0xIr 5+Z+wFyayiCTUjKeB9EuCPgHYejgrtK0RtMKsgHA= 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.10 170/563] drm/bridge: ti-sn65dsi86: Set max register for regmap Date: Mon, 24 Jan 2022 19:38:55 +0100 Message-Id: <20220124184030.296105763@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ecdf9b01340f5..1a58481037b3f 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -171,6 +171,7 @@ static const struct regmap_config ti_sn_bridge_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_sn_bridge_write_u16(struct ti_sn_bridge *pdata, --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6943C3526E for ; Mon, 24 Jan 2022 21:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444442AbiAXVA5 (ORCPT ); Mon, 24 Jan 2022 16:00:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387137AbiAXUgZ (ORCPT ); Mon, 24 Jan 2022 15:36: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 9CAC8C038AED; Mon, 24 Jan 2022 11:49: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 65A54B810AF; Mon, 24 Jan 2022 19:49:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBF18C340E7; Mon, 24 Jan 2022 19:49:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053772; bh=YlU1sBgVFOIGLyn4tPFI06pq4M3DdSGDx1s/nOu7IKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aUHUq2w+W80nSqkDM9tFtsp+RhFb0+8miHn1rcqNkyHPVImO8IPtvrENchHntj/L4 +AvGTnVOE6Vx1xotzNsI0oO6mTtDPFwqmxK6Rs6UVl+yagMdG69s3t+z4129ImNjth SG6RcY4ObKl8LwrkJHwRdQPuvCa6s2uZCqzEYt8c= 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.10 171/563] drm/tegra: vic: Fix DMA API misuse Date: Mon, 24 Jan 2022 19:38:56 +0100 Message-Id: <20220124184030.328363973@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 b77f726303d89..ec0e4d8f0aade 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 @@ -265,10 +266,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D80AC4332F for ; Tue, 25 Jan 2022 02:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421374AbiAYC0r (ORCPT ); Mon, 24 Jan 2022 21:26:47 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37646 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357206AbiAXTth (ORCPT ); Mon, 24 Jan 2022 14:49: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 6AB6FB81188; Mon, 24 Jan 2022 19:49:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92A27C340E8; Mon, 24 Jan 2022 19:49:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053775; bh=VHxhncLM05CKD8ZqIUX3uIMUbkQi3PdPyrNZ2fAV1Cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p0DyD9GxutFaBBzhtWeGsxdCQcl5VpXyYjKBtKLAbi2sykJJnWkpbLsyeu/uIJT9z MPgNCB4RezeR54mrTqLClrUq793Bn1DynuwciwutowuHRPvFvTDIddvhsdji3/ipFq lUFgGZsMBVwK178HR92EPJC5Vzjis2TgbyPW2v5I= 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.10 172/563] media: hantro: Fix probe func error path Date: Mon, 24 Jan 2022 19:38:57 +0100 Message-Id: <20220124184030.360088937@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 7749ca9a8ebbf..bc97ec0a7e4af 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -829,7 +829,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); @@ -885,6 +885,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9830CC433F5 for ; Mon, 24 Jan 2022 20:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354606AbiAXUIL (ORCPT ); Mon, 24 Jan 2022 15:08:11 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46772 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357225AbiAXTtj (ORCPT ); Mon, 24 Jan 2022 14:49: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 9F2886091C; Mon, 24 Jan 2022 19:49:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 867CAC340E5; Mon, 24 Jan 2022 19:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053778; bh=WzNw0oSd1gKe/M9faZwGg+IalzTanMcEGX+KVptdEPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TcSepyyzt82KiaaIWdXx3BxTx7HKMqHV8mVziOHgPRBtmEpr1DvuR4sT69iadsslI 1s9voMzxfkEltQbjNjaqb2Ky1itTzxSthjpmE1ziAlnSK9rtExS9mRD7tWW5REiDb4 cxjwGPUKo3q1K+9DcFo/kyIFgjEVUcOKEQq1flvg= 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.10 173/563] xfrm: interface with if_id 0 should return error Date: Mon, 24 Jan 2022 19:38:58 +0100 Message-Id: <20220124184030.397155595@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 e9ce23343f5ca..e1fae61a5bb90 100644 --- a/net/xfrm/xfrm_interface.c +++ b/net/xfrm/xfrm_interface.c @@ -643,11 +643,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; @@ -672,7 +677,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D4D4C4167D for ; Mon, 24 Jan 2022 21:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446944AbiAXVJn (ORCPT ); Mon, 24 Jan 2022 16:09:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389460AbiAXUkz (ORCPT ); Mon, 24 Jan 2022 15:40: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 D5876C045926; Mon, 24 Jan 2022 11:51: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 93354B81142; Mon, 24 Jan 2022 19:51:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFA2EC340E7; Mon, 24 Jan 2022 19:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053911; bh=jFAPDr8IEDpp7WV0gdkRVMZiZ9GFIrjnmNnKpTkCTy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cgd+4DDmj6b3G8BsTPVcx/s+unOd4thXzCA8PME753ePS5Pf7VsXvemWYl/5mTNkC rBWH5fq41921d/LS8srUFZE8PMQhhIhaQDpp1b0I9YWeo/+JVt+vs6F+oynB0shvbD z2PSfAMO7LMg0Rc5JD7bUF/OEhCTCApkHKtq89l8= 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.10 174/563] xfrm: state and policy should fail if XFRMA_IF_ID 0 Date: Mon, 24 Jan 2022 19:38:59 +0100 Message-Id: <20220124184030.428821480@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 97f7ebf5324e7..ddf1b3a5f7c1f 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) @@ -1353,8 +1358,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); @@ -1667,8 +1677,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA7ADC433EF for ; Mon, 24 Jan 2022 21:14:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376777AbiAXVNY (ORCPT ); Mon, 24 Jan 2022 16:13:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387521AbiAXUgy (ORCPT ); Mon, 24 Jan 2022 15:36: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 2A48FC02B8CD; Mon, 24 Jan 2022 11:50: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 E613BB8122A; Mon, 24 Jan 2022 19:50:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E214C340E5; Mon, 24 Jan 2022 19:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053804; bh=zxj4OLEpD3fEK0UfOMFmztZyNK21te4lEjSjRx3YcbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eAt3boAaiiR2RphyDXXoKKi+p5p+qismUeF1NrQ76xKZ2C2zbdFSGHB3fIqPz9E63 NkuHS78Sul/UqUJzIMs3RDke5tCE/qVIzogKy0FtD7h3yPsSkTBgCnW6Rh6aYjmMby 9+q9ICJdjJ7hwtyDF6DleBk7fqZs67LD6DGwJmO4= 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.10 175/563] ARM: 9159/1: decompressor: Avoid UNPREDICTABLE NOP encoding Date: Mon, 24 Jan 2022 19:39:00 +0100 Message-Id: <20220124184030.464792427@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 247ce90559901..7a38c63b62bf0 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -190,7 +190,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D960C4321E for ; Mon, 24 Jan 2022 21:03:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444780AbiAXVBd (ORCPT ); Mon, 24 Jan 2022 16:01:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387623AbiAXUg7 (ORCPT ); Mon, 24 Jan 2022 15:36: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 25843C038AFE; Mon, 24 Jan 2022 11:50: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 BB54260989; Mon, 24 Jan 2022 19:50:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E89DC340E5; Mon, 24 Jan 2022 19:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053839; bh=QM//hBjgsuTM7DDyxfrEEztPQK4cgXN6RcQsVOzNrDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z8IJ+3lsbckgVyZqbCYoUqysIClYDnM1XzEKbUVsP6KPyZNKqybihkYB+aahvYtJZ v/7V7cDb7ob4h+Xu4Hg1eVv1AymwecyicWc/o+7qmBWv4r2ZGp+MednkvBf4kX6UDz IhboTy9/V//sNI0Cl2vDClxIInqwEUeGpJRVl8Fk= 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.10 176/563] usb: ftdi-elan: fix memory leak on device disconnect Date: Mon, 24 Jan 2022 19:39:01 +0100 Message-Id: <20220124184030.498568904@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8a3d9c0c8d8bc..157b31d354ac2 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84B6FC433FE for ; Mon, 24 Jan 2022 21:04:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445463AbiAXVDh (ORCPT ); Mon, 24 Jan 2022 16:03:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388480AbiAXUjC (ORCPT ); Mon, 24 Jan 2022 15:39: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 B46DEC02415F; Mon, 24 Jan 2022 11:51: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 71C64B81142; Mon, 24 Jan 2022 19:51:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98DFAC340E5; Mon, 24 Jan 2022 19:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053872; bh=Jqatb1L8yQjhbQy9UNMVpIvmVrX+KciqGzLn7FtNWoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KfJ54gJol/zKCsvdzAWIRbMdaYRaUq4WBox/TSB64PSVUu02H2vI+sE8BQeSXxfiN sxsCg3cGAPflfYuypp4MyxjYeJdj8fz5rq6UiimDLqZbiopMlBOrHvbfb7CqTFwXwz U6Hb5sFz8WgavAMloBEcx1GL3KfWwPtZ+m9ECILY= 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.10 177/563] arm64: dts: marvell: cn9130: add GPIO and SPI aliases Date: Mon, 24 Jan 2022 19:39:02 +0100 Message-Id: <20220124184030.536654813@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B97ECC47082 for ; Mon, 24 Jan 2022 21:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447144AbiAXVKF (ORCPT ); Mon, 24 Jan 2022 16:10:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388845AbiAXUkM (ORCPT ); Mon, 24 Jan 2022 15: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 B34D5C04590F; Mon, 24 Jan 2022 11:51: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 589FBB81215; Mon, 24 Jan 2022 19:51:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86A5CC340E5; Mon, 24 Jan 2022 19:51:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053893; bh=2/G4H/z6ZjT0mBnaR+ViTzd1dhM7FMwdV/1uFN7ooNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hz7SdrvlMbEm4IgGUN12tpx00NlcVkIc7wr0Uivf8akj0B0TKcmT9GRzspu+S1PVh +kR1OoIQxDeGnJOVs9qgWVWasCZASq5Am8o8Pg2dFgNk2qirGjZIjSeoJa0iLmYzRl s44r0PWXkOJ3nI32yRhG8A0bsAdOXhvIL7A0w5Tw= 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.10 178/563] arm64: dts: marvell: cn9130: enable CP0 GPIO controllers Date: Mon, 24 Jan 2022 19:39:03 +0100 Message-Id: <20220124184030.572918348@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44A72C4167B for ; Mon, 24 Jan 2022 21:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447014AbiAXVJu (ORCPT ); Mon, 24 Jan 2022 16:09:50 -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 S1388853AbiAXUkN (ORCPT ); Mon, 24 Jan 2022 15:40: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 B363AC045917; Mon, 24 Jan 2022 11:51: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 6FB97B81215; Mon, 24 Jan 2022 19:51:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DED3C340E5; Mon, 24 Jan 2022 19:51:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053896; bh=U+Nb0NPZWLh7Nmoze8/HV96EGs6PbpH8kYa4V7Ihd9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fdwQPyRlEBnQKZvj8hDHts7AT4EJSvXO0chIphy4Nz33LC55wPuZQ3WyPBXt/erFd SwjLVdDzxu+mMfbF2I/FzuR2+KjFrJXILHGWI59+VF4hA3RwYlI4q2eKBtGcGrlula 3HqtJP5YLjwNeWHvYO0QqaKr4sd13xXplt84j7n0= 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.10 179/563] ARM: dts: armada-38x: Add generic compatible to UART nodes Date: Mon, 24 Jan 2022 19:39:04 +0100 Message-Id: <20220124184030.612748962@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 917FBC4321E for ; Mon, 24 Jan 2022 21:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446969AbiAXVJp (ORCPT ); Mon, 24 Jan 2022 16:09:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388894AbiAXUkO (ORCPT ); Mon, 24 Jan 2022 15:40: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 0903DC04591A; Mon, 24 Jan 2022 11:51: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 9D93F6090C; Mon, 24 Jan 2022 19:51:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83766C340E5; Mon, 24 Jan 2022 19:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053899; bh=kbRf5scrruy7y6jvXJpnetLiMFEv5Gi2TPuf03fCRF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r6itZoRLfbbi85oNQISlqRDilkLQ1HyeTJY45zCb16TPQcBAGj1gcY8E38PMXDkAt xmN1/T3gNeKZTWCELJ7+wAhJv91jmTBostLeI2id6ewPFOhUU0EJKZJd/ON0wfe7TG o22dbJ1/F3XdMRsEYgy8jzWCN/tKV05wWaz3yiGk= 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.10 180/563] iwlwifi: mvm: fix 32-bit build in FTM Date: Mon, 24 Jan 2022 19:39:05 +0100 Message-Id: <20220124184030.645268819@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a0ce761d0c59b..fe3d52620a897 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c @@ -967,7 +967,8 @@ static void iwl_mvm_ftm_rtt_smoothing(struct iwl_mvm *m= vm, 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0D31C4332F for ; Mon, 24 Jan 2022 21:04:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445418AbiAXVDX (ORCPT ); Mon, 24 Jan 2022 16:03:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389064AbiAXUkY (ORCPT ); Mon, 24 Jan 2022 15:40: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 17CF0C04591E; Mon, 24 Jan 2022 11:51: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 AC1B86090B; Mon, 24 Jan 2022 19:51:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FE95C340E7; Mon, 24 Jan 2022 19:51:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053902; bh=0dTjDPuPh42l9Elb2mTzWgKjEFKlEsgebhqLwC16fN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FUsTsqmSS7Tv98W3Yh3dLaOrqvtE5c70fB3YjCTN6UcIlffoAGAm0y5BJfjwuoHGt w41hBTOQr6wt0TZ15VUeZshlzVYz7o4UZ5W3OTR6pQcrghDU+CyDhQxgSjtAMnBM7n WC4zcAz9t1DR8/rgRlYLfbHnHn6xikI6VX9DauHo= 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.10 181/563] iwlwifi: mvm: test roc running status bits before removing the sta Date: Mon, 24 Jan 2022 19:39:06 +0100 Message-Id: <20220124184030.678301912@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../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 394598b14a173..a633ad5f8ca4e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c @@ -98,14 +98,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 @@ -131,9 +130,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 774B8C433EF for ; Mon, 24 Jan 2022 20:24:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354365AbiAXUY3 (ORCPT ); Mon, 24 Jan 2022 15:24:29 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49206 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357770AbiAXTvq (ORCPT ); Mon, 24 Jan 2022 14:51: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 C2295601B6; Mon, 24 Jan 2022 19:51:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93A27C340E5; Mon, 24 Jan 2022 19:51:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053905; bh=zYvhXmgk5raJcaWJoqoTorEjCgspp2OTg+ecp5a6CF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bB4AhEl+8eQuy7HCEyDEQ7mwvUpZAjTw0YTmHsVVOBjr089i5Kk3RZY4TUjRcEmQx yk2iN7IvGFcpYr2f4N2wzdehzcqqQj94Bd9z8yEsH+rtFc+0g+KMeDepXTUgnmGj+5 sRbECibJ0ccO/ilp3Uf5V4UTNBqxvQrFC4FgTN9k= 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.10 182/563] mmc: meson-mx-sdhc: add IRQ check Date: Mon, 24 Jan 2022 19:39:07 +0100 Message-Id: <20220124184030.714161210@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E1AFC4167B for ; Mon, 24 Jan 2022 21:04:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359755AbiAXVDy (ORCPT ); Mon, 24 Jan 2022 16:03:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389445AbiAXUkz (ORCPT ); Mon, 24 Jan 2022 15:40: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 3C79AC045923; Mon, 24 Jan 2022 11:51: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 D09D060B88; Mon, 24 Jan 2022 19:51:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC6F3C340E5; Mon, 24 Jan 2022 19:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053908; bh=Ufaa4jKKCgqnRSUhHqLd976W0nGl3ILv2sToo0ivXwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V2SxVt2ubuSYSpoXELwRMfGgBNYe3OgSS9RSEgfsUCOELTfpeiSfynuj1BC4JMNG6 Ho1ETgJPasUBjSNyme5uv2atzQXEbktnr4YwivZLXJ3OlFGBlE1jM9EVRuTFkVqLao WujDnDl6+SLDw7kb+L0Dde8JNTH2Wu6asOaYux7c= 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.10 183/563] mmc: meson-mx-sdio: add IRQ check Date: Mon, 24 Jan 2022 19:39:08 +0100 Message-Id: <20220124184030.745502688@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 1c5299cd0cbe1..264aae2a2b0cf 100644 --- a/drivers/mmc/host/meson-mx-sdio.c +++ b/drivers/mmc/host/meson-mx-sdio.c @@ -663,6 +663,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5C89C433FE for ; Mon, 24 Jan 2022 21:13:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229593AbiAXVNN (ORCPT ); Mon, 24 Jan 2022 16:13:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387549AbiAXUgz (ORCPT ); Mon, 24 Jan 2022 15:36: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 76737C02B8CE; Mon, 24 Jan 2022 11:50: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 EDBACB811F9; Mon, 24 Jan 2022 19:50:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23B2AC340E5; Mon, 24 Jan 2022 19:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053807; bh=Z4WqW7aiWhpSpvVTjLKFKzmmQSWflf5Gz0MzVnFB0Xs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r345/yzNxGFQa7OADeUtBrjg7IZY1Oil2SEMPU+FjbOmm9x8akedWawS9hyYPWJXw Z/3lcfwSwFbJrjpvjUjyDsaFqLooZRk0bXOzDGd5mjbfacojHBNnbK4WEG/3mZ1iGv etZihHhNrZyIgk6RSf7GYOgKuPerhOlUHhgHrq9M= 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.10 184/563] selinux: fix potential memleak in selinux_add_opt() Date: Mon, 24 Jan 2022 19:39:09 +0100 Message-Id: <20220124184030.782697105@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ff2191ae53528..86159b32921cc 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -947,18 +947,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) @@ -983,6 +987,10 @@ static int selinux_add_opt(int token, const char *s, v= oid **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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39571C4707E for ; Mon, 24 Jan 2022 21:13:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447635AbiAXVLH (ORCPT ); Mon, 24 Jan 2022 16:11:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387548AbiAXUgz (ORCPT ); Mon, 24 Jan 2022 15:36: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 BDAC0C038AF6; Mon, 24 Jan 2022 11:50: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 48FDD6091B; Mon, 24 Jan 2022 19:50:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29261C340E5; Mon, 24 Jan 2022 19:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053810; bh=8y110tx3r7t2HN8cFeLXNOvhc6Q0LIpe9KAMP9H6Dxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0gN0aZgyOiAMJQk9itrkddYd46pTxGb+zZ7UhY3GUmJOBAZFzsCIcoQI/0SPlh8hp jNHKw2EM7MLCRhtpG53hIX6PHwNIQSaRJh8c7OvIYhbUWSHxkvg+J3OJKK52PP1kqn vBjgQ5ZW92ZAH1x6ZiYfADR8y8M4+v4R+pyQzXbg= 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.10 185/563] um: fix ndelay/udelay defines Date: Mon, 24 Jan 2022 19:39:10 +0100 Message-Id: <20220124184030.816062435@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75B2FC47084 for ; Mon, 24 Jan 2022 21:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448590AbiAXVNG (ORCPT ); Mon, 24 Jan 2022 16:13:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387575AbiAXUg5 (ORCPT ); Mon, 24 Jan 2022 15:36:57 -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 BF507C038AF7; Mon, 24 Jan 2022 11:50: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 4CE0960915; Mon, 24 Jan 2022 19:50:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2979BC340E5; Mon, 24 Jan 2022 19:50:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053813; bh=t5SxjgbiiJ4hjr1e5ee5PsWnPbWkh/Lbl9KvMrK5U1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LTzMyfgmqtOMnwzWLRcSAZT0a5VmT3rEWGbckInjYxsRnfjn92onMG8FfSpr2cgIE lARAilSNGTbAeI/ZPeibQI7sZSqlWkMV1aotK+rMu9T79kEd8P754xkKJJjtDp53by 5ynT9cTkSWcEpZDkYpzPJ++vjSd4A5PPebrtKZl8= 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.10 186/563] um: virtio_uml: Fix time-travel external time propagation Date: Mon, 24 Jan 2022 19:39:11 +0100 Message-Id: <20220124184030.855937858@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 d11b3d41c3785..d5d768188b3ba 100644 --- a/arch/um/drivers/virtio_uml.c +++ b/arch/um/drivers/virtio_uml.c @@ -1076,6 +1076,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(VIRTIO_IRQ, vu_dev); @@ -1109,6 +1111,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ADDAC43219 for ; Tue, 25 Jan 2022 02:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421447AbiAYC05 (ORCPT ); Mon, 24 Jan 2022 21:26:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:39068 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357576AbiAXTuT (ORCPT ); Mon, 24 Jan 2022 14:50: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 F18E6B8122F; Mon, 24 Jan 2022 19:50:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FF2AC340E5; Mon, 24 Jan 2022 19:50:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053816; bh=nbudAHV5Id/HIQCDuN+n30CdC18eMXg3cLWyw/aOG2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xcUiGlPwnnAtBIBkiyjcXbU5I68M7s4hID9899QKqvkdDkEMaMoyF4sKn7r7cwxyM LpPEz41y3UgTylmgBbxDoJMUtQxKf91ya/5fbsVyZrZTocus/Hdvea/lvXHsZveYbw JtOCXj98AXiVNKs5yq8vL5c6hPdW6vcKtBVV3YdE= 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.10 187/563] Bluetooth: L2CAP: Fix using wrong mode Date: Mon, 24 Jan 2022 19:39:12 +0100 Message-Id: <20220124184030.887767032@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78F4CC433FE for ; Tue, 25 Jan 2022 02:34:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421483AbiAYC1B (ORCPT ); Mon, 24 Jan 2022 21:27:01 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47272 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350390AbiAXTuX (ORCPT ); Mon, 24 Jan 2022 14:50: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 4E99560916; Mon, 24 Jan 2022 19:50:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31978C340E5; Mon, 24 Jan 2022 19:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053819; bh=DIgOYh03wvGFM6IJ9KVgmDtuQm5cPvldYLsK2fYZFS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UpB0S+hT+NxGW0jsNFzckQ8B/JMargJefU/i0rZT7YnG9000+p/l/ZHnCT2Pp0zDn OgyxdQeSVVtzABY4I+owx3lFRAzs0J4pSiGCZgSicMcjgwXBTeIqVD1iKXdizfz5E+ qLZrJZxwBY4raCuGiOEy9Q6gM4fT6SKg4dILWuAU= 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.10 188/563] bpftool: Enable line buffering for stdout Date: Mon, 24 Jan 2022 19:39:13 +0100 Message-Id: <20220124184030.919378117@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 c58a135dc355e..1854d6b978604 100644 --- a/tools/bpf/bpftool/main.c +++ b/tools/bpf/bpftool/main.c @@ -396,6 +396,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73F3FC47081 for ; Mon, 24 Jan 2022 21:13:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448570AbiAXVND (ORCPT ); Mon, 24 Jan 2022 16:13:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387576AbiAXUg5 (ORCPT ); Mon, 24 Jan 2022 15:36:57 -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 BD113C038AF8; Mon, 24 Jan 2022 11:50: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 5DADA6091B; Mon, 24 Jan 2022 19:50:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40DF8C340E5; Mon, 24 Jan 2022 19:50:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053822; bh=pn09FPzboF/tVh8/0L5nmMFwe2Jrkb8T9pquQXiejis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rth71vgbRoyhg1ZYqAlE/rdU93Inf4IKKUCr0eQNJVSwHAkCcPIuTvOVfvIRwDYp3 /WdgTJFyFBGsv8aKR7sNg5cGozoKPzxeL3LLraX9Lzuo8zL3m7QKwULNa2Q7THPM3o RgfyEDe+SIAgmAQgBJDZ3USZ/SYq150Ieresjpf8= 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.10 189/563] backlight: qcom-wled: Validate enabled string indices in DT Date: Mon, 24 Jan 2022 19:39:14 +0100 Message-Id: <20220124184030.959132141@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 cd11c57764381..2c4290f082025 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D114FC35276 for ; Mon, 24 Jan 2022 21:13:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448518AbiAXVM7 (ORCPT ); Mon, 24 Jan 2022 16:12:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387577AbiAXUg5 (ORCPT ); Mon, 24 Jan 2022 15:36:57 -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 C346EC038AF9; Mon, 24 Jan 2022 11:50: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 621A160915; Mon, 24 Jan 2022 19:50:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3ABB7C340E7; Mon, 24 Jan 2022 19:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053825; bh=ofhkGRnyirw/XhpznoA8KDxIxBrgG3dGGZoCS9L+msQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kiHcprL3LQRkZjvFnZW9EEpU1YjQA8A/mMxWg4u5Xx9OaURYhi/kjt3imzslJDdss NkReBl8nq1Kw6biMltn/W6OOaEbG7d6jqYAQ2xeFmy8sda2cTt/dFjTmLUmDLKK6Zp xeYvN6EAZwTD3Pruq/jss1AMtk6ME3MehND7kjYQ= 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.10 190/563] backlight: qcom-wled: Pass number of elements to read to read_u32_array Date: Mon, 24 Jan 2022 19:39:15 +0100 Message-Id: <20220124184030.996356318@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2c4290f082025..92df5a9f6ae51 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E00A7C433F5 for ; Mon, 24 Jan 2022 20:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353226AbiAXUIu (ORCPT ); Mon, 24 Jan 2022 15:08:50 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47408 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350884AbiAXTud (ORCPT ); Mon, 24 Jan 2022 14:50: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 D563660B43; Mon, 24 Jan 2022 19:50:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A6D9C340E5; Mon, 24 Jan 2022 19:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053830; bh=02qCKii77kOqjfN+HoEomacGxd5qMKcREHO1H1Kj6rU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lDF+wsI9vd8kd/qcU4Wm/GCMcnNEHe0RmR+eo0F8Dp58SKneoPcVmiAE35hkWJspx OtFvdg6ERWlz1OT99DmeepVHhQr7rNoWlqEpu7tSEOrvSbx2gkj57ucjxDKBJ9FNLn YMepiXtiYpHCqtQHoENVxsRPLsHrNjEHv6hty1S8= 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.10 191/563] backlight: qcom-wled: Fix off-by-one maximum with default num_strings Date: Mon, 24 Jan 2022 19:39:16 +0100 Message-Id: <20220124184031.029770158@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 92df5a9f6ae51..9e09165984b48 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CB7CC433F5 for ; Mon, 24 Jan 2022 20:09:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353624AbiAXUI4 (ORCPT ); Mon, 24 Jan 2022 15:08:56 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47446 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350903AbiAXTug (ORCPT ); Mon, 24 Jan 2022 14:50: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 E9D7E60920; Mon, 24 Jan 2022 19:50:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2803C340E5; Mon, 24 Jan 2022 19:50:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053833; bh=P1FEAYpAUHwEE1RE/qP8LxkIT85JWa3N48CBRmLc0jU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bdLDwe/nhgeqexLnUky4q6uZMwMeaLQbBW2HTflr47B2ne60jDLa30engkCT8fA2i ZNmNM7Wv3E9nBFjMhkiSz+w1gyzazt0OmU427BIJqumlDDV+lDH9XrL7BPoAh41Wx7 niVXk4fmrmJVUbdQhERLog9/UmuKkM6PmtDlcrlA= 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.10 192/563] backlight: qcom-wled: Override default length with qcom,enabled-strings Date: Mon, 24 Jan 2022 19:39:17 +0100 Message-Id: <20220124184031.069588962@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 9e09165984b48..70fcee74866a5 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5C52C433EF for ; Tue, 25 Jan 2022 02:34:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421509AbiAYC1D (ORCPT ); Mon, 24 Jan 2022 21:27:03 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45688 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350929AbiAXTui (ORCPT ); Mon, 24 Jan 2022 14:50: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 E468260B03; Mon, 24 Jan 2022 19:50:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC67CC340E5; Mon, 24 Jan 2022 19:50:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053836; bh=UCxDnoM5ZMozC2PjxW1JyBuEh17gqFvQToMn369sdiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UMh5MnxK5zfZGVcNKCuqgDDRNIPrpXhPozvc7EL9IpKBsJNGh3mGhkSZg7h/5hkks RoaekyoUKQsj6fMFCUZJ6Z+SEAfG35R/o4Ik3JIVjvII8C5uPiyQrAspjGlNgV+IRo l2aIvOkXpaZ5vxi7aOULWda2PS8Fxq5Ze+ke/K6k= 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.10 193/563] backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion Date: Mon, 24 Jan 2022 19:39:18 +0100 Message-Id: <20220124184031.108040168@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 70fcee74866a5..13368044d0a75 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C2FBC3526F for ; Mon, 24 Jan 2022 21:04:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444590AbiAXVBJ (ORCPT ); Mon, 24 Jan 2022 16:01:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387632AbiAXUhA (ORCPT ); Mon, 24 Jan 2022 15:37: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 08E75C02B8D0; Mon, 24 Jan 2022 11:50: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 9D15E60A28; Mon, 24 Jan 2022 19:50:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80C7FC36AEB; Mon, 24 Jan 2022 19:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053842; bh=ULmtpc7qmryrvM5UjTP5xRNI/y1LHlg8sD/9hFxJG1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MVJJxftHyadv9oE5ydDlhxMigauPOFI6rRR1El6idpkBXWtBrX/+vgjzX7SJgh+JQ UsAdc/dKsmGVYZ3qZBWieT/DVYzBylD8QMWT6beseO6OwmfGrR4lm60V9K+WjfJ0m4 a7Q/RZSVo/hjutlRCbqnYc55YpwulbgIaa6s3bjo= 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.10 194/563] backlight: qcom-wled: Respect enabled-strings in set_brightness Date: Mon, 24 Jan 2022 19:39:19 +0100 Message-Id: <20220124184031.139764252@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 13368044d0a75..486d35da01507 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FDAFC433EF for ; Mon, 24 Jan 2022 21:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444760AbiAXVB3 (ORCPT ); Mon, 24 Jan 2022 16:01:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387634AbiAXUhA (ORCPT ); Mon, 24 Jan 2022 15:37: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 BAD25C02B8D2; Mon, 24 Jan 2022 11:50: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 9DB1660B11; Mon, 24 Jan 2022 19:50:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A73CC340E5; Mon, 24 Jan 2022 19:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053845; bh=OJih1Jcf4b2viqGvfEjCDpa3eJtwp2vKJgAcrR28yf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YeZhf17qQ2NNAD+2ULRHdKpp+3CBJMtxI5jUwiukYDt0MqU+KAnOmtq1xf7WArn0I YzVVtkngUHZnYQF/L/6iVF30tCW7T9iv+R4yfI61LJR3aT9t0HtUIFEEA6i8SkC6lo KEWG1KRqAPl37xyyZxDbtP27hjI2e89PiS+Ih6rQ= 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.10 195/563] software node: fix wrong node passed to find nargs_prop Date: Mon, 24 Jan 2022 19:39:20 +0100 Message-Id: <20220124184031.178454245@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 206bd4d7d7e23..d2fb3eb5816c3 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -519,7 +519,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B5D1C43219 for ; Tue, 25 Jan 2022 02:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421572AbiAYC1N (ORCPT ); Mon, 24 Jan 2022 21:27:13 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47724 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244739AbiAXTuz (ORCPT ); Mon, 24 Jan 2022 14:50: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 AD61660B89; Mon, 24 Jan 2022 19:50:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 913FDC340E5; Mon, 24 Jan 2022 19:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053848; bh=m0OcBpcxmIF16T15F0g3LId9WJ1aV0DdmBGbFIrLcTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OaE0icx0hWyDhWWo7DwsUxozoPxmPiax0t06ZKDGT1hDGlVFRzATL5crgxwTF9t7X abAy0V7KCL35/e8LPRK/wmaS8C0KnV2/5Lpae8LxQADq3Sgf8OzrebZwfBw6RHXH7T gBs36dgu87Zh1Fpvdt2Xy/hzgx4897Dm4ur5JYIY= 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.10 196/563] Bluetooth: hci_qca: Stop IBS timer during BT OFF Date: Mon, 24 Jan 2022 19:39:21 +0100 Message-Id: <20220124184031.210103661@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 4184faef9f169..4f8a32601c1b6 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -1844,6 +1844,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6F6CC43217 for ; Tue, 25 Jan 2022 02:34:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421552AbiAYC1K (ORCPT ); Mon, 24 Jan 2022 21:27:10 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47772 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354921AbiAXTuz (ORCPT ); Mon, 24 Jan 2022 14:50: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 9768E60B02; Mon, 24 Jan 2022 19:50:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7135AC340E5; Mon, 24 Jan 2022 19:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053851; bh=CMAFuYCxD3n3x60E7psobpsZULWljbebeyEgXDEvhw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xH4ZPOT6sxDCNePWylVBn6CW1fl9If+JHWfJVPUEGVMkw4S5jYKz1CuqJcJt2ocoM WvoAVo5IRL9X29t+QFrQV7riIobclnrQfEcBm+ha7RHxb2ZuBFel91U8bIktXCWML7 sZmupnV3AFtHRcZ2GcoMePFu+Ef+MunfXTXIgoQg= 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.10 197/563] x86/boot/compressed: Move CLANG_FLAGS to beginning of KBUILD_CFLAGS Date: Mon, 24 Jan 2022 19:39:22 +0100 Message-Id: <20220124184031.248771405@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 6004047d25fdd..bf91e0a36d77f 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 -DDISABLE_BRANCH_PROFILING cflags-$(CONFIG_X86_32) :=3D -march=3Di386 @@ -46,7 +50,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-es.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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A4BDC46467 for ; Mon, 24 Jan 2022 21:04:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444608AbiAXVBL (ORCPT ); Mon, 24 Jan 2022 16:01:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387635AbiAXUhA (ORCPT ); Mon, 24 Jan 2022 15:37: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 D3AD2C02B8D5; Mon, 24 Jan 2022 11:50: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 7105660B8A; Mon, 24 Jan 2022 19:50:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50C60C340E5; Mon, 24 Jan 2022 19:50:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053853; bh=84KscKH2YPPL8zxJwn5K7nuAWQLFMwMEAMm6Ccb5/+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fcq5kcwP4aEZYiA6dMUh/4vsPKq7ic/01g1yWFj1r3Bw5paYAj08q2QnEAI+CIm6K SgT5iTe0R+ZosHhtkViYw76+MfcWUMOiqCalqrrv1KLPKrsWWFq3YR0qPlK0nYiQDj BdGPkag+A24CWerHjfWwcvsRN4E0gmGw057iEOWE= 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.10 198/563] hwmon: (mr75203) fix wrong power-up delay value Date: Mon, 24 Jan 2022 19:39:23 +0100 Message-Id: <20220124184031.278058490@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 18da5a25e89ab..046523d47c29b 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5BE9C35270 for ; Mon, 24 Jan 2022 21:04:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444656AbiAXVBO (ORCPT ); Mon, 24 Jan 2022 16:01:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387637AbiAXUhA (ORCPT ); Mon, 24 Jan 2022 15:37: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 74175C02B8D6; Mon, 24 Jan 2022 11:50: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 3C6D0B81142; Mon, 24 Jan 2022 19:50:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 623D9C340E7; Mon, 24 Jan 2022 19:50:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053857; bh=45UaNH9/HbIDxSHTUqBMSe0RI4AGTAFns1A7plVdQbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2kR5rSrXsU7acP5lNDg4l/UjH6mpfm4VgNCZoGW3J2/Y/w4rvmQD3XFtva4HFypJI IOki6eSTNjgPbueuWP9wBjHq0ORPi07BDkqTHk9R3YqSl03+P4lqwsArvKT+hReyib tOEvoSse2oR1Uy1fWBJ30s7Epi7XPZSgbmWCnJH0= 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.10 199/563] x86/mce/inject: Avoid out-of-bounds write when setting flags Date: Mon, 24 Jan 2022 19:39:24 +0100 Message-Id: <20220124184031.312888807@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 3a44346f22766..e7808309d4710 100644 --- a/arch/x86/kernel/cpu/mce/inject.c +++ b/arch/x86/kernel/cpu/mce/inject.c @@ -347,7 +347,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78075C35272 for ; Mon, 24 Jan 2022 21:04:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444808AbiAXVBg (ORCPT ); Mon, 24 Jan 2022 16:01:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387950AbiAXUhg (ORCPT ); Mon, 24 Jan 2022 15:37: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 AB1E7C02B8E2; Mon, 24 Jan 2022 11:51: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 68A81B8123A; Mon, 24 Jan 2022 19:51:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8457CC340E8; Mon, 24 Jan 2022 19:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053860; bh=dew9iB/PSxpZFa7z+LvbEm0R1sFHfkirT3jY0G+NzIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FXte4R0tvEQmbEtum+D04DmEqTRgQAsOIigDo96C+s4uy+jjrzdQrd6Lt6hCKYipi n+vLRr4VnDnDLSfPyuQyfdV5hS1hTaeCw4V5HzkVq8AxBfvR+iF073q3Tgknsdgzaa 2mAxLl9VknkPnTdw4f/CWEKjDXdEgzsO5J2ZBBtY= 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.10 200/563] ACPI: scan: Create platform device for BCM4752 and LNV4752 ACPI nodes Date: Mon, 24 Jan 2022 19:39:25 +0100 Message-Id: <20220124184031.344880300@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 de0533bd4e086..67a5ee2fedfd3 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1577,6 +1577,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. @@ -1585,11 +1586,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 @@ -1603,8 +1611,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47D93C433F5 for ; Mon, 24 Jan 2022 21:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445441AbiAXVDZ (ORCPT ); Mon, 24 Jan 2022 16:03:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355210AbiAXUhz (ORCPT ); Mon, 24 Jan 2022 15:37: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 CF15AC02B8F1; Mon, 24 Jan 2022 11:51: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 739A9B810BD; Mon, 24 Jan 2022 19:51:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EB98C340E5; Mon, 24 Jan 2022 19:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053863; bh=HyqnZj4hnbENVg9FBNZafOFO/KlHBnFYWqWpCss4+bA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GPm8gwbUMbRtaqdagVxZiG3GFgmsOxiOaDssvXvU9IjRGdpj8bagoGBxoGH+ViWRV AFe8FFMVcL4ZyuD3BVNkx5PdXjz18vtrzVpTq9tyYMnxYxbpneFGnaeOr+bOn6UflL Mr7LbWTeJhCgaFzVa+8rfpEG0RoOIYwb8Txb+N6w= 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.10 201/563] pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in __nonstatic_find_io_region() Date: Mon, 24 Jan 2022 19:39:26 +0100 Message-Id: <20220124184031.380890377@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 3b05760e69d62..4c70e8ffe04ea 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88E10C41535 for ; Mon, 24 Jan 2022 21:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444976AbiAXVBt (ORCPT ); Mon, 24 Jan 2022 16:01:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388375AbiAXUiz (ORCPT ); Mon, 24 Jan 2022 15:38: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 86943C024148; Mon, 24 Jan 2022 11:51: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 45532B81142; Mon, 24 Jan 2022 19:51:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75B4BC36AE9; Mon, 24 Jan 2022 19:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053866; bh=jnFAsEx811A4DvqvXcfMvJ1VJaWvTEwoxEVEJIk2m+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Za3NeUYmEKsROe1jXpK4KrYoD93CE8/eicHu3tTez0ZmoyE7FuRlZb0WI5PT3jE1o X3SsEr2myDbduswKdI2JHvwAmvY+Uj5faLutCTwXnaYvIo6X2P/F18H/T+FP+//3KM xGGUntxOEtTSfIrWo50SegGIL84yWYUiXGoTjczA= 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.10 202/563] pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in nonstatic_find_mem_region() Date: Mon, 24 Jan 2022 19:39:27 +0100 Message-Id: <20220124184031.413510994@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 4c70e8ffe04ea..69a6e9a5d6d26 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62BA7C35271 for ; Mon, 24 Jan 2022 21:13:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448334AbiAXVM1 (ORCPT ); Mon, 24 Jan 2022 16:12:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388384AbiAXUiz (ORCPT ); Mon, 24 Jan 2022 15:38: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 07E4EC02414B; Mon, 24 Jan 2022 11:51: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 9A277601B6; Mon, 24 Jan 2022 19:51:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 918FCC340E5; Mon, 24 Jan 2022 19:51:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053869; bh=38QJKayBH1t+mBmsiqgcjzBj6O8WHMCZs2mmLV6jwwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fu8VgzP1d/xfs8QURiASTFhgV+2aejt3+eJ44b5auR75rcNihYZPSy/UyNE3vF6Z6 H+pV4U/F4jn3r9E0qfqm8oAjQfO7t3hdtHTht+4YByPPk7jdYnCUb5mDmrZ/NktbUP 5Rinzt7lKY9n9KZch2Coq5nlfX3w7ltvT5w9aWuo= 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.10 203/563] power: reset: mt6397: Check for null res pointer Date: Mon, 24 Jan 2022 19:39:28 +0100 Message-Id: <20220124184031.452159207@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 233F5C4321E for ; Mon, 24 Jan 2022 21:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445006AbiAXVBx (ORCPT ); Mon, 24 Jan 2022 16:01:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388485AbiAXUjC (ORCPT ); Mon, 24 Jan 2022 15:39: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 1DF9FC024168; Mon, 24 Jan 2022 11:51: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 9B0D360B28; Mon, 24 Jan 2022 19:51:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE682C340E5; Mon, 24 Jan 2022 19:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053875; bh=VzkmA8MDyid/hSHyTb2Yay4rEh93lvOtjxJkw9z+kPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WOJ1tIY2SX41mch18Z0+fEf0YWECqzd8oXJnOWLlexKb2Bthdh6ym2zz+KPH76LOI likweIcbviNG/0Op06r30qfpSWO5JdU54bh0EkQRTFOHE1MqWu+UqfKghRFS+X9qYF zL6w8O51SGuZjwaOQDU+L6EtjR6OQ76HHXB86SJ8= 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.10 204/563] netfilter: ipt_CLUSTERIP: fix refcount leak in clusterip_tg_check() Date: Mon, 24 Jan 2022 19:39:29 +0100 Message-Id: <20220124184031.488449972@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a8b980ad11d4e..1088564d4dbcb 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c @@ -505,8 +505,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA105C433EF for ; Tue, 25 Jan 2022 00:15:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372977AbiAYAMt (ORCPT ); Mon, 24 Jan 2022 19:12:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849686AbiAXX02 (ORCPT ); Mon, 24 Jan 2022 18:26: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 A4698C02B850; Mon, 24 Jan 2022 11:51: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 62736B811F3; Mon, 24 Jan 2022 19:51:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9190AC340E5; Mon, 24 Jan 2022 19:51:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053878; bh=uZdjnvYVh5IOLTVLrRpVEx2N2444vhjRxBkWWJxrb8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eWx+7w4j4QHNnqUL5scAumNWSVkPtVVTWnm4NchvK5pZxgSNKi40Paf8tDcMKRxou 2vE72MatsHAp17zyBQnDHpqfoAiUtyr/j4v0auqU065FTiHCAKMQxpEhLp6xNDz9Us Whk3/OMhw1LY4jvzzEoojpF2R5UzPs6I2msEnXVE= 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.10 205/563] bpf: Dont promote bogus looking registers after null check. Date: Mon, 24 Jan 2022 19:39:30 +0100 Message-Id: <20220124184031.520807730@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 c623c3e549210..015bf2ba4a0b6 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -7725,15 +7725,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9856EC433F5 for ; Mon, 24 Jan 2022 20:28:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381789AbiAXUYp (ORCPT ); Mon, 24 Jan 2022 15:24:45 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48564 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240634AbiAXTvW (ORCPT ); Mon, 24 Jan 2022 14:51: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 90F336090A; Mon, 24 Jan 2022 19:51:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71283C340E5; Mon, 24 Jan 2022 19:51:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053881; bh=EWuSD09ncRWFckeaGe1epERgKjEawSin+XEHc36Lp5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y7+c6ARAUg6fbnj0mtSJ9nWqwUYweW7GeW+p0YK9siKKhHYfoPQxmke0ZsO6/KLq1 biULhaoLoljGfW4QeXzkYrogcEpu0Ot619vCSuHoYgpJvsqQga4HIMYHKF7OwXXuTC Cqj3KK3dLuQ9S/fAMUKmvFvgfsuT/5nxnHI42pkY= 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.10 206/563] bpf: Fix SO_RCVBUF/SO_SNDBUF handling in _bpf_setsockopt(). Date: Mon, 24 Jan 2022 19:39:31 +0100 Message-Id: <20220124184031.552229798@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- net/core/filter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index abd58dce49bbc..706c31ae65b01 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4711,12 +4711,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21157C433EF for ; Mon, 24 Jan 2022 20:28:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351710AbiAXUYf (ORCPT ); Mon, 24 Jan 2022 15:24:35 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:39910 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354724AbiAXTv1 (ORCPT ); Mon, 24 Jan 2022 14:51: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 37A9CB811F3; Mon, 24 Jan 2022 19:51:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69D57C340E5; Mon, 24 Jan 2022 19:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053884; bh=RTtE72TEKRptEnT9avhBLidZKHxVwDtJvr7QQ0QGyVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F+TUmL3nh3/phT4BMuw7tcwY4ABe9QcDEegr32klRSRrRkC+JWzyKLVp3Cs2n30Bs 2VC/wRG5eWsU6DEZ/KTT5JtT9t2hYc0wI+AjUN6k3vxn8KwaQTKtEZswTqmXOmv/KO 2xd6N4HmAbXG1Je4994OevbprSPzpzyK++xi6B2E= 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.10 207/563] netfilter: nft_set_pipapo: allocate pcpu scratch maps on clone Date: Mon, 24 Jan 2022 19:39:32 +0100 Message-Id: <20220124184031.583468907@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2d73f265b12c9..f67c4436c5d31 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECEC3C4332F for ; Mon, 24 Jan 2022 20:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383634AbiAXU13 (ORCPT ); Mon, 24 Jan 2022 15:27:29 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38688 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355678AbiAXTv3 (ORCPT ); Mon, 24 Jan 2022 14:51: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 387CEB810BD; Mon, 24 Jan 2022 19:51:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57E20C340E7; Mon, 24 Jan 2022 19:51:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053887; bh=JtPGXf7Elp4J0SujJGD2ep04bNZGi9qcDiiU1d/KAgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2SCqP4SvxPyIZw+p8AUCC4wHubdOsJJrMkoLPzNMTqIAcW6l3ftSNyrKGZqx/RoIP LnupAEnut64/2P1vWkqu5KL9rgjhXeLi7qYG1CfvGF/4RSbEz2fuTOb9V1aydQBxkB ydjPy9q2lf5nsIJb3O8uo6c4iiIiRqP200TvlXww= 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.10 208/563] ppp: ensure minimum packet size in ppp_write() Date: Mon, 24 Jan 2022 19:39:33 +0100 Message-Id: <20220124184031.630830705@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 33b2e0fb68bbb..2b9815ec4a622 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 @@ -496,6 +498,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) @@ -1632,7 +1637,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 841A0C41535 for ; Mon, 24 Jan 2022 21:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447176AbiAXVKH (ORCPT ); Mon, 24 Jan 2022 16:10:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388810AbiAXUkM (ORCPT ); Mon, 24 Jan 2022 15: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 96F19C04590D; Mon, 24 Jan 2022 11:51: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 53AFAB8123A; Mon, 24 Jan 2022 19:51:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69960C340E7; Mon, 24 Jan 2022 19:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053890; bh=ETqpcHCICc1tUB+WtR27CydYwT/UiM3pGK7XK2NBSNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nj9IL1bz8FNgriO+/ZOK1ofYo813PVKoXFMLRiGrEDFAR6cTLk/ww0rl8+furF4Gv 9oOWXvDFb6PaCBZSB54LA39z52avEC3y8nLHPq6InrIzAd66zf49J8aicZ3vHznJX1 WEW+XDH2u6bIm8k/Jou4TJi/ZEEtJhvO6YzO1I/s= 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.10 209/563] rocker: fix a sleeping in atomic bug Date: Mon, 24 Jan 2022 19:39:34 +0100 Message-Id: <20220124184031.661855955@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 7072b249c8bd6..8157666209798 100644 --- a/drivers/net/ethernet/rocker/rocker_ofdpa.c +++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c @@ -2795,7 +2795,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CE74C433EF for ; Mon, 24 Jan 2022 20:14:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347777AbiAXUOO (ORCPT ); Mon, 24 Jan 2022 15:14:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41328 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240135AbiAXTxp (ORCPT ); Mon, 24 Jan 2022 14:53: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 0087FB81218; Mon, 24 Jan 2022 19:53:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89D87C36AE3; Mon, 24 Jan 2022 19:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054022; bh=eoSpb2Jjaa/VzEtSTqkkOb08WYHFLtrDP1lBsjhRaGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=urk3XKZOYcJ1EJZM6QHATZZkUyfzw2RiDdiF/lfQYqi2KylcyRRr64rKUek3VG3a1 GrWCOoxcyMpk9bCypJkPZQFdgw9JXfIn62c1P+lHdmeM5ufnO/UzIG5YHPvUkU9fbR SPmahl3yYTqR2YbId9yYyxJigC7FCgVrYDITGxgE= 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.10 210/563] staging: greybus: audio: Check null pointer Date: Mon, 24 Jan 2022 19:39:35 +0100 Message-Id: <20220124184031.699760005@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2bb8e7b60e8d5..e1579f356af5c 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E79B6C4321E for ; Mon, 24 Jan 2022 21:12:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446908AbiAXVJj (ORCPT ); Mon, 24 Jan 2022 16:09:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355870AbiAXUk6 (ORCPT ); Mon, 24 Jan 2022 15:40:58 -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 191B1C045929; Mon, 24 Jan 2022 11:51: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 B1EBCB81188; Mon, 24 Jan 2022 19:51:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7FE6C340E5; Mon, 24 Jan 2022 19:51:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053914; bh=XvsuaybxONItoAZe5a0vX9UxPNEjPcRQlzwFZKwiE4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pDgWWbaDTkK3k0RylsjsaRY0oB/xipg/+HE3d3O6Pvzec53Y+QDDSuiGtN9PsQrKo D10pTl1ReFbD33iNNhiVyNz9jTSFNFh8Kdnjkckk/1Wgh/AFphONdOTxAdsUcvTSUq bP+FLxLW3vUz293WHs+A5i0Yh8M+CEa4xQyb4CVc= 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.10 211/563] fsl/fman: Check for null pointer after calling devm_ioremap Date: Mon, 24 Jan 2022 19:39:36 +0100 Message-Id: <20220124184031.739722328@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 901749a7a318b..6eeccc11b76ef 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 937C4C2BA4C for ; Mon, 24 Jan 2022 21:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448096AbiAXVMA (ORCPT ); Mon, 24 Jan 2022 16:12:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357891AbiAXUmV (ORCPT ); Mon, 24 Jan 2022 15:42: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 39B28C04964B; Mon, 24 Jan 2022 11:52: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 dfw.source.kernel.org (Postfix) with ESMTPS id CF45A60FE3; Mon, 24 Jan 2022 19:52:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4922C340E5; Mon, 24 Jan 2022 19:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053948; bh=mcKoFe4cII9r12R2i3LDH/U9FReDIMVglxL+peuZ7gg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RemwROgUeNsFt0gcdtKoc3VmiBfi9NCdq+R8GUy46DKWLmvfRvBNMb2wq+U1Jd1xf w2bQ21P9SzcGKvYuKGvHsvQP71S04DuyA5oFguMZXyrNVRRy7RXOgjUo4LyqGY0hVN aEVoq30kQxRISeRdMSJVflAfv88aZrPIpNiqbujA= 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.10 212/563] Bluetooth: hci_bcm: Check for error irq Date: Mon, 24 Jan 2022 19:39:37 +0100 Message-Id: <20220124184031.779476763@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8ea5ca8d71d6d..259a643377c24 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -1164,7 +1164,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 762ECC433F5 for ; Mon, 24 Jan 2022 21:05:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353037AbiAXVFl (ORCPT ); Mon, 24 Jan 2022 16:05:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389732AbiAXUm6 (ORCPT ); Mon, 24 Jan 2022 15:42: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 70BC5C04967A; Mon, 24 Jan 2022 11:53: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 0F99460B02; Mon, 24 Jan 2022 19:53:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE3F6C36AE9; Mon, 24 Jan 2022 19:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053981; bh=EdRBPmg9UuzN3RscHx/sISlmgsII/q5Oql95LbXNop0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JglY1Pcb11z48W8Ayv51vQTBUR/iXXTqciITs6xLa/Zo4IbugFZW++tVK14HT6rRf ilWy8svjnw6oiBfuoiHPWCyH1FELTwroq6KAgZYRf57q2NKVnjHWbKBmcOLVh2mp54 jhwk6aq8/qSGibf/wwJkB5CGPpm/Y3hWRm0Sioi0= 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.10 213/563] Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe Date: Mon, 24 Jan 2022 19:39:38 +0100 Message-Id: <20220124184031.819170738@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/bluetooth/hci_qca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 4f8a32601c1b6..dc7ee5dd2eeca 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -1990,7 +1990,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB6D1C35274 for ; Mon, 24 Jan 2022 21:05:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445840AbiAXVFD (ORCPT ); Mon, 24 Jan 2022 16:05:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358023AbiAXUnA (ORCPT ); Mon, 24 Jan 2022 15:43: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 1172EC019B2B; Mon, 24 Jan 2022 11:53: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 CFDCAB8122F; Mon, 24 Jan 2022 19:53:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 097C8C340E5; Mon, 24 Jan 2022 19:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054003; bh=81xl3sgM260UXnSFz+zCoNVTk3dN1gWBm6MwUjmOT7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jjLuGwQTbfL7qXzMfJMQ4qc1jz+WRbPAGZ8xBpXf/XLYkTlhvBPwxGa+0TfF7k6Bn +gTBNztk3Tpf/Y+vZQ1MHMCRQyEFSTi8LVReBd+sxZt+R89rtzbHzKPkprpS2rMnuz 671wwAPEXuwqjZiJ5G2acF4Vid0ilrkE0/Ghr1iY= 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.10 214/563] usb: dwc3: qcom: Fix NULL vs IS_ERR checking in dwc3_qcom_probe Date: Mon, 24 Jan 2022 19:39:39 +0100 Message-Id: <20220124184031.855228474@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2a29e2f681fe6..504f8af4d0f80 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -764,9 +764,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 467D7C433F5 for ; Mon, 24 Jan 2022 20:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379598AbiAXULy (ORCPT ); Mon, 24 Jan 2022 15:11:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48564 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354409AbiAXTx1 (ORCPT ); Mon, 24 Jan 2022 14:53: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 5CB0060B02; Mon, 24 Jan 2022 19:53:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AB79C340E5; Mon, 24 Jan 2022 19:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054006; bh=hPIfp+xb0nCIRiWKRjRo3dFFJQLH9qNfIauxYLsotvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BkCuA0JnRtlxv/AsFIMJzXZKZ/S1AnAVq9J7+iWGQcgYdNq9j9YucJC1/CUOLkP5t 5VCoVztMOK2JITcevTChfVioDNfIR7oBVLyaJvPRkhWW2FAV8tQKMVTnzPyepRbxwQ O2tUmWCEYohf8Nn1p4zsOw+nj4luhmoot6O4EG9k= 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.10 215/563] HID: hid-uclogic-params: Invalid parameter check in uclogic_params_init Date: Mon, 24 Jan 2022 19:39:40 +0100 Message-Id: <20220124184031.886701421@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 dd05bed4ca53a..851ab8e24f9d7 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -832,10 +832,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, }; @@ -846,6 +846,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6EDEC433F5 for ; Mon, 24 Jan 2022 20:14:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347601AbiAXUOF (ORCPT ); Mon, 24 Jan 2022 15:14:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50768 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352811AbiAXTxe (ORCPT ); Mon, 24 Jan 2022 14:53: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 8717460B43; Mon, 24 Jan 2022 19:53:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59C2AC340E5; Mon, 24 Jan 2022 19:53:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054010; bh=dw098V/xn/6y2e25F4vFP5lnwvm1i/90y4rt2uf9skI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k8DzSza2USLHuE9PVPSt9MhjAXcD2Al8WcARtosg44IMUUkMp3nodaD+vs2AZPiYR zh7tgboHTu98v+PzcXdOGZrIH908+tEUgT2U2+Eic8SrxEk6qez5ZdJ8KbsMxYhc0M TkFs6I7D+DQtKlQd9okSqGg15ROd0OFMWytrqB7U= 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.10 216/563] HID: hid-uclogic-params: Invalid parameter check in uclogic_params_get_str_desc Date: Mon, 24 Jan 2022 19:39:41 +0100 Message-Id: <20220124184031.927703535@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 851ab8e24f9d7..a751c9a49360f 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -65,7 +65,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 */ @@ -74,6 +74,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39203C4332F for ; Mon, 24 Jan 2022 20:13:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345061AbiAXUN5 (ORCPT ); Mon, 24 Jan 2022 15:13:57 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50796 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357960AbiAXTxe (ORCPT ); Mon, 24 Jan 2022 14:53: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 9E15760B4E; Mon, 24 Jan 2022 19:53:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84346C340E5; Mon, 24 Jan 2022 19:53:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054013; bh=8aVxZ5d5NrDI04qkthgBcQyo7elCVhjuzYezjAPXQhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EaxsCXgW171F81HsvzjrHnjvw08riLDToP+0usNo6/egZVZXBIq/ACZY5uPXfSx3q /PiuLz5Sj7ZFf1/re9tKYOZk8G4i98XN4l/+/utUojdTffhnbNxy0QiQ963ifFo3d9 KFfWiEqnyXeVSavXYSAPqRfdjCUk2VDwG8gd05HM= 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.10 217/563] HID: hid-uclogic-params: Invalid parameter check in uclogic_params_huion_init Date: Mon, 24 Jan 2022 19:39:42 +0100 Message-Id: <20220124184031.956289046@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a751c9a49360f..df12178a80da5 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -707,9 +707,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, }; @@ -723,6 +723,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC862C433FE for ; Tue, 25 Jan 2022 00:19:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374929AbiAYASe (ORCPT ); Mon, 24 Jan 2022 19:18:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351191AbiAXXdx (ORCPT ); Mon, 24 Jan 2022 18:33: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 1248EC041887; Mon, 24 Jan 2022 11: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 A5CF36090B; Mon, 24 Jan 2022 19:53:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7978DC340E5; Mon, 24 Jan 2022 19:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054016; bh=GGL5qBjAJAJlWnNI7YGaJP/NQE4ZhQ0sFC6FbR+0c/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e32gB4WGgUQzHLXQqiXqCNopSoVhguL0IjLDoPEGy9nT+FXghqPpt36GMyuFSRSGw 4XbLsY5ZVpyjesbZ2gtIVy3m5Aivi9Io9TrMwrbI3uBD88NDME/pK0Zh6KjjJW/kR6 zwSOlIHRqt1fccxVjux0S1LDrVe8EiUL6EJng1xY= 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.10 218/563] HID: hid-uclogic-params: Invalid parameter check in uclogic_params_frame_init_v1_buttonpad Date: Mon, 24 Jan 2022 19:39:43 +0100 Message-Id: <20220124184031.985855200@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 df12178a80da5..38f9bbad81c17 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -451,7 +451,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 @@ -461,6 +461,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1851FC433EF for ; Mon, 24 Jan 2022 20:12:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345337AbiAXUMP (ORCPT ); Mon, 24 Jan 2022 15:12:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41276 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356179AbiAXTxn (ORCPT ); Mon, 24 Jan 2022 14:53: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 427D8B811F9; Mon, 24 Jan 2022 19:53:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79E6CC340E7; Mon, 24 Jan 2022 19:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054019; bh=v/uAKWoENKRN5LqOTFj36NcBgFNJnU9A42i7wUgs0l8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2di109X09x2uw5MWWvhQAIoZ6whhU1Jl39tTPrjZFEPlzg+HWdxKN26vdDBiVetsr PD1yQ+IMPsm3aAaVQBkPxoPtGEunE6YZnl8cQiS1smxAbmGcQ8lj2iWuUid8DjNIZ8 OVMv1BM3bEmQf2Dok8g/DoIRzk6idPMAP5St/ZUM= 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.10 219/563] debugfs: lockdown: Allow reading debugfs files that are not world readable Date: Mon, 24 Jan 2022 19:39:44 +0100 Message-Id: <20220124184032.026535046@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 3aa5eb9ce498e..96059af28f508 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A497C4332F for ; Mon, 24 Jan 2022 20:09:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354287AbiAXUJX (ORCPT ); Mon, 24 Jan 2022 15:09:23 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49486 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345444AbiAXTv7 (ORCPT ); Mon, 24 Jan 2022 14:51: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 3A71960FE0; Mon, 24 Jan 2022 19:51:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E478C340E5; Mon, 24 Jan 2022 19:51:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053917; bh=JWqpxqKlVhff/kyKeh/XNYbKg6VwUJvBcSXp1JJWZ5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OsGwV+OZiIVh+zAJgO4uKYXAtoYVcllmSEel/pJph8orK49aVVLFXDz0kHHDk/c3y 09FXitVC4sDuRh7AEKT0SWuCKVqKHwbjw5bq98oUHJMEZVWvzl/8KRpjAtuNxm6twE ThpZgewVOw50GZA2BMtufhZ2B5FqbPg6MLwFZoXk= 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.10 220/563] net/mlx5e: Fix page DMA map/unmap attributes Date: Mon, 24 Jan 2022 19:39:45 +0100 Message-Id: <20220124184032.056935072@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 71e8d66fa1509..6692bc8333f73 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 117a593414537..d384403d73f69 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -276,8 +276,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; @@ -298,7 +298,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25756C4332F for ; Mon, 24 Jan 2022 20:09:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359391AbiAXUJd (ORCPT ); Mon, 24 Jan 2022 15:09:33 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40382 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357849AbiAXTwD (ORCPT ); Mon, 24 Jan 2022 14:52: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 E3F61B810AF; Mon, 24 Jan 2022 19:52:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16DE4C340E5; Mon, 24 Jan 2022 19:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053920; bh=oYl28Gp+li/lzw+XgswClzaXlPQR2fB04j5Ja2l+KmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a5JJP5B93tlpnlxw603fT6HbrlhUHE25Ryz7rOuKal8XRsEq3akSe0+6llb4+MbjO r3RGKmenrGWKIpPYUq8GTua9qtJWghIED08cjKjk7pqw1gmXkgw17f/kQRRIaBMwMJ Io1wTwfVsT8e8km6tvd0maEOzJaMc+tApfG7j940= 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.10 221/563] net/mlx5e: Dont block routes with nexthop objects in SW Date: Mon, 24 Jan 2022 19:39:46 +0100 Message-Id: <20220124184032.088069192@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 15c3a9058e728..0f0d250bbc150 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c @@ -265,10 +265,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 093F5C43217 for ; Mon, 24 Jan 2022 20:10:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376486AbiAXUJi (ORCPT ); Mon, 24 Jan 2022 15:09:38 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49566 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357858AbiAXTwF (ORCPT ); Mon, 24 Jan 2022 14:52: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 537D260FDD; Mon, 24 Jan 2022 19:52:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28638C340E5; Mon, 24 Jan 2022 19:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053923; bh=HQl6YcXziRLQm+WPUb+jMGqqFQhdR6u6srb+Q89n8GY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BhE5ctBPU3hjE6SmCqotHh1FyhfELWhbKztH+EiCF93DyPSPq3Ko2c/Gs7/E2KGQm fsPYbpS5wVFjdSYeDceUQyUkugvUQXj1W7GfWDH7z+A6Z7IbpZoZ+5g2EXm6Lz7jM/ pQmFOHDMm+l+Tbm2mta94shEh/yRBMx7HtAH4/7k= 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.10 222/563] Revert "net/mlx5e: Block offload of outer header csum for UDP tunnels" Date: Mon, 24 Jan 2022 19:39:47 +0100 Message-Id: <20220124184032.128483270@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2f6c3a5813ed1..16e98ac47624c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -5024,9 +5024,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(mdev, IPPROTO_GRE)) { --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F3FBC433F5 for ; Mon, 24 Jan 2022 20:10:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377130AbiAXUJp (ORCPT ); Mon, 24 Jan 2022 15:09:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40434 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351587AbiAXTwJ (ORCPT ); Mon, 24 Jan 2022 14:52: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 09C34B811FB; Mon, 24 Jan 2022 19:52:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39B44C36AE9; Mon, 24 Jan 2022 19:52:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053926; bh=yBJBbtwUqcN2I3MOKeskrjlDtzT79TeZeDKBZRp+q3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xg098aAEU/lkgt1chTDUfuMfcxr9MMBJCcUZMFL2C4rVmz0Ezp5IpAB6NuxPZ4cZj pwew/ffamAAKxzmLn+8RrgipjdQMaw2Y5iEo643zEhzlKq/CUrdflpDDP1sE7LUtVr a66jXWjTJUHkB6WGd8ur5QBd2xDK+U4QQIY5CqrM= 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.10 223/563] net/mlx5: Set command entry semaphore up once got index free Date: Mon, 24 Jan 2022 19:39:48 +0100 Message-Id: <20220124184032.160638281@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2e55e00888715..20e3f8cd074a1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -147,8 +147,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); } @@ -1582,8 +1586,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 */ @@ -1606,10 +1608,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); @@ -1663,7 +1661,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E55EC4332F for ; Mon, 24 Jan 2022 21:05:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353079AbiAXVEX (ORCPT ); Mon, 24 Jan 2022 16:04:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351667AbiAXUls (ORCPT ); Mon, 24 Jan 2022 15:41: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 90784C019B03; Mon, 24 Jan 2022 11:52: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 2967EB81215; Mon, 24 Jan 2022 19:52:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B8B7C340E5; Mon, 24 Jan 2022 19:52:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053929; bh=3bYJ1Uv45V46z7TGSRB+5GaY5VET5wRoQDd1kBkBs3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KjJGd8Lbrj9yFkCunNjSQLVYsVh1nLrzsdeDp2Yi7jybsabqROKciFvlvRV1xfV2X YlnHnxeN/84BgKRaumfOqlQCdo+Wmx9Yvc47+18fP+I09BmfmP8YC7mr3Rkf5M0vaq A8VbbRljknBStI7xcNTJq0uqNjB5Z6PFAUnCv8TQ= 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.10 224/563] lib/mpi: Add the return value check of kcalloc() Date: Mon, 24 Jan 2022 19:39:49 +0100 Message-Id: <20220124184032.199902040@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FDE2C433EF for ; Tue, 25 Jan 2022 00:18:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374695AbiAYARm (ORCPT ); Mon, 24 Jan 2022 19:17:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1851185AbiAXXcH (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 E0F83C019B06; Mon, 24 Jan 2022 11:52: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 7FF4E6090B; Mon, 24 Jan 2022 19:52:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ACE2C340E5; Mon, 24 Jan 2022 19:52:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053932; bh=l6Ni9v689sSDYi8RGWJ0Fvwu5bh71a7KQRIO9ThqCxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ja2INnCtpFJvoUFie1gNGt149zvQSihO5Vbq7VquOdPjSI3br1zTWqfkRTqYWsGxl 8SRJ6u15r8iIoxLaqywM3xaIcyOkwynbnQDJzLTdkbM15w9zAuUWWsj0xzI0Uuqzkz M/0VdTQ10uCk5VZV7CPhHFK/+XYx00eq4gi+i0vY= 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.10 225/563] Bluetooth: L2CAP: uninitialized variables in l2cap_sock_setsockopt() Date: Mon, 24 Jan 2022 19:39:50 +0100 Message-Id: <20220124184032.232010791@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A33AFC433F5 for ; Mon, 24 Jan 2022 20:11:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378956AbiAXUKG (ORCPT ); Mon, 24 Jan 2022 15:10:06 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40510 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347194AbiAXTwS (ORCPT ); Mon, 24 Jan 2022 14:52: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 57CB7B81229; Mon, 24 Jan 2022 19:52:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 803C6C340E5; Mon, 24 Jan 2022 19:52:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053936; bh=VhfLq6rswzGbOL/ljKj6bPc7+9MR7Lf4elfV0tKpNaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hp2MrEqEVppltJlTAPKfVIEBcbOflbGbEJeCtuFwTRQ1uBmEaFi02I2qzkYPnOnuA WXErqvIYpkgBpdFnncHgkoi3NEQ1sJM5kSWfRN8qk0FhggaPBsx8SUtYB46xwx9KcV VndzBCLoGOIfRv1oBehZGBIxs6ZI2dYzOcD8NhU4= 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.10 226/563] spi: spi-meson-spifc: Add missing pm_runtime_disable() in meson_spifc_probe Date: Mon, 24 Jan 2022 19:39:51 +0100 Message-Id: <20220124184032.264663766@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A55FC433EF for ; Tue, 25 Jan 2022 00:19:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374801AbiAYASR (ORCPT ); Mon, 24 Jan 2022 19:18:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2359437AbiAXXch (ORCPT ); Mon, 24 Jan 2022 18:32: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 455ECC019B11; Mon, 24 Jan 2022 11:52: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 D7BA760BA1; Mon, 24 Jan 2022 19:52:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4AD3C340E5; Mon, 24 Jan 2022 19:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053939; bh=BLuA5+HRtipvLUDV44kxQsi5XLKyu1GrNFQ4hzvmezk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GrrYteh85/bBML5Q/1K7hfJ14U+XPpbW5cVpr4P2bWVmtFcBnqp5XXqqYmQzGI4yy tjs+7kPhcsp0trFYcLwR0+016a5t6ATuCn3Go+GUOdHaJz3hgRVEGBxlzGjJvEynl3 LA6/a/0fR4K91eFLp2FK63yx7oYDVk2sx8oNSjF4= 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.10 227/563] ax25: uninitialized variable in ax25_setsockopt() Date: Mon, 24 Jan 2022 19:39:52 +0100 Message-Id: <20220124184032.295666377@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 22278807b3f36..5e84dce5ff7ae 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB369C3526D for ; Mon, 24 Jan 2022 21:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448179AbiAXVMI (ORCPT ); Mon, 24 Jan 2022 16:12:08 -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 S1389562AbiAXUmS (ORCPT ); Mon, 24 Jan 2022 15:42:18 -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 AF7A4C049643; Mon, 24 Jan 2022 11:52: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 784E3B81215; Mon, 24 Jan 2022 19:52:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA7A7C340E8; Mon, 24 Jan 2022 19:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053942; bh=/3IpXYpDHqc7BIxJtkGrqj2x3uRCAnMnROnnR4zFBgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OY+j4eEPI+J48eKsaaid91stx+CxgB5nGKjeW2dZXDQAUkXkJ/4CWIc/+uAYpJwZv q9Kvh2H6k4rOkkVP0Xaumro7ea+c9DoyY4QNvuwm3lOXrh0VJCupGiEvcbLI5tnFCH E2NbqFbA3Hv0ae00FQHiKTgKk635lrUe/kdnad5Q= 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.10 228/563] netrom: fix api breakage in nr_setsockopt() Date: Mon, 24 Jan 2022 19:39:53 +0100 Message-Id: <20220124184032.330706563@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 eef0e3f2f25b0..e5c8a295e6406 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FFCCC3525A for ; Mon, 24 Jan 2022 21:13:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448163AbiAXVMH (ORCPT ); Mon, 24 Jan 2022 16:12:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389564AbiAXUmS (ORCPT ); Mon, 24 Jan 2022 15:42:18 -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 DF66AC049646; Mon, 24 Jan 2022 11:52: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 8839EB81142; Mon, 24 Jan 2022 19:52:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9937BC340E7; Mon, 24 Jan 2022 19:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053945; bh=bRrlijC1F6GBDT2Rk+XS0Jz07Rmt6OW88U30+cWYSz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CNI6UYPQVKErXjOgJeMVanzoqel651bkT/6IxabeZKOhCCVzZyGrVlQNZXiPsszh2 PfZAoVH1FYQF+84+dJCU2iPr+pRBcbiDFReiSsdwoa5BUnJe4CvD1hzZdqCYkc+bRp tpLrbqRyLsQl0Wa+jFXTdw8JOtdwHf4gjo0pmF2A= 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.10 229/563] regmap: Call regmap_debugfs_exit() prior to _init() Date: Mon, 24 Jan 2022 19:39:54 +0100 Message-Id: <20220124184032.369790263@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 456a1787e18d0..55a30afc14a00 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -620,6 +620,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F272DC4332F for ; Mon, 24 Jan 2022 21:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376651AbiAXVIh (ORCPT ); Mon, 24 Jan 2022 16:08:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389571AbiAXUmV (ORCPT ); Mon, 24 Jan 2022 15:42: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 E4C36C04964D; Mon, 24 Jan 2022 11:52: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 AC360B81188; Mon, 24 Jan 2022 19:52:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7FAEC340E5; Mon, 24 Jan 2022 19:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053951; bh=VCiTbnnjte9C+5Tux5ffEglBv+5ZTbI2UNk5iaPeTpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=apVw3TQE9jZwQ7UBFZKrq2B5ZJuxVXW0esTvPrRiGaddwZAUSEqJEyvre16nrDcCT zEeuqkMR4w4ENYDXHWgnOsdpiCrx1wt0KRXyY+2rilhl/xf9Gpa57icyYJD5SLEufa xTroy20jSLvh7IyeXIlPAa0VMgqjolDdsHUQf51w= 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.10 230/563] can: mcp251xfd: add missing newline to printed strings Date: Mon, 24 Jan 2022 19:39:55 +0100 Message-Id: <20220124184032.404070396@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 4e13f6dfb91a2..e0b322ab03628 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c @@ -2497,7 +2497,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)); } @@ -2534,7 +2534,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11E5DC433EF for ; Mon, 24 Jan 2022 21:08:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446488AbiAXVIb (ORCPT ); Mon, 24 Jan 2022 16:08:31 -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 S1389566AbiAXUmV (ORCPT ); Mon, 24 Jan 2022 15:42: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 2C432C04964F; Mon, 24 Jan 2022 11:52: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 C7EE7B81188; Mon, 24 Jan 2022 19:52:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1346C340E7; Mon, 24 Jan 2022 19:52:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053954; bh=utsPrtpcWIvwCt9tvxNIxDq0GM9C7hpc0Yc/H/vxqiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YPjb65L8lVBMh+F634Gp3OFXQ2BUBkkVtmLBZ7EKuzDUktALpyVRCMReR/ky4JkSP 5OcyrTGSLW7khYjyCNn5o7PU/XO2SP/KxhbDu40wJaIjMkiLcbMtabPmCHCMcNTUTb j171szkTrjcT9RIFTPUqjPOQclKa7hq7ysbO/A4Y= 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.10 231/563] tpm: add request_locality before write TPM_INT_ENABLE Date: Mon, 24 Jan 2022 19:39:56 +0100 Message-Id: <20220124184032.433253802@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 188E8C43219 for ; Mon, 24 Jan 2022 20:11:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379057AbiAXUKQ (ORCPT ); Mon, 24 Jan 2022 15:10:16 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:47446 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351696AbiAXTwi (ORCPT ); Mon, 24 Jan 2022 14:52: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 5E7FB60920; Mon, 24 Jan 2022 19:52:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BC24C340E5; Mon, 24 Jan 2022 19:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053957; bh=zspjBTPA65ubtgbkRw3QgH1nHju9jZUDsFEcbrEiT9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z8HfIj9VkZrmyCnYROBtyVinJBCr3DBldeKOkGeLt3C/Mhi+MVlStMTHRUuSddhnq VzOfjwguvCx2sH0A0PTvxVPW1+HkYI+RlHVXFKHF2xmqlacTQG1//Vj+1TIQuKRPLd mesF016zkwbHL/lpmAQlggQBd7NCvmmrf7s+Fks4= 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.10 232/563] tpm_tis: Fix an error handling path in tpm_tis_core_init() Date: Mon, 24 Jan 2022 19:39:57 +0100 Message-Id: <20220124184032.471516850@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E48FC433EF for ; Tue, 25 Jan 2022 00:23:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2375488AbiAYAUQ (ORCPT ); Mon, 24 Jan 2022 19:20:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2359448AbiAXXch (ORCPT ); Mon, 24 Jan 2022 18:32: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 343AFC04965E; Mon, 24 Jan 2022 11:52: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 F212BB8121A; Mon, 24 Jan 2022 19:52:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F4F5C340E5; Mon, 24 Jan 2022 19:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053960; bh=l3drqyKm307shc4cfxIPCuI+/kKxaW+ThbT4V2EVyfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0LD6YYuZeHxJZ1bzQX7KNpYEgarXGCg42LZI8W64YNu2NxR/jMOFN6SYTbJHrPLvC k/3rEy2ZZR8owvLqiYL+qVwq4XRfecXQ8KWac1fRlcgbfyg8OAP+FJfyfvXUpuiKEF j2AkHu8Pw6mTw502XKGqI9xiw6ndxpeDW1AbPgmY= 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.10 233/563] can: softing: softing_startstop(): fix set but not used variable warning Date: Mon, 24 Jan 2022 19:39:58 +0100 Message-Id: <20220124184032.503244774@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ccd649a8e37bd..bad69a4abec10 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25261C433EF for ; Mon, 24 Jan 2022 20:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355384AbiAXUNh (ORCPT ); Mon, 24 Jan 2022 15:13:37 -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 S1352212AbiAXTwp (ORCPT ); Mon, 24 Jan 2022 14:52: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 35B8860B03; Mon, 24 Jan 2022 19:52:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F24C7C340E5; Mon, 24 Jan 2022 19:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053963; bh=OlA4Y8FkDzTA8w20jYBGvYJlPZZsqfaEp19JGgNdp7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tEhS2897oYeeHjYrAJPpvgNhR81VTglomEjFkPvAJs1IP6f2/tA5QAgSClmTV42YC QE0PUvD4JPlbdFCFvsSXS1UZhc5rkOWdYEjFIfYIT9O/DEIroKhnoxPxwdiH0zsUA9 2s6RAVQ5/YNjms1i1jFQvf07oarstK8K4xyVPCcs= 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.10 234/563] can: xilinx_can: xcan_probe(): check for error irq Date: Mon, 24 Jan 2022 19:39:59 +0100 Message-Id: <20220124184032.534625351@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 48d746e18f302..375998263af7a 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -1762,7 +1762,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22A7DC43217 for ; Tue, 25 Jan 2022 00:18:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388744AbiAYARz (ORCPT ); Mon, 24 Jan 2022 19:17:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1851282AbiAXXcS (ORCPT ); Mon, 24 Jan 2022 18:32: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 966F7C049662; Mon, 24 Jan 2022 11:52: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 3387760FED; Mon, 24 Jan 2022 19:52:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 116A7C340E5; Mon, 24 Jan 2022 19:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053966; bh=g6pSpn2i0X05d9/e/pvWbJQ995pdOEPCyDaWB64n2Dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zfSra3olk6ZJudhiZrda2WIpC8N8p9wYcVP4uZTslTfq3A1UCw6/BS8wxPAJ1nxeY Tasd5iUWy1YeV/d2iTgV9DF8H70jPYvpwJZc8dSCtRLZma1duoZjgpYC2vaSE2kinz 1432tvmxp32JTBnPaZ+KIOGKG+GYwCYmzHkLBFlA= 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.10 235/563] pcmcia: fix setting of kthread task states Date: Mon, 24 Jan 2022 19:40:00 +0100 Message-Id: <20220124184032.566342016@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCC7DC4167B for ; Mon, 24 Jan 2022 20:11:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379169AbiAXUK3 (ORCPT ); Mon, 24 Jan 2022 15:10:29 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50246 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235569AbiAXTwv (ORCPT ); Mon, 24 Jan 2022 14:52: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 1580860989; Mon, 24 Jan 2022 19:52:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDAB1C340E8; Mon, 24 Jan 2022 19:52:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053969; bh=HkJde7G0N3DRpmHjssvvdYfr06UK7b1u/hUJBLTfLf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fWjdYUDEYkQS17SfaxzHQxD0xOFt9HQJXJ6Ng5oiOi3YfHrufv9d0+2CzQI61NyCH C+LIlUpWArhp3jej1Zuvz/+HyCr7A/8z+P5zlW7TJLC3dt1sXq2m1K9xlYRQBxv8qh uMrCwR6zgEY/bK5JZB6zDavMWAql/B2etcECtDWE= 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.10 236/563] iwlwifi: mvm: Use div_s64 instead of do_div in iwl_mvm_ftm_rtt_smoothing() Date: Mon, 24 Jan 2022 19:40:01 +0100 Message-Id: <20220124184032.606666415@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 fe3d52620a897..b1335fe3b01a2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c @@ -967,8 +967,7 @@ static void iwl_mvm_ftm_rtt_smoothing(struct iwl_mvm *m= vm, 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A45B3C433EF for ; Mon, 24 Jan 2022 20:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355044AbiAXUKm (ORCPT ); Mon, 24 Jan 2022 15:10:42 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50274 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352389AbiAXTwy (ORCPT ); Mon, 24 Jan 2022 14:52: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 E600D60916; Mon, 24 Jan 2022 19:52:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D049AC340E5; Mon, 24 Jan 2022 19:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053972; bh=Otfz0U8maTLEn+Irs0y44lE82ilMaXIVy8OqHKRQp7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MjFgCH6xCGUNGpd3TD/LFWfAIvJ+bwd44q3FSHsEdUl5ox264i91o1lI2kTzAfIDv FYFzxOlF0ki7GmpAb6WkIvR5l51QkgUqSMXAzrDcQo8vFelGObUHePvatNaRrItcTq 4mM67mUhQOHi8JsExcFtZGTvG0eUn7ZAm1CZXSu0= 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.10 237/563] net: mcs7830: handle usb read errors properly Date: Mon, 24 Jan 2022 19:40:02 +0100 Message-Id: <20220124184032.642319486@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 09bfa6a4dfbc1..7e40e2e2f3723 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DE0DC433F5 for ; Mon, 24 Jan 2022 21:08:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376311AbiAXVIJ (ORCPT ); Mon, 24 Jan 2022 16:08:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358518AbiAXUmZ (ORCPT ); Mon, 24 Jan 2022 15:42: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 62F1FC04966E; Mon, 24 Jan 2022 11:52: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 F3D3360B43; Mon, 24 Jan 2022 19:52:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC940C340E8; Mon, 24 Jan 2022 19:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053975; bh=stAZSoMPzPSb71CrbNvLWrWhQ3nE4fD5aHfcj2BwaxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SZgEKaoam9ojbWuVvHT7zYb6PRW7Xm9pav5Qlrp863Gss8KZ3pM89ubHxFpprqALY RWv0Nn/qrqfPbrWEoVT53UosoSDiwWnwGKmkv4rh+eX38LQlg6Lw5lcrd3Op7seDFM 6Y8cj4ykqkUkEOajxN3CuqB4LGPPJgP6xNDI2EvE= 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.10 238/563] ext4: avoid trim error on fs with small groups Date: Mon, 24 Jan 2022 19:40:03 +0100 Message-Id: <20220124184032.672243166@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 cb54ea6461fd8..413bf3d2f7844 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -1123,8 +1123,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 d7cb7d719ee58..60aef7fdd61d0 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -5815,6 +5815,7 @@ out: */ 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; @@ -5833,6 +5834,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC014C3526D for ; Mon, 24 Jan 2022 21:05:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445716AbiAXVEr (ORCPT ); Mon, 24 Jan 2022 16:04:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389727AbiAXUm6 (ORCPT ); Mon, 24 Jan 2022 15:42:58 -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 DC286C049676; Mon, 24 Jan 2022 11:53: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 A5F2CB81188; Mon, 24 Jan 2022 19:52:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E12FBC340E5; Mon, 24 Jan 2022 19:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053978; bh=7mscifVvvB0xHnK3gXnTZrnfXZXBS3/hJzrI3nhj9xI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d6NCjsd4n0fR1T1T2YeQjxyQUeAMOvV0SXfQ3KdqTthPRcb6u94/VS3dyMURLgjfx pio5Bedq2oazpcPO6xh/dn10wJfEcAnxestncfSgQsr2ZkaQuPTRLvsvQtk75l+w7r 6vK3tm9MKQqCpivJXDxbKXuYAN5cbX9jbxYMSzK0= 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.10 239/563] ALSA: jack: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:40:04 +0100 Message-Id: <20220124184032.702292214@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- sound/core/jack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/core/jack.c b/sound/core/jack.c index d6502dff247a8..dc2e06ae24149 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -54,10 +54,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B868FC4332F for ; Mon, 24 Jan 2022 21:06:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343755AbiAXVGY (ORCPT ); Mon, 24 Jan 2022 16:06:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388453AbiAXUm6 (ORCPT ); Mon, 24 Jan 2022 15:42: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 7DFBAC04967E; Mon, 24 Jan 2022 11:53: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 1DB1C61007; Mon, 24 Jan 2022 19:53:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDB22C340E7; Mon, 24 Jan 2022 19:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053984; bh=OpXJQiAdVYaUhVv2ktwuoXqH6kxvKw1geUPxPGiPlk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wxaNlaeEiDNw04iJZwNmG+Z3iIGWw5iqNyEba6hi2VR7pr0pnFQ9dZmGCmBYZg65T tRhOh8eYt8vj8w7P4D+uXc0Afcieeb9/xMKBocn5jggi3RJgM7cWqDPxGzLP9tY/6P uWVlhuolv+u+Bs3+PWKZHE0I4k72gFpXeRqdkYkU= 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.10 240/563] ALSA: PCM: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:40:05 +0100 Message-Id: <20220124184032.733574692@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 41cbdac5b1cfa..a8ae5928decda 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E343C433F5 for ; Mon, 24 Jan 2022 21:13:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447705AbiAXVLU (ORCPT ); Mon, 24 Jan 2022 16:11:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358714AbiAXUm7 (ORCPT ); Mon, 24 Jan 2022 15:42: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 77791C019B17; Mon, 24 Jan 2022 11:53: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 17C7A60B56; Mon, 24 Jan 2022 19:53:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7E3AC340E5; Mon, 24 Jan 2022 19:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053988; bh=zfKn7wh8I2H8T5QJWZmD5y1h6MOrm2419lqsY1J2kOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fJ8NX6+AagUndKNoXu5DdxdPD5H9JAacMiTlmeAXADt6sOZAafDjkfuA6gfFqo0U7 OZZITNLoSP97K5H3tDYUTuTYGQ3C7iWk6zIuYRpxtr15y3lNCe3JXoBO53GMhzhN4C BawuE3xKt3WEeLgtJ06sYfoZFyzumdXnsqVoVlb0= 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.10 241/563] ALSA: hda: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:40:06 +0100 Message-Id: <20220124184032.765181648@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 6dece719be669..39281106477eb 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FD7DC35272 for ; Mon, 24 Jan 2022 21:13:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447682AbiAXVLO (ORCPT ); Mon, 24 Jan 2022 16:11:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351749AbiAXUnA (ORCPT ); Mon, 24 Jan 2022 15:43: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 52073C019B20; Mon, 24 Jan 2022 11:53: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 1AF15B81218; Mon, 24 Jan 2022 19:53:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20DF8C340E7; Mon, 24 Jan 2022 19:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053991; bh=EFTGqwFfNZIupBXAaiJo6wPohOcD99sfHVhnWJuEJKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C8aDu1tEDxxJMcqeVyOZraOMYzEriyZxNSqXjrZZqiDkM2h/GRrYhJ78C33ERK9ku SgW5NUkbCVV51aJk9VB2KxtjIIdDpcbFJ5XMDPgAwlcM/vtFHZjsWixDBrEKcrufWN Vx/dsobeI/m//NAHypWwodxw7b0DES6fvEmFodj4= 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.10 242/563] RDMA/bnxt_re: Scan the whole bitmap when checking if "disabling RCFW with pending cmd-bit" Date: Mon, 24 Jan 2022 19:40:07 +0100 Message-Id: <20220124184032.798069203@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 441eb421e5e59..5759027914b01 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c @@ -614,8 +614,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), @@ -663,8 +661,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 5f2f0a5a3560f..6953f4e53dd20 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h @@ -150,7 +150,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 787FCC433F5 for ; Mon, 24 Jan 2022 20:13:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355462AbiAXUNk (ORCPT ); Mon, 24 Jan 2022 15:13:40 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50616 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351901AbiAXTxQ (ORCPT ); Mon, 24 Jan 2022 14:53: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 548E660B56; Mon, 24 Jan 2022 19:53:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31441C340E5; Mon, 24 Jan 2022 19:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053994; bh=3xWET1iBUs7ti7fNEsXZBvabZF6fE/iIgtcF6eHBmr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c7FqEgNeLNf+mxj876lNS1BIooXR8wW0/KRW3g0jwoefgBEHov7bnawZ0F34mU2Su 3pJ7+34dC5u0en3kPo5BUV9/LUmbuX6voaLxO10ryEgfuLS6ZE+Qg1PRwFFCX4grOL nJSXbr/zSOgbNRx70St5dMuvc75Cq2s3+9LW/H/Y= 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.10 243/563] RDMA/hns: Validate the pkey index Date: Mon, 24 Jan 2022 19:40:08 +0100 Message-Id: <20220124184032.833457825@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ba65823a5c0bb..c0249e4874a96 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -279,6 +279,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, u8 port, u16 inde= x, u16 *pkey) { + if (index > 0) + return -EINVAL; + *pkey =3D PKEY_ID; =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CD70C4167B for ; Mon, 24 Jan 2022 20:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245353AbiAXULo (ORCPT ); Mon, 24 Jan 2022 15:11:44 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41030 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357912AbiAXTxW (ORCPT ); Mon, 24 Jan 2022 14: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 00E51B8122C; Mon, 24 Jan 2022 19:53:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B0DAC340E5; Mon, 24 Jan 2022 19:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053997; bh=6O4ixEgbR8ruLiZx+ckm3RWsZX2EjjJUpSSMui6IHzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2Ru9wGlPbhVVwZbT9WuzwCKDPIEDbweuQwXvlwhzJ39JzskVUz+A1E0Ev3X4ulMih Gdn63lZ9fjuSIoxho7pTyeMTAkaKuZRYToob2GwRzMDh9+Xb0OiWgiJ4rqzCev25fR 82crgsbf4kpmG3QIBgS092fI/nBd2jvhrZf/XRvo= 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.10 244/563] scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd() Date: Mon, 24 Jan 2022 19:40:09 +0100 Message-Id: <20220124184032.865459407@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 5d751628a6340..9b318958d78cc 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -1323,7 +1323,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 =3D -1; =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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CD70C47081 for ; Mon, 24 Jan 2022 21:05:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445882AbiAXVFF (ORCPT ); Mon, 24 Jan 2022 16:05:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358760AbiAXUnA (ORCPT ); Mon, 24 Jan 2022 15:43: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 8E9B0C019B28; Mon, 24 Jan 2022 11:53: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 2C6B260B4E; Mon, 24 Jan 2022 19:53:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36289C340E5; Mon, 24 Jan 2022 19:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054000; bh=SJHZKZITEzpGaG9cSq85dVyeEN1YWr4QBwoeChZ5/jo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OhBxBrR3BeUyH+jGm1b98aATxWxIIRBW8ikyWE02P7vARdUxpmXbGPCK67vzIclRe qqLBlMlDt+By/4RX+Humpup7DtE3hhDVD9F74jRN1Fi/UGLqG+KLK6DRD+q1qbUXJN wp9xxTkN6B1RBYTjTmMJlj5neQ7SRShFEesFlMT4= 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.10 245/563] clk: imx8mn: Fix imx8mn_clko1_sels Date: Mon, 24 Jan 2022 19:40:10 +0100 Message-Id: <20220124184032.897969484@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 33a7ddc23cd24..db122d94db583 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -274,9 +274,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F7AAC4167D for ; Mon, 24 Jan 2022 20:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380047AbiAXUP0 (ORCPT ); Mon, 24 Jan 2022 15:15:26 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42234 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358654AbiAXTzg (ORCPT ); Mon, 24 Jan 2022 14:55: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 6767CB8122C; Mon, 24 Jan 2022 19:55:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E259C340E5; Mon, 24 Jan 2022 19:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054134; bh=StqJfxjmPP0SWtICLm5IqSnA0cNN4g6PCyJXbEi9dsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RbEcjO+3wZrIksPhUve5Qd4TYK1ivqSyTdcNkUZTEcdKSlOEqiA54A2jnW3HTVCdA Ie4GyQlP8D7QlxymQub+gu/d9GbyqLfpguRH5xietQ/0nkThlcQDPmnfeFS5o2wTtq cIdv1dGpyJXhN9TaEuJqPAVf17K//Dz+xFTprJ2s= 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.10 246/563] powerpc/prom_init: Fix improper check of prom_getprop() Date: Mon, 24 Jan 2022 19:40:11 +0100 Message-Id: <20220124184032.927893394@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 7e337c570ea6b..9e71c0739f08d 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -2956,7 +2956,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26C60C433F5 for ; Tue, 25 Jan 2022 00:18:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389077AbiAYASE (ORCPT ); Mon, 24 Jan 2022 19:18:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1851340AbiAXXc2 (ORCPT ); Mon, 24 Jan 2022 18:32: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 290D5C019B34; Mon, 24 Jan 2022 11: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 E526DB810BD; Mon, 24 Jan 2022 19:53:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25A51C340E5; Mon, 24 Jan 2022 19:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054025; bh=hoGmMt6X0klq0+u7iW/1fCYXghyAHMkMKI5zDTPe7y0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=us1KK7VgwfcqXF7sa0i1kBZTwE/ih1EpzMA0rQ0YVGL7K7nOk9ZzmN11HgFpHPyll /ktd6t+wBEIsUqYG+k7yy5ZO/BkuI1kedhtOtfj1obmeKxQ58FtnCXlV2rVd7V+HFW wHGrtwEgZG6KBy09stBGvLuPM0z29P00Hx5TVi+U= 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.10 247/563] ASoC: uniphier: drop selecting non-existing SND_SOC_UNIPHIER_AIO_DMA Date: Mon, 24 Jan 2022 19:40:12 +0100 Message-Id: <20220124184032.958220601@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3135BC433F5 for ; Mon, 24 Jan 2022 21:06:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444306AbiAXVG5 (ORCPT ); Mon, 24 Jan 2022 16:06:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390166AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 16915C0617BC; Mon, 24 Jan 2022 11:54: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 D217BB81229; Mon, 24 Jan 2022 19:54:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0B12C340E5; Mon, 24 Jan 2022 19:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054059; bh=1yWpEKWsnxvzT9qXhc23Xqk5jPQ5wA/WL2CuYle5s9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vSqtI6WQBOkbn7uqz0o5zwgtz9lmp/u1OU2/gzHgYRwNR2UOpN0b/xf2Q0bfFEAS3 iihx8PtZzjgsCPWPiDmsfuJjBJuAtS/QD1RD/fdMKvzC1NjTHaQWhigoOBSAhUffTl ooxA6hMl2zF9VMPkuO9yimlpZUL0bBGPf3YJDShs= 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.10 248/563] dt-bindings: thermal: Fix definition of cooling-maps contribution property Date: Mon, 24 Jan 2022 19:40:13 +0100 Message-Id: <20220124184032.992904339@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../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 164f71598c595..1b3954aa71c15 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25536C433F5 for ; Mon, 24 Jan 2022 21:07:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446201AbiAXVH3 (ORCPT ); Mon, 24 Jan 2022 16:07:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390183AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 5D4D4C06138D; Mon, 24 Jan 2022 11:54: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 F35AAB81247; Mon, 24 Jan 2022 19:54:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 240FCC340E5; Mon, 24 Jan 2022 19:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054093; bh=XJFUSpOwGxLAKHdjHkI7nzTHoan357sgdNncSughnsc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sG2l7eBiKv7+MCY8UaDFqCVZWT01Qu2tl6dFPWaxbEGfKxoXJoa4WkEhP5Ju/R2/5 KX42LozGsDOxlunGqLRvi1ayWE4ns2IDE9jkbbA/QUVcE0DjENzMOkcZCkM+350ow4 C5ToPwHDSK2NQFR7OdnMME8LHBPa28o5JRE9CDtA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jordan Niethe , Michael Ellerman , Sasha Levin Subject: [PATCH 5.10 249/563] powerpc/64s: Convert some cpu_setup() and cpu_restore() functions to C Date: Mon, 24 Jan 2022 19:40:14 +0100 Message-Id: <20220124184033.028842917@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jordan Niethe [ Upstream commit 344fbab991a568dc33ad90711b489d870e18d26d ] The only thing keeping the cpu_setup() and cpu_restore() functions used in the cputable entries for Power7, Power8, Power9 and Power10 in assembly was cpu_restore() being called before there was a stack in generic_secondary_smp_init(). Commit ("powerpc/64: Set up a kernel stack for secondaries before cpu_restore()") means that it is now possible to use C. Rewrite the functions in C so they are a little bit easier to read. This is not changing their functionality. Signed-off-by: Jordan Niethe [mpe: Tweak copyright and authorship notes] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20201014072837.24539-2-jniethe5@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- arch/powerpc/include/asm/cpu_setup_power.h | 12 + arch/powerpc/kernel/cpu_setup_power.S | 252 ------------------- arch/powerpc/kernel/cpu_setup_power.c | 271 +++++++++++++++++++++ arch/powerpc/kernel/cputable.c | 12 +- 4 files changed, 287 insertions(+), 260 deletions(-) create mode 100644 arch/powerpc/include/asm/cpu_setup_power.h delete mode 100644 arch/powerpc/kernel/cpu_setup_power.S create mode 100644 arch/powerpc/kernel/cpu_setup_power.c diff --git a/arch/powerpc/include/asm/cpu_setup_power.h b/arch/powerpc/incl= ude/asm/cpu_setup_power.h new file mode 100644 index 0000000000000..24be9131f8032 --- /dev/null +++ b/arch/powerpc/include/asm/cpu_setup_power.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2020 IBM Corporation + */ +void __setup_cpu_power7(unsigned long offset, struct cpu_spec *spec); +void __restore_cpu_power7(void); +void __setup_cpu_power8(unsigned long offset, struct cpu_spec *spec); +void __restore_cpu_power8(void); +void __setup_cpu_power9(unsigned long offset, struct cpu_spec *spec); +void __restore_cpu_power9(void); +void __setup_cpu_power10(unsigned long offset, struct cpu_spec *spec); +void __restore_cpu_power10(void); diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cp= u_setup_power.S deleted file mode 100644 index 704e8b9501eee..0000000000000 --- a/arch/powerpc/kernel/cpu_setup_power.S +++ /dev/null @@ -1,252 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * This file contains low level CPU setup functions. - * Copyright (C) 2003 Benjamin Herrenschmidt (benh@kernel.crashing.org) - */ - -#include -#include -#include -#include -#include -#include -#include - -/* Entry: r3 =3D crap, r4 =3D ptr to cputable entry - * - * Note that we can be called twice for pseudo-PVRs - */ -_GLOBAL(__setup_cpu_power7) - mflr r11 - bl __init_hvmode_206 - mtlr r11 - beqlr - li r0,0 - mtspr SPRN_LPID,r0 - LOAD_REG_IMMEDIATE(r0, PCR_MASK) - mtspr SPRN_PCR,r0 - mfspr r3,SPRN_LPCR - li r4,(LPCR_LPES1 >> LPCR_LPES_SH) - bl __init_LPCR_ISA206 - mtlr r11 - blr - -_GLOBAL(__restore_cpu_power7) - mflr r11 - mfmsr r3 - rldicl. r0,r3,4,63 - beqlr - li r0,0 - mtspr SPRN_LPID,r0 - LOAD_REG_IMMEDIATE(r0, PCR_MASK) - mtspr SPRN_PCR,r0 - mfspr r3,SPRN_LPCR - li r4,(LPCR_LPES1 >> LPCR_LPES_SH) - bl __init_LPCR_ISA206 - mtlr r11 - blr - -_GLOBAL(__setup_cpu_power8) - mflr r11 - bl __init_FSCR - bl __init_PMU - bl __init_PMU_ISA207 - bl __init_hvmode_206 - mtlr r11 - beqlr - li r0,0 - mtspr SPRN_LPID,r0 - LOAD_REG_IMMEDIATE(r0, PCR_MASK) - mtspr SPRN_PCR,r0 - mfspr r3,SPRN_LPCR - ori r3, r3, LPCR_PECEDH - li r4,0 /* LPES =3D 0 */ - bl __init_LPCR_ISA206 - bl __init_HFSCR - bl __init_PMU_HV - bl __init_PMU_HV_ISA207 - mtlr r11 - blr - -_GLOBAL(__restore_cpu_power8) - mflr r11 - bl __init_FSCR - bl __init_PMU - bl __init_PMU_ISA207 - mfmsr r3 - rldicl. r0,r3,4,63 - mtlr r11 - beqlr - li r0,0 - mtspr SPRN_LPID,r0 - LOAD_REG_IMMEDIATE(r0, PCR_MASK) - mtspr SPRN_PCR,r0 - mfspr r3,SPRN_LPCR - ori r3, r3, LPCR_PECEDH - li r4,0 /* LPES =3D 0 */ - bl __init_LPCR_ISA206 - bl __init_HFSCR - bl __init_PMU_HV - bl __init_PMU_HV_ISA207 - mtlr r11 - blr - -_GLOBAL(__setup_cpu_power10) - mflr r11 - bl __init_FSCR_power10 - bl __init_PMU - bl __init_PMU_ISA31 - b 1f - -_GLOBAL(__setup_cpu_power9) - mflr r11 - bl __init_FSCR_power9 - bl __init_PMU -1: bl __init_hvmode_206 - mtlr r11 - beqlr - li r0,0 - mtspr SPRN_PSSCR,r0 - mtspr SPRN_LPID,r0 - mtspr SPRN_PID,r0 - LOAD_REG_IMMEDIATE(r0, PCR_MASK) - mtspr SPRN_PCR,r0 - mfspr r3,SPRN_LPCR - LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_= HEIC) - or r3, r3, r4 - LOAD_REG_IMMEDIATE(r4, LPCR_UPRT | LPCR_HR) - andc r3, r3, r4 - li r4,0 /* LPES =3D 0 */ - bl __init_LPCR_ISA300 - bl __init_HFSCR - bl __init_PMU_HV - mtlr r11 - blr - -_GLOBAL(__restore_cpu_power10) - mflr r11 - bl __init_FSCR_power10 - bl __init_PMU - bl __init_PMU_ISA31 - b 1f - -_GLOBAL(__restore_cpu_power9) - mflr r11 - bl __init_FSCR_power9 - bl __init_PMU -1: mfmsr r3 - rldicl. r0,r3,4,63 - mtlr r11 - beqlr - li r0,0 - mtspr SPRN_PSSCR,r0 - mtspr SPRN_LPID,r0 - mtspr SPRN_PID,r0 - LOAD_REG_IMMEDIATE(r0, PCR_MASK) - mtspr SPRN_PCR,r0 - mfspr r3,SPRN_LPCR - LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_H= EIC) - or r3, r3, r4 - LOAD_REG_IMMEDIATE(r4, LPCR_UPRT | LPCR_HR) - andc r3, r3, r4 - li r4,0 /* LPES =3D 0 */ - bl __init_LPCR_ISA300 - bl __init_HFSCR - bl __init_PMU_HV - mtlr r11 - blr - -__init_hvmode_206: - /* Disable CPU_FTR_HVMODE and exit if MSR:HV is not set */ - mfmsr r3 - rldicl. r0,r3,4,63 - bnelr - ld r5,CPU_SPEC_FEATURES(r4) - LOAD_REG_IMMEDIATE(r6,CPU_FTR_HVMODE | CPU_FTR_P9_TM_HV_ASSIST) - andc r5,r5,r6 - std r5,CPU_SPEC_FEATURES(r4) - blr - -__init_LPCR_ISA206: - /* Setup a sane LPCR: - * Called with initial LPCR in R3 and desired LPES 2-bit value in R4 - * - * LPES =3D 0b01 (HSRR0/1 used for 0x500) - * PECE =3D 0b111 - * DPFD =3D 4 - * HDICE =3D 0 - * VC =3D 0b100 (VPM0=3D1, VPM1=3D0, ISL=3D0) - * VRMASD =3D 0b10000 (L=3D1, LP=3D00) - * - * Other bits untouched for now - */ - li r5,0x10 - rldimi r3,r5, LPCR_VRMASD_SH, 64-LPCR_VRMASD_SH-5 - - /* POWER9 has no VRMASD */ -__init_LPCR_ISA300: - rldimi r3,r4, LPCR_LPES_SH, 64-LPCR_LPES_SH-2 - ori r3,r3,(LPCR_PECE0|LPCR_PECE1|LPCR_PECE2) - li r5,4 - rldimi r3,r5, LPCR_DPFD_SH, 64-LPCR_DPFD_SH-3 - clrrdi r3,r3,1 /* clear HDICE */ - li r5,4 - rldimi r3,r5, LPCR_VC_SH, 0 - mtspr SPRN_LPCR,r3 - isync - blr - -__init_FSCR_power10: - mfspr r3, SPRN_FSCR - ori r3, r3, FSCR_PREFIX - mtspr SPRN_FSCR, r3 - // fall through - -__init_FSCR_power9: - mfspr r3, SPRN_FSCR - ori r3, r3, FSCR_SCV - mtspr SPRN_FSCR, r3 - // fall through - -__init_FSCR: - mfspr r3,SPRN_FSCR - ori r3,r3,FSCR_TAR|FSCR_EBB - mtspr SPRN_FSCR,r3 - blr - -__init_HFSCR: - mfspr r3,SPRN_HFSCR - ori r3,r3,HFSCR_TAR|HFSCR_TM|HFSCR_BHRB|HFSCR_PM|\ - HFSCR_DSCR|HFSCR_VECVSX|HFSCR_FP|HFSCR_EBB|HFSCR_MSGP - mtspr SPRN_HFSCR,r3 - blr - -__init_PMU_HV: - li r5,0 - mtspr SPRN_MMCRC,r5 - blr - -__init_PMU_HV_ISA207: - li r5,0 - mtspr SPRN_MMCRH,r5 - blr - -__init_PMU: - li r5,0 - mtspr SPRN_MMCRA,r5 - mtspr SPRN_MMCR0,r5 - mtspr SPRN_MMCR1,r5 - mtspr SPRN_MMCR2,r5 - blr - -__init_PMU_ISA207: - li r5,0 - mtspr SPRN_MMCRS,r5 - blr - -__init_PMU_ISA31: - li r5,0 - mtspr SPRN_MMCR3,r5 - LOAD_REG_IMMEDIATE(r5, MMCRA_BHRB_DISABLE) - mtspr SPRN_MMCRA,r5 - blr diff --git a/arch/powerpc/kernel/cpu_setup_power.c b/arch/powerpc/kernel/cp= u_setup_power.c new file mode 100644 index 0000000000000..0c2191ee139ec --- /dev/null +++ b/arch/powerpc/kernel/cpu_setup_power.c @@ -0,0 +1,271 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2020, Jordan Niethe, IBM Corporation. + * + * This file contains low level CPU setup functions. + * Originally written in assembly by Benjamin Herrenschmidt & various other + * authors. + */ + +#include +#include +#include +#include +#include + +/* Disable CPU_FTR_HVMODE and return false if MSR:HV is not set */ +static bool init_hvmode_206(struct cpu_spec *t) +{ + u64 msr; + + msr =3D mfmsr(); + if (msr & MSR_HV) + return true; + + t->cpu_features &=3D ~(CPU_FTR_HVMODE | CPU_FTR_P9_TM_HV_ASSIST); + return false; +} + +static void init_LPCR_ISA300(u64 lpcr, u64 lpes) +{ + /* POWER9 has no VRMASD */ + lpcr |=3D (lpes << LPCR_LPES_SH) & LPCR_LPES; + lpcr |=3D LPCR_PECE0|LPCR_PECE1|LPCR_PECE2; + lpcr |=3D (4ull << LPCR_DPFD_SH) & LPCR_DPFD; + lpcr &=3D ~LPCR_HDICE; /* clear HDICE */ + lpcr |=3D (4ull << LPCR_VC_SH); + mtspr(SPRN_LPCR, lpcr); + isync(); +} + +/* + * Setup a sane LPCR: + * Called with initial LPCR and desired LPES 2-bit value + * + * LPES =3D 0b01 (HSRR0/1 used for 0x500) + * PECE =3D 0b111 + * DPFD =3D 4 + * HDICE =3D 0 + * VC =3D 0b100 (VPM0=3D1, VPM1=3D0, ISL=3D0) + * VRMASD =3D 0b10000 (L=3D1, LP=3D00) + * + * Other bits untouched for now + */ +static void init_LPCR_ISA206(u64 lpcr, u64 lpes) +{ + lpcr |=3D (0x10ull << LPCR_VRMASD_SH) & LPCR_VRMASD; + init_LPCR_ISA300(lpcr, lpes); +} + +static void init_FSCR(void) +{ + u64 fscr; + + fscr =3D mfspr(SPRN_FSCR); + fscr |=3D FSCR_TAR|FSCR_EBB; + mtspr(SPRN_FSCR, fscr); +} + +static void init_FSCR_power9(void) +{ + u64 fscr; + + fscr =3D mfspr(SPRN_FSCR); + fscr |=3D FSCR_SCV; + mtspr(SPRN_FSCR, fscr); + init_FSCR(); +} + +static void init_FSCR_power10(void) +{ + u64 fscr; + + fscr =3D mfspr(SPRN_FSCR); + fscr |=3D FSCR_PREFIX; + mtspr(SPRN_FSCR, fscr); + init_FSCR_power9(); +} + +static void init_HFSCR(void) +{ + u64 hfscr; + + hfscr =3D mfspr(SPRN_HFSCR); + hfscr |=3D HFSCR_TAR|HFSCR_TM|HFSCR_BHRB|HFSCR_PM|HFSCR_DSCR|\ + HFSCR_VECVSX|HFSCR_FP|HFSCR_EBB|HFSCR_MSGP; + mtspr(SPRN_HFSCR, hfscr); +} + +static void init_PMU_HV(void) +{ + mtspr(SPRN_MMCRC, 0); +} + +static void init_PMU_HV_ISA207(void) +{ + mtspr(SPRN_MMCRH, 0); +} + +static void init_PMU(void) +{ + mtspr(SPRN_MMCRA, 0); + mtspr(SPRN_MMCR0, 0); + mtspr(SPRN_MMCR1, 0); + mtspr(SPRN_MMCR2, 0); +} + +static void init_PMU_ISA207(void) +{ + mtspr(SPRN_MMCRS, 0); +} + +static void init_PMU_ISA31(void) +{ + mtspr(SPRN_MMCR3, 0); + mtspr(SPRN_MMCRA, MMCRA_BHRB_DISABLE); +} + +/* + * Note that we can be called twice of pseudo-PVRs. + * The parameter offset is not used. + */ + +void __setup_cpu_power7(unsigned long offset, struct cpu_spec *t) +{ + if (!init_hvmode_206(t)) + return; + + mtspr(SPRN_LPID, 0); + mtspr(SPRN_PCR, PCR_MASK); + init_LPCR_ISA206(mfspr(SPRN_LPCR), LPCR_LPES1 >> LPCR_LPES_SH); +} + +void __restore_cpu_power7(void) +{ + u64 msr; + + msr =3D mfmsr(); + if (!(msr & MSR_HV)) + return; + + mtspr(SPRN_LPID, 0); + mtspr(SPRN_PCR, PCR_MASK); + init_LPCR_ISA206(mfspr(SPRN_LPCR), LPCR_LPES1 >> LPCR_LPES_SH); +} + +void __setup_cpu_power8(unsigned long offset, struct cpu_spec *t) +{ + init_FSCR(); + init_PMU(); + init_PMU_ISA207(); + + if (!init_hvmode_206(t)) + return; + + mtspr(SPRN_LPID, 0); + mtspr(SPRN_PCR, PCR_MASK); + init_LPCR_ISA206(mfspr(SPRN_LPCR) | LPCR_PECEDH, 0); /* LPES =3D 0 */ + init_HFSCR(); + init_PMU_HV(); + init_PMU_HV_ISA207(); +} + +void __restore_cpu_power8(void) +{ + u64 msr; + + init_FSCR(); + init_PMU(); + init_PMU_ISA207(); + + msr =3D mfmsr(); + if (!(msr & MSR_HV)) + return; + + mtspr(SPRN_LPID, 0); + mtspr(SPRN_PCR, PCR_MASK); + init_LPCR_ISA206(mfspr(SPRN_LPCR) | LPCR_PECEDH, 0); /* LPES =3D 0 */ + init_HFSCR(); + init_PMU_HV(); + init_PMU_HV_ISA207(); +} + +void __setup_cpu_power9(unsigned long offset, struct cpu_spec *t) +{ + init_FSCR_power9(); + init_PMU(); + + if (!init_hvmode_206(t)) + return; + + mtspr(SPRN_PSSCR, 0); + mtspr(SPRN_LPID, 0); + mtspr(SPRN_PID, 0); + mtspr(SPRN_PCR, PCR_MASK); + init_LPCR_ISA300((mfspr(SPRN_LPCR) | LPCR_PECEDH | LPCR_PECE_HVEE |\ + LPCR_HVICE | LPCR_HEIC) & ~(LPCR_UPRT | LPCR_HR), 0); + init_HFSCR(); + init_PMU_HV(); +} + +void __restore_cpu_power9(void) +{ + u64 msr; + + init_FSCR_power9(); + init_PMU(); + + msr =3D mfmsr(); + if (!(msr & MSR_HV)) + return; + + mtspr(SPRN_PSSCR, 0); + mtspr(SPRN_LPID, 0); + mtspr(SPRN_PID, 0); + mtspr(SPRN_PCR, PCR_MASK); + init_LPCR_ISA300((mfspr(SPRN_LPCR) | LPCR_PECEDH | LPCR_PECE_HVEE |\ + LPCR_HVICE | LPCR_HEIC) & ~(LPCR_UPRT | LPCR_HR), 0); + init_HFSCR(); + init_PMU_HV(); +} + +void __setup_cpu_power10(unsigned long offset, struct cpu_spec *t) +{ + init_FSCR_power10(); + init_PMU(); + init_PMU_ISA31(); + + if (!init_hvmode_206(t)) + return; + + mtspr(SPRN_PSSCR, 0); + mtspr(SPRN_LPID, 0); + mtspr(SPRN_PID, 0); + mtspr(SPRN_PCR, PCR_MASK); + init_LPCR_ISA300((mfspr(SPRN_LPCR) | LPCR_PECEDH | LPCR_PECE_HVEE |\ + LPCR_HVICE | LPCR_HEIC) & ~(LPCR_UPRT | LPCR_HR), 0); + init_HFSCR(); + init_PMU_HV(); +} + +void __restore_cpu_power10(void) +{ + u64 msr; + + init_FSCR_power10(); + init_PMU(); + init_PMU_ISA31(); + + msr =3D mfmsr(); + if (!(msr & MSR_HV)) + return; + + mtspr(SPRN_PSSCR, 0); + mtspr(SPRN_LPID, 0); + mtspr(SPRN_PID, 0); + mtspr(SPRN_PCR, PCR_MASK); + init_LPCR_ISA300((mfspr(SPRN_LPCR) | LPCR_PECEDH | LPCR_PECE_HVEE |\ + LPCR_HVICE | LPCR_HEIC) & ~(LPCR_UPRT | LPCR_HR), 0); + init_HFSCR(); + init_PMU_HV(); +} diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 29de58d4dfb76..8fdb40ee86d11 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c @@ -60,19 +60,15 @@ extern void __setup_cpu_7410(unsigned long offset, stru= ct cpu_spec* spec); extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec); #endif /* CONFIG_PPC32 */ #ifdef CONFIG_PPC64 +#include extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec= ); extern void __setup_cpu_ppc970MP(unsigned long offset, struct cpu_spec* sp= ec); extern void __setup_cpu_pa6t(unsigned long offset, struct cpu_spec* spec); extern void __restore_cpu_pa6t(void); extern void __restore_cpu_ppc970(void); -extern void __setup_cpu_power7(unsigned long offset, struct cpu_spec* spec= ); -extern void __restore_cpu_power7(void); -extern void __setup_cpu_power8(unsigned long offset, struct cpu_spec* spec= ); -extern void __restore_cpu_power8(void); -extern void __setup_cpu_power9(unsigned long offset, struct cpu_spec* spec= ); -extern void __restore_cpu_power9(void); -extern void __setup_cpu_power10(unsigned long offset, struct cpu_spec* spe= c); -extern void __restore_cpu_power10(void); +extern long __machine_check_early_realmode_p7(struct pt_regs *regs); +extern long __machine_check_early_realmode_p8(struct pt_regs *regs); +extern long __machine_check_early_realmode_p9(struct pt_regs *regs); #endif /* CONFIG_PPC64 */ #if defined(CONFIG_E500) extern void __setup_cpu_e5500(unsigned long offset, struct cpu_spec* spec); --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B563C4332F for ; Mon, 24 Jan 2022 21:07:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446240AbiAXVHm (ORCPT ); Mon, 24 Jan 2022 16:07:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390179AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 31C23C061390; Mon, 24 Jan 2022 11:55: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 C522D60989; Mon, 24 Jan 2022 19:55:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FE24C340E5; Mon, 24 Jan 2022 19:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054115; bh=P8FNdST8MIiMSsIkJay1Yf+qqqIZclz8ADarO4rtgH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M1S1veKmJsgXsddXj+m945kCxDrZTnJZ23ErNmY1YgiH7QAGfM5crSnzyNWMtO5Cc +d/buD//KVDvxt5M5EcpusFS12PCzl6cpH54JgtZbNP3Z/HYrm3Sj6qIxpAv2GJivN WIg3kfyw7lHeQJ44Y3jpfhxeBpdKOOMLnfUUqQ+U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Athira Rajeev , Michael Ellerman , Sasha Levin Subject: [PATCH 5.10 250/563] powerpc/perf: MMCR0 control for PMU registers under PMCC=00 Date: Mon, 24 Jan 2022 19:40:15 +0100 Message-Id: <20220124184033.066628118@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 91668ab7db4bcfae332e561df1de2401f3f18553 ] PowerISA v3.1 introduces new control bit (PMCCEXT) for restricting access to group B PMU registers in problem state when MMCR0 PMCC=3D0b00. In problem state and when MMCR0 PMCC=3D0b00, setting the Monitor Mode Control Register bit 54 (MMCR0 PMCCEXT), will restrict read permission on Group B Performance Monitor Registers (SIER, SIAR, SDAR and MMCR1). When this bit is set to zero, group B registers will be readable. In other platforms (like power9), the older behaviour is retained where group B PMU SPRs are readable. Patch adds support for MMCR0 PMCCEXT bit in power10 by enabling this bit during boot and during the PMU event enable/disable callback functions. Signed-off-by: Athira Rajeev Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1606409684-1589-8-git-send-email-atrajeev@l= inux.vnet.ibm.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- arch/powerpc/include/asm/reg.h | 1 + arch/powerpc/kernel/cpu_setup_power.c | 1 + arch/powerpc/kernel/dt_cpu_ftrs.c | 1 + arch/powerpc/perf/core-book3s.c | 4 ++++ arch/powerpc/perf/isa207-common.c | 8 ++++++++ 5 files changed, 15 insertions(+) diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index f4b98903064f5..6afb14b6bbc26 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h @@ -865,6 +865,7 @@ #define MMCR0_BHRBA 0x00200000UL /* BHRB Access allowed in userspace */ #define MMCR0_EBE 0x00100000UL /* Event based branch enable */ #define MMCR0_PMCC 0x000c0000UL /* PMC control */ +#define MMCR0_PMCCEXT ASM_CONST(0x00000200) /* PMCCEXT control */ #define MMCR0_PMCC_U6 0x00080000UL /* PMC1-6 are R/W by user (PR) */ #define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/ #define MMCR0_PMCjCE ASM_CONST(0x00004000) /* PMCj count enable*/ diff --git a/arch/powerpc/kernel/cpu_setup_power.c b/arch/powerpc/kernel/cp= u_setup_power.c index 0c2191ee139ec..3cca88ee96d71 100644 --- a/arch/powerpc/kernel/cpu_setup_power.c +++ b/arch/powerpc/kernel/cpu_setup_power.c @@ -123,6 +123,7 @@ static void init_PMU_ISA31(void) { mtspr(SPRN_MMCR3, 0); mtspr(SPRN_MMCRA, MMCRA_BHRB_DISABLE); + mtspr(SPRN_MMCR0, MMCR0_PMCCEXT); } =20 /* diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu= _ftrs.c index 1098863e17ee8..9d079659b24d3 100644 --- a/arch/powerpc/kernel/dt_cpu_ftrs.c +++ b/arch/powerpc/kernel/dt_cpu_ftrs.c @@ -454,6 +454,7 @@ static void init_pmu_power10(void) =20 mtspr(SPRN_MMCR3, 0); mtspr(SPRN_MMCRA, MMCRA_BHRB_DISABLE); + mtspr(SPRN_MMCR0, MMCR0_PMCCEXT); } =20 static int __init feat_enable_pmu_power10(struct dt_cpu_feature *f) diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3= s.c index 91452313489f1..7bda7499d0401 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -95,6 +95,7 @@ static unsigned int freeze_events_kernel =3D MMCR0_FCS; #define SPRN_SIER3 0 #define MMCRA_SAMPLE_ENABLE 0 #define MMCRA_BHRB_DISABLE 0 +#define MMCR0_PMCCEXT 0 =20 static inline unsigned long perf_ip_adjust(struct pt_regs *regs) { @@ -1245,6 +1246,9 @@ static void power_pmu_disable(struct pmu *pmu) val |=3D MMCR0_FC; val &=3D ~(MMCR0_EBE | MMCR0_BHRBA | MMCR0_PMCC | MMCR0_PMAO | MMCR0_FC56); + /* Set mmcr0 PMCCEXT for p10 */ + if (ppmu->flags & PPMU_ARCH_31) + val |=3D MMCR0_PMCCEXT; =20 /* * The barrier is to make sure the mtspr has been diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-c= ommon.c index 5e8eedda45d39..58448f0e47213 100644 --- a/arch/powerpc/perf/isa207-common.c +++ b/arch/powerpc/perf/isa207-common.c @@ -561,6 +561,14 @@ int isa207_compute_mmcr(u64 event[], int n_ev, if (!(pmc_inuse & 0x60)) mmcr->mmcr0 |=3D MMCR0_FC56; =20 + /* + * Set mmcr0 (PMCCEXT) for p10 which + * will restrict access to group B registers + * when MMCR0 PMCC=3D0b00. + */ + if (cpu_has_feature(CPU_FTR_ARCH_31)) + mmcr->mmcr0 |=3D MMCR0_PMCCEXT; + mmcr->mmcr1 =3D mmcr1; mmcr->mmcra =3D mmcra; mmcr->mmcr2 =3D mmcr2; --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42FC5C433EF for ; Mon, 24 Jan 2022 21:07:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446141AbiAXVHQ (ORCPT ); Mon, 24 Jan 2022 16:07:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390190AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 D9405C061392; Mon, 24 Jan 2022 11: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 9F381B81250; Mon, 24 Jan 2022 19:55:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1D64C340E5; Mon, 24 Jan 2022 19:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054118; bh=+z3YuLmZMy6w1DdMisKiRxUejo41fwoO2deVR1S3N08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cAGp+ctsdlcTiyoJUdtdGz6xrWhYE0lPS5a7SunNJUEwXQt+zNWTUaYAbwwdqiMF8 KGswQE8tFxO5v/pz6VmpzJNzmBr0BR6ZJ190HxzOREgrTwKXYNtMhKX5PZJ/6XfDJX umAjNcMbTeo+DRxV5R3TZTe0eG6j3y84mmZ0mgOU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.10 251/563] powerpc/perf: move perf irq/nmi handling details into traps.c Date: Mon, 24 Jan 2022 19:40:16 +0100 Message-Id: <20220124184033.103056832@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 156b5371a9c2482a9ad23ec82d1a4f89a3ab430d ] This is required in order to allow more significant differences between NMI type interrupt handlers and regular asynchronous handlers. Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210130130852.2952424-20-npiggin@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- arch/powerpc/kernel/traps.c | 31 +++++++++++++++++++++++++++- arch/powerpc/perf/core-book3s.c | 35 ++------------------------------ arch/powerpc/perf/core-fsl-emb.c | 25 ----------------------- 3 files changed, 32 insertions(+), 59 deletions(-) diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 77dffea3d5373..069d451240fa4 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -1922,11 +1922,40 @@ void vsx_unavailable_tm(struct pt_regs *regs) } #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ =20 -void performance_monitor_exception(struct pt_regs *regs) +static void performance_monitor_exception_nmi(struct pt_regs *regs) +{ + nmi_enter(); + + __this_cpu_inc(irq_stat.pmu_irqs); + + perf_irq(regs); + + nmi_exit(); +} + +static void performance_monitor_exception_async(struct pt_regs *regs) { + irq_enter(); + __this_cpu_inc(irq_stat.pmu_irqs); =20 perf_irq(regs); + + irq_exit(); +} + +void performance_monitor_exception(struct pt_regs *regs) +{ + /* + * On 64-bit, if perf interrupts hit in a local_irq_disable + * (soft-masked) region, we consider them as NMIs. This is required to + * prevent hash faults on user addresses when reading callchains (and + * looks better from an irq tracing perspective). + */ + if (IS_ENABLED(CONFIG_PPC64) && unlikely(arch_irq_disabled_regs(regs))) + performance_monitor_exception_nmi(regs); + else + performance_monitor_exception_async(regs); } =20 #ifdef CONFIG_PPC_ADV_DEBUG_REGS diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3= s.c index 7bda7499d0401..b5cac8ddcf5bc 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -110,10 +110,6 @@ static inline void perf_read_regs(struct pt_regs *regs) { regs->result =3D 0; } -static inline int perf_intr_is_nmi(struct pt_regs *regs) -{ - return 0; -} =20 static inline int siar_valid(struct pt_regs *regs) { @@ -332,15 +328,6 @@ static inline void perf_read_regs(struct pt_regs *regs) regs->result =3D use_siar; } =20 -/* - * If interrupts were soft-disabled when a PMU interrupt occurs, treat - * it as an NMI. - */ -static inline int perf_intr_is_nmi(struct pt_regs *regs) -{ - return (regs->softe & IRQS_DISABLED); -} - /* * On processors like P7+ that have the SIAR-Valid bit, marked instructions * must be sampled only if the SIAR-valid bit is set. @@ -2254,7 +2241,6 @@ static void __perf_event_interrupt(struct pt_regs *re= gs) struct perf_event *event; unsigned long val[8]; int found, active; - int nmi; =20 if (cpuhw->n_limited) freeze_limited_counters(cpuhw, mfspr(SPRN_PMC5), @@ -2262,18 +2248,6 @@ static void __perf_event_interrupt(struct pt_regs *r= egs) =20 perf_read_regs(regs); =20 - /* - * If perf interrupts hit in a local_irq_disable (soft-masked) region, - * we consider them as NMIs. This is required to prevent hash faults on - * user addresses when reading callchains. See the NMI test in - * do_hash_page. - */ - nmi =3D perf_intr_is_nmi(regs); - if (nmi) - nmi_enter(); - else - irq_enter(); - /* Read all the PMCs since we'll need them a bunch of times */ for (i =3D 0; i < ppmu->n_counter; ++i) val[i] =3D read_pmc(i + 1); @@ -2319,8 +2293,8 @@ static void __perf_event_interrupt(struct pt_regs *re= gs) } } } - if (!found && !nmi && printk_ratelimit()) - printk(KERN_WARNING "Can't find PMC that caused IRQ\n"); + if (unlikely(!found) && !arch_irq_disabled_regs(regs)) + printk_ratelimited(KERN_WARNING "Can't find PMC that caused IRQ\n"); =20 /* * Reset MMCR0 to its normal value. This will set PMXE and @@ -2330,11 +2304,6 @@ static void __perf_event_interrupt(struct pt_regs *r= egs) * we get back out of this interrupt. */ write_mmcr0(cpuhw, cpuhw->mmcr.mmcr0); - - if (nmi) - nmi_exit(); - else - irq_exit(); } =20 static void perf_event_interrupt(struct pt_regs *regs) diff --git a/arch/powerpc/perf/core-fsl-emb.c b/arch/powerpc/perf/core-fsl-= emb.c index e0e7e276bfd25..ee721f420a7ba 100644 --- a/arch/powerpc/perf/core-fsl-emb.c +++ b/arch/powerpc/perf/core-fsl-emb.c @@ -31,19 +31,6 @@ static atomic_t num_events; /* Used to avoid races in calling reserve/release_pmc_hardware */ static DEFINE_MUTEX(pmc_reserve_mutex); =20 -/* - * If interrupts were soft-disabled when a PMU interrupt occurs, treat - * it as an NMI. - */ -static inline int perf_intr_is_nmi(struct pt_regs *regs) -{ -#ifdef __powerpc64__ - return (regs->softe & IRQS_DISABLED); -#else - return 0; -#endif -} - static void perf_event_interrupt(struct pt_regs *regs); =20 /* @@ -659,13 +646,6 @@ static void perf_event_interrupt(struct pt_regs *regs) struct perf_event *event; unsigned long val; int found =3D 0; - int nmi; - - nmi =3D perf_intr_is_nmi(regs); - if (nmi) - nmi_enter(); - else - irq_enter(); =20 for (i =3D 0; i < ppmu->n_counter; ++i) { event =3D cpuhw->event[i]; @@ -690,11 +670,6 @@ static void perf_event_interrupt(struct pt_regs *regs) mtmsr(mfmsr() | MSR_PMM); mtpmr(PMRN_PMGC0, PMGC0_PMIE | PMGC0_FCECE); isync(); - - if (nmi) - nmi_exit(); - else - irq_exit(); } =20 void hw_perf_event_setup(int cpu) --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CCEFC4167E for ; Mon, 24 Jan 2022 20:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379974AbiAXUPV (ORCPT ); Mon, 24 Jan 2022 15:15:21 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41030 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358524AbiAXTzY (ORCPT ); Mon, 24 Jan 2022 14: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 368CCB81249; Mon, 24 Jan 2022 19:55:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F0DAC340E5; Mon, 24 Jan 2022 19:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054122; bh=98zH9u/dBMHoLBSmD4N4UIOlb0RnvHJAmJkIuGxkAPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sl/VVDtLUE0V4i77dHsdyO1PQe04HcHOyp7JgNa/spRMqEyDN71j33j0KG4Ly5IMZ Zv0iFAIrkj13MITBE/ZKfKI1WNauXYRwOiYcWuQzzztOibH7W9TmzZGP2ime2tVDdx Rr0pK7iNauYA6Fy5vn/oNFw5OmfMdtpq4ewDNis8= 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.10 252/563] powerpc/irq: Add helper to set regs->softe Date: Mon, 24 Jan 2022 19:40:17 +0100 Message-Id: <20220124184033.139559555@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 fb5608fd117a8b48752d2b5a7e70847c1ed33d33 ] regs->softe doesn't exist on PPC32. Add irq_soft_mask_regs_set_state() helper to set regs->softe. This helper will void on PPC32. Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/5f37d1177a751fdbca79df461d283850ca3a34a2.16= 12796617.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- arch/powerpc/include/asm/hw_irq.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/h= w_irq.h index 0363734ff56e0..da94cab528dd4 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h @@ -38,6 +38,8 @@ #define PACA_IRQ_MUST_HARD_MASK (PACA_IRQ_EE) #endif =20 +#endif /* CONFIG_PPC64 */ + /* * flags for paca->irq_soft_mask */ @@ -46,8 +48,6 @@ #define IRQS_PMI_DISABLED 2 #define IRQS_ALL_DISABLED (IRQS_DISABLED | IRQS_PMI_DISABLED) =20 -#endif /* CONFIG_PPC64 */ - #ifndef __ASSEMBLY__ =20 extern void replay_system_reset(void); @@ -296,6 +296,10 @@ extern void irq_set_pending_from_srr1(unsigned long sr= r1); =20 extern void force_external_irq_replay(void); =20 +static inline void irq_soft_mask_regs_set_state(struct pt_regs *regs, unsi= gned long val) +{ + regs->softe =3D val; +} #else /* CONFIG_PPC64 */ =20 static inline unsigned long arch_local_save_flags(void) @@ -364,6 +368,9 @@ static inline bool arch_irq_disabled_regs(struct pt_reg= s *regs) =20 static inline void may_hard_irq_enable(void) { } =20 +static inline void irq_soft_mask_regs_set_state(struct pt_regs *regs, unsi= gned long val) +{ +} #endif /* CONFIG_PPC64 */ =20 #define ARCH_IRQ_INIT_FLAGS IRQ_NOREQUEST --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 280EDC2BA4C for ; Mon, 24 Jan 2022 21:13:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447817AbiAXVLb (ORCPT ); Mon, 24 Jan 2022 16:11:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390195AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 9E984C061394; Mon, 24 Jan 2022 11:55: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 65756B8124E; Mon, 24 Jan 2022 19:55:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70CF8C340E5; Mon, 24 Jan 2022 19:55:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054125; bh=NTMoDJhmBuJyFroywjtdJV/f8o+rFALBpZ1AX8ZMNqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bvCW21ORHSv+vR3VDD+JoDW0+Gh9ZHTpa1mdMjfocuELHK74iKyJEHi8kBwCniWqW /PWms3uZorRws2ft5XdHP5jEi91SeHXJLTskQhem/3V8vdukDFZzopEB9yPEP8uySz kZbgiszV3lE0zZBCb1F1Mpen99lCiJh6ouF0lNiU= 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.10 253/563] powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an overflown PMC Date: Mon, 24 Jan 2022 19:40:18 +0100 Message-Id: <20220124184033.177864222@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 da94cab528dd4..0f2acbb966740 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h @@ -175,6 +175,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 @@ -368,6 +404,10 @@ static inline bool arch_irq_disabled_regs(struct pt_re= gs *regs) =20 static inline void may_hard_irq_enable(void) { } =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 b5cac8ddcf5bc..bd34e062bd290 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -805,6 +805,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) { @@ -1228,11 +1241,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; @@ -1246,6 +1261,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 /* @@ -1337,6 +1369,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) @@ -2274,6 +2315,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); @@ -2293,6 +2342,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C314C433FE for ; Mon, 24 Jan 2022 21:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446330AbiAXVHx (ORCPT ); Mon, 24 Jan 2022 16:07:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390196AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 A4C64C061395; Mon, 24 Jan 2022 11:55: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 4B972B8124F; Mon, 24 Jan 2022 19:55:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67528C340E5; Mon, 24 Jan 2022 19:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054128; bh=th4VKO5Ug+nK9IqtFEODJ6OwStYjXRjMQK8H8lx4WDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J/t/eJ7c0uoezgJvaT6LXdo2LzEy/IX410IzigQMUGZ4arXjCfZMIomzefj6oMNEt x3PJa1bFLQbIGVL6YqyPBZOGsfiNTG7iHrvtdOfqnXaicp7J07uEEbrhCOFyKMKS8J LRw4MSD59m84uPEV0jPJceIH1nxgmp6AZXWWHOo8= 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.10 254/563] powerpc/32s: Fix shift-out-of-bounds in KASAN init Date: Mon, 24 Jan 2022 19:40:19 +0100 Message-Id: <20220124184033.209947453@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C254C35274 for ; Mon, 24 Jan 2022 20:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380006AbiAXUPX (ORCPT ); Mon, 24 Jan 2022 15:15:23 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42220 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358632AbiAXTze (ORCPT ); Mon, 24 Jan 2022 14:55: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 68117B8124F; Mon, 24 Jan 2022 19:55:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C741C340E5; Mon, 24 Jan 2022 19:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054131; bh=ojMR8X9nX7zDdS/xnbxlbb75aZ9SZ4nkfezZ4o8jmNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C/87rKVmO5UvRSamdqPzDwHCtJlyewNxPYqwZ/bAYqvX5LbXJmu0BOFP9NKOGlT8B rXw/KAeCu8cbcLJ7q9BxKk1s9OHdTzauewTF1KZhRcT/Epr8rV4KnVLgb5VtedUnLj AReSa1XUAaL34OjQ+taZ7eObVFs0gP3GHrzZlZD4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , "Paul E. McKenney" , Feng Tang , Sasha Levin Subject: [PATCH 5.10 255/563] clocksource: Reduce clocksource-skew threshold Date: Mon, 24 Jan 2022 19:40:20 +0100 Message-Id: <20220124184033.241893805@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 E. McKenney [ Upstream commit 2e27e793e280ff12cb5c202a1214c08b0d3a0f26 ] Currently, WATCHDOG_THRESHOLD is set to detect a 62.5-millisecond skew in a 500-millisecond WATCHDOG_INTERVAL. This requires that clocks be skewed by more than 12.5% in order to be marked unstable. Except that a clock that is skewed by that much is probably destroying unsuspecting software right and left. And given that there are now checks for false-positive skews due to delays between reading the two clocks, it should be possible to greatly decrease WATCHDOG_THRESHOLD, at least for fine-grained clocks such as TSC. Therefore, add a new uncertainty_margin field to the clocksource structure that contains the maximum uncertainty in nanoseconds for the corresponding clock. This field may be initialized manually, as it is for clocksource_tsc_early and clocksource_jiffies, which is copied to refined_jiffies. If the field is not initialized manually, it will be computed at clock-registry time as the period of the clock in question based on the scale and freq parameters to __clocksource_update_freq_scale() function. If either of those two parameters are zero, the tens-of-milliseconds WATCHDOG_THRESHOLD is used as a cowardly alternative to dividing by zero. No matter how the uncertainty_margin field is calculated, it is bounded below by twice WATCHDOG_MAX_SKEW, that is, by 100 microseconds. Note that manually initialized uncertainty_margin fields are not adjusted, but there is a WARN_ON_ONCE() that triggers if any such field is less than twice WATCHDOG_MAX_SKEW. This WARN_ON_ONCE() is intended to discourage production use of the one-nanosecond uncertainty_margin values that are used to test the clock-skew code itself. The actual clock-skew check uses the sum of the uncertainty_margin fields of the two clocksource structures being compared. Integer overflow is avoided because the largest computed value of the uncertainty_margin fields is one billion (10^9), and double that value fits into an unsigned int. However, if someone manually specifies (say) UINT_MAX, they will get what they deserve. Note that the refined_jiffies uncertainty_margin field is initialized to TICK_NSEC, which means that skew checks involving this clocksource will be sufficently forgiving. In a similar vein, the clocksource_tsc_early uncertainty_margin field is initialized to 32*NSEC_PER_MSEC, which replicates the current behavior and allows custom setting if needed in order to address the rare skews detected for this clocksource in current mainline. Suggested-by: Thomas Gleixner Signed-off-by: Paul E. McKenney Signed-off-by: Thomas Gleixner Acked-by: Feng Tang Link: https://lore.kernel.org/r/20210527190124.440372-4-paulmck@kernel.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- arch/x86/kernel/tsc.c | 1 + include/linux/clocksource.h | 3 +++ kernel/time/clocksource.c | 48 +++++++++++++++++++++++++++++-------- kernel/time/jiffies.c | 15 ++++++------ 4 files changed, 50 insertions(+), 17 deletions(-) diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index f9f1b45e5ddc4..13d1a0ac8916a 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -1127,6 +1127,7 @@ static int tsc_cs_enable(struct clocksource *cs) static struct clocksource clocksource_tsc_early =3D { .name =3D "tsc-early", .rating =3D 299, + .uncertainty_margin =3D 32 * NSEC_PER_MSEC, .read =3D read_tsc, .mask =3D CLOCKSOURCE_MASK(64), .flags =3D CLOCK_SOURCE_IS_CONTINUOUS | diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 83a3ebff74560..8f87c1a6f3231 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h @@ -42,6 +42,8 @@ struct module; * @shift: Cycle to nanosecond divisor (power of two) * @max_idle_ns: Maximum idle time permitted by the clocksource (nsecs) * @maxadj: Maximum adjustment value to mult (~11%) + * @uncertainty_margin: Maximum uncertainty in nanoseconds per half second. + * Zero says to use default WATCHDOG_THRESHOLD. * @archdata: Optional arch-specific data * @max_cycles: Maximum safe cycle value which won't overflow on * multiplication @@ -93,6 +95,7 @@ struct clocksource { u32 shift; u64 max_idle_ns; u32 maxadj; + u32 uncertainty_margin; #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA struct arch_clocksource_data archdata; #endif diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 74492f08660c4..d0803a69a2009 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -93,6 +93,20 @@ static char override_name[CS_NAME_LEN]; static int finished_booting; static u64 suspend_start; =20 +/* + * Threshold: 0.0312s, when doubled: 0.0625s. + * Also a default for cs->uncertainty_margin when registering clocks. + */ +#define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 5) + +/* + * Maximum permissible delay between two readouts of the watchdog + * clocksource surrounding a read of the clocksource being validated. + * 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) + #ifdef CONFIG_CLOCKSOURCE_WATCHDOG static void clocksource_watchdog_work(struct work_struct *work); static void clocksource_select(void); @@ -119,17 +133,9 @@ static int clocksource_watchdog_kthread(void *data); static void __clocksource_change_rating(struct clocksource *cs, int rating= ); =20 /* - * Interval: 0.5sec Threshold: 0.0625s + * Interval: 0.5sec. */ #define WATCHDOG_INTERVAL (HZ >> 1) -#define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4) - -/* - * Maximum permissible delay between two readouts of the watchdog - * clocksource surrounding a read of the clocksource being validated. - * This delay could be due to SMIs, NMIs, or to VCPU preemptions. - */ -#define WATCHDOG_MAX_SKEW (100 * NSEC_PER_USEC) =20 static void clocksource_watchdog_work(struct work_struct *work) { @@ -284,6 +290,7 @@ static void clocksource_watchdog(struct timer_list *unu= sed) int next_cpu, reset_pending; int64_t wd_nsec, cs_nsec; struct clocksource *cs; + u32 md; =20 spin_lock(&watchdog_lock); if (!watchdog_running) @@ -330,7 +337,8 @@ static void clocksource_watchdog(struct timer_list *unu= sed) continue; =20 /* Check the deviation from the watchdog clocksource. */ - if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) { + md =3D cs->uncertainty_margin + watchdog->uncertainty_margin; + if (abs(cs_nsec - wd_nsec) > md) { pr_warn("timekeeping watchdog on CPU%d: Marking clocksource '%s' as uns= table because the skew is too large:\n", smp_processor_id(), cs->name); pr_warn(" '%s' wd_now: %llx wd_last: %llx mask: %l= lx\n", @@ -985,6 +993,26 @@ void __clocksource_update_freq_scale(struct clocksourc= e *cs, u32 scale, u32 freq clocks_calc_mult_shift(&cs->mult, &cs->shift, freq, NSEC_PER_SEC / scale, sec * scale); } + + /* + * If the uncertainty margin is not specified, calculate it. + * If both scale and freq are non-zero, calculate the clock + * period, but bound below at 2*WATCHDOG_MAX_SKEW. However, + * if either of scale or freq is zero, be very conservative and + * take the tens-of-milliseconds WATCHDOG_THRESHOLD value for the + * uncertainty margin. Allow stupidly small uncertainty margins + * to be specified by the caller for testing purposes, but warn + * to discourage production use of this capability. + */ + if (scale && freq && !cs->uncertainty_margin) { + cs->uncertainty_margin =3D NSEC_PER_SEC / (scale * freq); + if (cs->uncertainty_margin < 2 * WATCHDOG_MAX_SKEW) + cs->uncertainty_margin =3D 2 * WATCHDOG_MAX_SKEW; + } else if (!cs->uncertainty_margin) { + cs->uncertainty_margin =3D WATCHDOG_THRESHOLD; + } + WARN_ON_ONCE(cs->uncertainty_margin < 2 * WATCHDOG_MAX_SKEW); + /* * Ensure clocksources that have large 'mult' values don't overflow * when adjusted. diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c index eddcf49704445..65409abcca8e1 100644 --- a/kernel/time/jiffies.c +++ b/kernel/time/jiffies.c @@ -49,13 +49,14 @@ static u64 jiffies_read(struct clocksource *cs) * for "tick-less" systems. */ static struct clocksource clocksource_jiffies =3D { - .name =3D "jiffies", - .rating =3D 1, /* lowest valid rating*/ - .read =3D jiffies_read, - .mask =3D CLOCKSOURCE_MASK(32), - .mult =3D TICK_NSEC << JIFFIES_SHIFT, /* details above */ - .shift =3D JIFFIES_SHIFT, - .max_cycles =3D 10, + .name =3D "jiffies", + .rating =3D 1, /* lowest valid rating*/ + .uncertainty_margin =3D 32 * NSEC_PER_MSEC, + .read =3D jiffies_read, + .mask =3D CLOCKSOURCE_MASK(32), + .mult =3D TICK_NSEC << JIFFIES_SHIFT, /* details above */ + .shift =3D JIFFIES_SHIFT, + .max_cycles =3D 10, }; =20 __cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK(jiffies_lock); --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09FF9C433FE for ; Mon, 24 Jan 2022 20:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379780AbiAXUMg (ORCPT ); Mon, 24 Jan 2022 15:12:36 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49206 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344298AbiAXTxv (ORCPT ); Mon, 24 Jan 2022 14:53: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 48A0C601B6; Mon, 24 Jan 2022 19:53:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 308B5C340E5; Mon, 24 Jan 2022 19:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054028; bh=lOJCY7buUeLtrTZHe3ywJbkc8zqpQTJvczT/ZH8x97Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=op4XRG0VRxo1CxhAFEmKH8ZTzdogegbVt8GyyIHXyUsgQIq51oIgXx+hQTOlgEGRX K03TT/CfqMOZdfvj7JDtzh6D0zNSaC5rb/H5zn12HGDPPpfNrigm0QtwJ/4v3mWF9M njJPO7Ea980N/njNGpzWBFJ3osKS7pf+Ler8xnxA= 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.10 256/563] clocksource: Avoid accidental unstable marking of clocksources Date: Mon, 24 Jan 2022 19:40:21 +0100 Message-Id: <20220124184033.272071853@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 d0803a69a2009..e34ceb91f4c5a 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -105,7 +105,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); @@ -200,17 +200,24 @@ void clocksource_mark_unstable(struct clocksource *cs) static ulong max_cswd_read_retries =3D 3; module_param(max_cswd_read_retries, ulong, 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); @@ -221,13 +228,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; @@ -290,6 +318,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); @@ -307,9 +336,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4A35C433FE for ; Mon, 24 Jan 2022 21:06:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353387AbiAXVGw (ORCPT ); Mon, 24 Jan 2022 16:06:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389805AbiAXUo2 (ORCPT ); Mon, 24 Jan 2022 15:44: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 32DD6C04188D; Mon, 24 Jan 2022 11:53: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 F0866B8121C; Mon, 24 Jan 2022 19:53:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FF11C340E5; Mon, 24 Jan 2022 19:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054031; bh=4bgj3UJ+SB6aSXL1iZwnfhSoYSwQqqjJV/7MYe/jTug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=euZWi1V72rC8Zseo9pslyURSmUUJS+etyGY7ujmDK+SIjbc3AjgGskhgyeDEP42cW C2oIgHfcZ0mEmf7TRtk/dzG3h24shMSfohSP+Wm/2ifRT46yAUdRCF1LLWW3AZPySx WW0CxrqiE2lt8AgKnQiEWR6DX8Gb5GQ7czZznTYM= 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.10 257/563] ALSA: oss: fix compile error when OSS_DEBUG is enabled Date: Mon, 24 Jan 2022 19:40:22 +0100 Message-Id: <20220124184033.306236446@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 77727a69c3c4e..d79febeebf0c5 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -2056,7 +2056,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4790DC433EF for ; Mon, 24 Jan 2022 20:12:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347604AbiAXUMY (ORCPT ); Mon, 24 Jan 2022 15:12:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41452 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358063AbiAXTx6 (ORCPT ); Mon, 24 Jan 2022 14:53: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 11214B8121C; Mon, 24 Jan 2022 19:53:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28A77C340E5; Mon, 24 Jan 2022 19:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054034; bh=1bb9Wix4RTwcEXFOmAXngaH3mepogma1vLiG3AebptE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=loeyF9ill8TJsll04WbbIZmeTVryDWx0KGNBbWL5Tx5nelHaYQUHcviuq1i6JruvX EBFUOICUle4CYMoYMvjbFqs1zCdeiu/jBsPfveWTCyfmFGTzviWRiD2KVKYw0rJhSD X/CWnwlPaQ6ErnAa7S3WIjhkzgyuLA+BG13wD1rk= 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.10 258/563] ALSA: usb-audio: Drop superfluous 0 in Presonus Studio 1810cs ID Date: Mon, 24 Jan 2022 19:40:23 +0100 Message-Id: <20220124184033.343663272@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 4693384db0695..e8a63ea2189d1 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -365,7 +365,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 8297117f4766e..86fdd669f3fd7 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c @@ -3033,7 +3033,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 75d4d317b34b6..6333a2ecb848a 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1310,7 +1310,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 226AAC433F5 for ; Mon, 24 Jan 2022 21:06:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443803AbiAXVGc (ORCPT ); Mon, 24 Jan 2022 16:06:32 -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 S1389821AbiAXUo3 (ORCPT ); Mon, 24 Jan 2022 15:44: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 4ED38C019B3B; Mon, 24 Jan 2022 11:54: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 0B80BB811F3; Mon, 24 Jan 2022 19:53:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A07FC340E5; Mon, 24 Jan 2022 19:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054037; bh=0KD1eiKFQZ+15lvlwGjcpA2CZ9608oocxiXbhgHw+rM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tSEiW+xc5XXiw6IDYHjSjbiap39Q6jkCZe6hRFdOGgd2BmRjC6tmyeJJ9ZHHssVwz dnMNZWZoiEj5VmhDSqVPvd6i0njJfBXtKVgkprM3FW8TaHRsahSwZpdRXdIKX1v0aO IqeoV+7d61GaQtnH6MRR58gaW5dVUcWQbQVOHtQU= 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.10 259/563] char/mwave: Adjust io port register size Date: Mon, 24 Jan 2022 19:40:24 +0100 Message-Id: <20220124184033.382939940@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87E97C433EF for ; Mon, 24 Jan 2022 20:14:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345564AbiAXUO2 (ORCPT ); Mon, 24 Jan 2022 15:14:28 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49486 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351643AbiAXTyC (ORCPT ); Mon, 24 Jan 2022 14:54: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 6B31960C2A; Mon, 24 Jan 2022 19:54:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CD0DC340E5; Mon, 24 Jan 2022 19:54:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054040; bh=IGbzNY6f3suY9s0u1XuNuzP2O/Pk4yXeeJ9hmyQGuew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vosSdu+ZxcDgBTvl+VDmu2OtgOZzzeXpARqks3g3uIR9z1xyKwqboQr5PFBVsETbi C+S2lI1ywzTNI9vUW6hUCmO/ItbE/D1aunJQKum3EgoRaLozdRgf4yCTSblS/XW0Dt huQFQf2yB7yRLYVHQzBbcX+lYOQPBj1/BDfKyzww= 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.10 260/563] binder: fix handling of error during copy Date: Mon, 24 Jan 2022 19:40:25 +0100 Message-Id: <20220124184033.421679754@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 80e2bbb36422e..366b124057081 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2657,8 +2657,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B5FAC433EF for ; Mon, 24 Jan 2022 20:14:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350039AbiAXUOa (ORCPT ); Mon, 24 Jan 2022 15:14:30 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51212 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241746AbiAXTyF (ORCPT ); Mon, 24 Jan 2022 14: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 dfw.source.kernel.org (Postfix) with ESMTPS id B467E60FD7; Mon, 24 Jan 2022 19:54:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61E58C340ED; Mon, 24 Jan 2022 19:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054044; bh=gW6W/LYDczWG1fyNSWXD+duzWRVrqeY6Pi0AavfNS5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bqLVHO1+U7ib/VREBGdguc3QkV2VSdwxc1ibIy6T+SWcGPC8vFfnoxfVrjM8VGZMe u/AILtFh4mbKTD/pRVVL5fG2p71GZJx1Z0T1maKSkK2ByhZMMCrD5k6303H7h6JmkI mw5//2OYMCXRy5t2ZWh0CDaQ87+owW9xW2NWBrqQ= 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.10 261/563] openrisc: Add clone3 ABI wrapper Date: Mon, 24 Jan 2022 19:40:26 +0100 Message-Id: <20220124184033.453050081@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 98e4f97db5159..b42d32d79b2e6 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D813BC433FE for ; Tue, 25 Jan 2022 00:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3408642AbiAYAXP (ORCPT ); Mon, 24 Jan 2022 19:23:15 -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 S2359447AbiAXXch (ORCPT ); Mon, 24 Jan 2022 18:32: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 33E63C0424C2; Mon, 24 Jan 2022 11:54: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 C6A3E6090A; Mon, 24 Jan 2022 19:54:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0FCAC340E5; Mon, 24 Jan 2022 19:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054047; bh=CrsAMLvUKyiVAjFDGVtOADoyn++mkZi/qdhbrG2tSOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mGdrSwR1a4KaOsshw5ZpOkNyVzhSrPNJ5CH1wQg9zrwecguvqW91mfFGNrvObS+w8 fXzOlruPkmUMeEHpUXyfwtjFIVBJwW+We+zN1e792r3QNGw5KhzZklRaRUVBjjafin BN9JmoiB1W+fdSHmGgrLFBPc5/HBIkXcZ1RnSh3s= 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.10 262/563] uio: uio_dmem_genirq: Catch the Exception Date: Mon, 24 Jan 2022 19:40:27 +0100 Message-Id: <20220124184033.490683244@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ec7f66f4555a6..bf39a424ea77d 100644 --- a/drivers/uio/uio_dmem_genirq.c +++ b/drivers/uio/uio_dmem_genirq.c @@ -183,7 +183,11 @@ static int uio_dmem_genirq_probe(struct platform_devic= e *pdev) goto bad0; } =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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB4E5C433F5 for ; Mon, 24 Jan 2022 20:12:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354827AbiAXUMm (ORCPT ); Mon, 24 Jan 2022 15:12:42 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40434 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351647AbiAXTyN (ORCPT ); Mon, 24 Jan 2022 14:54: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 868ABB810AF; Mon, 24 Jan 2022 19:54:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACBF2C340E5; Mon, 24 Jan 2022 19:54:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054050; bh=d07dzSUvA2+iSjIdp5m4YqSXELfzyQug44lKx6iS7Tw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XrQwhDlvh4mkF6gjGvCAp0rIqH1BhkTCtOHcCocjg0KmOlT90kP68YRkmj4MpF2DF Wmv5vnpTjCMQLKaGAtZEOn/lRbnRqgo8V3dqifLbGWiYto8TBRDHtFn37IFMCaLSgP TLdewOS4TE1eKbwqA/hphEcq6XHqoz0WoZkjBecI= 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.10 263/563] iommu/io-pgtable-arm: Fix table descriptor paddr formatting Date: Mon, 24 Jan 2022 19:40:28 +0100 Message-Id: <20220124184033.530803695@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 bcfbd0e44a4a0..e1cd31c0e3c19 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -302,11 +302,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 @@ -357,7 +358,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)) { @@ -546,7 +547,7 @@ static size_t arm_lpae_split_blk_unmap(struct arm_lpae_= io_pgtable *data, __arm_lpae_init_pte(data, blk_paddr, pte, lvl, &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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFBE4C433FE for ; Mon, 24 Jan 2022 20:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354820AbiAXUMp (ORCPT ); Mon, 24 Jan 2022 15:12:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41620 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351561AbiAXTyQ (ORCPT ); Mon, 24 Jan 2022 14:54: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 92AC6B811F3; Mon, 24 Jan 2022 19:54:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEA15C340E5; Mon, 24 Jan 2022 19:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054053; bh=gyHa6h3IF00eYz9MNCK5cW5GOUIyi5XlR9+BBKvvDCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P9K1DZFwnkduB+HUVLggpDXLwSx8SNOaLoryM/2YI7vHjiO97Cq8f1suFSynivM9v H8nlNYIh4VI/d+u9BsM33m7Nu0wofFr2pYliyFOWlmIMfhZ1ofCngGfVINQQh0MMO3 HNgUa3BtATgrt0TfVe4r5l02Uu/vOx9dmTnLoWhc= 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.10 264/563] scsi: ufs: Fix race conditions related to driver data Date: Mon, 24 Jan 2022 19:40:29 +0100 Message-Id: <20220124184033.562806838@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 67a6a61154b71..4e471484539d2 100644 --- a/drivers/scsi/ufs/tc-dwc-g210-pci.c +++ b/drivers/scsi/ufs/tc-dwc-g210-pci.c @@ -135,7 +135,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 fadd566025b86..4bf8ec88676ee 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -347,8 +347,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 8c92d1bde64be..e49505534d498 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -412,8 +412,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 e3a9a02cadf5a..bf302776340ce 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -9085,6 +9085,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7634C433EF for ; Mon, 24 Jan 2022 20:12:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343512AbiAXUMy (ORCPT ); Mon, 24 Jan 2022 15:12:54 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41656 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347076AbiAXTyT (ORCPT ); Mon, 24 Jan 2022 14:54: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 8DF6AB81239; Mon, 24 Jan 2022 19:54:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7F2AC340E5; Mon, 24 Jan 2022 19:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054056; bh=kQeVpgjXMWBkDkt3qPRgjWIZf9hgcZyZSnVYNAKMg0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N2ClNA0/MBMVsoksSHrWeCDzauK+90quhQU53DSnmEf2xikH/KOPN9rc7nMyKXdqn tlEozhIaNYUsINy8tUhFcvMBXMrxSKSIFn7n/zFWLSd9YzfBEGa0VLFlINwZGClz8i w/6vfNRZHsTTh+xRtMRSEqD19O8JUBrlE6tP2eVE= 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.10 265/563] RDMA/qedr: Fix reporting max_{send/recv}_wr attrs Date: Mon, 24 Jan 2022 19:40:30 +0100 Message-Id: <20220124184033.600036014@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 16d5283651894..eeb87f31cd252 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c @@ -1918,6 +1918,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, @@ -1928,6 +1929,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB83FC433F5 for ; Mon, 24 Jan 2022 21:08:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446343AbiAXVIB (ORCPT ); Mon, 24 Jan 2022 16:08:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390169AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 8C16CC0424C9; Mon, 24 Jan 2022 11: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 243316090A; Mon, 24 Jan 2022 19:54:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 092B1C340E5; Mon, 24 Jan 2022 19:54:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054062; bh=3/xGQscgkM8CssT8T+AIB1T7dP+Y+M/pd+KZ9tVxfUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VtHgAQgjvZdj2zGvRzb3yyknKnTDVIfVzVoj/RzouHwm1w6SblXUDiEPWOhzA1a0u O4Xh8XN4xkVr2YHJ8uACwDWs0jQeBYSYKNDmJEQe3+eqp2kfEHZFVe0btGpdNdi58Z gKQgZLwUORbxjuhK4nhWQlVIZ43mQN5dHG1Hse0Y= 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.10 266/563] PCI/MSI: Fix pci_irq_vector()/pci_irq_get_affinity() Date: Mon, 24 Jan 2022 19:40:31 +0100 Message-Id: <20220124184033.640624882@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 57314fec2261b..3da69b26e6743 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -1291,19 +1291,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; @@ -1327,17 +1332,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE3F9C433EF for ; Mon, 24 Jan 2022 20:13:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346585AbiAXUNO (ORCPT ); Mon, 24 Jan 2022 15:13:14 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51504 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358113AbiAXTyc (ORCPT ); Mon, 24 Jan 2022 14:54: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 34C066090B; Mon, 24 Jan 2022 19:54:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F33D0C340E5; Mon, 24 Jan 2022 19:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054065; bh=FaB0y9HIYPaqAi9q7owR1nZqkiO+ArzL+57wSpMcVoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mXN7gTpr8ERbD4+iZDnFD1CG8Hfd16PMQGyFb6f0QJt9N8Oc4gItIwdbvJ8tC73ZU qPhEmxzWqLpl36HrFUXL/Yc1unmMacmJ1RnzHGIKjksTeZefYzF8pkdE2aX/eARfs4 54HtAWaF8gdtGscg3p8tcbOcpWlYVkQGbCBep+lM= 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.10 267/563] powerpc/powermac: Add additional missing lockdep_register_key() Date: Mon, 24 Jan 2022 19:40:32 +0100 Message-Id: <20220124184033.680604443@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25C97C433F5 for ; Mon, 24 Jan 2022 20:13:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348499AbiAXUNS (ORCPT ); Mon, 24 Jan 2022 15:13:18 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51530 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358135AbiAXTyc (ORCPT ); Mon, 24 Jan 2022 14:54: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 31AD060B88; Mon, 24 Jan 2022 19:54:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F783C340E5; Mon, 24 Jan 2022 19:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054068; bh=trFRVxPpwQP5j5PpHCK0jByQ6eNg8p9rOMd216bDq5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DpKVVVd7h48U6EEB02P20CG4+cFiLyz4IomYwKjGffx0UI8Zbz1JAIlgQIpVMFcAE Tkxbs3CKYMRoWNL76O9sCkgwrgxceYzg7feUebOOSG8H2+2kFOIhfp5HZAxEDA15t3 4VyfAmpMlN55OeugKEyyYA5oNgd06bebwsCGQskY= 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.10 268/563] RDMA/core: Let ib_find_gid() continue search even after empty entry Date: Mon, 24 Jan 2022 19:40:33 +0100 Message-Id: <20220124184033.719964552@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 76b9c436edcd2..aa526c5ca0cf3 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2411,7 +2411,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 468B3C35272 for ; Mon, 24 Jan 2022 20:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378102AbiAXUOy (ORCPT ); Mon, 24 Jan 2022 15:14:54 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41764 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358158AbiAXTyg (ORCPT ); Mon, 24 Jan 2022 14: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 ams.source.kernel.org (Postfix) with ESMTPS id EA682B81229; Mon, 24 Jan 2022 19:54:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18552C340E7; Mon, 24 Jan 2022 19:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054071; bh=Zf2oU5zgQQMODYzgwGbMC19Oupb+AxdNmqbbKp+TCUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WD8Ki+t3wazPKsayV5p0ZbllDHSPGPEPJCe1biuDfRyfGCD9yLzWb/QwH1XogWoVR C1l6C6lDcWBZfkaaB3RO6Xzs6NI7NCt9lO/64gRAzMRiA82qlDPxsX2QxHz1xxajG2 jKZc5GVDyWPOTggvy2PxrnqPXYrc90gvqwHIjPxc= 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.10 269/563] RDMA/cma: Let cma_resolve_ib_dev() continue search even after empty entry Date: Mon, 24 Jan 2022 19:40:34 +0100 Message-Id: <20220124184033.749989711@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8e54184566f7f..4d4ba09f6cf93 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -775,6 +775,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; @@ -793,9 +794,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DE9DC433F5 for ; Mon, 24 Jan 2022 20:13:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345232AbiAXUNZ (ORCPT ); Mon, 24 Jan 2022 15:13:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41808 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358203AbiAXTyh (ORCPT ); Mon, 24 Jan 2022 14:54: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 17573B8119E; Mon, 24 Jan 2022 19:54:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32CCEC340E5; Mon, 24 Jan 2022 19:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054074; bh=G4y5VaQLlX2WmLR6x7NApiSBbmoSG7zgYqheBLtIcBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aCKrANjmUXBJHpWyL/e4niW06wJ1YM+2vr4+eWQjE+oRSzKhKqMWg6TZLzRqSzVsb sof5zFO+jeMMvqJvB/7kmD2HsBbYJeN71tsx5ofhcOx7kuWAjFCM2k3sysKsCDO4Lq b4Hee3yrnaiXBsb3GdJvxahBhqSCuzZnzOuJ7dE8= 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.10 270/563] ASoC: rt5663: Handle device_property_read_u32_array error codes Date: Mon, 24 Jan 2022 19:40:35 +0100 Message-Id: <20220124184033.781895504@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 619fb9a031e39..db8a41aaa3859 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49D41C433F5 for ; Mon, 24 Jan 2022 20:13:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355353AbiAXUNa (ORCPT ); Mon, 24 Jan 2022 15:13:30 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41822 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358225AbiAXTyk (ORCPT ); Mon, 24 Jan 2022 14:54: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 43F73B81215; Mon, 24 Jan 2022 19:54:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FEA2C340E5; Mon, 24 Jan 2022 19:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054078; bh=bW+bF1ExHsREagpkrACN8lVvle3DblM3ngq6eFFY7eA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gi36GAea6uoH4P9ztcU39Y9vduda6PurWerRvi1wzDJ9DTfAVRkOW7srWbsFUJdEP XT6faO1bcDaUE+eTdOqr5Zt/yPbNfnekdlu3IG2Ezh3nm2er/XiTtPe3us8F08H7/Q eO2kGHsSKpeXlORFQA+pvYFE9zjzF72hvybSfejk= 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.10 271/563] of: unittest: fix warning on PowerPC frame size warning Date: Mon, 24 Jan 2022 19:40:36 +0100 Message-Id: <20220124184033.811895623@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 1d4b0b7d0cc10..a5c4c77b6f3e2 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -910,11 +910,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", @@ -924,6 +931,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A81D1C43219 for ; Mon, 24 Jan 2022 21:13:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447865AbiAXVLf (ORCPT ); Mon, 24 Jan 2022 16:11:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390172AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 159FEC0617BD; Mon, 24 Jan 2022 11:54: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 AAC876090A; Mon, 24 Jan 2022 19:54:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F42BC340E5; Mon, 24 Jan 2022 19:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054081; bh=Kdgl4eAeB8QZQJOvxda19BG6ULeDMmWdoInfnJAQYOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T5DSkxv14Dv/vA6fKbRnHS8g8fsNiYVQL05IAbrSSa+vdSK6wm/Jtr/2J07FO2zjo N2kJtpbtIBTKrB2AzKfwMz9Mss23SRXt6i7FmJG7haWma/lhRprF+4Xj6rYKQmQasr +Klvnf+fHpUZYbFraVqvlsCpSAE0ZSTGvf7VX+NU= 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.10 272/563] of: unittest: 64 bit dma address test requires arch support Date: Mon, 24 Jan 2022 19:40:37 +0100 Message-Id: <20220124184033.844760247@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a5c4c77b6f3e2..5407bbdb64395 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -941,8 +941,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14DF2C43219 for ; Mon, 24 Jan 2022 20:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379813AbiAXUPF (ORCPT ); Mon, 24 Jan 2022 15:15:05 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41894 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358277AbiAXTyr (ORCPT ); Mon, 24 Jan 2022 14:54: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 57CCBB8122F; Mon, 24 Jan 2022 19:54:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FE7FC340E5; Mon, 24 Jan 2022 19:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054084; bh=PlU0BGXYhEPw+yxn5LNeHuz6RZoUF0+GF9AQ5NrEnq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bc61rIyCtgE3Y3eb6rGqotXfZlMgN3OoG09ENsVc7Xz/ljcUaCGxTlwJ63xN/f9ej WEshwVCJrLUUhBYdG1h99t24jGGbmI3/FlD/MqGiFxTiJQ12anqOWBVWylORbSPCAJ hZ1vQhHdoF6tf4nHyhMdDYgXbFFFTznulXEor6us= 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.10 273/563] clk: stm32: Fix ltdcs clock turn off by clk_disable_unused() after system enter shell Date: Mon, 24 Jan 2022 19:40:38 +0100 Message-Id: <20220124184033.880776185@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 5c75e3d906c20..682a18b392f08 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88FD7C46467 for ; Mon, 24 Jan 2022 21:13:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448044AbiAXVLz (ORCPT ); Mon, 24 Jan 2022 16:11:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390180AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 F0351C0617BE; Mon, 24 Jan 2022 11:54: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 9095461012; Mon, 24 Jan 2022 19:54:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71D7AC340E5; Mon, 24 Jan 2022 19:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054087; bh=xQDm7FZPXcXZlrZTnKkz6kxd0O0POjHE1l9GdUOFf8Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZsHhuGoZqcsWkJRtw6P+BOIGo4cCJSHuxwLx/npvS4z2xH02Jt1OJ+fZQ853VXALa OBx3MxDFdVL9KAFODtW2MXjGpq9BM+fvzE/maNLN0C5khxFI2JLg6jklVTjNpVgoGr F1dkJQ6UV8EzRyNUnAcJzJ5L6UvJbLhvL4uvVzR8= 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.10 274/563] mips: add SYS_HAS_CPU_MIPS64_R5 config for MIPS Release 5 support Date: Mon, 24 Jan 2022 19:40:39 +0100 Message-Id: <20220124184033.921285032@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- arch/mips/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 23d756fe0fd6c..db8fe5d7a2377 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -1985,6 +1985,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 968A0C4332F for ; Mon, 24 Jan 2022 21:13:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447839AbiAXVLd (ORCPT ); Mon, 24 Jan 2022 16:11:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390184AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 8DD76C061381; Mon, 24 Jan 2022 11:54: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 2C6CD61012; Mon, 24 Jan 2022 19:54:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82AE6C340E5; Mon, 24 Jan 2022 19:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054090; bh=6j0VPUnXttJfHiteE5SxThT+4Mz+16P0Y0QVdGbg2/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y2RpqiQnpMLiWlVt3opMIG63jgQtApxmGOwApqSbp6SkeWEr95vxgV2bwTC6o/RKg piawuthXqJXp2NrIcVfL0nYTYP9RaMRRPn9qIORHCS3tC61YqZOCDNSTQDj9hmyZQB G+7gct8lGddLL8Cee3eBP60w2Elfw7+h/W9CAGrg= 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.10 275/563] mips: fix Kconfig reference to PHYS_ADDR_T_64BIT Date: Mon, 24 Jan 2022 19:40:40 +0100 Message-Id: <20220124184033.951928346@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- arch/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index db8fe5d7a2377..3442bdd4314cb 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2150,7 +2150,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 default y if 64BIT && (CPU_MIPSR2 || CPU_MIPSR6) && !CPU_XLP --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4B2EC43217 for ; Mon, 24 Jan 2022 20:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379248AbiAXUO5 (ORCPT ); Mon, 24 Jan 2022 15:14:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41972 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358344AbiAXTy7 (ORCPT ); Mon, 24 Jan 2022 14:54: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 075A4B8123A; Mon, 24 Jan 2022 19:54:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36963C340E5; Mon, 24 Jan 2022 19:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054096; bh=lNSuvqnoauz/uGYK36agIlf1ZmxRGgCihca25HQzVt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cmnifa937lJ/Jt28iTecV3Xi1GPwP1o8rdbNTZmu+1s5e25zx1boqxkrVKjV0WZtv ernBBSser6wLsPvelwhR5BD3Y47GzvCXKJgmy2KTM0bNTC3+4OA/s7LhHz1K39ivfL oCpqk4waHe8/2aSaJiaFiBbtI9ZW4JqCTwY4PWZc= 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.10 276/563] dmaengine: pxa/mmp: stop referencing config->slave_id Date: Mon, 24 Jan 2022 19:40:41 +0100 Message-Id: <20220124184033.985754932@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 b84303be8edf5..4eb63f1ad2247 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c @@ -728,12 +728,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 349fb312c8725..b4ef4f19f7dec 100644 --- a/drivers/dma/pxa_dma.c +++ b/drivers/dma/pxa_dma.c @@ -911,13 +911,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D84FC433EF for ; Mon, 24 Jan 2022 21:07:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354482AbiAXVHh (ORCPT ); Mon, 24 Jan 2022 16:07:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390178AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 B8279C06138E; Mon, 24 Jan 2022 11:55: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 55BE760989; Mon, 24 Jan 2022 19:55:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E2E1C340E5; Mon, 24 Jan 2022 19:54:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054099; bh=KuJpflFQSegupwZxZ5OZ91OVC0jVZr/s65fvB8KorQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h7GZumRpUpyLpt2s41trLYGjETyB9EgLCI+rfyjH75caoZ+aBebafAGx/atOjhV9l 8sMR4cX6JmrtufxPMiwYyIHhoCaEQEk8ur9gu48POdt5LoTa63T2dA7pjxSmrV8+3V Avizt1S9yP+i0EyL4X+P+49jBRh/FerUKA4jr7tg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suravee Suthikulpanit , Joerg Roedel , Sasha Levin Subject: [PATCH 5.10 277/563] iommu/amd: Remove iommu_init_ga() Date: Mon, 24 Jan 2022 19:40:42 +0100 Message-Id: <20220124184034.018563907@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Suravee Suthikulpanit [ Upstream commit eb03f2d2f6a4da25d286613717d10add9ce9f175 ] Since the function has been simplified and only call iommu_init_ga_log(), remove the function and replace with iommu_init_ga_log() instead. Signed-off-by: Suravee Suthikulpanit Link: https://lore.kernel.org/r/20210820202957.187572-4-suravee.suthikulpan= it@amd.com Fixes: 8bda0cfbdc1a ("iommu/amd: Detect and initialize guest vAPIC log") Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/iommu/amd/init.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 28de889aa5164..c82f8ab4783c0 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -830,9 +830,9 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu) return 0; } =20 -#ifdef CONFIG_IRQ_REMAP static int iommu_init_ga_log(struct amd_iommu *iommu) { +#ifdef CONFIG_IRQ_REMAP u64 entry; =20 if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir)) @@ -862,18 +862,9 @@ static int iommu_init_ga_log(struct amd_iommu *iommu) err_out: free_ga_log(iommu); return -EINVAL; -} -#endif /* CONFIG_IRQ_REMAP */ - -static int iommu_init_ga(struct amd_iommu *iommu) -{ - int ret =3D 0; - -#ifdef CONFIG_IRQ_REMAP - ret =3D iommu_init_ga_log(iommu); +#else + return 0; #endif /* CONFIG_IRQ_REMAP */ - - return ret; } =20 static int __init alloc_cwwb_sem(struct amd_iommu *iommu) @@ -1860,7 +1851,7 @@ static int __init iommu_init_pci(struct amd_iommu *io= mmu) if (iommu_feature(iommu, FEATURE_PPR) && alloc_ppr_log(iommu)) return -ENOMEM; =20 - ret =3D iommu_init_ga(iommu); + ret =3D iommu_init_ga_log(iommu); if (ret) return ret; =20 --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D83DBC46467 for ; Mon, 24 Jan 2022 20:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380124AbiAXUPm (ORCPT ); Mon, 24 Jan 2022 15:15:42 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42022 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358383AbiAXTzF (ORCPT ); Mon, 24 Jan 2022 14:55: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 19B5AB8121A; Mon, 24 Jan 2022 19:55:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 406E1C340E8; Mon, 24 Jan 2022 19:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054102; bh=FefeJGsmeNMUxg0X1ZZOUXPj77eqdLaMeq6xYH64748=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JHp0tFJOEBM3/RboI3dqOTOZ7hmS9/BGJ4SkKRaYL1xR45xu1z0mEmbV1qlr4LXiL GdRew3WpuEI5vnTCDkcbb7ciCN1QtsFswjKKezeXWvf/hMQNFRSQ5WvI2rB3Vdx/Br 5kMBCOS0h5DcNbUCcDd02B4seHfOJ5LmUS8RDeQs= 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.10 278/563] iommu/amd: Restore GA log/tail pointer on host resume Date: Mon, 24 Jan 2022 19:40:43 +0100 Message-Id: <20220124184034.055626385@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 c82f8ab4783c0..3f31a52f7044f 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -805,16 +805,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 @@ -824,7 +835,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; @@ -833,8 +844,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 @@ -848,16 +857,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26850C4167B for ; Mon, 24 Jan 2022 20:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379834AbiAXUPK (ORCPT ); Mon, 24 Jan 2022 15:15:10 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42050 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358395AbiAXTzI (ORCPT ); Mon, 24 Jan 2022 14:55: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 32386B8124B; Mon, 24 Jan 2022 19:55:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54190C340E5; Mon, 24 Jan 2022 19:55:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054105; bh=u6wn5hvtFVt0BP/ZgDwafgBXxb/0euiS2/J+gFOmtrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T2TAwvXlYHz3db0xdqsq2mEuNccd2WOPph+pAhtaxM8StXhrKE3CW+02gOc/dWuX/ Me5FMiAfhwB11v5A0dB4bCOHxJB/TYjCBZ17chH7qGgJFEYru9CJtgBqPyAwmMcSIE RhU3sykJ8SbRFWdZixvIEOJ3vG0CDNuQisCjME0M= 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.10 279/563] ASoC: Intel: catpt: Test dmaengine_submit() result before moving on Date: Mon, 24 Jan 2022 19:40:44 +0100 Message-Id: <20220124184034.086005621@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 9e807b9417321..38a92bbc1ed56 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A6C8C4321E for ; Mon, 24 Jan 2022 20:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379872AbiAXUPN (ORCPT ); Mon, 24 Jan 2022 15:15:13 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42064 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358435AbiAXTzM (ORCPT ); Mon, 24 Jan 2022 14:55: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 1DE37B81247; Mon, 24 Jan 2022 19:55:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CAEDC340E5; Mon, 24 Jan 2022 19:55:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054108; bh=hAIdkZCY+ok1pRLnYWR59O3Yuc/U9rnIQHy6AiirbO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WgeS+0lOjHJ7ZDCfavc7duewwlnkbT2xUyWwKJDvZPEatUayu4UezJm+hivaHHjo5 Tz+r6FZ72EwgDxoDVUHOhukNMK6lx+/XfK5iczRVXpf13mX1jw0O2xaxn5s8kDjhPU 1m4fJCtDRuc5zWaBjQOpl2i/9TOv7hoVR2hPWHZ4= 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.10 280/563] iommu/iova: Fix race between FQ timeout and teardown Date: Mon, 24 Jan 2022 19:40:45 +0100 Message-Id: <20220124184034.126466350@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 30d969a4c5fde..1164d1a42cbc5 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c @@ -64,8 +64,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59548C47082 for ; Mon, 24 Jan 2022 20:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379933AbiAXUPT (ORCPT ); Mon, 24 Jan 2022 15:15:19 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42094 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358442AbiAXTzO (ORCPT ); Mon, 24 Jan 2022 14:55: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 75341B811FB; Mon, 24 Jan 2022 19:55:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CC3FC340E5; Mon, 24 Jan 2022 19:55:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054112; bh=9OYIhp4tcNcPNdnDiXHPbH5wBCGJndxbPgN1unI9o3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nygkoRjbjeinuWg3fuba3ch9mudvbRLMwhMgkeAGVIi3+tCMg5UXUOEZjlUKaGgWL REGkDUlGEzlN7kYCbihFpIKrf2sBE7aVbW5UAnL/LAUJUGxZLg3y6Pvnbcpc1OV1DO a7mlxvLSsn9G5GPvMq/W7YrhXalltLAk8+POro28= 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.10 281/563] scsi: block: pm: Always set request queue runtime active in blk_post_runtime_resume() Date: Mon, 24 Jan 2022 19:40:46 +0100 Message-Id: <20220124184034.158011166@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 3717eea37ecb3..e91a0a5bc7a3e 100644 --- a/drivers/scsi/scsi_pm.c +++ b/drivers/scsi/scsi_pm.c @@ -262,7 +262,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4A05C433F5 for ; Mon, 24 Jan 2022 20:29:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383210AbiAXU05 (ORCPT ); Mon, 24 Jan 2022 15:26:57 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53818 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237207AbiAXT5Z (ORCPT ); Mon, 24 Jan 2022 14: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 dfw.source.kernel.org (Postfix) with ESMTPS id 96F0D6090B; Mon, 24 Jan 2022 19:57:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 544F9C33DA0; Mon, 24 Jan 2022 19:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054244; bh=eBtV3ryZiXUZattGsksT7BmwOVTZlzKcXHsLCTSvJcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g6ooYM8B7/jCwc5C68VkebOO6p5py7J74ct8cqZhIwD7aOV0Fn2WPA3zTHpb5M5hf rn6zqB3I53jnwDSP8NM3CaLtuVxCHIaTYlK8SoOKFuI5CGLPK6NzK7WooeW+cxlwOP a+Fbpkqu4I37TuQ49Dh3pgbfXDnHJyagtdmNJuF8= 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.10 282/563] phy: uniphier-usb3ss: fix unintended writing zeros to PHY register Date: Mon, 24 Jan 2022 19:40:47 +0100 Message-Id: <20220124184034.194066983@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7149EC433EF for ; Mon, 24 Jan 2022 21:13:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447788AbiAXVL2 (ORCPT ); Mon, 24 Jan 2022 16:11:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390230AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 1C7C9C061396; Mon, 24 Jan 2022 11:55: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 B030360B02; Mon, 24 Jan 2022 19:55:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 802DDC340E5; Mon, 24 Jan 2022 19:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054137; bh=4F+FoEJCjA5dc535C82+wg9z4q7LEbCQMztv5Eb7YX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iiYS0Py4XIQ08NX6b06t6PjXLOta0vw5ZKxO3vMlJVxpLul4RW080D9WyHhGztAkJ thAeRo3TxksxPMWMaD6jYLgAeDfYCGshn6EAySpQixgLh/5jVE6RrgADugovL4oDn+ 5fGmrFycEHbF4R6YccfMJbo32FCZ/l7wEndM6N3w= 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.10 283/563] ASoC: mediatek: Check for error clk pointer Date: Mon, 24 Jan 2022 19:40:48 +0100 Message-Id: <20220124184034.226566770@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA774C35271 for ; Mon, 24 Jan 2022 21:13:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447531AbiAXVK5 (ORCPT ); Mon, 24 Jan 2022 16:10:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390867AbiAXUqc (ORCPT ); Mon, 24 Jan 2022 15: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 DF0F5C061244; Mon, 24 Jan 2022 11:56: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 7E4EB60B43; Mon, 24 Jan 2022 19:56:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66F35C340E5; Mon, 24 Jan 2022 19:56:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054170; bh=IRR7woKXRTUuwAj7dh3xDIZETJ6KdYf3GLSVPriOUYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fVZeWNshHySh1DNIoc05/y28TTllg9aMlUPyRE5x86vXyzucn7od5FEFfZoBmK/RG hPsGsIuAdJWizJUoG5SHlKxI2luKox09MKeuvu1heWy9x+ahAmfPR0K/cUfH+xdSR7 pumckHYWnHF1QgNpuUpWoOVPb2IZUjc8K/Gcic38= 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.10 284/563] ASoC: samsung: idma: Check of ioremap return value Date: Mon, 24 Jan 2022 19:40:49 +0100 Message-Id: <20220124184034.264010475@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A84FC35280 for ; Mon, 24 Jan 2022 21:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447506AbiAXVKy (ORCPT ); Mon, 24 Jan 2022 16:10:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390880AbiAXUqc (ORCPT ); Mon, 24 Jan 2022 15: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 6A4AAC06127F; Mon, 24 Jan 2022 11:56: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 DA3B960B88; Mon, 24 Jan 2022 19:56:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7D4AC340E5; Mon, 24 Jan 2022 19:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054204; bh=2ar6FmBe3ohWlaAPy0642av0NyegdVTMSJANRqfjvP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KrOTO8TMuF3DMTJE9hSEkh4K10KKFLXJotwSXxVFUSPI169/CoptT3i3opKR1W9Qq a+WjXKZPixiXduAI3VgvmEQyyP+jyZ3tXb2ytgMw1cEdxT8hde5ssEPA/rRR0dhKix ie850lfxa8kr/n58JuFNjyEbtcJOc117E5SbR70Y= 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.10 285/563] misc: lattice-ecp3-config: Fix task hung when firmware load failed Date: Mon, 24 Jan 2022 19:40:50 +0100 Message-Id: <20220124184034.303060075@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 5eaf74447ca1e..556bb7d705f53 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 531C2C43217 for ; Mon, 24 Jan 2022 20:29:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383433AbiAXU1P (ORCPT ); Mon, 24 Jan 2022 15:27:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42022 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352065AbiAXT5I (ORCPT ); Mon, 24 Jan 2022 14:57: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 A45C2B81250; Mon, 24 Jan 2022 19:57:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB5FCC36AF8; Mon, 24 Jan 2022 19:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054225; bh=VZmVXt/UEJu0JrykiqxVGJCDpMEGYho1Ci9uJsaNUT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dmUdwV/fh7FRY8SIHKMp90u9EqYgtEHu76mVeSk2oHww1CC3Fm30+QjVzidTk7wmM R82WO07hQ9o5uUqTkjMUnrRzWs1kjAmSkTy4z3ltHAsyGFFqPlw1TVeRJE4Ltjm9fO W41ZTb9XNHuMref3oSqOj9JzK0e6CoULoePbl7ZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, William Breathitt Gray , Fabrice Gasnier , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.10 286/563] counter: stm32-lptimer-cnt: remove iio counter abi Date: Mon, 24 Jan 2022 19:40:51 +0100 Message-Id: <20220124184034.341913688@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabrice Gasnier [ Upstream commit 01f68f067dc39df9c9d95d759ee61517eb4b0fcf ] Currently, the STM32 LP Timer counter driver registers into both IIO and counter subsystems, which is redundant. Remove the IIO counter ABI and IIO registration from the STM32 LP Timer counter driver since it's been superseded by the Counter subsystem as discussed in [1]. Keep only the counter subsystem related part. Move a part of the ABI documentation into a driver comment. This also removes a duplicate ABI warning $ scripts/get_abi.pl validate ... /sys/bus/iio/devices/iio:deviceX/in_count0_preset is defined 2 times: ./Documentation/ABI/testing/sysfs-bus-iio-timer-stm32:100 ./Documentation/ABI/testing/sysfs-bus-iio-lptimer-stm32:0 [1] https://lkml.org/lkml/2021/1/19/347 Acked-by: William Breathitt Gray Signed-off-by: Fabrice Gasnier Link: https://lore.kernel.org/r/1611926542-2490-1-git-send-email-fabrice.ga= snier@foss.st.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../ABI/testing/sysfs-bus-iio-lptimer-stm32 | 62 ---- drivers/counter/Kconfig | 2 +- drivers/counter/stm32-lptimer-cnt.c | 297 +++--------------- 3 files changed, 37 insertions(+), 324 deletions(-) delete mode 100644 Documentation/ABI/testing/sysfs-bus-iio-lptimer-stm32 diff --git a/Documentation/ABI/testing/sysfs-bus-iio-lptimer-stm32 b/Docume= ntation/ABI/testing/sysfs-bus-iio-lptimer-stm32 deleted file mode 100644 index 73498ff666bd7..0000000000000 --- a/Documentation/ABI/testing/sysfs-bus-iio-lptimer-stm32 +++ /dev/null @@ -1,62 +0,0 @@ -What: /sys/bus/iio/devices/iio:deviceX/in_count0_preset -KernelVersion: 4.13 -Contact: fabrice.gasnier@st.com -Description: - Reading returns the current preset value. Writing sets the - preset value. Encoder counts continuously from 0 to preset - value, depending on direction (up/down). - -What: /sys/bus/iio/devices/iio:deviceX/in_count_quadrature_mode_available -KernelVersion: 4.13 -Contact: fabrice.gasnier@st.com -Description: - Reading returns the list possible quadrature modes. - -What: /sys/bus/iio/devices/iio:deviceX/in_count0_quadrature_mode -KernelVersion: 4.13 -Contact: fabrice.gasnier@st.com -Description: - Configure the device counter quadrature modes: - - - non-quadrature: - Encoder IN1 input servers as the count input (up - direction). - - - quadrature: - Encoder IN1 and IN2 inputs are mixed to get direction - and count. - -What: /sys/bus/iio/devices/iio:deviceX/in_count_polarity_available -KernelVersion: 4.13 -Contact: fabrice.gasnier@st.com -Description: - Reading returns the list possible active edges. - -What: /sys/bus/iio/devices/iio:deviceX/in_count0_polarity -KernelVersion: 4.13 -Contact: fabrice.gasnier@st.com -Description: - Configure the device encoder/counter active edge: - - - rising-edge - - falling-edge - - both-edges - - In non-quadrature mode, device counts up on active edge. - - In quadrature mode, encoder counting scenarios are as follows: - - +---------+----------+--------------------+--------------------+ - | Active | Level on | IN1 signal | IN2 signal | - | edge | opposite +----------+---------+----------+---------+ - | | signal | Rising | Falling | Rising | Falling | - +---------+----------+----------+---------+----------+---------+ - | Rising | High -> | Down | - | Up | - | - | edge | Low -> | Up | - | Down | - | - +---------+----------+----------+---------+----------+---------+ - | Falling | High -> | - | Up | - | Down | - | edge | Low -> | - | Down | - | Up | - +---------+----------+----------+---------+----------+---------+ - | Both | High -> | Down | Up | Up | Down | - | edges | Low -> | Up | Down | Down | Up | - +---------+----------+----------+---------+----------+---------+ diff --git a/drivers/counter/Kconfig b/drivers/counter/Kconfig index 2de53ab0dd252..cbdf84200e278 100644 --- a/drivers/counter/Kconfig +++ b/drivers/counter/Kconfig @@ -41,7 +41,7 @@ config STM32_TIMER_CNT =20 config STM32_LPTIMER_CNT tristate "STM32 LP Timer encoder counter driver" - depends on (MFD_STM32_LPTIMER || COMPILE_TEST) && IIO + depends on MFD_STM32_LPTIMER || COMPILE_TEST help Select this option to enable STM32 Low-Power Timer quadrature encoder and counter driver. diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lp= timer-cnt.c index fd6828e2d34f5..937439635d53f 100644 --- a/drivers/counter/stm32-lptimer-cnt.c +++ b/drivers/counter/stm32-lptimer-cnt.c @@ -12,8 +12,8 @@ =20 #include #include -#include #include +#include #include #include #include @@ -107,249 +107,27 @@ static int stm32_lptim_setup(struct stm32_lptim_cnt = *priv, int enable) return regmap_update_bits(priv->regmap, STM32_LPTIM_CFGR, mask, val); } =20 -static int stm32_lptim_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int val, int val2, long mask) -{ - struct stm32_lptim_cnt *priv =3D iio_priv(indio_dev); - int ret; - - switch (mask) { - case IIO_CHAN_INFO_ENABLE: - if (val < 0 || val > 1) - return -EINVAL; - - /* Check nobody uses the timer, or already disabled/enabled */ - ret =3D stm32_lptim_is_enabled(priv); - if ((ret < 0) || (!ret && !val)) - return ret; - if (val && ret) - return -EBUSY; - - ret =3D stm32_lptim_setup(priv, val); - if (ret) - return ret; - return stm32_lptim_set_enable_state(priv, val); - - default: - return -EINVAL; - } -} - -static int stm32_lptim_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int *val, int *val2, long mask) -{ - struct stm32_lptim_cnt *priv =3D iio_priv(indio_dev); - u32 dat; - int ret; - - switch (mask) { - case IIO_CHAN_INFO_RAW: - ret =3D regmap_read(priv->regmap, STM32_LPTIM_CNT, &dat); - if (ret) - return ret; - *val =3D dat; - return IIO_VAL_INT; - - case IIO_CHAN_INFO_ENABLE: - ret =3D stm32_lptim_is_enabled(priv); - if (ret < 0) - return ret; - *val =3D ret; - return IIO_VAL_INT; - - case IIO_CHAN_INFO_SCALE: - /* Non-quadrature mode: scale =3D 1 */ - *val =3D 1; - *val2 =3D 0; - if (priv->quadrature_mode) { - /* - * Quadrature encoder mode: - * - both edges, quarter cycle, scale is 0.25 - * - either rising/falling edge scale is 0.5 - */ - if (priv->polarity > 1) - *val2 =3D 2; - else - *val2 =3D 1; - } - return IIO_VAL_FRACTIONAL_LOG2; - - default: - return -EINVAL; - } -} - -static const struct iio_info stm32_lptim_cnt_iio_info =3D { - .read_raw =3D stm32_lptim_read_raw, - .write_raw =3D stm32_lptim_write_raw, -}; - -static const char *const stm32_lptim_quadrature_modes[] =3D { - "non-quadrature", - "quadrature", -}; - -static int stm32_lptim_get_quadrature_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan) -{ - struct stm32_lptim_cnt *priv =3D iio_priv(indio_dev); - - return priv->quadrature_mode; -} - -static int stm32_lptim_set_quadrature_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan, - unsigned int type) -{ - struct stm32_lptim_cnt *priv =3D iio_priv(indio_dev); - - if (stm32_lptim_is_enabled(priv)) - return -EBUSY; - - priv->quadrature_mode =3D type; - - return 0; -} - -static const struct iio_enum stm32_lptim_quadrature_mode_en =3D { - .items =3D stm32_lptim_quadrature_modes, - .num_items =3D ARRAY_SIZE(stm32_lptim_quadrature_modes), - .get =3D stm32_lptim_get_quadrature_mode, - .set =3D stm32_lptim_set_quadrature_mode, -}; - -static const char * const stm32_lptim_cnt_polarity[] =3D { - "rising-edge", "falling-edge", "both-edges", -}; - -static int stm32_lptim_cnt_get_polarity(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan) -{ - struct stm32_lptim_cnt *priv =3D iio_priv(indio_dev); - - return priv->polarity; -} - -static int stm32_lptim_cnt_set_polarity(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan, - unsigned int type) -{ - struct stm32_lptim_cnt *priv =3D iio_priv(indio_dev); - - if (stm32_lptim_is_enabled(priv)) - return -EBUSY; - - priv->polarity =3D type; - - return 0; -} - -static const struct iio_enum stm32_lptim_cnt_polarity_en =3D { - .items =3D stm32_lptim_cnt_polarity, - .num_items =3D ARRAY_SIZE(stm32_lptim_cnt_polarity), - .get =3D stm32_lptim_cnt_get_polarity, - .set =3D stm32_lptim_cnt_set_polarity, -}; - -static ssize_t stm32_lptim_cnt_get_ceiling(struct stm32_lptim_cnt *priv, - char *buf) -{ - return snprintf(buf, PAGE_SIZE, "%u\n", priv->ceiling); -} - -static ssize_t stm32_lptim_cnt_set_ceiling(struct stm32_lptim_cnt *priv, - const char *buf, size_t len) -{ - int ret; - - if (stm32_lptim_is_enabled(priv)) - return -EBUSY; - - ret =3D kstrtouint(buf, 0, &priv->ceiling); - if (ret) - return ret; - - if (priv->ceiling > STM32_LPTIM_MAX_ARR) - return -EINVAL; - - return len; -} - -static ssize_t stm32_lptim_cnt_get_preset_iio(struct iio_dev *indio_dev, - uintptr_t private, - const struct iio_chan_spec *chan, - char *buf) -{ - struct stm32_lptim_cnt *priv =3D iio_priv(indio_dev); - - return stm32_lptim_cnt_get_ceiling(priv, buf); -} - -static ssize_t stm32_lptim_cnt_set_preset_iio(struct iio_dev *indio_dev, - uintptr_t private, - const struct iio_chan_spec *chan, - const char *buf, size_t len) -{ - struct stm32_lptim_cnt *priv =3D iio_priv(indio_dev); - - return stm32_lptim_cnt_set_ceiling(priv, buf, len); -} - -/* LP timer with encoder */ -static const struct iio_chan_spec_ext_info stm32_lptim_enc_ext_info[] =3D { - { - .name =3D "preset", - .shared =3D IIO_SEPARATE, - .read =3D stm32_lptim_cnt_get_preset_iio, - .write =3D stm32_lptim_cnt_set_preset_iio, - }, - IIO_ENUM("polarity", IIO_SEPARATE, &stm32_lptim_cnt_polarity_en), - IIO_ENUM_AVAILABLE("polarity", &stm32_lptim_cnt_polarity_en), - IIO_ENUM("quadrature_mode", IIO_SEPARATE, - &stm32_lptim_quadrature_mode_en), - IIO_ENUM_AVAILABLE("quadrature_mode", &stm32_lptim_quadrature_mode_en), - {} -}; - -static const struct iio_chan_spec stm32_lptim_enc_channels =3D { - .type =3D IIO_COUNT, - .channel =3D 0, - .info_mask_separate =3D BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_ENABLE) | - BIT(IIO_CHAN_INFO_SCALE), - .ext_info =3D stm32_lptim_enc_ext_info, - .indexed =3D 1, -}; - -/* LP timer without encoder (counter only) */ -static const struct iio_chan_spec_ext_info stm32_lptim_cnt_ext_info[] =3D { - { - .name =3D "preset", - .shared =3D IIO_SEPARATE, - .read =3D stm32_lptim_cnt_get_preset_iio, - .write =3D stm32_lptim_cnt_set_preset_iio, - }, - IIO_ENUM("polarity", IIO_SEPARATE, &stm32_lptim_cnt_polarity_en), - IIO_ENUM_AVAILABLE("polarity", &stm32_lptim_cnt_polarity_en), - {} -}; - -static const struct iio_chan_spec stm32_lptim_cnt_channels =3D { - .type =3D IIO_COUNT, - .channel =3D 0, - .info_mask_separate =3D BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_ENABLE) | - BIT(IIO_CHAN_INFO_SCALE), - .ext_info =3D stm32_lptim_cnt_ext_info, - .indexed =3D 1, -}; - /** * enum stm32_lptim_cnt_function - enumerates LPTimer counter & encoder mo= des * @STM32_LPTIM_COUNTER_INCREASE: up count on IN1 rising, falling or both = edges * @STM32_LPTIM_ENCODER_BOTH_EDGE: count on both edges (IN1 & IN2 quadratu= re) + * + * In non-quadrature mode, device counts up on active edge. + * In quadrature mode, encoder counting scenarios are as follows: + * +---------+----------+--------------------+--------------------+ + * | Active | Level on | IN1 signal | IN2 signal | + * | edge | opposite +----------+---------+----------+---------+ + * | | signal | Rising | Falling | Rising | Falling | + * +---------+----------+----------+---------+----------+---------+ + * | Rising | High -> | Down | - | Up | - | + * | edge | Low -> | Up | - | Down | - | + * +---------+----------+----------+---------+----------+---------+ + * | Falling | High -> | - | Up | - | Down | + * | edge | Low -> | - | Down | - | Up | + * +---------+----------+----------+---------+----------+---------+ + * | Both | High -> | Down | Up | Up | Down | + * | edges | Low -> | Up | Down | Down | Up | + * +---------+----------+----------+---------+----------+---------+ */ enum stm32_lptim_cnt_function { STM32_LPTIM_COUNTER_INCREASE, @@ -484,7 +262,7 @@ static ssize_t stm32_lptim_cnt_ceiling_read(struct coun= ter_device *counter, { struct stm32_lptim_cnt *const priv =3D counter->priv; =20 - return stm32_lptim_cnt_get_ceiling(priv, buf); + return snprintf(buf, PAGE_SIZE, "%u\n", priv->ceiling); } =20 static ssize_t stm32_lptim_cnt_ceiling_write(struct counter_device *counte= r, @@ -493,8 +271,22 @@ static ssize_t stm32_lptim_cnt_ceiling_write(struct co= unter_device *counter, const char *buf, size_t len) { struct stm32_lptim_cnt *const priv =3D counter->priv; + unsigned int ceiling; + int ret; + + if (stm32_lptim_is_enabled(priv)) + return -EBUSY; + + ret =3D kstrtouint(buf, 0, &ceiling); + if (ret) + return ret; + + if (ceiling > STM32_LPTIM_MAX_ARR) + return -EINVAL; + + priv->ceiling =3D ceiling; =20 - return stm32_lptim_cnt_set_ceiling(priv, buf, len); + return len; } =20 static const struct counter_count_ext stm32_lptim_cnt_ext[] =3D { @@ -630,32 +422,19 @@ static int stm32_lptim_cnt_probe(struct platform_devi= ce *pdev) { struct stm32_lptimer *ddata =3D dev_get_drvdata(pdev->dev.parent); struct stm32_lptim_cnt *priv; - struct iio_dev *indio_dev; - int ret; =20 if (IS_ERR_OR_NULL(ddata)) return -EINVAL; =20 - indio_dev =3D devm_iio_device_alloc(&pdev->dev, sizeof(*priv)); - if (!indio_dev) + priv =3D devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) return -ENOMEM; =20 - priv =3D iio_priv(indio_dev); priv->dev =3D &pdev->dev; priv->regmap =3D ddata->regmap; priv->clk =3D ddata->clk; priv->ceiling =3D STM32_LPTIM_MAX_ARR; =20 - /* Initialize IIO device */ - indio_dev->name =3D dev_name(&pdev->dev); - indio_dev->dev.of_node =3D pdev->dev.of_node; - indio_dev->info =3D &stm32_lptim_cnt_iio_info; - if (ddata->has_encoder) - indio_dev->channels =3D &stm32_lptim_enc_channels; - else - indio_dev->channels =3D &stm32_lptim_cnt_channels; - indio_dev->num_channels =3D 1; - /* Initialize Counter device */ priv->counter.name =3D dev_name(&pdev->dev); priv->counter.parent =3D &pdev->dev; @@ -673,10 +452,6 @@ static int stm32_lptim_cnt_probe(struct platform_devic= e *pdev) =20 platform_set_drvdata(pdev, priv); =20 - ret =3D devm_iio_device_register(&pdev->dev, indio_dev); - if (ret) - return ret; - return devm_counter_register(&pdev->dev, &priv->counter); } =20 --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 990BFC433EF for ; Mon, 24 Jan 2022 20:24:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381628AbiAXUYT (ORCPT ); Mon, 24 Jan 2022 15:24:19 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:43330 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352152AbiAXT5L (ORCPT ); Mon, 24 Jan 2022 14:57: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 CB8B8B81215; Mon, 24 Jan 2022 19:57:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1C34C340E5; Mon, 24 Jan 2022 19:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054228; bh=k/jaFgS3jdXQ+cUcP3Ir26Qm797Ulvmbkt2quYhZPXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EiVRB0/pgehPGxN8zYgj+emrt4ekQJbhQih6mY9VXO3sJsctpDDleFBHyct5t486+ XCaFHOlMewCUD9y5XKDzwTwTajA7t5/6vm5LWyN+Tea3Esdaz7X8pLpnfmCXQUMExL HFRWSG5UCbqe7mbohq2Ni0lrEDU/N7ccGLQm82z8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sameer Pujar , Thierry Reding , Sasha Levin Subject: [PATCH 5.10 287/563] arm64: tegra: Fix Tegra194 HDA {clock,reset}-names ordering Date: Mon, 24 Jan 2022 19:40:52 +0100 Message-Id: <20220124184034.378586170@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 48f6e195039486bc303118948f49a9873acc888f ] As per the HDA binding doc reorder {clock,reset}-names entries for Tegra194. This also serves as a preparation for converting existing binding doc to json-schema. Signed-off-by: Sameer Pujar Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts= /nvidia/tegra194.dtsi index 9b5007e5f790f..815df654e6387 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -782,13 +782,13 @@ reg =3D <0x3510000 0x10000>; interrupts =3D ; clocks =3D <&bpmp TEGRA194_CLK_HDA>, - <&bpmp TEGRA194_CLK_HDA2CODEC_2X>, - <&bpmp TEGRA194_CLK_HDA2HDMICODEC>; - clock-names =3D "hda", "hda2codec_2x", "hda2hdmi"; + <&bpmp TEGRA194_CLK_HDA2HDMICODEC>, + <&bpmp TEGRA194_CLK_HDA2CODEC_2X>; + clock-names =3D "hda", "hda2hdmi", "hda2codec_2x"; resets =3D <&bpmp TEGRA194_RESET_HDA>, - <&bpmp TEGRA194_RESET_HDA2CODEC_2X>, - <&bpmp TEGRA194_RESET_HDA2HDMICODEC>; - reset-names =3D "hda", "hda2codec_2x", "hda2hdmi"; + <&bpmp TEGRA194_RESET_HDA2HDMICODEC>, + <&bpmp TEGRA194_RESET_HDA2CODEC_2X>; + reset-names =3D "hda", "hda2hdmi", "hda2codec_2x"; 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A90BC3527A for ; Mon, 24 Jan 2022 20:17:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380485AbiAXUQX (ORCPT ); Mon, 24 Jan 2022 15:16:23 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42064 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352711AbiAXT5N (ORCPT ); Mon, 24 Jan 2022 14:57: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 DFBB5B81239; Mon, 24 Jan 2022 19:57:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 153BDC340E5; Mon, 24 Jan 2022 19:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054231; bh=DEHeXxGMoZ459O6MpLMINR8caHq/plgIdLNric1bdMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kkT6cP7bagKRZeOYhMYNZVSu6fDAEABIIrECFkwKxH7ZnBA7ZuymsaPuviBdCZcBC SAHS4zDeg+Pg1ZSqtSn+oVDi2AS5uVGdWm5DpDjUsHo98Lo7ICzEw3mLTWdkc5UHEB at3AXMlt0pTxm1fgPdZA/k0D0XY4J6LOQ7xrBcOw= 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.10 288/563] arm64: tegra: Remove non existent Tegra194 reset Date: Mon, 24 Jan 2022 19:40:53 +0100 Message-Id: <20220124184034.409760358@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 815df654e6387..05cf606b85c9f 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -786,9 +786,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39E44C4332F for ; Mon, 24 Jan 2022 20:29:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383298AbiAXU1G (ORCPT ); Mon, 24 Jan 2022 15:27:06 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42094 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352176AbiAXT5R (ORCPT ); Mon, 24 Jan 2022 14:57: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 DB54CB811FB; Mon, 24 Jan 2022 19:57:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF375C340E5; Mon, 24 Jan 2022 19:57:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054234; bh=Qbnpal6S+UxOf65CG/ERZROcEXBzaAoH3S2RJUPcGq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lKmDTKwSKKx+k9xWQVpkoi2Zrts/e9ist8g0ha93Im7bryycYQaU7t9L8dyVVaW14 8ckgWWVmB2cIFKMh2jOW52/b6khYOiTZA1+bBKQCAt9Dn3++FFtKQAEgYwQhrYJOJD 8wLW2LEopzb7ugxX80DFvnoWprDjlXql3IDRWLoo= 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.10 289/563] mips: lantiq: add support for clk_set_parent() Date: Mon, 24 Jan 2022 19:40:54 +0100 Message-Id: <20220124184034.446478280@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AB35C433F5 for ; Mon, 24 Jan 2022 21:38:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455969AbiAXVg7 (ORCPT ); Mon, 24 Jan 2022 16:36:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391121AbiAXUq7 (ORCPT ); Mon, 24 Jan 2022 15:46: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 14248C0619C9; Mon, 24 Jan 2022 11:57: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 C792FB81269; Mon, 24 Jan 2022 19:57:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0642AC340E5; Mon, 24 Jan 2022 19:57:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054237; bh=TYR6G0G1NNZYgGiHfvo4P7O8iCjHHs0h9Uv+G6h0s/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LmTvLLaz3maq5qjfPEGmVQqBiAdsb1fO5rbjt5yUyeCnzXy1Ejrq7JFrgU+U5iTb1 YfqqUYoQMeIr4f6oeBt7rJaT+J4a9HHTdfKFzKeoYYxUX4O0Z10uxlhMtsKgE91h/8 tjVp9kOcYzpPF8FlVpR0JG1yEM42R1zWvQm97Qkc= 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.10 290/563] mips: bcm63xx: add support for clk_set_parent() Date: Mon, 24 Jan 2022 19:40:55 +0100 Message-Id: <20220124184034.486618910@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 aba6e2d6a736c..dcfa0ea912fe1 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB136C4707A for ; Mon, 24 Jan 2022 21:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347299AbiAXV0n (ORCPT ); Mon, 24 Jan 2022 16:26:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391136AbiAXUq7 (ORCPT ); Mon, 24 Jan 2022 15:46: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 38380C0619CD; Mon, 24 Jan 2022 11:57: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 01A2EB8128F; Mon, 24 Jan 2022 19:57:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16DBBC33DA3; Mon, 24 Jan 2022 19:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054240; bh=e/pMVKumLe2FHFOwgK2m3U8iURjNJRFnpl9Hmy2/nEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wY6sXAsiJCr/+Sa/3mEg7RN8fC08hrtMERN+z/2JIG8MTwzJ8+Y4QGlVax1zjwrt5 Xxv5CklEJIv70W68kWph5nL9APbxJs3ZpAbBnEvHGDYpNwPDrHFccj7YQaQiwwFHI/ q9vmf/fGzgqIni8HA5VNu80EcD+wu6ICotjrP8Gk= 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.10 291/563] powerpc/xive: Add missing null check after calling kmalloc Date: Mon, 24 Jan 2022 19:40:56 +0100 Message-Id: <20220124184034.517499362@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 1e3674d7ea7bc..b57eeaff7bb33 100644 --- a/arch/powerpc/sysdev/xive/spapr.c +++ b/arch/powerpc/sysdev/xive/spapr.c @@ -658,6 +658,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13544C4167E for ; Mon, 24 Jan 2022 21:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447949AbiAXVLq (ORCPT ); Mon, 24 Jan 2022 16:11:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390234AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 A00A7C0613A0; Mon, 24 Jan 2022 11:55: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 5E0E0B80FA1; Mon, 24 Jan 2022 19:55:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83E73C340E5; Mon, 24 Jan 2022 19:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054140; bh=b8G62tcbZ+RNUVrSWREkGXkwEKGfu9XRr04Yuz48NHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q3Cjrwpj4AgUKhn5ap+CsR5t8jxQLLJQQ+0CYihpHAvhz/CZKKn2qwMoir+94/gGw caPKlkoj/3iWgNEFL/BgkJpeV1oKVKC+mR9wuZgKQkqowA2+wlfmqQqqa4pGmC9C3G F1BQLPuSMf4YQvgvmoNCZny8bfXWjXygQ3GAlIcI= 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.10 292/563] ASoC: fsl_mqs: fix MODULE_ALIAS Date: Mon, 24 Jan 2022 19:40:57 +0100 Message-Id: <20220124184034.547453892@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 69aeb0e71844d..0d4efbed41dab 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A560C433FE for ; Mon, 24 Jan 2022 21:07:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345835AbiAXVHD (ORCPT ); Mon, 24 Jan 2022 16:07:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390235AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 3E6BCC0613A6; Mon, 24 Jan 2022 11:55: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 D0B8960B56; Mon, 24 Jan 2022 19:55:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A25BBC340E5; Mon, 24 Jan 2022 19:55:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054143; bh=PgU5/HgFGDp/MIMNYfxiJlEP6GPrvT3oRWfVLrJRIoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MdzTBkhkguYTa89AYOnKMM3lWMalR5riuRh0svrELFsEjviCqOmQoTxs3nGaqfqja shl/EC48zPmR5KTXn5WJfbMEHsrNQj39cZzgK7t6pZn0kINJI1nh3J9oFRsqKXeaaT iSXBP6VZhdUUd6g+KmVqiqQDX0iu5W6pxUM1YrSA= 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.10 293/563] RDMA/cxgb4: Set queue pair state when being queried Date: Mon, 24 Jan 2022 19:40:58 +0100 Message-Id: <20220124184034.578172665@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 861e19fdfeb46..12e5461581cb4 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c @@ -2469,6 +2469,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3159C4167B for ; Mon, 24 Jan 2022 21:13:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447924AbiAXVLo (ORCPT ); Mon, 24 Jan 2022 16:11:44 -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 S1390267AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45: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 B3064C0613B0; Mon, 24 Jan 2022 11:55: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 6E68CB811F9; Mon, 24 Jan 2022 19:55:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DE41C340E5; Mon, 24 Jan 2022 19:55:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054146; bh=m7A0ETu85jMiQuAlInkxOU6TY3zIaUQmSPd4T4pwPHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZersNLfPYfw+PipKtxf6QccZ4QU5vjmo5e+pV4cqQr5+nTmYUr+Wx6rSQ5Gxa0K3r Dme5yxkh25qKXsFTpCz9nV3IESUGW2VYJNH8TVylPtjIjtZll4PW31K7C5bEMIZJx7 bIkPnRHvlBOq/0N7EXErlob0nImxREvzg2k+Dcsc= 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.10 294/563] ASoC: fsl_asrc: refine the check of available clock divider Date: Mon, 24 Jan 2022 19:40:59 +0100 Message-Id: <20220124184034.608451972@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 02c81d2e34ad0..5e3c71f025f45 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3F33C433EF for ; Mon, 24 Jan 2022 21:09:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376754AbiAXVJP (ORCPT ); Mon, 24 Jan 2022 16:09:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390641AbiAXUp7 (ORCPT ); Mon, 24 Jan 2022 15:45: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 C6C7EC0613BD; Mon, 24 Jan 2022 11:55: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 6C04EB80FA1; Mon, 24 Jan 2022 19:55:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A11DFC340E5; Mon, 24 Jan 2022 19:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054149; bh=uDbfPJ73HUWqhPHuTRXhY7UbI0yEEfy4ihntlu9sniM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QZv3l+6Q3hPPdY4o8Xr4Qt2aqiqio2hdWf/RhiYubfvr9J46JjG/asJEggVE1DfIi glBJ5lEeC6cleNGp8Bwp5Pz3IT6tLjstmr9Lr3kOuWslU/0wrJ/DAyx6oajaT0LJWx ze5zCeOrcDsZmspy3PP3PUgPZwGMPZZHZEea44VU= 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.10 295/563] clk: bm1880: remove kfrees on static allocations Date: Mon, 24 Jan 2022 19:41:00 +0100 Message-Id: <20220124184034.638740619@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4EFAC2BA4C for ; Mon, 24 Jan 2022 20:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380083AbiAXUPd (ORCPT ); Mon, 24 Jan 2022 15:15:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49206 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358825AbiAXTzy (ORCPT ); Mon, 24 Jan 2022 14: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 dfw.source.kernel.org (Postfix) with ESMTPS id D336D60B02; Mon, 24 Jan 2022 19:55:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A90E7C340E5; Mon, 24 Jan 2022 19:55:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054152; bh=eMrX1hV6akwkz8ht0zyrabETUFdYz2E50DjI7Kz+wBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nu64cdg2uXBotrs4kWdg7m3NVj24/oNOK8M8LsQFS+Werl8YTztpFY3v0/W30xD9q 2n1BDmDFGuEEREnWsVSI68oILrSAiJ9uTZ+iJ0CXC/vjWvSGujeQ68XRTsqVwdaHkU s34tRx2cs5oYKLLYE60Fdl4+5iKphsYLq/M+xJec= 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.10 296/563] of: base: Fix phandle argument length mismatch error message Date: Mon, 24 Jan 2022 19:41:01 +0100 Message-Id: <20220124184034.674849285@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 161a23631472d..60cb9b44d4ecc 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1328,9 +1328,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16324C433F5 for ; Mon, 24 Jan 2022 21:13:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447329AbiAXVK2 (ORCPT ); Mon, 24 Jan 2022 16:10:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390792AbiAXUqW (ORCPT ); Mon, 24 Jan 2022 15:46: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 D035DC061346; Mon, 24 Jan 2022 11: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 98044B8124C; Mon, 24 Jan 2022 19:55:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA97EC340E5; Mon, 24 Jan 2022 19:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054155; bh=qVTsRmkfHHvtcYhP+AfBxHTCm0Hpp40vXIcFjCKm+lI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SMmKcXt28MLRHtGD2QXf5c+fH5AD5+wHR+HaI+ZzAkskq8leL6WOCUWsB+L/JGxmf J6y8zsQai8AfiAlRE+XpN5ux92ed/fq+Ht/DD134KovDmFndMFGGDiODgInfM8ZJhw xSYgp7bKHvKdlNTUUp3XZO1ERfWgpiHdKcpuo1HY= 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.10 297/563] ARM: dts: omap3-n900: Fix lp5523 for multi color Date: Mon, 24 Jan 2022 19:41:02 +0100 Message-Id: <20220124184034.714475941@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 930BBC41535 for ; Mon, 24 Jan 2022 20:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380064AbiAXUPa (ORCPT ); Mon, 24 Jan 2022 15:15:30 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41452 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358902AbiAXT4A (ORCPT ); Mon, 24 Jan 2022 14:56: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 A6D60B811F9; Mon, 24 Jan 2022 19:55:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4301C340E8; Mon, 24 Jan 2022 19:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054158; bh=Am4JlF+3LE3QNxnbCrz5BtyOYey+mHZ/4iNz2HgS+MY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o1fNizLOsK95zLBHtGwdig9QrUpzcSOhV+Wt7XZGOql1q+ArDkvs0P5JR6VOBNurJ gQXr/Nwke33lA9dTeZ3cu9fiG4EzRt29ePjFNHpPjOlHbe2/erbiQvREdASM6nFyyj DGvAkKJ1vHfeeh+ZaQgr6MSCpNIbuuH2LTWsP80g= 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.10 298/563] Bluetooth: Fix debugfs entry leak in hci_register_dev() Date: Mon, 24 Jan 2022 19:41:03 +0100 Message-Id: <20220124184034.745171504@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2ad66f64879f1..2e7998bad133b 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3810,6 +3810,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30CF2C3526D for ; Mon, 24 Jan 2022 21:13:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447347AbiAXVKb (ORCPT ); Mon, 24 Jan 2022 16:10:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390791AbiAXUqW (ORCPT ); Mon, 24 Jan 2022 15:46: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 37D91C06135C; Mon, 24 Jan 2022 11:56: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 E8DC8B81218; Mon, 24 Jan 2022 19:56:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 054CFC340E5; Mon, 24 Jan 2022 19:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054161; bh=qRXq3Vg1/SgfObo49KqPcW5DHZ0hYhLqgBcufrlK0v4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SjowC+2ayaF1i1q3fLw1Q13Ns/70q62rG/80d1rzKixxPyzhtvAa+kfJ4vAiHGcw2 j/lTS04LYZfrfmp0vg2VnD3wOaoAjlBQdgYK/vDfz5hmfVy/tWytUP7N4qrvdeTTGW wlJBXm3ndUQ9OOJt3/FVU7RIo9vUige7nHBQnwhk= 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.10 299/563] fs: dlm: filter user dlm messages for kernel locks Date: Mon, 24 Jan 2022 19:41:04 +0100 Message-Id: <20220124184034.786714403@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/dlm/lock.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 002123efc6b05..1e9d8999b9390 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -3975,6 +3975,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: @@ -4003,6 +4011,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73714C3526E for ; Mon, 24 Jan 2022 21:13:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447411AbiAXVKo (ORCPT ); Mon, 24 Jan 2022 16:10:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390818AbiAXUq0 (ORCPT ); Mon, 24 Jan 2022 15:46: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 65AEBC0612B1; Mon, 24 Jan 2022 11:56: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 21550B80FA1; Mon, 24 Jan 2022 19:56:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D69EC340E5; Mon, 24 Jan 2022 19:56:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054164; bh=FWtbtmARrt7YCzY3o9axlqB5+rkW6kVoS11LNDSwnWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UuwgO3yRFk/VZp1rQP4IHAbDmIMh4o+4mkEKOZ5sLELe6EUM1DXnBbg3JsH6kSdCY CC/ekpzhTx4HCALnSKzeqqw3jHaQI8cmpe5CRRLIy5VKv8B1x6nYzRxS5YEmza8agv 8WmvUpbT4sPQs/XubZIZA8sVXZZS5ge+TKn/032s= 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.10 300/563] libbpf: Validate that .BTF and .BTF.ext sections contain data Date: Mon, 24 Jan 2022 19:41:05 +0100 Message-Id: <20220124184034.824126628@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 b337d6f29098b..e8ad53d31044a 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -2870,8 +2870,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D230C433FE for ; Mon, 24 Jan 2022 21:13:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447435AbiAXVKp (ORCPT ); Mon, 24 Jan 2022 16:10:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390833AbiAXUq2 (ORCPT ); Mon, 24 Jan 2022 15:46: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 727F2C061243; Mon, 24 Jan 2022 11:56: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 2E9C9B8121C; Mon, 24 Jan 2022 19:56:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F009C340E5; Mon, 24 Jan 2022 19:56:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054167; bh=FpFOz55NDArr1D4SGMUr6c5B/Pd266OUahPpfqk8l5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTqQh2/eP1CLyBJvnz/LJ4hk5uuMAxeVvxeeBXwxzw6L8dQ4yLA9DiXGXERwtQEGZ Rs8aKlukynXCOvnxY+2JA45WHRfzzKhjogKWbblYFGvqKsFFufDW+sDfybFgF1z869 Z3UDpSC+Oj6qRSP54xRHX+/zVX7uezc+mGcqM5Ec= 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.10 301/563] drm/lima: fix warning when CONFIG_DEBUG_SG=y & CONFIG_DMA_API_DEBUG=y Date: Mon, 24 Jan 2022 19:41:06 +0100 Message-Id: <20220124184034.854329625@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 65fdca366e41f..36c9905894278 100644 --- a/drivers/gpu/drm/lima/lima_device.c +++ b/drivers/gpu/drm/lima/lima_device.c @@ -357,6 +357,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE7F6C3526D for ; Mon, 24 Jan 2022 20:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380142AbiAXUPq (ORCPT ); Mon, 24 Jan 2022 15:15:46 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42720 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359054AbiAXT4Q (ORCPT ); Mon, 24 Jan 2022 14:56: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 46BDFB810AF; Mon, 24 Jan 2022 19:56:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EBACC340E5; Mon, 24 Jan 2022 19:56:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054174; bh=Adkz8tW47vbwofh7NrAPeUglOkNTCxORjd0loYPv954=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fy8hekyhvUx3/KYKgpDljlJgHe6E/pzcuY7mDViEQqP4oY+XCa7IGmy7tgxog3hAn aMHNiwfEujmboC2dbnydhKUyZ52k1OLo0yUou34jY31XhbCsionnZYCBUjsIYbKsp1 fy7vrI59KSUu46t8x3go5TDcpOE793O66CX8wCYg= 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.10 302/563] selftests/bpf: Fix bpf_object leak in skb_ctx selftest Date: Mon, 24 Jan 2022 19:41:07 +0100 Message-Id: <20220124184034.893760003@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 fafeddaad6a99..23915be6172d6 100644 --- a/tools/testing/selftests/bpf/prog_tests/skb_ctx.c +++ b/tools/testing/selftests/bpf/prog_tests/skb_ctx.c @@ -105,4 +105,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0ADC5C4707A for ; Mon, 24 Jan 2022 20:17:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380163AbiAXUPt (ORCPT ); Mon, 24 Jan 2022 15:15:49 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42774 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359078AbiAXT4T (ORCPT ); Mon, 24 Jan 2022 14:56: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 36882B80FA1; Mon, 24 Jan 2022 19:56:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 609C8C340E5; Mon, 24 Jan 2022 19:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054177; bh=z9Xl0iPAzJD3iaKf5VYmbyxLHCGM/Ya1QMtZ25AxyiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AatUUandzzMuOyC2mo9IVIb5iOdkUWAWHH2Dzo2CElXtqso4TM3+fd+B4HnKCnwSr 8VUN3SMCH2WMkZbKyJufVP2m2Lw9mj1x8OkvTv28nouIwpNfYzTKEWbxtObxnPP+yH G2xxxHoY1fiEZZt0ZBBZCb2UNidR6LmBe4n0x6oY= 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.10 303/563] ar5523: Fix null-ptr-deref with unexpected WDCMSG_TARGET_START reply Date: Mon, 24 Jan 2022 19:41:08 +0100 Message-Id: <20220124184034.924621595@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 49cc4b7ed5163..1baec4b412c8d 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8266C43217 for ; Mon, 24 Jan 2022 21:13:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447572AbiAXVK7 (ORCPT ); Mon, 24 Jan 2022 16:10:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390869AbiAXUqc (ORCPT ); Mon, 24 Jan 2022 15: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 DE25DC061254; Mon, 24 Jan 2022 11:56: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 7E3C860B89; Mon, 24 Jan 2022 19:56:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D15CC340E5; Mon, 24 Jan 2022 19:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054179; bh=lIX2r7eSQ/EpCjwtdMC7rJeKPE+cTnyydeIsvHazwQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FByfYnQhKGOYE43K5Bpt4OFYXJwGb0B+QxkS+tYqyo6vVkpSIPgDwaTGfKwzrtr6T qcTmRfOx0KjcWrx73TBNuXKFW9vrGkRYJtAbIgqhtPX6PAxfHzVrNfss8x0WGYJeoj AZtmZLGeEaRelhNgmHqOpbNXTdjz1YRYKu6/E4fg= 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.10 304/563] drm/bridge: dw-hdmi: handle ELD when DRM_BRIDGE_ATTACH_NO_CONNECTOR Date: Mon, 24 Jan 2022 19:41:09 +0100 Message-Id: <20220124184034.955939214@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 9fef6413741dc..9682416056ed6 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 0c79a9ba48bb6..29c0eb4bd7546 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -756,6 +756,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); @@ -3395,7 +3403,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 @@ -3408,7 +3416,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 954EAC4332F for ; Mon, 24 Jan 2022 21:14:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448471AbiAXVMk (ORCPT ); Mon, 24 Jan 2022 16:12:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390872AbiAXUqc (ORCPT ); Mon, 24 Jan 2022 15: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 BF102C061259; Mon, 24 Jan 2022 11:56: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 5CC6760B89; Mon, 24 Jan 2022 19:56:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BB8CC340E5; Mon, 24 Jan 2022 19:56:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054182; bh=N+xAuBNrumYAwKdpAGtW0TSvVD1arLgbiAIJ/iqPfH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Wgc1tA4QNEdQ8/T3xWQNaqSBbTnoU4lWyWnxMlzzKRl/U0evUKk9+6XO2qZ7qfLG /TF301QQ+QmgT3mVsDLyW0FHmNQ4wCOp0HSwAWQINjfMMjoa0kqjGoLfd6IB/99sZP fRZVnZ58qo04AV4O95JQ0jaPUNvIEy0jLV0CXi/Y= 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.10 305/563] drm/nouveau/pmu/gm200-: avoid touching PMU outside of DEVINIT/PREOS/ACR Date: Mon, 24 Jan 2022 19:41:10 +0100 Message-Id: <20220124184034.988303891@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../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 a0fe607c9c07f..3bfc55c571b5e 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56468C4332F for ; Mon, 24 Jan 2022 21:14:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448453AbiAXVMk (ORCPT ); Mon, 24 Jan 2022 16:12:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390876AbiAXUqc (ORCPT ); Mon, 24 Jan 2022 15: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 B2828C06125A; Mon, 24 Jan 2022 11:56: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 524E560B43; Mon, 24 Jan 2022 19:56:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33C21C340E5; Mon, 24 Jan 2022 19:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054185; bh=1WPtrGRdvx6qK4nXEUfEMqpAwDHs5yO3RQRlQrPvYxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wvDMK9uVUxiPybMHcSkICHl4CkmNKsvbzp+iYQRU7gQC8EZvcexK3Gka0sJyM91W/ dh9Xm4nlh1mGGXo5xD/34v5Wda+BPE9wZhKeAiCaaIURzq/z8csFyeZpKCpFGk4//h ah3gsVk+DQLPvCi2EeZXTAPfMDad2aPmsE2tszfA= 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.10 306/563] media: atomisp: fix try_fmt logic Date: Mon, 24 Jan 2022 19:41:11 +0100 Message-Id: <20220124184035.021782371@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../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 830df02626634..8a0648fd7c813 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, 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42BC2C3526E for ; Mon, 24 Jan 2022 20:17:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380183AbiAXUPx (ORCPT ); Mon, 24 Jan 2022 15:15:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42916 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359159AbiAXT4c (ORCPT ); Mon, 24 Jan 2022 14:56: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 19674B8121C; Mon, 24 Jan 2022 19:56:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45F14C340E5; Mon, 24 Jan 2022 19:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054188; bh=dVLxwB0+A0mebD0nNeXgZgT8QMaBEkMkcXjCLxBqgjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c+aW6/1W5ZB76HpBaarAhKxCkPTPauFuMh71nMiGL7XaSPE9lySX2hRsKM6b1p4wT Z5v/sMXnEJMFgubR6C5Z5LwEKudEWiHKbimxfTbPl8T25lNCGvhZvVnorGiwYYswtJ xby/JmN9XBRrMnfryigkrF20EtYXxK1/CMksGpdk= 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.10 307/563] media: atomisp: set per-devices default mode Date: Mon, 24 Jan 2022 19:41:12 +0100 Message-Id: <20220124184035.062649287@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 52d24c1ca0d64..b751df31cc24c 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 dcc2dd981ca60..628e85799274d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -1178,23 +1178,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 330a77eed8aa6..12215d7406169 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 687e94e8b6ce5..8aeea74cfd06b 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53F12C4707E for ; Mon, 24 Jan 2022 20:17:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380221AbiAXUPy (ORCPT ); Mon, 24 Jan 2022 15:15:54 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42930 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359180AbiAXT4e (ORCPT ); Mon, 24 Jan 2022 14:56: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 4A311B811F3; Mon, 24 Jan 2022 19:56:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C1E5C340E5; Mon, 24 Jan 2022 19:56:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054192; bh=enBE6ig5rLsNPHOkyfXqmaui5X7hjG1/VviCzIM8hng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qj1PmETPHp8h/x9Drf4j5qoyau9nwuKFRdGuTs15i6YIPswnRMDNX1mKZUh927o8k AheN/DgVRL58TF/xHBh8NiUWWDf2AolgRPF9v7WFMxrxjPPMAMNe4kXauMbWnM7xfl Dw1dq6/gddMA9XtqtBftCqmbaXvIezGYoeAZ7W3Q= 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.10 308/563] media: atomisp-ov2680: Fix ov2680_set_fmt() clobbering the exposure Date: Mon, 24 Jan 2022 19:41:13 +0100 Message-Id: <20220124184035.093100551@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 49920245e0647..cafb798a71abe 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A3E9C47084 for ; Mon, 24 Jan 2022 20:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380238AbiAXUP5 (ORCPT ); Mon, 24 Jan 2022 15:15:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41764 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359217AbiAXT4h (ORCPT ); Mon, 24 Jan 2022 14:56: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 69B67B81229; Mon, 24 Jan 2022 19:56:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EC63C340E5; Mon, 24 Jan 2022 19:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054195; bh=k/Lz/Zo8RSedFrd/Cb57u0V3RMctMpavMVRb8b8/edc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DNoeQ9nOGoFx6Z/qKelRmY25uiOO1Dnp+92ug47lIsm4IflcvSBlsAqKcvmZ40wua E0OgPqJq27ccMpzKltFH8lUVnhqwvGTs/3xsepd00mkoRpi2NsXz6ppJojmLtJ5JZB K5XxOuuL5kzYTnVm8aXfy+tzvYEGDpBCx0gL2oTE= 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.10 309/563] ARM: shmobile: rcar-gen2: Add missing of_node_put() Date: Mon, 24 Jan 2022 19:41:14 +0100 Message-Id: <20220124184035.123713305@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1362C41535 for ; Mon, 24 Jan 2022 21:14:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448435AbiAXVMj (ORCPT ); Mon, 24 Jan 2022 16:12:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390879AbiAXUqc (ORCPT ); Mon, 24 Jan 2022 15: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 5556EC06125B; Mon, 24 Jan 2022 11:56: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 E940E60916; Mon, 24 Jan 2022 19:56:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE061C340E5; Mon, 24 Jan 2022 19:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054198; bh=Y3fmQ1Gr9y2ZSWkBNN6dTmaQIXWW9+9Nx7kmY3MGb2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2PLUS4mTY9wS9UmG5xKr2AzTttAZ9JG+Pxi3BD8CpXtjFyNPafa7z7uKN7JW4Qxyf dITGXM8uOA9bwuLdx48cr0HC2VwcMwYInkNR0//ZQ7EbfrEjE8ueqes2Emg6GVuiEj 5sNMdOumQQxKCrVPCUC5DXbPJ8Dl76XdaCoaSCg8= 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.10 310/563] batman-adv: allow netlink usage in unprivileged containers Date: Mon, 24 Jan 2022 19:41:15 +0100 Message-Id: <20220124184035.154666306@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 c7a55647b520e..121459704b069 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -1361,21 +1361,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, }, { @@ -1390,68 +1390,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, @@ -1467,7 +1467,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4B0AC35273 for ; Mon, 24 Jan 2022 21:13:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448418AbiAXVMh (ORCPT ); Mon, 24 Jan 2022 16:12:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390883AbiAXUqc (ORCPT ); Mon, 24 Jan 2022 15: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 EE04CC06127E; Mon, 24 Jan 2022 11: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 A921FB81218; Mon, 24 Jan 2022 19:56:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D515BC340E5; Mon, 24 Jan 2022 19:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054201; bh=1b6YLDjsUCQzFUYs8Px5c2cq/w57NeG2Q6+eG+HGcOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UjkkszSa8i0F10lcts/2MC45EXJB/WDlhOY/r//qLwOhyxT0NQ1gwt1seoEg8XEbe S2ZuiRZEJNDZJBAmUmkz6WhuNCFqP/kgnutGzyzKjtt50kbnQGdwnHe3kFMCtLeD+t iEJK/iVe0VPVLKm4E48ztidc8Ah9ZLsEk8wvcDeo= 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.10 311/563] media: atomisp: handle errors at sh_css_create_isp_params() Date: Mon, 24 Jan 2022 19:41:16 +0100 Message-Id: <20220124184035.186222073@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 24fc497bd4915..8d6514c45eeb6 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -2437,7 +2437,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); @@ -2482,7 +2482,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F87BC4332F for ; Mon, 24 Jan 2022 20:17:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380436AbiAXUQU (ORCPT ); Mon, 24 Jan 2022 15:16:20 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41894 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351767AbiAXT4t (ORCPT ); Mon, 24 Jan 2022 14:56: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 7DB13B8119E; Mon, 24 Jan 2022 19:56:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A80F3C340E5; Mon, 24 Jan 2022 19:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054207; bh=P0NElVdu2k+uYeRLYxTnbs9lZbPTnq+Y0IUJpc7myYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g7Rh/k4RVmh4nUIv989hgfByffXEveEyZoG2Stth9lHDKaDV+DinDN1Ol+8fk4VXY nhi7Iu4jw19r+u6PaDsRw7dToEVbQQ+kgqZQyuHvmUlebYudmkqHQ3Svu9jbsnw+Hd +9WC977enmzWNTkdrP5+s05ExXAkS13kM13l7Kqg= 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.10 312/563] ath11k: Fix crash caused by uninitialized TX ring Date: Mon, 24 Jan 2022 19:41:17 +0100 Message-Id: <20220124184035.222561707@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 66331da350129..f6282e8702923 100644 --- a/drivers/net/wireless/ath/ath11k/hw.c +++ b/drivers/net/wireless/ath/ath11k/hw.c @@ -246,8 +246,6 @@ const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_ip= q8074 =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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFC93C4167B for ; Mon, 24 Jan 2022 21:14:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448796AbiAXVNs (ORCPT ); Mon, 24 Jan 2022 16:13:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391105AbiAXUq7 (ORCPT ); Mon, 24 Jan 2022 15:46: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 7E72EC0619C2; Mon, 24 Jan 2022 11:56: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 ams.source.kernel.org (Postfix) with ESMTPS id 3AB33B8122F; Mon, 24 Jan 2022 19:56:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92510C340E5; Mon, 24 Jan 2022 19:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054210; bh=WwyqKVvqSWpzPHuY0DjZnnFLbWkXOccjBFegE6a5n8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SxWaDOXibv/qmdAVtyEesNJeWeMRve9vQnfLf+F3cxcSwNvOKXLCnLoG+TJL6E+Up 1SUGSDwWQF+2GKCF//MgeqNRtoQgfCuigzR8uoPje/Nds6C90Rw3rt/9TVhBLhyT6y 7D2cqq4jW2vgCMcrZF1iR/QZYzenn4QPoYLxzFzM= 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.10 313/563] usb: gadget: f_fs: Use stream_open() for endpoint files Date: Mon, 24 Jan 2022 19:41:18 +0100 Message-Id: <20220124184035.255603480@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 cbb7947f366f9..d8652321e15e9 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) @@ -1152,7 +1152,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B244C3525A for ; Mon, 24 Jan 2022 21:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452823AbiAXV1G (ORCPT ); Mon, 24 Jan 2022 16:27:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391106AbiAXUq7 (ORCPT ); Mon, 24 Jan 2022 15:46: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 8EB6AC0619C3; Mon, 24 Jan 2022 11:56: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 4A39BB8122F; Mon, 24 Jan 2022 19:56:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E19CC340E7; Mon, 24 Jan 2022 19:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054213; bh=dxlHkkDhrDWGJRS2ZBt0S7lqBxv/VVktAClM8xc6FqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y+8ZZenoKIRTXJGgWteeSA3Mhk95GYezmHKLlHrl0y3iCDRnkPzVQzW+1PTcgPJ3o 5VX6KgIv8ZIpcL3cSnBVjQ9mslKCh/KIM+Bc7pA7+cU5KrNo3ngScxhm7D2V2gzhj5 T5WHvc3bk+wd/ibYdi8p8gcLURKrn0lK9fE1g0Ro= 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.10 314/563] drm: panel-orientation-quirks: Add quirk for the Lenovo Yoga Book X91F/L Date: Mon, 24 Jan 2022 19:41:19 +0100 Message-Id: <20220124184035.287668311@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a950d5db211c5..9d1bd8f491ad7 100644 --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -248,6 +248,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD73AC433EF for ; Mon, 24 Jan 2022 21:14:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448882AbiAXVOE (ORCPT ); Mon, 24 Jan 2022 16:14:04 -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 S1391108AbiAXUq7 (ORCPT ); Mon, 24 Jan 2022 15:46: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 D65F5C0619C4; Mon, 24 Jan 2022 11:56: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 79EB6B8122F; Mon, 24 Jan 2022 19:56:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97A02C340E8; Mon, 24 Jan 2022 19:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054216; bh=mTzcCRXvRXdFMvGvyeb2rwfSPt4Nj5V1BB1LEiRqQ70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kTsLq0lynSOZmLmPL7f+UhvsxIPLNjJmwIKZbTiSJGNdzYADphLDg1MA8K1xrhjPO BM4slc3gZbs78hhjz7wH6V7D4wJ/ORpdVE0hUM2YtVeYJ4HDjK7bOrWXFx79MvUSDP 6A1AdLHB9k3/M5ipUjdaO6JNqvX1waE+FpLmXZs0= 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.10 315/563] HID: apple: Do not reset quirks when the Fn key is not found Date: Mon, 24 Jan 2022 19:41:20 +0100 Message-Id: <20220124184035.322383770@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 5c1d33cda863b..e5d2e7e9541b8 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c @@ -415,7 +415,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 317C1C35270 for ; Mon, 24 Jan 2022 21:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353835AbiAXV0u (ORCPT ); Mon, 24 Jan 2022 16:26:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391107AbiAXUq7 (ORCPT ); Mon, 24 Jan 2022 15:46: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 9801AC0619C5; Mon, 24 Jan 2022 11:57: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 60A06B81239; Mon, 24 Jan 2022 19:57:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90C41C340E5; Mon, 24 Jan 2022 19:56:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054219; bh=c48g0P2kXom32ZkWk2oniIOiwrvvjuNKadW20KYAa4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xmIJX1IsGxyKdIDxNB1YRpKUcsQtykYiETfsCLposwtCEhLhAAFcpH+OeBRnn6so9 GTW3KHOXIOMNCsOC006lwL+T07dwiJfw8ZnwWPOUTWskCEUymqYfLOK6NthrZsOHV5 NonbBiqVsQ2fPTUkxoLHbh5DP+Unx8I9GxaifYHY= 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.10 316/563] media: b2c2: Add missing check in flexcop_pci_isr: Date: Mon, 24 Jan 2022 19:41:21 +0100 Message-Id: <20220124184035.362810588@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a9d9520a94c6d..c9e6c7d663768 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17B87C433F5 for ; Mon, 24 Jan 2022 21:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349028AbiAXV0p (ORCPT ); Mon, 24 Jan 2022 16:26:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391109AbiAXUq7 (ORCPT ); Mon, 24 Jan 2022 15:46: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 C9271C0619C6; Mon, 24 Jan 2022 11: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 ams.source.kernel.org (Postfix) with ESMTPS id 71790B81239; Mon, 24 Jan 2022 19:57:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ADE4C340E5; Mon, 24 Jan 2022 19:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054222; bh=bjnr579xE3xgyvjFIi7SCyvGueJvDxugpZ7TyGVGiLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pvq1A8wafWZLLr3CMt2WeRE9aPrW1A8M9xJ6pEsU85cksZQUcfU/8lc5z8erxWh+P fSXf+A4yRHVU/Kmu+1ij3UHbmDync+UjcmrEfYpbpwflZ/TDV7ON5ZVSelU6rDFySE GV5nGCPV89KSJh4roFnnVtYEdmJa42OcDNwlwbgE= 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.10 317/563] EDAC/synopsys: Use the quirk for version instead of ddr version Date: Mon, 24 Jan 2022 19:41:22 +0100 Message-Id: <20220124184035.393469702@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 1a801a5d3b08b..92906b56b1a2b 100644 --- a/drivers/edac/synopsys_edac.c +++ b/drivers/edac/synopsys_edac.c @@ -1351,8 +1351,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7422C4321E for ; Mon, 24 Jan 2022 20:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380746AbiAXUQv (ORCPT ); Mon, 24 Jan 2022 15:16:51 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:43330 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353083AbiAXT7P (ORCPT ); Mon, 24 Jan 2022 14: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 ams.source.kernel.org (Postfix) with ESMTPS id 1272BB8119D; Mon, 24 Jan 2022 19:59:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 461DDC340E5; Mon, 24 Jan 2022 19:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054352; bh=FMHYx2XBoKvpWK72As1cxGEVQ+XWXjh/vSjCyMexVUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yGZG13DO1WXUDoUeJm5mhhPGFCdiw29CwAFpIYb2HOQNKdUVr8kHIhQcUe7Jd781d xCYa0VIY2c4s2TqLMtz1hXXBU9KNqD70fAFAmLc1wRvllAtuqCaZGo3AFGywQlRwo6 zPm9f7ece5uQf3f+iKNtCEl9GnFfEYyBinJN/IYo= 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.10 318/563] ARM: imx: rename DEBUG_IMX21_IMX27_UART to DEBUG_IMX27_UART Date: Mon, 24 Jan 2022 19:41:23 +0100 Message-Id: <20220124184035.430426801@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8986a91a6f31b..dd1cf70353986 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -400,12 +400,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" @@ -1523,7 +1523,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 || \ @@ -1591,12 +1591,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A32CC433EF for ; Mon, 24 Jan 2022 21:16:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359662AbiAXVOV (ORCPT ); Mon, 24 Jan 2022 16:14:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391161AbiAXUrB (ORCPT ); Mon, 24 Jan 2022 15:47: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 A234DC0424D1; Mon, 24 Jan 2022 11:57: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 5E3A5B81249; Mon, 24 Jan 2022 19:57:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EA8EC33DA0; Mon, 24 Jan 2022 19:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054247; bh=mzszewQvu+rH1A9pS5GqxEif5yWkdOeZ53lYTxnWPLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q7hhyE7mYa2a66mIekIhR1ho45Y3gl6P57105IfqPLzWqD2+AG3CsrveSac5kezRm FYmeM1aUisFQe2C+IgZsciWYjt5R8rx6lhn+IQK2Yh/QcJojoM+Q23iiPRypf+K94O ypwPcMGGJIlKiBNPNmwLISrY6aMk58dDYp5Ww8cA= 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.10 319/563] drm/amd/display: check top_pipe_to_program pointer Date: Mon, 24 Jan 2022 19:41:24 +0100 Message-Id: <20220124184035.468725778@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 284ed1c8a35ac..93f5229c303e7 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2436,7 +2436,8 @@ static void commit_planes_for_stream(struct dc *dc, } =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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21858C433F5 for ; Mon, 24 Jan 2022 21:18:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346921AbiAXVSF (ORCPT ); Mon, 24 Jan 2022 16:18:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391836AbiAXUtE (ORCPT ); Mon, 24 Jan 2022 15:49: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 A61B2C0418B9; Mon, 24 Jan 2022 11:58: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 4531960B43; Mon, 24 Jan 2022 19:58:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00072C340E5; Mon, 24 Jan 2022 19:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054280; bh=ZE5dsaoNj8qyo4ImDQroynSx3KZtWAsOjL0c8M5iZPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lMdgDaIKbnnTIrd72oCszDgviZSXmgi1pkCoMAjlqWY83I2sPA7BM+PXal60MZ2yK efQcfDE6xdjRdo7OyIff6OL2koWWL6cU+qPEfmC435z/+wqB6jcWKcxQoZWXb0Q4od fsYLObr/1Pc7tQWYIeFB02Ii+1Yhdm83EMA04654= 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.10 320/563] drm/amdgpu/display: set vblank_disable_immediate for DC Date: Mon, 24 Jan 2022 19:41:25 +0100 Message-Id: <20220124184035.505523349@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2f70fdd6104f2..582055136cdbf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c @@ -267,7 +267,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 a5b6f36fe1d72..6c8f141103da4 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1069,6 +1069,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5983C433F5 for ; Mon, 24 Jan 2022 20:24:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354656AbiAXUYK (ORCPT ); Mon, 24 Jan 2022 15:24:10 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54938 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352572AbiAXT6h (ORCPT ); Mon, 24 Jan 2022 14:58: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 CCCDA60B88; Mon, 24 Jan 2022 19:58:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B405BC340E5; Mon, 24 Jan 2022 19:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054314; bh=bECX07xkx2k484fsrIWFoWPuZFgoO91gV/NWmls1Tc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eT410Q8XZ6uHkHpUutT5UGdWLZbQbNMx1OgWIym4+Ofx4phN+001ID/h/WL/MnZTW qmQjPOnGKObxD3BzflVNj27mvrFJLLaTPwAXBRPqh7Dj2WjWqqcdmPenr92cP3V2lL LVnW+VMCTWc22comb2TM/LvIsCqgPJEW4sy2nARI= 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.10 321/563] soc: ti: pruss: fix referenced node in error message Date: Mon, 24 Jan 2022 19:41:26 +0100 Message-Id: <20220124184035.537585419@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 cc0b4ad7a3d34..30695172a508f 100644 --- a/drivers/soc/ti/pruss.c +++ b/drivers/soc/ti/pruss.c @@ -131,7 +131,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1F47C433EF for ; Mon, 24 Jan 2022 21:27:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451200AbiAXVWZ (ORCPT ); Mon, 24 Jan 2022 16:22:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358937AbiAXUxE (ORCPT ); Mon, 24 Jan 2022 15:53: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 21C54C02B868; Mon, 24 Jan 2022 11:58: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 AB1AB611CD; Mon, 24 Jan 2022 19:58:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F8CFC340EA; Mon, 24 Jan 2022 19:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054335; bh=KSWW/ll7lDv72awejLQeJlMAMbruAtklcTYuzeueNak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f4TmSegcvTUkKJZMjHP6XzSXbEUK9WcE7ANcZ5SuUcZYAaeCfIVbP4IM1kh3v9ycj JQZ6IS0ZgChyU74dE5U9W/IRrX+UQbtgwyMIeF9x3V6HkfLhWhVODNI7XM9CG5T6R9 rK4CSwP40nQnfoB4UWcHafct4zIzrfbDvhQC44+Q= 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.10 322/563] mlxsw: pci: Add shutdown method in PCI driver Date: Mon, 24 Jan 2022 19:41:27 +0100 Message-Id: <20220124184035.571448566@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ffaeda75eec42..72d5c77bcb949 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -1900,6 +1900,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDED3C4321E for ; Mon, 24 Jan 2022 21:28:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450774AbiAXVVX (ORCPT ); Mon, 24 Jan 2022 16:21:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359000AbiAXUxE (ORCPT ); Mon, 24 Jan 2022 15:53: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 1EB5BC02B869; Mon, 24 Jan 2022 11:58: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 A6E6961012; Mon, 24 Jan 2022 19:58:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C501C340E5; Mon, 24 Jan 2022 19:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054338; bh=rko4MC36AgJP3EXLrY5Ps0LX8nTKm3wAjDd0/UzRWcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C8+Pt6u026aw6D3+Zz7bYAM5MJqs1JMKIGkUHYksZiYbfjGg4//l+7IWsW0sY/PQi I0APUXJja1bSlUssFkRRTQ48cNQf4wBa51bieQ+ZnZFfZzaH8T+kTF7Ggb4Q76clIS wmLyM+LNgKqZnlBAlDXY7Xxyz7u13Nz+Xs8EY2Rk= 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.10 323/563] drm/bridge: megachips: Ensure both bridges are probed before registration Date: Mon, 24 Jan 2022 19:41:28 +0100 Message-Id: <20220124184035.602235679@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 781A1C4167D for ; Mon, 24 Jan 2022 21:27:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450815AbiAXVV3 (ORCPT ); Mon, 24 Jan 2022 16:21:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359047AbiAXUxE (ORCPT ); Mon, 24 Jan 2022 15:53: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 157F1C02B86B; Mon, 24 Jan 2022 11: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 A7DE260B43; Mon, 24 Jan 2022 19:59:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73670C340E5; Mon, 24 Jan 2022 19:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054341; bh=nTQQoOcwOSWdtjW4HqwT3MpwSNGEGW1hkZI3TJyvSr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lAg2F0TzMBdQ7GBQIlVp37H+WD8oXlmL6xlHLLJxw4B8V+QHijRzfneXvjVSqAvxk JBLU+O07iynz5J0ozM/FA1BpeF+mmQjSIjTzbwVzjNpPbSHbDmSq9vjcz3CXtiiV9U zKrK+lJKN0IjUW8LsDD/G47iZFM5XBRlXdpaGyfY= 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.10 324/563] tty: serial: imx: disable UCR4_OREN in .stop_rx() instead of .shutdown() Date: Mon, 24 Jan 2022 19:41:29 +0100 Message-Id: <20220124184035.638726101@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 28cc328ddb6eb..93cd8ad57f385 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -508,18 +508,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); @@ -1576,7 +1579,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BD89C433EF for ; Mon, 24 Jan 2022 21:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451237AbiAXVWa (ORCPT ); Mon, 24 Jan 2022 16:22:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359039AbiAXUxE (ORCPT ); Mon, 24 Jan 2022 15:53: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 E109FC095401; Mon, 24 Jan 2022 11:59: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 6A5FE60FF4; Mon, 24 Jan 2022 19:59:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EB2DC340E5; Mon, 24 Jan 2022 19:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054343; bh=fpJUuwgTvCrd7e1pIEnOTkVUhstiH0I4N60wi49/f9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AKHwK+2MT5AU80uYTa7yjfdtJgSPMVFf8NB5OfkM7PJ+BKATRL1rHoNgWcRlc+yJG wfsJbA9hBkabcm4ceFwU//lkPVqPX8J7OIrKqrxdjmY2OkKDGtc26WGiyXRJysBKq0 27jbOOh9Ay/kUVhsz0DGgBJ4AAbtXAC2HpMgbDx8= 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.10 325/563] gpiolib: acpi: Do not set the IRQ type if the IRQ is already in use Date: Mon, 24 Jan 2022 19:41:30 +0100 Message-Id: <20220124184035.676435963@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 6f11714ce0239..55e4f402ec8b6 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -969,10 +969,17 @@ int acpi_dev_gpio_irq_get_by(struct acpi_device *adev= , 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C53A5C433F5 for ; Mon, 24 Jan 2022 21:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451223AbiAXVW2 (ORCPT ); Mon, 24 Jan 2022 16:22:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359074AbiAXUxE (ORCPT ); Mon, 24 Jan 2022 15:53: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 9CE82C047CC4; Mon, 24 Jan 2022 11:59: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 20FC5B8119D; Mon, 24 Jan 2022 19:59:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57BF5C340E5; Mon, 24 Jan 2022 19:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054346; bh=SR6/RHYzbaW8Yv7fuCZxeBV3M2Vgut2hDG7UGkgolbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MyNuvCNmd1ej8A/oVZUaPAvKWj2XeGKtjDYg8CZnqNJrB68kSDlKkhGTUID4yPwyE 0Kd4gRmPP9eTQM73BbuwKkiyGBtLyAuVaTtG/G1sINqb/XdRonC8qoyLQ2FrXQ9OSc nNPuVu8Mu4Z0szHzL7AnnFMDBwSmM+MiERE6U1Ss= 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.10 326/563] HSI: core: Fix return freed object in hsi_new_client Date: Mon, 24 Jan 2022 19:41:31 +0100 Message-Id: <20220124184035.707047298@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a5f92e2889cb8..a330f58d45fc6 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6569CC433EF for ; Mon, 24 Jan 2022 21:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451584AbiAXVXK (ORCPT ); Mon, 24 Jan 2022 16:23:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359088AbiAXUxF (ORCPT ); Mon, 24 Jan 2022 15:53: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 C0320C047CC6; Mon, 24 Jan 2022 11:59: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 5DD1C60B43; Mon, 24 Jan 2022 19:59:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 712F6C340E5; Mon, 24 Jan 2022 19:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054349; bh=cp+p/t25XdZb2rsecPqcVi9U8jj0FyYDOxIhELjcxZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t2PGzIoNoh7QE9x6r3fUnrM/7VQ7B8ad/WGUOLudLrpllhBx8y8kFP7bImAk+A1r0 OXbgEzba/UNiP50ws5xs37M6WliEYkxF3/x8Dsffp8+7pdAfqBZKqw+Idio+iUJ8AF jrDV0PWzTq89baQ2OhVu1LQV85wrWlgnYklPQWUw= 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.10 327/563] crypto: jitter - consider 32 LSB for APT Date: Mon, 24 Jan 2022 19:41:32 +0100 Message-Id: <20220124184035.742929596@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- crypto/jitterentropy.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crypto/jitterentropy.c b/crypto/jitterentropy.c index 6e147c43fc186..37c4c308339e4 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BADEC35276 for ; Mon, 24 Jan 2022 21:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344034AbiAXV0k (ORCPT ); Mon, 24 Jan 2022 16:26:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391192AbiAXUrD (ORCPT ); Mon, 24 Jan 2022 15:47: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 09341C0424D8; Mon, 24 Jan 2022 11:57: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 80781B81218; Mon, 24 Jan 2022 19:57:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FDFBC33DA0; Mon, 24 Jan 2022 19:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054250; bh=mMVMuisXCIt+zCi8F5XYc+fsmSAixmNaldXMRbfRe4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TU/o+f6rnXqlsgW1HlLNttZdlrrgw1ptwsndQYtQ3t4OlPardNnFSaRTgtNl8Zl35 mxhGQojMAp3tABAGz0zIPRURJ7ZK57LOqOXLVCJuo4pUBUILo0gI5SyxHUp9Cf9UZ3 YPKDJsbCs1UlEmfRsW74b49rKq1i8mh6Q1uyNUa8= 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.10 328/563] mwifiex: Fix skb_over_panic in mwifiex_usb_recv() Date: Mon, 24 Jan 2022 19:41:33 +0100 Message-Id: <20220124184035.773561830@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D8FEC4167E for ; Mon, 24 Jan 2022 20:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380658AbiAXUQl (ORCPT ); Mon, 24 Jan 2022 15:16:41 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53960 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348223AbiAXT5e (ORCPT ); Mon, 24 Jan 2022 14:57: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 E493360B56; Mon, 24 Jan 2022 19:57:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0CB3C340E5; Mon, 24 Jan 2022 19:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054253; bh=cN3Y0NOmEgjX6lY6HpwrG6edABhYWBCKcpqZwy82Zp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rsnaQV913iIOPQKVZvUWai+Mb8I2cYfqYGyugZLpNRV/eDlHqopS69BYadCsbgKfR e0TnhAHHTMoIggt8k7PhxDnGbgZO8DacR2loS98g7m3NqZecKMZSGRFnYdr78DKUUq NLJ5zFTXPmTXKLaKg+/Q4zSm39LKBQ7r1tzZPVeY= 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.10 329/563] rsi: Fix use-after-free in rsi_rx_done_handler() Date: Mon, 24 Jan 2022 19:41:34 +0100 Message-Id: <20220124184035.812021706@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 d881df9ebd0c3..7f34148c7dfe5 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70571C43219 for ; Mon, 24 Jan 2022 20:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380532AbiAXUQ1 (ORCPT ); Mon, 24 Jan 2022 15:16:27 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53998 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348009AbiAXT5h (ORCPT ); Mon, 24 Jan 2022 14: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 F2D1560B89; Mon, 24 Jan 2022 19:57:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C99D1C340E5; Mon, 24 Jan 2022 19:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054256; bh=Jf2jqJkMT9XhVYOHueT6/brMJFdC5+zm2vIMbJgJbm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tQ094Jerhvr+HKZqW4n6/OlG1g2wvAWJjQKCDB6cqCap7HJh4L1KFm6wKJXay8zHX qUrth/yqloe0HakUXteEO4JRJz6xjzGfKv6UlG6ouKwc2PJWUbv5UdjJWNPQ5gvaBO 75Igzt7bmG7EVhAM4PnfFyb95k8xxEIiOx7ElTb4= 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.10 330/563] rsi: Fix out-of-bounds read in rsi_read_pkt() Date: Mon, 24 Jan 2022 19:41:35 +0100 Message-Id: <20220124184035.841947926@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8c638cfeac52f..fe8aed58ac088 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 7f34148c7dfe5..11388a1469621 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -328,7 +328,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 8702f434b5699..ad88f8c70a351 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF53FC43219 for ; Mon, 24 Jan 2022 21:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455911AbiAXVgo (ORCPT ); Mon, 24 Jan 2022 16:36:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391733AbiAXUs3 (ORCPT ); Mon, 24 Jan 2022 15:48: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 4D677C0424F9; Mon, 24 Jan 2022 11:57: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 E21A460916; Mon, 24 Jan 2022 19:57:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B421EC340E5; Mon, 24 Jan 2022 19:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054259; bh=yVqrQMm+dBFHy3tLs5xHzr01Bu1+kQu+9Yzb3HWeDUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XkBvo8EOVUpUms/CDuHFD8cqaW6VnDlmcWTlKmw+s2ZMfIfDJh5x6D4IPUShoO3/r Ku/KgZHk3fiWLzQCbYcknHN06d5Z+ha168/EMunviQI4lGWivFvEccf634BnJnM3BP TZwQr+MkIGiBiVfBZjecMW6aGX763DX81SyLktX8= 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.10 331/563] ath11k: Avoid NULL ptr access during mgmt tx cleanup Date: Mon, 24 Jan 2022 19:41:36 +0100 Message-Id: <20220124184035.873094415@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 18e841e1a016d..cc9122f420243 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 @@ -3883,23 +3884,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; } @@ -3908,17 +3918,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; } @@ -3933,6 +3936,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69F0BC433EF for ; Mon, 24 Jan 2022 20:17:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380560AbiAXUQ3 (ORCPT ); Mon, 24 Jan 2022 15:16:29 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54130 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354759AbiAXT5o (ORCPT ); Mon, 24 Jan 2022 14:57: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 251CE6100F; Mon, 24 Jan 2022 19:57:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE3B4C340E5; Mon, 24 Jan 2022 19:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054262; bh=DBMqJKBAA5+Sv3fdAUDEfa1IUaWR+nEpjs6K5wVVVVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RcN6CYYKgMgZ+090ZViMdlGv/c0zyiqsYbBOB1HIuNsPgD5AAV/vP0CXFtcHoKmQO fdRnaQAjMGnfvhk5goQ1ePsSxf1lbse7H9D/UHFebhQjX3YctHHtlHWzbMlRuDvvDu tCR8esSp0FdIGbylOpa/Pryc2zKXUKEJyLn6eJe8= 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.10 332/563] media: venus: avoid calling core_clk_setrate() concurrently during concurrent video sessions Date: Mon, 24 Jan 2022 19:41:37 +0100 Message-Id: <20220124184035.903470031@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../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 63095d70f8d82..710f9a2b132b0 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -147,14 +147,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; } @@ -203,14 +201,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, @@ -237,8 +233,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 @@ -263,17 +260,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) @@ -960,13 +959,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; @@ -982,7 +981,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 @@ -1006,17 +1004,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68693C4167B for ; Mon, 24 Jan 2022 21:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452749AbiAXV03 (ORCPT ); Mon, 24 Jan 2022 16:26:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358721AbiAXUtA (ORCPT ); Mon, 24 Jan 2022 15:49: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 413C0C04189D; Mon, 24 Jan 2022 11: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 F015BB8123A; Mon, 24 Jan 2022 19:57:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1080FC340E5; Mon, 24 Jan 2022 19:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054265; bh=pDLLvoeU36LjGUQLKpr+514zihBBhyi8aheoZQjcDAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H1+ab6hdO/5118LX4aroI/nou7K4IN32g0R57X+jhMUAH8XfC1A2dTbqckKsAl2IK 9rAzNov7cjMYO3+VR98aBwvxySIAvkAbRuYa6O7tSVg04JcnkDfeNiIVl6yOlXNFom 4cshDQSjmgAW7xOVwvY2qGSsEgYpJml/d54V0p0Y= 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.10 333/563] ACPI / x86: Drop PWM2 device on Lenovo Yoga Book from always present table Date: Mon, 24 Jan 2022 19:41:38 +0100 Message-Id: <20220124184035.942065856@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 bdc1ba00aee9f..baaa44edc9441 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 839DFC43217 for ; Mon, 24 Jan 2022 20:17:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380586AbiAXUQb (ORCPT ); Mon, 24 Jan 2022 15:16:31 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54256 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344741AbiAXT54 (ORCPT ); Mon, 24 Jan 2022 14:57: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 44288601B6; Mon, 24 Jan 2022 19:57:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 208EDC340E5; Mon, 24 Jan 2022 19:57:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054268; bh=71nH87Z6BVAnpSiRG8nwjV+jcRkslnkAPdOkkfFElvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k+sn+aJcOBYU4MZQGL3uQZ3gWmJk6jEkhwGNqtqGz6PrkZYcytsoLy+H/2+io7EHY R/Z++UO8vc5XjVkt1ZRfaa8WI+vfBQbOhulBWPKwO0tUCfkAw4iHJ30rpbBYdIiG0A 10HUFjFJPxBY53rZHTolH0pQWqsTljGeq6rMRogI= 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.10 334/563] ACPI: Change acpi_device_always_present() into acpi_device_override_status() Date: Mon, 24 Jan 2022 19:41:39 +0100 Message-Id: <20220124184035.980450043@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 e317214aabec5..5e14288fcabe9 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 baaa44edc9441..c6b0782dcced5 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 6ad3b89a8a2e0..0f5366792d22e 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -605,9 +605,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9FEFC4321E for ; Mon, 24 Jan 2022 20:17:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380625AbiAXUQf (ORCPT ); Mon, 24 Jan 2022 15:16:35 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:43908 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345767AbiAXT6A (ORCPT ); Mon, 24 Jan 2022 14:58: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 E87ACB8123A; Mon, 24 Jan 2022 19:57:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E4BAC340E5; Mon, 24 Jan 2022 19:57:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054271; bh=kTg8vEfwcwCp1q4N3Z9VVLQobA/kn/bNqh568ct1VJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TcfSJSCMf+vmxfYKtW9OTxYRVTbMv8VNnXo6llm1l3eOuzrIWn6I7zg4RrOX/7s3b O0dklI1QwNI/jKIf8cJQNn1DomajPi6ySoNTdpNsdPXlFTpyE5dBhIPFMFnZ68gzcG 2VFpyI9cda/DZPj6uPRNqatwnkgEBvJzPCy/Ef8c= 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.10 335/563] ACPI / x86: Allow specifying acpi_device_override_status() quirks by path Date: Mon, 24 Jan 2022 19:41:40 +0100 Message-Id: <20220124184036.019748581@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 c6b0782dcced5..91bbc4b6b8035 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 492B6C43219 for ; Mon, 24 Jan 2022 21:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452732AbiAXV0Y (ORCPT ); Mon, 24 Jan 2022 16:26:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358951AbiAXUtC (ORCPT ); Mon, 24 Jan 2022 15:49: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 836AAC0418AE; Mon, 24 Jan 2022 11:57: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 2557060BA1; Mon, 24 Jan 2022 19:57:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B6B4C340E5; Mon, 24 Jan 2022 19:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054274; bh=YnzVyzVF2gyXnAhBU7QgCxTIBetL5S/Hebevk1xn7XQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JRhkQZvZYQN4M77HDVr6lOp2RgeMfadFKWh9kNeKidMQ0SycGw9hoOB2fyAvKbfnm BU/hzYc/p4jRl84yaFSVyNMdrhRTaihdPBfvslssGKCV5uNuyBmPMbZsdoKRByXJaq eVcJPt3F90lK3n83vV8nnGfBsPJNUntWYxWn8874= 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.10 336/563] ACPI / x86: Add not-present quirk for the PCI0.SDHB.BRC1 device on the GPD win Date: Mon, 24 Jan 2022 19:41:41 +0100 Message-Id: <20220124184036.057066427@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 91bbc4b6b8035..3f9a162be84e3 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 630F5C433FE for ; Mon, 24 Jan 2022 21:37:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455755AbiAXVgF (ORCPT ); Mon, 24 Jan 2022 16:36:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381767AbiAXUtE (ORCPT ); Mon, 24 Jan 2022 15:49: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 1FDD9C0418B5; Mon, 24 Jan 2022 11:58: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 D1129B81218; Mon, 24 Jan 2022 19:57:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 110D1C340E5; Mon, 24 Jan 2022 19:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054277; bh=zFvwzpFQWjdF+o/sqOiU7jfu+9OjkMg1F/9RRwCH8ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r6S4ZmOoZ2Skam62FMmMvq5Ve+SVDfpydQ9YNQ7kIWZ/AFOa4x1Lis53XANpwp/d9 pPUt8ZmZgbIkoai6Y6dFz4Uz3nkmj93uqholSRZSu8tpcO1dAzTSJ1GQVTo0hQUFTm h8jXY4rTrqyxugOROtTrPce1ccEDZV1/1wb2OBo4= 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.10 337/563] arm64: dts: ti: j7200-main: Fix dtbs_check serdes_ln_ctrl node Date: Mon, 24 Jan 2022 19:41:42 +0100 Message-Id: <20220124184036.087679600@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 5832ad830ed14..1ab9f9604af6c 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi @@ -25,7 +25,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5BBEC433FE for ; Mon, 24 Jan 2022 21:16:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1449601AbiAXVPw (ORCPT ); Mon, 24 Jan 2022 16:15:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391837AbiAXUtE (ORCPT ); Mon, 24 Jan 2022 15:49: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 59EF2C08C5C9; Mon, 24 Jan 2022 11:58: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 202F4B81218; Mon, 24 Jan 2022 19:58:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A29BC340E5; Mon, 24 Jan 2022 19:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054283; bh=Wz1PAbR8+iIe/jPfTcBbjPHkLNB0RxFEi0fK8+Aossk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AeFBFi4pl93iNzNYFP9Np0pfo2Fwettz/xDrEDgY75zGuqqLODYQnKpp/jj/nDjVl yh7YM+rejpxojnsNfmHGRkiDU+7oVQ204txoP0CPHTlBQ9Hp8WXcwt4tb8XmRP6Zfl JsxDQRqYJ3UErsFIDOV2O3smFx9d0Mf5Br6KNsuk= 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.10 338/563] usb: uhci: add aspeed ast2600 uhci support Date: Mon, 24 Jan 2022 19:41:43 +0100 Message-Id: <20220124184036.118403513@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB8C3C433EF for ; Mon, 24 Jan 2022 21:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349076AbiAXVRU (ORCPT ); Mon, 24 Jan 2022 16:17:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1392150AbiAXUue (ORCPT ); Mon, 24 Jan 2022 15:50: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 71CDFC0354A8; Mon, 24 Jan 2022 11:58: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 39330B8119D; Mon, 24 Jan 2022 19:58:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50189C340E5; Mon, 24 Jan 2022 19:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054287; bh=lCWF6HsuBdeUK8uQomQA0sJreFc3+PyumZ9acFwY7Tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oSbt5tt+tN/W26FnLsLZ4XQPhdUKw+rMFP8OL6AND9xiZ8ZUI0cGs2E8raQP9AFwG UWBLTevwzIrTRWCqnUZ6MuUXjHvxNXoakJ9rR4tefNtMdQyuvtWoBhrSZ3l2CA6I+v htMSE5j5KIA5iTGDxaVgIzoq2sZAPF0Trg/Ucrrw= 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.10 339/563] floppy: Add max size check for user space request Date: Mon, 24 Jan 2022 19:41:44 +0100 Message-Id: <20220124184036.150834402@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 eb4f841902aee..aaee15058d181 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3169,6 +3169,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) { @@ -3198,7 +3200,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03292C433FE for ; Mon, 24 Jan 2022 21:28:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452697AbiAXV0O (ORCPT ); Mon, 24 Jan 2022 16:26:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1392299AbiAXUvB (ORCPT ); Mon, 24 Jan 2022 15:51: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 47D93C054301; Mon, 24 Jan 2022 11: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 ams.source.kernel.org (Postfix) with ESMTPS id E2EB8B8119D; Mon, 24 Jan 2022 19:58:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 482BFC340E7; Mon, 24 Jan 2022 19:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054289; bh=zfEYjZPtuQKLUiQd334jkr6Im+SBhh1cinJVAghTffk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iGk+uYmvtZFi1jsS+ey3VHhnNu0DE0Nnt2bWheyfr5U9GD4t/jYuO/1HCOhI9qeyx OYIvsq1BHZEKc6LGDth1U1mw2Pd58lUAHp1FD6sSrPp6pGGjcAB4q7BXGLVJqzuhWC lx8riCaBkEx0VBo/KpguFiImrO7RqghkHzTdWOzo= 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.10 340/563] x86/mm: Flush global TLB when switching to trampoline page-table Date: Mon, 24 Jan 2022 19:41:45 +0100 Message-Id: <20220124184036.186221874@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 798a6f73f8946..df3514835b356 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 3313bffbecd4d..1a702c6a226ec 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E730BC43219 for ; Mon, 24 Jan 2022 20:17:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380609AbiAXUQe (ORCPT ); Mon, 24 Jan 2022 15:16:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54610 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359280AbiAXT6O (ORCPT ); Mon, 24 Jan 2022 14:58: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 2E9C160916; Mon, 24 Jan 2022 19:58:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 111CFC340EA; Mon, 24 Jan 2022 19:58:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054292; bh=WQCIdyoCBqzT1RiVCy6TIWZuU6QVvUeH/y9HpzGEJrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wLTuJfk0AksQz20HkkHE+WIfjZQFjixYTiWjqGjJ7ysQiTnpVWxZtCsrHB5XK9e9e fMxW0dBa+4FtNvIExqIfbr9/FCNUyYeeg2V3LrH2MeuoMByL2KZg/7Zyt0K5nan3hD g2bFzW2/47g5FncWQI0vZGNRiQZBF9dCs/8vE2J0= 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.10 341/563] drm: rcar-du: Fix CRTC timings when CMM is used Date: Mon, 24 Jan 2022 19:41:46 +0100 Message-Id: <20220124184036.217959039@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 1b9738e44909d..065604c5837de 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 @@ -298,10 +299,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); @@ -831,6 +837,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)) @@ -838,9 +845,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6332C43217 for ; Mon, 24 Jan 2022 21:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452676AbiAXV0I (ORCPT ); Mon, 24 Jan 2022 16:26:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1392314AbiAXUvC (ORCPT ); Mon, 24 Jan 2022 15:51: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 9A1DDC054310; Mon, 24 Jan 2022 11:58: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 3919260B43; Mon, 24 Jan 2022 19:58:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1487FC340EA; Mon, 24 Jan 2022 19:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054295; bh=ixHiAAhTeUJ3CTD9gpQ0BpOp0z4g1efWh7BF2ublt54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=upMIpHhkNmWpMaX6NU7iZtLVorcDJt4SdV71UbpnYQSAlzxC9LtXsec5H81r9tfKk MT0TKK8mKXiXHKucX0nGuXy8KtGx9QOaMjtBoH51wt3+9+nwt4LOBvsWpvv24obIns RyKllc98E57kE2z2b0GI0jnaSW/3GKzsaP3u7WPk= 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.10 342/563] media: uvcvideo: Increase UVC_CTRL_CONTROL_TIMEOUT to 5 seconds. Date: Mon, 24 Jan 2022 19:41:47 +0100 Message-Id: <20220124184036.250507367@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a3dfacf069c44..c884020b28784 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -183,7 +183,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 839DDC43217 for ; Mon, 24 Jan 2022 20:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380642AbiAXUQj (ORCPT ); Mon, 24 Jan 2022 15:16:39 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42774 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245216AbiAXT6W (ORCPT ); Mon, 24 Jan 2022 14:58: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 1CF86B811F9; Mon, 24 Jan 2022 19:58:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F10AC36AEB; Mon, 24 Jan 2022 19:58:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054298; bh=qDhR74ah9joXahceyFh9WO/6szkMtojGpRt+7xDLEdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P0/EHm9o5X2igDsYwgKZ/QNcG5/pVIn2Farmc7d2o+QjSkHnwhNk+rSGtgA+Aw+WG 5z00aryneVgdqTGzN7FnglUlOPhXihJ18ed0Rq/rIncQgwcypjXnLxcwbtBtgBY+vh zFplSCtfaYLWKy51kglZMB29BSKSJW+QKxMF1t/4= 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.10 343/563] media: rcar-vin: Update format alignment constraints Date: Mon, 24 Jan 2022 19:41:48 +0100 Message-Id: <20220124184036.289671836@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 3e7a3ae2a6b97..0bbe6f9f92062 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -175,20 +175,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4225EC4167B for ; Mon, 24 Jan 2022 21:27:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450326AbiAXVUP (ORCPT ); Mon, 24 Jan 2022 16:20:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1392365AbiAXUvE (ORCPT ); Mon, 24 Jan 2022 15:51: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 98AFBC054325; Mon, 24 Jan 2022 11:58: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 577B5B8119D; Mon, 24 Jan 2022 19:58:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AD0BC340E5; Mon, 24 Jan 2022 19:58:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054302; bh=JjoTPxcrsm13yYDz2X0aCGOrakWj/cvM4DjQzFBa75A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uEvl33PG4PPhjxI0aEAMSxO9ikEBrIAAZuf3SNDRDbIh9df/u5cbxO3NYbiN24y6s zjic6cIYomUy+OTLpXJPA4R/5jk4YUEHeSyGGJIpqt2UkMF/y9iWss0cqEPDLuQ1rE bUyCoKwojDCLiifVYZ+Zm6rotJzy7fPsJAWEWceQ= 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.10 344/563] media: saa7146: hexium_orion: Fix a NULL pointer dereference in hexium_attach() Date: Mon, 24 Jan 2022 19:41:49 +0100 Message-Id: <20220124184036.320287570@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CC34C4707F for ; Mon, 24 Jan 2022 20:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383186AbiAXU0z (ORCPT ); Mon, 24 Jan 2022 15:26:55 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54838 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347509AbiAXT6b (ORCPT ); Mon, 24 Jan 2022 14:58: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 D086660B02; Mon, 24 Jan 2022 19:58:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA024C340E5; Mon, 24 Jan 2022 19:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054305; bh=aXgAlWjFhuTYaGo0IQrs5NxFaBkHUtQAgDjh1OBwC9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QuN7KRleVxvKtb7ekSR5PDdUAomPSZdo42sXLDwVXaLHqz9UnLfGECrrvhNX+PglG +I9EIGTRC3QbanLPz7HQhvTKTinlpZZONvvtGkw6RP7eNseoxte+2Lv3zIvFD5Y5eh f1g/qEnAdfQ3HQqXOweuH4DoT7b1R+HLqsc9rCO8= 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.10 345/563] media: m920x: dont use stack on USB reads Date: Mon, 24 Jan 2022 19:41:50 +0100 Message-Id: <20220124184036.351610038@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 404F6C433EF for ; Mon, 24 Jan 2022 21:24:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376387AbiAXVTf (ORCPT ); Mon, 24 Jan 2022 16:19:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1392375AbiAXUvF (ORCPT ); Mon, 24 Jan 2022 15:51: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 4F0E7C05432D; Mon, 24 Jan 2022 11:58: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 dfw.source.kernel.org (Postfix) with ESMTPS id E218861028; Mon, 24 Jan 2022 19:58:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B55FFC340E5; Mon, 24 Jan 2022 19:58:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054308; bh=ogkFxolfQWRQxJZn/Tdu72Ih6tdiWRo2xRIJQtxu78g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=abD5uZA+mkgD4DhYARoDRt+1Zad14ECoS1kZWmrSl3yMShD3xU3sBpAaWRTA669J3 Vi2WljSFa7w1j7Iz2f3vSliPsjGy6jGfBRjE6jqQ7/nk38xVO2U8AWAuD+zej6eFA8 ZF1bCkdXfWxehqOCNLanKVxQDDEcvSpClz11tpr0= 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.10 346/563] thunderbolt: Runtime PM activate both ends of the device link Date: Mon, 24 Jan 2022 19:41:51 +0100 Message-Id: <20220124184036.381000032@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/thunderbolt/acpi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/thunderbolt/acpi.c b/drivers/thunderbolt/acpi.c index b5442f979b4d0..6355fdf7d71a3 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50622C4321E for ; Mon, 24 Jan 2022 21:27:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450388AbiAXVUZ (ORCPT ); Mon, 24 Jan 2022 16:20:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441805AbiAXUvl (ORCPT ); Mon, 24 Jan 2022 15:51: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 CB46DC054330; Mon, 24 Jan 2022 11:58: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 89869B810AF; Mon, 24 Jan 2022 19:58:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2B58C340E5; Mon, 24 Jan 2022 19:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054311; bh=hhcJmuN2kWlMk96NPFUrqTDWUoSgBnttal2l50VDvZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vq0TaAaNCBawkhTbvvp8KsOyLd+Y4m1fZcklpGGBp8/2xJr6V1nXscs5YIXmbcugn rnfdNuoswE4d3J1r63BvZQjcqFcwAE7ak88qJFPXBD70jl7J70G/36Bf5ssy2n/vEK 8IgYmZh+yfGW7xyjn1HpuhxYHx69tm4NDc1vWZGc= 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.10 347/563] iwlwifi: mvm: synchronize with FW after multicast commands Date: Mon, 24 Jan 2022 19:41:52 +0100 Message-Id: <20220124184036.411665606@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- .../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 81cc85a97eb20..922a7ea0cd24e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1739,6 +1739,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 @@ -1748,6 +1749,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44D25C35272 for ; Mon, 24 Jan 2022 20:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383167AbiAXU0y (ORCPT ); Mon, 24 Jan 2022 15:26:54 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44306 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347497AbiAXT6k (ORCPT ); Mon, 24 Jan 2022 14: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 91783B80FA1; Mon, 24 Jan 2022 19:58:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC051C340E5; Mon, 24 Jan 2022 19:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054317; bh=9Df3ZJ+2b4VOrSeXn0WahFNQGHuymqCiY1adXrjqDfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AijO7NF/AVB/IWqp5HTh0IwZnGmnsmELso+sUzQ0F7mvE2UaGtrm1ciOYAdJ8d/Tc IJ4txUkQPGAcHL2EMnQKOusgcSUOSGO+cxcHFagitBXul3KqXDbiX7CRotXnaI3Ur/ 927CSLflZv1HCwPW4cPxQxr/8ek+tvI5wa4+voBw= 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.10 348/563] iwlwifi: mvm: avoid clearing a just saved session protection id Date: Mon, 24 Jan 2022 19:41:53 +0100 Message-Id: <20220124184036.441853434@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a633ad5f8ca4e..3f081cdea09ca 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c @@ -1166,15 +1166,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); @@ -1188,6 +1183,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); spin_unlock_bh(&mvm->time_event_lock); =20 --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 693EEC433EF for ; Mon, 24 Jan 2022 21:37:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455445AbiAXVfZ (ORCPT ); Mon, 24 Jan 2022 16:35:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441922AbiAXUwX (ORCPT ); Mon, 24 Jan 2022 15:52: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 D82F0C054334; Mon, 24 Jan 2022 11:58: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 7C49AB810AF; Mon, 24 Jan 2022 19:58:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1621C340E5; Mon, 24 Jan 2022 19:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054320; bh=4S6W1uH/DBQDhbPbfljwz+7E5vLaJ+gnyilWru1NEOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mzIE8TiMxPOTMPYD7D4ulXsuOU8N50Xens2vCfWBdoNCbRd8KyU2mAUxUqy4GGnLw mtnVRrrovb+IlPGpddBn0bt1akFb6Fy3aNrqYC2sUbtfjmp/U/GqklSjFqED2eShZy 53I6Zzey5PbGmZn4/0cQTVDv+mkR3X9mwM8C3r78= 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.10 349/563] ath11k: avoid deadlock by change ieee80211_queue_work for regd_update_work Date: Mon, 24 Jan 2022 19:41:54 +0100 Message-Id: <20220124184036.472877665@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 acf1641ce88fd..53846dc9a5c5a 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -5422,7 +5422,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D4E0C43219 for ; Mon, 24 Jan 2022 21:27:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450687AbiAXVVL (ORCPT ); Mon, 24 Jan 2022 16:21:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441924AbiAXUwX (ORCPT ); Mon, 24 Jan 2022 15:52: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 47EDCC054336; Mon, 24 Jan 2022 11: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 D9D6C60B43; Mon, 24 Jan 2022 19:58:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2ADFC340E5; Mon, 24 Jan 2022 19:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054323; bh=HBx2Z0bo2vlrE7hqQN6Os7uEULxdugf4B9uv+P7rybc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=alcG0En+VMtFGIBsXGjRtdHapGd6w2so9qAJzLz5j+SKLWCG9uEUg5ET/CA2VnGq4 c/PlOhDJHqw2BpI5mG7LjAJlXENiSCAjitICQXcYsdQuzwrhEO0iqdtvq8e4jgHQNl FfUpnPHl0puv+8Y3WXjFPipb1iBx8O6UwHxMDb8k= 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.10 350/563] ath10k: Fix tx hanging Date: Mon, 24 Jan 2022 19:41:55 +0100 Message-Id: <20220124184036.511935255@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 1fc0a312ab587..5f67da47036cf 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 aefe1f7f906c0..f51f1cf2c6a40 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC7F1C433F5 for ; Mon, 24 Jan 2022 21:27:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451342AbiAXVWm (ORCPT ); Mon, 24 Jan 2022 16:22:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442007AbiAXUwe (ORCPT ); Mon, 24 Jan 2022 15:52: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 C0732C03540E; Mon, 24 Jan 2022 11:58: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 7D580B81218; Mon, 24 Jan 2022 19:58:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABF00C340ED; Mon, 24 Jan 2022 19:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054326; bh=+lpXt2QvzgIYVVxYWVN0oM5QZUSO2Opgpdlmv+PCAI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0CckU9rOTQfJekJFNT0JgZCHv4h9MnsJ/PcKu8cXijyJ/oBiub4FPfJ5yLpIDyl6C o5dsUyori/6GsaHEhvLAwWkWTFQ9mv94HdYdHiC95fPK/HwkS5c8s4a2ZNPrEtrbOA Dl4+lK4e8llBzijiMCYp05FB6LB2bkuyWGxhMnEs= 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.10 351/563] net-sysfs: update the queue counts in the unregistration path Date: Mon, 24 Jan 2022 19:41:56 +0100 Message-Id: <20220124184036.549398330@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 af59123601055..99303897b7bb7 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -1804,6 +1804,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F40F7C4167B for ; Mon, 24 Jan 2022 21:28:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450794AbiAXVVZ (ORCPT ); Mon, 24 Jan 2022 16:21:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359040AbiAXUxE (ORCPT ); Mon, 24 Jan 2022 15:53: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 B2536C02B862; Mon, 24 Jan 2022 11:58: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 AFA9560FEA; Mon, 24 Jan 2022 19:58:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B00EC340E8; Mon, 24 Jan 2022 19:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054329; bh=FXSw/S6ooWsN7m2aISlJ2oWew5BJRMgPDCbiE4oQ4RI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nz6yw2XRc0mGJLLS1kPZegysgogatvIoxwvTy6YG8DlCQtTuafxPJIJmUi5avvEbZ iqdCFwJG01xQFlrxLDp8u1EQ2iX0opwhRSl4dYpmrtWgesC/ubNn/7DxjGguz0WU7a LqjPQ1/7uTckJaRF8fiwWT2fxIUtoevI87M/2448= 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.10 352/563] net: phy: prefer 1000baseT over 1000baseKX Date: Mon, 24 Jan 2022 19:41:57 +0100 Message-Id: <20220124184036.580028364@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8d333d3084ed3..cccb83dae673b 100644 --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c @@ -161,11 +161,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28729C433F5 for ; Mon, 24 Jan 2022 21:27:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451098AbiAXVWH (ORCPT ); Mon, 24 Jan 2022 16:22:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359026AbiAXUxF (ORCPT ); Mon, 24 Jan 2022 15:53: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 0F841C02B866; Mon, 24 Jan 2022 11:58: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 5A791B8119D; Mon, 24 Jan 2022 19:58:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75E6FC340E5; Mon, 24 Jan 2022 19:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054332; bh=9LNPEI3vU+GgQ06ospyNK/ywpFLeKxPrJ2gMNjRDkLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bWdeKoR4ZEYlXT/6Y9vLycjzqwF8i5xo2UI5O1GpWsSq5VLr2heDoECL+TkyYi7de uGupQhC+WfduX0SBVlU5pOP+FlYIOX/gt8542xMXnD2gaitTJ7iY05FP8QgeUX268N JWIz9CKhdghSatzSWyLIYQnHWh1lAqi8tfGVxUO8= 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.10 353/563] gpio: aspeed: Convert aspeed_gpio.lock to raw_spinlock Date: Mon, 24 Jan 2022 19:41:58 +0100 Message-Id: <20220124184036.620118465@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 b966f5e28ebff..e0d5d80ec8e0f 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 @@ -719,7 +719,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); @@ -733,7 +733,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; } @@ -859,7 +859,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); @@ -919,7 +919,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; } @@ -930,13 +930,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; } @@ -1018,7 +1018,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) { @@ -1039,7 +1039,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); @@ -1063,7 +1063,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) { @@ -1077,7 +1077,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); @@ -1151,7 +1151,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B4B5C4167D for ; Mon, 24 Jan 2022 20:18:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350980AbiAXUSB (ORCPT ); Mon, 24 Jan 2022 15:18:01 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45986 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353190AbiAXUBC (ORCPT ); Mon, 24 Jan 2022 15:01: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 A33E8B8122A; Mon, 24 Jan 2022 20:01:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9175C340E5; Mon, 24 Jan 2022 20:00:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054459; bh=NsNmxlzJcp4bHdt1JVI79chzoIVKauwC5RQte6uzHu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IIwQOCuU8/Q7IifiwSRKkHxsWJyta6kyLJkZBrcR2s0YqWDpdMrlQhH41ViEp8ZX0 EtjlVSqwW5ponDUp9IBK5wZBl8yH3Mhs6NF2lpygDuJiN1aQlP2JJDIiP1KjwKE0s9 NAd1kRwvqW9DnSVyRkNdRv1mYruiLGDayAIr1jKQ= 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.10 354/563] selftests/ftrace: make kprobe profile testcase description unique Date: Mon, 24 Jan 2022 19:41:59 +0100 Message-Id: <20220124184036.659126137@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE849C433EF for ; Mon, 24 Jan 2022 21:27:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451038AbiAXVWA (ORCPT ); Mon, 24 Jan 2022 16:22:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359214AbiAXUxG (ORCPT ); Mon, 24 Jan 2022 15:53: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 76749C09540C; Mon, 24 Jan 2022 11:59: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 329FDB811F3; Mon, 24 Jan 2022 19:59:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5174DC340E5; Mon, 24 Jan 2022 19:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054356; bh=Wu4PxbI8hIbDonZ3zmKT+l+rtS8XwPQg/vt8SwwVPAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mMH+uGWDoRbUkk6xMsrWNty5SLYX/CiUinAQpOan3Fly9ECoUYdffF0ULGnzvrz5I Yrsvr/1d6zqxhHV7Eiw5P/ksvZ+QzsUUMFoiNRbw1EAd2j6Q4G/ii+dpUFZBCW7QkV CYZposg0ufbDfaAYZsYiwO33oVkdCQohHCCCgz8c= 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.10 355/563] ath11k: Avoid false DEADLOCK warning reported by lockdep Date: Mon, 24 Jan 2022 19:42:00 +0100 Message-Id: <20220124184036.696048005@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 9904c0eb75875..f3b9108ab6bd0 100644 --- a/drivers/net/wireless/ath/ath11k/hal.c +++ b/drivers/net/wireless/ath/ath11k/hal.c @@ -991,6 +991,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] + @@ -1237,6 +1238,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; @@ -1256,6 +1275,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: @@ -1270,6 +1291,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 1f1b29cd0aa39..5fbfded8d546c 100644 --- a/drivers/net/wireless/ath/ath11k/hal.h +++ b/drivers/net/wireless/ath/ath11k/hal.h @@ -888,6 +888,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDF4AC2BA4C for ; Mon, 24 Jan 2022 20:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380886AbiAXURB (ORCPT ); Mon, 24 Jan 2022 15:17:01 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44998 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359570AbiAXT7v (ORCPT ); Mon, 24 Jan 2022 14:59: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 C7439B8121A; Mon, 24 Jan 2022 19:59:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4ADDC340E5; Mon, 24 Jan 2022 19:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054388; bh=7iTssmaqpC1K/Xqd0MdRNMXEmtIL7JRZogdBpi/rGDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MFmm58sKhK/Ejz9tehtTAhu/DoSMHgHGKiwD/5hQXzG2xYf1GJqwm/oit3NX6mb23 HDMkvZP4GTpiQ0gwsDTuyB0tRgvNEnC/5tWhP3/fHiAH127Z80/vsxMxY0IRmxQcng P2cYyPQOUWz62vKzoVQ4qs0fFfO9+9zlZ6sBEiqs= 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.10 356/563] x86/mce: Allow instrumentation during task work queueing Date: Mon, 24 Jan 2022 19:42:01 +0100 Message-Id: <20220124184036.726854688@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 14b34963eb1f7..34fffffaf8730 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1443,6 +1443,14 @@ noinstr void do_machine_check(struct pt_regs *regs) if (worst !=3D MCE_AR_SEVERITY && !kill_it) 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. */ @@ -1468,6 +1476,9 @@ noinstr void do_machine_check(struct pt_regs *regs) if (m.kflags & MCE_IN_KERNEL_COPYIN) queue_task_work(&m, msg, kill_it); } + + instrumentation_end(); + out: mce_wrmsrl(MSR_IA32_MCG_STATUS, 0); } --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF62EC35270 for ; Mon, 24 Jan 2022 20:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380932AbiAXURV (ORCPT ); Mon, 24 Jan 2022 15:17:21 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42774 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344007AbiAXUAY (ORCPT ); Mon, 24 Jan 2022 15:00: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 33BBDB81218; Mon, 24 Jan 2022 20:00:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56124C340E5; Mon, 24 Jan 2022 20:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054421; bh=ehT1W02LPHHbQC4CpSx98mgh4CIOnT+AKMKHij0IAzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CldPozz/hgOS6PkcXNiifqofcJPm2nXcSNZadRaMqTLhswYJE3HR7GzjwiA6E8mCt tA0BdMUR2QYy2HaTDntfQU7iQB0vNz4SxQqEzRy8QNFx0vjlSUgrWSNXpobI6fX9CP UkL7zomYVGgGRU5zOdOqPe9x/rUyGF5BvWvLT30Q= 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.10 357/563] x86/mce: Mark mce_panic() noinstr Date: Mon, 24 Jan 2022 19:42:02 +0100 Message-Id: <20220124184036.765131336@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 34fffffaf8730..64d8a96a2bf1e 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -295,11 +295,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) { /* @@ -314,7 +320,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 */ @@ -352,6 +358,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CBD8C35270 for ; Mon, 24 Jan 2022 20:29:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382904AbiAXU03 (ORCPT ); Mon, 24 Jan 2022 15:26:29 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44306 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353131AbiAXUAp (ORCPT ); Mon, 24 Jan 2022 15:00: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 32398B80FA1; Mon, 24 Jan 2022 20:00:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62427C36AEB; Mon, 24 Jan 2022 20:00:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054440; bh=zA1vUZ3qOrUG9ozfGNzjuB1i+/p5YXJFjtVkvmVp47k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jjc6107ueyZgwc+kXKR/GMxc9dzpNU9Ab4vWHeDAcown23Gyl3OBVp0XJsfkZX+G9 FZ31SRKUhsb76bqTFi+OK8sqB+EqZo33Emc7fECv+kyWuRZPXGx5d2NA9jR0uVIA55 6GQYB9RMSs0pLLFQQmrfbmFs5Md/VgqijLz8wNL8= 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.10 358/563] x86/mce: Mark mce_end() noinstr Date: Mon, 24 Jan 2022 19:42:03 +0100 Message-Id: <20220124184036.798384907@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 64d8a96a2bf1e..2a608f0819765 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1070,10 +1070,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; @@ -1117,7 +1120,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 /* @@ -1132,6 +1136,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0785C4321E for ; Mon, 24 Jan 2022 21:37:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455110AbiAXVep (ORCPT ); Mon, 24 Jan 2022 16:34:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385536AbiAXU5G (ORCPT ); Mon, 24 Jan 2022 15:57: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 ECE0DC054851; Mon, 24 Jan 2022 12:00: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 8DC35611D1; Mon, 24 Jan 2022 20:00:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 579D8C340E7; Mon, 24 Jan 2022 20:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054444; bh=nnmFS4snQfH4IgxLfKCjV44SRCnnUshUmD3/lNSIPSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oDQH0Ub3S6f4qL3S1G5b7Ec6n9X/CeNnWlny9i3Z2ODSrImmxC+TgV61omvmaizAU iHQLPrTt+xpnAtEWPqZsZPMtvcFPb6OCedmLSsfvrPmmiHEZF3gdx7tbpVxmeeso7p sRgk4XODxMJSiQ4RVMnQqRUZKV+hG2UCRr4kn5eo= 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.10 359/563] x86/mce: Mark mce_read_aux() noinstr Date: Mon, 24 Jan 2022 19:42:04 +0100 Message-Id: <20220124184036.829775354@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2a608f0819765..5cf1a024408bf 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -691,7 +691,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(msr_ops.misc(i)); --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53B10C43217 for ; Mon, 24 Jan 2022 20:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346756AbiAXURh (ORCPT ); Mon, 24 Jan 2022 15:17:37 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45662 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353139AbiAXUAv (ORCPT ); Mon, 24 Jan 2022 15:00: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 71DECB811F9; Mon, 24 Jan 2022 20:00:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77120C340E5; Mon, 24 Jan 2022 20:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054447; bh=kJ6hh66THiIfhZ/HNkX+wErjWOiFn8GVjT+3pv10txo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1yWMY47q+WsLE51sTCSeo7ciJAGLvBcC1eav1G2ahgyCXvtTQriHD85Y5ZpqO4+Kq VBMaGxn75NjMazKKkidjQXlaAba5zXUH9bbb62PPJbGbALJWlzBSKjXHpknzk7nnW/ OEJMth3JYpVeJ8EYT25COesUeig0BV/pU8z1GusY= 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.10 360/563] net: bonding: debug: avoid printing debug logs when bond is not notifying peers Date: Mon, 24 Jan 2022 19:42:05 +0100 Message-Id: <20220124184036.869521499@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 645c7cabcbe4d..e2e6a69adab4b 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1061,9 +1061,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 || @@ -1071,6 +1068,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65F71C4332F for ; Mon, 24 Jan 2022 21:29:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377015AbiAXV3c (ORCPT ); Mon, 24 Jan 2022 16:29:32 -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 S1443499AbiAXU5I (ORCPT ); Mon, 24 Jan 2022 15:57: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 A713EC054866; Mon, 24 Jan 2022 12:00: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 ams.source.kernel.org (Postfix) with ESMTPS id 63FC3B8122A; Mon, 24 Jan 2022 20:00:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77AF4C340E8; Mon, 24 Jan 2022 20:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054450; bh=twGCo6Va5F3vSA9YOP7NgbYkHKzZtHUGT0pyg9iWBIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q061FsHD2tbA8waY01+bt7dwRiPMZ3xblangEGXfpqHxPtJyEvtGjbo+kw4jIC/OZ nWh3uxpJloZpZfhrtB9u4o/xZAAPtxK23btqp1OjDmmxANK3jUyM68inCNIQfLrZMx m8q+czoYUDZ8R66eJdLS0Pt47MiVZCVQTJ8S9wFw= 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.10 361/563] bpf: Do not WARN in bpf_warn_invalid_xdp_action() Date: Mon, 24 Jan 2022 19:42:06 +0100 Message-Id: <20220124184036.899291970@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 706c31ae65b01..7fa4283f2a8c0 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -7921,9 +7921,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A407C433FE for ; Mon, 24 Jan 2022 21:27:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452231AbiAXVYW (ORCPT ); Mon, 24 Jan 2022 16:24:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354702AbiAXU5p (ORCPT ); Mon, 24 Jan 2022 15:57: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 314B0C05486B; Mon, 24 Jan 2022 12:00: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 C6C0A60B88; Mon, 24 Jan 2022 20:00:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A560BC340E5; Mon, 24 Jan 2022 20:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054453; bh=0+XfjOPAbLf9sTVRzvQ+1jNIKU4CH6CO3sXWF4+Cn78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ME5svfsQxlOfTrXJEnMUTsGGlsEjpl8wkVs9d36wzWpHX2UnC7l7dfINMPfcQo1i/ YzxFQq1/7F3i7FNnuwPrQ2oNaACDgyVpgIBsz7kZt6oWGtKZ0LuNGv7fNwZjmkiNMH u+wDZTPuKX9voJM8OVeLG+Ly5S4m8+Qk9P+9xZLc= 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.10 362/563] HID: quirks: Allow inverting the absolute X/Y values Date: Mon, 24 Jan 2022 19:42:07 +0100 Message-Id: <20220124184036.931107513@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 580d378342c41..eb53855898c8d 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -1288,6 +1288,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 fc56d53cc68bf..2ba33d708942c 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -345,6 +345,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D59DC4332F for ; Mon, 24 Jan 2022 20:18:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346639AbiAXURv (ORCPT ); Mon, 24 Jan 2022 15:17:51 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45938 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347434AbiAXUA7 (ORCPT ); Mon, 24 Jan 2022 15:00: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 84943B8122C; Mon, 24 Jan 2022 20:00:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0FE7C340E8; Mon, 24 Jan 2022 20:00:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054456; bh=WPTVkbAlftiPDcELrGcS+39e8k3c46GZhJ5lqBJBBQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LvcvEoSxSGcYRWBBCR1NM6KmVfxcMQb9e9UWIoxXrYX5tcMUoh4+rfKvxUkW7oV0v dpI3scQQWxf3sGRXMitDpAWJUXi2dz5BditzV/FQ08MMkKrJshxHxylPokQ8FvIY7W WbdzdkDY4mgB+yoDzTXHl6PaR2NV8fPt5+ZVHkw0= 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.10 363/563] media: igorplugusb: receiver overflow should be reported Date: Mon, 24 Jan 2022 19:42:08 +0100 Message-Id: <20220124184036.962768088@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DF2CC3526D for ; Mon, 24 Jan 2022 20:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380766AbiAXUQy (ORCPT ); Mon, 24 Jan 2022 15:16:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55680 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358273AbiAXT7V (ORCPT ); Mon, 24 Jan 2022 14:59: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 995BA60B43; Mon, 24 Jan 2022 19:59:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69E57C340E5; Mon, 24 Jan 2022 19:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054359; bh=Mmov4kXM/0WU3bh6vK5IbxHSy3H97/BMQnWmsVg6fm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LDhG/HCEdfzq1g5EX3iyT5513seI2/TyI8kg7XEwg/t6oJtYDpB1wcxLzEqRI9ZI0 /OICjauJmL5K8n/dmrHz7bGugg9X7VDM7Co/fmasvqOHE8qXLpDIaQljPP+kVSlcSQ eNfHVtiriLPMGS+XxwgjI5ZPs9DM8W9OJQ+64GkY= 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.10 364/563] media: saa7146: hexium_gemini: Fix a NULL pointer dereference in hexium_attach() Date: Mon, 24 Jan 2022 19:42:09 +0100 Message-Id: <20220124184037.002398444@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 d6531874faa65..8047e305f3d01 100644 --- a/drivers/media/common/saa7146/saa7146_fops.c +++ b/drivers/media/common/saa7146/saa7146_fops.c @@ -523,7 +523,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6DE8C4167E for ; Mon, 24 Jan 2022 21:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451019AbiAXVV6 (ORCPT ); Mon, 24 Jan 2022 16:21:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384555AbiAXUxH (ORCPT ); Mon, 24 Jan 2022 15:53: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 18526C095417; Mon, 24 Jan 2022 11:59: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 A9393611CD; Mon, 24 Jan 2022 19:59:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DE04C340E8; Mon, 24 Jan 2022 19:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054362; bh=VG1kD5DcqOtXZR9TY8TdK67T+wa/ynVIIQFX0eGJiCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZdBTVU2SarNGU6btRq3GAd3djc/m2wpRjN4WUU+Ug1EdyT8jXBOT27+mnCV+PcN3Q jt9JW78i405YOXMxPT9bBxyqYMMXWBL9McFG9ypjscnIf9ku5l2qwpGNO+vZTSOrTF GWqzs0HVcfjeenbFg1XN4VKSgvk+dOW2S7/EXw9k= 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.10 365/563] mmc: core: Fixup storing of OCR for MMC_QUIRK_NONSTD_SDIO Date: Mon, 24 Jan 2022 19:42:10 +0100 Message-Id: <20220124184037.039837909@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 1b0853a82189a..99a4ce68d82f1 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28F2DC2BA4C for ; Mon, 24 Jan 2022 20:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383045AbiAXU0p (ORCPT ); Mon, 24 Jan 2022 15:26:45 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53818 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348708AbiAXT7b (ORCPT ); Mon, 24 Jan 2022 14:59: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 85F276090B; Mon, 24 Jan 2022 19:59:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67295C340E5; Mon, 24 Jan 2022 19:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054365; bh=t663/92JMy5zMjLaJe1V6EEdgtY92TPBONg80JAqH8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qayc/WEN9psYlYUWyuH9erv2oKtgPL7EbLcTzFOdNQ9gjWQmuDSA13hSf0iyOE2YV zQBqiAlGmRDBGxnhPsVPg5RqNR+fFPoCoU96KevVagregXdqZkgDA7skJWI7zHHNf1 k4qjI5/cp1oWX/Hk0A8iFRqdlTlFzr79/AUHFpNs= 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.10 366/563] audit: ensure userspace is penalized the same as the kernel when under pressure Date: Mon, 24 Jan 2022 19:42:11 +0100 Message-Id: <20220124184037.079588334@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- kernel/audit.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/kernel/audit.c b/kernel/audit.c index d784000921da3..2a38cbaf3ddb7 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1305C433EF for ; Mon, 24 Jan 2022 20:24:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344466AbiAXUYF (ORCPT ); Mon, 24 Jan 2022 15:24:05 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44836 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348484AbiAXT7c (ORCPT ); Mon, 24 Jan 2022 14:59: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 03A60B811FB; Mon, 24 Jan 2022 19:59:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 601CEC340E5; Mon, 24 Jan 2022 19:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054367; bh=oNKfQZp6IYkR3zZ/vnCBN90qRflrO3WLuupod0LlapE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p9WitlsIe8Nu+1M5vlK6MdNUBeguSSy3bS6OU4mHL83muSvnT9F/uajUYJoXqJgr9 aNcztVL1AjBJgaZxdeFFS4MNZXFlweZSb6DeT5kKKuPuJrlQJy/HOeIAUyfDu1G9us TNZ+h3a2vFrMawQLl8hVqMIUXsSZvxDy1dUuoIAM= 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.10 367/563] arm64: dts: ls1028a-qds: move rtc node to the correct i2c bus Date: Mon, 24 Jan 2022 19:42:12 +0100 Message-Id: <20220124184037.119218640@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 13cdc958ba3ea..71858c9376c25 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts @@ -261,11 +261,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>; @@ -307,6 +302,15 @@ =20 }; =20 +&i2c1 { + status =3D "okay"; + + rtc@51 { + compatible =3D "nxp,pcf2129"; + reg =3D <0x51>; + }; +}; + &enetc_port1 { phy-handle =3D <&qds_phy1>; phy-connection-type =3D "rgmii-id"; --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41DB9C35268 for ; Mon, 24 Jan 2022 20:17:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380811AbiAXUQ5 (ORCPT ); Mon, 24 Jan 2022 15:16:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44852 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359325AbiAXT7d (ORCPT ); Mon, 24 Jan 2022 14:59: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 1DF43B811F3; Mon, 24 Jan 2022 19:59:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 361B3C340E5; Mon, 24 Jan 2022 19:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054370; bh=NtvLuRHT3V4sSBm45JA9E7W19eu6qsnP4a59oSTKsyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2nVZ3rFv9GlmehdNBN6VwshJ2n3vTGexpEP3Fw3kXQlDwwGSVKN4b/EpUnQbC2rab OqZ9Sgdxh7uoole3NY83/uob//xdrL2SAytSlrcRCpJs6ZT5VLgzIWrilTAGxDgYd4 lW6sS4KZjtP96JxEjdGEvHhsmW/ItOcjMGjW7wxw= 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.10 368/563] arm64: tegra: Adjust length of CCPLEX cluster MMIO region Date: Mon, 24 Jan 2022 19:42:13 +0100 Message-Id: <20220124184037.149943023@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 0c46ab7bbbf37..eec6418ecdb1a 100644 --- a/arch/arm64/boot/dts/nvidia/tegra186.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra186.dtsi @@ -985,7 +985,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA5ECC4167E for ; Mon, 24 Jan 2022 20:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380827AbiAXUQ6 (ORCPT ); Mon, 24 Jan 2022 15:16:58 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44866 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359363AbiAXT7i (ORCPT ); Mon, 24 Jan 2022 14:59: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 DAA2FB8119E; Mon, 24 Jan 2022 19:59:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 349C7C340E5; Mon, 24 Jan 2022 19:59:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054373; bh=H866M6xCOcdYv+r6p734DGCGRCl35R3+8VLYrg5bNJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yoTZEiippC5IVv/nLR4Eg0BBkU0gMnf57zNBtRV+n0vOnV7tj4pu4zepahpVu+dV7 qNOzD89nXidFLNcGMBc3yu4u46xVA/WlZpDQUdPVjxGi8v64rkv6jqotcW9d0s85i9 ZbJnTz5JmuPGpk2nfcevw93PswewyecgAE9DXGto= 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.10 369/563] PM: runtime: Add safety net to supplier device release Date: Mon, 24 Jan 2022 19:42:14 +0100 Message-Id: <20220124184037.180762615@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 389d13616d1df..c0566aff53551 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -348,8 +348,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 bc649da4899a0..1573319404888 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) @@ -1755,9 +1776,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 161acd4ede448..30091ab5de287 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 /** * pm_runtime_get_if_in_use - Conditionally bump up runtime PM usage count= er. @@ -279,6 +280,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9CBBC433F5 for ; Mon, 24 Jan 2022 21:28:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452564AbiAXVZx (ORCPT ); Mon, 24 Jan 2022 16:25:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442663AbiAXUzE (ORCPT ); Mon, 24 Jan 2022 15:55: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 22589C095422; Mon, 24 Jan 2022 11:59: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 D341DB810AF; Mon, 24 Jan 2022 19:59:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 141A7C340E5; Mon, 24 Jan 2022 19:59:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054376; bh=EUtzGHwc0AI9vPC/gyGm26EPy+dyA+8wOf2lTLuS7Gs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nrLlu/9gMCGTK5N5yQLYTwch7A9431s+MIO+BdFS4/fg//dKPxNzTAISxudFl1Y35 f4cOzp2g82Y5Ab7REXdb0IKvp4YQ6JKGjwzBJRafqA3CI0jp2trGO4ceB5OdvCERHM IOMCIUw6quRBPQcV2ErSYF6MULYFqgac65Ki0DkU= 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.10 370/563] cpufreq: Fix initialization of min and max frequency QoS requests Date: Mon, 24 Jan 2022 19:42:15 +0100 Message-Id: <20220124184037.212017964@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8e159fb6af9cd..30dafe8fc5054 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1400,7 +1400,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 @@ -1420,7 +1420,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1400C43219 for ; Mon, 24 Jan 2022 20:29:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383030AbiAXU0n (ORCPT ); Mon, 24 Jan 2022 15:26:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55976 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359401AbiAXT7l (ORCPT ); Mon, 24 Jan 2022 14: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 dfw.source.kernel.org (Postfix) with ESMTPS id F1F4F60B89; Mon, 24 Jan 2022 19:59:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EA32C340E5; Mon, 24 Jan 2022 19:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054379; bh=gihdcPke+Avb3ww8X3kO4UJgUteet+I3HWKLaDdFe5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wsb4Nmg0jd1cWko3wZ3czK43vtxeaUZI6pd6GETlcAfGqW+7XarFmyrOmkdrEtsPC DWn11nCgSp5sQe3KYTc+ANzi1zQbdWHBrT8sZ9DN95/foGjD4AnuDcLnpoxfK5DHMU ImOGgqM2851ZfcSvRKjsvqJ/SZHvFNzJivwHZN7Y= 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.10 371/563] usb: hub: Add delay for SuperSpeed hub resume to let links transit to U0 Date: Mon, 24 Jan 2022 19:42:16 +0100 Message-Id: <20220124184037.242998014@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 af15dbe6bb141..18ee3914b4686 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1109,7 +1109,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBE30C43217 for ; Mon, 24 Jan 2022 20:29:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383011AbiAXU0l (ORCPT ); Mon, 24 Jan 2022 15:26:41 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44952 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359483AbiAXT7p (ORCPT ); Mon, 24 Jan 2022 14: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 C91ACB810AF; Mon, 24 Jan 2022 19:59:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0CCBC340E5; Mon, 24 Jan 2022 19:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054382; bh=sr+Q2oFR8CNiUVEfQQFtfRQdkcamxTQq3ai2GqUz1MU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ErVkFFUfauQPMkMApl1BZKI+D8oieF6iy5j+y62c4TnIJu3cX2mny+wsYvBJywNC1 tAGtyDZ6sWoMP/K3LaTQ1aUYzxneRgsCYjzfuRGFZg33qVxb4AGRHm0kVmjluQLUA+ WOft6rB6V0q2S0kPPyPyjLz3VYxWQAbQQGVXrZGY= 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.10 372/563] ath9k: Fix out-of-bound memcpy in ath9k_hif_usb_rx_stream Date: Mon, 24 Jan 2022 19:42:17 +0100 Message-Id: <20220124184037.273763997@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1588C3526E for ; Mon, 24 Jan 2022 20:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380849AbiAXUQ7 (ORCPT ); Mon, 24 Jan 2022 15:16:59 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54130 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359511AbiAXT7q (ORCPT ); Mon, 24 Jan 2022 14:59: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 E2CFF60FEA; Mon, 24 Jan 2022 19:59:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1D60C340E5; Mon, 24 Jan 2022 19:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054385; bh=ND1OzIQ4qqHezNqKTpq1HofiiNOFrdx989O0rs0C+SM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ay3E388EtsoQ6C6rTgsCp+i/OwispjUSBbaaAdmOEiTxF0K6AWjpdSwvDra6rfT+d PhlkTkMuShR7QmFwy1jSiHAyM6MV8NJ4tmKlDkmrQ1uG9ueCLyY1BpQZiFIbxqX96D oc8kpVhScFxUDzQ4GGkp1a1hPbFOM80jeolSTZfA= 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.10 373/563] rtw88: 8822c: update rx settings to prevent potential hw deadlock Date: Mon, 24 Jan 2022 19:42:18 +0100 Message-Id: <20220124184037.313369633@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 565efd8806247..2ef1416899f03 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1652,7 +1652,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 bd01e82b6bcd0..8d1e8ff71d7ef 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 22d0dd640ac94..dbfd67c3f598c 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c @@ -204,7 +204,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 79ad6232dce83..cee586335552d 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c @@ -1248,7 +1248,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAF94C4167D for ; Mon, 24 Jan 2022 20:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380869AbiAXURA (ORCPT ); Mon, 24 Jan 2022 15:17:00 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45018 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359599AbiAXT7y (ORCPT ); Mon, 24 Jan 2022 14:59: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 CE2FFB81215; Mon, 24 Jan 2022 19:59:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21D05C340E5; Mon, 24 Jan 2022 19:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054391; bh=lqjG8Z5Qsq8axODgfIxil7lLhZeJUVwF0kCwte+SYhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JUPkqUcwcklvffbIRjZHxIcH1KSskQvLdvqImfuuy0NxDMCoRmzrM72QicI3oQLgy Y81U8R6l0W9S94+GJlIVINCKkTsLI30Xsdyho498cxPigvb643W/SC/q+Xnn0aj/lp dEy5VIN3ZZwl6u/rOw4uoBMsmxgplFydxG2GBEHY= 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.10 374/563] PM: AVS: qcom-cpr: Use div64_ul instead of do_div Date: Mon, 24 Jan 2022 19:42:19 +0100 Message-Id: <20220124184037.346047259@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 b24cc77d1889f..6298561bc29c9 100644 --- a/drivers/soc/qcom/cpr.c +++ b/drivers/soc/qcom/cpr.c @@ -1043,7 +1043,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04186C43219 for ; Mon, 24 Jan 2022 21:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455195AbiAXVez (ORCPT ); Mon, 24 Jan 2022 16:34:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442667AbiAXUzE (ORCPT ); Mon, 24 Jan 2022 15:55: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 84DF5C047CE3; Mon, 24 Jan 2022 11:59: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 22C4660B56; Mon, 24 Jan 2022 19:59:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F388FC340E5; Mon, 24 Jan 2022 19:59:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054394; bh=9ps7Jv4uIYBcpa73FrRpKTB27g2ZiCKS7+v1WkaUAAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hPS41ELlAX5Njc9Du3loFrtow/TfRHeEyHCoxnRWPD8vJLf1Y+C9HhhQ0e3Uk2D90 Rr3l5fEM1gEq7/mK6D0z3QsYZ8zncy5rbyqdA4eldJbsRvbONUQynpt88nGiyElMNB cK+r1ktBek4Z+FIQxRUbeMP9ZTZ963aCBDWmhrYQ= 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.10 375/563] iwlwifi: fix leaks/bad data after failed firmware load Date: Mon, 24 Jan 2022 19:42:20 +0100 Message-Id: <20220124184037.391561934@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 be214f39f52be..4bdfd6afa7324 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -185,6 +185,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, @@ -1365,6 +1368,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 @@ -1634,6 +1638,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: @@ -1649,6 +1654,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10C2FC433F5 for ; Mon, 24 Jan 2022 21:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451359AbiAXVWp (ORCPT ); Mon, 24 Jan 2022 16:22:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442662AbiAXUzE (ORCPT ); Mon, 24 Jan 2022 15:55: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 D74C2C047CE4; Mon, 24 Jan 2022 11: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 A00AFB81229; Mon, 24 Jan 2022 19:59:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03E47C340E5; Mon, 24 Jan 2022 19:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054397; bh=/dLmxP0k5YulXdYMfs2D5bBa+Ba737FmT5TgawM3dGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vF/8skGovRwakkmlzaILgojRMk0CDlGbKb5tPabqJGZBQLWLOq/ygtNnPswinsoU6 pBWx7vVbxUv0QL8TlE9UpJKdnUEZk4ddgF4aaobWQ2n0O0wpjZ8F9H6YAI/shTLp7S 46qQaQrRIxxr2pkFaabCUll93EfVKg3eWkeDDyOc= 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.10 376/563] iwlwifi: remove module loading failure message Date: Mon, 24 Jan 2022 19:42:21 +0100 Message-Id: <20220124184037.433003114@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 4bdfd6afa7324..30c6d7b18599a 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -1629,15 +1629,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 779D9C433EF for ; Mon, 24 Jan 2022 21:27:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451400AbiAXVWv (ORCPT ); Mon, 24 Jan 2022 16:22:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442670AbiAXUzE (ORCPT ); Mon, 24 Jan 2022 15:55: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 0240AC047CE5; Mon, 24 Jan 2022 12:00: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 9ECC6B81218; Mon, 24 Jan 2022 20:00:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B44C9C340E5; Mon, 24 Jan 2022 19:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054400; bh=sDAo1XnIxCI4a6omn15xDtLahALW8/Pua+mmxRBmHWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A5CcKB8hTvaBfwx4Xo4Qk+4E+Z6SurcG42hoPzA6WS18o39zqv96Klwdr/iUa66Hj bc/9y7wRrCElb1QEwTKpsNDF/eKp02pTcAA9i4bzFdLi5twCOl9oJdtnBbmeyMt5e1 G3B0nq6HpYbWOw0p/Uw+Ruw7F+ishBm0hO4Wl94U= 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.10 377/563] iwlwifi: mvm: Fix calculation of frame length Date: Mon, 24 Jan 2022 19:42:22 +0100 Message-Id: <20220124184037.466685641@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 838734fec5023..86b3fb321dfdd 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c @@ -177,12 +177,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C757C433EF for ; Mon, 24 Jan 2022 21:28:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452626AbiAXVZ7 (ORCPT ); Mon, 24 Jan 2022 16:25:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442672AbiAXUzE (ORCPT ); Mon, 24 Jan 2022 15:55: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 195BBC047CE8; Mon, 24 Jan 2022 12:00: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 CB431B81229; Mon, 24 Jan 2022 20:00:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03D62C340E7; Mon, 24 Jan 2022 20:00:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054403; bh=Gvxsjpd5cfIoDoJ7uJZx2+ip3PN++DHEoQrmqb82lSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nr0mLG+lVb03ubTfVTQeFJwSsrEo8MMDIFYEPwiMWKzAdn/paT791TTsPxSbIQUqH UmnGTvKb73zxnASzbaSRQvceh8tZHv90jISRXyd+qlBTBJj6HS8jKf9D6P8YX5nP5A 2kdWxoRMBIZ5IgMTLPtxSOynut564IsjOl2GY+6Q= 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.10 378/563] iwlwifi: pcie: make sure prph_info is set when treating wakeup IRQ Date: Mon, 24 Jan 2022 19:42:23 +0100 Message-Id: <20220124184037.498455575@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2c13fa8f28200..6aedf5762571d 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c @@ -2260,7 +2260,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAD38C433EF for ; Mon, 24 Jan 2022 20:24:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351307AbiAXUYA (ORCPT ); Mon, 24 Jan 2022 15:24:00 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45126 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359743AbiAXUAJ (ORCPT ); Mon, 24 Jan 2022 15:00: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 E179AB8121C; Mon, 24 Jan 2022 20:00:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15ECEC340E8; Mon, 24 Jan 2022 20:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054406; bh=YRtFLS33UvhcMXoutG1kpLoHx0Za8NOY2p3DeITTCGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N8G190iczAmIsVdkIDTfdooI4luwueeEHzp5fS3yymmRXtMvTdrMl7hYhWww7QVw4 IyOEYt6f0ZqCXhhygYJVU4qh8wK1TD8i75Egm2b5zyaGCmqKzyeACaRoRoIb/SsT68 UecxR8EzEEdO+y0Inb4DT8kx/cPQYSexluZnTUA4= 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.10 379/563] um: registers: Rename function names to avoid conflicts and build problems Date: Mon, 24 Jan 2022 19:42:24 +0100 Message-Id: <20220124184037.530599766@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 f79dc338279e6..b28373a2b8d2d 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c @@ -336,7 +336,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75678C4707A for ; Mon, 24 Jan 2022 20:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358413AbiAXURM (ORCPT ); Mon, 24 Jan 2022 15:17:12 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56384 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359759AbiAXUAL (ORCPT ); Mon, 24 Jan 2022 15:00: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 31E10601B6; Mon, 24 Jan 2022 20:00:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26BDEC340E5; Mon, 24 Jan 2022 20:00:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054409; bh=Ewoqf+lA3UVgXVPosWCGDLUE0k5LkPsd+VjXLW6OORU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OrG1e2ZbEUS1oZeYt1VnZ0q7phPA6Tk5JC3lCS2xHZ/h5gkPQQdGMWH51Sao1Hphm yWWFle7NMkWN0xoUi13hkYgjq+fp134jKyjRXCQKJFZHfnc3X6kuAtja8PHJa8wVAb evXDR7PMRYsJA6LbQNgLTTZQr/8QR72KAinyfjgM= 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.10 380/563] ath11k: Fix napi related hang Date: Mon, 24 Jan 2022 19:42:25 +0100 Message-Id: <20220124184037.567917942@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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(-) diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/a= th/ath11k/ahb.c index e8cca58e18ffc..9ff6e68533142 100644 --- 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(struct ath11k= _base *ab) =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(struct ath11k_ba= se *ab) 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); } } diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/= ath/ath11k/core.h index c8e36251068c9..d2f2898d17b49 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -124,6 +124,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; }; @@ -687,7 +688,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; diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/a= th/ath11k/pci.c index d7eb6b7160bb4..105e344240c10 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -416,8 +416,11 @@ static void __ath11k_pci_ext_irq_disable(struct ath11k= _base *sc) =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 @@ -436,7 +439,10 @@ static void ath11k_pci_ext_irq_enable(struct ath11k_ba= se *ab) 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); } } --=20 2.34.1 From nobody Tue Jun 30 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3D43C4707E for ; Mon, 24 Jan 2022 21:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452587AbiAXVZ4 (ORCPT ); Mon, 24 Jan 2022 16:25:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442671AbiAXUzE (ORCPT ); Mon, 24 Jan 2022 15:55: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 3BDA7C047CE9; Mon, 24 Jan 2022 12:00: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 05637B8122C; Mon, 24 Jan 2022 20:00:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30A3EC340E5; Mon, 24 Jan 2022 20:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054412; bh=gDmFszm+/TUhgaalM12dREB18MEqRLtv9uD+Yy9sdoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jcW9SaQtTxdjRRTzBS1CGprQrajlwCmmkJvWFVyFnVK/jIeQf3d3Ksjlvp4pCMAGW Z4QTJYnyleB6k/XOici5Vl+f73lGdwuOjO13QZX1UVXeqxoUb4RICereOjPD2m0/Y+ 2IlFE3kmipludW12KPgTK5L6Wq/FxC9tLVQaaYes= 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.10 381/563] Bluetooth: vhci: Set HCI_QUIRK_VALID_LE_STATES Date: Mon, 24 Jan 2022 19:42:26 +0100 Message-Id: <20220124184037.600747926@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8ab26dec5f6e8..8469f9876dd26 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c @@ -121,6 +121,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A962C41535 for ; Mon, 24 Jan 2022 20:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347532AbiAXURC (ORCPT ); Mon, 24 Jan 2022 15:17:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54610 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359839AbiAXUAR (ORCPT ); Mon, 24 Jan 2022 15:00: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 3BA0860916; Mon, 24 Jan 2022 20:00:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A965C340E5; Mon, 24 Jan 2022 20:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054415; bh=C+4B7g9Rtt7BSWPboHk3EW42cx6jfP4t12STewUU/Eo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hcqlJJhjXPsslbrzgac42DiZG1T4hdwGQFw17Tl6773Y+LJEBx4ZSLrEB99CtnAxB Q1F0MzwdW+h0CY/fOTC+lYXG5z7JtJYeWxGDMvyCx9kFwjUsj8uAobH+AwReznceFP 6zr2yIZQTn83tcGSmE4whpSmqlEjPbac68Qw6eTA= 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.10 382/563] xfrm: rate limit SA mapping change message to user space Date: Mon, 24 Jan 2022 19:42:27 +0100 Message-Id: <20220124184037.632696519@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 6232a5f048bde..337d29875e518 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -193,6 +193,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 ffc6a5391bb7b..2290c98b47cf8 100644 --- a/include/uapi/linux/xfrm.h +++ b/include/uapi/linux/xfrm.h @@ -308,6 +308,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 c158e70e8ae10..65e2805fa113a 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -1557,6 +1557,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 @@ -2208,7 +2211,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; @@ -2223,6 +2226,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 ddf1b3a5f7c1f..d0fdfbf4c5f72 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) @@ -969,8 +977,13 @@ static int copy_to_user_state_extra(struct xfrm_state = *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; } @@ -2924,6 +2937,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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBB72C4707E for ; Mon, 24 Jan 2022 21:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452542AbiAXVZt (ORCPT ); Mon, 24 Jan 2022 16:25:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442681AbiAXUzF (ORCPT ); Mon, 24 Jan 2022 15:55: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 C424FC047CEA; Mon, 24 Jan 2022 12:00: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 64D5D60FF4; Mon, 24 Jan 2022 20:00:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40324C340E5; Mon, 24 Jan 2022 20:00:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054418; bh=vYqT50n7P1s8BSjh/eXllW0EJ7z12+co5rPuam7sJbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TYyh5XBlFvxKoAoO0sml/3pU7PIEzYfxgW6XIpXGKrtrce2ayECh4Hq1FURd453Uf 0yRqNi8TCAUxHemrjOoDCA0jxNNWR9LTb64ityVdj6kN2MbRytu79yxJRqZUBpOhrD bIFICgezYC0sSq2EeomiTFyUBhapWjBPvanr+jzI= 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.10 383/563] drm/etnaviv: consider completed fence seqno in hang check Date: Mon, 24 Jan 2022 19:42:28 +0100 Message-Id: <20220124184037.671331423@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 cd46c882269cc..026b6c0731198 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c @@ -106,8 +106,10 @@ static void etnaviv_sched_timedout_job(struct drm_sche= d_job *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 06:15:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB260C433F5 for ; Mon, 24 Jan 2022 20:23:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346240AbiAXUXn (ORCPT ); Mon, 24 Jan 2022 15:23:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56682 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346099AbiAXUA2 (ORCPT ); Mon, 24 Jan 2022 15: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 dfw.source.kernel.org (Postfix) with ESMTPS id A4913612F0; Mon, 24 Jan 2022 20:00:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D8DDC340E8; Mon, 24 Jan 2022 20:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054425; bh=9zqniQmnmRj2EP7QeluyIKIoG9IT21ZtY1hW7QzQH5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FfVQ6AYg0Ov9apoImHL8kelULttcaV+qOqMh++Rb8hV95yRSq3ncHy1XSWcETYfhh 6i3K4QVT9Oxv7sI1NYNxCAJi8hF9PX9lHNVjkES0EhOQVw25woGsZWh4EHJzvbjf5a WUOuIwxSHwPZIhjbJ62pqUxrM7vi6ATniNlCWQbw= 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.10 384/563] jffs2: GC deadlock reading a page that is used in jffs2_write_begin() Date: Mon, 24 Jan 2022 19:42:29 +0100 Message-Id: <20220124184037.702968319@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF5ACC433FE for ; Mon, 24 Jan 2022 20:17:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381003AbiAXURZ (ORCPT ); Mon, 24 Jan 2022 15:17:25 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56772 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347427AbiAXUAa (ORCPT ); Mon, 24 Jan 2022 15:00: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 E159D61028; Mon, 24 Jan 2022 20:00:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA22BC340E5; Mon, 24 Jan 2022 20:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054428; bh=l0GpjSvIxki+YLVBG10eC3DNjPlwaQrzUJ48btOsIBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F953C4IUAQVRynS524oIPrNVDYQzrydgNmibd/89IS/BpVR9UDOK9Ap/YlSRMdZ7e tm/oWipR/LDaM8/bFyqpmIQxdsbb8KfstikcpN2XFrqLAkavJ2EmIZnEAlTXvB81QD ldLe0OsEIsmKW9RBTUV01sJNRrEp2R1v0W6QR+PE= 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.10 385/563] ACPICA: actypes.h: Expand the ACPI_ACCESS_ definitions Date: Mon, 24 Jan 2022 19:42:30 +0100 Message-Id: <20220124184037.743109630@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 647cb11d0a0a3..7334037624c5c 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24330C4321E for ; Mon, 24 Jan 2022 21:27:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451639AbiAXVXP (ORCPT ); Mon, 24 Jan 2022 16:23:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442868AbiAXUzf (ORCPT ); Mon, 24 Jan 2022 15:55: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 7D432C09543D; Mon, 24 Jan 2022 12:00: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 1CF9F611C8; Mon, 24 Jan 2022 20:00:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB9DBC36AF6; Mon, 24 Jan 2022 20:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054431; bh=DwA8F4zgidWixlK9aMmqBvtZBvHnXYpCKUEafJu47RM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i8pB0MosULBx/4t8yhyWQF49YArfYo2mCqKJOs6KMNbrPyyzeXW++YK7I8+lLRbJq i67SjjALmO+l8j7Lx1GRDg6tolGMXU7YG9cmQXECJB7H76MT98I6miN9g1CdVVJMoi LCUk0RuaYqA8LIg3padR4xZje0SjDXBcOSH5g4Xo= 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.10 386/563] ACPICA: Utilities: Avoid deleting the same object twice in a row Date: Mon, 24 Jan 2022 19:42:31 +0100 Message-Id: <20220124184037.781017181@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 72d2c0b656339..cb1750e7a6281 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B2CBC4332F for ; Mon, 24 Jan 2022 20:17:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381023AbiAXURa (ORCPT ); Mon, 24 Jan 2022 15:17:30 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45448 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348898AbiAXUAk (ORCPT ); Mon, 24 Jan 2022 15:00: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 3810AB81229; Mon, 24 Jan 2022 20:00:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D773DC36AE2; Mon, 24 Jan 2022 20:00:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054434; bh=CvzemMv2Xr4QsyQODOoIl53LrSRrmmgPZquz8f0aymw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DJJkdg96Akabc2I6q1RvgUP0/BuCm8wBvk7SBrRAcJiEae6BnzofmXtDkS41jPtdZ 7MW2HvUdlA4C7iaDNiJLaqdlMYomxHlcNIY3dQTU1DpavYF35xyMOvXc3TrUoTGIg+ tSmJjJuRp2tzPP0CqL7GobhpZlwc/rBU+TmHElIs= 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.10 387/563] ACPICA: Executer: Fix the REFCLASS_REFOF case in acpi_ex_opcode_1A_0T_1R() Date: Mon, 24 Jan 2022 19:42:32 +0100 Message-Id: <20220124184037.812935843@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a46d685a3ffcf..9d67dfd93d5b6 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92C7BC35273 for ; Mon, 24 Jan 2022 20:17:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241569AbiAXURc (ORCPT ); Mon, 24 Jan 2022 15:17:32 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56978 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349062AbiAXUAj (ORCPT ); Mon, 24 Jan 2022 15:00: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 9A837611C8; Mon, 24 Jan 2022 20:00:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F422C340E5; Mon, 24 Jan 2022 20:00:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054438; bh=BwrD9v9Ae2aInMK3LbZeEEzNTK56stm9l1eBv1Y1hG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pX61aExvxv8/0k4SH9QqLxUUyc93bSpOnE/WDLYVz6uET5bol6dgBldOlsP5UzfoZ 0sIG+LCgoBGV1RScjX/EyvOv7bsRxgPhVIxZDibU79B8yIg+7sEjKgPoZctkSK/pCI tFkiBsH5YJh7jcpp/dUI1MUcAmWV0A9r66NHx5ds= 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.10 388/563] ACPICA: Fix wrong interpretation of PCC address Date: Mon, 24 Jan 2022 19:42:33 +0100 Message-Id: <20220124184037.849909483@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 3323a2ba6a313..b3230e511870a 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c @@ -326,12 +326,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C8EDC433EF for ; Mon, 24 Jan 2022 21:43:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456972AbiAXVkg (ORCPT ); Mon, 24 Jan 2022 16:40:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445262AbiAXVCg (ORCPT ); Mon, 24 Jan 2022 16:02: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 161F7C055A92; Mon, 24 Jan 2022 12:02: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 AA24660916; Mon, 24 Jan 2022 20:02:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C3B9C340E5; Mon, 24 Jan 2022 20:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054571; bh=tS16myAIoGxdzTgUG/CRAm/8SzRWeK7sW/Xbej1WoIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zEql/InG4buvjTsWHik0HQBbKBKcQq26pp2pRb/1uTj/E7CQzS3LfIyHGtQ2LNbc6 9baynVJk0u6V+ZV3dyCbCbAWybLIw5vJ64bgUwv2AOa2NXFoYSbpGP5nz+xGZ9Mye7 8LZHu+5IL3b0Aimjh5yVDLdlc9Vf7GqxSWEbWDoE= 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.10 389/563] ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5 Date: Mon, 24 Jan 2022 19:42:34 +0100 Message-Id: <20220124184037.890594238@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 4836a4b8b38b8..142a755be6881 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 fcc84d196238a..6a20bb5059c1d 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 f1645d87864c3..3948c34d85830 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51761C433EF for ; Mon, 24 Jan 2022 21:28:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351730AbiAXVYl (ORCPT ); Mon, 24 Jan 2022 16:24:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443767AbiAXU7G (ORCPT ); Mon, 24 Jan 2022 15:59: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 07E0DC047CFD; Mon, 24 Jan 2022 12:01: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 C4376B8124B; Mon, 24 Jan 2022 20:01:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F28A4C340ED; Mon, 24 Jan 2022 20:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054462; bh=gftabYyXkMadHg19oaBWLurzEcg5g5knoVByzQVVmhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7/zu80a3Bopj72SBDmJCSs5oCV3NSpsysnYFI2ocvhfQTK0CyC8b+k4RfIHiO5QI r/riSSqJ3ZDVNzfmTxFZ1FGg9gCeb4FrQfC1IgkGBw8VJuQmjtkgbCj3ObKC10SBhY ShlkRy/cy9c6x/xO19sfLaZa3XQ37E33Cflp0N/g= 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.10 390/563] drm/amdgpu: fixup bad vram size on gmc v8 Date: Mon, 24 Jan 2022 19:42:35 +0100 Message-Id: <20220124184037.921732618@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 9ab65ca7df777..873bc33912e23 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c @@ -524,10 +524,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 */ @@ -571,8 +571,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D99AC433EF for ; Mon, 24 Jan 2022 20:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381114AbiAXUSz (ORCPT ); Mon, 24 Jan 2022 15:18:55 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46498 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376391AbiAXUBm (ORCPT ); Mon, 24 Jan 2022 15: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 7FBF6B811FB; Mon, 24 Jan 2022 20:01:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F42EC340E5; Mon, 24 Jan 2022 20:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054497; bh=Csfys2uwM396iME7raG1/d7q99Qkj/wQ1zHtdVop2hQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IKTw90tYXDjExGfaPa6oXiue1DhraGiv/b33D3RhBBbpaakWEUwGWHNQpVvk7KJgw TQ4K1TChHyx+R4oy0lHzvaIcChYMUyKKsRJunEvrXWsT7sF4byNXlDg5VFMQ+bhdla D62WFwL9oInsVF+z4gFZeCqi7W332PLfGHy8Yb04= 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.10 391/563] amdgpu/pm: Make sysfs pm attributes as read-only for VFs Date: Mon, 24 Jan 2022 19:42:36 +0100 Message-Id: <20220124184037.956883483@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 9f383b9041d28..49109614510b8 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -2098,6 +2098,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20EBCC433F5 for ; Mon, 24 Jan 2022 20:19:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344765AbiAXUTc (ORCPT ); Mon, 24 Jan 2022 15:19:32 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56384 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347130AbiAXUCM (ORCPT ); Mon, 24 Jan 2022 15:02: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 21480612FC; Mon, 24 Jan 2022 20:02:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D7FAC340E5; Mon, 24 Jan 2022 20:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054531; bh=pA7FEnnPlBTN/gEJTGTmLjbB1t5AvBXv4YRugod206k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vqCfbHpF2a5RtNT+Flz8YDknCkNad7KHdTXUtMmvYBvtcrtUk1EmdgUrWeUYGLe3o 9c4gSlvD77YnGJmXLjbaGkvpA7dhBQFs235HuHpcIjRBAH4JT3ifXu7afC3mlLvN1w iXNg4WWvC42Wmwq7ztVlMH3EuGlEuogBKvUgsTD4= 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.10 392/563] ACPI: battery: Add the ThinkPad "Not Charging" quirk Date: Mon, 24 Jan 2022 19:42:37 +0100 Message-Id: <20220124184037.993195557@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/acpi/battery.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index e04352c1dc2ce..2376f57b3617a 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -59,6 +59,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"); @@ -222,6 +223,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; @@ -1105,6 +1108,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 */ @@ -1149,6 +1158,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EF0EC433F5 for ; Mon, 24 Jan 2022 21:43:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456601AbiAXVjf (ORCPT ); Mon, 24 Jan 2022 16:39:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444638AbiAXVBO (ORCPT ); Mon, 24 Jan 2022 16:01: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 A5F57C04C06A; Mon, 24 Jan 2022 12: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 4E22CB81218; Mon, 24 Jan 2022 20:02:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FE3EC340E5; Mon, 24 Jan 2022 20:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054553; bh=xZeHHhIJdcdcNUkvrYURqdkvZoRC0kzJWd7ulHWA++Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CyqXCIA83LZrr8PXqlMHmTiGWVmcKEErlWS6YiSKl4/n1O5mg5gOgfPPKEkTUzPyh x0h3W088Qo1BHPwQhE8scpD6wAlKRx6UjGTiko6yku9NTr4uJ2qV4F2KgbhZEyywoM xOJYqMEZB8sT01w9dKxLJyRkKASPkGITsjsvAHE0= 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.10 393/563] btrfs: remove BUG_ON() in find_parent_nodes() Date: Mon, 24 Jan 2022 19:42:38 +0100 Message-Id: <20220124184038.030887000@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 6e447bdaf9ec8..8b471579e26e1 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1213,7 +1213,12 @@ again: ret =3D btrfs_search_slot(trans, 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12C87C4167B for ; Mon, 24 Jan 2022 20:29:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382289AbiAXUZZ (ORCPT ); Mon, 24 Jan 2022 15:25:25 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59122 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376550AbiAXUCk (ORCPT ); Mon, 24 Jan 2022 15:02: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 94E0A612F0; Mon, 24 Jan 2022 20:02:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7774AC340E5; Mon, 24 Jan 2022 20:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054556; bh=FaYKt4gnTfuF6TjBBOx0FbqMFJY4EXOhStDyYJlL4e8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iKB8KfNX4iAHe6TTPuDB3xahPBC9jaZ8q3WIJ7wQHQ3FYNL6wmJVe9WT5J79Zj8Po 9B6Lb+22nrnza0TAvDtOIgcFppGquIEMwN/5VXys7Il5wWhGkmOfqDh7TXr6SIFPKr Qes09vYJbT2zdqI9pa7+jwHaSf76E5p9bQ7j4Vpc= 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.10 394/563] btrfs: remove BUG_ON(!eie) in find_parent_nodes Date: Mon, 24 Jan 2022 19:42:39 +0100 Message-Id: <20220124184038.060803830@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8b471579e26e1..baff31a147e7d 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1366,10 +1366,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C916CC4167B for ; Mon, 24 Jan 2022 21:38:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378066AbiAXVit (ORCPT ); Mon, 24 Jan 2022 16:38:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444650AbiAXVBO (ORCPT ); Mon, 24 Jan 2022 16:01: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 C6C82C04C071; Mon, 24 Jan 2022 12:02: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 3CD0CB811F3; Mon, 24 Jan 2022 20:02:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A9E7C340E5; Mon, 24 Jan 2022 20:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054559; bh=Tfk/9Tnd2NIGXZpaVjiZo4dOXCNs2OsaCggUq26g89U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=izp5MRdaFp5aBDAgIDmyJxZY7FTsPE0hLs8HhKqKELxEoxW3hCEbgBn/1+gr8racN ntm3yoOO2FosRY1qApA3l6lPw4aTzhhS7V6zy7oCMPobzJtjnMbpaZh98LTcBD/1PW gQur7lff231X9eX2KZgPm4E6nHl1mnfaF/D94euY= 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.10 395/563] net: mdio: Demote probed message to debug print Date: Mon, 24 Jan 2022 19:42:40 +0100 Message-Id: <20220124184038.091730452@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2645ca35103c9..c416ab1d2b008 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -588,7 +588,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E30CEC3525A for ; Mon, 24 Jan 2022 21:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377642AbiAXViE (ORCPT ); Mon, 24 Jan 2022 16:38:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444937AbiAXVBq (ORCPT ); Mon, 24 Jan 2022 16:01: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 95F29C04C074; Mon, 24 Jan 2022 12:02: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 3BCCCB81218; Mon, 24 Jan 2022 20:02:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64263C340E5; Mon, 24 Jan 2022 20:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054562; bh=xU/E0UOkkueNXhNTpQtFR0kqDRHiSMIPw0I95vr7Xqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ieiNdeBn39DBLpTWENtubSho5QRsO7H0OHdj7qsBOFs9X4sEjiV/F4LJir4bCb6p5 tE13HsQkbwshWthuk3oavUyQhcavGZfZD65ileg6PhhB9I/fL9sfGgUZ522Jd1h3PT 62B0hMiDq5CZjc5ikOjQEvh/SW6wpYdjDxkmo7eI= 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.10 396/563] mac80211: allow non-standard VHT MCS-10/11 Date: Mon, 24 Jan 2022 19:42:41 +0100 Message-Id: <20220124184038.122519714@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 6a24431b90095..d27c444a19ed1 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -4800,7 +4800,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 829DAC433EF for ; Tue, 25 Jan 2022 02:55:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1313156AbiAYCrr (ORCPT ); Mon, 24 Jan 2022 21:47:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445194AbiAXVC3 (ORCPT ); Mon, 24 Jan 2022 16:02: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 1619CC04C078; Mon, 24 Jan 2022 12:02: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 A884D611C8; Mon, 24 Jan 2022 20:02:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D950C340E5; Mon, 24 Jan 2022 20:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054565; bh=Lqn3vSoFlKiqqZwJh+JyEU5SZY1cUlLW87QVRtDJf+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T17Ry6vj/gm4pyMQt1pFD2VkiSJeLBxH1iSqDUnq5J43jiQGbIL/ExTtPbaW5iji6 pWq30mqgRJ8H/wInREmCb1UhbIZYuw0bfRJRvCKjufmm27jDpRgpqO3+iCl0PG2YXC JSbhkmogNs9QYDKR37X19OLWHNqZ3FwBwX1FWq60= 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.10 397/563] dm btree: add a defensive bounds check to insert_at() Date: Mon, 24 Jan 2022 19:42:42 +0100 Message-Id: <20220124184038.157602599@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 ef6e78d45d5b8..ee3e63aa864bf 100644 --- a/drivers/md/persistent-data/dm-btree.c +++ b/drivers/md/persistent-data/dm-btree.c @@ -83,14 +83,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4FFCC4167B for ; Mon, 24 Jan 2022 21:43:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457064AbiAXVkt (ORCPT ); Mon, 24 Jan 2022 16:40:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445261AbiAXVCg (ORCPT ); Mon, 24 Jan 2022 16:02: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 87BCDC055A91; Mon, 24 Jan 2022 12:02: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 4F462B811F3; Mon, 24 Jan 2022 20:02:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F472C340E5; Mon, 24 Jan 2022 20:02:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054568; bh=Bf2KpLKl42cxGt39Tk6pcrnnOXoTk3V933L/qa6WQzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jmKUKu3S4B1jHTfK4ZYykleC2ovRRAfm/+EcS5rz10bxaknLev53kmARuZCjzGgep FU38rszfz0CcJ3LYPAj48H0AgkEsM05JbeNYVy988xSya426r9GZaw56J8c9dVP8t0 4Jf0a3c/wGsBfDvGlJdZdj2VZKJMJG3teDWayymY= 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.10 398/563] dm space map common: add bounds check to sm_ll_lookup_bitmap() Date: Mon, 24 Jan 2022 19:42:43 +0100 Message-Id: <20220124184038.188921917@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a213bf11738fb..85853ab629717 100644 --- a/drivers/md/persistent-data/dm-space-map-common.c +++ b/drivers/md/persistent-data/dm-space-map-common.c @@ -281,6 +281,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC0A3C35271 for ; Mon, 24 Jan 2022 20:29:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382886AbiAXU01 (ORCPT ); Mon, 24 Jan 2022 15:26:27 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57572 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353838AbiAXUBJ (ORCPT ); Mon, 24 Jan 2022 15:01: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 34071611D6; Mon, 24 Jan 2022 20:01:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF52FC36AE2; Mon, 24 Jan 2022 20:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054465; bh=aBh7I4G6eOqb3JIhGIqsj/himHv49hrPqU4ibGY8N90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wot25cpXPGKIIYyiBhtdeiRoXLOI0Ml/9xeVUCjXQK9NQXrJKVCD2hHuvnUb1Q/Ag MD75QeHpv+ZwAH4IJqhpGJuWqiDfW13ZtPbz8sq5A5KLqKffAnsr+t+N47OQzh6ZdW 7zsLY2ntn6W+HIXCjmyk7R2XwMi4jIvU2ff2OdYk= 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.10 399/563] mlxsw: pci: Avoid flow control for EMAD packets Date: Mon, 24 Jan 2022 19:42:44 +0100 Message-Id: <20220124184038.227358463@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 5ffdfb532cb7f..91f68fb0b420a 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/cmd.h +++ b/drivers/net/ethernet/mellanox/mlxsw/cmd.h @@ -905,6 +905,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 72d5c77bcb949..dbb16ce25bdf3 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++) { @@ -1599,7 +1603,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AABAC433FE for ; Mon, 24 Jan 2022 20:29:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382869AbiAXU0Z (ORCPT ); Mon, 24 Jan 2022 15:26:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46142 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376272AbiAXUBL (ORCPT ); Mon, 24 Jan 2022 15: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 ams.source.kernel.org (Postfix) with ESMTPS id 063BBB8124F; Mon, 24 Jan 2022 20:01:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31808C340E5; Mon, 24 Jan 2022 20:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054468; bh=MOqpyLIQ3I/vv1y8J/7vIEClqtBU18OiiM0sN/pQ4eE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jOElBW9Pm3SkRaxePYkH5Sr7ZI7CANFZ5kDf5yHTxdAJ9VM/OFdbv5LeDZ4rjmaod W+wNRv9LwYycjZ7SuDiLUjl218zAzKz6z1geu8ilH8aJCILZ1UpcY8dt6ckUG1SKwC wttYlH9J+2JfJw7EVxSBiB0gcq2pDPrRCXKHlhQI= 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.10 400/563] net: phy: marvell: configure RGMII delays for 88E1118 Date: Mon, 24 Jan 2022 19:42:45 +0100 Message-Id: <20220124184038.266854410@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/net/phy/marvell.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 91616182c311f..4dda2ab19c265 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -1090,6 +1090,12 @@ static int m88e1118_config_init(struct phy_device *p= hydev) 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); --=20 2.34.1 From nobody Tue Jun 30 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4880FC2BA4C for ; Mon, 24 Jan 2022 21:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353167AbiAXVYo (ORCPT ); Mon, 24 Jan 2022 16:24:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443780AbiAXU7H (ORCPT ); Mon, 24 Jan 2022 15:59: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 ACD2EC04D60A; Mon, 24 Jan 2022 12:01: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 4AFC76091B; Mon, 24 Jan 2022 20:01:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35739C340E5; Mon, 24 Jan 2022 20:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054471; bh=V5YukOHU6VCz6Xve1aib1W7dXXOp4w7id33j9rMc2uU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=woYMOYztVlmC5KkENiSHZXSabFwIM0J/LfM0Fs6Sc9ivfQPtb8o883+DTDPmA3DOl YqKQ1WcRrPuUd8snW+tqifPZPAhRWnHAMFriHjhs4Kt1fvpOr1UaJxu4wERytyXQWl 60lnnK1btyL7gXUcz6Y6wCaSGWR2QzQvsyph2kJA= 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.10 401/563] net: gemini: allow any RGMII interface mode Date: Mon, 24 Jan 2022 19:42:46 +0100 Message-Id: <20220124184038.306708694@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8df6f081f2447..d11fcfd927c0b 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1492C433FE for ; Mon, 24 Jan 2022 20:18:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355902AbiAXUSW (ORCPT ); Mon, 24 Jan 2022 15:18:22 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57754 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237325AbiAXUBP (ORCPT ); Mon, 24 Jan 2022 15:01: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 502156130A; Mon, 24 Jan 2022 20:01:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2762CC36AFC; Mon, 24 Jan 2022 20:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054474; bh=oxD4SZxbk/IfGdi8uub6L4h5OJsot3+ZJKCvxuH8tI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Orj4BpxmUTGD9q9NAzzfw8567ARnugOzCwzCXFVZzatpCxh5wOl6wtKidzTeN0p16 SZh1FPKLAiHoZTkzctSFmCJzjKf6LSMcvadgyLiDbFs8ybV5SJIqcL5FkcZ2ylEUvH CbXpSsU335OFUd5z3FH6e95VWqLRemzVme2D2tR0= 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.10 402/563] regulator: qcom_smd: Align probe function with rpmh-regulator Date: Mon, 24 Jan 2022 19:42:47 +0100 Message-Id: <20220124184038.345900414@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 bb944ee5fe3b1..03e146e98abd5 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 { @@ -1107,52 +1108,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 213BBC433F5 for ; Mon, 24 Jan 2022 21:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1453548AbiAXVaT (ORCPT ); Mon, 24 Jan 2022 16:30:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443056AbiAXU7O (ORCPT ); Mon, 24 Jan 2022 15:59: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 73E7CC04D625; Mon, 24 Jan 2022 12:01: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 2FD1BB8123A; Mon, 24 Jan 2022 20:01:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F1B2C340E5; Mon, 24 Jan 2022 20:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054477; bh=RKSEmNaXGd0qqSaJBIwGtQiobulqLStSBkj1kyOlIzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d5Rlr3Q7rf37Au/zHqCOVvn21ytUMqcNfO+pR+tm88aJPb0WZXrHgpROQRKX+jKX8 J+3w11LnBSykm/Ubz0wz8+YSFevfBK1gpI4Y/Q4wxnMZrSYMTUruM7sDsMxNlyYZko Be4cE9LYJeqHxgZXUA8UZtF00+XlrE+46UniE33U= 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.10 403/563] serial: pl010: Drop CR register reset on set_termios Date: Mon, 24 Jan 2022 19:42:48 +0100 Message-Id: <20220124184038.386658409@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 3284f34e9dfe1..75d61e038a775 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c @@ -448,14 +448,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94119C433EF for ; Mon, 24 Jan 2022 20:23:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354799AbiAXUXD (ORCPT ); Mon, 24 Jan 2022 15:23:03 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57884 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356460AbiAXUBW (ORCPT ); Mon, 24 Jan 2022 15: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 dfw.source.kernel.org (Postfix) with ESMTPS id BA5146091B; Mon, 24 Jan 2022 20:01:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8213DC340E5; Mon, 24 Jan 2022 20:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054481; bh=ttfyB81yNQlMenIPGF8dZQXmiBNmpBeJ8w+ZiOjs+5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QVobm+CrnqTJFJfcOo8leq2yvbbbC3sknlInPUL8l9/xi9BH90jkqcKJodLBdnrCS Ylfid4tnaOoaN0DWGuNfNZd/g7GLiI6xIgqRe8sRyt6ZasDEf3g2rqr7g18dtosWx6 kHzCHdnqqiNoBDuGMpLjEFXV5RFyYaTAhKFIv9cw= 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.10 404/563] serial: core: Keep mctrl register state and cached copy in sync Date: Mon, 24 Jan 2022 19:42:49 +0100 Message-Id: <20220124184038.419766592@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 046bedca7b8f5..55108db5b64bf 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2414,7 +2414,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD491C433FE for ; Mon, 24 Jan 2022 21:28:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353968AbiAXVYs (ORCPT ); Mon, 24 Jan 2022 16:24:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443078AbiAXU7O (ORCPT ); Mon, 24 Jan 2022 15:59: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 51869C04D627; Mon, 24 Jan 2022 12:01: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 E574460B43; Mon, 24 Jan 2022 20:01:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6C15C340E5; Mon, 24 Jan 2022 20:01:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054484; bh=/dGnbHoEWV8PzqxzFoRe3cgvni4WisFgqP4qPwYHDpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YDlhHVbNZ42gp5XFIA7LjLDvDABtD0wVrknDrfFjCRiT9EkW3x/FXXDpCXiffpN7+ DPRRbCIaFfzxSVXc/kxE6xKCTY8pXOxWBMp811fv8IbAolaeXkLheClTLF6q140oi+ 2mRXJleyhIHlHbL/SzDyoSLhH47aZdfmd15c3OZk= 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.10 405/563] random: do not throw away excess input to crng_fast_load Date: Mon, 24 Jan 2022 19:42:50 +0100 Message-Id: <20220124184038.450540055@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 8c94380e7a463..5444206f35e22 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -922,12 +922,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; @@ -938,7 +940,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) { @@ -946,7 +948,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 /* @@ -1299,7 +1301,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; } @@ -2319,8 +2321,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2D65C4707E for ; Mon, 24 Jan 2022 20:29:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382766AbiAXU0S (ORCPT ); Mon, 24 Jan 2022 15:26:18 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58044 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353254AbiAXUBa (ORCPT ); Mon, 24 Jan 2022 15:01: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 BB49D611CD; Mon, 24 Jan 2022 20:01:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABCE4C340E7; Mon, 24 Jan 2022 20:01:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054488; bh=sPspLDjSwcA/+CaLh+o2OAKsp197ZqFntPnughJxxdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bMyVPtQHdupblyZELIrIHw0ilOaQ4oMflYrHtVw0OZWyNwYkUbtfmAQEr9DtbVNsy yXA8S7kQQ+02LZtfo+olYtY3orM4uFf/ISFn7JteGO0Z1bYk5qOXwyzRRYj9xAssxM SRF6ubw+27MIxRaISSNH+Sj0zwM/4bTrsTzxWPKY= 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.10 406/563] parisc: Avoid calling faulthandler_disabled() twice Date: Mon, 24 Jan 2022 19:42:51 +0100 Message-Id: <20220124184038.488134638@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 43f56335759a4..269b737d26299 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c @@ -784,7 +784,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D00CCC433FE for ; Mon, 24 Jan 2022 20:29:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382807AbiAXU0T (ORCPT ); Mon, 24 Jan 2022 15:26:19 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53818 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376365AbiAXUBc (ORCPT ); Mon, 24 Jan 2022 15: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 dfw.source.kernel.org (Postfix) with ESMTPS id E0BBA6090A; Mon, 24 Jan 2022 20:01:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A387BC340E7; Mon, 24 Jan 2022 20:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054491; bh=EFtw07ghmDhsLRYEMt7OcljBkB5I335EQOUAD3LHu60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HsD+kffF935WcsvN4opJTo5kY7Vwq+j0n1pGHfLcSCs9ctifKKTbOVmrP/Av0EsYm jaDUwIe/RjJwFrp4WyP5M0I77a9ou+55a9sIfQ3Uxf+VhAk9LqyPXexH+OLmZb6C2K IIS1AvdgGJnK/AgTw0hQyOSEnTm0k1Wg/vz/oVE4= 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.10 407/563] scripts: sphinx-pre-install: Fix ctex support on Debian Date: Mon, 24 Jan 2022 19:42:52 +0100 Message-Id: <20220124184038.518662343@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- scripts/sphinx-pre-install | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install index 828a8615a9181..b32a20782c851 100755 --- a/scripts/sphinx-pre-install +++ b/scripts/sphinx-pre-install @@ -370,6 +370,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EA8CC433FE for ; Mon, 24 Jan 2022 20:18:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381054AbiAXUSt (ORCPT ); Mon, 24 Jan 2022 15:18:49 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44852 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353260AbiAXUBh (ORCPT ); Mon, 24 Jan 2022 15:01: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 6C155B8122F; Mon, 24 Jan 2022 20:01:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D309C340E5; Mon, 24 Jan 2022 20:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054494; bh=XKhNpFcyGUjE+sjTlejmD2OUYPSklbFBgEeUXUUIQe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UPU4jHB/7hZKEoubXPoZsU5KKFr++YmltxEJQmdIYTQt3Alr5Rx5V8artuy2hswLq 9T8JADaa8ULydhnUrI0yapJBBgRhv8Xy1kz7B1Q/vYNi1uok/4SJG3TB4dADHKhMdI 43s/bev1ns/KgMaKHSnAHWaxxOV7keTrVcZawfNU= 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.10 408/563] x86/kbuild: Enable CONFIG_KALLSYMS_ALL=y in the defconfigs Date: Mon, 24 Jan 2022 19:42:53 +0100 Message-Id: <20220124184038.548917070@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 78210793d357c..38d7acb9610cc 100644 --- a/arch/x86/configs/i386_defconfig +++ b/arch/x86/configs/i386_defconfig @@ -264,3 +264,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 9936528e19393..c6e587a9a6f85 100644 --- a/arch/x86/configs/x86_64_defconfig +++ b/arch/x86/configs/x86_64_defconfig @@ -260,3 +260,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F614C4321E for ; Mon, 24 Jan 2022 21:38:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377132AbiAXVgb (ORCPT ); Mon, 24 Jan 2022 16:36:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444312AbiAXVAh (ORCPT ); Mon, 24 Jan 2022 16:00: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 4B491C04D633; Mon, 24 Jan 2022 12:01: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 DF3B66090B; Mon, 24 Jan 2022 20:01:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A736BC340E5; Mon, 24 Jan 2022 20:01:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054500; bh=ETddzE3Lq3EU9bMSDlE2ShnRd8iiKQWFS2i5TL7wyWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWx7kK+a2gZ2x/jW/Fze8XJY7wrrRKvubX81FyWoMjL/tkXIh3j+4c5q0S5Q4gWFM XpOPakVryryDgP5kMhhD8mHBzD8XKIDNXapsWLhZjGncpwPJ2L3k/RLUSDxTIJWC8e 3jiLaX01MzxHavvsbXjsO5wXFrZ5u6ywITU1adlk= 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.10 409/563] powerpc/6xx: add missing of_node_put Date: Mon, 24 Jan 2022 19:42:54 +0100 Message-Id: <20220124184038.589674247@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a1b7f79a8a152..de10c13de15c6 100644 --- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c +++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c @@ -215,6 +215,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AF2AC433F5 for ; Mon, 24 Jan 2022 20:22:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381412AbiAXUWe (ORCPT ); Mon, 24 Jan 2022 15:22:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55976 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376418AbiAXUBp (ORCPT ); Mon, 24 Jan 2022 15:01: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 D428B60B02; Mon, 24 Jan 2022 20:01:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0F48C340E5; Mon, 24 Jan 2022 20:01:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054503; bh=KUsfQVHU2x96z/Fe4VrNN/7LI2bKQv8NRmV2m8PqQuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oHEai0rpA7pett1FSC9hPjUEYlNQ/BOR00pWng9gLjXe+rY+w7sGwfN3y5M5FqlX2 X8u57kcoajv0ockHnXEjmQ1hkkNOSZQIek6Nsi9rUweYIXVyuXOldpxSiJbgGC3WlI BePyvDH4/g76Tfk0YlO8baXEubIyHleGOJoGWRps= 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.10 410/563] powerpc/powernv: add missing of_node_put Date: Mon, 24 Jan 2022 19:42:55 +0100 Message-Id: <20220124184038.625401716@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 608569082ba0b..123a0e799b7bd 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7728C433EF for ; Mon, 24 Jan 2022 20:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352849AbiAXUTH (ORCPT ); Mon, 24 Jan 2022 15:19:07 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46698 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353278AbiAXUBt (ORCPT ); Mon, 24 Jan 2022 15:01: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 AE0E1B81249; Mon, 24 Jan 2022 20:01:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA4EAC340E5; Mon, 24 Jan 2022 20:01:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054506; bh=ZQuvwUhzXDZlVRJIFeNsyD+aS4ESV6Ln/kKFVT98EhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Duy8CZdr3sGVuqUEmdFoFyd2xAB1wPLBWO29NcGymlIihikzAZ4OsTy+jcu3XtSGj 67C7gGPMWmcj2Jhj+jTddMzRLRsMeQSpQRtTijzgx8S6qKtOFcRpA5etV9ZQP5VX0V s19O3q4J0ir0H2JGUOXQdG20BhALRKQbi/RSWOSg= 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.10 411/563] powerpc/cell: add missing of_node_put Date: Mon, 24 Jan 2022 19:42:56 +0100 Message-Id: <20220124184038.658328650@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 2124831cf57c0..d04079b34d7c2 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c @@ -976,6 +976,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67028C43217 for ; Mon, 24 Jan 2022 21:37:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345633AbiAXVgT (ORCPT ); Mon, 24 Jan 2022 16:36:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444320AbiAXVAi (ORCPT ); Mon, 24 Jan 2022 16:00: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 A9DE5C04D63A; Mon, 24 Jan 2022 12:01: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 70D4BB81239; Mon, 24 Jan 2022 20:01:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4C0DC340EA; Mon, 24 Jan 2022 20:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054509; bh=noPkjLggVRzhHtJtUyyY8AiSqQGvqU0JZkwRb0GYV3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tqZK/LYm8eZeDFp0CCfxYyT0j7jlRQE3Jyf+Rm0xTfGOf8HrbepC7W7vZI+obsnGC hj2K9Ie+gBt42imdKjHEoOr7oOYE7Z9SRRKUDFmcROWpWbyd4Fy1Riaf5ZSdUxeGgI pm3ZOwjQeWUbCZrPLfG0KEi1MHy/laQF/MbpUkZ0= 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.10 412/563] powerpc/btext: add missing of_node_put Date: Mon, 24 Jan 2022 19:42:57 +0100 Message-Id: <20220124184038.697652909@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C46FC433FE for ; Mon, 24 Jan 2022 21:38:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352049AbiAXVg1 (ORCPT ); Mon, 24 Jan 2022 16:36:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444317AbiAXVAi (ORCPT ); Mon, 24 Jan 2022 16:00: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 39F3CC04C04F; Mon, 24 Jan 2022 12:01: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 CAE8C6090B; Mon, 24 Jan 2022 20:01:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3E94C340E5; Mon, 24 Jan 2022 20:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054512; bh=fqghv2tM9KQdZtwnpamw7ZoE6favq2oByT6WYmfaJKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G3YCdU1SukD79N4aAelSjrIvls+sst2qU1+Uwx/wHrhOxWEDF1ZZpG8d93uYmRz4q AzGzd+bNgsDKfvwXhBnd0fkuTbo3TaJc5sgK5fHGdma5cAIAaVFloKyp13R8gOlK6K I/gw79OYlUQcvGOhwQJ/nPwiSZ+Ha6X4HPSLbM5M= 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.10 413/563] powerpc/watchdog: Fix missed watchdog reset due to memory ordering race Date: Mon, 24 Jan 2022 19:42:58 +0100 Message-Id: <20220124184038.729399483@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 af3c15a1d41eb..75b2a6c4db5a5 100644 --- a/arch/powerpc/kernel/watchdog.c +++ b/arch/powerpc/kernel/watchdog.c @@ -132,6 +132,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, @@ -217,13 +221,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; @@ -314,8 +349,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FFFBC433EF for ; Mon, 24 Jan 2022 20:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382348AbiAXUZc (ORCPT ); Mon, 24 Jan 2022 15:25:32 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45018 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353262AbiAXUCA (ORCPT ); Mon, 24 Jan 2022 15:02: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 8D8DDB8121A; Mon, 24 Jan 2022 20:01:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4C16C340E5; Mon, 24 Jan 2022 20:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054515; bh=gHJkcpYKXR/RhQBBuV2zUOoAWjs3ei98HPq/WqtjGlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RxT/LwrzdMcvb0o/8WoYEAXRBUqgPOFYa+5uwSceg+rs5HS9nW99qCESBdE67sZjk GvK4C8AMAMwDE42ErMtWmf0CGewd5/G0z1GqsabbXXCsABXqQhbglhduFF3uIFSl7Y sKD2LhJRim/X90RpjM2f8cYJ9V925zCBBWWE98Sk= 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.10 414/563] i2c: i801: Dont silently correct invalid transfer size Date: Mon, 24 Jan 2022 19:42:59 +0100 Message-Id: <20220124184038.762166278@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 eab6fd6b890eb..5618c1ff34dc3 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -797,6 +797,11 @@ static int i801_block_transaction(struct i801_priv *pr= iv, 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 */ @@ -810,16 +815,6 @@ static int i801_block_transaction(struct i801_priv *pr= iv, } } =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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBF6FC433F5 for ; Mon, 24 Jan 2022 20:20:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351911AbiAXUUm (ORCPT ); Mon, 24 Jan 2022 15:20:42 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58628 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354076AbiAXUCB (ORCPT ); Mon, 24 Jan 2022 15: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 0D47A60FEA; Mon, 24 Jan 2022 20:01:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C95DCC340E5; Mon, 24 Jan 2022 20:01:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054518; bh=JWXNqsVU8CyrmkM1MYCCOMy09l/9ViqNHqXM/QnraDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H6dyJ8IBtHOwPgmUTgrS75tlw5cl2H1WMSh1GJuawxq/e6L4MlyfhzafIfQsGmleS 7bA2zwuTIMvG/bmfwAzvC1mrq/5Ovqbm/1wkykZCANOEdcwfNYjQxhk01pyZ5QU722 7oN8RBxToEGHf9HUzren419ojS+2A5IlDnLlCEpQ= 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.10 415/563] powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING Date: Mon, 24 Jan 2022 19:43:00 +0100 Message-Id: <20220124184038.792431735@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 452cbf98bfd71..50aeef08aa470 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -1488,10 +1488,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20963C2BA4C for ; Mon, 24 Jan 2022 21:28:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1453120AbiAXV2G (ORCPT ); Mon, 24 Jan 2022 16:28:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444541AbiAXVBG (ORCPT ); Mon, 24 Jan 2022 16:01: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 836E3C04D63B; Mon, 24 Jan 2022 12:02: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 21F3361304; Mon, 24 Jan 2022 20:02:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7229C340E5; Mon, 24 Jan 2022 20:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054521; bh=sTCekZEw9uEAHrjdVyISUfUMGWrR2PuYEye6KgK+SL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DgKJxCsD2LOzpmlYYK5j0ev43HVTS/PlU7ellL6OKpP4OqfYjkGNo/z2vzA0XtZ8L Cu6IIRnfCcd8Uy2PLfk+RR0iNn3RK1kAJjbui9o5n4R2KP7MpevPJi/D+274MriW3p WiFyoAb3+VOjifMmfELVTUwYJGf/OwoTEJqceDkU= 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.10 416/563] i2c: mpc: Correct I2C reset procedure Date: Mon, 24 Jan 2022 19:43:01 +0100 Message-Id: <20220124184038.831581955@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 af349661fd769..8de8296d25831 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -105,23 +105,30 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id) /* 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_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) --=20 2.34.1 From nobody Tue Jun 30 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D359C433F5 for ; Mon, 24 Jan 2022 20:20:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356565AbiAXUTn (ORCPT ); Mon, 24 Jan 2022 15:19:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58696 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376532AbiAXUCG (ORCPT ); Mon, 24 Jan 2022 15:02: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 69E4061304; Mon, 24 Jan 2022 20:02:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52512C340E5; Mon, 24 Jan 2022 20:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054524; bh=GnC4qoc3qNiPeEEPfhsgJBYgncJZP5nIfaEdUe0w6x0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2KZFI77X4yFMVyRRwdB/vjXpvP+yIl0EhUdTG8SCfwQ9hCUaQHNM+USRCITweHR/3 /DkL/IAJ3P5/hWuyfaYRMZLpb3QTPi+o8DbbizQVLvm6zDeZia6vbho91/njBanvGv iq/jUyObLMw8g+Cg4qqdB97VSbLvMmvNP1EOpOzk= 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.10 417/563] clk: meson: gxbb: Fix the SDM_EN bit for MPLL0 on GXBB Date: Mon, 24 Jan 2022 19:43:02 +0100 Message-Id: <20220124184038.869757473@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 0a68af6eec3dd..d42551a46ec91 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -712,6 +712,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, @@ -748,7 +777,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, }, @@ -3043,7 +3081,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, @@ -3438,7 +3476,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B412C433FE for ; Tue, 25 Jan 2022 02:44:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355820AbiAYCoI (ORCPT ); Mon, 24 Jan 2022 21:44:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444551AbiAXVBH (ORCPT ); Mon, 24 Jan 2022 16:01: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 F19F5C055A81; Mon, 24 Jan 2022 12: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 937FB60B43; Mon, 24 Jan 2022 20:02:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62AADC340E5; Mon, 24 Jan 2022 20:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054528; bh=uC02QHBoKcdv9ttW/OShKG68uyhUyvnpqZMr6byhIJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WFJhtMFCiPMMhn5Bndt0KIUQ+4tZohhrcy4MF+zh0hiOGqrgZQQzl5zl/y5x0tfFB WoRtLWhRecEBFaGOynOoZJxUfZvjjj1hDTtb+ZKTPytpkif6B/WMm/mg+rY0pcf3Fq 6skvcjnRtTll2pJKoX77BpnYpFH4E+BHu7jFARAo= 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.10 418/563] powerpc/powermac: Add missing lockdep_register_key() Date: Mon, 24 Jan 2022 19:43:03 +0100 Message-Id: <20220124184038.907056929@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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! Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan ------------[ 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 764C1C4332F for ; Tue, 25 Jan 2022 02:44:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356314AbiAYCoL (ORCPT ); Mon, 24 Jan 2022 21:44:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444559AbiAXVBI (ORCPT ); Mon, 24 Jan 2022 16:01: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 9553CC055A84; Mon, 24 Jan 2022 12:02: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 35D076130D; Mon, 24 Jan 2022 20:02:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15E25C340E5; Mon, 24 Jan 2022 20:02:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054534; bh=LxtqiCU/HnTQBi7Y6RaZ5mzfJ2enE8ac2ayAJ6KDquo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MiJRrYFzm/cSjxF+/wzmcWYO+AbWlh8A3aSmUQx/ANk837ZrX2SaxXwLQhFfb1HOC 1dgc8nL/ZGzupU8ru+akJw40jabh5duKirQVMkkSpO4zwGCTLbpNrU3/Gst7bOgCTF xlTW7ereVAXFoR8l8FO5yxWG8zoIsPgKgrVRDShw= 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.10 419/563] KVM: PPC: Book3S: Suppress warnings when allocating too big memory slots Date: Mon, 24 Jan 2022 19:43:04 +0100 Message-Id: <20220124184038.943871029@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 175967a195c44..527c205d5a5f5 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -4557,8 +4557,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6E05C433EF for ; Mon, 24 Jan 2022 20:20:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356507AbiAXUTi (ORCPT ); Mon, 24 Jan 2022 15:19:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47026 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354144AbiAXUCU (ORCPT ); Mon, 24 Jan 2022 15:02: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 00DD0B8119E; Mon, 24 Jan 2022 20:02:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 273ADC340E5; Mon, 24 Jan 2022 20:02:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054537; bh=e21FpSYim1ygMkk92DWrzZG+FchegcpQRTza2xVC53M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vD5DOltpALMmFmalo5t2YDxcVjeGyDkpNyMy2SeN7ML2W5NxOWaldCZGs+QQ7zYEH HzGIdj8DX1Hw/0pCvLMPh7KdRvGaJTD2EcB+cIqpiCa2aWpKkMPhd8s9oMBaqG02kQ DttIORv1dxX+PQJnHaCSBSpNAyvatbexRrJ8S3Hk= 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.10 420/563] KVM: PPC: Book3S: Suppress failed alloc warning in H_COPY_TOFROM_GUEST Date: Mon, 24 Jan 2022 19:43:05 +0100 Message-Id: <20220124184038.983374046@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a5f1ae892ba68..d0b6c8c16c48a 100644 --- a/arch/powerpc/kvm/book3s_hv_nested.c +++ b/arch/powerpc/kvm/book3s_hv_nested.c @@ -510,7 +510,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAAF3C433F5 for ; Tue, 25 Jan 2022 02:44:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233802AbiAYCoR (ORCPT ); Mon, 24 Jan 2022 21:44:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444569AbiAXVBI (ORCPT ); Mon, 24 Jan 2022 16:01: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 B12CFC055A88; Mon, 24 Jan 2022 12:02: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 514CA60916; Mon, 24 Jan 2022 20:02:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 399EBC340E5; Mon, 24 Jan 2022 20:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054540; bh=6YKiuUS8IB5VXSiZrYfnABL7p33uLb807OzSPrmlgRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p44QetWohzSuKZVJBnXdsCciW4HIFLavFsxqfETagnBEsTi9dvtIfDBRBkSSiosP+ gc5aqhlp0XE/iaHdAwQU7JWzaW+zAiuz8WP+CdE7qKyi8WnJO3WTBKPHGVZdzRZDGr 2GBc3eZj+309xI0FOJjQAXDRqtxtg9wNhlwpovK4= 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.10 421/563] w1: Misuse of get_user()/put_user() reported by sparse Date: Mon, 24 Jan 2022 19:43:06 +0100 Message-Id: <20220124184039.015526617@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74FB7C433F5 for ; Tue, 25 Jan 2022 02:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412787AbiAYCpx (ORCPT ); Mon, 24 Jan 2022 21:45:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444565AbiAXVBI (ORCPT ); Mon, 24 Jan 2022 16:01: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 067FEC04D63F; Mon, 24 Jan 2022 12: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 dfw.source.kernel.org (Postfix) with ESMTPS id 8387361307; Mon, 24 Jan 2022 20:02:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DAA2C340E5; Mon, 24 Jan 2022 20:02:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054544; bh=Y5jlLYsWFAHRggd1xo9Vqx2B9cfFo1Wl0XfIsTSkE0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o4viPQVN6EhG+4xeuxl+CLLNKiV5qPI+gC5qU6kxGRLv2JuiOJlrXHeGAK0RikqoG 751M43a3SUS/2QjBgjQ9Pjp1S0QhjgPlO85VK1GNQLJctjDONnREQAWEc19T489M9H xPlvZOT9KiKrTd+pvuCAPTDLaUk0SxXF2KKW1PHg= 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.10 422/563] nvmem: core: set size for sysfs bin file Date: Mon, 24 Jan 2022 19:43:07 +0100 Message-Id: <20220124184039.054739776@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/nvmem/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 6b170083cd248..21d89d80d0838 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -222,6 +222,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C60DC2BA4C for ; Mon, 24 Jan 2022 21:43:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456839AbiAXVkM (ORCPT ); Mon, 24 Jan 2022 16:40:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444615AbiAXVBM (ORCPT ); Mon, 24 Jan 2022 16:01: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 6478AC04C060; Mon, 24 Jan 2022 12:02: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 2BC7BB81218; Mon, 24 Jan 2022 20:02:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57E8BC340E5; Mon, 24 Jan 2022 20:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054546; bh=6SWFNtQAhiPbgkd6kdbFRMEtXk7VCljfVemFjaj60sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2TpbxtHNAAmY+5e0j0RBMk9jmrs0WE5NBAZIgYu6fInyIsMh7TeKkzWpK8kCc2jwX 2n6YczDxr4hr7W24+FsRbZyNJLPHO21HurcSWuKPUCFomzNB1GI8Bdh8D4OA/dRvYS Yz/7zPRcZotPmyGXyiN71MfGnYdDA+BwDBRYxE54= 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.10 423/563] dm: fix alloc_dax error handling in alloc_dev Date: Mon, 24 Jan 2022 19:43:08 +0100 Message-Id: <20220124184039.092847415@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 19a70f434029b..6030cba5b0382 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1894,8 +1894,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 add_disk_no_queue_reg(md->disk); --=20 2.34.1 From nobody Tue Jun 30 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96D86C433F5 for ; Mon, 24 Jan 2022 21:43:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1456517AbiAXVjZ (ORCPT ); Mon, 24 Jan 2022 16:39:25 -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 S1444637AbiAXVBO (ORCPT ); Mon, 24 Jan 2022 16:01: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 B0377C04C068; Mon, 24 Jan 2022 12:02: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 4AC8FB811F3; Mon, 24 Jan 2022 20:02:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DD5EC340E5; Mon, 24 Jan 2022 20:02:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054550; bh=7VnSDqdkBWFz1nn1/t8V7f8JUax9ks0u9dReuL6ZEqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wAPQNwJNP+h106dazvuknqHwLHUj9/BRhkWB2PnD8yNsnu0unqDvprSXfFIX/AFC5 ne5oOmgatxhasDIfumeEfxkpTpdSACqy3YIKq80heDJOfRoW6Wi+d7Pv5X04RhF39R gXRVDsZSJfzWFTd3+nzALHITSWZIsqk2fz8/0Yy4= 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.10 424/563] scsi: lpfc: Trigger SLI4 firmware dump before doing driver cleanup Date: Mon, 24 Jan 2022 19:43:09 +0100 Message-Id: <20220124184039.126441654@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 93e507677bdcb..0273bf3918ff3 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -763,7 +763,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 @@ -772,6 +771,7 @@ struct lpfc_hba { #define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */ #define HBA_DEFER_FLOGI 0x800000 /* Defer FLOGI till read_sparm cmpl */ =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 2c59a5bf35390..727b7ba4d8f82 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -1536,25 +1536,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 @@ -1583,24 +1583,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 f4a672e549716..68ff233f936e5 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -635,10 +635,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 06a23718a7c7f..1a9522baba484 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -4629,12 +4629,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68037C4167D for ; Tue, 25 Jan 2022 03:00:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314825AbiAYCvy (ORCPT ); Mon, 24 Jan 2022 21:51:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348365AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 BB20BC055A9D; Mon, 24 Jan 2022 12: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 dfw.source.kernel.org (Postfix) with ESMTPS id 30D726131B; Mon, 24 Jan 2022 20:04:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F40EDC340E5; Mon, 24 Jan 2022 20:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054677; bh=khj1TPKAGtqZ8SRnFW3L1kpEHrsWYchWuXRxLdSbLMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FHXsymWalUxw042jk9i3cMv0kETAce32+0T6WfoqMIl9Y9YUVgrH4zlHDet6Ob89w x5DO8mdT6vjxQqpsm4kmJWq0hDjuPikmvenfTfwPE7K5E0jgyiT3TLdpFaoYr5cc31 sYXXoVcfma3K3bDuCjou5tD2eAjBYQQyHJxtqVUI= 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.10 425/563] ALSA: seq: Set upper limit of processed events Date: Mon, 24 Jan 2022 19:43:10 +0100 Message-Id: <20220124184039.156668491@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 71a6ea62c3be7..4ff0b927230c2 100644 --- a/sound/core/seq/seq_queue.c +++ b/sound/core/seq/seq_queue.c @@ -234,12 +234,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; @@ -262,6 +265,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... */ @@ -271,14 +276,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D357C4332F for ; Mon, 24 Jan 2022 20:20:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381196AbiAXUTw (ORCPT ); Mon, 24 Jan 2022 15:19:52 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59400 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348557AbiAXUCz (ORCPT ); Mon, 24 Jan 2022 15:02: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 8E11B6131F; Mon, 24 Jan 2022 20:02:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FF9BC340E5; Mon, 24 Jan 2022 20:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054574; bh=rB6Zg+CMwhJliJX6NAPO6qIY5v6Ys7TXXUv50Yzxacg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sswXCAV4X248aYiQESxLlqyV3osR+9BRqNCNJESgV1o5nNvKO98mvbJyhhqqAW1NV FMxZ5eZgGoASoL0wh9pZGb5jxXCIKs/LWJeQSiSD1gTJcxrbovWWO6iatoow85CnEn E5MGUPLCcANaLTJSKTelFKA/Mk6M9ScmTYfFyqE0= 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.10 426/563] MIPS: Loongson64: Use three arguments for slti Date: Mon, 24 Jan 2022 19:43:11 +0100 Message-Id: <20220124184039.187543162@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 87a5bfbf8cfe9..28572ddfb004a 100644 --- a/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h +++ b/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h @@ -36,7 +36,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: @@ -71,7 +71,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E44EC4332F for ; Mon, 24 Jan 2022 20:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382427AbiAXUZk (ORCPT ); Mon, 24 Jan 2022 15:25:40 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59946 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353551AbiAXUDa (ORCPT ); Mon, 24 Jan 2022 15:03: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 EE3B06131D; Mon, 24 Jan 2022 20:03:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D28C1C340E5; Mon, 24 Jan 2022 20:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054607; bh=LeyIUgvkFtpWE6KUzBcR44hgBmbAuYis0U7utztFNFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QGQQDY/HwEHrisLD+MRjFojNdAvqI2VNuD0uR73/qjU4UzxCv/pkYQxsuudeHM7+g LgnNG/OfJty2WPuxkI7psdJmCH9gVjBjkbEDzW4lpbWDWWd9dzsYgyhDWHih1RkLSf G91rT9bndQbhB8zH9JaF5XNUMLzf48uG56DZE2IY= 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.10 427/563] powerpc/40x: Map 32Mbytes of memory at startup Date: Mon, 24 Jan 2022 19:43:12 +0100 Message-Id: <20220124184039.220968113@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 a1ae00689e0f4..aeb9bc9958749 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 @@ -626,7 +627,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: @@ -663,6 +664,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08936C433F5 for ; Mon, 24 Jan 2022 20:23:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344673AbiAXUXG (ORCPT ); Mon, 24 Jan 2022 15:23:06 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48096 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376814AbiAXUEG (ORCPT ); Mon, 24 Jan 2022 15:04: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 454BDB81229; Mon, 24 Jan 2022 20:04:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75399C340E5; Mon, 24 Jan 2022 20:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054641; bh=/+mI8nrRREij5JDaj6gEO/h76K+KA7kZdaVgSdBD+Fk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RvOtHKfvir77WWjSlgwYJBiZmQkCdbrYjk0LzaU0r5zlUiiRKo58CqMRowR+vvjfL jNve9bWYcY0d80I1o43obPRie5xof185qZSBaZi2qwQVu5zGaPeucJfXJqLp/fw+Xy NPp4ilY2aNUEvyeHYdZRMWn0AHuwohK4ePQQKe9M= 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.10 428/563] selftests/powerpc/spectre_v2: Return skip code when miss_percent is high Date: Mon, 24 Jan 2022 19:43:13 +0100 Message-Id: <20220124184039.253521440@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF28DC433EF for ; Tue, 25 Jan 2022 03:00:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314506AbiAYCvI (ORCPT ); Mon, 24 Jan 2022 21:51:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445655AbiAXVEm (ORCPT ); Mon, 24 Jan 2022 16:04:42 -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 74527C068090; Mon, 24 Jan 2022 12:04: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 3B780B811FB; Mon, 24 Jan 2022 20:04:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DF09C340E5; Mon, 24 Jan 2022 20:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054659; bh=Aqzs6TyYmoFSONdI2u4ZRgTSfsF8vwjIks/uERB6+TQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tRcTrICOhJgCTmJYpAqnqpf+syd7eNa0hkkOea2q6EBaJ0vsLPFiIBbKCEvB1waW5 dhA9QCWfCVN6WslJSEir5dWk5npJZaSVF7BAXGCTfgIY+JtXlWgj7uxy7NZu2ODbgw PluLpX9qB42dKm2Ted/6JSfu6ekjX4dERD15kP9w= 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.10 429/563] powerpc: handle kdump appropriately with crash_kexec_post_notifiers option Date: Mon, 24 Jan 2022 19:43:14 +0100 Message-Id: <20220124184039.294568624@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 50aeef08aa470..d993f28107afa 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -594,6 +594,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF5AAC4332F for ; Mon, 24 Jan 2022 21:44:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457494AbiAXVlo (ORCPT ); Mon, 24 Jan 2022 16:41:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445659AbiAXVEm (ORCPT ); Mon, 24 Jan 2022 16:04:42 -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 94472C06B5BB; Mon, 24 Jan 2022 12:04: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 5D7A9B8119E; Mon, 24 Jan 2022 20:04:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E1F8C340E7; Mon, 24 Jan 2022 20:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054662; bh=0w4R2NHgExzeD9t+H0AsT8Etmds2t5Ti0YZB3Jt+H/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EcV090jptT92hrwxE1p5EKXWgtS8o7UoCSm4NlhWv33gkg1oB83PbpZHtchjqNuyx 7qVWnLMgzlqSJnXoZ+Eevo7ZjSMMZDkDTuIJI7FgqwIOGHPTRmEmHxOmEJLN7r9XHf HKIi4IwXLIWzW1qY3Oy9U4136jQoQQLMP181krqw= 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.10 430/563] powerpc/fadump: Fix inaccurate CPU state info in vmcore generated with panic Date: Mon, 24 Jan 2022 19:43:15 +0100 Message-Id: <20220124184039.325859101@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 eddf362caedce..c3bb800dc4352 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 d993f28107afa..cf99f57aed822 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -60,6 +60,7 @@ #include #include #include +#include =20 #ifdef DEBUG #include @@ -612,6 +613,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52D6FC433EF for ; Mon, 24 Jan 2022 20:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351241AbiAXUXy (ORCPT ); Mon, 24 Jan 2022 15:23:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60764 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349002AbiAXUE0 (ORCPT ); Mon, 24 Jan 2022 15:04: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 EDB7860FEA; Mon, 24 Jan 2022 20:04:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B71ACC340E5; Mon, 24 Jan 2022 20:04:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054665; bh=4KlIyUwdaU0SslnKI/s1L0XxnUs5SxyM+C11F7GRPMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SHgLwC+iY8Y+ZOVRA/jYhPn3zDdQVw8AB/FkbIWP3tPQ+QRpsFG3z+1DI1jmfyord ui/lKPol8rZr06Xw5eXfGodWdD7+tS5+lvm2HXd1FE126POsXgtFwusaYLlQWEsirj k8ONNkjRFXSm3PQop4MDQbMH01fj7UWcqRkDizIM= 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.10 431/563] udf: Fix error handling in udf_new_inode() Date: Mon, 24 Jan 2022 19:43:16 +0100 Message-Id: <20220124184039.356522375@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/udf/ialloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 84ed23edebfd3..87a77bf70ee19 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A658C3526C for ; Tue, 25 Jan 2022 03:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314770AbiAYCvo (ORCPT ); Mon, 24 Jan 2022 21:51:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347065AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 05737C055A94; Mon, 24 Jan 2022 12:04: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 B6A13B811FB; Mon, 24 Jan 2022 20:04:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E21B9C340E5; Mon, 24 Jan 2022 20:04:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054668; bh=1W7QnzWemca3+VHrxEBDJsad3MM3/pf0E4IB4zUs6LA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p8GcmPvcQA6sgSZ+00ofn+xjsHT7CIPoDKBnUZibiXyvmqOOXP/KHHFTtV2lex4cS u0T0mQubQYJ82mYLlwXpbTV8mIkQX4yLcivF9cVTOQPv/s8XlFey8KffBmqzqjrXwo nhKr6zPKsEi/b+YXcGJ3TtGkRHik64upYyq8ablU= 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.10 432/563] MIPS: OCTEON: add put_device() after of_find_device_by_node() Date: Mon, 24 Jan 2022 19:43:17 +0100 Message-Id: <20220124184039.394739063@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 950e6c6e86297..fa87e5aa1811d 100644 --- a/arch/mips/cavium-octeon/octeon-usb.c +++ b/arch/mips/cavium-octeon/octeon-usb.c @@ -544,6 +544,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3A61C4321E for ; Tue, 25 Jan 2022 03:00:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314806AbiAYCvs (ORCPT ); Mon, 24 Jan 2022 21:51:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347317AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 7C712C055A97; Mon, 24 Jan 2022 12:04: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 09BF161357; Mon, 24 Jan 2022 20:04:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB007C340E5; Mon, 24 Jan 2022 20:04:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054671; bh=TCMAxjkJB9dgoIXSVmuuBks01Ti+Fg5Kyhrp6E1okHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DlqVVy0Ri6sg23/kQTRjdVd/x31vNOqjesvEa0NlsqOD4GYPRA7DDaZJtJxJwjVKa EA+ehfVAXiU3c3O7MXaTgfFrsvJTKbvLT46WsyfxDMVyKa3u6gCHgorvLh3kkYgiN0 RrWanrZ/q3Kk/ad3fuwHELo0lf85K6PsrkoKbdSM= 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.10 433/563] irqchip/gic-v4: Disable redistributors view of the VPE table at boot time Date: Mon, 24 Jan 2022 19:43:18 +0100 Message-Id: <20220124184039.425602485@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 1bdb7acf445f4..04d1b3963b6ba 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -915,6 +915,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4AE9C4167B for ; Tue, 25 Jan 2022 03:00:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314787AbiAYCvq (ORCPT ); Mon, 24 Jan 2022 21:51:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347052AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 80999C055A9B; Mon, 24 Jan 2022 12:04: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 0877C61304; Mon, 24 Jan 2022 20:04:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11671C340E5; Mon, 24 Jan 2022 20:04:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054674; bh=BWshRrCtXTPjXgm2ZsCn2D+lTq5Noo72zfMsLxKXsYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yaRxSTYnQIHlHc/aRruTqfyPYv2r5udOcKMq26yeaoDoJhcowhF65gSD2OIcK+A14 AWUcKAoYyEizVUjc1goLgiM/T5vf3PxmNC/uPB907AZzwmUAuJ8Muw/2wGkKl937gY BsUj34GSGmctQ1L0sIWAG3aD5stbiNiY/KE2UxAM= 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.10 434/563] i2c: designware-pci: Fix to change data types of hcnt and lcnt parameters Date: Mon, 24 Jan 2022 19:43:19 +0100 Message-Id: <20220124184039.456440317@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 55c83a7a24f36..56c87ade0e89d 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -37,10 +37,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1C1BC433F5 for ; Mon, 24 Jan 2022 21:44:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457048AbiAXVkr (ORCPT ); Mon, 24 Jan 2022 16:40:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445273AbiAXVCi (ORCPT ); Mon, 24 Jan 2022 16:02: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 15E5EC06B580; Mon, 24 Jan 2022 12: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 A9C3D60916; Mon, 24 Jan 2022 20:02:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F94BC340E5; Mon, 24 Jan 2022 20:02:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054577; bh=HTUHJVVdTyLs2HI+l2PKLckftklMLQZY10KtFgY2Q+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jddJedW3P03s2L2udHVHEoe1nagbxGWeDhh8wSPg2AAmHMmztmKdLg941j6raiA3Z FrEzLHwKa04hLFP1UF1/VhfyCJxJnWXfxHt3V/+LEAxPrjomx1ZD5ggIeHoY9It3Oq fgtSdtgwGb/RD1qWOaQVymOp6rlqfFTNTxP/tzlE= 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.10 435/563] MIPS: Octeon: Fix build errors using clang Date: Mon, 24 Jan 2022 19:43:20 +0100 Message-Id: <20220124184039.489830457@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 c114a7ba0badd..e77e8b7c00838 100644 --- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h +++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h @@ -317,7 +317,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) { @@ -408,7 +408,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE34BC43217 for ; Tue, 25 Jan 2022 03:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1313289AbiAYCsQ (ORCPT ); Mon, 24 Jan 2022 21:48:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355765AbiAXVDJ (ORCPT ); Mon, 24 Jan 2022 16:03: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 ED392C06B584; Mon, 24 Jan 2022 12:03: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 880DF6131E; Mon, 24 Jan 2022 20:03:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 994DFC340E5; Mon, 24 Jan 2022 20:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054580; bh=etu1+QawpUz4kFPhtE4lzzUtDzxSXDESMys7UCF3mVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hd1ACcFDUOzjzhLAUozl24JESmzXkjYdfGfxtVlZrDzwIs4ZUcBoXCeXq6YrSBCnO Ab47ThMKXfXH4Ktzv7Vz7UTlt4Ee41QE2dSHLpRZdjShpqngFqROAB26t5hn5stBYs 53BftVH3ZYBoss7LbyUwpuOsTlY7yk48oXInzOo8= 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.10 436/563] scsi: sr: Dont use GFP_DMA Date: Mon, 24 Jan 2022 19:43:21 +0100 Message-Id: <20220124184039.521251314@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 4cb4ab9c6137e..464418413ced0 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -917,7 +917,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 788E9C433EF for ; Mon, 24 Jan 2022 20:20:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345593AbiAXUUa (ORCPT ); Mon, 24 Jan 2022 15:20:30 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59572 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351367AbiAXUDE (ORCPT ); Mon, 24 Jan 2022 15:03: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 A12D36090B; Mon, 24 Jan 2022 20:03:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B015C340E5; Mon, 24 Jan 2022 20:03:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054583; bh=dPNDS9c1FKRDuq5vFo9z89Gbkjn2n1/fPgl2lhDlYk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tYvqzebEzQ99d3TGOYjjZBLhc6EpMSPu2myjK34DwRBa/fNDOBv0InR/gr1ACiRtO a/MKR4BZGtv4WKpJMhIbsAWrUZSx9Bjqs79GCT1HMpbdFyqbVHXOXzff/7SVsI/elg yS6zyn7loELLVe760ct75GatZeGOsjrnUMXRLyC0= 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.10 437/563] ASoC: mediatek: mt8173: fix device_node leak Date: Mon, 24 Jan 2022 19:43:22 +0100 Message-Id: <20220124184039.560360245@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 c28ebf891cb05..e168d31f44459 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD0BFC433EF for ; Tue, 25 Jan 2022 03:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1313750AbiAYCtP (ORCPT ); Mon, 24 Jan 2022 21:49:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358665AbiAXVDK (ORCPT ); Mon, 24 Jan 2022 16:03: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 30996C06B58B; Mon, 24 Jan 2022 12:03: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 A09C661320; Mon, 24 Jan 2022 20:03:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87D3BC340E8; Mon, 24 Jan 2022 20:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054586; bh=ZqzrJaiaGVNMXGWL+p/VujNjJlhpChX0ptTIT8Wsttc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ywPtpdH5EqgBVH0olyPKIJqfHKEo/UkGN9v+a1N+kBoe5/ow2AOeJLQMDMkjKw6Jz QabSZpEUWyKG+7QKYtOjIXJFraogTs9nbN95ZKGW/8qVHNiiDCnX1F1cU0q3/Yc5HD n2SiyNNSbcBelPvN+eCYTLnI0S6F3D7cLEOqlG+Q= 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.10 438/563] ASoC: mediatek: mt8183: fix device_node leak Date: Mon, 24 Jan 2022 19:43:23 +0100 Message-Id: <20220124184039.590688431@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 20d31b69a5c00..9cc0f26b08fbc 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -787,7 +787,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 79ba2f2d84522..14ce8b93597f3 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -720,7 +720,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB184C4321E for ; Tue, 25 Jan 2022 03:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1313831AbiAYCt1 (ORCPT ); Mon, 24 Jan 2022 21:49:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359085AbiAXVDK (ORCPT ); Mon, 24 Jan 2022 16:03: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 8DE44C06B58F; Mon, 24 Jan 2022 12:03: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 54D57B811A2; Mon, 24 Jan 2022 20:03:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8299CC340E7; Mon, 24 Jan 2022 20:03:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054589; bh=zqxVLJAQDSMqLlm3O2uF0y8g2XadcjGY1EzyOllkM8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vydQOeFrIT2/cK6AHjEdEkt6aZwk6l+bQvQuBKxQKdF0QNuI3IXu4UCmDPg2TmhXc AHeFOATyDI82HmdzWnyezADXmmFBRvm99iYfTcQ0t3019JSa441DZrLEdpROLZhT8X ZhuCwTX7af6e8GcCcFQBxaZhYuHfJP9NH8U6VcQc= 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.10 439/563] phy: mediatek: Fix missing check in mtk_mipi_tx_probe Date: Mon, 24 Jan 2022 19:43:24 +0100 Message-Id: <20220124184039.621669542@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_mipi_tx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c b/drivers/gpu/drm/media= tek/mtk_mipi_tx.c index 8cee2591e7284..ccc742dc78bd9 100644 --- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c +++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c @@ -147,6 +147,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 mem =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); mipi_tx->regs =3D devm_ioremap_resource(dev, mem); --=20 2.34.1 From nobody Tue Jun 30 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C74DC433EF for ; Mon, 24 Jan 2022 20:21:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346628AbiAXUV2 (ORCPT ); Mon, 24 Jan 2022 15:21:28 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46142 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353538AbiAXUDQ (ORCPT ); Mon, 24 Jan 2022 15:03: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 7F79EB811F9; Mon, 24 Jan 2022 20:03:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BF20C340E5; Mon, 24 Jan 2022 20:03:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054592; bh=n3NJfTp/Pp/vZAidsmeEXWJbiKjAhzMri3BOT8j4izQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T7V656C0TMN7/D2l3skAeVWwHdhqqvm/Y0DwMtI0ngy+ZqqJcaqjV2H7jyNm3NZPN byH2u+AExK/aHGBxdnYXanv/Ic8J5ulZpI4np1AX7H5p9UKzp7aV+opM/hdsNJE/oN pgWZFD7S+lYgUxqtt8+q/uD1CTqY5vbu+rIBPYVw= 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.10 440/563] rpmsg: core: Clean up resources on announce_create failure. Date: Mon, 24 Jan 2022 19:43:25 +0100 Message-Id: <20220124184039.652086378@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -473,13 +473,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BA02C433EF for ; Mon, 24 Jan 2022 20:21:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356210AbiAXUVR (ORCPT ); Mon, 24 Jan 2022 15:21:17 -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 S1376600AbiAXUDR (ORCPT ); Mon, 24 Jan 2022 15:03: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 B357760916; Mon, 24 Jan 2022 20:03:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C9E3C340E5; Mon, 24 Jan 2022 20:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054595; bh=Vub3gPcbHXrEudD6mir+BV04nfHnrQJy1HXlwH2MdRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ctw6Eq3zsr3iiPR5KS/zNJvIc1BEvc1W/AJ+e84x9SQvNPWUxm22Fig0n2TPRHZW3 8HcWzGTWM5QESJZKuMQ5w74zMZK4Cq18Mcvi2Xy6yuRWLPdpEInBUiXvS1HBugOorc QjmjWqn54bJkzeBy8fTTYpJB3Ln2vD/vriBRZhMA= 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.10 441/563] crypto: omap-aes - Fix broken pm_runtime_and_get() usage Date: Mon, 24 Jan 2022 19:43:26 +0100 Message-Id: <20220124184039.689890360@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1977C43217 for ; Tue, 25 Jan 2022 03:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1313778AbiAYCtS (ORCPT ); Mon, 24 Jan 2022 21:49:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359323AbiAXVDK (ORCPT ); Mon, 24 Jan 2022 16:03: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 7A7BCC06B598; Mon, 24 Jan 2022 12:03: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 14F3761028; Mon, 24 Jan 2022 20:03:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BE73C340E5; Mon, 24 Jan 2022 20:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054598; bh=8FTpx20CPyOOXFtNwPoa4MCozejgitLRpKaNV6dHwN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2uXhrS5LYE7aqHTgB7Vo5vnahaQrEHrsLMtXU2KdGbMqgq4rD71hOJax6vk6AgXd4 52KwkKF+wE5MsKD3bL+ok0xU+JaOVqgCfKdGMhZe2qD33XFh8jSUWjAkS/NvRT8+Md DaGEaBsQ/McaZgTyxNDHqWgABllFAR6wpxgRbWSc= 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.10 442/563] crypto: stm32/crc32 - Fix kernel BUG triggered in probe() Date: Mon, 24 Jan 2022 19:43:27 +0100 Message-Id: <20220124184039.729742844@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 876BDC433FE for ; Tue, 25 Jan 2022 03:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1313497AbiAYCsl (ORCPT ); Mon, 24 Jan 2022 21:48:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359346AbiAXVDK (ORCPT ); Mon, 24 Jan 2022 16:03: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 76CDFC06B59A; Mon, 24 Jan 2022 12:03: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 16FDA61028; Mon, 24 Jan 2022 20:03:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4D99C340E7; Mon, 24 Jan 2022 20:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054601; bh=6xbJmd6f01+fZLlPBClTdRN12VoLGcHc5990lZQbkJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M1mB4GP8Qng3KR9rsaznkilHLKrJUN2nOhPHJuU/WapKOdDQdQ/RHru5TPOcLOqOC 0BJ+f/ZvBr3twbi0+R/BzHNjmDmV0k33Pj0Jj2reTBCH9cqkzSq4iaanCJhcx/xuej GkvRsg3iEfF7J0ECWxcDOyWDzJtGcFwv1HTG6KyM= 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.10 443/563] crypto: caam - replace this_cpu_ptr with raw_cpu_ptr Date: Mon, 24 Jan 2022 19:43:28 +0100 Message-Id: <20220124184039.770132103@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -5467,7 +5467,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0D72C43217 for ; Mon, 24 Jan 2022 20:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382572AbiAXUZy (ORCPT ); Mon, 24 Jan 2022 15:25:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59868 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376632AbiAXUD1 (ORCPT ); Mon, 24 Jan 2022 15:03: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 2ABA8612F5; Mon, 24 Jan 2022 20:03:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07228C340E5; Mon, 24 Jan 2022 20:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054604; bh=BsOquwzcCQW5R6uppJmiiyzG8hpOx4nUbKNuwlUKS3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WwoAoW8C6JwaXwJ8TMrs8Fbppm6iaYh/7fhGWHWb1IPlA6IBghK3+V6efcjYVV7XZ 6OHM1G2/cWl3bOWwqb9ynqGQr1Qq9e1rITJsTY1alb+kz3TddyK2Vj33HgBoXfb7N/ Ul9hdxF8wxInV5/UE9gzvjk2tbv+axENYW43fDFQ= 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.10 444/563] ubifs: Error path in ubifs_remount_rw() seems to wrongly free write buffers Date: Mon, 24 Jan 2022 19:43:29 +0100 Message-Id: <20220124184039.811108277@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6FA8C433EF for ; Mon, 24 Jan 2022 20:21:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350495AbiAXUVp (ORCPT ); Mon, 24 Jan 2022 15:21:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47728 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352290AbiAXUDd (ORCPT ); Mon, 24 Jan 2022 15:03: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 BDD7BB80FA1; Mon, 24 Jan 2022 20:03:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EED24C340E5; Mon, 24 Jan 2022 20:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054610; bh=fKi7ZwPG8n0+BGVYMxk00IA52PoG1YjyUx5UZx1Vb/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IXbm1vNFKuVxYVWc9sVbQQitjpL9vgq8DHgcCkIVWsXi4l3L+RRZSA+LSGTPYOH1+ itv4ZC6BtDEEymd18uCfk7TpiErh2DXdcHtjql/RVlZJNHz0gjB9UEFnV7gnNvz1Ac q4K5YLqwlrzlS5Lh8zjfvMNmmoIv3yxu1J0Ys9JI= 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.10 445/563] tpm: fix NPE on probe for missing device Date: Mon, 24 Jan 2022 19:43:30 +0100 Message-Id: <20220124184039.846941886@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99891C4332F for ; Mon, 24 Jan 2022 20:21:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351161AbiAXUVx (ORCPT ); Mon, 24 Jan 2022 15:21:53 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60038 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376685AbiAXUDe (ORCPT ); Mon, 24 Jan 2022 15:03: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 2A03E6131E; Mon, 24 Jan 2022 20:03:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A066C340E5; Mon, 24 Jan 2022 20:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054613; bh=9YkuKF8cpwuIWjIHtOGRypGioyQeoLf8mYpkm6MpMf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mbvbB2ASsm1EhDFU0quxdyq+w8VRsvC+S0qvBgBonNJlOYv9KkYpRfbS1m9rSrag9 ljHWg3vSbPm4/ylcGB+uDTk5eBuRqmWZvM+3FONxcrGpoXeB6x3uBhl+POxEUJcm1b NHvz4IIvSZUGwKEpzbWRCFjx50edI5TQ471eArHo= 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.10 446/563] spi: uniphier: Fix a bug that doesnt point to private data correctly Date: Mon, 24 Jan 2022 19:43:31 +0100 Message-Id: <20220124184039.877813877@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B22DC4332F for ; Tue, 25 Jan 2022 03:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1313559AbiAYCss (ORCPT ); Mon, 24 Jan 2022 21:48:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359523AbiAXVDK (ORCPT ); Mon, 24 Jan 2022 16:03: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 899D2C06B5A2; Mon, 24 Jan 2022 12:03: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 2A77161333; Mon, 24 Jan 2022 20:03:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01A9FC340E5; Mon, 24 Jan 2022 20:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054616; bh=lRlIHxLA+FhWCYJVfDqIdzQVSQrZgqEhG2DBKd2bWcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ugOUh+ratmJmDOWIFfv5Vq/CF5vAKogQlUyQS+kawCwA9W9czIWmUi1qxyPUmXi+N ALWR8S7JpfKuekQDosr01GZgHZAImyFL/B2BoF/BRVFNgVG6Ay9rAfFfMpmkjTWq97 zNUeF0cilW+VJfKJLEhnUQediNk0l44kmxJasQJs= 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.10 447/563] xen/gntdev: fix unmap notification order Date: Mon, 24 Jan 2022 19:43:32 +0100 Message-Id: <20220124184039.913055821@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/xen/gntdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -240,13 +240,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A1BEC433F5 for ; Mon, 24 Jan 2022 20:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350609AbiAXUWF (ORCPT ); Mon, 24 Jan 2022 15:22:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60126 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353664AbiAXUDm (ORCPT ); Mon, 24 Jan 2022 15:03: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 0A67461028; Mon, 24 Jan 2022 20:03:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6A12C340E5; Mon, 24 Jan 2022 20:03:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054619; bh=atTkGfMMk75fom7jlFBYADegWZNkmEzSAJvW2WQSJ6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kyi+ljwMVYLzYQkhBAhFmWgQiah4lAI6reeKU0ZZuzDl6afQDHayLZRmKb/x/n7i1 BqlIrR+riKxFu72xbN+uDnoe8HPAMJ0frYFIPhYRnov6ZU6Obg64GjdyFU7/hLI9Da f0kvKEbTUbtVt88xopQgfHuu8XknHcGRbgYXLVS0= 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.10 448/563] fuse: Pass correct lend value to filemap_write_and_wait_range() Date: Mon, 24 Jan 2022 19:43:33 +0100 Message-Id: <20220124184039.952113162@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/fuse/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -3251,7 +3251,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 332E5C3526E for ; Mon, 24 Jan 2022 20:29:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382610AbiAXUZ7 (ORCPT ); Mon, 24 Jan 2022 15:25:59 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60156 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376720AbiAXUDo (ORCPT ); Mon, 24 Jan 2022 15:03: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 2ECAD6091B; Mon, 24 Jan 2022 20:03:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3147C340E5; Mon, 24 Jan 2022 20:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054622; bh=uAlWWnbqersf2Iz6eORks7ljC27rMrLewZjq8ZOs8Hw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fYjUY/4Fn3f2fKeJXF7YP/152QdTkZe1swQ95VtEaHe16H2cCIq7K076GQWb5jDcJ n8oZLHGkKrDeP4la8FL2y1teFZpCyuHuxvs9LXu5Jq/LCrtLBJfi8+sKbsN4RMlXw4 y7xXb9UYlWD8v9NfybSnKfzFGJMafVMIIhK2BM9E= 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.10 449/563] serial: Fix incorrect rs485 polarity on uart open Date: Mon, 24 Jan 2022 19:43:34 +0100 Message-Id: <20220124184039.984110724@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9987C433F5 for ; Mon, 24 Jan 2022 20:22:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349274AbiAXUWZ (ORCPT ); Mon, 24 Jan 2022 15:22:25 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60202 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347024AbiAXUDq (ORCPT ); Mon, 24 Jan 2022 15: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 dfw.source.kernel.org (Postfix) with ESMTPS id 2917B6132F; Mon, 24 Jan 2022 20:03:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 011F9C340E5; Mon, 24 Jan 2022 20:03:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054625; bh=QaemAATjchbPUysn33dPWc1b6QtCHkameZcT4eNz62Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YQ2QXWbLVwr5rGoQlktUwy+Rz/7dZeGoaV60VVH53ZWi02PgZ4uHogrUuiH9mD13j KYOYXls8hLOsQriXgR27YtSnc0b+HkCgUXgC+15xB84O6DhLx7KpEopt4qKZ+cfFyf xD525ErRjqLoiTPd9ReTWGQlU7JPWM9+IuWipoww= 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.10 450/563] cputime, cpuacct: Include guest time in user time in cpuacct.stat Date: Mon, 24 Jan 2022 19:43:35 +0100 Message-Id: <20220124184040.016661631@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- kernel/sched/cputime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -147,10 +147,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DDD6C43219 for ; Tue, 25 Jan 2022 03:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1313965AbiAYCuC (ORCPT ); Mon, 24 Jan 2022 21:50:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387203AbiAXVDP (ORCPT ); Mon, 24 Jan 2022 16:03: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 501C1C06B5AE; Mon, 24 Jan 2022 12:03: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 0CF80B811FB; Mon, 24 Jan 2022 20:03:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1741BC340E8; Mon, 24 Jan 2022 20:03:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054628; bh=C0SHw/HBGJeYO40tcsni0/1HVx1c5uqo7CZO59eKrpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tavopEPZxX4z99dK4v3mfaOUtCnxcEmA51k8qw+ydS6kl4Uy+q14mfHN/SJ7kAuT1 YN0LKHL6lea8gMdYDvjQuPmBpQ/jLeu7Ve7Dz4N5WyXk/aK+F0Y5D4vFWM+UCRDL3J kREggO16RP+OxpsW99S/fVUiU4nAabqkY+utDdVQ= 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.10 451/563] tracing/kprobes: nmissed not showed correctly for kretprobe Date: Mon, 24 Jan 2022 19:43:36 +0100 Message-Id: <20220124184040.047274925@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1183,15 +1183,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E9A3C43217 for ; Mon, 24 Jan 2022 20:28:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382671AbiAXU0F (ORCPT ); Mon, 24 Jan 2022 15:26:05 -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 S1348481AbiAXUDy (ORCPT ); Mon, 24 Jan 2022 15:03: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 03253B810AF; Mon, 24 Jan 2022 20:03:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 285A3C340E5; Mon, 24 Jan 2022 20:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054631; bh=LQm4QQc6Vgl5DIjwrQyP6wFXQa7I4UmfCDLYWKaa/SU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=asi5nIvn7/ti63HNTs9rs9D7q6oK59Y8XYvWNZTGLFeLVtQj1p5MUlPUt0VruZcYu B5dZLUt97sSN8hWLGOHih7vsYP3HN78b9XEAAhh+ujPF8Ab+TnxZKRrOw85sogPzsZ rwR8YCa0vi8wMfhNQw3jJqeoNyY35nGT9GWUfKqg= 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.10 452/563] iwlwifi: mvm: Increase the scan timeout guard to 30 seconds Date: Mon, 24 Jan 2022 19:43:37 +0100 Message-Id: <20220124184040.077391893@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -2157,7 +2157,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 500A0C433FE for ; Mon, 24 Jan 2022 20:28:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382689AbiAXU0J (ORCPT ); Mon, 24 Jan 2022 15:26:09 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60318 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353095AbiAXUDz (ORCPT ); Mon, 24 Jan 2022 15: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 dfw.source.kernel.org (Postfix) with ESMTPS id 5D5A86130A; Mon, 24 Jan 2022 20:03:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39301C340E7; Mon, 24 Jan 2022 20:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054634; bh=TFPhLY7a+S1lP7pzZ62if65Bl194tX+Ki4DpuTF2t9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p4A2Y2fG95+iMnqOlgRjgZKEDnx6L+uxuC4wN8wuAj52Y35s2XkEb1uuYilBeRlAy b/cqE5QGVrAPrP4j1xw+Wu7QNSXPA/pwVRUbXyxIqAVAPgOq26iggZPr5gUpXvBZxt j6U3eFmSRHwJnVE20aflizPJk9bq5+KFvACD71GA= 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.10 453/563] s390/mm: fix 2KB pgtable release race Date: Mon, 24 Jan 2022 19:43:38 +0100 Message-Id: <20220124184040.107858769@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan ---- ---- 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 @@ -253,13 +253,15 @@ void page_table_free(struct mm_struct *m /* Free 2K page table fragment of a 4K page */ bit =3D (__pa(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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B69CC43219 for ; Tue, 25 Jan 2022 03:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314008AbiAYCuL (ORCPT ); Mon, 24 Jan 2022 21:50:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445371AbiAXVDQ (ORCPT ); Mon, 24 Jan 2022 16:03: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 79DA9C06B5B3; Mon, 24 Jan 2022 12:04: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 307E3B81218; Mon, 24 Jan 2022 20:03:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63BB5C340E5; Mon, 24 Jan 2022 20:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054637; bh=RaPK8Eyr4HE56rbewWn9cmr8Bv4VqvqGAd5d/J3fTwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cRB2HHyUF7be83aSlFQIe6AX3kKbjHY6XT6gkLHbX3ZDVw5pfeg9o8HxKvURo196t 31OnVBqL0gVuPQOfUYCa47lfDzkqEN0LWuYiHY5REs69BEaChuOWXRQaPJIlCn68aw HdUjlK4ugOSdELlFdyNMTyi77tFY5sX4FCeRuc+0= 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.10 454/563] device property: Fix fwnode_graph_devcon_match() fwnode leak Date: Mon, 24 Jan 2022 19:43:39 +0100 Message-Id: <20220124184040.143479590@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/base/property.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -1195,8 +1195,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 888C3C43217 for ; Mon, 24 Jan 2022 21:44:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457193AbiAXVlJ (ORCPT ); Mon, 24 Jan 2022 16:41:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445466AbiAXVDi (ORCPT ); Mon, 24 Jan 2022 16:03: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 184A1C068083; Mon, 24 Jan 2022 12:04: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 A983E60FEA; Mon, 24 Jan 2022 20:04:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67DA3C340E7; Mon, 24 Jan 2022 20:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054644; bh=A2EUI144kMYsLayEJBAsTA84cPoFnieVulthcDcdZcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QN20Q08l/ulH2jwDs6tYhK8rSb6xKLVQHNwLEqlHfaiRKTtPjHzEfiVEXgIc0srkK B6g4oLXSDqBAQh0991bXHYpVmx5tptN1ReIe0IOJlvGMsvJnVemOSCFAklQqMEpcTY OgCH/jLgK0iWz7fKEnUStBEI87VjxS17bKZSyxwM= 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.10 455/563] drm/etnaviv: limit submit sizes Date: Mon, 24 Jan 2022 19:43:40 +0100 Message-Id: <20220124184040.184257696@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E9FBC433EF for ; Mon, 24 Jan 2022 21:44:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457264AbiAXVlS (ORCPT ); Mon, 24 Jan 2022 16:41:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353701AbiAXVDs (ORCPT ); Mon, 24 Jan 2022 16:03: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 93E82C06B5B6; Mon, 24 Jan 2022 12:04: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 5A56AB8121A; Mon, 24 Jan 2022 20:04:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8307CC340E5; Mon, 24 Jan 2022 20:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054647; bh=xI5hEJ3lhDIHA1QI9owRidjMV8Rm3Aur9/+X8usPUKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g5YGj11OlZPVEXz1Ot6A/Y3kIG4iFyF17MkLH805xVUWuZ50OCawkmQf0IGpolNLr nE/pMO6ZLOPz4SSP9s8z+nerFVk8mGlgig1z2nIjBXWgBKLdveRZ6NdSMhddV8YMJR d36QUs3OPHhwp404bqh+FKcQVY6VfdJf1t0K9O60= 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.10 456/563] drm/nouveau/kms/nv04: use vzalloc for nv04_display Date: Mon, 24 Jan 2022 19:43:41 +0100 Message-Id: <20220124184040.216794823@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42FFFC433FE for ; Tue, 25 Jan 2022 03:00:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314410AbiAYCu4 (ORCPT ); Mon, 24 Jan 2022 21:50:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445597AbiAXVE3 (ORCPT ); Mon, 24 Jan 2022 16:04: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 E0CFDC068084; Mon, 24 Jan 2022 12:04: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 7F1CC6090A; Mon, 24 Jan 2022 20:04:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 600EBC340E5; Mon, 24 Jan 2022 20:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054650; bh=LexXsOHLM2Zyt+r8gcyKj5jMn+0GNWWGVK2D4CaDRiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E9WZL8K1sM0c2jlFsX+uyUxNWMa1ajeqndE7gI/g5L+Nzesu3d47HHC8RYIcLoXNm t17Mefom4mJd8acMddFZ1nRnbEDD3ubpEnwUs2/s70mHbuqivR+UCnEYWMx80SVl8x gMgtzOSzmS9Q0OMPgWRCPtM1bTltMoksy14CY5xk= 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.10 457/563] drm/bridge: analogix_dp: Make PSR-exit block less Date: Mon, 24 Jan 2022 19:43:42 +0100 Message-Id: <20220124184040.252701251@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1086,11 +1086,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF566C3526C for ; Tue, 25 Jan 2022 03:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314380AbiAYCuw (ORCPT ); Mon, 24 Jan 2022 21:50:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442274AbiAXVE3 (ORCPT ); Mon, 24 Jan 2022 16:04: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 6E7C0C068087; Mon, 24 Jan 2022 12:04: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 2D7B0B81218; Mon, 24 Jan 2022 20:04:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63C39C340E5; Mon, 24 Jan 2022 20:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054652; bh=YljHBSu8U7fYgPuBxiqBxuJLS3a+IyXUlt9fCs6zb+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLSiCmFPmfNFJDKw8wp1uJ/MWrr6ytCzPQlktwgPP2pfacLidfR83Iyb0evhL/RBn JzviTwYSHzg9JFGINxDl+pAsNNSW1IpV2nrfEVf9CeF4CPFbKYckNRp/rWpIzpyHvI s0msGEU9QmxAabOVcm4G8293dj7VioWZXsnOCY8g= 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.10 458/563] parisc: Fix lpa and lpa_user defines Date: Mon, 24 Jan 2022 19:43:43 +0100 Message-Id: <20220124184040.288671499@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0847FC433EF for ; Mon, 24 Jan 2022 20:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345775AbiAXUXi (ORCPT ); Mon, 24 Jan 2022 15:23:38 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60596 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376878AbiAXUES (ORCPT ); Mon, 24 Jan 2022 15:04: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 8A495611CD; Mon, 24 Jan 2022 20:04:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61E8FC340E7; Mon, 24 Jan 2022 20:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054656; bh=IvIQaEZt2ffRaMJJrLZuUpbFT8T8VG/ahiVl4TyEc7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j3mRs8GUiwWC6VDVYhxMtwxFCHgELilDZ6qA9IJF/CUo9l8qzyM6b0WhSVRqO5vZw WSFIz9bbwbBrRsH8WT0vwqiuBAGCq8KaM+hYtA58nFTtcEtSnsbYckqZ7hhCCV4OTr vatnzB2yCJRT2njGVGGExHitiQhPB8xGTTvS352Y= 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.10 459/563] powerpc/64s/radix: Fix huge vmap false positive Date: Mon, 24 Jan 2022 19:43:44 +0100 Message-Id: <20220124184040.330083950@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1152,7 +1152,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; } @@ -1199,7 +1199,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_page_vaddr(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_page_vaddr(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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F392C4332F for ; Tue, 25 Jan 2022 03:00:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314975AbiAYCwI (ORCPT ); Mon, 24 Jan 2022 21:52:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353004AbiAXVFt (ORCPT ); Mon, 24 Jan 2022 16:05: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 C4C18C06177F; Mon, 24 Jan 2022 12:06: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 8DCFEB8122F; Mon, 24 Jan 2022 20:06:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5EA3C340E5; Mon, 24 Jan 2022 20:06:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054789; bh=chR8q+WKD2uFEc4mwI/c7D3xEq11yM9yTEw/Rw4Sum0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CB9lS/9TqAaMUT7pKMZ2q5ri4cQamdpV5U13tKEJTzgNDE/UIyMTpgSq0Eas4sbsR 6NfG4LqD7ixOpgTMtuNZAViadzNiXZxZKsGI4cjgDR/K13YUw1LQ06hfoXj+X+gAjp L91XZPtpvjfgjVkw1P3Wxqqvqc6FCYurOOUEcP1c= 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.10 460/563] PCI: xgene: Fix IB window setup Date: Mon, 24 Jan 2022 19:43:45 +0100 Message-Id: <20220124184040.370956063@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -467,7 +467,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17E79C46467 for ; Tue, 25 Jan 2022 03:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314685AbiAYCvc (ORCPT ); Mon, 24 Jan 2022 21:51:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349131AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 443D7C068091; Mon, 24 Jan 2022 12:04: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 02655B810BD; Mon, 24 Jan 2022 20:04:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16602C340E5; Mon, 24 Jan 2022 20:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054680; bh=In9dkfJoPO9DJLb0Q0aCQlLwXEl9HC8izXvQvUn3oH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tMjHn/ca4qFEkVVqwl8Mp3wzQ/ccj0q74E4KF49f3XefM14VRDUKjaVdqJIjG3S1T w7c35gmBTKWRabLx62noL3uuH+mmUEkEjt0X4SY0r/Lc80jgWeE14JMAMioLh8QntY RVOo42cdp31gAiJIy7F05Y3xa8ugXp5lfmaBUJB8= 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.10 461/563] PCI: pciehp: Use down_read/write_nested(reset_lock) to fix lockdep errors Date: Mon, 24 Jan 2022 19:43:46 +0100 Message-Id: <20220124184040.408497028@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -72,6 +72,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, @@ -103,6 +105,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)) @@ -880,7 +880,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; @@ -936,6 +936,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; @@ -949,6 +963,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3BB5C43219 for ; Tue, 25 Jan 2022 03:00:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314722AbiAYCvg (ORCPT ); Mon, 24 Jan 2022 21:51:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354037AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 E1EC9C0619D1; Mon, 24 Jan 2022 12: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 ams.source.kernel.org (Postfix) with ESMTPS id A9949B8122A; Mon, 24 Jan 2022 20:05:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6A84C340E5; Mon, 24 Jan 2022 20:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054714; bh=4KnP9f2BG2N0gQWpClCCaBlbp1tyU3Pjw2Z1LPrgmQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONb+Zn7PZ9/5w6HH76vpxhRBRaAi2sjUv4GZQPtLzoFCtQvOerTFAxjxjNZzHTUva 7VJSteBWF9+V3JCNccwi8zVjOYMDLuKKA0cU51KO1nnxHD8vjydLU6oGbEi7ld2WhZ Ec1GOT9eF7zkRWrz6EGx58Qbb+nj59gx/eyBZo+U= 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.10 462/563] PCI: pciehp: Fix infinite loop in IRQ handler upon power fault Date: Mon, 24 Jan 2022 19:43:47 +0100 Message-Id: <20220124184040.438960844@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99D2CC433EF for ; Tue, 25 Jan 2022 03:00:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314875AbiAYCwA (ORCPT ); Mon, 24 Jan 2022 21:52:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376393AbiAXVFQ (ORCPT ); Mon, 24 Jan 2022 16:05: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 22948C06809D; Mon, 24 Jan 2022 12:05: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 B610E6091B; Mon, 24 Jan 2022 20:05:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EE1CC340E5; Mon, 24 Jan 2022 20:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054749; bh=8kdnPAkKMFZeojypize7PQeSHKNwYqoEZAm1hMECNzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQQqEWuhZTwKoKleSPx8fxXnh6rd7hEVaZcLjTS0Nrvvf33jneVP4rhaYzsVn1WzU BGQVOdwQwb7Xl+7396NNUNUwRcsrdg59TaDa9VkLBHpJchp/Tw2W6Ksbgr8bWUZZsH 59WnmuhErnKRzviY1gQxxJqQOrbPZ5E22hep6kOA= 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.10 463/563] PCI: pci-bridge-emul: Make expansion ROM Base Address register read-only Date: Mon, 24 Jan 2022 19:43:48 +0100 Message-Id: <20220124184040.476639517@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1850EC433EF for ; Mon, 24 Jan 2022 20:31:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348285AbiAXU2L (ORCPT ); Mon, 24 Jan 2022 15:28:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49166 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378055AbiAXUGO (ORCPT ); Mon, 24 Jan 2022 15: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 674E4B81229; Mon, 24 Jan 2022 20:06:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BF61C340E5; Mon, 24 Jan 2022 20:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054771; bh=O/8B47WCHt/7NggE2om+s/HBijeVuMCAcR01gd/vuYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTFGqyhWIyMP4Hzzev7ieGnuBGdVYFD3vUUrrYzBgK10so0Gs/ypEpPkUCZ8k0kdF L64GZEcssYkSIOPOtx91tzogZ9EEMx27RTd9JM79wntejNa1yGxyP8nFH3lV40Xz8b svCzF8E2wRS6cKFywlSEW8M6ycJtbmODWDMgfD5A= 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.10 464/563] PCI: pci-bridge-emul: Properly mark reserved PCIe bits in PCI config space Date: Mon, 24 Jan 2022 19:43:49 +0100 Message-Id: <20220124184040.507268441@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B0ACC433EF for ; Tue, 25 Jan 2022 03:01:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314946AbiAYCwG (ORCPT ); Mon, 24 Jan 2022 21:52:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353048AbiAXVFl (ORCPT ); Mon, 24 Jan 2022 16:05: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 15913C06176C; Mon, 24 Jan 2022 12:06: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 87613B8122F; Mon, 24 Jan 2022 20:06:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC94CC340E5; Mon, 24 Jan 2022 20:06:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054774; bh=AaF7euI3kYHd/11AknQCQrpr2iggUpjasga3Y3juYgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rY9NJH9q3AgnYvZolDffUSAKiC2S6rhogsgQiBohOQWXdZ0zGAJHg6J2vkZCwPbXY oIbNU73lzT7O6GCuUnQL1rSHNMY6FDgrTk9wkVOfTpgr58/bYFvU5Syvdlil44+UTb sZmnlqvvow5sWdX5DlQMcEDjMJdUQw+irFf0ctm8= 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.10 465/563] PCI: pci-bridge-emul: Fix definitions of reserved bits Date: Mon, 24 Jan 2022 19:43:50 +0100 Message-Id: <20220124184040.541717331@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A284C433F5 for ; Mon, 24 Jan 2022 21:44:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457796AbiAXVmS (ORCPT ); Mon, 24 Jan 2022 16:42:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351861AbiAXVFt (ORCPT ); Mon, 24 Jan 2022 16: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 4ED54C06176E; Mon, 24 Jan 2022 12: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 DF4DD6130A; Mon, 24 Jan 2022 20:06:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD558C340E5; Mon, 24 Jan 2022 20:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054777; bh=Zy0wCKPXGHAirTOEVY3Tv0i5lFiG13/SrlaYaD/KHkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YSnwhO67F1XkH4dUs++OvXhZDc6NC/X6FMuoD/sMlB/tli+ZPAI7b+FbhirvQ15rK jp0bC/d9I5mVH9r3FAnJ39DUcaQv8mCsdqOWBFs152zI/4tJYkc+Qk881U7bktfmmW bJ5wZlgfGNOM7yl3Ma4gx05Ho+wTQEV26JRZvW6I= 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.10 466/563] PCI: pci-bridge-emul: Correctly set PCIe capabilities Date: Mon, 24 Jan 2022 19:43:51 +0100 Message-Id: <20220124184040.577692948@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -879,7 +879,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); @@ -960,6 +959,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 @@ -573,6 +573,8 @@ static struct pci_bridge_emul_ops mvebu_ static void 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; @@ -585,6 +587,12 @@ static void mvebu_pci_bridge_emul_init(s 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BAF6C41535 for ; Mon, 24 Jan 2022 20:29:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346363AbiAXU2I (ORCPT ); Mon, 24 Jan 2022 15:28:08 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60596 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378121AbiAXUGV (ORCPT ); Mon, 24 Jan 2022 15:06: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 D2A24611CD; Mon, 24 Jan 2022 20:06:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFB01C340E5; Mon, 24 Jan 2022 20:06:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054780; bh=YcFsUeslYa8xYA7haRFrlwUsZXiclWBMo3itOg4vcr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xc1pzXAXH/SB3svvP63QPpNsCqIOaaiEZr8SBicrwIRZNmnJcL0fluv1gYg7tRVVR N6NAu2/O51OwCFlJRCNQXzYhCk65nqFMapI1DCi9MMdDOXB6bSDdO58mk+t62VmjW6 6NssIbn9OFA5TIWwR3rQ5f+7ykwhfKZg9AA6SseM= 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.10 467/563] PCI: pci-bridge-emul: Set PCI_STATUS_CAP_LIST for PCIe device Date: Mon, 24 Jan 2022 19:43:52 +0100 Message-Id: <20220124184040.615274042@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 394ADC433EF for ; Mon, 24 Jan 2022 20:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351386AbiAXU2P (ORCPT ); Mon, 24 Jan 2022 15:28:15 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33542 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378136AbiAXUGY (ORCPT ); Mon, 24 Jan 2022 15:06: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 ECC616130A; Mon, 24 Jan 2022 20:06:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C77AAC340E5; Mon, 24 Jan 2022 20:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054783; bh=ww+BcVqET/zZZV6a5y5S+vmzcWajE9txv4bLkQMaiJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W4NtyY2ZWi76viPGKkf3ffNnPZLjUBCugJjpgyQV8FZ0A3N9lArEcgGU+D41fWXEk RxYcg60ZHddXyoP8B/FwnM6ywJTx3WX7nngZjUpmfQaT1WfKjTWGo1fc0ggfBDla/N SzG8Z0YBgaCD0xsd2e4iPJiFzTFTHS2l6qh7f/ac= 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.10 468/563] xfrm: fix policy lookup for ipv6 gre packets Date: Mon, 24 Jan 2022 19:43:53 +0100 Message-Id: <20220124184040.647045636@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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; @@ -1543,7 +1546,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 @@ -3455,6 +3456,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50C1EC35268 for ; Mon, 24 Jan 2022 20:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355678AbiAXU2Z (ORCPT ); Mon, 24 Jan 2022 15:28:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49364 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378162AbiAXUG2 (ORCPT ); Mon, 24 Jan 2022 15:06: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 7CE17B8122C; Mon, 24 Jan 2022 20:06:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD79DC340E5; Mon, 24 Jan 2022 20:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054786; bh=+7FxDuO7yr1t9qpl3uSqpYJ359PsLS1FIXDJxNUqOOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BgIziojMZtZdnXFGD5B7n7ouJpbrp5Ztr8gWkCy5FWZJ2oqPcjBYi/EQ6iuc7Y/x6 hWaa1u5Lfa4xwVlExQer/CYNsjMKkgrYry0JxJ3t1WkyrQ8L9NFVa5AcULCEQl4Ylw cBknH/Su/qh60N4Hfmjg7HQ/vSBfEpH9OYewhzmg= 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.10 469/563] btrfs: fix deadlock between quota enable and other quota operations Date: Mon, 24 Jan 2022 19:43:54 +0100 Message-Id: <20220124184040.684821809@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/btrfs/qgroup.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -941,6 +941,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; @@ -1118,8 +1126,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1FA5C43217 for ; Tue, 25 Jan 2022 03:00:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314737AbiAYCvi (ORCPT ); Mon, 24 Jan 2022 21:51:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353979AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 52D34C068092; Mon, 24 Jan 2022 12:04: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 18F25B8119E; Mon, 24 Jan 2022 20:04:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45333C340E5; Mon, 24 Jan 2022 20:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054683; bh=reE3UCFEJ7VrG77GGUJOYXy17lvnA1Oi9FlqzgLl1Bw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uG+o+3Ifbjd7f870GCdrKYGyNCHHNQb+fRIwwtCeS0O457BmqCbMqfM2G9K89uZ9X ha1a7Y9bo3iAHYOCSEVNBMbPI292tz0IaEX9F3+HjLl/+Bt2oA/MQtPL+GFv50jpn0 ovyx5mcTo/TzRl6MlePFzDHAmHaSYxyoYX69x++Q= 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.10 470/563] btrfs: check the root node for uptodate before returning it Date: Mon, 24 Jan 2022 19:43:55 +0100 Message-Id: <20220124184040.722129554@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/btrfs/ctree.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -2589,12 +2589,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, @@ -2632,6 +2629,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. @@ -2658,6 +2658,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 852C2C4332F for ; Tue, 25 Jan 2022 03:00:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314666AbiAYCv2 (ORCPT ); Mon, 24 Jan 2022 21:51:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349211AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 1B971C068093; Mon, 24 Jan 2022 12:04: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 D7AD3B8119E; Mon, 24 Jan 2022 20:04:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46C2FC340E5; Mon, 24 Jan 2022 20:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054686; bh=6Zayg6Lj/chNfgA3QoYSYBaYHAsYWM4JNzJbEEUECcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fi7WEpmagRb0Hgo5LjKo0iaFGhVeBCLdM01X/XxAm2oMEqryMgeGDTRfzPkOz1lEx RpUe22nT7E7Mi5tT7eyicQrME9Ccw4ZoooqugHeJyemy6Avz0fWuc0Pnrrcvcc1b8Z 7GB63UQLR8LKr0ecSFCWqrndqoVZGzj6cnr9jMIg= 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.10 471/563] btrfs: respect the max size in the header when activating swap file Date: Mon, 24 Jan 2022 19:43:56 +0100 Message-Id: <20220124184040.758131871@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/btrfs/inode.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -10094,9 +10094,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; @@ -10104,6 +10114,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2619BC2BA4C for ; Tue, 25 Jan 2022 03:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314754AbiAYCvk (ORCPT ); Mon, 24 Jan 2022 21:51:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349192AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 88E51C068095; Mon, 24 Jan 2022 12:04: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 ams.source.kernel.org (Postfix) with ESMTPS id 47A4AB810BD; Mon, 24 Jan 2022 20:04:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B043C340E5; Mon, 24 Jan 2022 20:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054690; bh=wDexgYPxIcnur2R9Xoptda8AzH+1e7S/lnUXV2G5T8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t8Gt+/5H+srMlqfDqVng6zkDZ3tegF1h5D7ng1+IKyXBfsv6dc64Gn6q8NRL5jQaq XolpjB5KicjxezAPUq0wGbQx/LLpfKH0lZiEoBvVo11ch+JfHnTC4JlGHe0/6ksye9 kyIKVkhx+VHgZ5DqUrsfKBciSMR2fWIotY+0jQ08= 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.10 472/563] ext4: make sure to reset inode lockdep class when quota enabling fails Date: Mon, 24 Jan 2022 19:43:57 +0100 Message-Id: <20220124184040.797286521@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/ext4/super.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -6427,8 +6427,19 @@ static int ext4_enable_quotas(struct sup "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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 020D7C433FE for ; Mon, 24 Jan 2022 20:29:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383279AbiAXU1E (ORCPT ); Mon, 24 Jan 2022 15:27:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48466 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377085AbiAXUEz (ORCPT ); Mon, 24 Jan 2022 15: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 ams.source.kernel.org (Postfix) with ESMTPS id 26F3CB8119E; Mon, 24 Jan 2022 20:04:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CE63C340E5; Mon, 24 Jan 2022 20:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054692; bh=1LRY7Hc5xtjb83pWWXrGzUxDQvG9QongWQv+GtMJcTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kyy7XG4vtS8pRQ793/7MnU2HJbsREvqwXNrlC6h6PNnViIvKl1wTOaW3BJUHMRx13 7M2xncIRzQJaWCG4IYv/TrfNUt4yWj9VuODTIsO7/UPn97aT+KF4Ddvb/gc26wJkQr LsFDWuQf8u8Wz4SHb9SJ6HeTq7YM9/L9mosJWD10= 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.10 473/563] ext4: make sure quota gets properly shutdown on error Date: Mon, 24 Jan 2022 19:43:58 +0100 Message-Id: <20220124184040.829568391@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/ext4/super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -6341,10 +6341,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 @@ -6364,7 +6361,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7306C433EF for ; Mon, 24 Jan 2022 20:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383328AbiAXU1I (ORCPT ); Mon, 24 Jan 2022 15:27:08 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59400 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377101AbiAXUE5 (ORCPT ); Mon, 24 Jan 2022 15:04: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 7A2976090A; Mon, 24 Jan 2022 20:04:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59FA9C340E5; Mon, 24 Jan 2022 20:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054695; bh=VvVGQHoLmST+7gv7HSxEUy+S9twM5XbFmDZKI+/vz+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d9Mj8ZXLF4faLsVOoL65qnjYvdsYOPW8vBrSeBA0xDiXtOnakEnyQAPNLC5cw9Nc5 LJo/LERedMfPGPjT35CC/y3N5JzV+otCZea22FXGELGbt3whyLpNOZN9yf+vT9XoAw vwN5P49Lqc9VKjR8CEWDannU0QvmlZr8Asq5C1IQ= 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.10 474/563] ext4: fix a possible ABBA deadlock due to busy PA Date: Mon, 24 Jan 2022 19:43:59 +0100 Message-Id: <20220124184040.862792782@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/ext4/mballoc.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4234,7 +4234,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; @@ -4242,8 +4242,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)) @@ -4266,19 +4265,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) { @@ -4318,22 +4312,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 /* @@ -4875,13 +4860,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBB2CC4167E for ; Tue, 25 Jan 2022 03:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314644AbiAYCv0 (ORCPT ); Mon, 24 Jan 2022 21:51:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353277AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 D5259C068096; Mon, 24 Jan 2022 12: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 dfw.source.kernel.org (Postfix) with ESMTPS id 7538F6131F; Mon, 24 Jan 2022 20:04:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E1BBC340E5; Mon, 24 Jan 2022 20:04:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054698; bh=9eZ9Mv8v14jvy7gY6J9fTqWGXGy5n8+bAcU7ppON4YQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EMMgGAmXsth3PYc29O0U2WxswzUEIevB10IuTBl5cxqev+v7MTHZQPGTLupZNINBV 53tc389HaKFQ42Hyzx2/hS7zgPk2RsecGAxceBUENoyzm7/9DEST+kT1rY0FvJjpIK ZNRi14T78zh1GAkhvrfFiQZQaxhIDf/LzJRUqFMo= 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.10 475/563] ext4: initialize err_blk before calling __ext4_get_inode_loc Date: Mon, 24 Jan 2022 19:44:00 +0100 Message-Id: <20220124184040.900353306@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/ext4/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4445,7 +4445,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, iloc, 0, @@ -4460,7 +4460,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 /* We have all inode data except xattrs in memory here. */ From nobody Tue Jun 30 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0880DC43217 for ; Mon, 24 Jan 2022 20:29:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383679AbiAXU1f (ORCPT ); Mon, 24 Jan 2022 15:27:35 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48538 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377178AbiAXUFF (ORCPT ); Mon, 24 Jan 2022 15:05: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 66A97B810BD; Mon, 24 Jan 2022 20:05:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DDA5C340E5; Mon, 24 Jan 2022 20:05:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054702; bh=bB4C5zhKszU8JAgQjhLPFX1ZWh9xWPpfbk5EACEQjd0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Td7NoFtV9mUQzrqDkwdiuRZ+i6GKTg76H7l0XAZczjOsHgTgJwNO58PoGq1ZoPq4W qs4Kldh0GmuAEoPD7+qo/UbjrGNU+/6XO8wKE74JvWp9QxF8/cbHyspJ/SRsqXT84b XM3teUO7k9D3jw9DsDpRgwJ0FVaYZA0v0AUMf58Q= 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.10 476/563] ext4: fix fast commit may miss tracking range for FALLOC_FL_ZERO_RANGE Date: Mon, 24 Jan 2022 19:44:01 +0100 Message-Id: <20220124184040.931288157@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -4638,8 +4638,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3FE2C43219 for ; Mon, 24 Jan 2022 20:29:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383738AbiAXU1m (ORCPT ); Mon, 24 Jan 2022 15:27:42 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59572 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377186AbiAXUFG (ORCPT ); Mon, 24 Jan 2022 15:05: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 C24E36090B; Mon, 24 Jan 2022 20:05:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E643C340E5; Mon, 24 Jan 2022 20:05:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054705; bh=PBfU0sjDKHjPEXXIWzNxqIfWzz3fkDv5Yi5PMouzK2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kfMYlhF7DPqdB1Zzb88S6aeafGMFemxSQOOnz/Ktmcwsgh/U2minb8r8swJfLaqKL 6J2DP8GQoYiXkCyZbkAGs6ab9vM3XWoIR9uM1pMVOupRw7w//pcOOo7JZzOEyfAE6e VRv5E+yk7225BqQnTRGCIHgKy7mXOMAkei1AaMkI= 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.10 477/563] ext4: set csum seed in tmp inode while migrating to extents Date: Mon, 24 Jan 2022 19:44:02 +0100 Message-Id: <20220124184040.962722424@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6178C43217 for ; Mon, 24 Jan 2022 20:28:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381909AbiAXUYw (ORCPT ); Mon, 24 Jan 2022 15:24:52 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48584 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377222AbiAXUFK (ORCPT ); Mon, 24 Jan 2022 15:05: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 7AD08B81218; Mon, 24 Jan 2022 20:05:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9972FC340E5; Mon, 24 Jan 2022 20:05:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054708; bh=6m50L64FqER3vbHG7PZvxv58c0ihB8uLr0YOsD27UuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rHL0LFbojzfy23H+wSNZZECZHiTkkLr15lAqIqKx89+1pwuoh0y+/jyNQSSgY1CSW Ez0704WM12W3LMDFQqlYF4zuFlEWmXa0Fsz3Ir/AqLp/DJxsnT3BD+Y32I44oXMe/M gQKL+5+zmhgg+0vdsDbhztkZKXSnWltawMfRxEyM= 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.10 478/563] ext4: Fix BUG_ON in ext4_bread when write quota data Date: Mon, 24 Jan 2022 19:44:03 +0100 Message-Id: <20220124184041.001357989@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -6545,7 +6545,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85BE3C4332F for ; Mon, 24 Jan 2022 20:29:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383756AbiAXU1o (ORCPT ); Mon, 24 Jan 2022 15:27:44 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48610 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377263AbiAXUFO (ORCPT ); Mon, 24 Jan 2022 15:05: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 7D531B8121A; Mon, 24 Jan 2022 20:05:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95D57C340E5; Mon, 24 Jan 2022 20:05:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054711; bh=2XGr8Nu1tgEUWl+Pl/DqQYYE7vo3QJeprvUIV3btP9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dFefzcEOh4IyYDEIaFySWQ370mk42avSkVSfC4KQa/qLp/Lj4OMSiOjul5FVpjvd6 ugwPERCKO+2w4rTU8yMfBot1cItOvjQSGMiLBjpC6CWGDXQifMDdi3soIe7QiEdkdR X8EAYGHC09UPd6xeo2fhdIaFUiwFWHlqlypDO4/8= 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.10 479/563] ext4: use ext4_ext_remove_space() for fast commit replay delete range Date: Mon, 24 Jan 2022 19:44:04 +0100 Message-Id: <20220124184041.031457527@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1764,11 +1764,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65355C433F5 for ; Tue, 25 Jan 2022 03:00:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314628AbiAYCvY (ORCPT ); Mon, 24 Jan 2022 21:51:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353984AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 1187DC068098; Mon, 24 Jan 2022 12:05: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 AD0DFB8122A; Mon, 24 Jan 2022 20:05:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9DF2C340E5; Mon, 24 Jan 2022 20:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054717; bh=dwuRJhL0tzbkr5ctUeyXeMSHkHGJOqAsMBmJPPixkaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HRrHpauhFJng8Dts2JHZ0YEXb9aI34nkVGr4P7yTevuJ3HHxdqeupnfPcky5QoBDx nAtdLX5GO0eGYNwORdaiz9Mz9yZafeFmKJdrO2qmXGAOHspmmrJw2u7sCVqeZy74bc cjf5bbCRNkxahX6BDu9hB6XZ1YC5M3Zu6eU1+GaM= 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.10 480/563] ext4: fast commit may miss tracking unwritten range during ftruncate Date: Mon, 24 Jan 2022 19:44:05 +0100 Message-Id: <20220124184041.063143682@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/ext4/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5468,8 +5468,7 @@ int ext4_setattr(struct dentry *dentry, 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A468C41535 for ; Tue, 25 Jan 2022 03:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314603AbiAYCvR (ORCPT ); Mon, 24 Jan 2022 21:51:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353993AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 114FCC068099; Mon, 24 Jan 2022 12:05: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 C2758B8122A; Mon, 24 Jan 2022 20:05:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E68B6C340E5; Mon, 24 Jan 2022 20:05:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054720; bh=rk21zKQ+j7Sr59F2dIE7knXhtPu1glCcJYXJODTUaGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zYKkBWbDB6ykUwPIfScWgyK5lusvuVdKGcMs+T+lY3EPBbcJtHnejQ5I8xqRUMTmb BsKTx4pSLRgryGS3H5JHsCZpDhcJ+PtBMBqVwLn5qSMxoKElrbie6fd7d+b4qp5rzN Qj3ptbBr08GRDQKuX7C+Jq/EwgKCs93ox9twBBag= 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.10 481/563] ext4: destroy ext4_fc_dentry_cachep kmemcache on module removal Date: Mon, 24 Jan 2022 19:44:06 +0100 Message-Id: <20220124184041.094594379@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -2778,6 +2778,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 @@ -2169,3 +2169,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 @@ -6729,6 +6729,7 @@ static int __init ext4_init_fs(void) out: unregister_as_ext2(); unregister_as_ext3(); + ext4_fc_destroy_dentry_cache(); out05: destroy_inodecache(); out1: @@ -6755,6 +6756,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55745C433EF for ; Tue, 25 Jan 2022 03:00:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314573AbiAYCvP (ORCPT ); Mon, 24 Jan 2022 21:51:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349289AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 3088AC06809A; Mon, 24 Jan 2022 12:05: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 C9032B811F9; Mon, 24 Jan 2022 20:05:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC5B6C340E5; Mon, 24 Jan 2022 20:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054723; bh=hXcoNs0eV+dMtxkq6Dw8eNgx0kpJ36Vku3/tBigUjX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hol1Qr6EcTtNrzLNSiJigVE2CAn6f9MyiCG5sHrTlaLtBtnJeNmTU/xvNDc1qfsuV IYE1qUDXsmAgtcZJedbdSLnHvC9VDhW03dbyWWA88UeOQ/ICEYbmHBxEbCjvmmm8NZ zfsNaLQVXzeHla09yn2D9uyfhxaDNoGYErdFriTg= 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.10 482/563] ext4: fix null-ptr-deref in __ext4_journal_ensure_credits Date: Mon, 24 Jan 2022 19:44:07 +0100 Message-Id: <20220124184041.124751097@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CA4FC4167B for ; Mon, 24 Jan 2022 20:29:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383778AbiAXU1r (ORCPT ); Mon, 24 Jan 2022 15:27:47 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33110 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377395AbiAXUF1 (ORCPT ); Mon, 24 Jan 2022 15: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 3A3E5612F0; Mon, 24 Jan 2022 20:05:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05AF9C340E5; Mon, 24 Jan 2022 20:05:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054726; bh=TZn8Yh7VlVGc1UIog89OIJSotNjIoF9dA/3e+R3TaEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Esmm0KTNQuvLp4CUYZLksVGTzKDQx9aCAWnOzgGKNZlB8tm7maBU1ufoTbVhjqx5Q Gr9WOHBz710Jv1JNOe75Q4fQTFAAMBoK0913I1kO78yh9fThcc+iRiLR3uxNncUCKQ CjCV3cESlOMr0i+5uJGbo0NMvRvkWySOEhMDA0B4= 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.10 483/563] ext4: dont use the orphan list when migrating an inode Date: Mon, 24 Jan 2022 19:44:08 +0100 Message-Id: <20220124184041.158175327@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94D37C433FE for ; Tue, 25 Jan 2022 03:00:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314706AbiAYCve (ORCPT ); Mon, 24 Jan 2022 21:51:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354079AbiAXVFL (ORCPT ); Mon, 24 Jan 2022 16:05: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 59A5BC06809B; Mon, 24 Jan 2022 12:05: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 18D83B811FB; Mon, 24 Jan 2022 20:05:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4026FC340E5; Mon, 24 Jan 2022 20:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054729; bh=J3h6L2kwUZJ7G0s0Kn2R/BUw7Zxwyn30CVsABOeUez4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=az0ZmAnwJ4Tfyx1RyLT5SM9/oRRgo/ErohZAzuhLggCYppBILzg/PHtvHA5/9+EkG cNEcwrCY6AEjEHg0m8epaGMCmm7iOgdtdsykqQmQQ/T4YVnbFaAPfnMYY1+7oxxqGQ oC69jT3SlhmZewGdacb9CsndQJ017wrTtrlWsMcg= 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.10 484/563] drm/radeon: fix error handling in radeon_driver_open_kms Date: Mon, 24 Jan 2022 19:44:09 +0100 Message-Id: <20220124184041.188741901@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -652,18 +652,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 */ @@ -671,7 +671,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, @@ -679,19 +679,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C333C4167D for ; Mon, 24 Jan 2022 20:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383835AbiAXU1v (ORCPT ); Mon, 24 Jan 2022 15:27:51 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47728 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377512AbiAXUFf (ORCPT ); Mon, 24 Jan 2022 15: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 ams.source.kernel.org (Postfix) with ESMTPS id 274E2B811FB; Mon, 24 Jan 2022 20:05:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A1D1C340E5; Mon, 24 Jan 2022 20:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054732; bh=XQqS/0TszdaN1MbzPtCKh6zql3OIVJFNlbEuzhDm9Qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FNHDS3TmnbtNGEKFgvPLzmepU2WeIeo9tjXIJFwOIkc5XTlUxMaK3/1vT+q6eYfSF wktSAp5ZVCNgCthowQY5PrBuIR+vHdn12gHZtYbtHwYgZ6EcbkhtnC+A6jp3jz8NvU vGvJ/WgTOzNHFxZqDGOke+witvbPPGYDq+KN51n4= 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.10 485/563] of: base: Improve argument length mismatch error Date: Mon, 24 Jan 2022 19:44:10 +0100 Message-Id: <20220124184041.219041488@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/of/base.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1328,9 +1328,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B1B1C4707A for ; Tue, 25 Jan 2022 03:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314861AbiAYCv7 (ORCPT ); Mon, 24 Jan 2022 21:51:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376383AbiAXVFQ (ORCPT ); Mon, 24 Jan 2022 16:05: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 2F101C0619D2; Mon, 24 Jan 2022 12:05: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 8561C60989; Mon, 24 Jan 2022 20:05:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 632F3C340E5; Mon, 24 Jan 2022 20:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054737; bh=Kg6lB8gyFX7ICKo3+KWCWKtc2SOVkFcVpBWAYHfLIk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S/Fiyx4yIFqqnSTXfOvdj+OH+KMTomjInsjXyYLRssrg6eNi2rWeTkDs5EM+iVafd qb0EsZZcXX5M3kU37UVx9FZytHzxj6U3CZ5sDWi3kMQcQog8okTfY/eG/tctitM8dm uhoq4jglXblG+Y35bJkOtCxE4VEGHND6uAM/yups= 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.10 486/563] firmware: Update Kconfig help text for Google firmware Date: Mon, 24 Jan 2022 19:44:11 +0100 Message-Id: <20220124184041.256076466@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70BE1C4167E for ; Mon, 24 Jan 2022 20:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383872AbiAXU1z (ORCPT ); Mon, 24 Jan 2022 15:27:55 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48852 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377567AbiAXUFm (ORCPT ); Mon, 24 Jan 2022 15:05: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 2BC5AB811F9; Mon, 24 Jan 2022 20:05:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BCE5C340E5; Mon, 24 Jan 2022 20:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054739; bh=UL7NgZpa8VCGf7E/EWje0rN+0VhXwC7Rboytk2AhmGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WXbSi43mUA6EVdtJy7GGvM7lr/P+V37f9Tlen7IQS9RECosBhUbdjzuVgIyVG/H3w DBlQ7NIfn2rkfVgTtmtpMvhg17rZU4aBYyOzIb5bqR4gdSBUouclkBAxK40UvZ2kP3 LpbBGzvv270JCSa4xqqU39nEf/JaxsDkIYDbnBlA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde Subject: [PATCH 5.10 487/563] can: mcp251xfd: mcp251xfd_tef_obj_read(): fix typo in error message Date: Mon, 24 Jan 2022 19:44:12 +0100 Message-Id: <20220124184041.291417050@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1288,7 +1288,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86679C46467 for ; Mon, 24 Jan 2022 20:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383905AbiAXU17 (ORCPT ); Mon, 24 Jan 2022 15:27:59 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48884 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377617AbiAXUFp (ORCPT ); Mon, 24 Jan 2022 15: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 ams.source.kernel.org (Postfix) with ESMTPS id 4376EB8122A; Mon, 24 Jan 2022 20:05:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D26EC340E5; Mon, 24 Jan 2022 20:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054743; bh=8YIJDSU95lxAcjy6scG6fi1Dh3ZhJhGtgJHvXafBIaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2fGVQKPbYQn7kXeCxG7ckW+4t361KCQEtCiMCDGVT89dBzs3I4nXGB0bc/81F6SU 7jx+Zy/58wcq9h/YNLUBfjMmE2G5384iCIOjENkoelD8unexxXkLJplvzqTQ3ubQet pIC55sWYxoHA1uKZ15hOxNtbc94w2A2ZfGCYNm+0= 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.10 488/563] media: rcar-csi2: Optimize the selection PHTW register Date: Mon, 24 Jan 2022 19:44:13 +0100 Message-Id: <20220124184041.323136714@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -976,10 +976,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA045C433F5 for ; Tue, 25 Jan 2022 03:01:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314890AbiAYCwC (ORCPT ); Mon, 24 Jan 2022 21:52:02 -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 S1376395AbiAXVFR (ORCPT ); Mon, 24 Jan 2022 16:05:17 -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 E82A4C06809C; Mon, 24 Jan 2022 12:05: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 857DC6091B; Mon, 24 Jan 2022 20:05:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BE61C340E5; Mon, 24 Jan 2022 20:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054746; bh=rKSH15DjDk60dPicvYM3uCvRq8hCaBfQaC1tF+7WONQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PcdH/lcNyJNdIE8XQ6ioBildZlFLTtrimq7fp3eVVPrTvyC55DNfBnMskbNZLfl52 neGBoMh1SpzFRE/CZuTXiwLp9SEzKtFWVpf3Yv6rfB3sS11/CKnjEI6lAPUahmLob+ r4CWsZX9Xsl/1bg1UqW8Ah8Yw/1kiWshaqf5+GDM= 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.10 489/563] drm/vc4: hdmi: Make sure the device is powered with CEC Date: Mon, 24 Jan 2022 19:44:14 +0100 Message-Id: <20220124184041.353523380@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1399,8 +1399,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; + + ret =3D pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); + if (ret) + return ret; =20 + 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); @@ -1525,6 +1531,8 @@ static int vc4_hdmi_cec_init(struct vc4_ if (ret < 0) goto err_delete_cec_adap; =20 + pm_runtime_put(&vc4_hdmi->pdev->dev); + return 0; =20 err_delete_cec_adap: From nobody Tue Jun 30 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E86AC43217 for ; Mon, 24 Jan 2022 21:44:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457712AbiAXVmL (ORCPT ); Mon, 24 Jan 2022 16:42:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237755AbiAXVFj (ORCPT ); Mon, 24 Jan 2022 16:05: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 B4CEBC06809E; Mon, 24 Jan 2022 12:05: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 7C5D8B8122F; Mon, 24 Jan 2022 20:05:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DF41C340E5; Mon, 24 Jan 2022 20:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054752; bh=T91MD1sr3C3+oB/nrJKahFEPd8Ny8PdZEwPdZdZ4y68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ewYiTgURx4iqcurWVQNy8U3QxE8ikbuIEyzr1DGlzs7Ypdicbv5WUGfDigrZ8I5UL ioP4+pQJeQ9ISJIsbtGRft0llgQKRIZjizg9O0VrqiSOBBKdkVlSWRip2jAKhiAf/R lZCaiguVieFQegsTWMKL6tCQp55t7plnBgki4w00= 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.10 490/563] media: correct MEDIA_TEST_SUPPORT help text Date: Mon, 24 Jan 2022 19:44:15 +0100 Message-Id: <20220124184041.394183297@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/media/Kconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -142,10 +142,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D80FC4707A for ; Mon, 24 Jan 2022 20:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383920AbiAXU2A (ORCPT ); Mon, 24 Jan 2022 15:28:00 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33340 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377747AbiAXUF4 (ORCPT ); Mon, 24 Jan 2022 15:05: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 BA69460916; Mon, 24 Jan 2022 20:05:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A102FC340E5; Mon, 24 Jan 2022 20:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054755; bh=Ss9cJ1xCoPXGKemzTHnuPgLOcrn/oCFFznA4VV3+pwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LObD8LfaJOaUMZgjtopaJzvYL5DbZU2S/dMTveAA7u+HoLdzhHG7iBLG/BN6PNSZW 3fd3mLtcDh0zR83X5fzx7F+fwSTIxORHu7boaalVbF0yX5sGJ5hylo0w2Qkg1BlHbs G7EvDIkGdEqXixzSJtCPzDFXmZUJlAexfugIyTC8= 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.10 491/563] Documentation: dmaengine: Correctly describe dmatest with channel unset Date: Mon, 24 Jan 2022 19:44:16 +0100 Message-Id: <20220124184041.427860925@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A49B2C433FE for ; Mon, 24 Jan 2022 20:29:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383939AbiAXU2C (ORCPT ); Mon, 24 Jan 2022 15:28:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33364 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377796AbiAXUF7 (ORCPT ); Mon, 24 Jan 2022 15:05: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 C2BDB6091B; Mon, 24 Jan 2022 20:05:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99B8FC340E5; Mon, 24 Jan 2022 20:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054758; bh=/CkJZbBS/noqHTVzt9gb1OaMJAK407vUfQxtvkkrFfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wAwHlTmaQnsPmk55EKQYBpKpnuPCN3JKIy+dULsAwiOvk1knLAdz8+VuH/8fAf806 buzxp1eFG2+uHeXjBX5v6+MbF4qtKhiadRlvByV9tvy1GcYfXEDBLaoGW5E1Q2Z0Qa TZGtTEAatBHuhv5TtXIjKJZFQkVZkCuOxAPVPHS4= 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.10 492/563] Documentation: ACPI: Fix data node reference documentation Date: Mon, 24 Jan 2022 19:44:17 +0100 Message-Id: <20220124184041.459814937@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEEA2C433FE for ; Mon, 24 Jan 2022 20:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383956AbiAXU2D (ORCPT ); Mon, 24 Jan 2022 15:28:03 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49082 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377971AbiAXUGE (ORCPT ); Mon, 24 Jan 2022 15:06: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 B741EB81215; Mon, 24 Jan 2022 20:06:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2F46C340E5; Mon, 24 Jan 2022 20:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054761; bh=vwRGDU4N4TbEApmcUFKQ4hpx5acenT08Vv9AbCWceh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kl3Nre77F2SH0prH9ZGLj73Cdb9wF5KnVrCWuM8yBiQy6AtHyK98Q5xts/uGKCEHm 4jmwKGZ+yJticKJmQxEAtLwDH3IRnFaxL8fjxIQWXxbLsmUZ/gstpmNUVbAv4P9BRF dknzDoEJFMP2OnrFpSqp/7F06Fpwcucho1zeJrYc= 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.10 493/563] Documentation: refer to config RANDOMIZE_BASE for kernel address-space randomization Date: Mon, 24 Jan 2022 19:44:18 +0100 Message-Id: <20220124184041.499757730@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDFEDC3526D for ; Mon, 24 Jan 2022 20:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238286AbiAXU2H (ORCPT ); Mon, 24 Jan 2022 15:28:07 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49108 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378014AbiAXUGI (ORCPT ); Mon, 24 Jan 2022 15:06: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 4F4F9B8122D; Mon, 24 Jan 2022 20:06:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83794C340E5; Mon, 24 Jan 2022 20:06:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054765; bh=9wTFvCDXsLGr2ff4ZSyAlfnhmj5VqNbcLjP9DYhL73E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BWfekx0k/06pvM6pp+8QTpWgs74DQ/UATHzuYUs1L+CYSyEMuUK81L+a69ytaFifO UO10j/WLD1SFHvILFETExhVFgQfQqDNkotiKgh4suKI2zlAWTyG0Cx+8s8cSEhQIyL PqPT2f9bDRoL1ozGIGpj+nXUdO7i/tHqZRda4FgA= 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.10 494/563] Documentation: fix firewire.rst ABI file path error Date: Mon, 24 Jan 2022 19:44:19 +0100 Message-Id: <20220124184041.539349566@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDD77C2BA4C for ; Mon, 24 Jan 2022 20:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383973AbiAXU2F (ORCPT ); Mon, 24 Jan 2022 15:28:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33432 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378024AbiAXUGJ (ORCPT ); Mon, 24 Jan 2022 15:06: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 AEC6961028; Mon, 24 Jan 2022 20:06:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88970C340E5; Mon, 24 Jan 2022 20:06:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054768; bh=r4idlkki+evNSY8a6mjHl74JdrHllU0Bosbsl+OfL1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b7V7z1V6IpWIK/7zywNgHbvpmGxrH1DrLPHJfCBcnK3kjUpWxGoP/zSWGC/oALYqF nLJc8nl1ykk6tvNLjtRIEmrD9mKkyu5jf94DsaV2jLmO+lvhBIWv9MJJL1ElzHzJOS ZWwsNVJgRlDWXBIp/BBMWcYF/vc35C6hKFxdb1so= 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.10 495/563] Bluetooth: hci_sync: Fix not setting adv set duration Date: Mon, 24 Jan 2022 19:44:20 +0100 Message-Id: <20220124184041.571791904@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -2118,7 +2118,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6E9AC433EF for ; Tue, 25 Jan 2022 02:35:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421866AbiAYC3J (ORCPT ); Mon, 24 Jan 2022 21:29:09 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50764 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378683AbiAXUIT (ORCPT ); Mon, 24 Jan 2022 15:08: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 50960B8121A; Mon, 24 Jan 2022 20:08:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51359C340E5; Mon, 24 Jan 2022 20:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054896; bh=Nfhpuzi4irbRQN3E3HkAZc4HSOT9aiM10z8KebCFNVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BRNsh3xcM8H9LzTEDLYB//9hfCPoNuW8+GZvQTVv2xUM5e+ZVOgDRfPj72vqnfwYU w04TWSXQpUL4TF6e0Aj+S8nnvJFhZYSRXRL7JaJb5wYpD5Rugd0gdxZMmGlDZLvy4+ my69ejpfl7QvpVpkae4J2f89mQr8XauSmdN9UAE0= 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.10 496/563] scsi: core: Show SCMD_LAST in text form Date: Mon, 24 Jan 2022 19:44:21 +0100 Message-Id: <20220124184041.604864608@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/scsi/scsi_debugfs.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/scsi/scsi_debugfs.c +++ b/drivers/scsi/scsi_debugfs.c @@ -10,6 +10,7 @@ static const char *const scsi_cmd_flags[ SCSI_CMD_FLAG_NAME(TAGGED), SCSI_CMD_FLAG_NAME(UNCHECKED_ISA_DMA), SCSI_CMD_FLAG_NAME(INITIALIZED), + SCSI_CMD_FLAG_NAME(LAST), }; #undef SCSI_CMD_FLAG_NAME =20 From nobody Tue Jun 30 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73EC0C433FE for ; Mon, 24 Jan 2022 21:44:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457767AbiAXVmQ (ORCPT ); Mon, 24 Jan 2022 16:42:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354150AbiAXVFt (ORCPT ); Mon, 24 Jan 2022 16:05: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 E24C4C0613E8; Mon, 24 Jan 2022 12:06: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 8995BB81239; Mon, 24 Jan 2022 20:06:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8359C340E5; Mon, 24 Jan 2022 20:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054792; bh=x7S04SykEtkNO6jyz+/ia/IfgXn8OU6ejHj5ebXM5TE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iZ8TaNah0+GuvgPL1GlUqk5C9gX7fgzpE6xpIA72LTdw++QXCuhh4U4OHKuBEOpGk iWqTPmThS44eRAIzZ2/AOt+WIMT95DThubrZaqCh0mM4aaGUUlIWYMDE2BQgL8fe9b ZRhLo4HcCP/ESDY/+1QVoHNH79vS8UfrzCiu/ktQ= 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.10 497/563] dmaengine: uniphier-xdmac: Fix type of address variables Date: Mon, 24 Jan 2022 19:44:22 +0100 Message-Id: <20220124184041.634891897@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE736C4167E for ; Tue, 25 Jan 2022 03:00:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315137AbiAYCwb (ORCPT ); Mon, 24 Jan 2022 21:52:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388453AbiAXVGb (ORCPT ); Mon, 24 Jan 2022 16:06: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 E52B8C0612AF; Mon, 24 Jan 2022 12:07: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 84B8A6131D; Mon, 24 Jan 2022 20:07:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4467FC340E5; Mon, 24 Jan 2022 20:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054825; bh=WPoBypGOB17l5huLIkhXPkLQEtWC0CGsthIkJnwSBrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LRXB1LLJHOeJH3VjPaLIouNy/c23l65CuLbYvNWf/K+r66N2Ft+oiQql6tbjA/X9Q wF+g52IN4geqpJBbtM3lDDVu22umgV4ckLM1mdY88O39zVGbejMm38MyYFlzvCbx6Q J09HsTNhFuzNNQbJi5PYFzRlf6WZRAoXpWUgdJCU= 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.10 498/563] RDMA/hns: Modify the mapping attribute of doorbell to device Date: Mon, 24 Jan 2022 19:44:23 +0100 Message-Id: <20220124184041.674115186@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -359,7 +359,7 @@ static int hns_roce_mmap(struct ib_ucont return rdma_user_mmap_io(context, vma, to_hr_ucontext(context)->uar.pfn, PAGE_SIZE, - pgprot_noncached(vma->vm_page_prot), + pgprot_device(vma->vm_page_prot), NULL); =20 /* vm_pgoff: 1 -- TPTR */ From nobody Tue Jun 30 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 866E9C433EF for ; Tue, 25 Jan 2022 02:34:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344769AbiAYC1n (ORCPT ); Mon, 24 Jan 2022 21:27:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34222 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378577AbiAXUHl (ORCPT ); Mon, 24 Jan 2022 15:07: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 69BB8612F0; Mon, 24 Jan 2022 20:07:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D3E1C340E5; Mon, 24 Jan 2022 20:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054858; bh=2OPf6rINlgijICnLGyVgivPdxGry3KR1g1l98rgazrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TaGjbXUP0eZTCFIdTUtOWHH7k4DR/qpfi2dfgfwVcLRvWXXtqexwiwCe84HQ+7PuS J+IrqCgK3H4+P2R/0Lgpgxi1ZbEayjrA7UbjMGPqTUHJ11x99wYC0CcHagK019/qSS VUCSL2Jp5RPvjNlCS5iw/KphvUOIXRtcTB+H4hS0= 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.10 499/563] RDMA/rxe: Fix a typo in opcode name Date: Mon, 24 Jan 2022 19:44:24 +0100 Message-Id: <20220124184041.711886908@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -110,7 +110,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0476C43217 for ; Tue, 25 Jan 2022 02:34:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378542AbiAYC2N (ORCPT ); Mon, 24 Jan 2022 21:28:13 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50364 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354217AbiAXUIA (ORCPT ); Mon, 24 Jan 2022 15:08: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 B2E47B811F9; Mon, 24 Jan 2022 20:07:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9471C340E5; Mon, 24 Jan 2022 20:07:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054877; bh=j8QhFAcoP5YnbewakrrigomulAjYONylTaD5Y1/NRwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WQCo2Gbyu8LFHzJekqXo92mNjvb61C1Qidw7wCqsb5MyE9ZzYQhD+KjfNIDLBHfEu DFG/JWRqusWn9S6pY5fm28ALw+st2GzMRzeKuXpX/EGXsHtVgKBVxDao6GPgvqBp8x 8WtsGzBJkz8lsetxvxvgiaYqJ2WV/W9kJDnWQBsA= 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.10 500/563] dmaengine: stm32-mdma: fix STM32_MDMA_CTBR_TSEL_MASK Date: Mon, 24 Jan 2022 19:44:25 +0100 Message-Id: <20220124184041.745777054@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28FB6C433FE for ; Tue, 25 Jan 2022 03:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315961AbiAYCy5 (ORCPT ); Mon, 24 Jan 2022 21:54:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S3409762AbiAYA1V (ORCPT ); Mon, 24 Jan 2022 19:27: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 6F736C0680B0; Mon, 24 Jan 2022 12:08: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 0E4E76136F; Mon, 24 Jan 2022 20:08:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA691C36AE3; Mon, 24 Jan 2022 20:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054880; bh=sJTHRCOFGEKhCCSbR10rJRMVIOEL5CyPtm+xZ+Ap18c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PehiphV64z/Tea7jZN2NiOpJoDMLUiuf4ViTcdK4UEIT1JDvTTjt6JgQC5btZfyHl qGL7O9jPw6wqV6BlD2DnaC3Dbi0KwlZZJXICgawKv55l7/WL1e6QuL8qK4JTp8eq1O QooGDOkQ0movuZB0Goa4wPR86O3Vjz2S1D5Y0N3k= 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.10 501/563] Revert "net/mlx5: Add retry mechanism to the command entry index allocation" Date: Mon, 24 Jan 2022 19:44:26 +0100 Message-Id: <20220124184041.786100923@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -887,25 +887,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) || @@ -930,7 +911,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 388D2C433EF for ; Tue, 25 Jan 2022 03:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315982AbiAYCy6 (ORCPT ); Mon, 24 Jan 2022 21:54:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S3409802AbiAYA11 (ORCPT ); Mon, 24 Jan 2022 19:27: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 6315FC0680B1; Mon, 24 Jan 2022 12:08: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 018CE6091B; Mon, 24 Jan 2022 20:08:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C943DC340E5; Mon, 24 Jan 2022 20:08:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054883; bh=jWDHRme/ITQfZrL35IpdVL6ftOshaIh0+geEM+S1LeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QYDJn6mPgNyP0hC43XGOE2lp75rrkExxH4i0JnOfncOoi+UGuZ7k0hxucCxZwyf6R glRZVl7p0vvDDkz0a12rRtmN2lScqHdjEi3jR1cY5ow+aNncVfTkTU+aHbzJ4JlOzp Lb6JnVhFGmoSvHfx5L2T077XrZFFIzGVGinpzNr8= 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.10 502/563] powerpc/cell: Fix clang -Wimplicit-fallthrough warning Date: Mon, 24 Jan 2022 19:44:27 +0100 Message-Id: <20220124184041.826719761@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -77,6 +77,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 966CBC433FE for ; Tue, 25 Jan 2022 02:34:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1842023AbiAYC2Y (ORCPT ); Mon, 24 Jan 2022 21:28:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50618 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353468AbiAXUIL (ORCPT ); Mon, 24 Jan 2022 15:08: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 E6B43B8159B; Mon, 24 Jan 2022 20:08:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BB37C340E5; Mon, 24 Jan 2022 20:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054886; bh=3U9VP1OuruVXeNmVCUIDrfmA01G3vDMoXgFxbdOhwwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqdSBf8oY1aiQmZMKKsMkwY6mY7n01tIbWfY4MueVLRLT0p6agy8m+29ZfSflhZSG 5lBBwChQSM6o4kfLWmpsBReNkbaiD/T2lc08xdU2u1VIUxIFZDdgZ7rqzuAyYHGW09 XuW2ZUmScSHcKu8HygxZiFspoR3/V+qinE/6y0xY= 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.10 503/563] powerpc/fsl/dts: Enable WA for erratum A-009885 on fman3l MDIO buses Date: Mon, 24 Jan 2022 19:44:28 +0100 Message-Id: <20220124184041.865223836@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF05DC433F5 for ; Tue, 25 Jan 2022 02:36:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2371166AbiAYC2l (ORCPT ); Mon, 24 Jan 2022 21:28:41 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49108 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359737AbiAXUIM (ORCPT ); Mon, 24 Jan 2022 15:08: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 0FD43B810AF; Mon, 24 Jan 2022 20:08:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18AAAC340E5; Mon, 24 Jan 2022 20:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054889; bh=bdl7aCB7q1AmohirLEAJ6MqG/P5xKxNKb1jA7R0d7mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZl9Xu02uyIPk9l2/znLVQkJsPUWQ6XDDT+W50wJoqZgp7z09iyS6ZcdrPqMC2cqY G7rEDzvRTJDxhPNfnLpgai1nMuduCzoYkWECDT17uFguxlLP0l7D40BbFB8DTras7R 0kJpjTlbagF067sSF5/IQ+f7Y1IhnuKQRtvEd9Qs= 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.10 504/563] block: Fix fsync always failed if once failed Date: Mon, 24 Jan 2022 19:44:29 +0100 Message-Id: <20220124184041.901852878@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- block/blk-flush.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -236,8 +236,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5C59C433F5 for ; Mon, 24 Jan 2022 20:31:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378055AbiAXU3P (ORCPT ); Mon, 24 Jan 2022 15:29:15 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34928 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354635AbiAXUIO (ORCPT ); Mon, 24 Jan 2022 15: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 dfw.source.kernel.org (Postfix) with ESMTPS id 569A261471; Mon, 24 Jan 2022 20:08:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36088C341D2; Mon, 24 Jan 2022 20:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054892; bh=CEkzwEYn6hpZRkF6t02OQp0xNq32zDm4ic8dJORavy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fhe+KBWH4Jp9Nd+zzeB2c2pvVE4x2/AbNTrLZyS4efUv5aoscZdM+HT9EyQegYb+r 9XevHUr0ogJkgNKNT4SCjFmv7Fa/CsFnJ6PNqhF4FZO/9a0MXceVasgB0boZXKq5nm ismb3/O2rdJnu9F+SeU3f32G15fdiclxe1lpzpso= 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.10 505/563] arm64/bpf: Remove 128MB limit for BPF JIT programs Date: Mon, 24 Jan 2022 19:44:30 +0100 Message-Id: <20220124184041.939992577@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -22,15 +22,6 @@ struct exception_table_entry =20 #define ARCH_HAS_RELATIVE_EXTABLE =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 int arm64_bpf_fixup_exception(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 (KASAN_SHADOW_END) -#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 (-VMEMMAP_SIZE - SZ_2M) #define VMEMMAP_END (VMEMMAP_START + VMEMMAP_SIZE) --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -923,7 +923,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 @@ -1136,15 +1136,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2F21C3526F for ; Mon, 24 Jan 2022 20:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383993AbiAXU2e (ORCPT ); Mon, 24 Jan 2022 15:28:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33622 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378229AbiAXUGg (ORCPT ); Mon, 24 Jan 2022 15:06: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 C0E3D60FEA; Mon, 24 Jan 2022 20:06:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98314C340E5; Mon, 24 Jan 2022 20:06:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054795; bh=qlfGHbOjwuWJJj7g3mrICRmEQ360zRztaKRh34ZW7F8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aCycsy53BRJGVdHkDhaTPyDxX/sSlAO0wC0qtQiFc7aPvtm61Dfr7FeqX4OnzuoEQ 3WTbk2uy6KnUl3wcadIgFGVoIFuhpjjG6X38UlGafUx9V+KqiKmHlQ3+HWrn3C5lDi TS6mg1Bi9s3+FRAXY8RGGsti+pt4pJL0HkPBlJWc= 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.10 506/563] bpftool: Remove inclusion of utilities.mak from Makefiles Date: Mon, 24 Jan 2022 19:44:31 +0100 Message-Id: <20220124184041.971920320@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7625FC433F5 for ; Mon, 24 Jan 2022 20:31:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384131AbiAXU2z (ORCPT ); Mon, 24 Jan 2022 15:28:55 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49536 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378242AbiAXUGk (ORCPT ); Mon, 24 Jan 2022 15:06: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 45D59B8122F; Mon, 24 Jan 2022 20:06:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AEA4C340E5; Mon, 24 Jan 2022 20:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054798; bh=U2lQl/MZ0d0+YaTq1QYVKR854nG4+BKuzrVJGOnA0c4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RmT19GfgKaPgmPtCOFkOKaFMAHxxmPBEcguIMka1TY2W89ONlxjMNAfKUYKoZRMUe mUN50MOdSTzMyexuQPGXY9Foprc0XO9msEz2a/ZS/xhfL1N8ANTkupCtIrMWs2/FHP FvD1o0QeAahHUfHGChi8el6LuWl8vnl6z5+g2Wng= 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.10 507/563] xdp: check prog type before updating BPF link Date: Mon, 24 Jan 2022 19:44:32 +0100 Message-Id: <20220124184042.004368957@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- net/core/dev.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -9339,6 +9339,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 248E9C433F5 for ; Mon, 24 Jan 2022 20:29:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384017AbiAXU2m (ORCPT ); Mon, 24 Jan 2022 15:28:42 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49662 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378266AbiAXUGn (ORCPT ); Mon, 24 Jan 2022 15:06: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 0E42CB8124F; Mon, 24 Jan 2022 20:06:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36C61C340E5; Mon, 24 Jan 2022 20:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054800; bh=8qphzB9DIKFYeekh22vyIkpyTJNnlON5enOGNgmM+ZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XHtu7o+AGXFMas5iaCTdivZ6VNdOZPxB8S64VaEPBQIKfmyQ+rFC/PL1eUSeOQ3bO kcvu10d05oBhQJqCEgJVxbVy42gUbBOH6pc3/bHGfWbfQXPZBlt0vqN+UP/WSGnQnl NYxhXv70r36mAvNN4PdTOgsFJkVVn6O5y6t8gvRo= 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.10 508/563] perf evsel: Override attr->sample_period for non-libpfm4 events Date: Mon, 24 Jan 2022 19:44:33 +0100 Message-Id: <20220124184042.036113932@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1014,6 +1014,17 @@ struct evsel_config_term *__evsel__get_c return found_term; } =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: * @@ -1080,14 +1091,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2529DC46467 for ; Tue, 25 Jan 2022 03:00:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315285AbiAYCxJ (ORCPT ); Mon, 24 Jan 2022 21:53:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376524AbiAXVGc (ORCPT ); Mon, 24 Jan 2022 16:06: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 C01E3C0613E9; Mon, 24 Jan 2022 12:06: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 610596131F; Mon, 24 Jan 2022 20:06:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6428BC340E7; Mon, 24 Jan 2022 20:06:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054803; bh=o4+DfOCig2plLCN2WaUQs6Fkq3E43q2XrxEr3ptjrwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=12kuqJmWze7PNgCQohmY9/V6whUFqYN7wZOTD0XbxuUPRMIguZAMFvN3kOyxLw4kP lIYDFuLQ1VEWD+rNjlfdK09U0/Iw38IVsUY+uJru4bws/6sq1P4/0RkcYA4qo05jPC jBI2vv0avgg2Md20/ohkcGtWOJu3eTfA6any9R8I= 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.10 509/563] ipv4: update fib_info_cnt under spinlock protection Date: Mon, 24 Jan 2022 19:44:34 +0100 Message-Id: <20220124184042.068531951@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -251,7 +251,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); } @@ -262,6 +261,10 @@ void fib_release_info(struct fib_info *f spin_lock_bh(&fib_info_lock); if (fi && --fi->fib_treeref =3D=3D 0) { 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) { @@ -1431,7 +1434,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; @@ -1463,7 +1468,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; @@ -1590,6 +1594,7 @@ link_it: fi->fib_treeref++; 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B552C433F5 for ; Tue, 25 Jan 2022 03:00:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315315AbiAYCxL (ORCPT ); Mon, 24 Jan 2022 21:53:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376993AbiAXVGc (ORCPT ); Mon, 24 Jan 2022 16:06: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 286A7C0613EF; Mon, 24 Jan 2022 12:06: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 BCB5461324; Mon, 24 Jan 2022 20:06:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACF53C340E5; Mon, 24 Jan 2022 20:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054807; bh=Jw7EEzHPcXAFK0dwyj8V0E54n37YUsAQ5hLgWn8Vm4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ubHqgzY/uDR7vbxbhgZ/XVNSwfZcddaHOtzgtHBtzi5c1tRcQm3cebnJHxbIa/csq LX6ZTp+WjiNgoNWc49qkD8fAJu9+sgcVeIBG4kV3JdDWHJVgJuiVjxTuYP80//buhF hIJUheACiANpj0pH9aHnlWTKOaKpvKT/yHC+DiJM= 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.10 510/563] ipv4: avoid quadratic behavior in netns dismantle Date: Mon, 24 Jan 2022 19:44:35 +0100 Message-Id: <20220124184042.099678760@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -321,11 +322,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, @@ -435,12 +440,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 && @@ -1608,12 +1612,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) } @@ -1963,8 +1965,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) { @@ -1983,12 +1984,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; @@ -2133,7 +2133,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; @@ -2149,8 +2148,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13F44C433FE for ; Mon, 24 Jan 2022 20:31:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384150AbiAXU27 (ORCPT ); Mon, 24 Jan 2022 15:28:59 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33746 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378320AbiAXUGv (ORCPT ); Mon, 24 Jan 2022 15:06: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 95E8161324; Mon, 24 Jan 2022 20:06:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93889C340E5; Mon, 24 Jan 2022 20:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054810; bh=SRAw0h8NYECOGKjSJjF9DsNbnXDNk3/S7oZf5Nhl9fE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uIsoq6NJO7/45MSw32TRI5YbyGhkdKTgEA9WrhTWrYsDRsAwbDdZUTYfQJk0HA+zV EH+c3ZR9qV73Lrzyc3IFuOwWdHBAGn1+GHEZ+kEzHQGIYpyTQfrZZNi5P3ZUsW7aJ1 5QNWKBFbfJus/h4jZKjHybb/kNZyf2dYTAsz8K24= 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.10 511/563] net/fsl: xgmac_mdio: Add workaround for erratum A-009885 Date: Mon, 24 Jan 2022 19:44:36 +0100 Message-Id: <20220124184042.137459992@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -49,6 +49,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 @@ -184,10 +185,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 @@ -219,12 +220,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) && @@ -232,13 +239,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) @@ -282,6 +293,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEE0FC433EF for ; Tue, 25 Jan 2022 02:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421677AbiAYC1a (ORCPT ); Mon, 24 Jan 2022 21:27:30 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33768 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378349AbiAXUGy (ORCPT ); Mon, 24 Jan 2022 15:06: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 B6CBA6131E; Mon, 24 Jan 2022 20:06:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96DFFC340E5; Mon, 24 Jan 2022 20:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054813; bh=X8v3YWVXZicOC7ikzRWWDSDNRdYKZm6bnipEV3B3dsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PsZa9qXJn7KnMaDKo0SuZi5V2Fq+Ph5k035jOPgyAYxE7DEhak1yoj38a5RUJqACc eNyp34qJMH2rNgKGCHNa2vapK6eZUgLPbeicnSFkoVJdJZOgw7KerS0OrkWB9jDgmx RuBvjIVMeQwhGqXHsH8KCe8HkPeCRO2QPmF8QSuc= 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.10 512/563] net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module Date: Mon, 24 Jan 2022 19:44:37 +0100 Message-Id: <20220124184042.167854518@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -320,9 +320,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F699C43217 for ; Tue, 25 Jan 2022 03:01:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315063AbiAYCw0 (ORCPT ); Mon, 24 Jan 2022 21:52:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377008AbiAXVGb (ORCPT ); Mon, 24 Jan 2022 16:06: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 E13C9C0613E5; Mon, 24 Jan 2022 12: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 dfw.source.kernel.org (Postfix) with ESMTPS id 80B0460B89; Mon, 24 Jan 2022 20:06:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EBDCC340E5; Mon, 24 Jan 2022 20:06:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054815; bh=x1ittnNsJWwt1zDpNreQd8A+qpmVXaypmHKKZugegkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QaKh3sv44ZbE/OsW2u3q7xyppB/iTprxUrkCJ/CQV753D10ECtK2x1qYvH6mOu0fw 2yTkr8q8x+J4sbNEncFPY3PFCN2qNcoy4tfQwx31M5lZYhdlct78bpuWgKKQoY0Drj Abw3phjneJpGuiKT3iYXcqJmXc/MnzkvtBn/rhnw= 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.10 513/563] parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries Date: Mon, 24 Jan 2022 19:44:38 +0100 Message-Id: <20220124184042.197847238@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B18A6C43219 for ; Mon, 24 Jan 2022 20:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345937AbiAXU3E (ORCPT ); Mon, 24 Jan 2022 15:29:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33840 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378402AbiAXUG7 (ORCPT ); Mon, 24 Jan 2022 15: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 72BF160B89; Mon, 24 Jan 2022 20:06:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55DBDC340E5; Mon, 24 Jan 2022 20:06:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054818; bh=aaHOJV8MOIdHgFB4aY/Fq/gj7JNcclxTGHGizhQJaHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MT49/35v/9MTMlXxTHpMCf3p2eMs8hOBCKvVQg7Bz4hs/474l/nsD31NpsSyTE/bK 2ZILgOFCA/fc9X41wkxROwVYqdny/bRcR2H2u9GHlLE0pl9KUISG71CCG55gk9gUoA syvuzX2N2riSb5WlxVmdtAfqWFC51t+jJNVLglCY= 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.10 514/563] f2fs: compress: fix potential deadlock of compress file Date: Mon, 24 Jan 2022 19:44:39 +0100 Message-Id: <20220124184042.229711221@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- fs/f2fs/compress.c | 50 ++++++++++++++++++++++--------------------------= -- 1 file changed, 22 insertions(+), 28 deletions(-) --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1362,25 +1362,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, @@ -1395,26 +1408,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; @@ -1423,14 +1425,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09B7DC3526C for ; Tue, 25 Jan 2022 03:00:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315263AbiAYCxG (ORCPT ); Mon, 24 Jan 2022 21:53:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386882AbiAXVGb (ORCPT ); Mon, 24 Jan 2022 16:06: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 4161CC0612AD; Mon, 24 Jan 2022 12:07: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 0A872B8123D; Mon, 24 Jan 2022 20:07:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6163DC340E5; Mon, 24 Jan 2022 20:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054821; bh=cHJfuW1rxuxGH3zObCKuUchcjxNQLuugkv/ck4wFPfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vVXMauRC/XNp4VaCM468CbacGp8NC9tDvkKyQm54Zuq/ZHVxXgHjj4FatwNRKqRnd ddCt97JoqOMNG/ml4CZadfN0qxaroAWqPZMtFAbAt6gtbwXwSPvzuQ/czK4fT+l03L tBf6qzuoDg6I5v5b2sl13Li3wwTqmW9nZ0yl78jA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org Subject: [PATCH 5.10 515/563] f2fs: fix to reserve space for IO align feature Date: Mon, 24 Jan 2022 19:44:40 +0100 Message-Id: <20220124184042.260404504@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -955,6 +955,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 */ @@ -1984,6 +1985,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; @@ -2229,6 +2235,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 @@ -539,7 +539,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 @@ -289,6 +289,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) @@ -3736,6 +3776,10 @@ try_onemore: goto free_nm; } =20 + err =3D adjust_reserved_segment(sbi); + if (err) + goto free_nm; + /* For write statistics */ if (sb->s_bdev->bd_part) sbi->sectors_written_start =3D --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -330,7 +330,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CECA5C433F5 for ; Tue, 25 Jan 2022 03:00:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315392AbiAYCxS (ORCPT ); Mon, 24 Jan 2022 21:53:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446066AbiAXVGn (ORCPT ); Mon, 24 Jan 2022 16:06: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 6D9C8C0604FD; Mon, 24 Jan 2022 12:07: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 2AF32B810AF; Mon, 24 Jan 2022 20:07:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72A00C340E5; Mon, 24 Jan 2022 20:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054827; bh=vaHrpZuT0SEiaCkxFuZmfH+VWUjcQY23cDzjyVIvb5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AmjRCnDqMNKXHZHGGL9ys7GmDTC9HkXYWKDqZ49x43eubHlXnOgvNhUMS/vFyCULN 7yeKMOW4rs133ln6QRERmFcGxddFsCQoTkkzHvj7/k2FVTSnnhAMWf1drMmFBMcXvW ynh0d51ccSE7NbL/Iwhm/DClP1be5zR7jfP8Ss8s= 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.10 516/563] af_unix: annote lockless accesses to unix_tot_inflight & gc_in_progress Date: Mon, 24 Jan 2022 19:44:41 +0100 Message-Id: <20220124184042.291857701@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF349C433FE for ; Tue, 25 Jan 2022 02:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421704AbiAYC1d (ORCPT ); Mon, 24 Jan 2022 21:27:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33974 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349172AbiAXUHM (ORCPT ); Mon, 24 Jan 2022 15:07: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 A9B906131D; Mon, 24 Jan 2022 20:07:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83EFFC340E5; Mon, 24 Jan 2022 20:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054831; bh=bTFoX/N6uoPeZfsGy7J1VXRKpnYHbB47AS5vmroa+hU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0e67oGZvX7TN207OLwdKmtS5tHUErLOlU4wRRl48B/6ntRMp/RDlY0trDrDpYW3bK d0rw2ArRXY5AbWqTSXU6wzHjF1CoI36B6j4pXZ1hm7vba1Jr69FET8dajqZRwwxwhk 0edQpd4Z0laz/KMG/vhY81O2GcbFF0wkwwL2cWKQ= 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.10 517/563] clk: Emit a stern warning with writable debugfs enabled Date: Mon, 24 Jan 2022 19:44:42 +0100 Message-Id: <20220124184042.331859164@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/clk/clk.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3314,6 +3314,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E527FC433F5 for ; Tue, 25 Jan 2022 02:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421721AbiAYC1e (ORCPT ); Mon, 24 Jan 2022 21:27:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34014 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352987AbiAXUHP (ORCPT ); Mon, 24 Jan 2022 15:07: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 9E1EA6133D; Mon, 24 Jan 2022 20:07:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A80B2C340E5; Mon, 24 Jan 2022 20:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054834; bh=TbXTETSQ1YQILlp9xSgjvtLzrsicT/Saq34wBUA5fk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h8Lkl1SLsdCY0UXjDLyOgjfCUHYNKTU6aZSvsAlSD/a98meF3HUl9wwoiUtzyR0s/ A1i3aBfhX7hyepPNhakiTiue0BtCbJnVxiNV3uZnqzhxA2jNIz2Z9cX79KJAsmYOmA qeVvr9bgfSHt+hod7CN1VQEZVR+xTMWUj4qKNMRs= 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.10 518/563] clk: si5341: Fix clock HW provider cleanup Date: Mon, 24 Jan 2022 19:44:43 +0100 Message-Id: <20220124184042.361906453@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1576,7 +1576,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DEBDC4707E for ; Tue, 25 Jan 2022 03:01:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315374AbiAYCxR (ORCPT ); Mon, 24 Jan 2022 21:53:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446067AbiAXVGn (ORCPT ); Mon, 24 Jan 2022 16:06: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 1810CC061367; Mon, 24 Jan 2022 12:07: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 A5CB26131F; Mon, 24 Jan 2022 20:07:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D54CC340E5; Mon, 24 Jan 2022 20:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054837; bh=JbWn9CKpNq8onDfW5JiMs2Mh8tmVqXNyymnYD5WiCeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fu0J5XaTpLrGrG9vbAWyQPI9sSQjZOLQJBf9/ck65csTcIbzeTMw7My0gnEUOJ2RF lr+BhYkQscKuKYni8AM2USiVEPH3ovDjdkDpuddnIZM2tZUTpso1hnN9CeLbyZPpIj Ku7A/et3TScgWgjcwy+uMzSyz49UlLPJKipb4TmY= 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.10 519/563] net/smc: Fix hung_task when removing SMC-R devices Date: Mon, 24 Jan 2022 19:44:44 +0100 Message-Id: <20220124184042.391336897@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1002,16 +1002,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); @@ -1023,7 +1018,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]); } } } @@ -1035,16 +1030,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB269C433EF for ; Tue, 25 Jan 2022 03:00:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315339AbiAYCxO (ORCPT ); Mon, 24 Jan 2022 21:53:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446089AbiAXVGn (ORCPT ); Mon, 24 Jan 2022 16:06: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 A2FEAC06136B; Mon, 24 Jan 2022 12: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 ams.source.kernel.org (Postfix) with ESMTPS id 5F842B810BD; Mon, 24 Jan 2022 20:07:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E728C340E5; Mon, 24 Jan 2022 20:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054840; bh=QQYbblQ35leF5mIDeINDGQFfwan87gWS7LaQi2QXxZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xT0ymktvrfA6sG0TT+iKfB8fTas5BsE3O//P2oWzUAxsIw7JxYDdOjCqLJtqVCYbt H/UxeblPCOwzfmO9UNNykZ7mvvQpPzFMQihhm7qmC5VxNAmPSxHkO5qMM9TZt/tWfj Aiql5XJeIMAB4ZGnBnTT3lEVufgPnCUhCqfjABVw= 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.10 520/563] net: axienet: increase reset timeout Date: Mon, 24 Jan 2022 19:44:45 +0100 Message-Id: <20220124184042.421883072@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 194BEC43219 for ; Tue, 25 Jan 2022 02:34:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421755AbiAYC1j (ORCPT ); Mon, 24 Jan 2022 21:27:39 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50028 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356915AbiAXUH3 (ORCPT ); Mon, 24 Jan 2022 15: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 80D2DB810BD; Mon, 24 Jan 2022 20:07:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 959AEC340E5; Mon, 24 Jan 2022 20:07:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054843; bh=hgTMhcKXn0qipvk81yvlR5VaiWMS55P9EIckJyt9sxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hsAHzu+/sh3dX6DNg+IGZ1suR/A7VE+t+gzEBHH6lmxzaJS/c8skaPtN939VjQnjH d5ZU0s0acYPFzmMDwBIVvUOoB9RpepE03/cPs6ZaxSr0kdHK5Sm4v7/RuOHbXqVPyU 18HznoP+lCWnEv521u9cyV6aG6hhtorzvZrdqP3I= 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.10 521/563] net: axienet: Wait for PhyRstCmplt after core reset Date: Mon, 24 Jan 2022 19:44:46 +0100 Message-Id: <20220124184042.465198186@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6379FC4332F for ; Tue, 25 Jan 2022 01:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413628AbiAYAjd (ORCPT ); Mon, 24 Jan 2022 19:39:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444974AbiAXVHP (ORCPT ); Mon, 24 Jan 2022 16:07: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 56A36C06136F; Mon, 24 Jan 2022 12:07: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 E930B6132F; Mon, 24 Jan 2022 20:07:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A839CC340E5; Mon, 24 Jan 2022 20:07:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054846; bh=SDhyJa7hfgQ8otNbA1lgN294AzUYzY6q7sgLiEq8GbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OAlgqryjmsS88vz1kfqEECJlzQd7SBjVmaYDCpFPYj2J51KWH37gn/HC5jPiDZcOn ZTX7LbhRRxIxC/tPQs/Y4tiPQSHDVoNnQePChrZ4mADjm0mSTrv/BaEqqQrrkzr6fX xxwlkSslFF8Z0n3k9j9C0HZCK5UkOOAbZ0I7YUso= 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.10 522/563] net: axienet: reset core on initialization prior to MDIO access Date: Mon, 24 Jan 2022 19:44:47 +0100 Message-Id: <20220124184042.498641995@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -2024,6 +2024,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5006BC433F5 for ; Tue, 25 Jan 2022 02:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413650AbiAYAjh (ORCPT ); Mon, 24 Jan 2022 19:39:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444873AbiAXVHP (ORCPT ); Mon, 24 Jan 2022 16:07: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 01780C061377; Mon, 24 Jan 2022 12:07: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 BE45CB8119E; Mon, 24 Jan 2022 20:07:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9154C340E5; Mon, 24 Jan 2022 20:07:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054849; bh=DKaIZ44jXhAHBBxgsqnKrT5Vc0etjfMDYpjpcuu0RIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KtdbmNFy0IGXeZ7UE1+eqyxzrDkITwfsHxsvuRoHEA9mtrezOxOMuC0I4nxaw8PPr 6VrSWxdpBz5k+GlvMJ+OwSBEHQJ0tvU7/Y/yYGzPGRVtvwA4Pu6eBvjOpyeMaOPAQ3 56BCs7KPUXZrms0CkDMzxRCNLF4XqNXyuYex3o8E= 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.10 523/563] net: axienet: add missing memory barriers Date: Mon, 24 Jan 2022 19:44:48 +0100 Message-Id: <20220124184042.530924435@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28E91C433EF for ; Tue, 25 Jan 2022 02:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413638AbiAYAjf (ORCPT ); Mon, 24 Jan 2022 19:39:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444932AbiAXVHP (ORCPT ); Mon, 24 Jan 2022 16:07: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 B3BEAC061A11; Mon, 24 Jan 2022 12:07: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 44CEB6131F; Mon, 24 Jan 2022 20:07:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C63CC340E5; Mon, 24 Jan 2022 20:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054852; bh=Yz34gZFrUHF1zddU6TD8TqbiJ7HLufaVp9r91pYmln8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nH24LWsFcWa8MqTDrseuAzQhLB3f2Z5O1iEjO2v7GzpgwXjs++yCDs4uCHVGIOIre ZRwQC1oJJ30W/jnPJqUY6+5EA60ME511hHEW7g5QtC4SH/acwsMxLRFt02h89B/iTH bmumXL6Skni2PauhOFq1n/iWHN7WerSzgQQmPYqY= 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.10 524/563] net: axienet: limit minimum TX ring size Date: Mon, 24 Jan 2022 19:44:49 +0100 Message-Id: <20220124184042.563314333@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1373,7 +1374,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6FC0C433EF for ; Mon, 24 Jan 2022 20:31:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350599AbiAXU3L (ORCPT ); Mon, 24 Jan 2022 15:29:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47728 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378550AbiAXUHi (ORCPT ); Mon, 24 Jan 2022 15:07: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 22F22B811FB; Mon, 24 Jan 2022 20:07:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36191C340E5; Mon, 24 Jan 2022 20:07:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054855; bh=z/kUukaJylcFxGt8AABs3R9KeYEcCOvB/8aKXDK3HDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PQplKajHiTtnXeC+jhbpNd+tvTqfjfueO/1fV6SqZeWrnnkDmhEsBwSOttlTA1hvP 5cqu3aIEqv5ZAA0rBtkfrPJKpHJuJCXIXRGjQnTrwL0mBww2EPyUApaKAnB2Rco/pV 3yBU6guxfpl89b4hfcxipEMCv078EolmWZ+GntLM= 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.10 525/563] net: axienet: Fix TX ring slot available check Date: Mon, 24 Jan 2022 19:44:50 +0100 Message-Id: <20220124184042.593953437@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6DA0C433FE for ; Mon, 24 Jan 2022 22:30:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586837AbiAXW1Y (ORCPT ); Mon, 24 Jan 2022 17:27:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445275AbiAXVHP (ORCPT ); Mon, 24 Jan 2022 16:07: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 BF8B6C0680A2; Mon, 24 Jan 2022 12:07: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 5E0E96090A; Mon, 24 Jan 2022 20:07:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C048C340E5; Mon, 24 Jan 2022 20:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054861; bh=EjBx6VLc9soLrs83ucHSAMI+i/H49AZLt1t7DcmUv5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PgZVgII2gyzAB5LA6IDlCYoJ6FvN79V54S3xe2IgGsttIZEpPw4Yemi120X4ZN3P8 knR+XsZvqwNiTlF15wB8V8TZ8YoR+wApNkJZzm78hADoTY/UiPFuPcebdVYpVpU8Tr +xq2DTNOwZRPfZ5eBvp6RKcWv/d+yXRxxdQKFsTM= 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.10 526/563] net: axienet: fix number of TX ring slots for available check Date: Mon, 24 Jan 2022 19:44:51 +0100 Message-Id: <20220124184042.624814989@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 916D9C433F5 for ; Tue, 25 Jan 2022 02:34:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356828AbiAYC17 (ORCPT ); Mon, 24 Jan 2022 21:27:59 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48884 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378614AbiAXUHr (ORCPT ); Mon, 24 Jan 2022 15:07: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 24B72B81544; Mon, 24 Jan 2022 20:07:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CC40C340E5; Mon, 24 Jan 2022 20:07:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054864; bh=br/iQTyRsURcetzVqnQpSl1GiGq29hfg10350Q/e9Ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LpVDu3+9mWvN2wjDwgkCEgewy4tY/EJVgh8ZVg8lNrIdt7y8iNyKMYR/VrZtZnBpK QVJ5SHPq7Lnl+cseu61w1JafGmOKsz2En5ASKOODQzDGJzZpi5xMaoD1p24UtLATtQ LFy0WgVLvCY7+tSRMiNUjFleU1sYliSLma/8Fg8I= 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.10 527/563] net: axienet: fix for TX busy handling Date: Mon, 24 Jan 2022 19:44:52 +0100 Message-Id: <20220124184042.656055898@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0EE3C4332F for ; Tue, 25 Jan 2022 02:34:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378504AbiAYC2I (ORCPT ); Mon, 24 Jan 2022 21:28:08 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34440 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378629AbiAXUHt (ORCPT ); Mon, 24 Jan 2022 15:07: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 8800B6090A; Mon, 24 Jan 2022 20:07:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B854C340E5; Mon, 24 Jan 2022 20:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054868; bh=GQv7LOP06zbfKaH6OrGhewLZ8+JM8W6ZxwkO/Q4Zfm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OW8jFAgzf/kTe1HPIdzdFH6keHlRT2VqPKxbbaultnEbeQHcJU38FHfE5vhclgm+s 1VW5k/76FQrahODvi72rjryRQKI/+IBqifDmHVxJN1WlXFTG5JWzDIJ3Gz7oekY/Ja DYe0iznXdJW3vkIDOHWQBr3YwuO/EgoKrPyK1vV4= 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.10 528/563] net: axienet: increase default TX ring size to 128 Date: Mon, 24 Jan 2022 19:44:53 +0100 Message-Id: <20220124184042.690096383@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D819C433FE for ; Mon, 24 Jan 2022 22:23:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584104AbiAXWUF (ORCPT ); Mon, 24 Jan 2022 17:20:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445327AbiAXVHQ (ORCPT ); Mon, 24 Jan 2022 16:07: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 18482C0680AB; Mon, 24 Jan 2022 12:07: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 AB82261342; Mon, 24 Jan 2022 20:07:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 874C8C340E8; Mon, 24 Jan 2022 20:07:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054871; bh=n3qzIhkJTs5Zt29pol17QM7Ob/p00R3z1XaX+um3/So=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lQT6qKdvrc31rtgLBAB6NYabBNLYnEt3Zz5Z4zfvsgq+3wJUHuQCjFAExA61UKm8X HVnARTy0hk+lBaVuaONX/vs0+LPBd92wA2k9K0uwV10QfSul59M63Ld8FrySIHNivg UJEN9U+g/XcYYh+Wi3zALDQnhUCyYBV3d8Q9wVi0= 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.10 529/563] HID: vivaldi: fix handling devices not using numbered reports Date: Mon, 24 Jan 2022 19:44:54 +0100 Message-Id: <20220124184042.736548769@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71381C433EF for ; Mon, 24 Jan 2022 22:23:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584191AbiAXWUY (ORCPT ); Mon, 24 Jan 2022 17:20:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445465AbiAXVHQ (ORCPT ); Mon, 24 Jan 2022 16:07: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 4632DC0680AD; Mon, 24 Jan 2022 12:07: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 DAD186090B; Mon, 24 Jan 2022 20:07:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEF63C340E5; Mon, 24 Jan 2022 20:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054874; bh=t36Qf7OqaHp5mhLh63Ejubt/7CRwFd48SoJJMeaqkEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aochQ6oos+JT/eCVwTKV8ak7Tn8SWuPjuNp6olUsKpATDoaq6EyFTWSnosXDeJEZk /3QNGMLD2jwNjdk+U0uSaxNXbKGRmBx+eEObq8DEGKKywEy6sK5lf1Qd6mT/Gh0qcS J0uUbPHkMKGZP17sKaY0gr6sMuK/zVAMwlszjLXs= 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.10 530/563] rtc: pxa: fix null pointer dereference Date: Mon, 24 Jan 2022 19:44:55 +0100 Message-Id: <20220124184042.775283083@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF7CCC4321E for ; Mon, 24 Jan 2022 22:17:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583082AbiAXWQZ (ORCPT ); Mon, 24 Jan 2022 17:16:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390804AbiAXVM6 (ORCPT ); Mon, 24 Jan 2022 16:12:58 -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 92790C02980B; Mon, 24 Jan 2022 12:09: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 598C2B8119E; Mon, 24 Jan 2022 20:09:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 808C7C340E7; Mon, 24 Jan 2022 20:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054997; bh=iVHyyH0Rl0ctyayqKyVIO5m9Sy/n8b+oFCc8GQ1GgAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rcz0PK+s9cZn+dghSUMl/nkqCDgBzzglLUpAadaXZVFZ8JMQiFhF7+Y3VKweyb6sp T9QQwZ+3mhDZBYIWEdVOx/5buP6wZB3Qr4o+HZkmRXX0Y0/+tMNRPF1ZV5/H/BKvTw 5l15DbK6W4EssT2o+Ou5KJR4UMNXc5uYX2l4K/uQ= 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.10 531/563] vdpa/mlx5: Fix wrong configuration of virtio_version_1_0 Date: Mon, 24 Jan 2022 19:44:56 +0100 Message-Id: <20220124184042.812983165@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -812,8 +812,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75054C4167B for ; Mon, 24 Jan 2022 21:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573765AbiAXVpv (ORCPT ); Mon, 24 Jan 2022 16:45:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446317AbiAXVHw (ORCPT ); Mon, 24 Jan 2022 16:07: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 E767CC055AAC; Mon, 24 Jan 2022 12: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 890CD6137C; Mon, 24 Jan 2022 20:08:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A158C340E5; Mon, 24 Jan 2022 20:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054899; bh=mi8szNe7SyfcyY24P0ioZ15zE0DHpA/xXv6Ss/mPiA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D/VZefa/wvzrqxsSA+gHiFMJmTyxN8Vfr6UoGMvwNwRLsqg1c2/rlxiUTkbHCFJcu wNnECNDhR0pPbcpvIdoVEiVUCtKYAdqp2x9BZNEH2CqllKJ1fPnIJl7zwXNTwFjMdo MD7muXp5FbtECAW4QNve0hxbHeq852/OPNysz4Ek= 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.10 532/563] virtio_ring: mark ring unused on error Date: Mon, 24 Jan 2022 19:44:57 +0100 Message-Id: <20220124184042.850338561@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1124,8 +1124,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E154AC433EF for ; Mon, 24 Jan 2022 22:23:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583955AbiAXWTo (ORCPT ); Mon, 24 Jan 2022 17:19:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447471AbiAXVKy (ORCPT ); Mon, 24 Jan 2022 16:10: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 D7A59C09D30D; Mon, 24 Jan 2022 12:08: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 7C8B3B8122A; Mon, 24 Jan 2022 20:08:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95FF8C340E5; Mon, 24 Jan 2022 20:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054932; bh=OLGhyBE3yYUeUqi46/+gVKgkTva0eh9cbOByjskd/PM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VFJorSzUtNIUiTxCS1mkwybUhV5w+kj6oM8eon23ji2rSd4daQOG8gVGvLeECVzZ6 exM+YXJkhisifPUQ7Q86Y3YzpLWqniMenFQeizB3Iw4DwNUsrlfQHz8RwW19oR/SDY 0d3VEgmNCi+bXRrg77shwUEUzDAYlsyP2BlGFxzA= 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.10 533/563] taskstats: Cleanup the use of task->exit_code Date: Mon, 24 Jan 2022 19:44:58 +0100 Message-Id: <20220124184042.881061424@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E96BEC433FE for ; Mon, 24 Jan 2022 21:47:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379005AbiAXVr2 (ORCPT ); Mon, 24 Jan 2022 16:47:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355870AbiAXVMp (ORCPT ); Mon, 24 Jan 2022 16:12: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 AFA53C02B776; Mon, 24 Jan 2022 12:09: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 6BD01B8122A; Mon, 24 Jan 2022 20:09:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93358C340E5; Mon, 24 Jan 2022 20:09:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054966; bh=4KubBFmDsVrKB9scUEaiucazOFxFpJPrDKsfzlgOojM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J6iB2Uo3t1BimrgNJpJAEVLjlVcj1h2nrX++ZsjcBioapAccf1oqFBXcfLgxZfazp BFAFHVJuB919e6yNG4GlYw0dW/Q49fQ+WHm/EfO98jHgrrWczMGHx1qqNrCqbMjwyn vcwz+bn8pXzRxIXOIlnCGVV/SVkIDlSGkYUotKvw= 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.10 534/563] inet: frags: annotate races around fqdir->dead and fqdir->high_thresh Date: Mon, 24 Jan 2022 19:44:59 +0100 Message-Id: <20220124184042.911703298@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -116,8 +116,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 @@ -204,9 +204,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); @@ -321,9 +321,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAF5BC433F5 for ; Mon, 24 Jan 2022 22:18:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349271AbiAXWSF (ORCPT ); Mon, 24 Jan 2022 17:18:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389949AbiAXVM5 (ORCPT ); Mon, 24 Jan 2022 16:12:57 -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 38134C029804; Mon, 24 Jan 2022 12:09: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 CDA8760916; Mon, 24 Jan 2022 20:09:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2605C340E5; Mon, 24 Jan 2022 20:09:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054978; bh=atuxVLNTxB+C80q7YUFCssDxZ+e35fzAx1KOHT0dCYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S7xmozUvXtdWPTn2nwAN2YxIgFCArINYzDvt6oobCp8ERruHCc5y2taCFK9tIhhC7 fQG+XAEH15FEv+SvQ9xKo/qkscP4orJWoVyxaUUp6LKR4v+G3yg3ZJFFjzWZXPobyx uRBf8Fe/2Jofu6YqUM/Y9wmO635koX5Mv5ukOS8E= 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.10 535/563] netns: add schedule point in ops_exit_list() Date: Mon, 24 Jan 2022 19:45:00 +0100 Message-Id: <20220124184042.943921168@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -183,8 +183,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C00ABC43217 for ; Mon, 24 Jan 2022 22:17:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583119AbiAXWQb (ORCPT ); Mon, 24 Jan 2022 17:16:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390455AbiAXVM6 (ORCPT ); Mon, 24 Jan 2022 16:12:58 -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 B6585C029808; Mon, 24 Jan 2022 12:09: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 74CC4B811FB; Mon, 24 Jan 2022 20:09:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9951CC340E5; Mon, 24 Jan 2022 20:09:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054981; bh=WI9uI2gpVnPU3QdHK+htWbOVLTe2ui+1xrW8axESCkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BIlRsKAQTqrFiTisIBTEwBUmfZuVq8eTZMY+2hWTJaipIelQckNXTPZLSSMggdD8l FaOi4c4SvgA0aZllpumbQLhuFian+Y7/30+ULFEjXbcEPPuMF18JNeWYazvxf6nt1V mZC0L60VdmIHpFO3cIEHGCV7cg18A764Qx22dUbc= 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.10 536/563] xfrm: Dont accidentally set RTO_ONLINK in decode_session4() Date: Mon, 24 Jan 2022 19:45:01 +0100 Message-Id: <20220124184042.974681561@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -3294,7 +3295,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10F75C433EF for ; Mon, 24 Jan 2022 22:17:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583104AbiAXWQ3 (ORCPT ); Mon, 24 Jan 2022 17:16:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390833AbiAXVM6 (ORCPT ); Mon, 24 Jan 2022 16:12: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 22627C02980A; Mon, 24 Jan 2022 12:09: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 B834F60916; Mon, 24 Jan 2022 20:09:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90CDEC340E5; Mon, 24 Jan 2022 20:09:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054984; bh=M8qBtgq4qnULWEmvL4y24IHRUUiDZqfTZBrg8l7jr4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bj+w5kLZbwakC5gbTVZfw5u8orir+1b2SCCwEMmRCuH+Z+HWzUmUDfOivk79xVqWU pt7vKeXEcPpmNybsroqteQxxc2P0/gTP2aura6PJBzmPs0AX1U9g9kKdOKM9+01Tl9 jUflmHXFt5QW8PtgxsbyTbq2xp1j6VZ+2Tng4WPI= 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.10 537/563] gre: Dont accidentally set RTO_ONLINK in gre_fill_metadata_dst() Date: Mon, 24 Jan 2022 19:45:02 +0100 Message-Id: <20220124184043.010103713@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -599,8 +599,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEC9DC4167D for ; Mon, 24 Jan 2022 20:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384558AbiAXUaD (ORCPT ); Mon, 24 Jan 2022 15:30:03 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51672 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378786AbiAXUJv (ORCPT ); Mon, 24 Jan 2022 15:09: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 7BF92B810BD; Mon, 24 Jan 2022 20:09:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA2F0C340E7; Mon, 24 Jan 2022 20:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054987; bh=DthYjh+AUf6U0msGHmNsk3EuOaLtsWRn1QyFhfakDLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cwauFz9rodWObEhGxdAnr1AaScRiVMLoDuxybAfB14o2u8W+zf1RFgj4DxCL2ulCZ o4Txi9bdxReLRG2RshtPL6rfY+LsLg05AuBqMluJ6adjgjvzuINbc8gt0ElulIrAWs Ra0pmOP5q3p7nbBCq3GGCvNAAh7FBm+oS+OwoN9A= 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.10 538/563] libcxgb: Dont accidentally set RTO_ONLINK in cxgb_find_route() Date: Mon, 24 Jan 2022 19:45:03 +0100 Message-Id: <20220124184043.042063436@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F27B9C4321E for ; Tue, 25 Jan 2022 02:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422045AbiAYCaB (ORCPT ); Mon, 24 Jan 2022 21:30:01 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36582 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378794AbiAXUJv (ORCPT ); Mon, 24 Jan 2022 15:09: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 5621F6136F; Mon, 24 Jan 2022 20:09:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F58DC340E5; Mon, 24 Jan 2022 20:09:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054990; bh=ZJUZG0M+EAzk8WRfF9nqPauGl/R5HVk9Iof7QH3bIac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PojPSSQsFl4wv6+XNElg9rV2IwILkaFEXSl6JSlCNdImVuofUutU4pr0w8YFL74mh mpU3ej8ZXfixaMbbwqo3IW+oSlttm8nw1DgrhkcgGdHO2Znq5FPTbq+YECduohEp5u vRgEErbtbmI5N+u1V33Jf/1U1mw8fAyINh6qq9HU= 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.10 539/563] perf script: Fix hex dump character output Date: Mon, 24 Jan 2022 19:45:04 +0100 Message-Id: <20220124184043.078437690@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -145,7 +145,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55BC5C433FE for ; Mon, 24 Jan 2022 20:31:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384571AbiAXUaF (ORCPT ); Mon, 24 Jan 2022 15:30:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36612 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378832AbiAXUJy (ORCPT ); Mon, 24 Jan 2022 15:09: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 9251960B56; Mon, 24 Jan 2022 20:09:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56CCAC340E7; Mon, 24 Jan 2022 20:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054994; bh=TdBfH9yDEX18SMwX7BpD8oKnsT0/eTI2XzEfRHK2+LY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MlwejpFuhShu/0/fWaogsZMrCq765qpfDHwp+Hix7YTAnVg7DhW8y7LOzWpRkcOf4 ALr2AjEYvpkTbm9sJjCwIFQDDf7+LszOR7KMOfnHQq5dpsQ/ecZ776Jq572gQgx8px 1X/G9G3K/R7XRsqyuKdKQQ1PocJzSrbiX/dVfn4w= 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.10 540/563] dmaengine: at_xdmac: Dont start transactions at tx_submit level Date: Mon, 24 Jan 2022 19:45:05 +0100 Message-Id: <20220124184043.114975053@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/dma/at_xdmac.c | 6 ------ 1 file changed, 6 deletions(-) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -338,9 +338,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 @@ -430,9 +427,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E65F4C433FE for ; Mon, 24 Jan 2022 20:31:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384237AbiAXU3V (ORCPT ); Mon, 24 Jan 2022 15:29:21 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60596 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352516AbiAXUIX (ORCPT ); Mon, 24 Jan 2022 15:08: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 A131D6090B; Mon, 24 Jan 2022 20:08:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AE0DC340E5; Mon, 24 Jan 2022 20:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054902; bh=MbUTtqRZVmfm9VmjrzVXUTwikZ754HhTMN8vg6hX4QA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b0s22fwSzE3WHhb8ce+xNKI1cezIllIvuZ6q+dzMWC3vcsX3uuupl2tfYGUPSQrDN kpoNxyfqoP5Jg52FVsTp2D+2Umxtjuuxz2kKkWGK60RTp6uvVbcX5SV/gRG809/3f8 r8D3XowKixoH5PtdoqrPQlOPdD6X4wz7YOrofu9M= 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.10 541/563] dmaengine: at_xdmac: Start transfer for cyclic channels in issue_pending Date: Mon, 24 Jan 2022 19:45:06 +0100 Message-Id: <20220124184043.145043772@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1718,11 +1718,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF5B7C433EF for ; Mon, 24 Jan 2022 21:44:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457938AbiAXVmc (ORCPT ); Mon, 24 Jan 2022 16:42:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446546AbiAXVIr (ORCPT ); Mon, 24 Jan 2022 16:08: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 AAD21C034610; Mon, 24 Jan 2022 12:08: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 67EE8B8122D; Mon, 24 Jan 2022 20:08:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8132DC340E5; Mon, 24 Jan 2022 20:08:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054905; bh=XvKunCyUTqhoDJttVMh5EWZ4rnj0JNBQ0NSEL9yv4Ak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KKPLzUt8ntv6MT1813HpeyS+g5VBvs4kOXYbCT44WC+idYaYU7TUO0gaoZdayCtSW C03133t6VKCqeWUwntlcNzlurd1uNcKOfYMnRj/N7umByxg8zLQpWP9lKlsS0yB+l8 p7y540yd0RBoN98K7r7wYDwr5b7+cZVrrrcBLdB0= 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.10 542/563] dmaengine: at_xdmac: Print debug message after realeasing the lock Date: Mon, 24 Jan 2022 19:45:07 +0100 Message-Id: <20220124184043.176567848@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -424,10 +424,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A86B1C4321E for ; Mon, 24 Jan 2022 21:46:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1572992AbiAXVmy (ORCPT ); Mon, 24 Jan 2022 16:42:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442661AbiAXVJP (ORCPT ); Mon, 24 Jan 2022 16:09: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 13955C08E7BF; Mon, 24 Jan 2022 12: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 dfw.source.kernel.org (Postfix) with ESMTPS id A9F1B61028; Mon, 24 Jan 2022 20:08:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72AD1C340E5; Mon, 24 Jan 2022 20:08:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054908; bh=kMr+l1X0Tz15rQxemznxgmpr77b7eA79Xv76g7qVjlg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwZ+728oYuE0f9XtySY9ZiSeYV/3rNHHnOfxBSNIzu3Bnz+TLdhjmEalaEAL3zbgP aDy82EN7lnrqLnYDNA5Hibh8+4fT4VfX+AX6DfseU1n+EKqNrf7rmN25XNkpbSZGX9 c3Vli2WKmEMpQ22+85OydDeEsujxwSQ9OiQKJwKM= 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.10 543/563] dmaengine: at_xdmac: Fix concurrency over xfers_list Date: Mon, 24 Jan 2022 19:45:08 +0100 Message-Id: <20220124184043.212118839@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1559,14 +1559,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0175AC433FE for ; Mon, 24 Jan 2022 21:46:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1458082AbiAXVmo (ORCPT ); Mon, 24 Jan 2022 16:42:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446720AbiAXVJQ (ORCPT ); Mon, 24 Jan 2022 16:09: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 4A640C08E859; Mon, 24 Jan 2022 12:08: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 D880060916; Mon, 24 Jan 2022 20:08:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DE35C340E5; Mon, 24 Jan 2022 20:08:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054911; bh=GmbIhl0GKXFYcgNw3rnSAj5/45aGoCjBXjN0MRLk7Lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=02K6P+jMTc54Ox5Gn03N/2Ef9d/zIsI6+jKuYXEt5AgqlDsWpjRYbeaUTG0PKA5nw zsCJ8qpfbz07Cu/8PTFHrNKmv6nUAF1oX4tqJ04hFabdxFi015YiW3+wqzsfeO1ryX 99uLxzp9l+MpD4uE/SZy4ebiPvWTRNsSZ9f1LG6I= 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.10 544/563] dmaengine: at_xdmac: Fix lld view setting Date: Mon, 24 Jan 2022 19:45:09 +0100 Message-Id: <20220124184043.247442822@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -89,6 +89,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 */ @@ -353,7 +354,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EF6AC433EF for ; Mon, 24 Jan 2022 20:31:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384362AbiAXU3e (ORCPT ); Mon, 24 Jan 2022 15:29:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35288 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378758AbiAXUIg (ORCPT ); Mon, 24 Jan 2022 15:08: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 E0E7661028; Mon, 24 Jan 2022 20:08:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7634C340E5; Mon, 24 Jan 2022 20:08:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054914; bh=WS0FP5EzZnRXvSa/+sP/qnF6xwKayJlaYd0A6sJ99QA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tHKOFy4wGQ3uYh4OBNimb1kAIcUa6JhEtiJq/ew6ZuG4+Svo6uM4U3+ttE1B/ybhH kJBSiiS82/mvE1wCkbvCpCgoropqIM77GWJfOYrJl8utsC1xOxcjl5/0nl+6SJYJBN NZnEI1G2WwSzwUVp7loLpSn0dWo3EsBlByn0nx40= 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.10 545/563] dmaengine: at_xdmac: Fix at_xdmac_lld struct definition Date: Mon, 24 Jan 2022 19:45:10 +0100 Message-Id: <20220124184043.277194664@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -221,15 +221,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04136C4332F for ; Mon, 24 Jan 2022 20:31:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384323AbiAXU3b (ORCPT ); Mon, 24 Jan 2022 15:29:31 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51016 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378769AbiAXUIk (ORCPT ); Mon, 24 Jan 2022 15:08: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 9C892B8122D; Mon, 24 Jan 2022 20:08:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E3AEC340E5; Mon, 24 Jan 2022 20:08:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054917; bh=3EHpRrMUpsj/gfEbrNR8bSyf7OM4VIACXy4nSoKp2rc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xfrzQlxpK13KwJkElNoHGWvpYm60uEl9oFEZqquI2LCliQrp8W/Gb37S/Ckq+9b9t qVvfQFeTJ1fbFWHfl9TqSuLTtGz+K6hGLVzMaLYQHr5p7S99Eaxl7MTdeC4svJoQFM 37JF5bG+x4QWMhhYpqabiNwWzJkTI+l+EdllUSbQ= 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.10 546/563] perf probe: Fix ppc64 perf probe add events failed case Date: Mon, 24 Jan 2022 19:45:11 +0100 Message-Id: <20220124184043.309725982@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -3035,6 +3035,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6BB4C433FE for ; Tue, 25 Jan 2022 02:35:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421896AbiAYC3P (ORCPT ); Mon, 24 Jan 2022 21:29:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49536 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351363AbiAXUIo (ORCPT ); Mon, 24 Jan 2022 15:08: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 7C20EB81229; Mon, 24 Jan 2022 20:08:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC83BC340E5; Mon, 24 Jan 2022 20:08:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054920; bh=jvYhz8YpNmkbER86BXrSZ5adwkxgPvr1U2vrZuzY4l0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=czipoAkGJYyveVf7IL9wl73IRdvtibGHmYo4EGf4vAVpAbbhVeefwhu8ZhSblFiLr 7anz73k2KDNntG1NZ51mxGjKIyKB3MkOFxmxDOeCayUwDJtw108FTGPFA3ZAVziLon Llp/1vrnoNImXF8Itb52jpE+H6/zqf11PjPT+G/o= 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.10 547/563] devlink: Remove misleading internal_flags from health reporter dump Date: Mon, 24 Jan 2022 19:45:12 +0100 Message-Id: <20220124184043.346118706@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- net/core/devlink.c | 2 -- 1 file changed, 2 deletions(-) --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -7852,8 +7852,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB82BC4167D for ; Mon, 24 Jan 2022 21:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573646AbiAXVp2 (ORCPT ); Mon, 24 Jan 2022 16:45:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446768AbiAXVJW (ORCPT ); Mon, 24 Jan 2022 16:09: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 08E68C02B87B; Mon, 24 Jan 2022 12:08: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 9D3C960FEA; Mon, 24 Jan 2022 20:08:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92FD2C340E5; Mon, 24 Jan 2022 20:08:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054923; bh=m7+b9VcktRHgCdFUxLCkctlmFH1mbIqL1qYB29VHNVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m791pyJEKT/nvEqPY2/FtDAe867OPv3EhMYshJjNi4lqr6DTKociTRJH7FUJPzlJY F6NbGYqZ5X/L1FWMEh2C05yerr9VVqE2GcrNdaAyKQlWtIzjyVzjNRE4auynDiM+7U XMJ7Sc26FhC1bd6ydRdQPNXNH2TrewgmXTKhwRWM= 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.10 548/563] arm64: dts: qcom: msm8996: drop not documented adreno properties Date: Mon, 24 Jan 2022 19:45:13 +0100 Message-Id: <20220124184043.386258247@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -645,9 +645,6 @@ nvmem-cells =3D <&gpu_speed_bin>; 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 gpu_opp_table: opp-table { From nobody Tue Jun 30 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 456C6C43217 for ; Mon, 24 Jan 2022 20:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384427AbiAXU3n (ORCPT ); Mon, 24 Jan 2022 15:29:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33698 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348836AbiAXUIs (ORCPT ); Mon, 24 Jan 2022 15: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 dfw.source.kernel.org (Postfix) with ESMTPS id AC24F6131F; Mon, 24 Jan 2022 20:08:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93A5AC340E5; Mon, 24 Jan 2022 20:08:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054926; bh=QYooLD2Iy4Ex5XNIjipp54FHDkWtZ0Nl+hc6wluX0oI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sb7bDZvEOJ/CuWmeXwywSTsTcAmvO0G+NyEISXub9Almwv0Bgsruj8N8shpHo8O7f Px8mWQRwTpXcs2hp3FjRvs3ZFElalzGBPjME4CYfGV0CLI0fIl879yifaxT/gPyUPN hoAbLCfrbsbgZO/A8P9QObG1jaQSxfeqyKLHhvbk= 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.10 549/563] net: bonding: fix bond_xmit_broadcast return value error bug Date: Mon, 24 Jan 2022 19:45:14 +0100 Message-Id: <20220124184043.423578112@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -4562,25 +4562,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7AE7C433F5 for ; Mon, 24 Jan 2022 22:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584029AbiAXWT4 (ORCPT ); Mon, 24 Jan 2022 17:19:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447467AbiAXVKy (ORCPT ); Mon, 24 Jan 2022 16:10: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 F0F61C09D306; Mon, 24 Jan 2022 12:08: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 681F1B81215; Mon, 24 Jan 2022 20:08:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93393C340E5; Mon, 24 Jan 2022 20:08:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054929; bh=Or7GSkXzoVtS/Y66OyTISEOtYo4mULGloYLLh4FWCl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sGeR3Ytfz+DXWF+cJgNZSLxAudWBL6nTH5kp3yro5EwCS/eWbefeMP84Fb3/E1ObJ ADe3UW+v2W7slA1uvP7/IUSM2ViS5cdft8gfxaQJ31Unjx8f4DiDu+xgtmGWFUYXNx q29S21r3YAw+ld1GyrHPdx32IE/6r6YJk7nVLEd8= 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.10 550/563] net_sched: restore "mpu xxx" handling Date: Mon, 24 Jan 2022 19:45:15 +0100 Message-Id: <20220124184043.458620209@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1261,6 +1261,7 @@ struct psched_ratecfg { u64 rate_bytes_ps; /* bytes per second */ u32 mult; u16 overhead; + u16 mpu; u8 linklayer; u8 shift; }; @@ -1270,6 +1271,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 @@ -1292,6 +1296,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 @@ -1386,6 +1386,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); r->mult =3D 1; From nobody Tue Jun 30 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 253CAC433F5 for ; Tue, 25 Jan 2022 02:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421918AbiAYC3S (ORCPT ); Mon, 24 Jan 2022 21:29:18 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33768 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353627AbiAXUI7 (ORCPT ); Mon, 24 Jan 2022 15: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 DADF66130A; Mon, 24 Jan 2022 20:08:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EEC9C340E5; Mon, 24 Jan 2022 20:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054935; bh=kIZkiytabEpHce63qKZzZ+US9kAwLMoXJzrChs/Ap1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQKzktTByNWOPGOb4ElohpqpW4gfDnBJRxoko+ucp2phBa5nLVkzaL+WPlxFkN+Qs LWMpr0RLZjvESgIYRkBZnDPgwD9Sil9IISWDM+lOE8CfAQI8RRcn4Vt9kvT+Qlrw47 YojwPbmMHtf+13GWg1TUsRa1gNUvqfM4jFe9OSXs= 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.10 551/563] bcmgenet: add WOL IRQ check Date: Mon, 24 Jan 2022 19:45:16 +0100 Message-Id: <20220124184043.489721539@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -3962,10 +3962,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96A9AC433F5 for ; Tue, 25 Jan 2022 02:36:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421963AbiAYC3e (ORCPT ); Mon, 24 Jan 2022 21:29:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35780 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353840AbiAXUJA (ORCPT ); Mon, 24 Jan 2022 15:09: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 03333612FC; Mon, 24 Jan 2022 20:08:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B912CC340E5; Mon, 24 Jan 2022 20:08:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054938; bh=yrC4/59bDpg4P6F8ntcpYsVINcsebGMtT4MPqprAZJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Adj4hF7SDdLoqL2rEiwuDW9Ptg8Y/BorCexbABjI3O5Hb7zXh4v/ffWppUhZzNV78 a9PEN8wXIV0cfUg0UiVyuTBrOBevbLz3BZJ2HM4IbBWNocKD0oNipANmMOT7JLbNDR wRMTEuLtS3EulaPyDlnAh90BRVN4f0ltB9pawzjw= 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.10 552/563] net: ethernet: mtk_eth_soc: fix error checking in mtk_mac_config() Date: Mon, 24 Jan 2022 19:45:17 +0100 Message-Id: <20220124184043.527136494@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -215,7 +215,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3019AC4332F for ; Mon, 24 Jan 2022 22:24:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381632AbiAXWY3 (ORCPT ); Mon, 24 Jan 2022 17:24:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447543AbiAXVK6 (ORCPT ); Mon, 24 Jan 2022 16:10:58 -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 DB8AFC09D326; Mon, 24 Jan 2022 12:09: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 98B68B8122C; Mon, 24 Jan 2022 20:09:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2782C340E5; Mon, 24 Jan 2022 20:09:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054941; bh=r8GhSghsTWhs/kPYweBGTn+V7itGNTAEK1ngaeBmVa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CzUXSVPVkV6kzN9cwHe9FW41GizXazz4rfaqvLwAY76PTe1R5fig+xoWNrIgZRCTV XM3hpdigPno6om4joDqTAPkPDtJcUug2yJlBynZYTDmVNRmf/oO+bcF72Bg5LRx9gs PzP6zJC3FXPrQz5q6TfX+V2aQPkkgg6m5o5ZYzrk= 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.10 553/563] net: sfp: fix high power modules without diagnostic monitoring Date: Mon, 24 Jan 2022 19:45:18 +0100 Message-Id: <20220124184043.566189264@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -1589,17 +1589,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. @@ -1616,11 +1619,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE3EFC433EF for ; Mon, 24 Jan 2022 22:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583840AbiAXWTh (ORCPT ); Mon, 24 Jan 2022 17:19:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447539AbiAXVK5 (ORCPT ); Mon, 24 Jan 2022 16:10: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 3219CC09D32A; Mon, 24 Jan 2022 12:09: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 CA7D1B8122C; Mon, 24 Jan 2022 20:09:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBA89C340E5; Mon, 24 Jan 2022 20:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054944; bh=Asg+7LepYHNGSHDvbNOVUOCVw+w7ba8PdA/sQW8ZIuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Z1jHidpspH3FYrc3AOg7VfQ4IqayJ+8OOQVilSA63hRaZKVAi2YyBjkVNPgS/4+T met1ag8czJIWef85O6vP/mnkQbzSjmKcekIvnD9qlYP5sbGKT12TTkTuVlvErkC/4S ALFmsf7F3Lzm7mFv13cispONCBE1FKzamr8wENvo= 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.10 554/563] net: mscc: ocelot: fix using match before it is set Date: Mon, 24 Jan 2022 19:45:19 +0100 Message-Id: <20220124184043.599259878@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -462,13 +462,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 @@ -483,6 +476,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83FBCC433F5 for ; Mon, 24 Jan 2022 22:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583736AbiAXWT2 (ORCPT ); Mon, 24 Jan 2022 17:19:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447555AbiAXVK6 (ORCPT ); Mon, 24 Jan 2022 16:10:58 -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 1FE8FC09D335; Mon, 24 Jan 2022 12:09: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 D95A4B8122C; Mon, 24 Jan 2022 20:09:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B730C340E5; Mon, 24 Jan 2022 20:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054947; bh=A61Mjq671YKWOXyCgRwXP22r5uuFJFRpViFWZVpV9aU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x4c4X+hwcDKJKpFB4RJtkTEIGBFS4CQLN5plJyRa6J6Nfp5KAya3lKUzhcgQPaKRd CdLEdIm/Lhh9LtnTibJKC+vfiWmO+FmAK8/JOQXpmdHjRgEUF2EkCO0bK6GB7aezt5 m2If3MseQqWhpGhJrpaPx737SeA2RPuTmvtrqiPk= 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.10 555/563] dt-bindings: display: meson-dw-hdmi: add missing sound-name-prefix property Date: Mon, 24 Jan 2022 19:45:20 +0100 Message-Id: <20220124184043.630517916@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E195C4167D for ; Mon, 24 Jan 2022 22:30:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586757AbiAXW1R (ORCPT ); Mon, 24 Jan 2022 17:27:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447759AbiAXVLZ (ORCPT ); Mon, 24 Jan 2022 16:11: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 72AF4C09D339; Mon, 24 Jan 2022 12:09: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 12DEE611CD; Mon, 24 Jan 2022 20:09:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D896EC340E5; Mon, 24 Jan 2022 20:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054950; bh=Q+kbtrSzN3sW0F+y05oRP18A4WGq9IVLlwKWgshlVIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FsXvZ3alGTP+0jMPAlurJmPPGzBvb660x9X3LYpi5LN7QmqK6MRL1Gmqho78tcQtT XRqnmHWGxP4AcFg0EQUIlqbWp9czMQH9NqOHaE7JQLYMwZWGWJVC3EtmUkqw2uOZwX XEo33MN6M+bIli19mnLLBA1WNe7XXH7DsjHOVYlA= 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.10 556/563] dt-bindings: display: meson-vpu: Add missing amlogic,canvas property Date: Mon, 24 Jan 2022 19:45:21 +0100 Message-Id: <20220124184043.665712880@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E403C4167B for ; Mon, 24 Jan 2022 22:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586735AbiAXW1P (ORCPT ); Mon, 24 Jan 2022 17:27:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447805AbiAXVLa (ORCPT ); Mon, 24 Jan 2022 16:11: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 56669C02B76B; Mon, 24 Jan 2022 12:09: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 E97D96131D; Mon, 24 Jan 2022 20:09:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6D0FC340E5; Mon, 24 Jan 2022 20:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054953; bh=RwgNWwgC6tm4OmIYkTg6If1aFsmpPow52E85Zp5Xwvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bKhf53vHkC4DgXXD0VLZFjQL4jPyhHOCYXF3VrgGE1kQ5xmQv78LPcHaGNMPWT5AX Ki6lSrY/IftItWB0q6b41MfT1/80/aUfoRYGEPL7A0aesh1LZJzNC9h/0eA1oHug39 Xg1IZhOmF50zbbWFV7rr+lnijHXsYwVktZYthVqs= 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.10 557/563] dt-bindings: watchdog: Require samsung,syscon-phandle for Exynos7 Date: Mon, 24 Jan 2022 19:45:22 +0100 Message-Id: <20220124184043.706346737@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78EC8C4332F for ; Tue, 25 Jan 2022 02:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421984AbiAYC3h (ORCPT ); Mon, 24 Jan 2022 21:29:37 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36132 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353904AbiAXUJR (ORCPT ); Mon, 24 Jan 2022 15:09: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 22C266131D; Mon, 24 Jan 2022 20:09:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D26F6C340E7; Mon, 24 Jan 2022 20:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054956; bh=yu+IE5+gItyP4e2FuDlpjTgxMD8d6Lf0tXsdlecCLis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pVO0uHo6LQESZ87fvNf0/m7MXcHpOYI+TVmnpIxLXmrXz+SUZ/8SQC68SdvzXHQIK 4MpMfdIF3G/OG76/Rab7EU7TT8WJG0ey4eceYRerFUEGo49Lzvt71+5PVmmPKAgyHf d9elk8Gzvfm52d9Nk9kUoXvXbRYu6ngF1v451RoA= 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.10 558/563] scripts/dtc: dtx_diff: remove broken example from help text Date: Mon, 24 Jan 2022 19:45:23 +0100 Message-Id: <20220124184043.747104714@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73549C43217 for ; Mon, 24 Jan 2022 22:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586699AbiAXW1M (ORCPT ); Mon, 24 Jan 2022 17:27:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447955AbiAXVLq (ORCPT ); Mon, 24 Jan 2022 16:11: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 B0437C02B773; Mon, 24 Jan 2022 12: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 4FE776133D; Mon, 24 Jan 2022 20:09:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26696C340E5; Mon, 24 Jan 2022 20:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054959; bh=CqvvbWfk9xwC8WTepgsm14BUMfW2AL5e1e4ceJFL41U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iG7hZyjpl/tQhJeoriGCVsJyQZSzgnzT/FWTzOQylrCdyfeWXnqlnqw+orBHku5FG c0MsOfIhIdzKqG8uf7D3biRd9U+FBLxOv118wbR8NH2Fwh8OZc6K5Op2f0KrDk+yBc YD3jOHF8Vj7wolXztzRKbcy9oYgUuc6xC3ramim8= 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.10 559/563] lib82596: Fix IRQ check in sni_82596_probe Date: Mon, 24 Jan 2022 19:45:24 +0100 Message-Id: <20220124184043.788019028@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C08CAC4167B for ; Mon, 24 Jan 2022 20:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384475AbiAXU3v (ORCPT ); Mon, 24 Jan 2022 15:29:51 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36238 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354486AbiAXUJY (ORCPT ); Mon, 24 Jan 2022 15:09: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 A5E5E6091B; Mon, 24 Jan 2022 20:09:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F9B7C340E5; Mon, 24 Jan 2022 20:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054963; bh=8VJ5DOh9GMO1apj0w6QDm4S3TRwOpzb1AAjkoMUZWbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y+Y6pZvUUF4a2IPKoLRyk3jzCbQZhXa22sfMhaCjHGB1kcHQWlZ4dC3HTNpCdtCaM vyuYJMKTnx3zUJT31RtTXq7NwQD3cOZ/Nn5Tvvue7zCq1gN33m98ZkJORUy6ds1zXK jo6IFy3KaKleXuoq4kNWzNS7PJY2BIfnjXaMi9vY= 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.10 560/563] mm/hmm.c: allow VM_MIXEDMAP to work with hmm_range_fault Date: Mon, 24 Jan 2022 19:45:25 +0100 Message-Id: <20220124184043.818421244@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 @@ -965,9 +965,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 @@ -296,7 +296,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); @@ -514,7 +515,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 @@ -1245,6 +1245,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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04D60C433EF for ; Mon, 24 Jan 2022 21:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574132AbiAXVrn (ORCPT ); Mon, 24 Jan 2022 16:47:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377757AbiAXVMv (ORCPT ); Mon, 24 Jan 2022 16:12:51 -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 B83E1C02B778; Mon, 24 Jan 2022 12:09: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 5DB19B8122A; Mon, 24 Jan 2022 20:09:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84AEFC340E5; Mon, 24 Jan 2022 20:09:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054969; bh=MHmC5G+aOd3jIodOwStGtnsuWl6x1s8Ye8y6waVER78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XCD6vIK2Eet5qPPwbEeM0MqCLkidvtXIoxgtQNpUPtP6DlBPXBzcvXlxbjv9g6qTV WjU4Xn3U9q6VhoYy+rFeyWpy3Kr1NSRT3JmT1MBD7OfspeC/QTVEKW/82AqLhxlq7I FfM9AjmnPPZjJbOiTwCwd5VQj7Mf4d5+kMzPPcwU= 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.10 561/563] lib/test_meminit: destroy cache in kmem_cache_alloc_bulk() test Date: Mon, 24 Jan 2022 19:45:26 +0100 Message-Id: <20220124184043.856005308@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- 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 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA165C4332F for ; Mon, 24 Jan 2022 21:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378952AbiAXVsN (ORCPT ); Mon, 24 Jan 2022 16:48:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377749AbiAXVMv (ORCPT ); Mon, 24 Jan 2022 16:12: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 37E3CC02B779; Mon, 24 Jan 2022 12:09: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 C8DDD6131E; Mon, 24 Jan 2022 20:09:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DCFFC340E5; Mon, 24 Jan 2022 20:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054972; bh=o4vXwjtGO5bckZbOzF25uhyLz3mbp8Clz6bUC0ZiGSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2jaBrNmqwKlDDLCXsWwcVJttl2rS05jt9L46XRYOH2oMizawFPXOJ3m0VyKP+uJ5J b6bQZf2KtMcnbxJFT8uurx1/fVkYyVgXO96Q8nJyz/FZ097tKLXU/nTTWO33hTZGom VW57YzDdoEhEyMKxAUVX8s5yY49RLb6wTOgb7RFw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrick Doyle , Richard Weinberger , Yoshio Furuyama , Miquel Raynal , Frieder Schrempf Subject: [PATCH 5.10 562/563] mtd: nand: bbt: Fix corner case in bad block table handling Date: Mon, 24 Jan 2022 19:45:27 +0100 Message-Id: <20220124184043.886778071@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Doyle, Patrick commit fd0d8d85f7230052e638a56d1bfea170c488e6bc upstream. In the unlikely event that both blocks 10 and 11 are marked as bad (on a 32 bit machine), then the process of marking block 10 as bad stomps on cached entry for block 11. There are (of course) other examples. Signed-off-by: Patrick Doyle Reviewed-by: Richard Weinberger Signed-off-by: Yoshio Furuyama [: Fixed the title] Signed-off-by: Miquel Raynal Cc: Frieder Schrempf Link: https://lore.kernel.org/linux-mtd/774a92693f311e7de01e5935e720a179fb1= b2468.1616635406.git.ytc-mb-yfuruyama7@kioxia.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/mtd/nand/bbt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mtd/nand/bbt.c +++ b/drivers/mtd/nand/bbt.c @@ -123,7 +123,7 @@ int nanddev_bbt_set_block_status(struct unsigned int rbits =3D bits_per_block + offs - BITS_PER_LONG; =20 pos[1] &=3D ~GENMASK(rbits - 1, 0); - pos[1] |=3D val >> rbits; + pos[1] |=3D val >> (bits_per_block - rbits); } =20 return 0; From nobody Tue Jun 30 06:16:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97BE5C433EF for ; Mon, 24 Jan 2022 22:18:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229551AbiAXWRz (ORCPT ); Mon, 24 Jan 2022 17:17:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388845AbiAXVM5 (ORCPT ); Mon, 24 Jan 2022 16:12:57 -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 3DF8CC02B5F2; Mon, 24 Jan 2022 12:09: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 D17F66136F; Mon, 24 Jan 2022 20:09:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9D2BC340E7; Mon, 24 Jan 2022 20:09:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054975; bh=+cHD1sv0DCBEaOmQQwWTkSRUl1GaWxvlAts901+cBS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IW6/BbboiNzapHlf4piCYmk0uKAMZ1ELA20KXlNqdKBrNSI5pfaemjzUoiiX7Nt17 qS0980VA/22p281eeDhMJOO/wSWoA7p7enL7YQFYrcpKFPorqXWpHfuLvz2HY0nh4x B5TqliJyyHLQnAMknApmQrByg6lbOHHKsp0Fae1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Kalle Valo Subject: [PATCH 5.10 563/563] ath10k: Fix the MTU size on QCA9377 SDIO Date: Mon, 24 Jan 2022 19:45:28 +0100 Message-Id: <20220124184043.924007897@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 09b8cd69edcf2be04a781e1781e98e52a775c9ad upstream. 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: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Hulk Robot Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath10k/core.c | 19 ++++++++++++++++++- drivers/net/wireless/ath/ath10k/hw.h | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) --- 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 ath .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, }, { @@ -123,6 +124,7 @@ static const struct ath10k_hw_params ath .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, }, { @@ -158,6 +160,7 @@ static const struct ath10k_hw_params ath .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, }, { @@ -187,6 +190,7 @@ static const struct ath10k_hw_params ath .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, }, @@ -222,6 +226,7 @@ static const struct ath10k_hw_params ath .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, }, { @@ -256,6 +261,7 @@ static const struct ath10k_hw_params ath .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, }, { @@ -290,6 +296,7 @@ static const struct ath10k_hw_params ath .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, }, { @@ -327,6 +334,7 @@ static const struct ath10k_hw_params ath .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, }, @@ -368,6 +376,7 @@ static const struct ath10k_hw_params ath .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, }, { @@ -415,6 +424,7 @@ static const struct ath10k_hw_params ath .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, }, { @@ -459,6 +469,7 @@ static const struct ath10k_hw_params ath .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, }, { @@ -493,6 +504,7 @@ static const struct ath10k_hw_params ath .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, }, { @@ -529,6 +541,7 @@ static const struct ath10k_hw_params ath .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, }, { @@ -557,6 +570,7 @@ static const struct ath10k_hw_params ath .ast_skid_limit =3D 0x10, .num_wds_entries =3D 0x20, .uart_pin_workaround =3D true, + .credit_size_workaround =3D true, }, { .id =3D QCA4019_HW_1_0_DEV_VERSION, @@ -597,6 +611,7 @@ static const struct ath10k_hw_params ath .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, }, { @@ -624,6 +639,7 @@ static const struct ath10k_hw_params ath .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, }, }; @@ -697,6 +713,7 @@ static void ath10k_send_suspend_complete =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 @@ -714,7 +731,7 @@ static int ath10k_init_sdio(struct ath10 =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; --- 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