From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3472C433F5 for ; Mon, 10 Oct 2022 07:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231184AbiJJHH6 (ORCPT ); Mon, 10 Oct 2022 03:07:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231673AbiJJHHT (ORCPT ); Mon, 10 Oct 2022 03:07:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 059D258DC8; Mon, 10 Oct 2022 00:05:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C8C2A60E84; Mon, 10 Oct 2022 07:05:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCEC6C433D7; Mon, 10 Oct 2022 07:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385522; bh=PSMXGnsG+3jG0WxZXNAHq0UZqhqCZ0vRVwIh4w1G0Ik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uvHqmLkOdxlNXnbrO6R/7/DuBt7ufDgPy3l0/JHGuMjSOlXHXdyeuSpzmj4a7AyH7 w8n670ZNwDm3NmIeZmctQZvWOpFdQjbtLYoGl/XLd7bO1nyONYTO2BDWf16U1NL7Bj vXuQ8lU+ZOJkaqLrP7JoABY3Z6L6qL2BRDC0A9UA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Andreas Larsson , Kees Cook Subject: [PATCH 5.19 01/48] sparc: Unbreak the build Date: Mon, 10 Oct 2022 09:04:59 +0200 Message-Id: <20221010070333.719441469@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bart Van Assche commit 17006e86a7641fa3c50324cfb602f0e74dac8527 upstream. Fix the following build errors: arch/sparc/mm/srmmu.c: In function =E2=80=98smp_flush_page_for_dma=E2=80=99: arch/sparc/mm/srmmu.c:1639:13: error: cast between incompatible function ty= pes from =E2=80=98void (*)(long unsigned int)=E2=80=99 to =E2=80=98void (*)= (long unsigned int, long unsigned int, long unsigned int, long unsigned = int, long unsigned int)=E2=80=99 [-Werror=3Dcast-function-type] 1639 | xc1((smpfunc_t) local_ops->page_for_dma, page); | ^ arch/sparc/mm/srmmu.c: In function =E2=80=98smp_flush_cache_mm=E2=80=99: arch/sparc/mm/srmmu.c:1662:29: error: cast between incompatible function ty= pes from =E2=80=98void (*)(struct mm_struct *)=E2=80=99 to =E2=80=98void (*= )(long unsigned int, long unsigned int, long unsigned int, long unsigned= int, long unsigned int)=E2=80=99 [-Werror=3Dcast-function-type] 1662 | xc1((smpfunc_t) local_ops->cache_mm, (unsig= ned long) mm); | [ ... ] Compile-tested only. Fixes: 552a23a0e5d0 ("Makefile: Enable -Wcast-function-type") Cc: stable@vger.kernel.org Signed-off-by: Bart Van Assche Tested-by: Andreas Larsson Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220830205854.1918026-1-bvanassche@acm.org Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/sparc/include/asm/smp_32.h | 15 ++++++--------- arch/sparc/kernel/leon_smp.c | 12 +++++++----- arch/sparc/kernel/sun4d_smp.c | 12 +++++++----- arch/sparc/kernel/sun4m_smp.c | 10 ++++++---- arch/sparc/mm/srmmu.c | 29 +++++++++++++---------------- 5 files changed, 39 insertions(+), 39 deletions(-) --- a/arch/sparc/include/asm/smp_32.h +++ b/arch/sparc/include/asm/smp_32.h @@ -33,9 +33,6 @@ extern volatile unsigned long cpu_callin extern cpumask_t smp_commenced_mask; extern struct linux_prom_registers smp_penguin_ctable; =20 -typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long, - unsigned long, unsigned long); - void cpu_panic(void); =20 /* @@ -57,7 +54,7 @@ void smp_bogo(struct seq_file *); void smp_info(struct seq_file *); =20 struct sparc32_ipi_ops { - void (*cross_call)(smpfunc_t func, cpumask_t mask, unsigned long arg1, + void (*cross_call)(void *func, cpumask_t mask, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4); void (*resched)(int cpu); @@ -66,28 +63,28 @@ struct sparc32_ipi_ops { }; extern const struct sparc32_ipi_ops *sparc32_ipi_ops; =20 -static inline void xc0(smpfunc_t func) +static inline void xc0(void *func) { sparc32_ipi_ops->cross_call(func, *cpu_online_mask, 0, 0, 0, 0); } =20 -static inline void xc1(smpfunc_t func, unsigned long arg1) +static inline void xc1(void *func, unsigned long arg1) { sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, 0, 0, 0); } -static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long a= rg2) +static inline void xc2(void *func, unsigned long arg1, unsigned long arg2) { sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, arg2, 0, 0); } =20 -static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long a= rg2, +static inline void xc3(void *func, unsigned long arg1, unsigned long arg2, unsigned long arg3) { sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, arg2, arg3, 0); } =20 -static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long a= rg2, +static inline void xc4(void *func, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4) { sparc32_ipi_ops->cross_call(func, *cpu_online_mask, --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c @@ -359,7 +359,7 @@ void leonsmp_ipi_interrupt(void) } =20 static struct smp_funcall { - smpfunc_t func; + void *func; unsigned long arg1; unsigned long arg2; unsigned long arg3; @@ -372,7 +372,7 @@ static struct smp_funcall { static DEFINE_SPINLOCK(cross_call_lock); =20 /* Cross calls must be serialized, at least currently. */ -static void leon_cross_call(smpfunc_t func, cpumask_t mask, unsigned long = arg1, +static void leon_cross_call(void *func, cpumask_t mask, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4) { @@ -384,7 +384,7 @@ static void leon_cross_call(smpfunc_t fu =20 { /* If you make changes here, make sure gcc generates proper code... */ - register smpfunc_t f asm("i0") =3D func; + register void *f asm("i0") =3D func; register unsigned long a1 asm("i1") =3D arg1; register unsigned long a2 asm("i2") =3D arg2; register unsigned long a3 asm("i3") =3D arg3; @@ -444,11 +444,13 @@ static void leon_cross_call(smpfunc_t fu /* Running cross calls. */ void leon_cross_call_irq(void) { + void (*func)(unsigned long, unsigned long, unsigned long, unsigned long, + unsigned long) =3D ccall_info.func; int i =3D smp_processor_id(); =20 ccall_info.processors_in[i] =3D 1; - ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, - ccall_info.arg4, ccall_info.arg5); + func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, ccall_info.arg4, + ccall_info.arg5); ccall_info.processors_out[i] =3D 1; } =20 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c @@ -268,7 +268,7 @@ static void sun4d_ipi_resched(int cpu) } =20 static struct smp_funcall { - smpfunc_t func; + void *func; unsigned long arg1; unsigned long arg2; unsigned long arg3; @@ -281,7 +281,7 @@ static struct smp_funcall { static DEFINE_SPINLOCK(cross_call_lock); =20 /* Cross calls must be serialized, at least currently. */ -static void sun4d_cross_call(smpfunc_t func, cpumask_t mask, unsigned long= arg1, +static void sun4d_cross_call(void *func, cpumask_t mask, unsigned long arg= 1, unsigned long arg2, unsigned long arg3, unsigned long arg4) { @@ -296,7 +296,7 @@ static void sun4d_cross_call(smpfunc_t f * If you make changes here, make sure * gcc generates proper code... */ - register smpfunc_t f asm("i0") =3D func; + register void *f asm("i0") =3D func; register unsigned long a1 asm("i1") =3D arg1; register unsigned long a2 asm("i2") =3D arg2; register unsigned long a3 asm("i3") =3D arg3; @@ -353,11 +353,13 @@ static void sun4d_cross_call(smpfunc_t f /* Running cross calls. */ void smp4d_cross_call_irq(void) { + void (*func)(unsigned long, unsigned long, unsigned long, unsigned long, + unsigned long) =3D ccall_info.func; int i =3D hard_smp_processor_id(); =20 ccall_info.processors_in[i] =3D 1; - ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, - ccall_info.arg4, ccall_info.arg5); + func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, ccall_info.arg4, + ccall_info.arg5); ccall_info.processors_out[i] =3D 1; } =20 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c @@ -157,7 +157,7 @@ static void sun4m_ipi_mask_one(int cpu) } =20 static struct smp_funcall { - smpfunc_t func; + void *func; unsigned long arg1; unsigned long arg2; unsigned long arg3; @@ -170,7 +170,7 @@ static struct smp_funcall { static DEFINE_SPINLOCK(cross_call_lock); =20 /* Cross calls must be serialized, at least currently. */ -static void sun4m_cross_call(smpfunc_t func, cpumask_t mask, unsigned long= arg1, +static void sun4m_cross_call(void *func, cpumask_t mask, unsigned long arg= 1, unsigned long arg2, unsigned long arg3, unsigned long arg4) { @@ -230,11 +230,13 @@ static void sun4m_cross_call(smpfunc_t f /* Running cross calls. */ void smp4m_cross_call_irq(void) { + void (*func)(unsigned long, unsigned long, unsigned long, unsigned long, + unsigned long) =3D ccall_info.func; int i =3D smp_processor_id(); =20 ccall_info.processors_in[i] =3D 1; - ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, - ccall_info.arg4, ccall_info.arg5); + func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, ccall_info.arg4, + ccall_info.arg5); ccall_info.processors_out[i] =3D 1; } =20 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -1636,19 +1636,19 @@ static void __init get_srmmu_type(void) /* Local cross-calls. */ static void smp_flush_page_for_dma(unsigned long page) { - xc1((smpfunc_t) local_ops->page_for_dma, page); + xc1(local_ops->page_for_dma, page); local_ops->page_for_dma(page); } =20 static void smp_flush_cache_all(void) { - xc0((smpfunc_t) local_ops->cache_all); + xc0(local_ops->cache_all); local_ops->cache_all(); } =20 static void smp_flush_tlb_all(void) { - xc0((smpfunc_t) local_ops->tlb_all); + xc0(local_ops->tlb_all); local_ops->tlb_all(); } =20 @@ -1659,7 +1659,7 @@ static void smp_flush_cache_mm(struct mm cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) - xc1((smpfunc_t) local_ops->cache_mm, (unsigned long) mm); + xc1(local_ops->cache_mm, (unsigned long)mm); local_ops->cache_mm(mm); } } @@ -1671,7 +1671,7 @@ static void smp_flush_tlb_mm(struct mm_s cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) { - xc1((smpfunc_t) local_ops->tlb_mm, (unsigned long) mm); + xc1(local_ops->tlb_mm, (unsigned long)mm); if (atomic_read(&mm->mm_users) =3D=3D 1 && current->active_mm =3D=3D mm) cpumask_copy(mm_cpumask(mm), cpumask_of(smp_processor_id())); @@ -1691,8 +1691,8 @@ static void smp_flush_cache_range(struct cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) - xc3((smpfunc_t) local_ops->cache_range, - (unsigned long) vma, start, end); + xc3(local_ops->cache_range, (unsigned long)vma, start, + end); local_ops->cache_range(vma, start, end); } } @@ -1708,8 +1708,8 @@ static void smp_flush_tlb_range(struct v cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) - xc3((smpfunc_t) local_ops->tlb_range, - (unsigned long) vma, start, end); + xc3(local_ops->tlb_range, (unsigned long)vma, start, + end); local_ops->tlb_range(vma, start, end); } } @@ -1723,8 +1723,7 @@ static void smp_flush_cache_page(struct cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) - xc2((smpfunc_t) local_ops->cache_page, - (unsigned long) vma, page); + xc2(local_ops->cache_page, (unsigned long)vma, page); local_ops->cache_page(vma, page); } } @@ -1738,8 +1737,7 @@ static void smp_flush_tlb_page(struct vm cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) - xc2((smpfunc_t) local_ops->tlb_page, - (unsigned long) vma, page); + xc2(local_ops->tlb_page, (unsigned long)vma, page); local_ops->tlb_page(vma, page); } } @@ -1753,7 +1751,7 @@ static void smp_flush_page_to_ram(unsign * XXX This experiment failed, research further... -DaveM */ #if 1 - xc1((smpfunc_t) local_ops->page_to_ram, page); + xc1(local_ops->page_to_ram, page); #endif local_ops->page_to_ram(page); } @@ -1764,8 +1762,7 @@ static void smp_flush_sig_insns(struct m cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) - xc2((smpfunc_t) local_ops->sig_insns, - (unsigned long) mm, insn_addr); + xc2(local_ops->sig_insns, (unsigned long)mm, insn_addr); local_ops->sig_insns(mm, insn_addr); } =20 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBE35C433FE for ; Mon, 10 Oct 2022 07:09:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231757AbiJJHJB (ORCPT ); Mon, 10 Oct 2022 03:09:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231515AbiJJHIC (ORCPT ); Mon, 10 Oct 2022 03:08:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FBAB5A88A; Mon, 10 Oct 2022 00:05:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E10160E9C; Mon, 10 Oct 2022 07:05:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D12BC433C1; Mon, 10 Oct 2022 07:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385550; bh=RvjgJAhyg8E/dp2oLUOROEysliEiQvWw4EMWn9vt4tI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U5IG02EbA0jqwsd20gVIkbxOFXSJmWwP8M2Q93NdUnows46Kw+jrmzRA9WwGhNiH6 U0+G2DKVQC6ZNjzD2q+wP1B8f8BcpbGvONxHpPgBkE6T3ZBel5Y92BCn/JhzIZuCVT 7DtCHljRoKcU789bakwoRwbhMB7Pr4wrBVK3RzXA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Sami Tolvanen , Kees Cook Subject: [PATCH 5.19 02/48] Makefile.extrawarn: Move -Wcast-function-type-strict to W=1 Date: Mon, 10 Oct 2022 09:05:00 +0200 Message-Id: <20221010070333.750059897@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sami Tolvanen commit 2120635108b35ecad9c59c8b44f6cbdf4f98214e upstream. We enable -Wcast-function-type globally in the kernel to warn about mismatching types in function pointer casts. Compilers currently warn only about ABI incompability with this flag, but Clang 16 will enable a stricter version of the check by default that checks for an exact type match. This will be very noisy in the kernel, so disable -Wcast-function-type-strict without W=3D1 until the new warnings have been addressed. Cc: stable@vger.kernel.org Link: https://reviews.llvm.org/D134831 Link: https://github.com/ClangBuiltLinux/linux/issues/1724 Suggested-by: Nathan Chancellor Signed-off-by: Sami Tolvanen Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220930203310.4010564-1-samitolvanen@googl= e.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- scripts/Makefile.extrawarn | 1 + 1 file changed, 1 insertion(+) --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -53,6 +53,7 @@ KBUILD_CFLAGS +=3D -Wno-format-zero-length KBUILD_CFLAGS +=3D $(call cc-disable-warning, pointer-to-enum-cast) KBUILD_CFLAGS +=3D -Wno-tautological-constant-out-of-range-compare KBUILD_CFLAGS +=3D $(call cc-disable-warning, unaligned-access) +KBUILD_CFLAGS +=3D $(call cc-disable-warning, cast-function-type-strict) endif =20 endif From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7251C433F5 for ; Mon, 10 Oct 2022 07:10:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230461AbiJJHKn (ORCPT ); Mon, 10 Oct 2022 03:10:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231789AbiJJHJn (ORCPT ); Mon, 10 Oct 2022 03:09:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 606A65AA27; Mon, 10 Oct 2022 00:06:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7534F60E74; Mon, 10 Oct 2022 07:06:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D7DFC433C1; Mon, 10 Oct 2022 07:06:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385573; bh=6Hc5bx5GFEZjGF07ymlLvZqUuiQjA3jUBwJkJeUbZF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=slhjoD/ysicAWx5J7YWsCuEcTtcGRGqJg4Rkg5EQlRdMTb548K2qmbK88QdZKoX77 7lNrx0OqhkiFOGZEZMl1tT4oDMDk4g3ZTZ5wWrj5N1hsWCvx2KsyWiUVll53zVzqQA IuA8K+ky9YWmHFZRoKe5j5PlXQc5trjAmfYeGWk4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Masahiro Yamada , Nick Desaulniers , linux-kbuild@vger.kernel.org, llvm@lists.linux.dev, Kees Cook Subject: [PATCH 5.19 03/48] hardening: Remove Clangs enable flag for -ftrivial-auto-var-init=zero Date: Mon, 10 Oct 2022 09:05:01 +0200 Message-Id: <20221010070333.780586109@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kees Cook commit 607e57c6c62c00965ae276902c166834ce73014a upstream. Now that Clang's -enable-trivial-auto-var-init-zero-knowing-it-will-be-remo= ved-from-clang option is no longer required, remove it from the command line. Clang 16 and later will warn when it is used, which will cause Kconfig to think it can't use -ftrivial-auto-var-init=3Dzero at all. Check for whether it is required and only use it when so. Cc: Nathan Chancellor Cc: Masahiro Yamada Cc: Nick Desaulniers Cc: linux-kbuild@vger.kernel.org Cc: llvm@lists.linux.dev Cc: stable@vger.kernel.org Fixes: f02003c860d9 ("hardening: Avoid harmless Clang option under CONFIG_I= NIT_STACK_ALL_ZERO") Signed-off-by: Kees Cook Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Makefile | 4 ++-- security/Kconfig.hardening | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) --- a/Makefile +++ b/Makefile @@ -830,8 +830,8 @@ endif # Initialize all stack variables with a zero value. ifdef CONFIG_INIT_STACK_ALL_ZERO KBUILD_CFLAGS +=3D -ftrivial-auto-var-init=3Dzero -ifdef CONFIG_CC_IS_CLANG -# https://bugs.llvm.org/show_bug.cgi?id=3D45497 +ifdef CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER +# https://github.com/llvm/llvm-project/issues/44842 KBUILD_CFLAGS +=3D -enable-trivial-auto-var-init-zero-knowing-it-will-be-r= emoved-from-clang endif endif --- a/security/Kconfig.hardening +++ b/security/Kconfig.hardening @@ -22,11 +22,17 @@ menu "Memory initialization" config CC_HAS_AUTO_VAR_INIT_PATTERN def_bool $(cc-option,-ftrivial-auto-var-init=3Dpattern) =20 -config CC_HAS_AUTO_VAR_INIT_ZERO - # GCC ignores the -enable flag, so we can test for the feature with - # a single invocation using the flag, but drop it as appropriate in - # the Makefile, depending on the presence of Clang. +config CC_HAS_AUTO_VAR_INIT_ZERO_BARE + def_bool $(cc-option,-ftrivial-auto-var-init=3Dzero) + +config CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER + # Clang 16 and later warn about using the -enable flag, but it + # is required before then. def_bool $(cc-option,-ftrivial-auto-var-init=3Dzero -enable-trivial-auto-= var-init-zero-knowing-it-will-be-removed-from-clang) + depends on !CC_HAS_AUTO_VAR_INIT_ZERO_BARE + +config CC_HAS_AUTO_VAR_INIT_ZERO + def_bool CC_HAS_AUTO_VAR_INIT_ZERO_BARE || CC_HAS_AUTO_VAR_INIT_ZERO_ENAB= LER =20 choice prompt "Initialize kernel stack variables at function entry" From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 351BDC4332F for ; Mon, 10 Oct 2022 07:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231834AbiJJHKc (ORCPT ); Mon, 10 Oct 2022 03:10:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231787AbiJJHJm (ORCPT ); Mon, 10 Oct 2022 03:09:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2A135AA1B; Mon, 10 Oct 2022 00:06:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AF6B7B80E28; Mon, 10 Oct 2022 07:06:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21BD3C433D7; Mon, 10 Oct 2022 07:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385576; bh=7a+WTDLovQeSm3K4+3q8ZCqpy2ODJ1EzuBZHDte6j3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EYpqd0whFwcd1py+589OmwLBxkGb43PY8cOmb7DIlOFjhO2eTimcXBeULaAhjBiLQ 3jJME4O7Q1/0lMMYasAFSQlD+XzzrZ75rDV9618jelTljFrJoYg4fDUaqjvXiGnV1O Lg9Ayb+hd2rxkUCb8X6Hi8xx5ocxBF6R6ylqvrto= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan , Jonathan Corbet Subject: [PATCH 5.19 04/48] docs: update mediator information in CoC docs Date: Mon, 10 Oct 2022 09:05:02 +0200 Message-Id: <20221010070333.808349023@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shuah Khan commit 8bfdfa0d6b929ede7b6189e0e546ceb6a124d05d upstream. Update mediator information in the CoC interpretation document. Signed-off-by: Shuah Khan Link: https://lore.kernel.org/r/20220901212319.56644-1-skhan@linuxfoundatio= n.org Cc: stable@vger.kernel.org Signed-off-by: Jonathan Corbet Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Documentation/process/code-of-conduct-interpretation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/Documentation/process/code-of-conduct-interpretation.rst +++ b/Documentation/process/code-of-conduct-interpretation.rst @@ -51,7 +51,7 @@ the Technical Advisory Board (TAB) or ot uncertain how to handle situations that come up. It will not be considered a violation report unless you want it to be. If you are uncertain about approaching the TAB or any other maintainers, please -reach out to our conflict mediator, Mishi Choudhary . +reach out to our conflict mediator, Joanna Lee . =20 In the end, "be kind to each other" is really what the end goal is for everybody. We know everyone is human and we all fail at times, but the From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE219C433FE for ; Mon, 10 Oct 2022 07:11:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231727AbiJJHLF (ORCPT ); Mon, 10 Oct 2022 03:11:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231740AbiJJHKG (ORCPT ); Mon, 10 Oct 2022 03:10:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B26FD5C958; Mon, 10 Oct 2022 00:06:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 49DF7B80E4B; Mon, 10 Oct 2022 07:06:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADE72C433D6; Mon, 10 Oct 2022 07:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385579; bh=f94DCNX4UHvjZxe2Cai+3T2g9SQvoyn8eJH+k4mLwSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cZUnQ1Y+LCCEgaR0amw+fxO4875VAkwCgaVIGbZf49elGT1jZfb/NrTrVVkj0PUb6 Z6OLtX+FceJjItyVZMHb5lOLnXvnNPllaE31O4pddThg1DvmNuBPW3ABGzItOp6dwV drfcTIJVdLBE+WrcuUF9z0UchglUYdJS9zXA7F48= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jalal Mostafa , Daniel Borkmann , Magnus Karlsson Subject: [PATCH 5.19 05/48] xsk: Inherit need_wakeup flag for shared sockets Date: Mon, 10 Oct 2022 09:05:03 +0200 Message-Id: <20221010070333.834147224@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jalal Mostafa commit 60240bc26114543fcbfcd8a28466e67e77b20388 upstream. The flag for need_wakeup is not set for xsks with `XDP_SHARED_UMEM` flag and of different queue ids and/or devices. They should inherit the flag from the first socket buffer pool since no flags can be specified once `XDP_SHARED_UMEM` is specified. Fixes: b5aea28dca134 ("xsk: Add shared umem support between queue ids") Signed-off-by: Jalal Mostafa Signed-off-by: Daniel Borkmann Acked-by: Magnus Karlsson Link: https://lore.kernel.org/bpf/20220921135701.10199-1-jalal.a.mostapha@g= mail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/xsk_buff_pool.h | 2 +- net/xdp/xsk.c | 4 ++-- net/xdp/xsk_buff_pool.c | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) --- a/include/net/xsk_buff_pool.h +++ b/include/net/xsk_buff_pool.h @@ -95,7 +95,7 @@ struct xsk_buff_pool *xp_create_and_assi struct xdp_umem *umem); int xp_assign_dev(struct xsk_buff_pool *pool, struct net_device *dev, u16 queue_id, u16 flags); -int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_umem *umem, +int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_sock *umem= _xs, struct net_device *dev, u16 queue_id); int xp_alloc_tx_descs(struct xsk_buff_pool *pool, struct xdp_sock *xs); void xp_destroy(struct xsk_buff_pool *pool); --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -951,8 +951,8 @@ static int xsk_bind(struct socket *sock, goto out_unlock; } =20 - err =3D xp_assign_dev_shared(xs->pool, umem_xs->umem, - dev, qid); + err =3D xp_assign_dev_shared(xs->pool, umem_xs, dev, + qid); if (err) { xp_destroy(xs->pool); xs->pool =3D NULL; --- a/net/xdp/xsk_buff_pool.c +++ b/net/xdp/xsk_buff_pool.c @@ -212,17 +212,18 @@ err_unreg_pool: return err; } =20 -int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_umem *umem, +int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_sock *umem= _xs, struct net_device *dev, u16 queue_id) { u16 flags; + struct xdp_umem *umem =3D umem_xs->umem; =20 /* One fill and completion ring required for each queue id. */ if (!pool->fq || !pool->cq) return -EINVAL; =20 flags =3D umem->zc ? XDP_ZEROCOPY : XDP_COPY; - if (pool->uses_need_wakeup) + if (umem_xs->pool->uses_need_wakeup) flags |=3D XDP_USE_NEED_WAKEUP; =20 return xp_assign_dev(pool, dev, queue_id, flags); From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B9D6C433F5 for ; Mon, 10 Oct 2022 07:10:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231716AbiJJHKr (ORCPT ); Mon, 10 Oct 2022 03:10:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231442AbiJJHJs (ORCPT ); Mon, 10 Oct 2022 03:09:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39E665C96A; Mon, 10 Oct 2022 00:06:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E1325B80E58; Mon, 10 Oct 2022 07:06:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58C57C433D6; Mon, 10 Oct 2022 07:06:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385581; bh=feenKvIhVopHHjhB8QNrUzjs27v0cHhImYaXhQXqF20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p3/yL8pKzBvvywXyLeIqwnft6HqeCypoinrfP4qfhgUoyMnpo089weap/U4IfB5fO TGIIowEJlg0tL/sQX7bt9V4uOox66dSL0+ZVIbJ0Qae0EvOm8fe0l8lMG3+XqBZo+9 Kt+lZsIGi1Q6fHrtdiJDtiWPX9vggA5AKASg9l9Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Will Deacon , Linus Torvalds Subject: [PATCH 5.19 06/48] wait_on_bit: add an acquire memory barrier Date: Mon, 10 Oct 2022 09:05:04 +0200 Message-Id: <20221010070333.864041551@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka commit 8238b4579866b7c1bb99883cfe102a43db5506ff upstream. There are several places in the kernel where wait_on_bit is not followed by a memory barrier (for example, in drivers/md/dm-bufio.c:new_read). On architectures with weak memory ordering, it may happen that memory accesses that follow wait_on_bit are reordered before wait_on_bit and they may return invalid data. Fix this class of bugs by introducing a new function "test_bit_acquire" that works like test_bit, but has acquire memory ordering semantics. Signed-off-by: Mikulas Patocka Acked-by: Will Deacon Cc: stable@vger.kernel.org Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/include/asm/bitops.h | 21 ++++++++++++++= +++++ include/asm-generic/bitops/instrumented-non-atomic.h | 12 ++++++++++ include/asm-generic/bitops/non-atomic.h | 14 ++++++++++++ include/linux/buffer_head.h | 2 - include/linux/wait_bit.h | 8 +++---- kernel/sched/wait_bit.c | 2 - 6 files changed, 53 insertions(+), 6 deletions(-) --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h @@ -207,6 +207,20 @@ static __always_inline bool constant_tes (addr[nr >> _BITOPS_LONG_SHIFT])) !=3D 0; } =20 +static __always_inline bool constant_test_bit_acquire(long nr, const volat= ile unsigned long *addr) +{ + bool oldbit; + + asm volatile("testb %2,%1" + CC_SET(nz) + : CC_OUT(nz) (oldbit) + : "m" (((unsigned char *)addr)[nr >> 3]), + "i" (1 << (nr & 7)) + :"memory"); + + return oldbit; +} + static __always_inline bool variable_test_bit(long nr, volatile const unsi= gned long *addr) { bool oldbit; @@ -224,6 +238,13 @@ static __always_inline bool variable_tes ? constant_test_bit((nr), (addr)) \ : variable_test_bit((nr), (addr))) =20 +static __always_inline bool +arch_test_bit_acquire(unsigned long nr, const volatile unsigned long *addr) +{ + return __builtin_constant_p(nr) ? constant_test_bit_acquire(nr, addr) : + variable_test_bit(nr, addr); +} + /** * __ffs - find first set bit in word * @word: The word to search --- a/include/asm-generic/bitops/instrumented-non-atomic.h +++ b/include/asm-generic/bitops/instrumented-non-atomic.h @@ -135,4 +135,16 @@ static __always_inline bool test_bit(lon return arch_test_bit(nr, addr); } =20 +/** + * _test_bit_acquire - Determine, with acquire semantics, whether a bit is= set + * @nr: bit number to test + * @addr: Address to start counting from + */ +static __always_inline bool +test_bit_acquire(unsigned long nr, const volatile unsigned long *addr) +{ + instrument_atomic_read(addr + BIT_WORD(nr), sizeof(long)); + return arch_test_bit_acquire(nr, addr); +} + #endif /* _ASM_GENERIC_BITOPS_INSTRUMENTED_NON_ATOMIC_H */ --- a/include/asm-generic/bitops/non-atomic.h +++ b/include/asm-generic/bitops/non-atomic.h @@ -3,6 +3,7 @@ #define _ASM_GENERIC_BITOPS_NON_ATOMIC_H_ =20 #include +#include =20 /** * arch___set_bit - Set a bit in memory @@ -119,4 +120,17 @@ arch_test_bit(unsigned int nr, const vol } #define test_bit arch_test_bit =20 +/** + * arch_test_bit_acquire - Determine, with acquire semantics, whether a bi= t is set + * @nr: bit number to test + * @addr: Address to start counting from + */ +static __always_inline bool +arch_test_bit_acquire(unsigned long nr, const volatile unsigned long *addr) +{ + unsigned long *p =3D ((unsigned long *)addr) + BIT_WORD(nr); + return 1UL & (smp_load_acquire(p) >> (nr & (BITS_PER_LONG-1))); +} +#define test_bit_acquire arch_test_bit_acquire + #endif /* _ASM_GENERIC_BITOPS_NON_ATOMIC_H_ */ --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -166,7 +166,7 @@ static __always_inline int buffer_uptoda * make it consistent with folio_test_uptodate * pairs with smp_mb__before_atomic in set_buffer_uptodate */ - return (smp_load_acquire(&bh->b_state) & (1UL << BH_Uptodate)) !=3D 0; + return test_bit_acquire(BH_Uptodate, &bh->b_state); } =20 #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) --- a/include/linux/wait_bit.h +++ b/include/linux/wait_bit.h @@ -71,7 +71,7 @@ static inline int wait_on_bit(unsigned long *word, int bit, unsigned mode) { might_sleep(); - if (!test_bit(bit, word)) + if (!test_bit_acquire(bit, word)) return 0; return out_of_line_wait_on_bit(word, bit, bit_wait, @@ -96,7 +96,7 @@ static inline int wait_on_bit_io(unsigned long *word, int bit, unsigned mode) { might_sleep(); - if (!test_bit(bit, word)) + if (!test_bit_acquire(bit, word)) return 0; return out_of_line_wait_on_bit(word, bit, bit_wait_io, @@ -123,7 +123,7 @@ wait_on_bit_timeout(unsigned long *word, unsigned long timeout) { might_sleep(); - if (!test_bit(bit, word)) + if (!test_bit_acquire(bit, word)) return 0; return out_of_line_wait_on_bit_timeout(word, bit, bit_wait_timeout, @@ -151,7 +151,7 @@ wait_on_bit_action(unsigned long *word, unsigned mode) { might_sleep(); - if (!test_bit(bit, word)) + if (!test_bit_acquire(bit, word)) return 0; return out_of_line_wait_on_bit(word, bit, action, mode); } --- a/kernel/sched/wait_bit.c +++ b/kernel/sched/wait_bit.c @@ -47,7 +47,7 @@ __wait_on_bit(struct wait_queue_head *wq prepare_to_wait(wq_head, &wbq_entry->wq_entry, mode); if (test_bit(wbq_entry->key.bit_nr, wbq_entry->key.flags)) ret =3D (*action)(&wbq_entry->key, mode); - } while (test_bit(wbq_entry->key.bit_nr, wbq_entry->key.flags) && !ret); + } while (test_bit_acquire(wbq_entry->key.bit_nr, wbq_entry->key.flags) &&= !ret); =20 finish_wait(wq_head, &wbq_entry->wq_entry); From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF8CAC43217 for ; Mon, 10 Oct 2022 07:12:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231855AbiJJHMi (ORCPT ); Mon, 10 Oct 2022 03:12:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231789AbiJJHLY (ORCPT ); Mon, 10 Oct 2022 03:11:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 074265E30D; Mon, 10 Oct 2022 00:06:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E122F60E55; Mon, 10 Oct 2022 07:06:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01EBDC433D6; Mon, 10 Oct 2022 07:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385584; bh=IL/d8xPFJDTPLYkDrOpJX95Dqn7qSOWOI6FKgv976lM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hMrvNC1ISusmDZ7EO2Rgw8WPPrJqqE16ggedJG/N40bgP9jww9IcsCJ01PUJDkzap eiCJ+5tMWwndaC+dxS+E6lwQa42l2ZgyYBCJ6c9qjcsJspNaBCFVStXp4bQ3+FMrHR ds+XIw0N8BO4NQEJODDhB6l1T/wJRynjN2ZfqPnU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Linus Torvalds Subject: [PATCH 5.19 07/48] provide arch_test_bit_acquire for architectures that define test_bit Date: Mon, 10 Oct 2022 09:05:05 +0200 Message-Id: <20221010070333.890399278@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka commit d6ffe6067a54972564552ea45d320fb98db1ac5e upstream. Some architectures define their own arch_test_bit and they also need arch_test_bit_acquire, otherwise they won't compile. We also clean up the code by using the generic test_bit if that is equivalent to the arch-specific version. Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Fixes: 8238b4579866 ("wait_on_bit: add an acquire memory barrier") Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/alpha/include/asm/bitops.h | 7 +++++++ arch/hexagon/include/asm/bitops.h | 15 +++++++++++++++ arch/ia64/include/asm/bitops.h | 7 +++++++ arch/m68k/include/asm/bitops.h | 6 ++++++ arch/s390/include/asm/bitops.h | 7 +++++++ arch/sh/include/asm/bitops-op32.h | 7 +++++++ 6 files changed, 49 insertions(+) --- a/arch/alpha/include/asm/bitops.h +++ b/arch/alpha/include/asm/bitops.h @@ -289,6 +289,13 @@ test_bit(int nr, const volatile void * a return (1UL & (((const int *) addr)[nr >> 5] >> (nr & 31))) !=3D 0UL; } =20 +static __always_inline bool +test_bit_acquire(unsigned long nr, const volatile unsigned long *addr) +{ + unsigned long *p =3D ((unsigned long *)addr) + BIT_WORD(nr); + return 1UL & (smp_load_acquire(p) >> (nr & (BITS_PER_LONG-1))); +} + /* * ffz =3D Find First Zero in word. Undefined if no zero exists, * so code should check against ~0UL first.. --- a/arch/hexagon/include/asm/bitops.h +++ b/arch/hexagon/include/asm/bitops.h @@ -172,7 +172,22 @@ static inline int __test_bit(int nr, con return retval; } =20 +static inline int __test_bit_acquire(int nr, const volatile unsigned long = *addr) +{ + int retval; + + asm volatile( + "{P0 =3D tstbit(%1,%2); if (P0.new) %0 =3D #1; if (!P0.new) %0 =3D #0;}\n" + : "=3D&r" (retval) + : "r" (addr[BIT_WORD(nr)]), "r" (nr % BITS_PER_LONG) + : "p0", "memory" + ); + + return retval; +} + #define test_bit(nr, addr) __test_bit(nr, addr) +#define test_bit_acquire(nr, addr) __test_bit_acquire(nr, addr) =20 /* * ffz - find first zero in word. --- a/arch/ia64/include/asm/bitops.h +++ b/arch/ia64/include/asm/bitops.h @@ -337,6 +337,13 @@ test_bit (int nr, const volatile void *a return 1 & (((const volatile __u32 *) addr)[nr >> 5] >> (nr & 31)); } =20 +static __always_inline bool +test_bit_acquire(unsigned long nr, const volatile unsigned long *addr) +{ + unsigned long *p =3D ((unsigned long *)addr) + BIT_WORD(nr); + return 1UL & (smp_load_acquire(p) >> (nr & (BITS_PER_LONG-1))); +} + /** * ffz - find the first zero bit in a long word * @x: The long word to find the bit in --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -153,6 +153,12 @@ static inline int test_bit(int nr, const return (vaddr[nr >> 5] & (1UL << (nr & 31))) !=3D 0; } =20 +static __always_inline bool +test_bit_acquire(unsigned long nr, const volatile unsigned long *addr) +{ + unsigned long *p =3D ((unsigned long *)addr) + BIT_WORD(nr); + return 1UL & (smp_load_acquire(p) >> (nr & (BITS_PER_LONG-1))); +} =20 static inline int bset_reg_test_and_set_bit(int nr, volatile unsigned long *vaddr) --- a/arch/s390/include/asm/bitops.h +++ b/arch/s390/include/asm/bitops.h @@ -184,6 +184,13 @@ static inline bool arch_test_bit(unsigne return *addr & mask; } =20 +static __always_inline bool +arch_test_bit_acquire(unsigned long nr, const volatile unsigned long *addr) +{ + unsigned long *p =3D ((unsigned long *)addr) + BIT_WORD(nr); + return 1UL & (smp_load_acquire(p) >> (nr & (BITS_PER_LONG-1))); +} + static inline bool arch_test_and_set_bit_lock(unsigned long nr, volatile unsigned long *ptr) { --- a/arch/sh/include/asm/bitops-op32.h +++ b/arch/sh/include/asm/bitops-op32.h @@ -138,4 +138,11 @@ static inline int test_bit(int nr, const return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1))); } =20 +static __always_inline bool +test_bit_acquire(unsigned long nr, const volatile unsigned long *addr) +{ + unsigned long *p =3D ((unsigned long *)addr) + BIT_WORD(nr); + return 1UL & (smp_load_acquire(p) >> (nr & (BITS_PER_LONG-1))); +} + #endif /* __ASM_SH_BITOPS_OP32_H */ From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14082C433F5 for ; Mon, 10 Oct 2022 07:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231872AbiJJHKz (ORCPT ); Mon, 10 Oct 2022 03:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231804AbiJJHKB (ORCPT ); Mon, 10 Oct 2022 03:10:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E93AE5C9F3; Mon, 10 Oct 2022 00:06:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2842CB80E5A; Mon, 10 Oct 2022 07:06:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93402C433C1; Mon, 10 Oct 2022 07:06:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385586; bh=HNPPtoQnYBQEA6aJUF+GOhYCaUNi2L9VMOgqLx3VwZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mfmiHjXcXU0o7v9WDg+/gRQRdR1JkbvKdmd4qmDGGGneaaCObFncTK6TIVvdVHKKr H67bZ4AiMSh/UkhyLcKc/9q7QGY51IcMN4qQWiOGpthZrNV1Ics237vps4yWbjEhFu 5NW6pgkzx+CyI81IBbVOw+LclEJEfH65eqy2tKLo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, butt3rflyh4ck , Hao Sun , Jiacheng Xu , "Christian Brauner (Microsoft)" , Dongliang Mu , Al Viro Subject: [PATCH 5.19 08/48] fs: fix UAF/GPF bug in nilfs_mdt_destroy Date: Mon, 10 Oct 2022 09:05:06 +0200 Message-Id: <20221010070333.919705923@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dongliang Mu commit 2e488f13755ffbb60f307e991b27024716a33b29 upstream. In alloc_inode, inode_init_always() could return -ENOMEM if security_inode_alloc() fails, which causes inode->i_private uninitialized. Then nilfs_is_metadata_file_inode() returns true and nilfs_free_inode() wrongly calls nilfs_mdt_destroy(), which frees the uninitialized inode->i_private and leads to crashes(e.g., UAF/GPF). Fix this by moving security_inode_alloc just prior to this_cpu_inc(nr_inodes) Link:=C2=A0https://lkml.kernel.org/r/CAFcO6XOcf1Jj2SeGt=3DjJV59wmhESeSKpfR0= omdFRq+J9nD1vfQ@mail.gmail.com Reported-by: butt3rflyh4ck Reported-by: Hao Sun Reported-by: Jiacheng Xu Reviewed-by: Christian Brauner (Microsoft) Signed-off-by: Dongliang Mu Cc: Al Viro Cc: stable@vger.kernel.org Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/inode.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/fs/inode.c +++ b/fs/inode.c @@ -192,8 +192,6 @@ int inode_init_always(struct super_block inode->i_wb_frn_history =3D 0; #endif =20 - if (security_inode_alloc(inode)) - goto out; spin_lock_init(&inode->i_lock); lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key); =20 @@ -228,11 +226,12 @@ int inode_init_always(struct super_block inode->i_fsnotify_mask =3D 0; #endif inode->i_flctx =3D NULL; + + if (unlikely(security_inode_alloc(inode))) + return -ENOMEM; this_cpu_inc(nr_inodes); =20 return 0; -out: - return -ENOMEM; } EXPORT_SYMBOL(inode_init_always); =20 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43771C433F5 for ; Mon, 10 Oct 2022 07:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231570AbiJJHLO (ORCPT ); Mon, 10 Oct 2022 03:11:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231779AbiJJHKW (ORCPT ); Mon, 10 Oct 2022 03:10:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 180A35C9DA; Mon, 10 Oct 2022 00:06:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0FE6A60E84; Mon, 10 Oct 2022 07:06:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29B68C433C1; Mon, 10 Oct 2022 07:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385589; bh=mf6CQxkQ4rgBoSgPh5/647RqhQi3+mUhudFOdshEm1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nfnpXiAyfkJueFuCkhBNBViv4bqEUa3t/2YaQXa/RiZBqRKk4GVvgAF8NwLAlcpHr mUfI4fQQ6TcoC56Bj1fKmKKLDkZ1ogq0QxoHT0lA6k3rJ/9dWYQLHVaaHX5+yWeWyd brZ7g58ASjsw8Spaz5SZtz5PEO3VesqgYYREJwag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cristian Marussi , Sudeep Holla , Sasha Levin Subject: [PATCH 5.19 09/48] firmware: arm_scmi: Improve checks in the info_get operations Date: Mon, 10 Oct 2022 09:05:07 +0200 Message-Id: <20221010070333.947553398@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cristian Marussi [ Upstream commit 1ecb7d27b1af6705e9a4e94415b4d8cc8cf2fbfb ] SCMI protocols abstract and expose a number of protocol specific resources like clocks, sensors and so on. Information about such specific domain resources are generally exposed via an `info_get` protocol operation. Improve the sanity check on these operations where needed. Link: https://lore.kernel.org/r/20220817172731.1185305-3-cristian.marussi@a= rm.com Signed-off-by: Cristian Marussi Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/firmware/arm_scmi/clock.c | 6 +++++- drivers/firmware/arm_scmi/sensors.c | 3 +++ include/linux/scmi_protocol.h | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/= clock.c index 3ed7ae0d6781..96060bf90a24 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -450,9 +450,13 @@ static int scmi_clock_count_get(const struct scmi_prot= ocol_handle *ph) static const struct scmi_clock_info * scmi_clock_info_get(const struct scmi_protocol_handle *ph, u32 clk_id) { + struct scmi_clock_info *clk; struct clock_info *ci =3D ph->get_priv(ph); - struct scmi_clock_info *clk =3D ci->clk + clk_id; =20 + if (clk_id >=3D ci->num_clocks) + return NULL; + + clk =3D ci->clk + clk_id; if (!clk->name[0]) return NULL; =20 diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scm= i/sensors.c index 7288c6117838..7d0c7476d206 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -948,6 +948,9 @@ scmi_sensor_info_get(const struct scmi_protocol_handle = *ph, u32 sensor_id) { struct sensors_info *si =3D ph->get_priv(ph); =20 + if (sensor_id >=3D si->num_sensors) + return NULL; + return si->sensors + sensor_id; } =20 diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 704111f63993..6dd50ac82d10 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -78,7 +78,7 @@ struct scmi_protocol_handle; struct scmi_clk_proto_ops { int (*count_get)(const struct scmi_protocol_handle *ph); =20 - const struct scmi_clock_info *(*info_get) + const struct scmi_clock_info __must_check *(*info_get) (const struct scmi_protocol_handle *ph, u32 clk_id); int (*rate_get)(const struct scmi_protocol_handle *ph, u32 clk_id, u64 *rate); @@ -460,7 +460,7 @@ enum scmi_sensor_class { */ struct scmi_sensor_proto_ops { int (*count_get)(const struct scmi_protocol_handle *ph); - const struct scmi_sensor_info *(*info_get) + const struct scmi_sensor_info __must_check *(*info_get) (const struct scmi_protocol_handle *ph, u32 sensor_id); int (*trip_point_config)(const struct scmi_protocol_handle *ph, u32 sensor_id, u8 trip_id, u64 trip_value); --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6C76C4332F for ; Mon, 10 Oct 2022 07:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231689AbiJJHH4 (ORCPT ); Mon, 10 Oct 2022 03:07:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231211AbiJJHHR (ORCPT ); Mon, 10 Oct 2022 03:07:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A76A58DF3; Mon, 10 Oct 2022 00:05:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4A15E60E33; Mon, 10 Oct 2022 07:05:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6456EC433D6; Mon, 10 Oct 2022 07:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385524; bh=Y2fNWVU4u1YcgAEFzh7WPVooORDKbcUr/iS2UcbjxWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYMw4IfU7zBBlQTN20PeqKYlWRnBGjGL+E2KxeduVinlEkX/+xqE0AlyJ+UChi16d 363ZCNXIpL8iLpAOk+QKTiDx4wJhTWZU3+DlxDcmvHF46bSG9aiAhmg7eMVU7XzCwx Qd2cTtcO6cn7m4IbNcQDgjxFe7xsPFDjL/Ujk+s8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cristian Marussi , Sudeep Holla , Sasha Levin Subject: [PATCH 5.19 10/48] firmware: arm_scmi: Harden accesses to the sensor domains Date: Mon, 10 Oct 2022 09:05:08 +0200 Message-Id: <20221010070333.973389550@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cristian Marussi [ Upstream commit 76f89c954788763db575fb512a40bd483864f1e9 ] Accessing sensor domains descriptors by the index upon the SCMI drivers requests through the SCMI sensor operations interface can potentially lead to out-of-bound violations if the SCMI driver misbehave. Add an internal consistency check before any such domains descriptors accesses. Link: https://lore.kernel.org/r/20220817172731.1185305-4-cristian.marussi@a= rm.com Signed-off-by: Cristian Marussi Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/firmware/arm_scmi/sensors.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scm= i/sensors.c index 7d0c7476d206..0b5853fa9d87 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -762,6 +762,10 @@ static int scmi_sensor_config_get(const struct scmi_pr= otocol_handle *ph, { int ret; struct scmi_xfer *t; + struct sensors_info *si =3D ph->get_priv(ph); + + if (sensor_id >=3D si->num_sensors) + return -EINVAL; =20 ret =3D ph->xops->xfer_get_init(ph, SENSOR_CONFIG_GET, sizeof(__le32), sizeof(__le32), &t); @@ -771,7 +775,6 @@ static int scmi_sensor_config_get(const struct scmi_pro= tocol_handle *ph, put_unaligned_le32(sensor_id, t->tx.buf); ret =3D ph->xops->do_xfer(ph, t); if (!ret) { - struct sensors_info *si =3D ph->get_priv(ph); struct scmi_sensor_info *s =3D si->sensors + sensor_id; =20 *sensor_config =3D get_unaligned_le64(t->rx.buf); @@ -788,6 +791,10 @@ static int scmi_sensor_config_set(const struct scmi_pr= otocol_handle *ph, int ret; struct scmi_xfer *t; struct scmi_msg_sensor_config_set *msg; + struct sensors_info *si =3D ph->get_priv(ph); + + if (sensor_id >=3D si->num_sensors) + return -EINVAL; =20 ret =3D ph->xops->xfer_get_init(ph, SENSOR_CONFIG_SET, sizeof(*msg), 0, &t); @@ -800,7 +807,6 @@ static int scmi_sensor_config_set(const struct scmi_pro= tocol_handle *ph, =20 ret =3D ph->xops->do_xfer(ph, t); if (!ret) { - struct sensors_info *si =3D ph->get_priv(ph); struct scmi_sensor_info *s =3D si->sensors + sensor_id; =20 s->sensor_config =3D sensor_config; @@ -831,8 +837,11 @@ static int scmi_sensor_reading_get(const struct scmi_p= rotocol_handle *ph, int ret; struct scmi_xfer *t; struct scmi_msg_sensor_reading_get *sensor; + struct scmi_sensor_info *s; struct sensors_info *si =3D ph->get_priv(ph); - struct scmi_sensor_info *s =3D si->sensors + sensor_id; + + if (sensor_id >=3D si->num_sensors) + return -EINVAL; =20 ret =3D ph->xops->xfer_get_init(ph, SENSOR_READING_GET, sizeof(*sensor), 0, &t); @@ -841,6 +850,7 @@ static int scmi_sensor_reading_get(const struct scmi_pr= otocol_handle *ph, =20 sensor =3D t->tx.buf; sensor->id =3D cpu_to_le32(sensor_id); + s =3D si->sensors + sensor_id; if (s->async) { sensor->flags =3D cpu_to_le32(SENSOR_READ_ASYNC); ret =3D ph->xops->do_xfer_with_response(ph, t); @@ -895,9 +905,13 @@ scmi_sensor_reading_get_timestamped(const struct scmi_= protocol_handle *ph, int ret; struct scmi_xfer *t; struct scmi_msg_sensor_reading_get *sensor; + struct scmi_sensor_info *s; struct sensors_info *si =3D ph->get_priv(ph); - struct scmi_sensor_info *s =3D si->sensors + sensor_id; =20 + if (sensor_id >=3D si->num_sensors) + return -EINVAL; + + s =3D si->sensors + sensor_id; if (!count || !readings || (!s->num_axis && count > 1) || (s->num_axis && count > s->num_axis)) return -EINVAL; --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BBB1C433F5 for ; Mon, 10 Oct 2022 07:08:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231582AbiJJHIK (ORCPT ); Mon, 10 Oct 2022 03:08:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231623AbiJJHHZ (ORCPT ); Mon, 10 Oct 2022 03:07:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A670B580B9; Mon, 10 Oct 2022 00:05:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9140DB80E57; Mon, 10 Oct 2022 07:05:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0839C433D7; Mon, 10 Oct 2022 07:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385527; bh=kKTfcun+D2/TQmby9X/mcS8O2NICvVceYFEmpFt3mjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aBWjSbBXUlYDuhAFUeKeQ7XJlZX86LFCrmxFv1ZMov+9ZbIMx2cOygRsGB4l9HaT2 BsS2Yhq44Dyru/wm4MEqgm6ZpsnvLEpwi/a+hq1O03u2qyK3YUdOaaXklu7Qr1p8aK QSzDAKHmKrelPOdF/U2DKbf99oeAcuIv1w0cV1tA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cristian Marussi , Sudeep Holla , Sasha Levin Subject: [PATCH 5.19 11/48] firmware: arm_scmi: Add SCMI PM driver remove routine Date: Mon, 10 Oct 2022 09:05:09 +0200 Message-Id: <20221010070333.999300967@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cristian Marussi [ Upstream commit dea796fcab0a219830831c070b8dc367d7e0f708 ] Currently, when removing the SCMI PM driver not all the resources registered with genpd subsystem are properly de-registered. As a side effect of this after a driver unload/load cycle you get a splat with a few warnings like this: | debugfs: Directory 'BIG_CPU0' with parent 'pm_genpd' already present! | debugfs: Directory 'BIG_CPU1' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_CPU0' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_CPU1' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_CPU2' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_CPU3' with parent 'pm_genpd' already present! | debugfs: Directory 'BIG_SSTOP' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_SSTOP' with parent 'pm_genpd' already present! | debugfs: Directory 'DBGSYS' with parent 'pm_genpd' already present! | debugfs: Directory 'GPUTOP' with parent 'pm_genpd' already present! Add a proper scmi_pm_domain_remove callback to the driver in order to take care of all the needed cleanups not handled by devres framework. Link: https://lore.kernel.org/r/20220817172731.1185305-7-cristian.marussi@a= rm.com Signed-off-by: Cristian Marussi Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/firmware/arm_scmi/scmi_pm_domain.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/firmware/arm_scmi/scmi_pm_domain.c b/drivers/firmware/= arm_scmi/scmi_pm_domain.c index d5dee625de78..0e05a79de82d 100644 --- a/drivers/firmware/arm_scmi/scmi_pm_domain.c +++ b/drivers/firmware/arm_scmi/scmi_pm_domain.c @@ -112,9 +112,28 @@ static int scmi_pm_domain_probe(struct scmi_device *sd= ev) scmi_pd_data->domains =3D domains; scmi_pd_data->num_domains =3D num_domains; =20 + dev_set_drvdata(dev, scmi_pd_data); + return of_genpd_add_provider_onecell(np, scmi_pd_data); } =20 +static void scmi_pm_domain_remove(struct scmi_device *sdev) +{ + int i; + struct genpd_onecell_data *scmi_pd_data; + struct device *dev =3D &sdev->dev; + struct device_node *np =3D dev->of_node; + + of_genpd_del_provider(np); + + scmi_pd_data =3D dev_get_drvdata(dev); + for (i =3D 0; i < scmi_pd_data->num_domains; i++) { + if (!scmi_pd_data->domains[i]) + continue; + pm_genpd_remove(scmi_pd_data->domains[i]); + } +} + static const struct scmi_device_id scmi_id_table[] =3D { { SCMI_PROTOCOL_POWER, "genpd" }, { }, @@ -124,6 +143,7 @@ MODULE_DEVICE_TABLE(scmi, scmi_id_table); static struct scmi_driver scmi_power_domain_driver =3D { .name =3D "scmi-power-domain", .probe =3D scmi_pm_domain_probe, + .remove =3D scmi_pm_domain_remove, .id_table =3D scmi_id_table, }; module_scmi_driver(scmi_power_domain_driver); --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 186D4C433FE for ; Mon, 10 Oct 2022 07:08:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231717AbiJJHI3 (ORCPT ); Mon, 10 Oct 2022 03:08:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbiJJHHb (ORCPT ); Mon, 10 Oct 2022 03:07:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A500058B71; Mon, 10 Oct 2022 00:05:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1F17AB80E4D; Mon, 10 Oct 2022 07:05:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D82DC433D6; Mon, 10 Oct 2022 07:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385529; bh=4JCiA5c4NdAx7YY0hwes4pyrpsIJwxT/BMs6N3Jek1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KGZcgiXylaEkLjWoMTov440cJUrFCA5j5mJQhGQfU4b73lGxIlQleKJZPL8asvBsy 4Y32kr8/kilShXteJpxz4h3gVHU8Nw/8ZDMYG2vTVD28yAYWmDcH4KmtLGwCsSdt8/ pGO9OeXSUqaSV5KOFQ3cmToGJQ6POza6DJgF3CLw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Wunderlich , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.19 12/48] arm64: dts: rockchip: fix upper usb port on BPI-R2-Pro Date: Mon, 10 Oct 2022 09:05:10 +0200 Message-Id: <20221010070334.027094907@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Wunderlich [ Upstream commit 388f9f0a7ff84b7890a24499a3a1fea0cad21373 ] - extcon is no more needed in 5.19 - so drop it commit 51a9b2c03dd3 ("phy: rockchip-inno-usb2: Handle ID IRQ") - dr_mode was changed from host to otg in rk356x.dtsi commit bc405bb3eeee ("arm64: dts: rockchip: enable otg/drd operation of usb_host0_xhci in rk356x") change it back on board level as id-pin on r2pro is not connected Signed-off-by: Frank Wunderlich Link: https://lore.kernel.org/r/20220821121929.244112-1-linux@fw-web.de Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts b/arch/arm6= 4/boot/dts/rockchip/rk3568-bpi-r2-pro.dts index 40cf2236c0b6..ca48d9a54939 100644 --- a/arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts +++ b/arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts @@ -558,7 +558,7 @@ &usb_host0_ohci { }; =20 &usb_host0_xhci { - extcon =3D <&usb2phy0>; + dr_mode =3D "host"; status =3D "okay"; }; =20 --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94B8EC433FE for ; Mon, 10 Oct 2022 07:08:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230496AbiJJHIh (ORCPT ); Mon, 10 Oct 2022 03:08:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbiJJHHq (ORCPT ); Mon, 10 Oct 2022 03:07:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 796055A3E1; Mon, 10 Oct 2022 00:05:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B4C0AB80E5A; Mon, 10 Oct 2022 07:05:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 152D3C4314A; Mon, 10 Oct 2022 07:05:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385532; bh=TyREBzyre60IBy24xJfvU5P0XRa2Pc9FiHrPgZyW9FM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RKzm6qg73yNUlIe7gv38UG1EbU54iwolTcGdQewJs770QuPdkUQ+WcRRnZ3z6FZ7K 74v9lma3M3l+bEBEqHW5Y/XlN/umx0FEUMhi7G7QlFoZkUnE1sE3Smtf1zhzAZ/wLB lD+T44cBY7UMkvjantRctTVIt1JhOIUbweT0uf1c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Swati Agarwal , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 13/48] dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling Date: Mon, 10 Oct 2022 09:05:11 +0200 Message-Id: <20221010070334.052955088@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Swati Agarwal [ Upstream commit 91df7751eb890e970afc08f50b8f0fa5ea39e03d ] Add missing cleanup in devm_platform_ioremap_resource(). When probe fails remove dma channel resources and disable clocks in accordance with the order of resources allocated . Signed-off-by: Swati Agarwal Link: https://lore.kernel.org/r/20220817061125.4720-2-swati.agarwal@xilinx.= com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/dma/xilinx/xilinx_dma.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dm= a.c index cd62bbb50e8b..ba0dccaa8cf1 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -3160,9 +3160,10 @@ static int xilinx_dma_probe(struct platform_device *= pdev) =20 /* Request and map I/O memory */ xdev->regs =3D devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(xdev->regs)) - return PTR_ERR(xdev->regs); - + if (IS_ERR(xdev->regs)) { + err =3D PTR_ERR(xdev->regs); + goto disable_clks; + } /* Retrieve the DMA engine properties from the device tree */ xdev->max_buffer_len =3D GENMASK(XILINX_DMA_MAX_TRANS_LEN_MAX - 1, 0); xdev->s2mm_chan_id =3D xdev->dma_config->max_channels / 2; @@ -3259,7 +3260,7 @@ static int xilinx_dma_probe(struct platform_device *p= dev) for_each_child_of_node(node, child) { err =3D xilinx_dma_child_probe(xdev, child); if (err < 0) - goto disable_clks; + goto error; } =20 if (xdev->dma_config->dmatype =3D=3D XDMA_TYPE_VDMA) { @@ -3294,12 +3295,12 @@ static int xilinx_dma_probe(struct platform_device = *pdev) =20 return 0; =20 -disable_clks: - xdma_disable_allclks(xdev); error: for (i =3D 0; i < xdev->dma_config->max_channels; i++) if (xdev->chan[i]) xilinx_dma_chan_remove(xdev->chan[i]); +disable_clks: + xdma_disable_allclks(xdev); =20 return err; } --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C06A9C4332F for ; Mon, 10 Oct 2022 07:08:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231585AbiJJHIl (ORCPT ); Mon, 10 Oct 2022 03:08:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231559AbiJJHHr (ORCPT ); Mon, 10 Oct 2022 03:07:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A68E1167F3; Mon, 10 Oct 2022 00:05:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8FCF660E33; Mon, 10 Oct 2022 07:05:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A35D6C43470; Mon, 10 Oct 2022 07:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385535; bh=atj1j0PKW4J78bE2bxMxEMMO/nt/+7SxCYm3vfCz78Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZBcydlnWFiHjVw5pDzcs4ZuCRAj6G744L7htfb/tMaLKA7hsVi0t7/O7VTlMn4fIm 5P9isCR8GN4Ike8xpZimlM8hsYAdHaxn7Ti9aawgdPS6dTk9jNChkFJKQMyfkNsM1A 9z8dBWfKNu/T/y2FZqnHN1eyp1r46XBsnuG5Qw6Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Swati Agarwal , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 14/48] dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property Date: Mon, 10 Oct 2022 09:05:12 +0200 Message-Id: <20221010070334.078829702@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Swati Agarwal [ Upstream commit 462bce790e6a7e68620a4ce260cc38f7ed0255d5 ] Free the allocated resources for missing xlnx,num-fstores property. Signed-off-by: Swati Agarwal Link: https://lore.kernel.org/r/20220817061125.4720-3-swati.agarwal@xilinx.= com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/dma/xilinx/xilinx_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dm= a.c index ba0dccaa8cf1..f63ec9d862ff 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -3191,7 +3191,7 @@ static int xilinx_dma_probe(struct platform_device *p= dev) if (err < 0) { dev_err(xdev->dev, "missing xlnx,num-fstores property\n"); - return err; + goto disable_clks; } =20 err =3D of_property_read_u32(node, "xlnx,flush-fsync", --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79BD6C4332F for ; Mon, 10 Oct 2022 07:08:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231705AbiJJHIw (ORCPT ); Mon, 10 Oct 2022 03:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230345AbiJJHIA (ORCPT ); Mon, 10 Oct 2022 03:08:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC4C122BE9; Mon, 10 Oct 2022 00:05:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D8061B80E5C; Mon, 10 Oct 2022 07:05:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 344ACC433C1; Mon, 10 Oct 2022 07:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385537; bh=2eEzG9gMoeCDqrQE6PVnB7Na/A3URZNcMUiHeCsODx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ATCYCJFjHPNjq/+KXG2Ukcy/TncdiF05rI9dkL3YU0ReFJ0kDMJiXJERsbu+NzjEK 5vtZbdgrX2rPoz5M9ebRLTyx5b5v2PgTwW2jW9YpumtPAlNJzweImNYQWzIYcEVBPL Q3cnidnK/5yE0h2qTLaD5VcaISJICQ1HnYGX+ImU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Swati Agarwal , Radhey Shyam Pandey , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 15/48] dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure Date: Mon, 10 Oct 2022 09:05:13 +0200 Message-Id: <20221010070334.108085226@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Swati Agarwal [ Upstream commit 8f2b6bc79c32f0fa60df000ae387a790ec80eae9 ] The driver does not handle the failure case while calling dma_set_mask_and_coherent API. In case of failure, capture the return value of API and then report an error. Addresses-coverity: Unchecked return value (CHECKED_RETURN) Signed-off-by: Swati Agarwal Reviewed-by: Radhey Shyam Pandey Link: https://lore.kernel.org/r/20220817061125.4720-4-swati.agarwal@xilinx.= com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/dma/xilinx/xilinx_dma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dm= a.c index f63ec9d862ff..7ce8bb160a59 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -3211,7 +3211,11 @@ static int xilinx_dma_probe(struct platform_device *= pdev) xdev->ext_addr =3D false; =20 /* Set the dma mask bits */ - dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); + err =3D dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); + if (err < 0) { + dev_err(xdev->dev, "DMA mask error %d\n", err); + goto disable_clks; + } =20 /* Initialize the DMA engine */ xdev->common.dev =3D &pdev->dev; --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 026DAC433F5 for ; Mon, 10 Oct 2022 07:08:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231627AbiJJHIo (ORCPT ); Mon, 10 Oct 2022 03:08:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbiJJHHw (ORCPT ); Mon, 10 Oct 2022 03:07:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACF4E1D678; Mon, 10 Oct 2022 00:05:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AA66960E08; Mon, 10 Oct 2022 07:05:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2406C433D6; Mon, 10 Oct 2022 07:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385540; bh=6JffHU6PnRtlmn1w09erYXoEyaJBI9+hx8PzX9HTScw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t2qq3vp/NpuK+fy3bD9QtVKJ7ognRPfjNkYvuBNgHffIicntEgXKq6uwdX3JDQOwa /XYYCTRsznXcs8oW2JBGl1xz5BlsdcZwKaUv0qfa/fj0kCx4LiEky0mOUiVKqCDKcr mhkE+A+qwZTNgxFdjViEm48kva9SCOlzokA0icsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , "Jason A. Donenfeld" , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 16/48] wifi: iwlwifi: dont spam logs with NSS>2 messages Date: Mon, 10 Oct 2022 09:05:14 +0200 Message-Id: <20221010070334.133086627@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 4d8421f2dd88583cc7a4d6c2a5532c35e816a52a ] I get a log line like this every 4 seconds when connected to my AP: [15650.221468] iwlwifi 0000:09:00.0: Got NSS =3D 4 - trimming to 2 Looking at the code, this seems to be related to a hardware limitation, and there's nothing to be done. In an effort to keep my dmesg manageable, downgrade this error to "debug" rather than "info". Cc: Johannes Berg Signed-off-by: Jason A. Donenfeld Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220905172246.105383-1-Jason@zx2c4.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/ne= t/wireless/intel/iwlwifi/mvm/mac80211.c index c5626ff83805..640e3786c244 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1833,8 +1833,8 @@ static void iwl_mvm_parse_ppe(struct iwl_mvm *mvm, * If nss < MAX: we can set zeros in other streams */ if (nss > MAX_HE_SUPP_NSS) { - IWL_INFO(mvm, "Got NSS =3D %d - trimming to %d\n", nss, - MAX_HE_SUPP_NSS); + IWL_DEBUG_INFO(mvm, "Got NSS =3D %d - trimming to %d\n", nss, + MAX_HE_SUPP_NSS); nss =3D MAX_HE_SUPP_NSS; } =20 --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80EB0C433F5 for ; Mon, 10 Oct 2022 07:08:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230479AbiJJHIs (ORCPT ); Mon, 10 Oct 2022 03:08:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231667AbiJJHHz (ORCPT ); Mon, 10 Oct 2022 03:07:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92AFF58DDE; Mon, 10 Oct 2022 00:05:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5208B60E84; Mon, 10 Oct 2022 07:05:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 663D2C433D6; Mon, 10 Oct 2022 07:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385542; bh=snTKj5uUCniAAmOx2ttL6/s1ceXhHSHr5CwfTfYUtug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lGFd2dzycqNlfK20EyT+F7iBbVhPGnPh/cxdraIcuZ6fAlz8OPhLBORNM8CUmlUAQ Tiilkm39HRdtYb1P9E1+hBcZhOHMk/de4pyuVTSRfmv6SZBr/WjvFaMBjbO0onS3DT W/BfJxLmgkWdhN9ail3rzM4cI0Ix6E+d8oNPx7iY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Sergei Antonov , Jonas Jensen , Sasha Levin Subject: [PATCH 5.19 17/48] ARM: dts: fix Moxa SDIO compatible, remove sdhci misnomer Date: Mon, 10 Oct 2022 09:05:15 +0200 Message-Id: <20221010070334.158173147@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergei Antonov [ Upstream commit 02181e68275d28cab3c3f755852770367f1bc229 ] Driver moxart-mmc.c has .compatible =3D "moxa,moxart-mmc". But moxart .dts/.dtsi and the documentation file moxa,moxart-dma.txt contain compatible =3D "moxa,moxart-sdhci". Change moxart .dts/.dtsi files and moxa,moxart-dma.txt to match the driver. Replace 'sdhci' with 'mmc' in names too, since SDHCI is a different controller from FTSDC010. Suggested-by: Arnd Bergmann Signed-off-by: Sergei Antonov Cc: Jonas Jensen Link: https://lore.kernel.org/r/20220907175341.1477383-1-saproj@gmail.com' Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt | 4 ++-- arch/arm/boot/dts/moxart-uc7112lx.dts | 2 +- arch/arm/boot/dts/moxart.dtsi | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt b/Do= cumentation/devicetree/bindings/dma/moxa,moxart-dma.txt index 8a9f3559335b..7e14e26676ec 100644 --- a/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt +++ b/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt @@ -34,8 +34,8 @@ Example: Use specific request line passing from dma For example, MMC request line is 5 =20 - sdhci: sdhci@98e00000 { - compatible =3D "moxa,moxart-sdhci"; + mmc: mmc@98e00000 { + compatible =3D "moxa,moxart-mmc"; reg =3D <0x98e00000 0x5C>; interrupts =3D <5 0>; clocks =3D <&clk_apb>; diff --git a/arch/arm/boot/dts/moxart-uc7112lx.dts b/arch/arm/boot/dts/moxa= rt-uc7112lx.dts index eb5291b0ee3a..e07b807b4cec 100644 --- a/arch/arm/boot/dts/moxart-uc7112lx.dts +++ b/arch/arm/boot/dts/moxart-uc7112lx.dts @@ -79,7 +79,7 @@ &clk_pll { clocks =3D <&ref12>; }; =20 -&sdhci { +&mmc { status =3D "okay"; }; =20 diff --git a/arch/arm/boot/dts/moxart.dtsi b/arch/arm/boot/dts/moxart.dtsi index f5f070a87482..764832ddfa78 100644 --- a/arch/arm/boot/dts/moxart.dtsi +++ b/arch/arm/boot/dts/moxart.dtsi @@ -93,8 +93,8 @@ watchdog: watchdog@98500000 { clock-names =3D "PCLK"; }; =20 - sdhci: sdhci@98e00000 { - compatible =3D "moxa,moxart-sdhci"; + mmc: mmc@98e00000 { + compatible =3D "moxa,moxart-mmc"; reg =3D <0x98e00000 0x5C>; interrupts =3D <5 IRQ_TYPE_LEVEL_HIGH>; clocks =3D <&clk_apb>; --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD431C433FE for ; Mon, 10 Oct 2022 07:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231229AbiJJHI5 (ORCPT ); Mon, 10 Oct 2022 03:08:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231287AbiJJHIB (ORCPT ); Mon, 10 Oct 2022 03:08:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F05225A2ED; Mon, 10 Oct 2022 00:05:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DF9B460E9A; Mon, 10 Oct 2022 07:05:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01A9EC433C1; Mon, 10 Oct 2022 07:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385545; bh=rmXLxzGf9Iaux4QL9qj05LHuT3qVQhmty6LBfQnYxuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jcUifL0lndk6VFTSqHJfmOQQ5NXYYeYesNzQkhOn3NgDXxvNzKJmGzBJetIoanOub olQ7jFFO9mMW7BIlUKTAuOYLn1I+4ds6KMeVA4cHtpDhI8D00hwujG78QfQNILveg7 CpB3HD0xmAKhveyAb1+KB0lw/zim/QJjtrnxA3h0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yifan Zhang , Tim Huang , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 18/48] drm/amdgpu/mes: zero the sdma_hqd_mask of 2nd SDMA engine for SDMA 6.0.1 Date: Mon, 10 Oct 2022 09:05:16 +0200 Message-Id: <20221010070334.182866385@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yifan Zhang [ Upstream commit 0af4ed0c329ebb4cef95fda4fcdbfcdea0255442 ] there is only one SDMA engine in SDMA 6.0.1, the sdma_hqd_mask has to be zeroed for the 2nd engine, otherwise MES scheduler will consider 2nd engine exists and map/unmap SDMA queues to the non-existent engine. Signed-off-by: Yifan Zhang Reviewed-by: Tim Huang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_mes.c index 69a70a0aaed9..6ab062c63da1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c @@ -169,6 +169,9 @@ int amdgpu_mes_init(struct amdgpu_device *adev) for (i =3D 0; i < AMDGPU_MES_MAX_SDMA_PIPES; i++) { if (adev->ip_versions[SDMA0_HWIP][0] < IP_VERSION(6, 0, 0)) adev->mes.sdma_hqd_mask[i] =3D i ? 0 : 0x3fc; + /* zero sdma_hqd_mask for non-existent engine */ + else if (adev->sdma.num_instances =3D=3D 1) + adev->mes.sdma_hqd_mask[i] =3D i ? 0 : 0xfc; else adev->mes.sdma_hqd_mask[i] =3D 0xfc; } --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC4A5C433F5 for ; Mon, 10 Oct 2022 07:09:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231765AbiJJHJN (ORCPT ); Mon, 10 Oct 2022 03:09:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231548AbiJJHI0 (ORCPT ); Mon, 10 Oct 2022 03:08:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DE8A58DDF; Mon, 10 Oct 2022 00:05:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 28518B80E4D; Mon, 10 Oct 2022 07:05:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95798C433D6; Mon, 10 Oct 2022 07:05:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385547; bh=EyS2H66dvolNP6xiUcKq1qUgivYU/HqvLxRNpK5DOg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FruHpnvtC3FsrqY2+GXksG+fPdZwrQdmH97XBEWwlNk1/9PMqNnNRftWlhSd+SBAi of3uttTRWzp0YXdaVn6Fvw0PnP47Fojwxh2CHCjlb53W3U/WNvQuo9oaPUUmMCt13V DqHuxvMISiH1odKQBCyuB+oZK7EoLCvH8Fup3Axw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Saurav Kashyap , Wende Tan , Letu Ren , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 19/48] scsi: qedf: Fix a UAF bug in __qedf_probe() Date: Mon, 10 Oct 2022 09:05:17 +0200 Message-Id: <20221010070334.207130765@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Letu Ren [ Upstream commit fbfe96869b782364caebae0445763969ddb6ea67 ] In __qedf_probe(), if qedf->cdev is NULL which means qed_ops->common->probe() failed, then the program will goto label err1, and scsi_host_put() will free lport->host pointer. Because the memory qedf points to is allocated by libfc_host_alloc(), it will be freed by scsi_host_put(). However, the if statement below label err0 only checks whether qedf is NULL but doesn't check whether the memory has been freed. So a UAF bug can occur. There are two ways to reach the statements below err0. The first one is described as before, "qedf" should be set to NULL. The second one is goto "err0" directly. In the latter scenario qedf hasn't been changed and it has the initial value NULL. As a result the if statement is not reachable in any situation. The KASAN logs are as follows: [ 2.312969] BUG: KASAN: use-after-free in __qedf_probe+0x5dcf/0x6bc0 [ 2.312969] [ 2.312969] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel= -1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 2.312969] Call Trace: [ 2.312969] dump_stack_lvl+0x59/0x7b [ 2.312969] print_address_description+0x7c/0x3b0 [ 2.312969] ? __qedf_probe+0x5dcf/0x6bc0 [ 2.312969] __kasan_report+0x160/0x1c0 [ 2.312969] ? __qedf_probe+0x5dcf/0x6bc0 [ 2.312969] kasan_report+0x4b/0x70 [ 2.312969] ? kobject_put+0x25d/0x290 [ 2.312969] kasan_check_range+0x2ca/0x310 [ 2.312969] __qedf_probe+0x5dcf/0x6bc0 [ 2.312969] ? selinux_kernfs_init_security+0xdc/0x5f0 [ 2.312969] ? trace_rpm_return_int_rcuidle+0x18/0x120 [ 2.312969] ? rpm_resume+0xa5c/0x16e0 [ 2.312969] ? qedf_get_generic_tlv_data+0x160/0x160 [ 2.312969] local_pci_probe+0x13c/0x1f0 [ 2.312969] pci_device_probe+0x37e/0x6c0 Link: https://lore.kernel.org/r/20211112120641.16073-1-fantasquex@gmail.com Reported-by: Zheyu Ma Acked-by: Saurav Kashyap Co-developed-by: Wende Tan Signed-off-by: Wende Tan Signed-off-by: Letu Ren Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qedf/qedf_main.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index 3d6b137314f3..bbc4d5890ae6 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -3686,11 +3686,6 @@ static int __qedf_probe(struct pci_dev *pdev, int mo= de) err1: scsi_host_put(lport->host); err0: - if (qedf) { - QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe done.\n"); - - clear_bit(QEDF_PROBING, &qedf->flags); - } return rc; } =20 --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CC60C433FE for ; Mon, 10 Oct 2022 07:09:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231734AbiJJHJQ (ORCPT ); Mon, 10 Oct 2022 03:09:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231550AbiJJHI2 (ORCPT ); Mon, 10 Oct 2022 03:08:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E86FD111; Mon, 10 Oct 2022 00:05:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A0B0160E33; Mon, 10 Oct 2022 07:05:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8677C433D7; Mon, 10 Oct 2022 07:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385553; bh=pXDGuA07sMKv8bo1AKnfsa/wE2d5OffbaPz69KQhWeY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ahQH60F62wpLNKvLMB/96Eth3XCs+U8hkok5ZZgdxO26EQpdmETo6tCRZxIVidrsd fKj6vu9CKtP32wdWEebg9bjQSVibQFuPPsQwk82x0G9nA8pNeeaLCo1LJ2m92y708T OAq6S2isUV1U40HM4oZDmr1KSTPzva4807hK8Jl0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haimin Zhang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 20/48] net/ieee802154: fix uninit value bug in dgram_sendmsg Date: Mon, 10 Oct 2022 09:05:18 +0200 Message-Id: <20221010070334.232891062@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haimin Zhang [ Upstream commit 94160108a70c8af17fa1484a37e05181c0e094af ] There is uninit value bug in dgram_sendmsg function in net/ieee802154/socket.c when the length of valid data pointed by the msg->msg_name isn't verified. We introducing a helper function ieee802154_sockaddr_check_size to check namelen. First we check there is addr_type in ieee802154_addr_sa. Then, we check namelen according to addr_type. Also fixed in raw_bind, dgram_bind, dgram_connect. Signed-off-by: Haimin Zhang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/ieee802154_netdev.h | 37 +++++++++++++++++++++++++++++ net/ieee802154/socket.c | 42 ++++++++++++++++++--------------- 2 files changed, 60 insertions(+), 19 deletions(-) diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netde= v.h index d0d188c3294b..a8994f307fc3 100644 --- a/include/net/ieee802154_netdev.h +++ b/include/net/ieee802154_netdev.h @@ -15,6 +15,22 @@ #ifndef IEEE802154_NETDEVICE_H #define IEEE802154_NETDEVICE_H =20 +#define IEEE802154_REQUIRED_SIZE(struct_type, member) \ + (offsetof(typeof(struct_type), member) + \ + sizeof(((typeof(struct_type) *)(NULL))->member)) + +#define IEEE802154_ADDR_OFFSET \ + offsetof(typeof(struct sockaddr_ieee802154), addr) + +#define IEEE802154_MIN_NAMELEN (IEEE802154_ADDR_OFFSET + \ + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, addr_type)) + +#define IEEE802154_NAMELEN_SHORT (IEEE802154_ADDR_OFFSET + \ + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, short_addr)) + +#define IEEE802154_NAMELEN_LONG (IEEE802154_ADDR_OFFSET + \ + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, hwaddr)) + #include #include #include @@ -165,6 +181,27 @@ static inline void ieee802154_devaddr_to_raw(void *raw= , __le64 addr) memcpy(raw, &temp, IEEE802154_ADDR_LEN); } =20 +static inline int +ieee802154_sockaddr_check_size(struct sockaddr_ieee802154 *daddr, int len) +{ + struct ieee802154_addr_sa *sa; + + sa =3D &daddr->addr; + if (len < IEEE802154_MIN_NAMELEN) + return -EINVAL; + switch (sa->addr_type) { + case IEEE802154_ADDR_SHORT: + if (len < IEEE802154_NAMELEN_SHORT) + return -EINVAL; + break; + case IEEE802154_ADDR_LONG: + if (len < IEEE802154_NAMELEN_LONG) + return -EINVAL; + break; + } + return 0; +} + static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a, const struct ieee802154_addr_sa *sa) { diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index 718fb77bb372..7889e1ef7fad 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -200,8 +200,9 @@ static int raw_bind(struct sock *sk, struct sockaddr *_= uaddr, int len) int err =3D 0; struct net_device *dev =3D NULL; =20 - if (len < sizeof(*uaddr)) - return -EINVAL; + err =3D ieee802154_sockaddr_check_size(uaddr, len); + if (err < 0) + return err; =20 uaddr =3D (struct sockaddr_ieee802154 *)_uaddr; if (uaddr->family !=3D AF_IEEE802154) @@ -493,7 +494,8 @@ static int dgram_bind(struct sock *sk, struct sockaddr = *uaddr, int len) =20 ro->bound =3D 0; =20 - if (len < sizeof(*addr)) + err =3D ieee802154_sockaddr_check_size(addr, len); + if (err < 0) goto out; =20 if (addr->family !=3D AF_IEEE802154) @@ -564,8 +566,9 @@ static int dgram_connect(struct sock *sk, struct sockad= dr *uaddr, struct dgram_sock *ro =3D dgram_sk(sk); int err =3D 0; =20 - if (len < sizeof(*addr)) - return -EINVAL; + err =3D ieee802154_sockaddr_check_size(addr, len); + if (err < 0) + return err; =20 if (addr->family !=3D AF_IEEE802154) return -EINVAL; @@ -604,6 +607,7 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr= *msg, size_t size) struct ieee802154_mac_cb *cb; struct dgram_sock *ro =3D dgram_sk(sk); struct ieee802154_addr dst_addr; + DECLARE_SOCKADDR(struct sockaddr_ieee802154*, daddr, msg->msg_name); int hlen, tlen; int err; =20 @@ -612,10 +616,20 @@ static int dgram_sendmsg(struct sock *sk, struct msgh= dr *msg, size_t size) return -EOPNOTSUPP; } =20 - if (!ro->connected && !msg->msg_name) - return -EDESTADDRREQ; - else if (ro->connected && msg->msg_name) - return -EISCONN; + if (msg->msg_name) { + if (ro->connected) + return -EISCONN; + if (msg->msg_namelen < IEEE802154_MIN_NAMELEN) + return -EINVAL; + err =3D ieee802154_sockaddr_check_size(daddr, msg->msg_namelen); + if (err < 0) + return err; + ieee802154_addr_from_sa(&dst_addr, &daddr->addr); + } else { + if (!ro->connected) + return -EDESTADDRREQ; + dst_addr =3D ro->dst_addr; + } =20 if (!ro->bound) dev =3D dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154); @@ -651,16 +665,6 @@ static int dgram_sendmsg(struct sock *sk, struct msghd= r *msg, size_t size) cb =3D mac_cb_init(skb); cb->type =3D IEEE802154_FC_TYPE_DATA; cb->ackreq =3D ro->want_ack; - - if (msg->msg_name) { - DECLARE_SOCKADDR(struct sockaddr_ieee802154*, - daddr, msg->msg_name); - - ieee802154_addr_from_sa(&dst_addr, &daddr->addr); - } else { - dst_addr =3D ro->dst_addr; - } - cb->secen =3D ro->secen; cb->secen_override =3D ro->secen_override; cb->seclevel =3D ro->seclevel; --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BCBCC433FE for ; Mon, 10 Oct 2022 07:09:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231469AbiJJHJ1 (ORCPT ); Mon, 10 Oct 2022 03:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231259AbiJJHIf (ORCPT ); Mon, 10 Oct 2022 03:08:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EF8C5AC66; Mon, 10 Oct 2022 00:05:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2EF2760E74; Mon, 10 Oct 2022 07:05:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 461E4C433C1; Mon, 10 Oct 2022 07:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385555; bh=6pTTRmUAv0wG9o5dh0evjFMOU1DGy3ZXeepzUNql1x8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uMJtN88zeGarNDN3wZIpcBLHiTDdEiFQyqAINYxZD6tY1UGCYnd/kTcMd0MBeA7ih 8kcOsGBxlawnsTAQEYXdSj1sO8hCfvn0VZX2K1WrUYYt9XuPOfb902zjkZLJSeJRTx JOtPCwudYhQSx4k6vJVt33kD74ZnEyfEDPAotVsU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksandr Mazur , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 21/48] net: marvell: prestera: add support for for Aldrin2 Date: Mon, 10 Oct 2022 09:05:19 +0200 Message-Id: <20221010070334.257091026@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Mazur [ Upstream commit 9124dbcc2dd6c51e81f97f63f7807118c4eb140a ] Aldrin2 (98DX8525) is a Marvell Prestera PP, with 100G support. Signed-off-by: Oleksandr Mazur V2: - retarget to net tree instead of net-next; - fix missed colon in patch subject ('net marvell' vs 'net: mavell'); Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/marvell/prestera/prestera_pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_pci.c b/drivers= /net/ethernet/marvell/prestera/prestera_pci.c index f538a749ebd4..59470d99f522 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_pci.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_pci.c @@ -872,6 +872,7 @@ static void prestera_pci_remove(struct pci_dev *pdev) static const struct pci_device_id prestera_pci_devices[] =3D { { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0xC804) }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0xC80C) }, + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0xCC1E) }, { } }; MODULE_DEVICE_TABLE(pci, prestera_pci_devices); --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68D4CC433F5 for ; Mon, 10 Oct 2022 07:10:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231285AbiJJHKI (ORCPT ); Mon, 10 Oct 2022 03:10:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231416AbiJJHJM (ORCPT ); Mon, 10 Oct 2022 03:09:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DB9C5F87; Mon, 10 Oct 2022 00:06:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CDCA960E08; Mon, 10 Oct 2022 07:05:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF964C433D6; Mon, 10 Oct 2022 07:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385558; bh=xClT/v5tpXl9eqY7m/CuYG4QEZ8SWZs/2OSQIrUYjzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O5c8H7OVUyNot26vgvL3+zzNXA7MNbOr8mrTDDh+rEtdETNXZbq17zNmOLDbxyH6v E7RI691+U2b+w9FoY/Cy1UU8hpsrrGdZSRqZs92YQJNG3EqYH2WcY5jlWYiHjtra7V uJpFkJenBb+4sqTR7WvqwWZ3kywBybplNzhXzP58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Vehmanen , Jaroslav Kysela , Takashi Iwai , Sasha Levin Subject: [PATCH 5.19 22/48] ALSA: hda/hdmi: Fix the converter reuse for the silent stream Date: Mon, 10 Oct 2022 09:05:20 +0200 Message-Id: <20221010070334.282161723@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jaroslav Kysela [ Upstream commit 5f80d6bd2b01de4cafac3302f58456bf860322fc ] When the user space pcm stream uses the silent stream converter, it is no longer allocated for the silent stream. Clear the appropriate flag in the hdmi_pcm_open() function. The silent stream setup may be applied in hdmi_pcm_close() (and the error path - open fcn) again. If the flag is not cleared, the reuse conditions for the silent stream converter in hdmi_choose_cvt() may improperly share this converter. Cc: Kai Vehmanen Signed-off-by: Jaroslav Kysela Link: https://lore.kernel.org/r/20220913070216.3233974-1-perex@perex.cz Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_hdmi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index c9d9aa6351ec..c239d9dbbaef 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -1278,6 +1278,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, set_bit(pcm_idx, &spec->pcm_in_use); per_pin =3D get_pin(spec, pin_idx); per_pin->cvt_nid =3D per_cvt->cvt_nid; + per_pin->silent_stream =3D false; hinfo->nid =3D per_cvt->cvt_nid; =20 /* flip stripe flag for the assigned stream if supported */ --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA4D0C433FE for ; Mon, 10 Oct 2022 07:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231420AbiJJHJy (ORCPT ); Mon, 10 Oct 2022 03:09:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231389AbiJJHJH (ORCPT ); Mon, 10 Oct 2022 03:09:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47EDC5FB4; Mon, 10 Oct 2022 00:06:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 79D2A60E8D; Mon, 10 Oct 2022 07:06:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C4CEC433C1; Mon, 10 Oct 2022 07:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385560; bh=Oo5dzfgUvi7RFuvhID2RTEtBjZh0y9xtz/tZcCFnyi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pUSZ4ysVqpozHqYwB7Uf6zitgFCnlY5e26sB3WIGld2YjyMRJdBCxbkwb0XLUwQqd tGUKXhn5C0XRYsVZBAVKB0iPPh2soVowTZiz0Obt71ktS7ezD40raX65o8A3YHzJBQ i6oQ9WQbnoGWCunj/GksjkS9XkH4431M1S163SEo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Straub , Richard Weinberger , Sasha Levin , Randy Dunlap Subject: [PATCH 5.19 23/48] um: Cleanup syscall_handler_t cast in syscalls_32.h Date: Mon, 10 Oct 2022 09:05:21 +0200 Message-Id: <20221010070334.306949060@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Straub [ Upstream commit 61670b4d270c71219def1fbc9441debc2ac2e6e9 ] Like in f4f03f299a56ce4d73c5431e0327b3b6cb55ebb9 "um: Cleanup syscall_handler_t definition/cast, fix warning", remove the cast to to fix the compiler warning. Signed-off-by: Lukas Straub Acked-by: Randy Dunlap # build-tested Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/um/shared/sysdep/syscalls_32.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/um/shared/sysdep/syscalls_32.h b/arch/x86/um/shared/s= ysdep/syscalls_32.h index 68fd2cf526fd..f6e9f84397e7 100644 --- a/arch/x86/um/shared/sysdep/syscalls_32.h +++ b/arch/x86/um/shared/sysdep/syscalls_32.h @@ -6,10 +6,9 @@ #include #include =20 -typedef long syscall_handler_t(struct pt_regs); +typedef long syscall_handler_t(struct syscall_args); =20 extern syscall_handler_t *sys_call_table[]; =20 #define EXECUTE_SYSCALL(syscall, regs) \ - ((long (*)(struct syscall_args)) \ - (*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) + ((*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE3ABC433FE for ; Mon, 10 Oct 2022 07:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231794AbiJJHJq (ORCPT ); Mon, 10 Oct 2022 03:09:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231235AbiJJHIm (ORCPT ); Mon, 10 Oct 2022 03:08:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAB1A5F77; Mon, 10 Oct 2022 00:06:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1A82660E75; Mon, 10 Oct 2022 07:06:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FBC4C433D6; Mon, 10 Oct 2022 07:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385563; bh=FMtJbvUlcZMfZJsHs+zcMqbDLnAq+to6DJYsgnmO13c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J7EdcCnXmOSAWGahPylrhrqzVKB/ODf/Xo3tzN3UNEqYZAbtOoEWIBa2z8jpUIgJj QckBtLoE14Bzi466baF1DkCUhljt/2OuwRg6vZmTc9U6+xCTjnfbb6Hl1FObpIIixi 6JbCDDEMaXJpgQRaC5Geg5CNwZijS7aFztS129AU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Straub , Richard Weinberger , Sasha Levin , Randy Dunlap Subject: [PATCH 5.19 24/48] um: Cleanup compiler warning in arch/x86/um/tls_32.c Date: Mon, 10 Oct 2022 09:05:22 +0200 Message-Id: <20221010070334.333060460@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Straub [ Upstream commit d27fff3499671dc23a08efd01cdb8b3764a391c4 ] arch.tls_array is statically allocated so checking for NULL doesn't make sense. This causes the compiler warning below. Remove the checks to silence these warnings. ../arch/x86/um/tls_32.c: In function 'get_free_idx': ../arch/x86/um/tls_32.c:68:13: warning: the comparison will always evaluate= as 'true' for the address of 'tls_array' will never be NULL [-Waddress] 68 | if (!t->arch.tls_array) | ^ In file included from ../arch/x86/um/asm/processor.h:10, from ../include/linux/rcupdate.h:30, from ../include/linux/rculist.h:11, from ../include/linux/pid.h:5, from ../include/linux/sched.h:14, from ../arch/x86/um/tls_32.c:7: ../arch/x86/um/asm/processor_32.h:22:31: note: 'tls_array' declared here 22 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; | ^~~~~~~~~ ../arch/x86/um/tls_32.c: In function 'get_tls_entry': ../arch/x86/um/tls_32.c:243:13: warning: the comparison will always evaluat= e as 'true' for the address of 'tls_array' will never be NULL [-Waddress] 243 | if (!t->arch.tls_array) | ^ ../arch/x86/um/asm/processor_32.h:22:31: note: 'tls_array' declared here 22 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; | ^~~~~~~~~ Signed-off-by: Lukas Straub Acked-by: Randy Dunlap # build-tested Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/um/tls_32.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c index ac8eee093f9c..66162eafd8e8 100644 --- a/arch/x86/um/tls_32.c +++ b/arch/x86/um/tls_32.c @@ -65,9 +65,6 @@ static int get_free_idx(struct task_struct* task) struct thread_struct *t =3D &task->thread; int idx; =20 - if (!t->arch.tls_array) - return GDT_ENTRY_TLS_MIN; - for (idx =3D 0; idx < GDT_ENTRY_TLS_ENTRIES; idx++) if (!t->arch.tls_array[idx].present) return idx + GDT_ENTRY_TLS_MIN; @@ -240,9 +237,6 @@ static int get_tls_entry(struct task_struct *task, stru= ct user_desc *info, { struct thread_struct *t =3D &task->thread; =20 - if (!t->arch.tls_array) - goto clear; - if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) return -EINVAL; =20 --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F014BC433FE for ; Mon, 10 Oct 2022 07:10:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231630AbiJJHKB (ORCPT ); Mon, 10 Oct 2022 03:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231714AbiJJHJM (ORCPT ); Mon, 10 Oct 2022 03:09:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B7CFAE6B; Mon, 10 Oct 2022 00:06:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BB2C960E33; Mon, 10 Oct 2022 07:06:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0868C433C1; Mon, 10 Oct 2022 07:06:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385566; bh=Ij9qIbVDOEwLjRKRVfWKa91KXVvfWGsn+1ZqzNaeZok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wxc7/YbPME7n9T6wrAyjmUS4O2toFhRM/oIkjlw74NGLTdv0dxUEZsR/H6DJrcGwx oITaULULj/RuJ+6Bi373UkAZG9pkVYpox5BCgVZlVwXUVM1X/ylpG4a9XhnY3oTx93 HdQi9iytWJ1ngou6UJ2gEZnAJM5eEtg74658HLyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Linus Walleij , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.19 25/48] gpio: ftgpio010: Make irqchip immutable Date: Mon, 10 Oct 2022 09:05:23 +0200 Message-Id: <20221010070334.359746429@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit ab637d48363d7b8ee67ae089808a8bc6051d53c4 ] This turns the FTGPIO010 irqchip immutable. Tested on the D-Link DIR-685. Cc: Marc Zyngier Signed-off-by: Linus Walleij Acked-by: Marc Zyngier Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpio/gpio-ftgpio010.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/gpio/gpio-ftgpio010.c b/drivers/gpio/gpio-ftgpio010.c index f422c3e129a0..f77a965f5780 100644 --- a/drivers/gpio/gpio-ftgpio010.c +++ b/drivers/gpio/gpio-ftgpio010.c @@ -41,14 +41,12 @@ * struct ftgpio_gpio - Gemini GPIO state container * @dev: containing device for this instance * @gc: gpiochip for this instance - * @irq: irqchip for this instance * @base: remapped I/O-memory base * @clk: silicon clock */ struct ftgpio_gpio { struct device *dev; struct gpio_chip gc; - struct irq_chip irq; void __iomem *base; struct clk *clk; }; @@ -70,6 +68,7 @@ static void ftgpio_gpio_mask_irq(struct irq_data *d) val =3D readl(g->base + GPIO_INT_EN); val &=3D ~BIT(irqd_to_hwirq(d)); writel(val, g->base + GPIO_INT_EN); + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); } =20 static void ftgpio_gpio_unmask_irq(struct irq_data *d) @@ -78,6 +77,7 @@ static void ftgpio_gpio_unmask_irq(struct irq_data *d) struct ftgpio_gpio *g =3D gpiochip_get_data(gc); u32 val; =20 + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); val =3D readl(g->base + GPIO_INT_EN); val |=3D BIT(irqd_to_hwirq(d)); writel(val, g->base + GPIO_INT_EN); @@ -221,6 +221,16 @@ static int ftgpio_gpio_set_config(struct gpio_chip *gc= , unsigned int offset, return 0; } =20 +static const struct irq_chip ftgpio_irq_chip =3D { + .name =3D "FTGPIO010", + .irq_ack =3D ftgpio_gpio_ack_irq, + .irq_mask =3D ftgpio_gpio_mask_irq, + .irq_unmask =3D ftgpio_gpio_unmask_irq, + .irq_set_type =3D ftgpio_gpio_set_irq_type, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static int ftgpio_gpio_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -277,14 +287,8 @@ static int ftgpio_gpio_probe(struct platform_device *p= dev) if (!IS_ERR(g->clk)) g->gc.set_config =3D ftgpio_gpio_set_config; =20 - g->irq.name =3D "FTGPIO010"; - g->irq.irq_ack =3D ftgpio_gpio_ack_irq; - g->irq.irq_mask =3D ftgpio_gpio_mask_irq; - g->irq.irq_unmask =3D ftgpio_gpio_unmask_irq; - g->irq.irq_set_type =3D ftgpio_gpio_set_irq_type; - girq =3D &g->gc.irq; - girq->chip =3D &g->irq; + gpio_irq_chip_set_chip(girq, &ftgpio_irq_chip); girq->parent_handler =3D ftgpio_gpio_irq_handler; girq->num_parents =3D 1; girq->parents =3D devm_kcalloc(dev, 1, sizeof(*girq->parents), --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9799EC433FE for ; Mon, 10 Oct 2022 07:10:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231865AbiJJHKx (ORCPT ); Mon, 10 Oct 2022 03:10:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231802AbiJJHJy (ORCPT ); Mon, 10 Oct 2022 03:09:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AD375BC3D; Mon, 10 Oct 2022 00:06:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0EB57B80E5C; Mon, 10 Oct 2022 07:06:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65A62C433D7; Mon, 10 Oct 2022 07:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385568; bh=kEVzyc8uT2RwjoKkZI5RjRz4QrD+XKGFvbKecr0kE8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=coRP6Ti7alPqJe3hd++95zGSj49cSzdm7Y0sMOGXm8uUUrU/cnP13oiAnCU7ZRJ7o au8FEBPu9C4ofOVxKRPsZmKfw2XM0w48LnnlNB5+3jFK1Oqy0Q51FQ0cb4SSTgziiy sQ/ASAc0oFcedUo2UDAACc88hLiIsbQHvuJeuv+8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Gow , Lukas Straub , Richard Weinberger , Sasha Levin , Randy Dunlap Subject: [PATCH 5.19 26/48] arch: um: Mark the stack non-executable to fix a binutils warning Date: Mon, 10 Oct 2022 09:05:24 +0200 Message-Id: <20221010070334.383070513@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Gow [ Upstream commit bd71558d585ac61cfd799db7f25e78dca404dd7a ] Since binutils 2.39, ld will print a warning if any stack section is executable, which is the default for stack sections on files without a .note.GNU-stack section. This was fixed for x86 in commit ffcf9c5700e4 ("x86: link vdso and boot wit= h -z noexecstack --no-warn-rwx-segments"), but remained broken for UML, resulting in several warnings: /usr/bin/ld: warning: arch/x86/um/vdso/vdso.o: missing .note.GNU-stack sect= ion implies executable stack /usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a fu= ture version of the linker /usr/bin/ld: warning: .tmp_vmlinux.kallsyms1 has a LOAD segment with RWX pe= rmissions /usr/bin/ld: warning: .tmp_vmlinux.kallsyms1.o: missing .note.GNU-stack sec= tion implies executable stack /usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a fu= ture version of the linker /usr/bin/ld: warning: .tmp_vmlinux.kallsyms2 has a LOAD segment with RWX pe= rmissions /usr/bin/ld: warning: .tmp_vmlinux.kallsyms2.o: missing .note.GNU-stack sec= tion implies executable stack /usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a fu= ture version of the linker /usr/bin/ld: warning: vmlinux has a LOAD segment with RWX permissions Link both the VDSO and vmlinux with -z noexecstack, fixing the warnings about .note.GNU-stack sections. In addition, pass --no-warn-rwx-segments to dodge the remaining warnings about LOAD segments with RWX permissions in the kallsyms objects. (Note that this flag is apparently not available on lld, so hide it behind a test for BFD, which is what the x86 patch does.) Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/co= mmit/?id=3Dffcf9c5700e49c0aee42dcba9a12ba21338e8136 Link: https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3Dba951= afb99912da01a6e8434126b8fac7aa75107 Signed-off-by: David Gow Reviewed-by: Lukas Straub Tested-by: Lukas Straub Acked-by: Randy Dunlap # build-tested Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/um/Makefile | 8 ++++++++ arch/x86/um/vdso/Makefile | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/um/Makefile b/arch/um/Makefile index f2fe63bfd819..f1d4d67157be 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -132,10 +132,18 @@ export LDS_ELF_FORMAT :=3D $(ELF_FORMAT) # The wrappers will select whether using "malloc" or the kernel allocator. LINK_WRAPS =3D -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc =20 +# Avoid binutils 2.39+ warnings by marking the stack non-executable and +# ignorning warnings for the kallsyms sections. +LDFLAGS_EXECSTACK =3D -z noexecstack +ifeq ($(CONFIG_LD_IS_BFD),y) +LDFLAGS_EXECSTACK +=3D $(call ld-option,--no-warn-rwx-segments) +endif + LD_FLAGS_CMDLINE =3D $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt)) =20 # Used by link-vmlinux.sh which has special support for um link export CFLAGS_vmlinux :=3D $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) +export LDFLAGS_vmlinux :=3D $(LDFLAGS_EXECSTACK) =20 # When cleaning we don't include .config, so we don't include # TT or skas makefiles and don't clean skas_ptregs.h. diff --git a/arch/x86/um/vdso/Makefile b/arch/x86/um/vdso/Makefile index 5943387e3f35..5ca366e15c76 100644 --- a/arch/x86/um/vdso/Makefile +++ b/arch/x86/um/vdso/Makefile @@ -62,7 +62,7 @@ quiet_cmd_vdso =3D VDSO $@ -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \ sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' =20 -VDSO_LDFLAGS =3D -fPIC -shared -Wl,--hash-style=3Dsysv +VDSO_LDFLAGS =3D -fPIC -shared -Wl,--hash-style=3Dsysv -z noexecstack GCOV_PROFILE :=3D n =20 # --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D872C433FE for ; Mon, 10 Oct 2022 07:10:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231623AbiJJHKi (ORCPT ); Mon, 10 Oct 2022 03:10:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231633AbiJJHJm (ORCPT ); Mon, 10 Oct 2022 03:09:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE2BF5BC19; Mon, 10 Oct 2022 00:06:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E2A7760E7F; Mon, 10 Oct 2022 07:06:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05FB3C433D6; Mon, 10 Oct 2022 07:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385571; bh=lGWll2ZLCWNFayanlIW957ru5Q6QTijFAVemujlKJ1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ax7uxa1Ar+A9pZzwS1lanUY3LirWvbiSeiAis2VIMaKSAKIWglfky+9hBXnriuO2m BVY7cxm8RVgCDCxK7dWQzvEJVeKwSAdOr2GygVnFKcrkKbS2DOuNmS7G9d0GidAaoT zyX5kQHEHiMBFruPxcdYypaX6ah4JV5NaFRvoK5U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 27/48] net: atlantic: fix potential memory leak in aq_ndev_close() Date: Mon, 10 Oct 2022 09:05:25 +0200 Message-Id: <20221010070334.407887127@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jianglei Nie [ Upstream commit 65e5d27df61283e5390f04b09dc79cd832f95607 ] If aq_nic_stop() fails, aq_ndev_close() returns err without calling aq_nic_deinit() to release the relevant memory and resource, which will lead to a memory leak. We can fix it by deleting the if condition judgment and goto statement to call aq_nic_deinit() directly after aq_nic_stop() to fix the memory leak. Signed-off-by: Jianglei Nie Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/aquantia/atlantic/aq_main.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net= /ethernet/aquantia/atlantic/aq_main.c index 88595863d8bc..8a0af371e7dc 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c @@ -94,11 +94,8 @@ static int aq_ndev_close(struct net_device *ndev) int err =3D 0; =20 err =3D aq_nic_stop(aq_nic); - if (err < 0) - goto err_exit; aq_nic_deinit(aq_nic, true); =20 -err_exit: return err; } =20 --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B033C433F5 for ; Mon, 10 Oct 2022 07:15:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232197AbiJJHPE (ORCPT ); Mon, 10 Oct 2022 03:15:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232094AbiJJHNK (ORCPT ); Mon, 10 Oct 2022 03:13:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 937D524084; Mon, 10 Oct 2022 00:08:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6DB93B80E62; Mon, 10 Oct 2022 07:07:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFDD0C433C1; Mon, 10 Oct 2022 07:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385647; bh=E44DQ4Za03GQzbvMam2sCoX3jPZyCievlyAL0u9o1Zc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S+PC0lsL2MmrWcbIreLDOVjjuO5I8x/e12TEPXB1ZjTPllAOcCqeDj+yzBSXzIGuc N7My4T2OfHjg3RF1qtJ+6majQMaqSBy6KHKxAD8TsYPlNDZXahj1Y3SvUPpJ+hhq7V 2J9zuMQSzGhdrl3n58pUsz2q+k1eEiZAcGFHLhww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Janis Schoetterl-Glausch , Claudio Imbrenda , Christian Borntraeger , Janosch Frank , Sasha Levin Subject: [PATCH 5.19 28/48] KVM: s390: Pass initialized arg even if unused Date: Mon, 10 Oct 2022 09:05:26 +0200 Message-Id: <20221010070334.431830252@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Janis Schoetterl-Glausch [ Upstream commit b3cefd6bf16e7234ffbd4209f6083060f4e35f59 ] This silences smatch warnings reported by kbuild bot: arch/s390/kvm/gaccess.c:859 guest_range_to_gpas() error: uninitialized symb= ol 'prot'. arch/s390/kvm/gaccess.c:1064 access_guest_with_key() error: uninitialized s= ymbol 'prot'. This is because it cannot tell that the value is not used in this case. The trans_exc* only examine prot if code is PGM_PROTECTION. Pass a dummy value for other codes. Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Janis Schoetterl-Glausch Reviewed-by: Claudio Imbrenda Link: https://lore.kernel.org/r/20220825192540.1560559-1-scgl@linux.ibm.com Signed-off-by: Christian Borntraeger Signed-off-by: Janosch Frank Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/s390/kvm/gaccess.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/s390/kvm/gaccess.c b/arch/s390/kvm/gaccess.c index 227ed0009354..0e82bf85e59b 100644 --- a/arch/s390/kvm/gaccess.c +++ b/arch/s390/kvm/gaccess.c @@ -489,6 +489,8 @@ enum prot_type { PROT_TYPE_ALC =3D 2, PROT_TYPE_DAT =3D 3, PROT_TYPE_IEP =3D 4, + /* Dummy value for passing an initialized value when code !=3D PGM_PROTEC= TION */ + PROT_NONE, }; =20 static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long= gva, u8 ar, @@ -504,6 +506,10 @@ static int trans_exc_ending(struct kvm_vcpu *vcpu, int= code, unsigned long gva, switch (code) { case PGM_PROTECTION: switch (prot) { + case PROT_NONE: + /* We should never get here, acts like termination */ + WARN_ON_ONCE(1); + break; case PROT_TYPE_IEP: tec->b61 =3D 1; fallthrough; @@ -968,8 +974,10 @@ static int guest_range_to_gpas(struct kvm_vcpu *vcpu, = unsigned long ga, u8 ar, return rc; } else { gpa =3D kvm_s390_real_to_abs(vcpu, ga); - if (kvm_is_error_gpa(vcpu->kvm, gpa)) + if (kvm_is_error_gpa(vcpu->kvm, gpa)) { rc =3D PGM_ADDRESSING; + prot =3D PROT_NONE; + } } if (rc) return trans_exc(vcpu, rc, ga, ar, mode, prot); @@ -1112,8 +1120,6 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsi= gned long ga, u8 ar, if (rc =3D=3D PGM_PROTECTION && try_storage_prot_override) rc =3D access_guest_page_with_key(vcpu->kvm, mode, gpas[idx], data, fragment_len, PAGE_SPO_ACC); - if (rc =3D=3D PGM_PROTECTION) - prot =3D PROT_TYPE_KEYC; if (rc) break; len -=3D fragment_len; @@ -1123,6 +1129,10 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, uns= igned long ga, u8 ar, if (rc > 0) { bool terminate =3D (mode =3D=3D GACC_STORE) && (idx > 0); =20 + if (rc =3D=3D PGM_PROTECTION) + prot =3D PROT_TYPE_KEYC; + else + prot =3D PROT_NONE; rc =3D trans_exc_ending(vcpu, rc, ga, ar, mode, prot, terminate); } out_unlock: --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2EA0C4332F for ; Mon, 10 Oct 2022 07:11:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231911AbiJJHLY (ORCPT ); Mon, 10 Oct 2022 03:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231855AbiJJHKl (ORCPT ); Mon, 10 Oct 2022 03:10:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC95B5E327; Mon, 10 Oct 2022 00:06:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 55F7160E08; Mon, 10 Oct 2022 07:06:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 657F0C433C1; Mon, 10 Oct 2022 07:06:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385594; bh=e1JMPfuaurNU7yamrXuJDf13lTzY2GGhqF2mchjNmik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENz83DBf9AljXaPNFbiq4ogUDMONPU34tht0OawPue0dSQT1Y2Ghxe8Eug7XZQvHX umiGayQ5bCDUrLacCQ7kS/ZMU2SAinsdGj6P4hal5bLvN3yCGOetBszMFZrQu6G3nz oKC7Ci2PqVLwZiyxD2ZToNtRLa4d0GAcdng2iDdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bhawanpreet Lakha , Wayne Lin , Leo Li , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 29/48] drm/amd/display: Fix double cursor on non-video RGB MPO Date: Mon, 10 Oct 2022 09:05:27 +0200 Message-Id: <20221010070334.456327237@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Leo Li [ Upstream commit b261509952bc19d1012cf732f853659be6ebc61e ] [Why] DC makes use of layer_index (zpos) when picking the HW plane to enable HW cursor on. However, some compositors will not attach zpos information to each DRM plane. Consequently, in amdgpu, we default layer_index to 0 and do not update it. This causes said DC logic to enable HW cursor on all planes of the same layer_index, which manifests as a double cursor issue if one of the planes is scaled (and hence scaling the cursor as well). [How] Use DRM core helpers to calculate a normalized_zpos value for each drm_plane_state under each crtc, within the atomic state. This helper will first consider existing zpos values, and if identical/unset, fallback to plane ID ordering. The normalized_zpos is then passed to dc_plane_info during atomic check for later use by the cursor logic. Reviewed-by: Bhawanpreet Lakha Acked-by: Wayne Lin Signed-off-by: Leo Li Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gp= u/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 0424570c736f..c781f92db959 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -5629,7 +5629,7 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *ade= v, plane_info->visible =3D true; plane_info->stereo_format =3D PLANE_STEREO_FORMAT_NONE; =20 - plane_info->layer_index =3D 0; + plane_info->layer_index =3D plane_state->normalized_zpos; =20 ret =3D fill_plane_color_attributes(plane_state, plane_info->format, &plane_info->color_space); @@ -5697,7 +5697,7 @@ static int fill_dc_plane_attributes(struct amdgpu_dev= ice *adev, dc_plane_state->global_alpha =3D plane_info.global_alpha; dc_plane_state->global_alpha_value =3D plane_info.global_alpha_value; dc_plane_state->dcc =3D plane_info.dcc; - dc_plane_state->layer_index =3D plane_info.layer_index; // Always returns= 0 + dc_plane_state->layer_index =3D plane_info.layer_index; dc_plane_state->flip_int_enabled =3D true; =20 /* @@ -11147,6 +11147,14 @@ static int amdgpu_dm_atomic_check(struct drm_devic= e *dev, } } =20 + /* + * DC consults the zpos (layer_index in DC terminology) to determine the + * hw plane on which to enable the hw cursor (see + * `dcn10_can_pipe_disable_cursor`). By now, all modified planes are in + * atomic state, so call drm helper to normalize zpos. + */ + drm_atomic_normalize_zpos(dev, state); + /* Remove exiting planes if they are modified */ for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new= _plane_state, i) { ret =3D dm_update_plane_state(dc, state, plane, --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC0E3C433F5 for ; Mon, 10 Oct 2022 07:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231967AbiJJHNQ (ORCPT ); Mon, 10 Oct 2022 03:13:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231214AbiJJHLr (ORCPT ); Mon, 10 Oct 2022 03:11:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96F6C5A166; Mon, 10 Oct 2022 00:07:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BBF5DB80E5E; Mon, 10 Oct 2022 07:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FA5BC433C1; Mon, 10 Oct 2022 07:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385623; bh=lPKcDtfBkw81BZ1ZRxlUP0s5ImWOvfOBFzo7y33aLBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yxa01gzVeyBP68nAmom9KKqE/sxRWZ1MoAsJNtWNB9kKz0q6TIdOoVeeb1uqgkGLN 1sWTZ6phLfgCfibBgynTSEBJRoaR55wces7Mz6rcnA1bKlFg6V8l52UMNDU+SRBA70 Dus68Bf+Jw3GHFlO99WyxivjIFMdEhkoLIK+5LWE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, George Shen , Wayne Lin , Michael Strauss , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 30/48] drm/amd/display: Assume an LTTPR is always present on fixed_vs links Date: Mon, 10 Oct 2022 09:05:28 +0200 Message-Id: <20221010070334.481514127@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Strauss [ Upstream commit 29956d0fded036a570bd8e7d4ea4b1a1730307d2 ] [WHY] LTTPRs can in very rare instsances fail to increment DPCD LTTPR count. This results in aux-i LTTPR requests to be sent to the wrong DPCD address, which causes link training failure. [HOW] Override internal repeater count if fixed_vs flag is set for a given link Reviewed-by: George Shen Acked-by: Wayne Lin Signed-off-by: Michael Strauss Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu= /drm/amd/display/dc/core/dc_link_dp.c index a4fc9a6c850e..0c52506b367d 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c @@ -5211,6 +5211,14 @@ bool dp_retrieve_lttpr_cap(struct dc_link *link) lttpr_dpcd_data[DP_PHY_REPEATER_128B132B_RATES - DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV]; =20 + /* If this chip cap is set, at least one retimer must exist in the chain + * Override count to 1 if we receive a known bad count (0 or an invalid = value) */ + if (link->chip_caps & EXT_DISPLAY_PATH_CAPS__DP_FIXED_VS_EN && + (dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt) =3D= =3D 0)) { + ASSERT(0); + link->dpcd_caps.lttpr_caps.phy_repeater_cnt =3D 0x80; + } + /* Attempt to train in LTTPR transparent mode if repeater count exceeds = 8. */ is_lttpr_present =3D (link->dpcd_caps.lttpr_caps.max_lane_count > 0 && link->dpcd_caps.lttpr_caps.max_lane_count <=3D 4 && --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B952C433F5 for ; Mon, 10 Oct 2022 07:28:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230507AbiJJH2H (ORCPT ); Mon, 10 Oct 2022 03:28:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232381AbiJJH1o (ORCPT ); Mon, 10 Oct 2022 03:27:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAEEB6B8FB; Mon, 10 Oct 2022 00:21:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 143A5B80E5C; Mon, 10 Oct 2022 07:07:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8110CC433C1; Mon, 10 Oct 2022 07:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385628; bh=uqE5ur36D/j3wyibxM/2VFbnUp+W6l2mwUdymFR+0BA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mKg52i6aDOmE3FVXk3sqUgf8IVsNrV46jF6V0H+7at3NphDDgh17RpAodQTj91wb4 TrcSbgfmo7uJtyGwhftSywVCiHKmWtki+qn5QA9S992BAt+OAP9pd2aKPIQdk+funb Za1c+7WzUJw5v09kYMG2/EAPzo5KVaFYWmJWDlSY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmytro Laktyushkin , Wayne Lin , Hugo Hu , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 31/48] drm/amd/display: update gamut remap if plane has changed Date: Mon, 10 Oct 2022 09:05:29 +0200 Message-Id: <20221010070334.506290657@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugo Hu [ Upstream commit 52bb21499cf54fa65b56d97cd0d68579c90207dd ] [Why] The desktop plane and full-screen game plane may have different gamut remap coefficients, if switching between desktop and full-screen game without updating the gamut remap will cause incorrect color. [How] Update gamut remap if planes change. Reviewed-by: Dmytro Laktyushkin Acked-by: Wayne Lin Signed-off-by: Hugo Hu Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c b/drivers/g= pu/drm/amd/display/dc/dcn20/dcn20_hwseq.c index ec6aa8d8b251..213a02a769d4 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c @@ -1520,6 +1520,7 @@ static void dcn20_update_dchubp_dpp( /* Any updates are handled in dc interface, just need * to apply existing for plane enable / opp change */ if (pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp= _changed + || pipe_ctx->update_flags.bits.plane_changed || pipe_ctx->stream->update_flags.bits.gamut_remap || pipe_ctx->stream->update_flags.bits.out_csc) { /* dpp/cm gamut remap*/ --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24A1FC433F5 for ; Mon, 10 Oct 2022 07:16:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232360AbiJJHQK (ORCPT ); Mon, 10 Oct 2022 03:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231990AbiJJHML (ORCPT ); Mon, 10 Oct 2022 03:12:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BBDC24959; Mon, 10 Oct 2022 00:08:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C3D15B80E5F; Mon, 10 Oct 2022 07:07:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2562DC433C1; Mon, 10 Oct 2022 07:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385631; bh=PEfUhnk/dHAbvQv9QPPgDLQ1toWlVdc8O27KDrIILKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cHC1iwCzr4vhGKgrwF+OANWjbg3lcmAC2U/F2KkBxauAsPO2Yfq910Yx8+UYotC0n iyAXev1z0UsWB20e2qqhWe9BAl6TpkW1stGducPpnljoq/tn0SFmzO+qTFisPqmt4J IfU4DLteJsURWvQSC+fGW6MLMMgKWtfuw3fp7a9g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charlene Liu , Wayne Lin , zhikzhai , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 32/48] drm/amd/display: skip audio setup when audio stream is enabled Date: Mon, 10 Oct 2022 09:05:30 +0200 Message-Id: <20221010070334.530528930@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: zhikzhai [ Upstream commit 65fbfb02c2734cacffec5e3f492e1b4f1dabcf98 ] [why] We have minimal pipe split transition method to avoid pipe allocation outage.However, this method will invoke audio setup which cause audio output stuck once pipe reallocate. [how] skip audio setup for pipelines which audio stream has been enabled Reviewed-by: Charlene Liu Acked-by: Wayne Lin Signed-off-by: zhikzhai Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/= drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c index aee31c785aa9..4f0ea50eaa83 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c @@ -2165,7 +2165,8 @@ static void dce110_setup_audio_dto( continue; if (pipe_ctx->stream->signal !=3D SIGNAL_TYPE_HDMI_TYPE_A) continue; - if (pipe_ctx->stream_res.audio !=3D NULL) { + if (pipe_ctx->stream_res.audio !=3D NULL && + pipe_ctx->stream_res.audio->enabled =3D=3D false) { struct audio_output audio_output; =20 build_audio_output(context, pipe_ctx, &audio_output); @@ -2207,7 +2208,8 @@ static void dce110_setup_audio_dto( if (!dc_is_dp_signal(pipe_ctx->stream->signal)) continue; =20 - if (pipe_ctx->stream_res.audio !=3D NULL) { + if (pipe_ctx->stream_res.audio !=3D NULL && + pipe_ctx->stream_res.audio->enabled =3D=3D false) { struct audio_output audio_output; =20 build_audio_output(context, pipe_ctx, &audio_output); --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17FBEC433F5 for ; Mon, 10 Oct 2022 07:14:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232010AbiJJHOO (ORCPT ); Mon, 10 Oct 2022 03:14:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231981AbiJJHMI (ORCPT ); Mon, 10 Oct 2022 03:12:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A05D121273; Mon, 10 Oct 2022 00:08:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B1FBD60AB4; Mon, 10 Oct 2022 07:07:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6DC2C433C1; Mon, 10 Oct 2022 07:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385634; bh=qBwQs3ScO9mSEiaUzW1hR+6DZafv70x1M0qGHdT/LRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eo4vjLx7ANL3Eg/esM+cwxtk1D4ItxGlJSox/rH4WS89sWCwHPyjXAk2aOkeXUVJx pKL8Fcqgnr4EmxUPFgx4j+HKfacmB/vvpfKK7HV+9ZfwotCykyLTG66cknByeWKe9y YFmiYxA8EXTRKI3bFRM+STTqmxLUG/xJqFWFWzbg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jun Lei , Wayne Lin , Cruise Hung , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 33/48] drm/amd/display: Fix DP MST timeslot issue when fallback happened Date: Mon, 10 Oct 2022 09:05:31 +0200 Message-Id: <20221010070334.554937962@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cruise Hung [ Upstream commit 20c6168b3c8aadef7d2853c925d99eb546bd5e1c ] [Why] When USB4 DP link training failed and fell back to lower link rate, the time slot calculation uses the verified_link_cap. And the verified_link_cap was not updated to the new one. It caused the wrong VC payload time-slot was allocated. [How] Updated verified_link_cap with the new one from cur_link_settings after the LT completes successfully. Reviewed-by: Jun Lei Acked-by: Wayne Lin Signed-off-by: Cruise Hung Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu= /drm/amd/display/dc/core/dc_link_dp.c index 0c52506b367d..b4203a812c4b 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c @@ -2857,8 +2857,14 @@ bool perform_link_training_with_retries( skip_video_pattern); =20 /* Transmit idle pattern once training successful. */ - if (status =3D=3D LINK_TRAINING_SUCCESS && !is_link_bw_low) + if (status =3D=3D LINK_TRAINING_SUCCESS && !is_link_bw_low) { dp_set_hw_test_pattern(link, &pipe_ctx->link_res, DP_TEST_PATTERN_VID= EO_MODE, NULL, 0); + /* Update verified link settings to current one + * Because DPIA LT might fallback to lower link setting. + */ + link->verified_link_cap.link_rate =3D link->cur_link_settings.link_ra= te; + link->verified_link_cap.lane_count =3D link->cur_link_settings.lane_c= ount; + } } else { status =3D dc_link_dp_perform_link_training(link, &pipe_ctx->link_res, --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9F17C433F5 for ; Mon, 10 Oct 2022 07:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232171AbiJJHOo (ORCPT ); Mon, 10 Oct 2022 03:14:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231929AbiJJHNB (ORCPT ); Mon, 10 Oct 2022 03:13:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8571A5EDC2; Mon, 10 Oct 2022 00:08:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4EE1560E83; Mon, 10 Oct 2022 07:07:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 638B2C433D6; Mon, 10 Oct 2022 07:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385636; bh=a9bbk+n0W6zEVK5wtX4ovn8t+np19o3n6a3wg1jiUlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IrTWebEBC6Mv83AYdPLHht6X/eDq5LDro/AVoh3akg4MgBWbFbemQ9dss2OM5P+fU 27L5G9CdV9Zuf0DnZGhKzR8rX8Pys5nSMvIEkP1IT/9I23UED5w5KgvRG8sVqN/Bdt 4HcUlSA5lz0kxVnkmGRJ6G+O6QVF0AdrbMITwo3s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jun Lei , Wayne Lin , Dmytro Laktyushkin , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 34/48] drm/amd/display: increase dcn315 pstate change latency Date: Mon, 10 Oct 2022 09:05:32 +0200 Message-Id: <20221010070334.579591246@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmytro Laktyushkin [ Upstream commit dcc2527df918edfe297c5074ccc1f05eae361ca6 ] [Why & How] Update after new measurment came in Reviewed-by: Jun Lei Acked-by: Wayne Lin Signed-off-by: Dmytro Laktyushkin Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../dc/clk_mgr/dcn315/dcn315_clk_mgr.c | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c= b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c index f4381725b210..c3d7712e9fd0 100644 --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c @@ -46,6 +46,9 @@ #define TO_CLK_MGR_DCN315(clk_mgr)\ container_of(clk_mgr, struct clk_mgr_dcn315, base) =20 +#define UNSUPPORTED_DCFCLK 10000000 +#define MIN_DPP_DISP_CLK 100000 + static int dcn315_get_active_display_cnt_wa( struct dc *dc, struct dc_state *context) @@ -146,6 +149,9 @@ static void dcn315_update_clocks(struct clk_mgr *clk_mg= r_base, } } =20 + /* Lock pstate by requesting unsupported dcfclk if change is unsupported = */ + if (!new_clocks->p_state_change_support) + new_clocks->dcfclk_khz =3D UNSUPPORTED_DCFCLK; if (should_set_clock(safe_to_lower, new_clocks->dcfclk_khz, clk_mgr_base-= >clks.dcfclk_khz)) { clk_mgr_base->clks.dcfclk_khz =3D new_clocks->dcfclk_khz; dcn315_smu_set_hard_min_dcfclk(clk_mgr, clk_mgr_base->clks.dcfclk_khz); @@ -159,10 +165,10 @@ static void dcn315_update_clocks(struct clk_mgr *clk_= mgr_base, =20 // workaround: Limit dppclk to 100Mhz to avoid lower eDP panel switch to = plus 4K monitor underflow. if (!IS_DIAG_DC(dc->ctx->dce_environment)) { - if (new_clocks->dppclk_khz < 100000) - new_clocks->dppclk_khz =3D 100000; - if (new_clocks->dispclk_khz < 100000) - new_clocks->dispclk_khz =3D 100000; + if (new_clocks->dppclk_khz < MIN_DPP_DISP_CLK) + new_clocks->dppclk_khz =3D MIN_DPP_DISP_CLK; + if (new_clocks->dispclk_khz < MIN_DPP_DISP_CLK) + new_clocks->dispclk_khz =3D MIN_DPP_DISP_CLK; } =20 if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base= .clks.dppclk_khz)) { @@ -272,7 +278,7 @@ static struct wm_table ddr5_wm_table =3D { { .wm_inst =3D WM_A, .wm_type =3D WM_TYPE_PSTATE_CHG, - .pstate_latency_us =3D 64.0, + .pstate_latency_us =3D 129.0, .sr_exit_time_us =3D 11.5, .sr_enter_plus_exit_time_us =3D 14.5, .valid =3D true, @@ -280,7 +286,7 @@ static struct wm_table ddr5_wm_table =3D { { .wm_inst =3D WM_B, .wm_type =3D WM_TYPE_PSTATE_CHG, - .pstate_latency_us =3D 64.0, + .pstate_latency_us =3D 129.0, .sr_exit_time_us =3D 11.5, .sr_enter_plus_exit_time_us =3D 14.5, .valid =3D true, @@ -288,7 +294,7 @@ static struct wm_table ddr5_wm_table =3D { { .wm_inst =3D WM_C, .wm_type =3D WM_TYPE_PSTATE_CHG, - .pstate_latency_us =3D 64.0, + .pstate_latency_us =3D 129.0, .sr_exit_time_us =3D 11.5, .sr_enter_plus_exit_time_us =3D 14.5, .valid =3D true, @@ -296,7 +302,7 @@ static struct wm_table ddr5_wm_table =3D { { .wm_inst =3D WM_D, .wm_type =3D WM_TYPE_PSTATE_CHG, - .pstate_latency_us =3D 64.0, + .pstate_latency_us =3D 129.0, .sr_exit_time_us =3D 11.5, .sr_enter_plus_exit_time_us =3D 14.5, .valid =3D true, --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA48FC4332F for ; Mon, 10 Oct 2022 07:15:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232229AbiJJHPU (ORCPT ); Mon, 10 Oct 2022 03:15:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232137AbiJJHNc (ORCPT ); Mon, 10 Oct 2022 03:13:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FDBEDA; Mon, 10 Oct 2022 00:08:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D84E860E08; Mon, 10 Oct 2022 07:07:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F21DDC433D6; Mon, 10 Oct 2022 07:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385639; bh=wECgCqn284g2WLAFZTD5CT6LRDXaFqK+ZymroE7rTwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lGL5u8/hucUCP+Gf4NgHBu9V6oOJwSIPgBWOcjAgDjCI35mSwGtKijqs9ZMS3Np1y llHM38NwDNJdPslPaSBZ/Mj565gBYTeCNaNYcd9XrmwDF8KrsqmfHKnM4NtArJURrM V1lvJZQdWeDSOqxnxKi9Qbm0FIjIP9BfpVJs/290= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianfeng Gao , "Peter Zijlstra (Intel)" , Kan Liang , Sasha Levin Subject: [PATCH 5.19 35/48] perf/x86/intel: Fix unchecked MSR access error for Alder Lake N Date: Mon, 10 Oct 2022 09:05:33 +0200 Message-Id: <20221010070334.605467137@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kan Liang [ Upstream commit 24919fdea6f8b31d7cdf32ac291bc5dd0b023878 ] For some Alder Lake N machine, the below unchecked MSR access error may be triggered. [ 0.088017] rcu: Hierarchical SRCU implementation. [ 0.088017] unchecked MSR access error: WRMSR to 0x38f (tried to write 0x0001000f0000003f) at rIP: 0xffffffffb5684de8 (native_write_msr+0x8/0x30) [ 0.088017] Call Trace: [ 0.088017] [ 0.088017] __intel_pmu_enable_all.constprop.46+0x4a/0xa0 The Alder Lake N only has e-cores. The X86_FEATURE_HYBRID_CPU flag is not set. The perf cannot retrieve the correct CPU type via get_this_hybrid_cpu_type(). The model specific get_hybrid_cpu_type() is hardcode to p-core. The wrong CPU type is given to the PMU of the Alder Lake N. Since Alder Lake N isn't in fact a hybrid CPU, remove ALDERLAKE_N from the rest of {ALDER,RAPTOP}LAKE and create a non-hybrid PMU setup. The differences between Gracemont and the previous Tremont are, - Number of GP counters - Load and store latency Events - PEBS event_constraints - Instruction Latency support - Data source encoding - Memory access latency encoding Fixes: c2a960f7c574 ("perf/x86: Add new Alder Lake and Raptor Lake support") Reported-by: Jianfeng Gao Suggested-by: Peter Zijlstra (Intel) Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20220831142702.153110-1-kan.liang@linux.int= el.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/events/intel/core.c | 40 +++++++++++++++++++++++++++++++++++- arch/x86/events/intel/ds.c | 9 ++++++-- arch/x86/events/perf_event.h | 2 ++ 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index bd8b98857609..8d6befb24b8e 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -2101,6 +2101,15 @@ static struct extra_reg intel_tnt_extra_regs[] __rea= d_mostly =3D { EVENT_EXTRA_END }; =20 +EVENT_ATTR_STR(mem-loads, mem_ld_grt, "event=3D0xd0,umask=3D0x5,ldlat=3D3"= ); +EVENT_ATTR_STR(mem-stores, mem_st_grt, "event=3D0xd0,umask=3D0x6"); + +static struct attribute *grt_mem_attrs[] =3D { + EVENT_PTR(mem_ld_grt), + EVENT_PTR(mem_st_grt), + NULL +}; + static struct extra_reg intel_grt_extra_regs[] __read_mostly =3D { /* must define OFFCORE_RSP_X first, see intel_fixup_er() */ INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x3fffffffffull, RSP_0), @@ -5874,6 +5883,36 @@ __init int intel_pmu_init(void) name =3D "Tremont"; break; =20 + case INTEL_FAM6_ALDERLAKE_N: + x86_pmu.mid_ack =3D true; + memcpy(hw_cache_event_ids, glp_hw_cache_event_ids, + sizeof(hw_cache_event_ids)); + memcpy(hw_cache_extra_regs, tnt_hw_cache_extra_regs, + sizeof(hw_cache_extra_regs)); + hw_cache_event_ids[C(ITLB)][C(OP_READ)][C(RESULT_ACCESS)] =3D -1; + + x86_pmu.event_constraints =3D intel_slm_event_constraints; + x86_pmu.pebs_constraints =3D intel_grt_pebs_event_constraints; + x86_pmu.extra_regs =3D intel_grt_extra_regs; + + x86_pmu.pebs_aliases =3D NULL; + x86_pmu.pebs_prec_dist =3D true; + x86_pmu.pebs_block =3D true; + x86_pmu.lbr_pt_coexist =3D true; + x86_pmu.flags |=3D PMU_FL_HAS_RSP_1; + x86_pmu.flags |=3D PMU_FL_INSTR_LATENCY; + + intel_pmu_pebs_data_source_grt(); + x86_pmu.pebs_latency_data =3D adl_latency_data_small; + x86_pmu.get_event_constraints =3D tnt_get_event_constraints; + x86_pmu.limit_period =3D spr_limit_period; + td_attr =3D tnt_events_attrs; + mem_attr =3D grt_mem_attrs; + extra_attr =3D nhm_format_attr; + pr_cont("Gracemont events, "); + name =3D "gracemont"; + break; + case INTEL_FAM6_WESTMERE: case INTEL_FAM6_WESTMERE_EP: case INTEL_FAM6_WESTMERE_EX: @@ -6216,7 +6255,6 @@ __init int intel_pmu_init(void) =20 case INTEL_FAM6_ALDERLAKE: case INTEL_FAM6_ALDERLAKE_L: - case INTEL_FAM6_ALDERLAKE_N: case INTEL_FAM6_RAPTORLAKE: case INTEL_FAM6_RAPTORLAKE_P: /* diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 9b48d957d2b3..139204aea94e 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -110,13 +110,18 @@ void __init intel_pmu_pebs_data_source_skl(bool pmem) __intel_pmu_pebs_data_source_skl(pmem, pebs_data_source); } =20 -static void __init intel_pmu_pebs_data_source_grt(u64 *data_source) +static void __init __intel_pmu_pebs_data_source_grt(u64 *data_source) { data_source[0x05] =3D OP_LH | P(LVL, L3) | LEVEL(L3) | P(SNOOP, HIT); data_source[0x06] =3D OP_LH | P(LVL, L3) | LEVEL(L3) | P(SNOOP, HITM); data_source[0x08] =3D OP_LH | P(LVL, L3) | LEVEL(L3) | P(SNOOPX, FWD); } =20 +void __init intel_pmu_pebs_data_source_grt(void) +{ + __intel_pmu_pebs_data_source_grt(pebs_data_source); +} + void __init intel_pmu_pebs_data_source_adl(void) { u64 *data_source; @@ -127,7 +132,7 @@ void __init intel_pmu_pebs_data_source_adl(void) =20 data_source =3D x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX].pebs_data_sou= rce; memcpy(data_source, pebs_data_source, sizeof(pebs_data_source)); - intel_pmu_pebs_data_source_grt(data_source); + __intel_pmu_pebs_data_source_grt(data_source); } =20 static u64 precise_store_data(u64 status) diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index 821098aebf78..84f6f947ddef 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -1513,6 +1513,8 @@ void intel_pmu_pebs_data_source_skl(bool pmem); =20 void intel_pmu_pebs_data_source_adl(void); =20 +void intel_pmu_pebs_data_source_grt(void); + int intel_pmu_setup_lbr_filter(struct perf_event *event); =20 void intel_pt_interrupt(void); --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23D45C433F5 for ; Mon, 10 Oct 2022 07:12:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231829AbiJJHMG (ORCPT ); Mon, 10 Oct 2022 03:12:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231897AbiJJHLO (ORCPT ); Mon, 10 Oct 2022 03:11:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94BBF2317A; Mon, 10 Oct 2022 00:07:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 336C2B80E60; Mon, 10 Oct 2022 07:07:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ED94C433C1; Mon, 10 Oct 2022 07:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385641; bh=YoajUM20gTB4qwbFyiuAFKO4hfeAyGhn+vIsU9/vtJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l1nSo6a2FEKSf1dwCrlPpH9n11YbskN8kNiN+TiUGpFSUXhohA0CCs1PmNNm+lEwO iix9/pHknO09RA3+9zoFXfGtrYIi8yVTAPdgb43Xgx1585Gc6r5SEm7KAQmQxSE174 4pOtxNb8v7nKsJsG+6TjzotCAwRm0mTn7Yn8zK94= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Sasha Levin Subject: [PATCH 5.19 36/48] [coredump] dont use __kernel_write() on kmap_local_page() Date: Mon, 10 Oct 2022 09:05:34 +0200 Message-Id: <20221010070334.630261714@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro [ Upstream commit 06bbaa6dc53cb72040db952053432541acb9adc7 ] passing kmap_local_page() result to __kernel_write() is unsafe - random ->write_iter() might (and 9p one does) get unhappy when passed ITER_KVEC with pointer that came from kmap_local_page(). Fix by providing a variant of __kernel_write() that takes an iov_iter from caller (__kernel_write() becomes a trivial wrapper) and adding dump_emit_page() that parallels dump_emit(), except that instead of __kernel_write() it uses __kernel_write_iter() with ITER_BVEC source. Fixes: 3159ed57792b "fs/coredump: use kmap_local_page()" Signed-off-by: Al Viro Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/coredump.c | 38 +++++++++++++++++++++++++++++++++----- fs/internal.h | 3 +++ fs/read_write.c | 22 ++++++++++++++-------- 3 files changed, 50 insertions(+), 13 deletions(-) diff --git a/fs/coredump.c b/fs/coredump.c index ebc43f960b64..f1355e52614a 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -832,6 +832,38 @@ static int __dump_skip(struct coredump_params *cprm, s= ize_t nr) } } =20 +static int dump_emit_page(struct coredump_params *cprm, struct page *page) +{ + struct bio_vec bvec =3D { + .bv_page =3D page, + .bv_offset =3D 0, + .bv_len =3D PAGE_SIZE, + }; + struct iov_iter iter; + struct file *file =3D cprm->file; + loff_t pos =3D file->f_pos; + ssize_t n; + + if (cprm->to_skip) { + if (!__dump_skip(cprm, cprm->to_skip)) + return 0; + cprm->to_skip =3D 0; + } + if (cprm->written + PAGE_SIZE > cprm->limit) + return 0; + if (dump_interrupted()) + return 0; + iov_iter_bvec(&iter, WRITE, &bvec, 1, PAGE_SIZE); + n =3D __kernel_write_iter(cprm->file, &iter, &pos); + if (n !=3D PAGE_SIZE) + return 0; + file->f_pos =3D pos; + cprm->written +=3D PAGE_SIZE; + cprm->pos +=3D PAGE_SIZE; + + return 1; +} + int dump_emit(struct coredump_params *cprm, const void *addr, int nr) { if (cprm->to_skip) { @@ -863,7 +895,6 @@ int dump_user_range(struct coredump_params *cprm, unsig= ned long start, =20 for (addr =3D start; addr < start + len; addr +=3D PAGE_SIZE) { struct page *page; - int stop; =20 /* * To avoid having to allocate page tables for virtual address @@ -874,10 +905,7 @@ int dump_user_range(struct coredump_params *cprm, unsi= gned long start, */ page =3D get_dump_page(addr); if (page) { - void *kaddr =3D kmap_local_page(page); - - stop =3D !dump_emit(cprm, kaddr, PAGE_SIZE); - kunmap_local(kaddr); + int stop =3D !dump_emit_page(cprm, page); put_page(page); if (stop) return 0; diff --git a/fs/internal.h b/fs/internal.h index 87e96b9024ce..3e206d3e317c 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -16,6 +16,7 @@ struct shrink_control; struct fs_context; struct user_namespace; struct pipe_inode_info; +struct iov_iter; =20 /* * block/bdev.c @@ -221,3 +222,5 @@ ssize_t do_getxattr(struct user_namespace *mnt_userns, int setxattr_copy(const char __user *name, struct xattr_ctx *ctx); int do_setxattr(struct user_namespace *mnt_userns, struct dentry *dentry, struct xattr_ctx *ctx); + +ssize_t __kernel_write_iter(struct file *file, struct iov_iter *from, loff= _t *pos); diff --git a/fs/read_write.c b/fs/read_write.c index 397da0236607..a0a3d35e2c0f 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -509,14 +509,9 @@ static ssize_t new_sync_write(struct file *filp, const= char __user *buf, size_t } =20 /* caller is responsible for file_start_write/file_end_write */ -ssize_t __kernel_write(struct file *file, const void *buf, size_t count, l= off_t *pos) +ssize_t __kernel_write_iter(struct file *file, struct iov_iter *from, loff= _t *pos) { - struct kvec iov =3D { - .iov_base =3D (void *)buf, - .iov_len =3D min_t(size_t, count, MAX_RW_COUNT), - }; struct kiocb kiocb; - struct iov_iter iter; ssize_t ret; =20 if (WARN_ON_ONCE(!(file->f_mode & FMODE_WRITE))) @@ -532,8 +527,7 @@ ssize_t __kernel_write(struct file *file, const void *b= uf, size_t count, loff_t =20 init_sync_kiocb(&kiocb, file); kiocb.ki_pos =3D pos ? *pos : 0; - iov_iter_kvec(&iter, WRITE, &iov, 1, iov.iov_len); - ret =3D file->f_op->write_iter(&kiocb, &iter); + ret =3D file->f_op->write_iter(&kiocb, from); if (ret > 0) { if (pos) *pos =3D kiocb.ki_pos; @@ -543,6 +537,18 @@ ssize_t __kernel_write(struct file *file, const void *= buf, size_t count, loff_t inc_syscw(current); return ret; } + +/* caller is responsible for file_start_write/file_end_write */ +ssize_t __kernel_write(struct file *file, const void *buf, size_t count, l= off_t *pos) +{ + struct kvec iov =3D { + .iov_base =3D (void *)buf, + .iov_len =3D min_t(size_t, count, MAX_RW_COUNT), + }; + struct iov_iter iter; + iov_iter_kvec(&iter, WRITE, &iov, 1, iov.iov_len); + return __kernel_write_iter(file, &iter, pos); +} /* * This "EXPORT_SYMBOL_GPL()" is more of a "EXPORT_SYMBOL_DONTUSE()", * but autofs is one of the few internal kernel users that actually --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7456C433F5 for ; Mon, 10 Oct 2022 07:12:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231995AbiJJHMR (ORCPT ); Mon, 10 Oct 2022 03:12:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231704AbiJJHLT (ORCPT ); Mon, 10 Oct 2022 03:11:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97D9E5E575; Mon, 10 Oct 2022 00:07:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CF66DB80E5D; Mon, 10 Oct 2022 07:07:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3367BC433C1; Mon, 10 Oct 2022 07:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385644; bh=ChhT3O4/jVJQsfuVPoIwoEQwBds6ECYEVClaA463q7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ST1Y3aEv+5ZIjc5GbWz/sVllqqa3xZVpkYT25+1e/yXOs+fj+VcpHF9Qp1GQMGv2X 19KVXMV5HFShWewp3RsR6KpJt/6yWcNuVM5Ds2C6w8hyCzNjl0nBRtOFVhV7sHXFQe O3iWyEhuLI9sa3QC/Yp3QjoxN7VNOiNERO1tioS8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Bartosz Golaszewski , Wolfram Sang , Sasha Levin Subject: [PATCH 5.19 37/48] i2c: davinci: fix PM disable depth imbalance in davinci_i2c_probe Date: Mon, 10 Oct 2022 09:05:35 +0200 Message-Id: <20221010070334.656210536@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Qilong [ Upstream commit e2062df704dea47efe16edcaa2316d7b5ecca64f ] The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. Fixes: 17f88151ff190 ("i2c: davinci: Add PM Runtime Support") Signed-off-by: Zhang Qilong Reviewed-by: Bartosz Golaszewski Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-davinci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davi= nci.c index 9e09db31a937..5343c82c8594 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -823,7 +823,7 @@ static int davinci_i2c_probe(struct platform_device *pd= ev) r =3D pm_runtime_resume_and_get(dev->dev); if (r < 0) { dev_err(dev->dev, "failed to runtime_get device: %d\n", r); - return r; + goto err_pm; } =20 i2c_davinci_init(dev); @@ -882,6 +882,7 @@ static int davinci_i2c_probe(struct platform_device *pd= ev) err_unuse_clocks: pm_runtime_dont_use_autosuspend(dev->dev); pm_runtime_put_sync(dev->dev); +err_pm: pm_runtime_disable(dev->dev); =20 return r; --=20 2.35.1 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F270CC433F5 for ; Mon, 10 Oct 2022 07:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231915AbiJJHL2 (ORCPT ); Mon, 10 Oct 2022 03:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231861AbiJJHKr (ORCPT ); Mon, 10 Oct 2022 03:10:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C0E25E561; Mon, 10 Oct 2022 00:07:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E24E360E8D; Mon, 10 Oct 2022 07:06:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3481C433C1; Mon, 10 Oct 2022 07:06:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385597; bh=xxDHkhWXn9LWoUKnTOuFYR63Zphxmul0hUMh47XisPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W8fhaA6jRT6jXhXu4s0jWe9JkJm12b/Xay8c5MxggkgRo3WmBTfV8h5LP1berUzQH D5KeCZvBZHQALq7+oywxmIPRVcfoeoBJ+bRY4q3sH8dxnQW2qddX4Vb9QOCpOype2b 0sel6qyRCQBQXwaCSg5TI8YpxSORhSQVIu71qGxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Dmitry Vyukov" , stable , syzbot+23f57c5ae902429285d7@syzkaller.appspotmail.com, Tadeusz Struk , PaX Team Subject: [PATCH 5.19 38/48] usb: mon: make mmapped memory read only Date: Mon, 10 Oct 2022 09:05:36 +0200 Message-Id: <20221010070334.682322724@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tadeusz Struk commit a659daf63d16aa883be42f3f34ff84235c302198 upstream. Syzbot found an issue in usbmon module, where the user space client can corrupt the monitor's internal memory, causing the usbmon module to crash the kernel with segfault, UAF, etc. The reproducer mmaps the /dev/usbmon memory to user space, and overwrites it with arbitrary data, which causes all kinds of issues. Return an -EPERM error from mon_bin_mmap() if the flag VM_WRTIE is set. Also clear VM_MAYWRITE to make it impossible to change it to writable later. Cc: "Dmitry Vyukov" Cc: stable Fixes: 6f23ee1fefdc ("USB: add binary API to usbmon") Suggested-by: PaX Team # for the VM_MAYRITE portion Link: https://syzkaller.appspot.com/bug?id=3D2eb1f35d6525fa4a74d75b4244971e= 5b1411c95a Reported-by: syzbot+23f57c5ae902429285d7@syzkaller.appspotmail.com Signed-off-by: Tadeusz Struk Link: https://lore.kernel.org/r/20220919215957.205681-1-tadeusz.struk@linar= o.org Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/mon/mon_bin.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/usb/mon/mon_bin.c +++ b/drivers/usb/mon/mon_bin.c @@ -1268,6 +1268,11 @@ static int mon_bin_mmap(struct file *fil { /* don't do anything here: "fault" will set up page table entries */ vma->vm_ops =3D &mon_bin_vm_ops; + + if (vma->vm_flags & VM_WRITE) + return -EPERM; + + vma->vm_flags &=3D ~VM_MAYWRITE; vma->vm_flags |=3D VM_DONTEXPAND | VM_DONTDUMP; vma->vm_private_data =3D filp->private_data; mon_bin_vma_open(vma); From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08883C433FE for ; Mon, 10 Oct 2022 07:11:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231928AbiJJHLg (ORCPT ); Mon, 10 Oct 2022 03:11:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231811AbiJJHLE (ORCPT ); Mon, 10 Oct 2022 03:11:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A43B1F624; Mon, 10 Oct 2022 00:07:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 32CBEB80E56; Mon, 10 Oct 2022 07:06:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AD81C433C1; Mon, 10 Oct 2022 07:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385600; bh=z6OsWk08vLGcLmceY4PxP1JeS2qoz8/BVeiey1XblsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i0pCH6oLE31y2C8I34vt7nd/r3M/QYlQEGxBCQayowu8D0azxyiTlFu8K6P11T/o6 kpky3yE5XRunXzoaW7pnOBfNZjs2tfAhj66ywe6s5E19SBT9t8S70w2lrq5Oyn9eoL HsPy17Te8UP68a6DqC6nUyICZNuBquVIAWC/5tJE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 5.19 39/48] USB: serial: ftdi_sio: fix 300 bps rate for SIO Date: Mon, 10 Oct 2022 09:05:37 +0200 Message-Id: <20221010070334.708320765@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 7bd7ad3c310cd6766f170927381eea0aa6f46c69 upstream. The 300 bps rate of SIO devices has been mapped to 9600 bps since 2003... Let's fix the regression. Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/serial/ftdi_sio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1319,8 +1319,7 @@ static u32 get_ftdi_divisor(struct tty_s case 38400: div_value =3D ftdi_sio_b38400; break; case 57600: div_value =3D ftdi_sio_b57600; break; case 115200: div_value =3D ftdi_sio_b115200; break; - } /* baud */ - if (div_value =3D=3D 0) { + default: dev_dbg(dev, "%s - Baudrate (%d) requested is not supported\n", __func__, baud); div_value =3D ftdi_sio_b9600; From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FF81C433F5 for ; Mon, 10 Oct 2022 07:12:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232005AbiJJHMV (ORCPT ); Mon, 10 Oct 2022 03:12:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231848AbiJJHLW (ORCPT ); Mon, 10 Oct 2022 03:11:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43C4622BFA; Mon, 10 Oct 2022 00:07:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E1C7BB80E5A; Mon, 10 Oct 2022 07:06:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C39EC433C1; Mon, 10 Oct 2022 07:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385602; bh=mtBG7YbGLH+hzkVaeIuOFkvDxRFlNPWGo/GBstJHbe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YDBXPivQCYwfvZ5Nv31KQw0miYi4KOC6lBMokrpuHAy6P+bIyFrj3yCULTSIlz5pP +bF2/7mQIj+U5DkOsvvDsLtSYbZcO3P07q74GGxRQJbtQu+YfEqT/mpBi2meKmf8M5 oOXPEQefnW0zN6R4tx9mRDSwpteudGsWg7xmFbJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , Hans de Goede , Mika Westerberg , Andy Shevchenko Subject: [PATCH 5.19 40/48] gpiolib: acpi: Add support to ignore programming an interrupt Date: Mon, 10 Oct 2022 09:05:38 +0200 Message-Id: <20221010070334.735457362@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mario Limonciello commit 6b6af7bd5718f4e45a9b930533aec1158387d552 upstream. gpiolib-acpi already had support for ignoring a pin for wakeup, but if an OEM configures a floating pin as an interrupt source then stopping it from being a wakeup won't do much good to stop the interrupt storm. Add support for a module parameter and quirk infrastructure to ignore interrupts as well. Signed-off-by: Mario Limonciello Reviewed-by: Hans de Goede Reviewed-by: Mika Westerberg Signed-off-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpio/gpiolib-acpi.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -32,9 +32,16 @@ MODULE_PARM_DESC(ignore_wake, "controller@pin combos on which to ignore the ACPI wake flag " "ignore_wake=3Dcontroller@pin[,controller@pin[,...]]"); =20 +static char *ignore_interrupt; +module_param(ignore_interrupt, charp, 0444); +MODULE_PARM_DESC(ignore_interrupt, + "controller@pin combos on which to ignore interrupt " + "ignore_interrupt=3Dcontroller@pin[,controller@pin[,...]]"); + struct acpi_gpiolib_dmi_quirk { bool no_edge_events_on_boot; char *ignore_wake; + char *ignore_interrupt; }; =20 /** @@ -317,14 +324,15 @@ static struct gpio_desc *acpi_request_ow return desc; } =20 -static bool acpi_gpio_in_ignore_list(const char *controller_in, unsigned i= nt pin_in) +static bool acpi_gpio_in_ignore_list(const char *ignore_list, const char *= controller_in, + unsigned int pin_in) { const char *controller, *pin_str; unsigned int pin; char *endp; int len; =20 - controller =3D ignore_wake; + controller =3D ignore_list; while (controller) { pin_str =3D strchr(controller, '@'); if (!pin_str) @@ -348,7 +356,7 @@ static bool acpi_gpio_in_ignore_list(con =20 return false; err: - pr_err_once("Error: Invalid value for gpiolib_acpi.ignore_wake: %s\n", ig= nore_wake); + pr_err_once("Error: Invalid value for gpiolib_acpi.ignore_...: %s\n", ign= ore_list); return false; } =20 @@ -360,7 +368,7 @@ static bool acpi_gpio_irq_is_wake(struct if (agpio->wake_capable !=3D ACPI_WAKE_CAPABLE) return false; =20 - if (acpi_gpio_in_ignore_list(dev_name(parent), pin)) { + if (acpi_gpio_in_ignore_list(ignore_wake, dev_name(parent), pin)) { dev_info(parent, "Ignoring wakeup on pin %u\n", pin); return false; } @@ -427,6 +435,11 @@ static acpi_status acpi_gpiochip_alloc_e goto fail_unlock_irq; } =20 + if (acpi_gpio_in_ignore_list(ignore_interrupt, dev_name(chip->parent), pi= n)) { + dev_info(chip->parent, "Ignoring interrupt on pin %u\n", pin); + return AE_OK; + } + event =3D kzalloc(sizeof(*event), GFP_KERNEL); if (!event) goto fail_unlock_irq; @@ -1582,6 +1595,9 @@ static int __init acpi_gpio_setup_params if (ignore_wake =3D=3D NULL && quirk && quirk->ignore_wake) ignore_wake =3D quirk->ignore_wake; =20 + if (ignore_interrupt =3D=3D NULL && quirk && quirk->ignore_interrupt) + ignore_interrupt =3D quirk->ignore_interrupt; + return 0; } From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A286C433FE for ; Mon, 10 Oct 2022 07:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231940AbiJJHLk (ORCPT ); Mon, 10 Oct 2022 03:11:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231719AbiJJHLH (ORCPT ); Mon, 10 Oct 2022 03:11:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB6935D0C3; Mon, 10 Oct 2022 00:07:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B27C660E74; Mon, 10 Oct 2022 07:06:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6C7FC433D6; Mon, 10 Oct 2022 07:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385605; bh=TVmifSLd598vBmFBbOOzT6/vPAVc43mXl5Lyo9GcfsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R6EccrxsrIfWexeNBak+tUlhlOvw31noaVivhkRPNRapYeka35cmLJ+N/tVbtj+xJ 3Kh518AKqzz0fCK/oT70aHV+UZQdu/DJKUkPhin/3BvW3pbTsxCuq6bzYHtw31Wqfj xstd0H89p9HWS3dXSR3fCiSqnmPiI3PK1eayUxQo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Krc , Hans de Goede , Mario Limonciello , Mika Westerberg , Andy Shevchenko Subject: [PATCH 5.19 41/48] gpiolib: acpi: Add a quirk for Asus UM325UAZ Date: Mon, 10 Oct 2022 09:05:39 +0200 Message-Id: <20221010070334.761150427@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mario Limonciello commit 0ea76c401f9245ac209f1b1ce03a7e1fb9de36e5 upstream. Asus UM325UAZ has GPIO 18 programmed as both an interrupt and a wake source, but confirmed with internal team on this design this pin is floating and shouldn't have been programmed. This causes lots of spurious IRQs on the system and horrendous battery life. Add a quirk to ignore attempts to program this pin on this system. Reported-by: Pavel Krc Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216208 Reviewed-by: Hans de Goede Signed-off-by: Mario Limonciello Reviewed-by: Mika Westerberg Signed-off-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpio/gpiolib-acpi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -1573,6 +1573,20 @@ static const struct dmi_system_id gpioli .ignore_wake =3D "INT33FF:01@0", }, }, + { + /* + * Interrupt storm caused from edge triggered floating pin + * Found in BIOS UX325UAZ.300 + * https://bugzilla.kernel.org/show_bug.cgi?id=3D216208 + */ + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UAZ_UM325UAZ"), + }, + .driver_data =3D &(struct acpi_gpiolib_dmi_quirk) { + .ignore_interrupt =3D "AMDI0030:00@18", + }, + }, {} /* Terminating entry */ }; From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E923DC433FE for ; Mon, 10 Oct 2022 07:12:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231987AbiJJHML (ORCPT ); Mon, 10 Oct 2022 03:12:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231658AbiJJHLP (ORCPT ); Mon, 10 Oct 2022 03:11:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A0611FCE7; Mon, 10 Oct 2022 00:07:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E24B6B80E4B; Mon, 10 Oct 2022 07:06:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5925DC433D6; Mon, 10 Oct 2022 07:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385607; bh=midXV7+XviSEoQHJ4KH9W7HgxeAwRxXmZXtAgHfw7P4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y0gvCQXxg0yUhkxIeLRzpuleUk2Q1/Vrsg+P1kzMly2NzbKTJ9UQVhrpVahCuf8ub XmxInxNwTCltuL2GVL3+6QGEqA8CQstekm+ER4ZVL/L36PZQWmLTGEHSelJ4ga696v tIfVOj9GiNzKdtaVWxkPLJ/KO9iZI2p2A9W4Hexo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, ChanWoo Lee , Linus Walleij , Ulf Hansson , Brian Norris Subject: [PATCH 5.19 42/48] mmc: core: Replace with already defined values for readability Date: Mon, 10 Oct 2022 09:05:40 +0200 Message-Id: <20221010070334.787214739@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: ChanWoo Lee commit e427266460826bea21b70f9b2bb29decfb2c2620 upstream. SD_ROCR_S18A is already defined and is used to check the rocr value, so let's replace with already defined values for readability. Signed-off-by: ChanWoo Lee Reviewed-by: Linus Walleij Link: https://lore.kernel.org/r/20220706004840.24812-1-cw9316.lee@samsung.c= om Signed-off-by: Ulf Hansson Signed-off-by: Brian Norris Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mmc/core/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -870,7 +870,7 @@ try_again: * the CCS bit is set as well. We deliberately deviate from the spec in * regards to this, which allows UHS-I to be supported for SDSC cards. */ - if (!mmc_host_is_spi(host) && rocr && (*rocr & 0x01000000)) { + if (!mmc_host_is_spi(host) && rocr && (*rocr & SD_ROCR_S18A)) { err =3D mmc_set_uhs_voltage(host, pocr); if (err =3D=3D -EAGAIN) { retries--; From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4258C4332F for ; Mon, 10 Oct 2022 07:11:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231947AbiJJHLl (ORCPT ); Mon, 10 Oct 2022 03:11:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231751AbiJJHLL (ORCPT ); Mon, 10 Oct 2022 03:11:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0820C10062; Mon, 10 Oct 2022 00:07:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CFC8860E7F; Mon, 10 Oct 2022 07:06:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E344BC433D7; Mon, 10 Oct 2022 07:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385610; bh=BObix2i7mUZ+lMAmfQwJ48HjJ9ZIzJkF5djtyduVrOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yAZFUKzv+eS6zxtWGb2z37ptFcBlTnEF07fLKYrpMk3OoDjqW4eNlKrmF5a/J5P9y cUE4yWHgK3jarQC562+foZIvHet9kytzsmjrxYJLROE4UouKX1jbh4791RboyknAdh MEancDFR4SC5BlFBVAhMIP4QQEt13MhPfXa3qlBQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Guenter Roeck , Ulf Hansson Subject: [PATCH 5.19 43/48] mmc: core: Terminate infinite loop in SD-UHS voltage switch Date: Mon, 10 Oct 2022 09:05:41 +0200 Message-Id: <20221010070334.814015235@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 e9233917a7e53980664efbc565888163c0a33c3f upstream. This loop intends to retry a max of 10 times, with some implicit termination based on the SD_{R,}OCR_S18A bit. Unfortunately, the termination condition depends on the value reported by the SD card (*rocr), which may or may not correctly reflect what we asked it to do. Needless to say, it's not wise to rely on the card doing what we expect; we should at least terminate the loop regardless. So, check both the input and output values, so we ensure we will terminate regardless of the SD card behavior. Note that SDIO learned a similar retry loop in commit 0797e5f1453b ("mmc: core: Fixup signal voltage switch"), but that used the 'ocr' result, and so the current pre-terminating condition looks like: rocr & ocr & R4_18V_PRESENT (i.e., it doesn't have the same bug.) This addresses a number of crash reports seen on ChromeOS that look like the following: ... // lots of repeated: ... <4>[13142.846061] mmc1: Skipping voltage switch <4>[13143.406087] mmc1: Skipping voltage switch <4>[13143.964724] mmc1: Skipping voltage switch <4>[13144.526089] mmc1: Skipping voltage switch <4>[13145.086088] mmc1: Skipping voltage switch <4>[13145.645941] mmc1: Skipping voltage switch <3>[13146.153969] INFO: task halt:30352 blocked for more than 122 secon= ds. ... Fixes: f2119df6b764 ("mmc: sd: add support for signal voltage switch proced= ure") Cc: Signed-off-by: Brian Norris Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220914014010.2076169-1-briannorris@chromi= um.org Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mmc/core/sd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -870,7 +870,8 @@ try_again: * the CCS bit is set as well. We deliberately deviate from the spec in * regards to this, which allows UHS-I to be supported for SDSC cards. */ - if (!mmc_host_is_spi(host) && rocr && (*rocr & SD_ROCR_S18A)) { + if (!mmc_host_is_spi(host) && (ocr & SD_OCR_S18R) && + rocr && (*rocr & SD_ROCR_S18A)) { err =3D mmc_set_uhs_voltage(host, pocr); if (err =3D=3D -EAGAIN) { retries--; From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F8A5C433F5 for ; Mon, 10 Oct 2022 07:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232081AbiJJHM5 (ORCPT ); Mon, 10 Oct 2022 03:12:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231929AbiJJHLh (ORCPT ); Mon, 10 Oct 2022 03:11:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 671B05E32F; Mon, 10 Oct 2022 00:07:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 33A10B80E4D; Mon, 10 Oct 2022 07:06:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86FFCC433C1; Mon, 10 Oct 2022 07:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385612; bh=90/blYXxXJRenRo89LmvK56791FwHNMYvbbFV3JBiOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=APMmTADk0pce4Lvl1aqWnrfaC6CJSZvTvh0yCHOcgV4pjP+ERQyERwvzNyioC28ec 3sK0n4xr4eKUgohjmT0KVpY5Juz+gQmmy26Q8RyuHKLHeHMgWWJ/2QQ5uZfKStqVmP gZ66fVJPPzC2t1JVcFKjcOAT/NkB6230ThcqZHOc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Stephen Boyd , Bjorn Andersson , Andrew Chernyakov Subject: [PATCH 5.19 44/48] rpmsg: qcom: glink: replace strncpy() with strscpy_pad() Date: Mon, 10 Oct 2022 09:05:42 +0200 Message-Id: <20221010070334.838895022@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krzysztof Kozlowski commit 766279a8f85df32345dbda03b102ca1ee3d5ddea upstream. The use of strncpy() is considered deprecated for NUL-terminated strings[1]. Replace strncpy() with strscpy_pad(), to keep existing pad-behavior of strncpy, similarly to commit 08de420a8014 ("rpmsg: glink: Replace strncpy() with strscpy_pad()"). This fixes W=3D1 warning: In function =E2=80=98qcom_glink_rx_close=E2=80=99, inlined from =E2=80=98qcom_glink_work=E2=80=99 at ../drivers/rpmsg/qcom= _glink_native.c:1638:4: drivers/rpmsg/qcom_glink_native.c:1549:17: warning: =E2=80=98strncpy=E2= =80=99 specified bound 32 equals destination size [-Wstringop-truncation] 1549 | strncpy(chinfo.name, channel->name, sizeof(chinfo= .name)); [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-= on-nul-terminated-strings Signed-off-by: Krzysztof Kozlowski Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220519073330.7187-1-krzysztof.kozlowski@l= inaro.org Signed-off-by: Andrew Chernyakov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/rpmsg/qcom_glink_native.c | 2 +- drivers/rpmsg/qcom_smd.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1546,7 +1546,7 @@ static void qcom_glink_rx_close(struct q cancel_work_sync(&channel->intent_work); =20 if (channel->rpdev) { - strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); + strscpy_pad(chinfo.name, channel->name, sizeof(chinfo.name)); chinfo.src =3D RPMSG_ADDR_ANY; chinfo.dst =3D RPMSG_ADDR_ANY; =20 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -1089,7 +1089,7 @@ static int qcom_smd_create_device(struct =20 /* Assign public information to the rpmsg_device */ rpdev =3D &qsdev->rpdev; - strncpy(rpdev->id.name, channel->name, RPMSG_NAME_SIZE); + strscpy_pad(rpdev->id.name, channel->name, RPMSG_NAME_SIZE); rpdev->src =3D RPMSG_ADDR_ANY; rpdev->dst =3D RPMSG_ADDR_ANY; =20 @@ -1323,7 +1323,7 @@ static void qcom_channel_state_worker(st =20 spin_unlock_irqrestore(&edge->channels_lock, flags); =20 - strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); + strscpy_pad(chinfo.name, channel->name, sizeof(chinfo.name)); chinfo.src =3D RPMSG_ADDR_ANY; chinfo.dst =3D RPMSG_ADDR_ANY; rpmsg_unregister_device(&edge->dev, &chinfo); From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11DAEC433F5 for ; Mon, 10 Oct 2022 07:11:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231959AbiJJHLv (ORCPT ); Mon, 10 Oct 2022 03:11:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231895AbiJJHLN (ORCPT ); Mon, 10 Oct 2022 03:11:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EAF05E550; Mon, 10 Oct 2022 00:07:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2947560E75; Mon, 10 Oct 2022 07:06:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DB90C433D6; Mon, 10 Oct 2022 07:06:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385615; bh=x0fo3YqqUYZJis+tob3naJg9hU3t1zBGM7M3bSodLh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NdgOOdPnwNc3HufrXVxGp+Wcf+LaerSeOz1CB3HxwnWmwfZH2i9sBgVP2qN7WZyy6 b6FQQoRogvj30Al1g3cFeUTLtMoaBs1P09jvLUh7ViO/f6omp6Tmh6oxBdCyXS/5fS XuXCi6gfH7zLIVAQ/idzTdua1T9B2J4eTDBXRx9c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kumar Kartikeya Dwivedi , Andrii Nakryiko , Alexei Starovoitov Subject: [PATCH 5.19 45/48] bpf: Gate dynptr API behind CAP_BPF Date: Mon, 10 Oct 2022 09:05:43 +0200 Message-Id: <20221010070334.864403313@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kumar Kartikeya Dwivedi commit 8addbfc7b308d591f8a5f2f6bb24d08d9d79dfbb upstream. This has been enabled for unprivileged programs for only one kernel release, hence the expected annoyances due to this move are low. Users using ringbuf can stick to non-dynptr APIs. The actual use cases dynptr is meant to serve may not make sense in unprivileged BPF programs. Hence, gate these helpers behind CAP_BPF and limit use to privileged BPF programs. Fixes: 263ae152e962 ("bpf: Add bpf_dynptr_from_mem for local dynptrs") Fixes: bc34dee65a65 ("bpf: Dynptr support for ring buffers") Fixes: 13bbbfbea759 ("bpf: Add bpf_dynptr_read and bpf_dynptr_write") Fixes: 34d4ef5775f7 ("bpf: Add dynptr data slices") Signed-off-by: Kumar Kartikeya Dwivedi Link: https://lore.kernel.org/r/20220921143550.30247-1-memxor@gmail.com Acked-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/bpf/helpers.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 1f961f9982d2..3814b0fd3a2c 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -1627,26 +1627,12 @@ bpf_base_func_proto(enum bpf_func_id func_id) return &bpf_ringbuf_discard_proto; case BPF_FUNC_ringbuf_query: return &bpf_ringbuf_query_proto; - case BPF_FUNC_ringbuf_reserve_dynptr: - return &bpf_ringbuf_reserve_dynptr_proto; - case BPF_FUNC_ringbuf_submit_dynptr: - return &bpf_ringbuf_submit_dynptr_proto; - case BPF_FUNC_ringbuf_discard_dynptr: - return &bpf_ringbuf_discard_dynptr_proto; case BPF_FUNC_for_each_map_elem: return &bpf_for_each_map_elem_proto; case BPF_FUNC_loop: return &bpf_loop_proto; case BPF_FUNC_strncmp: return &bpf_strncmp_proto; - case BPF_FUNC_dynptr_from_mem: - return &bpf_dynptr_from_mem_proto; - case BPF_FUNC_dynptr_read: - return &bpf_dynptr_read_proto; - case BPF_FUNC_dynptr_write: - return &bpf_dynptr_write_proto; - case BPF_FUNC_dynptr_data: - return &bpf_dynptr_data_proto; default: break; } @@ -1675,6 +1661,20 @@ bpf_base_func_proto(enum bpf_func_id func_id) return &bpf_timer_cancel_proto; case BPF_FUNC_kptr_xchg: return &bpf_kptr_xchg_proto; + case BPF_FUNC_ringbuf_reserve_dynptr: + return &bpf_ringbuf_reserve_dynptr_proto; + case BPF_FUNC_ringbuf_submit_dynptr: + return &bpf_ringbuf_submit_dynptr_proto; + case BPF_FUNC_ringbuf_discard_dynptr: + return &bpf_ringbuf_discard_dynptr_proto; + case BPF_FUNC_dynptr_from_mem: + return &bpf_dynptr_from_mem_proto; + case BPF_FUNC_dynptr_read: + return &bpf_dynptr_read_proto; + case BPF_FUNC_dynptr_write: + return &bpf_dynptr_write_proto; + case BPF_FUNC_dynptr_data: + return &bpf_dynptr_data_proto; default: break; } --=20 2.38.0 From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ABF1C4332F for ; Mon, 10 Oct 2022 07:12:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232058AbiJJHMq (ORCPT ); Mon, 10 Oct 2022 03:12:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231735AbiJJHLY (ORCPT ); Mon, 10 Oct 2022 03:11:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F5551F63F; Mon, 10 Oct 2022 00:07:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8F222B80E28; Mon, 10 Oct 2022 07:06:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF315C433C1; Mon, 10 Oct 2022 07:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385618; bh=wWIt7W38r1172jhSxno5+FW8NgxPwz1Fi0FdN/Yqt7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YjirBdYgNdTSrj+EGX0RteJ0PGFdedEwYKTMftKQ05clN0YucebRKgjiLLaPk3VEb SOajAWcD2uxhehCK+SUzZ/eQfUsWmN+RDNr52njNp8PLVbxuIwG1dUaW6jRrhcKEjH C7z2eXh3zjSfvmkuS2ZCoDimlmOfqffeoxzMwS3s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Daniel Golle , Jakub Kicinski Subject: [PATCH 5.19 46/48] net: ethernet: mtk_eth_soc: fix state in __mtk_foe_entry_clear Date: Mon, 10 Oct 2022 09:05:44 +0200 Message-Id: <20221010070334.889462162@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Golle commit ae3ed15da5889263de372ff9df2e83e16acca4cb upstream. Setting ib1 state to MTK_FOE_STATE_UNBIND in __mtk_foe_entry_clear routine as done by commit 0e80707d94e4c8 ("net: ethernet: mtk_eth_soc: fix typo in __mtk_foe_entry_clear") breaks flow offloading, at least on older MTK_NETSYS_V1 SoCs, OpenWrt users have confirmed the bug on MT7622 and MT7621 systems. Felix Fietkau suggested to use MTK_FOE_STATE_INVALID instead which works well on both, MTK_NETSYS_V1 and MTK_NETSYS_V2. Tested on MT7622 (Linksys E8450) and MT7986 (BananaPi BPI-R3). Suggested-by: Felix Fietkau Fixes: 0e80707d94e4c8 ("net: ethernet: mtk_eth_soc: fix typo in __mtk_foe_e= ntry_clear") Fixes: 33fc42de33278b ("net: ethernet: mtk_eth_soc: support creating mac ad= dress based offload entries") Signed-off-by: Daniel Golle Link: https://lore.kernel.org/r/YzY+1Yg0FBXcnrtc@makrotopia.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/mediatek/mtk_ppe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/mediatek/mtk_ppe.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c @@ -412,7 +412,7 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp if (entry->hash !=3D 0xffff) { ppe->foe_table[entry->hash].ib1 &=3D ~MTK_FOE_IB1_STATE; ppe->foe_table[entry->hash].ib1 |=3D FIELD_PREP(MTK_FOE_IB1_STATE, - MTK_FOE_STATE_UNBIND); + MTK_FOE_STATE_INVALID); dma_wmb(); } entry->hash =3D 0xffff; From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBF33C433F5 for ; Mon, 10 Oct 2022 07:13:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231953AbiJJHNM (ORCPT ); Mon, 10 Oct 2022 03:13:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231939AbiJJHLi (ORCPT ); Mon, 10 Oct 2022 03:11:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 850D55E64E; Mon, 10 Oct 2022 00:07:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1ED49B80E59; Mon, 10 Oct 2022 07:07:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87295C433C1; Mon, 10 Oct 2022 07:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385620; bh=N+KfCRxX1t/yyKxANDtaUUgj6VN8/odcAxx/cAj/G0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SYr94tcQnyLidiaVFZmnpYyw4/idDA8j18vthyeK4e6EV2bLmogT4m5y2+jwZpZvp evSowVLqCQ60FOLGwvPSNVIG7NDvBxasmiQrS+gFdLBYsUgRq1YcP8DsHqc+8tNs7+ YYw7iGpJHSP8TduapCQ8Ph59dWvNDVv8X5ABcuVs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jules Irenge , Alexei Starovoitov Subject: [PATCH 5.19 47/48] bpf: Fix resetting logic for unreferenced kptrs Date: Mon, 10 Oct 2022 09:05:45 +0200 Message-Id: <20221010070334.914562306@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jules Irenge commit 9fad7fe5b29803584c7f17a2abe6c2936fec6828 upstream. Sparse reported a warning at bpf_map_free_kptrs() "warning: Using plain integer as NULL pointer" During the process of fixing this warning, it was discovered that the curre= nt code erroneously writes to the pointer variable instead of deferencing and writing to the actual kptr. Hence, Sparse tool accidentally helped to uncov= er this problem. Fix this by doing WRITE_ONCE(*p, 0) instead of WRITE_ONCE(p, = 0). Note that the effect of this bug is that unreferenced kptrs will not be cle= ared during check_and_free_fields. It is not a problem if the clearing is not do= ne during map_free stage, as there is nothing to free for them. Fixes: 14a324f6a67e ("bpf: Wire up freeing of referenced kptr") Signed-off-by: Jules Irenge Link: https://lore.kernel.org/r/Yxi3pJaK6UDjVJSy@playground Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/bpf/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -578,7 +578,7 @@ void bpf_map_free_kptrs(struct bpf_map * if (off_desc->type =3D=3D BPF_KPTR_UNREF) { u64 *p =3D (u64 *)btf_id_ptr; =20 - WRITE_ONCE(p, 0); + WRITE_ONCE(*p, 0); continue; } old_ptr =3D xchg(btf_id_ptr, 0); From nobody Sat Apr 11 10:52:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2D11C4332F for ; Mon, 10 Oct 2022 07:13:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232114AbiJJHNT (ORCPT ); Mon, 10 Oct 2022 03:13:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbiJJHLt (ORCPT ); Mon, 10 Oct 2022 03:11:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 970815E674; Mon, 10 Oct 2022 00:07:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C069160E86; Mon, 10 Oct 2022 07:07:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D16BEC433C1; Mon, 10 Oct 2022 07:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385626; bh=aGbXVUNI2w2Bylacm24RP3M4Ejgu2PgK7MC0cJaih0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HcYybEBajOFfyg43J30zGf/vXh1sLJopBc2t9HWLZl8Ea09SFggGI/301XsPLEM6J 89rRANg9+g8tFFEgVrcj9OFtC3SdrvvrB7TuVKUOzojwplvf0PCe1iVVgrGcNEWpd+ c91R7PdjysBXmJgMKOtVgG8vv8FPoc7zxHs3Etv4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Luiz Augusto von Dentz Subject: [PATCH 5.19 48/48] Bluetooth: use hdev->workqueue when queuing hdev->{cmd,ncmd}_timer works Date: Mon, 10 Oct 2022 09:05:46 +0200 Message-Id: <20221010070334.939155348@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070333.676316214@linuxfoundation.org> References: <20221010070333.676316214@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa commit deee93d13d385103205879a8a0915036ecd83261 upstream. syzbot is reporting attempt to schedule hdev->cmd_work work from system_wq WQ into hdev->workqueue WQ which is under draining operation [1], for commit c8efcc2589464ac7 ("workqueue: allow chained queueing during destruction") does not allow such operation. The check introduced by commit 877afadad2dce8aa ("Bluetooth: When HCI work queue is drained, only queue chained work") was incomplete. Use hdev->workqueue WQ when queuing hdev->{cmd,ncmd}_timer works because hci_{cmd,ncmd}_timeout() calls queue_work(hdev->workqueue). Also, protect the queuing operation with RCU read lock in order to avoid calling queue_delayed_work() after cancel_delayed_work() completed. Link: https://syzkaller.appspot.com/bug?extid=3D243b7d89777f90f7613b [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Fixes: 877afadad2dce8aa ("Bluetooth: When HCI work queue is drained, only q= ueue chained work") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/bluetooth/hci_core.c | 15 +++++++++++++-- net/bluetooth/hci_event.c | 6 ++++-- 2 files changed, 17 insertions(+), 4 deletions(-) --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -596,6 +596,15 @@ static int hci_dev_do_reset(struct hci_d =20 /* Cancel these to avoid queueing non-chained pending work */ hci_dev_set_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE); + /* Wait for + * + * if (!hci_dev_test_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE)) + * queue_delayed_work(&hdev->{cmd,ncmd}_timer) + * + * inside RCU section to see the flag or complete scheduling. + */ + synchronize_rcu(); + /* Explicitly cancel works in case scheduled after setting the flag. */ cancel_delayed_work(&hdev->cmd_timer); cancel_delayed_work(&hdev->ncmd_timer); =20 @@ -3871,12 +3880,14 @@ static void hci_cmd_work(struct work_str if (res < 0) __hci_cmd_sync_cancel(hdev, -res); =20 + rcu_read_lock(); if (test_bit(HCI_RESET, &hdev->flags) || hci_dev_test_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE)) cancel_delayed_work(&hdev->cmd_timer); else - schedule_delayed_work(&hdev->cmd_timer, - HCI_CMD_TIMEOUT); + queue_delayed_work(hdev->workqueue, &hdev->cmd_timer, + HCI_CMD_TIMEOUT); + rcu_read_unlock(); } else { skb_queue_head(&hdev->cmd_q, skb); queue_work(hdev->workqueue, &hdev->cmd_work); --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -3763,16 +3763,18 @@ static inline void handle_cmd_cnt_and_ti { cancel_delayed_work(&hdev->cmd_timer); =20 + rcu_read_lock(); if (!test_bit(HCI_RESET, &hdev->flags)) { if (ncmd) { cancel_delayed_work(&hdev->ncmd_timer); atomic_set(&hdev->cmd_cnt, 1); } else { if (!hci_dev_test_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE)) - schedule_delayed_work(&hdev->ncmd_timer, - HCI_NCMD_TIMEOUT); + queue_delayed_work(hdev->workqueue, &hdev->ncmd_timer, + HCI_NCMD_TIMEOUT); } } + rcu_read_unlock(); } =20 #define HCI_CC_VL(_op, _func, _min, _max) \