From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 102EDCCA495 for ; Tue, 7 Jun 2022 21:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384019AbiFGVyA (ORCPT ); Tue, 7 Jun 2022 17:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378894AbiFGVBy (ORCPT ); Tue, 7 Jun 2022 17:01:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29BCF20EE8E; Tue, 7 Jun 2022 11:45:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BEA33B82182; Tue, 7 Jun 2022 18:45:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DF0FC385A2; Tue, 7 Jun 2022 18:45:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627551; bh=s6qD6yjv6eYKp+r/EsmCt8ddfsgFJ4IIoDGAa0pot5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1e8gnsDjQ7jQZ79LiqrT96ExwaX/Rk1rDPa3FXfN+IhB932kbpRweNRMi7eYeEFnT cjhRfNfTJV5QtkIxGVFO+rxLPY6EV0z/gLUzbgOPLDBeOucuPLkrhtG7IyJ1NXhLZi hzel0LX3j3hqWxN+pqaRdFk+Ro1ctXFT4Y+Bmn3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hsin-Yi Wang , Douglas Anderson , Ard Biesheuvel , Steven Rostedt , "Jason A. Donenfeld" , Dominik Brodowski , Stephen Boyd , Catalin Marinas Subject: [PATCH 5.18 001/879] arm64: Initialize jump labels before setup_machine_fdt() Date: Tue, 7 Jun 2022 18:51:59 +0200 Message-Id: <20220607165002.710523116@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephen Boyd commit 73e2d827a501d48dceeb5b9b267a4cd283d6b1ae upstream. A static key warning splat appears during early boot on arm64 systems that credit randomness from devicetrees that contain an "rng-seed" property. This is because setup_machine_fdt() is called before jump_label_init() during setup_arch(). Let's swap the order of these two calls so that jump labels are initialized before the devicetree is unflattened and the rng seed is credited. static_key_enable_cpuslocked(): static key '0xffffffe51c6fcfc0' used befor= e call to jump_label_init() WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:166 static_key_enable_cpuslo= cked+0xb0/0xb8 Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0+ #224 44b43e377bfc84bc99bb5= ab885ff694984ee09ff pstate: 600001c9 (nZCv dAIF -PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : static_key_enable_cpuslocked+0xb0/0xb8 lr : static_key_enable_cpuslocked+0xb0/0xb8 sp : ffffffe51c393cf0 x29: ffffffe51c393cf0 x28: 000000008185054c x27: 00000000f1042f10 x26: 0000000000000000 x25: 00000000f10302b2 x24: 0000002513200000 x23: 0000002513200000 x22: ffffffe51c1c9000 x21: fffffffdfdc00000 x20: ffffffe51c2f0831 x19: ffffffe51c6fcfc0 x18: 00000000ffff1020 x17: 00000000e1e2ac90 x16: 00000000000000e0 x15: ffffffe51b710708 x14: 0000000000000066 x13: 0000000000000018 x12: 0000000000000000 x11: 0000000000000000 x10: 00000000ffffffff x9 : 0000000000000000 x8 : 0000000000000000 x7 : 61632065726f6665 x6 : 6220646573752027 x5 : ffffffe51c641d25 x4 : ffffffe51c13142c x3 : ffff0a00ffffff05 x2 : 40000000ffffe003 x1 : 00000000000001c0 x0 : 0000000000000065 Call trace: static_key_enable_cpuslocked+0xb0/0xb8 static_key_enable+0x2c/0x40 crng_set_ready+0x24/0x30 execute_in_process_context+0x80/0x90 _credit_init_bits+0x100/0x154 add_bootloader_randomness+0x64/0x78 early_init_dt_scan_chosen+0x140/0x184 early_init_dt_scan_nodes+0x28/0x4c early_init_dt_scan+0x40/0x44 setup_machine_fdt+0x7c/0x120 setup_arch+0x74/0x1d8 start_kernel+0x84/0x44c __primary_switched+0xc0/0xc8 ---[ end trace 0000000000000000 ]--- random: crng init done Machine model: Google Lazor (rev1 - 2) with LTE Cc: Hsin-Yi Wang Cc: Douglas Anderson Cc: Ard Biesheuvel Cc: Steven Rostedt Cc: Jason A. Donenfeld Cc: Dominik Brodowski Fixes: f5bda35fba61 ("random: use static branch for crng_ready()") Signed-off-by: Stephen Boyd Reviewed-by: Jason A. Donenfeld Link: https://lore.kernel.org/r/20220602022109.780348-1-swboyd@chromium.org Signed-off-by: Catalin Marinas Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/kernel/setup.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -314,13 +314,14 @@ void __init __no_sanitize_address setup_ early_fixmap_init(); early_ioremap_init(); =20 - setup_machine_fdt(__fdt_pointer); - /* * Initialise the static keys early as they may be enabled by the - * cpufeature code and early parameters. + * cpufeature code, early parameters, and DT setup. */ jump_label_init(); + + setup_machine_fdt(__fdt_pointer); + parse_early_param(); =20 /* From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C888C433EF for ; Tue, 7 Jun 2022 21:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384232AbiFGVyW (ORCPT ); Tue, 7 Jun 2022 17:54:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379076AbiFGVCB (ORCPT ); Tue, 7 Jun 2022 17:02:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECF2B119071; Tue, 7 Jun 2022 11:46:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 58927B82182; Tue, 7 Jun 2022 18:46:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCA3CC385A5; Tue, 7 Jun 2022 18:46:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627582; bh=0xk7QbvvjWs4PqM9z0nuyiRFdDXw10iBBsUg2RvHZic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RWrWQSa6rGEvX4Rj76HAG8escIobblQjb89Z+lc1ti+zAiS8LGV5MOCHXuWNmUm2R AKjJumEKjBgqBeMuK4VobsUyr6Kqy4IUXNoBJ9lv7d6Rzhumy9s0yZAqIE+9TTjqnf ZRtaYQ0tJiLMg7a7kg6ZvYLDcc8Knye7yHbo3lIk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Damien Le Moal , Kees Cook , kernel test robot Subject: [PATCH 5.18 002/879] binfmt_flat: do not stop relocating GOT entries prematurely on riscv Date: Tue, 7 Jun 2022 18:52:00 +0200 Message-Id: <20220607165002.739331925@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Niklas Cassel commit 6045ab5fea4c849153ebeb0acb532da5f29d69c4 upstream. bFLT binaries are usually created using elf2flt. The linker script used by elf2flt has defined the .data section like the following for the last 19 years: .data : { _sdata =3D . ; __data_start =3D . ; data_start =3D . ; *(.got.plt) *(.got) FILL(0) ; . =3D ALIGN(0x20) ; LONG(-1) . =3D ALIGN(0x20) ; ... } It places the .got.plt input section before the .got input section. The same is true for the default linker script (ld --verbose) on most architectures except x86/x86-64. The binfmt_flat loader should relocate all GOT entries until it encounters a -1 (the LONG(-1) in the linker script). The problem is that the .got.plt input section starts with a GOTPLT header (which has size 16 bytes on elf64-riscv and 8 bytes on elf32-riscv), where the first word is set to -1. See the binutils implementation for riscv [1]. This causes the binfmt_flat loader to stop relocating GOT entries prematurely and thus causes the application to crash when running. Fix this by skipping the whole GOTPLT header, since the whole GOTPLT header is reserved for the dynamic linker. The GOTPLT header will only be skipped for bFLT binaries with flag FLAT_FLAG_GOTPIC set. This flag is unconditionally set by elf2flt if the supplied ELF binary has the symbol _GLOBAL_OFFSET_TABLE_ defined. ELF binaries without a .got input section should thus remain unaffected. Tested on RISC-V Canaan Kendryte K210 and RISC-V QEMU nommu_virt_defconfig. [1] https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dblob;f=3Dbfd/elfnn= -riscv.c;hb=3Dbinutils-2_38#l3275 Cc: Signed-off-by: Niklas Cassel Reviewed-by: Damien Le Moal Link: https://lore.kernel.org/r/20220414091018.896737-1-niklas.cassel@wdc.c= om Fixed-by: kernel test robot Link: https://lore.kernel.org/lkml/202204182333.OIUOotK8-lkp@intel.com Signed-off-by: Kees Cook Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/binfmt_flat.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c @@ -440,6 +440,30 @@ static void old_reloc(unsigned long rl) =20 /*************************************************************************= ***/ =20 +static inline u32 __user *skip_got_header(u32 __user *rp) +{ + if (IS_ENABLED(CONFIG_RISCV)) { + /* + * RISC-V has a 16 byte GOT PLT header for elf64-riscv + * and 8 byte GOT PLT header for elf32-riscv. + * Skip the whole GOT PLT header, since it is reserved + * for the dynamic linker (ld.so). + */ + u32 rp_val0, rp_val1; + + if (get_user(rp_val0, rp)) + return rp; + if (get_user(rp_val1, rp + 1)) + return rp; + + if (rp_val0 =3D=3D 0xffffffff && rp_val1 =3D=3D 0xffffffff) + rp +=3D 4; + else if (rp_val0 =3D=3D 0xffffffff) + rp +=3D 2; + } + return rp; +} + static int load_flat_file(struct linux_binprm *bprm, struct lib_info *libinfo, int id, unsigned long *extra_stack) { @@ -789,7 +813,8 @@ static int load_flat_file(struct linux_b * image. */ if (flags & FLAT_FLAG_GOTPIC) { - for (rp =3D (u32 __user *)datapos; ; rp++) { + rp =3D skip_got_header((u32 __user *) datapos); + for (; ; rp++) { u32 addr, rp_val; if (get_user(rp_val, rp)) return -EFAULT; From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92B1CC43334 for ; Tue, 7 Jun 2022 21:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384303AbiFGVy0 (ORCPT ); Tue, 7 Jun 2022 17:54:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379077AbiFGVCB (ORCPT ); Tue, 7 Jun 2022 17:02: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 EB87511E484; Tue, 7 Jun 2022 11:46:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6F2A56156D; Tue, 7 Jun 2022 18:46:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E332C385A2; Tue, 7 Jun 2022 18:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627584; bh=rpTWwyjktX7kqYmFTTv2lUiyxlshLEU5YxA/+fpgFro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HkWOg/lMraIHHhm2xkeM6v3Oi60FnppCqE2S39ObQ676UJCcFLnp9xqJQRkdCS3rk hMh/re2dlbjRkNn21HwiJRzf+94S9QdAPF7wOJENhHWe7dVdWNfloayeig/DpTd3VW 00pGKthLpNnUgH/hpBtHEfNSZfTqGeuJWiZmuxpU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Helge Deller Subject: [PATCH 5.18 003/879] parisc: fix a crash with multicore scheduler Date: Tue, 7 Jun 2022 18:52:01 +0200 Message-Id: <20220607165002.768275874@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 6ba688364856ad083be537f08e86ba97f433d405 upstream. With the kernel 5.18, the system will hang on boot if it is compiled with CONFIG_SCHED_MC. The last printed message is "Brought up 1 node, 1 CPU". The crash happens in sd_init tl->mask (which is cpu_coregroup_mask) returns an empty mask. This happens because cpu_topology[0].core_sibling is empty. Consequently, sd_span is set to an empty mask sd_id =3D cpumask_first(sd_span) sets sd_id =3D=3D NR_CPUS (because the mas= k is empty) sd->shared =3D *per_cpu_ptr(sdd->sds, sd_id); sets sd->shared to NULL because sd_id is out of range atomic_inc(&sd->shared->ref); crashes without printing anything We can fix it by calling reset_cpu_topology() from init_cpu_topology() - this will initialize the sibling masks on CPUs, so that they're not empty. This patch also removes the variable "dualcores_found", it is useless, because during boot, init_cpu_topology is called before store_cpu_topology. Thus, set_sched_topology(parisc_mc_topology) is never called. We don't need to call it at all because default_topology in kernel/sched/topology.c contains the same items as parisc_mc_topology. Note that we should not call store_cpu_topology() from init_per_cpu() because it is called too early in the kernel initialization process and it results in the message "Failure to register CPU0 device". Before this patch, store_cpu_topology() would exit immediatelly because cpuid_topo->core id was uninitialized and it was 0. Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org # v5.18 Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/parisc/kernel/processor.c | 2 -- arch/parisc/kernel/topology.c | 16 +--------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c index 26eb568f8b96..dddaaa6e7a82 100644 --- a/arch/parisc/kernel/processor.c +++ b/arch/parisc/kernel/processor.c @@ -327,8 +327,6 @@ int init_per_cpu(int cpunum) set_firmware_width(); ret =3D pdc_coproc_cfg(&coproc_cfg); =20 - store_cpu_topology(cpunum); - if(ret >=3D 0 && coproc_cfg.ccr_functional) { mtctl(coproc_cfg.ccr_functional, 10); /* 10 =3D=3D Coprocessor Control = Reg */ =20 diff --git a/arch/parisc/kernel/topology.c b/arch/parisc/kernel/topology.c index 9696e3cb6a2a..b9d845e314f8 100644 --- a/arch/parisc/kernel/topology.c +++ b/arch/parisc/kernel/topology.c @@ -20,8 +20,6 @@ =20 static DEFINE_PER_CPU(struct cpu, cpu_devices); =20 -static int dualcores_found; - /* * store_cpu_topology is called at boot when only one cpu is running * and with the mutex cpu_hotplug.lock locked, when several cpus have boot= ed, @@ -60,7 +58,6 @@ void store_cpu_topology(unsigned int cpuid) if (p->cpu_loc) { cpuid_topo->core_id++; cpuid_topo->package_id =3D cpu_topology[cpu].package_id; - dualcores_found =3D 1; continue; } } @@ -80,22 +77,11 @@ void store_cpu_topology(unsigned int cpuid) cpu_topology[cpuid].package_id); } =20 -static struct sched_domain_topology_level parisc_mc_topology[] =3D { -#ifdef CONFIG_SCHED_MC - { cpu_coregroup_mask, cpu_core_flags, SD_INIT_NAME(MC) }, -#endif - - { cpu_cpu_mask, SD_INIT_NAME(DIE) }, - { NULL, }, -}; - /* * init_cpu_topology is called at boot when only one cpu is running * which prevent simultaneous write access to cpu_topology array */ void __init init_cpu_topology(void) { - /* Set scheduler topology descriptor */ - if (dualcores_found) - set_sched_topology(parisc_mc_topology); + reset_cpu_topology(); } --=20 2.36.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43EA6CCA488 for ; Tue, 7 Jun 2022 22:02:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383330AbiFGWBq (ORCPT ); Tue, 7 Jun 2022 18:01:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379096AbiFGVCE (ORCPT ); Tue, 7 Jun 2022 17:02:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EF5811CB53; Tue, 7 Jun 2022 11:46: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 D66F9B81FE1; Tue, 7 Jun 2022 18:46:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F833C34115; Tue, 7 Jun 2022 18:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627587; bh=zy8e3PUZwgPf/1N8USf86WS+Opn8Dav5ji2fldlGHyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bSov8fwdoS+YAcBKOFcBe/Y4CJMM1amha8YEQEUYRGi+Frwlvlf9SU1F8fCej9bXq 4/oxjZg2ymV1IWhgSq9b/uEnGydN8y4QsP60QZfxA5pQcHAD+HJbbZ8S3uOzuKkZcB Mf5QPJJW8YGUpPSMw7nU01844Wzh7+c1RFnEpOBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 5.18 004/879] parisc/stifb: Implement fb_is_primary_device() Date: Tue, 7 Jun 2022 18:52:02 +0200 Message-Id: <20220607165002.797731259@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller commit cf936af790a3ef5f41ff687ec91bfbffee141278 upstream. Implement fb_is_primary_device() function, so that fbcon detects if this framebuffer belongs to the default graphics card which was used to start the system. Signed-off-by: Helge Deller Cc: stable@vger.kernel.org # v5.10+ Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/parisc/include/asm/fb.h | 4 ++++ drivers/video/console/sticore.c | 17 +++++++++++++++++ drivers/video/fbdev/stifb.c | 4 ++-- 3 files changed, 23 insertions(+), 2 deletions(-) --- a/arch/parisc/include/asm/fb.h +++ b/arch/parisc/include/asm/fb.h @@ -12,9 +12,13 @@ static inline void fb_pgprotect(struct f pgprot_val(vma->vm_page_prot) |=3D _PAGE_NO_CACHE; } =20 +#if defined(CONFIG_STI_CONSOLE) || defined(CONFIG_FB_STI) +int fb_is_primary_device(struct fb_info *info); +#else static inline int fb_is_primary_device(struct fb_info *info) { return 0; } +#endif =20 #endif /* _ASM_FB_H_ */ --- a/drivers/video/console/sticore.c +++ b/drivers/video/console/sticore.c @@ -30,6 +30,7 @@ #include #include #include +#include =20 #include "../fbdev/sticore.h" =20 @@ -1127,6 +1128,22 @@ int sti_call(const struct sti_struct *st return ret; } =20 +/* check if given fb_info is the primary device */ +int fb_is_primary_device(struct fb_info *info) +{ + struct sti_struct *sti; + + sti =3D sti_get_rom(0); + + /* if no built-in graphics card found, allow any fb driver as default */ + if (!sti) + return true; + + /* return true if it's the default built-in framebuffer driver */ + return (sti->info =3D=3D info); +} +EXPORT_SYMBOL(fb_is_primary_device); + MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer"); MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in= HP PARISC machines"); MODULE_LICENSE("GPL v2"); --- a/drivers/video/fbdev/stifb.c +++ b/drivers/video/fbdev/stifb.c @@ -1358,11 +1358,11 @@ static int __init stifb_init_fb(struct s goto out_err3; } =20 + /* save for primary gfx device detection & unregister_framebuffer() */ + sti->info =3D info; if (register_framebuffer(&fb->info) < 0) goto out_err4; =20 - sti->info =3D info; /* save for unregister_framebuffer() */ - fb_info(&fb->info, "%s %dx%d-%d frame buffer device, %s, id: %04x, mmio: = 0x%04lx\n", fix->id, var->xres, From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCF1FCCA499 for ; Tue, 7 Jun 2022 21:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384391AbiFGVyi (ORCPT ); Tue, 7 Jun 2022 17:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379106AbiFGVCF (ORCPT ); Tue, 7 Jun 2022 17:02:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 208D11207D2; Tue, 7 Jun 2022 11:46: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 9255AB82018; Tue, 7 Jun 2022 18:46:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00E50C385A2; Tue, 7 Jun 2022 18:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627590; bh=lIQbYf0TkVPgHqacQsbXEfI+WghXsnVMfGGAywaL/M8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U0EKsgWiZVMSNynHcHA4/KVLD5v3hbgSOKabO0/gS2Aqh5NnsAZg29WK5KsydYgWE 7t1pI4snzs09o+Ml5N3fpccPyWgxM7Cs3AfitcDJVhbIVzIGkrgXEvJKrNCdGl73a/ M84rO/zOsR7NR4lmk59yIqHnaH0IM3uNIP9ZXrYs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 5.18 005/879] parisc/stifb: Keep track of hardware path of graphics card Date: Tue, 7 Jun 2022 18:52:03 +0200 Message-Id: <20220607165002.827279464@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller commit b046f984814af7985f444150ec28716d42d00d9a upstream. Keep the pa_path (hardware path) of the graphics card in sti_struct and use this info to give more useful info which card is currently being used. Signed-off-by: Helge Deller Cc: stable@vger.kernel.org # v5.10+ Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/video/console/sticon.c | 5 ++++- drivers/video/console/sticore.c | 15 +++++++-------- drivers/video/fbdev/sticore.h | 3 +++ 3 files changed, 14 insertions(+), 9 deletions(-) --- a/drivers/video/console/sticon.c +++ b/drivers/video/console/sticon.c @@ -46,6 +46,7 @@ #include #include #include +#include =20 #include =20 @@ -392,7 +393,9 @@ static int __init sticonsole_init(void) for (i =3D 0; i < MAX_NR_CONSOLES; i++) font_data[i] =3D STI_DEF_FONT; =20 - pr_info("sticon: Initializing STI text console.\n"); + pr_info("sticon: Initializing STI text console on %s at [%s]\n", + sticon_sti->sti_data->inq_outptr.dev_name, + sticon_sti->pa_path); console_lock(); err =3D do_take_over_console(&sti_con, 0, MAX_NR_CONSOLES - 1, PAGE0->mem_cons.cl_class !=3D CL_DUPLEX); --- a/drivers/video/console/sticore.c +++ b/drivers/video/console/sticore.c @@ -34,7 +34,7 @@ =20 #include "../fbdev/sticore.h" =20 -#define STI_DRIVERVERSION "Version 0.9b" +#define STI_DRIVERVERSION "Version 0.9c" =20 static struct sti_struct *default_sti __read_mostly; =20 @@ -503,7 +503,7 @@ sti_select_fbfont(struct sti_cooked_rom if (!fbfont) return NULL; =20 - pr_info("STI selected %ux%u framebuffer font %s for sticon\n", + pr_info(" using %ux%u framebuffer font %s\n", fbfont->width, fbfont->height, fbfont->name); =09 bpc =3D ((fbfont->width+7)/8) * fbfont->height;=20 @@ -947,6 +947,7 @@ out_err: =20 static void sticore_check_for_default_sti(struct sti_struct *sti, char *pa= th) { + pr_info(" located at [%s]\n", sti->pa_path); if (strcmp (path, default_sti_path) =3D=3D 0) default_sti =3D sti; } @@ -958,7 +959,6 @@ static void sticore_check_for_default_st */ static int __init sticore_pa_init(struct parisc_device *dev) { - char pa_path[21]; struct sti_struct *sti =3D NULL; int hpa =3D dev->hpa.start; =20 @@ -971,8 +971,8 @@ static int __init sticore_pa_init(struct if (!sti) return 1; =20 - print_pa_hwpath(dev, pa_path); - sticore_check_for_default_sti(sti, pa_path); + print_pa_hwpath(dev, sti->pa_path); + sticore_check_for_default_sti(sti, sti->pa_path); return 0; } =20 @@ -1008,9 +1008,8 @@ static int sticore_pci_init(struct pci_d =20 sti =3D sti_try_rom_generic(rom_base, fb_base, pd); if (sti) { - char pa_path[30]; - print_pci_hwpath(pd, pa_path); - sticore_check_for_default_sti(sti, pa_path); + print_pci_hwpath(pd, sti->pa_path); + sticore_check_for_default_sti(sti, sti->pa_path); } =09 if (!sti) { --- a/drivers/video/fbdev/sticore.h +++ b/drivers/video/fbdev/sticore.h @@ -370,6 +370,9 @@ struct sti_struct { =20 /* pointer to all internal data */ struct sti_all_data *sti_data; + + /* pa_path of this device */ + char pa_path[24]; }; From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4E54CCA498 for ; Tue, 7 Jun 2022 21:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384353AbiFGVy3 (ORCPT ); Tue, 7 Jun 2022 17:54:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379118AbiFGVCF (ORCPT ); Tue, 7 Jun 2022 17:02:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16206188E7A; Tue, 7 Jun 2022 11:46:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AB3F2B81FE1; Tue, 7 Jun 2022 18:46:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E37CDC385A2; Tue, 7 Jun 2022 18:46:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627593; bh=xkQiGxoMysz9EE4tGtqoiVDGv52Ju5dOkOMx/O/9Vvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OOlrj9e67+eHThCmrlPx+pbVn0iBPU3baudMdGGl1utXKAAOEnR90oxFc594BiGWA ktgrSnxLlOMQDqS14bu1W2pWPddJYe+QtA+syE6NLf3AfWhX3IkhSSuAxNj9d83++E rsdgoy4GmcR/pO8viOiBNnIehRDzc0+q11kijZOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huaming Jiang , Guo Ren , Heiko Stuebner , Xianting Tian , Palmer Dabbelt , Nick Kossifidis Subject: [PATCH 5.18 006/879] RISC-V: Mark IORESOURCE_EXCLUSIVE for reserved mem instead of IORESOURCE_BUSY Date: Tue, 7 Jun 2022 18:52:04 +0200 Message-Id: <20220607165002.856696509@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xianting Tian commit e61bf5c071148c80d091f8e7220b3b9130780ae3 upstream. Commit 00ab027a3b82 ("RISC-V: Add kernel image sections to the resource tre= e") marked IORESOURCE_BUSY for reserved memory, which caused resource map failed in subsequent operations of related driver, so remove the IORESOURCE_BUSY flag. In order to prohibit userland mapping reserved memory, mark IORESOURCE_EXCLUSIVE for it. The code to reproduce the issue, dts: mem0: memory@a0000000 { reg =3D <0x0 0xa0000000 0 0x1000000>; no-map; }; &test { status =3D "okay"; memory-region =3D <&mem0>; }; code: np =3D of_parse_phandle(pdev->dev.of_node, "memory-region", 0); ret =3D of_address_to_resource(np, 0, &r); base =3D devm_ioremap_resource(&pdev->dev, &r); // base =3D -EBUSY Fixes: 00ab027a3b82 ("RISC-V: Add kernel image sections to the resource tre= e") Reported-by: Huaming Jiang Reviewed-by: Guo Ren Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner Co-developed-by: Nick Kossifidis Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20220518013428.1338983-1-xianting.tian@linu= x.alibaba.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/kernel/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -189,7 +189,7 @@ static void __init init_resources(void) res =3D &mem_res[res_idx--]; =20 res->name =3D "Reserved"; - res->flags =3D IORESOURCE_MEM | IORESOURCE_BUSY; + res->flags =3D IORESOURCE_MEM | IORESOURCE_EXCLUSIVE; res->start =3D __pfn_to_phys(memblock_region_reserved_base_pfn(region)); res->end =3D __pfn_to_phys(memblock_region_reserved_end_pfn(region)) - 1; =20 @@ -214,7 +214,7 @@ static void __init init_resources(void) =20 if (unlikely(memblock_is_nomap(region))) { res->name =3D "Reserved"; - res->flags =3D IORESOURCE_MEM | IORESOURCE_BUSY; + res->flags =3D IORESOURCE_MEM | IORESOURCE_EXCLUSIVE; } else { res->name =3D "System RAM"; res->flags =3D IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 231A1C3F2D4 for ; Tue, 7 Jun 2022 22:02:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383307AbiFGWBj (ORCPT ); Tue, 7 Jun 2022 18:01:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379119AbiFGVCF (ORCPT ); Tue, 7 Jun 2022 17:02:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2411B188E7D; Tue, 7 Jun 2022 11:46:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B3B27612F2; Tue, 7 Jun 2022 18:46:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2514C385A2; Tue, 7 Jun 2022 18:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627596; bh=+X1/Aj4S764+n4uxy2PfC01XzrJFcJkGE0j/wvJKRxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mMW2n5Lq2V352TsRIWgYfGst8R95k5VI7NjoIynsIEist+nXpr9CBM53g6XzwTqwK 4pgtrpuyLoy3Kf3P8sRa4MT2nd+7wtdENtD0VhGiziY8PnGaTSeC/rlVDcPktyXF93 tk58VTMZvlMCrMCigdJBZ3Ts/sxXLVkq72JQOaJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandre Ghiti , Palmer Dabbelt Subject: [PATCH 5.18 007/879] riscv: Initialize thread pointer before calling C functions Date: Tue, 7 Jun 2022 18:52:05 +0200 Message-Id: <20220607165002.885131751@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexandre Ghiti commit 35d33c76d68dfacc330a8eb477b51cc647c5a847 upstream. Because of the stack canary feature that reads from the current task structure the stack canary value, the thread pointer register "tp" must be set before calling any C function from head.S: by chance, setup_vm and all the functions that it calls does not seem to be part of the functions where the canary check is done, but in the following commits, some functions will. Fixes: f2c9699f65557a31 ("riscv: Add STACKPROTECTOR supported") Signed-off-by: Alexandre Ghiti Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/kernel/head.S | 1 + 1 file changed, 1 insertion(+) --- a/arch/riscv/kernel/head.S +++ b/arch/riscv/kernel/head.S @@ -297,6 +297,7 @@ clear_bss_done: REG_S a0, (a2) =20 /* Initialize page tables and relocate to virtual addresses */ + la tp, init_task la sp, init_thread_union + THREAD_SIZE XIP_FIXUP_OFFSET sp #ifdef CONFIG_BUILTIN_DTB From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F31DACCA486 for ; Tue, 7 Jun 2022 22:02:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383281AbiFGWBg (ORCPT ); Tue, 7 Jun 2022 18:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379136AbiFGVCG (ORCPT ); Tue, 7 Jun 2022 17:02:06 -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 D3D81188E89; Tue, 7 Jun 2022 11:46:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 65C72612F2; Tue, 7 Jun 2022 18:46:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72DBAC385A2; Tue, 7 Jun 2022 18:46:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627598; bh=sN1Kk7yA6tgJ56jtZ7RfRBdgp59iuwFaAZOanZaTchg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D1n2MmkOlra/zgC56BapGP0nizZnltjB4odabtXZF2Uiati+ovNcfQLQOC5eMcsOE D08GFMoEiOHxd0djJl4uGaoCQqTBA864r628Rvi4D8eBpepP+phzBSmSPlpfh3zeoW iFn7fpVrRwHbhyHKDwHGZ6imuf9o2E00htrxuizc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Holland , Heiko Stuebner , Palmer Dabbelt Subject: [PATCH 5.18 008/879] riscv: Fix irq_work when SMP is disabled Date: Tue, 7 Jun 2022 18:52:06 +0200 Message-Id: <20220607165002.913734663@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland commit 2273272823db6f67d57761df8116ae32e7f05bed upstream. irq_work is triggered via an IPI, but the IPI infrastructure is not included in uniprocessor kernels. As a result, irq_work never runs. Fall back to the tick-based irq_work implementation on uniprocessor configurations. Fixes: 298447928bb1 ("riscv: Support irq_work via self IPIs") Signed-off-by: Samuel Holland Reviewed-by: Heiko Stuebner Link: https://lore.kernel.org/r/20220430030025.58405-1-samuel@sholland.org Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/include/asm/irq_work.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/riscv/include/asm/irq_work.h +++ b/arch/riscv/include/asm/irq_work.h @@ -4,7 +4,7 @@ =20 static inline bool arch_irq_work_has_interrupt(void) { - return true; + return IS_ENABLED(CONFIG_SMP); } extern void arch_irq_work_raise(void); #endif /* _ASM_RISCV_IRQ_WORK_H */ From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDE06CCA49A for ; Tue, 7 Jun 2022 21:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377260AbiFGVyq (ORCPT ); Tue, 7 Jun 2022 17:54:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379165AbiFGVCI (ORCPT ); Tue, 7 Jun 2022 17:02:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D144188EA6; Tue, 7 Jun 2022 11:46:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C7ADAB82018; Tue, 7 Jun 2022 18:46:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3834BC385A2; Tue, 7 Jun 2022 18:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627601; bh=FQJSpetsLBnsxM9PqVdsBxFKyjDXSecnsj2VtGM4CvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CW86/Av+Ar7xtKbRmXeXwlb9/s3h3vxU2vRkzdCDRuLhUlZZc5pEIo11PFJGFa1y5 LL3KAADwMDdVtG0Tj4i6PMEJ/q/bz3RvdqVcSf0acj2+YkWVBZVqOmcidjfNJ3h7ce iD/Gg8A+ItCKK1eLGZuxoJKVYQl0NttuTt47q82A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tobias Klauser , Palmer Dabbelt Subject: [PATCH 5.18 009/879] riscv: Wire up memfd_secret in UAPI header Date: Tue, 7 Jun 2022 18:52:07 +0200 Message-Id: <20220607165002.941628628@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tobias Klauser commit 02d88b40cb2e9614e0117c3385afdce878f0d377 upstream. Move the __ARCH_WANT_MEMFD_SECRET define added in commit 7bb7f2ac24a0 ("arch, mm: wire up memfd_secret system call where relevant") to so __NR_memfd_secret is defined when including in userspace. This allows the memfd_secret selftest to pass on riscv. Signed-off-by: Tobias Klauser Link: https://lore.kernel.org/r/20220505081815.22808-1-tklauser@distanz.ch Fixes: 7bb7f2ac24a0 ("arch, mm: wire up memfd_secret system call where rele= vant") Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/include/asm/unistd.h | 1 - arch/riscv/include/uapi/asm/unistd.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) --- a/arch/riscv/include/asm/unistd.h +++ b/arch/riscv/include/asm/unistd.h @@ -9,7 +9,6 @@ */ =20 #define __ARCH_WANT_SYS_CLONE -#define __ARCH_WANT_MEMFD_SECRET =20 #include =20 --- a/arch/riscv/include/uapi/asm/unistd.h +++ b/arch/riscv/include/uapi/asm/unistd.h @@ -21,6 +21,7 @@ #endif /* __LP64__ */ =20 #define __ARCH_WANT_SYS_CLONE3 +#define __ARCH_WANT_MEMFD_SECRET =20 #include From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE48FC43334 for ; Tue, 7 Jun 2022 22:03:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378922AbiFGWDR (ORCPT ); Tue, 7 Jun 2022 18:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378918AbiFGVBy (ORCPT ); Tue, 7 Jun 2022 17:01:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF56A69296; Tue, 7 Jun 2022 11:45: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 62E8BB82182; Tue, 7 Jun 2022 18:45:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA382C385A2; Tue, 7 Jun 2022 18:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627554; bh=KidPKL7CSKLt/gRwD34Zy5/VxtuEN1OY6TljW2bDPrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lRkxEG8+PSHOSGeH1C5wfkBkz/who/hDQhWm22ElhClGWhqVeW851kNcSyMn2+cMw 1eU0Gv8zRYpBMb/iyb0hRNANV5SafmuZdNO8m0W1Fx8MeEali4lOEkzB5t8hl8O67t 1dy6baNCWgnlgu7wgkC05GDVaAM6s187HKyxqQ4U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Nathan Chancellor , Heiko Stuebner , Palmer Dabbelt Subject: [PATCH 5.18 010/879] riscv: Move alternative length validation into subsection Date: Tue, 7 Jun 2022 18:52:08 +0200 Message-Id: <20220607165002.969931142@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nathan Chancellor commit 61114e734ccb804bc12561ab4020745e02c468c2 upstream. After commit 49b290e430d3 ("riscv: prevent compressed instructions in alternatives"), builds with LLVM's integrated assembler fail: In file included from arch/riscv/mm/init.c:10: In file included from ./include/linux/mm.h:29: In file included from ./include/linux/pgtable.h:6: In file included from ./arch/riscv/include/asm/pgtable.h:108: ./arch/riscv/include/asm/tlbflush.h:23:2: error: expected assembly-time a= bsolute expression ALT_FLUSH_TLB_PAGE(__asm__ __volatile__ ("sfence.vma %0" : : "r" = (addr) : "memory")); ^ ./arch/riscv/include/asm/errata_list.h:33:5: note: expanded from macro 'A= LT_FLUSH_TLB_PAGE' asm(ALTERNATIVE("sfence.vma %0", "sfence.vma", SIFIVE_VENDOR_ID, \ ^ ./arch/riscv/include/asm/alternative-macros.h:187:2: note: expanded from = macro 'ALTERNATIVE' _ALTERNATIVE_CFG(old_content, new_content, vendor_id, errata_id, = CONFIG_k) ^ ./arch/riscv/include/asm/alternative-macros.h:113:2: note: expanded from = macro '_ALTERNATIVE_CFG' __ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, IS_ENABLED(= CONFIG_k)) ^ ./arch/riscv/include/asm/alternative-macros.h:110:2: note: expanded from = macro '__ALTERNATIVE_CFG' ALT_NEW_CONTENT(vendor_id, errata_id, enable, new_c) ^ ./arch/riscv/include/asm/alternative-macros.h:99:3: note: expanded from m= acro 'ALT_NEW_CONTENT' ".org . - (889b - 888b) + (887b - 886b)\n" \ ^ :26:6: note: instantiated into assembly here .org . - (889b - 888b) + (887b - 886b) ^ This error happens because LLVM's integrated assembler has a one-pass design, which means it cannot figure out the instruction lengths when the .org directive is outside of the subsection that contains the instructions, which was changed by the .option directives added by the above change. Move the .org directives before the .previous directive so that these directives are always within the same subsection, which resolves the failures and does not introduce any new issues with GNU as. This was done for arm64 in commit 966a0acce2fc ("arm64/alternatives: move length validation inside the subsection") and commit 22315a2296f4 ("arm64: alternatives: Move length validation in alternative_{insn, endif}"). While there is no error from the assembly versions of the macro, they appear to have the same problem so just make the same change there as well so that there are no problems in the future. Link: https://github.com/ClangBuiltLinux/linux/issues/1640 Reported-by: kernel test robot Signed-off-by: Nathan Chancellor Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner Link: https://lore.kernel.org/r/20220516214520.3252074-1-nathan@kernel.org Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/riscv/include/asm/alternative-macros.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/riscv/include/asm/alternative-macros.h +++ b/arch/riscv/include/asm/alternative-macros.h @@ -23,9 +23,9 @@ 888 : \new_c 889 : - .previous .org . - (889b - 888b) + (887b - 886b) .org . - (887b - 886b) + (889b - 888b) + .previous .endif .endm =20 @@ -60,9 +60,9 @@ "888 :\n" \ new_c "\n" \ "889 :\n" \ - ".previous\n" \ ".org . - (887b - 886b) + (889b - 888b)\n" \ ".org . - (889b - 888b) + (887b - 886b)\n" \ + ".previous\n" \ ".endif\n" =20 #define __ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, enable) \ From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A31FAC433EF for ; Tue, 7 Jun 2022 22:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357183AbiFGWDL (ORCPT ); Tue, 7 Jun 2022 18:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378922AbiFGVBz (ORCPT ); Tue, 7 Jun 2022 17:01:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECD276D1B4; Tue, 7 Jun 2022 11:45: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 82F336156D; Tue, 7 Jun 2022 18:45:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9160DC385A2; Tue, 7 Jun 2022 18:45:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627556; bh=oRsdagmTqjRgG5rvNnCdvfEpUsAV6/16oxShlkmqr3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PZRXrMfjzaKAuablHCiXcNHyMf8PPY1ubcw9nszVBLFUvxoFlm87N5NuzD4TsvbjN O9DrMzzBMQxTKT/tLnsXROYinsOoa0vRZFJDJABzjlSmQOKaAW0G2Yze6qXBVOcFZV +jnvW+t5ltAmCyh+9dJHpcZsaqvQKlr7LOpFUms0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kailang Yang , Takashi Iwai Subject: [PATCH 5.18 011/879] ALSA: hda/realtek - Add new type for ALC245 Date: Tue, 7 Jun 2022 18:52:09 +0200 Message-Id: <20220607165002.999421807@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kailang Yang commit 60571929d06b028800f27b51a7c81de1144944cf upstream. Add new type for ALC245. Signed-off-by: Kailang Yang Cc: Link: https://lore.kernel.org/r/cef26a7cd3d146eb96a3994ce79e34d2@realtek.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/pci/hda/patch_realtek.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3131,6 +3131,7 @@ enum { ALC269_TYPE_ALC257, ALC269_TYPE_ALC215, ALC269_TYPE_ALC225, + ALC269_TYPE_ALC245, ALC269_TYPE_ALC287, ALC269_TYPE_ALC294, ALC269_TYPE_ALC300, @@ -3168,6 +3169,7 @@ static int alc269_parse_auto_config(stru case ALC269_TYPE_ALC257: case ALC269_TYPE_ALC215: case ALC269_TYPE_ALC225: + case ALC269_TYPE_ALC245: case ALC269_TYPE_ALC287: case ALC269_TYPE_ALC294: case ALC269_TYPE_ALC300: @@ -3695,7 +3697,8 @@ static void alc225_init(struct hda_codec hda_nid_t hp_pin =3D alc_get_hp_pin(spec); bool hp1_pin_sense, hp2_pin_sense; =20 - if (spec->codec_variant !=3D ALC269_TYPE_ALC287) + if (spec->codec_variant !=3D ALC269_TYPE_ALC287 && + spec->codec_variant !=3D ALC269_TYPE_ALC245) /* required only at boot or S3 and S4 resume time */ if (!spec->done_hp_init || is_s3_resume(codec) || @@ -10148,7 +10151,10 @@ static int patch_alc269(struct hda_codec case 0x10ec0245: case 0x10ec0285: case 0x10ec0289: - spec->codec_variant =3D ALC269_TYPE_ALC215; + if (alc_get_coef0(codec) & 0x0010) + spec->codec_variant =3D ALC269_TYPE_ALC245; + else + spec->codec_variant =3D ALC269_TYPE_ALC215; spec->shutup =3D alc225_shutup; spec->init_hook =3D alc225_init; spec->gen.mixer_nid =3D 0; From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5170FC43334 for ; Tue, 7 Jun 2022 22:03:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382428AbiFGWCz (ORCPT ); Tue, 7 Jun 2022 18:02:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378939AbiFGVB4 (ORCPT ); Tue, 7 Jun 2022 17:01:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21D9311045E; Tue, 7 Jun 2022 11:46:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D29F7B82182; Tue, 7 Jun 2022 18:46:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 463C9C385A5; Tue, 7 Jun 2022 18:45:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627559; bh=QMG3R1mvrOBvB2v3vbuMnUg8mhkaroJLdlZ6oZ9ggBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0/GajD8B5ebR+Vh5Ek//jULAdbL1lK/W6Aqj87ddvkFP0TmNulNHQPEdlRRcH1aIE aZm4VFTRpD/3392/Pd19bLP5UBnKHKflITHG86KZjdewene6uV2msGLhma3f37MW0E hyZzs9hLE+ua6mbeeHoS3Y4dQWxH402nV9cg6XdU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rik van der Kemp , Takashi Iwai Subject: [PATCH 5.18 012/879] ALSA: hda/realtek: Enable 4-speaker output for Dell XPS 15 9520 laptop Date: Tue, 7 Jun 2022 18:52:10 +0200 Message-Id: <20220607165003.027607750@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rik van der Kemp commit 15dad62f4bdb5dc0f0efde8181d680db9963544c upstream. The 2022-model XPS 15 appears to use the same 4-speakers-on-ALC289 audio setup as the Dell XPS 15 9510, so requires the same quirk to enable woofer output. Tested on my own 9520. [ Move the entry to the right position in the SSID order -- tiwai ] BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=3D216035 Cc: Signed-off-by: Rik van der Kemp Link: https://lore.kernel.org/r/181056a137b.d14baf90133058.8425453735588429= 828@upto11.nl Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8957,6 +8957,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SP= K), SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MI= C_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK), SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CD12C433EF for ; Tue, 7 Jun 2022 21:57:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382416AbiFGV5b (ORCPT ); Tue, 7 Jun 2022 17:57:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378949AbiFGVB4 (ORCPT ); Tue, 7 Jun 2022 17:01:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC41187C03; Tue, 7 Jun 2022 11:46:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 09FE161295; Tue, 7 Jun 2022 18:46:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11F2EC385A2; Tue, 7 Jun 2022 18:46:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627562; bh=xXLFWftSkAvr+ult2Lpc9PstGpW7d7BWajMASz5VVno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6TZwA+/Z9RrzDv3rV7nkiTePH+aY+xJfdf+wHoOdLcDZf4nEpFQptBVKZMaGTyJM 5oGeRYf2MxCidS4THEC5+fUfGB4JSXoOSKIb8MnFJO4cYsouBDmPQuOFHuI+LHBDN8 T+2J2dFv8fB3fklKPZ4t1PneRmh/jtWQmXMG4250= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marios Levogiannis , Takashi Iwai Subject: [PATCH 5.18 013/879] ALSA: hda/realtek - Fix microphone noise on ASUS TUF B550M-PLUS Date: Tue, 7 Jun 2022 18:52:11 +0200 Message-Id: <20220607165003.056508330@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marios Levogiannis commit 9bfa7b36343c7d84370bc61c9ed774635b05e4eb upstream. Set microphone pins 0x18 (rear) and 0x19 (front) to VREF_50 to fix the microphone noise on ASUS TUF B550M-PLUS which uses the ALCS1200A codec. The initial value was VREF_80. The same issue is also present on Windows using both the default Windows driver and all tested Realtek drivers before version 6.0.9049.1. Comparing Realtek driver 6.0.9049.1 (the first one without the microphone noise) to Realtek driver 6.0.9047.1 (the last one with the microphone noise) revealed that the fix is the result of setting pins 0x18 and 0x19 to VREF_50. This fix may also work for other boards that have been reported to have the same microphone issue and use the ALC1150 and ALCS1200A codecs, since these codecs are similar and the fix in the Realtek driver on Windows is common for both. However, it is currently enabled only for ASUS TUF B550M-PLUS as this is the only board that could be tested. Signed-off-by: Marios Levogiannis Cc: Link: https://lore.kernel.org/r/20220530074131.12258-1-marios.levogiannis@g= mail.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/pci/hda/patch_realtek.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -1981,6 +1981,7 @@ enum { ALC1220_FIXUP_CLEVO_PB51ED_PINS, ALC887_FIXUP_ASUS_AUDIO, ALC887_FIXUP_ASUS_HMIC, + ALCS1200A_FIXUP_MIC_VREF, }; =20 static void alc889_fixup_coef(struct hda_codec *codec, @@ -2526,6 +2527,14 @@ static const struct hda_fixup alc882_fix .chained =3D true, .chain_id =3D ALC887_FIXUP_ASUS_AUDIO, }, + [ALCS1200A_FIXUP_MIC_VREF] =3D { + .type =3D HDA_FIXUP_PINCTLS, + .v.pins =3D (const struct hda_pintbl[]) { + { 0x18, PIN_VREF50 }, /* rear mic */ + { 0x19, PIN_VREF50 }, /* front mic */ + {} + } + }, }; =20 static const struct snd_pci_quirk alc882_fixup_tbl[] =3D { @@ -2563,6 +2572,7 @@ static const struct snd_pci_quirk alc882 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3), + SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_= VREF), SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PR= IMARY_HP), SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP= ), SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32D7AC433EF for ; Tue, 7 Jun 2022 22:02:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377620AbiFGWCo (ORCPT ); Tue, 7 Jun 2022 18:02:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378997AbiFGVB5 (ORCPT ); Tue, 7 Jun 2022 17:01:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF0E5187C35; Tue, 7 Jun 2022 11:46:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 85DF6B81FE1; Tue, 7 Jun 2022 18:46:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5EF5C385A5; Tue, 7 Jun 2022 18:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627565; bh=diPTJAlAYIKdCCWA3zqqCctkFNXEeBxcidPHNv1YQRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Svy5Cvc8pNCFvxOiB1Y41A8UFp9HaRceXonX+7c73W+cpONejjK72c8mUMLeGKLm g9w/lvuw0uaGLFIZOG6W/XSZQ6Gvadu2ODk4gc7pY2j6Py1h9K/j2dprKdw931B0ad ZSdN1KYIosO1/YEtkheLEFKCC6wTZ82QjyRdevy8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+6912c9592caca7ca0e7d@syzkaller.appspotmail.com, Takashi Iwai Subject: [PATCH 5.18 014/879] ALSA: usb-audio: Cancel pending work at closing a MIDI substream Date: Tue, 7 Jun 2022 18:52:12 +0200 Message-Id: <20220607165003.085393918@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai commit 0125de38122f0f66bf61336158d12a1aabfe6425 upstream. At closing a USB MIDI output substream, there might be still a pending work, which would eventually access the rawmidi runtime object that is being released. For fixing the race, make sure to cancel the pending work at closing. Reported-by: syzbot+6912c9592caca7ca0e7d@syzkaller.appspotmail.com Cc: Link: https://lore.kernel.org/r/000000000000e7e75005dfd07cf6@google.com Link: https://lore.kernel.org/r/20220525131203.11299-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/usb/midi.c | 3 +++ 1 file changed, 3 insertions(+) --- a/sound/usb/midi.c +++ b/sound/usb/midi.c @@ -1145,6 +1145,9 @@ static int snd_usbmidi_output_open(struc =20 static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substrea= m) { + struct usbmidi_out_port *port =3D substream->runtime->private_data; + + cancel_work_sync(&port->ep->work); return substream_open(substream, 0, 0); } From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AA78C43334 for ; Tue, 7 Jun 2022 22:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382500AbiFGWCj (ORCPT ); Tue, 7 Jun 2022 18:02:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379017AbiFGVB7 (ORCPT ); Tue, 7 Jun 2022 17:01:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9A6B188E44; Tue, 7 Jun 2022 11:46:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 76AA2B82018; Tue, 7 Jun 2022 18:46:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC3D9C385A2; Tue, 7 Jun 2022 18:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627568; bh=PQpjQG3pFURTCSgJVO1XL5DHQPOIXC4phwjj4OG20fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Da8XPz4mfZzFMUMzaxnExJaZWE8LI6fzD4+mDH5F6mxLPqMLkK0oJiT9M26rq3PIK mVs16aV4o8/x7pLaTe45uE4gDBO8mp8aJfBSdCUyfQYtnY6JVlZFxX4HuVaJVhuFjo MhwACM4Vfx9UKLhlwSzC4Rl4IaSQqIquUMaEc3G4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gary van der Merwe , Johan Hovold Subject: [PATCH 5.18 015/879] USB: serial: pl2303: fix type detection for odd device Date: Tue, 7 Jun 2022 18:52:13 +0200 Message-Id: <20220607165003.115165042@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 e82e7c6dde91acd6748d672a44dc1980ce239f86 upstream. At least one pl2303 device has a bcdUSB of 1.0.1 which most likely was was intended as 1.1. Allow bcdDevice 1.0.1 but interpret it as 1.1. Fixes: 1e9faef4d26d ("USB: serial: pl2303: fix HX type detection") Cc: stable@vger.kernel.org # 5.13 Link: https://lore.kernel.org/linux-usb/CAJixRzqf4a9-ZKZDgWxicc_BpfdZVE9qqG= mkiO7xEstOXUbGvQ@mail.gmail.com Reported-by: Gary van der Merwe Link: https://lore.kernel.org/r/20220517161736.13313-1-johan@kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/serial/pl2303.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -421,6 +421,9 @@ static int pl2303_detect_type(struct usb bcdUSB =3D le16_to_cpu(desc->bcdUSB); =20 switch (bcdUSB) { + case 0x101: + /* USB 1.0.1? Let's assume they meant 1.1... */ + fallthrough; case 0x110: switch (bcdDevice) { case 0x300: From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 221A3CCA47C for ; Tue, 7 Jun 2022 22:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382205AbiFGWCb (ORCPT ); Tue, 7 Jun 2022 18:02:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379022AbiFGVB7 (ORCPT ); Tue, 7 Jun 2022 17:01:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F21D188E4C; Tue, 7 Jun 2022 11:46: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 ADEE26160D; Tue, 7 Jun 2022 18:46:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B19B0C385A2; Tue, 7 Jun 2022 18:46:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627571; bh=TOJbzG2XZoI2WrokbFQt+q9q4+105c+y04J+e5RILtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o4mLkb3IS57SKEXPFPzKMEqWIJcN+o3pASZf0fm9F5pdOWDLd78zLY+G8U24i9Dzb +UnTdN60YnzzWTyS+0s+0DtyMTYkreqUUmKp0qyydhoTGNBI/uTUW8p0Ih+PbBRI24 zGrZr7JHOjH97unAwuV+wnHvykNas2HZgp6ZKEiM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Carl Yin , Johan Hovold Subject: [PATCH 5.18 016/879] USB: serial: option: add Quectel BG95 modem Date: Tue, 7 Jun 2022 18:52:14 +0200 Message-Id: <20220607165003.144531848@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Carl Yin(=E6=AE=B7=E5=BC=A0=E6=88=90) commit 33b7af2f459df453feb0d44628d820c47fefe7a8 upstream. The BG95 modem has 3 USB configurations that are configurable via the AT command AT+QCFGEXT=3D"usbnet",["ecm"|"modem"|"rmnet"] which make the modem enumerate with the following interfaces, respectively: "modem": Diag + GNSS + Modem + Modem "ecm" : Diag + GNSS + Modem + ECM "rmnet": Diag + GNSS + Modem + QMI Don't support Full QMI messages (e.g WDS_START_NETWORK_INTERFACE) A detailed description of the USB configuration for each mode follows: +QCFGEXT: "usbnet","modem" Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz -------------------------- T: Bus=3D01 Lev=3D02 Prnt=3D02 Port=3D01 Cnt=3D01 Dev#=3D 3 Spd=3D480 Mx= Ch=3D 0 D: Ver=3D 2.00 Cls=3D00(>ifc ) Sub=3D00 Prot=3D00 MxPS=3D64 #Cfgs=3D 1 P: Vendor=3D2c7c ProdID=3D0700 Rev=3D 0.00 S: Manufacturer=3DQuectel, Incorporated S: Product=3DQuectel LPWA Module S: SerialNumber=3D884328a2 C:* #Ifs=3D 4 Cfg#=3D 1 Atr=3De0 MxPwr=3D500mA I:* If#=3D 0 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D81(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D01(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 1 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D82(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D02(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D83(I) Atr=3D03(Int.) MxPS=3D 64 Ivl=3D2ms E: Ad=3D84(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D03(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 4 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dfe Prot=3Dff Driver= =3Doption E: Ad=3D85(I) Atr=3D03(Int.) MxPS=3D 64 Ivl=3D2ms E: Ad=3D86(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D04(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms +QCFGEXT: "usbnet","ecm" ------------------------ T: Bus=3D01 Lev=3D02 Prnt=3D02 Port=3D01 Cnt=3D01 Dev#=3D 4 Spd=3D480 Mx= Ch=3D 0 D: Ver=3D 2.00 Cls=3Def(misc ) Sub=3D02 Prot=3D01 MxPS=3D64 #Cfgs=3D 1 P: Vendor=3D2c7c ProdID=3D0700 Rev=3D 0.00 S: Manufacturer=3DQuectel, Incorporated S: Product=3DQuectel LPWA Module S: SerialNumber=3D884328a2 C:* #Ifs=3D 5 Cfg#=3D 1 Atr=3De0 MxPwr=3D500mA A: FirstIf#=3D 3 IfCount=3D 2 Cls=3D02(comm.) Sub=3D00 Prot=3D00 I:* If#=3D 0 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D81(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D01(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 1 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D82(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D02(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D83(I) Atr=3D03(Int.) MxPS=3D 64 Ivl=3D2ms E: Ad=3D84(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D03(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 3 Alt=3D 0 #EPs=3D 1 Cls=3D02(comm.) Sub=3D06 Prot=3D00 Driver= =3Dcdc_ether E: Ad=3D85(I) Atr=3D03(Int.) MxPS=3D 64 Ivl=3D2ms I: If#=3D 4 Alt=3D 0 #EPs=3D 0 Cls=3D0a(data ) Sub=3D00 Prot=3D00 Driver= =3Dcdc_ether I:* If#=3D 4 Alt=3D 1 #EPs=3D 2 Cls=3D0a(data ) Sub=3D00 Prot=3D00 Driver= =3Dcdc_ether E: Ad=3D86(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D04(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms +QCFGEXT: "usbnet","rmnet" -------------------------- T: Bus=3D01 Lev=3D02 Prnt=3D02 Port=3D01 Cnt=3D01 Dev#=3D 4 Spd=3D480 Mx= Ch=3D 0 D: Ver=3D 2.00 Cls=3D00(>ifc ) Sub=3D00 Prot=3D00 MxPS=3D64 #Cfgs=3D 1 P: Vendor=3D2c7c ProdID=3D0700 Rev=3D 0.00 S: Manufacturer=3DQuectel, Incorporated S: Product=3DQuectel LPWA Module S: SerialNumber=3D884328a2 C:* #Ifs=3D 4 Cfg#=3D 1 Atr=3De0 MxPwr=3D500mA I:* If#=3D 0 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D81(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D01(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 1 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D82(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D02(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D83(I) Atr=3D03(Int.) MxPS=3D 64 Ivl=3D2ms E: Ad=3D84(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D03(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 3 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Dqmi_wwan E: Ad=3D85(I) Atr=3D03(Int.) MxPS=3D 64 Ivl=3D2ms E: Ad=3D86(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D04(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms Signed-off-by: Carl Yin Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -1137,6 +1137,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, = 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, 0x0620, 0xff, 0xff, 0x= 30) }, /* EM160R-GL */ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, 0x0620, 0xff, 0, 0) }, + { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, 0x0700, 0xff), /* BG95 */ + .driver_info =3D RSVD(3) | ZLP }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q= , 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q= , 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q= , 0xff, 0xff, 0x10), From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 405CACCA497 for ; Tue, 7 Jun 2022 21:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384145AbiFGVyK (ORCPT ); Tue, 7 Jun 2022 17:54:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379037AbiFGVB7 (ORCPT ); Tue, 7 Jun 2022 17:01:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D085188E5D; Tue, 7 Jun 2022 11:46: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 16688B82018; Tue, 7 Jun 2022 18:46:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E413C385A2; Tue, 7 Jun 2022 18:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627573; bh=K8cwRLy74nAcCeG16MeX91VwfthlBiQKw/yx2Lx2yrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSdp7ax7dD5jHf7UdMMb/VP+niYer8Q357UeAGPb+Ru5JlVBY376lVlIvx2LTLg9I 2WAD4wpRHK2fGNnPWkAULKaVMuwqW1NAR5KC3s6qIXBjWoE1ynP0U3T7DPsoidjjZS Ev0Tph7oqE6QP/80ADikbgysZdE6EqABZROM3nh0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Monish Kumar R Subject: [PATCH 5.18 017/879] USB: new quirk for Dell Gen 2 devices Date: Tue, 7 Jun 2022 18:52:15 +0200 Message-Id: <20220607165003.172540432@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Monish Kumar R commit 97fa5887cf283bb75ffff5f6b2c0e71794c02400 upstream. Add USB_QUIRK_NO_LPM and USB_QUIRK_RESET_RESUME quirks for Dell usb gen 2 device to not fail during enumeration. Found this bug on own testing Signed-off-by: Monish Kumar R Cc: stable Link: https://lore.kernel.org/r/20220520130044.17303-1-monish.kumar.r@intel= .com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -510,6 +510,9 @@ static const struct usb_device_id usb_qu /* DJI CineSSD */ { USB_DEVICE(0x2ca3, 0x0031), .driver_info =3D USB_QUIRK_NO_LPM }, =20 + /* DELL USB GEN2 */ + { USB_DEVICE(0x413c, 0xb062), .driver_info =3D USB_QUIRK_NO_LPM | USB_QUI= RK_RESET_RESUME }, + /* VCOM device */ { USB_DEVICE(0x4296, 0x7570), .driver_info =3D USB_QUIRK_CONFIG_INTF_STRI= NGS }, From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F735CCA494 for ; Tue, 7 Jun 2022 21:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384085AbiFGVyH (ORCPT ); Tue, 7 Jun 2022 17:54:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379051AbiFGVCA (ORCPT ); Tue, 7 Jun 2022 17:02:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A562A188E5F; Tue, 7 Jun 2022 11:46: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 3D8D76156D; Tue, 7 Jun 2022 18:46:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A753C385A2; Tue, 7 Jun 2022 18:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627576; bh=COKzPOsl7kaNsDvx+z01yEVI+nhAt+B84z1IsdH3tzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TZir+/tXjmrZPpcl9MkFCJjYUNfBu1SxN2kCGpceY1VdPp0DgQICuVC92MhuS1731 rYPSMYM4TSvgvBGi1/IKSkWHk7Np97fG0wjm3MnoEFFnOC/ear8KTEuHVd31q4MXPJ OltieqgB3Vn5cf8nRbldipQ2RSrRxYNS0LqPTx2A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rui Miguel Silva , Dietmar Eggemann , Linus Walleij Subject: [PATCH 5.18 018/879] usb: isp1760: Fix out-of-bounds array access Date: Tue, 7 Jun 2022 18:52:16 +0200 Message-Id: <20220607165003.200430319@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 26ae2c942b5702f2e43d36b2a4389cfb7d616b6a upstream. Running the driver through kasan gives an interesting splat: BUG: KASAN: global-out-of-bounds in isp1760_register+0x180/0x70c Read of size 20 at addr f1db2e64 by task swapper/0/1 (...) isp1760_register from isp1760_plat_probe+0x1d8/0x220 (...) This happens because the loop reading the regmap fields for the different ISP1760 variants look like this: for (i =3D 0; i < HC_FIELD_MAX; i++) { ... } Meaning it expects the arrays to be at least HC_FIELD_MAX - 1 long. However the arrays isp1760_hc_reg_fields[], isp1763_hc_reg_fields[], isp1763_hc_volatile_ranges[] and isp1763_dc_volatile_ranges[] are dynamically sized during compilation. Fix this by putting an empty assignment to the [HC_FIELD_MAX] and [DC_FIELD_MAX] array member at the end of each array. This will make the array one member longer than it needs to be, but avoids the risk of overwriting whatever is inside [HC_FIELD_MAX - 1] and is simple and intuitive to read. Also add comments explaining what is going on. Fixes: 1da9e1c06873 ("usb: isp1760: move to regmap for register access") Cc: stable@vger.kernel.org Cc: Rui Miguel Silva Cc: Dietmar Eggemann Reviewed-by: Rui Miguel Silva Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20220516091424.391209-1-linus.walleij@linar= o.org Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/isp1760/isp1760-core.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/usb/isp1760/isp1760-core.c +++ b/drivers/usb/isp1760/isp1760-core.c @@ -251,6 +251,8 @@ static const struct reg_field isp1760_hc [HW_DM_PULLDOWN] =3D REG_FIELD(ISP176x_HC_OTG_CTRL, 2, 2), [HW_DP_PULLDOWN] =3D REG_FIELD(ISP176x_HC_OTG_CTRL, 1, 1), [HW_DP_PULLUP] =3D REG_FIELD(ISP176x_HC_OTG_CTRL, 0, 0), + /* Make sure the array is sized properly during compilation */ + [HC_FIELD_MAX] =3D {}, }; =20 static const struct reg_field isp1763_hc_reg_fields[] =3D { @@ -321,6 +323,8 @@ static const struct reg_field isp1763_hc [HW_DM_PULLDOWN_CLEAR] =3D REG_FIELD(ISP1763_HC_OTG_CTRL_CLEAR, 2, 2), [HW_DP_PULLDOWN_CLEAR] =3D REG_FIELD(ISP1763_HC_OTG_CTRL_CLEAR, 1, 1), [HW_DP_PULLUP_CLEAR] =3D REG_FIELD(ISP1763_HC_OTG_CTRL_CLEAR, 0, 0), + /* Make sure the array is sized properly during compilation */ + [HC_FIELD_MAX] =3D {}, }; =20 static const struct regmap_range isp1763_hc_volatile_ranges[] =3D { @@ -405,6 +409,8 @@ static const struct reg_field isp1761_dc [DC_CHIP_ID_HIGH] =3D REG_FIELD(ISP176x_DC_CHIPID, 16, 31), [DC_CHIP_ID_LOW] =3D REG_FIELD(ISP176x_DC_CHIPID, 0, 15), [DC_SCRATCH] =3D REG_FIELD(ISP176x_DC_SCRATCH, 0, 15), + /* Make sure the array is sized properly during compilation */ + [DC_FIELD_MAX] =3D {}, }; =20 static const struct regmap_range isp1763_dc_volatile_ranges[] =3D { @@ -458,6 +464,8 @@ static const struct reg_field isp1763_dc [DC_CHIP_ID_HIGH] =3D REG_FIELD(ISP1763_DC_CHIPID_HIGH, 0, 15), [DC_CHIP_ID_LOW] =3D REG_FIELD(ISP1763_DC_CHIPID_LOW, 0, 15), [DC_SCRATCH] =3D REG_FIELD(ISP1763_DC_SCRATCH, 0, 15), + /* Make sure the array is sized properly during compilation */ + [DC_FIELD_MAX] =3D {}, }; =20 static const struct regmap_config isp1763_dc_regmap_conf =3D { From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B595CCA48D for ; Tue, 7 Jun 2022 22:02:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349672AbiFGWCP (ORCPT ); Tue, 7 Jun 2022 18:02:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379064AbiFGVCA (ORCPT ); Tue, 7 Jun 2022 17:02:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63E6F11AFF1; Tue, 7 Jun 2022 11:46:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF7C96160D; Tue, 7 Jun 2022 18:46:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09978C385A5; Tue, 7 Jun 2022 18:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627579; bh=ISjmmFkAO+VM1yqXdbRb0UZ0YuSh7g7+PxFHZvOoPMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qMVUHs+zLhCOm/1R3QDBlz66fV3F6KxfkJok0uranU57mPp8C36kne3AmvWmULAnz /S8lYJizsv5EY+WTUYxhgKkhI8nzqdcET/KpqCiBcVTf9aNYD7dYMKffYssElAhmbb L5XEn3WF9nF0A2R4lC9ZOwDlLPh3BtF/GdB/BAHc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Albert Wang Subject: [PATCH 5.18 019/879] usb: dwc3: gadget: Move null pinter check to proper place Date: Tue, 7 Jun 2022 18:52:17 +0200 Message-Id: <20220607165003.228890970@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Albert Wang commit 3c5880745b4439ac64eccdb040e37fc1cc4c5406 upstream. When dwc3_gadget_ep_cleanup_completed_requests() called to dwc3_gadget_giveback() where the dwc3 lock is released, other thread is able to execute. In this situation, usb_ep_disable() gets the chance to clear endpoint descriptor pointer which leds to the null pointer dereference problem. So needs to move the null pointer check to a proper place. Example call stack: Thread#1: dwc3_thread_interrupt() spin_lock -> dwc3_process_event_buf() -> dwc3_process_event_entry() -> dwc3_endpoint_interrupt() -> dwc3_gadget_endpoint_trbs_complete() -> dwc3_gadget_ep_cleanup_completed_requests() ... -> dwc3_giveback() spin_unlock Thread#2 executes Thread#2: configfs_composite_disconnect() -> __composite_disconnect() -> ffs_func_disable() -> ffs_func_set_alt() -> ffs_func_eps_disable() -> usb_ep_disable() wait for dwc3 spin_lock Thread#1 released lock clear endpoint.desc Fixes: 26288448120b ("usb: dwc3: gadget: Fix null pointer exception") Cc: stable Signed-off-by: Albert Wang Link: https://lore.kernel.org/r/20220518061315.3359198-1-albertccwang@googl= e.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/dwc3/gadget.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -3380,14 +3380,14 @@ static bool dwc3_gadget_endpoint_trbs_co struct dwc3 *dwc =3D dep->dwc; bool no_started_trb =3D true; =20 - if (!dep->endpoint.desc) - return no_started_trb; - dwc3_gadget_ep_cleanup_completed_requests(dep, event, status); =20 if (dep->flags & DWC3_EP_END_TRANSFER_PENDING) goto out; =20 + if (!dep->endpoint.desc) + return no_started_trb; + if (usb_endpoint_xfer_isoc(dep->endpoint.desc) && list_empty(&dep->started_list) && (list_empty(&dep->pending_list) || status =3D=3D -EXDEV)) From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 766A9C433EF for ; Tue, 7 Jun 2022 22:04:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379096AbiFGWEV (ORCPT ); Tue, 7 Jun 2022 18:04:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378926AbiFGVDl (ORCPT ); Tue, 7 Jun 2022 17:03:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9AB418ADB0; Tue, 7 Jun 2022 11:48:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A6A6661579; Tue, 7 Jun 2022 18:48:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7ACCC385A2; Tue, 7 Jun 2022 18:48:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627727; bh=EGBFhl10/WxhjBf9f/lkCn81vM2bqbXJhwMAVy/nUBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hVtgxxQo2YGHvagykK4YyIbX1uV/Qhs40p8fMqsjcB3Rm29ca5i0B1dv2MxdPk4yZ Gh2cdtUhfA6pTX4Rq8513sOEmtMNk9MS9Iugx6SAQcXNgPS3G5Dy8MPK5k9Y2VO2wv M/htaDI4n9iiD3hRqr+t0OP4O7eew1SoNx4mPjaI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathias Nyman , Chris Chiu , Alan Stern , Kishon Vijay Abraham I Subject: [PATCH 5.18 020/879] usb: core: hcd: Add support for deferring roothub registration Date: Tue, 7 Jun 2022 18:52:18 +0200 Message-Id: <20220607165003.260971198@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kishon Vijay Abraham I commit a44623d9279086c89f631201d993aa332f7c9e66 upstream. It has been observed with certain PCIe USB cards (like Inateck connected to AM64 EVM or J7200 EVM) that as soon as the primary roothub is registered, port status change is handled even before xHC is running leading to cold plug USB devices not detected. For such cases, registering both the root hubs along with the second HCD is required. Add support for deferring roothub registration in usb_add_hcd(), so that both primary and secondary roothubs are registered along with the second HCD. This patch has been added and reverted earier as it triggered a race in usb device enumeration. That race is now fixed in 5.16-rc3, and in stable back to 5.4 commit 6cca13de26ee ("usb: hub: Fix locking issues with address0_mutex") commit 6ae6dc22d2d1 ("usb: hub: Fix usb enumeration issue due to address0 race") CC: stable@vger.kernel.org # 5.4+ Suggested-by: Mathias Nyman Tested-by: Chris Chiu Acked-by: Alan Stern Signed-off-by: Kishon Vijay Abraham I Link: https://lore.kernel.org/r/20220510091630.16564-2-kishon@ti.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/core/hcd.c | 29 +++++++++++++++++++++++------ include/linux/usb/hcd.h | 2 ++ 2 files changed, 25 insertions(+), 6 deletions(-) --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2816,6 +2816,7 @@ int usb_add_hcd(struct usb_hcd *hcd, { int retval; struct usb_device *rhdev; + struct usb_hcd *shared_hcd; =20 if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) { hcd->phy_roothub =3D usb_phy_roothub_alloc(hcd->self.sysdev); @@ -2976,13 +2977,26 @@ int usb_add_hcd(struct usb_hcd *hcd, goto err_hcd_driver_start; } =20 + /* starting here, usbcore will pay attention to the shared HCD roothub */ + shared_hcd =3D hcd->shared_hcd; + if (!usb_hcd_is_primary_hcd(hcd) && shared_hcd && HCD_DEFER_RH_REGISTER(s= hared_hcd)) { + retval =3D register_root_hub(shared_hcd); + if (retval !=3D 0) + goto err_register_root_hub; + + if (shared_hcd->uses_new_polling && HCD_POLL_RH(shared_hcd)) + usb_hcd_poll_rh_status(shared_hcd); + } + /* starting here, usbcore will pay attention to this root hub */ - retval =3D register_root_hub(hcd); - if (retval !=3D 0) - goto err_register_root_hub; + if (!HCD_DEFER_RH_REGISTER(hcd)) { + retval =3D register_root_hub(hcd); + if (retval !=3D 0) + goto err_register_root_hub; =20 - if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) - usb_hcd_poll_rh_status(hcd); + if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) + usb_hcd_poll_rh_status(hcd); + } =20 return retval; =20 @@ -3020,6 +3034,7 @@ EXPORT_SYMBOL_GPL(usb_add_hcd); void usb_remove_hcd(struct usb_hcd *hcd) { struct usb_device *rhdev =3D hcd->self.root_hub; + bool rh_registered; =20 dev_info(hcd->self.controller, "remove, state %x\n", hcd->state); =20 @@ -3030,6 +3045,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) =20 dev_dbg(hcd->self.controller, "roothub graceful disconnect\n"); spin_lock_irq (&hcd_root_hub_lock); + rh_registered =3D hcd->rh_registered; hcd->rh_registered =3D 0; spin_unlock_irq (&hcd_root_hub_lock); =20 @@ -3039,7 +3055,8 @@ void usb_remove_hcd(struct usb_hcd *hcd) cancel_work_sync(&hcd->died_work); =20 mutex_lock(&usb_bus_idr_lock); - usb_disconnect(&rhdev); /* Sets rhdev to NULL */ + if (rh_registered) + usb_disconnect(&rhdev); /* Sets rhdev to NULL */ mutex_unlock(&usb_bus_idr_lock); =20 /* --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -124,6 +124,7 @@ struct usb_hcd { #define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */ #define HCD_FLAG_DEAD 6 /* controller has died? */ #define HCD_FLAG_INTF_AUTHORIZED 7 /* authorize interfaces? */ +#define HCD_FLAG_DEFER_RH_REGISTER 8 /* Defer roothub registration */ =20 /* The flags can be tested using these macros; they are likely to * be slightly faster than test_bit(). @@ -134,6 +135,7 @@ struct usb_hcd { #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PEN= DING)) #define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING)) #define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD)) +#define HCD_DEFER_RH_REGISTER(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEFER_R= H_REGISTER)) =20 /* * Specifies if interfaces are authorized by default From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCA6CCCA483 for ; Tue, 7 Jun 2022 22:02:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383190AbiFGWB0 (ORCPT ); Tue, 7 Jun 2022 18:01:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379179AbiFGVCJ (ORCPT ); Tue, 7 Jun 2022 17:02:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C73CF188EBD; Tue, 7 Jun 2022 11:46:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6522B6160D; Tue, 7 Jun 2022 18:46:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7030FC385A5; Tue, 7 Jun 2022 18:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627607; bh=UkTbKdloFik5b/VHaRD1dza9i2d0N/klIUWUZfxdVnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e1YTQwRO9vzpSHy3Pz9EIh64CmWtnFXpb+joWZn3l8sEgFz5aH56oOlINglb21/6q rs1KKtFSanDrgEynvSujsvonVUIF6y9bVlijZ3Fjllu203MWMe1GsLwLGzs9e+ysFh n0vTIVyr99ErDjavaRSYwwAjLK1CvAKFng4Ag6nI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Luis=20Lara=20Carrascal?= , Mikulas Patocka , "Matthew Wilcox (Oracle)" , Namjae Jeon , Konstantin Komarov Subject: [PATCH 5.18 021/879] fs/ntfs3: provide block_invalidate_folio to fix memory leak Date: Tue, 7 Jun 2022 18:52:19 +0200 Message-Id: <20220607165003.290298143@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikulas Patocka commit 724bbe49c5e427cb077357d72d240a649f2e4054 upstream. The ntfs3 filesystem lacks the 'invalidate_folio' method and it causes memory leak. If you write to the filesystem and then unmount it, the cached written data are not freed and they are permanently leaked. Fixes: 7ba13abbd31e ("fs: Turn block_invalidatepage into block_invalidate_f= olio") Reported-by: Jos=C3=A9 Luis Lara Carrascal Signed-off-by: Mikulas Patocka Acked-by: Matthew Wilcox (Oracle) Reviewed-by: Namjae Jeon Signed-off-by: Konstantin Komarov Cc: stable@vger.kernel.org # v5.18 Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ntfs3/inode.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1951,6 +1951,7 @@ const struct address_space_operations nt .direct_IO =3D ntfs_direct_IO, .bmap =3D ntfs_bmap, .dirty_folio =3D block_dirty_folio, + .invalidate_folio =3D block_invalidate_folio, }; =20 const struct address_space_operations ntfs_aops_cmpr =3D { From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EF73CCA49C for ; Tue, 7 Jun 2022 21:56:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382445AbiFGVzy (ORCPT ); Tue, 7 Jun 2022 17:55:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379274AbiFGVCS (ORCPT ); Tue, 7 Jun 2022 17:02:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D914F4CD7B; Tue, 7 Jun 2022 11:47:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 744D1612F2; Tue, 7 Jun 2022 18:47:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 840ECC385A2; Tue, 7 Jun 2022 18:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627638; bh=uYiciictdrSEQB12gEqhK2G+ukdTSz3fit8pE6wltZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oh9xtc1CLoAeT0OqYnKlRNZUkE2Us+NDh9hAyz1zTIA4XkV4FAlHNUNRI5jQgUwVI G1oZ8JV/9qQQUzPV5z+xvH4DgF3I3pJoFpIDA1RW5ZlbK095MsSQPJCfBKngc0Slj4 b91jT8l5pmzfdeSESBcBCpMCjqQNqWiEb5Mp4BGo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Komarov Subject: [PATCH 5.18 022/879] fs/ntfs3: Update valid size if -EIOCBQUEUED Date: Tue, 7 Jun 2022 18:52:20 +0200 Message-Id: <20220607165003.320075307@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konstantin Komarov commit 52e00ea6b26e45fb8159e3b57cdde8d3f9bdd8e9 upstream. Update valid size if write is still in I/O queue. Fixes xfstest generic/240 Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ntfs3/inode.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -757,6 +757,7 @@ static ssize_t ntfs_direct_IO(struct kio loff_t vbo =3D iocb->ki_pos; loff_t end; int wr =3D iov_iter_rw(iter) & WRITE; + size_t iter_count =3D iov_iter_count(iter); loff_t valid; ssize_t ret; =20 @@ -770,10 +771,13 @@ static ssize_t ntfs_direct_IO(struct kio wr ? ntfs_get_block_direct_IO_W : ntfs_get_block_direct_IO_R); =20 - if (ret <=3D 0) + if (ret > 0) + end =3D vbo + ret; + else if (wr && ret =3D=3D -EIOCBQUEUED) + end =3D vbo + iter_count; + else goto out; =20 - end =3D vbo + ret; valid =3D ni->i_valid; if (wr) { if (end > valid && !S_ISBLK(inode->i_mode)) { From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54329CCA48B for ; Tue, 7 Jun 2022 21:56:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356426AbiFGV4l (ORCPT ); Tue, 7 Jun 2022 17:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379361AbiFGVCX (ORCPT ); Tue, 7 Jun 2022 17:02:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E08A813EF; Tue, 7 Jun 2022 11:47:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 304E4B81FE1; Tue, 7 Jun 2022 18:47:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E439C36AFF; Tue, 7 Jun 2022 18:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627668; bh=bH3s1BVToRvgFhBLsu+cvbtMNthczz1FNbaIJi0JObM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qqiiMYtDR5CpxGG5qVnxmDj0OvnHXIE9HKKBHxzWL7YRgDUFVWfeeniYDp8WerHc6 lgofgMp/U/KfyeMof9LF3TACsZWX3rwdICqnLl8BonvLqagGprVNNPvgf9BLYaeENm o4UksWXCvDEUmysjb88NLuZYzQPJ2u6zc2Q6gMA0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Komarov Subject: [PATCH 5.18 023/879] fs/ntfs3: Fix fiemap + fix shrink file size (to remove preallocated space) Date: Tue, 7 Jun 2022 18:52:21 +0200 Message-Id: <20220607165003.348544698@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konstantin Komarov commit 3880f2b816a7e4ca889b7e8a42e6c62c5706ed36 upstream. Two problems: 1. ntfs3_setattr can't truncate preallocated space; 2. if allocated fragment "cross" valid size, then fragment splits into two = parts: - normal part; - unwritten part (here we must return FIEMAP_EXTENT_LAST). Before this commit we returned FIEMAP_EXTENT_LAST for whole fragment. Fixes xfstest generic/092 Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation") Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ntfs3/file.c | 2 +- fs/ntfs3/frecord.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -762,7 +762,7 @@ int ntfs3_setattr(struct user_namespace } inode_dio_wait(inode); =20 - if (attr->ia_size < oldsize) + if (attr->ia_size <=3D oldsize) err =3D ntfs_truncate(inode, attr->ia_size); else if (attr->ia_size > oldsize) err =3D ntfs_extend(inode, attr->ia_size, 0, NULL); --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -1964,10 +1964,8 @@ int ni_fiemap(struct ntfs_inode *ni, str =20 vcn +=3D clen; =20 - if (vbo + bytes >=3D end) { + if (vbo + bytes >=3D end) bytes =3D end - vbo; - flags |=3D FIEMAP_EXTENT_LAST; - } =20 if (vbo + bytes <=3D valid) { ; @@ -1977,6 +1975,9 @@ int ni_fiemap(struct ntfs_inode *ni, str /* vbo < valid && valid < vbo + bytes */ u64 dlen =3D valid - vbo; =20 + if (vbo + dlen >=3D end) + flags |=3D FIEMAP_EXTENT_LAST; + err =3D fiemap_fill_next_extent(fieinfo, vbo, lbo, dlen, flags); if (err < 0) @@ -1995,6 +1996,9 @@ int ni_fiemap(struct ntfs_inode *ni, str flags |=3D FIEMAP_EXTENT_UNWRITTEN; } =20 + if (vbo + bytes >=3D end) + flags |=3D FIEMAP_EXTENT_LAST; + err =3D fiemap_fill_next_extent(fieinfo, vbo, lbo, bytes, flags); if (err < 0) break; From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F0E1CCA47F for ; Tue, 7 Jun 2022 22:02:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383038AbiFGWAy (ORCPT ); Tue, 7 Jun 2022 18:00:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377303AbiFGVCo (ORCPT ); Tue, 7 Jun 2022 17:02: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 A51EE123883; Tue, 7 Jun 2022 11:48: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 C35E4B8239B; Tue, 7 Jun 2022 18:48:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12A42C385A5; Tue, 7 Jun 2022 18:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627699; bh=0wUPtvcxsDb/X2qUcKd/zlt/iXNEj20UtsVY8xySO5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ebM/M2QKZ3ObhQ2hKSB9pjymjUlXMUkgQvluoOjQwRIQXzXGdnVZ3XGNyYS0s2eRI 7XFYMtXSxAGOkwuahU0wYgFyBJvgZQmpYXcRBzddAjB9ZmlSPsjVmbTyzoMuAz/ldF 3vDZ9m6AvIf+xv3AfHVueq4nvK6AQ0d0vJhEEIYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ganapathi Kamath , Kari Argillander , Konstantin Komarov Subject: [PATCH 5.18 024/879] fs/ntfs3: Keep preallocated only if option prealloc enabled Date: Tue, 7 Jun 2022 18:52:22 +0200 Message-Id: <20220607165003.376780972@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konstantin Komarov commit e95113ed4d428219e3395044e29f5713fc446720 upstream. If size of file was reduced, we still kept allocated blocks. This commit makes ntfs3 work as other fs like btrfs. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D214719 Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation") Reported-by: Ganapathi Kamath Tested-by: Ganapathi Kamath Reviewed-by: Kari Argillander Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ntfs3/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -495,7 +495,7 @@ static int ntfs_truncate(struct inode *i =20 down_write(&ni->file.run_lock); err =3D attr_set_size(ni, ATTR_DATA, NULL, 0, &ni->file.run, new_size, - &new_valid, true, NULL); + &new_valid, ni->mi.sbi->options->prealloc, NULL); up_write(&ni->file.run_lock); =20 if (new_valid < ni->i_valid) From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0441CCA482 for ; Tue, 7 Jun 2022 22:02:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378488AbiFGWCY (ORCPT ); Tue, 7 Jun 2022 18:02:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378609AbiFGVDM (ORCPT ); Tue, 7 Jun 2022 17:03:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BE451455B8; Tue, 7 Jun 2022 11:48: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 4CE6CB8239A; Tue, 7 Jun 2022 18:48:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB6CCC385A2; Tue, 7 Jun 2022 18:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627713; bh=sXhJAaUuI/+gq3WeDf4mmfghVWZcp4jTAcy/lc5Txhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TYxilvcORvrNH/fH0N3rcz1YJo96SM1rauqUL7CXBXO56hVaAHVD0xe6s94tjaFi3 vA2/aD0QdHZY2Qz/OC1XznkIE8mlBBv8ArX5/JMlzGhnEsy+qnzNVO6uLrBNwoxV88 rUo5/SYhgLwURBEla3OXXxxvwuETwz8KoJqBeTog= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kari Argillander , Konstantin Komarov Subject: [PATCH 5.18 025/879] fs/ntfs3: Check new size for limits Date: Tue, 7 Jun 2022 18:52:23 +0200 Message-Id: <20220607165003.406662524@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konstantin Komarov commit 114346978cf61de02832cc3cc68432a3de70fb38 upstream. We must check size before trying to allocate. Size can be set for example by "ulimit -f". Fixes xfstest generic/228 Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation") Reviewed-by: Kari Argillander Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ntfs3/file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -662,7 +662,13 @@ static long ntfs_fallocate(struct file * /* * Normal file: Allocate clusters, do not change 'valid' size. */ - err =3D ntfs_set_size(inode, max(end, i_size)); + loff_t new_size =3D max(end, i_size); + + err =3D inode_newsize_ok(inode, new_size); + if (err) + goto out; + + err =3D ntfs_set_size(inode, new_size); if (err) goto out; From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 109E9C433EF for ; Tue, 7 Jun 2022 22:03:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379275AbiFGWDj (ORCPT ); Tue, 7 Jun 2022 18:03:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378665AbiFGVDX (ORCPT ); Tue, 7 Jun 2022 17:03:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E17B3145589; Tue, 7 Jun 2022 11:48: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 7F1BA61295; Tue, 7 Jun 2022 18:48:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BA19C385A2; Tue, 7 Jun 2022 18:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627715; bh=qO2K96LJDhbirD99gp0YVHECVMdEPs1haKCeGlOd7O0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0XIe/dzPnfwJ/bsDQODmzGdNvbFD6ABI6/rreRtwYI/IxXPWZ2lhokRnCMTsX+sgg +xH4v0fd0+59idN32kj8WqBF6+0/aM4O6zCm2QsKgYfF96pycqo3xywmt1Dk5lQWJB RG37+kbXrSCteus25fgxG6Bd5QcylBxhbTtO/t+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Perches , Konstantin Komarov Subject: [PATCH 5.18 026/879] fs/ntfs3: In function ntfs_set_acl_ex do not change inode->i_mode if called from function ntfs_init_acl Date: Tue, 7 Jun 2022 18:52:24 +0200 Message-Id: <20220607165003.435264945@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konstantin Komarov commit 9186d472ee780fabf74424756c4c00545166157e upstream. ntfs_init_acl sets mode. ntfs_init_acl calls ntfs_set_acl_ex. ntfs_set_acl_ex must not change this mode. Fixes xfstest generic/444 Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations") Reviewed-by: Joe Perches Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ntfs3/xattr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -541,7 +541,7 @@ struct posix_acl *ntfs_get_acl(struct in =20 static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, struct inode *inode, struct posix_acl *acl, - int type) + int type, bool init_acl) { const char *name; size_t size, name_len; @@ -554,8 +554,9 @@ static noinline int ntfs_set_acl_ex(stru =20 switch (type) { case ACL_TYPE_ACCESS: - if (acl) { - umode_t mode =3D inode->i_mode; + /* Do not change i_mode if we are in init_acl */ + if (acl && !init_acl) { + umode_t mode; =20 err =3D posix_acl_update_mode(mnt_userns, inode, &mode, &acl); @@ -616,7 +617,7 @@ out: int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode, struct posix_acl *acl, int type) { - return ntfs_set_acl_ex(mnt_userns, inode, acl, type); + return ntfs_set_acl_ex(mnt_userns, inode, acl, type, false); } =20 /* @@ -636,7 +637,7 @@ int ntfs_init_acl(struct user_namespace =20 if (default_acl) { err =3D ntfs_set_acl_ex(mnt_userns, inode, default_acl, - ACL_TYPE_DEFAULT); + ACL_TYPE_DEFAULT, true); posix_acl_release(default_acl); } else { inode->i_default_acl =3D NULL; @@ -647,7 +648,7 @@ int ntfs_init_acl(struct user_namespace else { if (!err) err =3D ntfs_set_acl_ex(mnt_userns, inode, acl, - ACL_TYPE_ACCESS); + ACL_TYPE_ACCESS, true); posix_acl_release(acl); } From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97006C433EF for ; Tue, 7 Jun 2022 22:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382516AbiFGWDz (ORCPT ); Tue, 7 Jun 2022 18:03:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378736AbiFGVDg (ORCPT ); Tue, 7 Jun 2022 17:03:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0159E1451E5; Tue, 7 Jun 2022 11:48:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 45E8C612F2; Tue, 7 Jun 2022 18:48:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 525C1C385A2; Tue, 7 Jun 2022 18:48:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627718; bh=YONjxaeXJNfdjI6X1ZBJqFnOHU4P3dRFG2L57MY6MtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E05YtYol4r6U58w/TarxCg7ynnAHFDppkzKiUqgpmjyIDbh4zMxalKpoBEeFtusFq eYrZR1pP1cPqujD8LmVqUymPM7ByPSNAHOQCMtH/6VOTecdg0aZLJ9Zo31I7DDJzYw jE6M3OZ74s8xX8a1wJ21aO1+QG60S3nVGpu1MJdQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Konstantin Komarov Subject: [PATCH 5.18 027/879] fs/ntfs3: Fix some memory leaks in an error handling path of log_replay() Date: Tue, 7 Jun 2022 18:52:25 +0200 Message-Id: <20220607165003.463322950@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET commit e589f9b7078e1c0191613cd736f598e81d2390de upstream. All error handling paths lead to 'out' where many resources are freed. Do it as well here instead of a direct return, otherwise 'log', 'ra' and 'log->one_page_buf' (at least) will leak. Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal") Signed-off-by: Christophe JAILLET Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ntfs3/fslog.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -4085,8 +4085,10 @@ process_log: if (client =3D=3D LFS_NO_CLIENT_LE) { /* Insert "NTFS" client LogFile. */ client =3D ra->client_idx[0]; - if (client =3D=3D LFS_NO_CLIENT_LE) - return -EINVAL; + if (client =3D=3D LFS_NO_CLIENT_LE) { + err =3D -EINVAL; + goto out; + } =20 t16 =3D le16_to_cpu(client); cr =3D ca + t16; From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 217A5C433EF for ; Tue, 7 Jun 2022 22:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382799AbiFGWEh (ORCPT ); Tue, 7 Jun 2022 18:04:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378863AbiFGVDj (ORCPT ); Tue, 7 Jun 2022 17:03:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18E6F18A879; Tue, 7 Jun 2022 11:48:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 199296156D; Tue, 7 Jun 2022 18:48:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26177C385A2; Tue, 7 Jun 2022 18:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627721; bh=24/+sW6Sob7YMv6wVRkObr+QQ67G3CdFjp9sCUgysVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B8gAGp9vy41VWHqzJZLHlRr2Pqdq2Iy9ioDIXun/6+4PEJQsmueBm75gFttbqt5Yg tNMg2N6AKdVlJWcNOyP1UC6HpXdHJY6SNnn4C6bXsWONS/4lI/uQ3fxIiQMVxLybo+ cF0rodDs4sCczl5tqsCJHVL+TNZz5rl44J5Sqt+8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Komarov Subject: [PATCH 5.18 028/879] fs/ntfs3: Update i_ctime when xattr is added Date: Tue, 7 Jun 2022 18:52:26 +0200 Message-Id: <20220607165003.492806765@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konstantin Komarov commit 2d44667c306e7806848a3478820f87343feb5421 upstream. Ctime wasn't updated after setfacl command. This commit fixes xfstest generic/307 Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations") Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ntfs3/xattr.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -902,6 +902,9 @@ set_new_fa: err =3D ntfs_set_ea(inode, name, name_len, value, size, flags); =20 out: + inode->i_ctime =3D current_time(inode); + mark_inode_dirty(inode); + return err; } From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26ABCC433EF for ; Tue, 7 Jun 2022 22:04:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382576AbiFGWEa (ORCPT ); Tue, 7 Jun 2022 18:04:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352386AbiFGVDk (ORCPT ); Tue, 7 Jun 2022 17:03:40 -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 4E3F318AD9F; Tue, 7 Jun 2022 11:48:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CA61561295; Tue, 7 Jun 2022 18:48:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD2CEC385A2; Tue, 7 Jun 2022 18:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627724; bh=dbFetGycNFqXLnLqpJOm7aVXcJy1sch1epqabjZaOMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ces99LBiAlJs7J1f+7a/EETAhNiWEKUh1ZzEjgdFOX2wD4P7N9iHP47MUn5Iad8Eo PWjfqB3C2JrlSZOrsqY79nGjmGgTa4tWkadv5+ybaJWP7beqvilPE8CkH60NaR+8Rv 87Qk76/MBOssYB7BTWftItkNmaBT/6lSSckaLFk8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kari Argillander , Konstantin Komarov Subject: [PATCH 5.18 029/879] fs/ntfs3: Restore ntfs_xattr_get_acl and ntfs_xattr_set_acl functions Date: Tue, 7 Jun 2022 18:52:27 +0200 Message-Id: <20220607165003.521838932@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konstantin Komarov commit 87e21c99bad763524c953ff4d1a61ee19038ddc2 upstream. Apparently we need to maintain these functions with ntfs_get_acl_ex and ntfs_set_acl_ex. This commit fixes xfstest generic/099 Fixes: 95dd8b2c1ed0 ("fs/ntfs3: Remove unnecessary functions") Reviewed-by: Kari Argillander Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/ntfs3/xattr.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++= ++++- 1 file changed, 95 insertions(+), 1 deletion(-) --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -112,7 +112,7 @@ static int ntfs_read_ea(struct ntfs_inod return -ENOMEM; =20 if (!size) { - ; + /* EA info persists, but xattr is empty. Looks like EA problem. */ } else if (attr_ea->non_res) { struct runs_tree run; =20 @@ -620,6 +620,67 @@ int ntfs_set_acl(struct user_namespace * return ntfs_set_acl_ex(mnt_userns, inode, acl, type, false); } =20 +static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns, + struct inode *inode, int type, void *buffer, + size_t size) +{ + struct posix_acl *acl; + int err; + + if (!(inode->i_sb->s_flags & SB_POSIXACL)) { + ntfs_inode_warn(inode, "add mount option \"acl\" to use acl"); + return -EOPNOTSUPP; + } + + acl =3D ntfs_get_acl(inode, type, false); + if (IS_ERR(acl)) + return PTR_ERR(acl); + + if (!acl) + return -ENODATA; + + err =3D posix_acl_to_xattr(mnt_userns, acl, buffer, size); + posix_acl_release(acl); + + return err; +} + +static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns, + struct inode *inode, int type, const void *value, + size_t size) +{ + struct posix_acl *acl; + int err; + + if (!(inode->i_sb->s_flags & SB_POSIXACL)) { + ntfs_inode_warn(inode, "add mount option \"acl\" to use acl"); + return -EOPNOTSUPP; + } + + if (!inode_owner_or_capable(mnt_userns, inode)) + return -EPERM; + + if (!value) { + acl =3D NULL; + } else { + acl =3D posix_acl_from_xattr(mnt_userns, value, size); + if (IS_ERR(acl)) + return PTR_ERR(acl); + + if (acl) { + err =3D posix_acl_valid(mnt_userns, acl); + if (err) + goto release_and_out; + } + } + + err =3D ntfs_set_acl(mnt_userns, inode, acl, type); + +release_and_out: + posix_acl_release(acl); + return err; +} + /* * ntfs_init_acl - Initialize the ACLs of a new inode. * @@ -786,6 +847,23 @@ static int ntfs_getxattr(const struct xa goto out; } =20 +#ifdef CONFIG_NTFS3_FS_POSIX_ACL + if ((name_len =3D=3D sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 && + !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS, + sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) || + (name_len =3D=3D sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 && + !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT, + sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) { + /* TODO: init_user_ns? */ + err =3D ntfs_xattr_get_acl( + &init_user_ns, inode, + name_len =3D=3D sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 + ? ACL_TYPE_ACCESS + : ACL_TYPE_DEFAULT, + buffer, size); + goto out; + } +#endif /* Deal with NTFS extended attribute. */ err =3D ntfs_get_ea(inode, name, name_len, buffer, size, NULL); =20 @@ -898,6 +976,22 @@ set_new_fa: goto out; } =20 +#ifdef CONFIG_NTFS3_FS_POSIX_ACL + if ((name_len =3D=3D sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 && + !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS, + sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) || + (name_len =3D=3D sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 && + !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT, + sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) { + err =3D ntfs_xattr_set_acl( + mnt_userns, inode, + name_len =3D=3D sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 + ? ACL_TYPE_ACCESS + : ACL_TYPE_DEFAULT, + value, size); + goto out; + } +#endif /* Deal with NTFS extended attribute. */ err =3D ntfs_set_ea(inode, name, name_len, value, size, flags); From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7851ACCA47F for ; Tue, 7 Jun 2022 21:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377461AbiFGVyy (ORCPT ); Tue, 7 Jun 2022 17:54:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379200AbiFGVCL (ORCPT ); Tue, 7 Jun 2022 17:02:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E11411E1F3; Tue, 7 Jun 2022 11:46:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C35EBB8220B; Tue, 7 Jun 2022 18:46:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AC29C385A5; Tue, 7 Jun 2022 18:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627610; bh=eQJDeW28Q8lNsEGx74LsciocffWBnYZhpPkrpvgHptg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PIJ61amGj9mlHBpPzvxHY0DYmalA558cFH6sDK2qvsgnxXRL+5sCqqoTfVS2F/GnG 6Qud4Y2y3ZsPipQ+/sAADGHL8+VCwoxuGGV9Y4jEsDMx5zfsV4DCtNQkUHM5jc70nB +flZWsYlUdUnKRq5/IOIL/c7t3FsEAOp0B5yYbn0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Enzo Matsumiya , Steve French Subject: [PATCH 5.18 030/879] cifs: dont call cifs_dfs_query_info_nonascii_quirk() if nodfs was set Date: Tue, 7 Jun 2022 18:52:28 +0200 Message-Id: <20220607165003.550879611@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Enzo Matsumiya commit 421ef3d56513b2ff02e563623688cb6ab4977c4f upstream. Also return EOPNOTSUPP if path is remote but nodfs was set. Fixes: a2809d0e1696 ("cifs: quirk for STATUS_OBJECT_NAME_INVALID returned f= or non-ASCII dfs refs") Cc: stable@vger.kernel.org Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Enzo Matsumiya Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/cifs/connect.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3432,6 +3432,7 @@ static int is_path_remote(struct mount_c struct cifs_tcon *tcon =3D mnt_ctx->tcon; struct smb3_fs_context *ctx =3D mnt_ctx->fs_ctx; char *full_path; + bool nodfs =3D cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS; =20 if (!server->ops->is_path_accessible) return -EOPNOTSUPP; @@ -3449,14 +3450,20 @@ static int is_path_remote(struct mount_c rc =3D server->ops->is_path_accessible(xid, tcon, cifs_sb, full_path); #ifdef CONFIG_CIFS_DFS_UPCALL + if (nodfs) { + if (rc =3D=3D -EREMOTE) + rc =3D -EOPNOTSUPP; + goto out; + } + + /* path *might* exist with non-ASCII characters in DFS root + * try again with full path (only if nodfs is not set) */ if (rc =3D=3D -ENOENT && is_tcon_dfs(tcon)) rc =3D cifs_dfs_query_info_nonascii_quirk(xid, tcon, cifs_sb, full_path); #endif - if (rc !=3D 0 && rc !=3D -EREMOTE) { - kfree(full_path); - return rc; - } + if (rc !=3D 0 && rc !=3D -EREMOTE) + goto out; =20 if (rc !=3D -EREMOTE) { rc =3D cifs_are_all_path_components_accessible(server, xid, tcon, @@ -3468,6 +3475,7 @@ static int is_path_remote(struct mount_c } } =20 +out: kfree(full_path); return rc; } From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EB99CCA482 for ; Tue, 7 Jun 2022 21:56:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378194AbiFGVzA (ORCPT ); Tue, 7 Jun 2022 17:55:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379201AbiFGVCL (ORCPT ); Tue, 7 Jun 2022 17:02:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BF5D1203D4; Tue, 7 Jun 2022 11:46:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D80F26156D; Tue, 7 Jun 2022 18:46:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6FA5C385A2; Tue, 7 Jun 2022 18:46:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627613; bh=pXhqvl9Prhi+I+cIV2Zsg8ToLcJLpo51jTXHhnpd+Lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VZqmskhmofU995+yuU7fzOQMC0ZaQaYXs3TSYX6A9j9lHnurLktq7aNacdmMofRJm QAVRYEaKnpmHvY9J1BHPgwWOwRsgmkN+BtbnPf5koZ/xd/ISgnT0VbZDcyyIXjtVqS 9U6+m3tMYKvyIOwY7BHD9ThwP1pe2/TRv+j20v6E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Byron Stanoszek , "Paulo Alcantara (SUSE)" , Steve French Subject: [PATCH 5.18 031/879] cifs: fix ntlmssp on old servers Date: Tue, 7 Jun 2022 18:52:29 +0200 Message-Id: <20220607165003.579512241@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paulo Alcantara commit de3a9e943ddecba8d2ac1dde4cfff538e5c6a7b9 upstream. Some older servers seem to require the workstation name during ntlmssp to be at most 15 chars (RFC1001 name length), so truncate it before sending when using insecure dialects. Link: https://lore.kernel.org/r/e6837098-15d9-acb6-7e34-1923cf8c6fe1@winds.= org Reported-by: Byron Stanoszek Tested-by: Byron Stanoszek Fixes: 49bd49f983b5 ("cifs: send workstation name during ntlmssp session se= tup") Cc: stable@vger.kernel.org Signed-off-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/cifs/cifsglob.h | 15 ++++++++++++++- fs/cifs/connect.c | 22 ++++------------------ fs/cifs/fs_context.c | 29 ++++------------------------- fs/cifs/fs_context.h | 2 +- fs/cifs/misc.c | 1 - fs/cifs/sess.c | 6 +++--- 6 files changed, 26 insertions(+), 49 deletions(-) --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -944,7 +944,7 @@ struct cifs_ses { and after mount option parsing we fill it */ char *domainName; char *password; - char *workstation_name; + char workstation_name[CIFS_MAX_WORKSTATION_LEN]; struct session_key auth_key; struct ntlmssp_auth *ntlmssp; /* ciphertext, flags, server challenge */ enum securityEnum sectype; /* what security flavor was specified? */ @@ -1979,4 +1979,17 @@ static inline bool cifs_is_referral_serv return is_tcon_dfs(tcon) || (ref && (ref->flags & DFSREF_REFERRAL_SERVER)= ); } =20 +static inline size_t ntlmssp_workstation_name_size(const struct cifs_ses *= ses) +{ + if (WARN_ON_ONCE(!ses || !ses->server)) + return 0; + /* + * Make workstation name no more than 15 chars when using insecure dialec= ts as some legacy + * servers do require it during NTLMSSP. + */ + if (ses->server->dialect <=3D SMB20_PROT_ID) + return min_t(size_t, sizeof(ses->workstation_name), RFC1001_NAME_LEN_WIT= H_NULL); + return sizeof(ses->workstation_name); +} + #endif /* _CIFS_GLOB_H */ --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2037,18 +2037,7 @@ cifs_set_cifscreds(struct smb3_fs_contex } } =20 - ctx->workstation_name =3D kstrdup(ses->workstation_name, GFP_KERNEL); - if (!ctx->workstation_name) { - cifs_dbg(FYI, "Unable to allocate memory for workstation_name\n"); - rc =3D -ENOMEM; - kfree(ctx->username); - ctx->username =3D NULL; - kfree_sensitive(ctx->password); - ctx->password =3D NULL; - kfree(ctx->domainname); - ctx->domainname =3D NULL; - goto out_key_put; - } + strscpy(ctx->workstation_name, ses->workstation_name, sizeof(ctx->worksta= tion_name)); =20 out_key_put: up_read(&key->sem); @@ -2157,12 +2146,9 @@ cifs_get_smb_ses(struct TCP_Server_Info if (!ses->domainName) goto get_ses_fail; } - if (ctx->workstation_name) { - ses->workstation_name =3D kstrdup(ctx->workstation_name, - GFP_KERNEL); - if (!ses->workstation_name) - goto get_ses_fail; - } + + strscpy(ses->workstation_name, ctx->workstation_name, sizeof(ses->worksta= tion_name)); + if (ctx->domainauto) ses->domainAuto =3D ctx->domainauto; ses->cred_uid =3D ctx->cred_uid; --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -312,7 +312,6 @@ smb3_fs_context_dup(struct smb3_fs_conte new_ctx->password =3D NULL; new_ctx->server_hostname =3D NULL; new_ctx->domainname =3D NULL; - new_ctx->workstation_name =3D NULL; new_ctx->UNC =3D NULL; new_ctx->source =3D NULL; new_ctx->iocharset =3D NULL; @@ -327,7 +326,6 @@ smb3_fs_context_dup(struct smb3_fs_conte DUP_CTX_STR(UNC); DUP_CTX_STR(source); DUP_CTX_STR(domainname); - DUP_CTX_STR(workstation_name); DUP_CTX_STR(nodename); DUP_CTX_STR(iocharset); =20 @@ -766,8 +764,7 @@ static int smb3_verify_reconfigure_ctx(s cifs_errorf(fc, "can not change domainname during remount\n"); return -EINVAL; } - if (new_ctx->workstation_name && - (!old_ctx->workstation_name || strcmp(new_ctx->workstation_name, old_= ctx->workstation_name))) { + if (strcmp(new_ctx->workstation_name, old_ctx->workstation_name)) { cifs_errorf(fc, "can not change workstation_name during remount\n"); return -EINVAL; } @@ -814,7 +811,6 @@ static int smb3_reconfigure(struct fs_co STEAL_STRING(cifs_sb, ctx, username); STEAL_STRING(cifs_sb, ctx, password); STEAL_STRING(cifs_sb, ctx, domainname); - STEAL_STRING(cifs_sb, ctx, workstation_name); STEAL_STRING(cifs_sb, ctx, nodename); STEAL_STRING(cifs_sb, ctx, iocharset); =20 @@ -1467,22 +1463,15 @@ static int smb3_fs_context_parse_param(s =20 int smb3_init_fs_context(struct fs_context *fc) { - int rc; struct smb3_fs_context *ctx; char *nodename =3D utsname()->nodename; int i; =20 ctx =3D kzalloc(sizeof(struct smb3_fs_context), GFP_KERNEL); - if (unlikely(!ctx)) { - rc =3D -ENOMEM; - goto err_exit; - } + if (unlikely(!ctx)) + return -ENOMEM; =20 - ctx->workstation_name =3D kstrdup(nodename, GFP_KERNEL); - if (unlikely(!ctx->workstation_name)) { - rc =3D -ENOMEM; - goto err_exit; - } + strscpy(ctx->workstation_name, nodename, sizeof(ctx->workstation_name)); =20 /* * does not have to be perfect mapping since field is @@ -1555,14 +1544,6 @@ int smb3_init_fs_context(struct fs_conte fc->fs_private =3D ctx; fc->ops =3D &smb3_fs_context_ops; return 0; - -err_exit: - if (ctx) { - kfree(ctx->workstation_name); - kfree(ctx); - } - - return rc; } =20 void @@ -1588,8 +1569,6 @@ smb3_cleanup_fs_context_contents(struct ctx->source =3D NULL; kfree(ctx->domainname); ctx->domainname =3D NULL; - kfree(ctx->workstation_name); - ctx->workstation_name =3D NULL; kfree(ctx->nodename); ctx->nodename =3D NULL; kfree(ctx->iocharset); --- a/fs/cifs/fs_context.h +++ b/fs/cifs/fs_context.h @@ -170,7 +170,7 @@ struct smb3_fs_context { char *server_hostname; char *UNC; char *nodename; - char *workstation_name; + char workstation_name[CIFS_MAX_WORKSTATION_LEN]; char *iocharset; /* local code page for mapping to and from Unicode */ char source_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* clnt nb name */ char target_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* srvr nb name */ --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -95,7 +95,6 @@ sesInfoFree(struct cifs_ses *buf_to_free kfree_sensitive(buf_to_free->password); kfree(buf_to_free->user_name); kfree(buf_to_free->domainName); - kfree(buf_to_free->workstation_name); kfree_sensitive(buf_to_free->auth_key.response); kfree(buf_to_free->iface_list); kfree_sensitive(buf_to_free); --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -714,9 +714,9 @@ static int size_of_ntlmssp_blob(struct c else sz +=3D sizeof(__le16); =20 - if (ses->workstation_name) + if (ses->workstation_name[0]) sz +=3D sizeof(__le16) * strnlen(ses->workstation_name, - CIFS_MAX_WORKSTATION_LEN); + ntlmssp_workstation_name_size(ses)); else sz +=3D sizeof(__le16); =20 @@ -960,7 +960,7 @@ int build_ntlmssp_auth_blob(unsigned cha =20 cifs_security_buffer_from_str(&sec_blob->WorkstationName, ses->workstation_name, - CIFS_MAX_WORKSTATION_LEN, + ntlmssp_workstation_name_size(ses), *pbuffer, &tmp, nls_cp); From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8B57CCA482 for ; Tue, 7 Jun 2022 21:56:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382037AbiFGVzg (ORCPT ); Tue, 7 Jun 2022 17:55:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379223AbiFGVCN (ORCPT ); Tue, 7 Jun 2022 17:02:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9026EBBC; Tue, 7 Jun 2022 11:46: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 48D7EB81FE1; Tue, 7 Jun 2022 18:46:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95656C34115; Tue, 7 Jun 2022 18:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627615; bh=InTEJxokk0gSldDDmnuCDCLtUbImqooZSkroi+Xe/fA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ConUKPUQljQl8f38nIqrienv97ERXDR3w6xAlTNtPpPL/jVfYK3pFEM19lfwX/9Tn YJrucOM6WBEpzotHj+TndYqP8H7aeT9SelNbqJHaVyXte1oqLW3c7WZFAGoEXrhpVh 0cbzaBx1j4k3/dtU1qqZWpu1x8K2y9iK8gc2BmxQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roberto Bergantinos , Ronnie Sahlberg , Steve French Subject: [PATCH 5.18 032/879] cifs: fix potential double free during failed mount Date: Tue, 7 Jun 2022 18:52:30 +0200 Message-Id: <20220607165003.608638078@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ronnie Sahlberg commit 8378a51e3f8140f60901fb27208cc7a6e47047b5 upstream. RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=3D2088799 Cc: stable@vger.kernel.org Signed-off-by: Roberto Bergantinos Signed-off-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/cifs/cifsfs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -836,7 +836,7 @@ cifs_smb3_do_mount(struct file_system_ty int flags, struct smb3_fs_context *old_ctx) { int rc; - struct super_block *sb; + struct super_block *sb =3D NULL; struct cifs_sb_info *cifs_sb =3D NULL; struct cifs_mnt_data mnt_data; struct dentry *root; @@ -932,9 +932,11 @@ out_super: return root; out: if (cifs_sb) { - kfree(cifs_sb->prepath); - smb3_cleanup_fs_context(cifs_sb->ctx); - kfree(cifs_sb); + if (!sb || IS_ERR(sb)) { /* otherwise kill_sb will handle */ + kfree(cifs_sb->prepath); + smb3_cleanup_fs_context(cifs_sb->ctx); + kfree(cifs_sb); + } } return root; } From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B76A5C433EF for ; Tue, 7 Jun 2022 22:02:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382980AbiFGWAk (ORCPT ); Tue, 7 Jun 2022 18:00:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379226AbiFGVCN (ORCPT ); Tue, 7 Jun 2022 17:02:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3C3A614C; Tue, 7 Jun 2022 11:46:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4F0E96156D; Tue, 7 Jun 2022 18:46:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FAE6C385A5; Tue, 7 Jun 2022 18:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627618; bh=mLvHhE7q4dlXMPcB+5rAF8lzM5mQNsQtmSS0dFF7Lj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DpL2iP7xAbuyw+JZ077nHh2PoxGWn60EeXIYLyiIjPwKY82j9fjuyJnDjaj7ovXqx gcqTKuE3JLMrU/xrF0xmL+hkhSjUgcvzrg9eMrGCLgQ7VR/kz09qIChWKNGlZPltxm 8KFiQCp/vqTYoImJVJ13/tcDVZvKD9Ftj+bzemD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronnie Sahlberg , Steve French Subject: [PATCH 5.18 033/879] cifs: when extending a file with falloc we should make files not-sparse Date: Tue, 7 Jun 2022 18:52:31 +0200 Message-Id: <20220607165003.637742817@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ronnie Sahlberg commit f66f8b94e7f2f4ac9fffe710be231ca8f25c5057 upstream. as this is the only way to make sure the region is allocated. Fix the conditional that was wrong and only tried to make already non-sparse files non-sparse. Cc: stable@vger.kernel.org Signed-off-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/cifs/smb2ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -3837,7 +3837,7 @@ static long smb3_simple_falloc(struct fi if (rc) goto out; =20 - if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) =3D=3D 0) + if (cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) smb2_set_sparse(xid, tcon, cfile, inode, false); =20 eof =3D cpu_to_le64(off + len); From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 835A7CCA494 for ; Tue, 7 Jun 2022 21:56:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382204AbiFGVzo (ORCPT ); Tue, 7 Jun 2022 17:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379234AbiFGVCN (ORCPT ); Tue, 7 Jun 2022 17:02:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C84DD34BA7; Tue, 7 Jun 2022 11:47:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 220466156D; Tue, 7 Jun 2022 18:47:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EA39C385A5; Tue, 7 Jun 2022 18:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627621; bh=+XXbB3EX5auKXAmZDxmRIalEhFPa2J9WLidrIDueP3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JV2IxWa4KIw7wv2ijXXLN4Sl0EcTHLjj60M2MCHGENxvsxcaGzHkewNOVuWaSm1Rj RzcLOYzYU7wYMbBBpc3bUjnBzEWp32cYhaknAjnLks2eh4dJh5sPTRIaP2heiC0axs HhkfdqwdLqOp7CJZgHWcw15vJRgzKxGWW0Rqr19k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathias Nyman , Chris Chiu , Kishon Vijay Abraham I Subject: [PATCH 5.18 034/879] xhci: Set HCD flag to defer primary roothub registration Date: Tue, 7 Jun 2022 18:52:32 +0200 Message-Id: <20220607165003.665844631@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kishon Vijay Abraham I commit b7a4f9b5d0e4b6dd937678c546c0b322dd1a4054 upstream. Set "HCD_FLAG_DEFER_RH_REGISTER" to hcd->flags in xhci_run() to defer registering primary roothub in usb_add_hcd() if xhci has two roothubs. This will make sure both primary roothub and secondary roothub will be registered along with the second HCD. This is required for cold plugged USB devices to be detected in certain PCIe USB cards (like Inateck USB card connected to AM64 EVM or J7200 EVM). This patch has been added and reverted earier as it triggered a race in usb device enumeration. That race is now fixed in 5.16-rc3, and in stable back to 5.4 commit 6cca13de26ee ("usb: hub: Fix locking issues with address0_mutex") commit 6ae6dc22d2d1 ("usb: hub: Fix usb enumeration issue due to address0 race") [minor rebase change, and commit message update -Mathias] CC: stable@vger.kernel.org # 5.4+ Suggested-by: Mathias Nyman Tested-by: Chris Chiu Signed-off-by: Kishon Vijay Abraham I Link: https://lore.kernel.org/r/20220510091630.16564-3-kishon@ti.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/host/xhci.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -696,6 +696,8 @@ int xhci_run(struct usb_hcd *hcd) xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Finished xhci_run for USB2 roothub"); =20 + set_bit(HCD_FLAG_DEFER_RH_REGISTER, &hcd->flags); + xhci_create_dbc_dev(xhci); =20 xhci_debugfs_init(xhci); From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 138ACC433EF for ; Tue, 7 Jun 2022 22:02:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382893AbiFGWA1 (ORCPT ); Tue, 7 Jun 2022 18:00:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379241AbiFGVCO (ORCPT ); Tue, 7 Jun 2022 17:02:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D012810FDA; Tue, 7 Jun 2022 11:47:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 91E37B8220B; Tue, 7 Jun 2022 18:47:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00AE1C3411F; Tue, 7 Jun 2022 18:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627624; bh=q2Xpkw+onYKKa4/Us+LoQ26hoDxY+NiVrhxSovEPERo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YTNvPsA/wGjRGdOr+24fjmGU7NGIaQUKbpsYFVKQpwfUSL34SUYKq/1nmb+tYz82A Ft6VuTLlRYWXpyyGSSYzeXlFtVTdJ6r55jA3h1GErnlabaNnqVLc+uG6QmvTDrAKe5 6XRnzNK4R3FHfK/x/8IIEehl8uEb4LPqT1EVyfAo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Gopal Vamshi Krishna , Mathias Nyman Subject: [PATCH 5.18 035/879] xhci: Allow host runtime PM as default for Intel Alder Lake N xHCI Date: Tue, 7 Jun 2022 18:52:33 +0200 Message-Id: <20220607165003.696732256@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mathias Nyman commit 74f55a62c4c354f43a6d75f77dd184c4f57b9a26 upstream. Alder Lake N TCSS xHCI needs to be runtime suspended whenever possible to allow the TCSS hardware block to enter D3 and thus save energy Cc: stable@kernel.org Suggested-by: Gopal Vamshi Krishna Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220511220450.85367-10-mathias.nyman@linux= .intel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/usb/host/xhci-pci.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -59,6 +59,7 @@ #define PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI 0x9a13 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI 0x1138 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI 0x461e +#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI 0x464e #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed =20 #define PCI_DEVICE_ID_AMD_RENOIR_XHCI 0x1639 @@ -268,6 +269,7 @@ static void xhci_pci_quirks(struct devic pdev->device =3D=3D PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI || pdev->device =3D=3D PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI || pdev->device =3D=3D PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI || + pdev->device =3D=3D PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI || pdev->device =3D=3D PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI)) xhci->quirks |=3D XHCI_DEFAULT_PM_RUNTIME_ALLOW; From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CDD8CCA47C for ; Tue, 7 Jun 2022 22:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382785AbiFGWAU (ORCPT ); Tue, 7 Jun 2022 18:00:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379253AbiFGVCO (ORCPT ); Tue, 7 Jun 2022 17:02:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88C21252BB; Tue, 7 Jun 2022 11:47:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 48899B8220B; Tue, 7 Jun 2022 18:47:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA0C4C385A2; Tue, 7 Jun 2022 18:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627627; bh=4JWxKeMCzS1I9F8T8lOqSs2eeTmYuFxzWuEf3D1lwX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hero6S28mIn+sjbHJN1t4SyiS4dMBG/F9WHfCpxITsYuc1bGQn4FiURzNcP+B3mZf 2sn5CfDnEpFFcf91QoamzzvoDz/hydCyXWQbtuGuYKwLJ3+biyaY61V/del7M59cuw rrgNMVLwudFM7kPma5JpFDmtOCW5rbapsJQ/A4gk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Michael=20Niew=C3=B6hner?= , Hans de Goede Subject: [PATCH 5.18 036/879] platform/x86: intel-hid: fix _DSM function index handling Date: Tue, 7 Jun 2022 18:52:34 +0200 Message-Id: <20220607165003.725103749@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Niew=C3=B6hner commit 1620c80bba53af8c547bab34a1d3bc58319fe608 upstream. intel_hid_dsm_fn_mask is a bit mask containing one bit for each function index. Fix the function index check in intel_hid_evaluate_method accordingly, which was missed in commit 97ab4516205e ("platform/x86: intel-hid: fix _DSM function index handling"). Fixes: 97ab4516205e ("platform/x86: intel-hid: fix _DSM function index hand= ling") Cc: stable@vger.kernel.org Signed-off-by: Michael Niew=C3=B6hner Link: https://lore.kernel.org/r/66f813f5bcc724a0f6dd5adefe6a9728dbe509e3.ca= mel@mniewoehner.de Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/platform/x86/intel/hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/platform/x86/intel/hid.c +++ b/drivers/platform/x86/intel/hid.c @@ -238,7 +238,7 @@ static bool intel_hid_evaluate_method(ac =20 method_name =3D (char *)intel_hid_dsm_fn_to_method[fn_index]; =20 - if (!(intel_hid_dsm_fn_mask & fn_index)) + if (!(intel_hid_dsm_fn_mask & BIT(fn_index))) goto skip_dsm_eval; =20 obj =3D acpi_evaluate_dsm_typed(handle, &intel_dsm_guid, From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B793EC433EF for ; Tue, 7 Jun 2022 21:57:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382662AbiFGVz6 (ORCPT ); Tue, 7 Jun 2022 17:55:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379266AbiFGVCS (ORCPT ); Tue, 7 Jun 2022 17:02:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97327393D8; Tue, 7 Jun 2022 11:47: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 437DBB8220B; Tue, 7 Jun 2022 18:47:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D7C4C385A2; Tue, 7 Jun 2022 18:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627630; bh=i7tc9pg+IEwtWnNUuNwd19qPDlKm1NBNTebaBBlJuf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eFv903BQgLVH1de3sF7W1suOKUaiJp6vCECAloAfWyFnoOam9BIXHPtimGxi9/AfN /66roiks9zS1IShffS3/++cMV24D8IhgDtDmbc6wWbDNnQIRb42s0su+o5r0BoTsvK 5T7dLToGykxtd1UmSMStgbe4AQ2apXGHyfW9y2XQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alviro Iskandar Setiawan , Yazen Ghannam , Ammar Faizi , Borislav Petkov Subject: [PATCH 5.18 037/879] x86/MCE/AMD: Fix memory leak when threshold_create_bank() fails Date: Tue, 7 Jun 2022 18:52:35 +0200 Message-Id: <20220607165003.754599884@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ammar Faizi commit e5f28623ceb103e13fc3d7bd45edf9818b227fd0 upstream. In mce_threshold_create_device(), if threshold_create_bank() fails, the previously allocated threshold banks array @bp will be leaked because the call to mce_threshold_remove_device() will not free it. This happens because mce_threshold_remove_device() fetches the pointer through the threshold_banks per-CPU variable but bp is written there only after the bank creation is successful, and not before, when threshold_create_bank() fails. Add a helper which unwinds all the bank creation work previously done and pass into it the previously allocated threshold banks array for freeing. [ bp: Massage. ] Fixes: 6458de97fc15 ("x86/mce/amd: Straighten CPU hotplug path") Co-developed-by: Alviro Iskandar Setiawan Signed-off-by: Alviro Iskandar Setiawan Co-developed-by: Yazen Ghannam Signed-off-by: Yazen Ghannam Signed-off-by: Ammar Faizi Signed-off-by: Borislav Petkov Cc: Link: https://lore.kernel.org/r/20220329104705.65256-3-ammarfaizi2@gnuweeb.= org Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/cpu/mce/amd.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) --- a/arch/x86/kernel/cpu/mce/amd.c +++ b/arch/x86/kernel/cpu/mce/amd.c @@ -1294,10 +1294,23 @@ out_free: kfree(bank); } =20 +static void __threshold_remove_device(struct threshold_bank **bp) +{ + unsigned int bank, numbanks =3D this_cpu_read(mce_num_banks); + + for (bank =3D 0; bank < numbanks; bank++) { + if (!bp[bank]) + continue; + + threshold_remove_bank(bp[bank]); + bp[bank] =3D NULL; + } + kfree(bp); +} + int mce_threshold_remove_device(unsigned int cpu) { struct threshold_bank **bp =3D this_cpu_read(threshold_banks); - unsigned int bank, numbanks =3D this_cpu_read(mce_num_banks); =20 if (!bp) return 0; @@ -1308,13 +1321,7 @@ int mce_threshold_remove_device(unsigned */ this_cpu_write(threshold_banks, NULL); =20 - for (bank =3D 0; bank < numbanks; bank++) { - if (bp[bank]) { - threshold_remove_bank(bp[bank]); - bp[bank] =3D NULL; - } - } - kfree(bp); + __threshold_remove_device(bp); return 0; } =20 @@ -1351,15 +1358,14 @@ int mce_threshold_create_device(unsigned if (!(this_cpu_read(bank_map) & (1 << bank))) continue; err =3D threshold_create_bank(bp, cpu, bank); - if (err) - goto out_err; + if (err) { + __threshold_remove_device(bp); + return err; + } } this_cpu_write(threshold_banks, bp); =20 if (thresholding_irq_en) mce_threshold_vector =3D amd_threshold_interrupt; return 0; -out_err: - mce_threshold_remove_device(cpu); - return err; } From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A914C43334 for ; Tue, 7 Jun 2022 22:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382606AbiFGV7v (ORCPT ); Tue, 7 Jun 2022 17:59:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379270AbiFGVCS (ORCPT ); Tue, 7 Jun 2022 17:02:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCFA03CA59; Tue, 7 Jun 2022 11:47: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 8655CB81FE1; Tue, 7 Jun 2022 18:47:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DE9EC385A2; Tue, 7 Jun 2022 18:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627633; bh=yKGJ+d5ZKU97vSb+zzxqTj/aDTnvOOGjazdAMaubQE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m0Bo8cXIDHh9rSsAWQOntqs82cU04dud38mNmvG1PSUTnAmcI0V6IiHfllq9j5p5A zLCosj+7JrtK3nhVQReUSIUjk2bQiFgX0gmRo9q5Xke0zN8ZnDzStnw9W0oLN7D5Vo rbn/rqw6iIsXmvwEx8yit/5G4XO0QhoFDlt6qPHY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kan Liang , Ingo Molnar , Peter Zijlstra Subject: [PATCH 5.18 038/879] perf/x86/intel: Fix event constraints for ICL Date: Tue, 7 Jun 2022 18:52:36 +0200 Message-Id: <20220607165003.783888970@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 86dca369075b3e310c3c0adb0f81e513c562b5e4 upstream. According to the latest event list, the event encoding 0x55 INST_DECODED.DECODERS and 0x56 UOPS_DECODED.DEC0 are only available on the first 4 counters. Add them into the event constraints table. Fixes: 6017608936c1 ("perf/x86/intel: Add Icelake support") Signed-off-by: Kan Liang Signed-off-by: Ingo Molnar Acked-by: Peter Zijlstra Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220525133952.1660658-1-kan.liang@linux.in= tel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/events/intel/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -276,7 +276,7 @@ static struct event_constraint intel_icl INTEL_EVENT_CONSTRAINT_RANGE(0x03, 0x0a, 0xf), INTEL_EVENT_CONSTRAINT_RANGE(0x1f, 0x28, 0xf), INTEL_EVENT_CONSTRAINT(0x32, 0xf), /* SW_PREFETCH_ACCESS.* */ - INTEL_EVENT_CONSTRAINT_RANGE(0x48, 0x54, 0xf), + INTEL_EVENT_CONSTRAINT_RANGE(0x48, 0x56, 0xf), INTEL_EVENT_CONSTRAINT_RANGE(0x60, 0x8b, 0xf), INTEL_UEVENT_CONSTRAINT(0x04a3, 0xff), /* CYCLE_ACTIVITY.STALLS_TOTAL */ INTEL_UEVENT_CONSTRAINT(0x10a3, 0xff), /* CYCLE_ACTIVITY.CYCLES_MEM_ANY = */ From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D78A7C433EF for ; Tue, 7 Jun 2022 21:59:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347855AbiFGV7i (ORCPT ); Tue, 7 Jun 2022 17:59:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379272AbiFGVCS (ORCPT ); Tue, 7 Jun 2022 17:02:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22D8F41FBF; Tue, 7 Jun 2022 11:47: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 B389361295; Tue, 7 Jun 2022 18:47:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD027C385A2; Tue, 7 Jun 2022 18:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627636; bh=pF3h+0KVTBt6CIL4yFsTZkcuC4lHFPVqrqtLLicmaJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CSJv52Ph7EI9WQFO3bqSxaGvOOqYtbiqsKXQ3PVZkB68HMzIS444ErxhdyqVloHMx v9gCnBDaQ04a8ydpmixQEz4QVuFe+hAMd8HEGiteryB6EEEDahi1uGxwvu2P6uc6YX QNY3l97FpIpAiap63aM6tc/IVJ+vXJAPupiy7yXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baoquan He , Dave Young , Andrew Morton Subject: [PATCH 5.18 039/879] x86/kexec: fix memory leak of elf header buffer Date: Tue, 7 Jun 2022 18:52:37 +0200 Message-Id: <20220607165003.812709309@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baoquan He commit b3e34a47f98974d0844444c5121aaff123004e57 upstream. This is reported by kmemleak detector: unreferenced object 0xffffc900002a9000 (size 4096): comm "kexec", pid 14950, jiffies 4295110793 (age 373.951s) hex dump (first 32 bytes): 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 .ELF............ 04 00 3e 00 01 00 00 00 00 00 00 00 00 00 00 00 ..>............. backtrace: [<0000000016a8ef9f>] __vmalloc_node_range+0x101/0x170 [<000000002b66b6c0>] __vmalloc_node+0xb4/0x160 [<00000000ad40107d>] crash_prepare_elf64_headers+0x8e/0xcd0 [<0000000019afff23>] crash_load_segments+0x260/0x470 [<0000000019ebe95c>] bzImage64_load+0x814/0xad0 [<0000000093e16b05>] arch_kexec_kernel_image_load+0x1be/0x2a0 [<000000009ef2fc88>] kimage_file_alloc_init+0x2ec/0x5a0 [<0000000038f5a97a>] __do_sys_kexec_file_load+0x28d/0x530 [<0000000087c19992>] do_syscall_64+0x3b/0x90 [<0000000066e063a4>] entry_SYSCALL_64_after_hwframe+0x44/0xae In crash_prepare_elf64_headers(), a buffer is allocated via vmalloc() to store elf headers. While it's not freed back to system correctly when kdump kernel is reloaded or unloaded. Then memory leak is caused. Fix it by introducing x86 specific function arch_kimage_file_post_load_cleanup(), and freeing the buffer there. And also remove the incorrect elf header buffer freeing code. Before calling arch specific kexec_file loading function, the image instance has been initialized. So 'image->elf_headers' must be NULL. It doesn't make sense to free the elf header buffer in the place. Three different people have reported three bugs about the memory leak on x86_64 inside Redhat. Link: https://lkml.kernel.org/r/20220223113225.63106-2-bhe@redhat.com Signed-off-by: Baoquan He Acked-by: Dave Young Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/machine_kexec_64.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -376,9 +376,6 @@ void machine_kexec(struct kimage *image) #ifdef CONFIG_KEXEC_FILE void *arch_kexec_kernel_image_load(struct kimage *image) { - vfree(image->elf_headers); - image->elf_headers =3D NULL; - if (!image->fops || !image->fops->load) return ERR_PTR(-ENOEXEC); =20 @@ -514,6 +511,15 @@ overflow: (int)ELF64_R_TYPE(rel[i].r_info), value); return -ENOEXEC; } + +int arch_kimage_file_post_load_cleanup(struct kimage *image) +{ + vfree(image->elf_headers); + image->elf_headers =3D NULL; + image->elf_headers_sz =3D 0; + + return kexec_image_post_load_cleanup_default(image); +} #endif /* CONFIG_KEXEC_FILE */ =20 static int From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04ED9C433EF for ; Tue, 7 Jun 2022 22:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382680AbiFGWAB (ORCPT ); Tue, 7 Jun 2022 18:00:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379275AbiFGVCS (ORCPT ); Tue, 7 Jun 2022 17:02:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2544F5DA3D; Tue, 7 Jun 2022 11:47:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D6306B8237F; Tue, 7 Jun 2022 18:47:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36747C385A5; Tue, 7 Jun 2022 18:47:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627641; bh=/CyJwoKVuBaWLWd1+cNI4FVcV/PQuwuPI5jlFRzY3CE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RQYfiCFUBeGW6XLQtf7KQbxWa8iqZBlx9Wg06CgJKHnEHXmwN2zhqBN0rAS6tR0AA p8VT78dzRJd8khO2jCGSAbYOs3AWjhwtt0hwlclEOnGztq23vCh7e5zOv1Y7Sq+gsN SqtyywSDbI0RjAtJhLkqe492/8srBFBClLoHZRkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kristen Carlson Accardi , Dave Hansen , Shakeel Butt , Roman Gushchin Subject: [PATCH 5.18 040/879] x86/sgx: Set active memcg prior to shmem allocation Date: Tue, 7 Jun 2022 18:52:38 +0200 Message-Id: <20220607165003.842906959@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kristen Carlson Accardi commit 0c9782e204d3cc5625b9e8bf4e8625d38dfe0139 upstream. When the system runs out of enclave memory, SGX can reclaim EPC pages by swapping to normal RAM. These backing pages are allocated via a per-enclave shared memory area. Since SGX allows unlimited over commit on EPC memory, the reclaimer thread can allocate a large number of backing RAM pages in response to EPC memory pressure. When the shared memory backing RAM allocation occurs during the reclaimer thread context, the shared memory is charged to the root memory control group, and the shmem usage of the enclave is not properly accounted for, making cgroups ineffective at limiting the amount of RAM an enclave can consume. For example, when using a cgroup to launch a set of test enclaves, the kernel does not properly account for 50% - 75% of shmem page allocations on average. In the worst case, when nearly all allocations occur during the reclaimer thread, the kernel accounts less than a percent of the amount of shmem used by the enclave's cgroup to the correct cgroup. SGX stores a list of mm_structs that are associated with an enclave. Pick one of them during reclaim and charge that mm's memcg with the shmem allocation. The one that gets picked is arbitrary, but this list almost always only has one mm. The cases where there is more than one mm with different memcg's are not worth considering. Create a new function - sgx_encl_alloc_backing(). This function is used whenever a new backing storage page needs to be allocated. Previously the same function was used for page allocation as well as retrieving a previously allocated page. Prior to backing page allocation, if there is a mm_struct associated with the enclave that is requesting the allocation, it is set as the active memory control group. [ dhansen: - fix merge conflict with ELDU fixes - check against actual ksgxd_tsk, not ->mm ] Cc: stable@vger.kernel.org Signed-off-by: Kristen Carlson Accardi Signed-off-by: Dave Hansen Reviewed-by: Shakeel Butt Acked-by: Roman Gushchin Link: https://lkml.kernel.org/r/20220520174248.4918-1-kristen@linux.intel.c= om Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/cpu/sgx/encl.c | 105 ++++++++++++++++++++++++++++++++++++= ++++- arch/x86/kernel/cpu/sgx/encl.h | 7 +- arch/x86/kernel/cpu/sgx/main.c | 9 ++- 3 files changed, 115 insertions(+), 6 deletions(-) --- a/arch/x86/kernel/cpu/sgx/encl.c +++ b/arch/x86/kernel/cpu/sgx/encl.c @@ -152,7 +152,7 @@ static int __sgx_encl_eldu(struct sgx_en =20 page_pcmd_off =3D sgx_encl_get_backing_page_pcmd_offset(encl, page_index); =20 - ret =3D sgx_encl_get_backing(encl, page_index, &b); + ret =3D sgx_encl_lookup_backing(encl, page_index, &b); if (ret) return ret; =20 @@ -718,7 +718,7 @@ static struct page *sgx_encl_get_backing * 0 on success, * -errno otherwise. */ -int sgx_encl_get_backing(struct sgx_encl *encl, unsigned long page_index, +static int sgx_encl_get_backing(struct sgx_encl *encl, unsigned long page_= index, struct sgx_backing *backing) { pgoff_t page_pcmd_off =3D sgx_encl_get_backing_page_pcmd_offset(encl, pag= e_index); @@ -743,6 +743,107 @@ int sgx_encl_get_backing(struct sgx_encl return 0; } =20 +/* + * When called from ksgxd, returns the mem_cgroup of a struct mm stored + * in the enclave's mm_list. When not called from ksgxd, just returns + * the mem_cgroup of the current task. + */ +static struct mem_cgroup *sgx_encl_get_mem_cgroup(struct sgx_encl *encl) +{ + struct mem_cgroup *memcg =3D NULL; + struct sgx_encl_mm *encl_mm; + int idx; + + /* + * If called from normal task context, return the mem_cgroup + * of the current task's mm. The remainder of the handling is for + * ksgxd. + */ + if (!current_is_ksgxd()) + return get_mem_cgroup_from_mm(current->mm); + + /* + * Search the enclave's mm_list to find an mm associated with + * this enclave to charge the allocation to. + */ + idx =3D srcu_read_lock(&encl->srcu); + + list_for_each_entry_rcu(encl_mm, &encl->mm_list, list) { + if (!mmget_not_zero(encl_mm->mm)) + continue; + + memcg =3D get_mem_cgroup_from_mm(encl_mm->mm); + + mmput_async(encl_mm->mm); + + break; + } + + srcu_read_unlock(&encl->srcu, idx); + + /* + * In the rare case that there isn't an mm associated with + * the enclave, set memcg to the current active mem_cgroup. + * This will be the root mem_cgroup if there is no active + * mem_cgroup. + */ + if (!memcg) + return get_mem_cgroup_from_mm(NULL); + + return memcg; +} + +/** + * sgx_encl_alloc_backing() - allocate a new backing storage page + * @encl: an enclave pointer + * @page_index: enclave page index + * @backing: data for accessing backing storage for the page + * + * When called from ksgxd, sets the active memcg from one of the + * mms in the enclave's mm_list prior to any backing page allocation, + * in order to ensure that shmem page allocations are charged to the + * enclave. + * + * Return: + * 0 on success, + * -errno otherwise. + */ +int sgx_encl_alloc_backing(struct sgx_encl *encl, unsigned long page_index, + struct sgx_backing *backing) +{ + struct mem_cgroup *encl_memcg =3D sgx_encl_get_mem_cgroup(encl); + struct mem_cgroup *memcg =3D set_active_memcg(encl_memcg); + int ret; + + ret =3D sgx_encl_get_backing(encl, page_index, backing); + + set_active_memcg(memcg); + mem_cgroup_put(encl_memcg); + + return ret; +} + +/** + * sgx_encl_lookup_backing() - retrieve an existing backing storage page + * @encl: an enclave pointer + * @page_index: enclave page index + * @backing: data for accessing backing storage for the page + * + * Retrieve a backing page for loading data back into an EPC page with ELD= U. + * It is the caller's responsibility to ensure that it is appropriate to u= se + * sgx_encl_lookup_backing() rather than sgx_encl_alloc_backing(). If look= up is + * not used correctly, this will cause an allocation which is not accounte= d for. + * + * Return: + * 0 on success, + * -errno otherwise. + */ +int sgx_encl_lookup_backing(struct sgx_encl *encl, unsigned long page_inde= x, + struct sgx_backing *backing) +{ + return sgx_encl_get_backing(encl, page_index, backing); +} + /** * sgx_encl_put_backing() - Unpin the backing storage * @backing: data for accessing backing storage for the page --- a/arch/x86/kernel/cpu/sgx/encl.h +++ b/arch/x86/kernel/cpu/sgx/encl.h @@ -103,10 +103,13 @@ static inline int sgx_encl_find(struct m int sgx_encl_may_map(struct sgx_encl *encl, unsigned long start, unsigned long end, unsigned long vm_flags); =20 +bool current_is_ksgxd(void); void sgx_encl_release(struct kref *ref); int sgx_encl_mm_add(struct sgx_encl *encl, struct mm_struct *mm); -int sgx_encl_get_backing(struct sgx_encl *encl, unsigned long page_index, - struct sgx_backing *backing); +int sgx_encl_lookup_backing(struct sgx_encl *encl, unsigned long page_inde= x, + struct sgx_backing *backing); +int sgx_encl_alloc_backing(struct sgx_encl *encl, unsigned long page_index, + struct sgx_backing *backing); void sgx_encl_put_backing(struct sgx_backing *backing); int sgx_encl_test_and_clear_young(struct mm_struct *mm, struct sgx_encl_page *page); --- a/arch/x86/kernel/cpu/sgx/main.c +++ b/arch/x86/kernel/cpu/sgx/main.c @@ -313,7 +313,7 @@ static void sgx_reclaimer_write(struct s sgx_encl_put_backing(backing); =20 if (!encl->secs_child_cnt && test_bit(SGX_ENCL_INITIALIZED, &encl->flags)= ) { - ret =3D sgx_encl_get_backing(encl, PFN_DOWN(encl->size), + ret =3D sgx_encl_alloc_backing(encl, PFN_DOWN(encl->size), &secs_backing); if (ret) goto out; @@ -384,7 +384,7 @@ static void sgx_reclaim_pages(void) page_index =3D PFN_DOWN(encl_page->desc - encl_page->encl->base); =20 mutex_lock(&encl_page->encl->lock); - ret =3D sgx_encl_get_backing(encl_page->encl, page_index, &backing[i]); + ret =3D sgx_encl_alloc_backing(encl_page->encl, page_index, &backing[i]); if (ret) { mutex_unlock(&encl_page->encl->lock); goto skip; @@ -475,6 +475,11 @@ static bool __init sgx_page_reclaimer_in return true; } =20 +bool current_is_ksgxd(void) +{ + return current =3D=3D ksgxd_tsk; +} + static struct sgx_epc_page *__sgx_alloc_epc_page_from_node(int nid) { struct sgx_numa_node *node =3D &sgx_numa_nodes[nid]; From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D865C43334 for ; Tue, 7 Jun 2022 21:56:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382842AbiFGV4I (ORCPT ); Tue, 7 Jun 2022 17:56:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379279AbiFGVCT (ORCPT ); Tue, 7 Jun 2022 17:02:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 825F866AC7; Tue, 7 Jun 2022 11:47:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1DACE612F2; Tue, 7 Jun 2022 18:47:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2802DC385A5; Tue, 7 Jun 2022 18:47:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627644; bh=zZiGrdNdmGO+3CfM32sERyqnjtDOD2AoS3nDEP+ZFb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FnL9nV9ql5oZX81eCpv7ODEYK5z1uiYucH89xOMArC5+BkMuknutiB8HeKHx/eRQB A3gPk83AtpBMsG6ScAmgtdTZhvwwHOQsqauURFCNqAuoQYWZZot6b2/1DZ5OyEK6oT q1WZTaOePpPWRSKSUbf3TkWLKk/pXyxIbVZVrUyo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=9A=D1=83=D1=82=D1=8F=D0=B2=D0=B8=D0=BD?= , "Eric W. Biederman" Subject: [PATCH 5.18 041/879] kthread: Dont allocate kthread_struct for init and umh Date: Tue, 7 Jun 2022 18:52:39 +0200 Message-Id: <20220607165003.871993847@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric W. Biederman commit 343f4c49f2438d8920f1f76fa823ee59b91f02e4 upstream. If kthread_is_per_cpu runs concurrently with free_kthread_struct the kthread_struct that was just freed may be read from. This bug was introduced by commit 40966e316f86 ("kthread: Ensure struct kthread is present for all kthreads"). When kthread_struct started to be allocated for all tasks that have PF_KTHREAD set. This in turn required the kthread_struct to be freed in kernel_execve and violated the assumption that kthread_struct will have the same lifetime as the task. Looking a bit deeper this only applies to callers of kernel_execve which is just the init process and the user mode helper processes. These processes really don't want to be kernel threads but are for historical reasons. Mostly that copy_thread does not know how to take a kernel mode function to the process with for processes without PF_KTHREAD or PF_IO_WORKER set. Solve this by not allocating kthread_struct for the init process and the user mode helper processes. This is done by adding a kthread member to struct kernel_clone_args. Setting kthread in fork_idle and kernel_thread. Adding user_mode_thread that works like kernel_thread except it does not set kthread. In fork only allocating the kthread_struct if .kthread is set. I have looked at kernel/kthread.c and since commit 40966e316f86 ("kthread: Ensure struct kthread is present for all kthreads") there have been no assumptions added that to_kthread or __to_kthread will not return NULL. There are a few callers of to_kthread or __to_kthread that assume a non-NULL struct kthread pointer will be returned. These functions are kthread_data(), kthread_parmme(), kthread_exit(), kthread(), kthread_park(), kthread_unpark(), kthread_stop(). All of those functions can reasonably expected to be called when it is know that a task is a kthread so that assumption seems reasonable. Cc: stable@vger.kernel.org Fixes: 40966e316f86 ("kthread: Ensure struct kthread is present for all kth= reads") Reported-by: =D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC =D0=9A=D1=83=D1=82=D1=8F= =D0=B2=D0=B8=D0=BD Link: https://lkml.kernel.org/r/20220506141512.516114-1-ebiederm@xmission.c= om Signed-off-by: "Eric W. Biederman" Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/exec.c | 6 ++++-- include/linux/sched/task.h | 2 ++ init/main.c | 2 +- kernel/fork.c | 22 ++++++++++++++++++++-- kernel/umh.c | 6 +++--- 5 files changed, 30 insertions(+), 8 deletions(-) --- a/fs/exec.c +++ b/fs/exec.c @@ -1308,8 +1308,6 @@ int begin_new_exec(struct linux_binprm * if (retval) goto out_unlock; =20 - if (me->flags & PF_KTHREAD) - free_kthread_struct(me); me->flags &=3D ~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD | PF_NOFREEZE | PF_NO_SETAFFINITY); flush_thread(); @@ -1955,6 +1953,10 @@ int kernel_execve(const char *kernel_fil int fd =3D AT_FDCWD; int retval; =20 + if (WARN_ON_ONCE((current->flags & PF_KTHREAD) && + (current->worker_private))) + return -EINVAL; + filename =3D getname_kernel(kernel_filename); if (IS_ERR(filename)) return PTR_ERR(filename); --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h @@ -32,6 +32,7 @@ struct kernel_clone_args { size_t set_tid_size; int cgroup; int io_thread; + int kthread; struct cgroup *cgrp; struct css_set *cset; }; @@ -89,6 +90,7 @@ struct task_struct *create_io_thread(int struct task_struct *fork_idle(int); struct mm_struct *copy_init_mm(void); extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long fla= gs); +extern pid_t user_mode_thread(int (*fn)(void *), void *arg, unsigned long = flags); extern long kernel_wait4(pid_t, int __user *, int, struct rusage *); int kernel_wait(pid_t pid, int *stat); =20 --- a/init/main.c +++ b/init/main.c @@ -688,7 +688,7 @@ noinline void __ref rest_init(void) * the init task will end up wanting to create kthreads, which, if * we schedule it before we create kthreadd, will OOPS. */ - pid =3D kernel_thread(kernel_init, NULL, CLONE_FS); + pid =3D user_mode_thread(kernel_init, NULL, CLONE_FS); /* * Pin init on the boot CPU. Task migration is not properly working * until sched_init_smp() has been run. It will set the allowed --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2157,7 +2157,7 @@ static __latent_entropy struct task_stru p->io_context =3D NULL; audit_set_context(p, NULL); cgroup_fork(p); - if (p->flags & PF_KTHREAD) { + if (args->kthread) { if (!set_kthread_struct(p)) goto bad_fork_cleanup_delayacct; } @@ -2548,7 +2548,8 @@ struct task_struct * __init fork_idle(in { struct task_struct *task; struct kernel_clone_args args =3D { - .flags =3D CLONE_VM, + .flags =3D CLONE_VM, + .kthread =3D 1, }; =20 task =3D copy_process(&init_struct_pid, 0, cpu_to_node(cpu), &args); @@ -2682,6 +2683,23 @@ pid_t kernel_thread(int (*fn)(void *), v { struct kernel_clone_args args =3D { .flags =3D ((lower_32_bits(flags) | CLONE_VM | + CLONE_UNTRACED) & ~CSIGNAL), + .exit_signal =3D (lower_32_bits(flags) & CSIGNAL), + .stack =3D (unsigned long)fn, + .stack_size =3D (unsigned long)arg, + .kthread =3D 1, + }; + + return kernel_clone(&args); +} + +/* + * Create a user mode thread. + */ +pid_t user_mode_thread(int (*fn)(void *), void *arg, unsigned long flags) +{ + struct kernel_clone_args args =3D { + .flags =3D ((lower_32_bits(flags) | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL), .exit_signal =3D (lower_32_bits(flags) & CSIGNAL), .stack =3D (unsigned long)fn, --- a/kernel/umh.c +++ b/kernel/umh.c @@ -132,7 +132,7 @@ static void call_usermodehelper_exec_syn =20 /* If SIGCLD is ignored do_wait won't populate the status. */ kernel_sigaction(SIGCHLD, SIG_DFL); - pid =3D kernel_thread(call_usermodehelper_exec_async, sub_info, SIGCHLD); + pid =3D user_mode_thread(call_usermodehelper_exec_async, sub_info, SIGCHL= D); if (pid < 0) sub_info->retval =3D pid; else @@ -171,8 +171,8 @@ static void call_usermodehelper_exec_wor * want to pollute current->children, and we need a parent * that always ignores SIGCHLD to ensure auto-reaping. */ - pid =3D kernel_thread(call_usermodehelper_exec_async, sub_info, - CLONE_PARENT | SIGCHLD); + pid =3D user_mode_thread(call_usermodehelper_exec_async, sub_info, + CLONE_PARENT | SIGCHLD); if (pid < 0) { sub_info->retval =3D pid; umh_complete(sub_info); From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD82DCCA485 for ; Tue, 7 Jun 2022 21:56:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382742AbiFGV4C (ORCPT ); Tue, 7 Jun 2022 17:56:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379281AbiFGVCT (ORCPT ); Tue, 7 Jun 2022 17:02:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF0B56EC40; Tue, 7 Jun 2022 11:47:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6EEF0B81FE1; Tue, 7 Jun 2022 18:47:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE696C385A2; Tue, 7 Jun 2022 18:47:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627647; bh=UiQuWr2XSmmxcSj+TEDn9AnH6BFyusXZrRm6NO8ViVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e4mOD9UHb6LWBWdPXPF8iEdXzJn6aWU5pWBnXBIPh+QOJ8owgRiYj28FU0Ihbz0zQ vtqwQ4Svmh3wxBym1a2sfw8gUOPUosa4wK4ynq7TBpYT2iRCTvQ6wsiZWAzZh8oK3s bURnCRsKRXbT6+Jg0df3m/NGSCHyTZ1LSUAzlias= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Kees Cook , Oleg Nesterov , "Eric W. Biederman" Subject: [PATCH 5.18 042/879] ptrace/um: Replace PT_DTRACE with TIF_SINGLESTEP Date: Tue, 7 Jun 2022 18:52:40 +0200 Message-Id: <20220607165003.901005026@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric W. Biederman commit c200e4bb44e80b343c09841e7caaaca0aac5e5fa upstream. User mode linux is the last user of the PT_DTRACE flag. Using the flag to = indicate single stepping is a little confusing and worse changing tsk->ptrace withou= t locking could potentionally cause problems. So use a thread info flag with a better name instead of flag in tsk->ptrace. Remove the definition PT_DTRACE as uml is the last user. Cc: stable@vger.kernel.org Acked-by: Johannes Berg Tested-by: Kees Cook Reviewed-by: Oleg Nesterov Link: https://lkml.kernel.org/r/20220505182645.497868-3-ebiederm@xmission.c= om Signed-off-by: "Eric W. Biederman" Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/um/include/asm/thread_info.h | 2 ++ arch/um/kernel/exec.c | 2 +- arch/um/kernel/process.c | 2 +- arch/um/kernel/ptrace.c | 8 ++++---- arch/um/kernel/signal.c | 4 ++-- include/linux/ptrace.h | 1 - 6 files changed, 10 insertions(+), 9 deletions(-) --- a/arch/um/include/asm/thread_info.h +++ b/arch/um/include/asm/thread_info.h @@ -60,6 +60,7 @@ static inline struct thread_info *curren #define TIF_RESTORE_SIGMASK 7 #define TIF_NOTIFY_RESUME 8 #define TIF_SECCOMP 9 /* secure computing */ +#define TIF_SINGLESTEP 10 /* single stepping userspace */ =20 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) @@ -68,5 +69,6 @@ static inline struct thread_info *curren #define _TIF_MEMDIE (1 << TIF_MEMDIE) #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) #define _TIF_SECCOMP (1 << TIF_SECCOMP) +#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) =20 #endif --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c @@ -43,7 +43,7 @@ void start_thread(struct pt_regs *regs, { PT_REGS_IP(regs) =3D eip; PT_REGS_SP(regs) =3D esp; - current->ptrace &=3D ~PT_DTRACE; + clear_thread_flag(TIF_SINGLESTEP); #ifdef SUBARCH_EXECVE1 SUBARCH_EXECVE1(regs->regs); #endif --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -335,7 +335,7 @@ int singlestepping(void * t) { struct task_struct *task =3D t ? t : current; =20 - if (!(task->ptrace & PT_DTRACE)) + if (!test_thread_flag(TIF_SINGLESTEP)) return 0; =20 if (task->thread.singlestep_syscall) --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c @@ -11,7 +11,7 @@ =20 void user_enable_single_step(struct task_struct *child) { - child->ptrace |=3D PT_DTRACE; + set_tsk_thread_flag(child, TIF_SINGLESTEP); child->thread.singlestep_syscall =3D 0; =20 #ifdef SUBARCH_SET_SINGLESTEPPING @@ -21,7 +21,7 @@ void user_enable_single_step(struct task =20 void user_disable_single_step(struct task_struct *child) { - child->ptrace &=3D ~PT_DTRACE; + clear_tsk_thread_flag(child, TIF_SINGLESTEP); child->thread.singlestep_syscall =3D 0; =20 #ifdef SUBARCH_SET_SINGLESTEPPING @@ -120,7 +120,7 @@ static void send_sigtrap(struct uml_pt_r } =20 /* - * XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and + * XXX Check TIF_SINGLESTEP for singlestepping check and * PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check */ int syscall_trace_enter(struct pt_regs *regs) @@ -144,7 +144,7 @@ void syscall_trace_leave(struct pt_regs audit_syscall_exit(regs); =20 /* Fake a debug trap */ - if (ptraced & PT_DTRACE) + if (test_thread_flag(TIF_SINGLESTEP)) send_sigtrap(®s->regs, 0); =20 if (!test_thread_flag(TIF_SYSCALL_TRACE)) --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c @@ -53,7 +53,7 @@ static void handle_signal(struct ksignal unsigned long sp; int err; =20 - if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) + if (test_thread_flag(TIF_SINGLESTEP) && (current->ptrace & PT_PTRACED)) singlestep =3D 1; =20 /* Did we come from a system call? */ @@ -128,7 +128,7 @@ void do_signal(struct pt_regs *regs) * on the host. The tracing thread will check this flag and * PTRACE_SYSCALL if necessary. */ - if (current->ptrace & PT_DTRACE) + if (test_thread_flag(TIF_SINGLESTEP)) current->thread.singlestep_syscall =3D is_syscall(PT_REGS_IP(¤t->thread.regs)); =20 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -30,7 +30,6 @@ extern int ptrace_access_vm(struct task_ =20 #define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */ #define PT_PTRACED 0x00000001 -#define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ =20 #define PT_OPT_FLAG_SHIFT 3 /* PT_TRACE_* event enable flags */ From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F327DC433EF for ; Tue, 7 Jun 2022 21:59:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382137AbiFGV7n (ORCPT ); Tue, 7 Jun 2022 17:59:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379282AbiFGVCT (ORCPT ); Tue, 7 Jun 2022 17:02:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04335719ED; Tue, 7 Jun 2022 11:47:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89F056157E; Tue, 7 Jun 2022 18:47:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 943B8C385A2; Tue, 7 Jun 2022 18:47:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627650; bh=OgiNMBYlEY3guzwZGXY3PG8CmHv0f71hexffQ5zD8SY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gvv1EZCltwCUtOKTvyfWpGfMu/t7J+tRk+ommlAtFSlJ9E8hE8Q4cGwyct1eFy6ON 4V/SkVN+WsMJuM4W6Lys2kJ6tf2QxvL1ihp9r8JXI66l2hhWzII5ECQASPmYOa1k1j 4agVAZLNBxzy82KPc2+HOrhAiZEPn4PgFvCYVfJQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Filippov , Kees Cook , Oleg Nesterov , "Eric W. Biederman" Subject: [PATCH 5.18 043/879] ptrace/xtensa: Replace PT_SINGLESTEP with TIF_SINGLESTEP Date: Tue, 7 Jun 2022 18:52:41 +0200 Message-Id: <20220607165003.929708775@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric W. Biederman commit 4a3d2717d140401df7501a95e454180831a0c5af upstream. xtensa is the last user of the PT_SINGLESTEP flag. Changing tsk->ptrace in user_enable_single_step and user_disable_single_step without locking could potentiallly cause problems. So use a thread info flag instead of a flag in tsk->ptrace. Use TIF_SINGLE= STEP that xtensa already had defined but unused. Remove the definitions of PT_SINGLESTEP and PT_BLOCKSTEP as they have no mo= re users. Cc: stable@vger.kernel.org Acked-by: Max Filippov Tested-by: Kees Cook Reviewed-by: Oleg Nesterov Link: https://lkml.kernel.org/r/20220505182645.497868-4-ebiederm@xmission.c= om Signed-off-by: "Eric W. Biederman" Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/xtensa/kernel/ptrace.c | 4 ++-- arch/xtensa/kernel/signal.c | 4 ++-- include/linux/ptrace.h | 6 ------ 3 files changed, 4 insertions(+), 10 deletions(-) --- a/arch/xtensa/kernel/ptrace.c +++ b/arch/xtensa/kernel/ptrace.c @@ -225,12 +225,12 @@ const struct user_regset_view *task_user =20 void user_enable_single_step(struct task_struct *child) { - child->ptrace |=3D PT_SINGLESTEP; + set_tsk_thread_flag(child, TIF_SINGLESTEP); } =20 void user_disable_single_step(struct task_struct *child) { - child->ptrace &=3D ~PT_SINGLESTEP; + clear_tsk_thread_flag(child, TIF_SINGLESTEP); } =20 /* --- a/arch/xtensa/kernel/signal.c +++ b/arch/xtensa/kernel/signal.c @@ -473,7 +473,7 @@ static void do_signal(struct pt_regs *re /* Set up the stack frame */ ret =3D setup_frame(&ksig, sigmask_to_save(), regs); signal_setup_done(ret, &ksig, 0); - if (current->ptrace & PT_SINGLESTEP) + if (test_thread_flag(TIF_SINGLESTEP)) task_pt_regs(current)->icountlevel =3D 1; =20 return; @@ -499,7 +499,7 @@ static void do_signal(struct pt_regs *re /* If there's no signal to deliver, we just restore the saved mask. */ restore_saved_sigmask(); =20 - if (current->ptrace & PT_SINGLESTEP) + if (test_thread_flag(TIF_SINGLESTEP)) task_pt_regs(current)->icountlevel =3D 1; return; } --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -46,12 +46,6 @@ extern int ptrace_access_vm(struct task_ #define PT_EXITKILL (PTRACE_O_EXITKILL << PT_OPT_FLAG_SHIFT) #define PT_SUSPEND_SECCOMP (PTRACE_O_SUSPEND_SECCOMP << PT_OPT_FLAG_SHIFT) =20 -/* single stepping state bits (used on ARM and PA-RISC) */ -#define PT_SINGLESTEP_BIT 31 -#define PT_SINGLESTEP (1< X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B469FC433EF for ; Tue, 7 Jun 2022 21:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347654AbiFGV4V (ORCPT ); Tue, 7 Jun 2022 17:56:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379289AbiFGVCT (ORCPT ); Tue, 7 Jun 2022 17:02:19 -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 7204477F3F; Tue, 7 Jun 2022 11:47: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 F19DAB8239D; Tue, 7 Jun 2022 18:47:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AA66C385A5; Tue, 7 Jun 2022 18:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627652; bh=1j72S5O2DBHhhGxv0HK6Aui7WmFeAYDl4SZ8qVhieTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3964GMux3H2psm9WIMiUMos0lZ92MRkURholfMl8fiwJOlIjqLw9ixMztNzhEKXw T8uz1wR6pUYCDxP7ECBiejizM2cruR006BDw+0Mn+fGpqZ5yjUB6ca6MYnNTYkYDUv Qs0eSJ7oCW6zbFky7MzrM3l3HE5q8wz/2WdEtgNs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Kees Cook , Oleg Nesterov , "Eric W. Biederman" Subject: [PATCH 5.18 044/879] ptrace: Reimplement PTRACE_KILL by always sending SIGKILL Date: Tue, 7 Jun 2022 18:52:42 +0200 Message-Id: <20220607165003.959171310@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric W. Biederman commit 6a2d90ba027adba528509ffa27097cffd3879257 upstream. The current implementation of PTRACE_KILL is buggy and has been for many years as it assumes it's target has stopped in ptrace_stop. At a quick skim it looks like this assumption has existed since ptrace support was added in linux v1.0. While PTRACE_KILL has been deprecated we can not remove it as a quick search with google code search reveals many existing programs calling it. When the ptracee is not stopped at ptrace_stop some fields would be set that are ignored except in ptrace_stop. Making the userspace visible behavior of PTRACE_KILL a noop in those case. As the usual rules are not obeyed it is not clear what the consequences are of calling PTRACE_KILL on a running process. Presumably userspace does not do this as it achieves nothing. Replace the implementation of PTRACE_KILL with a simple send_sig_info(SIGKILL) followed by a return 0. This changes the observable user space behavior only in that PTRACE_KILL on a process not stopped in ptrace_stop will also kill it. As that has always been the intent of the code this seems like a reasonable change. Cc: stable@vger.kernel.org Reported-by: Al Viro Suggested-by: Al Viro Tested-by: Kees Cook Reviewed-by: Oleg Nesterov Link: https://lkml.kernel.org/r/20220505182645.497868-7-ebiederm@xmission.c= om Signed-off-by: "Eric W. Biederman" Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/step.c | 3 +-- kernel/ptrace.c | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) --- a/arch/x86/kernel/step.c +++ b/arch/x86/kernel/step.c @@ -180,8 +180,7 @@ void set_task_blockstep(struct task_stru * * NOTE: this means that set/clear TIF_BLOCKSTEP is only safe if * task is current or it can't be running, otherwise we can race - * with __switch_to_xtra(). We rely on ptrace_freeze_traced() but - * PTRACE_KILL is not safe. + * with __switch_to_xtra(). We rely on ptrace_freeze_traced(). */ local_irq_disable(); debugctl =3D get_debugctlmsr(); --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -1236,9 +1236,8 @@ int ptrace_request(struct task_struct *c return ptrace_resume(child, request, data); =20 case PTRACE_KILL: - if (child->exit_state) /* already dead */ - return 0; - return ptrace_resume(child, request, SIGKILL); + send_sig_info(SIGKILL, SEND_SIG_NOINFO, child); + return 0; =20 #ifdef CONFIG_HAVE_ARCH_TRACEHOOK case PTRACE_GETREGSET: From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10DF5C433EF for ; Tue, 7 Jun 2022 21:57:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358708AbiFGV5i (ORCPT ); Tue, 7 Jun 2022 17:57:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379297AbiFGVCT (ORCPT ); Tue, 7 Jun 2022 17:02:19 -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 217B43617F; Tue, 7 Jun 2022 11:47:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 926E1B823BA; Tue, 7 Jun 2022 18:47:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09587C36B11; Tue, 7 Jun 2022 18:47:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627655; bh=VNTYxmX8PpF2Jzw0wM9DpYH0agkzQxOFUJ/xXktJhtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ulyR8n/toaKKkzcda7x+mz+0RrlbUUtx2yCV/kE/0mxzD7X0i/a3TPEYsLR4lqtfG RV8sgIem3fqhj/pqJ8ZZErGR3Naab2j+Z3cHDMy9nog9S79drUYkbMdiBfYLcA8exh Stw7Lh0PKsGYS/zgVePF7O5enoUhWMrLlAiqUaTE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , Qu Wenruo , David Sterba Subject: [PATCH 5.18 045/879] btrfs: add "0x" prefix for unsupported optional features Date: Tue, 7 Jun 2022 18:52:43 +0200 Message-Id: <20220607165003.988268369@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qu Wenruo commit d5321a0fa8bc49f11bea0b470800962c17d92d8f upstream. The following error message lack the "0x" obviously: cannot mount because of unsupported optional features (4000) Add the prefix to make it less confusing. This can happen on older kernels that try to mount a filesystem with newer features so it makes sense to backport to older trees. CC: stable@vger.kernel.org # 4.14+ Reviewed-by: Nikolay Borisov Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/disk-io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3611,7 +3611,7 @@ int __cold open_ctree(struct super_block ~BTRFS_FEATURE_INCOMPAT_SUPP; if (features) { btrfs_err(fs_info, - "cannot mount because of unsupported optional features (%llx)", + "cannot mount because of unsupported optional features (0x%llx)", features); err =3D -EINVAL; goto fail_alloc; @@ -3649,7 +3649,7 @@ int __cold open_ctree(struct super_block ~BTRFS_FEATURE_COMPAT_RO_SUPP; if (!sb_rdonly(sb) && features) { btrfs_err(fs_info, - "cannot mount read-write because of unsupported optional features (%llx)", + "cannot mount read-write because of unsupported optional features (0x%llx= )", features); err =3D -EINVAL; goto fail_alloc; From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC037CCA47F for ; Tue, 7 Jun 2022 21:57:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354757AbiFGV5v (ORCPT ); Tue, 7 Jun 2022 17:57:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379300AbiFGVCU (ORCPT ); Tue, 7 Jun 2022 17:02:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BC4F4090B; Tue, 7 Jun 2022 11:47:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BEADC61794; Tue, 7 Jun 2022 18:47:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB615C341DF; Tue, 7 Jun 2022 18:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627658; bh=U8z2EyWlL/EamHjg5K9sUAchR/K3YRrPVDc2avLqNVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wi706HZXK3Svr/WYUcG46JK7w29jM9JH18XK83VmuCtvYNTLAVdYmDA3E0X8jWg+r GcGcTbPO9lbIWNRxt6+6IkkapyUrRbFgFM0H8VzeKHu7aYU0aZaop9TXeQEyDx+S/H ntuMp5cVaZ/oPc+7NDCSTmqyxj1Gp7L+UzhPG2f8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qu Wenruo , David Sterba Subject: [PATCH 5.18 046/879] btrfs: return correct error number for __extent_writepage_io() Date: Tue, 7 Jun 2022 18:52:44 +0200 Message-Id: <20220607165004.017527975@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qu Wenruo commit 44e5801fada6925d2bba1987c7b59cbcc9d0d592 upstream. [BUG] If we hit an error from submit_extent_page() inside __extent_writepage_io(), we could still return 0 to the caller, and even trigger the warning in btrfs_page_assert_not_dirty(). [CAUSE] In __extent_writepage_io(), if we hit an error from submit_extent_page(), we will just clean up the range and continue. This is completely fine for regular PAGE_SIZE =3D=3D sectorsize, as we can only hit one sector in one page, thus after the error we're ensured to exit and @ret will be saved. But for subpage case, we may have other dirty subpage range in the page, and in the next loop, we may succeeded submitting the next range. In that case, @ret will be overwritten, and we return 0 to the caller, while we have hit some error. [FIX] Introduce @has_error and @saved_ret to record the first error we hit, so we will never forget what error we hit. CC: stable@vger.kernel.org # 5.15+ Signed-off-by: Qu Wenruo Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/extent_io.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3920,10 +3920,12 @@ static noinline_for_stack int __extent_w u64 extent_offset; u64 block_start; struct extent_map *em; + int saved_ret =3D 0; int ret =3D 0; int nr =3D 0; u32 opf =3D REQ_OP_WRITE; const unsigned int write_flags =3D wbc_to_write_flags(wbc); + bool has_error =3D false; bool compressed; =20 ret =3D btrfs_writepage_cow_fixup(page); @@ -3973,6 +3975,9 @@ static noinline_for_stack int __extent_w if (IS_ERR(em)) { btrfs_page_set_error(fs_info, page, cur, end - cur + 1); ret =3D PTR_ERR_OR_ZERO(em); + has_error =3D true; + if (!saved_ret) + saved_ret =3D ret; break; } =20 @@ -4036,6 +4041,10 @@ static noinline_for_stack int __extent_w end_bio_extent_writepage, 0, 0, false); if (ret) { + has_error =3D true; + if (!saved_ret) + saved_ret =3D ret; + btrfs_page_set_error(fs_info, page, cur, iosize); if (PageWriteback(page)) btrfs_page_clear_writeback(fs_info, page, cur, @@ -4049,8 +4058,10 @@ static noinline_for_stack int __extent_w * If we finish without problem, we should not only clear page dirty, * but also empty subpage dirty bits */ - if (!ret) + if (!has_error) btrfs_page_assert_not_dirty(fs_info, page); + else + ret =3D saved_ret; *nr_ret =3D nr; return ret; } From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCDD3CCA489 for ; Tue, 7 Jun 2022 21:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347320AbiFGV4d (ORCPT ); Tue, 7 Jun 2022 17:56:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379313AbiFGVCU (ORCPT ); Tue, 7 Jun 2022 17:02:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 214C5544E6; Tue, 7 Jun 2022 11:47: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 7CB1B612F2; Tue, 7 Jun 2022 18:47:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FCE1C36AFF; Tue, 7 Jun 2022 18:47:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627660; bh=wNC8U3dK1TY97OQfPfc2Tk+MoG0IQByeSb90SP0rCYA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=krQYHnLT0vEs4Hf/4FsrJUj9wGqsz2HZfc00seXXYyoS+S8R3qRXNvhbK+rnPzLXE higJKCPv//ir6UDgtPYaVZJcDZsmQPJAF5Bg0fwYn29HKQ3B2jhNC1H+33eWtQC7zT Jpf2hZqf0j7ecMhupt67yWSb1wfFwBf9mLCWINB4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Luca=20B=C3=A9la=20Palkovics?= , Qu Wenruo , David Sterba Subject: [PATCH 5.18 047/879] btrfs: repair super block num_devices automatically Date: Tue, 7 Jun 2022 18:52:45 +0200 Message-Id: <20220607165004.047386387@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qu Wenruo commit d201238ccd2f30b9bfcfadaeae0972e3a486a176 upstream. [BUG] There is a report that a btrfs has a bad super block num devices. This makes btrfs to reject the fs completely. BTRFS error (device sdd3): super_num_devices 3 mismatch with num_devices = 2 found here BTRFS error (device sdd3): failed to read chunk tree: -22 BTRFS error (device sdd3): open_ctree failed [CAUSE] During btrfs device removal, chunk tree and super block num devs are updated in two different transactions: btrfs_rm_device() |- btrfs_rm_dev_item(device) | |- trans =3D btrfs_start_transaction() | | Now we got transaction X | | | |- btrfs_del_item() | | Now device item is removed from chunk tree | | | |- btrfs_commit_transaction() | Transaction X got committed, super num devs untouched, | but device item removed from chunk tree. | (AKA, super num devs is already incorrect) | |- cur_devices->num_devices--; |- cur_devices->total_devices--; |- btrfs_set_super_num_devices() All those operations are not in transaction X, thus it will only be written back to disk in next transaction. So after the transaction X in btrfs_rm_dev_item() committed, but before transaction X+1 (which can be minutes away), a power loss happen, then we got the super num mismatch. This has been fixed by commit bbac58698a55 ("btrfs: remove device item and update super block in the same transaction"). [FIX] Make the super_num_devices check less strict, converting it from a hard error to a warning, and reset the value to a correct one for the current or next transaction commit. As the number of device items is the critical information where the super block num_devices is only a cached value (and also useful for cross checking), it's safe to automatically update it. Other device related problems like missing device are handled after that and may require other means to resolve, like degraded mount. With this fix, potentially affected filesystems won't fail mount and require the manual repair by btrfs check. Reported-by: Luca B=C3=A9la Palkovics Link: https://lore.kernel.org/linux-btrfs/CA+8xDSpvdm_U0QLBAnrH=3DzqDq_cWCO= H5TiV46CKmp3igr44okQ@mail.gmail.com/ CC: stable@vger.kernel.org # 4.14+ Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/volumes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -7671,12 +7671,12 @@ int btrfs_read_chunk_tree(struct btrfs_f * do another round of validation checks. */ if (total_dev !=3D fs_info->fs_devices->total_devices) { - btrfs_err(fs_info, - "super_num_devices %llu mismatch with num_devices %llu found here", + btrfs_warn(fs_info, +"super block num_devices %llu mismatch with DEV_ITEM count %llu, will be r= epaired on next transaction commit", btrfs_super_num_devices(fs_info->super_copy), total_dev); - ret =3D -EINVAL; - goto error; + fs_info->fs_devices->total_devices =3D total_dev; + btrfs_set_super_num_devices(fs_info->super_copy, total_dev); } if (btrfs_super_total_bytes(fs_info->super_copy) < fs_info->fs_devices->total_rw_bytes) { From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72D69C43334 for ; Tue, 7 Jun 2022 21:59:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382819AbiFGV7N (ORCPT ); Tue, 7 Jun 2022 17:59:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379327AbiFGVCV (ORCPT ); Tue, 7 Jun 2022 17:02:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 588686007C; Tue, 7 Jun 2022 11:47: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 C820EB82391; Tue, 7 Jun 2022 18:47:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EA15C385A2; Tue, 7 Jun 2022 18:47:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627663; bh=o+MmL6FMhV0VWrsIVr9yU3DUtLKrFSL2sLS6Om3lkos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PS10GsrfQgqdnWfp0JkXf2nvkP6cGHoj5RF/0px1zpjKc9MF3tZZOivHIeVENXOL4 1wnlx55fJITfT4DEASDWr90XqpSNrK/EgI/VY4Jr1LHL3We9O1ECNOFuO+yUyt5Bx1 7h78VAQV/iwPaDiPDPDYU2wlDA6Dunp6ASgsmVr0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qu Wenruo , David Sterba Subject: [PATCH 5.18 048/879] btrfs: fix the error handling for submit_extent_page() for btrfs_do_readpage() Date: Tue, 7 Jun 2022 18:52:46 +0200 Message-Id: <20220607165004.077844875@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qu Wenruo commit 10f7f6f879c28f8368d6516ab1ccf3517a1f5d3d upstream. [BUG] Test case generic/475 have a very high chance (almost 100%) to hit a fs hang, where a data page will never be unlocked and hang all later operations. [CAUSE] In btrfs_do_readpage(), if we hit an error from submit_extent_page() we will try to do the cleanup for our current io range, and exit. This works fine for PAGE_SIZE =3D=3D sectorsize cases, but not for subpage. For subpage btrfs_do_readpage() will lock the full page first, which can contain several different sectors and extents: btrfs_do_readpage() |- begin_page_read() | |- btrfs_subpage_start_reader(); | Now the page will have PAGE_SIZE / sectorsize reader pending, | and the page is locked. | |- end_page_read() for different branches | This function will reduce subpage readers, and when readers | reach 0, it will unlock the page. But when submit_extent_page() failed, we only cleanup the current io range, while the remaining io range will never be cleaned up, and the page remains locked forever. [FIX] Update the error handling of submit_extent_page() to cleanup all the remaining subpage range before exiting the loop. Please note that, now submit_extent_page() can only fail due to sanity check in alloc_new_bio(). Thus regular IO errors are impossible to trigger the error path. CC: stable@vger.kernel.org # 5.15+ Signed-off-by: Qu Wenruo Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/extent_io.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3743,8 +3743,12 @@ int btrfs_do_readpage(struct page *page, this_bio_flag, force_bio_submit); if (ret) { - unlock_extent(tree, cur, cur + iosize - 1); - end_page_read(page, false, cur, iosize); + /* + * We have to unlock the remaining range, or the page + * will never be unlocked. + */ + unlock_extent(tree, cur, end); + end_page_read(page, false, cur, end + 1 - cur); goto out; } cur =3D cur + iosize; From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C968AC433EF for ; Tue, 7 Jun 2022 21:58:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353946AbiFGV6A (ORCPT ); Tue, 7 Jun 2022 17:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379360AbiFGVCX (ORCPT ); Tue, 7 Jun 2022 17:02:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F91571A1F; Tue, 7 Jun 2022 11:47:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 74F68B8239C; Tue, 7 Jun 2022 18:47:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD476C385A2; Tue, 7 Jun 2022 18:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627666; bh=wH3qr55WQ/dYCTjalZVSGD7peiP6GK3F62IR3pznFRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sa7UBdp3l9O05HvXQe8Y3H/SkINOmEHJEhF6WrwM3Q9JIw+mwW/Ph9OVWyu4HGLQA uEBAj+MRWvDmH4IVrFoN+Xr1Tq1kBew6+UyQMQg2Nk3Cwhe7rK8ssQwQdsz9wIrw2u IXSMnJhBu4VNHO7acBu2LvxqSR2S7svKonapwX8w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , David Sterba Subject: [PATCH 5.18 049/879] btrfs: fix deadlock between concurrent dio writes when low on free data space Date: Tue, 7 Jun 2022 18:52:47 +0200 Message-Id: <20220607165004.109520324@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Filipe Manana commit f5585f4f0ef5b17026bbd60fbff6fcc91b99d5bf upstream. When reserving data space for a direct IO write we can end up deadlocking if we have multiple tasks attempting a write to the same file range, there are multiple extents covered by that file range, we are low on available space for data and the writes don't expand the inode's i_size. The deadlock can happen like this: 1) We have a file with an i_size of 1M, at offset 0 it has an extent with a size of 128K and at offset 128K it has another extent also with a size of 128K; 2) Task A does a direct IO write against file range [0, 256K), and because the write is within the i_size boundary, it takes the inode's lock (VFS level) in shared mode; 3) Task A locks the file range [0, 256K) at btrfs_dio_iomap_begin(), and then gets the extent map for the extent covering the range [0, 128K). At btrfs_get_blocks_direct_write(), it creates an ordered extent for that file range ([0, 128K)); 4) Before returning from btrfs_dio_iomap_begin(), it unlocks the file range [0, 256K); 5) Task A executes btrfs_dio_iomap_begin() again, this time for the file range [128K, 256K), and locks the file range [128K, 256K); 6) Task B starts a direct IO write against file range [0, 256K) as well. It also locks the inode in shared mode, as it's within the i_size limit, and then tries to lock file range [0, 256K). It is able to lock the subrange [0, 128K) but then blocks waiting for the range [128K, 256K), as it is currently locked by task A; 7) Task A enters btrfs_get_blocks_direct_write() and tries to reserve data space. Because we are low on available free space, it triggers the async data reclaim task, and waits for it to reserve data space; 8) The async reclaim task decides to wait for all existing ordered extents to complete (through btrfs_wait_ordered_roots()). It finds the ordered extent previously created by task A for the file range [0, 128K) and waits for it to complete; 9) The ordered extent for the file range [0, 128K) can not complete because it blocks at btrfs_finish_ordered_io() when trying to lock the file range [0, 128K). This results in a deadlock, because: - task B is holding the file range [0, 128K) locked, waiting for the range [128K, 256K) to be unlocked by task A; - task A is holding the file range [128K, 256K) locked and it's waiting for the async data reclaim task to satisfy its space reservation request; - the async data reclaim task is waiting for ordered extent [0, 128K) to complete, but the ordered extent can not complete because the file range [0, 128K) is currently locked by task B, which is waiting on task A to unlock file range [128K, 256K) and task A waiting on the async data reclaim task. This results in a deadlock between 4 task: task A, task B, the async data reclaim task and the task doing ordered extent completion (a work queue task). This type of deadlock can sporadically be triggered by the test case generic/300 from fstests, and results in a stack trace like the following: [12084.033689] INFO: task kworker/u16:7:123749 blocked for more than 241 se= conds. [12084.034877] Not tainted 5.18.0-rc2-btrfs-next-115 #1 [12084.035562] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables = this message. [12084.036548] task:kworker/u16:7 state:D stack: 0 pid:123749 ppid: = 2 flags:0x00004000 [12084.036554] Workqueue: btrfs-flush_delalloc btrfs_work_helper [btrfs] [12084.036599] Call Trace: [12084.036601] [12084.036606] __schedule+0x3cb/0xed0 [12084.036616] schedule+0x4e/0xb0 [12084.036620] btrfs_start_ordered_extent+0x109/0x1c0 [btrfs] [12084.036651] ? prepare_to_wait_exclusive+0xc0/0xc0 [12084.036659] btrfs_run_ordered_extent_work+0x1a/0x30 [btrfs] [12084.036688] btrfs_work_helper+0xf8/0x400 [btrfs] [12084.036719] ? lock_is_held_type+0xe8/0x140 [12084.036727] process_one_work+0x252/0x5a0 [12084.036736] ? process_one_work+0x5a0/0x5a0 [12084.036738] worker_thread+0x52/0x3b0 [12084.036743] ? process_one_work+0x5a0/0x5a0 [12084.036745] kthread+0xf2/0x120 [12084.036747] ? kthread_complete_and_exit+0x20/0x20 [12084.036751] ret_from_fork+0x22/0x30 [12084.036765] [12084.036769] INFO: task kworker/u16:11:153787 blocked for more than 241 s= econds. [12084.037702] Not tainted 5.18.0-rc2-btrfs-next-115 #1 [12084.038540] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables = this message. [12084.039506] task:kworker/u16:11 state:D stack: 0 pid:153787 ppid: = 2 flags:0x00004000 [12084.039511] Workqueue: events_unbound btrfs_async_reclaim_data_space [bt= rfs] [12084.039551] Call Trace: [12084.039553] [12084.039557] __schedule+0x3cb/0xed0 [12084.039566] schedule+0x4e/0xb0 [12084.039569] schedule_timeout+0xed/0x130 [12084.039573] ? mark_held_locks+0x50/0x80 [12084.039578] ? _raw_spin_unlock_irq+0x24/0x50 [12084.039580] ? lockdep_hardirqs_on+0x7d/0x100 [12084.039585] __wait_for_common+0xaf/0x1f0 [12084.039587] ? usleep_range_state+0xb0/0xb0 [12084.039596] btrfs_wait_ordered_extents+0x3d6/0x470 [btrfs] [12084.039636] btrfs_wait_ordered_roots+0x175/0x240 [btrfs] [12084.039670] flush_space+0x25b/0x630 [btrfs] [12084.039712] btrfs_async_reclaim_data_space+0x108/0x1b0 [btrfs] [12084.039747] process_one_work+0x252/0x5a0 [12084.039756] ? process_one_work+0x5a0/0x5a0 [12084.039758] worker_thread+0x52/0x3b0 [12084.039762] ? process_one_work+0x5a0/0x5a0 [12084.039765] kthread+0xf2/0x120 [12084.039766] ? kthread_complete_and_exit+0x20/0x20 [12084.039770] ret_from_fork+0x22/0x30 [12084.039783] [12084.039800] INFO: task kworker/u16:17:217907 blocked for more than 241 s= econds. [12084.040709] Not tainted 5.18.0-rc2-btrfs-next-115 #1 [12084.041398] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables = this message. [12084.042404] task:kworker/u16:17 state:D stack: 0 pid:217907 ppid: = 2 flags:0x00004000 [12084.042411] Workqueue: btrfs-endio-write btrfs_work_helper [btrfs] [12084.042461] Call Trace: [12084.042463] [12084.042471] __schedule+0x3cb/0xed0 [12084.042485] schedule+0x4e/0xb0 [12084.042490] wait_extent_bit.constprop.0+0x1eb/0x260 [btrfs] [12084.042539] ? prepare_to_wait_exclusive+0xc0/0xc0 [12084.042551] lock_extent_bits+0x37/0x90 [btrfs] [12084.042601] btrfs_finish_ordered_io.isra.0+0x3fd/0x960 [btrfs] [12084.042656] ? lock_is_held_type+0xe8/0x140 [12084.042667] btrfs_work_helper+0xf8/0x400 [btrfs] [12084.042716] ? lock_is_held_type+0xe8/0x140 [12084.042727] process_one_work+0x252/0x5a0 [12084.042742] worker_thread+0x52/0x3b0 [12084.042750] ? process_one_work+0x5a0/0x5a0 [12084.042754] kthread+0xf2/0x120 [12084.042757] ? kthread_complete_and_exit+0x20/0x20 [12084.042763] ret_from_fork+0x22/0x30 [12084.042783] [12084.042798] INFO: task fio:234517 blocked for more than 241 seconds. [12084.043598] Not tainted 5.18.0-rc2-btrfs-next-115 #1 [12084.044282] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables = this message. [12084.045244] task:fio state:D stack: 0 pid:234517 ppid:234= 515 flags:0x00004000 [12084.045248] Call Trace: [12084.045250] [12084.045254] __schedule+0x3cb/0xed0 [12084.045263] schedule+0x4e/0xb0 [12084.045266] wait_extent_bit.constprop.0+0x1eb/0x260 [btrfs] [12084.045298] ? prepare_to_wait_exclusive+0xc0/0xc0 [12084.045306] lock_extent_bits+0x37/0x90 [btrfs] [12084.045336] btrfs_dio_iomap_begin+0x336/0xc60 [btrfs] [12084.045370] ? lock_is_held_type+0xe8/0x140 [12084.045378] iomap_iter+0x184/0x4c0 [12084.045383] __iomap_dio_rw+0x2c6/0x8a0 [12084.045406] iomap_dio_rw+0xa/0x30 [12084.045408] btrfs_do_write_iter+0x370/0x5e0 [btrfs] [12084.045440] aio_write+0xfa/0x2c0 [12084.045448] ? __might_fault+0x2a/0x70 [12084.045451] ? kvm_sched_clock_read+0x14/0x40 [12084.045455] ? lock_release+0x153/0x4a0 [12084.045463] io_submit_one+0x615/0x9f0 [12084.045467] ? __might_fault+0x2a/0x70 [12084.045469] ? kvm_sched_clock_read+0x14/0x40 [12084.045478] __x64_sys_io_submit+0x83/0x160 [12084.045483] ? syscall_enter_from_user_mode+0x1d/0x50 [12084.045489] do_syscall_64+0x3b/0x90 [12084.045517] entry_SYSCALL_64_after_hwframe+0x44/0xae [12084.045521] RIP: 0033:0x7fa76511af79 [12084.045525] RSP: 002b:00007ffd6d6b9058 EFLAGS: 00000246 ORIG_RAX: 000000= 00000000d1 [12084.045530] RAX: ffffffffffffffda RBX: 00007fa75ba6e760 RCX: 00007fa7651= 1af79 [12084.045532] RDX: 0000557b304ff3f0 RSI: 0000000000000001 RDI: 00007fa75ba= 4c000 [12084.045535] RBP: 00007fa75ba4c000 R08: 00007fa751b76000 R09: 00000000000= 00330 [12084.045537] R10: 0000000000000000 R11: 0000000000000246 R12: 00000000000= 00001 [12084.045540] R13: 0000000000000000 R14: 0000557b304ff3f0 R15: 0000557b305= 21eb0 [12084.045561] Fix this issue by always reserving data space before locking a file range at btrfs_dio_iomap_begin(). If we can't reserve the space, then we don't error out immediately - instead after locking the file range, check if we can do a NOCOW write, and if we can we don't error out since we don't need to allocate a data extent, however if we can't NOCOW then error out with -ENOSPC. This also implies that we may end up reserving space when it's not needed because the write will end up being done in NOCOW mode - in that case we just release the space after we noticed we did a NOCOW write - this is the same type of logic that is done in the path for buffered IO writes. Fixes: f0bfa76a11e93d ("btrfs: fix ENOSPC failure when attempting direct IO= write into NOCOW range") CC: stable@vger.kernel.org # 5.17+ Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/inode.c | 81 +++++++++++++++++++++++++++++++++++++++++++-------= ----- 1 file changed, 64 insertions(+), 17 deletions(-) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -64,6 +64,8 @@ struct btrfs_iget_args { struct btrfs_dio_data { ssize_t submitted; struct extent_changeset *data_reserved; + bool data_space_reserved; + bool nocow_done; }; =20 struct btrfs_rename_ctx { @@ -7489,15 +7491,25 @@ static int btrfs_get_blocks_direct_write ret =3D PTR_ERR(em2); goto out; } + + dio_data->nocow_done =3D true; } else { /* Our caller expects us to free the input extent map. */ free_extent_map(em); *map =3D NULL; =20 - /* We have to COW, so need to reserve metadata and data space. */ - ret =3D btrfs_delalloc_reserve_space(BTRFS_I(inode), - &dio_data->data_reserved, - start, len); + /* + * If we could not allocate data space before locking the file + * range and we can't do a NOCOW write, then we have to fail. + */ + if (!dio_data->data_space_reserved) + return -ENOSPC; + + /* + * We have to COW and we have already reserved data space before, + * so now we reserve only metadata. + */ + ret =3D btrfs_delalloc_reserve_metadata(BTRFS_I(inode), len, len); if (ret < 0) goto out; space_reserved =3D true; @@ -7510,10 +7522,8 @@ static int btrfs_get_blocks_direct_write *map =3D em; len =3D min(len, em->len - (start - em->start)); if (len < prev_len) - btrfs_delalloc_release_space(BTRFS_I(inode), - dio_data->data_reserved, - start + len, prev_len - len, - true); + btrfs_delalloc_release_metadata(BTRFS_I(inode), + prev_len - len, true); } =20 /* @@ -7531,15 +7541,7 @@ static int btrfs_get_blocks_direct_write out: if (ret && space_reserved) { btrfs_delalloc_release_extents(BTRFS_I(inode), len); - if (can_nocow) { - btrfs_delalloc_release_metadata(BTRFS_I(inode), len, true); - } else { - btrfs_delalloc_release_space(BTRFS_I(inode), - dio_data->data_reserved, - start, len, true); - extent_changeset_free(dio_data->data_reserved); - dio_data->data_reserved =3D NULL; - } + btrfs_delalloc_release_metadata(BTRFS_I(inode), len, true); } return ret; } @@ -7556,6 +7558,7 @@ static int btrfs_dio_iomap_begin(struct const bool write =3D !!(flags & IOMAP_WRITE); int ret =3D 0; u64 len =3D length; + const u64 data_alloc_len =3D length; bool unlock_extents =3D false; =20 if (!write) @@ -7584,6 +7587,25 @@ static int btrfs_dio_iomap_begin(struct =20 iomap->private =3D dio_data; =20 + /* + * We always try to allocate data space and must do it before locking + * the file range, to avoid deadlocks with concurrent writes to the same + * range if the range has several extents and the writes don't expand the + * current i_size (the inode lock is taken in shared mode). If we fail to + * allocate data space here we continue and later, after locking the + * file range, we fail with ENOSPC only if we figure out we can not do a + * NOCOW write. + */ + if (write && !(flags & IOMAP_NOWAIT)) { + ret =3D btrfs_check_data_free_space(BTRFS_I(inode), + &dio_data->data_reserved, + start, data_alloc_len); + if (!ret) + dio_data->data_space_reserved =3D true; + else if (ret && !(BTRFS_I(inode)->flags & + (BTRFS_INODE_NODATACOW | BTRFS_INODE_PREALLOC))) + goto err; + } =20 /* * If this errors out it's because we couldn't invalidate pagecache for @@ -7658,6 +7680,24 @@ static int btrfs_dio_iomap_begin(struct unlock_extents =3D true; /* Recalc len in case the new em is smaller than requested */ len =3D min(len, em->len - (start - em->start)); + if (dio_data->data_space_reserved) { + u64 release_offset; + u64 release_len =3D 0; + + if (dio_data->nocow_done) { + release_offset =3D start; + release_len =3D data_alloc_len; + } else if (len < data_alloc_len) { + release_offset =3D start + len; + release_len =3D data_alloc_len - len; + } + + if (release_len > 0) + btrfs_free_reserved_data_space(BTRFS_I(inode), + dio_data->data_reserved, + release_offset, + release_len); + } } else { /* * We need to unlock only the end area that we aren't using. @@ -7702,6 +7742,13 @@ unlock_err: unlock_extent_cached(&BTRFS_I(inode)->io_tree, lockstart, lockend, &cached_state); err: + if (dio_data->data_space_reserved) { + btrfs_free_reserved_data_space(BTRFS_I(inode), + dio_data->data_reserved, + start, data_alloc_len); + extent_changeset_free(dio_data->data_reserved); + } + kfree(dio_data); =20 return ret; From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7148C433EF for ; Tue, 7 Jun 2022 21:58:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352366AbiFGV6J (ORCPT ); Tue, 7 Jun 2022 17:58:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379374AbiFGVCY (ORCPT ); Tue, 7 Jun 2022 17:02:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95F65939B1; Tue, 7 Jun 2022 11:47:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F329FB822C0; Tue, 7 Jun 2022 18:47:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E6C8C3411C; Tue, 7 Jun 2022 18:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627671; bh=dYbzWcMta5duF/c1xbo26S7UogoDY6dI5zgmiYq/jpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RxmJXpnUZHSUMLNfkKk74dtyNz1VM9Hz+6Up16RMxAY5u8Wgs8XZK9fi21xsQHA8l tIkSUUvnCdDGaOw7WuUWicBmcN++/UMggzqFawPgrFE3pCXju00bTSQ/ADqffVwXXq JhKoHurMeFALp6B7Hy/Mi03ovpUOK+/ZpNLVS+EQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Thumshirn , Naohiro Aota , David Sterba Subject: [PATCH 5.18 050/879] btrfs: zoned: properly finish block group on metadata write Date: Tue, 7 Jun 2022 18:52:48 +0200 Message-Id: <20220607165004.138065755@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota commit 56fbb0a4e8b3e929e41cc846e6ef89eb01152201 upstream. Commit be1a1d7a5d24 ("btrfs: zoned: finish fully written block group") introduced zone finishing code both for data and metadata end_io path. However, the metadata side is not working as it should. First, it compares logical address (eb->start + eb->len) with offset within a block group (cache->zone_capacity) in submit_eb_page(). That essentially disabled zone finishing on metadata end_io path. Furthermore, fixing the issue above revealed we cannot call btrfs_zone_finish_endio() in end_extent_buffer_writeback(). We cannot call btrfs_lookup_block_group() which require spin lock inside end_io context. Introduce btrfs_schedule_zone_finish_bg() to wait for the extent buffer writeback and do the zone finish IO in a workqueue. Also, drop EXTENT_BUFFER_ZONE_FINISH as it is no longer used. Fixes: be1a1d7a5d24 ("btrfs: zoned: finish fully written block group") CC: stable@vger.kernel.org # 5.16+ Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/block-group.h | 2 ++ fs/btrfs/extent_io.c | 6 +----- fs/btrfs/extent_io.h | 1 - fs/btrfs/zoned.c | 31 +++++++++++++++++++++++++++++++ fs/btrfs/zoned.h | 5 +++++ 5 files changed, 39 insertions(+), 6 deletions(-) --- a/fs/btrfs/block-group.h +++ b/fs/btrfs/block-group.h @@ -212,6 +212,8 @@ struct btrfs_block_group { u64 meta_write_pointer; struct map_lookup *physical_map; struct list_head active_bg_list; + struct work_struct zone_finish_work; + struct extent_buffer *last_eb; }; =20 static inline u64 btrfs_block_group_end(struct btrfs_block_group *block_gr= oup) --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -4196,9 +4196,6 @@ void wait_on_extent_buffer_writeback(str =20 static void end_extent_buffer_writeback(struct extent_buffer *eb) { - if (test_bit(EXTENT_BUFFER_ZONE_FINISH, &eb->bflags)) - btrfs_zone_finish_endio(eb->fs_info, eb->start, eb->len); - clear_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags); smp_mb__after_atomic(); wake_up_bit(&eb->bflags, EXTENT_BUFFER_WRITEBACK); @@ -4818,8 +4815,7 @@ static int submit_eb_page(struct page *p /* * Implies write in zoned mode. Mark the last eb in a block group. */ - if (cache->seq_zone && eb->start + eb->len =3D=3D cache->zone_capacity) - set_bit(EXTENT_BUFFER_ZONE_FINISH, &eb->bflags); + btrfs_schedule_zone_finish_bg(cache, eb); btrfs_put_block_group(cache); } ret =3D write_one_eb(eb, wbc, epd); --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -32,7 +32,6 @@ enum { /* write IO error */ EXTENT_BUFFER_WRITE_ERR, EXTENT_BUFFER_NO_CHECK, - EXTENT_BUFFER_ZONE_FINISH, }; =20 /* these are flags for __process_pages_contig */ --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -2046,6 +2046,37 @@ out: btrfs_put_block_group(block_group); } =20 +static void btrfs_zone_finish_endio_workfn(struct work_struct *work) +{ + struct btrfs_block_group *bg =3D + container_of(work, struct btrfs_block_group, zone_finish_work); + + wait_on_extent_buffer_writeback(bg->last_eb); + free_extent_buffer(bg->last_eb); + btrfs_zone_finish_endio(bg->fs_info, bg->start, bg->length); + btrfs_put_block_group(bg); +} + +void btrfs_schedule_zone_finish_bg(struct btrfs_block_group *bg, + struct extent_buffer *eb) +{ + if (!bg->seq_zone || eb->start + eb->len * 2 <=3D bg->start + bg->zone_ca= pacity) + return; + + if (WARN_ON(bg->zone_finish_work.func =3D=3D btrfs_zone_finish_endio_work= fn)) { + btrfs_err(bg->fs_info, "double scheduling of bg %llu zone finishing", + bg->start); + return; + } + + /* For the work */ + btrfs_get_block_group(bg); + atomic_inc(&eb->refs); + bg->last_eb =3D eb; + INIT_WORK(&bg->zone_finish_work, btrfs_zone_finish_endio_workfn); + queue_work(system_unbound_wq, &bg->zone_finish_work); +} + void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg) { struct btrfs_fs_info *fs_info =3D bg->fs_info; --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -76,6 +76,8 @@ int btrfs_zone_finish(struct btrfs_block bool btrfs_can_activate_zone(struct btrfs_fs_devices *fs_devices, u64 flag= s); void btrfs_zone_finish_endio(struct btrfs_fs_info *fs_info, u64 logical, u64 length); +void btrfs_schedule_zone_finish_bg(struct btrfs_block_group *bg, + struct extent_buffer *eb); void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg); void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info); #else /* CONFIG_BLK_DEV_ZONED */ @@ -233,6 +235,9 @@ static inline bool btrfs_can_activate_zo static inline void btrfs_zone_finish_endio(struct btrfs_fs_info *fs_info, u64 logical, u64 length) { } =20 +static inline void btrfs_schedule_zone_finish_bg(struct btrfs_block_group = *bg, + struct extent_buffer *eb) { } + static inline void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg)= { } =20 static inline void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info) { } From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE63DC433EF for ; Tue, 7 Jun 2022 21:58:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349475AbiFGV6Q (ORCPT ); Tue, 7 Jun 2022 17:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379383AbiFGVCY (ORCPT ); Tue, 7 Jun 2022 17:02:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E87B7A82E; Tue, 7 Jun 2022 11:47: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 BB0CEB81FE1; Tue, 7 Jun 2022 18:47:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D9B4C385A2; Tue, 7 Jun 2022 18:47:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627674; bh=GHSWOLtaRIxGcfDoMTvsX1OVEgJYxZloovcbfd7Oric=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rg6nDat7SkRD6I6XQcOBUq0WiwNYRIwzUGj2Dv/1hlalQh/SR1hsNJ1jWKgmy9ULH iORyDFFTFsgk4NrjkgRGXG3mf6YcCGY5NAqF61gLgLHnY29p1jrpMbrIT3dxiIQEyd J9oJuDeEKt0vqMQfCyQLVVFXd1WoCB8kNoRl5BLo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Thumshirn , Naohiro Aota , David Sterba Subject: [PATCH 5.18 051/879] btrfs: zoned: zone finish unused block group Date: Tue, 7 Jun 2022 18:52:49 +0200 Message-Id: <20220607165004.167780399@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota commit 74e91b12b11560f01d120751d99d91d54b265d3d upstream. While the active zones within an active block group are reset, and their active resource is released, the block group itself is kept in the active block group list and marked as active. As a result, the list will contain more than max_active_zones block groups. That itself is not fatal for the device as the zones are properly reset. However, that inflated list is, of course, strange. Also, a to-appear patch series, which deactivates an active block group on demand, gets confused with the wrong list. So, fix the issue by finishing the unused block group once it gets read-only, so that we can release the active resource in an early stage. Fixes: be1a1d7a5d24 ("btrfs: zoned: finish fully written block group") CC: stable@vger.kernel.org # 5.16+ Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/block-group.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -1367,6 +1367,14 @@ void btrfs_delete_unused_bgs(struct btrf goto next; } =20 + ret =3D btrfs_zone_finish(block_group); + if (ret < 0) { + btrfs_dec_block_group_ro(block_group); + if (ret =3D=3D -EAGAIN) + ret =3D 0; + goto next; + } + /* * Want to do this before we do anything else so we can recover * properly if we fail to join the transaction. From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA173C43334 for ; Tue, 7 Jun 2022 21:59:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382525AbiFGV7I (ORCPT ); Tue, 7 Jun 2022 17:59:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379387AbiFGVCZ (ORCPT ); Tue, 7 Jun 2022 17:02:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82B3F1D0C3; Tue, 7 Jun 2022 11:47: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 CD4086157E; Tue, 7 Jun 2022 18:47:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E11C1C385A5; Tue, 7 Jun 2022 18:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627677; bh=EInUvTyG0QKxuaOKiE7JO3QEO7XmepPOp9648sfZpiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qcq1uQJV2Jfw8v0+StfnXC7Ym3D4tJHkjvia5VchRWjCqQYWT87ZMx8txtaoxJZG3 pTB1rdQpnGZTg2cS61Zt9vY629+qfiCZuHJWop3kUgT6ODrhrD8+6Nd+MpzPc6yp// Vif8/mMUpgCfF4HmFGTIxStO9ctrff9n0IOuiFAg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pankaj Raghav , Johannes Thumshirn , Naohiro Aota , David Sterba Subject: [PATCH 5.18 052/879] btrfs: zoned: finish block group when there are no more allocatable bytes left Date: Tue, 7 Jun 2022 18:52:50 +0200 Message-Id: <20220607165004.197224164@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota commit 8b8a53998caefebfe5c8da7a74c2b601caf5dd48 upstream. Currently, btrfs_zone_finish_endio() finishes a block group only when the written region reaches the end of the block group. We can also finish the block group when no more allocation is possible. Fixes: be1a1d7a5d24 ("btrfs: zoned: finish fully written block group") CC: stable@vger.kernel.org # 5.16+ Reviewed-by: Pankaj Raghav Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/zoned.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -2000,6 +2000,7 @@ void btrfs_zone_finish_endio(struct btrf struct btrfs_block_group *block_group; struct map_lookup *map; struct btrfs_device *device; + u64 min_alloc_bytes; u64 physical; =20 if (!btrfs_is_zoned(fs_info)) @@ -2008,7 +2009,15 @@ void btrfs_zone_finish_endio(struct btrf block_group =3D btrfs_lookup_block_group(fs_info, logical); ASSERT(block_group); =20 - if (logical + length < block_group->start + block_group->zone_capacity) + /* No MIXED_BG on zoned btrfs. */ + if (block_group->flags & BTRFS_BLOCK_GROUP_DATA) + min_alloc_bytes =3D fs_info->sectorsize; + else + min_alloc_bytes =3D fs_info->nodesize; + + /* Bail out if we can allocate more data from this block group. */ + if (logical + length + min_alloc_bytes <=3D + block_group->start + block_group->zone_capacity) goto out; =20 spin_lock(&block_group->lock); From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4200CCA483 for ; Tue, 7 Jun 2022 21:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382931AbiFGV67 (ORCPT ); Tue, 7 Jun 2022 17:58:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379395AbiFGVCZ (ORCPT ); Tue, 7 Jun 2022 17:02:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EFAAAF1F5; Tue, 7 Jun 2022 11:48:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8F1386157E; Tue, 7 Jun 2022 18:48:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C257C385A2; Tue, 7 Jun 2022 18:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627680; bh=xf9XcbXTutHEaP8Ja6L4CnA04pALN4aTf1DHiUc7ZXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tazklCE7QNm9pWR7g1EDFOr6t5sp06H4DpPEIJIiINbT9BiicWyKSnmQVBnDuLD3z P6LWWpmd5axd5zQHU0zlWKmbTybgdxJr19fLSOYyq9NTlXXBW6ZoQQIamLMjbREtb+ aDhy42rTmEEPZE43JGI2b9amWUm4ygaH52dgqJgQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba Subject: [PATCH 5.18 053/879] btrfs: zoned: fix comparison of alloc_offset vs meta_write_pointer Date: Tue, 7 Jun 2022 18:52:51 +0200 Message-Id: <20220607165004.227971390@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota commit aa9ffadfcae33e611d8c2d476bcc2aa0d273b587 upstream. The block_group->alloc_offset is an offset from the start of the block group. OTOH, the ->meta_write_pointer is an address in the logical space. So, we should compare the alloc_offset shifted with the block_group->start. Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking") CC: stable@vger.kernel.org # 5.16+ Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/zoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1896,7 +1896,7 @@ int btrfs_zone_finish(struct btrfs_block /* Check if we have unwritten allocated space */ if ((block_group->flags & (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)) && - block_group->alloc_offset > block_group->meta_write_pointer) { + block_group->start + block_group->alloc_offset > block_group->meta_wr= ite_pointer) { spin_unlock(&block_group->lock); return -EAGAIN; } From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5F78CCA482 for ; Tue, 7 Jun 2022 21:59:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382918AbiFGV6t (ORCPT ); Tue, 7 Jun 2022 17:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379446AbiFGVC2 (ORCPT ); Tue, 7 Jun 2022 17:02:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98883AEE32; Tue, 7 Jun 2022 11:48:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EA99EB8239A; Tue, 7 Jun 2022 18:48:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52A8BC385A2; Tue, 7 Jun 2022 18:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627682; bh=v6STE/M7umHmQhXZl5W6Am/3Zz1pQY0LUnmLP5HuXO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FjA2rYz/mDzbbqMp2GBy5iixiRfTEXRMLUxjNeCht1QKibKzdZQl8ym56PzfT0vgz 2X60s2mVdLeAgae1NIcCv8ctgkSzRKBie+HzPIF87gjoRfpgH3K+NaldqE9DJg3UE5 Y+BbY7YdV7IjXWLOHwQDhpcdAH84E6AsT9eGFMvM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raviteja Goud Talla , Rodrigo Vivi , Lu Baolu , Tejas Upadhyay , Sasha Levin Subject: [PATCH 5.18 054/879] iommu/vt-d: Add RPLS to quirk list to skip TE disabling Date: Tue, 7 Jun 2022 18:52:52 +0200 Message-Id: <20220607165004.257160466@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tejas Upadhyay [ Upstream commit 0a967f5bfd9134b89681cae58deb222e20840e76 ] The VT-d spec requires (10.4.4 Global Command Register, TE field) that: Hardware implementations supporting DMA draining must drain any in-flight DMA read/write requests queued within the Root-Complex before completing the translation enable command and reflecting the status of the command through the TES field in the Global Status register. Unfortunately, some integrated graphic devices fail to do so after some kind of power state transition. As the result, the system might stuck in iommu_disable_translati on(), waiting for the completion of TE transition. This adds RPLS to a quirk list for those devices and skips TE disabling if the qurik hits. Link: https://gitlab.freedesktop.org/drm/intel/-/issues/4898 Tested-by: Raviteja Goud Talla Cc: Rodrigo Vivi Acked-by: Lu Baolu Signed-off-by: Tejas Upadhyay Reviewed-by: Rodrigo Vivi Signed-off-by: Rodrigo Vivi Link: https://patchwork.freedesktop.org/patch/msgid/20220302043256.191529-1= -tejaskumarx.surendrakumar.upadhyay@intel.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/iommu/intel/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 0ea47e17b379..ba9a63cac47c 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -5031,7 +5031,7 @@ static void quirk_igfx_skip_te_disable(struct pci_dev= *dev) ver =3D (dev->device >> 8) & 0xff; if (ver !=3D 0x45 && ver !=3D 0x46 && ver !=3D 0x4c && ver !=3D 0x4e && ver !=3D 0x8a && ver !=3D 0x98 && - ver !=3D 0x9a) + ver !=3D 0x9a && ver !=3D 0xa7) return; =20 if (risky_device(dev)) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F683C43334 for ; Tue, 7 Jun 2022 21:58:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382301AbiFGV62 (ORCPT ); Tue, 7 Jun 2022 17:58:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350136AbiFGVC3 (ORCPT ); Tue, 7 Jun 2022 17:02:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4B11110AF0; Tue, 7 Jun 2022 11:48: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 10B3161295; Tue, 7 Jun 2022 18:48:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A86EC385A2; Tue, 7 Jun 2022 18:48:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627685; bh=m8OgePpjLaw3vqTYFrtd4bJ7YgU/xYB3M8CWzOMVcdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e/oWGqFhgz6Sls5I8jP4TnsSnUYARZxCcVh9vKx0f8v7LDsJhZ+eMhdmwwguqmfVL lo5Jnt9GWDyqdVJA/uRaWao9YB80zVoIaFASy30/U76054tMMYtswuuMRDIMUMcnpW iz84ZuL7G6OTsLmaxfKK7fYPoCUSf/f0wg41tnOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arunpravin , kernel test robot , =?UTF-8?q?Christian=20K=C3=B6nig?= , Sasha Levin Subject: [PATCH 5.18 055/879] drm/selftests: fix a shift-out-of-bounds bug Date: Tue, 7 Jun 2022 18:52:53 +0200 Message-Id: <20220607165004.286931280@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arunpravin [ Upstream commit fc3785fb56a27304c769af730d079f4337d4dc76 ] pass the correct size value computed using the max_order. [ 68.124177][ T1] UBSAN: shift-out-of-bounds in include/linux/log2.h:67:13 [ 68.125333][ T1] shift exponent 4294967295 is too large for 32-bit type 'l= ong unsigned int' [ 68.126563][ T1] CPU: 0 PID: 1 Comm: swapper Not tainted 5.17.0-rc2-00311-g39ec47bbfd5d #2 [ 68.127758][ T1] Call Trace: [ 68.128187][ T1] dump_stack_lvl (lib/dump_stack.c:108) [ 68.128793][ T1] dump_stack (lib/dump_stack.c:114) [ 68.129331][ T1] ubsan_epilogue (lib/ubsan.c:152) [ 68.129958][ T1] __ubsan_handle_shift_out_of_bounds.cold (arch/x86/include= /asm/smap.h:85) [ 68.130791][ T1] ? drm_block_alloc+0x28/0x80 [ 68.131582][ T1] ? rcu_read_lock_sched_held (kernel/rcu/update.c:125) [ 68.132215][ T1] ? kmem_cache_alloc (include/trace/events/kmem.h:54 mm/sla= b.c:3501) [ 68.132878][ T1] ? mark_free+0x2e/0x80 [ 68.133524][ T1] drm_buddy_init.cold (include/linux/log2.h:67 drivers/gpu/drm/drm_buddy.c:131) [ 68.134145][ T1] ? test_drm_cmdline_init (drivers/gpu/drm/selftests/test-d= rm_buddy.c:87) [ 68.134770][ T1] igt_buddy_alloc_limit (drivers/gpu/drm/selftests/test-drm= _buddy.c:30) [ 68.135472][ T1] ? vprintk_default (kernel/printk/printk.c:2257) [ 68.136057][ T1] ? test_drm_cmdline_init (drivers/gpu/drm/selftests/test-d= rm_buddy.c:87) [ 68.136812][ T1] test_drm_buddy_init (drivers/gpu/drm/selftests/drm_selfte= st.c:77 drivers/gpu/drm/selftests/test-drm_buddy.c:95) [ 68.137475][ T1] do_one_initcall (init/main.c:1300) [ 68.138111][ T1] ? parse_args (kernel/params.c:609 kernel/params.c:146 kernel/params.c:188) [ 68.138717][ T1] do_basic_setup (init/main.c:1372 init/main.c:1389 init/ma= in.c:1408) [ 68.139366][ T1] kernel_init_freeable (init/main.c:1617) [ 68.140040][ T1] ? rest_init (init/main.c:1494) [ 68.140634][ T1] kernel_init (init/main.c:1504) [ 68.141155][ T1] ret_from_fork (arch/x86/entry/entry_32.S:772) [ 68.141607][ T1] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D [ 68.146730][ T1] ------------[ cut here ]------------ [ 68.147460][ T1] kernel BUG at drivers/gpu/drm/drm_buddy.c:140! [ 68.148280][ T1] invalid opcode: 0000 [#1] [ 68.148895][ T1] CPU: 0 PID: 1 Comm: swapper Not tainted 5.17.0-rc2-00311-g39ec47bbfd5d #2 [ 68.149896][ T1] EIP: drm_buddy_init (drivers/gpu/drm/drm_buddy.c:140 (dis= criminator 1)) For more details: https://lists.01.org/hyperkitty/list/lkp@lists.01.org/thr= ead/FDIF3HCILZNN5UQAZMOR7E3MQSMHHKWU/ Signed-off-by: Arunpravin Reported-by: kernel test robot Acked-by: Christian K=C3=B6nig Link: https://patchwork.freedesktop.org/patch/msgid/20220303201602.2365-1-A= runpravin.PaneerSelvam@amd.com Signed-off-by: Christian K=C3=B6nig Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/selftests/test-drm_buddy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/selftests/test-drm_buddy.c b/drivers/gpu/drm/s= elftests/test-drm_buddy.c index fa997f89522b..913cbd7eae04 100644 --- a/drivers/gpu/drm/selftests/test-drm_buddy.c +++ b/drivers/gpu/drm/selftests/test-drm_buddy.c @@ -902,14 +902,13 @@ static int igt_buddy_alloc_range(void *arg) =20 static int igt_buddy_alloc_limit(void *arg) { - u64 end, size =3D U64_MAX, start =3D 0; + u64 size =3D U64_MAX, start =3D 0; struct drm_buddy_block *block; unsigned long flags =3D 0; LIST_HEAD(allocated); struct drm_buddy mm; int err; =20 - size =3D end =3D round_down(size, 4096); err =3D drm_buddy_init(&mm, size, PAGE_SIZE); if (err) return err; @@ -921,7 +920,8 @@ static int igt_buddy_alloc_limit(void *arg) goto out_fini; } =20 - err =3D drm_buddy_alloc_blocks(&mm, start, end, size, + size =3D mm.chunk_size << mm.max_order; + err =3D drm_buddy_alloc_blocks(&mm, start, size, size, PAGE_SIZE, &allocated, flags); =20 if (unlikely(err)) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4706C433EF for ; Tue, 7 Jun 2022 21:58:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353484AbiFGV6d (ORCPT ); Tue, 7 Jun 2022 17:58:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379454AbiFGVC3 (ORCPT ); Tue, 7 Jun 2022 17:02:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EC201208A7; Tue, 7 Jun 2022 11:48:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D3911616AF; Tue, 7 Jun 2022 18:48:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFED0C385A2; Tue, 7 Jun 2022 18:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627688; bh=s3qNkoIYVWMpejiHT67UNIh/odgE/06E//y1wED6l1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RdkD928l9xjJw6ej7ZJuLIKEOPOPQNeEytjRTnaalqblOchgJSW1cEoMQ+QMSfP4W iTK3VhBq496WlFjEQnX+GiiLaZNIzKmz4We1hz/MBX1LEaxZjuWgB/SRWjPu33yu/B J1GyCjV/W1Yg7F6oilHehdNGwJtJGH+lkDgA9zZ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zack Rusin , Martin Krastev , Sasha Levin Subject: [PATCH 5.18 056/879] drm/vmwgfx: validate the screen formats Date: Tue, 7 Jun 2022 18:52:54 +0200 Message-Id: <20220607165004.316743392@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zack Rusin [ Upstream commit 8bb75aeb58bd688d70827ae179bd3da57b6d975b ] The kms code wasn't validating the modifiers and was letting through unsupported formats. rgb8 was never properly supported and has no matching svga screen target format so remove it. This fixes format/modifier failures in kms_addfb_basic from IGT. Signed-off-by: Zack Rusin Reviewed-by: Martin Krastev Link: https://patchwork.freedesktop.org/patch/msgid/20220318174332.440068-4= -zack@kde.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 30 +++++++++++++++-------------- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 1 - 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/v= mwgfx_kms.c index 93431e8f6606..9410152f9d6f 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -914,6 +914,15 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_= private *dev_priv, * Sanity checks. */ =20 + if (!drm_any_plane_has_format(&dev_priv->drm, + mode_cmd->pixel_format, + mode_cmd->modifier[0])) { + drm_dbg(&dev_priv->drm, + "unsupported pixel format %p4cc / modifier 0x%llx\n", + &mode_cmd->pixel_format, mode_cmd->modifier[0]); + return -EINVAL; + } + /* Surface must be marked as a scanout. */ if (unlikely(!surface->metadata.scanout)) return -EINVAL; @@ -1236,20 +1245,13 @@ static int vmw_kms_new_framebuffer_bo(struct vmw_pr= ivate *dev_priv, return -EINVAL; } =20 - /* Limited framebuffer color depth support for screen objects */ - if (dev_priv->active_display_unit =3D=3D vmw_du_screen_object) { - switch (mode_cmd->pixel_format) { - case DRM_FORMAT_XRGB8888: - case DRM_FORMAT_ARGB8888: - break; - case DRM_FORMAT_XRGB1555: - case DRM_FORMAT_RGB565: - break; - default: - DRM_ERROR("Invalid pixel format: %p4cc\n", - &mode_cmd->pixel_format); - return -EINVAL; - } + if (!drm_any_plane_has_format(&dev_priv->drm, + mode_cmd->pixel_format, + mode_cmd->modifier[0])) { + drm_dbg(&dev_priv->drm, + "unsupported pixel format %p4cc / modifier 0x%llx\n", + &mode_cmd->pixel_format, mode_cmd->modifier[0]); + return -EINVAL; } =20 vfbd =3D kzalloc(sizeof(*vfbd), GFP_KERNEL); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/v= mwgfx_kms.h index 4d36e8507380..d9ebd02099a6 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h @@ -247,7 +247,6 @@ struct vmw_framebuffer_bo { static const uint32_t __maybe_unused vmw_primary_plane_formats[] =3D { DRM_FORMAT_XRGB1555, DRM_FORMAT_RGB565, - DRM_FORMAT_RGB888, DRM_FORMAT_XRGB8888, DRM_FORMAT_ARGB8888, }; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77AEDC43334 for ; Tue, 7 Jun 2022 22:04:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382959AbiFGWEv (ORCPT ); Tue, 7 Jun 2022 18:04:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357011AbiFGVCc (ORCPT ); Tue, 7 Jun 2022 17:02: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 A3D48122B5E; Tue, 7 Jun 2022 11:48: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 B394661295; Tue, 7 Jun 2022 18:48:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B89B9C34115; Tue, 7 Jun 2022 18:48:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627691; bh=bGvWXSsVYE8QDR2oEurh5TCb6bubWjqxrbK4wgMkhpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tz4D3Hcgq38do1TTZ4LQ3aTjcO2QxLjNNQsSVuLFd4TLxoGvWdFb2KAGC2exPp+El uPhHf+fPYCW+BvDTWZhQ/bsobl1c0QU0Po8YI3+RTxUZzoHplpjE0ivU2VXhPCGM8l ah/J64mieIfWI4BIImBvMgch8cWDRX9ZKna2oR4g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gong , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 057/879] ath11k: fix the warning of dev_wake in mhi_pm_disable_transition() Date: Tue, 7 Jun 2022 18:52:55 +0200 Message-Id: <20220607165004.345715791@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wen Gong [ Upstream commit 0d7a8a6204ea9271f1d0a8c66a9fd2f54d2e3cbc ] When test device recovery with below command, it has warning in message as below. echo assert > /sys/kernel/debug/ath11k/wcn6855\ hw2.0/simulate_fw_crash echo assert > /sys/kernel/debug/ath11k/qca6390\ hw2.0/simulate_fw_crash warning message: [ 1965.642121] ath11k_pci 0000:06:00.0: simulating firmware assert crash [ 1968.471364] ieee80211 phy0: Hardware restart was requested [ 1968.511305] ------------[ cut here ]------------ [ 1968.511368] WARNING: CPU: 3 PID: 1546 at drivers/bus/mhi/core/pm.c:505 m= hi_pm_disable_transition+0xb37/0xda0 [mhi] [ 1968.511443] Modules linked in: ath11k_pci ath11k mac80211 libarc4 cfg802= 11 qmi_helpers qrtr_mhi mhi qrtr nvme nvme_core [ 1968.511563] CPU: 3 PID: 1546 Comm: kworker/u17:0 Kdump: loaded Tainted: = G W 5.17.0-rc3-wt-ath+ #579 [ 1968.511629] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, = BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021 [ 1968.511704] Workqueue: mhi_hiprio_wq mhi_pm_st_worker [mhi] [ 1968.511787] RIP: 0010:mhi_pm_disable_transition+0xb37/0xda0 [mhi] [ 1968.511870] Code: a9 fe ff ff 4c 89 ff 44 89 04 24 e8 03 46 f6 e5 44 8b = 04 24 41 83 f8 01 0f 84 21 fe ff ff e9 4c fd ff ff 0f 0b e9 af f8 ff ff <0f= > 0b e9 5c f8 ff ff 48 89 df e8 da 9e ee e3 e9 12 fd ff ff 4c 89 [ 1968.511923] RSP: 0018:ffffc900024efbf0 EFLAGS: 00010286 [ 1968.511969] RAX: 00000000ffffffff RBX: ffff88811d241250 RCX: ffffffffc01= 76922 [ 1968.512014] RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffff888118a= 90a24 [ 1968.512059] RBP: ffff888118a90800 R08: 0000000000000000 R09: ffff888118a= 90a27 [ 1968.512102] R10: ffffed1023152144 R11: 0000000000000001 R12: ffff888118a= 908ac [ 1968.512229] R13: ffff888118a90928 R14: dffffc0000000000 R15: ffff888118a= 90a24 [ 1968.512310] FS: 0000000000000000(0000) GS:ffff888234200000(0000) knlGS:= 0000000000000000 [ 1968.512405] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1968.512493] CR2: 00007f5538f443a8 CR3: 000000016dc28001 CR4: 00000000003= 706e0 [ 1968.512587] Call Trace: [ 1968.512672] [ 1968.512751] ? _raw_spin_unlock_irq+0x1f/0x40 [ 1968.512859] mhi_pm_st_worker+0x3ac/0x790 [mhi] [ 1968.512959] ? mhi_pm_mission_mode_transition.isra.0+0x7d0/0x7d0 [mhi] [ 1968.513063] process_one_work+0x86a/0x1400 [ 1968.513184] ? pwq_dec_nr_in_flight+0x230/0x230 [ 1968.513312] ? move_linked_works+0x125/0x290 [ 1968.513416] worker_thread+0x6db/0xf60 [ 1968.513536] ? process_one_work+0x1400/0x1400 [ 1968.513627] kthread+0x241/0x2d0 [ 1968.513733] ? kthread_complete_and_exit+0x20/0x20 [ 1968.513821] ret_from_fork+0x22/0x30 [ 1968.513924] Reason is mhi_deassert_dev_wake() from mhi_device_put() is called but mhi_assert_dev_wake() from __mhi_device_get_sync() is not called in progress of recovery. Commit 8e0559921f9a ("bus: mhi: core: Skip device wake in error or shutdown state") add check for the pm_state of mhi in __mhi_device_get_sync(), and the pm_state is not the normal state untill recovery is completed, so it leads the dev_wake is not 0 and above warning print in mhi_pm_disable_transition() while checking mhi_cntrl->dev_wake. Add check in ath11k_pci_write32()/ath11k_pci_read32() to skip call mhi_device_put() if mhi_device_get_sync() does not really do wake, then the warning gone. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_L= ITE-2 Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220228064606.8981-5-quic_wgong@quicinc.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/pci.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/a= th/ath11k/pci.c index 903758751c99..8a3ff12057e8 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -191,6 +191,7 @@ void ath11k_pci_write32(struct ath11k_base *ab, u32 off= set, u32 value) { struct ath11k_pci *ab_pci =3D ath11k_pci_priv(ab); u32 window_start; + int ret =3D 0; =20 /* for offset beyond BAR + 4K - 32, may * need to wakeup MHI to access. @@ -198,7 +199,7 @@ void ath11k_pci_write32(struct ath11k_base *ab, u32 off= set, u32 value) if (ab->hw_params.wakeup_mhi && test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && offset >=3D ACCESS_ALWAYS_OFF) - mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); + ret =3D mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); =20 if (offset < WINDOW_START) { iowrite32(value, ab->mem + offset); @@ -222,7 +223,8 @@ void ath11k_pci_write32(struct ath11k_base *ab, u32 off= set, u32 value) =20 if (ab->hw_params.wakeup_mhi && test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && - offset >=3D ACCESS_ALWAYS_OFF) + offset >=3D ACCESS_ALWAYS_OFF && + !ret) mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); } =20 @@ -230,6 +232,7 @@ u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offse= t) { struct ath11k_pci *ab_pci =3D ath11k_pci_priv(ab); u32 val, window_start; + int ret =3D 0; =20 /* for offset beyond BAR + 4K - 32, may * need to wakeup MHI to access. @@ -237,7 +240,7 @@ u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offse= t) if (ab->hw_params.wakeup_mhi && test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && offset >=3D ACCESS_ALWAYS_OFF) - mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); + ret =3D mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); =20 if (offset < WINDOW_START) { val =3D ioread32(ab->mem + offset); @@ -261,7 +264,8 @@ u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offse= t) =20 if (ab->hw_params.wakeup_mhi && test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && - offset >=3D ACCESS_ALWAYS_OFF) + offset >=3D ACCESS_ALWAYS_OFF && + !ret) mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); =20 return val; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09853CCA47C for ; Tue, 7 Jun 2022 21:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382620AbiFGV7U (ORCPT ); Tue, 7 Jun 2022 17:59:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357786AbiFGVCd (ORCPT ); Tue, 7 Jun 2022 17:02:33 -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 1CD5F1238A2; Tue, 7 Jun 2022 11:48: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 0347EB82018; Tue, 7 Jun 2022 18:48:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71DA8C385A2; Tue, 7 Jun 2022 18:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627693; bh=9KHMSISyzzpbZ2PU0Ypgnuo/zuKW0vT9ok+Fw3ha3Ag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nkFmSwneWX05xWv4RqMWHKEmLJHWzRQx9/tx7g2pMoZaEeJ8BDIir7cYAVdJibbcA AlnvS9w5IJqgeuLe61wkWu0ubL8hmO+jpXuALwuJtNLohqwjJ/YCani9u1aTvntUeT i/ypSy3r+PfOq3mNKz5/uLeuru8YWfqiDmc0YwtY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Zixian , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.18 058/879] drm/virtio: fix NULL pointer dereference in virtio_gpu_conn_get_modes Date: Tue, 7 Jun 2022 18:52:56 +0200 Message-Id: <20220607165004.374934917@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liu Zixian [ Upstream commit 194d250cdc4a40ccbd179afd522a9e9846957402 ] drm_cvt_mode may return NULL and we should check it. This bug is found by syzkaller: FAULT_INJECTION stacktrace: [ 168.567394] FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 1 [ 168.567403] CPU: 1 PID: 6425 Comm: syz Kdump: loaded Not tainted 4.19.90= -vhulk2201.1.0.h1035.kasan.eulerosv2r10.aarch64 #1 [ 168.567406] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/20= 15 [ 168.567408] Call trace: [ 168.567414] dump_backtrace+0x0/0x310 [ 168.567418] show_stack+0x28/0x38 [ 168.567423] dump_stack+0xec/0x15c [ 168.567427] should_fail+0x3ac/0x3d0 [ 168.567437] __should_failslab+0xb8/0x120 [ 168.567441] should_failslab+0x28/0xc0 [ 168.567445] kmem_cache_alloc_trace+0x50/0x640 [ 168.567454] drm_mode_create+0x40/0x90 [ 168.567458] drm_cvt_mode+0x48/0xc78 [ 168.567477] virtio_gpu_conn_get_modes+0xa8/0x140 [virtio_gpu] [ 168.567485] drm_helper_probe_single_connector_modes+0x3a4/0xd80 [ 168.567492] drm_mode_getconnector+0x2e0/0xa70 [ 168.567496] drm_ioctl_kernel+0x11c/0x1d8 [ 168.567514] drm_ioctl+0x558/0x6d0 [ 168.567522] do_vfs_ioctl+0x160/0xf30 [ 168.567525] ksys_ioctl+0x98/0xd8 [ 168.567530] __arm64_sys_ioctl+0x50/0xc8 [ 168.567536] el0_svc_common+0xc8/0x320 [ 168.567540] el0_svc_handler+0xf8/0x160 [ 168.567544] el0_svc+0x10/0x218 KASAN stacktrace: [ 168.567561] BUG: KASAN: null-ptr-deref in virtio_gpu_conn_get_modes+0xb4= /0x140 [virtio_gpu] [ 168.567565] Read of size 4 at addr 0000000000000054 by task syz/6425 [ 168.567566] [ 168.567571] CPU: 1 PID: 6425 Comm: syz Kdump: loaded Not tainted 4.19.90= -vhulk2201.1.0.h1035.kasan.eulerosv2r10.aarch64 #1 [ 168.567573] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/20= 15 [ 168.567575] Call trace: [ 168.567578] dump_backtrace+0x0/0x310 [ 168.567582] show_stack+0x28/0x38 [ 168.567586] dump_stack+0xec/0x15c [ 168.567591] kasan_report+0x244/0x2f0 [ 168.567594] __asan_load4+0x58/0xb0 [ 168.567607] virtio_gpu_conn_get_modes+0xb4/0x140 [virtio_gpu] [ 168.567612] drm_helper_probe_single_connector_modes+0x3a4/0xd80 [ 168.567617] drm_mode_getconnector+0x2e0/0xa70 [ 168.567621] drm_ioctl_kernel+0x11c/0x1d8 [ 168.567624] drm_ioctl+0x558/0x6d0 [ 168.567628] do_vfs_ioctl+0x160/0xf30 [ 168.567632] ksys_ioctl+0x98/0xd8 [ 168.567636] __arm64_sys_ioctl+0x50/0xc8 [ 168.567641] el0_svc_common+0xc8/0x320 [ 168.567645] el0_svc_handler+0xf8/0x160 [ 168.567649] el0_svc+0x10/0x218 Signed-off-by: Liu Zixian Link: http://patchwork.freedesktop.org/patch/msgid/20220322091730.1653-1-li= uzixian4@huawei.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/virtio/virtgpu_display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/vir= tio/virtgpu_display.c index 5b00310ac4cd..f73352e7b832 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -179,6 +179,8 @@ static int virtio_gpu_conn_get_modes(struct drm_connect= or *connector) DRM_DEBUG("add mode: %dx%d\n", width, height); mode =3D drm_cvt_mode(connector->dev, width, height, 60, false, false, false); + if (!mode) + return count; mode->type |=3D DRM_MODE_TYPE_PREFERRED; drm_mode_probed_add(connector, mode); count++; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D22AC433EF for ; Tue, 7 Jun 2022 21:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382626AbiFGV71 (ORCPT ); Tue, 7 Jun 2022 17:59:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358000AbiFGVCd (ORCPT ); Tue, 7 Jun 2022 17:02:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC0661257A7; Tue, 7 Jun 2022 11:48:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1F563B81FE1; Tue, 7 Jun 2022 18:48:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30BABC385A5; Tue, 7 Jun 2022 18:48:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627696; bh=EI6kyMEv2r+oMfMB12oZQKomnwfH3xTNuKb7+f/Swr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ekONIaXuFNaElP+cfhCHcEhQKgSdPzFJ3mVCA5Qef9mfOL3dHhId+Xf6j1yIzd+Qr HE8msErNZS7DH1RyPXTbquxQJCVc0XPQNCnV1ARolW2I5kXzl4/09N1NHOZ7bWsI83 gKrZG+ljHmcnnA5+rCk9rFILwEafIyufsQ64M/YU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.18 059/879] selftests/bpf: Fix vfs_link kprobe definition Date: Tue, 7 Jun 2022 18:52:57 +0200 Message-Id: <20220607165004.404373852@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nikolay Borisov [ Upstream commit e299bcd4d16ff86f46c48df1062c8aae0eca1ed8 ] Since commit 6521f8917082 ("namei: prepare for idmapped mounts") vfs_link's prototype was changed, the kprobe definition in profiler selftest in turn wasn't updated. The result is that all argument after the first are now stored in different registers. This means that self-test has been broken ever since. Fix it by updating the kprobe definition accordingly. Signed-off-by: Nikolay Borisov Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220331140949.1410056-1-nborisov@suse.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/bpf/progs/profiler.inc.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h b/tools/testi= ng/selftests/bpf/progs/profiler.inc.h index 4896fdf816f7..92331053dba3 100644 --- a/tools/testing/selftests/bpf/progs/profiler.inc.h +++ b/tools/testing/selftests/bpf/progs/profiler.inc.h @@ -826,8 +826,9 @@ int kprobe_ret__do_filp_open(struct pt_regs* ctx) =20 SEC("kprobe/vfs_link") int BPF_KPROBE(kprobe__vfs_link, - struct dentry* old_dentry, struct inode* dir, - struct dentry* new_dentry, struct inode** delegated_inode) + struct dentry* old_dentry, struct user_namespace *mnt_userns, + struct inode* dir, struct dentry* new_dentry, + struct inode** delegated_inode) { struct bpf_func_stats_ctx stats_ctx; bpf_stats_enter(&stats_ctx, profiler_bpf_vfs_link); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2880C433EF for ; Tue, 7 Jun 2022 22:02:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383156AbiFGWBV (ORCPT ); Tue, 7 Jun 2022 18:01:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377539AbiFGVCp (ORCPT ); Tue, 7 Jun 2022 17:02:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 150AD13392E; Tue, 7 Jun 2022 11:48:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 580F9B82018; Tue, 7 Jun 2022 18:48:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1619C385A2; Tue, 7 Jun 2022 18:48:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627702; bh=eoTntXkJva1hHSA1bjTzO8FjSkV4RFJ+pjuoRT5FL7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C2RINI0h0VbUpDCnV9JiNzDin/N0XwDPMNpPHUlM0wwUQoFbJneafBBPbjGYVbLBD G8tzaqNlcMhhLeoo9jq0YtJ5t0QeO6BNCuOboDerCrT8Xu/xgvtaEFkfE71Wu5ozuI g4/SNGlImyt/uWVAIgsfgxcShoiuFFlbSM3SxH88= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Monnet , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.18 060/879] selftests/bpf: Fix parsing of prog types in UAPI hdr for bpftool sync Date: Tue, 7 Jun 2022 18:52:58 +0200 Message-Id: <20220607165004.432627806@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quentin Monnet [ Upstream commit 4eeebce6ac4ad80ee8243bb847c98e0e55848d47 ] The script for checking that various lists of types in bpftool remain in sync with the UAPI BPF header uses a regex to parse enum bpf_prog_type. If this enum contains a set of values different from the list of program types in bpftool, it complains. This script should have reported the addition, some time ago, of the new BPF_PROG_TYPE_SYSCALL, which was not reported to bpftool's program types list. It failed to do so, because it failed to parse that new type from the enum. This is because the new value, in the BPF header, has an explicative comment on the same line, and the regex does not support that. Let's update the script to support parsing enum values when they have comments on the same line. Signed-off-by: Quentin Monnet Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220404140944.64744-1-quentin@isovalent.= com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/bpf/test_bpftool_synctypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_bpftool_synctypes.py b/tools/= testing/selftests/bpf/test_bpftool_synctypes.py index 6bf21e47882a..c0e7acd698ed 100755 --- a/tools/testing/selftests/bpf/test_bpftool_synctypes.py +++ b/tools/testing/selftests/bpf/test_bpftool_synctypes.py @@ -180,7 +180,7 @@ class FileExtractor(object): @enum_name: name of the enum to parse """ start_marker =3D re.compile(f'enum {enum_name} {{\n') - pattern =3D re.compile('^\s*(BPF_\w+),?$') + pattern =3D re.compile('^\s*(BPF_\w+),?(\s+/\*.*\*/)?$') end_marker =3D re.compile('^};') parser =3D BlockParser(self.reader) parser.search_block(start_marker) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF027CCA482 for ; Tue, 7 Jun 2022 22:02:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383088AbiFGWBA (ORCPT ); Tue, 7 Jun 2022 18:01:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377589AbiFGVCs (ORCPT ); Tue, 7 Jun 2022 17:02:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CA0E5714E; Tue, 7 Jun 2022 11:48:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7222D6156D; Tue, 7 Jun 2022 18:48:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8199EC385A5; Tue, 7 Jun 2022 18:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627704; bh=2nJqjbrkEXx+zlta2BV0O1ePumXPRWHtyr5AtREfBTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oQOZtwgOR4XjkqTIKB5+AaZVsJOoxJABhVmmnT+01ML6lg23ee5x/b8AsMQAQNOpv V6ioNvKeWAxXMXXguXKPAhCAFtpfi7a1t4dGBKSRiax9qhydc8aCxKXfAfg4zVMkUi 69RQpY02mOXgB2IAfgEbG0c6ewWPFioe4yNNQ3SM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Karthikeyan Kathirvel , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 061/879] ath11k: Change max no of active probe SSID and BSSID to fw capability Date: Tue, 7 Jun 2022 18:52:59 +0200 Message-Id: <20220607165004.463095644@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Karthikeyan Kathirvel [ Upstream commit 50dc9ce9f80554a88e33b73c30851acf2be36ed3 ] The maximum number of SSIDs in a for active probe requests is currently reported as 16 (WLAN_SCAN_PARAMS_MAX_SSID) when registering the driver. The scan_req_params structure only has the capacity to hold 10 SSIDs. This leads to a buffer overflow which can be triggered from wpa_supplicant in userspace. When copying the SSIDs into the scan_req_params structure in the ath11k_mac_op_hw_scan route, it can overwrite the extraie pointer. Firmware supports 16 ssid * 4 bssid, for each ssid 4 bssid combo probe request will be sent, so totally 64 probe requests supported. So set both max ssid and bssid to 16 and 4 respectively. Remove the redundant macros of ssid and bssid. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01300-QCAHKSWPL_SILICONZ-1 Signed-off-by: Karthikeyan Kathirvel Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220329150221.21907-1-quic_kathirve@quicin= c.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/wmi.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/a= th/ath11k/wmi.h index 587f42307250..b5b72483477d 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -3088,9 +3088,6 @@ enum scan_dwelltime_adaptive_mode { SCAN_DWELL_MODE_STATIC =3D 4 }; =20 -#define WLAN_SCAN_MAX_NUM_SSID 10 -#define WLAN_SCAN_MAX_NUM_BSSID 10 - #define WLAN_SSID_MAX_LEN 32 =20 struct element_info { @@ -3105,7 +3102,6 @@ struct wlan_ssid { =20 #define WMI_IE_BITMAP_SIZE 8 =20 -#define WMI_SCAN_MAX_NUM_SSID 0x0A /* prefix used by scan requestor ids on the host */ #define WMI_HOST_SCAN_REQUESTOR_ID_PREFIX 0xA000 =20 @@ -3113,10 +3109,6 @@ struct wlan_ssid { /* host cycles through the lower 12 bits to generate ids */ #define WMI_HOST_SCAN_REQ_ID_PREFIX 0xA000 =20 -#define WLAN_SCAN_PARAMS_MAX_SSID 16 -#define WLAN_SCAN_PARAMS_MAX_BSSID 4 -#define WLAN_SCAN_PARAMS_MAX_IE_LEN 256 - /* Values lower than this may be refused by some firmware revisions with a= scan * completion with a timedout reason. */ @@ -3312,8 +3304,8 @@ struct scan_req_params { u32 n_probes; u32 *chan_list; u32 notify_scan_events; - struct wlan_ssid ssid[WLAN_SCAN_MAX_NUM_SSID]; - struct wmi_mac_addr bssid_list[WLAN_SCAN_MAX_NUM_BSSID]; + struct wlan_ssid ssid[WLAN_SCAN_PARAMS_MAX_SSID]; + struct wmi_mac_addr bssid_list[WLAN_SCAN_PARAMS_MAX_BSSID]; struct element_info extraie; struct element_info htcap; struct element_info vhtcap; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7839CCA485 for ; Tue, 7 Jun 2022 22:02:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383131AbiFGWBP (ORCPT ); Tue, 7 Jun 2022 18:01:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378457AbiFGVDL (ORCPT ); Tue, 7 Jun 2022 17:03:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A469313A2D9; Tue, 7 Jun 2022 11:48: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 0A889B8220B; Tue, 7 Jun 2022 18:48:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58F68C385A5; Tue, 7 Jun 2022 18:48:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627707; bh=7R34usxBQu7eJg2cIGwm/1IcqRrI7YppV2uXmYDwZpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lnh5h3wsRZOkJbJHT/EtFV239ViG9pvAI6CHZB+sBTwZDHKODWGDNhO/DtPo/ZLoG sMc50ov3eF3R0IKyHfUIV+baAgbFOhlYogSfL9y0Wz8qZ+et91AsItjQDiuQJyxVTx VWdZQ+gSKZdNzlyqO0elbRaMsAdVrrC/XksPwWH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yuntao Wang , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.18 062/879] selftests/bpf: Fix file descriptor leak in load_kallsyms() Date: Tue, 7 Jun 2022 18:53:00 +0200 Message-Id: <20220607165004.492035042@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yuntao Wang [ Upstream commit 2d0df01974ce2b59b6f7d5bd3ea58d74f12ddf85 ] Currently, if sym_cnt > 0, it just returns and does not close file, fix it. Signed-off-by: Yuntao Wang Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220405145711.49543-1-ytcoode@gmail.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/bpf/trace_helpers.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/se= lftests/bpf/trace_helpers.c index 3d6217e3aff7..9c4be2cdb21a 100644 --- a/tools/testing/selftests/bpf/trace_helpers.c +++ b/tools/testing/selftests/bpf/trace_helpers.c @@ -25,15 +25,12 @@ static int ksym_cmp(const void *p1, const void *p2) =20 int load_kallsyms(void) { - FILE *f =3D fopen("/proc/kallsyms", "r"); + FILE *f; char func[256], buf[256]; char symbol; void *addr; int i =3D 0; =20 - if (!f) - return -ENOENT; - /* * This is called/used from multiplace places, * load symbols just once. @@ -41,6 +38,10 @@ int load_kallsyms(void) if (sym_cnt) return 0; =20 + f =3D fopen("/proc/kallsyms", "r"); + if (!f) + return -ENOENT; + while (fgets(buf, sizeof(buf), f)) { if (sscanf(buf, "%p %c %s", &addr, &symbol, func) !=3D 3) break; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF69DCCA47C for ; Tue, 7 Jun 2022 22:02:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383111AbiFGWBF (ORCPT ); Tue, 7 Jun 2022 18:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378488AbiFGVDL (ORCPT ); Tue, 7 Jun 2022 17:03:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03403149166; Tue, 7 Jun 2022 11:48: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 9E605B8237F; Tue, 7 Jun 2022 18:48:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10508C385A5; Tue, 7 Jun 2022 18:48:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627710; bh=+WgOzsWRKetzAfOsz+S4/Q/45z6GGe4m0xrIXOZM+yA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uRdJP3w4L+GKVXLeV3shBa9B/bDihArXHwflUfAcSQPuP6wM8MdwwSIUOh3u6GKhs 1T723OL2vcvaBOlnv4Ofxs/ekliD94PaFfO2Y/a7B9Hm7bg4c0mITUERCV7HLAwqaL wcDCq2S2OsmACv+if2k1eLqZlKrg6Y6kJHnNncZA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zong-Zhe Yang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 063/879] rtw89: ser: fix CAM leaks occurring in L2 reset Date: Tue, 7 Jun 2022 18:53:01 +0200 Message-Id: <20220607165004.521491217@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zong-Zhe Yang [ Upstream commit b169f877f001a474fb89939842c390518160bcc5 ] The CAM, meaning address CAM and bssid CAM here, will get leaks during SER (system error recover) L2 reset process and ieee80211_restart_hw() which is called by L2 reset process eventually. The normal flow would be like -> add interface (acquire 1) -> enter ips (release 1) -> leave ips (acquire 1) -> connection (occupy 1) <(A) 1 leak after L2 reset if non-sec connection> The ieee80211_restart_hw() flow (under connection) -> ieee80211 reconfig -> add interface (acquire 1) -> leave ips (acquire 1) -> connection (occupy (A) + 2) <(B) 1 more leak> Originally, CAM is released before HW restart only if connection is under security. Now, release CAM whatever connection it is to fix leak in (A). OTOH, check if CAM is already valid to avoid acquiring multiple times to fix (B). Besides, if AP mode, release address CAM of all stations before HW restart. Signed-off-by: Zong-Zhe Yang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220314071250.40292-2-pkshih@realtek.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/realtek/rtw89/cam.c | 14 ++++++++++++-- drivers/net/wireless/realtek/rtw89/ser.c | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/cam.c b/drivers/net/wireles= s/realtek/rtw89/cam.c index 305dbbebff6b..26bef9fdd205 100644 --- a/drivers/net/wireless/realtek/rtw89/cam.c +++ b/drivers/net/wireless/realtek/rtw89/cam.c @@ -421,10 +421,8 @@ static void rtw89_cam_reset_key_iter(struct ieee80211_= hw *hw, void *data) { struct rtw89_dev *rtwdev =3D (struct rtw89_dev *)data; - struct rtw89_vif *rtwvif =3D (struct rtw89_vif *)vif->drv_priv; =20 rtw89_cam_sec_key_del(rtwdev, vif, sta, key, false); - rtw89_cam_deinit(rtwdev, rtwvif); } =20 void rtw89_cam_deinit_addr_cam(struct rtw89_dev *rtwdev, @@ -480,6 +478,12 @@ int rtw89_cam_init_addr_cam(struct rtw89_dev *rtwdev, int i; int ret; =20 + if (unlikely(addr_cam->valid)) { + rtw89_debug(rtwdev, RTW89_DBG_FW, + "addr cam is already valid; skip init\n"); + return 0; + } + ret =3D rtw89_cam_get_avail_addr_cam(rtwdev, &addr_cam_idx); if (ret) { rtw89_err(rtwdev, "failed to get available addr cam\n"); @@ -531,6 +535,12 @@ static int rtw89_cam_init_bssid_cam(struct rtw89_dev *= rtwdev, u8 bssid_cam_idx; int ret; =20 + if (unlikely(bssid_cam->valid)) { + rtw89_debug(rtwdev, RTW89_DBG_FW, + "bssid cam is already valid; skip init\n"); + return 0; + } + ret =3D rtw89_cam_get_avail_bssid_cam(rtwdev, &bssid_cam_idx); if (ret) { rtw89_err(rtwdev, "failed to get available bssid cam\n"); diff --git a/drivers/net/wireless/realtek/rtw89/ser.c b/drivers/net/wireles= s/realtek/rtw89/ser.c index 837cdc366a61..e86f3d89ef1b 100644 --- a/drivers/net/wireless/realtek/rtw89/ser.c +++ b/drivers/net/wireless/realtek/rtw89/ser.c @@ -220,11 +220,32 @@ static void ser_reset_vif(struct rtw89_dev *rtwdev, s= truct rtw89_vif *rtwvif) rtwvif->trigger =3D false; } =20 +static void ser_sta_deinit_addr_cam_iter(void *data, struct ieee80211_sta = *sta) +{ + struct rtw89_dev *rtwdev =3D (struct rtw89_dev *)data; + struct rtw89_sta *rtwsta =3D (struct rtw89_sta *)sta->drv_priv; + + rtw89_cam_deinit_addr_cam(rtwdev, &rtwsta->addr_cam); +} + +static void ser_deinit_cam(struct rtw89_dev *rtwdev, struct rtw89_vif *rtw= vif) +{ + if (rtwvif->net_type =3D=3D RTW89_NET_TYPE_AP_MODE) + ieee80211_iterate_stations_atomic(rtwdev->hw, + ser_sta_deinit_addr_cam_iter, + rtwdev); + + rtw89_cam_deinit(rtwdev, rtwvif); +} + static void ser_reset_mac_binding(struct rtw89_dev *rtwdev) { struct rtw89_vif *rtwvif; =20 rtw89_cam_reset_keys(rtwdev); + rtw89_for_each_rtwvif(rtwdev, rtwvif) + ser_deinit_cam(rtwdev, rtwvif); + rtw89_core_release_all_bits_map(rtwdev->mac_id_map, RTW89_MAX_MAC_ID_NUM); rtw89_for_each_rtwvif(rtwdev, rtwvif) ser_reset_vif(rtwdev, rtwvif); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EF6DCCA488 for ; Tue, 7 Jun 2022 22:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384313AbiFGWKw (ORCPT ); Tue, 7 Jun 2022 18:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378972AbiFGVIB (ORCPT ); Tue, 7 Jun 2022 17:08:01 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CC3B212C9C; Tue, 7 Jun 2022 11:50:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 2085FCE2425; Tue, 7 Jun 2022 18:50:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37872C385A2; Tue, 7 Jun 2022 18:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627846; bh=wB+eyMgg/Fjs26R7DtFWaZpsqYjiQcyeIh3vo3CFVwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T8dgnHJXG9BSyC23mVW6ynHmxacys7s9+dDL257xATTzF+XCCFs7IYU4aXC3wA6cj EXvdy85rNz7mqaGOrG58ZakHcq7UGPQDexKY8Gmh9UMsiioW40eBcQoCI+0pMxQ8vi sgUYgN4irtOa09X9IgZ1nUApUgD0Dvx2h2vOmJLc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Po Hao Huang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 064/879] rtw89: fix misconfiguration on hw_scan channel time Date: Tue, 7 Jun 2022 18:53:02 +0200 Message-Id: <20220607165004.550739513@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Po Hao Huang [ Upstream commit 65ee4971a262a024e239e5d2b7f4dee1b3dff40e ] Without this patch, hw scan won't stay long enough on DFS/passive channels. Found previous logic error and fix it. Signed-off-by: Po Hao Huang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220401055043.12512-5-pkshih@realtek.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/realtek/rtw89/fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless= /realtek/rtw89/fw.c index 6deaf8eec6b4..a9b5315a517e 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.c +++ b/drivers/net/wireless/realtek/rtw89/fw.c @@ -2065,7 +2065,7 @@ static void rtw89_hw_scan_add_chan(struct rtw89_dev *= rtwdev, int chan_type, ch_info->num_pkt =3D 0; break; case RTW89_CHAN_DFS: - ch_info->period =3D min_t(u8, ch_info->period, + ch_info->period =3D max_t(u8, ch_info->period, RTW89_DFS_CHAN_TIME); ch_info->dwell_time =3D RTW89_DWELL_TIME; break; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B962CCA47C for ; Tue, 7 Jun 2022 22:04:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379241AbiFGWEK (ORCPT ); Tue, 7 Jun 2022 18:04:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378622AbiFGVEM (ORCPT ); Tue, 7 Jun 2022 17:04:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 474FB18C05D; Tue, 7 Jun 2022 11:48:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 755746168E; Tue, 7 Jun 2022 18:48:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DF2EC385A5; Tue, 7 Jun 2022 18:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627729; bh=zLKqJ7YRx9+AQT3UXBkTEmxLVA2wtgkhaELDhD9VzXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=srM6ZS3jlJ0Dwzh9hWoMGJb/d6JQlGSvNLcXyE2m19JV7Cb5BsiAMzVmvVt/x4Kw+ gnUlaCuu3XY7IGe48caK4QIt32XzhRzkTcfzE2iqJ98H9EHhHi6n49VY21tgLeVN6A CmR2v1Q2WLNrA5oUo0rCz4Ujhry65kB2HcxC9eRo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Niels Dossche , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 065/879] mwifiex: add mutex lock for call in mwifiex_dfs_chan_sw_work_queue Date: Tue, 7 Jun 2022 18:53:03 +0200 Message-Id: <20220607165004.579924791@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Niels Dossche [ Upstream commit 3e12968f6d12a34b540c39cbd696a760cc4616f0 ] cfg80211_ch_switch_notify uses ASSERT_WDEV_LOCK to assert that net_device->ieee80211_ptr->mtx (which is the same as priv->wdev.mtx) is held during the function's execution. mwifiex_dfs_chan_sw_work_queue is one of its callers, which does not hold that lock, therefore violating the assertion. Add a lock around the call. Disclaimer: I am currently working on a static analyser to detect missing locks. This was a reported case. I manually verified the report by looking at the code, so that I do not send wrong information or patches. After concluding that this seems to be a true positive, I created this patch. However, as I do not in fact have this particular hardware, I was unable to test it. Reviewed-by: Brian Norris Signed-off-by: Niels Dossche Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220321225515.32113-1-dossche.niels@gmail.= com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/marvell/mwifiex/11h.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/11h.c b/drivers/net/wirel= ess/marvell/mwifiex/11h.c index d2ee6469e67b..3fa25cd64cda 100644 --- a/drivers/net/wireless/marvell/mwifiex/11h.c +++ b/drivers/net/wireless/marvell/mwifiex/11h.c @@ -303,5 +303,7 @@ void mwifiex_dfs_chan_sw_work_queue(struct work_struct = *work) =20 mwifiex_dbg(priv->adapter, MSG, "indicating channel switch completion to kernel\n"); + mutex_lock(&priv->wdev.mtx); cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef); + mutex_unlock(&priv->wdev.mtx); } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC6CECCA487 for ; Tue, 7 Jun 2022 22:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383609AbiFGWGA (ORCPT ); Tue, 7 Jun 2022 18:06:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379299AbiFGVFv (ORCPT ); Tue, 7 Jun 2022 17:05:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E66418DAEC; Tue, 7 Jun 2022 11:49:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 19185616C3; Tue, 7 Jun 2022 18:49:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F9DCC385A5; Tue, 7 Jun 2022 18:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627760; bh=nQbb+Dvg94Bd3lpBOt9d1emxz4LV6Rz434ipGpczzEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HBDS54y+/P/NdToJ5eWBUAOYp8wDE5yJ05Yw3c0IvsBiGyq8+tJCrV5dS2wv+/Rzr uyWp5ZKyHZi8rjDGdF0bV3mVK6kxZ9ipbY1xqqf0P+1s4OPBUZPpkvzedjtiKYP30e Fz/if3pIF7+OfNHB6Q41H4pVFfuqlYmPG6jDn6uY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haowen Bai , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 066/879] b43legacy: Fix assigning negative value to unsigned variable Date: Tue, 7 Jun 2022 18:53:04 +0200 Message-Id: <20220607165004.608582811@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haowen Bai [ Upstream commit 3f6b867559b3d43a7ce1b4799b755e812fc0d503 ] fix warning reported by smatch: drivers/net/wireless/broadcom/b43legacy/phy.c:1181 b43legacy_phy_lo_b_measu= re() warn: assigning (-772) to unsigned variable 'fval' Signed-off-by: Haowen Bai Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1648203433-8736-1-git-send-email-baihaowen@= meizu.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/broadcom/b43legacy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/b43legacy/phy.c b/drivers/net/wi= reless/broadcom/b43legacy/phy.c index 05404fbd1e70..c1395e622759 100644 --- a/drivers/net/wireless/broadcom/b43legacy/phy.c +++ b/drivers/net/wireless/broadcom/b43legacy/phy.c @@ -1123,7 +1123,7 @@ void b43legacy_phy_lo_b_measure(struct b43legacy_wlde= v *dev) struct b43legacy_phy *phy =3D &dev->phy; u16 regstack[12] =3D { 0 }; u16 mls; - u16 fval; + s16 fval; int i; int j; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A83FCCA490 for ; Tue, 7 Jun 2022 22:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383834AbiFGWGh (ORCPT ); Tue, 7 Jun 2022 18:06:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379656AbiFGVGL (ORCPT ); Tue, 7 Jun 2022 17:06:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8923420EEB9; Tue, 7 Jun 2022 11:50:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B0D9C6156D; Tue, 7 Jun 2022 18:49:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7EF1C385A5; Tue, 7 Jun 2022 18:49:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627791; bh=NCZ8ENLCATeP2GIJLaAP/xz+MzB5wHdRUTpcdOOL+I4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jgwOor5ZznYmNjZbJHwCJmCMCRx/jCeDvPyR2Z/59Q/6ZClXxdbQ0SjEvh59kCmv2 EEqTE1H9gjEQAn+cDZ1PriBK8RYvfFFOs1iOlEhBsgJovJ/uwkP+XphULku8/9l20h IXDNW3nERfNVGwcPMTgpSK8G4cXW75ByoC2Y39fU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haowen Bai , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 067/879] b43: Fix assigning negative value to unsigned variable Date: Tue, 7 Jun 2022 18:53:05 +0200 Message-Id: <20220607165004.636696475@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haowen Bai [ Upstream commit 11800d893b38e0e12d636c170c1abc19c43c730c ] fix warning reported by smatch: drivers/net/wireless/broadcom/b43/phy_n.c:585 b43_nphy_adjust_lna_gain_tabl= e() warn: assigning (-2) to unsigned variable '*(lna_gain[0])' Signed-off-by: Haowen Bai Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1648203315-28093-1-git-send-email-baihaowen= @meizu.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/broadcom/b43/phy_n.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/b43/phy_n.c b/drivers/net/wirele= ss/broadcom/b43/phy_n.c index cf3ccf4ddfe7..aa5c99465674 100644 --- a/drivers/net/wireless/broadcom/b43/phy_n.c +++ b/drivers/net/wireless/broadcom/b43/phy_n.c @@ -582,7 +582,7 @@ static void b43_nphy_adjust_lna_gain_table(struct b43_w= ldev *dev) u16 data[4]; s16 gain[2]; u16 minmax[2]; - static const u16 lna_gain[4] =3D { -2, 10, 19, 25 }; + static const s16 lna_gain[4] =3D { -2, 10, 19, 25 }; =20 if (nphy->hang_avoid) b43_nphy_stay_in_carrier_search(dev, 1); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DDFDC43334 for ; Tue, 7 Jun 2022 22:08:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383902AbiFGWIU (ORCPT ); Tue, 7 Jun 2022 18:08:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379915AbiFGVGg (ORCPT ); Tue, 7 Jun 2022 17:06:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB6842122BC; Tue, 7 Jun 2022 11:50:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E154EB81FE1; Tue, 7 Jun 2022 18:50:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AAAAC385A2; Tue, 7 Jun 2022 18:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627821; bh=gam7VJRU5tQrQ47mhnmERO7Bdx+TDXwHG5e3vtQwqLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f5L5RdUwRWmhPS89uRl14+v8OOU/2ia8UCONp81jln4Luys/+/qEA9zy3oHF7zJzE vLJSSXS3x9Mzp3oz1HOuuo0n7iTtnnOJt9cdvSnpQMvYRsfntj8pYo1uSAJk5OgFT2 GkUE5uQ2MTPJwApGxTgCFV11a7qGBgXDlEXWFNbQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haowen Bai , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 068/879] ipw2x00: Fix potential NULL dereference in libipw_xmit() Date: Tue, 7 Jun 2022 18:53:06 +0200 Message-Id: <20220607165004.666232980@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haowen Bai [ Upstream commit e8366bbabe1d207cf7c5b11ae50e223ae6fc278b ] crypt and crypt->ops could be null, so we need to checking null before dereference Signed-off-by: Haowen Bai Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1648797055-25730-1-git-send-email-baihaowen= @meizu.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/intel/ipw2x00/libipw_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_tx.c b/drivers/net/w= ireless/intel/ipw2x00/libipw_tx.c index 36d1e6b2568d..4aec1fce1ae2 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_tx.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_tx.c @@ -383,7 +383,7 @@ netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net= _device *dev) =20 /* Each fragment may need to have room for encryption * pre/postfix */ - if (host_encrypt) + if (host_encrypt && crypt && crypt->ops) bytes_per_frag -=3D crypt->ops->extra_mpdu_prefix_len + crypt->ops->extra_mpdu_postfix_len; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37E61CCA48D for ; Tue, 7 Jun 2022 22:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384139AbiFGWKV (ORCPT ); Tue, 7 Jun 2022 18:10:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379944AbiFGVGh (ORCPT ); Tue, 7 Jun 2022 17:06:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8F10212560; Tue, 7 Jun 2022 11:50:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5071961772; Tue, 7 Jun 2022 18:50:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B9B5C385A2; Tue, 7 Jun 2022 18:50:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627832; bh=xCNAFf0u7cNDjeIALTJWkSUBwi3rQPoajxPJWvRR0CU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MvYxvGmmDmJmKgyY8UfEJpj9UuKHFZ1fFA4QkpxrWCVQuDyl9N2COLtJh3/ee9WJM FEi65ZdyHMNFbKjbNZKsszR73pbvazvhNVW9IQbTgAaH3pHxF3UQewOZdYFrXp1PlF hVkpv0/r7qoK+nijLjN89Gre7rUhG2o3PgFPZOEo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , Niels Dossche , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 069/879] ipv6: fix locking issues with loops over idev->addr_list Date: Tue, 7 Jun 2022 18:53:07 +0200 Message-Id: <20220607165004.695610455@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Niels Dossche [ Upstream commit 51454ea42c1ab4e0c2828bb0d4d53957976980de ] idev->addr_list needs to be protected by idev->lock. However, it is not always possible to do so while iterating and performing actions on inet6_ifaddr instances. For example, multiple functions (like addrconf_{join,leave}_anycast) eventually call down to other functions that acquire the idev->lock. The current code temporarily unlocked the idev->lock during the loops, which can cause race conditions. Moving the locks up is also not an appropriate solution as the ordering of lock acquisition will be inconsistent with for example mc_lock. This solution adds an additional field to inet6_ifaddr that is used to temporarily add the instances to a temporary list while holding idev->lock. The temporary list can then be traversed without holding idev->lock. This change was done in two places. In addrconf_ifdown, the list_for_each_entry_safe variant of the list loop is also no longer necessary as there is no deletion within that specific loop. Suggested-by: Paolo Abeni Signed-off-by: Niels Dossche Acked-by: Paolo Abeni Link: https://lore.kernel.org/r/20220403231523.45843-1-dossche.niels@gmail.= com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/net/if_inet6.h | 8 ++++++++ net/ipv6/addrconf.c | 30 ++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index 4cfdef6ca4f6..c8490729b4ae 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h @@ -64,6 +64,14 @@ struct inet6_ifaddr { =20 struct hlist_node addr_lst; struct list_head if_list; + /* + * Used to safely traverse idev->addr_list in process context + * if the idev->lock needed to protect idev->addr_list cannot be held. + * In that case, add the items to this list temporarily and iterate + * without holding idev->lock. + * See addrconf_ifdown and dev_forward_change. + */ + struct list_head if_list_aux; =20 struct list_head tmp_list; struct inet6_ifaddr *ifpub; diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index b22504176588..1afc4c024981 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -797,6 +797,7 @@ static void dev_forward_change(struct inet6_dev *idev) { struct net_device *dev; struct inet6_ifaddr *ifa; + LIST_HEAD(tmp_addr_list); =20 if (!idev) return; @@ -815,14 +816,24 @@ static void dev_forward_change(struct inet6_dev *idev) } } =20 + read_lock_bh(&idev->lock); list_for_each_entry(ifa, &idev->addr_list, if_list) { if (ifa->flags&IFA_F_TENTATIVE) continue; + list_add_tail(&ifa->if_list_aux, &tmp_addr_list); + } + read_unlock_bh(&idev->lock); + + while (!list_empty(&tmp_addr_list)) { + ifa =3D list_first_entry(&tmp_addr_list, + struct inet6_ifaddr, if_list_aux); + list_del(&ifa->if_list_aux); if (idev->cnf.forwarding) addrconf_join_anycast(ifa); else addrconf_leave_anycast(ifa); } + inet6_netconf_notify_devconf(dev_net(dev), RTM_NEWNETCONF, NETCONFA_FORWARDING, dev->ifindex, &idev->cnf); @@ -3728,7 +3739,8 @@ static int addrconf_ifdown(struct net_device *dev, bo= ol unregister) unsigned long event =3D unregister ? NETDEV_UNREGISTER : NETDEV_DOWN; struct net *net =3D dev_net(dev); struct inet6_dev *idev; - struct inet6_ifaddr *ifa, *tmp; + struct inet6_ifaddr *ifa; + LIST_HEAD(tmp_addr_list); bool keep_addr =3D false; bool was_ready; int state, i; @@ -3820,16 +3832,23 @@ static int addrconf_ifdown(struct net_device *dev, = bool unregister) write_lock_bh(&idev->lock); } =20 - list_for_each_entry_safe(ifa, tmp, &idev->addr_list, if_list) { + list_for_each_entry(ifa, &idev->addr_list, if_list) + list_add_tail(&ifa->if_list_aux, &tmp_addr_list); + write_unlock_bh(&idev->lock); + + while (!list_empty(&tmp_addr_list)) { struct fib6_info *rt =3D NULL; bool keep; =20 + ifa =3D list_first_entry(&tmp_addr_list, + struct inet6_ifaddr, if_list_aux); + list_del(&ifa->if_list_aux); + addrconf_del_dad_work(ifa); =20 keep =3D keep_addr && (ifa->flags & IFA_F_PERMANENT) && !addr_is_local(&ifa->addr); =20 - write_unlock_bh(&idev->lock); spin_lock_bh(&ifa->lock); =20 if (keep) { @@ -3860,15 +3879,14 @@ static int addrconf_ifdown(struct net_device *dev, = bool unregister) addrconf_leave_solict(ifa->idev, &ifa->addr); } =20 - write_lock_bh(&idev->lock); if (!keep) { + write_lock_bh(&idev->lock); list_del_rcu(&ifa->if_list); + write_unlock_bh(&idev->lock); in6_ifa_put(ifa); } } =20 - write_unlock_bh(&idev->lock); - /* Step 5: Discard anycast and multicast list */ if (unregister) { ipv6_ac_destroy_dev(idev); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B039DC43334 for ; Tue, 7 Jun 2022 22:08:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382932AbiFGWIv (ORCPT ); Tue, 7 Jun 2022 18:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379932AbiFGVGg (ORCPT ); Tue, 7 Jun 2022 17:06:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CF22212554; Tue, 7 Jun 2022 11:50:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B930BB822C0; Tue, 7 Jun 2022 18:50:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28F91C385A2; Tue, 7 Jun 2022 18:50:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627835; bh=+ehzoZ1+4/6eIf04m+qPZ2eANMxYBdwQHqalydfBe80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dh5HsKV2XLmrkmrY8COdebUURFLNNXq2ZZdcMfjQGu9Nty94quS4mp3lK1HNzmv+I oqPFGRWxiwJMUSk4LqB4cDWg4s/v5twUtNzs2sTyU5xDftadS7TU8YN33yIbNjaytV avHat42Bj4CDYoGv+ubMR28YJu/6SVVhaWAoraRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Ravnborg , Daniel Vetter , Daniel Vetter , Du Cheng , Tetsuo Handa , Claudio Suarez , Thomas Zimmermann , Sasha Levin Subject: [PATCH 5.18 070/879] fbcon: Consistently protect deferred_takeover with console_lock() Date: Tue, 7 Jun 2022 18:53:08 +0200 Message-Id: <20220607165004.723924768@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Vetter [ Upstream commit 43553559121ca90965b572cf8a1d6d0fd618b449 ] This shouldn't be a problem in practice since until we've actually taken over the console there's nothing we've registered with the console/vt subsystem, so the exit/unbind path that check this can't do the wrong thing. But it's confusing, so fix it by moving it a tad later. Acked-by: Sam Ravnborg Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Du Cheng Cc: Tetsuo Handa Cc: Claudio Suarez Cc: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20220405210335.3434130-= 14-daniel.vetter@ffwll.ch Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/video/fbdev/core/fbcon.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fb= con.c index 2fc1b80a26ad..9a8ae6fa6ecb 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3265,6 +3265,9 @@ static void fbcon_register_existing_fbs(struct work_s= truct *work) =20 console_lock(); =20 + deferred_takeover =3D false; + logo_shown =3D FBCON_LOGO_DONTSHOW; + for_each_registered_fb(i) fbcon_fb_registered(registered_fb[i]); =20 @@ -3282,8 +3285,6 @@ static int fbcon_output_notifier(struct notifier_bloc= k *nb, pr_info("fbcon: Taking over console\n"); =20 dummycon_unregister_output_notifier(&fbcon_output_nb); - deferred_takeover =3D false; - logo_shown =3D FBCON_LOGO_DONTSHOW; =20 /* We may get called in atomic context */ schedule_work(&fbcon_deferred_takeover_work); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C833C43334 for ; Tue, 7 Jun 2022 22:09:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378784AbiFGWJP (ORCPT ); Tue, 7 Jun 2022 18:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379942AbiFGVGh (ORCPT ); Tue, 7 Jun 2022 17:06: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 EAB5C212561; Tue, 7 Jun 2022 11:50:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 73919B82182; Tue, 7 Jun 2022 18:50:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2653C385A2; Tue, 7 Jun 2022 18:50:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627838; bh=FQ0KiZojiiCMdSntTJQX+VlNmgl4iS0gWsxYxk6CTm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WS19y0ofb56z6PskalvI9tPZeevjymP5pwlPmvVqMwI2h2303YQq4xhrcWyRpTWw8 e6EAHYN5YTT8tmWvNWDH0kNp5s1C3cZHgjFu5N5+He3MTZ45blhjE/hWe1AdhAThTQ SSp4zOzsqtlhYK9AeOgnDb5T5GH+7KYhA7UNdrLA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Travis , Steve Wahl , Borislav Petkov , Dimitri Sivanich , Thomas Gleixner , Sasha Levin Subject: [PATCH 5.18 071/879] x86/platform/uv: Update TSC sync state for UV5 Date: Tue, 7 Jun 2022 18:53:09 +0200 Message-Id: <20220607165004.752723928@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Travis [ Upstream commit bb3ab81bdbd53f88f26ffabc9fb15bd8466486ec ] The UV5 platform synchronizes the TSCs among all chassis, and will not proceed to OS boot without achieving synchronization. Previous UV platforms provided a register indicating successful synchronization. This is no longer available on UV5. On this platform TSC_ADJUST should not be reset by the kernel. Signed-off-by: Mike Travis Signed-off-by: Steve Wahl Signed-off-by: Borislav Petkov Reviewed-by: Dimitri Sivanich Acked-by: Thomas Gleixner Link: https://lore.kernel.org/r/20220406195149.228164-3-steve.wahl@hpe.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/kernel/apic/x2apic_uv_x.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2ap= ic_uv_x.c index f5a48e66e4f5..a6e9c2794ef5 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c @@ -199,7 +199,13 @@ static void __init uv_tsc_check_sync(void) int mmr_shift; char *state; =20 - /* Different returns from different UV BIOS versions */ + /* UV5 guarantees synced TSCs; do not zero TSC_ADJUST */ + if (!is_uv(UV2|UV3|UV4)) { + mark_tsc_async_resets("UV5+"); + return; + } + + /* UV2,3,4, UV BIOS TSC sync state available */ mmr =3D uv_early_read_mmr(UVH_TSC_SYNC_MMR); mmr_shift =3D is_uv2_hub() ? UVH_TSC_SYNC_SHIFT_UV2K : UVH_TSC_SYNC_SHIFT; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0190DC433EF for ; Tue, 7 Jun 2022 22:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384073AbiFGWKT (ORCPT ); Tue, 7 Jun 2022 18:10:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377938AbiFGVGm (ORCPT ); Tue, 7 Jun 2022 17:06: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 7B9A7212C84; Tue, 7 Jun 2022 11:50:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C71F7612F2; Tue, 7 Jun 2022 18:50:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE02EC385A2; Tue, 7 Jun 2022 18:50:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627841; bh=RsqfcE3Vlaza98kvhQkeITROjqKHS5OvbTROZhct/dA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VYqku34jBQP5pBFBA9T1woAMofXqvRhM65yMqZEDUKrJTp6xvOjT9C0F5p+5q6vGc f9PV4JDDDWuIfpFd1NR9e1auuumFbX1356lbhnmMZQKQQDux7jLejhQsvNVJmPs3FH T5TPQzm+YpN3cTvpnDFgxpQ4xgJjHoHVjQOEb3nE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Kirill A. Shutemov" , Dave Hansen , Dan Williams , Thomas Gleixner , Sasha Levin Subject: [PATCH 5.18 072/879] ACPICA: Avoid cache flush inside virtual machines Date: Tue, 7 Jun 2022 18:53:10 +0200 Message-Id: <20220607165004.781286229@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kirill A. Shutemov [ Upstream commit e2efb6359e620521d1e13f69b2257de8ceaa9475 ] While running inside virtual machine, the kernel can bypass cache flushing. Changing sleep state in a virtual machine doesn't affect the host system sleep state and cannot lead to data loss. Before entering sleep states, the ACPI code flushes caches to prevent data loss using the WBINVD instruction. This mechanism is required on bare metal. But, any use WBINVD inside of a guest is worthless. Changing sleep state in a virtual machine doesn't affect the host system sleep state and cannot lead to data loss, so most hypervisors simply ignore it. Despite this, the ACPI code calls WBINVD unconditionally anyway. It's useless, but also normally harmless. In TDX guests, though, WBINVD stops being harmless; it triggers a virtualization exception (#VE). If the ACPI cache-flushing WBINVD were left in place, TDX guests would need handling to recover from the exception. Avoid using WBINVD whenever running under a hypervisor. This both removes the useless WBINVDs and saves TDX from implementing WBINVD handling. Signed-off-by: Kirill A. Shutemov Signed-off-by: Dave Hansen Reviewed-by: Dave Hansen Reviewed-by: Dan Williams Reviewed-by: Thomas Gleixner Link: https://lkml.kernel.org/r/20220405232939.73860-30-kirill.shutemov@lin= ux.intel.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/include/asm/acenv.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h index 9aff97f0de7f..d937c55e717e 100644 --- a/arch/x86/include/asm/acenv.h +++ b/arch/x86/include/asm/acenv.h @@ -13,7 +13,19 @@ =20 /* Asm macros */ =20 -#define ACPI_FLUSH_CPU_CACHE() wbinvd() +/* + * ACPI_FLUSH_CPU_CACHE() flushes caches on entering sleep states. + * It is required to prevent data loss. + * + * While running inside virtual machine, the kernel can bypass cache flush= ing. + * Changing sleep state in a virtual machine doesn't affect the host system + * sleep state and cannot lead to data loss. + */ +#define ACPI_FLUSH_CPU_CACHE() \ +do { \ + if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) \ + wbinvd(); \ +} while (0) =20 int __acpi_acquire_global_lock(unsigned int *lock); int __acpi_release_global_lock(unsigned int *lock); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2657ECCA482 for ; Tue, 7 Jun 2022 22:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384200AbiFGWKe (ORCPT ); Tue, 7 Jun 2022 18:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378603AbiFGVHG (ORCPT ); Tue, 7 Jun 2022 17:07:06 -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 7D56B212C87; Tue, 7 Jun 2022 11:50:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7F52C6176D; Tue, 7 Jun 2022 18:50:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DB88C385A2; Tue, 7 Jun 2022 18:50:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627843; bh=1Nut9CRMqLigdsqkyxIk7KKSPWoZoP6lmxG2cVbPM1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HYQnOHrhLIq2+c4/yFezJuNf2cWfOTGpaQ2P0vtdbJLmJPOLev2IsHfB/BV2sFTc9 QdjuR32RtJ7WaZF3d0fSMS1kk547jX7/0fmGT7M02TtVsAflAbXh6oyE195UZ2GGgq HI1NWHTwd0Z+YsKMQBTdaHzFv97KyV/7JCfgpgG0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Runqing Yang , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.18 073/879] libbpf: Fix a bug with checking bpf_probe_read_kernel() support in old kernels Date: Tue, 7 Jun 2022 18:53:11 +0200 Message-Id: <20220607165004.810672935@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Runqing Yang [ Upstream commit d252a4a499a07bec21c65873f605c3a1ef52ffed ] Background: Libbpf automatically replaces calls to BPF bpf_probe_read_{kernel,user} [_str]() helpers with bpf_probe_read[_str](), if libbpf detects that kernel doesn't support new APIs. Specifically, libbpf invokes the probe_kern_probe_read_kernel function to load a small eBPF program into the kernel in which bpf_probe_read_kernel API is invoked and lets the kernel checks whether the new API is valid. If the loading fails, libbpf considers the new API invalid and replaces it with the old API. static int probe_kern_probe_read_kernel(void) { struct bpf_insn insns[] =3D { BPF_MOV64_REG(BPF_REG_1, BPF_REG_10), /* r1 =3D r10 (fp) */ BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -8), /* r1 +=3D -8 */ BPF_MOV64_IMM(BPF_REG_2, 8), /* r2 =3D 8 */ BPF_MOV64_IMM(BPF_REG_3, 0), /* r3 =3D 0 */ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_probe_read_kernel), BPF_EXIT_INSN(), }; int fd, insn_cnt =3D ARRAY_SIZE(insns); fd =3D bpf_prog_load(BPF_PROG_TYPE_KPROBE, NULL, "GPL", insns, insn_cnt, NULL); return probe_fd(fd); } Bug: On older kernel versions [0], the kernel checks whether the version number provided in the bpf syscall, matches the LINUX_VERSION_CODE. If not matched, the bpf syscall fails. eBPF However, the probe_kern_probe_read_kernel code does not set the kernel version number provided to the bpf syscall, which causes the loading process alwasys fails for old versions. It means that libbpf will replace the new API with the old one even the kernel supports the new one. Solution: After a discussion in [1], the solution is using BPF_PROG_TYPE_TRACEPOINT program type instead of BPF_PROG_TYPE_KPROBE because kernel does not enfoce version check for tracepoint programs. I test the patch in old kernels (4.18 and 4.19) and it works well. [0] https://elixir.bootlin.com/linux/v4.19/source/kernel/bpf/syscall.c#L1= 360 [1] Closes: https://github.com/libbpf/libbpf/issues/473 Signed-off-by: Runqing Yang Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220409144928.27499-1-rainkin1993@gmail.= com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 809fe209cdcc..dabf9a1451c3 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -4587,7 +4587,7 @@ static int probe_kern_probe_read_kernel(void) }; int fd, insn_cnt =3D ARRAY_SIZE(insns); =20 - fd =3D bpf_prog_load(BPF_PROG_TYPE_KPROBE, NULL, "GPL", insns, insn_cnt, = NULL); + fd =3D bpf_prog_load(BPF_PROG_TYPE_TRACEPOINT, NULL, "GPL", insns, insn_c= nt, NULL); return probe_fd(fd); } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C505C433EF for ; Tue, 7 Jun 2022 22:04:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356862AbiFGWEB (ORCPT ); Tue, 7 Jun 2022 18:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378882AbiFGVE0 (ORCPT ); Tue, 7 Jun 2022 17:04:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31AC18ADB5; Tue, 7 Jun 2022 11:48: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 4E25561295; Tue, 7 Jun 2022 18:48:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56736C385A2; Tue, 7 Jun 2022 18:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627732; bh=C9X33pXWCcfrKODJ1R5etG2iGEZfHfyCD+gmXXOfpYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K7G5eb7+WFOw8sAOV0eJH9AHuSsbAUwj7LTO0nZC/65/gZhJFhR3l/yyw+HpqN0Uk 7G5JFnDAoOzL5lzToiU69k2ZlGE6xHzMGmuRD9MqjSUfRkJJLnFcMmxhg63sprTcqY sGhShvNYj5m9OjVr+YrwOA2QiBryEQHZGi/xs8Z4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Seiderer , Johannes Berg , Sasha Levin Subject: [PATCH 5.18 074/879] mac80211: minstrel_ht: fix where rate stats are stored (fixes debugfs output) Date: Tue, 7 Jun 2022 18:53:12 +0200 Message-Id: <20220607165004.839967461@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Seiderer [ Upstream commit 5c6dd7bd569b54c0d2904125d7366aa93f077f67 ] Using an ath9k card the debugfs output of minstrel_ht looks like the follow= ing (note the zero values for the first four rates sum-of success/attempts): best ____________rate__________ ____statistics___ ___= __last____ ______sum-of________ mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob)] [re= try|suc|att] [#success | #attempts] OFDM 1 DP 6.0M 272 1640 5.2 3.1 53.8 = 3 0 0 0 0 OFDM 1 C 9.0M 273 1104 7.7 4.6 53.8 = 4 0 0 0 0 OFDM 1 B 12.0M 274 836 10.0 6.0 53.8 = 4 0 0 0 0 OFDM 1 A S 18.0M 275 568 14.3 8.5 53.8 = 5 0 0 0 0 OFDM 1 S 24.0M 276 436 18.1 0.0 0.0 = 5 0 1 80 1778 OFDM 1 36.0M 277 300 24.9 0.0 0.0 = 0 0 1 0 107 OFDM 1 S 48.0M 278 236 30.4 0.0 0.0 = 0 0 0 0 75 OFDM 1 54.0M 279 212 33.0 0.0 0.0 = 0 0 0 0 72 Total packet count:: ideal 16582 lookaround 885 Average # of aggregated frames per A-MPDU: 1.0 Debugging showed that the rate statistics for the first four rates where stored in the MINSTREL_CCK_GROUP instead of the MINSTREL_OFDM_GROUP because in minstrel_ht_get_stats() the supported check was not honoured as done in various other places, e.g net/mac80211/rc80211_minstrel_ht_debugfs.c: 74 if (!(mi->supported[i] & BIT(j))) 75 continue; With the patch applied the output looks good: best ____________rate__________ ____statistics___ __= ___last____ ______sum-of________ mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob)] [re= try|suc|att] [#success | #attempts] OFDM 1 D 6.0M 272 1640 5.2 5.2 100.0 = 3 0 0 1 1 OFDM 1 C 9.0M 273 1104 7.7 7.7 100.0 = 4 0 0 38 38 OFDM 1 B 12.0M 274 836 10.0 9.9 89.5 = 4 2 2 372 395 OFDM 1 A P 18.0M 275 568 14.3 14.3 97.2 = 5 52 53 6956 7181 OFDM 1 S 24.0M 276 436 18.1 0.0 0.0 = 0 0 1 6 163 OFDM 1 36.0M 277 300 24.9 0.0 0.0 = 0 0 1 0 35 OFDM 1 S 48.0M 278 236 30.4 0.0 0.0 = 0 0 0 0 38 OFDM 1 S 54.0M 279 212 33.0 0.0 0.0 = 0 0 0 0 38 Total packet count:: ideal 7097 lookaround 287 Average # of aggregated frames per A-MPDU: 1.0 Signed-off-by: Peter Seiderer Link: https://lore.kernel.org/r/20220404165414.1036-1-ps.report@gmx.net Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/mac80211/rc80211_minstrel_ht.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_mins= trel_ht.c index 9c6ace858107..5a6bf46a4248 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -362,6 +362,9 @@ minstrel_ht_get_stats(struct minstrel_priv *mp, struct = minstrel_ht_sta *mi, =20 group =3D MINSTREL_CCK_GROUP; for (idx =3D 0; idx < ARRAY_SIZE(mp->cck_rates); idx++) { + if (!(mi->supported[group] & BIT(idx))) + continue; + if (rate->idx !=3D mp->cck_rates[idx]) continue; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 787D3C43334 for ; Tue, 7 Jun 2022 22:07:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382772AbiFGWHM (ORCPT ); Tue, 7 Jun 2022 18:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378735AbiFGVEb (ORCPT ); Tue, 7 Jun 2022 17:04: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 252E818CE18; Tue, 7 Jun 2022 11:48: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 B8DACB8220B; Tue, 7 Jun 2022 18:48:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2149CC385A2; Tue, 7 Jun 2022 18:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627735; bh=Aoq/ZnXVcKk+p7VdfH7dk2D2Y56VczJQo9MgI9eHjA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VNC3nVrUzn4nEr8DfhDa+WJ9o/6ul5g1h32KaHNtiQ2ONcNnBqoEbdDv8OvXXsHS9 kF4rfx6yJs3z4/UsYnRgTv6QaDJlZdBdfsqFN5gdb7WbQK9VAi5kL1rdk+PylWd7eW Cpfjiw22AXp71ylrGfxr9yWq6zcaJWyeuUIM31Ic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steven Price , Liviu Dudau , Sasha Levin Subject: [PATCH 5.18 075/879] drm/komeda: return early if drm_universal_plane_init() fails. Date: Tue, 7 Jun 2022 18:53:13 +0200 Message-Id: <20220607165004.868468353@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liviu Dudau [ Upstream commit c8f76c37cc3668ee45e081e76a15f24a352ebbdd ] If drm_universal_plane_init() fails early we jump to the common cleanup code that calls komeda_plane_destroy() which in turn could access the uninitalis= ed drm_plane and crash. Return early if an error is detected without going thr= ough the common code. Reported-by: Steven Price Reviewed-by: Steven Price Signed-off-by: Liviu Dudau Link: https://lore.kernel.org/dri-devel/20211203100946.2706922-1-liviu.duda= u@arm.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c b/drivers/gp= u/drm/arm/display/komeda/komeda_plane.c index d63d83800a8a..d646e3ae1a23 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c @@ -275,8 +275,10 @@ static int komeda_plane_add(struct komeda_kms_dev *kms, =20 komeda_put_fourcc_list(formats); =20 - if (err) - goto cleanup; + if (err) { + kfree(kplane); + return err; + } =20 drm_plane_helper_add(plane, &komeda_plane_helper_funcs); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 439BFCCA47C for ; Tue, 7 Jun 2022 22:07:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382579AbiFGWHJ (ORCPT ); Tue, 7 Jun 2022 18:07:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378838AbiFGVEc (ORCPT ); Tue, 7 Jun 2022 17:04:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71C7BB2EAB; Tue, 7 Jun 2022 11:48:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0CA916156D; Tue, 7 Jun 2022 18:48:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 142C4C36B0C; Tue, 7 Jun 2022 18:48:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627738; bh=cz7EaM8E2HHkUwPlijx0Xy7QFc9ala/dWiZQqSjozhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R0hYTOhIkPRpolN+KjXM/JowZCtGVpu9vam4TcjRAnsMLXUYW3UhSk2k4GiE2onPJ CM1/xjri7hrGi87tzk4G5UJGPfIFpC3MWG62Ds2I3PCPwigaZxLR/ofWZKJMlRvtjr 3nxEEgxX1LqRsGNCYRWy6QUZzF0ih8sHUn+z13BI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Yang , Pavle Kotarac , Saaem Rizvi , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 076/879] drm/amd/display: Disabling Z10 on DCN31 Date: Tue, 7 Jun 2022 18:53:14 +0200 Message-Id: <20220607165004.896958794@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Saaem Rizvi [ Upstream commit 5d5af34072c8b11f60960c3bea57ff9de5877791 ] [WHY] Z10 is should not be enabled by default on DCN31. [HOW] Using DC debug flags to disable Z10 by default on DCN31. Reviewed-by: Eric Yang Acked-by: Pavle Kotarac Signed-off-by: Saaem Rizvi Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c b/driver= s/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c index 63934ecf6be8..d71e625cc476 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c @@ -1030,6 +1030,7 @@ static const struct dc_debug_options debug_defaults_d= rv =3D { .afmt =3D true, } }, + .disable_z10 =3D true, .optimize_edp_link_rate =3D true, .enable_sw_cntl_psr =3D true, .apply_vendor_specific_lttpr_wa =3D true, --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F756CCA47F for ; Tue, 7 Jun 2022 22:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383479AbiFGWF2 (ORCPT ); Tue, 7 Jun 2022 18:05:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379004AbiFGVEe (ORCPT ); Tue, 7 Jun 2022 17:04:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 969E4146752; Tue, 7 Jun 2022 11:49:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 50564B8220B; Tue, 7 Jun 2022 18:49:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDD20C385A5; Tue, 7 Jun 2022 18:49:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627741; bh=W8dMmSvyCqN97kCN1sTOpXKzlWd6xvOqThnrKdx+K3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p9eQ0HQhyWzyPRY+wkqL8Tpf0nYAze9QqvIrLIUkRwJqktJY5wmmmKby4p24Knb7p iA55OzsdJeLC/a661yHTkRMtzmnC0zYhkVk62wkwvzy3H6lP7t/ptl6dQl5O3RZ2aO 6ZOK803N/AYXKfO6WuZ7/KwKQkJCww0u4lsV9RvA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paul E. McKenney" , Padmanabha Srinivasaiah , Sasha Levin Subject: [PATCH 5.18 077/879] rcu-tasks: Fix race in schedule and flush work Date: Tue, 7 Jun 2022 18:53:15 +0200 Message-Id: <20220607165004.925478006@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Padmanabha Srinivasaiah [ Upstream commit f75fd4b9221d93177c50dcfde671b2e907f53e86 ] While booting secondary CPUs, cpus_read_[lock/unlock] is not keeping online cpumask stable. The transient online mask results in below calltrace. [ 0.324121] CPU1: Booted secondary processor 0x0000000001 [0x410fd083] [ 0.346652] Detected PIPT I-cache on CPU2 [ 0.347212] CPU2: Booted secondary processor 0x0000000002 [0x410fd083] [ 0.377255] Detected PIPT I-cache on CPU3 [ 0.377823] CPU3: Booted secondary processor 0x0000000003 [0x410fd083] [ 0.379040] ------------[ cut here ]------------ [ 0.383662] WARNING: CPU: 0 PID: 10 at kernel/workqueue.c:3084 __flush_w= ork+0x12c/0x138 [ 0.384850] Modules linked in: [ 0.385403] CPU: 0 PID: 10 Comm: rcu_tasks_rude_ Not tainted 5.17.0-rc3-= v8+ #13 [ 0.386473] Hardware name: Raspberry Pi 4 Model B Rev 1.4 (DT) [ 0.387289] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE= =3D--) [ 0.388308] pc : __flush_work+0x12c/0x138 [ 0.388970] lr : __flush_work+0x80/0x138 [ 0.389620] sp : ffffffc00aaf3c60 [ 0.390139] x29: ffffffc00aaf3d20 x28: ffffffc009c16af0 x27: ffffff80f76= 1df48 [ 0.391316] x26: 0000000000000004 x25: 0000000000000003 x24: 00000000000= 00100 [ 0.392493] x23: ffffffffffffffff x22: ffffffc009c16b10 x21: ffffffc009c= 16b28 [ 0.393668] x20: ffffffc009e53861 x19: ffffff80f77fbf40 x18: 00000000d74= 4fcc9 [ 0.394842] x17: 000000000000000b x16: 00000000000001c2 x15: ffffffc009e= 57550 [ 0.396016] x14: 0000000000000000 x13: ffffffffffffffff x12: 00000001000= 00000 [ 0.397190] x11: 0000000000000462 x10: ffffff8040258008 x9 : 00000001000= 00000 [ 0.398364] x8 : 0000000000000000 x7 : ffffffc0093c8bf4 x6 : 00000000000= 00000 [ 0.399538] x5 : 0000000000000000 x4 : ffffffc00a976e40 x3 : ffffffc0081= 0444c [ 0.400711] x2 : 0000000000000004 x1 : 0000000000000000 x0 : 00000000000= 00000 [ 0.401886] Call trace: [ 0.402309] __flush_work+0x12c/0x138 [ 0.402941] schedule_on_each_cpu+0x228/0x278 [ 0.403693] rcu_tasks_rude_wait_gp+0x130/0x144 [ 0.404502] rcu_tasks_kthread+0x220/0x254 [ 0.405264] kthread+0x174/0x1ac [ 0.405837] ret_from_fork+0x10/0x20 [ 0.406456] irq event stamp: 102 [ 0.406966] hardirqs last enabled at (101): [] _raw_s= pin_unlock_irq+0x78/0xb4 [ 0.408304] hardirqs last disabled at (102): [] el1_db= g+0x24/0x5c [ 0.409410] softirqs last enabled at (54): [] local_b= h_enable+0xc/0x2c [ 0.410645] softirqs last disabled at (50): [] local_b= h_disable+0xc/0x2c [ 0.411890] ---[ end trace 0000000000000000 ]--- [ 0.413000] smp: Brought up 1 node, 4 CPUs [ 0.413762] SMP: Total of 4 processors activated. [ 0.414566] CPU features: detected: 32-bit EL0 Support [ 0.415414] CPU features: detected: 32-bit EL1 Support [ 0.416278] CPU features: detected: CRC32 instructions [ 0.447021] Callback from call_rcu_tasks_rude() invoked. [ 0.506693] Callback from call_rcu_tasks() invoked. This commit therefore fixes this issue by applying a single-CPU optimization to the RCU Tasks Rude grace-period process. The key point here is that the purpose of this RCU flavor is to force a schedule on each online CPU since some past event. But the rcu_tasks_rude_wait_gp() function runs in the context of the RCU Tasks Rude's grace-period kthread, so there must already have been a context switch on the current CPU since the call to either synchronize_rcu_tasks_rude() or call_rcu_tasks_rude(). So if there is only a single CPU online, RCU Tasks Rude's grace-period kthread does not need to anything at all. It turns out that the rcu_tasks_rude_wait_gp() function's call to schedule_on_each_cpu() causes problems during early boot. During that time, there is only one online CPU, namely the boot CPU. Therefore, applying this single-CPU optimization fixes early-boot instances of this problem. Link: https://lore.kernel.org/lkml/20220210184319.25009-1-treasure4paddy@gm= ail.com/T/ Suggested-by: Paul E. McKenney Signed-off-by: Padmanabha Srinivasaiah Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/rcu/tasks.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 99cf3a13954c..b43320b149d2 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -950,6 +950,9 @@ static void rcu_tasks_be_rude(struct work_struct *work) // Wait for one rude RCU-tasks grace period. static void rcu_tasks_rude_wait_gp(struct rcu_tasks *rtp) { + if (num_online_cpus() <=3D 1) + return; // Fastpath for only one CPU. + rtp->n_ipis +=3D cpumask_weight(cpu_online_mask); schedule_on_each_cpu(rcu_tasks_be_rude); } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24F13CCA483 for ; Tue, 7 Jun 2022 22:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383494AbiFGWFb (ORCPT ); Tue, 7 Jun 2022 18:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378993AbiFGVEe (ORCPT ); Tue, 7 Jun 2022 17:04:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 800C0703D1; Tue, 7 Jun 2022 11:49:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 63E9A612F2; Tue, 7 Jun 2022 18:49:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 697D5C385A2; Tue, 7 Jun 2022 18:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627743; bh=8n4OgktZlvppTMNUSoL4V5FRUeTebTWR5ynJTOiyTVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aa1vBW9hbSbaoU3mCjIITOledednbXshrn8pH85VolWwWoq3tBM51PE2XZZ6JL8bL S5MV9yMVHbqXKX0PljFBL/8IY9dmW4UZvMSnBhc6DdA8GlvsUx8AtBrIvhAloU7FOs YEVH1TTcK0IniqgNcY/JEl8aRgjIuWha9dSduIW4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.18 078/879] rcu-tasks: Handle sparse cpu_possible_mask in rcu_tasks_invoke_cbs() Date: Tue, 7 Jun 2022 18:53:16 +0200 Message-Id: <20220607165004.954494734@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul E. McKenney [ Upstream commit ab2756ea6b74987849b44ad0e33c3cfec159033b ] If the cpu_possible_mask is sparse (for example, if bits are set only for CPUs 0, 4, 8, ...), then rcu_tasks_invoke_cbs() will access per-CPU data for a CPU not in cpu_possible_mask. It makes these accesses while doing a workqueue-based binary search for non-empty callback lists. Although this search must pass through CPUs not represented in cpu_possible_mask, it has no need to check the callback list for such CPUs. This commit therefore changes the rcu_tasks_invoke_cbs() function's binary search so as to only check callback lists for CPUs present in cpu_possible_mask. Reported-by: Eric Dumazet Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/rcu/tasks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index b43320b149d2..00ff0896fb00 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -460,7 +460,7 @@ static void rcu_tasks_invoke_cbs(struct rcu_tasks *rtp,= struct rcu_tasks_percpu } } =20 - if (rcu_segcblist_empty(&rtpcp->cblist)) + if (rcu_segcblist_empty(&rtpcp->cblist) || !cpu_possible(cpu)) return; raw_spin_lock_irqsave_rcu_node(rtpcp, flags); rcu_segcblist_advance(&rtpcp->cblist, rcu_seq_current(&rtp->tasks_gp_seq)= ); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61EEECCA486 for ; Tue, 7 Jun 2022 22:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383533AbiFGWFl (ORCPT ); Tue, 7 Jun 2022 18:05:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378680AbiFGVE4 (ORCPT ); Tue, 7 Jun 2022 17:04:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03386B2EB6; Tue, 7 Jun 2022 11:49:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CD7CDB8220B; Tue, 7 Jun 2022 18:49:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33693C385A2; Tue, 7 Jun 2022 18:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627746; bh=/bRe3fMWLujieOuRXkmsKWSwKCr2pPGcp3HWPp9ylT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q22QvVumIZnpU+l0S6I6WXn1Z5nFUlssDzzNtVsAQN9/DCwPcwP4CSQmJoLPgTy4Q ySCGc0f93EpIoIgc11EKWRC99oAWQjdkk++N46JebvzLwy/QOP8w2vQaT/3khayDSG j89qAHj5A7Q3XiHKty4R2F9XMEONT6WOaNe9Qfho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyeonggon Yoo <42.hyeyoo@gmail.com>, "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.18 079/879] rcu: Make TASKS_RUDE_RCU select IRQ_WORK Date: Tue, 7 Jun 2022 18:53:17 +0200 Message-Id: <20220607165004.983480542@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul E. McKenney [ Upstream commit 46e861be589881e0905b9ade3d8439883858721c ] The TASKS_RUDE_RCU does not select IRQ_WORK, which can result in build failures for kernels that do not otherwise select IRQ_WORK. This commit therefore causes the TASKS_RUDE_RCU Kconfig option to select IRQ_WORK. Reported-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/rcu/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig index bf8e341e75b4..f559870fbf8b 100644 --- a/kernel/rcu/Kconfig +++ b/kernel/rcu/Kconfig @@ -86,6 +86,7 @@ config TASKS_RCU =20 config TASKS_RUDE_RCU def_bool 0 + select IRQ_WORK help This option enables a task-based RCU implementation that uses only context switch (including preemption) and user-mode --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43C93CCA482 for ; Tue, 7 Jun 2022 22:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383513AbiFGWFi (ORCPT ); Tue, 7 Jun 2022 18:05:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379082AbiFGVFK (ORCPT ); Tue, 7 Jun 2022 17:05:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57056BA557; Tue, 7 Jun 2022 11:49: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 A722AB8239A; Tue, 7 Jun 2022 18:49:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00403C385A2; Tue, 7 Jun 2022 18:49:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627749; bh=pBcuqRJyXkrcTTWjrJgll4gSCsKtCBBitGAKZhcs2VI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Af3+vOTnVM7B+jXif7uOmzSpueWI/NmEexsugJm2CBXEJ0UoiE8/DR8V462cv8ShI dr9ZHdQXOUqH9O2YWsfbVzSe2v3Q77AZVqYxAGzLR9rZzRU/z6G9LKW1DjKxYlb48g lGybx7E/JDlwuhksMNbe/fcbZ9JL7gjLNL3cf5Bw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haowen Bai , Edward Cree , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 080/879] sfc: ef10: Fix assigning negative value to unsigned variable Date: Tue, 7 Jun 2022 18:53:18 +0200 Message-Id: <20220607165005.011913913@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haowen Bai [ Upstream commit b8ff3395fbdf3b79a99d0ef410fc34c51044121e ] fix warning reported by smatch: 251 drivers/net/ethernet/sfc/ef10.c:2259 efx_ef10_tx_tso_desc() warn: assigning (-208) to unsigned variable 'ip_tot_len' Signed-off-by: Haowen Bai Acked-by: Edward Cree Link: https://lore.kernel.org/r/1649640757-30041-1-git-send-email-baihaowen= @meizu.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/sfc/ef10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef1= 0.c index f8edb3f1b73a..186cb28c03bd 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c @@ -2256,7 +2256,7 @@ int efx_ef10_tx_tso_desc(struct efx_tx_queue *tx_queu= e, struct sk_buff *skb, * guaranteed to satisfy the second as we only attempt TSO if * inner_network_header <=3D 208. */ - ip_tot_len =3D -EFX_TSO2_MAX_HDRLEN; + ip_tot_len =3D 0x10000 - EFX_TSO2_MAX_HDRLEN; EFX_WARN_ON_ONCE_PARANOID(mss + EFX_TSO2_MAX_HDRLEN + (tcp->doff << 2u) > ip_tot_len); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DCC9CCA488 for ; Tue, 7 Jun 2022 22:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383587AbiFGWFz (ORCPT ); Tue, 7 Jun 2022 18:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379188AbiFGVFl (ORCPT ); Tue, 7 Jun 2022 17:05:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0907FBCE9C; Tue, 7 Jun 2022 11:49:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6373EB8239B; Tue, 7 Jun 2022 18:49:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B89E0C385A2; Tue, 7 Jun 2022 18:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627752; bh=GTHiEG6Fbnv6d3nL/QXh9DsjWVX96eO95njhrpvwukM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G6E6Q1KxfrqXTDuLYCeTxa4BlucrdRUhoovOnsdxJM0nb4uKr54SIbBkStzcezRgg GVUC0sk7sVExR/OyACbJfXy/v85Z23fqnTotqX3kfcgXgDj0i5IHGuTMHOux0x09Bn edP/+1JSnftM0u6i4FdHyXer+pDmLQoBM8L8qb8o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= , Cezary Rojewski , Takashi Iwai , Sasha Levin Subject: [PATCH 5.18 081/879] ALSA: jack: Access input_dev under mutex Date: Tue, 7 Jun 2022 18:53:19 +0200 Message-Id: <20220607165005.041295530@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amadeusz S=C5=82awi=C5=84ski [ Upstream commit 1b6a6fc5280e97559287b61eade2d4b363e836f2 ] It is possible when using ASoC that input_dev is unregistered while calling snd_jack_report, which causes NULL pointer dereference. In order to prevent this serialize access to input_dev using mutex lock. Signed-off-by: Amadeusz S=C5=82awi=C5=84ski Reviewed-by: Cezary Rojewski Link: https://lore.kernel.org/r/20220412091628.3056922-1-amadeuszx.slawinsk= i@linux.intel.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/sound/jack.h | 1 + sound/core/jack.c | 34 +++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/include/sound/jack.h b/include/sound/jack.h index 1181f536557e..1ed90e2109e9 100644 --- a/include/sound/jack.h +++ b/include/sound/jack.h @@ -62,6 +62,7 @@ struct snd_jack { const char *id; #ifdef CONFIG_SND_JACK_INPUT_DEV struct input_dev *input_dev; + struct mutex input_dev_lock; int registered; int type; char name[100]; diff --git a/sound/core/jack.c b/sound/core/jack.c index d1e3055f2b6a..88493cc31914 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -42,8 +42,11 @@ static int snd_jack_dev_disconnect(struct snd_device *de= vice) #ifdef CONFIG_SND_JACK_INPUT_DEV struct snd_jack *jack =3D device->device_data; =20 - if (!jack->input_dev) + mutex_lock(&jack->input_dev_lock); + if (!jack->input_dev) { + mutex_unlock(&jack->input_dev_lock); return 0; + } =20 /* If the input device is registered with the input subsystem * then we need to use a different deallocator. */ @@ -52,6 +55,7 @@ static int snd_jack_dev_disconnect(struct snd_device *dev= ice) else input_free_device(jack->input_dev); jack->input_dev =3D NULL; + mutex_unlock(&jack->input_dev_lock); #endif /* CONFIG_SND_JACK_INPUT_DEV */ return 0; } @@ -90,8 +94,11 @@ static int snd_jack_dev_register(struct snd_device *devi= ce) snprintf(jack->name, sizeof(jack->name), "%s %s", card->shortname, jack->id); =20 - if (!jack->input_dev) + mutex_lock(&jack->input_dev_lock); + if (!jack->input_dev) { + mutex_unlock(&jack->input_dev_lock); return 0; + } =20 jack->input_dev->name =3D jack->name; =20 @@ -116,6 +123,7 @@ static int snd_jack_dev_register(struct snd_device *dev= ice) if (err =3D=3D 0) jack->registered =3D 1; =20 + mutex_unlock(&jack->input_dev_lock); return err; } #endif /* CONFIG_SND_JACK_INPUT_DEV */ @@ -517,9 +525,11 @@ int snd_jack_new(struct snd_card *card, const char *id= , int type, return -ENOMEM; } =20 - /* don't creat input device for phantom jack */ - if (!phantom_jack) { #ifdef CONFIG_SND_JACK_INPUT_DEV + mutex_init(&jack->input_dev_lock); + + /* don't create input device for phantom jack */ + if (!phantom_jack) { int i; =20 jack->input_dev =3D input_allocate_device(); @@ -537,8 +547,8 @@ int snd_jack_new(struct snd_card *card, const char *id,= int type, input_set_capability(jack->input_dev, EV_SW, jack_switch_types[i]); =20 -#endif /* CONFIG_SND_JACK_INPUT_DEV */ } +#endif /* CONFIG_SND_JACK_INPUT_DEV */ =20 err =3D snd_device_new(card, SNDRV_DEV_JACK, jack, &ops); if (err < 0) @@ -578,10 +588,14 @@ EXPORT_SYMBOL(snd_jack_new); void snd_jack_set_parent(struct snd_jack *jack, struct device *parent) { WARN_ON(jack->registered); - if (!jack->input_dev) + mutex_lock(&jack->input_dev_lock); + if (!jack->input_dev) { + mutex_unlock(&jack->input_dev_lock); return; + } =20 jack->input_dev->dev.parent =3D parent; + mutex_unlock(&jack->input_dev_lock); } EXPORT_SYMBOL(snd_jack_set_parent); =20 @@ -629,6 +643,8 @@ EXPORT_SYMBOL(snd_jack_set_key); =20 /** * snd_jack_report - Report the current status of a jack + * Note: This function uses mutexes and should be called from a + * context which can sleep (such as a workqueue). * * @jack: The jack to report status for * @status: The current status of the jack @@ -654,8 +670,11 @@ void snd_jack_report(struct snd_jack *jack, int status) status & jack_kctl->mask_bits); =20 #ifdef CONFIG_SND_JACK_INPUT_DEV - if (!jack->input_dev) + mutex_lock(&jack->input_dev_lock); + if (!jack->input_dev) { + mutex_unlock(&jack->input_dev_lock); return; + } =20 for (i =3D 0; i < ARRAY_SIZE(jack->key); i++) { int testbit =3D ((SND_JACK_BTN_0 >> i) & ~mask_bits); @@ -675,6 +694,7 @@ void snd_jack_report(struct snd_jack *jack, int status) } =20 input_sync(jack->input_dev); + mutex_unlock(&jack->input_dev_lock); #endif /* CONFIG_SND_JACK_INPUT_DEV */ } EXPORT_SYMBOL(snd_jack_report); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5FEFCCA47C for ; Tue, 7 Jun 2022 22:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384049AbiFGWKJ (ORCPT ); Tue, 7 Jun 2022 18:10:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379219AbiFGVFn (ORCPT ); Tue, 7 Jun 2022 17:05:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D310A106A72; Tue, 7 Jun 2022 11:49:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 301D0B82182; Tue, 7 Jun 2022 18:49:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DF7BC385A2; Tue, 7 Jun 2022 18:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627754; bh=I+5VL4h4/uUKIFvLHkwrzyV1ZwSfo2lBjc7LZAxD4nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wJmyShAGgdr8GD8XPygJuf80kUo0k9JPkm/aKlai5OfO6AIqcQ6wirVa9njF3sm3G ewf67Bo7zmKczifmAyJFzighXMDrZAELKsX+G+mZd2u4Z2ITeAsiIre+3sUE+nRr4B fF4tCWaUEV75MSe3BLboWtvf/IDptxYr7OowKSPI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Po-Hao Huang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 082/879] rtw88: fix incorrect frequency reported Date: Tue, 7 Jun 2022 18:53:20 +0200 Message-Id: <20220607165005.069867861@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Po-Hao Huang [ Upstream commit 6723c0cde84fde582a261c186ce84100dcfa0019 ] We should only fill in frequency reported by firmware during scan. Add this so frames won't be dropped by mac80211 due to frequency mismatch. Signed-off-by: Po-Hao Huang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220407095858.46807-3-pkshih@realtek.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/realtek/rtw88/rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw88/rx.c b/drivers/net/wireless= /realtek/rtw88/rx.c index d2d607e22198..84aedabdf285 100644 --- a/drivers/net/wireless/realtek/rtw88/rx.c +++ b/drivers/net/wireless/realtek/rtw88/rx.c @@ -158,7 +158,8 @@ void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev, memset(rx_status, 0, sizeof(*rx_status)); rx_status->freq =3D hw->conf.chandef.chan->center_freq; rx_status->band =3D hw->conf.chandef.chan->band; - if (rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_SCAN_OFFLOAD)) + if (rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_SCAN_OFFLOAD) && + test_bit(RTW_FLAG_SCANNING, rtwdev->flags)) rtw_set_rx_freq_by_pktstat(pkt_stat, rx_status); if (pkt_stat->crc_err) rx_status->flag |=3D RX_FLAG_FAILED_FCS_CRC; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AF73CCA47F for ; Tue, 7 Jun 2022 22:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384011AbiFGWKF (ORCPT ); Tue, 7 Jun 2022 18:10:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379287AbiFGVFv (ORCPT ); Tue, 7 Jun 2022 17:05:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 123F818DAE5; Tue, 7 Jun 2022 11:49:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D9DA3B82018; Tue, 7 Jun 2022 18:49:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D4A9C385A5; Tue, 7 Jun 2022 18:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627757; bh=R5pzKpdEPHGtsz9epenICLHLl0Q4w/B8PhegQPUoeNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yNFQUbF2dpU91kIGS4j1LZ8aHitrNuQrJA4JRXAu5IT2R3X44GWqIFOHMDY57Gmoo wH0KYzVEmLHf1rEDh/PFnv4Bm9hv1Vho36xuM6B1Vgbxj8wgjHhaYOhETYY6r4U7aA U6V86xchEuhV/uh+VSA7WANuwiBueEbkDJOZakaw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Po-Hao Huang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 083/879] rtw88: 8821c: fix debugfs rssi value Date: Tue, 7 Jun 2022 18:53:21 +0200 Message-Id: <20220607165005.098729519@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Po-Hao Huang [ Upstream commit ece31c93d4d68f7eb8eea4431b052aacdb678de2 ] RSSI value per frame is reported to mac80211 but not maintained in our own statistics, add it back to help us debug. Signed-off-by: Po-Hao Huang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220407095858.46807-7-pkshih@realtek.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/realtek/rtw88/rtw8821c.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wi= reless/realtek/rtw88/rtw8821c.c index 99eee128ae94..ec38a7c84951 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c @@ -512,6 +512,7 @@ static s8 get_cck_rx_pwr(struct rtw_dev *rtwdev, u8 lna= _idx, u8 vga_idx) static void query_phy_status_page0(struct rtw_dev *rtwdev, u8 *phy_status, struct rtw_rx_pkt_stat *pkt_stat) { + struct rtw_dm_info *dm_info =3D &rtwdev->dm_info; s8 rx_power; u8 lna_idx =3D 0; u8 vga_idx =3D 0; @@ -523,6 +524,7 @@ static void query_phy_status_page0(struct rtw_dev *rtwd= ev, u8 *phy_status, =20 pkt_stat->rx_power[RF_PATH_A] =3D rx_power; pkt_stat->rssi =3D rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 1); + dm_info->rssi[RF_PATH_A] =3D pkt_stat->rssi; pkt_stat->bw =3D RTW_CHANNEL_WIDTH_20; pkt_stat->signal_power =3D rx_power; } @@ -530,6 +532,7 @@ static void query_phy_status_page0(struct rtw_dev *rtwd= ev, u8 *phy_status, static void query_phy_status_page1(struct rtw_dev *rtwdev, u8 *phy_status, struct rtw_rx_pkt_stat *pkt_stat) { + struct rtw_dm_info *dm_info =3D &rtwdev->dm_info; u8 rxsc, bw; s8 min_rx_power =3D -120; =20 @@ -549,6 +552,7 @@ static void query_phy_status_page1(struct rtw_dev *rtwd= ev, u8 *phy_status, =20 pkt_stat->rx_power[RF_PATH_A] =3D GET_PHY_STAT_P1_PWDB_A(phy_status) - 11= 0; pkt_stat->rssi =3D rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 1); + dm_info->rssi[RF_PATH_A] =3D pkt_stat->rssi; pkt_stat->bw =3D bw; pkt_stat->signal_power =3D max(pkt_stat->rx_power[RF_PATH_A], min_rx_power); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68997C43334 for ; Tue, 7 Jun 2022 22:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383993AbiFGWJ5 (ORCPT ); Tue, 7 Jun 2022 18:09:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379375AbiFGVFy (ORCPT ); Tue, 7 Jun 2022 17:05:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99AD318E47F; Tue, 7 Jun 2022 11:49:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 66B68B8220B; Tue, 7 Jun 2022 18:49:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5CECC385A2; Tue, 7 Jun 2022 18:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627763; bh=MBi8JzpAoUKy5cp3Ar4hTl0Sf7G2CWS3MZih0JaaO5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eaYQOARUvcCIah9N7Jf9Ebkio8L0a8218aXOdTelKudiwDt26H+B60G9OxWJTkAu2 ZDERiarTFbDcPIa+nPXOBeVhd1Vgz5phNGMchhWq+vIt4K9tSg6Y6jFD5NebhFazOg szwFwW+UTJF/oLgNg9xia/zWVBPoJQNIPom/h7Uc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Vinod Koul , Geert Uytterhoeven , Mark Brown , Sasha Levin Subject: [PATCH 5.18 084/879] spi: spi-rspi: Remove setting {src,dst}_{addr,addr_width} based on DMA direction Date: Tue, 7 Jun 2022 18:53:22 +0200 Message-Id: <20220607165005.129247587@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Biju Das [ Upstream commit 6f381481a5b236cb53d6de2c49c6ef83a4d0f432 ] The direction field in the DMA config is deprecated. The rspi driver sets {src,dst}_{addr,addr_width} based on the DMA direction and it results in dmaengine_slave_config() failure as RZ DMAC driver validates {src,dst}_addr_width values independent of DMA direction. This patch fixes the issue by passing both {src,dst}_{addr,addr_width} values independent of DMA direction. Signed-off-by: Biju Das Suggested-by: Vinod Koul Reviewed-by: Vinod Koul Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20220411173115.6619-1-biju.das.jz@bp.renesa= s.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/spi/spi-rspi.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index bd5708d7e5a1..7a014eeec2d0 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c @@ -1108,14 +1108,11 @@ static struct dma_chan *rspi_request_dma_chan(struc= t device *dev, } =20 memset(&cfg, 0, sizeof(cfg)); + cfg.dst_addr =3D port_addr + RSPI_SPDR; + cfg.src_addr =3D port_addr + RSPI_SPDR; + cfg.dst_addr_width =3D DMA_SLAVE_BUSWIDTH_1_BYTE; + cfg.src_addr_width =3D DMA_SLAVE_BUSWIDTH_1_BYTE; cfg.direction =3D dir; - if (dir =3D=3D DMA_MEM_TO_DEV) { - cfg.dst_addr =3D port_addr; - cfg.dst_addr_width =3D DMA_SLAVE_BUSWIDTH_1_BYTE; - } else { - cfg.src_addr =3D port_addr; - cfg.src_addr_width =3D DMA_SLAVE_BUSWIDTH_1_BYTE; - } =20 ret =3D dmaengine_slave_config(chan, &cfg); if (ret) { @@ -1146,12 +1143,12 @@ static int rspi_request_dma(struct device *dev, str= uct spi_controller *ctlr, } =20 ctlr->dma_tx =3D rspi_request_dma_chan(dev, DMA_MEM_TO_DEV, dma_tx_id, - res->start + RSPI_SPDR); + res->start); if (!ctlr->dma_tx) return -ENODEV; =20 ctlr->dma_rx =3D rspi_request_dma_chan(dev, DMA_DEV_TO_MEM, dma_rx_id, - res->start + RSPI_SPDR); + res->start); if (!ctlr->dma_rx) { dma_release_channel(ctlr->dma_tx); ctlr->dma_tx =3D NULL; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8702CCA489 for ; Tue, 7 Jun 2022 22:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383663AbiFGWGI (ORCPT ); Tue, 7 Jun 2022 18:06:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379405AbiFGVFz (ORCPT ); Tue, 7 Jun 2022 17:05:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73F5118E47E; Tue, 7 Jun 2022 11:49:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7D5846156D; Tue, 7 Jun 2022 18:49:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89095C385A5; Tue, 7 Jun 2022 18:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627765; bh=mFZmCmXfkFOAG5ewdktFRxWxnqMPBYAH8t2tEQhXe+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P9HUP1DbnV8cFB12TOWTE+2ngn1VhqVZmh4XIQTzsQZJN1W3v5Rys8B1DpaQAANdy Yf7rleUBjlq+5ktqe1K5bn2OUjFvbxxM5REgsUFbYqToigRVvryobppR8rj7EG9EkV md58Gidu5+JaIbZrOi8htjOJ4JdwesIa+G0uuf0c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Pandruvada , Len Brown , Sasha Levin Subject: [PATCH 5.18 085/879] tools/power turbostat: fix ICX DRAM power numbers Date: Tue, 7 Jun 2022 18:53:23 +0200 Message-Id: <20220607165005.159684515@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Len Brown [ Upstream commit 6397b6418935773a34b533b3348b03f4ce3d7050 ] ICX (and its duplicates) require special hard-coded DRAM RAPL units, rather than using the generic RAPL energy units. Reported-by: Srinivas Pandruvada Signed-off-by: Len Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/power/x86/turbostat/turbostat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbos= tat/turbostat.c index bc5ae0872fed..babede4486de 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -4376,6 +4376,7 @@ static double rapl_dram_energy_units_probe(int model,= double rapl_energy_units) case INTEL_FAM6_BROADWELL_X: /* BDX */ case INTEL_FAM6_SKYLAKE_X: /* SKX */ case INTEL_FAM6_XEON_PHI_KNL: /* KNL */ + case INTEL_FAM6_ICELAKE_X: /* ICX */ return (rapl_dram_energy_units =3D 15.3 / 1000000); default: return (rapl_energy_units); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9F0CCCA48A for ; Tue, 7 Jun 2022 22:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383626AbiFGWGD (ORCPT ); Tue, 7 Jun 2022 18:06:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379414AbiFGVFz (ORCPT ); Tue, 7 Jun 2022 17:05:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9306918DAE3; Tue, 7 Jun 2022 11:49:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2FBC1616AF; Tue, 7 Jun 2022 18:49:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D7ECC385A5; Tue, 7 Jun 2022 18:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627768; bh=G8Lr5tC7exO+P44JmMYxw/QCR5EsrdoyP32XeHj5qcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2j834ykmfjyEZuhvzBCt+gpXKGZer9sT6onNE3NZGOtBx5Azg/BWork7XklboLOI2 rvnn+wh6DsiZII+ZDY0KFldOqhmR2VeLeBZDWSUWq5/OQl7YQ0r/i4EEnyfsueAQNz +lFD9AbjsMrENmS2An2r47OnyOypKlR7M4uzg0hU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 086/879] tcp: consume incoming skb leading to a reset Date: Tue, 7 Jun 2022 18:53:24 +0200 Message-Id: <20220607165005.189550617@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit d9d024f96609016628d750ebc8ee4a6f0d80e6e1 ] Whenever tcp_validate_incoming() handles a valid RST packet, we should not pretend the packet was dropped. Create a special section at the end of tcp_validate_incoming() to handle this case. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/ipv4/tcp_input.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 60f99e9fb6d1..1f3ce7aea716 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5711,7 +5711,7 @@ static bool tcp_validate_incoming(struct sock *sk, st= ruct sk_buff *skb, &tp->last_oow_ack_time)) tcp_send_dupack(sk, skb); } else if (tcp_reset_check(sk, skb)) { - tcp_reset(sk, skb); + goto reset; } goto discard; } @@ -5747,17 +5747,16 @@ static bool tcp_validate_incoming(struct sock *sk, = struct sk_buff *skb, } =20 if (rst_seq_match) - tcp_reset(sk, skb); - else { - /* Disable TFO if RST is out-of-order - * and no data has been received - * for current active TFO socket - */ - if (tp->syn_fastopen && !tp->data_segs_in && - sk->sk_state =3D=3D TCP_ESTABLISHED) - tcp_fastopen_active_disable(sk); - tcp_send_challenge_ack(sk); - } + goto reset; + + /* Disable TFO if RST is out-of-order + * and no data has been received + * for current active TFO socket + */ + if (tp->syn_fastopen && !tp->data_segs_in && + sk->sk_state =3D=3D TCP_ESTABLISHED) + tcp_fastopen_active_disable(sk); + tcp_send_challenge_ack(sk); goto discard; } =20 @@ -5782,6 +5781,11 @@ static bool tcp_validate_incoming(struct sock *sk, s= truct sk_buff *skb, discard: tcp_drop(sk, skb); return false; + +reset: + tcp_reset(sk, skb); + __kfree_skb(skb); + return false; } =20 /* --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45C29C433EF for ; Tue, 7 Jun 2022 22:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383982AbiFGWJz (ORCPT ); Tue, 7 Jun 2022 18:09:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379441AbiFGVF5 (ORCPT ); Tue, 7 Jun 2022 17:05:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AFEF18F2E1; Tue, 7 Jun 2022 11:49: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 C712C616C3; Tue, 7 Jun 2022 18:49:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D84DEC385A2; Tue, 7 Jun 2022 18:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627771; bh=MryhVYwL20qdpycWJZzLIYovOEL+Bs5lNHa/2TnV0EA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zR/0GN70zecaWHKTYH4KotHMeNz1X10cEx2N2EVOCkiaH6NH2cVM1yCjAq+CkbQfr kvo/u1h5riHY99v0drcrUEXOPf5j2YdAlVPABp5jT6lzLSVe2RVvxDyg/BjXw00GTY RGVzbBQkMJ9zEqgFQprX7GUuot439iFYa04l3WH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Jan Kara , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 087/879] loop: implement ->free_disk Date: Tue, 7 Jun 2022 18:53:25 +0200 Message-Id: <20220607165005.218796914@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig [ Upstream commit d2c7f56f8b5256d57f9e3fc7794c31361d43bdd9 ] Ensure that the lo_device which is stored in the gendisk private data is valid until the gendisk is freed. Currently the loop driver uses a lot of effort to make sure a device is not freed when it is still in use, but to to fix a potential deadlock this will be relaxed a bit soon. Signed-off-by: Christoph Hellwig Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220330052917.2566582-12-hch@lst.de Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/block/loop.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index a58595f5ee2c..ed7bec11948c 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1768,6 +1768,14 @@ static void lo_release(struct gendisk *disk, fmode_t= mode) mutex_unlock(&lo->lo_mutex); } =20 +static void lo_free_disk(struct gendisk *disk) +{ + struct loop_device *lo =3D disk->private_data; + + mutex_destroy(&lo->lo_mutex); + kfree(lo); +} + static const struct block_device_operations lo_fops =3D { .owner =3D THIS_MODULE, .open =3D lo_open, @@ -1776,6 +1784,7 @@ static const struct block_device_operations lo_fops = =3D { #ifdef CONFIG_COMPAT .compat_ioctl =3D lo_compat_ioctl, #endif + .free_disk =3D lo_free_disk, }; =20 /* @@ -2090,15 +2099,14 @@ static void loop_remove(struct loop_device *lo) { /* Make this loop device unreachable from pathname. */ del_gendisk(lo->lo_disk); - blk_cleanup_disk(lo->lo_disk); + blk_cleanup_queue(lo->lo_disk->queue); blk_mq_free_tag_set(&lo->tag_set); =20 mutex_lock(&loop_ctl_mutex); idr_remove(&loop_index_idr, lo->lo_number); mutex_unlock(&loop_ctl_mutex); - /* There is no route which can find this loop device. */ - mutex_destroy(&lo->lo_mutex); - kfree(lo); + + put_disk(lo->lo_disk); } =20 static void loop_probe(dev_t dev) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D28E1C433EF for ; Tue, 7 Jun 2022 22:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383904AbiFGWJg (ORCPT ); Tue, 7 Jun 2022 18:09:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379474AbiFGVF7 (ORCPT ); Tue, 7 Jun 2022 17:05:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39B5918F2EE; Tue, 7 Jun 2022 11:49:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CB76F616FF; Tue, 7 Jun 2022 18:49:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D35BAC385A2; Tue, 7 Jun 2022 18:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627774; bh=kdM3fNE5gu/C38KDzzmn5dQwtfjNDKoBsKPgDt1kxYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YENpRzuEfjIOs2D61Bh6R2C+BoNNm9W7StHLNGuBkqwy/6wu4KigxFADt9ymJRqdK eAX0TxT6U/dj73nNXfzrD3IkRtespqvoibyQqhPg8pDXE37tJ/yO0EuMMnQoc7c9Dj h/wvd/Wp0ioDs/HZVxr/Ti/6/Qt8EbCt4ZDdiCBo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 088/879] scsi: lpfc: Move cfg_log_verbose check before calling lpfc_dmp_dbg() Date: Tue, 7 Jun 2022 18:53:26 +0200 Message-Id: <20220607165005.247623393@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit e294647b1aed4247fe52851f3a3b2b19ae906228 ] In an attempt to log message 0126 with LOG_TRACE_EVENT, the following hard lockup call trace hangs the system. Call Trace: _raw_spin_lock_irqsave+0x32/0x40 lpfc_dmp_dbg.part.32+0x28/0x220 [lpfc] lpfc_cmpl_els_fdisc+0x145/0x460 [lpfc] lpfc_sli_cancel_jobs+0x92/0xd0 [lpfc] lpfc_els_flush_cmd+0x43c/0x670 [lpfc] lpfc_els_flush_all_cmd+0x37/0x60 [lpfc] lpfc_sli4_async_event_proc+0x956/0x1720 [lpfc] lpfc_do_work+0x1485/0x1d70 [lpfc] kthread+0x112/0x130 ret_from_fork+0x1f/0x40 Kernel panic - not syncing: Hard LOCKUP The same CPU tries to claim the phba->port_list_lock twice. Move the cfg_log_verbose checks as part of the lpfc_printf_vlog() and lpfc_printf_log() macros before calling lpfc_dmp_dbg(). There is no need to take the phba->port_list_lock within lpfc_dmp_dbg(). Link: https://lore.kernel.org/r/20220412222008.126521-3-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc_init.c | 29 +---------------------------- drivers/scsi/lpfc/lpfc_logmsg.h | 6 +++--- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 461d333b1b3a..f9cd4b72d949 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -15700,34 +15700,7 @@ void lpfc_dmp_dbg(struct lpfc_hba *phba) unsigned int temp_idx; int i; int j =3D 0; - unsigned long rem_nsec, iflags; - bool log_verbose =3D false; - struct lpfc_vport *port_iterator; - - /* Don't dump messages if we explicitly set log_verbose for the - * physical port or any vport. - */ - if (phba->cfg_log_verbose) - return; - - spin_lock_irqsave(&phba->port_list_lock, iflags); - list_for_each_entry(port_iterator, &phba->port_list, listentry) { - if (port_iterator->load_flag & FC_UNLOADING) - continue; - if (scsi_host_get(lpfc_shost_from_vport(port_iterator))) { - if (port_iterator->cfg_log_verbose) - log_verbose =3D true; - - scsi_host_put(lpfc_shost_from_vport(port_iterator)); - - if (log_verbose) { - spin_unlock_irqrestore(&phba->port_list_lock, - iflags); - return; - } - } - } - spin_unlock_irqrestore(&phba->port_list_lock, iflags); + unsigned long rem_nsec; =20 if (atomic_cmpxchg(&phba->dbg_log_dmping, 0, 1) !=3D 0) return; diff --git a/drivers/scsi/lpfc/lpfc_logmsg.h b/drivers/scsi/lpfc/lpfc_logms= g.h index 7d480c798794..a5aafe230c74 100644 --- a/drivers/scsi/lpfc/lpfc_logmsg.h +++ b/drivers/scsi/lpfc/lpfc_logmsg.h @@ -73,7 +73,7 @@ do { \ #define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \ do { \ { if (((mask) & (vport)->cfg_log_verbose) || (level[1] <=3D '3')) { \ - if ((mask) & LOG_TRACE_EVENT) \ + if ((mask) & LOG_TRACE_EVENT && !(vport)->cfg_log_verbose) \ lpfc_dmp_dbg((vport)->phba); \ dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \ fmt, (vport)->phba->brd_no, vport->vpi, ##arg); \ @@ -89,11 +89,11 @@ do { \ (phba)->pport->cfg_log_verbose : \ (phba)->cfg_log_verbose; \ if (((mask) & log_verbose) || (level[1] <=3D '3')) { \ - if ((mask) & LOG_TRACE_EVENT) \ + if ((mask) & LOG_TRACE_EVENT && !log_verbose) \ lpfc_dmp_dbg(phba); \ dev_printk(level, &((phba)->pcidev)->dev, "%d:" \ fmt, phba->brd_no, ##arg); \ - } else if (!(phba)->cfg_log_verbose)\ + } else if (!log_verbose)\ lpfc_dbg_print(phba, "%d:" fmt, phba->brd_no, ##arg); \ } \ } while (0) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B75EECCA47C for ; Tue, 7 Jun 2022 22:09:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383883AbiFGWJc (ORCPT ); Tue, 7 Jun 2022 18:09:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379495AbiFGVGA (ORCPT ); Tue, 7 Jun 2022 17:06:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E9E818FA46; Tue, 7 Jun 2022 11:49:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A18246156D; Tue, 7 Jun 2022 18:49:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADC9CC385A2; Tue, 7 Jun 2022 18:49:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627777; bh=2KToFwkNvNzfdHZcKKJhemrDipNoBJWJHSrlZBAWX2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YzN2RTVZrdjlBquOpoNF3hwhfLf0zsQ4N5C/TqYlwIK12ujEW4N9qxjChhqZOl2tM J7ROI6kfoneHXV/PsMbayXhpOmVHRYPL+tJI8XeJXQFmmeK7BOUsa0rkpmrgg//FJM XpcVOk3fI2m2b9aXcWTk194sA3SCuyfon2j5SvBs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 089/879] scsi: lpfc: Fix SCSI I/O completion and abort handler deadlock Date: Tue, 7 Jun 2022 18:53:27 +0200 Message-Id: <20220607165005.277544995@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit 03cbbd7c2f5ee288f648f4aeedc765a181188553 ] During stress I/O tests with 500+ vports, hard LOCKUP call traces are observed. CPU A: native_queued_spin_lock_slowpath+0x192 _raw_spin_lock_irqsave+0x32 lpfc_handle_fcp_err+0x4c6 lpfc_fcp_io_cmd_wqe_cmpl+0x964 lpfc_sli4_fp_handle_cqe+0x266 __lpfc_sli4_process_cq+0x105 __lpfc_sli4_hba_process_cq+0x3c lpfc_cq_poll_hdler+0x16 irq_poll_softirq+0x76 __softirqentry_text_start+0xe4 irq_exit+0xf7 do_IRQ+0x7f CPU B: native_queued_spin_lock_slowpath+0x5b _raw_spin_lock+0x1c lpfc_abort_handler+0x13e scmd_eh_abort_handler+0x85 process_one_work+0x1a7 worker_thread+0x30 kthread+0x112 ret_from_fork+0x1f Diagram of lockup: CPUA CPUB Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz ---- ---- lpfc_cmd->buf_lock phba->hbalock lpfc_cmd->buf_lock phba->hbalock Fix by reordering the taking of the lpfc_cmd->buf_lock and phba->hbalock in lpfc_abort_handler routine so that it tries to take the lpfc_cmd->buf_lock first before phba->hbalock. Link: https://lore.kernel.org/r/20220412222008.126521-7-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_scsi.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index ba9dbb51b75f..c4fa7d68fe03 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -5864,25 +5864,25 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) if (!lpfc_cmd) return ret; =20 - spin_lock_irqsave(&phba->hbalock, flags); + /* Guard against IO completion being called at same time */ + spin_lock_irqsave(&lpfc_cmd->buf_lock, flags); + + spin_lock(&phba->hbalock); /* driver queued commands are in process of being flushed */ if (phba->hba_flag & HBA_IOQ_FLUSH) { lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, "3168 SCSI Layer abort requested I/O has been " "flushed by LLD.\n"); ret =3D FAILED; - goto out_unlock; + goto out_unlock_hba; } =20 - /* Guard against IO completion being called at same time */ - spin_lock(&lpfc_cmd->buf_lock); - if (!lpfc_cmd->pCmd) { lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, "2873 SCSI Layer I/O Abort Request IO CMPL Status " "x%x ID %d LUN %llu\n", SUCCESS, cmnd->device->id, cmnd->device->lun); - goto out_unlock_buf; + goto out_unlock_hba; } =20 iocb =3D &lpfc_cmd->cur_iocbq; @@ -5890,7 +5890,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) pring_s4 =3D phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq->pring; if (!pring_s4) { ret =3D FAILED; - goto out_unlock_buf; + goto out_unlock_hba; } spin_lock(&pring_s4->ring_lock); } @@ -5923,8 +5923,8 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) "3389 SCSI Layer I/O Abort Request is pending\n"); if (phba->sli_rev =3D=3D LPFC_SLI_REV4) spin_unlock(&pring_s4->ring_lock); - spin_unlock(&lpfc_cmd->buf_lock); - spin_unlock_irqrestore(&phba->hbalock, flags); + spin_unlock(&phba->hbalock); + spin_unlock_irqrestore(&lpfc_cmd->buf_lock, flags); goto wait_for_cmpl; } =20 @@ -5945,15 +5945,13 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) if (ret_val !=3D IOCB_SUCCESS) { /* Indicate the IO is not being aborted by the driver. */ lpfc_cmd->waitq =3D NULL; - spin_unlock(&lpfc_cmd->buf_lock); - spin_unlock_irqrestore(&phba->hbalock, flags); ret =3D FAILED; - goto out; + goto out_unlock_hba; } =20 /* no longer need the lock after this point */ - spin_unlock(&lpfc_cmd->buf_lock); - spin_unlock_irqrestore(&phba->hbalock, flags); + spin_unlock(&phba->hbalock); + spin_unlock_irqrestore(&lpfc_cmd->buf_lock, flags); =20 if (phba->cfg_poll & DISABLE_FCP_RING_INT) lpfc_sli_handle_fast_ring_event(phba, @@ -5988,10 +5986,9 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) out_unlock_ring: if (phba->sli_rev =3D=3D LPFC_SLI_REV4) spin_unlock(&pring_s4->ring_lock); -out_unlock_buf: - spin_unlock(&lpfc_cmd->buf_lock); -out_unlock: - spin_unlock_irqrestore(&phba->hbalock, flags); +out_unlock_hba: + spin_unlock(&phba->hbalock); + spin_unlock_irqrestore(&lpfc_cmd->buf_lock, flags); out: lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, "0749 SCSI Layer I/O Abort Request Status x%x ID %d " --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16BBECCA483 for ; Tue, 7 Jun 2022 22:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384181AbiFGWK3 (ORCPT ); Tue, 7 Jun 2022 18:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379568AbiFGVGG (ORCPT ); Tue, 7 Jun 2022 17:06:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9DE71CA5C6; Tue, 7 Jun 2022 11:49:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0E439B82182; Tue, 7 Jun 2022 18:49:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 781F1C385A2; Tue, 7 Jun 2022 18:49:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627779; bh=Ft6p9kGIOkJkapwXK6jXCxSUMdE+m/EftAbFKlr8HL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U73O4Bur6M91fqHhJwkhpIlEMrH9Kk+FukSy8vJebVjdAJpPGdiji96xjNbVfGuM6 kGu2q+4I1AOqbF8rbiKxcpDJzRlIrjPTIDElbRQ8a/3nqfB7sSX2vq6XvKIW5/cJkL EMg0pAOopGj4fh6khJpbuqnCbQgZg0hITlYqBOJ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 090/879] scsi: lpfc: Fix null pointer dereference after failing to issue FLOGI and PLOGI Date: Tue, 7 Jun 2022 18:53:28 +0200 Message-Id: <20220607165005.306379954@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit 577a942df3de2666f6947bdd3a5c9e8d30073424 ] If lpfc_issue_els_flogi() fails and returns non-zero status, the node reference count is decremented to trigger the release of the nodelist structure. However, if there is a prior registration or dev-loss-evt work pending, the node may be released prematurely. When dev-loss-evt completes, the released node is referenced causing a use-after-free null pointer dereference. Similarly, when processing non-zero ELS PLOGI completion status in lpfc_cmpl_els_plogi(), the ndlp flags are checked for a transport registration before triggering node removal. If dev-loss-evt work is pending, the node may be released prematurely and a subsequent call to lpfc_dev_loss_tmo_handler() results in a use after free ndlp dereference. Add test for pending dev-loss before decrementing the node reference count for FLOGI, PLOGI, PRLI, and ADISC handling. Link: https://lore.kernel.org/r/20220412222008.126521-9-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc_els.c | 51 +++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 872a26376ccb..46a01a51b207 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -1532,10 +1532,13 @@ lpfc_initial_flogi(struct lpfc_vport *vport) } =20 if (lpfc_issue_els_flogi(vport, ndlp, 0)) { - /* This decrement of reference count to node shall kick off - * the release of the node. + /* A node reference should be retained while registered with a + * transport or dev-loss-evt work is pending. + * Otherwise, decrement node reference to trigger release. */ - lpfc_nlp_put(ndlp); + if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)) && + !(ndlp->nlp_flag & NLP_IN_DEV_LOSS)) + lpfc_nlp_put(ndlp); return 0; } return 1; @@ -1578,10 +1581,13 @@ lpfc_initial_fdisc(struct lpfc_vport *vport) } =20 if (lpfc_issue_els_fdisc(vport, ndlp, 0)) { - /* decrement node reference count to trigger the release of - * the node. + /* A node reference should be retained while registered with a + * transport or dev-loss-evt work is pending. + * Otherwise, decrement node reference to trigger release. */ - lpfc_nlp_put(ndlp); + if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)) && + !(ndlp->nlp_flag & NLP_IN_DEV_LOSS)) + lpfc_nlp_put(ndlp); return 0; } return 1; @@ -1983,6 +1989,7 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpf= c_iocbq *cmdiocb, int disc; struct serv_parm *sp =3D NULL; u32 ulp_status, ulp_word4, did, iotag; + bool release_node =3D false; =20 /* we pass cmdiocb to state machine which needs rspiocb as well */ cmdiocb->context_un.rsp_iocb =3D rspiocb; @@ -2071,19 +2078,21 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct l= pfc_iocbq *cmdiocb, spin_unlock_irq(&ndlp->lock); goto out; } - spin_unlock_irq(&ndlp->lock); =20 /* No PLOGI collision and the node is not registered with the * scsi or nvme transport. It is no longer an active node. Just * start the device remove process. */ if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD))) { - spin_lock_irq(&ndlp->lock); ndlp->nlp_flag &=3D ~NLP_NPR_2B_DISC; - spin_unlock_irq(&ndlp->lock); + if (!(ndlp->nlp_flag & NLP_IN_DEV_LOSS)) + release_node =3D true; + } + spin_unlock_irq(&ndlp->lock); + + if (release_node) lpfc_disc_state_machine(vport, ndlp, cmdiocb, NLP_EVT_DEVICE_RM); - } } else { /* Good status, call state machine */ prsp =3D list_entry(((struct lpfc_dmabuf *) @@ -2294,6 +2303,7 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc= _iocbq *cmdiocb, u32 loglevel; u32 ulp_status; u32 ulp_word4; + bool release_node =3D false; =20 /* we pass cmdiocb to state machine which needs rspiocb as well */ cmdiocb->context_un.rsp_iocb =3D rspiocb; @@ -2370,14 +2380,18 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lp= fc_iocbq *cmdiocb, * it is no longer an active node. Otherwise devloss * handles the final cleanup. */ + spin_lock_irq(&ndlp->lock); if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)) && !ndlp->fc4_prli_sent) { - spin_lock_irq(&ndlp->lock); ndlp->nlp_flag &=3D ~NLP_NPR_2B_DISC; - spin_unlock_irq(&ndlp->lock); + if (!(ndlp->nlp_flag & NLP_IN_DEV_LOSS)) + release_node =3D true; + } + spin_unlock_irq(&ndlp->lock); + + if (release_node) lpfc_disc_state_machine(vport, ndlp, cmdiocb, NLP_EVT_DEVICE_RM); - } } else { /* Good status, call state machine. However, if another * PRLI is outstanding, don't call the state machine @@ -2749,6 +2763,7 @@ lpfc_cmpl_els_adisc(struct lpfc_hba *phba, struct lpf= c_iocbq *cmdiocb, struct lpfc_nodelist *ndlp; int disc; u32 ulp_status, ulp_word4, tmo; + bool release_node =3D false; =20 /* we pass cmdiocb to state machine which needs rspiocb as well */ cmdiocb->context_un.rsp_iocb =3D rspiocb; @@ -2815,13 +2830,17 @@ lpfc_cmpl_els_adisc(struct lpfc_hba *phba, struct l= pfc_iocbq *cmdiocb, * transport, it is no longer an active node. Otherwise * devloss handles the final cleanup. */ + spin_lock_irq(&ndlp->lock); if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD))) { - spin_lock_irq(&ndlp->lock); ndlp->nlp_flag &=3D ~NLP_NPR_2B_DISC; - spin_unlock_irq(&ndlp->lock); + if (!(ndlp->nlp_flag & NLP_IN_DEV_LOSS)) + release_node =3D true; + } + spin_unlock_irq(&ndlp->lock); + + if (release_node) lpfc_disc_state_machine(vport, ndlp, cmdiocb, NLP_EVT_DEVICE_RM); - } } else /* Good status, call state machine */ lpfc_disc_state_machine(vport, ndlp, cmdiocb, --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C8D6CCA48B for ; Tue, 7 Jun 2022 22:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383765AbiFGWGS (ORCPT ); Tue, 7 Jun 2022 18:06:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379546AbiFGVGE (ORCPT ); Tue, 7 Jun 2022 17:06:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9E8B1CA5EA; Tue, 7 Jun 2022 11:49:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 23C58616B6; Tue, 7 Jun 2022 18:49:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31D30C385A5; Tue, 7 Jun 2022 18:49:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627782; bh=GfWpQ2f0XwiJpFMuX9ehdEugJEOsWkQR8NGeRHa91uU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A2JOD7Wkxp7ce+bT/xFdzMJFgj4XFKMoQyQGhoz2geWa0bxofXjrSY3Ow/TbHfFkk 0QIsh1EudL+SNrZ+sLGlj9vjkjE8kgmN7rWLMIfP3Ubj+990yj9L0awWiRWUtjDDVI TGM9LShDvtnOTTD23d9JaKTKq8CwVO5xv0qxCnlA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 091/879] scsi: lpfc: Protect memory leak for NPIV ports sending PLOGI_RJT Date: Tue, 7 Jun 2022 18:53:29 +0200 Message-Id: <20220607165005.334825025@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit 672d1cb40551ea9c95efad43ab6d45e4ab4e015f ] There is a potential memory leak in lpfc_ignore_els_cmpl() and lpfc_els_rsp_reject() that was allocated from NPIV PLOGI_RJT (lpfc_rcv_plogi()'s login_mbox). Check if cmdiocb->context_un.mbox was allocated in lpfc_ignore_els_cmpl(), and then free it back to phba->mbox_mem_pool along with mbox->ctx_buf for service parameters. For lpfc_els_rsp_reject() failure, free both the ctx_buf for service parameters and the login_mbox. Link: https://lore.kernel.org/r/20220412222008.126521-10-jsmart2021@gmail.c= om Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc_nportdisc.c | 10 ++++++++-- drivers/scsi/lpfc/lpfc_sli.c | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_np= ortdisc.c index c4e1a07066a2..4b065c51ee1b 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -614,9 +614,15 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_n= odelist *ndlp, stat.un.b.lsRjtRsnCode =3D LSRJT_INVALID_CMD; stat.un.b.lsRjtRsnCodeExp =3D LSEXP_NOTHING_MORE; rc =3D lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, - ndlp, login_mbox); - if (rc) + ndlp, login_mbox); + if (rc) { + mp =3D (struct lpfc_dmabuf *)login_mbox->ctx_buf; + if (mp) { + lpfc_mbuf_free(phba, mp->virt, mp->phys); + kfree(mp); + } mempool_free(login_mbox, phba->mbox_mem_pool); + } return 1; } =20 diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 6adaf79e67cc..09a45f8ecf3f 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -12066,6 +12066,8 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct = lpfc_iocbq *cmdiocb, { struct lpfc_nodelist *ndlp =3D NULL; IOCB_t *irsp; + LPFC_MBOXQ_t *mbox; + struct lpfc_dmabuf *mp; u32 ulp_command, ulp_status, ulp_word4, iotag; =20 ulp_command =3D get_job_cmnd(phba, cmdiocb); @@ -12077,6 +12079,21 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct= lpfc_iocbq *cmdiocb, } else { irsp =3D &rspiocb->iocb; iotag =3D irsp->ulpIoTag; + + /* It is possible a PLOGI_RJT for NPIV ports to get aborted. + * The MBX_REG_LOGIN64 mbox command is freed back to the + * mbox_mem_pool here. + */ + if (cmdiocb->context_un.mbox) { + mbox =3D cmdiocb->context_un.mbox; + mp =3D (struct lpfc_dmabuf *)mbox->ctx_buf; + if (mp) { + lpfc_mbuf_free(phba, mp->virt, mp->phys); + kfree(mp); + } + mempool_free(mbox, phba->mbox_mem_pool); + cmdiocb->context_un.mbox =3D NULL; + } } =20 /* ELS cmd tag completes */ --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8DC0C433EF for ; Tue, 7 Jun 2022 22:09:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351269AbiFGWJY (ORCPT ); Tue, 7 Jun 2022 18:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379569AbiFGVGG (ORCPT ); Tue, 7 Jun 2022 17:06:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BCA41F0FE8; Tue, 7 Jun 2022 11:49:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B1983B8220B; Tue, 7 Jun 2022 18:49:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2141AC385A5; Tue, 7 Jun 2022 18:49:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627785; bh=NQr4DnHVulh4RbREC1iNFCv8RKjtbaKcjTm0ZM5tSvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lwza+0FIK/iHzE/JosxV+v1GpzIbRPfH+mdLT0pEPckaMC4pYyP3svFBgs3gxQTzF nssUpM+fPEMzsaNb6dJV4uu2ePVZme6P64m+gli00cNiWgWi7RVXVvrP+RpxKHRIvq GJ4Y5Vnrm0xi6tBjHUIWjCqvn/6DdHXgluyrViAw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 092/879] scsi: lpfc: Fix call trace observed during I/O with CMF enabled Date: Tue, 7 Jun 2022 18:53:30 +0200 Message-Id: <20220607165005.362959230@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit d6d45f67a11136cb88a70a29ab22ea6db8ae6bd5 ] The following was seen with CMF enabled: BUG: using smp_processor_id() in preemptible code: systemd-udevd/31711 kernel: caller is lpfc_update_cmf_cmd+0x214/0x420 [lpfc] kernel: CPU: 12 PID: 31711 Comm: systemd-udevd kernel: Call Trace: kernel: kernel: dump_stack_lvl+0x44/0x57 kernel: check_preemption_disabled+0xbf/0xe0 kernel: lpfc_update_cmf_cmd+0x214/0x420 [lpfc] kernel: lpfc_nvme_fcp_io_submit+0x23b4/0x4df0 [lpfc] this_cpu_ptr() calls smp_processor_id() in a preemptible context. Fix by using per_cpu_ptr() with raw_smp_processor_id() instead. Link: https://lore.kernel.org/r/20220412222008.126521-16-jsmart2021@gmail.c= om Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc_scsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index c4fa7d68fe03..f617a2ef6b0f 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -3835,7 +3835,7 @@ lpfc_update_cmf_cmpl(struct lpfc_hba *phba, else time =3D div_u64(time + 500, 1000); /* round it */ =20 - cgs =3D this_cpu_ptr(phba->cmf_stat); + cgs =3D per_cpu_ptr(phba->cmf_stat, raw_smp_processor_id()); atomic64_add(size, &cgs->rcv_bytes); atomic64_add(time, &cgs->rx_latency); atomic_inc(&cgs->rx_io_cnt); @@ -3879,7 +3879,7 @@ lpfc_update_cmf_cmd(struct lpfc_hba *phba, uint32_t s= ize) atomic_set(&phba->rx_max_read_cnt, size); } =20 - cgs =3D this_cpu_ptr(phba->cmf_stat); + cgs =3D per_cpu_ptr(phba->cmf_stat, raw_smp_processor_id()); atomic64_add(size, &cgs->total_bytes); return 0; } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC4B6CCA48C for ; Tue, 7 Jun 2022 22:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383710AbiFGWGM (ORCPT ); Tue, 7 Jun 2022 18:06:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379550AbiFGVGE (ORCPT ); Tue, 7 Jun 2022 17:06:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A5801F5743; Tue, 7 Jun 2022 11:49:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7A383B81FE1; Tue, 7 Jun 2022 18:49:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0434C385A2; Tue, 7 Jun 2022 18:49:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627788; bh=NZOjF323UZNafxUxjZt3FD7HpP5qouR5J6a9gRbV+4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PjTC3V0nyUhmHdOcfgMSoR0dJmGpbP1L9UspIckf7X7DwwvmXvT/7VdJ9+KtoSt+R MfMc3hMyUgCiVrox7hzz+vLFMftQgRL2sFAdokT/dau9RMrwf6o1hacI6u2VEjHpW/ 9RWxyZZHObvVRw/+yw2gWrJU0iI1taQ0qSE9n3c0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maulik Shah , Ulf Hansson , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 093/879] cpuidle: PSCI: Improve support for suspend-to-RAM for PSCI OSI mode Date: Tue, 7 Jun 2022 18:53:31 +0200 Message-Id: <20220607165005.391570201@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ulf Hansson [ Upstream commit 171b66e2e2e9d80b93c8cff799e6175074b22297 ] When PSCI OSI mode is supported the syscore flag is set for the CPU devices that becomes attached to their PM domains (genpds). In the suspend-to-idle case, we call dev_pm_genpd_suspend|resume() to allow genpd to properly manage the power-off/on operations (pick an idlestate and manage the on/off notifications). For suspend-to-ram, dev_pm_genpd_suspend|resume() is currently not being called, which causes a problem that the genpd on/off notifiers do not get sent as expected. This prevents the platform-specific operations from being executed, typically needed just before/after the boot CPU is being turned off/on. To deal with this problem, let's register a syscore ops for cpuidle-psci when PSCI OSI mode is being used and call dev_pm_genpd_suspend|resume() from them. In this way, genpd regains control of the PM domain topology and then sends the on/off notifications when it's appropriate. Reported-by: Maulik Shah Suggested-by: Maulik Shah Signed-off-by: Ulf Hansson Tested-by: Maulik Shah Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/cpuidle/cpuidle-psci.c | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index b51b5df08450..540105ca0781 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -23,6 +23,7 @@ #include #include #include +#include =20 #include =20 @@ -131,6 +132,49 @@ static int psci_idle_cpuhp_down(unsigned int cpu) return 0; } =20 +static void psci_idle_syscore_switch(bool suspend) +{ + bool cleared =3D false; + struct device *dev; + int cpu; + + for_each_possible_cpu(cpu) { + dev =3D per_cpu_ptr(&psci_cpuidle_data, cpu)->dev; + + if (dev && suspend) { + dev_pm_genpd_suspend(dev); + } else if (dev) { + dev_pm_genpd_resume(dev); + + /* Account for userspace having offlined a CPU. */ + if (pm_runtime_status_suspended(dev)) + pm_runtime_set_active(dev); + + /* Clear domain state to re-start fresh. */ + if (!cleared) { + psci_set_domain_state(0); + cleared =3D true; + } + } + } +} + +static int psci_idle_syscore_suspend(void) +{ + psci_idle_syscore_switch(true); + return 0; +} + +static void psci_idle_syscore_resume(void) +{ + psci_idle_syscore_switch(false); +} + +static struct syscore_ops psci_idle_syscore_ops =3D { + .suspend =3D psci_idle_syscore_suspend, + .resume =3D psci_idle_syscore_resume, +}; + static void psci_idle_init_cpuhp(void) { int err; @@ -138,6 +182,8 @@ static void psci_idle_init_cpuhp(void) if (!psci_cpuidle_use_cpuhp) return; =20 + register_syscore_ops(&psci_idle_syscore_ops); + err =3D cpuhp_setup_state_nocalls(CPUHP_AP_CPU_PM_STARTING, "cpuidle/psci:online", psci_idle_cpuhp_up, --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D20ACCA48E for ; Tue, 7 Jun 2022 22:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383788AbiFGWG3 (ORCPT ); Tue, 7 Jun 2022 18:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379655AbiFGVGL (ORCPT ); Tue, 7 Jun 2022 17:06:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6B4720EEB2; Tue, 7 Jun 2022 11:49:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 29ED2B8237F; Tue, 7 Jun 2022 18:49:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DF75C385A2; Tue, 7 Jun 2022 18:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627793; bh=PBnEfVX85LaiNjq5AuHLvIpM2RMwLs/8cNoj0GuK3cU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ghr5FZA3LrUc2JJi/KGDJRXShBxSECcVogG0sX2bxHlo9QEOiogLZh8PqkI3jMekk Yb7U4s+NPkyguyQBHC0MoYvC2Pn/5CnhLPZrL6LvDG324/lv9BJr6+RHqsdiTuSaeE MiRGMTfHZTurmnEbPGjvabMutILndtkv1QcmSAd0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huang Rui , Aaron Liu , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 094/879] drm/amdgpu/pm: fix the null pointer while the smu is disabled Date: Tue, 7 Jun 2022 18:53:32 +0200 Message-Id: <20220607165005.420757847@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Huang Rui [ Upstream commit eea5c7b3390c6e006ba4cbd906447dd8cea8cfbf ] It needs to check if the pp_funcs is initialized while release the context, otherwise it will trigger null pointer panic while the software smu is not enabled. [ 1109.404555] BUG: kernel NULL pointer dereference, address: 0000000000000= 078 [ 1109.404609] #PF: supervisor read access in kernel mode [ 1109.404638] #PF: error_code(0x0000) - not-present page [ 1109.404657] PGD 0 P4D 0 [ 1109.404672] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 1109.404701] CPU: 7 PID: 9150 Comm: amdgpu_test Tainted: G OEL = 5.16.0-custom #1 [ 1109.404732] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS Virt= ualBox 12/01/2006 [ 1109.404765] RIP: 0010:amdgpu_dpm_force_performance_level+0x1d/0x170 [amd= gpu] [ 1109.405109] Code: 5d c3 44 8b a3 f0 80 00 00 eb e5 66 90 0f 1f 44 00 00 = 55 48 89 e5 41 57 41 56 41 55 41 54 53 48 83 ec 08 4c 8b b7 f0 7d 00 00 <49= > 83 7e 78 00 0f 84 f2 00 00 00 80 bf 87 80 00 00 00 48 89 fb 0f [ 1109.405176] RSP: 0018:ffffaf3083ad7c20 EFLAGS: 00010282 [ 1109.405203] RAX: 0000000000000000 RBX: ffff9796b1c14600 RCX: 00000000028= 62007 [ 1109.405229] RDX: ffff97968591c8c0 RSI: 0000000000000001 RDI: ffff9796a37= 00000 [ 1109.405260] RBP: ffffaf3083ad7c50 R08: ffffffff9897de00 R09: ffff979688d= 9db60 [ 1109.405286] R10: 0000000000000000 R11: ffff979688d9db90 R12: 00000000000= 00001 [ 1109.405316] R13: ffff9796a3700000 R14: 0000000000000000 R15: ffff9796a37= 08fc0 [ 1109.405345] FS: 00007ff055cff180(0000) GS:ffff9796bfdc0000(0000) knlGS:= 0000000000000000 [ 1109.405378] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1109.405400] CR2: 0000000000000078 CR3: 000000000a394000 CR4: 00000000000= 506e0 [ 1109.405434] Call Trace: [ 1109.405445] [ 1109.405456] ? delete_object_full+0x1d/0x20 [ 1109.405480] amdgpu_ctx_set_stable_pstate+0x7c/0xa0 [amdgpu] [ 1109.405698] amdgpu_ctx_fini.part.0+0xcb/0x100 [amdgpu] [ 1109.405911] amdgpu_ctx_do_release+0x71/0x80 [amdgpu] [ 1109.406121] amdgpu_ctx_ioctl+0x52d/0x550 [amdgpu] [ 1109.406327] ? _raw_spin_unlock+0x1a/0x30 [ 1109.406354] ? drm_gem_handle_delete+0x81/0xb0 [drm] [ 1109.406400] ? amdgpu_ctx_get_entity+0x2c0/0x2c0 [amdgpu] [ 1109.406609] drm_ioctl_kernel+0xb6/0x140 [drm] Signed-off-by: Huang Rui Reviewed-by: Aaron Liu Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/a= mdgpu_dpm.c index 72e7b5d40af6..5472f9936feb 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c @@ -790,7 +790,7 @@ int amdgpu_dpm_force_performance_level(struct amdgpu_de= vice *adev, AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK | AMD_DPM_FORCED_LEVEL_PROFILE_PEAK; =20 - if (!pp_funcs->force_performance_level) + if (!pp_funcs || !pp_funcs->force_performance_level) return 0; =20 if (adev->pm.dpm.thermal_active) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0571CC433EF for ; Tue, 7 Jun 2022 22:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358289AbiFGWJF (ORCPT ); Tue, 7 Jun 2022 18:09:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379703AbiFGVGP (ORCPT ); Tue, 7 Jun 2022 17:06:15 -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 CD3F52109D6; Tue, 7 Jun 2022 11:50:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ED681B81FE1; Tue, 7 Jun 2022 18:49:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 610DEC385A2; Tue, 7 Jun 2022 18:49:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627796; bh=Sn2E5T7+eZANOZsUBkk4ShXP8E0TUT3ruFCM8ktCFR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OYMn5ibTP6E5H8TS4asnICu2Yj7fngka75HK44yy2mj4sJHVQGayy+uD/cjS9ZZbv GjmUPzzA63XgRnrVkGmZapuNJtaatKkRwEKrh7uhWah1wHxFq/j5VP292D+5r1vLOm KvhEdfPOiUpObbgw3svBL0y/bXSK7I7KKk7xEhY4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keita Suzuki , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 095/879] drm/amd/pm: fix double free in si_parse_power_table() Date: Tue, 7 Jun 2022 18:53:33 +0200 Message-Id: <20220607165005.450407171@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keita Suzuki [ Upstream commit f3fa2becf2fc25b6ac7cf8d8b1a2e4a86b3b72bd ] In function si_parse_power_table(), array adev->pm.dpm.ps and its member is allocated. If the allocation of each member fails, the array itself is freed and returned with an error code. However, the array is later freed again in si_dpm_fini() function which is called when the function returns an error. This leads to potential double free of the array adev->pm.dpm.ps, as well as leak of its array members, since the members are not freed in the allocation function and the array is not nulled when freed. In addition adev->pm.dpm.num_ps, which keeps track of the allocated array member, is not updated until the member allocation is successfully finished, this could also lead to either use after free, or uninitialized variable access in si_dpm_fini(). Fix this by postponing the free of the array until si_dpm_fini() and increment adev->pm.dpm.num_ps everytime the array member is allocated. Signed-off-by: Keita Suzuki Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c b/drivers/gpu/drm/a= md/pm/legacy-dpm/si_dpm.c index 633dab14f51c..49c398ec0aaf 100644 --- a/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +++ b/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c @@ -7297,17 +7297,15 @@ static int si_parse_power_table(struct amdgpu_devic= e *adev) if (!adev->pm.dpm.ps) return -ENOMEM; power_state_offset =3D (u8 *)state_array->states; - for (i =3D 0; i < state_array->ucNumEntries; i++) { + for (adev->pm.dpm.num_ps =3D 0, i =3D 0; i < state_array->ucNumEntries; i= ++) { u8 *idx; power_state =3D (union pplib_power_state *)power_state_offset; non_clock_array_index =3D power_state->v2.nonClockInfoIndex; non_clock_info =3D (struct _ATOM_PPLIB_NONCLOCK_INFO *) &non_clock_info_array->nonClockInfo[non_clock_array_index]; ps =3D kzalloc(sizeof(struct si_ps), GFP_KERNEL); - if (ps =3D=3D NULL) { - kfree(adev->pm.dpm.ps); + if (ps =3D=3D NULL) return -ENOMEM; - } adev->pm.dpm.ps[i].ps_priv =3D ps; si_parse_pplib_non_clock_info(adev, &adev->pm.dpm.ps[i], non_clock_info, @@ -7329,8 +7327,8 @@ static int si_parse_power_table(struct amdgpu_device = *adev) k++; } power_state_offset +=3D 2 + power_state->v2.ucNumDPMLevels; + adev->pm.dpm.num_ps++; } - adev->pm.dpm.num_ps =3D state_array->ucNumEntries; =20 /* fill in the vce power states */ for (i =3D 0; i < adev->pm.dpm.num_of_vce_states; i++) { --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BB3BCCA48D for ; Tue, 7 Jun 2022 22:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383808AbiFGWGd (ORCPT ); Tue, 7 Jun 2022 18:06:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379702AbiFGVGP (ORCPT ); Tue, 7 Jun 2022 17:06:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA1B20FC78; Tue, 7 Jun 2022 11:50:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C2A5EB82391; Tue, 7 Jun 2022 18:50:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A933C385A2; Tue, 7 Jun 2022 18:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627799; bh=e4rQjDbcX7pYuLi/MagzF5WQm9G9+qVy7DrNZMANN00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wg7KUYJe+KcdapDlENFDpXmeTX8NeR1FjWL1L8+WBsQGkwMPzGm8WB23eVdQAzIYJ Y7KwnglzI9qfMUnIi2O8p5x9hAsH+3Q3XsCJTv6Rxly/yoE0+r5s8vv/oZcDA2vB7I k7JmTuuuZSHitJVDZXHT+SUKiVNvTm+IE4HZXWGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Kuninori Morimoto , Mark Brown , Sasha Levin Subject: [PATCH 5.18 096/879] ASoC: rsnd: care default case on rsnd_ssiu_busif_err_status_clear() Date: Tue, 7 Jun 2022 18:53:34 +0200 Message-Id: <20220607165005.479481319@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuninori Morimoto [ Upstream commit b1384d4c95088d01f4266237faabf165d3d605fc ] commit cfb7b8bf1e2d66 ("ASoC: rsnd: tidyup rsnd_ssiu_busif_err_status_clear()") merged duplicate code, but it didn't care about default case, and causes smatch warnings. smatch warnings: sound/soc/sh/rcar/ssiu.c:112 rsnd_ssiu_busif_err_status_clear() \ error: uninitialized symbol 'offset'. sound/soc/sh/rcar/ssiu.c:114 rsnd_ssiu_busif_err_status_clear() \ error: uninitialized symbol 'shift'. This patch cares it. Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/87r15rgn6p.wl-kuninori.morimoto.gx@renesas.= com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/sh/rcar/ssiu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c index 0d8f97633dd2..138f95dd9f4a 100644 --- a/sound/soc/sh/rcar/ssiu.c +++ b/sound/soc/sh/rcar/ssiu.c @@ -102,6 +102,8 @@ bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *= mod) shift =3D 1; offset =3D 1; break; + default: + goto out; } =20 for (i =3D 0; i < 4; i++) { @@ -120,7 +122,7 @@ bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *= mod) } rsnd_mod_write(mod, reg, val); } - +out: return error; } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E55DC43334 for ; Tue, 7 Jun 2022 22:08:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383911AbiFGWIn (ORCPT ); Tue, 7 Jun 2022 18:08:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379790AbiFGVG0 (ORCPT ); Tue, 7 Jun 2022 17:06:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1EC620FC40; Tue, 7 Jun 2022 11:50:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 935A2B82182; Tue, 7 Jun 2022 18:50:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DB45C385A2; Tue, 7 Jun 2022 18:50:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627802; bh=z4wDMbAV2RS1G7aP/5ULZccvzCp/6WBnP3rMRzqLcME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZOiWZD5g2CpZW0SNsSlxqdM+76ILcNwrfl1JqM97u0nX5AYHMDVPdpAjmQugzU7Yo NG19ZtbV/1+K1n6NgPIUd5FXEXt7I5PA5rySRuBTTgMeWq0Ubhpr8evIiNl1IWBoUb fqIXDxdqD8fMPsUlxhRpGFCKW/+0XfHf4UlCoI3M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Kuninori Morimoto , Mark Brown , Sasha Levin Subject: [PATCH 5.18 097/879] ASoC: rsnd: care return value from rsnd_node_fixed_index() Date: Tue, 7 Jun 2022 18:53:35 +0200 Message-Id: <20220607165005.510400183@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuninori Morimoto [ Upstream commit d09a7db431c65aaa8303eb456439d1831ca2e6b4 ] Renesas Sound is very complex, and thus it needs to use rsnd_node_fixed_index() to know enabled pin index. It returns error if strange pin was selected, but some codes didn't check it. This patch 1) indicates error message, 2) check return value. Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/87pmlbgn5t.wl-kuninori.morimoto.gx@renesas.= com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/sh/rcar/core.c | 15 ++++++++++----- sound/soc/sh/rcar/dma.c | 9 ++++++++- sound/soc/sh/rcar/rsnd.h | 2 +- sound/soc/sh/rcar/src.c | 7 ++++++- sound/soc/sh/rcar/ssi.c | 14 ++++++++++++-- sound/soc/sh/rcar/ssiu.c | 7 ++++++- 6 files changed, 43 insertions(+), 11 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 6a8fe0da7670..af8ef2a27d34 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1159,6 +1159,7 @@ void rsnd_parse_connect_common(struct rsnd_dai *rdai,= char *name, struct device_node *capture) { struct rsnd_priv *priv =3D rsnd_rdai_to_priv(rdai); + struct device *dev =3D rsnd_priv_to_dev(priv); struct device_node *np; int i; =20 @@ -1169,7 +1170,11 @@ void rsnd_parse_connect_common(struct rsnd_dai *rdai= , char *name, for_each_child_of_node(node, np) { struct rsnd_mod *mod; =20 - i =3D rsnd_node_fixed_index(np, name, i); + i =3D rsnd_node_fixed_index(dev, np, name, i); + if (i < 0) { + of_node_put(np); + break; + } =20 mod =3D mod_get(priv, i); =20 @@ -1183,7 +1188,7 @@ void rsnd_parse_connect_common(struct rsnd_dai *rdai,= char *name, of_node_put(node); } =20 -int rsnd_node_fixed_index(struct device_node *node, char *name, int idx) +int rsnd_node_fixed_index(struct device *dev, struct device_node *node, ch= ar *name, int idx) { char node_name[16]; =20 @@ -1210,6 +1215,8 @@ int rsnd_node_fixed_index(struct device_node *node, c= har *name, int idx) return idx; } =20 + dev_err(dev, "strange node numbering (%s)", + of_node_full_name(node)); return -EINVAL; } =20 @@ -1221,10 +1228,8 @@ int rsnd_node_count(struct rsnd_priv *priv, struct d= evice_node *node, char *name =20 i =3D 0; for_each_child_of_node(node, np) { - i =3D rsnd_node_fixed_index(np, name, i); + i =3D rsnd_node_fixed_index(dev, np, name, i); if (i < 0) { - dev_err(dev, "strange node numbering (%s)", - of_node_full_name(node)); of_node_put(np); return 0; } diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c index 03e0d4eca781..463ab237d7bd 100644 --- a/sound/soc/sh/rcar/dma.c +++ b/sound/soc/sh/rcar/dma.c @@ -240,12 +240,19 @@ static int rsnd_dmaen_start(struct rsnd_mod *mod, struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node, cha= r *name, struct rsnd_mod *mod, char *x) { + struct rsnd_priv *priv =3D rsnd_mod_to_priv(mod); + struct device *dev =3D rsnd_priv_to_dev(priv); struct dma_chan *chan =3D NULL; struct device_node *np; int i =3D 0; =20 for_each_child_of_node(of_node, np) { - i =3D rsnd_node_fixed_index(np, name, i); + i =3D rsnd_node_fixed_index(dev, np, name, i); + if (i < 0) { + chan =3D NULL; + of_node_put(np); + break; + } =20 if (i =3D=3D rsnd_mod_id_raw(mod) && (!chan)) chan =3D of_dma_request_slave_channel(np, x); diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index 6580bab0e229..d9cd190d7e19 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -460,7 +460,7 @@ void rsnd_parse_connect_common(struct rsnd_dai *rdai, c= har *name, struct device_node *playback, struct device_node *capture); int rsnd_node_count(struct rsnd_priv *priv, struct device_node *node, char= *name); -int rsnd_node_fixed_index(struct device_node *node, char *name, int idx); +int rsnd_node_fixed_index(struct device *dev, struct device_node *node, ch= ar *name, int idx); =20 int rsnd_channel_normalization(int chan); #define rsnd_runtime_channel_original(io) \ diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index 42a100c6303d..0ea84ae57c6a 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -676,7 +676,12 @@ int rsnd_src_probe(struct rsnd_priv *priv) if (!of_device_is_available(np)) goto skip; =20 - i =3D rsnd_node_fixed_index(np, SRC_NAME, i); + i =3D rsnd_node_fixed_index(dev, np, SRC_NAME, i); + if (i < 0) { + ret =3D -EINVAL; + of_node_put(np); + goto rsnd_src_probe_done; + } =20 src =3D rsnd_src_get(priv, i); =20 diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 87e606f688d3..43c5e27dc5c8 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -1105,6 +1105,7 @@ void rsnd_parse_connect_ssi(struct rsnd_dai *rdai, struct device_node *capture) { struct rsnd_priv *priv =3D rsnd_rdai_to_priv(rdai); + struct device *dev =3D rsnd_priv_to_dev(priv); struct device_node *node; struct device_node *np; int i; @@ -1117,7 +1118,11 @@ void rsnd_parse_connect_ssi(struct rsnd_dai *rdai, for_each_child_of_node(node, np) { struct rsnd_mod *mod; =20 - i =3D rsnd_node_fixed_index(np, SSI_NAME, i); + i =3D rsnd_node_fixed_index(dev, np, SSI_NAME, i); + if (i < 0) { + of_node_put(np); + break; + } =20 mod =3D rsnd_ssi_mod_get(priv, i); =20 @@ -1182,7 +1187,12 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) if (!of_device_is_available(np)) goto skip; =20 - i =3D rsnd_node_fixed_index(np, SSI_NAME, i); + i =3D rsnd_node_fixed_index(dev, np, SSI_NAME, i); + if (i < 0) { + ret =3D -EINVAL; + of_node_put(np); + goto rsnd_ssi_probe_done; + } =20 ssi =3D rsnd_ssi_get(priv, i); =20 diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c index 138f95dd9f4a..4b8a63e336c7 100644 --- a/sound/soc/sh/rcar/ssiu.c +++ b/sound/soc/sh/rcar/ssiu.c @@ -462,6 +462,7 @@ void rsnd_parse_connect_ssiu(struct rsnd_dai *rdai, struct device_node *capture) { struct rsnd_priv *priv =3D rsnd_rdai_to_priv(rdai); + struct device *dev =3D rsnd_priv_to_dev(priv); struct device_node *node =3D rsnd_ssiu_of_node(priv); struct rsnd_dai_stream *io_p =3D &rdai->playback; struct rsnd_dai_stream *io_c =3D &rdai->capture; @@ -474,7 +475,11 @@ void rsnd_parse_connect_ssiu(struct rsnd_dai *rdai, for_each_child_of_node(node, np) { struct rsnd_mod *mod; =20 - i =3D rsnd_node_fixed_index(np, SSIU_NAME, i); + i =3D rsnd_node_fixed_index(dev, np, SSIU_NAME, i); + if (i < 0) { + of_node_put(np); + break; + } =20 mod =3D rsnd_ssiu_mod_get(priv, i); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10C3FC43334 for ; Tue, 7 Jun 2022 22:08:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378196AbiFGWIF (ORCPT ); Tue, 7 Jun 2022 18:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379814AbiFGVG3 (ORCPT ); Tue, 7 Jun 2022 17:06:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13AD421110C; Tue, 7 Jun 2022 11:50:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C699A616B6; Tue, 7 Jun 2022 18:50:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D307BC385A2; Tue, 7 Jun 2022 18:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627805; bh=TR74+tfIx5LPTfO6NYsObBj1oQozGcliwE9T2Z1bW0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u5mYNW03BS6tRjBIzJT0PR76vkfk7F4tCtW12KqLxQO4yP9jNwLIRBwT6NrHLuc7/ 1BdKjFCz9oe50/VWRWwANkdTJXNrieKb4Oa3t91oH2/ZaxdmMvDBOtZWFW9KCXs/vS KgLCXpiDAI79VGNno8tMELXnKS6KFMKrmIgWvNYs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Radhey Shyam Pandey , Michal Simek , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 098/879] net: macb: In ZynqMP initialization make SGMII phy configuration optional Date: Tue, 7 Jun 2022 18:53:36 +0200 Message-Id: <20220607165005.539894668@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Radhey Shyam Pandey [ Upstream commit 29e96fe9e0ec0f0fe1dd306a4ccb7b8983eae67a ] In the macb binding documentation "phys" is an optional property. Make implementation in line with it. This change allows the traditional flow in which first stage bootloader does PS-GT configuration to work along with newer use cases in which PS-GT configuration is managed by the phy-zynqmp driver. It fixes below macb probe failure when macb DT node doesn't have SGMII phys handle. "macb ff0b0000.ethernet: error -ENODEV: failed to get PS-GTR PHY" Signed-off-by: Radhey Shyam Pandey Reviewed-by: Michal Simek Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 61284baa0496..ed7c2c2c4401 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4594,7 +4594,7 @@ static int zynqmp_init(struct platform_device *pdev) =20 if (bp->phy_interface =3D=3D PHY_INTERFACE_MODE_SGMII) { /* Ensure PS-GTR PHY device used in SGMII mode is ready */ - bp->sgmii_phy =3D devm_phy_get(&pdev->dev, "sgmii-phy"); + bp->sgmii_phy =3D devm_phy_optional_get(&pdev->dev, NULL); =20 if (IS_ERR(bp->sgmii_phy)) { ret =3D PTR_ERR(bp->sgmii_phy); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7371DC43334 for ; Tue, 7 Jun 2022 22:08:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383741AbiFGWIM (ORCPT ); Tue, 7 Jun 2022 18:08:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379825AbiFGVG3 (ORCPT ); Tue, 7 Jun 2022 17:06:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EF34211A80; Tue, 7 Jun 2022 11:50:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8E4C8616A9; Tue, 7 Jun 2022 18:50:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C32AC385A2; Tue, 7 Jun 2022 18:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627808; bh=6GPI7gYf07+zFN1Ol/tp6iH7PZSLrK3qLnRFMdReihY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZmE07VN8UPkiWpueXcvUsKI4TgS622TAMhIhGVE6QJ1AeJfai3SJTy/UQRoERJ/42 TuueJ9K+SjRUSsW793geBcfibrSHfYxy+V4j7aWIbuCqQ/bGohxY0GPSJwDw4dd0cT YsYxEz1T6TNQwdTNCD467/1nPVsIC8yeq3FD5M1Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Thibaut=20VAR=C3=88NE?= , Felix Fietkau , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 099/879] ath9k: fix QCA9561 PA bias level Date: Tue, 7 Jun 2022 18:53:37 +0200 Message-Id: <20220607165005.569010385@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thibaut VAR=C3=88NE [ Upstream commit e999a5da28a0e0f7de242d841ef7d5e48f4646ae ] This patch fixes an invalid TX PA DC bias level on QCA9561, which results in a very low output power and very low throughput as devices are further away from the AP (compared to other 2.4GHz APs). This patch was suggested by Felix Fietkau, who noted[1]: "The value written to that register is wrong, because while the mask definition AR_CH0_TOP2_XPABIASLVL uses a different value for 9561, the shift definition AR_CH0_TOP2_XPABIASLVL_S is hardcoded to 12, which is wrong for 9561." In real life testing, without this patch the 2.4GHz throughput on Yuncore XD3200 is around 10Mbps sitting next to the AP, and closer to practical maximum with the patch applied. [1] https://lore.kernel.org/all/91c58969-c60e-2f41-00ac-737786d435ae@nbd.na= me Signed-off-by: Thibaut VAR=C3=88NE Acked-by: Felix Fietkau Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220417145145.1847-1-hacks+kernel@slashdir= t.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath9k/ar9003_phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wire= less/ath/ath9k/ar9003_phy.h index a171dbb29fbb..ad949eb02f3d 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h @@ -720,7 +720,7 @@ #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \ (AR_SREV_9462(ah) ? 0x16290 : 0x16284)) #define AR_CH0_TOP2_XPABIASLVL (AR_SREV_9561(ah) ? 0x1e00 : 0xf000) -#define AR_CH0_TOP2_XPABIASLVL_S 12 +#define AR_CH0_TOP2_XPABIASLVL_S (AR_SREV_9561(ah) ? 9 : 12) =20 #define AR_CH0_XTAL (AR_SREV_9300(ah) ? 0x16294 : \ ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16298 : \ --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1B91C433EF for ; Tue, 7 Jun 2022 22:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383583AbiFGWIz (ORCPT ); Tue, 7 Jun 2022 18:08:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379729AbiFGVGQ (ORCPT ); Tue, 7 Jun 2022 17:06:16 -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 BD1462109FC; Tue, 7 Jun 2022 11:50:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3F98361734; Tue, 7 Jun 2022 18:50:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FE90C385A5; Tue, 7 Jun 2022 18:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627810; bh=CHObYO3QTAakNe5T3Fe914iXUbpSy1aT88lWYZtUQ/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DdWjTtJMisMc+TDXrS+pSGp4xjALh81EB7M+cVpbddyONwjR9SxtcZJu6lFNeFtJ/ zhFKccXY636b/Fj4B4Pf8M/Wnk4Z1Kj0RHIHWqPFkvtTXZXmKM5z5Bij2EHvc+x1Jk 6XyfABvz+veIGTOZVndYtwZR82jqtoA4F9tbPebM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sakari Ailus , Tomasz Figa , Bingbu Cao , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 100/879] media: Revert "media: dw9768: activate runtime PM and turn off device" Date: Tue, 7 Jun 2022 18:53:38 +0200 Message-Id: <20220607165005.598260361@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sakari Ailus [ Upstream commit 7dd0f93a31af03cba81c684c4c361bba510ffe71 ] This reverts commit c09d776eaa060534a1663e3b89d842db3e1d9076. Revert the commit as it breaks runtime PM support on OF based systems. More fixes to the driver are needed. Signed-off-by: Sakari Ailus Reviewed-by: Tomasz Figa Reviewed-by: Bingbu Cao Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/i2c/dw9768.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/media/i2c/dw9768.c b/drivers/media/i2c/dw9768.c index 65c6acf3ced9..c086580efac7 100644 --- a/drivers/media/i2c/dw9768.c +++ b/drivers/media/i2c/dw9768.c @@ -469,11 +469,6 @@ static int dw9768_probe(struct i2c_client *client) =20 dw9768->sd.entity.function =3D MEDIA_ENT_F_LENS; =20 - /* - * Device is already turned on by i2c-core with ACPI domain PM. - * Attempt to turn off the device to satisfy the privacy LED concerns. - */ - pm_runtime_set_active(dev); pm_runtime_enable(dev); if (!pm_runtime_enabled(dev)) { ret =3D dw9768_runtime_resume(dev); @@ -488,7 +483,6 @@ static int dw9768_probe(struct i2c_client *client) dev_err(dev, "failed to register V4L2 subdev: %d", ret); goto err_power_off; } - pm_runtime_idle(dev); =20 return 0; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71629CCA491 for ; Tue, 7 Jun 2022 22:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242746AbiFGWGr (ORCPT ); Tue, 7 Jun 2022 18:06:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379863AbiFGVGb (ORCPT ); Tue, 7 Jun 2022 17:06:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33F2621228F; Tue, 7 Jun 2022 11:50:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B3485B8239B; Tue, 7 Jun 2022 18:50:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 205AAC385A2; Tue, 7 Jun 2022 18:50:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627813; bh=cnzevXgz+waa72ojOU4KwgyU+p6nulyrqLCnlw984fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HgJDhKOwT8mjef0djt+BaLNz76ovYO6By4Lovbwl6aDEXalx0BQqt/hfY1laBQvYf UEcXRYBCctPyYEQIqD0lzgpjS02gjJibGV8ZitoanBjyWkQejgd8mPJiAyC1V3jDVm WykEInfDWT6GkXm3sMdtSuCzQq4TP2XmSLJNqgw8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 101/879] media: i2c: dw9714: Disable the regulator when the driver fails to probe Date: Tue, 7 Jun 2022 18:53:39 +0200 Message-Id: <20220607165005.628589270@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma [ Upstream commit 02276e18defa2fccf16413b44440277d98c2b1ea ] When the driver fails to probe, we will get the following splat: [ 59.305988] ------------[ cut here ]------------ [ 59.306417] WARNING: CPU: 2 PID: 395 at drivers/regulator/core.c:2257 _r= egulator_put+0x3ec/0x4e0 [ 59.310345] RIP: 0010:_regulator_put+0x3ec/0x4e0 [ 59.318362] Call Trace: [ 59.318582] [ 59.318765] regulator_put+0x1f/0x30 [ 59.319058] devres_release_group+0x319/0x3d0 [ 59.319420] i2c_device_probe+0x766/0x940 Fix this by disabling the regulator in error handling. Signed-off-by: Zheyu Ma Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/i2c/dw9714.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c index cd7008ad8f2f..8c5797ba57d4 100644 --- a/drivers/media/i2c/dw9714.c +++ b/drivers/media/i2c/dw9714.c @@ -183,6 +183,7 @@ static int dw9714_probe(struct i2c_client *client) return 0; =20 err_cleanup: + regulator_disable(dw9714_dev->vcc); v4l2_ctrl_handler_free(&dw9714_dev->ctrls_vcm); media_entity_cleanup(&dw9714_dev->sd.entity); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D909CCA492 for ; Tue, 7 Jun 2022 22:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383874AbiFGWGo (ORCPT ); Tue, 7 Jun 2022 18:06:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379898AbiFGVGe (ORCPT ); Tue, 7 Jun 2022 17:06:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B4452122A0; Tue, 7 Jun 2022 11:50: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 8932AB823A0; Tue, 7 Jun 2022 18:50:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4D9EC385A2; Tue, 7 Jun 2022 18:50:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627816; bh=1rMP8kZatU4ASe70FEHQC3m9PZKnZRDIpdNd/40kEeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l+9GNFkc4VvbjsD42sePFyIltijF4wdFZPi5CV1sg7sh8+txSRUk9kR/aVsL9IZPT ZrAyveAjbeSIKzmSELGyX0jaxAzSGAhGpPAvD4/rjum2NCZNhRJhyt/6wqQ+nfWYsK y9cIslDvWkrTo3RgiKdSYxNMd9NvfvLCeTJTOlMI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luca Weiss , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 102/879] media: venus: hfi: avoid null dereference in deinit Date: Tue, 7 Jun 2022 18:53:40 +0200 Message-Id: <20220607165005.657321390@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luca Weiss [ Upstream commit 86594f6af867b5165d2ba7b5a71fae3a5961e56c ] If venus_probe fails at pm_runtime_put_sync the error handling first calls hfi_destroy and afterwards hfi_core_deinit. As hfi_destroy sets core->ops to NULL, hfi_core_deinit cannot call the core_deinit function anymore. Avoid this null pointer derefence by skipping the call when necessary. Signed-off-by: Luca Weiss Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/qcom/venus/hfi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platfo= rm/qcom/venus/hfi.c index 4e2151fb47f0..1968f09ad177 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -104,6 +104,9 @@ int hfi_core_deinit(struct venus_core *core, bool block= ing) mutex_lock(&core->lock); } =20 + if (!core->ops) + goto unlock; + ret =3D core->ops->core_deinit(core); =20 if (!ret) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F3DFCCA48F for ; Tue, 7 Jun 2022 22:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383854AbiFGWGk (ORCPT ); Tue, 7 Jun 2022 18:06:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379842AbiFGVGa (ORCPT ); Tue, 7 Jun 2022 17:06:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97AE3211AB2; Tue, 7 Jun 2022 11:50:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8A6F16176D; Tue, 7 Jun 2022 18:50:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9135AC385A2; Tue, 7 Jun 2022 18:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627819; bh=MoPv6OhQx7EiRN060osT8VM3jcVMoppKxNbkWMOY8cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wyg3jEV5kVEdbhqLgwaquNYfchqfXC7a8uKuqtTlB0V8uGO6f6GP/RQlYi6868iL8 h0KGmTWQzOuNTR4nwSfzHMI1Gk4k4umnXNoVfb2ZzjevAOm4c7Ij3CEuHjQHx38QF3 XZV5p0i2T5YnKNIQ7RsNt0G0ZVKwRPpOxtdfxPYI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vikash Garodia , Fritz Koenig , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 103/879] media: venus: do not queue internal buffers from previous sequence Date: Tue, 7 Jun 2022 18:53:41 +0200 Message-Id: <20220607165005.685049958@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vikash Garodia [ Upstream commit 73664f107c0fafb59cd91e576b81c986adb74610 ] During reconfig (DRC) event from firmware, it is not guaranteed that all the DPB(internal) buffers would be released by the firmware. Some buffers might be released gradually while processing frames from the new sequence. These buffers now stay idle in the dpblist. In subsequent call to queue the DPBs to firmware, these idle buffers should not be queued. The fix identifies those buffers and free them. Signed-off-by: Vikash Garodia Tested-by: Fritz Koenig Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/qcom/venus/helpers.c | 34 +++++++++++++++------ 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/pl= atform/qcom/venus/helpers.c index 0bca95d01650..fa01edd54c03 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -90,12 +90,28 @@ bool venus_helper_check_codec(struct venus_inst *inst, = u32 v4l2_pixfmt) } EXPORT_SYMBOL_GPL(venus_helper_check_codec); =20 +static void free_dpb_buf(struct venus_inst *inst, struct intbuf *buf) +{ + ida_free(&inst->dpb_ids, buf->dpb_out_tag); + + list_del_init(&buf->list); + dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da, + buf->attrs); + kfree(buf); +} + int venus_helper_queue_dpb_bufs(struct venus_inst *inst) { - struct intbuf *buf; + struct intbuf *buf, *next; + unsigned int dpb_size =3D 0; int ret =3D 0; =20 - list_for_each_entry(buf, &inst->dpbbufs, list) { + if (inst->dpb_buftype =3D=3D HFI_BUFFER_OUTPUT) + dpb_size =3D inst->output_buf_size; + else if (inst->dpb_buftype =3D=3D HFI_BUFFER_OUTPUT2) + dpb_size =3D inst->output2_buf_size; + + list_for_each_entry_safe(buf, next, &inst->dpbbufs, list) { struct hfi_frame_data fdata; =20 memset(&fdata, 0, sizeof(fdata)); @@ -106,6 +122,12 @@ int venus_helper_queue_dpb_bufs(struct venus_inst *ins= t) if (buf->owned_by =3D=3D FIRMWARE) continue; =20 + /* free buffer from previous sequence which was released later */ + if (dpb_size > buf->size) { + free_dpb_buf(inst, buf); + continue; + } + fdata.clnt_data =3D buf->dpb_out_tag; =20 ret =3D hfi_session_process_buf(inst, &fdata); @@ -127,13 +149,7 @@ int venus_helper_free_dpb_bufs(struct venus_inst *inst) list_for_each_entry_safe(buf, n, &inst->dpbbufs, list) { if (buf->owned_by =3D=3D FIRMWARE) continue; - - ida_free(&inst->dpb_ids, buf->dpb_out_tag); - - list_del_init(&buf->list); - dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da, - buf->attrs); - kfree(buf); + free_dpb_buf(inst, buf); } =20 if (list_empty(&inst->dpbbufs)) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8D0DC43334 for ; Tue, 7 Jun 2022 22:07:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382518AbiFGWG7 (ORCPT ); Tue, 7 Jun 2022 18:06:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379841AbiFGVGa (ORCPT ); Tue, 7 Jun 2022 17:06:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCEF4211AB3; Tue, 7 Jun 2022 11:50:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0343061777; Tue, 7 Jun 2022 18:50:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10219C385A2; Tue, 7 Jun 2022 18:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627824; bh=dnVq8A+QaRcFBuWkdXsDnNqK0ZQ2F6cv/bJXs+evh2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S/HSI+I1TTmPGI7RFwuQj00kTe0GX8TEwKk428x3cFOf/kL+3S2uzDHO/xNoGpt0I fJ2TKxNIG5+eoHQA+PpSyuTdf09Se2+oHSXUPIQ/QpMVXOcHzNAm/hzKgcvhseV4AP CAirht/cVRug5i2C9g/I0H4sfTgnJuhq9f4Lok74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 104/879] media: pci: cx23885: Fix the error handling in cx23885_initdev() Date: Tue, 7 Jun 2022 18:53:42 +0200 Message-Id: <20220607165005.713750327@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma [ Upstream commit e8123311cf06d7dae71e8c5fe78e0510d20cd30b ] When the driver fails to call the dma_set_mask(), the driver will get the following splat: [ 55.853884] BUG: KASAN: use-after-free in __process_removed_driver+0x3c/= 0x240 [ 55.854486] Read of size 8 at addr ffff88810de60408 by task modprobe/590 [ 55.856822] Call Trace: [ 55.860327] __process_removed_driver+0x3c/0x240 [ 55.861347] bus_for_each_dev+0x102/0x160 [ 55.861681] i2c_del_driver+0x2f/0x50 This is because the driver has initialized the i2c related resources in cx23885_dev_setup() but not released them in error handling, fix this bug by modifying the error path that jumps after failing to call the dma_set_mask(). Signed-off-by: Zheyu Ma Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/pci/cx23885/cx23885-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/c= x23885/cx23885-core.c index f8f2ff3b00c3..a07b18f2034e 100644 --- a/drivers/media/pci/cx23885/cx23885-core.c +++ b/drivers/media/pci/cx23885/cx23885-core.c @@ -2165,7 +2165,7 @@ static int cx23885_initdev(struct pci_dev *pci_dev, err =3D dma_set_mask(&pci_dev->dev, 0xffffffff); if (err) { pr_err("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name); - goto fail_ctrl; + goto fail_dma_set_mask; } =20 err =3D request_irq(pci_dev->irq, cx23885_irq, @@ -2173,7 +2173,7 @@ static int cx23885_initdev(struct pci_dev *pci_dev, if (err < 0) { pr_err("%s: can't get IRQ %d\n", dev->name, pci_dev->irq); - goto fail_irq; + goto fail_dma_set_mask; } =20 switch (dev->board) { @@ -2195,7 +2195,7 @@ static int cx23885_initdev(struct pci_dev *pci_dev, =20 return 0; =20 -fail_irq: +fail_dma_set_mask: cx23885_dev_unregister(dev); fail_ctrl: v4l2_ctrl_handler_free(hdl); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 216A5CCA47F for ; Tue, 7 Jun 2022 22:06:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378882AbiFGWGz (ORCPT ); Tue, 7 Jun 2022 18:06:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379864AbiFGVGb (ORCPT ); Tue, 7 Jun 2022 17:06: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 194A4212287; Tue, 7 Jun 2022 11:50:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7414CB82391; Tue, 7 Jun 2022 18:50:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2E49C385A2; Tue, 7 Jun 2022 18:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627827; bh=pzKUd4jQDp6QbQLB8zB3/ApUbmtrmJ5ypu5nhg1Sbac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=12mUXeHWhFMbaYbfk+e+OjG5NTwliUUX3fpN9tGEuNNgJp0DsNcNWwwtbTfqN4KUh dGX2GpRLl0HYVSg9G1lW6yqvaPVAkYOiyU2zzF6t5GWVfyLNy/zr8zb6boQ21kTbvr wtWPbJkjeuhm4InGvNp9DS04MiXwWQL9IdbhYDTw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 105/879] media: cx25821: Fix the warning when removing the module Date: Tue, 7 Jun 2022 18:53:43 +0200 Message-Id: <20220607165005.742388348@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma [ Upstream commit 2203436a4d24302871617373a7eb21bc17e38762 ] When removing the module, we will get the following warning: [ 14.746697] remove_proc_entry: removing non-empty directory 'irq/21', le= aking at least 'cx25821[1]' [ 14.747449] WARNING: CPU: 4 PID: 368 at fs/proc/generic.c:717 remove_pro= c_entry+0x389/0x3f0 [ 14.751611] RIP: 0010:remove_proc_entry+0x389/0x3f0 [ 14.759589] Call Trace: [ 14.759792] [ 14.759975] unregister_irq_proc+0x14c/0x170 [ 14.760340] irq_free_descs+0x94/0xe0 [ 14.760640] mp_unmap_irq+0xb6/0x100 [ 14.760937] acpi_unregister_gsi_ioapic+0x27/0x40 [ 14.761334] acpi_pci_irq_disable+0x1d3/0x320 [ 14.761688] pci_disable_device+0x1ad/0x380 [ 14.762027] ? _raw_spin_unlock_irqrestore+0x2d/0x60 [ 14.762442] ? cx25821_shutdown+0x20/0x9f0 [cx25821] [ 14.762848] cx25821_finidev+0x48/0xc0 [cx25821] [ 14.763242] pci_device_remove+0x92/0x240 Fix this by freeing the irq before call pci_disable_device(). Signed-off-by: Zheyu Ma Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/pci/cx25821/cx25821-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/c= x25821/cx25821-core.c index 3078a39f0b95..6627fa9166d3 100644 --- a/drivers/media/pci/cx25821/cx25821-core.c +++ b/drivers/media/pci/cx25821/cx25821-core.c @@ -1332,11 +1332,11 @@ static void cx25821_finidev(struct pci_dev *pci_dev) struct cx25821_dev *dev =3D get_cx25821(v4l2_dev); =20 cx25821_shutdown(dev); - pci_disable_device(pci_dev); =20 /* unregister stuff */ if (pci_dev->irq) free_irq(pci_dev->irq, dev); + pci_disable_device(pci_dev); =20 cx25821_dev_unregister(dev); v4l2_device_unregister(v4l2_dev); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B43EFCCA47C for ; Tue, 7 Jun 2022 22:09:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383923AbiFGWJr (ORCPT ); Tue, 7 Jun 2022 18:09:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379945AbiFGVGh (ORCPT ); Tue, 7 Jun 2022 17:06:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11B87212550; Tue, 7 Jun 2022 11:50:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 836B861724; Tue, 7 Jun 2022 18:50:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90C6BC385A2; Tue, 7 Jun 2022 18:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627830; bh=PH+cowAQ+wr2TocWy9i17v14NXwGOM4fF5selByEHAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tw92rxTiqSReUKVqKQoZDOWVr1JJGJI5M677AGd0aavRwqRVPHPMIQiWr67HtN3Ex QTw5nbgCw0lpPVN9SZKsgtHngQHChRap+gYk2cX/yHErJJzjVXYV92HiYgCPG02lB3 4Grdn6ZJr+Tlf/dmk1iVPEQERKCwaPLIxX/4WOQA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Guoqing Jiang , Heming Zhao , Song Liu , Sasha Levin Subject: [PATCH 5.18 106/879] md/bitmap: dont set sb values if cant pass sanity check Date: Tue, 7 Jun 2022 18:53:44 +0200 Message-Id: <20220607165005.771344896@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Heming Zhao [ Upstream commit e68cb83a57a458b01c9739e2ad9cb70b04d1e6d2 ] If bitmap area contains invalid data, kernel will crash then mdadm triggers "Segmentation fault". This is cluster-md speical bug. In non-clustered env, mdadm will handle broken metadata case. In clustered array, only kernel space handles bitmap slot info. But even this bug only happened in clustered env, current sanity check is wrong, the code should be changed. How to trigger: (faulty injection) dd if=3D/dev/zero bs=3D1M count=3D1 oflag=3Ddirect of=3D/dev/sda dd if=3D/dev/zero bs=3D1M count=3D1 oflag=3Ddirect of=3D/dev/sdb mdadm -C /dev/md0 -b clustered -e 1.2 -n 2 -l mirror /dev/sda /dev/sdb mdadm -Ss echo aaa > magic.txt =3D=3D below modifying slot 2 bitmap data =3D=3D dd if=3Dmagic.txt of=3D/dev/sda seek=3D16384 bs=3D1 count=3D3 <=3D=3D destr= oy magic dd if=3D/dev/zero of=3D/dev/sda seek=3D16436 bs=3D1 count=3D4 <=3D=3D ZERO = chunksize mdadm -A /dev/md0 /dev/sda /dev/sdb =3D=3D kernel crashes. mdadm outputs "Segmentation fault" =3D=3D Reason of kernel crash: In md_bitmap_read_sb (called by md_bitmap_create), bad bitmap magic didn't block chunksize assignment, and zero value made DIV_ROUND_UP_SECTOR_T() trigger "divide error". Crash log: kernel: md: md0 stopped. kernel: md/raid1:md0: not clean -- starting background reconstruction kernel: md/raid1:md0: active with 2 out of 2 mirrors kernel: dlm: ... ... kernel: md-cluster: Joined cluster 44810aba-38bb-e6b8-daca-bc97a0b254aa slo= t 1 kernel: md0: invalid bitmap file superblock: bad magic kernel: md_bitmap_copy_from_slot can't get bitmap from slot 2 kernel: md-cluster: Could not gather bitmaps from slot 2 kernel: divide error: 0000 [#1] SMP NOPTI kernel: CPU: 0 PID: 1603 Comm: mdadm Not tainted 5.14.6-1-default kernel: Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) kernel: RIP: 0010:md_bitmap_create+0x1d1/0x850 [md_mod] kernel: RSP: 0018:ffffc22ac0843ba0 EFLAGS: 00010246 kernel: ... ... kernel: Call Trace: kernel: ? dlm_lock_sync+0xd0/0xd0 [md_cluster 77fe..7a0] kernel: md_bitmap_copy_from_slot+0x2c/0x290 [md_mod 24ea..d3a] kernel: load_bitmaps+0xec/0x210 [md_cluster 77fe..7a0] kernel: md_bitmap_load+0x81/0x1e0 [md_mod 24ea..d3a] kernel: do_md_run+0x30/0x100 [md_mod 24ea..d3a] kernel: md_ioctl+0x1290/0x15a0 [md_mod 24ea....d3a] kernel: ? mddev_unlock+0xaa/0x130 [md_mod 24ea..d3a] kernel: ? blkdev_ioctl+0xb1/0x2b0 kernel: block_ioctl+0x3b/0x40 kernel: __x64_sys_ioctl+0x7f/0xb0 kernel: do_syscall_64+0x59/0x80 kernel: ? exit_to_user_mode_prepare+0x1ab/0x230 kernel: ? syscall_exit_to_user_mode+0x18/0x40 kernel: ? do_syscall_64+0x69/0x80 kernel: entry_SYSCALL_64_after_hwframe+0x44/0xae kernel: RIP: 0033:0x7f4a15fa722b kernel: ... ... kernel: ---[ end trace 8afa7612f559c868 ]--- kernel: RIP: 0010:md_bitmap_create+0x1d1/0x850 [md_mod] Reported-by: kernel test robot Reported-by: Dan Carpenter Acked-by: Guoqing Jiang Signed-off-by: Heming Zhao Signed-off-by: Song Liu Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/md/md-bitmap.c | 44 ++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c index bfd6026d7809..612460d2bdaf 100644 --- a/drivers/md/md-bitmap.c +++ b/drivers/md/md-bitmap.c @@ -639,14 +639,6 @@ static int md_bitmap_read_sb(struct bitmap *bitmap) daemon_sleep =3D le32_to_cpu(sb->daemon_sleep) * HZ; write_behind =3D le32_to_cpu(sb->write_behind); sectors_reserved =3D le32_to_cpu(sb->sectors_reserved); - /* Setup nodes/clustername only if bitmap version is - * cluster-compatible - */ - if (sb->version =3D=3D cpu_to_le32(BITMAP_MAJOR_CLUSTERED)) { - nodes =3D le32_to_cpu(sb->nodes); - strlcpy(bitmap->mddev->bitmap_info.cluster_name, - sb->cluster_name, 64); - } =20 /* verify that the bitmap-specific fields are valid */ if (sb->magic !=3D cpu_to_le32(BITMAP_MAGIC)) @@ -668,6 +660,16 @@ static int md_bitmap_read_sb(struct bitmap *bitmap) goto out; } =20 + /* + * Setup nodes/clustername only if bitmap version is + * cluster-compatible + */ + if (sb->version =3D=3D cpu_to_le32(BITMAP_MAJOR_CLUSTERED)) { + nodes =3D le32_to_cpu(sb->nodes); + strlcpy(bitmap->mddev->bitmap_info.cluster_name, + sb->cluster_name, 64); + } + /* keep the array size field of the bitmap superblock up to date */ sb->sync_size =3D cpu_to_le64(bitmap->mddev->resync_max_sectors); =20 @@ -700,9 +702,9 @@ static int md_bitmap_read_sb(struct bitmap *bitmap) =20 out: kunmap_atomic(sb); - /* Assigning chunksize is required for "re_read" */ - bitmap->mddev->bitmap_info.chunksize =3D chunksize; if (err =3D=3D 0 && nodes && (bitmap->cluster_slot < 0)) { + /* Assigning chunksize is required for "re_read" */ + bitmap->mddev->bitmap_info.chunksize =3D chunksize; err =3D md_setup_cluster(bitmap->mddev, nodes); if (err) { pr_warn("%s: Could not setup cluster service (%d)\n", @@ -713,18 +715,18 @@ static int md_bitmap_read_sb(struct bitmap *bitmap) goto re_read; } =20 - out_no_sb: - if (test_bit(BITMAP_STALE, &bitmap->flags)) - bitmap->events_cleared =3D bitmap->mddev->events; - bitmap->mddev->bitmap_info.chunksize =3D chunksize; - bitmap->mddev->bitmap_info.daemon_sleep =3D daemon_sleep; - bitmap->mddev->bitmap_info.max_write_behind =3D write_behind; - bitmap->mddev->bitmap_info.nodes =3D nodes; - if (bitmap->mddev->bitmap_info.space =3D=3D 0 || - bitmap->mddev->bitmap_info.space > sectors_reserved) - bitmap->mddev->bitmap_info.space =3D sectors_reserved; - if (err) { + if (err =3D=3D 0) { + if (test_bit(BITMAP_STALE, &bitmap->flags)) + bitmap->events_cleared =3D bitmap->mddev->events; + bitmap->mddev->bitmap_info.chunksize =3D chunksize; + bitmap->mddev->bitmap_info.daemon_sleep =3D daemon_sleep; + bitmap->mddev->bitmap_info.max_write_behind =3D write_behind; + bitmap->mddev->bitmap_info.nodes =3D nodes; + if (bitmap->mddev->bitmap_info.space =3D=3D 0 || + bitmap->mddev->bitmap_info.space > sectors_reserved) + bitmap->mddev->bitmap_info.space =3D sectors_reserved; + } else { md_bitmap_print_sb(bitmap); if (bitmap->cluster_slot < 0) md_cluster_stop(bitmap->mddev); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7141CC433EF for ; Tue, 7 Jun 2022 22:17:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383384AbiFGWRo (ORCPT ); Tue, 7 Jun 2022 18:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379994AbiFGVLW (ORCPT ); Tue, 7 Jun 2022 17:11:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80EF7217345; Tue, 7 Jun 2022 11:52:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0BCF961579; Tue, 7 Jun 2022 18:52:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CF06C385A2; Tue, 7 Jun 2022 18:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627967; bh=Dz8ai7iKPglweNQzZKbSzXedFDeTrb0db8t40QK1R4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rWyzZg+JzzhZiElCl3VS/dv4gDALHBPkAUW/q7jiaS+jFj7snTLzDwyaip44CzfWn 2YqeXRvRG+hWqTVHpEAnlXtoWi8hMifSLKRhWJ1V0+0JXp2SyOoNF3KX0iXHZRAkhV 7acVgui8b6kM8K2UP/ruTdGQgm+mWa/6I+XugYtY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aidan MacDonald , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 107/879] mmc: jz4740: Apply DMA engine limits to maximum segment size Date: Tue, 7 Jun 2022 18:53:45 +0200 Message-Id: <20220607165005.800346734@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Aidan MacDonald [ Upstream commit afadb04f1d6e74b18a253403f5274cde5e3fd7bd ] Do what is done in other DMA-enabled MMC host drivers (cf. host/mmci.c) and limit the maximum segment size based on the DMA engine's capabilities. This is needed to avoid warnings like the following with CONFIG_DMA_API_DEBUG=3D= y. Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz ------------[ cut here ]------------ WARNING: CPU: 0 PID: 21 at kernel/dma/debug.c:1162 debug_dma_map_sg+0x2f4/0= x39c DMA-API: jz4780-dma 13420000.dma-controller: mapping sg segment longer than= device claims to support [len=3D98304] [max=3D65536] CPU: 0 PID: 21 Comm: kworker/0:1H Not tainted 5.18.0-rc1 #19 Workqueue: kblockd blk_mq_run_work_fn Stack : 81575aec 00000004 80620000 80620000 80620000 805e7358 00000009 8015= 37ac 814c832c 806276e3 806e34b4 80620000 81575aec 00000001 81575ab8 0929= 1444 00000000 00000000 805e7358 81575958 ffffffea 8157596c 00000000 636f= 6c62 6220646b 80387a70 0000000f 6d5f6b6c 80620000 00000000 81575ba4 0000= 0009 805e170c 80896640 00000001 00010000 00000000 00000000 00006098 806e= 0000 ... Call Trace: [<80107670>] show_stack+0x84/0x120 [<80528cd8>] __warn+0xb8/0xec [<80528d78>] warn_slowpath_fmt+0x6c/0xb8 [<8016f1d4>] debug_dma_map_sg+0x2f4/0x39c [<80169d4c>] __dma_map_sg_attrs+0xf0/0x118 [<8016a27c>] dma_map_sg_attrs+0x14/0x28 [<804f66b4>] jz4740_mmc_prepare_dma_data+0x74/0xa4 [<804f6714>] jz4740_mmc_pre_request+0x30/0x54 [<804f4ff4>] mmc_blk_mq_issue_rq+0x6e0/0x7bc [<804f5590>] mmc_mq_queue_rq+0x220/0x2d4 [<8038b2c0>] blk_mq_dispatch_rq_list+0x480/0x664 [<80391040>] blk_mq_do_dispatch_sched+0x2dc/0x370 [<80391468>] __blk_mq_sched_dispatch_requests+0xec/0x164 [<80391540>] blk_mq_sched_dispatch_requests+0x44/0x94 [<80387900>] __blk_mq_run_hw_queue+0xb0/0xcc [<80134c14>] process_one_work+0x1b8/0x264 [<80134ff8>] worker_thread+0x2ec/0x3b8 [<8013b13c>] kthread+0x104/0x10c [<80101dcc>] ret_from_kernel_thread+0x14/0x1c ---[ end trace 0000000000000000 ]--- Signed-off-by: Aidan MacDonald Link: https://lore.kernel.org/r/20220411153753.50443-1-aidanmacdonald.0x0@g= mail.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/jz4740_mmc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c index 7ab1b38a7be5..b1d563b2ed1b 100644 --- a/drivers/mmc/host/jz4740_mmc.c +++ b/drivers/mmc/host/jz4740_mmc.c @@ -247,6 +247,26 @@ static int jz4740_mmc_acquire_dma_channels(struct jz47= 40_mmc_host *host) return PTR_ERR(host->dma_rx); } =20 + /* + * Limit the maximum segment size in any SG entry according to + * the parameters of the DMA engine device. + */ + if (host->dma_tx) { + struct device *dev =3D host->dma_tx->device->dev; + unsigned int max_seg_size =3D dma_get_max_seg_size(dev); + + if (max_seg_size < host->mmc->max_seg_size) + host->mmc->max_seg_size =3D max_seg_size; + } + + if (host->dma_rx) { + struct device *dev =3D host->dma_rx->device->dev; + unsigned int max_seg_size =3D dma_get_max_seg_size(dev); + + if (max_seg_size < host->mmc->max_seg_size) + host->mmc->max_seg_size =3D max_seg_size; + } + return 0; } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C509BCCA487 for ; Tue, 7 Jun 2022 22:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384398AbiFGWLP (ORCPT ); Tue, 7 Jun 2022 18:11:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235181AbiFGVIB (ORCPT ); Tue, 7 Jun 2022 17:08:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18B75212C9F; Tue, 7 Jun 2022 11:50:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED63D616B6; Tue, 7 Jun 2022 18:50:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3FFBC385A2; Tue, 7 Jun 2022 18:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627849; bh=Dif+QLRgomHeNwIGglbOydkrFgua16Gw8/jn/i5m3BU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WAOT9/XrZfUK4iqHJhOWHafgZnxVRHBr+Ck55+DdkMwcz2H3RfrLZBZ8zWN7jDcgk /+C2K7E/4rYbqFqexHAZehArOe+1U004Pak3nC6k3Uo6SLIucuhakXtxvAgyM4U/Cy H3eJcdM+4EiA53nVMB+b3Q0a9rIhgLx9n7QMxOxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vignesh Raghavendra , Aswath Govindraju , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 108/879] drivers: mmc: sdhci_am654: Add the quirk to set TESTCD bit Date: Tue, 7 Jun 2022 18:53:46 +0200 Message-Id: <20220607165005.832701868@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vignesh Raghavendra [ Upstream commit c7666240ec76422cb7546bd07cc8ae80dc0ccdd2 ] The ARASAN MMC controller on Keystone 3 class of devices need the SDCD line to be connected for proper functioning. Similar to the issue pointed out in sdhci-of-arasan.c driver, commit 3794c542641f ("mmc: sdhci-of-arasan: Set controller to test mode when no CD bit"). In cases where this can't be connected, add a quirk to force the controller into test mode and set the TESTCD bit. Use the flag "ti,fails-without-test-cd", to implement this above quirk when required. Signed-off-by: Vignesh Raghavendra Signed-off-by: Aswath Govindraju Link: https://lore.kernel.org/r/20220425063120.10135-3-a-govindraju@ti.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/mmc/host/sdhci_am654.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c index e54fe24d47e7..e7ced1496a07 100644 --- a/drivers/mmc/host/sdhci_am654.c +++ b/drivers/mmc/host/sdhci_am654.c @@ -147,6 +147,9 @@ struct sdhci_am654_data { int drv_strength; int strb_sel; u32 flags; + u32 quirks; + +#define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0) }; =20 struct sdhci_am654_driver_data { @@ -369,6 +372,21 @@ static void sdhci_am654_write_b(struct sdhci_host *hos= t, u8 val, int reg) } } =20 +static void sdhci_am654_reset(struct sdhci_host *host, u8 mask) +{ + u8 ctrl; + struct sdhci_pltfm_host *pltfm_host =3D sdhci_priv(host); + struct sdhci_am654_data *sdhci_am654 =3D sdhci_pltfm_priv(pltfm_host); + + sdhci_reset(host, mask); + + if (sdhci_am654->quirks & SDHCI_AM654_QUIRK_FORCE_CDTEST) { + ctrl =3D sdhci_readb(host, SDHCI_HOST_CONTROL); + ctrl |=3D SDHCI_CTRL_CDTEST_INS | SDHCI_CTRL_CDTEST_EN; + sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); + } +} + static int sdhci_am654_execute_tuning(struct mmc_host *mmc, u32 opcode) { struct sdhci_host *host =3D mmc_priv(mmc); @@ -500,7 +518,7 @@ static struct sdhci_ops sdhci_j721e_4bit_ops =3D { .set_clock =3D sdhci_j721e_4bit_set_clock, .write_b =3D sdhci_am654_write_b, .irq =3D sdhci_am654_cqhci_irq, - .reset =3D sdhci_reset, + .reset =3D sdhci_am654_reset, }; =20 static const struct sdhci_pltfm_data sdhci_j721e_4bit_pdata =3D { @@ -719,6 +737,9 @@ static int sdhci_am654_get_of_property(struct platform_= device *pdev, device_property_read_u32(dev, "ti,clkbuf-sel", &sdhci_am654->clkbuf_sel); =20 + if (device_property_read_bool(dev, "ti,fails-without-test-cd")) + sdhci_am654->quirks |=3D SDHCI_AM654_QUIRK_FORCE_CDTEST; + sdhci_get_of_property(pdev); =20 return 0; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18A2CCCA48E for ; Tue, 7 Jun 2022 22:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384440AbiFGWLn (ORCPT ); Tue, 7 Jun 2022 18:11:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379321AbiFGVJ0 (ORCPT ); Tue, 7 Jun 2022 17:09:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F26A214402; Tue, 7 Jun 2022 11:51:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 413C3616C2; Tue, 7 Jun 2022 18:51:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 548FCC34115; Tue, 7 Jun 2022 18:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627879; bh=0um7h6J74b9iCwQNa3KP+UZfrgaiwOgLoUiCqYjh1tU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n3E+xSyOmJimLQ6uTx0x2CoXlaEPsp24+N88ZlaHcvwq8phLPRm8H5Vr+yQQ9e0C5 UfuiQRWNYLTCd2+eObCMNxA5/7k7S1Ii/9KPZYnEPFQGFBSfMphGUkxjwtG28PHQOv 98Qg+m6Qz+/wjRsvoK42Ax295WKeHqdVcLEmAFcE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Lv Ruyi , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 109/879] scsi: megaraid: Fix error check return value of register_chrdev() Date: Tue, 7 Jun 2022 18:53:47 +0200 Message-Id: <20220607165005.861445419@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lv Ruyi [ Upstream commit c5acd61dbb32b6bda0f3a354108f2b8dcb788985 ] If major equals 0, register_chrdev() returns an error code when it fails. This function dynamically allocates a major and returns its number on success, so we should use "< 0" to check it instead of "!". Link: https://lore.kernel.org/r/20220418105755.2558828-1-lv.ruyi@zte.com.cn Reported-by: Zeal Robot Signed-off-by: Lv Ruyi Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/megaraid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index a5d8cee2d510..bf491af9f0d6 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -4607,7 +4607,7 @@ static int __init megaraid_init(void) * major number allocation. */ major =3D register_chrdev(0, "megadev_legacy", &megadev_fops); - if (!major) { + if (major < 0) { printk(KERN_WARNING "megaraid: failed to register char device\n"); } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A3AACCA47C for ; Tue, 7 Jun 2022 22:13:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379287AbiFGWNG (ORCPT ); Tue, 7 Jun 2022 18:13:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379661AbiFGVKt (ORCPT ); Tue, 7 Jun 2022 17:10:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56F93215642; Tue, 7 Jun 2022 11:51:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F0AA6B8239A; Tue, 7 Jun 2022 18:51:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 572E9C34115; Tue, 7 Jun 2022 18:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627909; bh=uGxBakii2rIG+iogD6UuanWdzvcp4zMwBqkxmY5yAyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v0bQCRNgfsZSybwt68ZlUs6vE97giCM52jIXzkEPvj3A/f8eIl7U38zHIkP0L4ZHp 07PyAio2o1VvD7DBDQVq4UQQh9uW1qGxKyLP37RjDU5cu1+W7SaiMwc8OkK1TsXhU0 zvPb0Gvi2SDl2NtVQc9IpvQi5z4MhSOAwAO4/Pg0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Haohui Mai , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 110/879] drm/amdgpu/sdma: Fix incorrect calculations of the wptr of the doorbells Date: Tue, 7 Jun 2022 18:53:48 +0200 Message-Id: <20220607165005.890594916@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Haohui Mai [ Upstream commit 7dba6e838e741caadcf27ef717b6dcb561e77f89 ] This patch fixes the issue where the driver miscomputes the 64-bit values of the wptr of the SDMA doorbell when initializing the hardware. SDMA engines v4 and later on have full 64-bit registers for wptr thus they should be set properly. Older generation hardwares like CIK / SI have only 16 / 20 / 24bits for the WPTR, where the calls of lower_32_bits() will be removed in a following patch. Reviewed-by: Christian K=C3=B6nig Signed-off-by: Haohui Mai Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/a= mdgpu/sdma_v4_0.c index d7e8f7232364..ff86c43b63d1 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c @@ -772,8 +772,8 @@ static void sdma_v4_0_ring_set_wptr(struct amdgpu_ring = *ring) =20 DRM_DEBUG("Using doorbell -- " "wptr_offs =3D=3D 0x%08x " - "lower_32_bits(ring->wptr) << 2 =3D=3D 0x%08x " - "upper_32_bits(ring->wptr) << 2 =3D=3D 0x%08x\n", + "lower_32_bits(ring->wptr << 2) =3D=3D 0x%08x " + "upper_32_bits(ring->wptr << 2) =3D=3D 0x%08x\n", ring->wptr_offs, lower_32_bits(ring->wptr << 2), upper_32_bits(ring->wptr << 2)); diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/a= mdgpu/sdma_v5_0.c index a8d49c005f73..627eb1f147c2 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c @@ -394,8 +394,8 @@ static void sdma_v5_0_ring_set_wptr(struct amdgpu_ring = *ring) if (ring->use_doorbell) { DRM_DEBUG("Using doorbell -- " "wptr_offs =3D=3D 0x%08x " - "lower_32_bits(ring->wptr) << 2 =3D=3D 0x%08x " - "upper_32_bits(ring->wptr) << 2 =3D=3D 0x%08x\n", + "lower_32_bits(ring->wptr << 2) =3D=3D 0x%08x " + "upper_32_bits(ring->wptr << 2) =3D=3D 0x%08x\n", ring->wptr_offs, lower_32_bits(ring->wptr << 2), upper_32_bits(ring->wptr << 2)); @@ -774,9 +774,9 @@ static int sdma_v5_0_gfx_resume(struct amdgpu_device *a= dev) =20 if (!amdgpu_sriov_vf(adev)) { /* only bare-metal use register write for = wptr */ WREG32(sdma_v5_0_get_reg_offset(adev, i, mmSDMA0_GFX_RB_WPTR), - lower_32_bits(ring->wptr) << 2); + lower_32_bits(ring->wptr << 2)); WREG32(sdma_v5_0_get_reg_offset(adev, i, mmSDMA0_GFX_RB_WPTR_HI), - upper_32_bits(ring->wptr) << 2); + upper_32_bits(ring->wptr << 2)); } =20 doorbell =3D RREG32_SOC15_IP(GC, sdma_v5_0_get_reg_offset(adev, i, mmSDM= A0_GFX_DOORBELL)); diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/a= mdgpu/sdma_v5_2.c index 824eace69884..a5eb82bfeaa8 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c @@ -295,8 +295,8 @@ static void sdma_v5_2_ring_set_wptr(struct amdgpu_ring = *ring) if (ring->use_doorbell) { DRM_DEBUG("Using doorbell -- " "wptr_offs =3D=3D 0x%08x " - "lower_32_bits(ring->wptr) << 2 =3D=3D 0x%08x " - "upper_32_bits(ring->wptr) << 2 =3D=3D 0x%08x\n", + "lower_32_bits(ring->wptr << 2) =3D=3D 0x%08x " + "upper_32_bits(ring->wptr << 2) =3D=3D 0x%08x\n", ring->wptr_offs, lower_32_bits(ring->wptr << 2), upper_32_bits(ring->wptr << 2)); @@ -672,8 +672,8 @@ static int sdma_v5_2_gfx_resume(struct amdgpu_device *a= dev) WREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_GFX_MINOR_= PTR_UPDATE), 1); =20 if (!amdgpu_sriov_vf(adev)) { /* only bare-metal use register write for = wptr */ - WREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_GFX_RB_WPTR), lower_32= _bits(ring->wptr) << 2); - WREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_GFX_RB_WPTR_HI), upper= _32_bits(ring->wptr) << 2); + WREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_GFX_RB_WPTR), lower_32= _bits(ring->wptr << 2)); + WREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_GFX_RB_WPTR_HI), upper= _32_bits(ring->wptr << 2)); } =20 doorbell =3D RREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDM= A0_GFX_DOORBELL)); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43105CCA48A for ; Tue, 7 Jun 2022 22:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384674AbiFGWQA (ORCPT ); Tue, 7 Jun 2022 18:16:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379874AbiFGVLI (ORCPT ); Tue, 7 Jun 2022 17:11:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6EFF1238B5; Tue, 7 Jun 2022 11:52:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3CA6F6156D; Tue, 7 Jun 2022 18:52:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46633C385A2; Tue, 7 Jun 2022 18:52:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627939; bh=8fyaHLfs66JSD8DWARG4Vmw9VaXoP4pQwZnrSrmzxME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H05RnFtgmvVkpDWqK6i0IetmBP4blDPyTjitqy4ky+s1D12Lu1gQm3Y5/DEK2Krdz 5y/9v4UFe2STartBk3UKQ0EsmSLXiNxhX+UBg9g30WSXrjxF6xYYcIK9zQT+KpEIov 01AaPW1PCnfmtGxGNjdQLBOpmRVp+n7QBJJmp1Vw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Minghao Chi , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 111/879] scsi: ufs: Use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Date: Tue, 7 Jun 2022 18:53:49 +0200 Message-Id: <20220607165005.918279993@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Minghao Chi [ Upstream commit 75b8715e20a20bc7b4844835e4035543a2674200 ] Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync() and pm_runtime_put_noidle(). This change is just to simplify the code, no actual functional changes. Link: https://lore.kernel.org/r/20220420090353.2588804-1-chi.minghao@zte.co= m.cn Reported-by: Zeal Robot Signed-off-by: Minghao Chi Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/ufs/ti-j721e-ufs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/ufs/ti-j721e-ufs.c b/drivers/scsi/ufs/ti-j721e-uf= s.c index eafe0db98d54..122d650d0810 100644 --- a/drivers/scsi/ufs/ti-j721e-ufs.c +++ b/drivers/scsi/ufs/ti-j721e-ufs.c @@ -29,11 +29,9 @@ static int ti_j721e_ufs_probe(struct platform_device *pd= ev) return PTR_ERR(regbase); =20 pm_runtime_enable(dev); - ret =3D pm_runtime_get_sync(dev); - if (ret < 0) { - pm_runtime_put_noidle(dev); + ret =3D pm_runtime_resume_and_get(dev); + if (ret < 0) goto disable_pm; - } =20 /* Select MPHY refclk frequency */ clk =3D devm_clk_get(dev, NULL); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7394C43334 for ; Tue, 7 Jun 2022 22:14:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355454AbiFGWOB (ORCPT ); Tue, 7 Jun 2022 18:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379951AbiFGVLU (ORCPT ); Tue, 7 Jun 2022 17:11:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C717521682F; Tue, 7 Jun 2022 11:52: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 76063B82018; Tue, 7 Jun 2022 18:52:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8210C385A2; Tue, 7 Jun 2022 18:52:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627953; bh=uBJsSL0dyV/euH9wSsRXymgQdHcQOPUzRb7f6NJVMeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tn8IMquUjPrnpP12iVQcejOIoiZrimE3RgUMTsRU9zW0UYw6yATsOWYJfsWwDtHXA c6E1uTukmmkt3ar/gGqQlGULVGYJpQQDbCOtgbarlShNDUIBq4c7Rd9Eirje4EaEaE iI+P8r5ckxTyrDzlcSuuZ+CSzZqlOA89Cl1l5cgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 112/879] scsi: lpfc: Fix resource leak in lpfc_sli4_send_seq_to_ulp() Date: Tue, 7 Jun 2022 18:53:50 +0200 Message-Id: <20220607165005.949318007@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit 646db1a560f44236b7278b822ca99a1d3b6ea72c ] If no handler is found in lpfc_complete_unsol_iocb() to match the rctl of a received frame, the frame is dropped and resources are leaked. Fix by returning resources when discarding an unhandled frame type. Update lpfc_fc_frame_check() handling of NOP basic link service. Link: https://lore.kernel.org/r/20220426181419.9154-1-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc_sli.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 09a45f8ecf3f..a174e06bd96e 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -18124,7 +18124,6 @@ lpfc_fc_frame_check(struct lpfc_hba *phba, struct f= c_frame_header *fc_hdr) case FC_RCTL_ELS_REP: /* extended link services reply */ case FC_RCTL_ELS4_REQ: /* FC-4 ELS request */ case FC_RCTL_ELS4_REP: /* FC-4 ELS reply */ - case FC_RCTL_BA_NOP: /* basic link service NOP */ case FC_RCTL_BA_ABTS: /* basic link service abort */ case FC_RCTL_BA_RMC: /* remove connection */ case FC_RCTL_BA_ACC: /* basic accept */ @@ -18145,6 +18144,7 @@ lpfc_fc_frame_check(struct lpfc_hba *phba, struct f= c_frame_header *fc_hdr) fc_vft_hdr =3D (struct fc_vft_header *)fc_hdr; fc_hdr =3D &((struct fc_frame_header *)fc_vft_hdr)[1]; return lpfc_fc_frame_check(phba, fc_hdr); + case FC_RCTL_BA_NOP: /* basic link service NOP */ default: goto drop; } @@ -18959,12 +18959,14 @@ lpfc_sli4_send_seq_to_ulp(struct lpfc_vport *vpor= t, if (!lpfc_complete_unsol_iocb(phba, phba->sli4_hba.els_wq->pring, iocbq, fc_hdr->fh_r_ctl, - fc_hdr->fh_type)) + fc_hdr->fh_type)) { lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, "2540 Ring %d handler: unexpected Rctl " "x%x Type x%x received\n", LPFC_ELS_RING, fc_hdr->fh_r_ctl, fc_hdr->fh_type); + lpfc_in_buf_free(phba, &seq_dmabuf->dbuf); + } =20 /* Free iocb created in lpfc_prep_seq */ list_for_each_entry_safe(curr_iocb, next_iocb, --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E61FC433EF for ; Tue, 7 Jun 2022 22:17:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382272AbiFGWRt (ORCPT ); Tue, 7 Jun 2022 18:17:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379963AbiFGVLV (ORCPT ); Tue, 7 Jun 2022 17:11:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FD9D216832; Tue, 7 Jun 2022 11:52:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AD9A261579; Tue, 7 Jun 2022 18:52:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7F4DC385A2; Tue, 7 Jun 2022 18:52:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627956; bh=SrGB3I3yImzAPCnjAlFIOW+PK3rwCwo9unqbwzwEX88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VdhY1JnQ/+InuNghmeFUBIYHXkPjOkiDAVDnFIvyxPvi6Y6XxwU8l5ah/oNVMullk 9J74U0E+BnqXi5eZQ9PcGxKMq74V50jFaoZolFnITmYFzQ/4WkF2otK7HcFJ3kPCsy 9TMz6cVxRHAoj2aEQc1lVy6sp/DmELFgXYIbEMLs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hari Chandrakanthan , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 113/879] ath11k: disable spectral scan during spectral deinit Date: Tue, 7 Jun 2022 18:53:51 +0200 Message-Id: <20220607165005.982314027@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hari Chandrakanthan [ Upstream commit 161c64de239c7018e0295e7e0520a19f00aa32dc ] When ath11k modules are removed using rmmod with spectral scan enabled, crash is observed. Different crash trace is observed for each crash. Send spectral scan disable WMI command to firmware before cleaning the spectral dbring in the spectral_deinit API to avoid this crash. call trace from one of the crash observed: [ 1252.880802] Unable to handle kernel NULL pointer dereference at virtual = address 00000008 [ 1252.882722] pgd =3D 0f42e886 [ 1252.890955] [00000008] *pgd=3D00000000 [ 1252.893478] Internal error: Oops: 5 [#1] PREEMPT SMP ARM [ 1253.093035] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.89 #0 [ 1253.115261] Hardware name: Generic DT based system [ 1253.121149] PC is at ath11k_spectral_process_data+0x434/0x574 [ath11k] [ 1253.125940] LR is at 0x88e31017 [ 1253.132448] pc : [<7f9387b8>] lr : [<88e31017>] psr: a0000193 [ 1253.135488] sp : 80d01bc8 ip : 00000001 fp : 970e0000 [ 1253.141737] r10: 88e31000 r9 : 970ec000 r8 : 00000080 [ 1253.146946] r7 : 94734040 r6 : a0000113 r5 : 00000057 r4 : 00000000 [ 1253.152159] r3 : e18cb694 r2 : 00000217 r1 : 1df1f000 r0 : 00000001 [ 1253.158755] Flags: NzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segmen= t user [ 1253.165266] Control: 10c0383d Table: 5e71006a DAC: 00000055 [ 1253.172472] Process swapper/0 (pid: 0, stack limit =3D 0x60870141) [ 1253.458055] [<7f9387b8>] (ath11k_spectral_process_data [ath11k]) from [<= 7f917fdc>] (ath11k_dbring_buffer_release_event+0x214/0x2e4 [ath11k]) [ 1253.466139] [<7f917fdc>] (ath11k_dbring_buffer_release_event [ath11k]) f= rom [<7f8ea3c4>] (ath11k_wmi_tlv_op_rx+0x1840/0x29cc [ath11k]) [ 1253.478807] [<7f8ea3c4>] (ath11k_wmi_tlv_op_rx [ath11k]) from [<7f8fe868= >] (ath11k_htc_rx_completion_handler+0x180/0x4e0 [ath11k]) [ 1253.490699] [<7f8fe868>] (ath11k_htc_rx_completion_handler [ath11k]) fro= m [<7f91308c>] (ath11k_ce_per_engine_service+0x2c4/0x3b4 [ath11k]) [ 1253.502386] [<7f91308c>] (ath11k_ce_per_engine_service [ath11k]) from [<= 7f9a4198>] (ath11k_pci_ce_tasklet+0x28/0x80 [ath11k_pci]) [ 1253.514811] [<7f9a4198>] (ath11k_pci_ce_tasklet [ath11k_pci]) from [<803= 2227c>] (tasklet_action_common.constprop.2+0x64/0xe8) [ 1253.526476] [<8032227c>] (tasklet_action_common.constprop.2) from [<8030= 21e8>] (__do_softirq+0x130/0x2d0) [ 1253.537756] [<803021e8>] (__do_softirq) from [<80322610>] (irq_exit+0xcc= /0xe8) [ 1253.547304] [<80322610>] (irq_exit) from [<8036a4a4>] (__handle_domain_i= rq+0x60/0xb4) [ 1253.554428] [<8036a4a4>] (__handle_domain_irq) from [<805eb348>] (gic_ha= ndle_irq+0x4c/0x90) [ 1253.562321] [<805eb348>] (gic_handle_irq) from [<80301a78>] (__irq_svc+0= x58/0x8c) Tested-on: QCN6122 hw1.0 AHB WLAN.HK.2.6.0.1-00851-QCAHKSWPL_SILICONZ-1 Signed-off-by: Hari Chandrakanthan Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1649396345-349-1-git-send-email-quic_haric@= quicinc.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/spectral.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/spectral.c b/drivers/net/wirel= ess/ath/ath11k/spectral.c index 2b18871d5f7c..516a7b4cd180 100644 --- a/drivers/net/wireless/ath/ath11k/spectral.c +++ b/drivers/net/wireless/ath/ath11k/spectral.c @@ -212,7 +212,10 @@ static int ath11k_spectral_scan_config(struct ath11k *= ar, return -ENODEV; =20 arvif->spectral_enabled =3D (mode !=3D ATH11K_SPECTRAL_DISABLED); + + spin_lock_bh(&ar->spectral.lock); ar->spectral.mode =3D mode; + spin_unlock_bh(&ar->spectral.lock); =20 ret =3D ath11k_wmi_vdev_spectral_enable(ar, arvif->vdev_id, ATH11K_WMI_SPECTRAL_TRIGGER_CMD_CLEAR, @@ -843,9 +846,6 @@ static inline void ath11k_spectral_ring_free(struct ath= 11k *ar) { struct ath11k_spectral *sp =3D &ar->spectral; =20 - if (!sp->enabled) - return; - ath11k_dbring_srng_cleanup(ar, &sp->rx_ring); ath11k_dbring_buf_cleanup(ar, &sp->rx_ring); } @@ -897,15 +897,16 @@ void ath11k_spectral_deinit(struct ath11k_base *ab) if (!sp->enabled) continue; =20 - ath11k_spectral_debug_unregister(ar); - ath11k_spectral_ring_free(ar); + mutex_lock(&ar->conf_mutex); + ath11k_spectral_scan_config(ar, ATH11K_SPECTRAL_DISABLED); + mutex_unlock(&ar->conf_mutex); =20 spin_lock_bh(&sp->lock); - - sp->mode =3D ATH11K_SPECTRAL_DISABLED; sp->enabled =3D false; - spin_unlock_bh(&sp->lock); + + ath11k_spectral_debug_unregister(ar); + ath11k_spectral_ring_free(ar); } } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2B66C43334 for ; Tue, 7 Jun 2022 22:18:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383061AbiFGWSC (ORCPT ); Tue, 7 Jun 2022 18:18:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379974AbiFGVLV (ORCPT ); Tue, 7 Jun 2022 17:11:21 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37AA2217346; Tue, 7 Jun 2022 11:52:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 83BB6CE2424; Tue, 7 Jun 2022 18:52:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 735E2C385A2; Tue, 7 Jun 2022 18:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627958; bh=lYHN3M9R/cWlaC8P7t69WHiCUtqTwEPDM2IyLMD+e50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D6siFhsoDZ3XsQcYQQ9EOHAgNHDQoyNuH/47vuBvduLd4yKPmApuqU9P+7HIgmvQS vUMWYIdMNvSh0k2e1TW2O3chOUCYcJyb7bGNCxlXI/V43YtfTEPKGsIy2Bu7Gk90mG o2DfU5mFJWciyInSum69Q6ZGXJLolaJTkKfNkzDk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.18 114/879] ASoC: Intel: bytcr_rt5640: Add quirk for the HP Pro Tablet 408 Date: Tue, 7 Jun 2022 18:53:52 +0200 Message-Id: <20220607165006.010992767@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit ce216cfa84a4e1c23b105e652c550bdeaac9e922 ] Add a quirk for the HP Pro Tablet 408, this BYTCR tablet has no CHAN package in its ACPI tables and uses SSP0-AIF1 rather then SSP0-AIF2 which is the default for BYTCR devices. It also uses DMIC1 for the internal mic rather then the default IN3 and it uses JD2 rather then the default JD1 for jack-detect. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=3D211485 Signed-off-by: Hans de Goede Acked-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220427134918.527381-1-hdegoede@redhat.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/intel/boards/bytcr_rt5640.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards= /bytcr_rt5640.c index d76a505052fb..f81ae742faa7 100644 --- a/sound/soc/intel/boards/bytcr_rt5640.c +++ b/sound/soc/intel/boards/bytcr_rt5640.c @@ -773,6 +773,18 @@ static const struct dmi_system_id byt_rt5640_quirk_tab= le[] =3D { BYT_RT5640_OVCD_SF_0P75 | BYT_RT5640_MCLK_EN), }, + { /* HP Pro Tablet 408 */ + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP Pro Tablet 408"), + }, + .driver_data =3D (void *)(BYT_RT5640_DMIC1_MAP | + BYT_RT5640_JD_SRC_JD2_IN4N | + BYT_RT5640_OVCD_TH_1500UA | + BYT_RT5640_OVCD_SF_0P75 | + BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, { /* HP Stream 7 */ .matches =3D { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACD9EC43334 for ; Tue, 7 Jun 2022 22:14:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384254AbiFGWOV (ORCPT ); Tue, 7 Jun 2022 18:14:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379986AbiFGVLW (ORCPT ); Tue, 7 Jun 2022 17: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 67B26131F17; Tue, 7 Jun 2022 11:52:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A6E4B81F6D; Tue, 7 Jun 2022 18:52:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38863C385A2; Tue, 7 Jun 2022 18:52:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627962; bh=2u3HzTx97D8KukJGqGjYi4/l3+1TkIRnHr/uNhU+Aow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qesJY5Upl78/YcXh7FYhI20WSCEPDqagh8gvEhEoUTT0sdrRqfFaLIq0ZfvfO30si FELmgivSaC3mc8BdtTr8d9/b7HHrB+9Kw3DlD51duUTgbC2cg8vnkWcwUyDXjwoa+m qkDZpr6RCUqrdrYKr1GZUeq0NLkS3fYHgOtC/XRI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steven Price , Liviu Dudau , Sasha Levin Subject: [PATCH 5.18 115/879] drm/plane: Move range check for format_count earlier Date: Tue, 7 Jun 2022 18:53:53 +0200 Message-Id: <20220607165006.039995895@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Price [ Upstream commit 4b674dd69701c2e22e8e7770c1706a69f3b17269 ] While the check for format_count > 64 in __drm_universal_plane_init() shouldn't be hit (it's a WARN_ON), in its current position it will then leak the plane->format_types array and fail to call drm_mode_object_unregister() leaking the modeset identifier. Move it to the start of the function to avoid allocating those resources in the first place. Signed-off-by: Steven Price Signed-off-by: Liviu Dudau Link: https://lore.kernel.org/dri-devel/20211203102815.38624-1-steven.price= @arm.com/ Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/drm_plane.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index bf0daa8d9bbd..726f2f163c26 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -247,6 +247,13 @@ static int __drm_universal_plane_init(struct drm_devic= e *dev, if (WARN_ON(config->num_total_plane >=3D 32)) return -EINVAL; =20 + /* + * First driver to need more than 64 formats needs to fix this. Each + * format is encoded as a bit and the current code only supports a u64. + */ + if (WARN_ON(format_count > 64)) + return -EINVAL; + WARN_ON(drm_drv_uses_atomic_modeset(dev) && (!funcs->atomic_destroy_state || !funcs->atomic_duplicate_state)); @@ -268,13 +275,6 @@ static int __drm_universal_plane_init(struct drm_devic= e *dev, return -ENOMEM; } =20 - /* - * First driver to need more than 64 formats needs to fix this. Each - * format is encoded as a bit and the current code only supports a u64. - */ - if (WARN_ON(format_count > 64)) - return -EINVAL; - if (format_modifiers) { const uint64_t *temp_modifiers =3D format_modifiers; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B6FECCA49C for ; Tue, 7 Jun 2022 22:17:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347018AbiFGWRY (ORCPT ); Tue, 7 Jun 2022 18:17:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379991AbiFGVLW (ORCPT ); Tue, 7 Jun 2022 17: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 375D713B2D6; Tue, 7 Jun 2022 11:52: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 EFBE7B82018; Tue, 7 Jun 2022 18:52:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D497C385A5; Tue, 7 Jun 2022 18:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627964; bh=YKSYJ8feQQUks/Q0dsbpP6LiQTbUiyPC+M1UieNFIdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UaDeTQzLcO9lgD+YswtR87Z1+jxvkxyz/oPXHJn3Bho2b1mKhsiJL0RnfnuretEn9 01LX2OIgEh0qo8Y9WRgNmehIjrHrgdQ3zLfn67MFm1Vl75q6oaF4SWI0O/IxH7riTU 0QGlFUs+1Op/8Bj3FacsKopGEvTKIZykKt8RfTeY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mukul Joshi , Felix Kuehling , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 116/879] drm/amdkfd: Fix circular lock dependency warning Date: Tue, 7 Jun 2022 18:53:54 +0200 Message-Id: <20220607165006.068458107@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mukul Joshi [ Upstream commit b179fc28d521379ba7e0a38eec1a4c722e7ea634 ] [ 168.544078] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D [ 168.550309] WARNING: possible circular locking dependency detected [ 168.556523] 5.16.0-kfd-fkuehlin #148 Tainted: G E [ 168.562558] ------------------------------------------------------ [ 168.568764] kfdtest/3479 is trying to acquire lock: [ 168.573672] ffffffffc0927a70 (&topology_lock){++++}-{3:3}, at: kfd_topology_device_by_id+0x16/0x60 [amdgpu] [ 168.583663] but task is already holding lock: [ 168.589529] ffff97d303dee668 (&mm->mmap_lock#2){++++}-{3:3}, at: vm_mmap_pgoff+0xa9/0x180 [ 168.597755] which lock already depends on the new lock. [ 168.605970] the existing dependency chain (in reverse order) is: [ 168.613487] -> #3 (&mm->mmap_lock#2){++++}-{3:3}: [ 168.619700] lock_acquire+0xca/0x2e0 [ 168.623814] down_read+0x3e/0x140 [ 168.627676] do_user_addr_fault+0x40d/0x690 [ 168.632399] exc_page_fault+0x6f/0x270 [ 168.636692] asm_exc_page_fault+0x1e/0x30 [ 168.641249] filldir64+0xc8/0x1e0 [ 168.645115] call_filldir+0x7c/0x110 [ 168.649238] ext4_readdir+0x58e/0x940 [ 168.653442] iterate_dir+0x16a/0x1b0 [ 168.657558] __x64_sys_getdents64+0x83/0x140 [ 168.662375] do_syscall_64+0x35/0x80 [ 168.666492] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 168.672095] -> #2 (&type->i_mutex_dir_key#6){++++}-{3:3}: [ 168.679008] lock_acquire+0xca/0x2e0 [ 168.683122] down_read+0x3e/0x140 [ 168.686982] path_openat+0x5b2/0xa50 [ 168.691095] do_file_open_root+0xfc/0x190 [ 168.695652] file_open_root+0xd8/0x1b0 [ 168.702010] kernel_read_file_from_path_initns+0xc4/0x140 [ 168.709542] _request_firmware+0x2e9/0x5e0 [ 168.715741] request_firmware+0x32/0x50 [ 168.721667] amdgpu_cgs_get_firmware_info+0x370/0xdd0 [amdgpu] [ 168.730060] smu7_upload_smu_firmware_image+0x53/0x190 [amdgpu] [ 168.738414] fiji_start_smu+0xcf/0x4e0 [amdgpu] [ 168.745539] pp_dpm_load_fw+0x21/0x30 [amdgpu] [ 168.752503] amdgpu_pm_load_smu_firmware+0x4b/0x80 [amdgpu] [ 168.760698] amdgpu_device_fw_loading+0xb8/0x140 [amdgpu] [ 168.768412] amdgpu_device_init.cold+0xdf6/0x1716 [amdgpu] [ 168.776285] amdgpu_driver_load_kms+0x15/0x120 [amdgpu] [ 168.784034] amdgpu_pci_probe+0x19b/0x3a0 [amdgpu] [ 168.791161] local_pci_probe+0x40/0x80 [ 168.797027] work_for_cpu_fn+0x10/0x20 [ 168.802839] process_one_work+0x273/0x5b0 [ 168.808903] worker_thread+0x20f/0x3d0 [ 168.814700] kthread+0x176/0x1a0 [ 168.819968] ret_from_fork+0x1f/0x30 [ 168.825563] -> #1 (&adev->pm.mutex){+.+.}-{3:3}: [ 168.834721] lock_acquire+0xca/0x2e0 [ 168.840364] __mutex_lock+0xa2/0x930 [ 168.846020] amdgpu_dpm_get_mclk+0x37/0x60 [amdgpu] [ 168.853257] amdgpu_amdkfd_get_local_mem_info+0xba/0xe0 [amdgpu] [ 168.861547] kfd_create_vcrat_image_gpu+0x1b1/0xbb0 [amdgpu] [ 168.869478] kfd_create_crat_image_virtual+0x447/0x510 [amdgpu] [ 168.877884] kfd_topology_add_device+0x5c8/0x6f0 [amdgpu] [ 168.885556] kgd2kfd_device_init.cold+0x385/0x4c5 [amdgpu] [ 168.893347] amdgpu_amdkfd_device_init+0x138/0x180 [amdgpu] [ 168.901177] amdgpu_device_init.cold+0x141b/0x1716 [amdgpu] [ 168.909025] amdgpu_driver_load_kms+0x15/0x120 [amdgpu] [ 168.916458] amdgpu_pci_probe+0x19b/0x3a0 [amdgpu] [ 168.923442] local_pci_probe+0x40/0x80 [ 168.929249] work_for_cpu_fn+0x10/0x20 [ 168.935008] process_one_work+0x273/0x5b0 [ 168.940944] worker_thread+0x20f/0x3d0 [ 168.946623] kthread+0x176/0x1a0 [ 168.951765] ret_from_fork+0x1f/0x30 [ 168.957277] -> #0 (&topology_lock){++++}-{3:3}: [ 168.965993] check_prev_add+0x8f/0xbf0 [ 168.971613] __lock_acquire+0x1299/0x1ca0 [ 168.977485] lock_acquire+0xca/0x2e0 [ 168.982877] down_read+0x3e/0x140 [ 168.987975] kfd_topology_device_by_id+0x16/0x60 [amdgpu] [ 168.995583] kfd_device_by_id+0xa/0x20 [amdgpu] [ 169.002180] kfd_mmap+0x95/0x200 [amdgpu] [ 169.008293] mmap_region+0x337/0x5a0 [ 169.013679] do_mmap+0x3aa/0x540 [ 169.018678] vm_mmap_pgoff+0xdc/0x180 [ 169.024095] ksys_mmap_pgoff+0x186/0x1f0 [ 169.029734] do_syscall_64+0x35/0x80 [ 169.035005] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 169.041754] other info that might help us debug this: [ 169.053276] Chain exists of: &topology_lock --> &type->i_mutex_dir_key#6 --> &mm->mmap= _lock#2 [ 169.068389] Possible unsafe locking scenario: [ 169.076661] CPU0 CPU1 [ 169.082383] ---- ---- [ 169.088087] lock(&mm->mmap_lock#2); [ 169.092922] lock(&type->i_mutex_dir_key#6= ); [ 169.100975] lock(&mm->mmap_lock#2); [ 169.108320] lock(&topology_lock); [ 169.112957] *** DEADLOCK *** This commit fixes the deadlock warning by ensuring pm.mutex is not held while holding the topology lock. For this, kfd_local_mem_info is moved into the KFD dev struct and filled during device init. This cached value can then be used instead of querying the value again and again. Signed-off-by: Mukul Joshi Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 7 ++----- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 + drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 7 ++----- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd= /amdkfd/kfd_chardev.c index 607f65ab39ac..10cc834a5ac3 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -944,8 +944,6 @@ static int kfd_ioctl_acquire_vm(struct file *filep, str= uct kfd_process *p, =20 bool kfd_dev_is_large_bar(struct kfd_dev *dev) { - struct kfd_local_mem_info mem_info; - if (debug_largebar) { pr_debug("Simulate large-bar allocation on non large-bar machine\n"); return true; @@ -954,9 +952,8 @@ bool kfd_dev_is_large_bar(struct kfd_dev *dev) if (dev->use_iommu_v2) return false; =20 - amdgpu_amdkfd_get_local_mem_info(dev->adev, &mem_info); - if (mem_info.local_mem_size_private =3D=3D 0 && - mem_info.local_mem_size_public > 0) + if (dev->local_mem_info.local_mem_size_private =3D=3D 0 && + dev->local_mem_info.local_mem_size_public > 0) return true; return false; } diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/am= dkfd/kfd_crat.c index 1eaabd2cb41b..59b349a4c04a 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c @@ -2152,7 +2152,7 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_ima= ge, * report the total FB size (public+private) as a single * private heap. */ - amdgpu_amdkfd_get_local_mem_info(kdev->adev, &local_mem_info); + local_mem_info =3D kdev->local_mem_info; sub_type_hdr =3D (typeof(sub_type_hdr))((char *)sub_type_hdr + sub_type_hdr->length); =20 diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/= amdkfd/kfd_device.c index 62aa6c9d5123..c96d521447fc 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c @@ -575,6 +575,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, if (kfd_resume(kfd)) goto kfd_resume_error; =20 + amdgpu_amdkfd_get_local_mem_info(kfd->adev, &kfd->local_mem_info); + if (kfd_topology_add_device(kfd)) { dev_err(kfd_device, "Error adding device to topology\n"); goto kfd_topology_add_device_error; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/am= dkfd/kfd_priv.h index 8f58fc491b28..49a29a60b71e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h @@ -272,6 +272,7 @@ struct kfd_dev { =20 struct kgd2kfd_shared_resources shared_resources; struct kfd_vmid_info vm_info; + struct kfd_local_mem_info local_mem_info; =20 const struct kfd2kgd_calls *kfd2kgd; struct mutex doorbell_mutex; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/am= d/amdkfd/kfd_topology.c index 3bdcae239bc0..9fc24f6823df 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c @@ -1102,15 +1102,12 @@ static uint32_t kfd_generate_gpu_id(struct kfd_dev = *gpu) uint32_t buf[7]; uint64_t local_mem_size; int i; - struct kfd_local_mem_info local_mem_info; =20 if (!gpu) return 0; =20 - amdgpu_amdkfd_get_local_mem_info(gpu->adev, &local_mem_info); - - local_mem_size =3D local_mem_info.local_mem_size_private + - local_mem_info.local_mem_size_public; + local_mem_size =3D gpu->local_mem_info.local_mem_size_private + + gpu->local_mem_info.local_mem_size_public; =20 buf[0] =3D gpu->pdev->devfn; buf[1] =3D gpu->pdev->subsystem_vendor | --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F71CCCA485 for ; Tue, 7 Jun 2022 22:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384279AbiFGWKp (ORCPT ); Tue, 7 Jun 2022 18:10:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378969AbiFGVIC (ORCPT ); Tue, 7 Jun 2022 17:08:02 -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 0BFBC212CBE; Tue, 7 Jun 2022 11:50: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 81D00B82018; Tue, 7 Jun 2022 18:50:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0423C385A5; Tue, 7 Jun 2022 18:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627852; bh=4Ka0zqH5BPXKlynHTbbm9h1V2CMI319SCy/R6j+8HWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zXrWOx3yXpuCpFb4wwKbHEHRevCsW72Bf2uMq6wwKFxp4o3TPlNGbsb/m8KWFxX5A o2XBcmLqacBwxVte5O09eyvrDBi1+XOnFdWecwc1rqV50J8ZPr0cWEQlcYh1t3omdh LkEoier+KGwRZWIneZtUtYIdJjR2sPcn09nP8ftk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Alex Deucher , Evan Quan , Sasha Levin Subject: [PATCH 5.18 117/879] drm/amd/pm: fix the compile warning Date: Tue, 7 Jun 2022 18:53:55 +0200 Message-Id: <20220607165006.097552034@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Evan Quan [ Upstream commit 555238d92ac32dbad2d77ad2bafc48d17391990c ] Fix the compile warning below: drivers/gpu/drm/amd/amdgpu/../pm/legacy-dpm/kv_dpm.c:1641 kv_get_acp_boot_level() warn: always true condition '(table->entries[i]->cl= k >=3D 0) =3D> (0-u32max >=3D 0)' Reported-by: kernel test robot CC: Alex Deucher Signed-off-by: Evan Quan Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c b/drivers/gpu/drm/a= md/pm/legacy-dpm/kv_dpm.c index 8b23cc9f098a..8fd0782a2b20 100644 --- a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c +++ b/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c @@ -1623,19 +1623,7 @@ static int kv_update_samu_dpm(struct amdgpu_device *= adev, bool gate) =20 static u8 kv_get_acp_boot_level(struct amdgpu_device *adev) { - u8 i; - struct amdgpu_clock_voltage_dependency_table *table =3D - &adev->pm.dpm.dyn_state.acp_clock_voltage_dependency_table; - - for (i =3D 0; i < table->count; i++) { - if (table->entries[i].clk >=3D 0) /* XXX */ - break; - } - - if (i >=3D table->count) - i =3D table->count - 1; - - return i; + return 0; } =20 static void kv_update_acp_boot_level(struct amdgpu_device *adev) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE50ACCA48A for ; Tue, 7 Jun 2022 22:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384380AbiFGWLJ (ORCPT ); Tue, 7 Jun 2022 18:11:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379021AbiFGVIk (ORCPT ); Tue, 7 Jun 2022 17:08:40 -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 6A0D7213283; Tue, 7 Jun 2022 11:50: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 8AF7B612F2; Tue, 7 Jun 2022 18:50:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D7F7C385A2; Tue, 7 Jun 2022 18:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627855; bh=0SOjUx1vP3pC5to7NMBxAemGEoK1IKRZDN4I6BH/TuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wZ8fj7K/rSp7e9q6gUUKQ6bWkwXD3YrfqHRJUB1MUEOd+gY3IW7jucABHGpHjjYMd MvUmaiTWiaCTed7Tfhn11zfax2S7pCDN1+K4IX2lxHk55EsBV0eH+vHqSzTGP0F5wN cSN7F1FbSHjJsoELtzM/d8IX5sNmipbkR32zOnac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gong , Abhishek Kumar , Brian Norris , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 118/879] ath10k: skip ath10k_halt during suspend for driver state RESTARTING Date: Tue, 7 Jun 2022 18:53:56 +0200 Message-Id: <20220607165006.126929640@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Abhishek Kumar [ Upstream commit b72a4aff947ba807177bdabb43debaf2c66bee05 ] Double free crash is observed when FW recovery(caused by wmi timeout/crash) is followed by immediate suspend event. The FW recovery is triggered by ath10k_core_restart() which calls driver clean up via ath10k_halt(). When the suspend event occurs between the FW recovery, the restart worker thread is put into frozen state until suspend completes. The suspend event triggers ath10k_stop() which again triggers ath10k_halt() The double invocation of ath10k_halt() causes ath10k_htt_rx_free() to be called twice(Note: ath10k_htt_rx_alloc was not called by restart worker thread because of its frozen state), causing the crash. To fix this, during the suspend flow, skip call to ath10k_halt() in ath10k_stop() when the current driver state is ATH10K_STATE_RESTARTING. Also, for driver state ATH10K_STATE_RESTARTING, call ath10k_wait_for_suspend() in ath10k_stop(). This is because call to ath10k_wait_for_suspend() is skipped later in [ath10k_halt() > ath10k_core_stop()] for the driver state ATH10K_STATE_RESTARTING. The frozen restart worker thread will be cancelled during resume when the device comes out of suspend. Below is the crash stack for reference: [ 428.469167] ------------[ cut here ]------------ [ 428.469180] kernel BUG at mm/slub.c:4150! [ 428.469193] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI [ 428.469219] Workqueue: events_unbound async_run_entry_fn [ 428.469230] RIP: 0010:kfree+0x319/0x31b [ 428.469241] RSP: 0018:ffffa1fac015fc30 EFLAGS: 00010246 [ 428.469247] RAX: ffffedb10419d108 RBX: ffff8c05262b0000 [ 428.469252] RDX: ffff8c04a8c07000 RSI: 0000000000000000 [ 428.469256] RBP: ffffa1fac015fc78 R08: 0000000000000000 [ 428.469276] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 428.469285] Call Trace: [ 428.469295] ? dma_free_attrs+0x5f/0x7d [ 428.469320] ath10k_core_stop+0x5b/0x6f [ 428.469336] ath10k_halt+0x126/0x177 [ 428.469352] ath10k_stop+0x41/0x7e [ 428.469387] drv_stop+0x88/0x10e [ 428.469410] __ieee80211_suspend+0x297/0x411 [ 428.469441] rdev_suspend+0x6e/0xd0 [ 428.469462] wiphy_suspend+0xb1/0x105 [ 428.469483] ? name_show+0x2d/0x2d [ 428.469490] dpm_run_callback+0x8c/0x126 [ 428.469511] ? name_show+0x2d/0x2d [ 428.469517] __device_suspend+0x2e7/0x41b [ 428.469523] async_suspend+0x1f/0x93 [ 428.469529] async_run_entry_fn+0x3d/0xd1 [ 428.469535] process_one_work+0x1b1/0x329 [ 428.469541] worker_thread+0x213/0x372 [ 428.469547] kthread+0x150/0x15f [ 428.469552] ? pr_cont_work+0x58/0x58 [ 428.469558] ? kthread_blkcg+0x31/0x31 Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00288-QCARMSWPZ-1 Co-developed-by: Wen Gong Signed-off-by: Wen Gong Signed-off-by: Abhishek Kumar Reviewed-by: Brian Norris Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220426221859.v2.1.I650b809482e1af8d0156ed= 88b5dc2677a0711d46@changeid Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath10k/mac.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/a= th/ath10k/mac.c index b11aaee8b8c0..a11b31191d5a 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -5339,13 +5339,29 @@ static int ath10k_start(struct ieee80211_hw *hw) static void ath10k_stop(struct ieee80211_hw *hw) { struct ath10k *ar =3D hw->priv; + u32 opt; =20 ath10k_drain_tx(ar); =20 mutex_lock(&ar->conf_mutex); if (ar->state !=3D ATH10K_STATE_OFF) { - if (!ar->hw_rfkill_on) - ath10k_halt(ar); + if (!ar->hw_rfkill_on) { + /* If the current driver state is RESTARTING but not yet + * fully RESTARTED because of incoming suspend event, + * then ath10k_halt() is already called via + * ath10k_core_restart() and should not be called here. + */ + if (ar->state !=3D ATH10K_STATE_RESTARTING) { + ath10k_halt(ar); + } else { + /* Suspending here, because when in RESTARTING + * state, ath10k_core_stop() skips + * ath10k_wait_for_suspend(). + */ + opt =3D WMI_PDEV_SUSPEND_AND_DISABLE_INTR; + ath10k_wait_for_suspend(ar, opt); + } + } ar->state =3D ATH10K_STATE_OFF; } mutex_unlock(&ar->conf_mutex); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DA38C43334 for ; Tue, 7 Jun 2022 22:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384333AbiFGWK7 (ORCPT ); Tue, 7 Jun 2022 18:10:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379044AbiFGVIn (ORCPT ); Tue, 7 Jun 2022 17:08:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80C80213295; Tue, 7 Jun 2022 11:50: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 38B85616AF; Tue, 7 Jun 2022 18:50:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47D90C385A2; Tue, 7 Jun 2022 18:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627857; bh=vCRnmPPAkAz3/aZj4ABaUxpyCMnNCPoQsR3C6GEciKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1oGaZmh5+HOZP+0AOFO2VQ7RRCvPRQ7xn+uQCslgFJ+XLKEpcIH0WjqQz0e7WBFzj xMi50PxMsHng/5XnlXtO51Lw7lmP5D0NPlYKdKERC/+z9DhaoA57yOIbbbHX7MWdUn 56ZAnxVsxT094PPEcqqidZ+QnJ1ebPjP9NP6FVUo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandru Elisei , Marc Zyngier , Catalin Marinas , Sasha Levin Subject: [PATCH 5.18 119/879] arm64: compat: Do not treat syscall number as ESR_ELx for a bad syscall Date: Tue, 7 Jun 2022 18:53:57 +0200 Message-Id: <20220607165006.156133667@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexandru Elisei [ Upstream commit 3fed9e551417b84038b15117732ea4505eee386b ] If a compat process tries to execute an unknown system call above the __ARM_NR_COMPAT_END number, the kernel sends a SIGILL signal to the offending process. Information about the error is printed to dmesg in compat_arm_syscall() -> arm64_notify_die() -> arm64_force_sig_fault() -> arm64_show_signal(). arm64_show_signal() interprets a non-zero value for current->thread.fault_code as an exception syndrome and displays the message associated with the ESR_ELx.EC field (bits 31:26). current->thread.fault_code is set in compat_arm_syscall() -> arm64_notify_die() with the bad syscall number instead of a valid ESR_ELx value. This means that the ESR_ELx.EC field has the value that the user set for the syscall number and the kernel can end up printing bogus exception messages*. For example, for the syscall number 0x68000000, which evaluates to ESR_ELx.EC value of 0x1A (ESR_ELx_EC_FPAC) the kernel prints this error: [ 18.349161] syscall[300]: unhandled exception: ERET/ERETAA/ERETAB, ESR 0= x68000000, Oops - bad compat syscall(2) in syscall[10000+50000] [ 18.350639] CPU: 2 PID: 300 Comm: syscall Not tainted 5.18.0-rc1 #79 [ 18.351249] Hardware name: Pine64 RockPro64 v2.0 (DT) [..] which is misleading, as the bad compat syscall has nothing to do with pointer authentication. Stop arm64_show_signal() from printing exception syndrome information by having compat_arm_syscall() set the ESR_ELx value to 0, as it has no meaning for an invalid system call number. The example above now becomes: [ 19.935275] syscall[301]: unhandled exception: Oops - bad compat syscall= (2) in syscall[10000+50000] [ 19.936124] CPU: 1 PID: 301 Comm: syscall Not tainted 5.18.0-rc1-00005-g= 7e08006d4102 #80 [ 19.936894] Hardware name: Pine64 RockPro64 v2.0 (DT) [..] which although shows less information because the syscall number, wrongfully advertised as the ESR value, is missing, it is better than showing plainly wrong information. The syscall number can be easily obtained with strace. *A 32-bit value above or equal to 0x8000_0000 is interpreted as a negative integer in compat_arm_syscal() and the condition scno < __ARM_NR_COMPAT_END evaluates to true; the syscall will exit to userspace in this case with the ENOSYS error code instead of arm64_notify_die() being called. Signed-off-by: Alexandru Elisei Reviewed-by: Marc Zyngier Link: https://lore.kernel.org/r/20220425114444.368693-3-alexandru.elisei@ar= m.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/kernel/sys_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c index 12c6864e51e1..df14336c3a29 100644 --- a/arch/arm64/kernel/sys_compat.c +++ b/arch/arm64/kernel/sys_compat.c @@ -113,6 +113,6 @@ long compat_arm_syscall(struct pt_regs *regs, int scno) addr =3D instruction_pointer(regs) - (compat_thumb_mode(regs) ? 2 : 4); =20 arm64_notify_die("Oops - bad compat syscall(2)", regs, - SIGILL, ILL_ILLTRP, addr, scno); + SIGILL, ILL_ILLTRP, addr, 0); return 0; } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CF03CCA489 for ; Tue, 7 Jun 2022 22:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384355AbiFGWLE (ORCPT ); Tue, 7 Jun 2022 18:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377717AbiFGVIv (ORCPT ); Tue, 7 Jun 2022 17:08:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C16572132A7; Tue, 7 Jun 2022 11:51:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D4640616A9; Tue, 7 Jun 2022 18:51:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E72FEC385A2; Tue, 7 Jun 2022 18:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627860; bh=dMH/huRRqAdoiUb0Rl7RxxXYfjvxgvx+UaGWVg1/P4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bg/NmM5c4SEv5dvVDuXZjvHBhjrJ9EH0JPBBlv7NP9bUP3NZnruE2AqCOa7qb/gNF iuMKcP+XHkqGQb87uma6U+imf9Yp7Lj6ZBqh8oRLYzVRdxmo13eFZAU+d9hIZewPPg dawDGDAUVPTP+rQbfdR/74qooL5Zb4yXp4Dj3Cpc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Lv Ruyi , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 5.18 120/879] drm: msm: fix error check return value of irq_of_parse_and_map() Date: Tue, 7 Jun 2022 18:53:58 +0200 Message-Id: <20220607165006.185252914@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lv Ruyi [ Upstream commit b9e4f1d2b505df8e2439b63e67afaa287c1c43e2 ] The irq_of_parse_and_map() function returns 0 on failure, and does not return an negative value. Reported-by: Zeal Robot Signed-off-by: Lv Ruyi Reviewed-by: Dmitry Baryshkov Patchwork: https://patchwork.freedesktop.org/patch/483175/ Link: https://lore.kernel.org/r/20220424031959.3172406-1-lv.ruyi@zte.com.cn Signed-off-by: Dmitry Baryshkov Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm= /disp/mdp5/mdp5_kms.c index 3b92372e7bdf..1d4bbde29320 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -570,9 +570,9 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) } =20 irq =3D irq_of_parse_and_map(pdev->dev.of_node, 0); - if (irq < 0) { - ret =3D irq; - DRM_DEV_ERROR(&pdev->dev, "failed to get irq: %d\n", ret); + if (!irq) { + ret =3D -EINVAL; + DRM_DEV_ERROR(&pdev->dev, "failed to get irq\n"); goto fail; } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BA23C43334 for ; Tue, 7 Jun 2022 22:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383600AbiFGWMC (ORCPT ); Tue, 7 Jun 2022 18:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378725AbiFGVJT (ORCPT ); Tue, 7 Jun 2022 17:09:19 -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 7CC6D213E43; Tue, 7 Jun 2022 11:51:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3A95BB822C0; Tue, 7 Jun 2022 18:51:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DBB4C385A2; Tue, 7 Jun 2022 18:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627862; bh=ooRjUvmGJzzu/siEDXfgX0wur8PrGZ7/pd2kHQ/UvyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EBk4j5UmYfj/W4AuAlj2t2riqr/z4rfZJLrs9jWz4fZEk8on5MbpcQ/AveJOsT/E5 +/FtsI/UNz+0Q6R1ChtlgSBCyg7B3cmB8AUX3C0ag1C+gKumExsWVHXiY/qy1RBZJ1 0Vhoq7j1nOxSw1K6RP6+PGgBCKlduIPXkpPnNuLE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Rob Clark , Jessica Zhang , Sasha Levin Subject: [PATCH 5.18 121/879] drm/msm/dpu: Clean up CRC debug logs Date: Tue, 7 Jun 2022 18:53:59 +0200 Message-Id: <20220607165006.213077149@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jessica Zhang [ Upstream commit 3ce8bdca394fc606b55e7c5ed779d171aaae5d09 ] Currently, dpu_hw_lm_collect_misr returns EINVAL if CRC is disabled. This causes a lot of spam in the DRM debug logs as it's called for every vblank. Instead of returning EINVAL when CRC is disabled in dpu_hw_lm_collect_misr, let's return ENODATA and add an extra ENODATA check before the debug log in dpu_crtc_get_crc. Changes since V1: - Added reported-by and suggested-by tags Reported-by: Dmitry Baryshkov Suggested-by: Rob Clark Signed-off-by: Jessica Zhang Tested-by: Jessica Zhang # RB5 (qrb5165) Reviewed-by: Dmitry Baryshkov Patchwork: https://patchwork.freedesktop.org/patch/484274/ Link: https://lore.kernel.org/r/20220430005210.339-1-quic_jesszhan@quicinc.= com Signed-off-by: Dmitry Baryshkov Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 3 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm= /disp/dpu1/dpu_crtc.c index 7763558ef566..16ba9f9b9a78 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -204,7 +204,8 @@ static int dpu_crtc_get_crc(struct drm_crtc *crtc) rc =3D m->hw_lm->ops.collect_misr(m->hw_lm, &crcs[i]); =20 if (rc) { - DRM_DEBUG_DRIVER("MISR read failed\n"); + if (rc !=3D -ENODATA) + DRM_DEBUG_DRIVER("MISR read failed\n"); return rc; } } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c b/drivers/gpu/drm/ms= m/disp/dpu1/dpu_hw_lm.c index 86363c0ec834..462f5082099e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c @@ -138,7 +138,7 @@ static int dpu_hw_lm_collect_misr(struct dpu_hw_mixer *= ctx, u32 *misr_value) ctrl =3D DPU_REG_READ(c, LM_MISR_CTRL); =20 if (!(ctrl & LM_MISR_CTRL_ENABLE)) - return -EINVAL; + return -ENODATA; =20 if (!(ctrl & LM_MISR_CTRL_STATUS)) return -EINVAL; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15727C433EF for ; Tue, 7 Jun 2022 22:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379441AbiFGWLz (ORCPT ); Tue, 7 Jun 2022 18:11:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379215AbiFGVJX (ORCPT ); Tue, 7 Jun 2022 17:09:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 893BD213E40; Tue, 7 Jun 2022 11:51: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 ams.source.kernel.org (Postfix) with ESMTPS id 1A52DB82182; Tue, 7 Jun 2022 18:51:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 630C3C385A2; Tue, 7 Jun 2022 18:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627865; bh=agAvA2UlDjU1S+805plgMgA31btECECZRC2FbGPFZ+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=db8ufcIahlPoFEjJGEHd0OOxv7DiNtXbb9nNyB7VUW64t9IIOaTwe0h9Fot9+VuXb 6YRoBX4N8Lu+Dk7G/ZxIuJTtYEW6wQiH5eqUsXvziavtUpv5/U7/1AafQ9cHIykQ2L qy1Z53vR/qP17nPwgN0R2BDi4H1VBrzJtLMYnoDQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Filippov , Sasha Levin Subject: [PATCH 5.18 122/879] xtensa: move trace_hardirqs_off call back to entry.S Date: Tue, 7 Jun 2022 18:54:00 +0200 Message-Id: <20220607165006.242073367@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Max Filippov [ Upstream commit de4415d0bac91192ee9c74e849bc61429efa9b42 ] Context tracking call must be done after hardirq tracking call, otherwise lockdep_assert_irqs_disabled called from rcu_eqs_exit gives a warning. To avoid context tracking logic duplication for IRQ/exception entry paths move trace_hardirqs_off call back to common entry code. Signed-off-by: Max Filippov Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/xtensa/kernel/entry.S | 19 +++++++++++++------ arch/xtensa/kernel/traps.c | 11 ++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index 6b6eff658795..07d683d94e17 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S @@ -442,7 +442,6 @@ KABI_W or a3, a3, a0 moveqz a3, a0, a2 # a3 =3D LOCKLEVEL iff interrupt KABI_W movi a2, PS_WOE_MASK KABI_W or a3, a3, a2 - rsr a2, exccause #endif =20 /* restore return address (or 0 if return to userspace) */ @@ -469,19 +468,27 @@ KABI_W or a3, a3, a2 =20 save_xtregs_opt a1 a3 a4 a5 a6 a7 PT_XTREGS_OPT =09 +#ifdef CONFIG_TRACE_IRQFLAGS + rsr abi_tmp0, ps + extui abi_tmp0, abi_tmp0, PS_INTLEVEL_SHIFT, PS_INTLEVEL_WIDTH + beqz abi_tmp0, 1f + abi_call trace_hardirqs_off +1: +#endif + /* Go to second-level dispatcher. Set up parameters to pass to the * exception handler and call the exception handler. */ =20 - rsr a4, excsave1 - addx4 a4, a2, a4 - l32i a4, a4, EXC_TABLE_DEFAULT # load handler - mov abi_arg1, a2 # pass EXCCAUSE + l32i abi_arg1, a1, PT_EXCCAUSE # pass EXCCAUSE + rsr abi_tmp0, excsave1 + addx4 abi_tmp0, abi_arg1, abi_tmp0 + l32i abi_tmp0, abi_tmp0, EXC_TABLE_DEFAULT # load handler mov abi_arg0, a1 # pass stack frame =20 /* Call the second-level handler */ =20 - abi_callx a4 + abi_callx abi_tmp0 =20 /* Jump here for exception exit */ .global common_exception_return diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index 9345007d474d..5f86208c67c8 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c @@ -242,12 +242,8 @@ DEFINE_PER_CPU(unsigned long, nmi_count); =20 void do_nmi(struct pt_regs *regs) { - struct pt_regs *old_regs; + struct pt_regs *old_regs =3D set_irq_regs(regs); =20 - if ((regs->ps & PS_INTLEVEL_MASK) < LOCKLEVEL) - trace_hardirqs_off(); - - old_regs =3D set_irq_regs(regs); nmi_enter(); ++*this_cpu_ptr(&nmi_count); check_valid_nmi(); @@ -269,12 +265,9 @@ void do_interrupt(struct pt_regs *regs) XCHAL_INTLEVEL6_MASK, XCHAL_INTLEVEL7_MASK, }; - struct pt_regs *old_regs; + struct pt_regs *old_regs =3D set_irq_regs(regs); unsigned unhandled =3D ~0u; =20 - trace_hardirqs_off(); - - old_regs =3D set_irq_regs(regs); irq_enter(); =20 for (;;) { --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF096CCA48B for ; Tue, 7 Jun 2022 22:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384426AbiFGWLb (ORCPT ); Tue, 7 Jun 2022 18:11:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379238AbiFGVJY (ORCPT ); Tue, 7 Jun 2022 17:09:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80BDF213E56; Tue, 7 Jun 2022 11:51:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 149D5616A9; Tue, 7 Jun 2022 18:51:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F4BEC385A2; Tue, 7 Jun 2022 18:51:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627868; bh=MQrjqXErBDcH5v3vhgMjiO1PsCtlzbFiX1PZbys4/vo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hv9qn/4tI5TQnohFqI1DYvgC5EeehWHd35yiJh6SXP6WMM3PZSaOCq7Tjczr7h4hI 4kAiwciptH7MMyQjTdyVxLsQPe467Iboj6t6EKp1pEzzS9NC0Ea/UlRs10hEvJM6tJ ZHITIMj3uaYjh1DmMqNnmYYWVNCq4FUl7KIoErHY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gong , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 123/879] ath11k: fix warning of not found station for bssid in message Date: Tue, 7 Jun 2022 18:54:01 +0200 Message-Id: <20220607165006.271462013@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wen Gong [ Upstream commit 7330e1ec9748948177830c6e1a13379835d577f9 ] When test connect/disconnect to an AP frequently with WCN6855, sometimes it show below log. [ 277.040121] wls1: deauthenticating from 8c:21:0a:b3:5a:64 by local choic= e (Reason: 3=3DDEAUTH_LEAVING) [ 277.050906] ath11k_pci 0000:05:00.0: wmi stats vdev id 0 mac 00:03:7f:29= :61:11 [ 277.050944] ath11k_pci 0000:05:00.0: wmi stats bssid 8c:21:0a:b3:5a:64 v= if pK-error [ 277.050954] ath11k_pci 0000:05:00.0: not found station for bssid 8c:21:0= a:b3:5a:64 [ 277.050961] ath11k_pci 0000:05:00.0: failed to parse rssi chain -71 [ 277.050967] ath11k_pci 0000:05:00.0: failed to pull fw stats: -71 [ 277.050976] ath11k_pci 0000:05:00.0: wmi stats vdev id 0 mac 00:03:7f:29= :61:11 [ 277.050983] ath11k_pci 0000:05:00.0: wmi stats bssid 8c:21:0a:b3:5a:64 v= if pK-error [ 277.050989] ath11k_pci 0000:05:00.0: not found station for bssid 8c:21:0= a:b3:5a:64 [ 277.050995] ath11k_pci 0000:05:00.0: failed to parse rssi chain -71 [ 277.051000] ath11k_pci 0000:05:00.0: failed to pull fw stats: -71 [ 278.064050] ath11k_pci 0000:05:00.0: failed to request fw stats: -110 Reason is: When running disconnect operation, sta_info removed from local->sta_hash by __sta_info_destroy_part1() from __sta_info_flush(), after this, ieee80211_find_sta_by_ifaddr() which called by ath11k_wmi_tlv_fw_stats_data_parse() and ath11k_wmi_tlv_rssi_chain_parse() cannot find this station, then failed log printed. steps are like this: 1. when disconnect from AP, __sta_info_destroy() called __sta_info_destroy_= part1() and __sta_info_destroy_part2(). 2. in __sta_info_destroy_part1(), it has "sta_info_hash_del(local, sta)" and "list_del_rcu(&sta->list)", it will remove the ieee80211_sta from the list of ieee80211_hw. 3. in __sta_info_destroy_part2(), it called drv_sta_state()->ath11k_mac_op_= sta_state(), then peer->sta is clear at this moment. 4. in __sta_info_destroy_part2(), it then called sta_set_sinfo()->drv_sta_s= tatistics() ->ath11k_mac_op_sta_statistics(), then WMI_REQUEST_STATS_CMDID sent to firm= ware. 5. WMI_UPDATE_STATS_EVENTID reported from firmware, at this moment, the ieee80211_sta can not be found again because it has remove from list in step2 and also peer->sta is clear in step3. 6. in __sta_info_destroy_part2(), it then called cleanup_single_sta()-> sta_info_free()->kfree(sta), at this moment, the ieee80211_sta is freed in memory, then the failed log will not happen because function ath11k_mac_op_sta_state() will not be called. Actually this print log is not a real error, it is only to skip parse the info, so change to skip print by default debug setting. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_L= ITE-3 Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220428022426.2927-1-quic_wgong@quicinc.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/wmi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/a= th/ath11k/wmi.c index 2751fe8814df..0900f75eef20 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -5789,9 +5789,9 @@ static int ath11k_wmi_tlv_rssi_chain_parse(struct ath= 11k_base *ab, arvif->bssid, NULL); if (!sta) { - ath11k_warn(ab, "not found station for bssid %pM\n", - arvif->bssid); - ret =3D -EPROTO; + ath11k_dbg(ab, ATH11K_DBG_WMI, + "not found station of bssid %pM for rssi chain\n", + arvif->bssid); goto exit; } =20 @@ -5889,8 +5889,9 @@ static int ath11k_wmi_tlv_fw_stats_data_parse(struct = ath11k_base *ab, "wmi stats vdev id %d snr %d\n", src->vdev_id, src->beacon_snr); } else { - ath11k_warn(ab, "not found station for bssid %pM\n", - arvif->bssid); + ath11k_dbg(ab, ATH11K_DBG_WMI, + "not found station of bssid %pM for vdev stat\n", + arvif->bssid); } } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA576CCA48C for ; Tue, 7 Jun 2022 22:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384411AbiFGWLW (ORCPT ); Tue, 7 Jun 2022 18:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379244AbiFGVJY (ORCPT ); Tue, 7 Jun 2022 17:09: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 4DE8A213E60; Tue, 7 Jun 2022 11:51: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 D5BED61579; Tue, 7 Jun 2022 18:51:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC2C5C385A5; Tue, 7 Jun 2022 18:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627871; bh=IOZQFxD3Ei8X9FXly0Xd6AHPYzqasxfP4I4dQecQaZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zs444ldMZnvF+txMVkwjEA5FBDOXbcMeJMNfBXuCoE3vJaXZJShan7SCrXxdkxvfM J2Yhzjs4ufUHwsWedwnb3AKY+2KHaM8uycLmU6d+RLk8+8AB2tcmWSC4vxs1RZK5XU gX5AZnSq15hDXa42BKI6ncN89oi75RsRSyRsVU6M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bodo Stroesser , Xiaoguang Wang , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 124/879] scsi: target: tcmu: Fix possible data corruption Date: Tue, 7 Jun 2022 18:54:02 +0200 Message-Id: <20220607165006.300873828@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaoguang Wang [ Upstream commit bb9b9eb0ae2e9d3f6036f0ad907c3a83dcd43485 ] When tcmu_vma_fault() gets a page successfully, before the current context completes page fault procedure, find_free_blocks() may run and call unmap_mapping_range() to unmap the page. Assume that when find_free_blocks() initially completes and the previous page fault procedure starts to run again and completes, then one truncated page has been mapped to userspace. But note that tcmu_vma_fault() has gotten a refcount for the page so any other subsystem won't be able to use the page unless the userspace address is unmapped later. If another command subsequently runs and needs to extend dbi_thresh it may reuse the corresponding slot for the previous page in data_bitmap. Then though we'll allocate new page for this slot in data_area, no page fault will happen because we have a valid map and the real request's data will be lost. Filesystem implementations will also run into this issue but they usually lock the page when vm_operations_struct->fault gets a page and unlock the page after finish_fault() completes. For truncate filesystems lock pages in truncate_inode_pages() to protect against racing wrt. page faults. To fix this possible data corruption scenario we can apply a method similar to the filesystems. For pages that are to be freed, tcmu_blocks_release() locks and unlocks. Make tcmu_vma_fault() also lock found page under cmdr_lock. At the same time, since tcmu_vma_fault() gets an extra page refcount, tcmu_blocks_release() won't free pages if pages are in page fault procedure, which means it is safe to call tcmu_blocks_release() before unmap_mapping_range(). With these changes tcmu_blocks_release() will wait for all page faults to be completed before calling unmap_mapping_range(). And later, if unmap_mapping_range() is called, it will ensure stale mappings are removed. Link: https://lore.kernel.org/r/20220421023735.9018-1-xiaoguang.wang@linux.= alibaba.com Reviewed-by: Bodo Stroesser Signed-off-by: Xiaoguang Wang Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/target/target_core_user.c | 40 ++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core= _user.c index fd7267baa707..b1fd06edea59 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1667,6 +1668,26 @@ static u32 tcmu_blocks_release(struct tcmu_dev *udev= , unsigned long first, xas_lock(&xas); xas_for_each(&xas, page, (last + 1) * udev->data_pages_per_blk - 1) { xas_store(&xas, NULL); + /* + * While reaching here there may be page faults occurring on + * the to-be-released pages. A race condition may occur if + * unmap_mapping_range() is called before page faults on these + * pages have completed; a valid but stale map is created. + * + * If another command subsequently runs and needs to extend + * dbi_thresh, it may reuse the slot corresponding to the + * previous page in data_bitmap. Though we will allocate a new + * page for the slot in data_area, no page fault will happen + * because we have a valid map. Therefore the command's data + * will be lost. + * + * We lock and unlock pages that are to be released to ensure + * all page faults have completed. This way + * unmap_mapping_range() can ensure stale maps are cleanly + * removed. + */ + lock_page(page); + unlock_page(page); __free_page(page); pages_freed++; } @@ -1822,6 +1843,7 @@ static struct page *tcmu_try_get_data_page(struct tcm= u_dev *udev, uint32_t dpi) page =3D xa_load(&udev->data_pages, dpi); if (likely(page)) { get_page(page); + lock_page(page); mutex_unlock(&udev->cmdr_lock); return page; } @@ -1863,6 +1885,7 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf) struct page *page; unsigned long offset; void *addr; + vm_fault_t ret =3D 0; =20 int mi =3D tcmu_find_mem_index(vmf->vma); if (mi < 0) @@ -1887,10 +1910,11 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *v= mf) page =3D tcmu_try_get_data_page(udev, dpi); if (!page) return VM_FAULT_SIGBUS; + ret =3D VM_FAULT_LOCKED; } =20 vmf->page =3D page; - return 0; + return ret; } =20 static const struct vm_operations_struct tcmu_vm_ops =3D { @@ -3205,12 +3229,22 @@ static void find_free_blocks(void) udev->dbi_max =3D block; } =20 + /* + * Release the block pages. + * + * Also note that since tcmu_vma_fault() gets an extra page + * refcount, tcmu_blocks_release() won't free pages if pages + * are mapped. This means it is safe to call + * tcmu_blocks_release() before unmap_mapping_range() which + * drops the refcount of any pages it unmaps and thus releases + * them. + */ + pages_freed =3D tcmu_blocks_release(udev, start, end - 1); + /* Here will truncate the data area from off */ off =3D udev->data_off + (loff_t)start * udev->data_blk_size; unmap_mapping_range(udev->inode->i_mapping, off, 0, 1); =20 - /* Release the block pages */ - pages_freed =3D tcmu_blocks_release(udev, start, end - 1); mutex_unlock(&udev->cmdr_lock); =20 total_pages_freed +=3D pages_freed; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3433C433EF for ; Tue, 7 Jun 2022 22:11:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350977AbiFGWLt (ORCPT ); Tue, 7 Jun 2022 18:11:49 -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 S1379288AbiFGVJ0 (ORCPT ); Tue, 7 Jun 2022 17:09:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBE67213E61; Tue, 7 Jun 2022 11:51: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 3F12EB8220B; Tue, 7 Jun 2022 18:51:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2AE7C385A2; Tue, 7 Jun 2022 18:51:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627874; bh=MDwfBG7S4XMz0GzRuwAmHXVTxzGrPYUTQCoPOICLb8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kn2fkZpEaw4Wg/C6eFoe8PFdpMYytQFGJ+WF7M2tW9qRhz7WO4594K8Hl1AaUyee5 IDBjJAO6jwKusJ6k5O3LzN5aMyczm0XtXIIEN3p5Zs0kVE/olKVsZy4VkCtlLr5vBT Sb5A79AtdMqG9NJHHzamDarX6hljAB6FA1flO6Zo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, jianghaoran , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 125/879] ipv6: Dont send rs packets to the interface of ARPHRD_TUNNEL Date: Tue, 7 Jun 2022 18:54:03 +0200 Message-Id: <20220607165006.330043585@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: jianghaoran [ Upstream commit b52e1cce31ca721e937d517411179f9196ee6135 ] ARPHRD_TUNNEL interface can't process rs packets and will generate TX errors ex: ip tunnel add ethn mode ipip local 192.168.1.1 remote 192.168.1.2 ifconfig ethn x.x.x.x ethn: flags=3D209 mtu 1480 inet x.x.x.x netmask 255.255.255.255 destination x.x.x.x inet6 fe80::5efe:ac1e:3cdb prefixlen 64 scopeid 0x20 tunnel txqueuelen 1000 (IPIP Tunnel) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 3 dropped 0 overruns 0 carrier 0 collisions 0 Signed-off-by: jianghaoran Link: https://lore.kernel.org/r/20220429053802.246681-1-jianghaoran@kylinos= .cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/ipv6/addrconf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 1afc4c024981..51e77dc6571a 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -4219,7 +4219,8 @@ static void addrconf_dad_completed(struct inet6_ifadd= r *ifp, bool bump_id, send_rs =3D send_mld && ipv6_accept_ra(ifp->idev) && ifp->idev->cnf.rtr_solicits !=3D 0 && - (dev->flags&IFF_LOOPBACK) =3D=3D 0; + (dev->flags & IFF_LOOPBACK) =3D=3D 0 && + (dev->type !=3D ARPHRD_TUNNEL); read_unlock_bh(&ifp->idev->lock); =20 /* While dad is in progress mld report's source address is in6_addrany. --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 486C7CCA48F for ; Tue, 7 Jun 2022 22:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384453AbiFGWLr (ORCPT ); Tue, 7 Jun 2022 18:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379009AbiFGVJ0 (ORCPT ); Tue, 7 Jun 2022 17:09:26 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6054D213E7B; Tue, 7 Jun 2022 11:51:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 92FC4CE2425; Tue, 7 Jun 2022 18:51:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F935C385A2; Tue, 7 Jun 2022 18:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627877; bh=wWAvOVOPQT5CaVYQmJhM10amzags21436o88ZdkxGgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0LwxNlBWNyt/fCLkbc2h6IB8ekgWpW3QPTxgVslK05J4+HzmIks+INDsjc+ASwCfs 0SE5GkflgxyHHYVJHPXPcJek2Utidj6KwFEaZSjxDX1eVt6/cg2IGU3VgUeYhJaw0m 8Tw8VuEOf7eIPwRsedRgOINaJAV+bfUc/2yIKvmc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ziyang Xuan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 126/879] net/mlx5: use kvfree() for kvzalloc() in mlx5_ct_fs_smfs_matcher_create Date: Tue, 7 Jun 2022 18:54:04 +0200 Message-Id: <20220607165006.358583026@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ziyang Xuan [ Upstream commit c389362096be8ee69ec3a163a0699a31e84b8451 ] The memory of spec is allocated with kvzalloc(), the corresponding release function should not be kfree(), use kvfree() instead. Generated by: scripts/coccinelle/api/kfree_mismatch.cocci Signed-off-by: Ziyang Xuan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c b/d= rivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c index bec9ed0103a9..2b80fe73549d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c @@ -101,7 +101,7 @@ mlx5_ct_fs_smfs_matcher_create(struct mlx5_ct_fs *fs, s= truct mlx5dr_table *tbl, spec->match_criteria_enable =3D MLX5_MATCH_MISC_PARAMETERS_2 | MLX5_MATCH= _OUTER_HEADERS; =20 dr_matcher =3D mlx5_smfs_matcher_create(tbl, priority, spec); - kfree(spec); + kvfree(spec); if (!dr_matcher) return ERR_PTR(-EINVAL); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2975DC43334 for ; Tue, 7 Jun 2022 22:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353194AbiFGWMG (ORCPT ); Tue, 7 Jun 2022 18:12:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379347AbiFGVJa (ORCPT ); Tue, 7 Jun 2022 17:09:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B473214428; Tue, 7 Jun 2022 11:51: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 9B0ACB82182; Tue, 7 Jun 2022 18:51:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DACFC385A2; Tue, 7 Jun 2022 18:51:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627882; bh=KIXhqxSYoKrP4kKBC0eYCNhdJSzSYEi5MBaoOve82dc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z822kWUn45WJah36MuZSbXHpAb7GGoWePrMH6RZyxRo5TvzNes5rq2IQJRxQQJjGC 10R/1L7CnC5MNOsZ7COceuEGR3dP8lMONXoIV8cxkoA0GLyuUT8DOwneY8TQplTcFR dBSGahZwQhUtgujv61be9QgJom0NLzOCIIOsRXI4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Bloch , Maor Gottlieb , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 127/879] net/mlx5: fs, delete the FTE when there are no rules attached to it Date: Tue, 7 Jun 2022 18:54:05 +0200 Message-Id: <20220607165006.388275159@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Bloch [ Upstream commit 7b0c6338597613f465d131bd939a51844a00455a ] When an FTE has no children is means all the rules where removed and the FTE can be deleted regardless of the dests_size value. While dests_size should be 0 when there are no children be extra careful not to leak memory or get firmware syndrome if the proper bookkeeping of dests_size wasn't done. Signed-off-by: Mark Bloch Reviewed-by: Maor Gottlieb Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/ne= t/ethernet/mellanox/mlx5/core/fs_core.c index 3ad67e6b5586..89ba72e8d109 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -2071,16 +2071,16 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *h= andle) down_write_ref_node(&fte->node, false); for (i =3D handle->num_rules - 1; i >=3D 0; i--) tree_remove_node(&handle->rule[i]->node, true); - if (fte->dests_size) { - if (fte->modify_mask) - modify_fte(fte); - up_write_ref_node(&fte->node, false); - } else if (list_empty(&fte->node.children)) { + if (list_empty(&fte->node.children)) { del_hw_fte(&fte->node); /* Avoid double call to del_hw_fte */ fte->node.del_hw_func =3D NULL; up_write_ref_node(&fte->node, false); tree_put_node(&fte->node, false); + } else if (fte->dests_size) { + if (fte->modify_mask) + modify_fte(fte); + up_write_ref_node(&fte->node, false); } else { up_write_ref_node(&fte->node, false); } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 569A2C43334 for ; Tue, 7 Jun 2022 22:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383944AbiFGWMM (ORCPT ); Tue, 7 Jun 2022 18:12:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379049AbiFGVJi (ORCPT ); Tue, 7 Jun 2022 17:09: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 7C707214800; Tue, 7 Jun 2022 11:51:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 547E3B8239E; Tue, 7 Jun 2022 18:51:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5DE2C36B0F; Tue, 7 Jun 2022 18:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627885; bh=laup2rznz3Il/ZJtnKku7FRUlcG86YxUDSIH8CKkm2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMPdIAOO+qwU2ooL0JApX+2G9R+DcWWfuSKZKoZNl85n5ylJLSyn8kpXd6zTKL2Aj eL4TwcUn8d4lqn/iadY56kOUT0P8Es2mXMmci8Zm2xFQ5qpIuadrKh3psv/dLfqvSq DAa9ji8CMG+alAYhD7EijP1ACCPrOD0DrtoJBQEs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Sasha Levin Subject: [PATCH 5.18 128/879] ASoC: dapm: Dont fold register value changes into notifications Date: Tue, 7 Jun 2022 18:54:06 +0200 Message-Id: <20220607165006.418214861@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Brown [ Upstream commit ad685980469b9f9b99d4d6ea05f4cb8f57cb2234 ] DAPM tracks and reports the value presented to the user from DAPM controls separately to the register value, these may diverge during initialisation or when an autodisable control is in use. When writing DAPM controls we currently report that a change has occurred if either the DAPM value or the value stored in the register has changed, meaning that if the two are out of sync we may appear to report a spurious event to userspace. Since we use this folded in value for nothing other than the value reported to userspace simply drop the folding in of the register change. Signed-off-by: Mark Brown Link: https://lore.kernel.org/r/20220428161833.3690050-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/soc-dapm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index ca917a849c42..869c76506b66 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3437,7 +3437,6 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcont= rol, update.val =3D val; card->update =3D &update; } - change |=3D reg_change; =20 ret =3D soc_dapm_mixer_update_power(card, kcontrol, connect, rconnect); @@ -3539,7 +3538,6 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol = *kcontrol, update.val =3D val; card->update =3D &update; } - change |=3D reg_change; =20 ret =3D soc_dapm_mux_update_power(card, kcontrol, item[0], e); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC316CCA482 for ; Tue, 7 Jun 2022 22:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384594AbiFGWPi (ORCPT ); Tue, 7 Jun 2022 18:15:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379211AbiFGVJj (ORCPT ); Tue, 7 Jun 2022 17:09:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0DE412E80E; Tue, 7 Jun 2022 11:51: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 0289CB81FE1; Tue, 7 Jun 2022 18:51:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F6CAC385A5; Tue, 7 Jun 2022 18:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627887; bh=4jTvK2lpoiEdeQm+qpzHyCZoxAUPXJcXPmcaCJ93CzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DWxb8c3ysWmQ7k5oVLTInjsbVwnEORJcBI+fygSB7mM3FfVduYnwmwEaPzfwVXeju MpQ+uDvVUZqF+WdLeIcr3S7wCTj+Tm6qZlIA0XwTyh6XLuMzau5GNmWLTFF3srh+Vr 9seftkbymh/E4Jgv6qkgiG0fVi83GtFP21dEmmYs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Senozhatsky , Peter Ujfalusi , Mark Brown , Sasha Levin Subject: [PATCH 5.18 129/879] ASoC: SOF: ipc3-topology: Correct get_control_data for non bytes payload Date: Tue, 7 Jun 2022 18:54:07 +0200 Message-Id: <20220607165006.447365727@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit a962890a5a3cce903ff7c7a19fadee63ed9efdc7 ] It is possible to craft a topology where sof_get_control_data() would do out of bounds access because it expects that it is only called when the payload is bytes type. Confusingly it also handles other types of controls, but the payload parsing implementation is only valid for bytes. Fix the code to count the non bytes controls and instead of storing a pointer to sof_abi_hdr in sof_widget_data (which is only valid for bytes), store the pointer to the data itself and add a new member to save the size of the data. In case of non bytes controls we store the pointer to the chanv itself, which is just an array of values at the end. In case of bytes control, drop the wrong cdata->data (wdata[i].pdata) check against NULL since it is incorrect and invalid in this context. The data is pointing to the end of cdata struct, so it should never be null. Reported-by: Sergey Senozhatsky Signed-off-by: Peter Ujfalusi Reviewed-by: Sergey Senozhatsky Tested-by: Sergey Senozhatsky Link: https://lore.kernel.org/r/20220427185221.28928-1-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/sof/ipc3-topology.c | 39 +++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c index 2f8450a8c0a1..af1bbd34213c 100644 --- a/sound/soc/sof/ipc3-topology.c +++ b/sound/soc/sof/ipc3-topology.c @@ -20,7 +20,8 @@ struct sof_widget_data { int ctrl_type; int ipc_cmd; - struct sof_abi_hdr *pdata; + void *pdata; + size_t pdata_size; struct snd_sof_control *control; }; =20 @@ -784,16 +785,26 @@ static int sof_get_control_data(struct snd_soc_compon= ent *scomp, } =20 cdata =3D wdata[i].control->ipc_control_data; - wdata[i].pdata =3D cdata->data; - if (!wdata[i].pdata) - return -EINVAL; =20 - /* make sure data is valid - data can be updated at runtime */ - if (widget->dobj.widget.kcontrol_type[i] =3D=3D SND_SOC_TPLG_TYPE_BYTES = && - wdata[i].pdata->magic !=3D SOF_ABI_MAGIC) - return -EINVAL; + if (widget->dobj.widget.kcontrol_type[i] =3D=3D SND_SOC_TPLG_TYPE_BYTES)= { + /* make sure data is valid - data can be updated at runtime */ + if (cdata->data->magic !=3D SOF_ABI_MAGIC) + return -EINVAL; + + wdata[i].pdata =3D cdata->data->data; + wdata[i].pdata_size =3D cdata->data->size; + } else { + /* points to the control data union */ + wdata[i].pdata =3D cdata->chanv; + /* + * wdata[i].control->size is calculated with struct_size + * and includes the size of struct sof_ipc_ctrl_data + */ + wdata[i].pdata_size =3D wdata[i].control->size - + sizeof(struct sof_ipc_ctrl_data); + } =20 - *size +=3D wdata[i].pdata->size; + *size +=3D wdata[i].pdata_size; =20 /* get data type */ switch (cdata->cmd) { @@ -876,10 +887,12 @@ static int sof_process_load(struct snd_soc_component = *scomp, */ if (ipc_data_size) { for (i =3D 0; i < widget->num_kcontrols; i++) { - memcpy(&process->data[offset], - wdata[i].pdata->data, - wdata[i].pdata->size); - offset +=3D wdata[i].pdata->size; + if (!wdata[i].pdata_size) + continue; + + memcpy(&process->data[offset], wdata[i].pdata, + wdata[i].pdata_size); + offset +=3D wdata[i].pdata_size; } } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB385CCA483 for ; Tue, 7 Jun 2022 22:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384580AbiFGWPd (ORCPT ); Tue, 7 Jun 2022 18:15:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378843AbiFGVJj (ORCPT ); Tue, 7 Jun 2022 17:09:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68BFA21482E; Tue, 7 Jun 2022 11:51: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 BD086B822C0; Tue, 7 Jun 2022 18:51:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25BEAC385A2; Tue, 7 Jun 2022 18:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627890; bh=4XChG8Mn9Ckp+o5xpIAJPICimju0Ixs9wovnr8tIqy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=axPHdCgNYHPF7fvsbCbrIWJ51IRFFxtsZaIbza19QIE9J1RAsKTxb7RPOsGTr7JB/ qsR1G9Ht2QCPdnWWJAXX+AWZCBCCOtDlhMLEMQTa7inTLHxGJHmVAkWTxBS6Rkd5RO BZKSNUSRQtIVTItaPjYggSQwey6GBKtIXEMQD0Nc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maksym Yaremchuk , Petr Machata , Ido Schimmel , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 130/879] mlxsw: spectrum_dcb: Do not warn about priority changes Date: Tue, 7 Jun 2022 18:54:08 +0200 Message-Id: <20220607165006.475914338@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Petr Machata [ Upstream commit b6b584562cbe7dc357083459d6dd5b171e12cadb ] The idea behind the warnings is that the user would get warned in case when more than one priority is configured for a given DSCP value on a netdevice. The warning is currently wrong, because dcb_ieee_getapp_mask() returns the first matching entry, not all of them, and the warning will then claim that some priority is "current", when in fact it is not. But more importantly, the warning is misleading in general. Consider the following commands: # dcb app flush dev swp19 dscp-prio # dcb app add dev swp19 dscp-prio 24:3 # dcb app replace dev swp19 dscp-prio 24:2 The last command will issue the following warning: mlxsw_spectrum3 0000:07:00.0 swp19: Ignoring new priority 2 for DSCP 24 in= favor of current value of 3 The reason is that the "replace" command works by first adding the new value, and then removing all old values. This is the only way to make the replacement without causing the traffic to be prioritized to whatever the chip defaults to. The warning is issued in response to adding the new priority, and then no warning is shown when the old priority is removed. The upshot is that the canonical way to change traffic prioritization always produces a warning about ignoring the new priority, but what gets configured is in fact what the user intended. An option to just emit warning every time that the prioritization changes just to make it clear that it happened is obviously unsatisfactory. Therefore, in this patch, remove the warnings. Reported-by: Maksym Yaremchuk Signed-off-by: Petr Machata Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c b/drivers/n= et/ethernet/mellanox/mlxsw/spectrum_dcb.c index 5f92b1691360..aff6d4f35cd2 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c @@ -168,8 +168,6 @@ static int mlxsw_sp_dcbnl_ieee_setets(struct net_device= *dev, static int mlxsw_sp_dcbnl_app_validate(struct net_device *dev, struct dcb_app *app) { - int prio; - if (app->priority >=3D IEEE_8021QAZ_MAX_TCS) { netdev_err(dev, "APP entry with priority value %u is invalid\n", app->priority); @@ -183,17 +181,6 @@ static int mlxsw_sp_dcbnl_app_validate(struct net_devi= ce *dev, app->protocol); return -EINVAL; } - - /* Warn about any DSCP APP entries with the same PID. */ - prio =3D fls(dcb_ieee_getapp_mask(dev, app)); - if (prio--) { - if (prio < app->priority) - netdev_warn(dev, "Choosing priority %d for DSCP %d in favor of previou= sly-active value of %d\n", - app->priority, app->protocol, prio); - else if (prio > app->priority) - netdev_warn(dev, "Ignoring new priority %d for DSCP %d in favor of cur= rent value of %d\n", - app->priority, app->protocol, prio); - } break; =20 case IEEE_8021QAZ_APP_SEL_ETHERTYPE: --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79F34C433EF for ; Tue, 7 Jun 2022 22:12:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384035AbiFGWMQ (ORCPT ); Tue, 7 Jun 2022 18:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379364AbiFGVJk (ORCPT ); Tue, 7 Jun 2022 17:09:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 311BE12E33D; Tue, 7 Jun 2022 11:51:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6ADF7B81FE1; Tue, 7 Jun 2022 18:51:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C74F9C385A2; Tue, 7 Jun 2022 18:51:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627893; bh=6Hz5HqIYdJLRIZwRktEAYB4iRCBgmhBAZDeEbAndy0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mN2B1/A08c4dE0ABELqA2PIVCEjcsgveK91AXkXa6oky1dSozpapGwyQOQLmd2Vl8 ol6yeTyx8TO30tA+WSb2sN+SYOET0VHDBC+OKiVdWxiQPwUXM4dP7re0/fUuiQYydC MilCRPOKTxeo5gYV3D/ZDgWQDz3LmX081Mu9n/kc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maksym Yaremchuk , Petr Machata , Ido Schimmel , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 131/879] mlxsw: Treat LLDP packets as control Date: Tue, 7 Jun 2022 18:54:09 +0200 Message-Id: <20220607165006.504814247@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Petr Machata [ Upstream commit 0106668cd2f91bf913fb78972840dedfba80a3c3 ] When trapping packets for on-CPU processing, Spectrum machines differentiate between control and non-control traps. Traffic trapped through non-control traps is treated as data and kept in shared buffer in pools 0-4. Traffic trapped through control traps is kept in the dedicated control buffer 9. The advantage of marking traps as control is that pressure in the data plane does not prevent the control traffic to be processed. When the LLDP trap was introduced, it was marked as a control trap. But then in commit aed4b5721143 ("mlxsw: spectrum: PTP: Hook into packet receive path"), PTP traps were introduced. Because Ethernet-encapsulated PTP packets look to the Spectrum-1 ASIC as LLDP traffic and are trapped under the LLDP trap, this trap was reconfigured as non-control, in sync with the PTP traps. There is however no requirement that PTP traffic be handled as data. Besides, the usual encapsulation for PTP traffic is UDP, not bare Ethernet, and that is in deployments that even need PTP, which is far less common than LLDP. This is reflected by the default policer, which was not bumped up to the 19Kpps / 24Kpps that is the expected load of a PTP-enabled Spectrum-1 switch. Marking of LLDP trap as non-control was therefore probably misguided. In this patch, change it back to control. Reported-by: Maksym Yaremchuk Signed-off-by: Petr Machata Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c b/drivers/= net/ethernet/mellanox/mlxsw/spectrum_trap.c index 47b061b99160..ed4d0d3448f3 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c @@ -864,7 +864,7 @@ static const struct mlxsw_sp_trap_item mlxsw_sp_trap_it= ems_arr[] =3D { .trap =3D MLXSW_SP_TRAP_CONTROL(LLDP, LLDP, TRAP), .listeners_arr =3D { MLXSW_RXL(mlxsw_sp_rx_ptp_listener, LLDP, TRAP_TO_CPU, - false, SP_LLDP, DISCARD), + true, SP_LLDP, DISCARD), }, }, { --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11DDDC433EF for ; Tue, 7 Jun 2022 22:12:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378972AbiFGWM0 (ORCPT ); Tue, 7 Jun 2022 18:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379376AbiFGVJl (ORCPT ); Tue, 7 Jun 2022 17:09:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22C6121483D; Tue, 7 Jun 2022 11:51: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 533F2B8237F; Tue, 7 Jun 2022 18:51:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6057C385A2; Tue, 7 Jun 2022 18:51:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627896; bh=yZVqEBLc3U5iliDZjfXNJejculO0HrUD/c4t8ogteQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uiAjNQkA2lAO8I75QxHLa9lFtk+qNUdH7wwfKIqU7Rs3GbyhhVQdVMHKzJS5WwxAR HR/58E2M/NsT3aKiGthW9BdG/9nkKhkJOFVWQpbGM4eJ9V2sb74uDKli1dWEv1zt4z 19zPudok2GljwdG1erWWdF/j53Fd0n46yh6WQ/Pg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hawking Zhang , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 132/879] drm/amdgpu/psp: move PSP memory alloc from hw_init to sw_init Date: Tue, 7 Jun 2022 18:54:10 +0200 Message-Id: <20220607165006.533849936@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Deucher [ Upstream commit b95b5391684b39695887afb4a13cccee7820f5d6 ] Memory allocations should be done in sw_init. hw_init should just be hardware programming needed to initialize the IP block. This is how most other IP blocks work. Move the GPU memory allocations from psp hw_init to psp sw_init and move the memory free to sw_fini. This also fixes a potential GPU memory leak if psp hw_init fails. Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 95 ++++++++++++------------- 1 file changed, 47 insertions(+), 48 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_psp.c index a6acec1a6155..21aa556a6bef 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -357,7 +357,39 @@ static int psp_sw_init(void *handle) } } =20 + ret =3D amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG, + amdgpu_sriov_vf(adev) ? + AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT, + &psp->fw_pri_bo, + &psp->fw_pri_mc_addr, + &psp->fw_pri_buf); + if (ret) + return ret; + + ret =3D amdgpu_bo_create_kernel(adev, PSP_FENCE_BUFFER_SIZE, PAGE_SIZE, + AMDGPU_GEM_DOMAIN_VRAM, + &psp->fence_buf_bo, + &psp->fence_buf_mc_addr, + &psp->fence_buf); + if (ret) + goto failed1; + + ret =3D amdgpu_bo_create_kernel(adev, PSP_CMD_BUFFER_SIZE, PAGE_SIZE, + AMDGPU_GEM_DOMAIN_VRAM, + &psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, + (void **)&psp->cmd_buf_mem); + if (ret) + goto failed2; + return 0; + +failed2: + amdgpu_bo_free_kernel(&psp->fw_pri_bo, + &psp->fw_pri_mc_addr, &psp->fw_pri_buf); +failed1: + amdgpu_bo_free_kernel(&psp->fence_buf_bo, + &psp->fence_buf_mc_addr, &psp->fence_buf); + return ret; } =20 static int psp_sw_fini(void *handle) @@ -391,6 +423,13 @@ static int psp_sw_fini(void *handle) kfree(cmd); cmd =3D NULL; =20 + amdgpu_bo_free_kernel(&psp->fw_pri_bo, + &psp->fw_pri_mc_addr, &psp->fw_pri_buf); + amdgpu_bo_free_kernel(&psp->fence_buf_bo, + &psp->fence_buf_mc_addr, &psp->fence_buf); + amdgpu_bo_free_kernel(&psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, + (void **)&psp->cmd_buf_mem); + return 0; } =20 @@ -2430,51 +2469,18 @@ static int psp_load_fw(struct amdgpu_device *adev) struct psp_context *psp =3D &adev->psp; =20 if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev)) { - psp_ring_stop(psp, PSP_RING_TYPE__KM); /* should not destroy ring, only = stop */ - goto skip_memalloc; - } - - if (amdgpu_sriov_vf(adev)) { - ret =3D amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG, - AMDGPU_GEM_DOMAIN_VRAM, - &psp->fw_pri_bo, - &psp->fw_pri_mc_addr, - &psp->fw_pri_buf); + /* should not destroy ring, only stop */ + psp_ring_stop(psp, PSP_RING_TYPE__KM); } else { - ret =3D amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG, - AMDGPU_GEM_DOMAIN_GTT, - &psp->fw_pri_bo, - &psp->fw_pri_mc_addr, - &psp->fw_pri_buf); - } - - if (ret) - goto failed; - - ret =3D amdgpu_bo_create_kernel(adev, PSP_FENCE_BUFFER_SIZE, PAGE_SIZE, - AMDGPU_GEM_DOMAIN_VRAM, - &psp->fence_buf_bo, - &psp->fence_buf_mc_addr, - &psp->fence_buf); - if (ret) - goto failed; - - ret =3D amdgpu_bo_create_kernel(adev, PSP_CMD_BUFFER_SIZE, PAGE_SIZE, - AMDGPU_GEM_DOMAIN_VRAM, - &psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, - (void **)&psp->cmd_buf_mem); - if (ret) - goto failed; + memset(psp->fence_buf, 0, PSP_FENCE_BUFFER_SIZE); =20 - memset(psp->fence_buf, 0, PSP_FENCE_BUFFER_SIZE); - - ret =3D psp_ring_init(psp, PSP_RING_TYPE__KM); - if (ret) { - DRM_ERROR("PSP ring init failed!\n"); - goto failed; + ret =3D psp_ring_init(psp, PSP_RING_TYPE__KM); + if (ret) { + DRM_ERROR("PSP ring init failed!\n"); + goto failed; + } } =20 -skip_memalloc: ret =3D psp_hw_start(psp); if (ret) goto failed; @@ -2592,13 +2598,6 @@ static int psp_hw_fini(void *handle) psp_tmr_terminate(psp); psp_ring_destroy(psp, PSP_RING_TYPE__KM); =20 - amdgpu_bo_free_kernel(&psp->fw_pri_bo, - &psp->fw_pri_mc_addr, &psp->fw_pri_buf); - amdgpu_bo_free_kernel(&psp->fence_buf_bo, - &psp->fence_buf_mc_addr, &psp->fence_buf); - amdgpu_bo_free_kernel(&psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, - (void **)&psp->cmd_buf_mem); - return 0; } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0F93C43334 for ; Tue, 7 Jun 2022 22:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384087AbiFGWMj (ORCPT ); Tue, 7 Jun 2022 18:12:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359576AbiFGVJm (ORCPT ); Tue, 7 Jun 2022 17: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 042AF214882; Tue, 7 Jun 2022 11:51:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 525B16156D; Tue, 7 Jun 2022 18:51:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 622A5C385A2; Tue, 7 Jun 2022 18:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627898; bh=mkOZcs9H0Fc6oEmSvunN1C04xzrsehRv9BhzW7OHhdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mOu6V0fe5zqnyrRNVdoSmol+0hr53822HZ5UYvdbYT4zTvn8o6F7ZRPGCtlKocYQV d+KKpwRC10qRkzbTU1AOpOU1tPBhc6kqQBmu1D4K+88nVp+m5aGCB4cxomyu8LfkEN YjCqqwOy1b/XdiMVdabutdImdUvFgCb2fkN58Aw0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alice Wong , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 133/879] drm/amdgpu/ucode: Remove firmware load type check in amdgpu_ucode_free_bo Date: Tue, 7 Jun 2022 18:54:11 +0200 Message-Id: <20220607165006.563819317@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alice Wong [ Upstream commit ab0cd4a9ae5b4679b714d8dbfedc0901fecdce9f ] When psp_hw_init failed, it will set the load_type to AMDGPU_FW_LOAD_DIRECT. During amdgpu_device_ip_fini, amdgpu_ucode_free_bo checks that load_type is AMDGPU_FW_LOAD_DIRECT and skips deallocating fw_buf causing memory leak. Remove load_type check in amdgpu_ucode_free_bo. Signed-off-by: Alice Wong Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/am= d/amdgpu/amdgpu_ucode.c index ca3350502618..aebafbc327fb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c @@ -714,8 +714,7 @@ int amdgpu_ucode_create_bo(struct amdgpu_device *adev) =20 void amdgpu_ucode_free_bo(struct amdgpu_device *adev) { - if (adev->firmware.load_type !=3D AMDGPU_FW_LOAD_DIRECT) - amdgpu_bo_free_kernel(&adev->firmware.fw_buf, + amdgpu_bo_free_kernel(&adev->firmware.fw_buf, &adev->firmware.fw_buf_mc, &adev->firmware.fw_buf_ptr); } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB725CCA486 for ; Tue, 7 Jun 2022 22:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384613AbiFGWPq (ORCPT ); Tue, 7 Jun 2022 18:15:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379032AbiFGVJy (ORCPT ); Tue, 7 Jun 2022 17: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 7081A214888; Tue, 7 Jun 2022 11:51:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A370AB81FE1; Tue, 7 Jun 2022 18:51:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FF97C385A5; Tue, 7 Jun 2022 18:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627901; bh=cB/zmou4JNBatz0EsRvy0e6Im6lxkG/oKJCnqFwoMfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e+GkkndBp7GHWpnnptze6274rPwbaNnCBy76XXOPni1AFY194my/MZqPNpIVKxB3a iYrRo5E39nQ+IzK3BPRBT0M83pHjVclol3QLGWexIERbnak9QLMBgntT45N1jcYuMh NmJBfhT67L8s29ZjAlb39XFAmiRRX+FBF73Ofzgw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Mark Brown , Sasha Levin Subject: [PATCH 5.18 134/879] regulator: mt6315: Enforce regulator-compatible, not name Date: Tue, 7 Jun 2022 18:54:12 +0200 Message-Id: <20220607165006.592659436@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: N=C3=ADcolas F. R. A. Prado [ Upstream commit 6d435a94ba5bb4f2ad381c0828fbae89c66b50fe ] The MT6315 PMIC dt-binding should enforce that one of the valid regulator-compatible is set in each regulator node. However it was mistakenly matching against regulator-name instead. Fix the typo. This not only fixes the compatible verification, but also lifts the regulator-name restriction, so that more meaningful names can be set for each platform. Signed-off-by: N=C3=ADcolas F. R. A. Prado Link: https://lore.kernel.org/r/20220429201325.2205799-1-nfraprado@collabor= a.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../devicetree/bindings/regulator/mt6315-regulator.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/regulator/mt6315-regulator.y= aml b/Documentation/devicetree/bindings/regulator/mt6315-regulator.yaml index 61dd5af80db6..5d2d989de893 100644 --- a/Documentation/devicetree/bindings/regulator/mt6315-regulator.yaml +++ b/Documentation/devicetree/bindings/regulator/mt6315-regulator.yaml @@ -31,7 +31,7 @@ properties: $ref: "regulator.yaml#" =20 properties: - regulator-name: + regulator-compatible: pattern: "^vbuck[1-4]$" =20 additionalProperties: false --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99F65C43334 for ; Tue, 7 Jun 2022 22:12:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356111AbiFGWM4 (ORCPT ); Tue, 7 Jun 2022 18:12:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379540AbiFGVKT (ORCPT ); Tue, 7 Jun 2022 17:10:19 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC7862148AE; Tue, 7 Jun 2022 11:51:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D7B82CE2465; Tue, 7 Jun 2022 18:51:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD908C385A2; Tue, 7 Jun 2022 18:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627904; bh=bGfe+XYml5vTZnnP/P6GhNopkUPsUwTEgTIBai+RAio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ysbzePnEz80+nMQoYz5vVdhE+Qzihf+G98tDpQ7SXpWWqzQY3jBe5G+ddl2DpwpJk Njmu2JDiD472gaLrNbOKTM9M214Q8RkHpt83WsIoitAu7rFo9VQbYFpc7zqVZZdVL2 7eLI5kYzgeB9bsX6iyix+cvi+91CcDn1llLpv3yE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacob Keller , Paul Menzel , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.18 135/879] ice: always check VF VSI pointer values Date: Tue, 7 Jun 2022 18:54:13 +0200 Message-Id: <20220607165006.621436225@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jacob Keller [ Upstream commit baeb705fd6a7245cc1fa69ed991a9cffdf44a174 ] The ice_get_vf_vsi function can return NULL in some cases, such as if handling messages during a reset where the VSI is being removed and recreated. Several places throughout the driver do not bother to check whether this VSI pointer is valid. Static analysis tools maybe report issues because they detect paths where a potentially NULL pointer could be dereferenced. Fix this by checking the return value of ice_get_vf_vsi everywhere. Signed-off-by: Jacob Keller Reviewed-by: Paul Menzel Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice_devlink.c | 5 ++- drivers/net/ethernet/intel/ice/ice_repr.c | 7 +++- drivers/net/ethernet/intel/ice/ice_sriov.c | 32 +++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 28 +++++++++++++++- drivers/net/ethernet/intel/ice/ice_virtchnl.c | 5 +++ .../ethernet/intel/ice/ice_virtchnl_fdir.c | 7 +++- 6 files changed, 77 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/eth= ernet/intel/ice/ice_devlink.c index a230edb38466..4a9de59121d8 100644 --- a/drivers/net/ethernet/intel/ice/ice_devlink.c +++ b/drivers/net/ethernet/intel/ice/ice_devlink.c @@ -753,9 +753,12 @@ int ice_devlink_create_vf_port(struct ice_vf *vf) =20 pf =3D vf->pf; dev =3D ice_pf_to_dev(pf); - vsi =3D ice_get_vf_vsi(vf); devlink_port =3D &vf->devlink_port; =20 + vsi =3D ice_get_vf_vsi(vf); + if (!vsi) + return -EINVAL; + attrs.flavour =3D DEVLINK_PORT_FLAVOUR_PCI_VF; attrs.pci_vf.pf =3D pf->hw.bus.func; attrs.pci_vf.vf =3D vf->vf_id; diff --git a/drivers/net/ethernet/intel/ice/ice_repr.c b/drivers/net/ethern= et/intel/ice/ice_repr.c index 848f2adea563..a91b81c3088b 100644 --- a/drivers/net/ethernet/intel/ice/ice_repr.c +++ b/drivers/net/ethernet/intel/ice/ice_repr.c @@ -293,8 +293,13 @@ static int ice_repr_add(struct ice_vf *vf) struct ice_q_vector *q_vector; struct ice_netdev_priv *np; struct ice_repr *repr; + struct ice_vsi *vsi; int err; =20 + vsi =3D ice_get_vf_vsi(vf); + if (!vsi) + return -EINVAL; + repr =3D kzalloc(sizeof(*repr), GFP_KERNEL); if (!repr) return -ENOMEM; @@ -313,7 +318,7 @@ static int ice_repr_add(struct ice_vf *vf) goto err_alloc; } =20 - repr->src_vsi =3D ice_get_vf_vsi(vf); + repr->src_vsi =3D vsi; repr->vf =3D vf; vf->repr =3D repr; np =3D netdev_priv(repr->netdev); diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ether= net/intel/ice/ice_sriov.c index 0c438219f7a3..bb1721f1321d 100644 --- a/drivers/net/ethernet/intel/ice/ice_sriov.c +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c @@ -46,7 +46,12 @@ static void ice_free_vf_entries(struct ice_pf *pf) */ static void ice_vf_vsi_release(struct ice_vf *vf) { - ice_vsi_release(ice_get_vf_vsi(vf)); + struct ice_vsi *vsi =3D ice_get_vf_vsi(vf); + + if (WARN_ON(!vsi)) + return; + + ice_vsi_release(vsi); ice_vf_invalidate_vsi(vf); } =20 @@ -104,6 +109,8 @@ static void ice_dis_vf_mappings(struct ice_vf *vf) =20 hw =3D &pf->hw; vsi =3D ice_get_vf_vsi(vf); + if (WARN_ON(!vsi)) + return; =20 dev =3D ice_pf_to_dev(pf); wr32(hw, VPINT_ALLOC(vf->vf_id), 0); @@ -341,6 +348,9 @@ static void ice_ena_vf_q_mappings(struct ice_vf *vf, u1= 6 max_txq, u16 max_rxq) struct ice_hw *hw =3D &vf->pf->hw; u32 reg; =20 + if (WARN_ON(!vsi)) + return; + /* set regardless of mapping mode */ wr32(hw, VPLAN_TXQ_MAPENA(vf->vf_id), VPLAN_TXQ_MAPENA_TX_ENA_M); =20 @@ -386,6 +396,9 @@ static void ice_ena_vf_mappings(struct ice_vf *vf) { struct ice_vsi *vsi =3D ice_get_vf_vsi(vf); =20 + if (WARN_ON(!vsi)) + return; + ice_ena_vf_msix_mappings(vf); ice_ena_vf_q_mappings(vf, vsi->alloc_txq, vsi->alloc_rxq); } @@ -1128,6 +1141,8 @@ static struct ice_vf *ice_get_vf_from_pfq(struct ice_= pf *pf, u16 pfq) u16 rxq_idx; =20 vsi =3D ice_get_vf_vsi(vf); + if (!vsi) + continue; =20 ice_for_each_rxq(vsi, rxq_idx) if (vsi->rxq_map[rxq_idx] =3D=3D pfq) { @@ -1521,8 +1536,15 @@ static int ice_calc_all_vfs_min_tx_rate(struct ice_p= f *pf) static bool ice_min_tx_rate_oversubscribed(struct ice_vf *vf, int min_tx_rate) { - int link_speed_mbps =3D ice_get_link_speed_mbps(ice_get_vf_vsi(vf)); - int all_vfs_min_tx_rate =3D ice_calc_all_vfs_min_tx_rate(vf->pf); + struct ice_vsi *vsi =3D ice_get_vf_vsi(vf); + int all_vfs_min_tx_rate; + int link_speed_mbps; + + if (WARN_ON(!vsi)) + return false; + + link_speed_mbps =3D ice_get_link_speed_mbps(vsi); + all_vfs_min_tx_rate =3D ice_calc_all_vfs_min_tx_rate(vf->pf); =20 /* this VF's previous rate is being overwritten */ all_vfs_min_tx_rate -=3D vf->min_tx_rate; @@ -1566,6 +1588,10 @@ ice_set_vf_bw(struct net_device *netdev, int vf_id, = int min_tx_rate, goto out_put_vf; =20 vsi =3D ice_get_vf_vsi(vf); + if (!vsi) { + ret =3D -EINVAL; + goto out_put_vf; + } =20 /* when max_tx_rate is zero that means no max Tx rate limiting, so only * check if max_tx_rate is non-zero diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethe= rnet/intel/ice/ice_vf_lib.c index 6578059d9479..aefd66a4db80 100644 --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c @@ -220,8 +220,10 @@ static void ice_vf_clear_counters(struct ice_vf *vf) { struct ice_vsi *vsi =3D ice_get_vf_vsi(vf); =20 + if (vsi) + vsi->num_vlan =3D 0; + vf->num_mac =3D 0; - vsi->num_vlan =3D 0; memset(&vf->mdd_tx_events, 0, sizeof(vf->mdd_tx_events)); memset(&vf->mdd_rx_events, 0, sizeof(vf->mdd_rx_events)); } @@ -251,6 +253,9 @@ static int ice_vf_rebuild_vsi(struct ice_vf *vf) struct ice_vsi *vsi =3D ice_get_vf_vsi(vf); struct ice_pf *pf =3D vf->pf; =20 + if (WARN_ON(!vsi)) + return -EINVAL; + if (ice_vsi_rebuild(vsi, true)) { dev_err(ice_pf_to_dev(pf), "failed to rebuild VF %d VSI\n", vf->vf_id); @@ -514,6 +519,10 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags) ice_trigger_vf_reset(vf, flags & ICE_VF_RESET_VFLR, false); =20 vsi =3D ice_get_vf_vsi(vf); + if (WARN_ON(!vsi)) { + err =3D -EIO; + goto out_unlock; + } =20 ice_dis_vf_qs(vf); =20 @@ -572,6 +581,11 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags) =20 vf->vf_ops->post_vsi_rebuild(vf); vsi =3D ice_get_vf_vsi(vf); + if (WARN_ON(!vsi)) { + err =3D -EINVAL; + goto out_unlock; + } + ice_eswitch_update_repr(vsi); ice_eswitch_replay_vf_mac_rule(vf); =20 @@ -610,6 +624,9 @@ void ice_dis_vf_qs(struct ice_vf *vf) { struct ice_vsi *vsi =3D ice_get_vf_vsi(vf); =20 + if (WARN_ON(!vsi)) + return; + ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, vf->vf_id); ice_vsi_stop_all_rx_rings(vsi); ice_set_vf_state_qs_dis(vf); @@ -790,6 +807,9 @@ static int ice_vf_rebuild_host_mac_cfg(struct ice_vf *v= f) u8 broadcast[ETH_ALEN]; int status; =20 + if (WARN_ON(!vsi)) + return -EINVAL; + if (ice_is_eswitch_mode_switchdev(vf->pf)) return 0; =20 @@ -875,6 +895,9 @@ static int ice_vf_rebuild_host_tx_rate_cfg(struct ice_v= f *vf) struct ice_vsi *vsi =3D ice_get_vf_vsi(vf); int err; =20 + if (WARN_ON(!vsi)) + return -EINVAL; + if (vf->min_tx_rate) { err =3D ice_set_min_bw_limit(vsi, (u64)vf->min_tx_rate * 1000); if (err) { @@ -938,6 +961,9 @@ void ice_vf_rebuild_host_cfg(struct ice_vf *vf) struct device *dev =3D ice_pf_to_dev(vf->pf); struct ice_vsi *vsi =3D ice_get_vf_vsi(vf); =20 + if (WARN_ON(!vsi)) + return; + ice_vf_set_host_trust_cfg(vf); =20 if (ice_vf_rebuild_host_mac_cfg(vf)) diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl.c b/drivers/net/et= hernet/intel/ice/ice_virtchnl.c index 2889e050a4c9..5405a0e752cf 100644 --- a/drivers/net/ethernet/intel/ice/ice_virtchnl.c +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl.c @@ -2392,6 +2392,11 @@ static int ice_vc_ena_vlan_stripping(struct ice_vf *= vf) } =20 vsi =3D ice_get_vf_vsi(vf); + if (!vsi) { + v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; + goto error_param; + } + if (vsi->inner_vlan_ops.ena_stripping(vsi, ETH_P_8021Q)) v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; =20 diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c b/drivers/n= et/ethernet/intel/ice/ice_virtchnl_fdir.c index 8e38ee2faf58..b74ccbd1591a 100644 --- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c @@ -1344,7 +1344,12 @@ static void ice_vf_fdir_dump_info(struct ice_vf *vf) pf =3D vf->pf; hw =3D &pf->hw; dev =3D ice_pf_to_dev(pf); - vf_vsi =3D pf->vsi[vf->lan_vsi_idx]; + vf_vsi =3D ice_get_vf_vsi(vf); + if (!vf_vsi) { + dev_dbg(dev, "VF %d: invalid VSI pointer\n", vf->vf_id); + return; + } + vsi_num =3D ice_get_hw_vsi_num(hw, vf_vsi->idx); =20 fd_size =3D rd32(hw, VSIQF_FD_SIZE(vsi_num)); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BC0EC43334 for ; Tue, 7 Jun 2022 22:12:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379568AbiFGWMp (ORCPT ); Tue, 7 Jun 2022 18:12:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379472AbiFGVKC (ORCPT ); Tue, 7 Jun 2022 17:10:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC6EC21489D; Tue, 7 Jun 2022 11:51: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 670FB616AF; Tue, 7 Jun 2022 18:51:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 776C4C36B00; Tue, 7 Jun 2022 18:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627906; bh=7jqS2tTlnNZbrQ98eK9OJ7pRMtBHKuwDuhlgk5Xc4Sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uz+BjS9/oXuQ2nrfpEmOmnHgRVoeNPKF6V+iv6EGFoyYmZnZXTYl2Ct9Ac1YcF1+1 4Q/MJTxUEfs6tfXQWEawvJ/wZulX11jZtXj7WzPTkkAxlpBGq69RFJZAlwcvAWWBKN VLcI2GYRAsLhQKVIV6QUwd4ivnlHhKRZIePPCoRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzkaller , Dongliang Mu , Jiri Kosina , Sasha Levin Subject: [PATCH 5.18 136/879] HID: bigben: fix slab-out-of-bounds Write in bigben_probe Date: Tue, 7 Jun 2022 18:54:14 +0200 Message-Id: <20220607165006.650590282@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dongliang Mu [ Upstream commit fc4ef9d5724973193bfa5ebed181dba6de3a56db ] There is a slab-out-of-bounds Write bug in hid-bigbenff driver. The problem is the driver assumes the device must have an input but some malicious devices violate this assumption. Fix this by checking hid_device's input is non-empty before its usage. Reported-by: syzkaller Signed-off-by: Dongliang Mu Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hid/hid-bigbenff.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/hid/hid-bigbenff.c b/drivers/hid/hid-bigbenff.c index 74ad8bf98bfd..e8c5e3ac9fff 100644 --- a/drivers/hid/hid-bigbenff.c +++ b/drivers/hid/hid-bigbenff.c @@ -347,6 +347,12 @@ static int bigben_probe(struct hid_device *hid, bigben->report =3D list_entry(report_list->next, struct hid_report, list); =20 + if (list_empty(&hid->inputs)) { + hid_err(hid, "no inputs found\n"); + error =3D -ENODEV; + goto error_hw_stop; + } + hidinput =3D list_first_entry(&hid->inputs, struct hid_input, list); set_bit(FF_RUMBLE, hidinput->input->ffbit); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D040CCA485 for ; Tue, 7 Jun 2022 22:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384630AbiFGWPu (ORCPT ); Tue, 7 Jun 2022 18:15:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379678AbiFGVKt (ORCPT ); Tue, 7 Jun 2022 17:10:49 -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 59E13215655; Tue, 7 Jun 2022 11:51: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 B381BB8237F; Tue, 7 Jun 2022 18:51:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07161C385A5; Tue, 7 Jun 2022 18:51:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627912; bh=2aro4hsaizbmehGAHGgs444aSUzly18lMFz3EQEQqnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KmCk9sDDXAyJHJZ+0akEDbqlU392ixJio9H4PKhhRoCWYNp+KUTGw/opS0QQiQ/nw hlap3czSpPWuhN1c9RzFcqqi3IyOCFdAzDHy7im0woAaqwneMVFJO8uo44ufgUIDWf HHEKyfZA2F38Tzf8im0juUkzTreGJgQQ10AvX4hw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Thierry Reding , Sasha Levin Subject: [PATCH 5.18 137/879] drm/tegra: gem: Do not try to dereference ERR_PTR() Date: Tue, 7 Jun 2022 18:54:15 +0200 Message-Id: <20220607165006.680667412@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thierry Reding [ Upstream commit cb7e1abc2c73633e1eefa168ab2dad6e838899c9 ] When mapping the DMA-BUF attachment fails, map->sgt will be an ERR_PTR- encoded error code and the cleanup code would try to free that memory, which obviously would fail. Zero out that pointer after extracting the error code when this happens so that kfree() can do the right thing. Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/tegra/gem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index 0063403ab5e1..7c7dd84e6db8 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -88,6 +88,7 @@ static struct host1x_bo_mapping *tegra_bo_pin(struct devi= ce *dev, struct host1x_ if (IS_ERR(map->sgt)) { dma_buf_detach(buf, map->attach); err =3D PTR_ERR(map->sgt); + map->sgt =3D NULL; goto free; } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0CB6C43334 for ; Tue, 7 Jun 2022 22:13:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383935AbiFGWNA (ORCPT ); Tue, 7 Jun 2022 18:13:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379682AbiFGVKt (ORCPT ); Tue, 7 Jun 2022 17:10:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F47721565D; Tue, 7 Jun 2022 11:51: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 C4888617A4; Tue, 7 Jun 2022 18:51:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1F74C341C7; Tue, 7 Jun 2022 18:51:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627915; bh=31HpYQaWeWqtZN+AGWXO2osKlfGZ7/fW6vbdG5g5fus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=koQnRJnnVWWo5kDwuDW4MZxhZl4XbuCBe0t7hyQC5PUhRhXmyQlVZt2b+hnOKJ139 TpWKa4T1nullHKoMKS2XK/3e6nrP8mikClaqf/4CI55K5+Xx9vjDC+rpgwWWulvvmK NFBff4JPPO1D5efzdRW5V0uZ2NytP7ZrcFgjVmNk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhen Lei , Rob Herring , Baoquan He , Catalin Marinas , Sasha Levin Subject: [PATCH 5.18 138/879] of: Support more than one crash kernel regions for kexec -s Date: Tue, 7 Jun 2022 18:54:16 +0200 Message-Id: <20220607165006.711247089@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhen Lei [ Upstream commit 8af6b91f58341325bf74ecb0389ddc0039091d84 ] When "crashkernel=3DX,high" is used, there may be two crash regions: high=3Dcrashk_res and low=3Dcrashk_low_res. But now the syscall kexec_file_load() only add crashk_res into "linux,usable-memory-range", this may cause the second kernel to have no available dma memory. Fix it like kexec-tools does for option -c, add both 'high' and 'low' regions into the dtb. Signed-off-by: Zhen Lei Acked-by: Rob Herring Acked-by: Baoquan He Link: https://lore.kernel.org/r/20220506114402.365-6-thunder.leizhen@huawei= .com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/of/kexec.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c index b9bd1cff1793..8d374cc552be 100644 --- a/drivers/of/kexec.c +++ b/drivers/of/kexec.c @@ -386,6 +386,15 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage= *image, crashk_res.end - crashk_res.start + 1); if (ret) goto out; + + if (crashk_low_res.end) { + ret =3D fdt_appendprop_addrrange(fdt, 0, chosen_node, + "linux,usable-memory-range", + crashk_low_res.start, + crashk_low_res.end - crashk_low_res.start + 1); + if (ret) + goto out; + } } =20 /* add bootargs */ --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22958CCA488 for ; Tue, 7 Jun 2022 22:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384645AbiFGWPx (ORCPT ); Tue, 7 Jun 2022 18:15:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379706AbiFGVKu (ORCPT ); Tue, 7 Jun 2022 17:10:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5AFD215667; Tue, 7 Jun 2022 11:52:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0D077B8239B; Tue, 7 Jun 2022 18:51:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80E0DC385A2; Tue, 7 Jun 2022 18:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627917; bh=BMxjupewSyN1zYjMGF8CZPdW+jWCEaz6ImvUq00v+cY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zG0M8xtIikkBk9QtrkwQdUku1owQcHQzGwlf1a4pEESiNnI37oNOiiWpGSSEmqYa5 pM3RuauPJkbhK30WDA4Uo5KkBmYhA/DOWWTscBoEv8pk2Iv74vmplpfU1auDhQi06U UtEyBBUYlI+6NsJuzod26KjSPy1Rh9+KVupUZiTk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 139/879] ASoC: tscs454: Add endianness flag in snd_soc_component_driver Date: Tue, 7 Jun 2022 18:54:17 +0200 Message-Id: <20220607165006.740371177@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit ff69ec96b87dccb3a29edef8cec5d4fefbbc2055 ] The endianness flag is used on the CODEC side to specify an ambivalence to endian, typically because it is lost over the hardware link. This device receives audio over an I2S DAI and as such should have endianness applied. A fixup is also required to use the width directly rather than relying on the format in hw_params, now both little and big endian would be supported. It is worth noting this changes the behaviour of S24_LE to use a word length of 24 rather than 32. This would appear to be a correction since the fact S24_LE is stored as 32 bits should not be presented over the bus. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220504170905.332415-26-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/codecs/tscs454.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/tscs454.c b/sound/soc/codecs/tscs454.c index 7e1826d6f06f..32e6fa7b0a06 100644 --- a/sound/soc/codecs/tscs454.c +++ b/sound/soc/codecs/tscs454.c @@ -3120,18 +3120,17 @@ static int set_aif_sample_format(struct snd_soc_com= ponent *component, unsigned int width; int ret; =20 - switch (format) { - case SNDRV_PCM_FORMAT_S16_LE: + switch (snd_pcm_format_width(format)) { + case 16: width =3D FV_WL_16; break; - case SNDRV_PCM_FORMAT_S20_3LE: + case 20: width =3D FV_WL_20; break; - case SNDRV_PCM_FORMAT_S24_3LE: + case 24: width =3D FV_WL_24; break; - case SNDRV_PCM_FORMAT_S24_LE: - case SNDRV_PCM_FORMAT_S32_LE: + case 32: width =3D FV_WL_32; break; default: @@ -3326,6 +3325,7 @@ static const struct snd_soc_component_driver soc_comp= onent_dev_tscs454 =3D { .num_dapm_routes =3D ARRAY_SIZE(tscs454_intercon), .controls =3D tscs454_snd_controls, .num_controls =3D ARRAY_SIZE(tscs454_snd_controls), + .endianness =3D 1, }; =20 #define TSCS454_RATES SNDRV_PCM_RATE_8000_96000 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BA18C433EF for ; Tue, 7 Jun 2022 22:13:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383151AbiFGWNO (ORCPT ); Tue, 7 Jun 2022 18:13:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379768AbiFGVK6 (ORCPT ); Tue, 7 Jun 2022 17:10:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A171215E52; Tue, 7 Jun 2022 11:52:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1277B8237F; Tue, 7 Jun 2022 18:52:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 260A9C385A5; Tue, 7 Jun 2022 18:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627920; bh=HQF46pET341uvIM6dclJ+MRdmoa7RzWaMYRR/mwcVOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VnDG7HyPl5g42GvOliHIztOCHbdTUroNXrMUqieUdSsbNCjvoAH4nnfPrRVYeo/E+ FKaVTRH73EepeDH/zebGXbWXMUYJRh2BgFnCr27IDlH+6earYqVAb4vprrV/jKGHrH rCMguWbF9rmE5r55w0VqFd/YXF73FVmugUJpH3Pg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gavin Li , Moshe Shemesh , Shay Drory , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 140/879] net/mlx5: Increase FW pre-init timeout for health recovery Date: Tue, 7 Jun 2022 18:54:18 +0200 Message-Id: <20220607165006.769133227@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gavin Li [ Upstream commit 37ca95e62ee23fa6d2c2c64e3dc40b4a0c0146dc ] Currently, health recovery will reload driver to recover it from fatal errors. During the driver's load process, it would wait for FW to set the pre-init bit for up to 120 seconds, beyond this threshold it would abort the load process. In some cases, such as a FW upgrade on the DPU, this timeout period is insufficient, and the user has no way to recover the host device. To solve this issue, introduce a new FW pre-init timeout for health recovery, which is set to 2 hours. The timeout for devlink reload and probe will use the original one because they are user triggered flows, and therefore should not have a significantly long timeout, during which the user command would hang. Signed-off-by: Gavin Li Reviewed-by: Moshe Shemesh Reviewed-by: Shay Drory Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../net/ethernet/mellanox/mlx5/core/devlink.c | 4 ++-- .../ethernet/mellanox/mlx5/core/fw_reset.c | 2 +- .../ethernet/mellanox/mlx5/core/lib/tout.c | 1 + .../ethernet/mellanox/mlx5/core/lib/tout.h | 1 + .../net/ethernet/mellanox/mlx5/core/main.c | 23 +++++++++++-------- .../ethernet/mellanox/mlx5/core/mlx5_core.h | 2 +- 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/ne= t/ethernet/mellanox/mlx5/core/devlink.c index 057dde6f4417..9401127fb0ec 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c @@ -178,13 +178,13 @@ static int mlx5_devlink_reload_up(struct devlink *dev= link, enum devlink_reload_a *actions_performed =3D BIT(action); switch (action) { case DEVLINK_RELOAD_ACTION_DRIVER_REINIT: - return mlx5_load_one(dev); + return mlx5_load_one(dev, false); case DEVLINK_RELOAD_ACTION_FW_ACTIVATE: if (limit =3D=3D DEVLINK_RELOAD_LIMIT_NO_RESET) break; /* On fw_activate action, also driver is reloaded and reinit performed */ *actions_performed |=3D BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT); - return mlx5_load_one(dev); + return mlx5_load_one(dev, false); default: /* Unsupported action should not get to this function */ WARN_ON(1); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c b/drivers/n= et/ethernet/mellanox/mlx5/core/fw_reset.c index 81eb67fb95b0..052af4901c0b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c @@ -149,7 +149,7 @@ static void mlx5_fw_reset_complete_reload(struct mlx5_c= ore_dev *dev) if (test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags)) { complete(&fw_reset->done); } else { - mlx5_load_one(dev); + mlx5_load_one(dev, false); devlink_remote_reload_actions_performed(priv_to_devlink(dev), 0, BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) | BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE)); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c b/drivers/n= et/ethernet/mellanox/mlx5/core/lib/tout.c index c1df0d3595d8..d758848d34d0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c @@ -10,6 +10,7 @@ struct mlx5_timeouts { =20 static const u32 tout_def_sw_val[MAX_TIMEOUT_TYPES] =3D { [MLX5_TO_FW_PRE_INIT_TIMEOUT_MS] =3D 120000, + [MLX5_TO_FW_PRE_INIT_ON_RECOVERY_TIMEOUT_MS] =3D 7200000, [MLX5_TO_FW_PRE_INIT_WARN_MESSAGE_INTERVAL_MS] =3D 20000, [MLX5_TO_FW_PRE_INIT_WAIT_MS] =3D 2, [MLX5_TO_FW_INIT_MS] =3D 2000, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/tout.h b/drivers/n= et/ethernet/mellanox/mlx5/core/lib/tout.h index 1c42ead782fa..257c03eeab36 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/tout.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/tout.h @@ -7,6 +7,7 @@ enum mlx5_timeouts_types { /* pre init timeouts (not read from FW) */ MLX5_TO_FW_PRE_INIT_TIMEOUT_MS, + MLX5_TO_FW_PRE_INIT_ON_RECOVERY_TIMEOUT_MS, MLX5_TO_FW_PRE_INIT_WARN_MESSAGE_INTERVAL_MS, MLX5_TO_FW_PRE_INIT_WAIT_MS, =20 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/e= thernet/mellanox/mlx5/core/main.c index ef196cb764e2..8b5263699994 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -1014,7 +1014,7 @@ static void mlx5_cleanup_once(struct mlx5_core_dev *d= ev) mlx5_devcom_unregister_device(dev->priv.devcom); } =20 -static int mlx5_function_setup(struct mlx5_core_dev *dev, bool boot) +static int mlx5_function_setup(struct mlx5_core_dev *dev, u64 timeout) { int err; =20 @@ -1029,11 +1029,11 @@ static int mlx5_function_setup(struct mlx5_core_dev= *dev, bool boot) =20 /* wait for firmware to accept initialization segments configurations */ - err =3D wait_fw_init(dev, mlx5_tout_ms(dev, FW_PRE_INIT_TIMEOUT), + err =3D wait_fw_init(dev, timeout, mlx5_tout_ms(dev, FW_PRE_INIT_WARN_MESSAGE_INTERVAL)); if (err) { mlx5_core_err(dev, "Firmware over %llu MS in pre-initializing state, abo= rting\n", - mlx5_tout_ms(dev, FW_PRE_INIT_TIMEOUT)); + timeout); return err; } =20 @@ -1296,7 +1296,7 @@ int mlx5_init_one(struct mlx5_core_dev *dev) mutex_lock(&dev->intf_state_mutex); dev->state =3D MLX5_DEVICE_STATE_UP; =20 - err =3D mlx5_function_setup(dev, true); + err =3D mlx5_function_setup(dev, mlx5_tout_ms(dev, FW_PRE_INIT_TIMEOUT)); if (err) goto err_function; =20 @@ -1360,9 +1360,10 @@ void mlx5_uninit_one(struct mlx5_core_dev *dev) mutex_unlock(&dev->intf_state_mutex); } =20 -int mlx5_load_one(struct mlx5_core_dev *dev) +int mlx5_load_one(struct mlx5_core_dev *dev, bool recovery) { int err =3D 0; + u64 timeout; =20 mutex_lock(&dev->intf_state_mutex); if (test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) { @@ -1372,7 +1373,11 @@ int mlx5_load_one(struct mlx5_core_dev *dev) /* remove any previous indication of internal error */ dev->state =3D MLX5_DEVICE_STATE_UP; =20 - err =3D mlx5_function_setup(dev, false); + if (recovery) + timeout =3D mlx5_tout_ms(dev, FW_PRE_INIT_ON_RECOVERY_TIMEOUT); + else + timeout =3D mlx5_tout_ms(dev, FW_PRE_INIT_TIMEOUT); + err =3D mlx5_function_setup(dev, timeout); if (err) goto err_function; =20 @@ -1746,7 +1751,7 @@ static void mlx5_pci_resume(struct pci_dev *pdev) =20 mlx5_pci_trace(dev, "Enter, loading driver..\n"); =20 - err =3D mlx5_load_one(dev); + err =3D mlx5_load_one(dev, false); =20 mlx5_pci_trace(dev, "Done, err =3D %d, device %s\n", err, !err ? "recovered" : "Failed"); @@ -1833,7 +1838,7 @@ static int mlx5_resume(struct pci_dev *pdev) { struct mlx5_core_dev *dev =3D pci_get_drvdata(pdev); =20 - return mlx5_load_one(dev); + return mlx5_load_one(dev, false); } =20 static const struct pci_device_id mlx5_core_pci_table[] =3D { @@ -1878,7 +1883,7 @@ int mlx5_recover_device(struct mlx5_core_dev *dev) return -EIO; } =20 - return mlx5_load_one(dev); + return mlx5_load_one(dev, true); } =20 static struct pci_driver mlx5_core_driver =3D { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/= net/ethernet/mellanox/mlx5/core/mlx5_core.h index a9b2d6ead542..9026be1d6223 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h @@ -290,7 +290,7 @@ void mlx5_mdev_uninit(struct mlx5_core_dev *dev); int mlx5_init_one(struct mlx5_core_dev *dev); void mlx5_uninit_one(struct mlx5_core_dev *dev); void mlx5_unload_one(struct mlx5_core_dev *dev); -int mlx5_load_one(struct mlx5_core_dev *dev); +int mlx5_load_one(struct mlx5_core_dev *dev, bool recovery); =20 int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 function_= id, void *out); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 579BEC43334 for ; Tue, 7 Jun 2022 22:13:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383873AbiFGWNS (ORCPT ); Tue, 7 Jun 2022 18:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379775AbiFGVK7 (ORCPT ); Tue, 7 Jun 2022 17:10:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 864B0215E55; Tue, 7 Jun 2022 11:52:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BB0FB61787; Tue, 7 Jun 2022 18:52:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBC36C385A2; Tue, 7 Jun 2022 18:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627923; bh=yWcmRdVyi+FWys7GZ9HWj6oxRlxBcBG6kQKuSmRN7nY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nlxCumJ7KfDghPj03b5R3q+PCe0sbPpqXFcHnfFJQr5M+97/Zy3LRfwnBZV2OAfEs CFT+jdwDkOcEWTZZixHVem4BVUkO6BGpbb7DtzV0G/wHesbCmt+B0BBm3YOUyq/2RB 2ojD3SOMDlexAQ+b2EksFUJ4jDWnDp02eAaxk/xo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bard Liao , Brent Lu , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.18 141/879] ASoC: Intel: sof_ssp_amp: fix no DMIC BE Link on Chromebooks Date: Tue, 7 Jun 2022 18:54:19 +0200 Message-Id: <20220607165006.798317953@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brent Lu [ Upstream commit d1c808765deb2bcd35d827402ed4d75d068aae18 ] The SOF topology supports 2 BE Links(dmic01 and dmic16k) and each link supports up to four DMICs. However, Chromebook does not implement ACPI NHLT table so the mach->mach_params.dmic_num is always zero. We add a quirk so machine driver knows it's running on a Chromebook and need to create BE Links for DMIC. Reviewed-by: Bard Liao Signed-off-by: Brent Lu Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220509170922.54868-3-pierre-louis.bossart= @linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/intel/boards/sof_ssp_amp.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/boards/sof_ssp_amp.c b/sound/soc/intel/boards/= sof_ssp_amp.c index 88530e9de543..ef70c6f27fe1 100644 --- a/sound/soc/intel/boards/sof_ssp_amp.c +++ b/sound/soc/intel/boards/sof_ssp_amp.c @@ -9,6 +9,7 @@ =20 #include #include +#include #include #include #include @@ -78,6 +79,16 @@ struct sof_card_private { bool idisp_codec; }; =20 +static const struct dmi_system_id chromebook_platforms[] =3D { + { + .ident =3D "Google Chromebooks", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {}, +}; + static const struct snd_soc_dapm_widget sof_ssp_amp_dapm_widgets[] =3D { SND_SOC_DAPM_MIC("SoC DMIC", NULL), }; @@ -371,7 +382,7 @@ static int sof_ssp_amp_probe(struct platform_device *pd= ev) struct snd_soc_dai_link *dai_links; struct snd_soc_acpi_mach *mach; struct sof_card_private *ctx; - int dmic_be_num, hdmi_num =3D 0; + int dmic_be_num =3D 0, hdmi_num =3D 0; int ret, ssp_codec; =20 ctx =3D devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); @@ -383,7 +394,8 @@ static int sof_ssp_amp_probe(struct platform_device *pd= ev) =20 mach =3D pdev->dev.platform_data; =20 - dmic_be_num =3D mach->mach_params.dmic_num; + if (dmi_check_system(chromebook_platforms) || mach->mach_params.dmic_num = > 0) + dmic_be_num =3D 2; =20 ssp_codec =3D sof_ssp_amp_quirk & SOF_AMPLIFIER_SSP_MASK; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C946FC433EF for ; Tue, 7 Jun 2022 22:13:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353748AbiFGWNZ (ORCPT ); Tue, 7 Jun 2022 18:13:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379821AbiFGVLD (ORCPT ); Tue, 7 Jun 2022 17:11:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A438B215E7F; Tue, 7 Jun 2022 11:52: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 ams.source.kernel.org (Postfix) with ESMTPS id 259B8B81FE1; Tue, 7 Jun 2022 18:52:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ED2CC385A2; Tue, 7 Jun 2022 18:52:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627925; bh=OkvOHVTj+0RUFez+W4m7EDCBB4EaSlENkTb8ZwkIaAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iee8egRh1HPtgHgTpiedPTd0c7uOilwPVWg18V4c+vghMrEyKOJERngoXS/guJ+Fg abdWb3T0etPgL3WJCLYfbC5OG7gkUuEsx+xYHaS/sl0Lo4jV5dyozeW2eOdcQ8NGEr 1iH1WfpArBEa0sYnQQkajwBkeL4R4EjNAjBnbd0I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yihang Li , Xiang Chen , John Garry , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 142/879] scsi: hisi_sas: Undo RPM resume for failed notify phy event for v3 HW Date: Tue, 7 Jun 2022 18:54:20 +0200 Message-Id: <20220607165006.827225822@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiang Chen [ Upstream commit 9b5387fe5af38116b452259d87cd66594b6277c1 ] If we fail to notify the phy up event then undo the RPM resume, as the phy up notify event handling pairs with that RPM resume. Link: https://lore.kernel.org/r/1651839939-101188-1-git-send-email-john.gar= ry@huawei.com Reported-by: Yihang Li Tested-by: Yihang Li Signed-off-by: Xiang Chen Signed-off-by: John Garry Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas= /hisi_sas_v3_hw.c index 79f87d7c3e68..7d819fc0395e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1563,9 +1563,15 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct h= isi_hba *hisi_hba) =20 phy->port_id =3D port_id; =20 - /* Call pm_runtime_put_sync() with pairs in hisi_sas_phyup_pm_work() */ + /* + * Call pm_runtime_get_noresume() which pairs with + * hisi_sas_phyup_pm_work() -> pm_runtime_put_sync(). + * For failure call pm_runtime_put() as we are in a hardirq context. + */ pm_runtime_get_noresume(dev); - hisi_sas_notify_phy_event(phy, HISI_PHYE_PHY_UP_PM); + res =3D hisi_sas_notify_phy_event(phy, HISI_PHYE_PHY_UP_PM); + if (!res) + pm_runtime_put(dev); =20 res =3D IRQ_HANDLED; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 337E6CCA487 for ; Tue, 7 Jun 2022 22:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384659AbiFGWP5 (ORCPT ); Tue, 7 Jun 2022 18:15:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379843AbiFGVLG (ORCPT ); Tue, 7 Jun 2022 17:11:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AE0417D39F; Tue, 7 Jun 2022 11:52:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 139DFB82182; Tue, 7 Jun 2022 18:52:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62C61C385A2; Tue, 7 Jun 2022 18:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627928; bh=242D0h+7US9qoAxy4aP+hGItDh1JMCe93gIbKSuD2uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cRQtvVNyqEIML979+N4+c6h26yNucyORjmAxnQOOejI/DJOTGQsvoiObDC5hNw9W1 JHyZGYfMIUCj1w5vdSehO1ASzUSEz2xmB/VEtLe6nVXrhktKTsvCBPe/xIS0V+Pl6x TDwcfQo7gUGquzdEN6eKTXLV/FPa4F2N96agUYIE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 143/879] scsi: lpfc: Inhibit aborts if external loopback plug is inserted Date: Tue, 7 Jun 2022 18:54:21 +0200 Message-Id: <20220607165006.856159380@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit ead76d4c09b89f4c8d632648026a476a5a34fde8 ] After running a short external loopback test, when the external loopback is removed and a normal cable inserted that is directly connected to a target device, the system oops in the llpfc_set_rrq_active() routine. When the loopback was inserted an FLOGI was transmit. As we're looped back, we receive the FLOGI request. The FLOGI is ABTS'd as we recognize the same wppn thus understand it's a loopback. However, as the ABTS sends address information the port is not set to (fffffe), the ABTS is dropped on the wire. A short 1 frame loopback test is run and completes before the ABTS times out. The looback is unplugged and the new cable plugged in, and the an FLOGI to the new device occurs and completes. Due to a mixup in ref counting the completion of the new FLOGI releases the fabric ndlp. Then the original ABTS completes and references the released ndlp generating the oops. Correct by no-op'ing the ABTS when in loopback mode (it will be dropped anyway). Added a flag to track the mode to recognize when it should be no-op'd. Link: https://lore.kernel.org/r/20220506035519.50908-5-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 12 ++++++++++++ drivers/scsi/lpfc/lpfc_hbadisc.c | 3 +++ drivers/scsi/lpfc/lpfc_sli.c | 8 +++++--- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 0025760230e5..da5e91a91151 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1025,6 +1025,7 @@ struct lpfc_hba { #define LS_MDS_LINK_DOWN 0x8 /* MDS Diagnostics Link Down */ #define LS_MDS_LOOPBACK 0x10 /* MDS Diagnostics Link Up (Loopback) */ #define LS_CT_VEN_RPA 0x20 /* Vendor RPA sent to switch */ +#define LS_EXTERNAL_LOOPBACK 0x40 /* External loopback plug inserted */ =20 uint32_t hba_flag; /* hba generic flags */ #define HBA_ERATT_HANDLED 0x1 /* This flag is set when eratt handled */ diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 46a01a51b207..9545a35f0777 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -1387,6 +1387,9 @@ lpfc_issue_els_flogi(struct lpfc_vport *vport, struct= lpfc_nodelist *ndlp, =20 phba->hba_flag |=3D (HBA_FLOGI_ISSUED | HBA_FLOGI_OUTSTANDING); =20 + /* Clear external loopback plug detected flag */ + phba->link_flag &=3D ~LS_EXTERNAL_LOOPBACK; + /* Check for a deferred FLOGI ACC condition */ if (phba->defer_flogi_acc_flag) { /* lookup ndlp for received FLOGI */ @@ -8182,6 +8185,9 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct l= pfc_iocbq *cmdiocb, uint32_t fc_flag =3D 0; uint32_t port_state =3D 0; =20 + /* Clear external loopback plug detected flag */ + phba->link_flag &=3D ~LS_EXTERNAL_LOOPBACK; + cmd =3D *lp++; sp =3D (struct serv_parm *) lp; =20 @@ -8233,6 +8239,12 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct = lpfc_iocbq *cmdiocb, return 1; } =20 + /* External loopback plug insertion detected */ + phba->link_flag |=3D LS_EXTERNAL_LOOPBACK; + + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_LIBDFC, + "1119 External Loopback plug detected\n"); + /* abort the flogi coming back to ourselves * due to external loopback on the port. */ diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbad= isc.c index 2b877dff5ed4..6b6b3790d7b5 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -1221,6 +1221,9 @@ lpfc_linkdown(struct lpfc_hba *phba) =20 phba->defer_flogi_acc_flag =3D false; =20 + /* Clear external loopback plug detected flag */ + phba->link_flag &=3D ~LS_EXTERNAL_LOOPBACK; + spin_lock_irq(&phba->hbalock); phba->fcf.fcf_flag &=3D ~(FCF_AVAILABLE | FCF_SCAN_DONE); spin_unlock_irq(&phba->hbalock); diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index a174e06bd96e..11f907278f09 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -12202,7 +12202,8 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, s= truct lpfc_sli_ring *pring, =20 if (phba->link_state < LPFC_LINK_UP || (phba->sli_rev =3D=3D LPFC_SLI_REV4 && - phba->sli4_hba.link_state.status =3D=3D LPFC_FC_LA_TYPE_LINK_DOWN)) + phba->sli4_hba.link_state.status =3D=3D LPFC_FC_LA_TYPE_LINK_DOWN) || + (phba->link_flag & LS_EXTERNAL_LOOPBACK)) ia =3D true; else ia =3D false; @@ -12661,7 +12662,8 @@ lpfc_sli_abort_taskmgmt(struct lpfc_vport *vport, s= truct lpfc_sli_ring *pring, ndlp =3D lpfc_cmd->rdata->pnode; =20 if (lpfc_is_link_up(phba) && - (ndlp && ndlp->nlp_state =3D=3D NLP_STE_MAPPED_NODE)) + (ndlp && ndlp->nlp_state =3D=3D NLP_STE_MAPPED_NODE) && + !(phba->link_flag & LS_EXTERNAL_LOOPBACK)) ia =3D false; else ia =3D true; @@ -21126,7 +21128,7 @@ lpfc_sli4_issue_abort_iotag(struct lpfc_hba *phba, = struct lpfc_iocbq *cmdiocb, abtswqe =3D &abtsiocb->wqe; memset(abtswqe, 0, sizeof(*abtswqe)); =20 - if (!lpfc_is_link_up(phba)) + if (!lpfc_is_link_up(phba) || (phba->link_flag & LS_EXTERNAL_LOOPBACK)) bf_set(abort_cmd_ia, &abtswqe->abort_cmd, 1); bf_set(abort_cmd_criteria, &abtswqe->abort_cmd, T_XRI_TAG); abtswqe->abort_cmd.rsrvd5 =3D 0; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE81EC433EF for ; Tue, 7 Jun 2022 22:13:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383963AbiFGWN3 (ORCPT ); Tue, 7 Jun 2022 18:13:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379852AbiFGVLH (ORCPT ); Tue, 7 Jun 2022 17: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 342D3216288; Tue, 7 Jun 2022 11:52:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0210461734; Tue, 7 Jun 2022 18:52:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D83DC385A2; Tue, 7 Jun 2022 18:52:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627931; bh=GyameJLNn35/i4nSz9B0JeJrRXUDJHFDMxiweObynGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dHtNkGEbrnG2jro21xXL5HdfQ0O9kCSwntg/iNfLd0hq6f5gp12P+R8WyiG1n7JKg mXKh57VX9HpUjgXcEoy0CI8qqrMK/46IhoxwL1JVLu3IGWn0RXZskPLs2UrTkpUEMh ulBa59YMAAHiXw+SuNBAWf69aFW/ABoRTPhp6KAo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 144/879] scsi: lpfc: Alter FPIN stat accounting logic Date: Tue, 7 Jun 2022 18:54:22 +0200 Message-Id: <20220607165006.885014079@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit e6f51041450282a8668af3a8fc5c7744e81a447c ] When configuring CMF management based on signals instead of FPINs, FPIN alarm and warning statistics are not tracked. Change the behavior so that FPIN alarms and warnings are always tracked regardless of the configured mode. Similar changes are made in the CMF signal stat accounting logic. Upon receipt of a signal, only track signaled alarms and warnings. FPIN stats should not be incremented upon receipt of a signal. Link: https://lore.kernel.org/r/20220506035519.50908-11-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc_els.c | 49 +++++++++++------------------------ drivers/scsi/lpfc/lpfc_init.c | 22 ++-------------- 2 files changed, 17 insertions(+), 54 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 9545a35f0777..892b3da1ba45 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -3877,9 +3877,6 @@ lpfc_least_capable_settings(struct lpfc_hba *phba, { u32 rsp_sig_cap =3D 0, drv_sig_cap =3D 0; u32 rsp_sig_freq_cyc =3D 0, rsp_sig_freq_scale =3D 0; - struct lpfc_cgn_info *cp; - u32 crc; - u16 sig_freq; =20 /* Get rsp signal and frequency capabilities. */ rsp_sig_cap =3D be32_to_cpu(pcgd->xmt_signal_capability); @@ -3935,25 +3932,7 @@ lpfc_least_capable_settings(struct lpfc_hba *phba, } } =20 - if (!phba->cgn_i) - return; - - /* Update signal frequency in congestion info buffer */ - cp =3D (struct lpfc_cgn_info *)phba->cgn_i->virt; - - /* Frequency (in ms) Signal Warning/Signal Congestion Notifications - * are received by the HBA - */ - sig_freq =3D phba->cgn_sig_freq; - - if (phba->cgn_reg_signal =3D=3D EDC_CG_SIG_WARN_ONLY) - cp->cgn_warn_freq =3D cpu_to_le16(sig_freq); - if (phba->cgn_reg_signal =3D=3D EDC_CG_SIG_WARN_ALARM) { - cp->cgn_alarm_freq =3D cpu_to_le16(sig_freq); - cp->cgn_warn_freq =3D cpu_to_le16(sig_freq); - } - crc =3D lpfc_cgn_calc_crc32(cp, LPFC_CGN_INFO_SZ, LPFC_CGN_CRC32_SEED); - cp->cgn_info_crc =3D cpu_to_le32(crc); + /* We are NOT recording signal frequency in congestion info buffer */ return; =20 out_no_support: @@ -9971,11 +9950,14 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct= fc_tlv_desc *tlv) /* Take action here for an Alarm event */ if (phba->cmf_active_mode !=3D LPFC_CFG_OFF) { if (phba->cgn_reg_fpin & LPFC_CGN_FPIN_ALARM) { - /* Track of alarm cnt for cgn_info */ - atomic_inc(&phba->cgn_fabric_alarm_cnt); /* Track of alarm cnt for SYNC_WQE */ atomic_inc(&phba->cgn_sync_alarm_cnt); } + /* Track alarm cnt for cgn_info regardless + * of whether CMF is configured for Signals + * or FPINs. + */ + atomic_inc(&phba->cgn_fabric_alarm_cnt); goto cleanup; } break; @@ -9983,11 +9965,14 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct= fc_tlv_desc *tlv) /* Take action here for a Warning event */ if (phba->cmf_active_mode !=3D LPFC_CFG_OFF) { if (phba->cgn_reg_fpin & LPFC_CGN_FPIN_WARN) { - /* Track of warning cnt for cgn_info */ - atomic_inc(&phba->cgn_fabric_warn_cnt); /* Track of warning cnt for SYNC_WQE */ atomic_inc(&phba->cgn_sync_warn_cnt); } + /* Track warning cnt and freq for cgn_info + * regardless of whether CMF is configured for + * Signals or FPINs. + */ + atomic_inc(&phba->cgn_fabric_warn_cnt); cleanup: /* Save frequency in ms */ phba->cgn_fpin_frequency =3D @@ -9996,14 +9981,10 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct= fc_tlv_desc *tlv) if (phba->cgn_i) { cp =3D (struct lpfc_cgn_info *) phba->cgn_i->virt; - if (phba->cgn_reg_fpin & - LPFC_CGN_FPIN_ALARM) - cp->cgn_alarm_freq =3D - cpu_to_le16(value); - if (phba->cgn_reg_fpin & - LPFC_CGN_FPIN_WARN) - cp->cgn_warn_freq =3D - cpu_to_le16(value); + cp->cgn_alarm_freq =3D + cpu_to_le16(value); + cp->cgn_warn_freq =3D + cpu_to_le16(value); crc =3D lpfc_cgn_calc_crc32 (cp, LPFC_CGN_INFO_SZ, diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index f9cd4b72d949..011849c1ed3c 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -5866,21 +5866,8 @@ lpfc_cgn_save_evt_cnt(struct lpfc_hba *phba) =20 /* Use the frequency found in the last rcv'ed FPIN */ value =3D phba->cgn_fpin_frequency; - if (phba->cgn_reg_fpin & LPFC_CGN_FPIN_WARN) - cp->cgn_warn_freq =3D cpu_to_le16(value); - if (phba->cgn_reg_fpin & LPFC_CGN_FPIN_ALARM) - cp->cgn_alarm_freq =3D cpu_to_le16(value); - - /* Frequency (in ms) Signal Warning/Signal Congestion Notifications - * are received by the HBA - */ - value =3D phba->cgn_sig_freq; - - if (phba->cgn_reg_signal =3D=3D EDC_CG_SIG_WARN_ONLY || - phba->cgn_reg_signal =3D=3D EDC_CG_SIG_WARN_ALARM) - cp->cgn_warn_freq =3D cpu_to_le16(value); - if (phba->cgn_reg_signal =3D=3D EDC_CG_SIG_WARN_ALARM) - cp->cgn_alarm_freq =3D cpu_to_le16(value); + cp->cgn_warn_freq =3D cpu_to_le16(value); + cp->cgn_alarm_freq =3D cpu_to_le16(value); =20 lvalue =3D lpfc_cgn_calc_crc32(cp, LPFC_CGN_INFO_SZ, LPFC_CGN_CRC32_SEED); @@ -6595,9 +6582,6 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct= lpfc_acqe_sli *acqe_sli) /* Alarm overrides warning, so check that first */ if (cgn_signal->alarm_cnt) { if (phba->cgn_reg_signal =3D=3D EDC_CG_SIG_WARN_ALARM) { - /* Keep track of alarm cnt for cgn_info */ - atomic_add(cgn_signal->alarm_cnt, - &phba->cgn_fabric_alarm_cnt); /* Keep track of alarm cnt for CMF_SYNC_WQE */ atomic_add(cgn_signal->alarm_cnt, &phba->cgn_sync_alarm_cnt); @@ -6606,8 +6590,6 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct= lpfc_acqe_sli *acqe_sli) /* signal action needs to be taken */ if (phba->cgn_reg_signal =3D=3D EDC_CG_SIG_WARN_ONLY || phba->cgn_reg_signal =3D=3D EDC_CG_SIG_WARN_ALARM) { - /* Keep track of warning cnt for cgn_info */ - atomic_add(cnt, &phba->cgn_fabric_warn_cnt); /* Keep track of warning cnt for CMF_SYNC_WQE */ atomic_add(cnt, &phba->cgn_sync_warn_cnt); } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FB25CCA49B for ; Tue, 7 Jun 2022 22:17:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384688AbiFGWQC (ORCPT ); Tue, 7 Jun 2022 18:16:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379866AbiFGVLH (ORCPT ); Tue, 7 Jun 2022 17:11:07 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 900EF20E52F; Tue, 7 Jun 2022 11:52:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C0626CE2465; Tue, 7 Jun 2022 18:52:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB027C385A2; Tue, 7 Jun 2022 18:52:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627934; bh=vP7PH4Srh+bvPzDuDeiJrBEIpsiBzOwQZMJ0VjjfR3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ein+AwdvXhpl3IpfrdMs+lRp3hKbCHzVl5MopYJdtxUg1B55mE1BJj1OVCYkZbvU7 Wuu5fNTUZLZmJlq9ZK0xXH0VafqL+AWe+ijPIjBtlyLjy2jVczOTdcY7KY8c1FQkOo a3PwrnDXNNZFggeJqIrtpYFbRY719IOEtqfQYxY0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 145/879] net: remove two BUG() from skb_checksum_help() Date: Tue, 7 Jun 2022 18:54:23 +0200 Message-Id: <20220607165006.913303961@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit d7ea0d9df2a6265b2b180d17ebc64b38105968fc ] I have a syzbot report that managed to get a crash in skb_checksum_help() If syzbot can trigger these BUG(), it makes sense to replace them with more friendly WARN_ON_ONCE() since skb_checksum_help() can instead return an error code. Note that syzbot will still crash there, until real bug is fixed. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/core/dev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 2771fd22dc6a..0784c339cd7d 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3215,11 +3215,15 @@ int skb_checksum_help(struct sk_buff *skb) } =20 offset =3D skb_checksum_start_offset(skb); - BUG_ON(offset >=3D skb_headlen(skb)); + ret =3D -EINVAL; + if (WARN_ON_ONCE(offset >=3D skb_headlen(skb))) + goto out; + csum =3D skb_checksum(skb, offset, skb->len - offset, 0); =20 offset +=3D skb->csum_offset; - BUG_ON(offset + sizeof(__sum16) > skb_headlen(skb)); + if (WARN_ON_ONCE(offset + sizeof(__sum16) > skb_headlen(skb))) + goto out; =20 ret =3D skb_ensure_writable(skb, offset + sizeof(__sum16)); if (ret) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2720DC43334 for ; Tue, 7 Jun 2022 22:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384112AbiFGWNi (ORCPT ); Tue, 7 Jun 2022 18:13:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379872AbiFGVLI (ORCPT ); Tue, 7 Jun 2022 17:11:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 829D012B006; Tue, 7 Jun 2022 11:52:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1389FB81FE1; Tue, 7 Jun 2022 18:52:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C6CEC385A2; Tue, 7 Jun 2022 18:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627936; bh=g7XB8B2hXhx0t6vm3lGhWMstRlw7oJH8/lHkhtWU6kk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rRT0vJ+c/XgHqfFioQALDmDfPJpEYcoO34K63Knr5Z0lKOV/L2dqkv5f8ooku/pO1 QcWxiPXHLoOkN1STlmnmf8Ee8Jmt3uYXptWaBkuiXEQWOtX5t4K+xOTFzZc7v9h0Hq RpG1QIqNzSWsSzeXdVQTbRoLtdi+ZvQowG6iZTGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Richter , Sven Schnelle , Heiko Carstens , Sasha Levin Subject: [PATCH 5.18 146/879] s390/preempt: disable __preempt_count_add() optimization for PROFILE_ALL_BRANCHES Date: Tue, 7 Jun 2022 18:54:24 +0200 Message-Id: <20220607165006.941950313@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heiko Carstens [ Upstream commit 63678eecec57fc51b778be3da35a397931287170 ] gcc 12 does not (always) optimize away code that should only be generated if parameters are constant and within in a certain range. This depends on various obscure kernel config options, however in particular PROFILE_ALL_BRANCHES can trigger this compile error: In function =E2=80=98__atomic_add_const=E2=80=99, inlined from =E2=80=98__preempt_count_add.part.0=E2=80=99 at ./arch/s39= 0/include/asm/preempt.h:50:3: ./arch/s390/include/asm/atomic_ops.h:80:9: error: impossible constraint in = =E2=80=98asm=E2=80=99 80 | asm volatile( = \ | ^~~ Workaround this by simply disabling the optimization for PROFILE_ALL_BRANCHES, since the kernel will be so slow, that this optimization won't matter at all. Reported-by: Thomas Richter Reviewed-by: Sven Schnelle Signed-off-by: Heiko Carstens Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/s390/include/asm/preempt.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/s390/include/asm/preempt.h b/arch/s390/include/asm/preemp= t.h index d9d5350cc3ec..bf15da0fedbc 100644 --- a/arch/s390/include/asm/preempt.h +++ b/arch/s390/include/asm/preempt.h @@ -46,10 +46,17 @@ static inline bool test_preempt_need_resched(void) =20 static inline void __preempt_count_add(int val) { - if (__builtin_constant_p(val) && (val >=3D -128) && (val <=3D 127)) - __atomic_add_const(val, &S390_lowcore.preempt_count); - else - __atomic_add(val, &S390_lowcore.preempt_count); + /* + * With some obscure config options and CONFIG_PROFILE_ALL_BRANCHES + * enabled, gcc 12 fails to handle __builtin_constant_p(). + */ + if (!IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES)) { + if (__builtin_constant_p(val) && (val >=3D -128) && (val <=3D 127)) { + __atomic_add_const(val, &S390_lowcore.preempt_count); + return; + } + } + __atomic_add(val, &S390_lowcore.preempt_count); } =20 static inline void __preempt_count_sub(int val) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E53BDC43334 for ; Tue, 7 Jun 2022 22:13:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354329AbiFGWNl (ORCPT ); Tue, 7 Jun 2022 18:13:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379883AbiFGVLI (ORCPT ); Tue, 7 Jun 2022 17:11:08 -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 6D49D21629E; Tue, 7 Jun 2022 11:52:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E3D286156D; Tue, 7 Jun 2022 18:52:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04385C385A2; Tue, 7 Jun 2022 18:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627942; bh=sbZJ/EgR/Q6h7bQ8bXYkdHk3sVPiz5d14IrGMh6M1ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RkQ0cJeYiIpbknQTHCz34yPra8oATCa5cJLJ6yXuzls+XJ4BPvB4UCyo/6JpCnGSs cG+omIN2vPS9+1sePQf0VIk1R0wVC6y5TKH50EhZ5B/Zob52fXH2LUo0Mn9TqX/nYs jWWaG2JxYaqgBySILnUH7XFORVb/I+qB2N993wEo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ravi Bangoria , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.18 147/879] perf/amd/ibs: Cascade pmu init functions return value Date: Tue, 7 Jun 2022 18:54:25 +0200 Message-Id: <20220607165006.971472877@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ravi Bangoria [ Upstream commit 39b2ca75eec8a33e2ffdb8aa0c4840ec3e3b472c ] IBS pmu initialization code ignores return value provided by callee functions. Fix it. Signed-off-by: Ravi Bangoria Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20220509044914.1473-2-ravi.bangoria@amd.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/events/amd/ibs.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c index 9739019d4b67..367ca899e6e8 100644 --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c @@ -759,9 +759,10 @@ static __init int perf_ibs_pmu_init(struct perf_ibs *p= erf_ibs, char *name) return ret; } =20 -static __init void perf_event_ibs_init(void) +static __init int perf_event_ibs_init(void) { struct attribute **attr =3D ibs_op_format_attrs; + int ret; =20 /* * Some chips fail to reset the fetch count when it is written; instead @@ -773,7 +774,9 @@ static __init void perf_event_ibs_init(void) if (boot_cpu_data.x86 =3D=3D 0x19 && boot_cpu_data.x86_model < 0x10) perf_ibs_fetch.fetch_ignore_if_zero_rip =3D 1; =20 - perf_ibs_pmu_init(&perf_ibs_fetch, "ibs_fetch"); + ret =3D perf_ibs_pmu_init(&perf_ibs_fetch, "ibs_fetch"); + if (ret) + return ret; =20 if (ibs_caps & IBS_CAPS_OPCNT) { perf_ibs_op.config_mask |=3D IBS_OP_CNT_CTL; @@ -786,15 +789,35 @@ static __init void perf_event_ibs_init(void) perf_ibs_op.cnt_mask |=3D IBS_OP_MAX_CNT_EXT_MASK; } =20 - perf_ibs_pmu_init(&perf_ibs_op, "ibs_op"); + ret =3D perf_ibs_pmu_init(&perf_ibs_op, "ibs_op"); + if (ret) + goto err_op; + + ret =3D register_nmi_handler(NMI_LOCAL, perf_ibs_nmi_handler, 0, "perf_ib= s"); + if (ret) + goto err_nmi; =20 - register_nmi_handler(NMI_LOCAL, perf_ibs_nmi_handler, 0, "perf_ibs"); pr_info("perf: AMD IBS detected (0x%08x)\n", ibs_caps); + return 0; + +err_nmi: + perf_pmu_unregister(&perf_ibs_op.pmu); + free_percpu(perf_ibs_op.pcpu); + perf_ibs_op.pcpu =3D NULL; +err_op: + perf_pmu_unregister(&perf_ibs_fetch.pmu); + free_percpu(perf_ibs_fetch.pcpu); + perf_ibs_fetch.pcpu =3D NULL; + + return ret; } =20 #else /* defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD) */ =20 -static __init void perf_event_ibs_init(void) { } +static __init int perf_event_ibs_init(void) +{ + return 0; +} =20 #endif =20 @@ -1064,9 +1087,7 @@ static __init int amd_ibs_init(void) x86_pmu_amd_ibs_starting_cpu, x86_pmu_amd_ibs_dying_cpu); =20 - perf_event_ibs_init(); - - return 0; + return perf_event_ibs_init(); } =20 /* Since we need the pci subsystem to init ibs we can't do this earlier: */ --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D8E6C433EF for ; Tue, 7 Jun 2022 22:18:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383133AbiFGWSS (ORCPT ); Tue, 7 Jun 2022 18:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379908AbiFGVLJ (ORCPT ); Tue, 7 Jun 2022 17:11:09 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5476216805; Tue, 7 Jun 2022 11:52: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 sin.source.kernel.org (Postfix) with ESMTPS id F35D1CE2425; Tue, 7 Jun 2022 18:52:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD503C385A2; Tue, 7 Jun 2022 18:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627945; bh=JRkJa0zl65vatEo/O3a7Xd7SVKXSRFf9IzYWnB78tLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v6rSj0X/KzzynKj1yzSjhL8goHfi1ihcalTa01s+63/+nQXenIk5vv9RBmHMApNbU fg2jrvbFFKEJtA3hwWJZkhy1duyBBSh1wAHMJlPqAA7eFCyEEmzcWkpesO2YsRP2Qw /AQB7MbGr7v8MUnecS0YVtjo0lHO+0vmhs8eUoeE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hao Jia , "Peter Zijlstra (Intel)" , Dietmar Eggemann , Sasha Levin Subject: [PATCH 5.18 148/879] sched/core: Avoid obvious double update_rq_clock warning Date: Tue, 7 Jun 2022 18:54:26 +0200 Message-Id: <20220607165007.001307779@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hao Jia [ Upstream commit 2679a83731d51a744657f718fc02c3b077e47562 ] When we use raw_spin_rq_lock() to acquire the rq lock and have to update the rq clock while holding the lock, the kernel may issue a WARN_DOUBLE_CLOCK warning. Since we directly use raw_spin_rq_lock() to acquire rq lock instead of rq_lock(), there is no corresponding change to rq->clock_update_flags. In particular, we have obtained the rq lock of other CPUs, the rq->clock_update_flags of this CPU may be RQCF_UPDATED at this time, and then calling update_rq_clock() will trigger the WARN_DOUBLE_CLOCK warning. So we need to clear RQCF_UPDATED of rq->clock_update_flags to avoid the WARN_DOUBLE_CLOCK warning. For the sched_rt_period_timer() and migrate_task_rq_dl() cases we simply replace raw_spin_rq_lock()/raw_spin_rq_unlock() with rq_lock()/rq_unlock(). For the {pull,push}_{rt,dl}_task() cases, we add the double_rq_clock_clear_update() function to clear RQCF_UPDATED of rq->clock_update_flags, and call double_rq_clock_clear_update() before double_lock_balance()/double_rq_lock() returns to avoid the WARN_DOUBLE_CLOCK warning. Some call trace reports: Call Trace 1: sched_rt_period_timer+0x10f/0x3a0 ? enqueue_top_rt_rq+0x110/0x110 __hrtimer_run_queues+0x1a9/0x490 hrtimer_interrupt+0x10b/0x240 __sysvec_apic_timer_interrupt+0x8a/0x250 sysvec_apic_timer_interrupt+0x9a/0xd0 asm_sysvec_apic_timer_interrupt+0x12/0x20 Call Trace 2: activate_task+0x8b/0x110 push_rt_task.part.108+0x241/0x2c0 push_rt_tasks+0x15/0x30 finish_task_switch+0xaa/0x2e0 ? __switch_to+0x134/0x420 __schedule+0x343/0x8e0 ? hrtimer_start_range_ns+0x101/0x340 schedule+0x4e/0xb0 do_nanosleep+0x8e/0x160 hrtimer_nanosleep+0x89/0x120 ? hrtimer_init_sleeper+0x90/0x90 __x64_sys_nanosleep+0x96/0xd0 do_syscall_64+0x34/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae Call Trace 3: deactivate_task+0x93/0xe0 pull_rt_task+0x33e/0x400 balance_rt+0x7e/0x90 __schedule+0x62f/0x8e0 do_task_dead+0x3f/0x50 do_exit+0x7b8/0xbb0 do_group_exit+0x2d/0x90 get_signal+0x9df/0x9e0 ? preempt_count_add+0x56/0xa0 ? __remove_hrtimer+0x35/0x70 arch_do_signal_or_restart+0x36/0x720 ? nanosleep_copyout+0x39/0x50 ? do_nanosleep+0x131/0x160 ? audit_filter_inodes+0xf5/0x120 exit_to_user_mode_prepare+0x10f/0x1e0 syscall_exit_to_user_mode+0x17/0x30 do_syscall_64+0x40/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae Call Trace 4: update_rq_clock+0x128/0x1a0 migrate_task_rq_dl+0xec/0x310 set_task_cpu+0x84/0x1e4 try_to_wake_up+0x1d8/0x5c0 wake_up_process+0x1c/0x30 hrtimer_wakeup+0x24/0x3c __hrtimer_run_queues+0x114/0x270 hrtimer_interrupt+0xe8/0x244 arch_timer_handler_phys+0x30/0x50 handle_percpu_devid_irq+0x88/0x140 generic_handle_domain_irq+0x40/0x60 gic_handle_irq+0x48/0xe0 call_on_irq_stack+0x2c/0x60 do_interrupt_handler+0x80/0x84 Steps to reproduce: 1. Enable CONFIG_SCHED_DEBUG when compiling the kernel 2. echo 1 > /sys/kernel/debug/clear_warn_once echo "WARN_DOUBLE_CLOCK" > /sys/kernel/debug/sched/features echo "NO_RT_PUSH_IPI" > /sys/kernel/debug/sched/features 3. Run some rt/dl tasks that periodically work and sleep, e.g. Create 2*n rt or dl (90% running) tasks via rt-app (on a system with n CPUs), and Dietmar Eggemann reports Call Trace 4 when running on PREEMPT_RT kernel. Signed-off-by: Hao Jia Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Dietmar Eggemann Link: https://lore.kernel.org/r/20220430085843.62939-2-jiahao.os@bytedance.= com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/sched/core.c | 6 +++--- kernel/sched/deadline.c | 5 +++-- kernel/sched/rt.c | 5 +++-- kernel/sched/sched.h | 28 ++++++++++++++++++++++++---- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index d58c0389eb23..e58d894df207 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -610,10 +610,10 @@ void double_rq_lock(struct rq *rq1, struct rq *rq2) swap(rq1, rq2); =20 raw_spin_rq_lock(rq1); - if (__rq_lockp(rq1) =3D=3D __rq_lockp(rq2)) - return; + if (__rq_lockp(rq1) !=3D __rq_lockp(rq2)) + raw_spin_rq_lock_nested(rq2, SINGLE_DEPTH_NESTING); =20 - raw_spin_rq_lock_nested(rq2, SINGLE_DEPTH_NESTING); + double_rq_clock_clear_update(rq1, rq2); } #endif =20 diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index fb4255ae0b2c..b61281d10458 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1832,6 +1832,7 @@ select_task_rq_dl(struct task_struct *p, int cpu, int= flags) =20 static void migrate_task_rq_dl(struct task_struct *p, int new_cpu __maybe_= unused) { + struct rq_flags rf; struct rq *rq; =20 if (READ_ONCE(p->__state) !=3D TASK_WAKING) @@ -1843,7 +1844,7 @@ static void migrate_task_rq_dl(struct task_struct *p,= int new_cpu __maybe_unused * from try_to_wake_up(). Hence, p->pi_lock is locked, but * rq->lock is not... So, lock it */ - raw_spin_rq_lock(rq); + rq_lock(rq, &rf); if (p->dl.dl_non_contending) { update_rq_clock(rq); sub_running_bw(&p->dl, &rq->dl); @@ -1859,7 +1860,7 @@ static void migrate_task_rq_dl(struct task_struct *p,= int new_cpu __maybe_unused put_task_struct(p); } sub_rq_bw(&p->dl, &rq->dl); - raw_spin_rq_unlock(rq); + rq_unlock(rq, &rf); } =20 static void check_preempt_equal_dl(struct rq *rq, struct task_struct *p) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index a32c46889af8..7891c0f0e1ff 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -871,6 +871,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth= *rt_b, int overrun) int enqueue =3D 0; struct rt_rq *rt_rq =3D sched_rt_period_rt_rq(rt_b, i); struct rq *rq =3D rq_of_rt_rq(rt_rq); + struct rq_flags rf; int skip; =20 /* @@ -885,7 +886,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth= *rt_b, int overrun) if (skip) continue; =20 - raw_spin_rq_lock(rq); + rq_lock(rq, &rf); update_rq_clock(rq); =20 if (rt_rq->rt_time) { @@ -923,7 +924,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth= *rt_b, int overrun) =20 if (enqueue) sched_rt_rq_enqueue(rt_rq); - raw_spin_rq_unlock(rq); + rq_unlock(rq, &rf); } =20 if (!throttled && (!rt_bandwidth_enabled() || rt_b->rt_runtime =3D=3D RUN= TIME_INF)) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 8dccb34eb190..2133aea22086 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2478,6 +2478,24 @@ unsigned long arch_scale_freq_capacity(int cpu) } #endif =20 +#ifdef CONFIG_SCHED_DEBUG +/* + * In double_lock_balance()/double_rq_lock(), we use raw_spin_rq_lock() to + * acquire rq lock instead of rq_lock(). So at the end of these two functi= ons + * we need to call double_rq_clock_clear_update() to clear RQCF_UPDATED of + * rq->clock_update_flags to avoid the WARN_DOUBLE_CLOCK warning. + */ +static inline void double_rq_clock_clear_update(struct rq *rq1, struct rq = *rq2) +{ + rq1->clock_update_flags &=3D (RQCF_REQ_SKIP|RQCF_ACT_SKIP); + /* rq1 =3D=3D rq2 for !CONFIG_SMP, so just clear RQCF_UPDATED once. */ +#ifdef CONFIG_SMP + rq2->clock_update_flags &=3D (RQCF_REQ_SKIP|RQCF_ACT_SKIP); +#endif +} +#else +static inline void double_rq_clock_clear_update(struct rq *rq1, struct rq = *rq2) {} +#endif =20 #ifdef CONFIG_SMP =20 @@ -2543,14 +2561,15 @@ static inline int _double_lock_balance(struct rq *t= his_rq, struct rq *busiest) __acquires(busiest->lock) __acquires(this_rq->lock) { - if (__rq_lockp(this_rq) =3D=3D __rq_lockp(busiest)) - return 0; - - if (likely(raw_spin_rq_trylock(busiest))) + if (__rq_lockp(this_rq) =3D=3D __rq_lockp(busiest) || + likely(raw_spin_rq_trylock(busiest))) { + double_rq_clock_clear_update(this_rq, busiest); return 0; + } =20 if (rq_order_less(this_rq, busiest)) { raw_spin_rq_lock_nested(busiest, SINGLE_DEPTH_NESTING); + double_rq_clock_clear_update(this_rq, busiest); return 0; } =20 @@ -2644,6 +2663,7 @@ static inline void double_rq_lock(struct rq *rq1, str= uct rq *rq2) BUG_ON(rq1 !=3D rq2); raw_spin_rq_lock(rq1); __acquire(rq2->lock); /* Fake it out ;) */ + double_rq_clock_clear_update(rq1, rq2); } =20 /* --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC224C43334 for ; Tue, 7 Jun 2022 22:13:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358798AbiFGWNw (ORCPT ); Tue, 7 Jun 2022 18:13:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379907AbiFGVLJ (ORCPT ); Tue, 7 Jun 2022 17:11:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4DAE216802; Tue, 7 Jun 2022 11:52: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 49EF4612F2; Tue, 7 Jun 2022 18:52:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FB26C385A2; Tue, 7 Jun 2022 18:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627947; bh=63KEk9VLTggDHYa7uCWhw1ThCahBRf68liu0x9+Y4Q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B2olAgxPCtAWpqnZ838c+7Z05LLh6+GM5Vcp/HD00hXs4tUu6bt76Zy6i/fjE7/xk 35cIra2dpcwLDqfGFbMCmyLhoFscfyldsI/lSgD+SACiU2Jw+9iE6sAFZGJil31Y75 qmOvWsuCf8/x0tQfu1BYZr9PspWV6HRC6Sg45hmA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrice Chotard , eberhard.stoll@kontron.de, Mark Brown , Sasha Levin Subject: [PATCH 5.18 149/879] spi: stm32-qspi: Fix wait_cmd timeout in APM mode Date: Tue, 7 Jun 2022 18:54:27 +0200 Message-Id: <20220607165007.030694004@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Patrice Chotard [ Upstream commit d83d89ea68b4726700fa87b22db075e4217e691c ] In APM mode, TCF and TEF flags are not set. To avoid timeout in stm32_qspi_wait_cmd(), don't check if TCF/TEF are set. Signed-off-by: Patrice Chotard Reported-by: eberhard.stoll@kontron.de Link: https://lore.kernel.org/r/20220511074644.558874-2-patrice.chotard@fos= s.st.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/spi/spi-stm32-qspi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c index ffdc55f87e82..dd38cb8ffbc2 100644 --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c @@ -308,7 +308,8 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi, if (!op->data.nbytes) goto wait_nobusy; =20 - if (readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF) + if ((readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF) || + qspi->fmode =3D=3D CCR_FMODE_APM) goto out; =20 reinit_completion(&qspi->data_completion); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FAAFC43334 for ; Tue, 7 Jun 2022 22:14:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384034AbiFGWOF (ORCPT ); Tue, 7 Jun 2022 18:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379943AbiFGVLU (ORCPT ); Tue, 7 Jun 2022 17:11:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64830216826; Tue, 7 Jun 2022 11:52: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 AA7D0B81FE1; Tue, 7 Jun 2022 18:52:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 110DCC385A5; Tue, 7 Jun 2022 18:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627950; bh=7Cf6JB2q1A9OGemJDYVSx1pjXiSzVu0Yuw1kwfazgNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j8WAYktuE59SSnFDLSuO//xmzhQ0Hj+SfnMSGaOYX6JP+wKdPWR7o80zz/sxZUnzz d1Wa1ttFcjYbF4tSALJj91nRViUgnsB7ysomFRFnEFyYNup8LF8QBlgpRmf3Hgwjfk nin2oHs93UVoUOmTPopKKHqTqlDZnGVaA6LKFhQU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.18 150/879] dma-debug: change allocation mode from GFP_NOWAIT to GFP_ATIOMIC Date: Tue, 7 Jun 2022 18:54:28 +0200 Message-Id: <20220607165007.059045396@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 84bc4f1dbbbb5f8aa68706a96711dccb28b518e5 ] We observed the error "cacheline tracking ENOMEM, dma-debug disabled" during a light system load (copying some files). The reason for this error is that the dma_active_cacheline radix tree uses GFP_NOWAIT allocation - so it can't access the emergency memory reserves and it fails as soon as anybody reaches the watermark. This patch changes GFP_NOWAIT to GFP_ATOMIC, so that it can access the emergency memory reserves. Signed-off-by: Mikulas Patocka Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- kernel/dma/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c index f8ff598596b8..ac740630c79c 100644 --- a/kernel/dma/debug.c +++ b/kernel/dma/debug.c @@ -448,7 +448,7 @@ void debug_dma_dump_mappings(struct device *dev) * other hand, consumes a single dma_debug_entry, but inserts 'nents' * entries into the tree. */ -static RADIX_TREE(dma_active_cacheline, GFP_NOWAIT); +static RADIX_TREE(dma_active_cacheline, GFP_ATOMIC); static DEFINE_SPINLOCK(radix_lock); #define ACTIVE_CACHELINE_MAX_OVERLAP ((1 << RADIX_TREE_MAX_TAGS) - 1) #define CACHELINE_PER_PAGE_SHIFT (PAGE_SHIFT - L1_CACHE_SHIFT) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6117CCA483 for ; Tue, 7 Jun 2022 22:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384730AbiFGWUm (ORCPT ); Tue, 7 Jun 2022 18:20:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380299AbiFGVQD (ORCPT ); Tue, 7 Jun 2022 17:16:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E6FB158750; Tue, 7 Jun 2022 11:54:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 201E8B81FE1; Tue, 7 Jun 2022 18:54:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85513C385A2; Tue, 7 Jun 2022 18:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628085; bh=rtHzjj2GFfazvNSR27w6EM4Oeo2YGiREyRIw+vC3rmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pk74MNeSdHj7EdsUhuj7se1jle8JmV8c4LETPOd1LoTGcSMUNc9S0TJAnjdT3ht9l JxeTmUfznG852oW6LkhtTI5qOj8YQ3lQ92p1OYmicuZaJHto9bDXRIngptKRjla4oy s2ve/UT2ABV6CZgHy1Eh1N+RPC37FE7B1K/1OLlY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Seth Forshee , Christoph Hellwig , Al Viro , linux-fsdevel@vger.kernel.org, "Christian Brauner (Microsoft)" , Sasha Levin Subject: [PATCH 5.18 151/879] fs: hold writers when changing mounts idmapping Date: Tue, 7 Jun 2022 18:54:29 +0200 Message-Id: <20220607165007.088140974@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Brauner [ Upstream commit e1bbcd277a53e08d619ffeec56c5c9287f2bf42f ] Hold writers when changing a mount's idmapping to make it more robust. The vfs layer takes care to retrieve the idmapping of a mount once ensuring that the idmapping used for vfs permission checking is identical to the idmapping passed down to the filesystem. For ioctl codepaths the filesystem itself is responsible for taking the idmapping into account if they need to. While all filesystems with FS_ALLOW_IDMAP raised take the same precautions as the vfs we should enforce it explicitly by making sure there are no active writers on the relevant mount while changing the idmapping. This is similar to turning a mount ro with the difference that in contrast to turning a mount ro changing the idmapping can only ever be done once while a mount can transition between ro and rw as much as it wants. This is a minor user-visible change. But it is extremely unlikely to matter. The caller must've created a detached mount via OPEN_TREE_CLONE and then handed that O_PATH fd to another process or thread which then must've gotten a writable fd for that mount and started creating files in there while the caller is still changing mount properties. While not impossible it will be an extremely rare corner-case and should in general be considered a bug in the application. Consider making a mount MOUNT_ATTR_NOEXEC or MOUNT_ATTR_NODEV while allowing someone else to perform lookups or exec'ing in parallel by handing them a copy of the OPEN_TREE_CLONE fd or another fd beneath that mount. Link: https://lore.kernel.org/r/20220510095840.152264-1-brauner@kernel.org Cc: Seth Forshee Cc: Christoph Hellwig Cc: Al Viro Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Christian Brauner (Microsoft) Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/namespace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index afe2b64b14f1..41461f55c039 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -4026,8 +4026,9 @@ static int can_idmap_mount(const struct mount_kattr *= kattr, struct mount *mnt) static inline bool mnt_allow_writers(const struct mount_kattr *kattr, const struct mount *mnt) { - return !(kattr->attr_set & MNT_READONLY) || - (mnt->mnt.mnt_flags & MNT_READONLY); + return (!(kattr->attr_set & MNT_READONLY) || + (mnt->mnt.mnt_flags & MNT_READONLY)) && + !kattr->mnt_userns; } =20 static int mount_setattr_prepare(struct mount_kattr *kattr, struct mount *= mnt) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39C12CCA485 for ; Tue, 7 Jun 2022 22:17:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379032AbiFGWRd (ORCPT ); Tue, 7 Jun 2022 18:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379996AbiFGVLW (ORCPT ); Tue, 7 Jun 2022 17:11:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27AAA21734F; Tue, 7 Jun 2022 11:52: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 BB66361579; Tue, 7 Jun 2022 18:52:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE37EC36B05; Tue, 7 Jun 2022 18:52:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627970; bh=+u2Yt/xw2sPo6EAVrtuFDGeht+dJf7/yaSqLvJi8jeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XYfhEJ+7rZCPIc8OLuATxCaAxGKdDioQ+Wd41VfAB3dRLNVn4xjgSlK6yz7vV6vI7 Ilj91alwKNP0bXYjTfUjwRAsCEsWrJFCcgF2Lt+54Y+5Mfl2UhKiTAyTSJBkoFNi8e A3DaUibPnIHYVWSEh+RbwoM29aKi8Tz9zhV9HhsQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Bin , Mark Brown , Sasha Levin Subject: [PATCH 5.18 152/879] ASoC: SOF: amd: add missing platform_device_unregister in acp_pci_rn_probe Date: Tue, 7 Jun 2022 18:54:30 +0200 Message-Id: <20220607165007.117946976@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheng Bin [ Upstream commit cbcab8cd737c74c20195c31d647e19f7cb49c9b8 ] acp_pci_rn_probe misses a call platform_device_unregister in error path, this patch fixes that. Signed-off-by: Zheng Bin Link: https://lore.kernel.org/r/20220512013728.4128903-1-zhengbin13@huawei.= com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/sof/amd/pci-rn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/sof/amd/pci-rn.c b/sound/soc/sof/amd/pci-rn.c index 392ffbdf6417..d809d151a38c 100644 --- a/sound/soc/sof/amd/pci-rn.c +++ b/sound/soc/sof/amd/pci-rn.c @@ -93,6 +93,7 @@ static int acp_pci_rn_probe(struct pci_dev *pci, const st= ruct pci_device_id *pci res =3D devm_kzalloc(&pci->dev, sizeof(struct resource) * ARRAY_SIZE(reno= ir_res), GFP_KERNEL); if (!res) { sof_pci_remove(pci); + platform_device_unregister(dmic_dev); return -ENOMEM; } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 971FECCA47F for ; Tue, 7 Jun 2022 22:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384550AbiFGWPW (ORCPT ); Tue, 7 Jun 2022 18:15:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380160AbiFGVLf (ORCPT ); Tue, 7 Jun 2022 17:11:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 948D9149A8C; Tue, 7 Jun 2022 11:53:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AEDDF616C2; Tue, 7 Jun 2022 18:53:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8A6AC36AFE; Tue, 7 Jun 2022 18:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628000; bh=++FBKUrUNdenNgdg9O0dxiFbOQonQ6ctCVrjU7cnTw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JSnTpldIPLH5+RXLMmk3lNyHpzIkK/rhyGJG77lD+9Uh7bVyAA8xubky911k50ECI 0Z0ADLN7gQD0xrhHS1VTD89/LrSHlxjcXGtWd86LswSvdcwRXzEY59GiH0it8W19HI rrrhPFRDOfP8TEVwIJhI9wzTko7P/0cJXm638Hgo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian-Hong Pan , Mario Limonciello , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 153/879] ACPI: PM: Block ASUS B1400CEAE from suspend to idle by default Date: Tue, 7 Jun 2022 18:54:31 +0200 Message-Id: <20220607165007.147422801@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mario Limonciello [ Upstream commit d52848620de00cde4a3a5df908e231b8c8868250 ] ASUS B1400CEAE fails to resume from suspend to idle by default. This was bisected back to commit df4f9bc4fb9c ("nvme-pci: add support for ACPI StorageD3Enable property") but this is a red herring to the problem. Before this commit the system wasn't getting into deepest sleep state. Presumably this commit is allowing entry into deepest sleep state as advertised by firmware, but there are some other problems related to the wakeup. As it is confirmed the system works properly with S3, set the default for this system to S3. Reported-by: Jian-Hong Pan Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D215742 Signed-off-by: Mario Limonciello Tested-by: Jian-Hong Pan Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/sleep.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index c992e57b2c79..3147702710af 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -373,6 +373,18 @@ static const struct dmi_system_id acpisleep_dmi_table[= ] __initconst =3D { DMI_MATCH(DMI_PRODUCT_NAME, "20GGA00L00"), }, }, + /* + * ASUS B1400CEAE hangs on resume from suspend (see + * https://bugzilla.kernel.org/show_bug.cgi?id=3D215742). + */ + { + .callback =3D init_default_s3, + .ident =3D "ASUS B1400CEAE", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "ASUS EXPERTBOOK B1400CEAE"), + }, + }, {}, }; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D92CCCA497 for ; Tue, 7 Jun 2022 22:17:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384961AbiFGWQ6 (ORCPT ); Tue, 7 Jun 2022 18:16:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380291AbiFGVLr (ORCPT ); Tue, 7 Jun 2022 17:11:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1885821913C; Tue, 7 Jun 2022 11:53:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8BE2E616C2; Tue, 7 Jun 2022 18:53:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97A6AC385A2; Tue, 7 Jun 2022 18:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628031; bh=j8BlhbMW32GkhbU+NCT33qF/jy4hbgqTlQH7X9esMYA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1xXLzIq3MFpWYDnerzzpLpJonZA6BVupZ1CQM1egOx+4PBK88mr3tkdcAc6fetmVU g5URghORgCrQj7iUBrG/TzBH274MHvAPYCXR/q10mked2iYupwt84WXCGyIQojfGWf 0Y6+bw9Wv3fDyAVk66ksA0iYot7drogZFXK3tuJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haowen Bai , Corey Minyard , Sasha Levin Subject: [PATCH 5.18 154/879] ipmi:ssif: Check for NULL msg when handling events and messages Date: Tue, 7 Jun 2022 18:54:32 +0200 Message-Id: <20220607165007.176324279@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Corey Minyard [ Upstream commit 7602b957e2404e5f98d9a40b68f1fd27f0028712 ] Even though it's not possible to get into the SSIF_GETTING_MESSAGES and SSIF_GETTING_EVENTS states without a valid message in the msg field, it's probably best to be defensive here and check and print a log, since that means something else went wrong. Also add a default clause to that switch statement to release the lock and print a log, in case the state variable gets messed up somehow. Reported-by: Haowen Bai Signed-off-by: Corey Minyard Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/char/ipmi/ipmi_ssif.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index f199cc194844..64c73ea9c915 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c @@ -814,6 +814,14 @@ static void msg_done_handler(struct ssif_info *ssif_in= fo, int result, break; =20 case SSIF_GETTING_EVENTS: + if (!msg) { + /* Should never happen, but just in case. */ + dev_warn(&ssif_info->client->dev, + "No message set while getting events\n"); + ipmi_ssif_unlock_cond(ssif_info, flags); + break; + } + if ((result < 0) || (len < 3) || (msg->rsp[2] !=3D 0)) { /* Error getting event, probably done. */ msg->done(msg); @@ -838,6 +846,14 @@ static void msg_done_handler(struct ssif_info *ssif_in= fo, int result, break; =20 case SSIF_GETTING_MESSAGES: + if (!msg) { + /* Should never happen, but just in case. */ + dev_warn(&ssif_info->client->dev, + "No message set while getting messages\n"); + ipmi_ssif_unlock_cond(ssif_info, flags); + break; + } + if ((result < 0) || (len < 3) || (msg->rsp[2] !=3D 0)) { /* Error getting event, probably done. */ msg->done(msg); @@ -861,6 +877,13 @@ static void msg_done_handler(struct ssif_info *ssif_in= fo, int result, deliver_recv_msg(ssif_info, msg); } break; + + default: + /* Should never happen, but just in case. */ + dev_warn(&ssif_info->client->dev, + "Invalid state in message done handling: %d\n", + ssif_info->ssif_state); + ipmi_ssif_unlock_cond(ssif_info, flags); } =20 flags =3D ipmi_ssif_lock_cond(ssif_info, &oflags); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F6FCC43334 for ; Tue, 7 Jun 2022 22:19:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380291AbiFGWTL (ORCPT ); Tue, 7 Jun 2022 18:19:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379972AbiFGVNp (ORCPT ); Tue, 7 Jun 2022 17:13:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 078C3152D86; Tue, 7 Jun 2022 11:54:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AE3BE61311; Tue, 7 Jun 2022 18:54:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCF29C36B00; Tue, 7 Jun 2022 18:54:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628061; bh=4YDsHdimR8u7sWuDUcn+7M1z80A9tCO2U93t+ProAg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Amo+ljtuA97bpECBlQC4BpYdl1tWWR7ZKsfWVaMSMVjs6t/kyRjiVuFbpiHN2Iq7M XnTpXzBWmaPXf9kgz6dxSsEvCoedoh2TnfkntxL+QFvDs/YIzjN7br6+LV0AeRu2Ha caXL9hs400ti5y+Sin4L32DcfoA7JUFBbLQkLAyk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Wiese , Corey Minyard , Sasha Levin Subject: [PATCH 5.18 155/879] ipmi: Add an intializer for ipmi_smi_msg struct Date: Tue, 7 Jun 2022 18:54:33 +0200 Message-Id: <20220607165007.205311367@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Corey Minyard [ Upstream commit 9824117dd964ecebf5d81990dbf21dfb56445049 ] There was a "type" element added to this structure, but some static values were missed. The default value will be zero, which is correct, but create an initializer for the type and initialize the type properly in the initializer to avoid future issues. Reported-by: Joe Wiese Signed-off-by: Corey Minyard Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/char/ipmi/ipmi_poweroff.c | 4 +--- drivers/char/ipmi/ipmi_watchdog.c | 14 +++++--------- include/linux/ipmi_smi.h | 6 ++++++ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_pow= eroff.c index bc3a18daf97a..62e71c46ac5f 100644 --- a/drivers/char/ipmi/ipmi_poweroff.c +++ b/drivers/char/ipmi/ipmi_poweroff.c @@ -94,9 +94,7 @@ static void dummy_recv_free(struct ipmi_recv_msg *msg) { atomic_dec(&dummy_count); } -static struct ipmi_smi_msg halt_smi_msg =3D { - .done =3D dummy_smi_free -}; +static struct ipmi_smi_msg halt_smi_msg =3D INIT_IPMI_SMI_MSG(dummy_smi_fr= ee); static struct ipmi_recv_msg halt_recv_msg =3D { .done =3D dummy_recv_free }; diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_wat= chdog.c index 0604abdd249a..4c1e9663ea47 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -354,9 +354,7 @@ static void msg_free_recv(struct ipmi_recv_msg *msg) complete(&msg_wait); } } -static struct ipmi_smi_msg smi_msg =3D { - .done =3D msg_free_smi -}; +static struct ipmi_smi_msg smi_msg =3D INIT_IPMI_SMI_MSG(msg_free_smi); static struct ipmi_recv_msg recv_msg =3D { .done =3D msg_free_recv }; @@ -475,9 +473,8 @@ static void panic_recv_free(struct ipmi_recv_msg *msg) atomic_dec(&panic_done_count); } =20 -static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg =3D { - .done =3D panic_smi_free -}; +static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg =3D + INIT_IPMI_SMI_MSG(panic_smi_free); static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg =3D { .done =3D panic_recv_free }; @@ -516,9 +513,8 @@ static void panic_halt_ipmi_heartbeat(void) atomic_sub(2, &panic_done_count); } =20 -static struct ipmi_smi_msg panic_halt_smi_msg =3D { - .done =3D panic_smi_free -}; +static struct ipmi_smi_msg panic_halt_smi_msg =3D + INIT_IPMI_SMI_MSG(panic_smi_free); static struct ipmi_recv_msg panic_halt_recv_msg =3D { .done =3D panic_recv_free }; diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index 9277d21c2690..5d69820d8b02 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h @@ -125,6 +125,12 @@ struct ipmi_smi_msg { void (*done)(struct ipmi_smi_msg *msg); }; =20 +#define INIT_IPMI_SMI_MSG(done_handler) \ +{ \ + .done =3D done_handler, \ + .type =3D IPMI_SMI_MSG_TYPE_NORMAL \ +} + struct ipmi_smi_handlers { struct module *owner; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 668AFC433EF for ; Tue, 7 Jun 2022 22:21:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380753AbiFGWT6 (ORCPT ); Tue, 7 Jun 2022 18:19:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380029AbiFGVOL (ORCPT ); Tue, 7 Jun 2022 17:14:11 -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 4723721AC75; Tue, 7 Jun 2022 11:54: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 4D37FB81F6D; Tue, 7 Jun 2022 18:54:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4F6BC385A2; Tue, 7 Jun 2022 18:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628072; bh=O/cCnmDC0+HiYEH7R5Qp6f1XM/22h+N2T5KYNs2lq7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=saKqugDRFON8ja/2MsRPP5aeo4zn26DyfHBXR7oQv7GaNY4rds6VvMXw72M5jApVe JmR/PpwWf6APZtoVpUvuBf+GkwopIdzdNUUZF4IEngHzI9GHSiDdcvUlTxujTO/I/5 kWSF2hPih8OckGU9DrtrXQcGuX1MPH5wTLrQTMVs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Corey Minyard , Sasha Levin Subject: [PATCH 5.18 156/879] ipmi: Fix pr_fmt to avoid compilation issues Date: Tue, 7 Jun 2022 18:54:34 +0200 Message-Id: <20220607165007.233902758@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Corey Minyard [ Upstream commit 2ebaf18a0b7fb764bba6c806af99fe868cee93de ] The was it was wouldn't work in some situations, simplify it. What was there was unnecessary complexity. Reported-by: kernel test robot Signed-off-by: Corey Minyard Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/char/ipmi/ipmi_msghandler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_m= sghandler.c index f1827257ef0e..2610e809c802 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -11,8 +11,8 @@ * Copyright 2002 MontaVista Software Inc. */ =20 -#define pr_fmt(fmt) "%s" fmt, "IPMI message handler: " -#define dev_fmt pr_fmt +#define pr_fmt(fmt) "IPMI message handler: " fmt +#define dev_fmt(fmt) pr_fmt(fmt) =20 #include #include --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FD3CC433EF for ; Tue, 7 Jun 2022 22:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384468AbiFGWUZ (ORCPT ); Tue, 7 Jun 2022 18:20:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379834AbiFGVO4 (ORCPT ); Tue, 7 Jun 2022 17:14:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F51A21B10C; Tue, 7 Jun 2022 11:54:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 31765B8220B; Tue, 7 Jun 2022 18:54:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78737C385A2; Tue, 7 Jun 2022 18:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628074; bh=DrlCtqRdmd/H4FDcqecWOdiAET1SvEdTVJUq2ANWkK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6+K77tc6PzDUA9bOsedRkRN6U9uRWilEREiI2OazgWt0oEM60kij6jRkTEL3s569 3QdtPowG2p7kFmyOA6X48OgC/PVIa+UJjTUg1jdaxDMdieqcSGX+w2pALDFRIX0OPO x4U6aXRGtgI9pw8EcbZHuStUNXT9+/yXUl7wEKjU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Latypov , Zeal Robot , Lv Ruyi , Brendan Higgins , Shuah Khan , Sasha Levin Subject: [PATCH 5.18 157/879] kunit: bail out of test filtering logic quicker if OOM Date: Tue, 7 Jun 2022 18:54:35 +0200 Message-Id: <20220607165007.263771259@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Latypov [ Upstream commit a02353f491622e49c7ddedc6a6dc4f1d6ed2150a ] When filtering what tests to run (suites and/or cases) via kunit.filter_glob (e.g. kunit.py run ), we allocate copies of suites. These allocations can fail, and we largely don't handle that. Note: realistically, this probably doesn't matter much. We're not allocating much memory and this happens early in boot, so if we can't do that, then there's likely far bigger problems. This patch makes us immediately bail out from the top-level function (kunit_filter_suites) with -ENOMEM if any of the underlying kmalloc() calls return NULL. Implementation note: we used to return NULL pointers from some functions to indicate either that all suites/tests were filtered out or there was an error allocating the new array. We'll log a short error in this case and not run any tests or print a TAP header. From a kunit.py user's perspective, they'll get a message about missing/invalid TAP output and have to dig into the test.log to see it. Since hitting this error seems so unlikely, it's probably fine to not invent a way to plumb this error message more visibly. See also: https://lore.kernel.org/linux-kselftest/20220329103919.2376818-1-= lv.ruyi@zte.com.cn/ Signed-off-by: Daniel Latypov Reported-by: Zeal Robot Reported-by: Lv Ruyi Reviewed-by: Brendan Higgins Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- lib/kunit/executor.c | 27 ++++++++++++++++++++++----- lib/kunit/executor_test.c | 4 +++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c index 22640c9ee819..2f73a6a35a7e 100644 --- a/lib/kunit/executor.c +++ b/lib/kunit/executor.c @@ -71,9 +71,13 @@ kunit_filter_tests(struct kunit_suite *const suite, cons= t char *test_glob) =20 /* Use memcpy to workaround copy->name being const. */ copy =3D kmalloc(sizeof(*copy), GFP_KERNEL); + if (!copy) + return ERR_PTR(-ENOMEM); memcpy(copy, suite, sizeof(*copy)); =20 filtered =3D kcalloc(n + 1, sizeof(*filtered), GFP_KERNEL); + if (!filtered) + return ERR_PTR(-ENOMEM); =20 n =3D 0; kunit_suite_for_each_test_case(suite, test_case) { @@ -106,14 +110,16 @@ kunit_filter_subsuite(struct kunit_suite * const * co= nst subsuite, =20 filtered =3D kmalloc_array(n + 1, sizeof(*filtered), GFP_KERNEL); if (!filtered) - return NULL; + return ERR_PTR(-ENOMEM); =20 n =3D 0; for (i =3D 0; subsuite[i] !=3D NULL; ++i) { if (!glob_match(filter->suite_glob, subsuite[i]->name)) continue; filtered_suite =3D kunit_filter_tests(subsuite[i], filter->test_glob); - if (filtered_suite) + if (IS_ERR(filtered_suite)) + return ERR_CAST(filtered_suite); + else if (filtered_suite) filtered[n++] =3D filtered_suite; } filtered[n] =3D NULL; @@ -146,7 +152,8 @@ static void kunit_free_suite_set(struct suite_set suite= _set) } =20 static struct suite_set kunit_filter_suites(const struct suite_set *suite_= set, - const char *filter_glob) + const char *filter_glob, + int *err) { int i; struct kunit_suite * const **copy, * const *filtered_subsuite; @@ -166,6 +173,10 @@ static struct suite_set kunit_filter_suites(const stru= ct suite_set *suite_set, =20 for (i =3D 0; i < max; ++i) { filtered_subsuite =3D kunit_filter_subsuite(suite_set->start[i], &filter= ); + if (IS_ERR(filtered_subsuite)) { + *err =3D PTR_ERR(filtered_subsuite); + return filtered; + } if (filtered_subsuite) *copy++ =3D filtered_subsuite; } @@ -236,9 +247,15 @@ int kunit_run_all_tests(void) .start =3D __kunit_suites_start, .end =3D __kunit_suites_end, }; + int err; =20 - if (filter_glob_param) - suite_set =3D kunit_filter_suites(&suite_set, filter_glob_param); + if (filter_glob_param) { + suite_set =3D kunit_filter_suites(&suite_set, filter_glob_param, &err); + if (err) { + pr_err("kunit executor: error filtering suites: %d\n", err); + return err; + } + } =20 if (!action_param) kunit_exec_run_tests(&suite_set); diff --git a/lib/kunit/executor_test.c b/lib/kunit/executor_test.c index 4ed57fd94e42..eac6ff480273 100644 --- a/lib/kunit/executor_test.c +++ b/lib/kunit/executor_test.c @@ -137,14 +137,16 @@ static void filter_suites_test(struct kunit *test) .end =3D suites + 2, }; struct suite_set filtered =3D {.start =3D NULL, .end =3D NULL}; + int err =3D 0; =20 /* Emulate two files, each having one suite */ subsuites[0][0] =3D alloc_fake_suite(test, "suite0", dummy_test_cases); subsuites[1][0] =3D alloc_fake_suite(test, "suite1", dummy_test_cases); =20 /* Filter out suite1 */ - filtered =3D kunit_filter_suites(&suite_set, "suite0"); + filtered =3D kunit_filter_suites(&suite_set, "suite0", &err); kfree_subsuites_at_end(test, &filtered); /* let us use ASSERTs without le= aking */ + KUNIT_EXPECT_EQ(test, err, 0); KUNIT_ASSERT_EQ(test, filtered.end - filtered.start, (ptrdiff_t)1); =20 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, filtered.start); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7598CCA47C for ; Tue, 7 Jun 2022 22:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382608AbiFGWUE (ORCPT ); Tue, 7 Jun 2022 18:20:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378952AbiFGVOg (ORCPT ); Tue, 7 Jun 2022 17:14:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B4E821B111; Tue, 7 Jun 2022 11:54:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 38386612F2; Tue, 7 Jun 2022 18:54:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 481A5C385A2; Tue, 7 Jun 2022 18:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628077; bh=KcMfdVrPS5sBaTos33sAmjiggMA4Goon5JHj92fmjP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rgxIGMh9TBj+ecXphlvdYrQqpP35OkTYC4SvnvikoaiCwYd3ow5gPlf7vZ4HYM9BS QT/wBp0FDmMPW2W2peIgNowl/LIl7+92uLDXRnV28FWbC/Cx16PcxMDqkqmaNjdAgK PGCgKsUC2WW5dzkKaXR7w+ZLnKj4smXr3CmSwApM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzkaller , Dongliang Mu , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 158/879] rtlwifi: Use pr_warn instead of WARN_ONCE Date: Tue, 7 Jun 2022 18:54:36 +0200 Message-Id: <20220607165007.292230291@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dongliang Mu [ Upstream commit ad732da434a2936128769216eddaece3b1af4588 ] This memory allocation failure can be triggered by fault injection or high pressure testing, resulting a WARN. Fix this by replacing WARN with pr_warn. Reported-by: syzkaller Signed-off-by: Dongliang Mu Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220511014453.1621366-1-dzm91@hust.edu.cn Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/realtek/rtlwifi/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wirel= ess/realtek/rtlwifi/usb.c index 86a236873254..a8eebafb9a7e 100644 --- a/drivers/net/wireless/realtek/rtlwifi/usb.c +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c @@ -1014,7 +1014,7 @@ int rtl_usb_probe(struct usb_interface *intf, hw =3D ieee80211_alloc_hw(sizeof(struct rtl_priv) + sizeof(struct rtl_usb_priv), &rtl_ops); if (!hw) { - WARN_ONCE(true, "rtl_usb: ieee80211 alloc failed\n"); + pr_warn("rtl_usb: ieee80211 alloc failed\n"); return -ENOMEM; } rtlpriv =3D hw->priv; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6AE1C43334 for ; Tue, 7 Jun 2022 22:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383990AbiFGWUJ (ORCPT ); Tue, 7 Jun 2022 18:20:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380113AbiFGVPZ (ORCPT ); Tue, 7 Jun 2022 17:15:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96E331567C8; Tue, 7 Jun 2022 11:54:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B1577B82182; Tue, 7 Jun 2022 18:54:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DB88C385A2; Tue, 7 Jun 2022 18:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628080; bh=VePB9HYfx5w6HP34ukuWlxDdJC0cAZBd+ZDzUXQyhfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=brgWiK/zyewv/NMhw1Onqr8nYCAJDzylnvhEUSn5L7XPOxzpMJE1HFgJprmBhsUgO tzFdMZdvUXtCNdMSwMTt2JBboAlfKQqNn734wnMXl/+4joJPSQO2+ZyHOJTxubmQtT CTubgiPQpe8G18jd8ZzUVjGTEWZ/qhMhdtuJaqds= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 159/879] mt76: mt7915: accept rx frames with non-standard VHT MCS10-11 Date: Tue, 7 Jun 2022 18:54:37 +0200 Message-Id: <20220607165007.320901101@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Felix Fietkau [ Upstream commit 77045a3740fa3d2325293cf8623899532b39303e ] The hardware receives them properly, they should not be dropped Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/= wireless/mediatek/mt76/mt7915/mac.c index e9e7efbf350d..a8df65cc115f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -521,7 +521,7 @@ mt7915_mac_fill_rx_rate(struct mt7915_dev *dev, status->encoding =3D RX_ENC_VHT; if (gi) status->enc_flags |=3D RX_ENC_FLAG_SHORT_GI; - if (i > 9) + if (i > 11) return -EINVAL; break; case MT_PHY_TYPE_HE_MU: --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5B09CCA486 for ; Tue, 7 Jun 2022 22:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384973AbiFGWUs (ORCPT ); Tue, 7 Jun 2022 18:20:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380400AbiFGVQR (ORCPT ); Tue, 7 Jun 2022 17:16:17 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78E0F1567F3; Tue, 7 Jun 2022 11:54: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 sin.source.kernel.org (Postfix) with ESMTPS id DAD29CE244E; Tue, 7 Jun 2022 18:54:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1F46C34115; Tue, 7 Jun 2022 18:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628083; bh=T278upJVbk/em8SEvypNZ1SQJbk0LgQu1PtRWWC3Fk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aq56V5LN1JLAmFlKVX7YvR33ibJrgLoLz6V4iSmiDQQ9V5uHv79lueQJ4vU5rC0k4 F3AWDlT7GMSJ8xIWrX7/895M0J118aU3Q+Hg28sbbPU4mhf8n309Lf4eSY6K653DrE lPMky9fRScAqE4obbCaWFxP5KYR4MuyaLesXoYhs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 160/879] mt76: mt7921: accept rx frames with non-standard VHT MCS10-11 Date: Tue, 7 Jun 2022 18:54:38 +0200 Message-Id: <20220607165007.350514925@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Felix Fietkau [ Upstream commit 3128ea016965ce9f91ddf4e1dd944724462d1698 ] The hardware receives them properly, they should not be dropped Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/= wireless/mediatek/mt76/mt7921/mac.c index 233998ca4857..f34070ca7bbe 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -696,7 +696,7 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_bu= ff *skb) status->nss =3D FIELD_GET(MT_PRXV_NSTS, v0) + 1; status->encoding =3D RX_ENC_VHT; - if (i > 9) + if (i > 11) return -EINVAL; break; case MT_PHY_TYPE_HE_MU: --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96B1EC433EF for ; Tue, 7 Jun 2022 22:14:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379058AbiFGWO1 (ORCPT ); Tue, 7 Jun 2022 18:14:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380017AbiFGVLX (ORCPT ); Tue, 7 Jun 2022 17:11:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C39D9131F19; Tue, 7 Jun 2022 11:52: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 291D3B82182; Tue, 7 Jun 2022 18:52:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82772C385A5; Tue, 7 Jun 2022 18:52:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627972; bh=edmrEx74CLJEL2ZSmVTR+lC6JWHI26Po+D1lAUpwoPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j4Q55Z7L8Tw3J/7qB58IA4eiMBgcgrUKZOowfNQr0hyWpydyceiA/q5cB6ZG+91tA YJhET7idukzVIQRbJRX+vMJWAkqXY1C4KRiXL2Ul85jeJT/ywQvutO9tYwQPBQA3s0 M2jEgyU/sWdyg6Egxvj9CMekeNhNJz/FRRcCMwPw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Thibaut=20VAR=C3=88NE?= , Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 161/879] mt76: fix encap offload ethernet type check Date: Tue, 7 Jun 2022 18:54:39 +0200 Message-Id: <20220607165007.379568253@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Felix Fietkau [ Upstream commit bc98e7fdd80d215b4b55eea001023231eb8ce12e ] The driver needs to check if the format is 802.2 vs 802.3 in order to set a tx descriptor flag. skb->protocol can't be used, since it may not be prop= erly initialized for packets coming in from a packet socket. Fix misdetection by checking the ethertype from the skb data instead Reported-by: Thibaut VAR=C3=88NE Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 4 +++- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/= wireless/mediatek/mt76/mt7915/mac.c index a8df65cc115f..eaa31f5e0b00 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -1017,6 +1017,7 @@ mt7915_mac_write_txwi_8023(struct mt7915_dev *dev, __= le32 *txwi, =20 u8 tid =3D skb->priority & IEEE80211_QOS_CTL_TID_MASK; u8 fc_type, fc_stype; + u16 ethertype; bool wmm =3D false; u32 val; =20 @@ -1030,7 +1031,8 @@ mt7915_mac_write_txwi_8023(struct mt7915_dev *dev, __= le32 *txwi, val =3D FIELD_PREP(MT_TXD1_HDR_FORMAT, MT_HDR_FORMAT_802_3) | FIELD_PREP(MT_TXD1_TID, tid); =20 - if (be16_to_cpu(skb->protocol) >=3D ETH_P_802_3_MIN) + ethertype =3D get_unaligned_be16(&skb->data[12]); + if (ethertype >=3D ETH_P_802_3_MIN) val |=3D MT_TXD1_ETH_802_3; =20 txwi[1] |=3D cpu_to_le32(val); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/= wireless/mediatek/mt76/mt7921/mac.c index f34070ca7bbe..c5350e7a11e6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -814,6 +814,7 @@ mt7921_mac_write_txwi_8023(struct mt7921_dev *dev, __le= 32 *txwi, { u8 tid =3D skb->priority & IEEE80211_QOS_CTL_TID_MASK; u8 fc_type, fc_stype; + u16 ethertype; bool wmm =3D false; u32 val; =20 @@ -827,7 +828,8 @@ mt7921_mac_write_txwi_8023(struct mt7921_dev *dev, __le= 32 *txwi, val =3D FIELD_PREP(MT_TXD1_HDR_FORMAT, MT_HDR_FORMAT_802_3) | FIELD_PREP(MT_TXD1_TID, tid); =20 - if (be16_to_cpu(skb->protocol) >=3D ETH_P_802_3_MIN) + ethertype =3D get_unaligned_be16(&skb->data[12]); + if (ethertype >=3D ETH_P_802_3_MIN) val |=3D MT_TXD1_ETH_802_3; =20 txwi[1] |=3D cpu_to_le32(val); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79DC8CCA49A for ; Tue, 7 Jun 2022 22:17:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384713AbiFGWQE (ORCPT ); Tue, 7 Jun 2022 18:16:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380031AbiFGVLZ (ORCPT ); Tue, 7 Jun 2022 17:11:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50C83217370; Tue, 7 Jun 2022 11:52: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 BF0F1B8220B; Tue, 7 Jun 2022 18:52:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34732C385A2; Tue, 7 Jun 2022 18:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627975; bh=phB7LXbMznbVSVQXBgVCBso+VRteL7PNg//ZRtMP2a8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0+VRGIwAWaCsXriMSoBEobaMujqBplXDIFZfoyiTEe/uPV/pPQN41fUVzZzgvU6Qw pf2KwfVCzMMn3o9Uj1sL8SeY1fquqX/rrQ8KSNYNRQlTZRrPJooqVauAYD6fTPW9Ji w6/AQhdtK3GPWyfP15xaOIfg6hOp1zCBDda+TZgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 162/879] media: rga: fix possible memory leak in rga_probe Date: Tue, 7 Jun 2022 18:54:40 +0200 Message-Id: <20220607165007.409101477@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua [ Upstream commit a71eb6025305192e646040cd76ccacb5bd48a1b5 ] rga->m2m_dev needs to be freed when rga_probe fails. Signed-off-by: Hangyu Hua Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/rockchip/rga/rga.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/plat= form/rockchip/rga/rga.c index 3d3d1062e212..2f8df74ad0fd 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -865,7 +865,7 @@ static int rga_probe(struct platform_device *pdev) =20 ret =3D pm_runtime_resume_and_get(rga->dev); if (ret < 0) - goto rel_vdev; + goto rel_m2m; =20 rga->version.major =3D (rga_read(rga, RGA_VERSION_INFO) >> 24) & 0xFF; rga->version.minor =3D (rga_read(rga, RGA_VERSION_INFO) >> 20) & 0x0F; @@ -881,7 +881,7 @@ static int rga_probe(struct platform_device *pdev) DMA_ATTR_WRITE_COMBINE); if (!rga->cmdbuf_virt) { ret =3D -ENOMEM; - goto rel_vdev; + goto rel_m2m; } =20 rga->src_mmu_pages =3D @@ -918,6 +918,8 @@ static int rga_probe(struct platform_device *pdev) free_dma: dma_free_attrs(rga->dev, RGA_CMDBUF_SIZE, rga->cmdbuf_virt, rga->cmdbuf_phy, DMA_ATTR_WRITE_COMBINE); +rel_m2m: + v4l2_m2m_release(rga->m2m_dev); rel_vdev: video_device_release(vfd); unreg_v4l2_dev: --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51B3CC433EF for ; Tue, 7 Jun 2022 22:14:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350967AbiFGWOi (ORCPT ); Tue, 7 Jun 2022 18:14:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380035AbiFGVLZ (ORCPT ); Tue, 7 Jun 2022 17:11:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 963F61498DD; Tue, 7 Jun 2022 11:52:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CECC7616A9; Tue, 7 Jun 2022 18:52:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1ABAC385A2; Tue, 7 Jun 2022 18:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627978; bh=XCIo5oBjPhUPMtJO6VtGpo5T64/wBIlRjbYu4ZudoSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aLIb1vKwsMeO9EE7eR5BeWy5qq2UGFDDAaRVHGGXmm/KUznJYJh0JwA449aIUxGaN 53tVK5T1RaKb3qPnAsD1bJcrZ0XqJDUJFgmyIX1fxETQCzZlo3zGprXwljOVwLNAls gfuhFflHl1wgOpIaSrIpvxmGGetop+mY1bMd+4po= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 163/879] media: coda: limit frame interval enumeration to supported encoder frame sizes Date: Tue, 7 Jun 2022 18:54:41 +0200 Message-Id: <20220607165007.437688168@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Philipp Zabel [ Upstream commit 67e33dd957880879e785cfea83a3aa24bd5c5577 ] Let VIDIOC_ENUM_FRAMEINTERVALS return -EINVAL if userspace queries frame intervals for frame sizes unsupported by the encoder. Fixes the following v4l2-compliance failure: fail: v4l2-test-formats.cpp(123): found frame intervals for invalid size = 47x16 fail: v4l2-test-formats.cpp(282): node->codec_mask & STATEFUL_ENCODER test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL [hverkuil: drop incorrect 'For decoder devices, return -ENOTTY.' in the com= mit log] Signed-off-by: Philipp Zabel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../media/platform/chips-media/coda-common.c | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/chips-media/coda-common.c b/drivers/med= ia/platform/chips-media/coda-common.c index a57822b05070..a2cad1830318 100644 --- a/drivers/media/platform/chips-media/coda-common.c +++ b/drivers/media/platform/chips-media/coda-common.c @@ -1324,7 +1324,8 @@ static int coda_enum_frameintervals(struct file *file= , void *fh, struct v4l2_frmivalenum *f) { struct coda_ctx *ctx =3D fh_to_ctx(fh); - int i; + struct coda_q_data *q_data; + const struct coda_codec *codec; =20 if (f->index) return -EINVAL; @@ -1333,12 +1334,19 @@ static int coda_enum_frameintervals(struct file *fi= le, void *fh, if (!ctx->vdoa && f->pixel_format =3D=3D V4L2_PIX_FMT_YUYV) return -EINVAL; =20 - for (i =3D 0; i < CODA_MAX_FORMATS; i++) { - if (f->pixel_format =3D=3D ctx->cvd->src_formats[i] || - f->pixel_format =3D=3D ctx->cvd->dst_formats[i]) - break; + if (coda_format_normalize_yuv(f->pixel_format) =3D=3D V4L2_PIX_FMT_YUV420= ) { + q_data =3D get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); + codec =3D coda_find_codec(ctx->dev, f->pixel_format, + q_data->fourcc); + } else { + codec =3D coda_find_codec(ctx->dev, V4L2_PIX_FMT_YUV420, + f->pixel_format); } - if (i =3D=3D CODA_MAX_FORMATS) + if (!codec) + return -EINVAL; + + if (f->width < MIN_W || f->width > codec->max_w || + f->height < MIN_H || f->height > codec->max_h) return -EINVAL; =20 f->type =3D V4L2_FRMIVAL_TYPE_CONTINUOUS; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBE42C433EF for ; Tue, 7 Jun 2022 22:14:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384065AbiFGWOl (ORCPT ); Tue, 7 Jun 2022 18:14:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380067AbiFGVL1 (ORCPT ); Tue, 7 Jun 2022 17:11:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EBCE217616; Tue, 7 Jun 2022 11:53:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 451D2B81F6D; Tue, 7 Jun 2022 18:53:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD92CC385A2; Tue, 7 Jun 2022 18:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627981; bh=1IhMAlmpFLnSmrF7JaiDJvASdMM846kQitQkMmoRy58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F3FlgPSGG6bobwbWIxy0HVcYfBehF2X5sN3XcgILnml8+Ciqcw6Qj2AhWYZFJtlDy xObOPMzfi1YDxlMPOzjQIJxV5RQthFFx/C5YJpy9wwV8DHauwLFqho6ML+w2WEnqQS qS5r5k+kvldUGWZs6i2cMpUYgy/pdamj0z9ZWyeE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Gaignard , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 164/879] media: hantro: HEVC: unconditionnaly set pps_{cb/cr}_qp_offset values Date: Tue, 7 Jun 2022 18:54:42 +0200 Message-Id: <20220607165007.466874994@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Gaignard [ Upstream commit 46c836569196f377f87a3657b330cffaf94bd727 ] Always set pps_cb_qp_offset and pps_cr_qp_offset values in Hantro/G2 register whatever is V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT flag value. The vendor code does the same to set these values. This fixes conformance test CAINIT_G_SHARP_3. Fluster HEVC score is increase by one with this patch. Signed-off-by: Benjamin Gaignard Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/hantro/hantro_g2_hevc_dec.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c b/drivers/st= aging/media/hantro/hantro_g2_hevc_dec.c index c524af41baf5..2e7eec0372cd 100644 --- a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c +++ b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c @@ -180,13 +180,8 @@ static void set_params(struct hantro_ctx *ctx) hantro_reg_write(vpu, &g2_max_cu_qpd_depth, 0); } =20 - if (pps->flags & V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT) { - hantro_reg_write(vpu, &g2_cb_qp_offset, pps->pps_cb_qp_offset); - hantro_reg_write(vpu, &g2_cr_qp_offset, pps->pps_cr_qp_offset); - } else { - hantro_reg_write(vpu, &g2_cb_qp_offset, 0); - hantro_reg_write(vpu, &g2_cr_qp_offset, 0); - } + hantro_reg_write(vpu, &g2_cb_qp_offset, pps->pps_cb_qp_offset); + hantro_reg_write(vpu, &g2_cr_qp_offset, pps->pps_cr_qp_offset); =20 hantro_reg_write(vpu, &g2_filt_offset_beta, pps->pps_beta_offset_div2); hantro_reg_write(vpu, &g2_filt_offset_tc, pps->pps_tc_offset_div2); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F02DC43334 for ; Tue, 7 Jun 2022 22:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384487AbiFGWOp (ORCPT ); Tue, 7 Jun 2022 18:14:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380083AbiFGVL2 (ORCPT ); Tue, 7 Jun 2022 17:11:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 408F621761E; Tue, 7 Jun 2022 11:53:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4FFBE6156D; Tue, 7 Jun 2022 18:53:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 622B5C385A2; Tue, 7 Jun 2022 18:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627983; bh=iKlBYoUEHHSKLj/FQ6yF2o4GA7+S+LJ6Nw0AmRb3NAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ERuyAXOkq3tLSqDl7WOzpH515lSIcCOJ4aA3U7ijzCGT9WkndADUpkPkdB8r3bLBz 7L2zOlflLPU/Xt7A3BbY+RdRThD5oUaE+6Jn6i75HQTwBW9yNCMrfjEUPirSirBVFA F2nDo+/j/VienaKkixB8+KRSaPvrTFPEU5uRRPf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 165/879] media: ccs-core.c: fix failure to call clk_disable_unprepare Date: Tue, 7 Jun 2022 18:54:43 +0200 Message-Id: <20220607165007.498129095@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans Verkuil [ Upstream commit eca89cf60b040ee2cae693ea72a0364284f3084c ] Fixes smatch warning: drivers/media/i2c/ccs/ccs-core.c:1676 ccs_power_on() warn: 'sensor->ext_clk= ' from clk_prepare_enable() not released on lines: 1606. Signed-off-by: Hans Verkuil Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/i2c/ccs/ccs-core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-c= ore.c index 03e841b8443f..7ae469caf990 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -1602,8 +1602,11 @@ static int ccs_power_on(struct device *dev) usleep_range(1000, 2000); } while (--retry); =20 - if (!reset) - return -EIO; + if (!reset) { + dev_err(dev, "software reset failed\n"); + rval =3D -EIO; + goto out_cci_addr_fail; + } } =20 if (sensor->hwcfg.i2c_addr_alt) { --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 584DECCA489 for ; Tue, 7 Jun 2022 22:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384753AbiFGWQK (ORCPT ); Tue, 7 Jun 2022 18:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380090AbiFGVL2 (ORCPT ); Tue, 7 Jun 2022 17:11:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C67E217631; Tue, 7 Jun 2022 11:53:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EE5DD6176D; Tue, 7 Jun 2022 18:53:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 081AFC385A2; Tue, 7 Jun 2022 18:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627986; bh=o882i/Fwuefe4ZEUm5K6yWjxmkM/x190IqhzUQdH+N8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D8dY9skkWnepJp2w4jOc1rLimec8hIVk6UiICksB5s42yBB+a9vw5DhCqrkoFi7Ui liRwn2QUJuirWcv2QjDeyCVFuCpO73Ms9fRL6Nu15Vzl0GhUWF4WMHI6HbTfFuMlrv 6TgoMyaZTVF12QHkzZHd9TWk1P7a3Tzbuy5NfM7A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Alan Stern , Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 166/879] media: imon: reorganize serialization Date: Tue, 7 Jun 2022 18:54:44 +0200 Message-Id: <20220607165007.526722317@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa [ Upstream commit db264d4c66c0fe007b5d19fd007707cd0697603d ] Since usb_register_dev() from imon_init_display() from imon_probe() holds minor_rwsem while display_open() which holds driver_lock and ictx->lock is called with minor_rwsem held from usb_open(), holding driver_lock or ictx->lock when calling usb_register_dev() causes circular locking dependency problem. Since usb_deregister_dev() from imon_disconnect() holds minor_rwsem while display_open() which holds driver_lock is called with minor_rwsem held, holding driver_lock when calling usb_deregister_dev() also causes circular locking dependency problem. Sean Young explained that the problem is there are imon devices which have two usb interfaces, even though it is one device. The probe and disconnect function of both usb interfaces can run concurrently. Alan Stern responded that the driver and USB cores guarantee that when an interface is probed, both the interface and its USB device are locked. Ditto for when the disconnect callback gets run. So concurrent probing/ disconnection of multiple interfaces on the same device is not possible. Therefore, we don't need locks for handling race between imon_probe() and imon_disconnect(). But we still need to handle race between display_open() /vfd_write()/lcd_write()/display_close() and imon_disconnect(), for disconnect event can happen while file descriptors are in use. Since "struct file"->private_data is set by display_open(), vfd_write()/ lcd_write()/display_close() can assume that "struct file"->private_data is not NULL even after usb_set_intfdata(interface, NULL) was called. Replace insufficiently held driver_lock with refcount_t based management. Add a boolean flag for recording whether imon_disconnect() was already called. Use RCU for accessing this boolean flag and refcount_t. Since the boolean flag for imon_disconnect() is shared, disconnect event on either intf0 or intf1 affects both interfaces. But I assume that this change does not matter, for usually disconnect event would not happen while interfaces are in use. Link: https://syzkaller.appspot.com/bug?extid=3Dc558267ad910fc494497 Reported-by: syzbot Signed-off-by: Tetsuo Handa Tested-by: syzbot Cc: Alan Stern Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/rc/imon.c | 99 +++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 52 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 54da6f60079b..ab090663f975 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -153,6 +153,24 @@ struct imon_context { const struct imon_usb_dev_descr *dev_descr; /* device description with key */ /* table for front panels */ + /* + * Fields for deferring free_imon_context(). + * + * Since reference to "struct imon_context" is stored into + * "struct file"->private_data, we need to remember + * how many file descriptors might access this "struct imon_context". + */ + refcount_t users; + /* + * Use a flag for telling display_open()/vfd_write()/lcd_write() that + * imon_disconnect() was already called. + */ + bool disconnected; + /* + * We need to wait for RCU grace period in order to allow + * display_open() to safely check ->disconnected and increment ->users. + */ + struct rcu_head rcu; }; =20 #define TOUCH_TIMEOUT (HZ/30) @@ -160,18 +178,18 @@ struct imon_context { /* vfd character device file operations */ static const struct file_operations vfd_fops =3D { .owner =3D THIS_MODULE, - .open =3D &display_open, - .write =3D &vfd_write, - .release =3D &display_close, + .open =3D display_open, + .write =3D vfd_write, + .release =3D display_close, .llseek =3D noop_llseek, }; =20 /* lcd character device file operations */ static const struct file_operations lcd_fops =3D { .owner =3D THIS_MODULE, - .open =3D &display_open, - .write =3D &lcd_write, - .release =3D &display_close, + .open =3D display_open, + .write =3D lcd_write, + .release =3D display_close, .llseek =3D noop_llseek, }; =20 @@ -439,9 +457,6 @@ static struct usb_driver imon_driver =3D { .id_table =3D imon_usb_id_table, }; =20 -/* to prevent races between open() and disconnect(), probing, etc */ -static DEFINE_MUTEX(driver_lock); - /* Module bookkeeping bits */ MODULE_AUTHOR(MOD_AUTHOR); MODULE_DESCRIPTION(MOD_DESC); @@ -481,9 +496,11 @@ static void free_imon_context(struct imon_context *ict= x) struct device *dev =3D ictx->dev; =20 usb_free_urb(ictx->tx_urb); + WARN_ON(ictx->dev_present_intf0); usb_free_urb(ictx->rx_urb_intf0); + WARN_ON(ictx->dev_present_intf1); usb_free_urb(ictx->rx_urb_intf1); - kfree(ictx); + kfree_rcu(ictx, rcu); =20 dev_dbg(dev, "%s: iMON context freed\n", __func__); } @@ -499,9 +516,6 @@ static int display_open(struct inode *inode, struct fil= e *file) int subminor; int retval =3D 0; =20 - /* prevent races with disconnect */ - mutex_lock(&driver_lock); - subminor =3D iminor(inode); interface =3D usb_find_interface(&imon_driver, subminor); if (!interface) { @@ -509,13 +523,16 @@ static int display_open(struct inode *inode, struct f= ile *file) retval =3D -ENODEV; goto exit; } - ictx =3D usb_get_intfdata(interface); =20 - if (!ictx) { + rcu_read_lock(); + ictx =3D usb_get_intfdata(interface); + if (!ictx || ictx->disconnected || !refcount_inc_not_zero(&ictx->users)) { + rcu_read_unlock(); pr_err("no context found for minor %d\n", subminor); retval =3D -ENODEV; goto exit; } + rcu_read_unlock(); =20 mutex_lock(&ictx->lock); =20 @@ -533,8 +550,10 @@ static int display_open(struct inode *inode, struct fi= le *file) =20 mutex_unlock(&ictx->lock); =20 + if (retval && refcount_dec_and_test(&ictx->users)) + free_imon_context(ictx); + exit: - mutex_unlock(&driver_lock); return retval; } =20 @@ -544,16 +563,9 @@ static int display_open(struct inode *inode, struct fi= le *file) */ static int display_close(struct inode *inode, struct file *file) { - struct imon_context *ictx =3D NULL; + struct imon_context *ictx =3D file->private_data; int retval =3D 0; =20 - ictx =3D file->private_data; - - if (!ictx) { - pr_err("no context for device\n"); - return -ENODEV; - } - mutex_lock(&ictx->lock); =20 if (!ictx->display_supported) { @@ -568,6 +580,8 @@ static int display_close(struct inode *inode, struct fi= le *file) } =20 mutex_unlock(&ictx->lock); + if (refcount_dec_and_test(&ictx->users)) + free_imon_context(ictx); return retval; } =20 @@ -934,15 +948,12 @@ static ssize_t vfd_write(struct file *file, const cha= r __user *buf, int offset; int seq; int retval =3D 0; - struct imon_context *ictx; + struct imon_context *ictx =3D file->private_data; static const unsigned char vfd_packet6[] =3D { 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF }; =20 - ictx =3D file->private_data; - if (!ictx) { - pr_err_ratelimited("no context for device\n"); + if (ictx->disconnected) return -ENODEV; - } =20 mutex_lock(&ictx->lock); =20 @@ -1018,13 +1029,10 @@ static ssize_t lcd_write(struct file *file, const c= har __user *buf, size_t n_bytes, loff_t *pos) { int retval =3D 0; - struct imon_context *ictx; + struct imon_context *ictx =3D file->private_data; =20 - ictx =3D file->private_data; - if (!ictx) { - pr_err_ratelimited("no context for device\n"); + if (ictx->disconnected) return -ENODEV; - } =20 mutex_lock(&ictx->lock); =20 @@ -2404,7 +2412,6 @@ static int imon_probe(struct usb_interface *interface, int ifnum, sysfs_err; int ret =3D 0; struct imon_context *ictx =3D NULL; - struct imon_context *first_if_ctx =3D NULL; u16 vendor, product; =20 usbdev =3D usb_get_dev(interface_to_usbdev(interface)); @@ -2416,17 +2423,12 @@ static int imon_probe(struct usb_interface *interfa= ce, dev_dbg(dev, "%s: found iMON device (%04x:%04x, intf%d)\n", __func__, vendor, product, ifnum); =20 - /* prevent races probing devices w/multiple interfaces */ - mutex_lock(&driver_lock); - first_if =3D usb_ifnum_to_if(usbdev, 0); if (!first_if) { ret =3D -ENODEV; goto fail; } =20 - first_if_ctx =3D usb_get_intfdata(first_if); - if (ifnum =3D=3D 0) { ictx =3D imon_init_intf0(interface, id); if (!ictx) { @@ -2434,9 +2436,11 @@ static int imon_probe(struct usb_interface *interfac= e, ret =3D -ENODEV; goto fail; } + refcount_set(&ictx->users, 1); =20 } else { /* this is the secondary interface on the device */ + struct imon_context *first_if_ctx =3D usb_get_intfdata(first_if); =20 /* fail early if first intf failed to register */ if (!first_if_ctx) { @@ -2450,14 +2454,13 @@ static int imon_probe(struct usb_interface *interfa= ce, ret =3D -ENODEV; goto fail; } + refcount_inc(&ictx->users); =20 } =20 usb_set_intfdata(interface, ictx); =20 if (ifnum =3D=3D 0) { - mutex_lock(&ictx->lock); - if (product =3D=3D 0xffdc && ictx->rf_device) { sysfs_err =3D sysfs_create_group(&interface->dev.kobj, &imon_rf_attr_group); @@ -2468,21 +2471,17 @@ static int imon_probe(struct usb_interface *interfa= ce, =20 if (ictx->display_supported) imon_init_display(ictx, interface); - - mutex_unlock(&ictx->lock); } =20 dev_info(dev, "iMON device (%04x:%04x, intf%d) on usb<%d:%d> initialized\= n", vendor, product, ifnum, usbdev->bus->busnum, usbdev->devnum); =20 - mutex_unlock(&driver_lock); usb_put_dev(usbdev); =20 return 0; =20 fail: - mutex_unlock(&driver_lock); usb_put_dev(usbdev); dev_err(dev, "unable to register, err %d\n", ret); =20 @@ -2498,10 +2497,8 @@ static void imon_disconnect(struct usb_interface *in= terface) struct device *dev; int ifnum; =20 - /* prevent races with multi-interface device probing and display_open */ - mutex_lock(&driver_lock); - ictx =3D usb_get_intfdata(interface); + ictx->disconnected =3D true; dev =3D ictx->dev; ifnum =3D interface->cur_altsetting->desc.bInterfaceNumber; =20 @@ -2542,11 +2539,9 @@ static void imon_disconnect(struct usb_interface *in= terface) } } =20 - if (!ictx->dev_present_intf0 && !ictx->dev_present_intf1) + if (refcount_dec_and_test(&ictx->users)) free_imon_context(ictx); =20 - mutex_unlock(&driver_lock); - dev_dbg(dev, "%s: iMON device (intf%d) disconnected\n", __func__, ifnum); } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91BDFCCA48E for ; Tue, 7 Jun 2022 22:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384816AbiFGWQ0 (ORCPT ); Tue, 7 Jun 2022 18:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380106AbiFGVLa (ORCPT ); Tue, 7 Jun 2022 17:11:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A62B6217621; Tue, 7 Jun 2022 11:53:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F10C6176D; Tue, 7 Jun 2022 18:53:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9EDFC385A5; Tue, 7 Jun 2022 18:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627989; bh=1QCkvUVKkSssoNrecKUlG97xKfGrKuMFunKfeuff/Ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nTeD/sfuUDCzGdqnWDgmRD1KMA7wsb9hEAzghzIKzf6dr2FL1w4d9L5uJGqmOwM2q ALQDpKQsWAGwz57K4WOp2jBVDcNE/v7Lz5T1HIwIxIg8T4gg+TXoxn1sBaAffh0iHP HRoTvFyeRoYwTzTKLjP/yG+Ss0Kk+qh3iv471ogM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 167/879] media: cec-adap.c: fix is_configuring state Date: Tue, 7 Jun 2022 18:54:45 +0200 Message-Id: <20220607165007.556567139@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans Verkuil [ Upstream commit 59267fc34f4900dcd2ec3295f6be04b79aee2186 ] If an adapter is trying to claim a free logical address then it is in the 'is_configuring' state. If during that process the cable is disconnected (HPD goes low, which in turn invalidates the physical address), then cec_adap_unconfigure() is called, and that set the is_configuring boolean to false, even though the thread that's trying to claim an LA is still running. Don't touch the is_configuring bool in cec_adap_unconfigure(), it will eventually be cleared by the thread. By making that change the cec_config_log_addr() function also had to change: it was aborting if is_configuring became false (since that is what cec_adap_unconfigure() did), but that no longer works. Instead check if the physical address is invalid. That is a much more appropriate check anyway. This fixes a bug where the the adapter could be disabled even though the device was still configuring. This could cause POLL transmits to time out. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/cec/core/cec-adap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec= -adap.c index 2e12331c12a9..01766e744772 100644 --- a/drivers/media/cec/core/cec-adap.c +++ b/drivers/media/cec/core/cec-adap.c @@ -1278,7 +1278,7 @@ static int cec_config_log_addr(struct cec_adapter *ad= ap, * While trying to poll the physical address was reset * and the adapter was unconfigured, so bail out. */ - if (!adap->is_configuring) + if (adap->phys_addr =3D=3D CEC_PHYS_ADDR_INVALID) return -EINTR; =20 if (err) @@ -1335,7 +1335,6 @@ static void cec_adap_unconfigure(struct cec_adapter *= adap) adap->phys_addr !=3D CEC_PHYS_ADDR_INVALID) WARN_ON(adap->ops->adap_log_addr(adap, CEC_LOG_ADDR_INVALID)); adap->log_addrs.log_addr_mask =3D 0; - adap->is_configuring =3D false; adap->is_configured =3D false; cec_flush(adap); wake_up_interruptible(&adap->kthread_waitq); @@ -1527,9 +1526,10 @@ static int cec_config_thread_func(void *arg) for (i =3D 0; i < las->num_log_addrs; i++) las->log_addr[i] =3D CEC_LOG_ADDR_INVALID; cec_adap_unconfigure(adap); + adap->is_configuring =3D false; adap->kthread_config =3D NULL; - mutex_unlock(&adap->lock); complete(&adap->config_completion); + mutex_unlock(&adap->lock); return 0; } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EFCCC433EF for ; Tue, 7 Jun 2022 22:17:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384110AbiFGWO5 (ORCPT ); Tue, 7 Jun 2022 18:14:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380117AbiFGVLb (ORCPT ); Tue, 7 Jun 2022 17:11: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 65C0A2178A4; Tue, 7 Jun 2022 11:53:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0FB2EB81F6D; Tue, 7 Jun 2022 18:53:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BD70C385A2; Tue, 7 Jun 2022 18:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627991; bh=67f36S+4rjT+JdsrzBc14AqQKTdEkAdczFOtEskmpRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fMTP545xExRWOgun2l5fN5CCI5ZJ4mdLF3QRC///R4TslD17sQG0/TcFAPZ0ozlPW 097f61iRXIhuY8Cp9gjzO0I9gtf6XIglocR+8XkrUsCoSqC3bVDWO6VRyvSj+FcZLG bX1gF28Ek/j7eSWWelFp5bcdlMKwie7j35QtHXoE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Oliver Neukum , Martyn Welch , Andrew Lunn , "David S. Miller" , Sasha Levin , Oleksij Rempel , Ferry Toth Subject: [PATCH 5.18 168/879] usbnet: Run unregister_netdev() before unbind() again Date: Tue, 7 Jun 2022 18:54:46 +0200 Message-Id: <20220607165007.586261372@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner [ Upstream commit d1408f6b4dd78fb1b9e26bcf64477984e5f85409 ] Commit 2c9d6c2b871d ("usbnet: run unbind() before unregister_netdev()") sought to fix a use-after-free on disconnect of USB Ethernet adapters. It turns out that a different fix is necessary to address the issue: https://lore.kernel.org/netdev/18b3541e5372bc9b9fc733d422f4e698c089077c.165= 0177997.git.lukas@wunner.de/ So the commit was not necessary. The commit made binding and unbinding of USB Ethernet asymmetrical: Before, usbnet_probe() first invoked the ->bind() callback and then register_netdev(). usbnet_disconnect() mirrored that by first invoking unregister_netdev() and then ->unbind(). Since the commit, the order in usbnet_disconnect() is reversed and no longer mirrors usbnet_probe(). One consequence is that a PHY disconnected (and stopped) in ->unbind() is afterwards stopped once more by unregister_netdev() as it closes the netdev before unregistering. That necessitates a contortion in ->stop() because the PHY may only be stopped if it hasn't already been disconnected. Reverting the commit allows making the call to phy_stop() unconditional in ->stop(). Tested-by: Oleksij Rempel # LAN9514/9512/9500 Tested-by: Ferry Toth # LAN9514 Signed-off-by: Lukas Wunner Acked-by: Oliver Neukum Cc: Martyn Welch Cc: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/usb/asix_devices.c | 6 +----- drivers/net/usb/smsc95xx.c | 3 +-- drivers/net/usb/usbnet.c | 6 +++--- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index 38e47a93fb83..5b5eb630c4b7 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c @@ -795,11 +795,7 @@ static int ax88772_stop(struct usbnet *dev) { struct asix_common_private *priv =3D dev->driver_priv; =20 - /* On unplugged USB, we will get MDIO communication errors and the - * PHY will be set in to PHY_HALTED state. - */ - if (priv->phydev->state !=3D PHY_HALTED) - phy_stop(priv->phydev); + phy_stop(priv->phydev); =20 return 0; } diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 4ef61f6b85df..edf0492ad489 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -1243,8 +1243,7 @@ static int smsc95xx_start_phy(struct usbnet *dev) =20 static int smsc95xx_stop(struct usbnet *dev) { - if (dev->net->phydev) - phy_stop(dev->net->phydev); + phy_stop(dev->net->phydev); =20 return 0; } diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 9a6450f796dc..36b24ec11650 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1616,9 +1616,6 @@ void usbnet_disconnect (struct usb_interface *intf) xdev->bus->bus_name, xdev->devpath, dev->driver_info->description); =20 - if (dev->driver_info->unbind) - dev->driver_info->unbind(dev, intf); - net =3D dev->net; unregister_netdev (net); =20 @@ -1626,6 +1623,9 @@ void usbnet_disconnect (struct usb_interface *intf) =20 usb_scuttle_anchored_urbs(&dev->deferred); =20 + if (dev->driver_info->unbind) + dev->driver_info->unbind(dev, intf); + usb_kill_urb(dev->interrupt); usb_free_urb(dev->interrupt); kfree(dev->padding_pkt); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3D18C3F2D4 for ; Tue, 7 Jun 2022 22:17:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385025AbiFGWRM (ORCPT ); Tue, 7 Jun 2022 18:17:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380142AbiFGVLd (ORCPT ); Tue, 7 Jun 2022 17:11:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CB9E2178AF; Tue, 7 Jun 2022 11:53:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C8C6DB82018; Tue, 7 Jun 2022 18:53:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2351FC3411C; Tue, 7 Jun 2022 18:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627994; bh=uBf4ntkHBfzEN3956XOhHHxqoIIf5aiUP6GYJPkD3to=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0QpoEznOYP5yxAdLSh9vOZqfF1Mn1nOLvUqZhB91lzr4Yy7giZaekQE0uc/YjdY8k PKX2/YP+4DRPJsohR3ZiPOG+k6gTetYtpEtjXjzKFIbfbfZmGYaFPa5Q9nSRFbIgI/ HqDzABGaPCEh3tO5QfC/kbV5g4admizo4jaeRsVM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.18 169/879] Bluetooth: HCI: Add HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN quirk Date: Tue, 7 Jun 2022 18:54:47 +0200 Message-Id: <20220607165007.615036012@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luiz Augusto von Dentz [ Upstream commit 05abad857277dda198063017b00ba5b9fed2c0cb ] This adds HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN quirk which can be used to mark HCI_Enhanced_Setup_Synchronous_Connection as broken even if its support command bit are set since some controller report it as supported but the command don't work properly with some configurations (e.g. BT_VOICE_TRANSPARENT/mSBC). Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/net/bluetooth/hci.h | 9 +++++++++ include/net/bluetooth/hci_core.h | 8 ++++++-- net/bluetooth/hci_conn.c | 2 +- net/bluetooth/sco.c | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 69ef31cea582..62a9bb022aed 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -265,6 +265,15 @@ enum { * runtime suspend, because event filtering takes place there. */ HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, + + /* + * When this quirk is set, disables the use of + * HCI_OP_ENHANCED_SETUP_SYNC_CONN command to setup SCO connections. + * + * This quirk can be set before hci_register_dev is called or + * during the hdev->setup vendor callback. + */ + HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, }; =20 /* HCI device flags */ diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_c= ore.h index 62d7b81b1cb7..5a52a2018b56 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1495,8 +1495,12 @@ void hci_conn_del_sysfs(struct hci_conn *conn); #define privacy_mode_capable(dev) (use_ll_privacy(dev) && \ (hdev->commands[39] & 0x04)) =20 -/* Use enhanced synchronous connection if command is supported */ -#define enhanced_sco_capable(dev) ((dev)->commands[29] & 0x08) +/* Use enhanced synchronous connection if command is supported and its qui= rk + * has not been set. + */ +#define enhanced_sync_conn_capable(dev) \ + (((dev)->commands[29] & 0x08) && \ + !test_bit(HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, &(dev)->quirks)) =20 /* Use ext scanning if set ext scan param and ext scan enable is supported= */ #define use_ext_scan(dev) (((dev)->commands[37] & 0x20) && \ diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index fe803bee419a..882a7df13005 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -481,7 +481,7 @@ static bool hci_setup_sync_conn(struct hci_conn *conn, = __u16 handle) =20 bool hci_setup_sync(struct hci_conn *conn, __u16 handle) { - if (enhanced_sco_capable(conn->hdev)) + if (enhanced_sync_conn_capable(conn->hdev)) return hci_enhanced_setup_sync_conn(conn, handle); =20 return hci_setup_sync_conn(conn, handle); diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 8eabf41b2993..2a58c7d88433 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -885,7 +885,7 @@ static int sco_sock_setsockopt(struct socket *sock, int= level, int optname, err =3D -EBADFD; break; } - if (enhanced_sco_capable(hdev) && + if (enhanced_sync_conn_capable(hdev) && voice.setting =3D=3D BT_VOICE_TRANSPARENT) sco_pi(sk)->codec.id =3D BT_CODEC_TRANSPARENT; hci_dev_put(hdev); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64FC4C433EF for ; Tue, 7 Jun 2022 22:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384522AbiFGWPF (ORCPT ); Tue, 7 Jun 2022 18:15:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380156AbiFGVLf (ORCPT ); Tue, 7 Jun 2022 17:11:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0676E1498E3; Tue, 7 Jun 2022 11:53:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7E3D4B81FE1; Tue, 7 Jun 2022 18:53:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D99EAC385A2; Tue, 7 Jun 2022 18:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627997; bh=KPrctiGxlv//O7HkBngTp+QRuLCMbHbeWLwuZvRLw1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J1DxivFZTISPTZ5dAyk+9Ci2/1uQoakrb5aqj5JTbT782y40rPKllw+kgpcMeuQpn pzZyot3jX29CrUURNRieuVCY/JMZtI85AWmPgHVvqVfgUaT5TJv3pkvayovthJ0bd3 orHMP35SvPLAes6BWym9Lk9ACukrDU5S8rAHVD80= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.18 170/879] Bluetooth: btusb: Set HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN for QCA Date: Tue, 7 Jun 2022 18:54:48 +0200 Message-Id: <20220607165007.644159709@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luiz Augusto von Dentz [ Upstream commit d44e1dbda36fff5d7c2586683c4adc0963aef908 ] This sets HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN for QCA controllers since SCO appear to not work when using HCI_OP_ENHANCED_SETUP_SYNC_CONN. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D215576 Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bluetooth/btusb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 50df417207af..06a854a2507e 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -3335,6 +3335,11 @@ static int btusb_setup_qca(struct hci_dev *hdev) msleep(QCA_BT_RESET_WAIT_MS); } =20 + /* Mark HCI_OP_ENHANCED_SETUP_SYNC_CONN as broken as it doesn't seem to + * work with the likes of HSP/HFP mSBC. + */ + set_bit(HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, &hdev->quirks); + return 0; } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B59D0CCA48F for ; Tue, 7 Jun 2022 22:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384847AbiFGWQa (ORCPT ); Tue, 7 Jun 2022 18:16:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380181AbiFGVLk (ORCPT ); Tue, 7 Jun 2022 17:11:40 -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 ABD3E218A86; Tue, 7 Jun 2022 11:53: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 3B1AFB82018; Tue, 7 Jun 2022 18:53:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 807E5C385A5; Tue, 7 Jun 2022 18:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628002; bh=ZY+9bOivnNwE6I+fPAkFM/4luhtBKoOnJATkvk/5Qi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mgpHxWMjXGYlaEPKef5OYDzfFk66eShA5ewj8JzNRyOa3N6nosmn3wmNjKO43Rj8v MXzBAMm+DTuhxlrlw7AmlIVuEgCrMhcqPzMPhUDOInh8XbnSzYMt3/ia81N1VE5Zal Dinnehu9kjAKiNJLX/frdMm8+EwEz1piYY3/bRn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zijun Hu , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.18 171/879] Bluetooth: btusb: Set HCI_QUIRK_BROKEN_ERR_DATA_REPORTING for QCA Date: Tue, 7 Jun 2022 18:54:49 +0200 Message-Id: <20220607165007.675903937@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zijun Hu [ Upstream commit 247f226adadfb7be09dd537f177429f4415aef8e ] Set HCI_QUIRK_BROKEN_ERR_DATA_REPORTING for QCA controllers since they answer HCI_OP_READ_DEF_ERR_DATA_REPORTING with error code "UNKNOWN HCI COMMAND" as shown below: [ 580.517552] Bluetooth: hci0: unexpected cc 0x0c5a length: 1 < 2 [ 580.517660] Bluetooth: hci0: Opcode 0x c5a failed: -38 hcitool -i hci0 cmd 0x03 0x5a < HCI Command: ogf 0x03, ocf 0x005a, plen 0 > HCI Event: 0x0e plen 4 01 5A 0C 01 btmon log: < HCI Command: Read Default Erroneous Data Reporting (0x03|0x005a) plen 0 > HCI Event: Command Complete (0x0e) plen 4 Read Default Erroneous Data Reporting (0x03|0x005a) ncmd 1 Status: Unknown HCI Command (0x01) Signed-off-by: Zijun Hu Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 06a854a2507e..e48c3ad069bb 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -3339,6 +3339,7 @@ static int btusb_setup_qca(struct hci_dev *hdev) * work with the likes of HSP/HFP mSBC. */ set_bit(HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, &hdev->quirks); + set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks); =20 return 0; } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85975C43334 for ; Tue, 7 Jun 2022 22:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384538AbiFGWPO (ORCPT ); Tue, 7 Jun 2022 18:15:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380186AbiFGVLk (ORCPT ); Tue, 7 Jun 2022 17:11:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFAE81498FA; Tue, 7 Jun 2022 11:53: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 23EE3612F2; Tue, 7 Jun 2022 18:53:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34592C385A2; Tue, 7 Jun 2022 18:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628005; bh=czw9kRjZG40hr+kia3G/03BugvUAA5H+FXWgSqt3PEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lfSQbZgG7daHKQL3Z17vMINZ9qFrnUxAhtm8vFj8HUBQ1cSgxvX4Aks3pAlRm9mqp FWyVnXEyvuemmnd4zgUKwROlsw/rejIqX0MwUKbaivjNhxl1lD1Um7GUxtCL+4B46g HR+OXdGHkTQQXP6TKIqK/BbebDgCO4l49GuwbVwc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Cochran , Pavan Chebbi , Michael Chan , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 172/879] bnxt_en: Configure ptp filters during bnxt open Date: Tue, 7 Jun 2022 18:54:50 +0200 Message-Id: <20220607165007.705141014@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavan Chebbi [ Upstream commit 11862689e8f117e4702f55000790d7bce6859e84 ] For correctness, we need to configure the packet filters for timestamping during bnxt_open. This way they are always configured after firmware reset or chip reset. We should not assume that the filters will always be retained across resets. This patch modifies the ioctl handler and always configures the PTP filters in the bnxt_open() path. Cc: Richard Cochran Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 56 ++++++++++++++----- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 2 + 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethern= et/broadcom/bnxt/bnxt.c index 1d69fe0737a1..d5149478a351 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -10363,6 +10363,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool ir= q_re_init, bool link_re_init) if (BNXT_PF(bp)) bnxt_vf_reps_open(bp); bnxt_ptp_init_rtc(bp, true); + bnxt_ptp_cfg_tstamp_filters(bp); return 0; =20 open_err_irq: diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/et= hernet/broadcom/bnxt/bnxt_ptp.c index 00f2f80c0073..f9c94e5fe718 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c @@ -295,6 +295,27 @@ static int bnxt_ptp_cfg_event(struct bnxt *bp, u8 even= t) return hwrm_req_send(bp, req); } =20 +void bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp) +{ + struct bnxt_ptp_cfg *ptp =3D bp->ptp_cfg; + struct hwrm_port_mac_cfg_input *req; + + if (!ptp || !ptp->tstamp_filters) + return; + + if (hwrm_req_init(bp, req, HWRM_PORT_MAC_CFG)) + goto out; + req->flags =3D cpu_to_le32(ptp->tstamp_filters); + req->enables =3D cpu_to_le32(PORT_MAC_CFG_REQ_ENABLES_RX_TS_CAPTURE_PTP_M= SG_TYPE); + req->rx_ts_capture_ptp_msg_type =3D cpu_to_le16(ptp->rxctl); + + if (!hwrm_req_send(bp, req)) + return; + ptp->tstamp_filters =3D 0; +out: + netdev_warn(bp->dev, "Failed to configure HW packet timestamp filters\n"); +} + void bnxt_ptp_reapply_pps(struct bnxt *bp) { struct bnxt_ptp_cfg *ptp =3D bp->ptp_cfg; @@ -435,27 +456,36 @@ static int bnxt_ptp_enable(struct ptp_clock_info *ptp= _info, static int bnxt_hwrm_ptp_cfg(struct bnxt *bp) { struct bnxt_ptp_cfg *ptp =3D bp->ptp_cfg; - struct hwrm_port_mac_cfg_input *req; u32 flags =3D 0; - int rc; + int rc =3D 0; =20 - rc =3D hwrm_req_init(bp, req, HWRM_PORT_MAC_CFG); - if (rc) - return rc; + switch (ptp->rx_filter) { + case HWTSTAMP_FILTER_NONE: + flags =3D PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE; + break; + case HWTSTAMP_FILTER_PTP_V2_EVENT: + case HWTSTAMP_FILTER_PTP_V2_SYNC: + case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: + flags =3D PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_ENABLE; + break; + } =20 - if (ptp->rx_filter) - flags |=3D PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_ENABLE; - else - flags |=3D PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE; if (ptp->tx_tstamp_en) flags |=3D PORT_MAC_CFG_REQ_FLAGS_PTP_TX_TS_CAPTURE_ENABLE; else flags |=3D PORT_MAC_CFG_REQ_FLAGS_PTP_TX_TS_CAPTURE_DISABLE; - req->flags =3D cpu_to_le32(flags); - req->enables =3D cpu_to_le32(PORT_MAC_CFG_REQ_ENABLES_RX_TS_CAPTURE_PTP_M= SG_TYPE); - req->rx_ts_capture_ptp_msg_type =3D cpu_to_le16(ptp->rxctl); =20 - return hwrm_req_send(bp, req); + ptp->tstamp_filters =3D flags; + + if (netif_running(bp->dev)) { + rc =3D bnxt_close_nic(bp, false, false); + if (!rc) + rc =3D bnxt_open_nic(bp, false, false); + if (!rc && !ptp->tstamp_filters) + rc =3D -EIO; + } + + return rc; } =20 int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h b/drivers/net/et= hernet/broadcom/bnxt/bnxt_ptp.h index 530b9922608c..4ce0a14c1e23 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h @@ -113,6 +113,7 @@ struct bnxt_ptp_cfg { BNXT_PTP_MSG_PDELAY_RESP) u8 tx_tstamp_en:1; int rx_filter; + u32 tstamp_filters; =20 u32 refclk_regs[2]; u32 refclk_mapped_regs[2]; @@ -133,6 +134,7 @@ do { \ int bnxt_ptp_parse(struct sk_buff *skb, u16 *seq_id, u16 *hdr_off); void bnxt_ptp_update_current_time(struct bnxt *bp); void bnxt_ptp_pps_event(struct bnxt *bp, u32 data1, u32 data2); +void bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp); void bnxt_ptp_reapply_pps(struct bnxt *bp); int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr); int bnxt_hwtstamp_get(struct net_device *dev, struct ifreq *ifr); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACBEECCA47C for ; Tue, 7 Jun 2022 22:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384566AbiFGWP0 (ORCPT ); Tue, 7 Jun 2022 18:15:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380193AbiFGVLk (ORCPT ); Tue, 7 Jun 2022 17:11:40 -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 A0AC8218A89; Tue, 7 Jun 2022 11:53:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E762612F2; Tue, 7 Jun 2022 18:53:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 162D4C3411C; Tue, 7 Jun 2022 18:53:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628008; bh=gxsFb/v4AB0XAGjYM+rRf9p/fUvFDHFjqtE2n2EA7VY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JwEmA+gVAT75aFumcK5mpIS/emo2qNv6a7VjSI45Ln2QSre+BBhXci662v9sSDvDE /OQEN/AQNXGSOTX9actkI7KqeyJf6zcd7jHUY+FQfZoKIC4KDOGvFwlhrH9VuvTdB9 dCVCUS9NSE9kNLER2aQ3ArvGqwgHsyiIVEW+rl30= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunfei Dong , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 173/879] media: mediatek: vcodec: prevent kernel crash when rmmod mtk-vcodec-dec.ko Date: Tue, 7 Jun 2022 18:54:51 +0200 Message-Id: <20220607165007.735114915@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunfei Dong [ Upstream commit c10c0086db688c95bb4e0e378e523818dff1551d ] If the driver support subdev mode, the parameter "dev->pm.dev" will be NULL in mtk_vcodec_dec_remove. Kernel will crash when try to rmmod mtk-vcodec-dec.ko. [ 4380.702726] pc : do_raw_spin_trylock+0x4/0x80 [ 4380.707075] lr : _raw_spin_lock_irq+0x90/0x14c [ 4380.711509] sp : ffff80000819bc10 [ 4380.714811] x29: ffff80000819bc10 x28: ffff3600c03e4000 x27: 00000000000= 00000 [ 4380.721934] x26: 0000000000000000 x25: 0000000000000000 x24: 00000000000= 00000 [ 4380.729057] x23: ffff3600c0f34930 x22: ffffd5e923549000 x21: 00000000000= 00220 [ 4380.736179] x20: 0000000000000208 x19: ffffd5e9213e8ebc x18: 00000000000= 00020 [ 4380.743298] x17: 0000002000000000 x16: ffffd5e9213e8e90 x15: 696c346f656= 46976 [ 4380.750420] x14: 0000000000000000 x13: 0000000000000001 x12: 00000000000= 00040 [ 4380.757542] x11: 0000000000000000 x10: 0000000000000000 x9 : 00000000000= 00000 [ 4380.764664] x8 : 0000000000000000 x7 : ffff3600c7273ae8 x6 : ffffd5e9213= e8ebc [ 4380.771786] x5 : 0000000000000000 x4 : 0000000000000001 x3 : 00000000000= 00000 [ 4380.778908] x2 : 0000000000000000 x1 : ffff3600c03e4000 x0 : 00000000000= 00208 [ 4380.786031] Call trace: [ 4380.788465] do_raw_spin_trylock+0x4/0x80 [ 4380.792462] __pm_runtime_disable+0x2c/0x1b0 [ 4380.796723] mtk_vcodec_dec_remove+0x5c/0xa0 [mtk_vcodec_dec] [ 4380.802466] platform_remove+0x2c/0x60 [ 4380.806204] __device_release_driver+0x194/0x250 [ 4380.810810] driver_detach+0xc8/0x15c [ 4380.814462] bus_remove_driver+0x5c/0xb0 [ 4380.818375] driver_unregister+0x34/0x64 [ 4380.822288] platform_driver_unregister+0x18/0x24 [ 4380.826979] mtk_vcodec_dec_driver_exit+0x1c/0x888 [mtk_vcodec_dec] [ 4380.833240] __arm64_sys_delete_module+0x190/0x224 [ 4380.838020] invoke_syscall+0x48/0x114 [ 4380.841760] el0_svc_common.constprop.0+0x60/0x11c [ 4380.846540] do_el0_svc+0x28/0x90 [ 4380.849844] el0_svc+0x4c/0x100 [ 4380.852975] el0t_64_sync_handler+0xec/0xf0 [ 4380.857148] el0t_64_sync+0x190/0x194 [ 4380.860801] Code: 94431515 17ffffca d503201f d503245f (b9400004) Signed-off-by: Yunfei Dong Tested-by: N=C3=ADcolas F. R. A. Prado Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/= drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c index df7b25e9cbc8..128edcf541e1 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -487,7 +487,8 @@ static int mtk_vcodec_dec_remove(struct platform_device= *pdev) video_unregister_device(dev->vfd_dec); =20 v4l2_device_unregister(&dev->v4l2_dev); - pm_runtime_disable(dev->pm.dev); + if (!dev->vdec_pdata->is_subdev_supported) + pm_runtime_disable(dev->pm.dev); mtk_vcodec_fw_release(dev->fw_handler); return 0; } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB9F1CCA498 for ; Tue, 7 Jun 2022 22:17:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385008AbiFGWRJ (ORCPT ); Tue, 7 Jun 2022 18:17:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380207AbiFGVLl (ORCPT ); Tue, 7 Jun 2022 17:11:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BB4A218AA1; Tue, 7 Jun 2022 11:53: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 07FCD6176D; Tue, 7 Jun 2022 18:53:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1682CC385A2; Tue, 7 Jun 2022 18:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628011; bh=HfOrDTLhdUzR7V2uVaro7XE7vKpON/b5Tcu5bw6pI6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Suoh2DyTcAmYQwcdDFTOah0GP7uRCWIJ4CS6h/szG3AEiVA6hk58BnxdOmxpOolcv LLS/NoMXWH7vNkgLt9Y/3+dymhWa5fyqZSsIqV0CzLlhp36ondDATrAWLFDvqkEHy4 zUMH77aMHpGj3E6Mt2oCaFwJnHA75/66yOPyU15w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Arnd Bergmann , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Guenter Roeck , "Jason A. Donenfeld" , Sasha Levin Subject: [PATCH 5.18 174/879] openrisc: start CPU timer early in boot Date: Tue, 7 Jun 2022 18:54:52 +0200 Message-Id: <20220607165007.891629583@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 516dd4aacd67a0f27da94f3fe63fe0f4dbab6e2b ] In order to measure the boot process, the timer should be switched on as early in boot as possible. As well, the commit defines the get_cycles macro, like the previous patches in this series, so that generic code is aware that it's implemented by the platform, as is done on other archs. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Jonas Bonn Cc: Stefan Kristiansson Acked-by: Stafford Horne Reported-by: Guenter Roeck Signed-off-by: Jason A. Donenfeld Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/openrisc/include/asm/timex.h | 1 + arch/openrisc/kernel/head.S | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/arch/openrisc/include/asm/timex.h b/arch/openrisc/include/asm/= timex.h index d52b4e536e3f..5487fa93dd9b 100644 --- a/arch/openrisc/include/asm/timex.h +++ b/arch/openrisc/include/asm/timex.h @@ -23,6 +23,7 @@ static inline cycles_t get_cycles(void) { return mfspr(SPR_TTCR); } +#define get_cycles get_cycles =20 /* This isn't really used any more */ #define CLOCK_TICK_RATE 1000 diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S index 15f1b38dfe03..871f4c858859 100644 --- a/arch/openrisc/kernel/head.S +++ b/arch/openrisc/kernel/head.S @@ -521,6 +521,15 @@ _start: l.ori r3,r0,0x1 l.mtspr r0,r3,SPR_SR =20 + /* + * Start the TTCR as early as possible, so that the RNG can make use of + * measurements of boot time from the earliest opportunity. Especially + * important is that the TTCR does not return zero by the time we reach + * rand_initialize(). + */ + l.movhi r3,hi(SPR_TTMR_CR) + l.mtspr r0,r3,SPR_TTMR + CLEAR_GPR(r1) CLEAR_GPR(r2) CLEAR_GPR(r3) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9DEBCCA490 for ; Tue, 7 Jun 2022 22:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384882AbiFGWQh (ORCPT ); Tue, 7 Jun 2022 18:16:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380237AbiFGVLm (ORCPT ); Tue, 7 Jun 2022 17:11:42 -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 5A004218ABF; Tue, 7 Jun 2022 11:53:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 76C8AB81FE1; Tue, 7 Jun 2022 18:53:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0B12C385A2; Tue, 7 Jun 2022 18:53:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628014; bh=pVUNEsiwiqNBZBI/yNccmCzF3JEyW8mOd+NKkwpJvhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t6phl+6lcMWZCurZbo/KvzCUGofqbF13XEPGhATsPgBfekAkqbEMORz4Pv19/JNhb DqM5E5FAce0DYz0yyQk64uLVoEt0uucp6ppcplzpDVsA2f/FQ/x4BBnJG8ELHukTth kkMBx4ev6jsY0bQcLAGmoQBGqBNWE85d3WGS0fVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kyle Smith , Chaitanya Kulkarni , Hannes Reinecke , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.18 175/879] nvme-pci: fix a NULL pointer dereference in nvme_alloc_admin_tags Date: Tue, 7 Jun 2022 18:54:53 +0200 Message-Id: <20220607165007.921805103@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Smith, Kyle Miller (Nimble Kernel) [ Upstream commit da42761181627e9bdc37d18368b827948a583929 ] In nvme_alloc_admin_tags, the admin_q can be set to an error (typically -ENOMEM) if the blk_mq_init_queue call fails to set up the queue, which is checked immediately after the call. However, when we return the error message up the stack, to nvme_reset_work the error takes us to nvme_remove_dead_ctrl() nvme_dev_disable() nvme_suspend_queue(&dev->queues[0]). Here, we only check that the admin_q is non-NULL, rather than not an error or NULL, and begin quiescing a queue that never existed, leading to bad / NULL pointer dereference. Signed-off-by: Kyle Smith Reviewed-by: Chaitanya Kulkarni Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 3aacf1c0d5a5..17aeb7d5c485 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1775,6 +1775,7 @@ static int nvme_alloc_admin_tags(struct nvme_dev *dev) dev->ctrl.admin_q =3D blk_mq_init_queue(&dev->admin_tagset); if (IS_ERR(dev->ctrl.admin_q)) { blk_mq_free_tag_set(&dev->admin_tagset); + dev->ctrl.admin_q =3D NULL; return -ENOMEM; } if (!blk_get_queue(dev->ctrl.admin_q)) { --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8E6BCCA493 for ; Tue, 7 Jun 2022 22:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384897AbiFGWQl (ORCPT ); Tue, 7 Jun 2022 18:16:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380243AbiFGVLm (ORCPT ); Tue, 7 Jun 2022 17:11: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 3DA0B14AA51; Tue, 7 Jun 2022 11:53:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A23BF616A9; Tue, 7 Jun 2022 18:53:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AED3CC385A2; Tue, 7 Jun 2022 18:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628017; bh=exPGkkNvsUk+zn+DuPTfeI/LZZeoAt13rijdsRPZbco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y8V9OfzYCwrCiosZQNm9HlsPLIy1MF8FVa5vFZ/FXLe0yrF+PaKyUmhqUHjCWNaEo gA5hxENCvihs2nal5KYdguEsQoNTbEroHKQM8LivflPnJQIcuZiNnBqcQMDBH1G/wS 2CAFvsLI7K9JhuqIiuH6lUoKiu1D6vJ9khKeCBB0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Ma , Mark Brown , Sasha Levin Subject: [PATCH 5.18 176/879] ASoC: rt5645: Fix errorenous cleanup order Date: Tue, 7 Jun 2022 18:54:54 +0200 Message-Id: <20220607165007.950520523@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lin Ma [ Upstream commit 2def44d3aec59e38d2701c568d65540783f90f2f ] There is a logic error when removing rt5645 device as the function rt5645_i2c_remove() first cancel the &rt5645->jack_detect_work and delete the &rt5645->btn_check_timer latter. However, since the timer handler rt5645_btn_check_callback() will re-queue the jack_detect_work, this cleanup order is buggy. That is, once the del_timer_sync in rt5645_i2c_remove is concurrently run with the rt5645_btn_check_callback, the canceled jack_detect_work will be rescheduled again, leading to possible use-after-free. This patch fix the issue by placing the del_timer_sync function before the cancel_delayed_work_sync. Signed-off-by: Lin Ma Link: https://lore.kernel.org/r/20220516092035.28283-1-linma@zju.edu.cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/codecs/rt5645.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 197c56047947..4b2e027c1033 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -4154,9 +4154,14 @@ static int rt5645_i2c_remove(struct i2c_client *i2c) if (i2c->irq) free_irq(i2c->irq, rt5645); =20 + /* + * Since the rt5645_btn_check_callback() can queue jack_detect_work, + * the timer need to be delted first + */ + del_timer_sync(&rt5645->btn_check_timer); + cancel_delayed_work_sync(&rt5645->jack_detect_work); cancel_delayed_work_sync(&rt5645->rcclock_work); - del_timer_sync(&rt5645->btn_check_timer); =20 regulator_bulk_disable(ARRAY_SIZE(rt5645->supplies), rt5645->supplies); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA92ACCA491 for ; Tue, 7 Jun 2022 22:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384865AbiFGWQd (ORCPT ); Tue, 7 Jun 2022 18:16:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380256AbiFGVLn (ORCPT ); Tue, 7 Jun 2022 17:11:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC883219105; Tue, 7 Jun 2022 11:53:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 271ECB8220B; Tue, 7 Jun 2022 18:53:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C9D3C385A2; Tue, 7 Jun 2022 18:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628019; bh=y3bhC0rUOrF3icDOfUWiGnm7BKnScQLuWa8qmBsViaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HEDoOpe1pHS5fynIEH26O2OPlG9y0dFOiUs9I+8Qk6vU53GmHUsqKIRWjhYpfHn/1 YqzUvTLQfZeVfjSgGaMNKJTyZQfs24dWvzzVBs1ptxYTXYEV+/LAG7gFjRpSORiqqN Y8UWunvimrriIzEQlltd/XiUn82ETViOuQ/SkeNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Jianhai , Xie Yongji , Josef Bacik , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 177/879] nbd: Fix hung on disconnect request if socket is closed before Date: Tue, 7 Jun 2022 18:54:55 +0200 Message-Id: <20220607165007.979386632@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xie Yongji [ Upstream commit 491bf8f236fdeec698fa6744993f1ecf3fafd1a5 ] When userspace closes the socket before sending a disconnect request, the following I/O requests will be blocked in wait_for_reconnect() until dead timeout. This will cause the following disconnect request also hung on blk_mq_quiesce_queue(). That means we have no way to disconnect a nbd device if there are some I/O requests waiting for reconnecting until dead timeout. It's not expected. So let's wake up the thread waiting for reconnecting directly when a disconnect request is sent. Reported-by: Xu Jianhai Signed-off-by: Xie Yongji Reviewed-by: Josef Bacik Link: https://lore.kernel.org/r/20220322080639.142-1-xieyongji@bytedance.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/block/nbd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 5a1f98494ddd..284557041336 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -947,11 +947,15 @@ static int wait_for_reconnect(struct nbd_device *nbd) struct nbd_config *config =3D nbd->config; if (!config->dead_conn_timeout) return 0; - if (test_bit(NBD_RT_DISCONNECTED, &config->runtime_flags)) + + if (!wait_event_timeout(config->conn_wait, + test_bit(NBD_RT_DISCONNECTED, + &config->runtime_flags) || + atomic_read(&config->live_connections) > 0, + config->dead_conn_timeout)) return 0; - return wait_event_timeout(config->conn_wait, - atomic_read(&config->live_connections) > 0, - config->dead_conn_timeout) > 0; + + return !test_bit(NBD_RT_DISCONNECTED, &config->runtime_flags); } =20 static int nbd_handle_cmd(struct nbd_cmd *cmd, int index) @@ -2082,6 +2086,7 @@ static void nbd_disconnect_and_put(struct nbd_device = *nbd) mutex_lock(&nbd->config_lock); nbd_disconnect(nbd); sock_shutdown(nbd); + wake_up(&nbd->config->conn_wait); /* * Make sure recv thread has finished, we can safely call nbd_clear_que() * to cancel the inflight I/Os. --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09F4ACCA492 for ; Tue, 7 Jun 2022 22:17:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384914AbiFGWQs (ORCPT ); Tue, 7 Jun 2022 18:16:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380264AbiFGVLo (ORCPT ); Tue, 7 Jun 2022 17:11:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D10F621911E; Tue, 7 Jun 2022 11:53:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 427C7616A9; Tue, 7 Jun 2022 18:53:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EDD4C385A2; Tue, 7 Jun 2022 18:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628022; bh=iJOWEQeEya++FDpv90BhXob+T4+XbmP5vzMKKkYsioE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qqtTiNAXRYBUHUpCN55h3QaabqfdRu5daE6eEc/NhbLu9NxSS8+3JJtXxq9ew93ol 99RiyIlZRiL3Bc8GIpfmA2sFlmvoDfCWChLDZ2Kg2obxopVmINEeNDG4rH71YxslGE y8cCS0xlEuro+GGNHQpu0GT0P6ankrML4QHaJwIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sathishkumar S , Lijo Lazar , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 178/879] drm/amd/pm: update smartshift powerboost calc for smu12 Date: Tue, 7 Jun 2022 18:54:56 +0200 Message-Id: <20220607165008.008052023@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sathishkumar S [ Upstream commit 138292f1dc00e7e0724f44769f9da39cf2f3bf0b ] smartshift apu and dgpu power boost are reported as percentage with respect to their power limits. This value[0-100] reflects the boost for the respective device. Signed-off-by: Sathishkumar S Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 60 ++++++++++++++----- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c b/drivers/gpu/= drm/amd/pm/swsmu/smu12/renoir_ppt.c index fd6c44ece168..012e3bd99cc2 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c @@ -1119,6 +1119,39 @@ static int renoir_get_power_profile_mode(struct smu_= context *smu, return size; } =20 +static void renoir_get_ss_power_percent(SmuMetrics_t *metrics, + uint32_t *apu_percent, uint32_t *dgpu_percent) +{ + uint32_t apu_boost =3D 0; + uint32_t dgpu_boost =3D 0; + uint16_t apu_limit =3D 0; + uint16_t dgpu_limit =3D 0; + uint16_t apu_power =3D 0; + uint16_t dgpu_power =3D 0; + + apu_power =3D metrics->ApuPower; + apu_limit =3D metrics->StapmOriginalLimit; + if (apu_power > apu_limit && apu_limit !=3D 0) + apu_boost =3D ((apu_power - apu_limit) * 100) / apu_limit; + apu_boost =3D (apu_boost > 100) ? 100 : apu_boost; + + dgpu_power =3D metrics->dGpuPower; + if (metrics->StapmCurrentLimit > metrics->StapmOriginalLimit) + dgpu_limit =3D metrics->StapmCurrentLimit - metrics->StapmOriginalLimit; + if (dgpu_power > dgpu_limit && dgpu_limit !=3D 0) + dgpu_boost =3D ((dgpu_power - dgpu_limit) * 100) / dgpu_limit; + dgpu_boost =3D (dgpu_boost > 100) ? 100 : dgpu_boost; + + if (dgpu_boost >=3D apu_boost) + apu_boost =3D 0; + else + dgpu_boost =3D 0; + + *apu_percent =3D apu_boost; + *dgpu_percent =3D dgpu_boost; +} + + static int renoir_get_smu_metrics_data(struct smu_context *smu, MetricsMember_t member, uint32_t *value) @@ -1127,6 +1160,9 @@ static int renoir_get_smu_metrics_data(struct smu_con= text *smu, =20 SmuMetrics_t *metrics =3D (SmuMetrics_t *)smu_table->metrics_table; int ret =3D 0; + uint32_t apu_percent =3D 0; + uint32_t dgpu_percent =3D 0; + =20 ret =3D smu_cmn_get_metrics_table(smu, NULL, @@ -1171,26 +1207,18 @@ static int renoir_get_smu_metrics_data(struct smu_c= ontext *smu, *value =3D metrics->Voltage[1]; break; case METRICS_SS_APU_SHARE: - /* return the percentage of APU power with respect to APU's power limit. - * percentage is reported, this isn't boost value. Smartshift power - * boost/shift is only when the percentage is more than 100. + /* return the percentage of APU power boost + * with respect to APU's power limit. */ - if (metrics->StapmOriginalLimit > 0) - *value =3D (metrics->ApuPower * 100) / metrics->StapmOriginalLimit; - else - *value =3D 0; + renoir_get_ss_power_percent(metrics, &apu_percent, &dgpu_percent); + *value =3D apu_percent; break; case METRICS_SS_DGPU_SHARE: - /* return the percentage of dGPU power with respect to dGPU's power limi= t. - * percentage is reported, this isn't boost value. Smartshift power - * boost/shift is only when the percentage is more than 100. + /* return the percentage of dGPU power boost + * with respect to dGPU's power limit. */ - if ((metrics->dGpuPower > 0) && - (metrics->StapmCurrentLimit > metrics->StapmOriginalLimit)) - *value =3D (metrics->dGpuPower * 100) / - (metrics->StapmCurrentLimit - metrics->StapmOriginalLimit); - else - *value =3D 0; + renoir_get_ss_power_percent(metrics, &apu_percent, &dgpu_percent); + *value =3D dgpu_percent; break; default: *value =3D UINT_MAX; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 190F3CCA495 for ; Tue, 7 Jun 2022 22:17:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384930AbiFGWQv (ORCPT ); Tue, 7 Jun 2022 18:16:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380273AbiFGVLp (ORCPT ); Tue, 7 Jun 2022 17:11:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4614321911C; Tue, 7 Jun 2022 11:53:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B4FE8B82018; Tue, 7 Jun 2022 18:53:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23F29C385A5; Tue, 7 Jun 2022 18:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628025; bh=AXSUpGzFRrsZs0apkR/T9iXU45rGIqbP27cyfYEiBG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oPtVeumOIW8hs3+3JEZso3lx31X4KAYpbe9oxiuGxhQI/rzbv7drmDXcOHmKUdiHH aYbmkLshpIlQDXNYX8Q7ir4hRDrAveebRJoT7KbBbaDcZvlex41GCEpQrLEqeblWte yyCRnSbdigmf+eREqLbrVqsGGev0B0YJNQMA+YGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sathishkumar S , Lijo Lazar , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 179/879] drm/amd/pm: update smartshift powerboost calc for smu13 Date: Tue, 7 Jun 2022 18:54:57 +0200 Message-Id: <20220607165008.036733272@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sathishkumar S [ Upstream commit cdf4c8ec39872a61a58d62f19b4db80f0f7bc586 ] smartshift apu and dgpu power boost are reported as percentage with respect to their power limits. adjust the units of power before calculating the percentage of boost. Signed-off-by: Sathishkumar S Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c | 62 ++++++++++++++----- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c b/drivers= /gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c index e2d099409123..87257b1b028f 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c @@ -276,6 +276,42 @@ static int yellow_carp_mode2_reset(struct smu_context = *smu) return yellow_carp_mode_reset(smu, SMU_RESET_MODE_2); } =20 + +static void yellow_carp_get_ss_power_percent(SmuMetrics_t *metrics, + uint32_t *apu_percent, uint32_t *dgpu_percent) +{ + uint32_t apu_boost =3D 0; + uint32_t dgpu_boost =3D 0; + uint16_t apu_limit =3D 0; + uint16_t dgpu_limit =3D 0; + uint16_t apu_power =3D 0; + uint16_t dgpu_power =3D 0; + + /* APU and dGPU power values are reported in milli Watts + * and STAPM power limits are in Watts */ + apu_power =3D metrics->ApuPower/1000; + apu_limit =3D metrics->StapmOpnLimit; + if (apu_power > apu_limit && apu_limit !=3D 0) + apu_boost =3D ((apu_power - apu_limit) * 100) / apu_limit; + apu_boost =3D (apu_boost > 100) ? 100 : apu_boost; + + dgpu_power =3D metrics->dGpuPower/1000; + if (metrics->StapmCurrentLimit > metrics->StapmOpnLimit) + dgpu_limit =3D metrics->StapmCurrentLimit - metrics->StapmOpnLimit; + if (dgpu_power > dgpu_limit && dgpu_limit !=3D 0) + dgpu_boost =3D ((dgpu_power - dgpu_limit) * 100) / dgpu_limit; + dgpu_boost =3D (dgpu_boost > 100) ? 100 : dgpu_boost; + + if (dgpu_boost >=3D apu_boost) + apu_boost =3D 0; + else + dgpu_boost =3D 0; + + *apu_percent =3D apu_boost; + *dgpu_percent =3D dgpu_boost; + +} + static int yellow_carp_get_smu_metrics_data(struct smu_context *smu, MetricsMember_t member, uint32_t *value) @@ -284,6 +320,8 @@ static int yellow_carp_get_smu_metrics_data(struct smu_= context *smu, =20 SmuMetrics_t *metrics =3D (SmuMetrics_t *)smu_table->metrics_table; int ret =3D 0; + uint32_t apu_percent =3D 0; + uint32_t dgpu_percent =3D 0; =20 ret =3D smu_cmn_get_metrics_table(smu, NULL, false); if (ret) @@ -332,26 +370,18 @@ static int yellow_carp_get_smu_metrics_data(struct sm= u_context *smu, *value =3D metrics->Voltage[1]; break; case METRICS_SS_APU_SHARE: - /* return the percentage of APU power with respect to APU's power limit. - * percentage is reported, this isn't boost value. Smartshift power - * boost/shift is only when the percentage is more than 100. + /* return the percentage of APU power boost + * with respect to APU's power limit. */ - if (metrics->StapmOpnLimit > 0) - *value =3D (metrics->ApuPower * 100) / metrics->StapmOpnLimit; - else - *value =3D 0; + yellow_carp_get_ss_power_percent(metrics, &apu_percent, &dgpu_percent); + *value =3D apu_percent; break; case METRICS_SS_DGPU_SHARE: - /* return the percentage of dGPU power with respect to dGPU's power limi= t. - * percentage is reported, this isn't boost value. Smartshift power - * boost/shift is only when the percentage is more than 100. + /* return the percentage of dGPU power boost + * with respect to dGPU's power limit. */ - if ((metrics->dGpuPower > 0) && - (metrics->StapmCurrentLimit > metrics->StapmOpnLimit)) - *value =3D (metrics->dGpuPower * 100) / - (metrics->StapmCurrentLimit - metrics->StapmOpnLimit); - else - *value =3D 0; + yellow_carp_get_ss_power_percent(metrics, &apu_percent, &dgpu_percent); + *value =3D dgpu_percent; break; default: *value =3D UINT_MAX; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E20FCCA494 for ; Tue, 7 Jun 2022 22:17:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384945AbiFGWQy (ORCPT ); Tue, 7 Jun 2022 18:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380286AbiFGVLq (ORCPT ); Tue, 7 Jun 2022 17:11:46 -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 D2CBF149D97; Tue, 7 Jun 2022 11:53: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 757B4B82018; Tue, 7 Jun 2022 18:53:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2CCAC385A2; Tue, 7 Jun 2022 18:53:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628028; bh=hPUbUC3wFDCP8aithaZ5HvATm1athO3Gq5+G/6a2wHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qLiSVoJHZmQLofjDbPSIsK093pKMEaFtsurvIweOrLcirAZnRiTa+aWe9yvXsa6O9 gdeEk4yDfVMuAIJV/fJ1vXVPhs/epJr3lmKCFqQIbLamCj/rQboA8eSz3IDRLnKkjy HO4xXLg9eqcTwosdBGeaYXre1mZZcTNiNOAt3uUU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 180/879] drm/amdgpu: Move mutex_init(&smu->message_lock) to smu_early_init() Date: Tue, 7 Jun 2022 18:54:58 +0200 Message-Id: <20220607165008.065260983@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 4b9caaa0281972ca5ea4e1cdac2e12b9df1ae00b ] Lockdep complains about the smu->message_lock mutex being used before it is initialized through the following call path: amdgpu_device_init() amdgpu_dpm_mode2_reset() smu_mode2_reset() smu_v12_0_mode2_reset() smu_cmn_send_smc_msg_with_param() Move the mutex_init() call to smu_early_init() to fix the mutex being used before it is initialized. This fixes the following lockdep splat: [ 3.867331] ------------[ cut here ]------------ [ 3.867335] fbcon: Taking over console [ 3.867338] DEBUG_LOCKS_WARN_ON(lock->magic !=3D lock) [ 3.867340] WARNING: CPU: 14 PID: 491 at kernel/locking/mutex.c:579 __mu= tex_lock+0x44c/0x830 [ 3.867349] Modules linked in: amdgpu(+) crct10dif_pclmul drm_ttm_helper= crc32_pclmul ttm crc32c_intel ghash_clmulni_intel hid_lg_g15 iommu_v2 sp51= 00_tco nvme gpu_sched drm_dp_helper nvme_core ccp wmi video hid_logitech_dj= ip6_tables ip_tables ipmi_devintf ipmi_msghandler fuse i2c_dev [ 3.867363] CPU: 14 PID: 491 Comm: systemd-udevd Tainted: G I = 5.18.0-rc5+ #33 [ 3.867366] Hardware name: Micro-Star International Co., Ltd. MS-7C95/B5= 50M PRO-VDH WIFI (MS-7C95), BIOS 2.90 12/23/2021 [ 3.867369] RIP: 0010:__mutex_lock+0x44c/0x830 [ 3.867372] Code: ff 85 c0 0f 84 33 fc ff ff 8b 0d b7 50 25 01 85 c9 0f = 85 25 fc ff ff 48 c7 c6 fb 41 82 99 48 c7 c7 6b 63 80 99 e8 88 2a f8 ff <0f= > 0b e9 0b fc ff ff f6 83 b9 0c 00 00 01 0f 85 64 ff ff ff 4c 89 [ 3.867377] RSP: 0018:ffffaef8c0fc79f0 EFLAGS: 00010286 [ 3.867380] RAX: 0000000000000028 RBX: 0000000000000000 RCX: 00000000000= 00027 [ 3.867382] RDX: ffff9ccc0dda0928 RSI: 0000000000000001 RDI: ffff9ccc0dd= a0920 [ 3.867384] RBP: ffffaef8c0fc7a80 R08: 0000000000000000 R09: ffffaef8c0f= c7820 [ 3.867386] R10: 0000000000000003 R11: ffff9ccc2a2fffe8 R12: 00000000000= 00002 [ 3.867388] R13: ffff9cc990808058 R14: 0000000000000000 R15: ffff9cc98bf= c0000 [ 3.867390] FS: 00007fc4d830f580(0000) GS:ffff9ccc0dd80000(0000) knlGS:= 0000000000000000 [ 3.867394] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 3.867396] CR2: 0000560a77031410 CR3: 000000010f522000 CR4: 00000000007= 50ee0 [ 3.867398] PKRU: 55555554 [ 3.867399] Call Trace: [ 3.867401] [ 3.867403] ? smu_cmn_send_smc_msg_with_param+0x98/0x240 [amdgpu] [ 3.867533] ? __mutex_lock+0x90/0x830 [ 3.867535] ? amdgpu_dpm_mode2_reset+0x37/0x60 [amdgpu] [ 3.867653] ? smu_cmn_send_smc_msg_with_param+0x98/0x240 [amdgpu] [ 3.867758] smu_cmn_send_smc_msg_with_param+0x98/0x240 [amdgpu] [ 3.867857] smu_mode2_reset+0x2b/0x50 [amdgpu] [ 3.867953] amdgpu_dpm_mode2_reset+0x46/0x60 [amdgpu] [ 3.868096] amdgpu_device_init.cold+0x1069/0x1e78 [amdgpu] [ 3.868219] ? _raw_spin_unlock_irqrestore+0x30/0x50 [ 3.868222] ? pci_conf1_read+0x9b/0xf0 [ 3.868226] amdgpu_driver_load_kms+0x15/0x110 [amdgpu] [ 3.868314] amdgpu_pci_probe+0x1a9/0x3c0 [amdgpu] [ 3.868398] local_pci_probe+0x41/0x80 [ 3.868401] pci_device_probe+0xab/0x200 [ 3.868404] really_probe+0x1a1/0x370 [ 3.868407] __driver_probe_device+0xfc/0x170 [ 3.868410] driver_probe_device+0x1f/0x90 [ 3.868412] __driver_attach+0xbf/0x1a0 [ 3.868414] ? __device_attach_driver+0xe0/0xe0 [ 3.868416] bus_for_each_dev+0x65/0x90 [ 3.868419] bus_add_driver+0x151/0x1f0 [ 3.868421] driver_register+0x89/0xd0 [ 3.868423] ? 0xffffffffc0bd4000 [ 3.868425] do_one_initcall+0x5d/0x300 [ 3.868428] ? do_init_module+0x22/0x240 [ 3.868431] ? rcu_read_lock_sched_held+0x3c/0x70 [ 3.868434] ? trace_kmalloc+0x30/0xe0 [ 3.868437] ? kmem_cache_alloc_trace+0x1e6/0x3a0 [ 3.868440] do_init_module+0x4a/0x240 [ 3.868442] __do_sys_finit_module+0x93/0xf0 [ 3.868446] do_syscall_64+0x5b/0x80 [ 3.868449] ? rcu_read_lock_sched_held+0x3c/0x70 [ 3.868451] ? lockdep_hardirqs_on_prepare+0xd9/0x180 [ 3.868454] ? do_syscall_64+0x67/0x80 [ 3.868456] ? do_syscall_64+0x67/0x80 [ 3.868458] ? do_syscall_64+0x67/0x80 [ 3.868460] ? do_syscall_64+0x67/0x80 [ 3.868462] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 3.868465] RIP: 0033:0x7fc4d8ec1ced [ 3.868467] Code: 5d c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 = 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48= > 3d 01 f0 ff ff 73 01 c3 48 8b 0d fb 70 0e 00 f7 d8 64 89 01 48 [ 3.868472] RSP: 002b:00007fff687ae6b8 EFLAGS: 00000246 ORIG_RAX: 000000= 0000000139 [ 3.868475] RAX: ffffffffffffffda RBX: 0000560a76fbca60 RCX: 00007fc4d8e= c1ced [ 3.868477] RDX: 0000000000000000 RSI: 00007fc4d902343c RDI: 00000000000= 00011 [ 3.868479] RBP: 00007fc4d902343c R08: 0000000000000000 R09: 0000560a76f= b59c0 [ 3.868481] R10: 0000000000000011 R11: 0000000000000246 R12: 00000000000= 20000 [ 3.868484] R13: 0000560a76f8bfd0 R14: 0000000000000000 R15: 0000560a76f= c2d10 [ 3.868487] [ 3.868489] irq event stamp: 120617 [ 3.868490] hardirqs last enabled at (120617): [] __u= p_console_sem+0x5e/0x70 [ 3.868494] hardirqs last disabled at (120616): [] __u= p_console_sem+0x43/0x70 [ 3.868497] softirqs last enabled at (119684): [] __i= rq_exit_rcu+0xca/0x100 [ 3.868501] softirqs last disabled at (119679): [] __i= rq_exit_rcu+0xca/0x100 [ 3.868504] ---[ end trace 0000000000000000 ]--- Signed-off-by: Hans de Goede Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/am= d/pm/swsmu/amdgpu_smu.c index f10a0256413e..32cff21f261c 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c @@ -576,6 +576,8 @@ static int smu_early_init(void *handle) smu->smu_baco.platform_support =3D false; smu->user_dpm_profile.fan_mode =3D -1; =20 + mutex_init(&smu->message_lock); + adev->powerplay.pp_handle =3D smu; adev->powerplay.pp_funcs =3D &swsmu_pm_funcs; =20 @@ -975,8 +977,6 @@ static int smu_sw_init(void *handle) bitmap_zero(smu->smu_feature.supported, SMU_FEATURE_MAX); bitmap_zero(smu->smu_feature.allowed, SMU_FEATURE_MAX); =20 - mutex_init(&smu->message_lock); - INIT_WORK(&smu->throttling_logging_work, smu_throttling_logging_work_fn); INIT_WORK(&smu->interrupt_work, smu_interrupt_work_fn); atomic64_set(&smu->throttle_int_counter, 0); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62684CCA496 for ; Tue, 7 Jun 2022 22:17:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384979AbiFGWRC (ORCPT ); Tue, 7 Jun 2022 18:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349467AbiFGVLs (ORCPT ); Tue, 7 Jun 2022 17:11:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEA372194CE; Tue, 7 Jun 2022 11:53:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6C82361724; Tue, 7 Jun 2022 18:53:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78AAEC36B00; Tue, 7 Jun 2022 18:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628033; bh=A3CivUUyS2UHd9YX6XuOP1Gz13QUVPcNKCp/bvnCo6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lGlrZbV26dQ/cgfo9TCiqJ0qnwwQtFovdRHJ/quTQGBzkcqb2sXMs4Hpnm14CqmIo qfobOPyRikBnIwIL1FWDXfiM9+t+j12VNIei+m+eX8ooDWBa1JgrsgoVJUH7Hu2UDv 9FRFGhIPs5+oZR1I8aV29xNuQfoDzMFyTmhah/ZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sweet Tea Dorminy , Omar Sandoval , David Sterba , Sasha Levin Subject: [PATCH 5.18 181/879] btrfs: fix anon_dev leak in create_subvol() Date: Tue, 7 Jun 2022 18:54:59 +0200 Message-Id: <20220607165008.093753515@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Omar Sandoval [ Upstream commit 2256e901f5bddc56e24089c96f27b77da932dfcc ] When btrfs_qgroup_inherit(), btrfs_alloc_tree_block, or btrfs_insert_root() fail in create_subvol(), we return without freeing anon_dev. Reorganize the error handling in create_subvol() to fix this. Reviewed-by: Sweet Tea Dorminy Signed-off-by: Omar Sandoval Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/btrfs/ioctl.c | 49 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index be6c24577dbe..777801902511 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -561,7 +561,7 @@ static noinline int create_subvol(struct user_namespace= *mnt_userns, struct timespec64 cur_time =3D current_time(dir); struct inode *inode; int ret; - dev_t anon_dev =3D 0; + dev_t anon_dev; u64 objectid; u64 index =3D 0; =20 @@ -571,11 +571,7 @@ static noinline int create_subvol(struct user_namespac= e *mnt_userns, =20 ret =3D btrfs_get_free_objectid(fs_info->tree_root, &objectid); if (ret) - goto fail_free; - - ret =3D get_anon_bdev(&anon_dev); - if (ret < 0) - goto fail_free; + goto out_root_item; =20 /* * Don't create subvolume whose level is not zero. Or qgroup will be @@ -583,9 +579,13 @@ static noinline int create_subvol(struct user_namespac= e *mnt_userns, */ if (btrfs_qgroup_level(objectid)) { ret =3D -ENOSPC; - goto fail_free; + goto out_root_item; } =20 + ret =3D get_anon_bdev(&anon_dev); + if (ret < 0) + goto out_root_item; + btrfs_init_block_rsv(&block_rsv, BTRFS_BLOCK_RSV_TEMP); /* * The same as the snapshot creation, please see the comment @@ -593,26 +593,26 @@ static noinline int create_subvol(struct user_namespa= ce *mnt_userns, */ ret =3D btrfs_subvolume_reserve_metadata(root, &block_rsv, 8, false); if (ret) - goto fail_free; + goto out_anon_dev; =20 trans =3D btrfs_start_transaction(root, 0); if (IS_ERR(trans)) { ret =3D PTR_ERR(trans); btrfs_subvolume_release_metadata(root, &block_rsv); - goto fail_free; + goto out_anon_dev; } trans->block_rsv =3D &block_rsv; trans->bytes_reserved =3D block_rsv.size; =20 ret =3D btrfs_qgroup_inherit(trans, 0, objectid, inherit); if (ret) - goto fail; + goto out; =20 leaf =3D btrfs_alloc_tree_block(trans, root, 0, objectid, NULL, 0, 0, 0, BTRFS_NESTING_NORMAL); if (IS_ERR(leaf)) { ret =3D PTR_ERR(leaf); - goto fail; + goto out; } =20 btrfs_mark_buffer_dirty(leaf); @@ -667,7 +667,7 @@ static noinline int create_subvol(struct user_namespace= *mnt_userns, btrfs_tree_unlock(leaf); btrfs_free_tree_block(trans, objectid, leaf, 0, 1); free_extent_buffer(leaf); - goto fail; + goto out; } =20 free_extent_buffer(leaf); @@ -676,19 +676,18 @@ static noinline int create_subvol(struct user_namespa= ce *mnt_userns, key.offset =3D (u64)-1; new_root =3D btrfs_get_new_fs_root(fs_info, objectid, anon_dev); if (IS_ERR(new_root)) { - free_anon_bdev(anon_dev); ret =3D PTR_ERR(new_root); btrfs_abort_transaction(trans, ret); - goto fail; + goto out; } - /* Freeing will be done in btrfs_put_root() of new_root */ + /* anon_dev is owned by new_root now. */ anon_dev =3D 0; =20 ret =3D btrfs_record_root_in_trans(trans, new_root); if (ret) { btrfs_put_root(new_root); btrfs_abort_transaction(trans, ret); - goto fail; + goto out; } =20 ret =3D btrfs_create_subvol_root(trans, new_root, root, mnt_userns); @@ -696,7 +695,7 @@ static noinline int create_subvol(struct user_namespace= *mnt_userns, if (ret) { /* We potentially lose an unused inode item here */ btrfs_abort_transaction(trans, ret); - goto fail; + goto out; } =20 /* @@ -705,28 +704,28 @@ static noinline int create_subvol(struct user_namespa= ce *mnt_userns, ret =3D btrfs_set_inode_index(BTRFS_I(dir), &index); if (ret) { btrfs_abort_transaction(trans, ret); - goto fail; + goto out; } =20 ret =3D btrfs_insert_dir_item(trans, name, namelen, BTRFS_I(dir), &key, BTRFS_FT_DIR, index); if (ret) { btrfs_abort_transaction(trans, ret); - goto fail; + goto out; } =20 btrfs_i_size_write(BTRFS_I(dir), dir->i_size + namelen * 2); ret =3D btrfs_update_inode(trans, root, BTRFS_I(dir)); if (ret) { btrfs_abort_transaction(trans, ret); - goto fail; + goto out; } =20 ret =3D btrfs_add_root_ref(trans, objectid, root->root_key.objectid, btrfs_ino(BTRFS_I(dir)), index, name, namelen); if (ret) { btrfs_abort_transaction(trans, ret); - goto fail; + goto out; } =20 ret =3D btrfs_uuid_tree_add(trans, root_item->uuid, @@ -734,8 +733,7 @@ static noinline int create_subvol(struct user_namespace= *mnt_userns, if (ret) btrfs_abort_transaction(trans, ret); =20 -fail: - kfree(root_item); +out: trans->block_rsv =3D NULL; trans->bytes_reserved =3D 0; btrfs_subvolume_release_metadata(root, &block_rsv); @@ -751,11 +749,10 @@ static noinline int create_subvol(struct user_namespa= ce *mnt_userns, return PTR_ERR(inode); d_instantiate(dentry, inode); } - return ret; - -fail_free: +out_anon_dev: if (anon_dev) free_anon_bdev(anon_dev); +out_root_item: kfree(root_item); return ret; } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77CBECCA499 for ; Tue, 7 Jun 2022 22:17:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384993AbiFGWRG (ORCPT ); Tue, 7 Jun 2022 18:17:06 -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 S1359589AbiFGVLs (ORCPT ); Tue, 7 Jun 2022 17:11:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94A562194DB; Tue, 7 Jun 2022 11:53: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 2A4B261724; Tue, 7 Jun 2022 18:53:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38F53C385A2; Tue, 7 Jun 2022 18:53:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628036; bh=xRzVVb9dp3AfJuQgs6IuBJGSwSqg0aexqaH6UBZReSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tyXGWFiN8R0iR0U7cL8JBciu1exTUMyPGa9nt4iD0OH7aY4oY48Rl0RHv7m40ORGB egXkRkzSUCzhy0lXPPocGilDqs4Kdb0QhFfOETQwOW7oE8mWDe2RYkNYIg26EXZ6+X sfd60eXp3+vIa0UNo+my6aUQ/7jlRNXV1HIsyI0I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Latypov , David Gow , Brendan Higgins , Shuah Khan , Sasha Levin Subject: [PATCH 5.18 182/879] kunit: tool: make parser stop overwriting status of suites w/ no_tests Date: Tue, 7 Jun 2022 18:55:00 +0200 Message-Id: <20220607165008.124527200@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Latypov [ Upstream commit dbf0b0d53a2b5afa6ef7372dcedf52302669fc2c ] Consider this invocation $ ./tools/testing/kunit/kunit.py parse < parent_test =3D parse_test_header(lines, test) where we have special handling when we see "# Subtest" and we ignore the explicit reported "not ok 1" status! Also, NO_TESTS at a suite-level only results in a non-zero status code where then there's only one suite atm. This change is the minimal one to make sure we don't overwrite it. Signed-off-by: Daniel Latypov Reviewed-by: David Gow Reviewed-by: Brendan Higgins Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/kunit/kunit_parser.py | 7 +++++-- .../test_data/test_is_test_passed-no_tests_no_plan.log | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/testing/kunit/kunit_parser.py b/tools/testing/kunit/kuni= t_parser.py index 05ff334761dd..2f93ed1d7f99 100644 --- a/tools/testing/kunit/kunit_parser.py +++ b/tools/testing/kunit/kunit_parser.py @@ -789,8 +789,11 @@ def parse_test(lines: LineStream, expected_num: int, l= og: List[str]) -> Test: =20 # Check for there being no tests if parent_test and len(subtests) =3D=3D 0: - test.status =3D TestStatus.NO_TESTS - test.add_error('0 tests run!') + # Don't override a bad status if this test had one reported. + # Assumption: no subtests means CRASHED is from Test.__init__() + if test.status in (TestStatus.TEST_CRASHED, TestStatus.SUCCESS): + test.status =3D TestStatus.NO_TESTS + test.add_error('0 tests run!') =20 # Add statuses to TestCounts attribute in Test object bubble_up_test_results(test) diff --git a/tools/testing/kunit/test_data/test_is_test_passed-no_tests_no_= plan.log b/tools/testing/kunit/test_data/test_is_test_passed-no_tests_no_pl= an.log index dd873c981108..4f81876ee6f1 100644 --- a/tools/testing/kunit/test_data/test_is_test_passed-no_tests_no_plan.log +++ b/tools/testing/kunit/test_data/test_is_test_passed-no_tests_no_plan.log @@ -3,5 +3,5 @@ TAP version 14 # Subtest: suite 1..1 # Subtest: case - ok 1 - case # SKIP + ok 1 - case ok 1 - suite --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E3F3C43334 for ; Tue, 7 Jun 2022 22:18:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384182AbiFGWSZ (ORCPT ); Tue, 7 Jun 2022 18:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379207AbiFGVLv (ORCPT ); Tue, 7 Jun 2022 17:11:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00D592194F3; Tue, 7 Jun 2022 11:54:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8894EB81F6D; Tue, 7 Jun 2022 18:54:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4952C385A5; Tue, 7 Jun 2022 18:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628039; bh=Z9yF7wXK7FyIDA4sdjwhkOzBIa9BHIXOUCAnORgpRiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cU8G+cxUNtNJP+neZvtKwo/oE/6UL/3U+oaz2YV0ckKmuKcXxO2U5xG7WWKUBsxMz nGuDldd4wltVGhoVMWVzX8kbykPzuGttNqlFRFGR9UFv3En7QfPeQlFhXnDNvEPLvL zeziOASjjmth+To5D1dPrYPD7WYHaF3vKxkhnWEI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Andrew Lunn , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 183/879] net: phy: micrel: Allow probing without .driver_data Date: Tue, 7 Jun 2022 18:55:01 +0200 Message-Id: <20220607165008.154283792@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit f2ef6f7539c68c6bd6c32323d8845ee102b7c450 ] Currently, if the .probe element is present in the phy_driver structure and the .driver_data is not, a NULL pointer dereference happens. Allow passing .probe without .driver_data by inserting NULL checks for priv->type. Signed-off-by: Fabio Estevam Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220513114613.762810-1-festevam@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/phy/micrel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index cd9aa353b653..48c7d715a9e3 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -497,7 +497,7 @@ static int kszphy_config_reset(struct phy_device *phyde= v) } } =20 - if (priv->led_mode >=3D 0) + if (priv->type && priv->led_mode >=3D 0) kszphy_setup_led(phydev, priv->type->led_mode_reg, priv->led_mode); =20 return 0; @@ -513,10 +513,10 @@ static int kszphy_config_init(struct phy_device *phyd= ev) =20 type =3D priv->type; =20 - if (type->has_broadcast_disable) + if (type && type->has_broadcast_disable) kszphy_broadcast_disable(phydev); =20 - if (type->has_nand_tree_disable) + if (type && type->has_nand_tree_disable) kszphy_nand_tree_disable(phydev); =20 return kszphy_config_reset(phydev); @@ -1514,7 +1514,7 @@ static int kszphy_probe(struct phy_device *phydev) =20 priv->type =3D type; =20 - if (type->led_mode_reg) { + if (type && type->led_mode_reg) { ret =3D of_property_read_u32(np, "micrel,led-mode", &priv->led_mode); if (ret) @@ -1535,7 +1535,8 @@ static int kszphy_probe(struct phy_device *phydev) unsigned long rate =3D clk_get_rate(clk); bool rmii_ref_clk_sel_25_mhz; =20 - priv->rmii_ref_clk_sel =3D type->has_rmii_ref_clk_sel; + if (type) + priv->rmii_ref_clk_sel =3D type->has_rmii_ref_clk_sel; rmii_ref_clk_sel_25_mhz =3D of_property_read_bool(np, "micrel,rmii-reference-clock-select-25-mhz"); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB061C433EF for ; Tue, 7 Jun 2022 22:18:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381115AbiFGWSk (ORCPT ); Tue, 7 Jun 2022 18:18:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379464AbiFGVMB (ORCPT ); Tue, 7 Jun 2022 17:12:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1E6E21A540; Tue, 7 Jun 2022 11:54:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C88861768; Tue, 7 Jun 2022 18:54:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE02BC385A2; Tue, 7 Jun 2022 18:54:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628042; bh=p85B30dk9OhAgqXpoKQRxZZSIMPJk0LPPpMeE1vocXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CJjwRd+RA5fp1FTIDVRUgx6BXNzs3q+vcU2J0K14KGncUXVADh2jAzsoUGipk+WSY 1/3CTCN8qs3COmMoRcFOu9Hxg6wq0HpfVHAPKYF+WK4rvEorOPRkvkjEXwt/uW/luw PX44y6l0G2N+iPf16pj+QZxpGcvm2ERLp0foqqM4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Kwanghoon Son , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 184/879] media: exynos4-is: Fix compile warning Date: Tue, 7 Jun 2022 18:55:02 +0200 Message-Id: <20220607165008.184390262@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kwanghoon Son [ Upstream commit e080f5c1f2b6d02c02ee5d674e0e392ccf63bbaf ] Declare static on function 'fimc_isp_video_device_unregister'. When VIDEO_EXYNOS4_ISP_DMA_CAPTURE=3Dn, compiler warns about warning: no previous prototype for function [-Wmissing-prototypes] Reported-by: kernel test robot Signed-off-by: Kwanghoon Son Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/media/platform/samsung/exynos4-is/fimc-isp-video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-isp-video.h b/d= rivers/media/platform/samsung/exynos4-is/fimc-isp-video.h index edcb3a5e3cb9..2dd4ddbc748a 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-isp-video.h +++ b/drivers/media/platform/samsung/exynos4-is/fimc-isp-video.h @@ -32,7 +32,7 @@ static inline int fimc_isp_video_device_register(struct f= imc_isp *isp, return 0; } =20 -void fimc_isp_video_device_unregister(struct fimc_isp *isp, +static inline void fimc_isp_video_device_unregister(struct fimc_isp *isp, enum v4l2_buf_type type) { } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B5A3C43334 for ; Tue, 7 Jun 2022 22:18:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351296AbiFGWSa (ORCPT ); Tue, 7 Jun 2022 18:18:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379651AbiFGVMC (ORCPT ); Tue, 7 Jun 2022 17:12:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1489D21A54F; Tue, 7 Jun 2022 11:54: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 4B18A616A9; Tue, 7 Jun 2022 18:54:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C055C385A2; Tue, 7 Jun 2022 18:54:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628044; bh=lyG/J14veE4PPv7P93S7wmHZ8PtfDwL4ePf9On8nxYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZF6llAc5N8qTqgrsRaxfUi/1wwxDbdQuMJRn0aS9D2ogsmghHDyFtppIF7BktL9G3 Y+5fJ5OIerMTlD6/s+yQYlXszu2ELncY3BA3tMX82hpgyDmJbJZ90NDCx7Np7GVAdk qeQMNfpaZnluzB58xtdxjKNbSuHrA1wV+4THaN8A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Dufresne , Sebastian Fricke , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 185/879] media: hantro: Stop using H.264 parameter pic_num Date: Tue, 7 Jun 2022 18:55:03 +0200 Message-Id: <20220607165008.213259241@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Dufresne [ Upstream commit 831410700909f4e29d5af1ef26b8c59fc2d1988e ] The hardware expects FrameNumWrap or long_term_frame_idx. Picture numbers are per field, and are mostly used during the memory management process, which is done in userland. This fixes two ITU conformance tests: - MR6_BT_B - MR8_BT_B Signed-off-by: Nicolas Dufresne Reviewed-by: Sebastian Fricke Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/staging/media/hantro/hantro_h264.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/m= edia/hantro/hantro_h264.c index 0b4d2491be3b..228629fb3cdf 100644 --- a/drivers/staging/media/hantro/hantro_h264.c +++ b/drivers/staging/media/hantro/hantro_h264.c @@ -354,8 +354,6 @@ u16 hantro_h264_get_ref_nbr(struct hantro_ctx *ctx, uns= igned int dpb_idx) =20 if (!(dpb->flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE)) return 0; - if (dpb->flags & V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM) - return dpb->pic_num; return dpb->frame_num; } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F9B2C43334 for ; Tue, 7 Jun 2022 22:18:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381622AbiFGWSv (ORCPT ); Tue, 7 Jun 2022 18:18:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379773AbiFGVMb (ORCPT ); Tue, 7 Jun 2022 17:12:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EA2C21A56C; Tue, 7 Jun 2022 11:54: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 1002D61724; Tue, 7 Jun 2022 18:54:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19DF3C385A2; Tue, 7 Jun 2022 18:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628047; bh=+o/sFHWDGEWMaxy4QsdwsNn9L7s09ctGvgv72soVAO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dZACoU88oFbM9+Neu2/97T3lNmFGlF85AjZEUiP2Q+vyEMTzlTQsxVOyGNNTtOngE y4KfYY/JrSu2h45OiYGwa4Y28z7NltIxWXtpOa1cF1GLX5x7+7aCDK2VbjFTGov9RW yh2iZ4RO89pn2hL/l9m6bfIPy1cSwhadWrtV5gIQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 186/879] rtw89: cfo: check mac_id to avoid out-of-bounds Date: Tue, 7 Jun 2022 18:55:04 +0200 Message-Id: <20220607165008.241850652@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ping-Ke Shih [ Upstream commit 97df85871a5b187609d30fca6d85b912d9e02f29 ] Somehow, hardware reports incorrect mac_id and pollute memory. Check index before we access the array. UBSAN: array-index-out-of-bounds in rtw89/phy.c:2517:23 index 188 is out of range for type 's32 [64]' CPU: 1 PID: 51550 Comm: irq/35-rtw89_pc Tainted: G OE Call Trace: show_stack+0x52/0x58 dump_stack_lvl+0x4c/0x63 dump_stack+0x10/0x12 ubsan_epilogue+0x9/0x45 __ubsan_handle_out_of_bounds.cold+0x44/0x49 ? __alloc_skb+0x92/0x1d0 rtw89_phy_cfo_parse+0x44/0x7f [rtw89_core] rtw89_core_rx+0x261/0x871 [rtw89_core] ? __alloc_skb+0xee/0x1d0 rtw89_pci_napi_poll+0x3fa/0x4ea [rtw89_pci] __napi_poll+0x33/0x1a0 net_rx_action+0x126/0x260 ? __queue_work+0x217/0x4c0 __do_softirq+0xd9/0x315 ? disable_irq_nosync+0x10/0x10 do_softirq.part.0+0x6d/0x90 __local_bh_enable_ip+0x62/0x70 rtw89_pci_interrupt_threadfn+0x182/0x1a6 [rtw89_pci] irq_thread_fn+0x28/0x60 irq_thread+0xc8/0x190 ? irq_thread_fn+0x60/0x60 kthread+0x16b/0x190 ? irq_thread_check_affinity+0xe0/0xe0 ? set_kthread_struct+0x50/0x50 ret_from_fork+0x22/0x30 Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220516005215.5878-4-pkshih@realtek.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/realtek/rtw89/phy.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireles= s/realtek/rtw89/phy.c index ac211d897311..8414f30184b9 100644 --- a/drivers/net/wireless/realtek/rtw89/phy.c +++ b/drivers/net/wireless/realtek/rtw89/phy.c @@ -2213,6 +2213,11 @@ void rtw89_phy_cfo_parse(struct rtw89_dev *rtwdev, s= 16 cfo_val, struct rtw89_cfo_tracking_info *cfo =3D &rtwdev->cfo_tracking; u8 macid =3D phy_ppdu->mac_id; =20 + if (macid >=3D CFO_TRACK_MAX_USER) { + rtw89_warn(rtwdev, "mac_id %d is out of range\n", macid); + return; + } + cfo->cfo_tail[macid] +=3D cfo_val; cfo->cfo_cnt[macid]++; cfo->packet_count++; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA30EC433EF for ; Tue, 7 Jun 2022 22:18:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383819AbiFGWS5 (ORCPT ); Tue, 7 Jun 2022 18:18:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379837AbiFGVMm (ORCPT ); Tue, 7 Jun 2022 17:12:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADFF815352E; Tue, 7 Jun 2022 11:54:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E7330616A9; Tue, 7 Jun 2022 18:54:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE8DFC385A2; Tue, 7 Jun 2022 18:54:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628050; bh=goT196KiQfwpElqIN5celghRGMAp8wKph89erWgkuJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zW85+kwkfkATKmxAoLVFUNVHznd8lVt7LLxa0nDj99QMur4zyezO41jO+cQQ0lp83 sZ3FYEZtlUB7B/RqSe9Rb7ECoqLUFm7b3bYfbaPgpIPXmeTn6fkZfGpEWYRjdFmoZj c97LCeaArHoNKCUKY3OlR69mbH8XqlZlSwiDmz/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ross Burton , Andre Przywara , Rob Herring , Sasha Levin Subject: [PATCH 5.18 187/879] of/fdt: Ignore disabled memory nodes Date: Tue, 7 Jun 2022 18:55:05 +0200 Message-Id: <20220607165008.270554431@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andre Przywara [ Upstream commit df5cd369876114f91f9ae60658fea80acfb15890 ] When we boot a machine using a devicetree, the generic DT code goes through all nodes with a 'device_type =3D "memory"' property, and collects all memory banks mentioned there. However it does not check for the status property, so any nodes which are explicitly "disabled" will still be added as a memblock. This ends up badly for QEMU, when booting with secure firmware on arm/arm64 machines, because QEMU adds a node describing secure-only memory: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D secram@e000000 { secure-status =3D "okay"; status =3D "disabled"; reg =3D <0x00 0xe000000 0x00 0x1000000>; device_type =3D "memory"; }; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The kernel will eventually use that memory block (which is located below the main DRAM bank), but accesses to that will be answered with an SError: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ 0.000000] Internal error: synchronous external abort: 96000050 [#1] PR= EEMPT SMP [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0-rc6-00014-g10= c8acb8b679 #524 [ 0.000000] Hardware name: linux,dummy-virt (DT) [ 0.000000] pstate: 200000c5 (nzCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE= =3D--) [ 0.000000] pc : new_slab+0x190/0x340 [ 0.000000] lr : new_slab+0x184/0x340 [ 0.000000] sp : ffff80000a4b3d10 .... =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The actual crash location and call stack will be somewhat random, and depend on the specific allocation of that physical memory range. As the DT spec[1] explicitly mentions standard properties, add a simple check to skip over disabled memory nodes, so that we only use memory that is meant for non-secure code to use. That fixes booting a QEMU arm64 VM with EL3 enabled ("secure=3Don"), when not using UEFI. In this case the QEMU generated DT will be handed on to the kernel, which will see the secram node. This issue is reproducible when using TF-A together with U-Boot as firmware, then booting with the "booti" command. When using U-Boot as an UEFI provider, the code there [2] explicitly filters for disabled nodes when generating the UEFI memory map, so we are safe. EDK/2 only reads the first bank of the first DT memory node [3] to learn about memory, so we got lucky there. [1] https://github.com/devicetree-org/devicetree-specification/blob/main/so= urce/chapter3-devicenodes.rst#memory-node (after the table) [2] https://source.denx.de/u-boot/u-boot/-/blob/master/lib/fdtdec.c#L1061-1= 063 [3] https://github.com/tianocore/edk2/blob/master/ArmVirtPkg/PrePi/FdtParse= r.c Reported-by: Ross Burton Signed-off-by: Andre Przywara Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20220517101410.3493781-1-andre.przywara@arm= .com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/of/fdt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index ec315b060cd5..0f30496ce80b 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -1105,6 +1105,9 @@ int __init early_init_dt_scan_memory(void) if (type =3D=3D NULL || strcmp(type, "memory") !=3D 0) continue; =20 + if (!of_fdt_device_is_available(fdt, node)) + continue; + reg =3D of_get_flat_dt_prop(node, "linux,usable-memory", &l); if (reg =3D=3D NULL) reg =3D of_get_flat_dt_prop(node, "reg", &l); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81D8CC433EF for ; Tue, 7 Jun 2022 22:19:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380083AbiFGWTA (ORCPT ); Tue, 7 Jun 2022 18:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379880AbiFGVMu (ORCPT ); Tue, 7 Jun 2022 17:12:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84703154B05; Tue, 7 Jun 2022 11:54: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 9D6876176D; Tue, 7 Jun 2022 18:54:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A637AC385A2; Tue, 7 Jun 2022 18:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628053; bh=ycLUjmMHzdDC3CERFJqNRWnivcnpn9dj7vhSjrVVdc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hsCXu97R1QNU/O0P3BbB8vYYqJlA7HBImWk5D7Xr9+UbNMKYdCvHJ0iF+JifROh1U bqeHC/ul41XPueq8ViuOvZT7EMMeSGXAL5ucMJFbSumMLvzE/98/CWiYXDx8sJ9rGn teH3Zi9qUXTZ0YRhbk6iv4Xp94wmseFpvuGzpMiU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laibin Qiu , Ming Lei , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 188/879] blk-throttle: Set BIO_THROTTLED when bio has been throttled Date: Tue, 7 Jun 2022 18:55:06 +0200 Message-Id: <20220607165008.299214842@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Laibin Qiu [ Upstream commit 5a011f889b4832aa80c2a872a5aade5c48d2756f ] 1.In current process, all bio will set the BIO_THROTTLED flag after __blk_throtl_bio(). 2.If bio needs to be throttled, it will start the timer and stop submit bio directly. Bio will submit in blk_throtl_dispatch_work_fn() when the timer expires.But in the current process, if bio is throttled. The BIO_THROTTLED will be set to bio after timer start. If the bio has been completed, it may cause use-after-free blow. BUG: KASAN: use-after-free in blk_throtl_bio+0x12f0/0x2c70 Read of size 2 at addr ffff88801b8902d4 by task fio/26380 dump_stack+0x9b/0xce print_address_description.constprop.6+0x3e/0x60 kasan_report.cold.9+0x22/0x3a blk_throtl_bio+0x12f0/0x2c70 submit_bio_checks+0x701/0x1550 submit_bio_noacct+0x83/0xc80 submit_bio+0xa7/0x330 mpage_readahead+0x380/0x500 read_pages+0x1c1/0xbf0 page_cache_ra_unbounded+0x471/0x6f0 do_page_cache_ra+0xda/0x110 ondemand_readahead+0x442/0xae0 page_cache_async_ra+0x210/0x300 generic_file_buffered_read+0x4d9/0x2130 generic_file_read_iter+0x315/0x490 blkdev_read_iter+0x113/0x1b0 aio_read+0x2ad/0x450 io_submit_one+0xc8e/0x1d60 __se_sys_io_submit+0x125/0x350 do_syscall_64+0x2d/0x40 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Allocated by task 26380: kasan_save_stack+0x19/0x40 __kasan_kmalloc.constprop.2+0xc1/0xd0 kmem_cache_alloc+0x146/0x440 mempool_alloc+0x125/0x2f0 bio_alloc_bioset+0x353/0x590 mpage_alloc+0x3b/0x240 do_mpage_readpage+0xddf/0x1ef0 mpage_readahead+0x264/0x500 read_pages+0x1c1/0xbf0 page_cache_ra_unbounded+0x471/0x6f0 do_page_cache_ra+0xda/0x110 ondemand_readahead+0x442/0xae0 page_cache_async_ra+0x210/0x300 generic_file_buffered_read+0x4d9/0x2130 generic_file_read_iter+0x315/0x490 blkdev_read_iter+0x113/0x1b0 aio_read+0x2ad/0x450 io_submit_one+0xc8e/0x1d60 __se_sys_io_submit+0x125/0x350 do_syscall_64+0x2d/0x40 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 0: kasan_save_stack+0x19/0x40 kasan_set_track+0x1c/0x30 kasan_set_free_info+0x1b/0x30 __kasan_slab_free+0x111/0x160 kmem_cache_free+0x94/0x460 mempool_free+0xd6/0x320 bio_free+0xe0/0x130 bio_put+0xab/0xe0 bio_endio+0x3a6/0x5d0 blk_update_request+0x590/0x1370 scsi_end_request+0x7d/0x400 scsi_io_completion+0x1aa/0xe50 scsi_softirq_done+0x11b/0x240 blk_mq_complete_request+0xd4/0x120 scsi_mq_done+0xf0/0x200 virtscsi_vq_done+0xbc/0x150 vring_interrupt+0x179/0x390 __handle_irq_event_percpu+0xf7/0x490 handle_irq_event_percpu+0x7b/0x160 handle_irq_event+0xcc/0x170 handle_edge_irq+0x215/0xb20 common_interrupt+0x60/0x120 asm_common_interrupt+0x1e/0x40 Fix this by move BIO_THROTTLED set into the queue_lock. Signed-off-by: Laibin Qiu Reviewed-by: Ming Lei Link: https://lore.kernel.org/r/20220301123919.2381579-1-qiulaibin@huawei.c= om Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- block/blk-throttle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 469c483719be..5c5f2741a95f 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -2189,13 +2189,14 @@ bool __blk_throtl_bio(struct bio *bio) } =20 out_unlock: - spin_unlock_irq(&q->queue_lock); bio_set_flag(bio, BIO_THROTTLED); =20 #ifdef CONFIG_BLK_DEV_THROTTLING_LOW if (throttled || !td->track_bio_latency) bio->bi_issue.value |=3D BIO_ISSUE_THROTL_SKIP_LATENCY; #endif + spin_unlock_irq(&q->queue_lock); + rcu_read_unlock(); return throttled; } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DBF5C43334 for ; Tue, 7 Jun 2022 22:19:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380584AbiFGWTE (ORCPT ); Tue, 7 Jun 2022 18:19:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379949AbiFGVNU (ORCPT ); Tue, 7 Jun 2022 17:13:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77FBD152DB4; Tue, 7 Jun 2022 11:54:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4FE6D61724; Tue, 7 Jun 2022 18:54:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BE8FC385A2; Tue, 7 Jun 2022 18:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628055; bh=h7W2RTM4iSYf5Vb34BpA5vqhUmN3Q4wahm5IZG81TM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dOYSw+ZSYRs6sGtb6grjeTMke8YoyAoLjdV4XL8YHTAc9+e7clz6R9LNHDvT3kmbQ zxOMDaabxCVNypAWSRq1XNcNpfUzxMkC4a5yEAUkdIYJTnJ10H5xk6WmFSpBuJD6dv QN44A/x5ZcxkZLoKXU4MnaLoWSZBQJA71qtHoon4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Pierre-Louis Bossart , =?UTF-8?q?P=C3=A9ter=20Ujfalusi?= , Mark Brown , Sasha Levin Subject: [PATCH 5.18 189/879] ASoC: max98357a: remove dependency on GPIOLIB Date: Tue, 7 Jun 2022 18:55:07 +0200 Message-Id: <20220607165008.328383519@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart [ Upstream commit 21ca3274333f5c1cbbf9d91e5b33f4f2463859b2 ] commit dcc2c012c7691 ("ASoC: Fix gpiolib dependencies") removed a series of unnecessary dependencies on GPIOLIB when the gpio was optional. A similar simplification seems valid for max98357a, so remove the dependency as well. This will avoid the following warning WARNING: unmet direct dependencies detected for SND_SOC_MAX98357A Depends on [n]: SOUND [=3Dy] && !UML && SND [=3Dy] && SND_SOC [=3Dy] &= & GPIOLIB [=3Dn] Selected by [y]: - SND_SOC_INTEL_SOF_CS42L42_MACH [=3Dy] && SOUND [=3Dy] && !UML && SND [=3Dy] && SND_SOC [=3Dy] && SND_SOC_INTEL_MACH [=3Dy] && (SND_SOC_SOF_HDA_LINK [=3Dy] || SND_SOC_SOF_BAYTRAIL [=3Dn]) && I2C [=3Dy] && ACPI [=3Dy] && SND_HDA_CODEC_HDMI [=3Dy] && SND_SOC_SOF_HDA_AUDIO_CODEC [=3Dy] && (MFD_INTEL_LPSS [=3Dy] || COMPILE_TEST [=3Dn]) Reported-by: kernel test robot Signed-off-by: Pierre-Louis Bossart Reviewed-by: P=C3=A9ter Ujfalusi Link: https://lore.kernel.org/r/20220517172647.468244-2-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/codecs/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index f46a22660103..156f2519459d 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -953,7 +953,6 @@ config SND_SOC_MAX98095 =20 config SND_SOC_MAX98357A tristate "Maxim MAX98357A CODEC" - depends on GPIOLIB =20 config SND_SOC_MAX98371 tristate --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAC3AC433EF for ; Tue, 7 Jun 2022 22:19:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357179AbiFGWTS (ORCPT ); Tue, 7 Jun 2022 18:19:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379970AbiFGVNW (ORCPT ); Tue, 7 Jun 2022 17:13:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C0F1152DAF; Tue, 7 Jun 2022 11:54:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 13621612F2; Tue, 7 Jun 2022 18:54:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2844FC385A5; Tue, 7 Jun 2022 18:54:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628058; bh=YUT/g2jwaEbyBeENevqDwxAfPQZzcjDa+B0CACpQ21Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v7XhK6VmFuH42anhROnx9mF5Q7z4u0gX+84Z6rtBMN7BuNaIL0TUgnlIVFznNp0eU imQxAYU7zheVc8JKydHqRXVPPg6sdtY/hLVMUvtz6xeUJXqjSX5i1rnrwH8ERJ2ciY eZvvmkruhQ8aCuJRpSfAAVSYhpOsQWsZ1YZV7LNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Pierre-Louis Bossart , =?UTF-8?q?P=C3=A9ter=20Ujfalusi?= , Mark Brown , Sasha Levin Subject: [PATCH 5.18 190/879] ASoC: rt1015p: remove dependency on GPIOLIB Date: Tue, 7 Jun 2022 18:55:08 +0200 Message-Id: <20220607165008.356874330@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart [ Upstream commit b390c25c6757b9d56cecdfbf6d55f15fc89a6386 ] commit dcc2c012c7691 ("ASoC: Fix gpiolib dependencies") removed a series of unnecessary dependencies on GPIOLIB when the gpio was optional. A similar simplification seems valid for rt1015p, so remove the dependency as well. This will avoid the following warning WARNING: unmet direct dependencies detected for SND_SOC_RT1015P Depends on [n]: SOUND [=3Dy] && !UML && SND [=3Dy] && SND_SOC [=3Dy] && GPIOLIB [=3Dn] Selected by [y]: - SND_SOC_INTEL_SOF_RT5682_MACH [=3Dy] && SOUND [=3Dy] && !UML && SND [=3Dy] && SND_SOC [=3Dy] && SND_SOC_INTEL_MACH [=3Dy] && (SND_SOC_SOF_HDA_LINK [=3Dy] || SND_SOC_SOF_BAYTRAIL [=3Dn]) && I2C [=3Dy] && ACPI [=3Dy] && (SND_HDA_CODEC_HDMI [=3Dy] && SND_SOC_SOF_HDA_AUDIO_CODEC [=3Dy] && (MFD_INTEL_LPSS [=3Dy] || COMPILE_TEST [=3Dy]) || SND_SOC_SOF_BAYTRAIL [=3Dn] && (X86_INTEL_LPSS [=3Dn] || COMPILE_TEST [=3Dy])) Reported-by: kernel test robot Signed-off-by: Pierre-Louis Bossart Reviewed-by: P=C3=A9ter Ujfalusi Link: https://lore.kernel.org/r/20220517172647.468244-3-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/codecs/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 156f2519459d..3dea20b2c405 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -1212,7 +1212,6 @@ config SND_SOC_RT1015 =20 config SND_SOC_RT1015P tristate - depends on GPIOLIB =20 config SND_SOC_RT1019 tristate --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DF75C43334 for ; Tue, 7 Jun 2022 22:19:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357975AbiFGWTa (ORCPT ); Tue, 7 Jun 2022 18:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378852AbiFGVNr (ORCPT ); Tue, 7 Jun 2022 17:13:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D21F152D8F; Tue, 7 Jun 2022 11:54:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D74F61277; Tue, 7 Jun 2022 18:54:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AE98C385A5; Tue, 7 Jun 2022 18:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628063; bh=DEoc8i7aPgstshbzPGcR3ZykmcCRzy2UNNk8exG0MWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eZL5A55d34p77nl+lT9otwQREfWZ52xiqtlOgb90mPS3vfjL4VqrOekl73jRxuxoQ 9ZR6MnKdkQ7TLhvAUF4NG9PSewEkTiJus0gfY2jv19qFzl9MMLkEDMuyoge5CA+gUF xEjvzDTrURSCi5bYKgSjBqAnfny2ZJVeyOJC51Y0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre Gondois , Sudeep Holla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 191/879] ACPI: CPPC: Assume no transition latency if no PCCT Date: Tue, 7 Jun 2022 18:55:09 +0200 Message-Id: <20220607165008.385335751@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre Gondois [ Upstream commit 6380b7b2b29da9d9c5ab2d4a265901cd93ba3696 ] The transition_delay_us (struct cpufreq_policy) is currently defined as: Preferred average time interval between consecutive invocations of the driver to set the frequency for this policy. To be set by the scaling driver (0, which is the default, means no preference). The transition_latency represents the amount of time necessary for a CPU to change its frequency. A PCCT table advertises mutliple values: - pcc_nominal: Expected latency to process a command, in microseconds - pcc_mpar: The maximum number of periodic requests that the subspace channel can support, reported in commands per minute. 0 indicates no limitation. - pcc_mrtt: The minimum amount of time that OSPM must wait after the completion of a command before issuing the next command, in microseconds. cppc_get_transition_latency() allows to get the max of them. commit d4f3388afd48 ("cpufreq / CPPC: Set platform specific transition_delay_us") allows to select transition_delay_us based on the platform, and fallbacks to cppc_get_transition_latency() otherwise. If _CPC objects are not using PCC channels (no PPCT table), the transition_delay_us is set to CPUFREQ_ETERNAL, leading to really long periods between frequency updates (~4s). If the desired_reg, where performance requests are written, is in SystemMemory or SystemIo ACPI address space, there is no delay in requests. So return 0 instead of CPUFREQ_ETERNAL, leading to transition_delay_us being set to LATENCY_MULTIPLIER us (1000 us). This patch also adds two macros to check the address spaces. Signed-off-by: Pierre Gondois Reviewed-by: Sudeep Holla Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/acpi/cppc_acpi.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index bc1454789a06..34576ab0e2e1 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -100,6 +100,16 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr); (cpc)->cpc_entry.reg.space_id =3D=3D \ ACPI_ADR_SPACE_PLATFORM_COMM) =20 +/* Check if a CPC register is in SystemMemory */ +#define CPC_IN_SYSTEM_MEMORY(cpc) ((cpc)->type =3D=3D ACPI_TYPE_BUFFER && \ + (cpc)->cpc_entry.reg.space_id =3D=3D \ + ACPI_ADR_SPACE_SYSTEM_MEMORY) + +/* Check if a CPC register is in SystemIo */ +#define CPC_IN_SYSTEM_IO(cpc) ((cpc)->type =3D=3D ACPI_TYPE_BUFFER && \ + (cpc)->cpc_entry.reg.space_id =3D=3D \ + ACPI_ADR_SPACE_SYSTEM_IO) + /* Evaluates to True if reg is a NULL register descriptor */ #define IS_NULL_REG(reg) ((reg)->space_id =3D=3D ACPI_ADR_SPACE_SYSTEM_ME= MORY && \ (reg)->address =3D=3D 0 && \ @@ -1447,6 +1457,9 @@ EXPORT_SYMBOL_GPL(cppc_set_perf); * transition latency for performance change requests. The closest we have * is the timing information from the PCCT tables which provides the info * on the number and frequency of PCC commands the platform can handle. + * + * If desired_reg is in the SystemMemory or SystemIo ACPI address space, + * then assume there is no latency. */ unsigned int cppc_get_transition_latency(int cpu_num) { @@ -1472,7 +1485,9 @@ unsigned int cppc_get_transition_latency(int cpu_num) return CPUFREQ_ETERNAL; =20 desired_reg =3D &cpc_desc->cpc_regs[DESIRED_PERF]; - if (!CPC_IN_PCC(desired_reg)) + if (CPC_IN_SYSTEM_MEMORY(desired_reg) || CPC_IN_SYSTEM_IO(desired_reg)) + return 0; + else if (!CPC_IN_PCC(desired_reg)) return CPUFREQ_ETERNAL; =20 if (pcc_ss_id < 0) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABAA5C43334 for ; Tue, 7 Jun 2022 22:19:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381910AbiFGWTh (ORCPT ); Tue, 7 Jun 2022 18:19:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346961AbiFGVNr (ORCPT ); Tue, 7 Jun 2022 17:13:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55FE121AC46; Tue, 7 Jun 2022 11:54:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A8077B82018; Tue, 7 Jun 2022 18:54:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19785C385A5; Tue, 7 Jun 2022 18:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628066; bh=q3LpIfPSwOGe/mvSWUmd9l5vhrYfQkqCQRcFEYW08qE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v4z/K2928vMxMevcc+2G6zT+bjnLBhNCx/rz67Xcy1zlulZoY/geWqQ+zHkVrR/ND RNxAVj9G28/DFrCIets1+nX7B6FH9Hbu8q65/0jg+KYAycqeCGbE6gBRelzmU2W7Do bKIM6Zbg2tLK7jjC6xMSyRCzlopH5I4n0HmD/IZk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chaitanya Kulkarni , Keith Busch , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.18 192/879] nvme: set non-mdts limits in nvme_scan_work Date: Tue, 7 Jun 2022 18:55:10 +0200 Message-Id: <20220607165008.414623997@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chaitanya Kulkarni [ Upstream commit 78288665b5d0154978fed431985310cb4f166836 ] In current implementation we set the non-mdts limits by calling nvme_init_non_mdts_limits() from nvme_init_ctrl_finish(). This also tries to set the limits for the discovery controller which has no I/O queues resulting in the warning message reported by the nvme_log_error() when running blktest nvme/002: - [ 2005.155946] run blktests nvme/002 at 2022-04-09 16:57:47 [ 2005.192223] loop: module loaded [ 2005.196429] nvmet: adding nsid 1 to subsystem blktests-subsystem-0 [ 2005.200334] nvmet: adding nsid 1 to subsystem blktests-subsystem-1 <------------------------------SNIP----------------------------------> [ 2008.958108] nvmet: adding nsid 1 to subsystem blktests-subsystem-997 [ 2008.962082] nvmet: adding nsid 1 to subsystem blktests-subsystem-998 [ 2008.966102] nvmet: adding nsid 1 to subsystem blktests-subsystem-999 [ 2008.973132] nvmet: creating discovery controller 1 for subsystem nqn.201= 4-08.org.nvmexpress.discovery for NQN testhostnqn. *[ 2008.973196] nvme1: Identify(0x6), Invalid Field in Command (sct 0x0 / s= c 0x2) MORE DNR* [ 2008.974595] nvme nvme1: new ctrl: "nqn.2014-08.org.nvmexpress.discovery" [ 2009.103248] nvme nvme1: Removing ctrl: NQN "nqn.2014-08.org.nvmexpress.d= iscovery" Move the call of nvme_init_non_mdts_limits() to nvme_scan_work() after we verify that I/O queues are created since that is a converging point for each transport where these limits are actually used. 1. FC : nvme_fc_create_association() ... nvme_fc_create_io_queues(ctrl); ... nvme_start_ctrl() nvme_scan_queue() nvme_scan_work() 2. PCIe:- nvme_reset_work() ... nvme_setup_io_queues() nvme_create_io_queues() nvme_alloc_queue() ... nvme_start_ctrl() nvme_scan_queue() nvme_scan_work() 3. RDMA :- nvme_rdma_setup_ctrl ... nvme_rdma_configure_io_queues ... nvme_start_ctrl() nvme_scan_queue() nvme_scan_work() 4. TCP :- nvme_tcp_setup_ctrl ... nvme_tcp_configure_io_queues ... nvme_start_ctrl() nvme_scan_queue() nvme_scan_work() * nvme_scan_work() ... nvme_validate_or_alloc_ns() nvme_alloc_ns() nvme_update_ns_info() nvme_update_disk_info() nvme_config_discard() <--- blk_queue_max_write_zeroes_sectors() <--- Signed-off-by: Chaitanya Kulkarni Reviewed-by: Keith Busch Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/nvme/host/core.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index e1846d04817f..ac32d1cd8477 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -3080,10 +3080,6 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl) if (ret) return ret; =20 - ret =3D nvme_init_non_mdts_limits(ctrl); - if (ret < 0) - return ret; - ret =3D nvme_configure_apst(ctrl); if (ret < 0) return ret; @@ -4237,11 +4233,26 @@ static void nvme_scan_work(struct work_struct *work) { struct nvme_ctrl *ctrl =3D container_of(work, struct nvme_ctrl, scan_work); + int ret; =20 /* No tagset on a live ctrl means IO queues could not created */ if (ctrl->state !=3D NVME_CTRL_LIVE || !ctrl->tagset) return; =20 + /* + * Identify controller limits can change at controller reset due to + * new firmware download, even though it is not common we cannot ignore + * such scenario. Controller's non-mdts limits are reported in the unit + * of logical blocks that is dependent on the format of attached + * namespace. Hence re-read the limits at the time of ns allocation. + */ + ret =3D nvme_init_non_mdts_limits(ctrl); + if (ret < 0) { + dev_warn(ctrl->device, + "reading non-mdts-limits failed: %d\n", ret); + return; + } + if (test_and_clear_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events)) { dev_info(ctrl->device, "rescanning namespaces.\n"); nvme_clear_changed_ns_log(ctrl); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17A21C433EF for ; Tue, 7 Jun 2022 22:19:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381695AbiFGWTs (ORCPT ); Tue, 7 Jun 2022 18:19:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379858AbiFGVN5 (ORCPT ); Tue, 7 Jun 2022 17:13:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5059821AC59; Tue, 7 Jun 2022 11:54: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 93BA2B8239E; Tue, 7 Jun 2022 18:54:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC428C36B0F; Tue, 7 Jun 2022 18:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628069; bh=8gQNAltN6BIULDhgTdmaQHw+k3XtzpJbkUP7TqeHUWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YcIOiwzRj7woc6EZxFIe7MzNnsJCaKNkiz1qej11JpfPXbuFUJdDhFGRZVbSGcf1R xS8ufHYJoUbKjshu8nxuINkpHWVqdfQ/uYt44LFv+Gr4mYFpv15fVoiZ7dm1Uw4vob xGHth16cDxpuz3pn7RH98yD8MgYKdqQnGD2UwPTw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , kernel test robot , Marc Kleine-Budde , Sasha Levin , Nathan Chancellor Subject: [PATCH 5.18 193/879] can: mcp251xfd: silence clangs -Wunaligned-access warning Date: Tue, 7 Jun 2022 18:55:11 +0200 Message-Id: <20220607165008.444219311@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Mailhol [ Upstream commit 1a6dd9996699889313327be03981716a8337656b ] clang emits a -Wunaligned-access warning on union mcp251xfd_tx_ojb_load_buf. The reason is that field hw_tx_obj (not declared as packed) is being packed right after a 16 bits field inside a packed struct: | union mcp251xfd_tx_obj_load_buf { | struct __packed { | struct mcp251xfd_buf_cmd cmd; | /* ^ 16 bits fields */ | struct mcp251xfd_hw_tx_obj_raw hw_tx_obj; | /* ^ not declared as packed */ | } nocrc; | struct __packed { | struct mcp251xfd_buf_cmd_crc cmd; | struct mcp251xfd_hw_tx_obj_raw hw_tx_obj; | __be16 crc; | } crc; | } ____cacheline_aligned; Starting from LLVM 14, having an unpacked struct nested in a packed struct triggers a warning. c.f. [1]. This is a false positive because the field is always being accessed with the relevant put_unaligned_*() function. Adding __packed to the structure declaration silences the warning. [1] https://github.com/llvm/llvm-project/issues/55520 Link: https://lore.kernel.org/all/20220518114357.55452-1-mailhol.vincent@wa= nadoo.fr Signed-off-by: Vincent Mailhol Reported-by: kernel test robot Tested-by: Nathan Chancellor # build Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h b/drivers/net/can/sp= i/mcp251xfd/mcp251xfd.h index 9cb6b5ad8dda..60e56fa4601d 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h @@ -441,7 +441,7 @@ struct mcp251xfd_hw_tef_obj { /* The tx_obj_raw version is used in spi async, i.e. without * regmap. We have to take care of endianness ourselves. */ -struct mcp251xfd_hw_tx_obj_raw { +struct __packed mcp251xfd_hw_tx_obj_raw { __le32 id; __le32 flags; u8 data[sizeof_field(struct canfd_frame, data)]; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E8D1C433EF for ; Tue, 7 Jun 2022 22:22:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351264AbiFGWWk (ORCPT ); Tue, 7 Jun 2022 18:22:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380733AbiFGVQz (ORCPT ); Tue, 7 Jun 2022 17:16: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 E1A4021F9D1; Tue, 7 Jun 2022 11:56:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8A08361794; Tue, 7 Jun 2022 18:56:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 977AFC34115; Tue, 7 Jun 2022 18:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628208; bh=zyZ5vI2l/3gg/uoWaooDfVMf9ohSXQs2r2KPinSGMqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XGexz/Dls+vwtvO4td/b5pV7xysWxXOk9dcLeDxNdam0RMxo/D98OLFpDCI7Q7ll3 OEKlldn0k50M3VbrLDquWJSeRtKu9C+p0Wfbma5uw4HdbKolZHsiXUmB+RSuQwc76t ZScs/nEqDVFNYmtGbiPpqITBpcbSC/Y4TaIHaGBg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Borislav Petkov , Sasha Levin Subject: [PATCH 5.18 194/879] x86/microcode: Add explicit CPU vendor dependency Date: Tue, 7 Jun 2022 18:55:12 +0200 Message-Id: <20220607165008.474137652@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Borislav Petkov [ Upstream commit 9c55d99e099bd7aa6b91fce8718505c35d5dfc65 ] Add an explicit dependency to the respective CPU vendor so that the respective microcode support for it gets built only when that support is enabled. Reported-by: Randy Dunlap Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/8ead0da9-9545-b10d-e3db-7df1a1f219e4@infrad= ead.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/x86/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 4bed3abf444d..b2c65f573353 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1313,7 +1313,7 @@ config MICROCODE =20 config MICROCODE_INTEL bool "Intel microcode loading support" - depends on MICROCODE + depends on CPU_SUP_INTEL && MICROCODE default MICROCODE help This options enables microcode patch loading support for Intel @@ -1325,7 +1325,7 @@ config MICROCODE_INTEL =20 config MICROCODE_AMD bool "AMD microcode loading support" - depends on MICROCODE + depends on CPU_SUP_AMD && MICROCODE help If you select this option, microcode patch loading support for AMD processors will be enabled. --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A11DCCCA482 for ; Tue, 7 Jun 2022 22:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384496AbiFGWUd (ORCPT ); Tue, 7 Jun 2022 18:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380242AbiFGVP4 (ORCPT ); Tue, 7 Jun 2022 17:15:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EF8D158757; Tue, 7 Jun 2022 11:54:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3D685617A0; Tue, 7 Jun 2022 18:54:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 499C9C385A2; Tue, 7 Jun 2022 18:54:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628088; bh=Kp8VJzKJlpWZkHGsD8IDe+JQQwNyAiTWjYeGgo66Je0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vNMCLshvimHvtI4NzsoRR/euyfOaUvsZ3YbFY5BFfOBJiq90fQ7pPqNFkuR+bcfwo GU+2Qx5ToTgHnUrxbo0gPsoikhGJVMGlftQvRvSCDtWEHOF8H6rWUSeLoMhEeWLjcu f63icdywshcO3ELde8GPkRK1TgYiq505ozyERxw0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Elder , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 195/879] net: ipa: ignore endianness if there is no header Date: Tue, 7 Jun 2022 18:55:13 +0200 Message-Id: <20220607165008.504526030@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Elder [ Upstream commit 332ef7c814bdd60f08d0d9013d0e1104798b2d23 ] If we program an RX endpoint to have no header (header length is 0), header-related endpoint configuration values are meaningless and are ignored. The only case we support that defines a header is QMAP endpoints. In ipa_endpoint_init_hdr_ext() we set the endianness mask value unconditionally, but it should not be done if there is no header (meaning it is not configured for QMAP). Set the endianness conditionally, and rearrange the logic in that function slightly to avoid testing the qmap flag twice. Delete an incorrect comment in ipa_endpoint_init_aggr(). Signed-off-by: Alex Elder Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ipa/ipa_endpoint.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 53764f3c0c7e..55322800ba58 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -587,19 +587,23 @@ static void ipa_endpoint_init_hdr_ext(struct ipa_endp= oint *endpoint) struct ipa *ipa =3D endpoint->ipa; u32 val =3D 0; =20 - val |=3D HDR_ENDIANNESS_FMASK; /* big endian */ - - /* A QMAP header contains a 6 bit pad field at offset 0. The RMNet - * driver assumes this field is meaningful in packets it receives, - * and assumes the header's payload length includes that padding. - * The RMNet driver does *not* pad packets it sends, however, so - * the pad field (although 0) should be ignored. - */ - if (endpoint->data->qmap && !endpoint->toward_ipa) { - val |=3D HDR_TOTAL_LEN_OR_PAD_VALID_FMASK; - /* HDR_TOTAL_LEN_OR_PAD is 0 (pad, not total_len) */ - val |=3D HDR_PAYLOAD_LEN_INC_PADDING_FMASK; - /* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0 */ + if (endpoint->data->qmap) { + /* We have a header, so we must specify its endianness */ + val |=3D HDR_ENDIANNESS_FMASK; /* big endian */ + + /* A QMAP header contains a 6 bit pad field at offset 0. + * The RMNet driver assumes this field is meaningful in + * packets it receives, and assumes the header's payload + * length includes that padding. The RMNet driver does + * *not* pad packets it sends, however, so the pad field + * (although 0) should be ignored. + */ + if (!endpoint->toward_ipa) { + val |=3D HDR_TOTAL_LEN_OR_PAD_VALID_FMASK; + /* HDR_TOTAL_LEN_OR_PAD is 0 (pad, not total_len) */ + val |=3D HDR_PAYLOAD_LEN_INC_PADDING_FMASK; + /* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0 */ + } } =20 /* HDR_PAYLOAD_LEN_INC_PADDING is 0 */ @@ -759,8 +763,6 @@ static void ipa_endpoint_init_aggr(struct ipa_endpoint = *endpoint) =20 close_eof =3D rx_data->aggr_close_eof; val |=3D aggr_sw_eof_active_encoded(version, close_eof); - - /* AGGR_HARD_BYTE_LIMIT_ENABLE is 0 */ } else { val |=3D u32_encode_bits(IPA_ENABLE_DEAGGR, AGGR_EN_FMASK); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34EBACCA488 for ; Tue, 7 Jun 2022 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385153AbiFGWVL (ORCPT ); Tue, 7 Jun 2022 18:21:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380530AbiFGVQ0 (ORCPT ); Tue, 7 Jun 2022 17:16:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBDAA21D49E; Tue, 7 Jun 2022 11:55:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C7DDA61311; Tue, 7 Jun 2022 18:55:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EAF1C385A2; Tue, 7 Jun 2022 18:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628119; bh=ogyjMyihZQAL3OGvTEq7dTUDoOlDFa9mgae1624z+fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eGN1FEcH9s+pyjYoRp58H6naqi8zXxKFI25bXILOqlEH80xr9osq8fgPXxstToQwF vK6wNJFgYlmZwzvKAdM7FNln7E8Lgb9qh+kjTe8L9SWenjvb0Oy4DO24mFeqBWQKML +1kecucVVyUGfcEllOiSAm8tFUJ8kcz7BSiF6gVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yuntao Wang , Andrii Nakryiko , Yonghong Song , Sasha Levin Subject: [PATCH 5.18 196/879] selftests/bpf: Add missing trampoline program type to trampoline_count test Date: Tue, 7 Jun 2022 18:55:14 +0200 Message-Id: <20220607165008.534939978@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yuntao Wang [ Upstream commit b23316aabffa835ecc516cb81daeef5b9155e8a5 ] Currently the trampoline_count test doesn't include any fmod_ret bpf programs, fix it to make the test cover all possible trampoline program types. Since fmod_ret bpf programs can't be attached to __set_task_comm function, as it's neither whitelisted for error injection nor a security hook, change it to bpf_modify_return_test. This patch also does some other cleanups such as removing duplicate code, dropping inconsistent comments, etc. Signed-off-by: Yuntao Wang Signed-off-by: Andrii Nakryiko Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20220519150610.601313-1-ytcoode@gmail.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/linux/bpf.h | 2 +- .../bpf/prog_tests/trampoline_count.c | 134 +++++++----------- .../bpf/progs/test_trampoline_count.c | 16 ++- 3 files changed, 61 insertions(+), 91 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index bdb5298735ce..f084b251fce7 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -672,7 +672,7 @@ struct btf_func_model { #define BPF_TRAMP_F_RET_FENTRY_RET BIT(4) =20 /* Each call __bpf_prog_enter + call bpf_func + call __bpf_prog_exit is ~50 - * bytes on x86. Pick a number to fit into BPF_IMAGE_SIZE / 2 + * bytes on x86. */ #define BPF_MAX_TRAMP_PROGS 38 =20 diff --git a/tools/testing/selftests/bpf/prog_tests/trampoline_count.c b/to= ols/testing/selftests/bpf/prog_tests/trampoline_count.c index 9c795ee52b7b..b0acbda6dbf5 100644 --- a/tools/testing/selftests/bpf/prog_tests/trampoline_count.c +++ b/tools/testing/selftests/bpf/prog_tests/trampoline_count.c @@ -1,126 +1,94 @@ // SPDX-License-Identifier: GPL-2.0-only #define _GNU_SOURCE -#include -#include #include =20 #define MAX_TRAMP_PROGS 38 =20 struct inst { struct bpf_object *obj; - struct bpf_link *link_fentry; - struct bpf_link *link_fexit; + struct bpf_link *link; }; =20 -static int test_task_rename(void) -{ - int fd, duration =3D 0, err; - char buf[] =3D "test_overhead"; - - fd =3D open("/proc/self/comm", O_WRONLY|O_TRUNC); - if (CHECK(fd < 0, "open /proc", "err %d", errno)) - return -1; - err =3D write(fd, buf, sizeof(buf)); - if (err < 0) { - CHECK(err < 0, "task rename", "err %d", errno); - close(fd); - return -1; - } - close(fd); - return 0; -} - -static struct bpf_link *load(struct bpf_object *obj, const char *name) +static struct bpf_program *load_prog(char *file, char *name, struct inst *= inst) { + struct bpf_object *obj; struct bpf_program *prog; - int duration =3D 0; + int err; + + obj =3D bpf_object__open_file(file, NULL); + if (!ASSERT_OK_PTR(obj, "obj_open_file")) + return NULL; + + inst->obj =3D obj; + + err =3D bpf_object__load(obj); + if (!ASSERT_OK(err, "obj_load")) + return NULL; =20 prog =3D bpf_object__find_program_by_name(obj, name); - if (CHECK(!prog, "find_probe", "prog '%s' not found\n", name)) - return ERR_PTR(-EINVAL); - return bpf_program__attach_trace(prog); + if (!ASSERT_OK_PTR(prog, "obj_find_prog")) + return NULL; + + return prog; } =20 /* TODO: use different target function to run in concurrent mode */ void serial_test_trampoline_count(void) { - const char *fentry_name =3D "prog1"; - const char *fexit_name =3D "prog2"; - const char *object =3D "test_trampoline_count.o"; - struct inst inst[MAX_TRAMP_PROGS] =3D {}; - int err, i =3D 0, duration =3D 0; - struct bpf_object *obj; + char *file =3D "test_trampoline_count.o"; + char *const progs[] =3D { "fentry_test", "fmod_ret_test", "fexit_test" }; + struct inst inst[MAX_TRAMP_PROGS + 1] =3D {}; + struct bpf_program *prog; struct bpf_link *link; - char comm[16] =3D {}; + int prog_fd, err, i; + LIBBPF_OPTS(bpf_test_run_opts, opts); =20 /* attach 'allowed' trampoline programs */ for (i =3D 0; i < MAX_TRAMP_PROGS; i++) { - obj =3D bpf_object__open_file(object, NULL); - if (!ASSERT_OK_PTR(obj, "obj_open_file")) { - obj =3D NULL; + prog =3D load_prog(file, progs[i % ARRAY_SIZE(progs)], &inst[i]); + if (!prog) goto cleanup; - } =20 - err =3D bpf_object__load(obj); - if (CHECK(err, "obj_load", "err %d\n", err)) + link =3D bpf_program__attach(prog); + if (!ASSERT_OK_PTR(link, "attach_prog")) goto cleanup; - inst[i].obj =3D obj; - obj =3D NULL; - - if (rand() % 2) { - link =3D load(inst[i].obj, fentry_name); - if (!ASSERT_OK_PTR(link, "attach_prog")) { - link =3D NULL; - goto cleanup; - } - inst[i].link_fentry =3D link; - } else { - link =3D load(inst[i].obj, fexit_name); - if (!ASSERT_OK_PTR(link, "attach_prog")) { - link =3D NULL; - goto cleanup; - } - inst[i].link_fexit =3D link; - } + + inst[i].link =3D link; } =20 /* and try 1 extra.. */ - obj =3D bpf_object__open_file(object, NULL); - if (!ASSERT_OK_PTR(obj, "obj_open_file")) { - obj =3D NULL; + prog =3D load_prog(file, "fmod_ret_test", &inst[i]); + if (!prog) goto cleanup; - } - - err =3D bpf_object__load(obj); - if (CHECK(err, "obj_load", "err %d\n", err)) - goto cleanup_extra; =20 /* ..that needs to fail */ - link =3D load(obj, fentry_name); - err =3D libbpf_get_error(link); - if (!ASSERT_ERR_PTR(link, "cannot attach over the limit")) { - bpf_link__destroy(link); - goto cleanup_extra; + link =3D bpf_program__attach(prog); + if (!ASSERT_ERR_PTR(link, "attach_prog")) { + inst[i].link =3D link; + goto cleanup; } =20 /* with E2BIG error */ - ASSERT_EQ(err, -E2BIG, "proper error check"); - ASSERT_EQ(link, NULL, "ptr_is_null"); + if (!ASSERT_EQ(libbpf_get_error(link), -E2BIG, "E2BIG")) + goto cleanup; + if (!ASSERT_EQ(link, NULL, "ptr_is_null")) + goto cleanup; =20 /* and finaly execute the probe */ - if (CHECK_FAIL(prctl(PR_GET_NAME, comm, 0L, 0L, 0L))) - goto cleanup_extra; - CHECK_FAIL(test_task_rename()); - CHECK_FAIL(prctl(PR_SET_NAME, comm, 0L, 0L, 0L)); + prog_fd =3D bpf_program__fd(prog); + if (!ASSERT_GE(prog_fd, 0, "bpf_program__fd")) + goto cleanup; + + err =3D bpf_prog_test_run_opts(prog_fd, &opts); + if (!ASSERT_OK(err, "bpf_prog_test_run_opts")) + goto cleanup; + + ASSERT_EQ(opts.retval & 0xffff, 4, "bpf_modify_return_test.result"); + ASSERT_EQ(opts.retval >> 16, 1, "bpf_modify_return_test.side_effect"); =20 -cleanup_extra: - bpf_object__close(obj); cleanup: - if (i >=3D MAX_TRAMP_PROGS) - i =3D MAX_TRAMP_PROGS - 1; for (; i >=3D 0; i--) { - bpf_link__destroy(inst[i].link_fentry); - bpf_link__destroy(inst[i].link_fexit); + bpf_link__destroy(inst[i].link); bpf_object__close(inst[i].obj); } } diff --git a/tools/testing/selftests/bpf/progs/test_trampoline_count.c b/to= ols/testing/selftests/bpf/progs/test_trampoline_count.c index f030e469d05b..7765720da7d5 100644 --- a/tools/testing/selftests/bpf/progs/test_trampoline_count.c +++ b/tools/testing/selftests/bpf/progs/test_trampoline_count.c @@ -1,20 +1,22 @@ // SPDX-License-Identifier: GPL-2.0 -#include -#include #include #include #include =20 -struct task_struct; +SEC("fentry/bpf_modify_return_test") +int BPF_PROG(fentry_test, int a, int *b) +{ + return 0; +} =20 -SEC("fentry/__set_task_comm") -int BPF_PROG(prog1, struct task_struct *tsk, const char *buf, bool exec) +SEC("fmod_ret/bpf_modify_return_test") +int BPF_PROG(fmod_ret_test, int a, int *b, int ret) { return 0; } =20 -SEC("fexit/__set_task_comm") -int BPF_PROG(prog2, struct task_struct *tsk, const char *buf, bool exec) +SEC("fexit/bpf_modify_return_test") +int BPF_PROG(fexit_test, int a, int *b, int ret) { return 0; } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CFF8CCA47C for ; Tue, 7 Jun 2022 22:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380586AbiFGWVo (ORCPT ); Tue, 7 Jun 2022 18:21:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380649AbiFGVQj (ORCPT ); Tue, 7 Jun 2022 17:16:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1879121E33A; Tue, 7 Jun 2022 11:55:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 83E54612F2; Tue, 7 Jun 2022 18:55:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EF97C385A2; Tue, 7 Jun 2022 18:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628149; bh=y268Ia38mDcy8oVClEGS/uTeQtbK8P1DKzIAcwjQsRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rzivVUY6q9beKvbYIXZUZ/W73yaojkfvLU0UeooZX0DpJ/d0Sp1pMrPt2a80693XZ Si6/hun00ZaFjr4jjq/48yIg3SqWOYZfMu0ZAfzEQazSqS2x+XiCBZFdb8ujG5QkpZ WeqxduSyVdKM+4tcDmAVkyBJSM5G6eWY6xuBEtv4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Guenter Roeck , Geert Uytterhoeven , Michael Schmitz , Sasha Levin Subject: [PATCH 5.18 197/879] m68k: atari: Make Atari ROM port I/O write macros return void Date: Tue, 7 Jun 2022 18:55:15 +0200 Message-Id: <20220607165008.563891016@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit 30b5e6ef4a32ea4985b99200e06d6660a69f9246 ] The macros implementing Atari ROM port I/O writes do not cast away their output, unlike similar implementations for other I/O buses. When they are combined using conditional expressions in the definitions of outb() and friends, this triggers sparse warnings like: drivers/net/appletalk/cops.c:382:17: error: incompatible types in condi= tional expression (different base types): drivers/net/appletalk/cops.c:382:17: unsigned char drivers/net/appletalk/cops.c:382:17: void Fix this by adding casts to "void". Reported-by: kernel test robot Reported-by: Guenter Roeck Signed-off-by: Geert Uytterhoeven Reviewed-by: Guenter Roeck Reviewed-by: Michael Schmitz Link: https://lore.kernel.org/r/c15bedc83d90a14fffcd5b1b6bfb32b8a80282c5.16= 53057096.git.geert@linux-m68k.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/m68k/include/asm/raw_io.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/m68k/include/asm/raw_io.h b/arch/m68k/include/asm/raw_io.h index 80eb2396d01e..3ba40bc1dfaa 100644 --- a/arch/m68k/include/asm/raw_io.h +++ b/arch/m68k/include/asm/raw_io.h @@ -80,14 +80,14 @@ ({ u16 __v =3D le16_to_cpu(*(__force volatile u16 *) (addr)); __v; }) =20 #define rom_out_8(addr, b) \ - ({u8 __maybe_unused __w, __v =3D (b); u32 _addr =3D ((u32) (addr)); \ + (void)({u8 __maybe_unused __w, __v =3D (b); u32 _addr =3D ((u32) (addr))= ; \ __w =3D ((*(__force volatile u8 *) ((_addr | 0x10000) + (__v<<1)))); }) #define rom_out_be16(addr, w) \ - ({u16 __maybe_unused __w, __v =3D (w); u32 _addr =3D ((u32) (addr)); \ + (void)({u16 __maybe_unused __w, __v =3D (w); u32 _addr =3D ((u32) (addr))= ; \ __w =3D ((*(__force volatile u16 *) ((_addr & 0xFFFF0000UL) + ((__v & 0xF= F)<<1)))); \ __w =3D ((*(__force volatile u16 *) ((_addr | 0x10000) + ((__v >> 8)<<1))= )); }) #define rom_out_le16(addr, w) \ - ({u16 __maybe_unused __w, __v =3D (w); u32 _addr =3D ((u32) (addr)); \ + (void)({u16 __maybe_unused __w, __v =3D (w); u32 _addr =3D ((u32) (addr))= ; \ __w =3D ((*(__force volatile u16 *) ((_addr & 0xFFFF0000UL) + ((__v >> 8)= <<1)))); \ __w =3D ((*(__force volatile u16 *) ((_addr | 0x10000) + ((__v & 0xFF)<<1= )))); }) =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B2E9CCA487 for ; Tue, 7 Jun 2022 22:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385437AbiFGWb3 (ORCPT ); Tue, 7 Jun 2022 18:31:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380699AbiFGVQl (ORCPT ); Tue, 7 Jun 2022 17:16:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60FFC14AF5D; Tue, 7 Jun 2022 11:56:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F05A061578; Tue, 7 Jun 2022 18:56:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C0E2C385A2; Tue, 7 Jun 2022 18:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628180; bh=jwx+vf2s8FhK15e9dVjLvjTG6LGBGKIc0EVLYugk9P8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BVKxFZwR5G7ZziiK8D9dmWTdVFZYGLcPlCHom5dGzEq2At8yzcmbcG6pxxtix/wis a/pPGD/owkwOPCYrZDMbSVcOMw62qEj0nC+CCa4zXDuLbkQgBlGzQAKBZ9pfrQGVqH AcRNaUXH134BTbcr5QO+jWdzNEWUmgwG0WtkTaRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?M=C3=A5rten=20Lindahl?= , Guenter Roeck , Sasha Levin Subject: [PATCH 5.18 198/879] hwmon: (pmbus) Add get_voltage/set_voltage ops Date: Tue, 7 Jun 2022 18:55:16 +0200 Message-Id: <20220607165008.592697266@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: M=C3=A5rten Lindahl [ Upstream commit 28bf22ef93eceb42c7583f0909bc9dedc07770e3 ] The pmbus core does not have operations for getting or setting voltage. Add functions get/set voltage for the dynamic regulator framework. Signed-off-by: M=C3=A5rten Lindahl Link: https://lore.kernel.org/r/20220503104631.3515715-5-marten.lindahl@axi= s.com [groeck: cosmetic alignment / empty line fixes] Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/hwmon/pmbus/pmbus_core.c | 67 ++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_c= ore.c index d93574d6a1fb..5a1796650f5b 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -2548,11 +2548,78 @@ static int pmbus_regulator_get_error_flags(struct r= egulator_dev *rdev, unsigned return 0; } =20 +static int pmbus_regulator_get_voltage(struct regulator_dev *rdev) +{ + struct device *dev =3D rdev_get_dev(rdev); + struct i2c_client *client =3D to_i2c_client(dev->parent); + struct pmbus_data *data =3D i2c_get_clientdata(client); + struct pmbus_sensor s =3D { + .page =3D rdev_get_id(rdev), + .class =3D PSC_VOLTAGE_OUT, + .convert =3D true, + }; + + s.data =3D _pmbus_read_word_data(client, s.page, 0xff, PMBUS_READ_VOUT); + if (s.data < 0) + return s.data; + + return (int)pmbus_reg2data(data, &s) * 1000; /* unit is uV */ +} + +static int pmbus_regulator_set_voltage(struct regulator_dev *rdev, int min= _uv, + int max_uv, unsigned int *selector) +{ + struct device *dev =3D rdev_get_dev(rdev); + struct i2c_client *client =3D to_i2c_client(dev->parent); + struct pmbus_data *data =3D i2c_get_clientdata(client); + struct pmbus_sensor s =3D { + .page =3D rdev_get_id(rdev), + .class =3D PSC_VOLTAGE_OUT, + .convert =3D true, + .data =3D -1, + }; + int val =3D DIV_ROUND_CLOSEST(min_uv, 1000); /* convert to mV */ + int low, high; + + *selector =3D 0; + + if (pmbus_check_word_register(client, s.page, PMBUS_MFR_VOUT_MIN)) + s.data =3D _pmbus_read_word_data(client, s.page, 0xff, PMBUS_MFR_VOUT_MI= N); + if (s.data < 0) { + s.data =3D _pmbus_read_word_data(client, s.page, 0xff, PMBUS_VOUT_MARGIN= _LOW); + if (s.data < 0) + return s.data; + } + low =3D pmbus_reg2data(data, &s); + + s.data =3D -1; + if (pmbus_check_word_register(client, s.page, PMBUS_MFR_VOUT_MAX)) + s.data =3D _pmbus_read_word_data(client, s.page, 0xff, PMBUS_MFR_VOUT_MA= X); + if (s.data < 0) { + s.data =3D _pmbus_read_word_data(client, s.page, 0xff, PMBUS_VOUT_MARGIN= _HIGH); + if (s.data < 0) + return s.data; + } + high =3D pmbus_reg2data(data, &s); + + /* Make sure we are within margins */ + if (low > val) + val =3D low; + if (high < val) + val =3D high; + + val =3D pmbus_data2reg(data, &s, val); + + return _pmbus_write_word_data(client, s.page, PMBUS_VOUT_COMMAND, (u16)va= l); +} + const struct regulator_ops pmbus_regulator_ops =3D { .enable =3D pmbus_regulator_enable, .disable =3D pmbus_regulator_disable, .is_enabled =3D pmbus_regulator_is_enabled, .get_error_flags =3D pmbus_regulator_get_error_flags, + .get_voltage =3D pmbus_regulator_get_voltage, + .set_voltage =3D pmbus_regulator_set_voltage, }; EXPORT_SYMBOL_NS_GPL(pmbus_regulator_ops, PMBUS); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86474C43334 for ; Tue, 7 Jun 2022 22:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385067AbiFGW0S (ORCPT ); Tue, 7 Jun 2022 18:26:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380715AbiFGVQt (ORCPT ); Tue, 7 Jun 2022 17:16:49 -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 D561521F9C5; Tue, 7 Jun 2022 11:56:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 67C28B8220B; Tue, 7 Jun 2022 18:56:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C76CAC385A2; Tue, 7 Jun 2022 18:56:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628194; bh=s4KO1UgUY/B996K+l2DBDtuWNiu3YWMyS23OqCyZMqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dChu9tR9YvUg0HCi9mBz1PQnZyV4ubTVx9AqJRbaTtxUDVSnLsvQyUM8Mmgz20UoV 96r6Fq8xNZRKCCdbDs5ljk8QUt8Mme8rqz476eL1IOgzbA+t7ON51CqsbCR4Q8kOdU g6mc4rSn7R2QePEF9cVYIPTpXFMVAt2ulUFgbId4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Dionne , David Howells , linux-afs@lists.infradead.org, "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 199/879] rxrpc: Return an error to sendmsg if call failed Date: Tue, 7 Jun 2022 18:55:17 +0200 Message-Id: <20220607165008.621633343@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Howells [ Upstream commit 4ba68c5192554876bd8c3afd904e3064d2915341 ] If at the end of rxrpc sendmsg() or rxrpc_kernel_send_data() the call that was being given data was aborted remotely or otherwise failed, return an error rather than returning the amount of data buffered for transmission. The call (presumably) did not complete, so there's not much point continuing with it. AF_RXRPC considers it "complete" and so will be unwilling to do anything else with it - and won't send a notification for it, deeming the return from sendmsg sufficient. Not returning an error causes afs to incorrectly handle a StoreData operation that gets interrupted by a change of address due to NAT reconfiguration. This doesn't normally affect most operations since their request parameters tend to fit into a single UDP packet and afs_make_call() returns before the server responds; StoreData is different as it involves transmission of a lot of data. This can be triggered on a client by doing something like: dd if=3D/dev/zero of=3D/afs/example.com/foo bs=3D1M count=3D512 at one prompt, and then changing the network address at another prompt, e.g.: ifconfig enp6s0 inet 192.168.6.2 && route add 192.168.6.1 dev enp6s0 Tracing packets on an Auristor fileserver looks something like: 192.168.6.1 -> 192.168.6.3 RX 107 ACK Idle Seq: 0 Call: 4 Source Port: = 7000 Destination Port: 7001 192.168.6.3 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(64538) (64538) 192.168.6.3 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(64538) (64538) 192.168.6.1 -> 192.168.6.3 RX 107 ACK Idle Seq: 0 Call: 4 Source Port: = 7000 Destination Port: 7001 192.168.6.2 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(0) (0) 192.168.6.2 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(0) (0) 192.168.6.1 -> 192.168.6.2 RX 107 ACK Exceeds Window Seq: 0 Call: 4 Sou= rce Port: 7000 Destination Port: 7001 192.168.6.1 -> 192.168.6.2 RX 74 ABORT Seq: 0 Call: 4 Source Port: 7000= Destination Port: 7001 192.168.6.1 -> 192.168.6.2 RX 74 ABORT Seq: 29321 Call: 4 Source Port: = 7000 Destination Port: 7001 The Auristor fileserver logs code -453 (RXGEN_SS_UNMARSHAL), but the abort code received by kafs is -5 (RX_PROTOCOL_ERROR) as the rx layer sees the condition and generates an abort first and the unmarshal error is a consequence of that at the application layer. Reported-by: Marc Dionne Signed-off-by: David Howells cc: linux-afs@lists.infradead.org Link: http://lists.infradead.org/pipermail/linux-afs/2021-December/004810.h= tml # v1 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- net/rxrpc/sendmsg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c index af8ad6c30b9f..1d38e279e2ef 100644 --- a/net/rxrpc/sendmsg.c +++ b/net/rxrpc/sendmsg.c @@ -444,6 +444,12 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, =20 success: ret =3D copied; + if (READ_ONCE(call->state) =3D=3D RXRPC_CALL_COMPLETE) { + read_lock_bh(&call->state_lock); + if (call->error < 0) + ret =3D call->error; + read_unlock_bh(&call->state_lock); + } out: call->tx_pending =3D skb; _leave(" =3D %d", ret); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7AD1CCA486 for ; Tue, 7 Jun 2022 22:27:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384798AbiFGW0F (ORCPT ); Tue, 7 Jun 2022 18:26:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380718AbiFGVQv (ORCPT ); Tue, 7 Jun 2022 17:16:51 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F67821F9CC; Tue, 7 Jun 2022 11:56: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 sin.source.kernel.org (Postfix) with ESMTPS id A4AC9CE2475; Tue, 7 Jun 2022 18:56:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFF99C385A2; Tue, 7 Jun 2022 18:56:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628197; bh=UEtTKC+segok9K/ynO7AyNzCmnn7J3j6y8rLTN8HqF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pk/PxLu2Mn+tGF6e8h5QjD1zy/7vR5ffTYPl77ZimMuSd39TrC4wpnPHVbB9aPgUY c6LxQpPyPOGyUtkKHnt9U0cjlSlNu5UT2/WJOa/+N/MB5k7/huR1xsbHMLEShI13JM N/vLNPC4+mlg4JJd2UVrLVPI6Sj7i3+DCyR053zA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeffrey Altman , David Howells , Marc Dionne , linux-afs@lists.infradead.org, "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 200/879] rxrpc, afs: Fix selection of abort codes Date: Tue, 7 Jun 2022 18:55:18 +0200 Message-Id: <20220607165008.650924569@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Howells [ Upstream commit de696c4784f0706884458893c5a6c39b3a3ff65c ] The RX_USER_ABORT code should really only be used to indicate that the user of the rxrpc service (ie. userspace) implicitly caused a call to be aborted - for instance if the AF_RXRPC socket is closed whilst the call was in progress. (The user may also explicitly abort a call and specify the abort code to use). Change some of the points of generation to use other abort codes instead: (1) Abort the call with RXGEN_SS_UNMARSHAL or RXGEN_CC_UNMARSHAL if we see ENOMEM and EFAULT during received data delivery and abort with RX_CALL_DEAD in the default case. (2) Abort with RXGEN_SS_MARSHAL if we get ENOMEM whilst trying to send a reply. (3) Abort with RX_CALL_DEAD if we stop hearing from the peer if we had heard from the peer and abort with RX_CALL_TIMEOUT if we hadn't. (4) Abort with RX_CALL_DEAD if we try to disconnect a call that's not completed successfully or been aborted. Reported-by: Jeffrey Altman Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/afs/rxrpc.c | 8 +++++--- net/rxrpc/call_event.c | 4 ++-- net/rxrpc/conn_object.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c index 23a1a92d64bb..a5434f3e57c6 100644 --- a/fs/afs/rxrpc.c +++ b/fs/afs/rxrpc.c @@ -537,6 +537,8 @@ static void afs_deliver_to_call(struct afs_call *call) case -ENODATA: case -EBADMSG: case -EMSGSIZE: + case -ENOMEM: + case -EFAULT: abort_code =3D RXGEN_CC_UNMARSHAL; if (state !=3D AFS_CALL_CL_AWAIT_REPLY) abort_code =3D RXGEN_SS_UNMARSHAL; @@ -544,7 +546,7 @@ static void afs_deliver_to_call(struct afs_call *call) abort_code, ret, "KUM"); goto local_abort; default: - abort_code =3D RX_USER_ABORT; + abort_code =3D RX_CALL_DEAD; rxrpc_kernel_abort_call(call->net->socket, call->rxcall, abort_code, ret, "KER"); goto local_abort; @@ -836,7 +838,7 @@ void afs_send_empty_reply(struct afs_call *call) case -ENOMEM: _debug("oom"); rxrpc_kernel_abort_call(net->socket, call->rxcall, - RX_USER_ABORT, -ENOMEM, "KOO"); + RXGEN_SS_MARSHAL, -ENOMEM, "KOO"); fallthrough; default: _leave(" [error]"); @@ -878,7 +880,7 @@ void afs_send_simple_reply(struct afs_call *call, const= void *buf, size_t len) if (n =3D=3D -ENOMEM) { _debug("oom"); rxrpc_kernel_abort_call(net->socket, call->rxcall, - RX_USER_ABORT, -ENOMEM, "KOO"); + RXGEN_SS_MARSHAL, -ENOMEM, "KOO"); } _leave(" [error]"); } diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c index 22e05de5d1ca..e426f6831aab 100644 --- a/net/rxrpc/call_event.c +++ b/net/rxrpc/call_event.c @@ -377,9 +377,9 @@ void rxrpc_process_call(struct work_struct *work) if (test_bit(RXRPC_CALL_RX_HEARD, &call->flags) && (int)call->conn->hi_serial - (int)call->rx_serial > 0) { trace_rxrpc_call_reset(call); - rxrpc_abort_call("EXP", call, 0, RX_USER_ABORT, -ECONNRESET); + rxrpc_abort_call("EXP", call, 0, RX_CALL_DEAD, -ECONNRESET); } else { - rxrpc_abort_call("EXP", call, 0, RX_USER_ABORT, -ETIME); + rxrpc_abort_call("EXP", call, 0, RX_CALL_TIMEOUT, -ETIME); } set_bit(RXRPC_CALL_EV_ABORT, &call->events); goto recheck_state; diff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c index b2159dbf5412..660cd9b1a465 100644 --- a/net/rxrpc/conn_object.c +++ b/net/rxrpc/conn_object.c @@ -183,7 +183,7 @@ void __rxrpc_disconnect_call(struct rxrpc_connection *c= onn, chan->last_type =3D RXRPC_PACKET_TYPE_ABORT; break; default: - chan->last_abort =3D RX_USER_ABORT; + chan->last_abort =3D RX_CALL_DEAD; chan->last_type =3D RXRPC_PACKET_TYPE_ABORT; break; } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C6F5CCA486 for ; Tue, 7 Jun 2022 22:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384201AbiFGWbG (ORCPT ); Tue, 7 Jun 2022 18:31:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380726AbiFGVQy (ORCPT ); Tue, 7 Jun 2022 17:16:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC0621F9DA; Tue, 7 Jun 2022 11:56:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0550AB8220B; Tue, 7 Jun 2022 18:56:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70FDBC385A2; Tue, 7 Jun 2022 18:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628199; bh=gp+bAwgN/XkaIdPSbXzdr6VTyitKE+FeeuAK5qrBDUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e9dk1Mj5R8QxUGZJNV/N4Nqjax1CobtchnCn2ZbFcMWUuHjcV3P+yQamvKW0Dxa3I nnzGSG7hfU07ebRREBIuYCwMnS7tckPGm3GpdaYVFO58fBCoFBqY05ZOXR7xCXjUuW c1XtX78yUggaXmETfikydxF8Zr8+ecoI4+vVdat8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Dionne , David Howells , linux-afs@lists.infradead.org, "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 201/879] afs: Adjust ACK interpretation to try and cope with NAT Date: Tue, 7 Jun 2022 18:55:19 +0200 Message-Id: <20220607165008.679781368@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Howells [ Upstream commit adc9613ff66c26ebaff9814973181ac178beb90b ] If a client's address changes, say if it is NAT'd, this can disrupt an in progress operation. For most operations, this is not much of a problem, but StoreData can be different as some servers modify the target file as the data comes in, so if a store request is disrupted, the file can get corrupted on the server. The problem is that the server doesn't recognise packets that come after the change of address as belonging to the original client and will bounce them, either by sending an OUT_OF_SEQUENCE ACK to the apparent new call if the packet number falls within the initial sequence number window of a call or by sending an EXCEEDS_WINDOW ACK if it falls outside and then aborting it. In both cases, firstPacket will be 1 and previousPacket will be 0 in the ACK information. Fix this by the following means: (1) If a client call receives an EXCEEDS_WINDOW ACK with firstPacket as 1 and previousPacket as 0, assume this indicates that the server saw the incoming packets from a different peer and thus as a different call. Fail the call with error -ENETRESET. (2) Also fail the call if a similar OUT_OF_SEQUENCE ACK occurs if the first packet has been hard-ACK'd. If it hasn't been hard-ACK'd, the ACK packet will cause it to get retransmitted, so the call will just be repeated. (3) Make afs_select_fileserver() treat -ENETRESET as a straight fail of the operation. (4) Prioritise the error code over things like -ECONNRESET as the server did actually respond. (5) Make writeback treat -ENETRESET as a retryable error and make it redirty all the pages involved in a write so that the VM will retry. Note that there is still a circumstance that I can't easily deal with: if the operation is fully received and processed by the server, but the reply is lost due to address change. There's no way to know if the op happened. We can examine the server, but a conflicting change could have been made by a third party - and we can't tell the difference. In such a case, a message like: kAFS: vnode modified {100058:146266} b7->b8 YFS.StoreData64 (op=3D2646a) will be logged to dmesg on the next op to touch the file and the client will reset the inode state, including invalidating clean parts of the pagecache. Reported-by: Marc Dionne Signed-off-by: David Howells cc: linux-afs@lists.infradead.org Link: http://lists.infradead.org/pipermail/linux-afs/2021-December/004811.h= tml # v1 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/afs/misc.c | 5 ++++- fs/afs/rotate.c | 4 ++++ fs/afs/write.c | 1 + net/rxrpc/input.c | 27 +++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/fs/afs/misc.c b/fs/afs/misc.c index 1d1a8debe472..933e67fcdab1 100644 --- a/fs/afs/misc.c +++ b/fs/afs/misc.c @@ -163,8 +163,11 @@ void afs_prioritise_error(struct afs_error *e, int err= or, u32 abort_code) return; =20 case -ECONNABORTED: + error =3D afs_abort_to_error(abort_code); + fallthrough; + case -ENETRESET: /* Responded, but we seem to have changed address */ e->responded =3D true; - e->error =3D afs_abort_to_error(abort_code); + e->error =3D error; return; } } diff --git a/fs/afs/rotate.c b/fs/afs/rotate.c index 79e1a5f6701b..a840c3588ebb 100644 --- a/fs/afs/rotate.c +++ b/fs/afs/rotate.c @@ -292,6 +292,10 @@ bool afs_select_fileserver(struct afs_operation *op) op->error =3D error; goto iterate_address; =20 + case -ENETRESET: + pr_warn("kAFS: Peer reset %s (op=3D%x)\n", + op->type ? op->type->name : "???", op->debug_id); + fallthrough; case -ECONNRESET: _debug("call reset"); op->error =3D error; diff --git a/fs/afs/write.c b/fs/afs/write.c index 4763132ca57e..c1bc52ac7de1 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -636,6 +636,7 @@ static ssize_t afs_write_back_from_locked_folio(struct = address_space *mapping, case -EKEYEXPIRED: case -EKEYREJECTED: case -EKEYREVOKED: + case -ENETRESET: afs_redirty_pages(wbc, mapping, start, len); mapping_set_error(mapping, ret); break; diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c index dc201363f2c4..67d3eba60dc7 100644 --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c @@ -903,6 +903,33 @@ static void rxrpc_input_ack(struct rxrpc_call *call, s= truct sk_buff *skb) rxrpc_propose_ack_respond_to_ack); } =20 + /* If we get an EXCEEDS_WINDOW ACK from the server, it probably + * indicates that the client address changed due to NAT. The server + * lost the call because it switched to a different peer. + */ + if (unlikely(buf.ack.reason =3D=3D RXRPC_ACK_EXCEEDS_WINDOW) && + first_soft_ack =3D=3D 1 && + prev_pkt =3D=3D 0 && + rxrpc_is_client_call(call)) { + rxrpc_set_call_completion(call, RXRPC_CALL_REMOTELY_ABORTED, + 0, -ENETRESET); + return; + } + + /* If we get an OUT_OF_SEQUENCE ACK from the server, that can also + * indicate a change of address. However, we can retransmit the call + * if we still have it buffered to the beginning. + */ + if (unlikely(buf.ack.reason =3D=3D RXRPC_ACK_OUT_OF_SEQUENCE) && + first_soft_ack =3D=3D 1 && + prev_pkt =3D=3D 0 && + call->tx_hard_ack =3D=3D 0 && + rxrpc_is_client_call(call)) { + rxrpc_set_call_completion(call, RXRPC_CALL_REMOTELY_ABORTED, + 0, -ENETRESET); + return; + } + /* Discard any out-of-order or duplicate ACKs (outside lock). */ if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) { trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial, --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BCFDC43334 for ; Tue, 7 Jun 2022 22:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384495AbiFGWbK (ORCPT ); Tue, 7 Jun 2022 18:31:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380727AbiFGVQy (ORCPT ); Tue, 7 Jun 2022 17:16:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B08821F9DE; Tue, 7 Jun 2022 11:56:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D7669B82391; Tue, 7 Jun 2022 18:56:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34DACC385A5; Tue, 7 Jun 2022 18:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628202; bh=sm8MbBlNG5K6X9hLCmzFjLBYl5czMKscsEUm5HoPOMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ijfdGRRPCGsBmDD14XI/Nm1Pwve/lk3659+UqNu2cDCflaPFUbu0mMYAsbTwbIHfu w/pyap0CbYC9xp4FlLqJTwAk8OA//MPRTa41WEOnQVBVCRwHv9VVDOXYXfLB5I5I9N ZwYbmMDRGgca5iOgpD3QGPVurGWbLXzX5Z7NrwY4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 202/879] eth: tg3: silence the GCC 12 array-bounds warning Date: Tue, 7 Jun 2022 18:55:20 +0200 Message-Id: <20220607165008.709160263@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jakub Kicinski [ Upstream commit 9dec850fd7c210a04b4707df8e6c95bfafdd6a4b ] GCC 12 currently generates a rather inconsistent warning: drivers/net/ethernet/broadcom/tg3.c:17795:51: warning: array subscript 5 is= above array bounds of =E2=80=98struct tg3_napi[5]=E2=80=99 [-Warray-bounds] 17795 | struct tg3_napi *tnapi =3D &tp->napi[i]; | ~~~~~~~~^~~ i is guaranteed < tp->irq_max which in turn is either 1 or 5. There are more loops like this one in the driver, but strangely GCC 12 dislikes only this single one. Silence this silliness for now. Signed-off-by: Jakub Kicinski Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/ethernet/broadcom/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/broadcom/Makefile b/drivers/net/ethernet/= broadcom/Makefile index 0ddfb5b5d53c..2e6c5f258a1f 100644 --- a/drivers/net/ethernet/broadcom/Makefile +++ b/drivers/net/ethernet/broadcom/Makefile @@ -17,3 +17,8 @@ obj-$(CONFIG_BGMAC_BCMA) +=3D bgmac-bcma.o bgmac-bcma-mdi= o.o obj-$(CONFIG_BGMAC_PLATFORM) +=3D bgmac-platform.o obj-$(CONFIG_SYSTEMPORT) +=3D bcmsysport.o obj-$(CONFIG_BNXT) +=3D bnxt/ + +# FIXME: temporarily silence -Warray-bounds on non W=3D1+ builds +ifndef KBUILD_EXTRA_WARN +CFLAGS_tg3.o +=3D -Wno-array-bounds +endif --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72D36C43334 for ; Tue, 7 Jun 2022 22:23:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381826AbiFGWWv (ORCPT ); Tue, 7 Jun 2022 18:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380728AbiFGVQy (ORCPT ); Tue, 7 Jun 2022 17:16:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DC3E21F9E1; Tue, 7 Jun 2022 11:56: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 CDE7A61794; Tue, 7 Jun 2022 18:56:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD1FAC385A2; Tue, 7 Jun 2022 18:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628205; bh=iNHK4FsWAeAmGLGVXN+d7gkN/OJ8GAY1t4eehMHASVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DsMkhhbx1YaGIOiuB8rTCaIEodtZSB/sMvClPuSJq+mz0eWRNRh0RGitVv9d6GyTu kJWPhHNzvll44DgjFLyqUNMlfW/qrQtc7OTX2iVW9EXbxxuZv05u6PRt5wEMi5dbBI XtCZy+C3aB1MGs023KIin9edWxVA3KrZFVnsDNsc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 5.18 203/879] char: tpm: cr50_i2c: Suppress duplicated error message in .remove() Date: Tue, 7 Jun 2022 18:55:21 +0200 Message-Id: <20220607165008.738250110@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit e0687fe958f763f1790f22ed5483025b7624e744 ] Returning an error value in an i2c remove callback results in an error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called. As tpm_cr50_i2c_remove() emits an error message already and the additional error message by the i2c core doesn't add any useful information, change the return value to zero to suppress this error message. Note that if i2c_clientdata is NULL, there is something really fishy. Assuming no memory corruption happened (then all bets are lost anyhow), tpm_cr50_i2c_remove() is only called after tpm_cr50_i2c_probe() returned successfully. So there was a tpm chip registered before and after tpm_cr50_i2c_remove() its privdata is freed but the associated character device isn't removed. If after that happened userspace accesses the character device it's likely that the freed memory is accessed. For that reason the warning message is made a bit more frightening. Signed-off-by: Uwe Kleine-K=C3=B6nig Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/char/tpm/tpm_tis_i2c_cr50.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c b/drivers/char/tpm/tpm_tis= _i2c_cr50.c index f6c0affbb456..bf608b6af339 100644 --- a/drivers/char/tpm/tpm_tis_i2c_cr50.c +++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c @@ -768,8 +768,8 @@ static int tpm_cr50_i2c_remove(struct i2c_client *clien= t) struct device *dev =3D &client->dev; =20 if (!chip) { - dev_err(dev, "Could not get client data at remove\n"); - return -ENODEV; + dev_crit(dev, "Could not get client data at remove, memory corruption ah= ead\n"); + return 0; } =20 tpm_chip_unregister(chip); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 242E7CCA47F for ; Tue, 7 Jun 2022 22:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384048AbiFGWUO (ORCPT ); Tue, 7 Jun 2022 18:20:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380107AbiFGVPZ (ORCPT ); Tue, 7 Jun 2022 17:15:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9081721B12C; Tue, 7 Jun 2022 11:54:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 040B5612F2; Tue, 7 Jun 2022 18:54:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DECEC385A2; Tue, 7 Jun 2022 18:54:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628091; bh=cYbqQ0dMuwCZflYozzYeRbTkmB9Hzvvc14PryXL08Gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YaFNuiqj96H7HsOVWQCTJREH8pLgnZ712YkexUwb9OHERK064GRTJ/Uu21uXAGDdU pzOXuItlpeUivYgRJxJYWrUhMTh5F66Lsl+jzFUoclxOM2HcaN7IcFEAgnT9pd9K5s 7UKkc0HzeraJjteL67nrzWZLjgHT4a2bpl3aRcbs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mykola Lysenko , Yonghong Song , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.18 204/879] selftests/bpf: fix btf_dump/btf_dump due to recent clang change Date: Tue, 7 Jun 2022 18:55:22 +0200 Message-Id: <20220607165008.768192981@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yonghong Song [ Upstream commit 4050764cbaa25760aab40857f723393c07898474 ] Latest llvm-project upstream had a change of behavior related to qualifiers on function return type ([1]). This caused selftests btf_dump/btf_dump failure. The following example shows what changed. $ cat t.c typedef const char * const (* const (* const fn_ptr_arr2_t[5])())(char * = (*)(int)); struct t { int a; fn_ptr_arr2_t l; }; int foo(struct t *arg) { return arg->a; } Compiled with latest upstream llvm15, $ clang -O2 -g -target bpf -S -emit-llvm t.c The related generated debuginfo IR looks like: !16 =3D !DIDerivedType(tag: DW_TAG_typedef, name: "fn_ptr_arr2_t", file: = !1, line: 1, baseType: !17) !17 =3D !DICompositeType(tag: DW_TAG_array_type, baseType: !18, size: 320= , elements: !32) !18 =3D !DIDerivedType(tag: DW_TAG_const_type, baseType: !19) !19 =3D !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64) !20 =3D !DISubroutineType(types: !21) !21 =3D !{!22, null} !22 =3D !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !23, size: 64) !23 =3D !DISubroutineType(types: !24) !24 =3D !{!25, !28} !25 =3D !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !26, size: 64) !26 =3D !DIDerivedType(tag: DW_TAG_const_type, baseType: !27) !27 =3D !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) You can see two intermediate const qualifier to pointer are dropped in debu= ginfo IR. With llvm14, we have following debuginfo IR: !16 =3D !DIDerivedType(tag: DW_TAG_typedef, name: "fn_ptr_arr2_t", file: = !1, line: 1, baseType: !17) !17 =3D !DICompositeType(tag: DW_TAG_array_type, baseType: !18, size: 320= , elements: !34) !18 =3D !DIDerivedType(tag: DW_TAG_const_type, baseType: !19) !19 =3D !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64) !20 =3D !DISubroutineType(types: !21) !21 =3D !{!22, null} !22 =3D !DIDerivedType(tag: DW_TAG_const_type, baseType: !23) !23 =3D !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !24, size: 64) !24 =3D !DISubroutineType(types: !25) !25 =3D !{!26, !30} !26 =3D !DIDerivedType(tag: DW_TAG_const_type, baseType: !27) !27 =3D !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !28, size: 64) !28 =3D !DIDerivedType(tag: DW_TAG_const_type, baseType: !29) !29 =3D !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) All const qualifiers are preserved. To adapt the selftest to both old and new llvm, this patch removed the intermediate const qualifier in const-to-ptr types, to make the test succeed again. [1] https://reviews.llvm.org/D125919 Reported-by: Mykola Lysenko Signed-off-by: Yonghong Song Link: https://lore.kernel.org/r/20220523152044.3905809-1-yhs@fb.com Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c = b/tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c index 1c7105fcae3c..4ee4748133fe 100644 --- a/tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c +++ b/tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c @@ -94,7 +94,7 @@ typedef void (* (*signal_t)(int, void (*)(int)))(int); =20 typedef char * (*fn_ptr_arr1_t[10])(int **); =20 -typedef char * (* const (* const fn_ptr_arr2_t[5])())(char * (*)(int)); +typedef char * (* (* const fn_ptr_arr2_t[5])())(char * (*)(int)); =20 struct struct_w_typedefs { int_t a; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 821D9C43334 for ; Tue, 7 Jun 2022 22:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384394AbiFGWUU (ORCPT ); Tue, 7 Jun 2022 18:20:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380115AbiFGVPZ (ORCPT ); Tue, 7 Jun 2022 17:15:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90F3D21B13A; Tue, 7 Jun 2022 11:54: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 ABF1C6156D; Tue, 7 Jun 2022 18:54:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE613C385A2; Tue, 7 Jun 2022 18:54:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628094; bh=HwjH44pS8984mw7Nh4lKusX1l8RJWXNJDc+xlPI7FLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rbpi0zSvGpQ7OddZZ+dkvKTRdwYIa6IVbjx9y5O9cz25I3sJrKpu6BsvYjXdm6vB1 sxkU2TRu26bDDgHhDwU6vT6mPLkrKdV5xmC7g3S0gQU83Iq0XVF2cWz4cKVd4iiAxe HEnoOp7YxB9SJPRk9JJfXH5P00JgiwYSzZjUpYUY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Peterson , Andreas Gruenbacher , Sasha Levin Subject: [PATCH 5.18 205/879] gfs2: use i_lock spin_lock for inode qadata Date: Tue, 7 Jun 2022 18:55:23 +0200 Message-Id: <20220607165008.798822478@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bob Peterson [ Upstream commit 5fcff61eea9efd1f4b60e89d2d686b5feaea100f ] Before this patch, functions gfs2_qa_get and _put used the i_rw_mutex to prevent simultaneous access to its i_qadata. But i_rw_mutex is now used for many other things, including iomap_begin and end, which causes a conflict according to lockdep. We cannot just remove the lock since simultaneous opens (gfs2_open -> gfs2_open_common -> gfs2_qa_get) can then stomp on each others values for i_qadata. This patch solves the conflict by using the i_lock spin_lock in the inode to prevent simultaneous access. Signed-off-by: Bob Peterson Signed-off-by: Andreas Gruenbacher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/gfs2/quota.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index be0997e24d60..dc77080a82bb 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -531,34 +531,42 @@ static void qdsb_put(struct gfs2_quota_data *qd) */ int gfs2_qa_get(struct gfs2_inode *ip) { - int error =3D 0; struct gfs2_sbd *sdp =3D GFS2_SB(&ip->i_inode); + struct inode *inode =3D &ip->i_inode; =20 if (sdp->sd_args.ar_quota =3D=3D GFS2_QUOTA_OFF) return 0; =20 - down_write(&ip->i_rw_mutex); + spin_lock(&inode->i_lock); if (ip->i_qadata =3D=3D NULL) { - ip->i_qadata =3D kmem_cache_zalloc(gfs2_qadata_cachep, GFP_NOFS); - if (!ip->i_qadata) { - error =3D -ENOMEM; - goto out; - } + struct gfs2_qadata *tmp; + + spin_unlock(&inode->i_lock); + tmp =3D kmem_cache_zalloc(gfs2_qadata_cachep, GFP_NOFS); + if (!tmp) + return -ENOMEM; + + spin_lock(&inode->i_lock); + if (ip->i_qadata =3D=3D NULL) + ip->i_qadata =3D tmp; + else + kmem_cache_free(gfs2_qadata_cachep, tmp); } ip->i_qadata->qa_ref++; -out: - up_write(&ip->i_rw_mutex); - return error; + spin_unlock(&inode->i_lock); + return 0; } =20 void gfs2_qa_put(struct gfs2_inode *ip) { - down_write(&ip->i_rw_mutex); + struct inode *inode =3D &ip->i_inode; + + spin_lock(&inode->i_lock); if (ip->i_qadata && --ip->i_qadata->qa_ref =3D=3D 0) { kmem_cache_free(gfs2_qadata_cachep, ip->i_qadata); ip->i_qadata =3D NULL; } - up_write(&ip->i_rw_mutex); + spin_unlock(&inode->i_lock); } =20 int gfs2_quota_hold(struct gfs2_inode *ip, kuid_t uid, kgid_t gid) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3875FC433EF for ; Tue, 7 Jun 2022 22:33:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381187AbiFGWd2 (ORCPT ); Tue, 7 Jun 2022 18:33:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380307AbiFGVQE (ORCPT ); Tue, 7 Jun 2022 17:16:04 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74D11157E8E; Tue, 7 Jun 2022 11:55: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 sin.source.kernel.org (Postfix) with ESMTPS id 9AC77CE1D50; Tue, 7 Jun 2022 18:54:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83456C385A2; Tue, 7 Jun 2022 18:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628096; bh=jAuNF6M+3PV9HonytzGTV1kYObV5ikBT2owp1pOQg1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eEFjN7f2Lk9jTr5hQpBd/m3Qnjo5B6WsdGlhNosW9Vp+rePVmsBtN/hH6HOpklIpg MVViYT/kgpGEt68Xw4FSCzpNHATWoZHoABXospJZSzZwa/lxjSc6grJI1Tdx8TFtcF uM6sI0OIYH3bjVFc8LLPQd8KUim3vlf3ChNMacXU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby , Bjorn Helgaas , Linus Torvalds , Sasha Levin Subject: [PATCH 5.18 206/879] linux/types.h: reinstate "__bitwise__" macro for user space use Date: Tue, 7 Jun 2022 18:55:24 +0200 Message-Id: <20220607165008.829694453@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Torvalds [ Upstream commit caa28984163cb63ea0be4cb8dbf05defdc7303f9 ] Commit c724c866bb70 ("linux/types.h: remove unnecessary __bitwise__") was right that there are no users of __bitwise__ in the kernel, but it turns out there are user space users of it that do expect it. It is, after all, in the uapi directory, so user space usage is to be expected. Instead of reverting the commit completely, let's just clarify the situation so that it doesn't happen again, and have some in-code explanations for why that "__bitwise__" still exists. Reported-by: Jiri Slaby Cc: Bjorn Helgaas Link: https://lore.kernel.org/all/b5c0a68d-8387-4909-beea-f70ab9e6e3d5@kern= el.org/ Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/uapi/linux/types.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h index c4dc597f3dcf..308433be33c2 100644 --- a/include/uapi/linux/types.h +++ b/include/uapi/linux/types.h @@ -26,6 +26,9 @@ #define __bitwise #endif =20 +/* The kernel doesn't use this legacy form, but user space does */ +#define __bitwise__ __bitwise + typedef __u16 __bitwise __le16; typedef __u16 __bitwise __be16; typedef __u32 __bitwise __le32; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0778CCA47C for ; Tue, 7 Jun 2022 22:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384602AbiFGWUj (ORCPT ); Tue, 7 Jun 2022 18:20:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380301AbiFGVQD (ORCPT ); Tue, 7 Jun 2022 17:16:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 748F421C38E; Tue, 7 Jun 2022 11:55:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 37D27617A0; Tue, 7 Jun 2022 18:55:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41507C385A2; Tue, 7 Jun 2022 18:54:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628099; bh=BErCoeOcvUTLRD/LFFRzHxiI1/soPkkPoQKfGyEBg7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NfW8IKM/4ehD9JhHbG27g+j31QE2gooD9eoFOFkssAqyoGQPdyOe4jBA7Bkl0icyB 4evEQbX4vrq+WQIIGIpHnKn8hsYHPtYhop3wiLVqkd9O0mUADFUqGDgnLqYP8TgydM y9fDp2YmQCstOfdAeulKGMOAToFlmLdieIgFwRVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Bodo Stroesser , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 207/879] scsi: target: tcmu: Avoid holding XArray lock when calling lock_page Date: Tue, 7 Jun 2022 18:55:25 +0200 Message-Id: <20220607165008.858395683@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bodo Stroesser [ Upstream commit 325d5c5fb216674296f3902a8902b942da3adc5b ] In tcmu_blocks_release(), lock_page() is called to prevent a race causing possible data corruption. Since lock_page() might sleep, calling it while holding XArray lock is a bug. To fix this, replace the xas_for_each() call with xa_for_each_range(). Since the latter does its own handling of XArray locking, the xas_lock() and xas_unlock() calls around the original loop are no longer necessary. The switch to xa_for_each_range() slows down the loop slightly. This is acceptable since tcmu_blocks_release() is not relevant for performance. Link: https://lore.kernel.org/r/20220517192913.21405-1-bostroesser@gmail.com Fixes: bb9b9eb0ae2e ("scsi: target: tcmu: Fix possible data corruption") Reported-by: Dan Carpenter Signed-off-by: Bodo Stroesser Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/target/target_core_user.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core= _user.c index b1fd06edea59..3deaeecb712e 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -1661,13 +1661,14 @@ static int tcmu_check_and_free_pending_cmd(struct t= cmu_cmd *cmd) static u32 tcmu_blocks_release(struct tcmu_dev *udev, unsigned long first, unsigned long last) { - XA_STATE(xas, &udev->data_pages, first * udev->data_pages_per_blk); struct page *page; + unsigned long dpi; u32 pages_freed =3D 0; =20 - xas_lock(&xas); - xas_for_each(&xas, page, (last + 1) * udev->data_pages_per_blk - 1) { - xas_store(&xas, NULL); + first =3D first * udev->data_pages_per_blk; + last =3D (last + 1) * udev->data_pages_per_blk - 1; + xa_for_each_range(&udev->data_pages, dpi, page, first, last) { + xa_erase(&udev->data_pages, dpi); /* * While reaching here there may be page faults occurring on * the to-be-released pages. A race condition may occur if @@ -1691,7 +1692,6 @@ static u32 tcmu_blocks_release(struct tcmu_dev *udev,= unsigned long first, __free_page(page); pages_freed++; } - xas_unlock(&xas); =20 atomic_sub(pages_freed, &global_page_count); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21397CCA487 for ; Tue, 7 Jun 2022 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385113AbiFGWVB (ORCPT ); Tue, 7 Jun 2022 18:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380455AbiFGVQU (ORCPT ); Tue, 7 Jun 2022 17:16:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8927F21CBE3; Tue, 7 Jun 2022 11:55:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EBF83612F2; Tue, 7 Jun 2022 18:55:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06A10C385A2; Tue, 7 Jun 2022 18:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628102; bh=tO43DjKucU72pP0RHq0rgcL4dGdhO7HahM+k57aUjI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=05YYQWxlMZdE/e51i1W7QvRYMTIy4XPv8B6BBQQ+61nCuKqgext0e96Dlj8EtYuvX jc460Fsr8T9SlYaR9AGjJaTazkJGULiZ7isCvj54DYEtFti/yA9vE9waiTRSuxZv67 7t9wTzDA4F8bK8rMfn8pJuQbRWGhcvsxNCKXl6cQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Latypov , Brendan Higgins , Shuah Khan , Sasha Levin Subject: [PATCH 5.18 208/879] kunit: fix executor OOM error handling logic on non-UML Date: Tue, 7 Jun 2022 18:55:26 +0200 Message-Id: <20220607165008.887415960@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Latypov [ Upstream commit 1b11063d32d7e11366e48be64215ff517ce32217 ] The existing logic happens to work fine on UML, but is not correct when running on other arches. 1. We didn't initialize `int err`, and kunit_filter_suites() doesn't explicitly set it to 0 on success. So we had false "failures". Note: it doesn't happen on UML, causing this to get overlooked. 2. If we error out, we do not call kunit_handle_shutdown(). This makes kunit.py timeout when using a non-UML arch, since the QEMU process doesn't ever exit. Fixes: a02353f49162 ("kunit: bail out of test filtering logic quicker if OO= M") Signed-off-by: Daniel Latypov Reviewed-by: Brendan Higgins Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- lib/kunit/executor.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c index 2f73a6a35a7e..96f96e42ce06 100644 --- a/lib/kunit/executor.c +++ b/lib/kunit/executor.c @@ -247,13 +247,13 @@ int kunit_run_all_tests(void) .start =3D __kunit_suites_start, .end =3D __kunit_suites_end, }; - int err; + int err =3D 0; =20 if (filter_glob_param) { suite_set =3D kunit_filter_suites(&suite_set, filter_glob_param, &err); if (err) { pr_err("kunit executor: error filtering suites: %d\n", err); - return err; + goto out; } } =20 @@ -268,9 +268,10 @@ int kunit_run_all_tests(void) kunit_free_suite_set(suite_set); } =20 - kunit_handle_shutdown(); =20 - return 0; +out: + kunit_handle_shutdown(); + return err; } =20 #if IS_BUILTIN(CONFIG_KUNIT_TEST) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 046ACCCA485 for ; Tue, 7 Jun 2022 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385062AbiFGWU5 (ORCPT ); Tue, 7 Jun 2022 18:20:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380427AbiFGVQS (ORCPT ); Tue, 7 Jun 2022 17:16:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE48B21CBFC; Tue, 7 Jun 2022 11:55:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 925EE61277; Tue, 7 Jun 2022 18:55:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A399EC385A2; Tue, 7 Jun 2022 18:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628105; bh=Io4HhJb+Cz16sRUnVJbOtBv6IWiQnhJuRY59WG07j+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PY11wD6HNhsbobYiOdBf9xufMl36zGVvY814mOQlai5kAgoMazkXnpdPfdBdCGHNs aAlw9gNfK2Sf+zBIORMZOzFPEoi3pRZThrwWB5kEymlCIUHoYuBVI3zF1/6s559Oqo 2oGRs5dD033v/g3r3n2JDlaflAoJz4X1UDFSyRDI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niels Dossche , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.18 209/879] IB/rdmavt: add missing locks in rvt_ruc_loopback Date: Tue, 7 Jun 2022 18:55:27 +0200 Message-Id: <20220607165008.918827102@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Niels Dossche [ Upstream commit 22cbc6c2681a0a4fe76150270426e763d52353a4 ] The documentation of the function rvt_error_qp says both r_lock and s_lock need to be held when calling that function. It also asserts using lockdep that both of those locks are held. rvt_error_qp is called form rvt_send_cq, which is called from rvt_qp_complete_swqe, which is called from rvt_send_complete, which is called from rvt_ruc_loopback in two places. Both of these places do not hold r_lock. Fix this by acquiring a spin_lock of r_lock in both of these places. The r_lock acquiring cannot be added in rvt_qp_complete_swqe because some of its other callers already have r_lock acquired. Link: https://lore.kernel.org/r/20220228195144.71946-1-dossche.niels@gmail.= com Signed-off-by: Niels Dossche Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/infiniband/sw/rdmavt/qp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdma= vt/qp.c index 8ef112f883a7..3acab569fbb9 100644 --- a/drivers/infiniband/sw/rdmavt/qp.c +++ b/drivers/infiniband/sw/rdmavt/qp.c @@ -2775,7 +2775,7 @@ void rvt_qp_iter(struct rvt_dev_info *rdi, EXPORT_SYMBOL(rvt_qp_iter); =20 /* - * This should be called with s_lock held. + * This should be called with s_lock and r_lock held. */ void rvt_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe, enum ib_wc_status status) @@ -3134,7 +3134,9 @@ void rvt_ruc_loopback(struct rvt_qp *sqp) rvp->n_loop_pkts++; flush_send: sqp->s_rnr_retry =3D sqp->s_rnr_retry_cnt; + spin_lock(&sqp->r_lock); rvt_send_complete(sqp, wqe, send_status); + spin_unlock(&sqp->r_lock); if (local_ops) { atomic_dec(&sqp->local_ops_pending); local_ops =3D 0; @@ -3188,7 +3190,9 @@ void rvt_ruc_loopback(struct rvt_qp *sqp) spin_unlock_irqrestore(&qp->r_lock, flags); serr_no_r_lock: spin_lock_irqsave(&sqp->s_lock, flags); + spin_lock(&sqp->r_lock); rvt_send_complete(sqp, wqe, send_status); + spin_unlock(&sqp->r_lock); if (sqp->ibqp.qp_type =3D=3D IB_QPT_RC) { int lastwqe; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3189EC43334 for ; Tue, 7 Jun 2022 22:33:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383022AbiFGWdV (ORCPT ); Tue, 7 Jun 2022 18:33:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380444AbiFGVQT (ORCPT ); Tue, 7 Jun 2022 17:16:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53EE421D3D3; Tue, 7 Jun 2022 11:55:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9124D61787; Tue, 7 Jun 2022 18:55:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 989FFC3411F; Tue, 7 Jun 2022 18:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628108; bh=y+ZCPCbodZGnjXfv4nC2fCqOJ8w4vtn6X4gFvwYmG9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+P2PajuknDJlHYJNuqXRKdeiBGeeP4YHqgWGxjNvytvZezRrYucAc7J1RpEVoyGi cvaZq8e+mM0bF/PCJiudn5jR7kXG2e3kk4fSR7QiFM1/oTiaUQMSgBj20caEBXkQxP iy5piDvlEWppCNbDtVZiGor8b+QUleT/1zpPPgZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg , Bjorn Helgaas , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.18 210/879] PCI/ASPM: Make Intel DG2 L1 acceptable latency unlimited Date: Tue, 7 Jun 2022 18:55:28 +0200 Message-Id: <20220607165008.947801730@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mika Westerberg [ Upstream commit 03038d84ace72678a9944524508f218a00377dc0 ] Intel DG2 discrete graphics PCIe endpoints advertise L1 acceptable exit latency to be < 1us even though they can actually tolerate unlimited exit latencies just fine. Quirk the L1 acceptable exit latency for these endpoints to be unlimited so ASPM L1 can be enabled. [bhelgaas: use FIELD_GET/FIELD_PREP, wordsmith comment & commit log] Link: https://lore.kernel.org/r/20220405093810.76613-1-mika.westerberg@linu= x.intel.com Signed-off-by: Mika Westerberg Signed-off-by: Bjorn Helgaas Reviewed-by: Rodrigo Vivi Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/quirks.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index da829274fc66..41aeaa235132 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -12,6 +12,7 @@ * file, where their drivers can use them. */ =20 +#include #include #include #include @@ -5895,3 +5896,49 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1533,= rom_bar_overlap_defect); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1536, rom_bar_overlap_defec= t); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1537, rom_bar_overlap_defec= t); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1538, rom_bar_overlap_defec= t); + +#ifdef CONFIG_PCIEASPM +/* + * Several Intel DG2 graphics devices advertise that they can only tolerate + * 1us latency when transitioning from L1 to L0, which may prevent ASPM L1 + * from being enabled. But in fact these devices can tolerate unlimited + * latency. Override their Device Capabilities value to allow ASPM L1 to + * be enabled. + */ +static void aspm_l1_acceptable_latency(struct pci_dev *dev) +{ + u32 l1_lat =3D FIELD_GET(PCI_EXP_DEVCAP_L1, dev->devcap); + + if (l1_lat < 7) { + dev->devcap |=3D FIELD_PREP(PCI_EXP_DEVCAP_L1, 7); + pci_info(dev, "ASPM: overriding L1 acceptable latency from %#x to 0x7\n", + l1_lat); + } +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f80, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f81, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f82, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f83, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f84, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f85, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f86, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f87, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f88, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x5690, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x5691, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x5692, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x5693, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x5694, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x5695, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a0, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a1, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a2, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a3, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a4, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a5, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a6, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56b0, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56b1, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56c0, aspm_l1_acceptable_l= atency); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56c1, aspm_l1_acceptable_l= atency); +#endif --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8412C433EF for ; Tue, 7 Jun 2022 22:33:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232947AbiFGWdE (ORCPT ); Tue, 7 Jun 2022 18:33:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380483AbiFGVQW (ORCPT ); Tue, 7 Jun 2022 17:16:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9609621D3F0; Tue, 7 Jun 2022 11:55:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EF396B82182; Tue, 7 Jun 2022 18:55:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5538CC385A5; Tue, 7 Jun 2022 18:55:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628110; bh=87fusB1NbeF9d5w5FokHgelhk1HMeGJ7WnXMAGuYKQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EfB+GPB7W22LB3MUc+gl9xd6bLXhMqyNudm8ZmkMU3TP9M+DCEkRriFBCenZ4dlx+ ng7oakCh/h6Hxc8h6rGvjVziw+dHCZlzXr4G5u+XKKoiv05DMgt8bj9sgIfch2zHSs FqSOhCMajwS2geHLnkqgJqJZoEXW1XiR6OgXecNk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Neil Armstrong , Sasha Levin Subject: [PATCH 5.18 211/879] ARM: dts: ox820: align interrupt controller node name with dtschema Date: Tue, 7 Jun 2022 18:55:29 +0200 Message-Id: <20220607165008.976963456@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit fbcd5ad7a419ad40644a0bb8b4152bc660172d8a ] Fixes dtbs_check warnings like: gic@1000: $nodename:0: 'gic@1000' does not match '^interrupt-controller(@= [0-9a-f,]+)*$' Signed-off-by: Krzysztof Kozlowski Acked-by: Neil Armstrong Link: https://lore.kernel.org/r/20220317115705.450427-1-krzysztof.kozlowski= @canonical.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/boot/dts/ox820.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/ox820.dtsi b/arch/arm/boot/dts/ox820.dtsi index 90846a7655b4..dde4364892bf 100644 --- a/arch/arm/boot/dts/ox820.dtsi +++ b/arch/arm/boot/dts/ox820.dtsi @@ -287,7 +287,7 @@ clocks =3D <&armclk>; }; =20 - gic: gic@1000 { + gic: interrupt-controller@1000 { compatible =3D "arm,arm11mp-gic"; interrupt-controller; #interrupt-cells =3D <3>; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31A66CCA47F for ; Tue, 7 Jun 2022 22:32:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381944AbiFGWco (ORCPT ); Tue, 7 Jun 2022 18:32:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380501AbiFGVQX (ORCPT ); Tue, 7 Jun 2022 17:16:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BB3A21D3FC; Tue, 7 Jun 2022 11:55: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 C4234B8220B; Tue, 7 Jun 2022 18:55:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 225A5C385A2; Tue, 7 Jun 2022 18:55:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628113; bh=VfEohdirGWqMYKm8EJN/0nGqKpK6fovf6VVJ591kVQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aB52yzu+c5p93sS2LvYSx5wHoVnDFK9Yt5HM4miQwKm7PHbnnMKW0y9kWsmHJAKf2 n4PAXMvcEZ52T7HswnZLf/uVV9PDdvFW/Qyyn02tbmcVI0otZFbEzGr7ZFtj8qmPAR LDvcrXt6JNzRfBx1gsW1FsEHFDAUsSYsSThlOuvo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Dinh Nguyen , Sasha Levin Subject: [PATCH 5.18 212/879] ARM: dts: socfpga: align interrupt controller node name with dtschema Date: Tue, 7 Jun 2022 18:55:30 +0200 Message-Id: <20220607165009.007728091@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit c9bdd50d2019f78bf4c1f6a79254c27771901023 ] Fixes dtbs_check warnings like: $nodename:0: 'intc@fffed000' does not match '^interrupt-controller(@[0-9a= -f,]+)*$' Signed-off-by: Krzysztof Kozlowski Acked-by: Dinh Nguyen Link: https://lore.kernel.org/r/20220317115705.450427-2-krzysztof.kozlowski= @canonical.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/boot/dts/socfpga.dtsi | 2 +- arch/arm/boot/dts/socfpga_arria10.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi index 7c1d6423d7f8..b8c5dd7860cb 100644 --- a/arch/arm/boot/dts/socfpga.dtsi +++ b/arch/arm/boot/dts/socfpga.dtsi @@ -46,7 +46,7 @@ <0xff113000 0x1000>; }; =20 - intc: intc@fffed000 { + intc: interrupt-controller@fffed000 { compatible =3D "arm,cortex-a9-gic"; #interrupt-cells =3D <3>; interrupt-controller; diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/soc= fpga_arria10.dtsi index 3ba431dfa8c9..f1e50d2e623a 100644 --- a/arch/arm/boot/dts/socfpga_arria10.dtsi +++ b/arch/arm/boot/dts/socfpga_arria10.dtsi @@ -38,7 +38,7 @@ <0xff113000 0x1000>; }; =20 - intc: intc@ffffd000 { + intc: interrupt-controller@ffffd000 { compatible =3D "arm,cortex-a9-gic"; #interrupt-cells =3D <3>; interrupt-controller; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBC8DC433EF for ; Tue, 7 Jun 2022 22:32:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381766AbiFGWcg (ORCPT ); Tue, 7 Jun 2022 18:32:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380515AbiFGVQZ (ORCPT ); Tue, 7 Jun 2022 17:16:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D422721D48A; Tue, 7 Jun 2022 11:55:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8D262B8237F; Tue, 7 Jun 2022 18:55:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0EBFC385A2; Tue, 7 Jun 2022 18:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628116; bh=Aif4FJPRrLoivnL8rDTd2v7dRNw5XL0pabuaQUQORPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/Mz0OIlP8S4e7hQi991WiJxuua3NladmTZB5cGMxZ6x+z93aexuKrXP9KdWEpMgW LffmB/6BnoHWLjDaTUQ6aI6En0/XkXIKtXXUhfmhWB8Ko7b26w5XyRtr1VQMuL6bIS w+xC6kyGrGQzQvs167dlPBUsdK2fQLMGxEwB+CAg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Jonathan Bakker , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.18 213/879] ARM: dts: s5pv210: align DMA channels with dtschema Date: Tue, 7 Jun 2022 18:55:31 +0200 Message-Id: <20220607165009.037001077@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit 9e916fb9bc3d16066286f19fc9c51d26a6aec6bd ] dtschema expects DMA channels in specific order (tx, rx and tx-sec). The order actually should not matter because dma-names is used however let's make it aligned with dtschema to suppress warnings like: i2s@eee30000: dma-names: ['rx', 'tx', 'tx-sec'] is not valid under any of= the given schemas Signed-off-by: Krzysztof Kozlowski Co-developed-by: Jonathan Bakker Signed-off-by: Jonathan Bakker Link: https://lore.kernel.org/r/CY4PR04MB056779A9C50DC95987C5272ACB1C9@CY4P= R04MB0567.namprd04.prod.outlook.com Signed-off-by: Krzysztof Kozlowski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/boot/dts/s5pv210-aries.dtsi | 2 +- arch/arm/boot/dts/s5pv210.dtsi | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/boot/dts/s5pv210-aries.dtsi b/arch/arm/boot/dts/s5pv2= 10-aries.dtsi index 26f2be2d9faa..c44fdf535795 100644 --- a/arch/arm/boot/dts/s5pv210-aries.dtsi +++ b/arch/arm/boot/dts/s5pv210-aries.dtsi @@ -636,7 +636,7 @@ }; =20 &i2s0 { - dmas =3D <&pdma0 9>, <&pdma0 10>, <&pdma0 11>; + dmas =3D <&pdma0 10>, <&pdma0 9>, <&pdma0 11>; status =3D "okay"; }; =20 diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi index 353ba7b09a0c..c5265f3ae31d 100644 --- a/arch/arm/boot/dts/s5pv210.dtsi +++ b/arch/arm/boot/dts/s5pv210.dtsi @@ -239,8 +239,8 @@ reg =3D <0xeee30000 0x1000>; interrupt-parent =3D <&vic2>; interrupts =3D <16>; - dma-names =3D "rx", "tx", "tx-sec"; - dmas =3D <&pdma1 9>, <&pdma1 10>, <&pdma1 11>; + dma-names =3D "tx", "rx", "tx-sec"; + dmas =3D <&pdma1 10>, <&pdma1 9>, <&pdma1 11>; clock-names =3D "iis", "i2s_opclk0", "i2s_opclk1"; @@ -259,8 +259,8 @@ reg =3D <0xe2100000 0x1000>; interrupt-parent =3D <&vic2>; interrupts =3D <17>; - dma-names =3D "rx", "tx"; - dmas =3D <&pdma1 12>, <&pdma1 13>; + dma-names =3D "tx", "rx"; + dmas =3D <&pdma1 13>, <&pdma1 12>; clock-names =3D "iis", "i2s_opclk0"; clocks =3D <&clocks CLK_I2S1>, <&clocks SCLK_AUDIO1>; pinctrl-names =3D "default"; @@ -274,8 +274,8 @@ reg =3D <0xe2a00000 0x1000>; interrupt-parent =3D <&vic2>; interrupts =3D <18>; - dma-names =3D "rx", "tx"; - dmas =3D <&pdma1 14>, <&pdma1 15>; + dma-names =3D "tx", "rx"; + dmas =3D <&pdma1 15>, <&pdma1 14>; clock-names =3D "iis", "i2s_opclk0"; clocks =3D <&clocks CLK_I2S2>, <&clocks SCLK_AUDIO2>; pinctrl-names =3D "default"; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D5ABCCA489 for ; Tue, 7 Jun 2022 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385175AbiFGWVU (ORCPT ); Tue, 7 Jun 2022 18:21:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380535AbiFGVQ2 (ORCPT ); Tue, 7 Jun 2022 17:16: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 08BF021DA0D; Tue, 7 Jun 2022 11:55:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 90977612F2; Tue, 7 Jun 2022 18:55:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B05DC385A2; Tue, 7 Jun 2022 18:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628122; bh=ysGPMCEE6zTrrAwWhMonkdrC5EuSx87LJP4/nYS+s1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wqrUJgvIrMxUKx7I1gwvXkKToyohig6VjTNfj3ARuHLWDBi2rOG2MG/DsKV/A8t3V nv+nPKrKHOATWxgdr6gUpZiIdLAl/doIa1kZ3Zo+x8HxVgji1qwHhTIQEIxu4ITQeK 1DnP0JBpK8Zca/yTwakRh06y3WdqUW5vb8bp6J3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , Mark Brown , Sasha Levin Subject: [PATCH 5.18 214/879] ASoC: amd: Add driver data to acp6x machine driver Date: Tue, 7 Jun 2022 18:55:32 +0200 Message-Id: <20220607165009.066381782@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mario Limonciello [ Upstream commit e521f087780d07731e8c950f2f34d08358c86bc9 ] Currently all of the quirked systems use the same card and so the DMI quirk list doesn't contain driver data. Add driver data to these quirks and then check the data was present or not. This will allow potentially setting quirks for systems with faulty firmware that claims to have a DMIC but doesn't really. Signed-off-by: Mario Limonciello Link: https://lore.kernel.org/r/20220411134532.13538-2-mario.limonciello@am= d.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/soc/amd/yc/acp6x-mach.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c index 9a767f47b89f..959b70e8baf2 100644 --- a/sound/soc/amd/yc/acp6x-mach.c +++ b/sound/soc/amd/yc/acp6x-mach.c @@ -45,108 +45,126 @@ static struct snd_soc_card acp6x_card =3D { =20 static const struct dmi_system_id yc_acp_quirk_table[] =3D { { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21D2"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21D3"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21D4"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21D5"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CF"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CG"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CQ"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CR"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21AW"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21AX"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21BN"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21BQ"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CH"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CJ"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CK"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CL"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21D8"), } }, { + .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21D9"), @@ -157,18 +175,21 @@ static const struct dmi_system_id yc_acp_quirk_table[= ] =3D { =20 static int acp6x_probe(struct platform_device *pdev) { + const struct dmi_system_id *dmi_id; struct acp6x_pdm *machine =3D NULL; struct snd_soc_card *card; int ret; - const struct dmi_system_id *dmi_id; =20 + /* check for any DMI overrides */ dmi_id =3D dmi_first_match(yc_acp_quirk_table); - if (!dmi_id) + if (dmi_id) + platform_set_drvdata(pdev, dmi_id->driver_data); + + card =3D platform_get_drvdata(pdev); + if (!card) return -ENODEV; - card =3D &acp6x_card; acp6x_card.dev =3D &pdev->dev; =20 - platform_set_drvdata(pdev, card); snd_soc_card_set_drvdata(card, machine); ret =3D devm_snd_soc_register_card(&pdev->dev, card); if (ret) { --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69AEDCCA47F for ; Tue, 7 Jun 2022 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385223AbiFGWVW (ORCPT ); Tue, 7 Jun 2022 18:21:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380545AbiFGVQb (ORCPT ); Tue, 7 Jun 2022 17:16:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD38021DA39; Tue, 7 Jun 2022 11:55:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 41FF861277; Tue, 7 Jun 2022 18:55:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52FBDC385A2; Tue, 7 Jun 2022 18:55:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628124; bh=5ijuIaRbgd+oSgheT9EPvH3wQ/y54m1bFMPcfGh+Pzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zsqatreeRUGkly+ZDvF9xkdAtRxu5QnkYK/yKUHD9C6YTsX8SRwo5c5cd2U6WiSWj hVjZO40ZcVNc+xaWJDgcZ8aEZ7M5DFrJglmRt6StCIVioRzY5sOAYwdHwHd5dfBM6Z Fd7qs+BA7qsKt4Rwg8hJROGW/3U1hf8XdUtT8MIQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 215/879] arm64: dts: qcom: msm8994: Fix the cont_splash_mem address Date: Tue, 7 Jun 2022 18:55:33 +0200 Message-Id: <20220607165009.094740814@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 049c46f31a726bf8d202ff1681661513447fac84 ] The default memory map places cont_splash_mem at 3401000, which was overlooked.. Fix it! Signed-off-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220319174645.340379-9-konrad.dybcio@somai= nline.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/qcom/msm8994.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/msm8994.dtsi b/arch/arm64/boot/dts/qc= om/msm8994.dtsi index 8c1dc5155b71..c65618b95ce0 100644 --- a/arch/arm64/boot/dts/qcom/msm8994.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8994.dtsi @@ -183,8 +183,8 @@ no-map; }; =20 - cont_splash_mem: memory@3800000 { - reg =3D <0 0x03800000 0 0x2400000>; + cont_splash_mem: memory@3401000 { + reg =3D <0 0x03401000 0 0x2200000>; no-map; }; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88FA7CCA48A for ; Tue, 7 Jun 2022 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385272AbiFGWVY (ORCPT ); Tue, 7 Jun 2022 18:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380555AbiFGVQb (ORCPT ); Tue, 7 Jun 2022 17:16:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8605F21E0F2; Tue, 7 Jun 2022 11:55: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 F1F8E612F2; Tue, 7 Jun 2022 18:55:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F2E5C385A5; Tue, 7 Jun 2022 18:55:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628127; bh=0s1KbpQyi4C/7s4nH4bshotU70y1+eeeKts6Qky4uOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f8F6hi9SfYElf4bJFwJzVZlH3xoWKGSbPxmb8EQVR1+5eyM2RaYi94rc8/ePnKr2C wuNhFFlzPD1U5P+yjQygEgR5CPPCIIplDcfuRF5DCpDjx24VCGG9t7UGY/pILMIsfD o/bQWPPNphd9LcwnndSbmRMDFU3ZZFmEqAWnMDVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 216/879] arm64: dts: qcom: msm8994: Fix BLSP[12]_DMA channels count Date: Tue, 7 Jun 2022 18:55:34 +0200 Message-Id: <20220607165009.124029730@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 1ae438d26b620979ed004d559c304d31c42173ae ] MSM8994 actually features 24 DMA channels for each BLSP, fix it! Signed-off-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220319174645.340379-14-konrad.dybcio@soma= inline.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/qcom/msm8994.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/msm8994.dtsi b/arch/arm64/boot/dts/qc= om/msm8994.dtsi index c65618b95ce0..b1e595cb4b90 100644 --- a/arch/arm64/boot/dts/qcom/msm8994.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8994.dtsi @@ -498,7 +498,7 @@ #dma-cells =3D <1>; qcom,ee =3D <0>; qcom,controlled-remotely; - num-channels =3D <18>; + num-channels =3D <24>; qcom,num-ees =3D <4>; }; =20 @@ -634,7 +634,7 @@ #dma-cells =3D <1>; qcom,ee =3D <0>; qcom,controlled-remotely; - num-channels =3D <18>; + num-channels =3D <24>; qcom,num-ees =3D <4>; }; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE2F9CCA48C for ; Tue, 7 Jun 2022 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385377AbiFGWVf (ORCPT ); Tue, 7 Jun 2022 18:21:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380568AbiFGVQd (ORCPT ); Tue, 7 Jun 2022 17:16:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D84C21E0FE; Tue, 7 Jun 2022 11:55:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A5AAE61277; Tue, 7 Jun 2022 18:55:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B51D9C385A2; Tue, 7 Jun 2022 18:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628130; bh=3a8gxMHCDSeL/R2EhuktrXzbJmCqXw0BGoZqVqZ6DYA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oegktrVK5Y4LfJzz0SbUz90C0JidfMpupKbVuBM6gDrq1g8JSmQSy5yUf2xLsTmrL /Wtjk3dpDKoStGSTufdwbRYNiAIh9+wZkW/h4a6pndh26ld7hR27FfS1znLCD3zZ4j OBmqkNAMHNAMSk7IrPOM39qkHEW31PXrxVnDlBZg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Chanwoo Choi , Sasha Levin Subject: [PATCH 5.18 217/879] PM / devfreq: rk3399_dmc: Disable edev on remove() Date: Tue, 7 Jun 2022 18:55:35 +0200 Message-Id: <20220607165009.153322455@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit 2fccf9e6050e0e3b8b4cd275d41daf7f7fa22804 ] Otherwise we hit an unablanced enable-count when unbinding the DFI device: [ 1279.659119] ------------[ cut here ]------------ [ 1279.659179] WARNING: CPU: 2 PID: 5638 at drivers/devfreq/devfreq-event.c= :360 devfreq_event_remove_edev+0x84/0x8c ... [ 1279.659352] Hardware name: Google Kevin (DT) [ 1279.659363] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO BTYPE=3D--) [ 1279.659371] pc : devfreq_event_remove_edev+0x84/0x8c [ 1279.659380] lr : devm_devfreq_event_release+0x1c/0x28 ... [ 1279.659571] Call trace: [ 1279.659582] devfreq_event_remove_edev+0x84/0x8c [ 1279.659590] devm_devfreq_event_release+0x1c/0x28 [ 1279.659602] release_nodes+0x1cc/0x244 [ 1279.659611] devres_release_all+0x44/0x60 [ 1279.659621] device_release_driver_internal+0x11c/0x1ac [ 1279.659629] device_driver_detach+0x20/0x2c [ 1279.659641] unbind_store+0x7c/0xb0 [ 1279.659650] drv_attr_store+0x2c/0x40 [ 1279.659663] sysfs_kf_write+0x44/0x58 [ 1279.659672] kernfs_fop_write_iter+0xf4/0x190 [ 1279.659684] vfs_write+0x2b0/0x2e4 [ 1279.659693] ksys_write+0x80/0xec [ 1279.659701] __arm64_sys_write+0x24/0x30 [ 1279.659714] el0_svc_common+0xf0/0x1d8 [ 1279.659724] do_el0_svc_compat+0x28/0x3c [ 1279.659738] el0_svc_compat+0x10/0x1c [ 1279.659746] el0_sync_compat_handler+0xa8/0xcc [ 1279.659758] el0_sync_compat+0x188/0x1c0 [ 1279.659768] ---[ end trace cec200e5094155b4 ]--- Signed-off-by: Brian Norris Signed-off-by: Chanwoo Choi Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/devfreq/rk3399_dmc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c index 293857ebfd75..538e8dc74f40 100644 --- a/drivers/devfreq/rk3399_dmc.c +++ b/drivers/devfreq/rk3399_dmc.c @@ -477,6 +477,8 @@ static int rk3399_dmcfreq_remove(struct platform_device= *pdev) { struct rk3399_dmcfreq *dmcfreq =3D dev_get_drvdata(&pdev->dev); =20 + devfreq_event_disable_edev(dmcfreq->edev); + /* * Before remove the opp table we need to unregister the opp notifier. */ --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A89B0C43334 for ; Tue, 7 Jun 2022 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385308AbiFGWVa (ORCPT ); Tue, 7 Jun 2022 18:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380588AbiFGVQe (ORCPT ); Tue, 7 Jun 2022 17:16:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 791E621E315; Tue, 7 Jun 2022 11:55: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 11303B81FE1; Tue, 7 Jun 2022 18:55:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E819C385A2; Tue, 7 Jun 2022 18:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628132; bh=VZt2nOdWMwFzurUHIONWPqfBKwllbRhQspuztDZ+FDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1uosKvwqA47vQnBU3A8vXI7jq64SEZuGLXa36o8O8D8l2glE901potLTDFPFgOlWm bh6uFTZyClNcOflkoqbob9An624WfHJ0MMDf1pQAHzdcJ8BNwyWqIHJL2evA+WjgX1 UvS9b/TzPd5NnKY1rmPWGqmjBWB9wMYYvjMZCyMw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gilad Ben-Yossef , Corentin Labbe , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 218/879] crypto: ccree - use fine grained DMA mapping dir Date: Tue, 7 Jun 2022 18:55:36 +0200 Message-Id: <20220607165009.183056308@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gilad Ben-Yossef [ Upstream commit a260436c98171cd825955a84a7f6e62bc8f4f00d ] Use a fine grained specification of DMA mapping directions in certain cases, allowing both a more optimized operation as well as shushing out a harmless, though persky dma-debug warning. Signed-off-by: Gilad Ben-Yossef Reported-by: Corentin Labbe Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/ccree/cc_buffer_mgr.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/ccree/cc_buffer_mgr.c b/drivers/crypto/ccree/cc= _buffer_mgr.c index 11e0278c8631..6140e4927322 100644 --- a/drivers/crypto/ccree/cc_buffer_mgr.c +++ b/drivers/crypto/ccree/cc_buffer_mgr.c @@ -356,12 +356,14 @@ void cc_unmap_cipher_request(struct device *dev, void= *ctx, req_ctx->mlli_params.mlli_dma_addr); } =20 - dma_unmap_sg(dev, src, req_ctx->in_nents, DMA_BIDIRECTIONAL); - dev_dbg(dev, "Unmapped req->src=3D%pK\n", sg_virt(src)); - if (src !=3D dst) { - dma_unmap_sg(dev, dst, req_ctx->out_nents, DMA_BIDIRECTIONAL); + dma_unmap_sg(dev, src, req_ctx->in_nents, DMA_TO_DEVICE); + dma_unmap_sg(dev, dst, req_ctx->out_nents, DMA_FROM_DEVICE); dev_dbg(dev, "Unmapped req->dst=3D%pK\n", sg_virt(dst)); + dev_dbg(dev, "Unmapped req->src=3D%pK\n", sg_virt(src)); + } else { + dma_unmap_sg(dev, src, req_ctx->in_nents, DMA_BIDIRECTIONAL); + dev_dbg(dev, "Unmapped req->src=3D%pK\n", sg_virt(src)); } } =20 @@ -377,6 +379,7 @@ int cc_map_cipher_request(struct cc_drvdata *drvdata, v= oid *ctx, u32 dummy =3D 0; int rc =3D 0; u32 mapped_nents =3D 0; + int src_direction =3D (src !=3D dst ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL); =20 req_ctx->dma_buf_type =3D CC_DMA_BUF_DLLI; mlli_params->curr_pool =3D NULL; @@ -399,7 +402,7 @@ int cc_map_cipher_request(struct cc_drvdata *drvdata, v= oid *ctx, } =20 /* Map the src SGL */ - rc =3D cc_map_sg(dev, src, nbytes, DMA_BIDIRECTIONAL, &req_ctx->in_nents, + rc =3D cc_map_sg(dev, src, nbytes, src_direction, &req_ctx->in_nents, LLI_MAX_NUM_OF_DATA_ENTRIES, &dummy, &mapped_nents); if (rc) goto cipher_exit; @@ -416,7 +419,7 @@ int cc_map_cipher_request(struct cc_drvdata *drvdata, v= oid *ctx, } } else { /* Map the dst sg */ - rc =3D cc_map_sg(dev, dst, nbytes, DMA_BIDIRECTIONAL, + rc =3D cc_map_sg(dev, dst, nbytes, DMA_FROM_DEVICE, &req_ctx->out_nents, LLI_MAX_NUM_OF_DATA_ENTRIES, &dummy, &mapped_nents); if (rc) @@ -456,6 +459,7 @@ void cc_unmap_aead_request(struct device *dev, struct a= ead_request *req) struct aead_req_ctx *areq_ctx =3D aead_request_ctx(req); unsigned int hw_iv_size =3D areq_ctx->hw_iv_size; struct cc_drvdata *drvdata =3D dev_get_drvdata(dev); + int src_direction =3D (req->src !=3D req->dst ? DMA_TO_DEVICE : DMA_BIDIR= ECTIONAL); =20 if (areq_ctx->mac_buf_dma_addr) { dma_unmap_single(dev, areq_ctx->mac_buf_dma_addr, @@ -514,13 +518,11 @@ void cc_unmap_aead_request(struct device *dev, struct= aead_request *req) sg_virt(req->src), areq_ctx->src.nents, areq_ctx->assoc.nents, areq_ctx->assoclen, req->cryptlen); =20 - dma_unmap_sg(dev, req->src, areq_ctx->src.mapped_nents, - DMA_BIDIRECTIONAL); + dma_unmap_sg(dev, req->src, areq_ctx->src.mapped_nents, src_direction); if (req->src !=3D req->dst) { dev_dbg(dev, "Unmapping dst sgl: req->dst=3D%pK\n", sg_virt(req->dst)); - dma_unmap_sg(dev, req->dst, areq_ctx->dst.mapped_nents, - DMA_BIDIRECTIONAL); + dma_unmap_sg(dev, req->dst, areq_ctx->dst.mapped_nents, DMA_FROM_DEVICE); } if (drvdata->coherent && areq_ctx->gen_ctx.op_type =3D=3D DRV_CRYPTO_DIRECTION_DECRYPT && @@ -843,7 +845,7 @@ static int cc_aead_chain_data(struct cc_drvdata *drvdat= a, else size_for_map -=3D authsize; =20 - rc =3D cc_map_sg(dev, req->dst, size_for_map, DMA_BIDIRECTIONAL, + rc =3D cc_map_sg(dev, req->dst, size_for_map, DMA_FROM_DEVICE, &areq_ctx->dst.mapped_nents, LLI_MAX_NUM_OF_DATA_ENTRIES, &dst_last_bytes, &dst_mapped_nents); @@ -1056,7 +1058,8 @@ int cc_map_aead_request(struct cc_drvdata *drvdata, s= truct aead_request *req) size_to_map +=3D authsize; } =20 - rc =3D cc_map_sg(dev, req->src, size_to_map, DMA_BIDIRECTIONAL, + rc =3D cc_map_sg(dev, req->src, size_to_map, + (req->src !=3D req->dst ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL), &areq_ctx->src.mapped_nents, (LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES + LLI_MAX_NUM_OF_DATA_ENTRIES), --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60F32CCA483 for ; Tue, 7 Jun 2022 22:32:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352974AbiFGWcK (ORCPT ); Tue, 7 Jun 2022 18:32:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380616AbiFGVQf (ORCPT ); Tue, 7 Jun 2022 17:16:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 274A321E320; Tue, 7 Jun 2022 11:55: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 B63CDB8220B; Tue, 7 Jun 2022 18:55:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20042C385A2; Tue, 7 Jun 2022 18:55:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628135; bh=etlSzNB3grrboXbbp7K/HPtPiQ3/vS9tQOuqaVtCEwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j9p03+Txtx5dYwz4YRWmVLTumSRQPf8r16ZTj4WkYIJWC0Zb9FwsgbOEJcX8A1+8C LJo3oSxdapE0PM79lPtTc8azCPlPNd0nNpqCb2Aw0imkneib6yrotRTkU0tr0j26Fq YSMMMm2qAx5znGYCXeitvI7USMXcQjY8PrqBeFuA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marco Chiappero , Giovanni Cabiddu , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 219/879] crypto: qat - fix off-by-one error in PFVF debug print Date: Tue, 7 Jun 2022 18:55:37 +0200 Message-Id: <20220607165009.211537519@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marco Chiappero [ Upstream commit dd3d081b7ea6754913222ed0313fcf644edcc7e6 ] PFVF Block Message requests for CRC use 0-based values to indicate amounts, which have to be remapped to 1-based values on the receiving side. This patch fixes one debug print which was however using the wire value. Signed-off-by: Marco Chiappero Reviewed-by: Giovanni Cabiddu Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c b/drivers/cr= ypto/qat/qat_common/adf_pfvf_pf_proto.c index 588352de1ef0..d17318d3f63a 100644 --- a/drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c +++ b/drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c @@ -154,7 +154,7 @@ static struct pfvf_message handle_blkmsg_req(struct adf= _accel_vf_info *vf_info, if (FIELD_GET(ADF_VF2PF_BLOCK_CRC_REQ_MASK, req.data)) { dev_dbg(&GET_DEV(vf_info->accel_dev), "BlockMsg of type %d for CRC over %d bytes received from VF%d\n", - blk_type, blk_byte, vf_info->vf_nr); + blk_type, blk_byte + 1, vf_info->vf_nr); =20 if (!adf_pf2vf_blkmsg_get_data(vf_info, blk_type, blk_byte, byte_max, &resp_data, --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3DB2CCA48B for ; Tue, 7 Jun 2022 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385454AbiFGWVj (ORCPT ); Tue, 7 Jun 2022 18:21:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380625AbiFGVQh (ORCPT ); Tue, 7 Jun 2022 17:16: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 CC99821E32D; Tue, 7 Jun 2022 11:55: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 66958B81F6D; Tue, 7 Jun 2022 18:55:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA99EC385A2; Tue, 7 Jun 2022 18:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628138; bh=85vm1vrtGgzFH8G8lTONTiZh58r6Wicm/naQSPQ/3OI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p3OfFsOAT82Ju5wR/4ATJojAR6NEYDy0q6c03He3kwh3td53y92cVaaxpNlz7FiI6 7OCNNOvjDzBPNIiGDNqeh636ZdwPhPRmZBqNGPHyNkki6ogeMwR7OY47SearRHGWOs hzWcoaTmSHL+jNAxV/gxomEy5N9CQHaGxfwDZKuc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, QintaoShen , Nishanth Menon , Sasha Levin Subject: [PATCH 5.18 220/879] soc: ti: ti_sci_pm_domains: Check for null return of devm_kcalloc Date: Tue, 7 Jun 2022 18:55:38 +0200 Message-Id: <20220607165009.239976171@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: QintaoShen [ Upstream commit ba56291e297d28aa6eb82c5c1964fae2d7594746 ] The allocation funciton devm_kcalloc may fail and return a null pointer, which would cause a null-pointer dereference later. It might be better to check it and directly return -ENOMEM just like the usage of devm_kcalloc in previous code. Signed-off-by: QintaoShen Signed-off-by: Nishanth Menon Link: https://lore.kernel.org/r/1648107843-29077-1-git-send-email-unSimple1= 993@163.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/soc/ti/ti_sci_pm_domains.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/soc/ti/ti_sci_pm_domains.c b/drivers/soc/ti/ti_sci_pm_= domains.c index 8afb3f45d263..a33ec7eaf23d 100644 --- a/drivers/soc/ti/ti_sci_pm_domains.c +++ b/drivers/soc/ti/ti_sci_pm_domains.c @@ -183,6 +183,8 @@ static int ti_sci_pm_domain_probe(struct platform_devic= e *pdev) devm_kcalloc(dev, max_id + 1, sizeof(*pd_provider->data.domains), GFP_KERNEL); + if (!pd_provider->data.domains) + return -ENOMEM; =20 pd_provider->data.num_domains =3D max_id + 1; pd_provider->data.xlate =3D ti_sci_pd_xlate; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44E08CCA47C for ; Tue, 7 Jun 2022 22:32:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381660AbiFGWc0 (ORCPT ); Tue, 7 Jun 2022 18:32:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380636AbiFGVQi (ORCPT ); Tue, 7 Jun 2022 17:16:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6F0B21E333; Tue, 7 Jun 2022 11:55:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7C6FDB81FE1; Tue, 7 Jun 2022 18:55:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82563C385A2; Tue, 7 Jun 2022 18:55:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628141; bh=yoxhDZYgsb+yYlZZwz5ToNqwGqQPdnkh/B9IKDpd3kM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m6j89rsuKBfCS73Dobnk3iyqkHne8BjH8oioTGHbdeYnv8a7KruXfgFC7L/Xfdnnl HNAKnXyKa+d0D+Gh88AtyaWk85NfaezezS5KlWf2F+UvoQ5xbDuHy4CRT3+7pt9qYJ zopxTejqsWu+FJMc6sNrKOy+KufxvRLbSqjUlPJk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, TOTE Robot , Zixuan Fu , Dave Kleikamp , Sasha Levin Subject: [PATCH 5.18 221/879] fs: jfs: fix possible NULL pointer dereference in dbFree() Date: Tue, 7 Jun 2022 18:55:39 +0200 Message-Id: <20220607165009.268155164@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zixuan Fu [ Upstream commit 0d4837fdb796f99369cf7691d33de1b856bcaf1f ] In our fault-injection testing, the variable "nblocks" in dbFree() can be zero when kmalloc_array() fails in dtSearch(). In this case, the variable "mp" in dbFree() would be NULL and then it is dereferenced in "write_metapage(mp)". The failure log is listed as follows: [ 13.824137] BUG: kernel NULL pointer dereference, address: 0000000000000= 020 ... [ 13.827416] RIP: 0010:dbFree+0x5f7/0x910 [jfs] [ 13.834341] Call Trace: [ 13.834540] [ 13.834713] txFreeMap+0x7b4/0xb10 [jfs] [ 13.835038] txUpdateMap+0x311/0x650 [jfs] [ 13.835375] jfs_lazycommit+0x5f2/0xc70 [jfs] [ 13.835726] ? sched_dynamic_update+0x1b0/0x1b0 [ 13.836092] kthread+0x3c2/0x4a0 [ 13.836355] ? txLockFree+0x160/0x160 [jfs] [ 13.836763] ? kthread_unuse_mm+0x160/0x160 [ 13.837106] ret_from_fork+0x1f/0x30 [ 13.837402] ... This patch adds a NULL check of "mp" before "write_metapage(mp)" is called. Reported-by: TOTE Robot Signed-off-by: Zixuan Fu Signed-off-by: Dave Kleikamp Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/jfs/jfs_dmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index d8502f4989d9..e75f31b81d63 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c @@ -385,7 +385,8 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks) } =20 /* write the last buffer. */ - write_metapage(mp); + if (mp) + write_metapage(mp); =20 IREAD_UNLOCK(ipbmap); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7856C43334 for ; Tue, 7 Jun 2022 22:32:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380736AbiFGWcQ (ORCPT ); Tue, 7 Jun 2022 18:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380634AbiFGVQi (ORCPT ); Tue, 7 Jun 2022 17:16:38 -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 A69F521E331; Tue, 7 Jun 2022 11:55:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E99C161768; Tue, 7 Jun 2022 18:55:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0754C385A2; Tue, 7 Jun 2022 18:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628144; bh=FfPhJu8v9WFm9WF85DjB2S/mhUA3fz0JzrI1FkCPw8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oBUZ6M/zleqr0j3B5/cBLMp4QW+wLlbk4UcBGf1smQAvIDxsJ205vsnQgyqAJfYoQ gkig+Y+dbcKM7FUA+DlfXc0lQllw+iJzy4NfWr34Sljub+F/vLjbSt2b972paLdVd3 IRVro7V2HrKgppw8FNXKzfcLITOV/cpuKexSZfYs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joel Selvaraj , Caleb Connolly , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 222/879] arm64: dts: qcom: sdm845-xiaomi-beryllium: fix typo in panels vddio-supply property Date: Tue, 7 Jun 2022 18:55:40 +0200 Message-Id: <20220607165009.296704905@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joel Selvaraj [ Upstream commit 1f1c494082a1f10d03ce4ee1485ee96d212e22ff ] vddio is misspelled with a "0" instead of "o". Fix it. Signed-off-by: Joel Selvaraj Reviewed-by: Caleb Connolly Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/BY5PR02MB7009901651E6A8D5ACB0425ED91F9@BY5P= R02MB7009.namprd02.prod.outlook.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts b/arch/ar= m64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts index 367389526b41..a97f5e89e1d0 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts @@ -218,7 +218,7 @@ panel@0 { compatible =3D "tianma,fhd-video"; reg =3D <0>; - vddi0-supply =3D <&vreg_l14a_1p8>; + vddio-supply =3D <&vreg_l14a_1p8>; vddpos-supply =3D <&lab>; vddneg-supply =3D <&ibb>; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37878CCA492 for ; Tue, 7 Jun 2022 22:32:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382250AbiFGWb6 (ORCPT ); Tue, 7 Jun 2022 18:31:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380641AbiFGVQi (ORCPT ); Tue, 7 Jun 2022 17:16:38 -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 2686C21E33B; Tue, 7 Jun 2022 11:55:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B0D6E61277; Tue, 7 Jun 2022 18:55:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC8C2C385A2; Tue, 7 Jun 2022 18:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628147; bh=FsnhM5PT/E5Fpk+dkdwL4mlsa9gXKVZzJ8yZXv4wNXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wWe9UrGmQtnl0J26HkbOLDdSnMEO1HjsHPD9NsgGiM27ZbHJE6+ru8rFqMBVTVdTx h7rhRPDk/yBUaPe5iXc3CUEHDoBCWRGzD0BRgKEk1J6uLIAputT2CJY2BPF31QpYSG RwUoaWKfGsR0ltr670P3QKD73bymjtO5AiYuQj1g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.18 223/879] ALSA: usb-audio: Add quirk bits for enabling/disabling generic implicit fb Date: Tue, 7 Jun 2022 18:55:41 +0200 Message-Id: <20220607165009.326406828@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 0f1f7a6661394fe4a53db254c346d6aa2dd64397 ] For making easier to test, add the new quirk_flags bits 17 and 18 to enable and disable the generic implicit feedback mode. The bit 17 is equivalent with implicit_fb=3D1 option, applying the generic implicit feedback sync mode. OTOH, the bit 18 disables the implicit fb mode forcibly. Link: https://lore.kernel.org/r/20220421064101.12456-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- Documentation/sound/alsa-configuration.rst | 4 +++- sound/usb/implicit.c | 5 ++++- sound/usb/usbaudio.h | 6 ++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/sound/alsa-configuration.rst b/Documentation/sou= nd/alsa-configuration.rst index 34888d4fc4a8..21ab5e6f7062 100644 --- a/Documentation/sound/alsa-configuration.rst +++ b/Documentation/sound/alsa-configuration.rst @@ -2246,7 +2246,7 @@ implicit_fb Apply the generic implicit feedback sync mode. When this is set and the playback stream sync mode is ASYNC, the driver tries to tie an adjacent ASYNC capture stream as the implicit feedback - source. + source. This is equivalent with quirk_flags bit 17. use_vmalloc Use vmalloc() for allocations of the PCM buffers (default: yes). For architectures with non-coherent memory like ARM or MIPS, the @@ -2288,6 +2288,8 @@ quirk_flags * bit 14: Ignore errors for mixer access * bit 15: Support generic DSD raw U32_BE format * bit 16: Set up the interface at first like UAC1 + * bit 17: Apply the generic implicit feedback sync mode + * bit 18: Don't apply implicit feedback sync mode =20 This module supports multiple devices, autoprobe and hotplugging. =20 diff --git a/sound/usb/implicit.c b/sound/usb/implicit.c index 2d444ec74202..1fd087128538 100644 --- a/sound/usb/implicit.c +++ b/sound/usb/implicit.c @@ -350,7 +350,8 @@ static int audioformat_implicit_fb_quirk(struct snd_usb= _audio *chip, } =20 /* Try the generic implicit fb if available */ - if (chip->generic_implicit_fb) + if (chip->generic_implicit_fb || + (chip->quirk_flags & QUIRK_FLAG_GENERIC_IMPLICIT_FB)) return add_generic_implicit_fb(chip, fmt, alts); =20 /* No quirk */ @@ -387,6 +388,8 @@ int snd_usb_parse_implicit_fb_quirk(struct snd_usb_audi= o *chip, struct audioformat *fmt, struct usb_host_interface *alts) { + if (chip->quirk_flags & QUIRK_FLAG_SKIP_IMPLICIT_FB) + return 0; if (fmt->endpoint & USB_DIR_IN) return audioformat_capture_quirk(chip, fmt, alts); else diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index b8359a0aa008..044cd7ab27cb 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h @@ -164,6 +164,10 @@ extern bool snd_usb_skip_validation; * Support generic DSD raw U32_BE format * QUIRK_FLAG_SET_IFACE_FIRST: * Set up the interface at first like UAC1 + * QUIRK_FLAG_GENERIC_IMPLICIT_FB + * Apply the generic implicit feedback sync mode (same as implicit_fb=3D1= option) + * QUIRK_FLAG_SKIP_IMPLICIT_FB + * Don't apply implicit feedback sync mode */ =20 #define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0) @@ -183,5 +187,7 @@ extern bool snd_usb_skip_validation; #define QUIRK_FLAG_IGNORE_CTL_ERROR (1U << 14) #define QUIRK_FLAG_DSD_RAW (1U << 15) #define QUIRK_FLAG_SET_IFACE_FIRST (1U << 16) +#define QUIRK_FLAG_GENERIC_IMPLICIT_FB (1U << 17) +#define QUIRK_FLAG_SKIP_IMPLICIT_FB (1U << 18) =20 #endif /* __USBAUDIO_H */ --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01C93CCA48D for ; Tue, 7 Jun 2022 22:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380357AbiFGWbw (ORCPT ); Tue, 7 Jun 2022 18:31:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380665AbiFGVQk (ORCPT ); Tue, 7 Jun 2022 17:16:40 -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 457A721F992; Tue, 7 Jun 2022 11:55: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 D158DB81FE1; Tue, 7 Jun 2022 18:55:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B612C385A2; Tue, 7 Jun 2022 18:55:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628152; bh=2JYU5DuEm+BMLnrJLtWoA5OKIcB5KezmZmgoLCAFNSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fIdpKwlcGaP4GgDQQdbll3YZ+uPVBjxXkKyyYzM8Xr/+IWl4VorMLlrIlT4J6jUrv YOR8vqPpEAZk6J5OHbdfu/dCQUp4h7xnqkvnFMu0s60bUuNsL/ptXs+HxVJ2IYfp2z ahT/FH/p0arQVMzzA1jhUX4c/E4Nj3OwX319GPWo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.18 224/879] ALSA: usb-audio: Move generic implicit fb quirk entries into quirks.c Date: Tue, 7 Jun 2022 18:55:42 +0200 Message-Id: <20220607165009.355896372@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 67d64069bc0867e52e73a1e255b17462005ca9b4 ] Use the new quirk bits to manage the generic implicit fb quirk entries. This makes easier to compare with other devices. Link: https://lore.kernel.org/r/20220421064101.12456-2-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- sound/usb/implicit.c | 5 ----- sound/usb/quirks.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sound/usb/implicit.c b/sound/usb/implicit.c index 1fd087128538..e1bf1b5da423 100644 --- a/sound/usb/implicit.c +++ b/sound/usb/implicit.c @@ -45,11 +45,6 @@ struct snd_usb_implicit_fb_match { =20 /* Implicit feedback quirk table for playback */ static const struct snd_usb_implicit_fb_match playback_implicit_fb_quirks[= ] =3D { - /* Generic matching */ - IMPLICIT_FB_GENERIC_DEV(0x0499, 0x1509), /* Steinberg UR22 */ - IMPLICIT_FB_GENERIC_DEV(0x0763, 0x2030), /* M-Audio Fast Track C400 */ - IMPLICIT_FB_GENERIC_DEV(0x0763, 0x2031), /* M-Audio Fast Track C600 */ - /* Fixed EP */ /* FIXME: check the availability of generic matching */ IMPLICIT_FB_FIXED_DEV(0x0763, 0x2080, 0x81, 2), /* M-Audio FastTrack Ultr= a */ diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index fbbe59054c3f..e8468f9b007d 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1793,6 +1793,8 @@ static const struct usb_audio_quirk_flags_table quirk= _flags_table[] =3D { QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_IGNORE_CTL_ERROR), DEVICE_FLG(0x046d, 0x09a4, /* Logitech QuickCam E 3500 */ QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_IGNORE_CTL_ERROR), + DEVICE_FLG(0x0499, 0x1509, /* Steinberg UR22 */ + QUIRK_FLAG_GENERIC_IMPLICIT_FB), DEVICE_FLG(0x04d8, 0xfeea, /* Benchmark DAC1 Pre */ QUIRK_FLAG_GET_SAMPLE_RATE), DEVICE_FLG(0x04e8, 0xa051, /* Samsung USBC Headset (AKG) */ @@ -1826,6 +1828,10 @@ static const struct usb_audio_quirk_flags_table quir= k_flags_table[] =3D { QUIRK_FLAG_GET_SAMPLE_RATE), DEVICE_FLG(0x074d, 0x3553, /* Outlaw RR2150 (Micronas UAC3553B) */ QUIRK_FLAG_GET_SAMPLE_RATE), + DEVICE_FLG(0x0763, 0x2030, /* M-Audio Fast Track C400 */ + QUIRK_FLAG_GENERIC_IMPLICIT_FB), + DEVICE_FLG(0x0763, 0x2031, /* M-Audio Fast Track C600 */ + QUIRK_FLAG_GENERIC_IMPLICIT_FB), DEVICE_FLG(0x08bb, 0x2702, /* LineX FM Transmitter */ QUIRK_FLAG_IGNORE_CTL_ERROR), DEVICE_FLG(0x0951, 0x16ad, /* Kingston HyperX */ --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13C93C433EF for ; Tue, 7 Jun 2022 22:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382577AbiFGWWa (ORCPT ); Tue, 7 Jun 2022 18:22:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380670AbiFGVQk (ORCPT ); Tue, 7 Jun 2022 17:16:40 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0EC621F99D; Tue, 7 Jun 2022 11:55:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 3DBD5CE244E; Tue, 7 Jun 2022 18:55:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41CCFC385A2; Tue, 7 Jun 2022 18:55:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628155; bh=XHRtkpxftbgTm/PySu+8nLF6MiAvmFtE9vRGXyrzS1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kta9bq+MQSo4wGAbJpUrUUWT824c8gfr6NO5dj1Wn7rQnUCP0TD4XrkVmVcMWulcw r2sNA8MusyeS/iUNcgnSoVmtkvbZ5TzTRsus2BwpFf6KI7GVBLF0Pr3LgwY8v1VO/r I/3NBu8fTInuCPX1DDcPmixHH3zKMhcrsrWHazYg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janusz Krzysztofik , Tony Lindgren , Arnd Bergmann , Sasha Levin Subject: [PATCH 5.18 225/879] ARM: OMAP1: clock: Fix UART rate reporting algorithm Date: Tue, 7 Jun 2022 18:55:43 +0200 Message-Id: <20220607165009.385151259@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Janusz Krzysztofik [ Upstream commit 338d5d476cde853dfd97378d20496baabc2ce3c0 ] Since its introduction to the mainline kernel, omap1_uart_recalc() helper makes incorrect use of clk->enable_bit as a ready to use bitmap mask while it only provides the bit number. Fix it. Signed-off-by: Janusz Krzysztofik Acked-by: Tony Lindgren Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/mach-omap1/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index 9d4a0ab50a46..d63d5eb8d8fd 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c @@ -41,7 +41,7 @@ static DEFINE_SPINLOCK(clockfw_lock); unsigned long omap1_uart_recalc(struct clk *clk) { unsigned int val =3D __raw_readl(clk->enable_reg); - return val & clk->enable_bit ? 48000000 : 12000000; + return val & 1 << clk->enable_bit ? 48000000 : 12000000; } =20 unsigned long omap1_sossi_recalc(struct clk *clk) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EE0FC433EF for ; Tue, 7 Jun 2022 22:22:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380804AbiFGWWW (ORCPT ); Tue, 7 Jun 2022 18:22:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380674AbiFGVQk (ORCPT ); Tue, 7 Jun 2022 17:16:40 -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 7FA2E21F989; Tue, 7 Jun 2022 11:55:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 14BA961311; Tue, 7 Jun 2022 18:55:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BBBDC385A2; Tue, 7 Jun 2022 18:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628158; bh=UVrRQ7UUGdZgqTTfy/Jr0X61/9B2DuEKbjBLSnF3gKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VrjOr1N6miuLMcMR/So6H688DvkYssGsbA6ERfkfB5vOOpjYGKjMOZl0gAgEp9sDq DH5Det4QhOwYfEyGvQAv18ylPcZ8ueSHLjljVvk/F6Pb5o2cdfOkpghzK+/KBHgCeK 9pRX6MLMPUEerNIdZaOR0nWn6yvFKkQJOt6T66Dw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hari Bathini , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 226/879] powerpc/fadump: Fix fadump to work with a different endian capture kernel Date: Tue, 7 Jun 2022 18:55:44 +0200 Message-Id: <20220607165009.413391321@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hari Bathini [ Upstream commit b74196af372f7cb4902179009265fe63ac81824f ] Dump capture would fail if capture kernel is not of the endianess as the production kernel, because the in-memory data structure (struct opal_fadump_mem_struct) shared across production kernel and capture kernel assumes the same endianess for both the kernels, which doesn't have to be true always. Fix it by having a well-defined endianess for struct opal_fadump_mem_struct. Signed-off-by: Hari Bathini Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/161902744901.86147.14719228311655123526.stg= it@hbathini Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/platforms/powernv/opal-fadump.c | 94 +++++++++++--------- arch/powerpc/platforms/powernv/opal-fadump.h | 10 +-- 2 files changed, 57 insertions(+), 47 deletions(-) diff --git a/arch/powerpc/platforms/powernv/opal-fadump.c b/arch/powerpc/pl= atforms/powernv/opal-fadump.c index c8ad057c7221..9d74d3950a52 100644 --- a/arch/powerpc/platforms/powernv/opal-fadump.c +++ b/arch/powerpc/platforms/powernv/opal-fadump.c @@ -60,7 +60,7 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_co= nf, u64 node) addr =3D be64_to_cpu(addr); pr_debug("Kernel metadata addr: %llx\n", addr); opal_fdm_active =3D (void *)addr; - if (opal_fdm_active->registered_regions =3D=3D 0) + if (be16_to_cpu(opal_fdm_active->registered_regions) =3D=3D 0) return; =20 ret =3D opal_mpipl_query_tag(OPAL_MPIPL_TAG_BOOT_MEM, &addr); @@ -95,17 +95,17 @@ static int opal_fadump_unregister(struct fw_dump *fadum= p_conf); static void opal_fadump_update_config(struct fw_dump *fadump_conf, const struct opal_fadump_mem_struct *fdm) { - pr_debug("Boot memory regions count: %d\n", fdm->region_cnt); + pr_debug("Boot memory regions count: %d\n", be16_to_cpu(fdm->region_cnt)); =20 /* * The destination address of the first boot memory region is the * destination address of boot memory regions. */ - fadump_conf->boot_mem_dest_addr =3D fdm->rgn[0].dest; + fadump_conf->boot_mem_dest_addr =3D be64_to_cpu(fdm->rgn[0].dest); pr_debug("Destination address of boot memory regions: %#016llx\n", fadump_conf->boot_mem_dest_addr); =20 - fadump_conf->fadumphdr_addr =3D fdm->fadumphdr_addr; + fadump_conf->fadumphdr_addr =3D be64_to_cpu(fdm->fadumphdr_addr); } =20 /* @@ -126,9 +126,9 @@ static void __init opal_fadump_get_config(struct fw_dum= p *fadump_conf, fadump_conf->boot_memory_size =3D 0; =20 pr_debug("Boot memory regions:\n"); - for (i =3D 0; i < fdm->region_cnt; i++) { - base =3D fdm->rgn[i].src; - size =3D fdm->rgn[i].size; + for (i =3D 0; i < be16_to_cpu(fdm->region_cnt); i++) { + base =3D be64_to_cpu(fdm->rgn[i].src); + size =3D be64_to_cpu(fdm->rgn[i].size); pr_debug("\t[%03d] base: 0x%lx, size: 0x%lx\n", i, base, size); =20 fadump_conf->boot_mem_addr[i] =3D base; @@ -143,7 +143,7 @@ static void __init opal_fadump_get_config(struct fw_dum= p *fadump_conf, * Start address of reserve dump area (permanent reservation) for * re-registering FADump after dump capture. */ - fadump_conf->reserve_dump_area_start =3D fdm->rgn[0].dest; + fadump_conf->reserve_dump_area_start =3D be64_to_cpu(fdm->rgn[0].dest); =20 /* * Rarely, but it can so happen that system crashes before all @@ -155,13 +155,14 @@ static void __init opal_fadump_get_config(struct fw_d= ump *fadump_conf, * Hope the memory that could not be preserved only has pages * that are usually filtered out while saving the vmcore. */ - if (fdm->region_cnt > fdm->registered_regions) { + if (be16_to_cpu(fdm->region_cnt) > be16_to_cpu(fdm->registered_regions)) { pr_warn("Not all memory regions were saved!!!\n"); pr_warn(" Unsaved memory regions:\n"); - i =3D fdm->registered_regions; - while (i < fdm->region_cnt) { + i =3D be16_to_cpu(fdm->registered_regions); + while (i < be16_to_cpu(fdm->region_cnt)) { pr_warn("\t[%03d] base: 0x%llx, size: 0x%llx\n", - i, fdm->rgn[i].src, fdm->rgn[i].size); + i, be64_to_cpu(fdm->rgn[i].src), + be64_to_cpu(fdm->rgn[i].size)); i++; } =20 @@ -170,7 +171,7 @@ static void __init opal_fadump_get_config(struct fw_dum= p *fadump_conf, } =20 fadump_conf->boot_mem_top =3D (fadump_conf->boot_memory_size + hole_size); - fadump_conf->boot_mem_regs_cnt =3D fdm->region_cnt; + fadump_conf->boot_mem_regs_cnt =3D be16_to_cpu(fdm->region_cnt); opal_fadump_update_config(fadump_conf, fdm); } =20 @@ -178,35 +179,38 @@ static void __init opal_fadump_get_config(struct fw_d= ump *fadump_conf, static void opal_fadump_init_metadata(struct opal_fadump_mem_struct *fdm) { fdm->version =3D OPAL_FADUMP_VERSION; - fdm->region_cnt =3D 0; - fdm->registered_regions =3D 0; - fdm->fadumphdr_addr =3D 0; + fdm->region_cnt =3D cpu_to_be16(0); + fdm->registered_regions =3D cpu_to_be16(0); + fdm->fadumphdr_addr =3D cpu_to_be64(0); } =20 static u64 opal_fadump_init_mem_struct(struct fw_dump *fadump_conf) { u64 addr =3D fadump_conf->reserve_dump_area_start; + u16 reg_cnt; int i; =20 opal_fdm =3D __va(fadump_conf->kernel_metadata); opal_fadump_init_metadata(opal_fdm); =20 /* Boot memory regions */ + reg_cnt =3D be16_to_cpu(opal_fdm->region_cnt); for (i =3D 0; i < fadump_conf->boot_mem_regs_cnt; i++) { - opal_fdm->rgn[i].src =3D fadump_conf->boot_mem_addr[i]; - opal_fdm->rgn[i].dest =3D addr; - opal_fdm->rgn[i].size =3D fadump_conf->boot_mem_sz[i]; + opal_fdm->rgn[i].src =3D cpu_to_be64(fadump_conf->boot_mem_addr[i]); + opal_fdm->rgn[i].dest =3D cpu_to_be64(addr); + opal_fdm->rgn[i].size =3D cpu_to_be64(fadump_conf->boot_mem_sz[i]); =20 - opal_fdm->region_cnt++; + reg_cnt++; addr +=3D fadump_conf->boot_mem_sz[i]; } + opal_fdm->region_cnt =3D cpu_to_be16(reg_cnt); =20 /* * Kernel metadata is passed to f/w and retrieved in capture kerenl. * So, use it to save fadump header address instead of calculating it. */ - opal_fdm->fadumphdr_addr =3D (opal_fdm->rgn[0].dest + - fadump_conf->boot_memory_size); + opal_fdm->fadumphdr_addr =3D cpu_to_be64(be64_to_cpu(opal_fdm->rgn[0].des= t) + + fadump_conf->boot_memory_size); =20 opal_fadump_update_config(fadump_conf, opal_fdm); =20 @@ -269,18 +273,21 @@ static u64 opal_fadump_get_bootmem_min(void) static int opal_fadump_register(struct fw_dump *fadump_conf) { s64 rc =3D OPAL_PARAMETER; + u16 registered_regs; int i, err =3D -EIO; =20 - for (i =3D 0; i < opal_fdm->region_cnt; i++) { + registered_regs =3D be16_to_cpu(opal_fdm->registered_regions); + for (i =3D 0; i < be16_to_cpu(opal_fdm->region_cnt); i++) { rc =3D opal_mpipl_update(OPAL_MPIPL_ADD_RANGE, - opal_fdm->rgn[i].src, - opal_fdm->rgn[i].dest, - opal_fdm->rgn[i].size); + be64_to_cpu(opal_fdm->rgn[i].src), + be64_to_cpu(opal_fdm->rgn[i].dest), + be64_to_cpu(opal_fdm->rgn[i].size)); if (rc !=3D OPAL_SUCCESS) break; =20 - opal_fdm->registered_regions++; + registered_regs++; } + opal_fdm->registered_regions =3D cpu_to_be16(registered_regs); =20 switch (rc) { case OPAL_SUCCESS: @@ -291,7 +298,8 @@ static int opal_fadump_register(struct fw_dump *fadump_= conf) case OPAL_RESOURCE: /* If MAX regions limit in f/w is hit, warn and proceed. */ pr_warn("%d regions could not be registered for MPIPL as MAX limit is re= ached!\n", - (opal_fdm->region_cnt - opal_fdm->registered_regions)); + (be16_to_cpu(opal_fdm->region_cnt) - + be16_to_cpu(opal_fdm->registered_regions))); fadump_conf->dump_registered =3D 1; err =3D 0; break; @@ -312,7 +320,7 @@ static int opal_fadump_register(struct fw_dump *fadump_= conf) * If some regions were registered before OPAL_MPIPL_ADD_RANGE * OPAL call failed, unregister all regions. */ - if ((err < 0) && (opal_fdm->registered_regions > 0)) + if ((err < 0) && (be16_to_cpu(opal_fdm->registered_regions) > 0)) opal_fadump_unregister(fadump_conf); =20 return err; @@ -328,7 +336,7 @@ static int opal_fadump_unregister(struct fw_dump *fadum= p_conf) return -EIO; } =20 - opal_fdm->registered_regions =3D 0; + opal_fdm->registered_regions =3D cpu_to_be16(0); fadump_conf->dump_registered =3D 0; return 0; } @@ -563,19 +571,20 @@ static void opal_fadump_region_show(struct fw_dump *f= adump_conf, else fdm_ptr =3D opal_fdm; =20 - for (i =3D 0; i < fdm_ptr->region_cnt; i++) { + for (i =3D 0; i < be16_to_cpu(fdm_ptr->region_cnt); i++) { /* * Only regions that are registered for MPIPL * would have dump data. */ if ((fadump_conf->dump_active) && - (i < fdm_ptr->registered_regions)) - dumped_bytes =3D fdm_ptr->rgn[i].size; + (i < be16_to_cpu(fdm_ptr->registered_regions))) + dumped_bytes =3D be64_to_cpu(fdm_ptr->rgn[i].size); =20 seq_printf(m, "DUMP: Src: %#016llx, Dest: %#016llx, ", - fdm_ptr->rgn[i].src, fdm_ptr->rgn[i].dest); + be64_to_cpu(fdm_ptr->rgn[i].src), + be64_to_cpu(fdm_ptr->rgn[i].dest)); seq_printf(m, "Size: %#llx, Dumped: %#llx bytes\n", - fdm_ptr->rgn[i].size, dumped_bytes); + be64_to_cpu(fdm_ptr->rgn[i].size), dumped_bytes); } =20 /* Dump is active. Show reserved area start address. */ @@ -624,6 +633,7 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_= conf, u64 node) { const __be32 *prop; unsigned long dn; + __be64 be_addr; u64 addr =3D 0; int i, len; s64 ret; @@ -680,13 +690,13 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadum= p_conf, u64 node) if (!prop) return; =20 - ret =3D opal_mpipl_query_tag(OPAL_MPIPL_TAG_KERNEL, &addr); - if ((ret !=3D OPAL_SUCCESS) || !addr) { + ret =3D opal_mpipl_query_tag(OPAL_MPIPL_TAG_KERNEL, &be_addr); + if ((ret !=3D OPAL_SUCCESS) || !be_addr) { pr_err("Failed to get Kernel metadata (%lld)\n", ret); return; } =20 - addr =3D be64_to_cpu(addr); + addr =3D be64_to_cpu(be_addr); pr_debug("Kernel metadata addr: %llx\n", addr); =20 opal_fdm_active =3D __va(addr); @@ -697,14 +707,14 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadum= p_conf, u64 node) } =20 /* Kernel regions not registered with f/w for MPIPL */ - if (opal_fdm_active->registered_regions =3D=3D 0) { + if (be16_to_cpu(opal_fdm_active->registered_regions) =3D=3D 0) { opal_fdm_active =3D NULL; return; } =20 - ret =3D opal_mpipl_query_tag(OPAL_MPIPL_TAG_CPU, &addr); - if (addr) { - addr =3D be64_to_cpu(addr); + ret =3D opal_mpipl_query_tag(OPAL_MPIPL_TAG_CPU, &be_addr); + if (be_addr) { + addr =3D be64_to_cpu(be_addr); pr_debug("CPU metadata addr: %llx\n", addr); opal_cpu_metadata =3D __va(addr); } diff --git a/arch/powerpc/platforms/powernv/opal-fadump.h b/arch/powerpc/pl= atforms/powernv/opal-fadump.h index f1e9ecf548c5..3f715efb0aa6 100644 --- a/arch/powerpc/platforms/powernv/opal-fadump.h +++ b/arch/powerpc/platforms/powernv/opal-fadump.h @@ -31,14 +31,14 @@ * OPAL FADump kernel metadata * * The address of this structure will be registered with f/w for retrieving - * and processing during crash dump. + * in the capture kernel to process the crash dump. */ struct opal_fadump_mem_struct { u8 version; u8 reserved[3]; - u16 region_cnt; /* number of regions */ - u16 registered_regions; /* Regions registered for MPIPL */ - u64 fadumphdr_addr; + __be16 region_cnt; /* number of regions */ + __be16 registered_regions; /* Regions registered for MPIPL */ + __be64 fadumphdr_addr; struct opal_mpipl_region rgn[FADUMP_MAX_MEM_REGS]; } __packed; =20 @@ -135,7 +135,7 @@ static inline void opal_fadump_read_regs(char *bufp, un= signed int regs_cnt, for (i =3D 0; i < regs_cnt; i++, bufp +=3D reg_entry_size) { reg_entry =3D (struct hdat_fadump_reg_entry *)bufp; val =3D (cpu_endian ? be64_to_cpu(reg_entry->reg_val) : - reg_entry->reg_val); + (u64)(reg_entry->reg_val)); opal_fadump_set_regval_regnum(regs, be32_to_cpu(reg_entry->reg_type), be32_to_cpu(reg_entry->reg_num), --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B88ECCA47F for ; Tue, 7 Jun 2022 22:22:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382745AbiFGWWB (ORCPT ); Tue, 7 Jun 2022 18:22:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380682AbiFGVQl (ORCPT ); Tue, 7 Jun 2022 17:16:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1011221F99A; Tue, 7 Jun 2022 11:56:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 90B9CB81FE1; Tue, 7 Jun 2022 18:56:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE0C4C385A2; Tue, 7 Jun 2022 18:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628161; bh=FTiI156Bl/R9a/IH+dywYgcf8JKm5MuzE4oQ6KL5C9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HbYuhywtT798ruk1VW5mLXvo/yKpG6fGSiJouXicq3JA9FsMIt6BWrpPAPTLJ3VRN e8CjnbtX+/otF3NIjHHOJVkzsEthy5SXNfyPvM7c/bvG8+b8+YJ0snp/nybcqbWkmN D0lu5W370nmFubQ+WWZ2ZPmfwtNABvmqBqm++qqw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, OGAWA Hirofumi , qianfan , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 227/879] fat: add ratelimit to fat*_ent_bread() Date: Tue, 7 Jun 2022 18:55:45 +0200 Message-Id: <20220607165009.442191631@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: OGAWA Hirofumi [ Upstream commit 183c3237c928109d2008c0456dff508baf692b20 ] fat*_ent_bread() can be the cause of too many report on I/O error path. So use fat_msg_ratelimit() instead. Link: https://lkml.kernel.org/r/87bkxogfeq.fsf@mail.parknet.co.jp Signed-off-by: OGAWA Hirofumi Reported-by: qianfan Tested-by: qianfan Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/fat/fatent.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index 978ac6751aeb..1db348f8f887 100644 --- a/fs/fat/fatent.c +++ b/fs/fat/fatent.c @@ -94,7 +94,8 @@ static int fat12_ent_bread(struct super_block *sb, struct= fat_entry *fatent, err_brelse: brelse(bhs[0]); err: - fat_msg(sb, KERN_ERR, "FAT read failed (blocknr %llu)", (llu)blocknr); + fat_msg_ratelimit(sb, KERN_ERR, "FAT read failed (blocknr %llu)", + (llu)blocknr); return -EIO; } =20 @@ -107,8 +108,8 @@ static int fat_ent_bread(struct super_block *sb, struct= fat_entry *fatent, fatent->fat_inode =3D MSDOS_SB(sb)->fat_inode; fatent->bhs[0] =3D sb_bread(sb, blocknr); if (!fatent->bhs[0]) { - fat_msg(sb, KERN_ERR, "FAT read failed (blocknr %llu)", - (llu)blocknr); + fat_msg_ratelimit(sb, KERN_ERR, "FAT read failed (blocknr %llu)", + (llu)blocknr); return -EIO; } fatent->nr_bhs =3D 1; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B997EC43334 for ; Tue, 7 Jun 2022 22:22:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380524AbiFGWWN (ORCPT ); Tue, 7 Jun 2022 18:22:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380687AbiFGVQl (ORCPT ); Tue, 7 Jun 2022 17:16:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 130C521F9A3; Tue, 7 Jun 2022 11:56:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 925A36176D; Tue, 7 Jun 2022 18:56:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2CCCC385A2; Tue, 7 Jun 2022 18:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628164; bh=MzavRj9nrP27S+bq6CPB0yuwsmyvhj3CJKBoxHtwgwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w041QQuW6VPPKnz6xlCcxmlN1O2RT79aXuY/nCUxIrrkqJuJUTAdJYVrZRs5hDYvf KWNRTjT2tWaGmMNT9H3Od/Q2Czx8h0cYxajiw/IxJK4QXYCbxKX+XMyP6mHwfrzjej u3SeK4M+0ioHyXeQwdlA322fM1y/k3+s4lNCInUY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.18 228/879] pinctrl: renesas: rzn1: Fix possible null-ptr-deref in sh_pfc_map_resources() Date: Tue, 7 Jun 2022 18:55:46 +0200 Message-Id: <20220607165009.471207468@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit 2f661477c2bb8068194dbba9738d05219f111c6e ] It will cause null-ptr-deref when using 'res', if platform_get_resource() returns NULL, so move using 'res' after devm_ioremap_resource() that will check it to avoid null-ptr-deref. And use devm_platform_get_and_ioremap_resource() to simplify code. Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20220429082637.1308182-2-yangyingliang@huaw= ei.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pinctrl/renesas/pinctrl-rzn1.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c b/drivers/pinctrl/renes= as/pinctrl-rzn1.c index ef5fb25b6016..849d091205d4 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzn1.c +++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c @@ -865,17 +865,15 @@ static int rzn1_pinctrl_probe(struct platform_device = *pdev) ipctl->mdio_func[0] =3D -1; ipctl->mdio_func[1] =3D -1; =20 - res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); - ipctl->lev1_protect_phys =3D (u32)res->start + 0x400; - ipctl->lev1 =3D devm_ioremap_resource(&pdev->dev, res); + ipctl->lev1 =3D devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(ipctl->lev1)) return PTR_ERR(ipctl->lev1); + ipctl->lev1_protect_phys =3D (u32)res->start + 0x400; =20 - res =3D platform_get_resource(pdev, IORESOURCE_MEM, 1); - ipctl->lev2_protect_phys =3D (u32)res->start + 0x400; - ipctl->lev2 =3D devm_ioremap_resource(&pdev->dev, res); + ipctl->lev2 =3D devm_platform_get_and_ioremap_resource(pdev, 1, &res); if (IS_ERR(ipctl->lev2)) return PTR_ERR(ipctl->lev2); + ipctl->lev2_protect_phys =3D (u32)res->start + 0x400; =20 ipctl->clk =3D devm_clk_get(&pdev->dev, NULL); if (IS_ERR(ipctl->clk)) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AB14CCA48A for ; Tue, 7 Jun 2022 22:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385477AbiFGWbc (ORCPT ); Tue, 7 Jun 2022 18:31:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380690AbiFGVQl (ORCPT ); Tue, 7 Jun 2022 17:16:41 -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 69BBC14AF4D; Tue, 7 Jun 2022 11:56:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E759BB82018; Tue, 7 Jun 2022 18:56:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 601E7C34115; Tue, 7 Jun 2022 18:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628166; bh=3bFFMwh7UcBdAXXdvobbtik2xvYHlP3q36CF7S5HcJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aN0NSciMVGOzUS4glk9yVs4ds+7xVm3Uuf21lpzG6AvGF1+3qX/GpEVKFMhY4+MQm 4lO6Z5Re25Ex2BUtR9vBxonxzXg551hHQxguNyBeY1RC3RTvr0jVpQvemE0Mmisrha zX+8DIiHYGBR5Dhd6jd5ux3dlZGe7cYLwVnxSQIw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Wu , Linus Walleij , Arnd Bergmann , Sasha Levin Subject: [PATCH 5.18 229/879] ARM: versatile: Add missing of_node_put in dcscb_init Date: Tue, 7 Jun 2022 18:55:47 +0200 Message-Id: <20220607165009.500094206@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Wu [ Upstream commit 23b44f9c649bbef10b45fa33080cd8b4166800ae ] The device_node pointer is returned by of_find_compatible_node with refcount incremented. We should use of_node_put() to avoid the refcount leak. Signed-off-by: Peng Wu Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20220428230356.69418-1-linus.walleij@linaro= .org' Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/mach-vexpress/dcscb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-vexpress/dcscb.c b/arch/arm/mach-vexpress/dcscb.c index a0554d7d04f7..e1adc098f89a 100644 --- a/arch/arm/mach-vexpress/dcscb.c +++ b/arch/arm/mach-vexpress/dcscb.c @@ -144,6 +144,7 @@ static int __init dcscb_init(void) if (!node) return -ENODEV; dcscb_base =3D of_iomap(node, 0); + of_node_put(node); if (!dcscb_base) return -EADDRNOTAVAIL; cfg =3D readl_relaxed(dcscb_base + DCS_CFG_R); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5C98CCA487 for ; Tue, 7 Jun 2022 22:27:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384735AbiFGW0A (ORCPT ); Tue, 7 Jun 2022 18:26:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380692AbiFGVQl (ORCPT ); Tue, 7 Jun 2022 17:16:41 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8E1B14AF61; Tue, 7 Jun 2022 11:56: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 sin.source.kernel.org (Postfix) with ESMTPS id 15853CE244E; Tue, 7 Jun 2022 18:56:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21D55C385A2; Tue, 7 Jun 2022 18:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628169; bh=EVoIgFvb+XVNTHPwe4vjskp+ClintZ4Q0sba7+OJU3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pogQm98mKvu/WsYjflhOk/+zOXOVuF7jPnSvABHItyI6P2KQb8ec1mQvwdkZ9c8t1 VjemITePfYpkqSr9YUpra2slMGqBee3ImfYc9FsflrNz4YjjondZfqgj5UTT8yxhw+ feJAhomiNKkkEee9lPxYIYyDIHo5bk9bujp2vViw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.18 230/879] ARM: dts: exynos: add atmel,24c128 fallback to Samsung EEPROM Date: Tue, 7 Jun 2022 18:55:48 +0200 Message-Id: <20220607165009.529329183@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit f038e8186fbc5723d7d38c6fa1d342945107347e ] The Samsung s524ad0xd1 EEPROM should use atmel,24c128 fallback, according to the AT24 EEPROM bindings. Reported-by: Rob Herring Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220426183443.243113-1-krzysztof.kozlowski= @linaro.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/boot/dts/exynos5250-smdk5250.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/= exynos5250-smdk5250.dts index 21fbbf3d8684..71293749ac48 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -129,7 +129,7 @@ samsung,i2c-max-bus-freq =3D <20000>; =20 eeprom@50 { - compatible =3D "samsung,s524ad0xd1"; + compatible =3D "samsung,s524ad0xd1", "atmel,24c128"; reg =3D <0x50>; }; =20 @@ -289,7 +289,7 @@ samsung,i2c-max-bus-freq =3D <20000>; =20 eeprom@51 { - compatible =3D "samsung,s524ad0xd1"; + compatible =3D "samsung,s524ad0xd1", "atmel,24c128"; reg =3D <0x51>; }; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5F29CCA483 for ; Tue, 7 Jun 2022 22:27:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384697AbiFGWZ5 (ORCPT ); Tue, 7 Jun 2022 18:25:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380694AbiFGVQl (ORCPT ); Tue, 7 Jun 2022 17:16:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27EDA21F9A4; Tue, 7 Jun 2022 11:56:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B8EB661311; Tue, 7 Jun 2022 18:56:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB5BFC385A2; Tue, 7 Jun 2022 18:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628172; bh=jQUQChwJbrQ4qrR8OZj17hDr6QR/W1yv93vA5CkVftI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rDWni6dsOnzh8jsJaagWAc3haxEXokpBVb4aHo33+oUtZlC2zQMzlIY9kXyqhdrTL hlkgOlGAFtMfVRrdUfzhN6EL4zwHNfTadkDNu+x3eAUC1mu5R6ANAV8l4ap202YCpR FPgX3Bt4Bxmp9TyPRMe+4XT+CMmY87CU/99xT3gA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vijaya Krishna Nivarthi , Douglas Anderson , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 231/879] arm64: dts: qcom: sc7280-idp: Configure CTS pin to bias-bus-hold for bluetooth Date: Tue, 7 Jun 2022 18:55:49 +0200 Message-Id: <20220607165009.558513009@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vijaya Krishna Nivarthi [ Upstream commit 497b272759986af1aa5a25b5e903d082c67bd8f6 ] WLAN rail was leaking power during RBSC/sleep even after turning BT off. Change active and sleep pinctrl configurations to handle same. Signed-off-by: Vijaya Krishna Nivarthi Reviewed-by: Douglas Anderson Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/1650556567-4995-2-git-send-email-quic_vniva= rth@quicinc.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/qcom/sc7280-idp.dtsi | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi b/arch/arm64/boot/dts= /qcom/sc7280-idp.dtsi index ecbf2b89d896..5ab3696af354 100644 --- a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi @@ -400,10 +400,13 @@ =20 &qup_uart7_cts { /* - * Configure a pull-down on CTS to match the pull of - * the Bluetooth module. + * Configure a bias-bus-hold on CTS to lower power + * usage when Bluetooth is turned off. Bus hold will + * maintain a low power state regardless of whether + * the Bluetooth module drives the pin in either + * direction or leaves the pin fully unpowered. */ - bias-pull-down; + bias-bus-hold; }; =20 &qup_uart7_rts { @@ -495,10 +498,13 @@ pins =3D "gpio28"; function =3D "gpio"; /* - * Configure a pull-down on CTS to match the pull of - * the Bluetooth module. + * Configure a bias-bus-hold on CTS to lower power + * usage when Bluetooth is turned off. Bus hold will + * maintain a low power state regardless of whether + * the Bluetooth module drives the pin in either + * direction or leaves the pin fully unpowered. */ - bias-pull-down; + bias-bus-hold; }; =20 qup_uart7_sleep_rts: qup-uart7-sleep-rts { --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39B87CCA482 for ; Tue, 7 Jun 2022 22:21:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382789AbiFGWVu (ORCPT ); Tue, 7 Jun 2022 18:21:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380695AbiFGVQl (ORCPT ); Tue, 7 Jun 2022 17:16:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BB5510051B; Tue, 7 Jun 2022 11:56:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A37A6159D; Tue, 7 Jun 2022 18:56:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5089C385A2; Tue, 7 Jun 2022 18:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628175; bh=Hhw55AfzpwlRxLhH27rdAzG4aVpO7vLDDDwchHEKwE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wfTI2axQ6BgbqNtFYs2pg6MqwCrxu6IzJOK5UXUewLeh+dWX4z0csnmNzCdSP4YER Te+/UCPO7+dtjhoD5Ucsh9ZpJTRvaAGGD34cfDcrsAMaXwpBTkV5zSA8YfyuXQEY2e EG+5VjUlNuVYpXZhswT6pLtYQ2qmSpavEAB5krWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vijaya Krishna Nivarthi , Douglas Anderson , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 232/879] arm64: dts: qcom: sc7280-qcard: Configure CTS pin to bias-bus-hold for bluetooth Date: Tue, 7 Jun 2022 18:55:50 +0200 Message-Id: <20220607165009.587287478@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vijaya Krishna Nivarthi [ Upstream commit 3d0e375bae55c2dfa6dd0762f45ad71f0b192f71 ] WLAN rail was leaking power during RBSC/sleep even after turning BT off. Change active and sleep pinctrl configurations to handle same. Signed-off-by: Vijaya Krishna Nivarthi Reviewed-by: Douglas Anderson Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/1650556567-4995-3-git-send-email-quic_vniva= rth@quicinc.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm64/boot/dts/qcom/sc7280-qcard.dtsi | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280-qcard.dtsi b/arch/arm64/boot/d= ts/qcom/sc7280-qcard.dtsi index b833ba1e8f4a..98b5cd70bca5 100644 --- a/arch/arm64/boot/dts/qcom/sc7280-qcard.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280-qcard.dtsi @@ -398,8 +398,14 @@ mos_bt_uart: &uart7 { =20 /* For mos_bt_uart */ &qup_uart7_cts { - /* Configure a pull-down on CTS to match the pull of the Bluetooth module= . */ - bias-pull-down; + /* + * Configure a bias-bus-hold on CTS to lower power + * usage when Bluetooth is turned off. Bus hold will + * maintain a low power state regardless of whether + * the Bluetooth module drives the pin in either + * direction or leaves the pin fully unpowered. + */ + bias-bus-hold; }; =20 /* For mos_bt_uart */ @@ -490,10 +496,13 @@ mos_bt_uart: &uart7 { pins =3D "gpio28"; function =3D "gpio"; /* - * Configure a pull-down on CTS to match the pull of - * the Bluetooth module. + * Configure a bias-bus-hold on CTS to lower power + * usage when Bluetooth is turned off. Bus hold will + * maintain a low power state regardless of whether + * the Bluetooth module drives the pin in either + * direction or leaves the pin fully unpowered. */ - bias-pull-down; + bias-bus-hold; }; =20 /* For mos_bt_uart */ --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99C39CCA489 for ; Tue, 7 Jun 2022 22:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385540AbiFGWbg (ORCPT ); Tue, 7 Jun 2022 18:31:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380697AbiFGVQl (ORCPT ); Tue, 7 Jun 2022 17:16:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 467C921F9AA; Tue, 7 Jun 2022 11:56:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 04B39B82018; Tue, 7 Jun 2022 18:56:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55EBBC385A2; Tue, 7 Jun 2022 18:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628177; bh=djdQ9S61mfxn5Qroahz8b0fLg9sK1orzkaSB+oH7BUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sMgnU8JSd9ee/5s0365axmLgAGiv7iCslud19PIYwhhcp2r78xtq5JbS+iGOe2wqY lA5lHn4Uj5FRyvmJ/qWAhMC/W1YYH4iut8UX+ls0IDJEXAaBGhMGNA55gv1Rdc3nC2 y4XddK2dVBY/i1nhHnEfJFgZORvxL6cpuRPnW9EI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Wu , Wei Xu , Sasha Levin Subject: [PATCH 5.18 233/879] ARM: hisi: Add missing of_node_put after of_find_compatible_node Date: Tue, 7 Jun 2022 18:55:51 +0200 Message-Id: <20220607165009.618117963@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Wu [ Upstream commit 9bc72e47d4630d58a840a66a869c56b29554cfe4 ] of_find_compatible_node will increment the refcount of the returned device_node. Calling of_node_put() to avoid the refcount leak Signed-off-by: Peng Wu Signed-off-by: Wei Xu Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/arm/mach-hisi/platsmp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c index a56cc64deeb8..9ce93e0b6cdc 100644 --- a/arch/arm/mach-hisi/platsmp.c +++ b/arch/arm/mach-hisi/platsmp.c @@ -67,14 +67,17 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int= max_cpus) } ctrl_base =3D of_iomap(np, 0); if (!ctrl_base) { + of_node_put(np); pr_err("failed to map address\n"); return; } if (of_property_read_u32(np, "smp-offset", &offset) < 0) { + of_node_put(np); pr_err("failed to find smp-offset property\n"); return; } ctrl_base +=3D offset; + of_node_put(np); } } =20 @@ -160,6 +163,7 @@ static int hip01_boot_secondary(unsigned int cpu, struc= t task_struct *idle) if (WARN_ON(!node)) return -1; ctrl_base =3D of_iomap(node, 0); + of_node_put(node); =20 /* set the secondary core boot from DDR */ remap_reg_value =3D readl_relaxed(ctrl_base + REG_SC_CTRL); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8CB7CCA48C for ; Tue, 7 Jun 2022 22:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385613AbiFGWbk (ORCPT ); Tue, 7 Jun 2022 18:31:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380698AbiFGVQl (ORCPT ); Tue, 7 Jun 2022 17:16:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3047A14AF70; Tue, 7 Jun 2022 11:56:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C036D61311; Tue, 7 Jun 2022 18:56:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CACF2C385A2; Tue, 7 Jun 2022 18:56:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628183; bh=r3DLkc6jEcY3i0/3z56pH0qiShiXBiSeWD+DV9othKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wtGeOixaWLcyLofPkvsBSJC3xddUg+Tqu9olhOX1qpKZWCsh/lGfycSdggZb4f7MO +eMmp73dXpBo9SseJ3HcDKCKhUqh34jCr3gL7HwyadO8Y0LbcfJj0R1qGI0oYUqOyF NxGYVRzAI0xEfav57eAme1q03k8/RsBs+y5ZsDvY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rex-BC Chen , Viresh Kumar , Jia-wei Chang , Matthias Brugger , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 234/879] cpufreq: Avoid unnecessary frequency updates due to mismatch Date: Tue, 7 Jun 2022 18:55:52 +0200 Message-Id: <20220607165009.646354366@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Viresh Kumar [ Upstream commit f55ae08c89873e140c7cac2a7fa161d31a0d60cf ] For some platforms, the frequency returned by hardware may be slightly different from what is provided in the frequency table. For example, hardware may return 499 MHz instead of 500 MHz. In such cases it is better to avoid getting into unnecessary frequency updates, as we may end up switching policy->cur between the two and sending unnecessary pre/post update notifications, etc. This patch has chosen allows the hardware frequency and table frequency to deviate by 1 MHz for now, we may want to increase it a bit later on if someone still complains. Reported-by: Rex-BC Chen Signed-off-by: Viresh Kumar Tested-by: Jia-wei Chang Reviewed-by: Matthias Brugger Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/cpufreq/cpufreq.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 80f535cc8a75..fbaa8e6c7d23 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -28,6 +28,7 @@ #include #include #include +#include #include =20 static LIST_HEAD(cpufreq_policy_list); @@ -1707,6 +1708,16 @@ static unsigned int cpufreq_verify_current_freq(stru= ct cpufreq_policy *policy, b return new_freq; =20 if (policy->cur !=3D new_freq) { + /* + * For some platforms, the frequency returned by hardware may be + * slightly different from what is provided in the frequency + * table, for example hardware may return 499 MHz instead of 500 + * MHz. In such cases it is better to avoid getting into + * unnecessary frequency updates. + */ + if (abs(policy->cur - new_freq) < HZ_PER_MHZ) + return policy->cur; + cpufreq_out_of_sync(policy, new_freq); if (update) schedule_work(&policy->update); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B06ECCA488 for ; Tue, 7 Jun 2022 22:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385265AbiFGWbU (ORCPT ); Tue, 7 Jun 2022 18:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380700AbiFGVQl (ORCPT ); Tue, 7 Jun 2022 17:16:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB0CE21F9AD; Tue, 7 Jun 2022 11:56: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 711B26159D; Tue, 7 Jun 2022 18:56:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81B02C385A2; Tue, 7 Jun 2022 18:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628185; bh=Q2EBRsgfT+PTS/7GnCfPNIMf+eKY8QMFmv+If5+/aew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YqBIyGSWlL+0I6wj7UiZw3zVH+DIeZK7fDFq26sI+UuQczmmBE3hlkOW+IQ3RerF/ JODK7hR+M6YJTrDRYJwZ+5A4OloPoHVqlrgz1EnsMnNLYcPByO6WuiCJQodFNYXraQ /inoSoaQ7k4396od8vYub/UkjAhv6eSZ55QS1xH8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Conor Dooley , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.18 235/879] PCI: microchip: Add missing chained_irq_enter()/exit() calls Date: Tue, 7 Jun 2022 18:55:53 +0200 Message-Id: <20220607165009.674819127@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Conor Dooley [ Upstream commit 30097efa334a706f9021b9aee6efcddcfa44a78a ] Two of the chained IRQ handlers miss their chained_irq_enter()/chained_irq_exit() calls, so add them in to avoid potentially lost interrupts. Reported by: Bjorn Helgaas Link: https://lore.kernel.org/linux-pci/87h76b8nxc.wl-maz@kernel.org Link: https://lore.kernel.org/r/20220511095504.2273799-1-conor.dooley@micro= chip.com Signed-off-by: Conor Dooley Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/pcie-microchip-host.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/con= troller/pcie-microchip-host.c index 29d8e81e4181..8175abed0f05 100644 --- a/drivers/pci/controller/pcie-microchip-host.c +++ b/drivers/pci/controller/pcie-microchip-host.c @@ -406,6 +406,7 @@ static void mc_pcie_enable_msi(struct mc_pcie *port, vo= id __iomem *base) static void mc_handle_msi(struct irq_desc *desc) { struct mc_pcie *port =3D irq_desc_get_handler_data(desc); + struct irq_chip *chip =3D irq_desc_get_chip(desc); struct device *dev =3D port->dev; struct mc_msi *msi =3D &port->msi; void __iomem *bridge_base_addr =3D @@ -414,6 +415,8 @@ static void mc_handle_msi(struct irq_desc *desc) u32 bit; int ret; =20 + chained_irq_enter(chip, desc); + status =3D readl_relaxed(bridge_base_addr + ISTATUS_LOCAL); if (status & PM_MSI_INT_MSI_MASK) { status =3D readl_relaxed(bridge_base_addr + ISTATUS_MSI); @@ -424,6 +427,8 @@ static void mc_handle_msi(struct irq_desc *desc) bit); } } + + chained_irq_exit(chip, desc); } =20 static void mc_msi_bottom_irq_ack(struct irq_data *data) @@ -563,6 +568,7 @@ static int mc_allocate_msi_domains(struct mc_pcie *port) static void mc_handle_intx(struct irq_desc *desc) { struct mc_pcie *port =3D irq_desc_get_handler_data(desc); + struct irq_chip *chip =3D irq_desc_get_chip(desc); struct device *dev =3D port->dev; void __iomem *bridge_base_addr =3D port->axi_base_addr + MC_PCIE_BRIDGE_ADDR; @@ -570,6 +576,8 @@ static void mc_handle_intx(struct irq_desc *desc) u32 bit; int ret; =20 + chained_irq_enter(chip, desc); + status =3D readl_relaxed(bridge_base_addr + ISTATUS_LOCAL); if (status & PM_MSI_INT_INTX_MASK) { status &=3D PM_MSI_INT_INTX_MASK; @@ -581,6 +589,8 @@ static void mc_handle_intx(struct irq_desc *desc) bit); } } + + chained_irq_exit(chip, desc); } =20 static void mc_ack_intx_irq(struct irq_data *data) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CBE0CCA488 for ; Tue, 7 Jun 2022 22:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384956AbiFGW0N (ORCPT ); Tue, 7 Jun 2022 18:26:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380707AbiFGVQo (ORCPT ); Tue, 7 Jun 2022 17:16: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 2AA9814AF64; Tue, 7 Jun 2022 11:56:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D8CBDB81F6D; Tue, 7 Jun 2022 18:56:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4934DC385A2; Tue, 7 Jun 2022 18:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628188; bh=rZ2OXPCITf7LRFHCb0HH1soMLzMUo8JEpL8zp4zSYqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cI/GRWuJf0GGaexbrXIVdnmqHu+FeG7Iv8ig9AlrZc1KzsTcCvuML1piyfULBwfE8 fDWThG0LEnfyOoGtYX/yfLqIurHzmQqjfPBcqU+OA3i8M4k3TizNGSTlyS1DIKcXrY F1brha14yvDBtPWroXxB+QRC7nNsNzah4pgPOE0s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Laurent Dufour , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 236/879] powerpc/rtas: Keep MSR[RI] set when calling RTAS Date: Tue, 7 Jun 2022 18:55:54 +0200 Message-Id: <20220607165009.703824925@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Laurent Dufour [ Upstream commit b6b1c3ce06ca438eb24e0f45bf0e63ecad0369f5 ] RTAS runs in real mode (MSR[DR] and MSR[IR] unset) and in 32-bit big endian mode (MSR[SF,LE] unset). The change in MSR is done in enter_rtas() in a relatively complex way, since the MSR value could be hardcoded. Furthermore, a panic has been reported when hitting the watchdog interrupt while running in RTAS, this leads to the following stack trace: watchdog: CPU 24 Hard LOCKUP watchdog: CPU 24 TB:997512652051031, last heartbeat TB:997504470175378 (1= 5980ms ago) ... Supported: No, Unreleased kernel CPU: 24 PID: 87504 Comm: drmgr Kdump: loaded Tainted: G E X = 5.14.21-150400.71.1.bz196362_2-default #1 SLE15-SP4 (unreleased) 0d821077= ef4faa8dfaf370efb5fdca1fa35f4e2c NIP: 000000001fb41050 LR: 000000001fb4104c CTR: 0000000000000000 REGS: c00000000fc33d60 TRAP: 0100 Tainted: G E X (5.14.= 21-150400.71.1.bz196362_2-default) MSR: 8000000002981000 CR: 48800002 XER: 20040020 CFAR: 000000000000011c IRQMASK: 1 GPR00: 0000000000000003 ffffffffffffffff 0000000000000001 00000000000050dc GPR04: 000000001ffb6100 0000000000000020 0000000000000001 000000001fb09010 GPR08: 0000000020000000 0000000000000000 0000000000000000 0000000000000000 GPR12: 80040000072a40a8 c00000000ff8b680 0000000000000007 0000000000000034 GPR16: 000000001fbf6e94 000000001fbf6d84 000000001fbd1db0 000000001fb3f008 GPR20: 000000001fb41018 ffffffffffffffff 000000000000017f fffffffffffff68f GPR24: 000000001fb18fe8 000000001fb3e000 000000001fb1adc0 000000001fb1cf40 GPR28: 000000001fb26000 000000001fb460f0 000000001fb17f18 000000001fb17000 NIP [000000001fb41050] 0x1fb41050 LR [000000001fb4104c] 0x1fb4104c Call Trace: Instruction dump: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX Oops: Unrecoverable System Reset, sig: 6 [#1] LE PAGE_SIZE=3D64K MMU=3DHash SMP NR_CPUS=3D2048 NUMA pSeries ... Supported: No, Unreleased kernel CPU: 24 PID: 87504 Comm: drmgr Kdump: loaded Tainted: G E X = 5.14.21-150400.71.1.bz196362_2-default #1 SLE15-SP4 (unreleased) 0d821077= ef4faa8dfaf370efb5fdca1fa35f4e2c NIP: 000000001fb41050 LR: 000000001fb4104c CTR: 0000000000000000 REGS: c00000000fc33d60 TRAP: 0100 Tainted: G E X (5.14.= 21-150400.71.1.bz196362_2-default) MSR: 8000000002981000 CR: 48800002 XER: 20040020 CFAR: 000000000000011c IRQMASK: 1 GPR00: 0000000000000003 ffffffffffffffff 0000000000000001 00000000000050dc GPR04: 000000001ffb6100 0000000000000020 0000000000000001 000000001fb09010 GPR08: 0000000020000000 0000000000000000 0000000000000000 0000000000000000 GPR12: 80040000072a40a8 c00000000ff8b680 0000000000000007 0000000000000034 GPR16: 000000001fbf6e94 000000001fbf6d84 000000001fbd1db0 000000001fb3f008 GPR20: 000000001fb41018 ffffffffffffffff 000000000000017f fffffffffffff68f GPR24: 000000001fb18fe8 000000001fb3e000 000000001fb1adc0 000000001fb1cf40 GPR28: 000000001fb26000 000000001fb460f0 000000001fb17f18 000000001fb17000 NIP [000000001fb41050] 0x1fb41050 LR [000000001fb4104c] 0x1fb4104c Call Trace: Instruction dump: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX ---[ end trace 3ddec07f638c34a2 ]--- This happens because MSR[RI] is unset when entering RTAS but there is no valid reason to not set it here. RTAS is expected to be called with MSR[RI] as specified in PAPR+ section "7.2.1 Machine State": R1=E2=80=937.2.1=E2=80=939. If called with MSR[RI] equal to 1, then RTAS = must protect its own critical regions from recursion by setting the MSR[RI] bit to 0 when in the critical regions. Fixing this by reviewing the way MSR is compute before calling RTAS. Now a hardcoded value meaning real mode, 32 bits big endian mode and Recoverable Interrupt is loaded. In the case MSR[S] is set, it will remain set while entering RTAS as only urfid can unset it (thanks Fabiano). In addition a check is added in do_enter_rtas() to detect calls made with MSR[RI] unset, as we are forcing it on later. This patch has been tested on the following machines: Power KVM Guest P8 S822L (host Ubuntu kernel 5.11.0-49-generic) PowerVM LPAR P8 9119-MME (FW860.A1) p9 9008-22L (FW950.00) P10 9080-HEX (FW1010.00) Suggested-by: Nicholas Piggin Signed-off-by: Laurent Dufour Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220504101244.12107-1-ldufour@linux.ibm.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kernel/entry_64.S | 24 ++++++++++++------------ arch/powerpc/kernel/rtas.c | 9 +++++++++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 9581906b5ee9..da18f83ef883 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -330,22 +330,22 @@ _GLOBAL(enter_rtas) clrldi r4,r4,2 /* convert to realmode address */ mtlr r4 =20 - li r0,0 - ori r0,r0,MSR_EE|MSR_SE|MSR_BE|MSR_RI - andc r0,r6,r0 -=09 - li r9,1 - rldicr r9,r9,MSR_SF_LG,(63-MSR_SF_LG) - ori r9,r9,MSR_IR|MSR_DR|MSR_FE0|MSR_FE1|MSR_FP|MSR_RI|MSR_LE - andc r6,r0,r9 - __enter_rtas: - sync /* disable interrupts so SRR0/1 */ - mtmsrd r0 /* don't get trashed */ - LOAD_REG_ADDR(r4, rtas) ld r5,RTASENTRY(r4) /* get the rtas->entry value */ ld r4,RTASBASE(r4) /* get the rtas->base value */ + + /* + * RTAS runs in 32-bit big endian real mode, but leave MSR[RI] on as we + * may hit NMI (SRESET or MCE) while in RTAS. RTAS should disable RI in + * its critical regions (as specified in PAPR+ section 7.2.1). MSR[S] + * is not impacted by RFI_TO_KERNEL (only urfid can unset it). So if + * MSR[S] is set, it will remain when entering RTAS. + */ + LOAD_REG_IMMEDIATE(r6, MSR_ME | MSR_RI) + + li r0,0 + mtmsrd r0,1 /* disable RI before using SRR0/1 */ =09 mtspr SPRN_SRR0,r5 mtspr SPRN_SRR1,r6 diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 1f42aabbbab3..6bc89d9ccf63 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -49,6 +49,15 @@ void enter_rtas(unsigned long); =20 static inline void do_enter_rtas(unsigned long args) { + unsigned long msr; + + /* + * Make sure MSR[RI] is currently enabled as it will be forced later + * in enter_rtas. + */ + msr =3D mfmsr(); + BUG_ON(!(msr & MSR_RI)); + enter_rtas(args); =20 srr_regs_clobbered(); /* rtas uses SRRs, invalidate */ --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05CCECCA489 for ; Tue, 7 Jun 2022 22:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384874AbiFGW0K (ORCPT ); Tue, 7 Jun 2022 18:26:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380710AbiFGVQr (ORCPT ); Tue, 7 Jun 2022 17:16:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 764FE21F9B9; Tue, 7 Jun 2022 11:56: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 0699E61724; Tue, 7 Jun 2022 18:56:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F94AC385A2; Tue, 7 Jun 2022 18:56:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628191; bh=g0u/pd5I5cajoFlJAmHmEkUnMh+QPi0LxEXCIF7xBjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ey7HmNvpcplrQm/AXqRmZOQ+gRV5upvMtWsupfCH0XtPnH6dlfGAx+yoXWk7uuINU sEMSLnd/31CMdesM0ioJJKPYCxpPdP0ohrVGc6ESFtOxPyXUwgErrNEWV1vH0XE5Rg y3bq1msW25Gq3pVhZioWlFX9HtYrhcfuoVDNbwvI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yicong Yang , Bjorn Helgaas , Sasha Levin , Jay Zhou Subject: [PATCH 5.18 237/879] PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store() Date: Tue, 7 Jun 2022 18:55:55 +0200 Message-Id: <20220607165009.732563014@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yicong Yang [ Upstream commit a91ee0e9fca9d7501286cfbced9b30a33e52740a ] The sysfs sriov_numvfs_store() path acquires the device lock before the config space access lock: sriov_numvfs_store device_lock # A (1) acquire device lock sriov_configure vfio_pci_sriov_configure # (for example) vfio_pci_core_sriov_configure pci_disable_sriov sriov_disable pci_cfg_access_lock pci_wait_cfg # B (4) wait for dev->block_cfg_access =3D= =3D 0 Previously, pci_dev_lock() acquired the config space access lock before the device lock: pci_dev_lock pci_cfg_access_lock dev->block_cfg_access =3D 1 # B (2) set dev->block_cfg_access =3D 1 device_lock # A (3) wait for device lock Any path that uses pci_dev_lock(), e.g., pci_reset_function(), may deadlock with sriov_numvfs_store() if the operations occur in the sequence (1) (2) (3) (4). Avoid the deadlock by reversing the order in pci_dev_lock() so it acquires the device lock before the config space access lock, the same as the sriov_numvfs_store() path. [bhelgaas: combined and adapted commit log from Jay Zhou's independent subsequent posting: https://lore.kernel.org/r/20220404062539.1710-1-jianjay.zhou@huawei.com] Link: https://lore.kernel.org/linux-pci/1583489997-17156-1-git-send-email-y= angyicong@hisilicon.com/ Also-posted-by: Jay Zhou Signed-off-by: Yicong Yang Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/pci.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d25122fbe98a..1af69e298ac3 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5113,19 +5113,19 @@ static int pci_reset_bus_function(struct pci_dev *d= ev, bool probe) =20 void pci_dev_lock(struct pci_dev *dev) { - pci_cfg_access_lock(dev); /* block PM suspend, driver probe, etc. */ device_lock(&dev->dev); + pci_cfg_access_lock(dev); } EXPORT_SYMBOL_GPL(pci_dev_lock); =20 /* Return 1 on successful lock, 0 on contention */ int pci_dev_trylock(struct pci_dev *dev) { - if (pci_cfg_access_trylock(dev)) { - if (device_trylock(&dev->dev)) + if (device_trylock(&dev->dev)) { + if (pci_cfg_access_trylock(dev)) return 1; - pci_cfg_access_unlock(dev); + device_unlock(&dev->dev); } =20 return 0; @@ -5134,8 +5134,8 @@ EXPORT_SYMBOL_GPL(pci_dev_trylock); =20 void pci_dev_unlock(struct pci_dev *dev) { - device_unlock(&dev->dev); pci_cfg_access_unlock(dev); + device_unlock(&dev->dev); } EXPORT_SYMBOL_GPL(pci_dev_unlock); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53BCBCCA48E for ; Tue, 7 Jun 2022 22:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385370AbiFGW1F (ORCPT ); Tue, 7 Jun 2022 18:27:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381382AbiFGVRl (ORCPT ); Tue, 7 Jun 2022 17:17:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B8C014CDF5; Tue, 7 Jun 2022 11:58:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2A4666179F; Tue, 7 Jun 2022 18:58:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D500C385A2; Tue, 7 Jun 2022 18:58:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628327; bh=84IfR7RwwFTk8qrcm0SBcSTrKK/dW3sr/Vog+1TxXdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lyqfN13hz1LGMegCoapNUT7QYcUNnqTpw5W+WxwFY81dU8tKwWp0niCUpRrHwnoU1 9Mn1ReRZoHbhkb2Ee5qv5TAK6VBNe3Z53jsLRlUYIGIQU1QlOsvvcNDVwCxoivpYrt Dd7aZmQ7xbxAdDWc+GAErCDYSvRXWv6npMxAGE7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Parshuram Thombare , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.18 238/879] PCI: cadence: Clear FLR in device capabilities register Date: Tue, 7 Jun 2022 18:55:56 +0200 Message-Id: <20220607165009.761206695@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Parshuram Thombare [ Upstream commit 95b00f68209e2bc9f2ee9126afcebab451e0e9d8 ] Clear FLR (Function Level Reset) from device capabilities registers for all physical functions. During FLR, the Margining Lane Status and Margining Lane Control registers should not be reset, as per PCIe specification. However, the controller incorrectly resets these registers upon FLR. This causes PCISIG compliance FLR test to fail. Hence preventing all functions from advertising FLR support if flag quirk_disable_flr is set. Link: https://lore.kernel.org/r/1635165075-89864-1-git-send-email-pthombar@= cadence.com Signed-off-by: Parshuram Thombare Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/pci/controller/cadence/pci-j721e.c | 3 +++ .../pci/controller/cadence/pcie-cadence-ep.c | 18 +++++++++++++++++- drivers/pci/controller/cadence/pcie-cadence.h | 3 +++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/contr= oller/cadence/pci-j721e.c index 768d33f9ebc8..a82f845cc4b5 100644 --- a/drivers/pci/controller/cadence/pci-j721e.c +++ b/drivers/pci/controller/cadence/pci-j721e.c @@ -69,6 +69,7 @@ struct j721e_pcie_data { enum j721e_pcie_mode mode; unsigned int quirk_retrain_flag:1; unsigned int quirk_detect_quiet_flag:1; + unsigned int quirk_disable_flr:1; u32 linkdown_irq_regfield; unsigned int byte_access_allowed:1; }; @@ -307,6 +308,7 @@ static const struct j721e_pcie_data j7200_pcie_rc_data = =3D { static const struct j721e_pcie_data j7200_pcie_ep_data =3D { .mode =3D PCI_MODE_EP, .quirk_detect_quiet_flag =3D true, + .quirk_disable_flr =3D true, }; =20 static const struct j721e_pcie_data am64_pcie_rc_data =3D { @@ -405,6 +407,7 @@ static int j721e_pcie_probe(struct platform_device *pde= v) return -ENOMEM; =20 ep->quirk_detect_quiet_flag =3D data->quirk_detect_quiet_flag; + ep->quirk_disable_flr =3D data->quirk_disable_flr; =20 cdns_pcie =3D &ep->pcie; cdns_pcie->dev =3D dev; diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci= /controller/cadence/pcie-cadence-ep.c index 88e05b9c2e5b..4b1c4bc4e003 100644 --- a/drivers/pci/controller/cadence/pcie-cadence-ep.c +++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c @@ -565,7 +565,8 @@ static int cdns_pcie_ep_start(struct pci_epc *epc) struct cdns_pcie_ep *ep =3D epc_get_drvdata(epc); struct cdns_pcie *pcie =3D &ep->pcie; struct device *dev =3D pcie->dev; - int ret; + int max_epfs =3D sizeof(epc->function_num_map) * 8; + int ret, value, epf; =20 /* * BIT(0) is hardwired to 1, hence function 0 is always enabled @@ -573,6 +574,21 @@ static int cdns_pcie_ep_start(struct pci_epc *epc) */ cdns_pcie_writel(pcie, CDNS_PCIE_LM_EP_FUNC_CFG, epc->function_num_map); =20 + if (ep->quirk_disable_flr) { + for (epf =3D 0; epf < max_epfs; epf++) { + if (!(epc->function_num_map & BIT(epf))) + continue; + + value =3D cdns_pcie_ep_fn_readl(pcie, epf, + CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET + + PCI_EXP_DEVCAP); + value &=3D ~PCI_EXP_DEVCAP_FLR; + cdns_pcie_ep_fn_writel(pcie, epf, + CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET + + PCI_EXP_DEVCAP, value); + } + } + ret =3D cdns_pcie_start_link(pcie); if (ret) { dev_err(dev, "Failed to start link\n"); diff --git a/drivers/pci/controller/cadence/pcie-cadence.h b/drivers/pci/co= ntroller/cadence/pcie-cadence.h index c8a27b6290ce..d9c785365da3 100644 --- a/drivers/pci/controller/cadence/pcie-cadence.h +++ b/drivers/pci/controller/cadence/pcie-cadence.h @@ -123,6 +123,7 @@ =20 #define CDNS_PCIE_EP_FUNC_MSI_CAP_OFFSET 0x90 #define CDNS_PCIE_EP_FUNC_MSIX_CAP_OFFSET 0xb0 +#define CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET 0xc0 #define CDNS_PCIE_EP_FUNC_SRIOV_CAP_OFFSET 0x200 =20 /* @@ -357,6 +358,7 @@ struct cdns_pcie_epf { * minimize time between read and write * @epf: Structure to hold info about endpoint function * @quirk_detect_quiet_flag: LTSSM Detect Quiet min delay set as quirk + * @quirk_disable_flr: Disable FLR (Function Level Reset) quirk flag */ struct cdns_pcie_ep { struct cdns_pcie pcie; @@ -372,6 +374,7 @@ struct cdns_pcie_ep { spinlock_t lock; struct cdns_pcie_epf *epf; unsigned int quirk_detect_quiet_flag:1; + unsigned int quirk_disable_flr:1; }; =20 =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7634CCCA482 for ; Tue, 7 Jun 2022 22:23:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383155AbiFGWXA (ORCPT ); Tue, 7 Jun 2022 18:23:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380734AbiFGVQz (ORCPT ); Tue, 7 Jun 2022 17:16: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 9894F21F9E5; Tue, 7 Jun 2022 11:56: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 32A996159D; Tue, 7 Jun 2022 18:56:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CBFFC385A2; Tue, 7 Jun 2022 18:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628210; bh=SIzEPNmhi3uXel6os5Hdua5jcjP8PY79NTHws9hQrjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mqk1TUdoZ7J+8mXE4el3hPxTlf2y+vSj1UquQxHEsnFfEH3yEfixmx3LtnOGCP4zX 1lEhvILx4dDvjCZY/eBbHpzi60bpEGeof6h4bZTc0Dxg3dfofwP9T+ElinPvtxtpEx Y7R+vB2nVVWu+vovtimifZc9gLs+oNWkhgPw2yEw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Fabiano Rosas , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 239/879] KVM: PPC: Book3S HV Nested: L2 LPCR should inherit L1 LPES setting Date: Tue, 7 Jun 2022 18:55:57 +0200 Message-Id: <20220607165009.790152442@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicholas Piggin [ Upstream commit 2852ebfa10afdcefff35ec72c8da97141df9845c ] The L1 should not be able to adjust LPES mode for the L2. Setting LPES if the L0 needs it clear would cause external interrupts to be sent to L2 and missed by the L0. Clearing LPES when it may be set, as typically happens with XIVE enabled could cause a performance issue despite having no native XIVE support in the guest, because it will cause mediated interrupts for the L2 to be taken in HV mode, which then have to be injected. Signed-off-by: Nicholas Piggin Reviewed-by: Fabiano Rosas Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220303053315.1056880-7-npiggin@gmail.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/kvm/book3s_hv.c | 4 ++++ arch/powerpc/kvm/book3s_hv_nested.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 6fa518f6501d..43af871383c2 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -5283,6 +5283,10 @@ static int kvmppc_core_init_vm_hv(struct kvm *kvm) kvm->arch.host_lpcr =3D lpcr =3D mfspr(SPRN_LPCR); lpcr &=3D LPCR_PECE | LPCR_LPES; } else { + /* + * The L2 LPES mode will be set by the L0 according to whether + * or not it needs to take external interrupts in HV mode. + */ lpcr =3D 0; } lpcr |=3D (4UL << LPCR_DPFD_SH) | LPCR_HDICE | diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_= hv_nested.c index c943a051c6e7..265bb30a0af2 100644 --- a/arch/powerpc/kvm/book3s_hv_nested.c +++ b/arch/powerpc/kvm/book3s_hv_nested.c @@ -261,8 +261,7 @@ static void load_l2_hv_regs(struct kvm_vcpu *vcpu, /* * Don't let L1 change LPCR bits for the L2 except these: */ - mask =3D LPCR_DPFD | LPCR_ILE | LPCR_TC | LPCR_AIL | LPCR_LD | - LPCR_LPES | LPCR_MER; + mask =3D LPCR_DPFD | LPCR_ILE | LPCR_TC | LPCR_AIL | LPCR_LD | LPCR_MER; =20 /* * Additional filtering is required depending on hardware --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6576FC43334 for ; Tue, 7 Jun 2022 22:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382184AbiFGWXx (ORCPT ); Tue, 7 Jun 2022 18:23:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380780AbiFGVQ6 (ORCPT ); Tue, 7 Jun 2022 17:16:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DC465D5C8; Tue, 7 Jun 2022 11:57: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 BD111B822C0; Tue, 7 Jun 2022 18:57:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29FC9C385A2; Tue, 7 Jun 2022 18:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628240; bh=4VbD8WfJB44zlOa5xh/C+Vp346v74EgwC6bktjAuxDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TMr9ImqT/ZKgbC6IXH6U1HlPvoxQNxCsuPsDsVnSNOLV/7gnFjv2Masp7j/NVbCU/ R+JJOI8geNpXiLrE8idezw0vv4J8EOebsYY1c0S1VxeOn+I9P6QBv0Bjt8dUhYpPv4 1aOz2iIdFoWVpNusjlzHx7vXph2h8fpqQZekSLzg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Matthew Wilcox (Oracle)" , kernel test robot , Christoph Hellwig , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 240/879] alpha: fix alloc_zeroed_user_highpage_movable() Date: Tue, 7 Jun 2022 18:55:58 +0200 Message-Id: <20220607165009.819107501@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matthew Wilcox (Oracle) [ Upstream commit f9c668d281aa20e38c9bda3b7b0adeb8891aa15e ] Due to a typo, the final argument to alloc_page_vma() didn't refer to a real variable. This only affected CONFIG_NUMA, which was marked BROKEN in 2006 and removed from alpha in 2021. Found due to a refactoring patch. Link: https://lkml.kernel.org/r/20220504182857.4013401-4-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) Reported-by: kernel test robot Reviewed-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/alpha/include/asm/page.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/alpha/include/asm/page.h b/arch/alpha/include/asm/page.h index 18f48a6f2ff6..8f3f5eecba28 100644 --- a/arch/alpha/include/asm/page.h +++ b/arch/alpha/include/asm/page.h @@ -18,7 +18,7 @@ extern void clear_page(void *page); #define clear_user_page(page, vaddr, pg) clear_page(page) =20 #define alloc_zeroed_user_highpage_movable(vma, vaddr) \ - alloc_page_vma(GFP_HIGHUSER_MOVABLE | __GFP_ZERO, vma, vmaddr) + alloc_page_vma(GFP_HIGHUSER_MOVABLE | __GFP_ZERO, vma, vaddr) #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE_MOVABLE =20 extern void copy_page(void * _to, void * _from); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEA9FC433EF for ; Tue, 7 Jun 2022 22:31:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381824AbiFGW35 (ORCPT ); Tue, 7 Jun 2022 18:29:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380830AbiFGVRB (ORCPT ); Tue, 7 Jun 2022 17:17: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 6919A443C9; Tue, 7 Jun 2022 11:57: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 CABC46156D; Tue, 7 Jun 2022 18:57:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4DB8C385A2; Tue, 7 Jun 2022 18:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628270; bh=8MKqyuteXsOfc+Xa4/v5pSDbjAuCsg3+b35G++XMffs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GZVE6IiSMYajTvbSLIQtCRInnCeqSaq+zZpkjpFA/8v7SX1rAl7/Z8516NnZEW78P 2doP8bcCEzA29i2mKgZwgJw5otmJqRQRVU3pgHuyWWTAudPeWsZhWPvx06m13ZLQkZ /e6cqHi4rGXyeeFxOZBfYLvqzY7irucPbT4+OSas= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Averin , "Steven Rostedt (Google)" , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 241/879] tracing: incorrect isolate_mote_t cast in mm_vmscan_lru_isolate Date: Tue, 7 Jun 2022 18:55:59 +0200 Message-Id: <20220607165009.848671864@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vasily Averin [ Upstream commit 2b132903de7124dd9a758be0c27562e91a510848 ] Fixes following sparse warnings: CHECK mm/vmscan.c mm/vmscan.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/vmscan.h): ./include/trace/events/vmscan.h:281:1: sparse: warning: cast to restricted isolate_mode_t ./include/trace/events/vmscan.h:281:1: sparse: warning: restricted isolate_mode_t degrades to integer Link: https://lkml.kernel.org/r/e85d7ff2-fd10-53f8-c24e-ba0458439c1b@openvz= .org Signed-off-by: Vasily Averin Acked-by: Steven Rostedt (Google) Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/trace/events/vmscan.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h index de136dbd623a..e7d28dc549da 100644 --- a/include/trace/events/vmscan.h +++ b/include/trace/events/vmscan.h @@ -297,7 +297,7 @@ TRACE_EVENT(mm_vmscan_lru_isolate, __field(unsigned long, nr_scanned) __field(unsigned long, nr_skipped) __field(unsigned long, nr_taken) - __field(isolate_mode_t, isolate_mode) + __field(unsigned int, isolate_mode) __field(int, lru) ), =20 @@ -308,7 +308,7 @@ TRACE_EVENT(mm_vmscan_lru_isolate, __entry->nr_scanned =3D nr_scanned; __entry->nr_skipped =3D nr_skipped; __entry->nr_taken =3D nr_taken; - __entry->isolate_mode =3D isolate_mode; + __entry->isolate_mode =3D (__force unsigned int)isolate_mode; __entry->lru =3D lru; ), =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C025EC43334 for ; Tue, 7 Jun 2022 22:28:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234577AbiFGW2X (ORCPT ); Tue, 7 Jun 2022 18:28:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381130AbiFGVRV (ORCPT ); Tue, 7 Jun 2022 17:17:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FC5A132771; Tue, 7 Jun 2022 11:58:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B86D5617E7; Tue, 7 Jun 2022 18:58:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC352C385A2; Tue, 7 Jun 2022 18:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628300; bh=eXwn9jpORhMFXa/l7hvpGfaQ1a87GZ++SVdKibfdzLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Av/vi081c7iyDUuIQjKun7wmELEqYYe2JspBvTNdCV0m1gQ3s7x9o4fgZx5VGj4ye cMUct/oPSrcYxdHmTVcP3uUXXUa8yDNSTJamu89aydnJ3s7vrLRTz+/LQqhEfRKIMW 50YqO3YOg+D4XokKg1pjQYxCHzT5X0dFj1zr0X2M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Enzo Matsumiya , "Paulo Alcantara (SUSE)" , Steve French , Sasha Levin Subject: [PATCH 5.18 242/879] cifs: return ENOENT for DFS lookup_cache_entry() Date: Tue, 7 Jun 2022 18:56:00 +0200 Message-Id: <20220607165009.877765372@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Enzo Matsumiya [ Upstream commit 337b8b0e4343567221ef8d88aac5e418208d4ac1 ] EEXIST didn't make sense to use when dfs_cache_find() couldn't find a cache entry nor retrieve a referral target. It also doesn't make sense cifs_dfs_query_info_nonascii_quirk() to emulate ENOENT anymore. Signed-off-by: Enzo Matsumiya Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/cifs/connect.c | 6 ++++-- fs/cifs/dfs_cache.c | 6 +++--- fs/cifs/misc.c | 6 +----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 2a639fc79c30..b28b1ff39fed 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3406,8 +3406,9 @@ cifs_are_all_path_components_accessible(struct TCP_Se= rver_Info *server, } =20 /* - * Check if path is remote (e.g. a DFS share). Return -EREMOTE if it is, - * otherwise 0. + * Check if path is remote (i.e. a DFS share). + * + * Return -EREMOTE if it is, otherwise 0 or -errno. */ static int is_path_remote(struct mount_ctx *mnt_ctx) { @@ -3697,6 +3698,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct s= mb3_fs_context *ctx) if (!isdfs) goto out; =20 + /* proceed as DFS mount */ uuid_gen(&mnt_ctx.mount_id); rc =3D connect_dfs_root(&mnt_ctx, &tl); dfs_cache_free_tgts(&tl); diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c index 956f8e5cf3e7..c5dd6f7305bd 100644 --- a/fs/cifs/dfs_cache.c +++ b/fs/cifs/dfs_cache.c @@ -654,7 +654,7 @@ static struct cache_entry *__lookup_cache_entry(const c= har *path, unsigned int h return ce; } } - return ERR_PTR(-EEXIST); + return ERR_PTR(-ENOENT); } =20 /* @@ -662,7 +662,7 @@ static struct cache_entry *__lookup_cache_entry(const c= har *path, unsigned int h * * Use whole path components in the match. Must be called with htable_rw_= lock held. * - * Return ERR_PTR(-EEXIST) if the entry is not found. + * Return ERR_PTR(-ENOENT) if the entry is not found. */ static struct cache_entry *lookup_cache_entry(const char *path) { @@ -710,7 +710,7 @@ static struct cache_entry *lookup_cache_entry(const cha= r *path) while (e > s && *e !=3D sep) e--; } - return ERR_PTR(-EEXIST); + return ERR_PTR(-ENOENT); } =20 /** diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 114810e563a9..5a803d686146 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -1308,7 +1308,7 @@ int cifs_update_super_prepath(struct cifs_sb_info *ci= fs_sb, char *prefix) * for "\\\" DFS reference, * where contains non-ASCII unicode symbols. * - * Check such DFS reference and emulate -ENOENT if it is actual. + * Check such DFS reference. */ int cifs_dfs_query_info_nonascii_quirk(const unsigned int xid, struct cifs_tcon *tcon, @@ -1340,10 +1340,6 @@ int cifs_dfs_query_info_nonascii_quirk(const unsigne= d int xid, cifs_dbg(FYI, "DFS ref '%s' is found, emulate -EREMOTE\n", dfspath); rc =3D -EREMOTE; - } else if (rc =3D=3D -EEXIST) { - cifs_dbg(FYI, "DFS ref '%s' is not found, emulate -ENOENT\n", - dfspath); - rc =3D -ENOENT; } else { cifs_dbg(FYI, "%s: dfs_cache_find returned %d\n", __func__, rc); } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53375CCA482 for ; Tue, 7 Jun 2022 22:27:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384307AbiFGWZY (ORCPT ); Tue, 7 Jun 2022 18:25:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381241AbiFGVRa (ORCPT ); Tue, 7 Jun 2022 17:17:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 609372218A4; Tue, 7 Jun 2022 11:58:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 21ECBB8233E; Tue, 7 Jun 2022 18:58:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EA8AC385A2; Tue, 7 Jun 2022 18:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628313; bh=pfvUU/V6IqUWT2zQcygVATlHHRSp7oNJoS8dGnypnnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PGzwbjtxLeswzkoigfBeOkFLgrnkR1lBW89U40JVhnlEyo5gQaf8EfNLb5jEkj+VD pJ38mT4b6oqx4j7859x2uDI9fNvk157dB9uIGw9i1onDSp5Di0seZ1Ha5X4ygvHFYM UrDB4i7b5YxZ1vTJ8Eq9KcEDAvFGF7hUtH/Cu7aI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Haren Myneni , Sasha Levin Subject: [PATCH 5.18 243/879] powerpc/powernv/vas: Assign real address to rx_fifo in vas_rx_win_attr Date: Tue, 7 Jun 2022 18:56:01 +0200 Message-Id: <20220607165009.906409912@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haren Myneni [ Upstream commit c127d130f6d59fa81701f6b04023cf7cd1972fb3 ] In init_winctx_regs(), __pa() is called on winctx->rx_fifo and this function is called to initialize registers for receive and fault windows. But the real address is passed in winctx->rx_fifo for receive windows and the virtual address for fault windows which causes errors with DEBUG_VIRTUAL enabled. Fixes this issue by assigning only real address to rx_fifo in vas_rx_win_attr struct for both receive and fault windows. Reported-by: Michael Ellerman Signed-off-by: Haren Myneni Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/338e958c7ab8f3b266fa794a1f80f99b9671829e.ca= mel@linux.ibm.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/include/asm/vas.h | 2 +- arch/powerpc/platforms/powernv/vas-fault.c | 2 +- arch/powerpc/platforms/powernv/vas-window.c | 4 ++-- arch/powerpc/platforms/powernv/vas.h | 2 +- drivers/crypto/nx/nx-common-powernv.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h index 83afcb6c194b..c36f71e01c0f 100644 --- a/arch/powerpc/include/asm/vas.h +++ b/arch/powerpc/include/asm/vas.h @@ -126,7 +126,7 @@ static inline void vas_user_win_add_mm_context(struct v= as_user_win_ref *ref) * Receive window attributes specified by the (in-kernel) owner of window. */ struct vas_rx_win_attr { - void *rx_fifo; + u64 rx_fifo; int rx_fifo_size; int wcreds_max; =20 diff --git a/arch/powerpc/platforms/powernv/vas-fault.c b/arch/powerpc/plat= forms/powernv/vas-fault.c index a7aabc18039e..c1bfad56447d 100644 --- a/arch/powerpc/platforms/powernv/vas-fault.c +++ b/arch/powerpc/platforms/powernv/vas-fault.c @@ -216,7 +216,7 @@ int vas_setup_fault_window(struct vas_instance *vinst) vas_init_rx_win_attr(&attr, VAS_COP_TYPE_FAULT); =20 attr.rx_fifo_size =3D vinst->fault_fifo_size; - attr.rx_fifo =3D vinst->fault_fifo; + attr.rx_fifo =3D __pa(vinst->fault_fifo); =20 /* * Max creds is based on number of CRBs can fit in the FIFO. diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/pla= tforms/powernv/vas-window.c index 0f8d39fbf2b2..0072682531d8 100644 --- a/arch/powerpc/platforms/powernv/vas-window.c +++ b/arch/powerpc/platforms/powernv/vas-window.c @@ -404,7 +404,7 @@ static void init_winctx_regs(struct pnv_vas_window *win= dow, * * See also: Design note in function header. */ - val =3D __pa(winctx->rx_fifo); + val =3D winctx->rx_fifo; val =3D SET_FIELD(VAS_PAGE_MIGRATION_SELECT, val, 0); write_hvwc_reg(window, VREG(LFIFO_BAR), val); =20 @@ -739,7 +739,7 @@ static void init_winctx_for_rxwin(struct pnv_vas_window= *rxwin, */ winctx->fifo_disable =3D true; winctx->intr_disable =3D true; - winctx->rx_fifo =3D NULL; + winctx->rx_fifo =3D 0; } =20 winctx->lnotify_lpid =3D rxattr->lnotify_lpid; diff --git a/arch/powerpc/platforms/powernv/vas.h b/arch/powerpc/platforms/= powernv/vas.h index 8bb08e395de0..08d9d3d5a22b 100644 --- a/arch/powerpc/platforms/powernv/vas.h +++ b/arch/powerpc/platforms/powernv/vas.h @@ -376,7 +376,7 @@ struct pnv_vas_window { * is a container for the register fields in the window context. */ struct vas_winctx { - void *rx_fifo; + u64 rx_fifo; int rx_fifo_size; int wcreds_max; int rsvd_txbuf_count; diff --git a/drivers/crypto/nx/nx-common-powernv.c b/drivers/crypto/nx/nx-c= ommon-powernv.c index 32a036ada5d0..f418817c0f43 100644 --- a/drivers/crypto/nx/nx-common-powernv.c +++ b/drivers/crypto/nx/nx-common-powernv.c @@ -827,7 +827,7 @@ static int __init vas_cfg_coproc_info(struct device_nod= e *dn, int chip_id, goto err_out; =20 vas_init_rx_win_attr(&rxattr, coproc->ct); - rxattr.rx_fifo =3D (void *)rx_fifo; + rxattr.rx_fifo =3D rx_fifo; rxattr.rx_fifo_size =3D fifo_size; rxattr.lnotify_lpid =3D lpid; rxattr.lnotify_pid =3D pid; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BA20CCA493 for ; Tue, 7 Jun 2022 22:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385433AbiFGW1Q (ORCPT ); Tue, 7 Jun 2022 18:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381266AbiFGVRb (ORCPT ); Tue, 7 Jun 2022 17:17:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 772712218AD; Tue, 7 Jun 2022 11:58:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 34E5661768; Tue, 7 Jun 2022 18:58:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42EDDC385A5; Tue, 7 Jun 2022 18:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628316; bh=ctIJdYl0vlNt157giC31wNXX7wsg81SlduRBQ1uUmGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A/8PaJ0RMZou8VjpCym0dMZ1wbP/ZsOWo5T+olzQ/xB8jhTu3jbzFfKXqMuNn3aLd 8VD5+qQd1PbOZtpcknG1fW2kBXCxyxp8GHM44wlBmb78pKQo4Pf2ztO07dRZTLCgKI sj/5/df+wlvZaVnM4JAoXi+0a7ZNyxLBo/Feacuw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Lv Ruyi , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 244/879] powerpc/xics: fix refcount leak in icp_opal_init() Date: Tue, 7 Jun 2022 18:56:02 +0200 Message-Id: <20220607165009.934535545@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lv Ruyi [ Upstream commit 5dd9e27ea4a39f7edd4bf81e9e70208e7ac0b7c9 ] The of_find_compatible_node() function returns a node pointer with refcount incremented, use of_node_put() on it when done. Reported-by: Zeal Robot Signed-off-by: Lv Ruyi Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220402013419.2410298-1-lv.ruyi@zte.com.cn Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/sysdev/xics/icp-opal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/sysdev/xics/icp-opal.c b/arch/powerpc/sysdev/xics= /icp-opal.c index bda4c32582d9..4dae624b9f2f 100644 --- a/arch/powerpc/sysdev/xics/icp-opal.c +++ b/arch/powerpc/sysdev/xics/icp-opal.c @@ -196,6 +196,7 @@ int __init icp_opal_init(void) =20 printk("XICS: Using OPAL ICP fallbacks\n"); =20 + of_node_put(np); return 0; } =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2458CCA48C for ; Tue, 7 Jun 2022 22:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385191AbiFGW0f (ORCPT ); Tue, 7 Jun 2022 18:26:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381274AbiFGVRc (ORCPT ); Tue, 7 Jun 2022 17:17:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 066C9222341; Tue, 7 Jun 2022 11:58:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1641D61787; Tue, 7 Jun 2022 18:58:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F86CC385A2; Tue, 7 Jun 2022 18:58:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628319; bh=y5FpsC0QGeen2RQowSl2Y0D8H3xk4G0Akqg3acr5AMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mS//OFsqV9x5h/aHKs2099p4bTMlfp5jsxZlerGUbvcefB0A6XvfReiVbbPdUhiNw 0tWmYrVXuBJ0GW/+BtjO20mFNHyPMmqSLSPhoGmDTki8WLpdiKG4qL4FlNq3GTWJC8 rL+Q+WPrVofq/gOqopgXWX2/cYe+w3MQ7Rko1Wjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Lv Ruyi , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 245/879] powerpc/powernv: fix missing of_node_put in uv_init() Date: Tue, 7 Jun 2022 18:56:03 +0200 Message-Id: <20220607165009.964228978@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lv Ruyi [ Upstream commit 3ffa9fd471f57f365bc54fc87824c530422f64a5 ] of_find_compatible_node() returns node pointer with refcount incremented, use of_node_put() on it when done. Reported-by: Zeal Robot Signed-off-by: Lv Ruyi Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220407090043.2491854-1-lv.ruyi@zte.com.cn Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/platforms/powernv/ultravisor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/powernv/ultravisor.c b/arch/powerpc/pla= tforms/powernv/ultravisor.c index e4a00ad06f9d..67c8c4b2d8b1 100644 --- a/arch/powerpc/platforms/powernv/ultravisor.c +++ b/arch/powerpc/platforms/powernv/ultravisor.c @@ -55,6 +55,7 @@ static int __init uv_init(void) return -ENODEV; =20 uv_memcons =3D memcons_init(node, "memcons"); + of_node_put(node); if (!uv_memcons) return -ENOENT; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65132CCA491 for ; Tue, 7 Jun 2022 22:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385398AbiFGW1J (ORCPT ); Tue, 7 Jun 2022 18:27:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381315AbiFGVRe (ORCPT ); Tue, 7 Jun 2022 17:17:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C08FA222369; Tue, 7 Jun 2022 11:58:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8F65AB82399; Tue, 7 Jun 2022 18:58:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6F84C385A5; Tue, 7 Jun 2022 18:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628322; bh=Gd+81C6t792u/OyBDJ9pfgOthfvlR8CL7NYdML5/hfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lhSM0F7mrceLObPjFWwHoP2z537rZkyLUC2ONtau0Ry95LKnubtenfJdRAQhzre/T JddQYehsnu2DOwF5+P5dTa/mzqzOmv0likvoKMFkA3T8cU0b0obiQdrDjA3eS7EGo5 TpLlb3LNuPujxrYFI9KUqIuUTOfFo+VEMismlloY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Finn Thain , Randy Dunlap , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 246/879] macintosh/via-pmu: Fix build failure when CONFIG_INPUT is disabled Date: Tue, 7 Jun 2022 18:56:04 +0200 Message-Id: <20220607165009.993135897@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Finn Thain [ Upstream commit 86ce436e30d86327c9f5260f718104ae7b21f506 ] drivers/macintosh/via-pmu-event.o: In function `via_pmu_event': via-pmu-event.c:(.text+0x44): undefined reference to `input_event' via-pmu-event.c:(.text+0x68): undefined reference to `input_event' via-pmu-event.c:(.text+0x94): undefined reference to `input_event' via-pmu-event.c:(.text+0xb8): undefined reference to `input_event' drivers/macintosh/via-pmu-event.o: In function `via_pmu_event_init': via-pmu-event.c:(.init.text+0x20): undefined reference to `input_allocate_d= evice' via-pmu-event.c:(.init.text+0xc4): undefined reference to `input_register_d= evice' via-pmu-event.c:(.init.text+0xd4): undefined reference to `input_free_devic= e' make[1]: *** [Makefile:1155: vmlinux] Error 1 make: *** [Makefile:350: __build_one_by_one] Error 2 Don't call into the input subsystem unless CONFIG_INPUT is built-in. Reported-by: kernel test robot Signed-off-by: Finn Thain Tested-by: Randy Dunlap Reviewed-by: Christophe Leroy Acked-by: Randy Dunlap Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/5edbe76ce68227f71e09af4614cc4c1bd61c7ec8.16= 49326292.git.fthain@linux-m68k.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/macintosh/Kconfig | 4 ++++ drivers/macintosh/Makefile | 3 ++- drivers/macintosh/via-pmu.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index 5cdc361da37c..3942db15a2b8 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig @@ -67,6 +67,10 @@ config ADB_PMU this device; you should do so if your machine is one of those mentioned above. =20 +config ADB_PMU_EVENT + def_bool y + depends on ADB_PMU && INPUT=3Dy + config ADB_PMU_LED bool "Support for the Power/iBook front LED" depends on PPC_PMAC && ADB_PMU diff --git a/drivers/macintosh/Makefile b/drivers/macintosh/Makefile index 49819b1b6f20..712edcb3e0b0 100644 --- a/drivers/macintosh/Makefile +++ b/drivers/macintosh/Makefile @@ -12,7 +12,8 @@ obj-$(CONFIG_MAC_EMUMOUSEBTN) +=3D mac_hid.o obj-$(CONFIG_INPUT_ADBHID) +=3D adbhid.o obj-$(CONFIG_ANSLCD) +=3D ans-lcd.o =20 -obj-$(CONFIG_ADB_PMU) +=3D via-pmu.o via-pmu-event.o +obj-$(CONFIG_ADB_PMU) +=3D via-pmu.o +obj-$(CONFIG_ADB_PMU_EVENT) +=3D via-pmu-event.o obj-$(CONFIG_ADB_PMU_LED) +=3D via-pmu-led.o obj-$(CONFIG_PMAC_BACKLIGHT) +=3D via-pmu-backlight.o obj-$(CONFIG_ADB_CUDA) +=3D via-cuda.o diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 4b98bc26a94b..2109129ea1bb 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c @@ -1459,7 +1459,7 @@ pmu_handle_data(unsigned char *data, int len) pmu_pass_intr(data, len); /* len =3D=3D 6 is probably a bad check. But how do I * know what PMU versions send what events here? */ - if (len =3D=3D 6) { + if (IS_ENABLED(CONFIG_ADB_PMU_EVENT) && len =3D=3D 6) { via_pmu_event(PMU_EVT_POWER, !!(data[1]&8)); via_pmu_event(PMU_EVT_LID, data[1]&1); } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74469CCA47F for ; Tue, 7 Jun 2022 22:27:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384505AbiFGWZh (ORCPT ); Tue, 7 Jun 2022 18:25:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381371AbiFGVRk (ORCPT ); Tue, 7 Jun 2022 17:17:40 -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 7409D2228C7; Tue, 7 Jun 2022 11:58: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 3D61DB82391; Tue, 7 Jun 2022 18:58:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8974BC385A2; Tue, 7 Jun 2022 18:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628324; bh=nDm+GwDgvJjU1T4VnyQabcgcfISjgZ8P6P4og/v0WJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdBuuDd/+eqoke2WVzJXiBt4ngWA1+yYjxVcdaDIDFaWQxINmnlzXZgthufHU7TOj h9H0xv21Hs/Wi/vI7Mb/spKiiDPlc5N3T55B1DrEw40/1P6UepkicTQltBgtxGTJjd XC+Hcb4Z53czd2gGM/pGiB1li/l+2SCX/BM5/eyE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Wu , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 247/879] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart Date: Tue, 7 Jun 2022 18:56:05 +0200 Message-Id: <20220607165010.021667638@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Wu [ Upstream commit 57b742a5b8945118022973e6416b71351df512fb ] The device_node pointer is returned by of_find_compatible_node with refcount incremented. We should use of_node_put() to avoid the refcount leak. Signed-off-by: Peng Wu Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220425081245.21705-1-wupeng58@huawei.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- arch/powerpc/sysdev/dart_iommu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_io= mmu.c index be6b99b1b352..9a02aed886a0 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c @@ -404,9 +404,10 @@ void __init iommu_init_early_dart(struct pci_controlle= r_ops *controller_ops) } =20 /* Initialize the DART HW */ - if (dart_init(dn) !=3D 0) + if (dart_init(dn) !=3D 0) { + of_node_put(dn); return; - + } /* * U4 supports a DART bypass, we use it for 64-bit capable devices to * improve performance. However, that only works for devices connected @@ -419,6 +420,7 @@ void __init iommu_init_early_dart(struct pci_controller= _ops *controller_ops) =20 /* Setup pci_dma ops */ set_pci_dma_ops(&dma_iommu_ops); + of_node_put(dn); } =20 #ifdef CONFIG_PM --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16D6ECCA48F for ; Tue, 7 Jun 2022 22:32:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384848AbiFGWbN (ORCPT ); Tue, 7 Jun 2022 18:31:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380736AbiFGVQz (ORCPT ); Tue, 7 Jun 2022 17:16: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 5E4A914AF7B; Tue, 7 Jun 2022 11:56:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED42F61768; Tue, 7 Jun 2022 18:56:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01A9BC385A5; Tue, 7 Jun 2022 18:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628213; bh=dsPytRuScUu0MpZ3yhZ+4QHzYxtIjhaCZwMQMNhAK7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pRsBoOTjTBUxrWf/w1PWbGmkkTEsRIr9b046KRvJLwoJmd0L8Kc2rVh5MdHgzKtxK A3VYHbxCBMPfPCINGEBZ1IE5ajONnokaupQPpPLah5p8EtJi1yw0y3sBHnbnZSLtEC VT2QFRdXl5qx+eLZ7316UMN1Eap2hUWAENisX9c4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Averin , "Christian Brauner (Microsoft)" , Christoph Hellwig , Jan Kara , Sasha Levin Subject: [PATCH 5.18 248/879] fanotify: fix incorrect fmode_t casts Date: Tue, 7 Jun 2022 18:56:06 +0200 Message-Id: <20220607165010.049715032@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vasily Averin [ Upstream commit dccd855771b37820b6d976a99729c88259549f85 ] Fixes sparce warnings: fs/notify/fanotify/fanotify_user.c:267:63: sparse: warning: restricted fmode_t degrades to integer fs/notify/fanotify/fanotify_user.c:1351:28: sparse: warning: restricted fmode_t degrades to integer FMODE_NONTIFY have bitwise fmode_t type and requires __force attribute for any casts. Signed-off-by: Vasily Averin Reviewed-by: Christian Brauner (Microsoft) Reviewed-by: Christoph Hellwig Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/9adfd6ac-1b89-791e-796b-49ada3293985@openvz= .org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/notify/fanotify/fanotify_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanoti= fy_user.c index a792e21c5309..16d8fc84713a 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -264,7 +264,7 @@ static int create_fd(struct fsnotify_group *group, stru= ct path *path, * originally opened O_WRONLY. */ new_file =3D dentry_open(path, - group->fanotify_data.f_flags | FMODE_NONOTIFY, + group->fanotify_data.f_flags | __FMODE_NONOTIFY, current_cred()); if (IS_ERR(new_file)) { /* @@ -1348,7 +1348,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, u= nsigned int, event_f_flags) (!(fid_mode & FAN_REPORT_NAME) || !(fid_mode & FAN_REPORT_FID))) return -EINVAL; =20 - f_flags =3D O_RDWR | FMODE_NONOTIFY; + f_flags =3D O_RDWR | __FMODE_NONOTIFY; if (flags & FAN_CLOEXEC) f_flags |=3D O_CLOEXEC; if (flags & FAN_NONBLOCK) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C226C433EF for ; Tue, 7 Jun 2022 22:23:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383400AbiFGWXG (ORCPT ); Tue, 7 Jun 2022 18:23:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380737AbiFGVQz (ORCPT ); Tue, 7 Jun 2022 17:16:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 829D1147829; Tue, 7 Jun 2022 11:56: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 3873DB822C0; Tue, 7 Jun 2022 18:56:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2E2BC385A2; Tue, 7 Jun 2022 18:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628216; bh=sCtI21mHmu6eCFDwJDJ9ANTa+yy3I1+xzGJmloI8pJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c5wLjeb3RPGOmKv3e2nv6AqIV3v/n2bGu7gav7QZ4CExuyg7jklcBDZnNVJa1bFgk CB9/4VH/fOKaIOMw9hOqjjEWV9H95ZKNSTPebnENN5YS0kYsEKZiLRPEigxsPOad0D Z6S227laD8izi9PKXZY4Bbusug0+nt6QlnLaWQhw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronnie Sahlberg , Steve French , Sasha Levin Subject: [PATCH 5.18 249/879] smb3: check for null tcon Date: Tue, 7 Jun 2022 18:56:07 +0200 Message-Id: <20220607165010.078321192@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steve French [ Upstream commit bbdf6cf56c88845fb0b713cbf5c6623c53fe40d8 ] Although unlikely to be null, it is confusing to use a pointer before checking for it to be null so move the use down after null check. Addresses-Coverity: 1517586 ("Null pointer dereferences (REVERSE_INULL)") Reviewed-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/cifs/smb2ops.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 2df9aab12db7..861291662c95 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -760,8 +760,8 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon = *tcon, struct cifs_sb_info *cifs_sb, struct cached_fid **cfid) { - struct cifs_ses *ses =3D tcon->ses; - struct TCP_Server_Info *server =3D ses->server; + struct cifs_ses *ses; + struct TCP_Server_Info *server; struct cifs_open_parms oparms; struct smb2_create_rsp *o_rsp =3D NULL; struct smb2_query_info_rsp *qi_rsp =3D NULL; @@ -779,6 +779,9 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon = *tcon, if (tcon->nohandlecache) return -ENOTSUPP; =20 + ses =3D tcon->ses; + server =3D ses->server; + if (cifs_sb->root =3D=3D NULL) return -ENOENT; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2681ACCA490 for ; Tue, 7 Jun 2022 22:32:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385140AbiFGWbQ (ORCPT ); Tue, 7 Jun 2022 18:31:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380739AbiFGVQz (ORCPT ); Tue, 7 Jun 2022 17:16:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B7A114B2C7; Tue, 7 Jun 2022 11:57:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F10D6B822C0; Tue, 7 Jun 2022 18:56:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62185C385A2; Tue, 7 Jun 2022 18:56:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628218; bh=Ir0V9XdICgoZ/GLaYLNxw9Lpqttbk/iKdMQZZJbOrvw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aT7E4isx7Rc6an5m9J+kN17vK/zwakXoE1yU+A/vofdnPfVGv9zn9RMdCAywuwCg6 c+JSIKUyrS04r4X7bfFQgKejBuKlNiST8+gRuRuAUa52mP0iGbeUVvEjJ6QRRlEdBq FcoR5n8mOhzxbGr8pU33DWsAdaXoCntIkQmGkSkE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Miller , Dennis Dalessandro , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.18 250/879] RDMA/hfi1: Prevent panic when SDMA is disabled Date: Tue, 7 Jun 2022 18:56:08 +0200 Message-Id: <20220607165010.106598195@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Douglas Miller [ Upstream commit 629e052d0c98e46dde9f0824f0aa437f678d9b8f ] If the hfi1 module is loaded with HFI1_CAP_SDMA off, a call to hfi1_write_iter() will dereference a NULL pointer and panic. A typical stack frame is: sdma_select_user_engine [hfi1] hfi1_user_sdma_process_request [hfi1] hfi1_write_iter [hfi1] do_iter_readv_writev do_iter_write vfs_writev do_writev do_syscall_64 The fix is to test for SDMA in hfi1_write_iter() and fail the I/O with EINVAL. Link: https://lore.kernel.org/r/20220520183706.48973.79803.stgit@awfm-01.co= rnelisnetworks.com Signed-off-by: Douglas Miller Signed-off-by: Dennis Dalessandro Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/infiniband/hw/hfi1/file_ops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/= hfi1/file_ops.c index 1783a6ea5427..3ebdd42fec36 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c @@ -265,6 +265,8 @@ static ssize_t hfi1_write_iter(struct kiocb *kiocb, str= uct iov_iter *from) unsigned long dim =3D from->nr_segs; int idx; =20 + if (!HFI1_CAP_IS_KSET(SDMA)) + return -EINVAL; idx =3D srcu_read_lock(&fd->pq_srcu); pq =3D srcu_dereference(fd->pq, &fd->pq_srcu); if (!cq || !pq) { --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8871CCA48A for ; Tue, 7 Jun 2022 22:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385089AbiFGW0W (ORCPT ); Tue, 7 Jun 2022 18:26:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380740AbiFGVQz (ORCPT ); Tue, 7 Jun 2022 17:16:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C90414B2CD; Tue, 7 Jun 2022 11:57:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 24DB86159D; Tue, 7 Jun 2022 18:57:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E1CAC385A5; Tue, 7 Jun 2022 18:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628221; bh=+Eu7a/01Gm0vvkEXgIQO9gAsjJXm9bL/OnGxnrNXiSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FtjCq7GiMDxGfYpzMh4P/dQsrrOcsbx69a0CmEd+pGu79qmoRZwb/l6uJrzmxDvp5 fOuLJjzgY5cY6j/PhH82D5zNSqm6n/dcr1hTPAURpj1aQWfuEUXHoZpz1mzq4ZIjkJ VKaqMRx/nZyQVLQc+OjrazDh8o5OwCLQfA1gievw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shyam Prasad N , Steve French , Sasha Levin Subject: [PATCH 5.18 251/879] cifs: do not use tcpStatus after negotiate completes Date: Tue, 7 Jun 2022 18:56:09 +0200 Message-Id: <20220607165010.135030627@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shyam Prasad N [ Upstream commit 1a6a41d4cedd9b302e2200e6f0e3c44dbbe13689 ] Recent changes to multichannel to allow channel reconnects to work in parallel and independent of each other did so by making use of tcpStatus for the connection, and status for the session. However, this did not take into account the multiuser scenario, where same connection is used by multiple connections. However, tcpStatus should be tracked only till the end of negotiate exchange, and not used for session setup. This change fixes this. Signed-off-by: Shyam Prasad N Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- fs/cifs/connect.c | 23 +++++++++++------------ fs/cifs/smb2pdu.c | 3 ++- fs/cifs/smb2transport.c | 3 ++- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index b28b1ff39fed..aa2d4c49e2a5 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3956,7 +3956,7 @@ cifs_negotiate_protocol(const unsigned int xid, struc= t cifs_ses *ses, if (rc =3D=3D 0) { spin_lock(&cifs_tcp_ses_lock); if (server->tcpStatus =3D=3D CifsInNegotiate) - server->tcpStatus =3D CifsNeedSessSetup; + server->tcpStatus =3D CifsGood; else rc =3D -EHOSTDOWN; spin_unlock(&cifs_tcp_ses_lock); @@ -3979,19 +3979,18 @@ cifs_setup_session(const unsigned int xid, struct c= ifs_ses *ses, bool is_binding =3D false; =20 /* only send once per connect */ + spin_lock(&ses->chan_lock); + is_binding =3D !CIFS_ALL_CHANS_NEED_RECONNECT(ses); + spin_unlock(&ses->chan_lock); + spin_lock(&cifs_tcp_ses_lock); - if ((server->tcpStatus !=3D CifsNeedSessSetup) && - (ses->status =3D=3D CifsGood)) { + if (ses->status =3D=3D CifsExiting) { spin_unlock(&cifs_tcp_ses_lock); return 0; } - server->tcpStatus =3D CifsInSessSetup; + ses->status =3D CifsInSessSetup; spin_unlock(&cifs_tcp_ses_lock); =20 - spin_lock(&ses->chan_lock); - is_binding =3D !CIFS_ALL_CHANS_NEED_RECONNECT(ses); - spin_unlock(&ses->chan_lock); - if (!is_binding) { ses->capabilities =3D server->capabilities; if (!linuxExtEnabled) @@ -4015,13 +4014,13 @@ cifs_setup_session(const unsigned int xid, struct c= ifs_ses *ses, if (rc) { cifs_server_dbg(VFS, "Send error in SessSetup =3D %d\n", rc); spin_lock(&cifs_tcp_ses_lock); - if (server->tcpStatus =3D=3D CifsInSessSetup) - server->tcpStatus =3D CifsNeedSessSetup; + if (ses->status =3D=3D CifsInSessSetup) + ses->status =3D CifsNeedSessSetup; spin_unlock(&cifs_tcp_ses_lock); } else { spin_lock(&cifs_tcp_ses_lock); - if (server->tcpStatus =3D=3D CifsInSessSetup) - server->tcpStatus =3D CifsGood; + if (ses->status =3D=3D CifsInSessSetup) + ses->status =3D CifsGood; /* Even if one channel is active, session is in good state */ ses->status =3D CifsGood; spin_unlock(&cifs_tcp_ses_lock); diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 1b7ad0c09566..f5321a3500f3 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -3899,7 +3899,8 @@ SMB2_echo(struct TCP_Server_Info *server) cifs_dbg(FYI, "In echo request for conn_id %lld\n", server->conn_id); =20 spin_lock(&cifs_tcp_ses_lock); - if (server->tcpStatus =3D=3D CifsNeedNegotiate) { + if (server->ops->need_neg && + server->ops->need_neg(server)) { spin_unlock(&cifs_tcp_ses_lock); /* No need to send echo on newly established connections */ mod_delayed_work(cifsiod_wq, &server->reconnect, 0); diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c index 2af79093b78b..01b732641edb 100644 --- a/fs/cifs/smb2transport.c +++ b/fs/cifs/smb2transport.c @@ -641,7 +641,8 @@ smb2_sign_rqst(struct smb_rqst *rqst, struct TCP_Server= _Info *server) if (!is_signed) return 0; spin_lock(&cifs_tcp_ses_lock); - if (server->tcpStatus =3D=3D CifsNeedNegotiate) { + if (server->ops->need_neg && + server->ops->need_neg(server)) { spin_unlock(&cifs_tcp_ses_lock); return 0; } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2BB0CCA483 for ; Tue, 7 Jun 2022 22:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383402AbiFGWa5 (ORCPT ); Tue, 7 Jun 2022 18:30:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380738AbiFGVQz (ORCPT ); Tue, 7 Jun 2022 17:16: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 50FD521F9E7; Tue, 7 Jun 2022 11:57:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E2EC96156D; Tue, 7 Jun 2022 18:57:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0EE4C385A5; Tue, 7 Jun 2022 18:57:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628224; bh=a3fmYRNmxmmGtW2qncH+A1b8hXxAu7cfiYtmX5DV0eM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VXm+srs7teZa7Sh+6Ckd0jXH/7JLnobRv7PR+RmZGOXDqTCkT19UvetpAE8qB09Up 3FO7CRN354WVqOqAgCYFIkVxhL/qhiremV9ZynJUo4mUkLk0twSjdOwVGfhCVmEZz0 NVnPy+FdzSwF9eX1EvXoDQcLkz4uhiKiFhiDhBMY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lad Prabhakar , Dmitry Torokhov , Sasha Levin Subject: [PATCH 5.18 252/879] Input: gpio-keys - cancel delayed work only in case of GPIO Date: Tue, 7 Jun 2022 18:56:10 +0200 Message-Id: <20220607165010.163719386@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar [ Upstream commit cee409bbba0d1bd3fb73064fb480ff365f453b5d ] gpio_keys module can either accept gpios or interrupts. The module initializes delayed work in case of gpios only and is only used if debounce timer is not used, so make sure cancel_delayed_work_sync() is called only when its gpio-backed and debounce_use_hrtimer is false. This fixes the issue seen below when the gpio_keys module is unloaded and an interrupt pin is used instead of GPIO: [ 360.297569] ------------[ cut here ]------------ [ 360.302303] WARNING: CPU: 0 PID: 237 at kernel/workqueue.c:3066 __flush_= work+0x414/0x470 [ 360.310531] Modules linked in: gpio_keys(-) [ 360.314797] CPU: 0 PID: 237 Comm: rmmod Not tainted 5.18.0-rc5-arm64-ren= esas-00116-g73636105874d-dirty #166 [ 360.324662] Hardware name: Renesas SMARC EVK based on r9a07g054l2 (DT) [ 360.331270] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE= =3D--) [ 360.338318] pc : __flush_work+0x414/0x470 [ 360.342385] lr : __cancel_work_timer+0x140/0x1b0 [ 360.347065] sp : ffff80000a7fba00 [ 360.350423] x29: ffff80000a7fba00 x28: ffff000012b9c5c0 x27: 00000000000= 00000 [ 360.357664] x26: ffff80000a7fbb80 x25: ffff80000954d0a8 x24: 00000000000= 00001 [ 360.364904] x23: ffff800009757000 x22: 0000000000000000 x21: ffff8000091= 9b000 [ 360.372143] x20: ffff00000f5974e0 x19: ffff00000f5974e0 x18: ffff8000097= fcf48 [ 360.379382] x17: 0000000000000000 x16: 0000000000000000 x15: 00000000000= 53f40 [ 360.386622] x14: ffff800009850e88 x13: 0000000000000002 x12: 00000000000= 0a60c [ 360.393861] x11: 000000000000a610 x10: 0000000000000000 x9 : 00000000000= 00008 [ 360.401100] x8 : 0101010101010101 x7 : 00000000a473c394 x6 : 00808080808= 08080 [ 360.408339] x5 : 0000000000000001 x4 : 0000000000000000 x3 : ffff8000091= 9b458 [ 360.415578] x2 : ffff8000097577f0 x1 : 0000000000000001 x0 : 00000000000= 00000 [ 360.422818] Call trace: [ 360.425299] __flush_work+0x414/0x470 [ 360.429012] __cancel_work_timer+0x140/0x1b0 [ 360.433340] cancel_delayed_work_sync+0x10/0x18 [ 360.437931] gpio_keys_quiesce_key+0x28/0x58 [gpio_keys] [ 360.443327] devm_action_release+0x10/0x18 [ 360.447481] release_nodes+0x8c/0x1a0 [ 360.451194] devres_release_all+0x90/0x100 [ 360.455346] device_unbind_cleanup+0x14/0x60 [ 360.459677] device_release_driver_internal+0xe8/0x168 [ 360.464883] driver_detach+0x4c/0x90 [ 360.468509] bus_remove_driver+0x54/0xb0 [ 360.472485] driver_unregister+0x2c/0x58 [ 360.476462] platform_driver_unregister+0x10/0x18 [ 360.481230] gpio_keys_exit+0x14/0x828 [gpio_keys] [ 360.486088] __arm64_sys_delete_module+0x1e0/0x270 [ 360.490945] invoke_syscall+0x40/0xf8 [ 360.494661] el0_svc_common.constprop.3+0xf0/0x110 [ 360.499515] do_el0_svc+0x20/0x78 [ 360.502877] el0_svc+0x48/0xf8 [ 360.505977] el0t_64_sync_handler+0x88/0xb0 [ 360.510216] el0t_64_sync+0x148/0x14c [ 360.513930] irq event stamp: 4306 [ 360.517288] hardirqs last enabled at (4305): [] __can= cel_work_timer+0x130/0x1b0 [ 360.526359] hardirqs last disabled at (4306): [] el1_d= bg+0x24/0x88 [ 360.534204] softirqs last enabled at (4278): [] _stex= t+0x4a0/0x5e0 [ 360.542133] softirqs last disabled at (4267): [] irq_e= xit_rcu+0x18c/0x1b0 [ 360.550591] ---[ end trace 0000000000000000 ]--- Signed-off-by: Lad Prabhakar Link: https://lore.kernel.org/r/20220524135822.14764-1-prabhakar.mahadev-la= d.rj@bp.renesas.com Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/input/keyboard/gpio_keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gp= io_keys.c index d75a8b179a8a..a5dc4ab87fa1 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -131,7 +131,7 @@ static void gpio_keys_quiesce_key(void *data) =20 if (!bdata->gpiod) hrtimer_cancel(&bdata->release_timer); - if (bdata->debounce_use_hrtimer) + else if (bdata->debounce_use_hrtimer) hrtimer_cancel(&bdata->debounce_timer); else cancel_delayed_work_sync(&bdata->work); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 360A5C433EF for ; Tue, 7 Jun 2022 22:23:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354539AbiFGWXe (ORCPT ); Tue, 7 Jun 2022 18:23:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380637AbiFGVQz (ORCPT ); Tue, 7 Jun 2022 17:16:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7986F13E17; Tue, 7 Jun 2022 11:57:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3306EB822C0; Tue, 7 Jun 2022 18:57:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C877C385A2; Tue, 7 Jun 2022 18:57:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628227; bh=MmQJDZApS8UaiRibxxFyjqlEdDr50z7x4JFT5HUt8A4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OJKPKFRGh4gKGnLOoSyMrEr9490zAKPxwDx0ddWOXUIMAYX9iuKcbWqF/PG3lt2oZ 2oPVM0+VclbsUWiW+ykgv73AR7AQEdDricyZ8Be+1g9gANZPU9v09Vhcz2nsXydyOS Vsy+F2AZlip1Dc6d4HBepvq+/2z6yh9PIx+a2wTU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudip Mukherjee , Arnd Bergmann , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Linus Torvalds , Sasha Levin Subject: [PATCH 5.18 253/879] drm: fix EDID struct for old ARM OABI format Date: Tue, 7 Jun 2022 18:56:11 +0200 Message-Id: <20220607165010.194133714@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Torvalds [ Upstream commit 47f15561b69e226bfc034e94ff6dbec51a4662af ] When building the kernel for arm with the "-mabi=3Dapcs-gnu" option, gcc will force alignment of all structures and unions to a word boundary (see also STRUCTURE_SIZE_BOUNDARY and the "-mstructure-size-boundary=3DXX" option if you're a gcc person), even when the members of said structures do not want or need said alignment. This completely messes up the structure alignment of 'struct edid' on those targets, because even though all the embedded structures are marked with "__attribute__((packed))", the unions that contain them are not. This was exposed by commit f1e4c916f97f ("drm/edid: add EDID block count and size helpers"), but the bug is pre-existing. That commit just made the structure layout problem cause a build failure due to the addition of the BUILD_BUG_ON(sizeof(*edid) !=3D EDID_LENGTH); sanity check in drivers/gpu/drm/drm_edid.c:edid_block_data(). This legacy union alignment should probably not be used in the first place, but we can fix the layout by adding the packed attribute to the union entries even when each member is already packed and it shouldn't matter in a sane build environment. You can see this issue with a trivial test program: union { struct { char c[5]; }; struct { char d; unsigned e; } __attribute__((packed)); } a =3D { "1234" }; where building this with a normal "gcc -S" will result in the expected 5-byte size of said union: .type a, @object .size a, 5 but with an ARM compiler and the old ABI: arm-linux-gnu-gcc -mabi=3Dapcs-gnu -mfloat-abi=3Dsoft -S t.c you get .type a, %object .size a, 8 instead, because even though each member of the union is packed, the union itself still gets aligned. This was reported by Sudip for the spear3xx_defconfig target. Link: https://lore.kernel.org/lkml/YpCUzStDnSgQLNFN@debian/ Reported-by: Sudip Mukherjee Acked-by: Arnd Bergmann Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- include/drm/drm_edid.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 144c495b99c4..d6b2aeb34211 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -121,7 +121,7 @@ struct detailed_data_monitor_range { u8 supported_scalings; u8 preferred_refresh; } __attribute__((packed)) cvt; - } formula; + } __attribute__((packed)) formula; } __attribute__((packed)); =20 struct detailed_data_wpindex { @@ -154,7 +154,7 @@ struct detailed_non_pixel { struct detailed_data_wpindex color; struct std_timing timings[6]; struct cvt_timing cvt[4]; - } data; + } __attribute__((packed)) data; } __attribute__((packed)); =20 #define EDID_DETAIL_EST_TIMINGS 0xf7 @@ -172,7 +172,7 @@ struct detailed_timing { union { struct detailed_pixel_timing pixel_data; struct detailed_non_pixel other_data; - } data; + } __attribute__((packed)) data; } __attribute__((packed)); =20 #define DRM_EDID_INPUT_SERRATION_VSYNC (1 << 0) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26156C43334 for ; Tue, 7 Jun 2022 22:23:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380734AbiFGWXW (ORCPT ); Tue, 7 Jun 2022 18:23:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380742AbiFGVQz (ORCPT ); Tue, 7 Jun 2022 17:16: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 AC1EB8A064; Tue, 7 Jun 2022 11:57:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 481676159D; Tue, 7 Jun 2022 18:57:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B2BCC385A2; Tue, 7 Jun 2022 18:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628229; bh=27T+o5aDnrnyaKXC7K+l9XYzuMzC06GKuuJNvAXwJ1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bpRYPUF2ExLBgXHNzAJ0pplxkGNS1c8fvkZ+9KWgPT5iQWcdX6pP85Il6hJhN3Co3 0i9fp2dFgZQJqrTAVgH7H4ms48Vc0uaXibyS0d9aUTsFeUoEkm2OFQ8WGv/eO0dmju k9mpY5JzU6cW/pZj7DHU9mPK6VDZcdvIzLNiKFqg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikita Yushchenko , Paul Cercueil , Kieran Bingham , Laurent Pinchart , Sasha Levin Subject: [PATCH 5.18 254/879] drm/bridge_connector: enable HPD by default if supported Date: Tue, 7 Jun 2022 18:56:12 +0200 Message-Id: <20220607165010.222466946@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nikita Yushchenko [ Upstream commit 09077bc3116581f4d1cb961ec359ad56586e370b ] Hotplug events reported by bridge drivers over drm_bridge_hpd_notify() get ignored unless somebody calls drm_bridge_hpd_enable(). When the connector for the bridge is bridge_connector, such a call is done from drm_bridge_connector_enable_hpd(). However drm_bridge_connector_enable_hpd() is never called on init paths, documentation suggests that it is intended for suspend/resume paths. In result, once encoders are switched to bridge_connector, bridge-detected HPD stops working. This patch adds a call to that API on init path. This fixes HDMI HPD with rcar-du + adv7513 case when adv7513 reports HPD events via interrupts. Fixes: c24110a8fd09 ("drm: rcar-du: Use drm_bridge_connector_init() helper") Signed-off-by: Nikita Yushchenko Signed-off-by: Paul Cercueil Tested-by: Kieran Bingham Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Link: https://patchwork.freedesktop.org/patch/msgid/20211225063151.2110878-= 1-nikita.yoush@cogentembedded.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/drm_bridge_connector.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_b= ridge_connector.c index 60923cdfe8e1..6b3dad03d77d 100644 --- a/drivers/gpu/drm/drm_bridge_connector.c +++ b/drivers/gpu/drm/drm_bridge_connector.c @@ -384,8 +384,10 @@ struct drm_connector *drm_bridge_connector_init(struct= drm_device *drm, connector_type, ddc); drm_connector_helper_add(connector, &drm_bridge_connector_helper_funcs); =20 - if (bridge_connector->bridge_hpd) + if (bridge_connector->bridge_hpd) { connector->polled =3D DRM_CONNECTOR_POLL_HPD; + drm_bridge_connector_enable_hpd(connector); + } else if (bridge_connector->bridge_detect) connector->polled =3D DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88E34C433EF for ; Tue, 7 Jun 2022 22:23:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382178AbiFGWXt (ORCPT ); Tue, 7 Jun 2022 18:23:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380748AbiFGVQ4 (ORCPT ); Tue, 7 Jun 2022 17:16:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51F9A49F17; Tue, 7 Jun 2022 11:57:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1AE76159D; Tue, 7 Jun 2022 18:57:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F22A4C385A5; Tue, 7 Jun 2022 18:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628232; bh=Kp9lSNG9ZMRLzWcdumWHugzb7Zr7YUX0zq3Ss2UvdWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JA4f6WaNqku7BL5owwsO1oeZ/Wu9GepcUPt7xlVEj2o87fheIH7TelIiV045rWY/m VuS7UJV0Jw4QiV7QraratfKORWYAi+S3D/MVduJz8fyNjk6jU9/5c8QsNHiOpkk4Y+ TZ8ouy7KMOZF4kAIr1ynD2BBfYUFm56+p6CLJ/ec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Arunpravin , =?UTF-8?q?Christian=20K=C3=B6nig?= , Sasha Levin Subject: [PATCH 5.18 255/879] drm/selftests: missing error code in igt_buddy_alloc_smoke() Date: Tue, 7 Jun 2022 18:56:13 +0200 Message-Id: <20220607165010.251403464@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 016d1ca3f6ad05676fd9e418715ddce1f4ab5a73 ] Set the error code to -ENOMEM if drm_random_order() fails. Fixes: e6ff5ef81170 ("drm/selftests: add drm buddy smoke testcase") Signed-off-by: Dan Carpenter Reviewed-by: Arunpravin Signed-off-by: Christian K=C3=B6nig Link: https://patchwork.freedesktop.org/patch/msgid/20220307125458.GA16710@= kili Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/selftests/test-drm_buddy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/selftests/test-drm_buddy.c b/drivers/gpu/drm/s= elftests/test-drm_buddy.c index 913cbd7eae04..aca0c491040f 100644 --- a/drivers/gpu/drm/selftests/test-drm_buddy.c +++ b/drivers/gpu/drm/selftests/test-drm_buddy.c @@ -488,8 +488,10 @@ static int igt_buddy_alloc_smoke(void *arg) } =20 order =3D drm_random_order(mm.max_order + 1, &prng); - if (!order) + if (!order) { + err =3D -ENOMEM; goto out_fini; + } =20 for (i =3D 0; i <=3D mm.max_order; ++i) { struct drm_buddy_block *block; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F0D4CCA47F for ; Tue, 7 Jun 2022 22:23:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381894AbiFGWXm (ORCPT ); Tue, 7 Jun 2022 18:23:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380755AbiFGVQ4 (ORCPT ); Tue, 7 Jun 2022 17:16:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 152DA46656; Tue, 7 Jun 2022 11:57:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8A48D6156D; Tue, 7 Jun 2022 18:57:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F127C385A5; Tue, 7 Jun 2022 18:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628235; bh=0or0bOVZvhDFy8k7MzwZE5SMX4NHHdVIR77GgpLle00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RatjAeSCIjkUvraUyR3LNyKTSqhoBOpz2tC9SBOUtjniFthHnp9TXy/tPqQVz2TXR DQoO0uChwsmQQTjbag3rJadqp1czjOos4FOQJWOQf1Hqn/fPJv//vFTmlYBQGgosWT 4A0khB616V6loWxXA01Atjp8He17jxZj2CsSTynE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wan Jiabing , Tomi Valkeinen , Sasha Levin Subject: [PATCH 5.18 256/879] drm/omap: fix NULL but dereferenced coccicheck error Date: Tue, 7 Jun 2022 18:56:14 +0200 Message-Id: <20220607165010.280964708@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wan Jiabing [ Upstream commit 8f2a3970c969d0d8d7289a4c65edcedafc16fd92 ] Fix the following coccicheck warning: ./drivers/gpu/drm/omapdrm/omap_overlay.c:89:22-25: ERROR: r_ovl is NULL but dereferenced. Here should be ovl->idx rather than r_ovl->idx. Fixes: e02b5cc9e898ad ("drm/omap: Add a 'right overlay' to plane state") Signed-off-by: Wan Jiabing Signed-off-by: Tomi Valkeinen Link: https://patchwork.freedesktop.org/patch/msgid/20220307095612.409090-1= -wanjiabing@vivo.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/omapdrm/omap_overlay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/omap_overlay.c b/drivers/gpu/drm/omapd= rm/omap_overlay.c index 10730c9b2752..b0bc9ad2ef73 100644 --- a/drivers/gpu/drm/omapdrm/omap_overlay.c +++ b/drivers/gpu/drm/omapdrm/omap_overlay.c @@ -86,7 +86,7 @@ int omap_overlay_assign(struct drm_atomic_state *s, struc= t drm_plane *plane, r_ovl =3D omap_plane_find_free_overlay(s->dev, overlay_map, caps, fourcc); if (!r_ovl) { - overlay_map[r_ovl->idx] =3D NULL; + overlay_map[ovl->idx] =3D NULL; *overlay =3D NULL; return -ENOMEM; } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89407C43334 for ; Tue, 7 Jun 2022 22:24:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382331AbiFGWYC (ORCPT ); Tue, 7 Jun 2022 18:24:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380769AbiFGVQ6 (ORCPT ); Tue, 7 Jun 2022 17:16:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37499644F4; Tue, 7 Jun 2022 11:57:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DDCF6B8220B; Tue, 7 Jun 2022 18:57:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A2F5C385A2; Tue, 7 Jun 2022 18:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628237; bh=XJ50Jb/dd9venn1pdAoNrEN6xPogM9j8x9SREus6Qzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GFdWrjbGQcqgFyovPXwNyikMW6sdbbq3R8DuLvX3P4j70A7ouSMiKn3MHLKEDgsHx NC4ZzLNTUpb2NUM61FVIvfzs8ymGeH/vsuRxkmnLi8RoRafxIQ475zTTE2l2HA8onN J/4EK8TxPtWvHA/S6zPMabTiT/KdchEcZoFG7EFQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , Rob Herring , Geert Uytterhoeven , David Lechner , Sasha Levin Subject: [PATCH 5.18 257/879] dt-bindings: display: sitronix, st7735r: Fix backlight in example Date: Tue, 7 Jun 2022 18:56:15 +0200 Message-Id: <20220607165010.309747977@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Noralf Tr=C3=B8nnes [ Upstream commit 471e201f543559e2cb19b182b680ebf04d80ee31 ] The backlight property was lost during conversion to yaml in commit abdd9e3705c8 ("dt-bindings: display: sitronix,st7735r: Convert to DT schema= "). Put it back. Fixes: abdd9e3705c8 ("dt-bindings: display: sitronix,st7735r: Convert to DT= schema") Signed-off-by: Noralf Tr=C3=B8nnes Acked-by: Rob Herring Reviewed-by: Geert Uytterhoeven Acked-by: David Lechner Link: https://patchwork.freedesktop.org/patch/msgid/20211124150757.17929-2-= noralf@tronnes.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- Documentation/devicetree/bindings/display/sitronix,st7735r.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/display/sitronix,st7735r.yam= l b/Documentation/devicetree/bindings/display/sitronix,st7735r.yaml index 0cebaaefda03..419c3b2ac5a6 100644 --- a/Documentation/devicetree/bindings/display/sitronix,st7735r.yaml +++ b/Documentation/devicetree/bindings/display/sitronix,st7735r.yaml @@ -72,6 +72,7 @@ examples: dc-gpios =3D <&gpio 43 GPIO_ACTIVE_HIGH>; reset-gpios =3D <&gpio 80 GPIO_ACTIVE_HIGH>; rotation =3D <270>; + backlight =3D <&backlight>; }; }; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3C44CCA482 for ; Tue, 7 Jun 2022 22:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383335AbiFGWaw (ORCPT ); Tue, 7 Jun 2022 18:30:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380794AbiFGVQ7 (ORCPT ); Tue, 7 Jun 2022 17:16:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B179C2982C; Tue, 7 Jun 2022 11:57: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 6E76EB8233E; Tue, 7 Jun 2022 18:57:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D72C9C385A2; Tue, 7 Jun 2022 18:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628243; bh=l+KNCHbgVMmd/yIZZbjqm8gJi4yhr1wcah02wTfDYYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZNV031xN9tKDoklMlydq2Q2J6KlmDYQn9609QGRwJfsCEZqlwCJAGa9E+UN2k+GPQ 6yBSnWiPx2+0Ba58plVWGE9lEx9fvY3J3QbUWM5ghqbrFE3FZCubePZa1HTtm0nbRY 6oodKPSgSLi/Pb1hHSHk5zCYnjO24cj0cl8z1prU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Robert Foss , Sasha Levin Subject: [PATCH 5.18 258/879] drm/bridge: anx7625: check the return on anx7625_aux_trans Date: Tue, 7 Jun 2022 18:56:16 +0200 Message-Id: <20220607165010.338124319@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tom Rix [ Upstream commit d583e752732421b26fef0d65020565f3bef12248 ] Clang static analysis reports this issue anx7625.c:876:13: warning: The left operand of '&' is a garbage value if (!(bcap & 0xOA01)) { ~~~~ ^ bcap is only set by a successful call to anx7625_aux_trans(). So check. Fixes: cd1637c7e480 ("drm/bridge: anx7625: add HDCP support") Signed-off-by: Tom Rix Fixes: adca62ec370c ("drm/bridge: anx7625: Support reading edid through aux= channel") Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220303201943.501746-1= -trix@redhat.com Reviewed-by: Robert Foss Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/bridge/analogix/anx7625.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/br= idge/analogix/anx7625.c index 31ecf5626f1d..8e1851a57638 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -874,7 +874,10 @@ static int anx7625_hdcp_enable(struct anx7625_data *ct= x) } =20 /* Read downstream capability */ - anx7625_aux_trans(ctx, DP_AUX_NATIVE_READ, 0x68028, 1, &bcap); + ret =3D anx7625_aux_trans(ctx, DP_AUX_NATIVE_READ, 0x68028, 1, &bcap); + if (ret < 0) + return ret; + if (!(bcap & 0x01)) { pr_warn("downstream not support HDCP 1.4, cap(%x).\n", bcap); return 0; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC4ADC433EF for ; Tue, 7 Jun 2022 22:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385149AbiFGW0a (ORCPT ); Tue, 7 Jun 2022 18:26:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380797AbiFGVQ7 (ORCPT ); Tue, 7 Jun 2022 17:16:59 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 257CF52B3D; Tue, 7 Jun 2022 11:57:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 97281CE244E; Tue, 7 Jun 2022 18:57:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B7A2C385A5; Tue, 7 Jun 2022 18:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628245; bh=4M718MF/c9068y/4EsWfAgSxjWRXy65Wpxn5CQQyKp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bbHcdTFcdH1DN6TeOayvjBvyXub0EXsmQqbQen5G/L0N6LWTBOqaQ3Uy6fufcnm/x dnOqbPGcm0E+VWVgimTCtFLwynh34L5vrRUAgfSS9XzEH86SZAhWlu7Yemxq8p95FM A2enMTi+ubIh6fDpXpZt7NhT2VrYZlMaE8IU1vYI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Javier Martinez Canillas , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.18 259/879] drm: ssd130x: Fix COM scan direction register mask Date: Tue, 7 Jun 2022 18:56:17 +0200 Message-Id: <20220607165010.369618689@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chen-Yu Tsai [ Upstream commit efb37e66b7572ce4696aa0ac21675e17d6b9a17d ] The SSD130x's command to toggle COM scan direction uses bit 3 and only bit 3 to set the direction of the scanout. The driver has an incorrect GENMASK(3, 2), causing the setting to be set on bit 2, rendering it ineffective. Fix the mask to only bit 3, so that the requested setting is applied correctly. Fixes: a61732e80867 ("drm: Add driver for Solomon SSD130x OLED displays") Signed-off-by: Chen-Yu Tsai Acked-by: Javier Martinez Canillas Tested-by: Geert Uytterhoeven Reviewed-by: Geert Uytterhoeven Signed-off-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20220308160758.26060-1-= wens@kernel.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/solomon/ssd130x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ss= d130x.c index ce4dc20412e0..ccd378135589 100644 --- a/drivers/gpu/drm/solomon/ssd130x.c +++ b/drivers/gpu/drm/solomon/ssd130x.c @@ -61,7 +61,7 @@ #define SSD130X_SET_COM_PINS_CONFIG 0xda #define SSD130X_SET_VCOMH 0xdb =20 -#define SSD130X_SET_COM_SCAN_DIR_MASK GENMASK(3, 2) +#define SSD130X_SET_COM_SCAN_DIR_MASK GENMASK(3, 3) #define SSD130X_SET_COM_SCAN_DIR_SET(val) FIELD_PREP(SSD130X_SET_COM_SCAN_= DIR_MASK, (val)) #define SSD130X_SET_CLOCK_DIV_MASK GENMASK(3, 0) #define SSD130X_SET_CLOCK_DIV_SET(val) FIELD_PREP(SSD130X_SET_CLOCK_DIV_M= ASK, (val)) --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26AC9C43334 for ; Tue, 7 Jun 2022 22:32:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382738AbiFGWaY (ORCPT ); Tue, 7 Jun 2022 18:30:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380798AbiFGVQ7 (ORCPT ); Tue, 7 Jun 2022 17:16:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A82BF527D2; Tue, 7 Jun 2022 11:57:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2BFD76159D; Tue, 7 Jun 2022 18:57:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3849CC385A2; Tue, 7 Jun 2022 18:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628248; bh=Iv21szQQ0IsjJwXsnfNc9wifZ6YaVnjO+Lc5Z9nTGic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vkheCahfwoxuZXc4vxF3HAVyh8H63n31pvgKLIXTojg5YzU2WggWT/y1E75DhSYf1 kl9dwuKGICI+H8gFq/LtMeVsQexksdnuT1NMMhcWz0yVjCFaprAIaZ3oiRSyWY1N3+ 24rMjErX8VaWS8BOtiVSLa6fswAR2m26Ot6J2PyA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Javier Martinez Canillas , Sasha Levin Subject: [PATCH 5.18 260/879] drm: ssd130x: Always apply segment remap setting Date: Tue, 7 Jun 2022 18:56:18 +0200 Message-Id: <20220607165010.397560644@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chen-Yu Tsai [ Upstream commit a134109c301736ea2ac5054ba3c29c30c87f6ba7 ] Currently the ssd130x driver only sets the segment remap setting when the device tree requests it; it however does not clear the setting if it is not requested. This leads to the setting incorrectly persisting if the hardware is always on and has no reset GPIO wired. This might happen when a developer is trying to find the correct settings for an unknown module, and cause the developer to get confused because the settings from the device tree are not consistently applied. Make the driver apply the segment remap setting consistently, setting the value correctly based on the device tree setting. This also makes this setting's behavior consistent with the other settings, which are always applied. Fixes: a61732e80867 ("drm: Add driver for Solomon SSD130x OLED displays") Signed-off-by: Chen-Yu Tsai Acked-by: Javier Martinez Canillas Signed-off-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20220308160758.26060-2-= wens@kernel.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/solomon/ssd130x.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ss= d130x.c index ccd378135589..d08d86ef07bc 100644 --- a/drivers/gpu/drm/solomon/ssd130x.c +++ b/drivers/gpu/drm/solomon/ssd130x.c @@ -48,7 +48,7 @@ #define SSD130X_CONTRAST 0x81 #define SSD130X_SET_LOOKUP_TABLE 0x91 #define SSD130X_CHARGE_PUMP 0x8d -#define SSD130X_SEG_REMAP_ON 0xa1 +#define SSD130X_SET_SEG_REMAP 0xa0 #define SSD130X_DISPLAY_OFF 0xae #define SSD130X_SET_MULTIPLEX_RATIO 0xa8 #define SSD130X_DISPLAY_ON 0xaf @@ -61,6 +61,8 @@ #define SSD130X_SET_COM_PINS_CONFIG 0xda #define SSD130X_SET_VCOMH 0xdb =20 +#define SSD130X_SET_SEG_REMAP_MASK GENMASK(0, 0) +#define SSD130X_SET_SEG_REMAP_SET(val) FIELD_PREP(SSD130X_SET_SEG_REMAP_M= ASK, (val)) #define SSD130X_SET_COM_SCAN_DIR_MASK GENMASK(3, 3) #define SSD130X_SET_COM_SCAN_DIR_SET(val) FIELD_PREP(SSD130X_SET_COM_SCAN_= DIR_MASK, (val)) #define SSD130X_SET_CLOCK_DIV_MASK GENMASK(3, 0) @@ -235,7 +237,7 @@ static void ssd130x_power_off(struct ssd130x_device *ss= d130x) =20 static int ssd130x_init(struct ssd130x_device *ssd130x) { - u32 precharge, dclk, com_invdir, compins, chargepump; + u32 precharge, dclk, com_invdir, compins, chargepump, seg_remap; int ret; =20 /* Set initial contrast */ @@ -244,11 +246,11 @@ static int ssd130x_init(struct ssd130x_device *ssd130= x) return ret; =20 /* Set segment re-map */ - if (ssd130x->seg_remap) { - ret =3D ssd130x_write_cmd(ssd130x, 1, SSD130X_SEG_REMAP_ON); - if (ret < 0) - return ret; - } + seg_remap =3D (SSD130X_SET_SEG_REMAP | + SSD130X_SET_SEG_REMAP_SET(ssd130x->seg_remap)); + ret =3D ssd130x_write_cmd(ssd130x, 1, seg_remap); + if (ret < 0) + return ret; =20 /* Set COM direction */ com_invdir =3D (SSD130X_SET_COM_SCAN_DIR | --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BFDECCA47C for ; Tue, 7 Jun 2022 22:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382949AbiFGWad (ORCPT ); Tue, 7 Jun 2022 18:30:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380800AbiFGVQ7 (ORCPT ); Tue, 7 Jun 2022 17:16:59 -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 C99FDA1A9; Tue, 7 Jun 2022 11:57: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 8921CB822C0; Tue, 7 Jun 2022 18:57:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7182C385A2; Tue, 7 Jun 2022 18:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628251; bh=VMBQ25Si+CvDpexTdClyp2NZuPRPUCh8Jw3Nk8iusDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MFiOnok2CweQF9lTocIG30TWCb9eSbtBktWPlJmONYTo9GIiUi3s1bITz6h91sQ1/ nfctQOyuJdXpuirZaOBIXMV/YKvhI3AtYCeNNkHt6TptSX4w2j2lrN+ymuUX2HkAfE 42Ny4Y1E4vTgUAgxHOc2PFwTS0n/c4Ba3NSXKfHE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Javier Martinez Canillas , Sasha Levin Subject: [PATCH 5.18 261/879] drm/solomon: Make DRM_SSD130X depends on MMU Date: Tue, 7 Jun 2022 18:56:19 +0200 Message-Id: <20220607165010.426578702@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: YueHaibing [ Upstream commit 47042e0ddd218f100292cebc5208cb1eff7473b6 ] WARNING: unmet direct dependencies detected for DRM_GEM_SHMEM_HELPER Depends on [n]: HAS_IOMEM [=3Dy] && DRM [=3Dm] && MMU [=3Dn] Selected by [m]: - DRM_SSD130X [=3Dm] && HAS_IOMEM [=3Dy] && DRM [=3Dm] DRM_GEM_SHMEM_HELPER depends on MMU, DRM_SSD130X should also depends on MMU. Fixes: a61732e80867 ("drm: Add driver for Solomon SSD130x OLED displays") Signed-off-by: YueHaibing Acked-by: Javier Martinez Canillas Signed-off-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20220312063437.19160-1-= yuehaibing@huawei.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/solomon/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/solomon/Kconfig b/drivers/gpu/drm/solomon/Kcon= fig index 5861c3ab7c45..6230369505c9 100644 --- a/drivers/gpu/drm/solomon/Kconfig +++ b/drivers/gpu/drm/solomon/Kconfig @@ -1,6 +1,6 @@ config DRM_SSD130X tristate "DRM support for Solomon SSD130x OLED displays" - depends on DRM + depends on DRM && MMU select BACKLIGHT_CLASS_DEVICE select DRM_GEM_SHMEM_HELPER select DRM_KMS_HELPER --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DE03C3F2D4 for ; Tue, 7 Jun 2022 22:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383050AbiFGWah (ORCPT ); Tue, 7 Jun 2022 18:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380799AbiFGVQ7 (ORCPT ); Tue, 7 Jun 2022 17:16:59 -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 6A2192F01F; Tue, 7 Jun 2022 11:57:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 26B4DB8220B; Tue, 7 Jun 2022 18:57:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C495C385A2; Tue, 7 Jun 2022 18:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628253; bh=CRQd8H8OiZSbsXXyPamobgycEaXOZlhITQlHQDMZtZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CIkaZmAfHz/8Ia2J2wWrWz6yhFCDFZYG3NQVWVJ5bPBOYUPboC63vrEJzpSoWzkZl weSGscblg3+/LyOeILcjBw8P4swGjtnezDfmu4qPWb8yWo5v68L4nSE3CEMm+fthHh 5DJTjnVVA/XvLSGpHzaxoy0K7lIAH8RjbpzJZYPo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Javier Martinez Canillas , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.18 262/879] drm/format-helper: Rename drm_fb_xrgb8888_to_mono_reversed() Date: Tue, 7 Jun 2022 18:56:20 +0200 Message-Id: <20220607165010.455227491@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit 9b13a3fcd35fc24045d2fd0f0e13ddd8d7985b4b ] There is no "reversed" handling in drm_fb_xrgb8888_to_mono_reversed(): the function just converts from color to grayscale, and reduces the number of grayscale levels from 256 to 2 (i.e. brightness 0-127 is mapped to 0, 128-255 to 1). All "reversed" handling is done in the repaper driver, where this function originated. Hence make this clear by renaming drm_fb_xrgb8888_to_mono_reversed() to drm_fb_xrgb8888_to_mono(), and documenting the black/white pixel mapping. Fixes: bcf8b616deb87941 ("drm/format-helper: Add drm_fb_xrgb8888_to_mono_re= versed()") Signed-off-by: Geert Uytterhoeven Acked-by: Javier Martinez Canillas Reviewed-by: Andy Shevchenko Signed-off-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20220317081830.1211400-= 2-geert@linux-m68k.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/drm_format_helper.c | 31 ++++++++++++++--------------- drivers/gpu/drm/solomon/ssd130x.c | 2 +- drivers/gpu/drm/tiny/repaper.c | 2 +- include/drm/drm_format_helper.h | 5 ++--- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_form= at_helper.c index bc0f49773868..5d9d0c695845 100644 --- a/drivers/gpu/drm/drm_format_helper.c +++ b/drivers/gpu/drm/drm_format_helper.c @@ -594,8 +594,8 @@ int drm_fb_blit_toio(void __iomem *dst, unsigned int ds= t_pitch, uint32_t dst_for } EXPORT_SYMBOL(drm_fb_blit_toio); =20 -static void drm_fb_gray8_to_mono_reversed_line(u8 *dst, const u8 *src, uns= igned int pixels, - unsigned int start_offset, unsigned int end_len) +static void drm_fb_gray8_to_mono_line(u8 *dst, const u8 *src, unsigned int= pixels, + unsigned int start_offset, unsigned int end_len) { unsigned int xb, i; =20 @@ -621,8 +621,8 @@ static void drm_fb_gray8_to_mono_reversed_line(u8 *dst,= const u8 *src, unsigned } =20 /** - * drm_fb_xrgb8888_to_mono_reversed - Convert XRGB8888 to reversed monochr= ome - * @dst: reversed monochrome destination buffer + * drm_fb_xrgb8888_to_mono - Convert XRGB8888 to monochrome + * @dst: monochrome destination buffer (0=3Dblack, 1=3Dwhite) * @dst_pitch: Number of bytes between two consecutive scanlines within dst * @src: XRGB8888 source buffer * @fb: DRM framebuffer @@ -633,10 +633,10 @@ static void drm_fb_gray8_to_mono_reversed_line(u8 *ds= t, const u8 *src, unsigned * and use this function to convert to the native format. * * This function uses drm_fb_xrgb8888_to_gray8() to convert to grayscale a= nd - * then the result is converted from grayscale to reversed monohrome. + * then the result is converted from grayscale to monochrome. */ -void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsigned int dst_pitch, c= onst void *vaddr, - const struct drm_framebuffer *fb, const struct drm_rect *clip) +void drm_fb_xrgb8888_to_mono(void *dst, unsigned int dst_pitch, const void= *vaddr, + const struct drm_framebuffer *fb, const struct drm_rect *clip) { unsigned int linepixels =3D drm_rect_width(clip); unsigned int lines =3D clip->y2 - clip->y1; @@ -652,8 +652,8 @@ void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsign= ed int dst_pitch, const v return; =20 /* - * The reversed mono destination buffer contains 1 bit per pixel - * and destination scanlines have to be in multiple of 8 pixels. + * The mono destination buffer contains 1 bit per pixel and + * destination scanlines have to be in multiple of 8 pixels. */ if (!dst_pitch) dst_pitch =3D DIV_ROUND_UP(linepixels, 8); @@ -664,9 +664,9 @@ void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsign= ed int dst_pitch, const v * The cma memory is write-combined so reads are uncached. * Speed up by fetching one line at a time. * - * Also, format conversion from XR24 to reversed monochrome - * are done line-by-line but are converted to 8-bit grayscale - * as an intermediate step. + * Also, format conversion from XR24 to monochrome are done + * line-by-line but are converted to 8-bit grayscale as an + * intermediate step. * * Allocate a buffer to be used for both copying from the cma * memory and to store the intermediate grayscale line pixels. @@ -683,7 +683,7 @@ void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsign= ed int dst_pitch, const v * are not aligned to multiple of 8. * * Calculate if the start and end pixels are not aligned and set the - * offsets for the reversed mono line conversion function to adjust. + * offsets for the mono line conversion function to adjust. */ start_offset =3D clip->x1 % 8; end_len =3D clip->x2 % 8; @@ -692,12 +692,11 @@ void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsi= gned int dst_pitch, const v for (y =3D 0; y < lines; y++) { src32 =3D memcpy(src32, vaddr, len_src32); drm_fb_xrgb8888_to_gray8_line(gray8, src32, linepixels); - drm_fb_gray8_to_mono_reversed_line(mono, gray8, dst_pitch, - start_offset, end_len); + drm_fb_gray8_to_mono_line(mono, gray8, dst_pitch, start_offset, end_len); vaddr +=3D fb->pitches[0]; mono +=3D dst_pitch; } =20 kfree(src32); } -EXPORT_SYMBOL(drm_fb_xrgb8888_to_mono_reversed); +EXPORT_SYMBOL(drm_fb_xrgb8888_to_mono); diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ss= d130x.c index d08d86ef07bc..caee851efd57 100644 --- a/drivers/gpu/drm/solomon/ssd130x.c +++ b/drivers/gpu/drm/solomon/ssd130x.c @@ -458,7 +458,7 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer = *fb, const struct iosys_m if (!buf) return -ENOMEM; =20 - drm_fb_xrgb8888_to_mono_reversed(buf, 0, vmap, fb, rect); + drm_fb_xrgb8888_to_mono(buf, 0, vmap, fb, rect); =20 ssd130x_update_rect(ssd130x, buf, rect); =20 diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c index 37b6bb90e46e..a096fb8b83e9 100644 --- a/drivers/gpu/drm/tiny/repaper.c +++ b/drivers/gpu/drm/tiny/repaper.c @@ -540,7 +540,7 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb) if (ret) goto out_free; =20 - drm_fb_xrgb8888_to_mono_reversed(buf, 0, cma_obj->vaddr, fb, &clip); + drm_fb_xrgb8888_to_mono(buf, 0, cma_obj->vaddr, fb, &clip); =20 drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE); =20 diff --git a/include/drm/drm_format_helper.h b/include/drm/drm_format_helpe= r.h index 0b0937c0b2f6..55145eca0782 100644 --- a/include/drm/drm_format_helper.h +++ b/include/drm/drm_format_helper.h @@ -43,8 +43,7 @@ int drm_fb_blit_toio(void __iomem *dst, unsigned int dst_= pitch, uint32_t dst_for const void *vmap, const struct drm_framebuffer *fb, const struct drm_rect *rect); =20 -void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsigned int dst_pitch, c= onst void *src, - const struct drm_framebuffer *fb, - const struct drm_rect *clip); +void drm_fb_xrgb8888_to_mono(void *dst, unsigned int dst_pitch, const void= *src, + const struct drm_framebuffer *fb, const struct drm_rect *clip); =20 #endif /* __LINUX_DRM_FORMAT_HELPER_H */ --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C988AC3F2D4 for ; Tue, 7 Jun 2022 22:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385112AbiFGW0X (ORCPT ); Tue, 7 Jun 2022 18:26:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380801AbiFGVQ7 (ORCPT ); Tue, 7 Jun 2022 17:16:59 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2FE8BCD; Tue, 7 Jun 2022 11:57:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6ADA8CE244E; Tue, 7 Jun 2022 18:57:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A2FAC385A2; Tue, 7 Jun 2022 18:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628256; bh=Zw30yPjlTPlfaapa3+ihpAdMgrOzSK6fcOqIb0v/d4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XHTTnFE5jpg/xR+R3/o4aWG+Zfpha53uTMiVIvwPFSldSLj9FumRlUwZhSmhtEdlW UlL/8UscHMBK5NPT2sgiJFq/gkYO7L5B6a+DZEcPwddY9huaLMObLeCiVKssP8/UhQ BdOhKMBEbaWz0I9JQyiwf8fk45kR20BYb56icDOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Javier Martinez Canillas , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.18 263/879] drm/format-helper: Fix XRGB888 to monochrome conversion Date: Tue, 7 Jun 2022 18:56:21 +0200 Message-Id: <20220607165010.484832015@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit 7392f2459eefcdab1d998af002d2b8b16fe4a2fd ] The conversion functions drm_fb_xrgb8888_to_mono() and drm_fb_gray8_to_mono_line() do not behave correctly when the horizontal boundaries of the clip rectangle are not multiples of 8: a. When x1 % 8 !=3D 0, the calculated pitch is not correct, b. When x2 % 8 !=3D 0, the pixel data for the last byte is wrong. Simplify the code and fix (a) by: 1. Removing start_offset, and always storing the first pixel in the first bit of the monochrome destination buffer. Drivers that require the first pixel in a byte to be located at an x-coordinate that is a multiple of 8 can always align the clip rectangle before calling drm_fb_xrgb8888_to_mono(). Note that: - The ssd130x driver does not need the alignment, as the monochrome buffer is a temporary format, - The repaper driver always updates the full screen, so the clip rectangle is always aligned. 2. Passing the number of pixels to drm_fb_gray8_to_mono_line(), instead of the number of bytes, and the number of pixels in the last byte. Fix (b) by explicitly setting the target bit, instead of always setting bit 7 and shifting the value in each loop iteration. Remove the bogus pitch check, which operates on bytes instead of pixels, and triggers when e.g. flashing the cursor on a text console with a font that is 8 pixels wide. Drop the confusing comment about scanlines, as a pitch in bytes always contains a multiple of 8 pixels. While at it, use the drm_rect_height() helper instead of open-coding the same operation. Update the comments accordingly. Fixes: bcf8b616deb87941 ("drm/format-helper: Add drm_fb_xrgb8888_to_mono_re= versed()") Signed-off-by: Geert Uytterhoeven Acked-by: Javier Martinez Canillas Reviewed-by: Andy Shevchenko Signed-off-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20220317081830.1211400-= 3-geert@linux-m68k.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/drm_format_helper.c | 55 ++++++++++------------------- 1 file changed, 18 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_form= at_helper.c index 5d9d0c695845..e085f855a199 100644 --- a/drivers/gpu/drm/drm_format_helper.c +++ b/drivers/gpu/drm/drm_format_helper.c @@ -594,27 +594,16 @@ int drm_fb_blit_toio(void __iomem *dst, unsigned int = dst_pitch, uint32_t dst_for } EXPORT_SYMBOL(drm_fb_blit_toio); =20 -static void drm_fb_gray8_to_mono_line(u8 *dst, const u8 *src, unsigned int= pixels, - unsigned int start_offset, unsigned int end_len) -{ - unsigned int xb, i; - - for (xb =3D 0; xb < pixels; xb++) { - unsigned int start =3D 0, end =3D 8; - u8 byte =3D 0x00; - - if (xb =3D=3D 0 && start_offset) - start =3D start_offset; =20 - if (xb =3D=3D pixels - 1 && end_len) - end =3D end_len; - - for (i =3D start; i < end; i++) { - unsigned int x =3D xb * 8 + i; +static void drm_fb_gray8_to_mono_line(u8 *dst, const u8 *src, unsigned int= pixels) +{ + while (pixels) { + unsigned int i, bits =3D min(pixels, 8U); + u8 byte =3D 0; =20 - byte >>=3D 1; - if (src[x] >> 7) - byte |=3D BIT(7); + for (i =3D 0; i < bits; i++, pixels--) { + if (*src++ >=3D 128) + byte |=3D BIT(i); } *dst++ =3D byte; } @@ -634,16 +623,22 @@ static void drm_fb_gray8_to_mono_line(u8 *dst, const = u8 *src, unsigned int pixel * * This function uses drm_fb_xrgb8888_to_gray8() to convert to grayscale a= nd * then the result is converted from grayscale to monochrome. + * + * The first pixel (upper left corner of the clip rectangle) will be conve= rted + * and copied to the first bit (LSB) in the first byte of the monochrome + * destination buffer. + * If the caller requires that the first pixel in a byte must be located a= t an + * x-coordinate that is a multiple of 8, then the caller must take care it= self + * of supplying a suitable clip rectangle. */ void drm_fb_xrgb8888_to_mono(void *dst, unsigned int dst_pitch, const void= *vaddr, const struct drm_framebuffer *fb, const struct drm_rect *clip) { unsigned int linepixels =3D drm_rect_width(clip); - unsigned int lines =3D clip->y2 - clip->y1; + unsigned int lines =3D drm_rect_height(clip); unsigned int cpp =3D fb->format->cpp[0]; unsigned int len_src32 =3D linepixels * cpp; struct drm_device *dev =3D fb->dev; - unsigned int start_offset, end_len; unsigned int y; u8 *mono =3D dst, *gray8; u32 *src32; @@ -652,14 +647,11 @@ void drm_fb_xrgb8888_to_mono(void *dst, unsigned int = dst_pitch, const void *vadd return; =20 /* - * The mono destination buffer contains 1 bit per pixel and - * destination scanlines have to be in multiple of 8 pixels. + * The mono destination buffer contains 1 bit per pixel */ if (!dst_pitch) dst_pitch =3D DIV_ROUND_UP(linepixels, 8); =20 - drm_WARN_ONCE(dev, dst_pitch % 8 !=3D 0, "dst_pitch is not a multiple of = 8\n"); - /* * The cma memory is write-combined so reads are uncached. * Speed up by fetching one line at a time. @@ -677,22 +669,11 @@ void drm_fb_xrgb8888_to_mono(void *dst, unsigned int = dst_pitch, const void *vadd =20 gray8 =3D (u8 *)src32 + len_src32; =20 - /* - * For damage handling, it is possible that only parts of the source - * buffer is copied and this could lead to start and end pixels that - * are not aligned to multiple of 8. - * - * Calculate if the start and end pixels are not aligned and set the - * offsets for the mono line conversion function to adjust. - */ - start_offset =3D clip->x1 % 8; - end_len =3D clip->x2 % 8; - vaddr +=3D clip_offset(clip, fb->pitches[0], cpp); for (y =3D 0; y < lines; y++) { src32 =3D memcpy(src32, vaddr, len_src32); drm_fb_xrgb8888_to_gray8_line(gray8, src32, linepixels); - drm_fb_gray8_to_mono_line(mono, gray8, dst_pitch, start_offset, end_len); + drm_fb_gray8_to_mono_line(mono, gray8, linepixels); vaddr +=3D fb->pitches[0]; mono +=3D dst_pitch; } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B482AC433EF for ; Tue, 7 Jun 2022 22:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383182AbiFGWan (ORCPT ); Tue, 7 Jun 2022 18:30:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380807AbiFGVQ7 (ORCPT ); Tue, 7 Jun 2022 17:16:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 738981CFF9; Tue, 7 Jun 2022 11:57:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0E57E6176D; Tue, 7 Jun 2022 18:57:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17A41C34115; Tue, 7 Jun 2022 18:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628259; bh=5x9rPzB2VVz92YlALq//O6CF/mu6mIhkuZuW8AeZanY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M1EQ+6DNZDpd6mArIc4lyfhVmCb+KjQra5NnoljBuvL4bGOFjrbE911LJUY4VToSk BJ05b3LKMBv/racdkcCwa68QxlFbshbSWwJs0rJIu2+qRHuP2peMvCTgwh6z7B9mVI huUzLRzmh20t0QeGuhTSk3MVoR10y4CNk0zfZgx8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Javier Martinez Canillas , Sasha Levin Subject: [PATCH 5.18 264/879] drm/ssd130x: Fix rectangle updates Date: Tue, 7 Jun 2022 18:56:22 +0200 Message-Id: <20220607165010.513065628@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit a97e753fd358e23155ae42c61292dfd57eb54c4a ] The rectangle update functions ssd130x_fb_blit_rect() and ssd130x_update_rect() do not behave correctly when x1 !=3D 0 or y1 !=3D 0, or when y1 or y2 are not aligned to display page boundaries. E.g. when used as a text console, only the first line of text is shown on the display. 1. The buffer passed by ssd130x_fb_blit_rect() points to the first byte of monochrome bitmap data, and thus has its origin at (x1, y1), while ssd130x_update_rect() assumes it is at (0, 0). Fix ssd130x_update_rect() by changing the vertical and horizontal loop ranges, and adding the offsets only when needed. 2. In ssd130x_fb_blit_rect(), align y1 and y2 to the display page boundaries before doing the color conversion, so the full page is converted and updated. Remove the correction for an unaligned y1 from ssd130x_update_rect(), and add a check to make sure y1 is aligned. Fixes: a61732e808672cfa ("drm: Add driver for Solomon SSD130x OLED displays= ") Signed-off-by: Geert Uytterhoeven Acked-by: Javier Martinez Canillas Signed-off-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20220317081830.1211400-= 4-geert@linux-m68k.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/solomon/ssd130x.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ss= d130x.c index caee851efd57..7c99af4ce9dd 100644 --- a/drivers/gpu/drm/solomon/ssd130x.c +++ b/drivers/gpu/drm/solomon/ssd130x.c @@ -355,11 +355,14 @@ static int ssd130x_update_rect(struct ssd130x_device = *ssd130x, u8 *buf, unsigned int width =3D drm_rect_width(rect); unsigned int height =3D drm_rect_height(rect); unsigned int line_length =3D DIV_ROUND_UP(width, 8); - unsigned int pages =3D DIV_ROUND_UP(y % 8 + height, 8); + unsigned int pages =3D DIV_ROUND_UP(height, 8); + struct drm_device *drm =3D &ssd130x->drm; u32 array_idx =3D 0; int ret, i, j, k; u8 *data_array =3D NULL; =20 + drm_WARN_ONCE(drm, y % 8 !=3D 0, "y must be aligned to screen page\n"); + data_array =3D kcalloc(width, pages, GFP_KERNEL); if (!data_array) return -ENOMEM; @@ -401,13 +404,13 @@ static int ssd130x_update_rect(struct ssd130x_device = *ssd130x, u8 *buf, if (ret < 0) goto out_free; =20 - for (i =3D y / 8; i < y / 8 + pages; i++) { + for (i =3D 0; i < pages; i++) { int m =3D 8; =20 /* Last page may be partial */ - if (8 * (i + 1) > ssd130x->height) + if (8 * (y / 8 + i + 1) > ssd130x->height) m =3D ssd130x->height % 8; - for (j =3D x; j < x + width; j++) { + for (j =3D 0; j < width; j++) { u8 data =3D 0; =20 for (k =3D 0; k < m; k++) { @@ -454,6 +457,10 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer= *fb, const struct iosys_m int ret =3D 0; u8 *buf =3D NULL; =20 + /* Align y to display page boundaries */ + rect->y1 =3D round_down(rect->y1, 8); + rect->y2 =3D min_t(unsigned int, round_up(rect->y2, 8), ssd130x->height); + buf =3D kcalloc(fb->width, fb->height, GFP_KERNEL); if (!buf) return -ENOMEM; --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07DCFC433EF for ; Tue, 7 Jun 2022 22:24:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381192AbiFGWYK (ORCPT ); Tue, 7 Jun 2022 18:24:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380813AbiFGVQ7 (ORCPT ); Tue, 7 Jun 2022 17:16:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5916B11C1D; Tue, 7 Jun 2022 11:57:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B36CA6159D; Tue, 7 Jun 2022 18:57:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2756C385A2; Tue, 7 Jun 2022 18:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628262; bh=jgkNuQnH2JVLqt1XUkjKASunCg6Sd0cNwbnANHgb/0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iUBvKzLBmaSIJcYPLmoWZfwh4oRAAljJb9ynDrxEtnjk5y0fEGcp4zb1AhL8LjlEH xdV2zgpuB2sk2jRdsQurugJT7KS90UbUhgeZ/Hzqg+foA+lKyPniEpSimM4xy7C6st uEVoRpTgSYdRpFInek3KVq/HmFbLDzuDdJfGw3r0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Javier Martinez Canillas , Sasha Levin Subject: [PATCH 5.18 265/879] drm/ssd130x: Reduce temporary buffer sizes Date: Tue, 7 Jun 2022 18:56:23 +0200 Message-Id: <20220607165010.541528639@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit 4442ac1af10442d6e7e824fdc226f89ed94d5b53 ] ssd130x_clear_screen() allocates a temporary buffer sized to hold one byte per pixel, while it only needs to hold one bit per pixel. ssd130x_fb_blit_rect() allocates a temporary buffer sized to hold one byte per pixel for the whole frame buffer, while it only needs to hold one bit per pixel for the part that is to be updated. Pass dst_pitch to drm_fb_xrgb8888_to_mono(), as we have already calculated it anyway. Fixes: a61732e808672cfa ("drm: Add driver for Solomon SSD130x OLED displays= ") Signed-off-by: Geert Uytterhoeven Acked-by: Javier Martinez Canillas Signed-off-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20220317081830.1211400-= 5-geert@linux-m68k.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/solomon/ssd130x.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ss= d130x.c index 7c99af4ce9dd..38b6c2c14f53 100644 --- a/drivers/gpu/drm/solomon/ssd130x.c +++ b/drivers/gpu/drm/solomon/ssd130x.c @@ -440,7 +440,8 @@ static void ssd130x_clear_screen(struct ssd130x_device = *ssd130x) .y2 =3D ssd130x->height, }; =20 - buf =3D kcalloc(ssd130x->width, ssd130x->height, GFP_KERNEL); + buf =3D kcalloc(DIV_ROUND_UP(ssd130x->width, 8), ssd130x->height, + GFP_KERNEL); if (!buf) return; =20 @@ -454,6 +455,7 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer = *fb, const struct iosys_m { struct ssd130x_device *ssd130x =3D drm_to_ssd130x(fb->dev); void *vmap =3D map->vaddr; /* TODO: Use mapping abstraction properly */ + unsigned int dst_pitch; int ret =3D 0; u8 *buf =3D NULL; =20 @@ -461,11 +463,12 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffe= r *fb, const struct iosys_m rect->y1 =3D round_down(rect->y1, 8); rect->y2 =3D min_t(unsigned int, round_up(rect->y2, 8), ssd130x->height); =20 - buf =3D kcalloc(fb->width, fb->height, GFP_KERNEL); + dst_pitch =3D DIV_ROUND_UP(drm_rect_width(rect), 8); + buf =3D kcalloc(dst_pitch, drm_rect_height(rect), GFP_KERNEL); if (!buf) return -ENOMEM; =20 - drm_fb_xrgb8888_to_mono(buf, 0, vmap, fb, rect); + drm_fb_xrgb8888_to_mono(buf, dst_pitch, vmap, fb, rect); =20 ssd130x_update_rect(ssd130x, buf, rect); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC4E7C43334 for ; Tue, 7 Jun 2022 22:31:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382323AbiFGWaD (ORCPT ); Tue, 7 Jun 2022 18:30:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380819AbiFGVRA (ORCPT ); Tue, 7 Jun 2022 17:17:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCF4014D11; Tue, 7 Jun 2022 11:57:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6A6156156D; Tue, 7 Jun 2022 18:57:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74836C385A2; Tue, 7 Jun 2022 18:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628264; bh=llGja+X4n31hJKn0deRxlhzf0jQ73Msyq0QGEx0Miko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yj7gN2GxexagHeJiuI1KL5CTz4Op8ZSJxvbkRF5zfy/ygmPE6I+C3GckdHS0D91HI DidBllu95RduezUnrCm0mkz8dcpzlW1L0olEIZHitmf/JaN1+q4PzsxHKGxotju4mW NeYcnF7le05UNGAZID2Hl/V2Sh5s23seFeLPrUlk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuansheng Liu , Thomas Zimmermann , Geert Uytterhoeven , Javier Martinez Canillas , Sasha Levin Subject: [PATCH 5.18 266/879] fbdev: defio: fix the pagelist corruption Date: Tue, 7 Jun 2022 18:56:24 +0200 Message-Id: <20220607165010.570589106@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chuansheng Liu [ Upstream commit 856082f021a28221db2c32bd0531614a8382be67 ] Easily hit the below list corruption: =3D=3D list_add corruption. prev->next should be next (ffffffffc0ceb090), but was ffffec604507edc8. (prev=3Dffffec604507edc8). WARNING: CPU: 65 PID: 3959 at lib/list_debug.c:26 __list_add_valid+0x53/0x80 CPU: 65 PID: 3959 Comm: fbdev Tainted: G U RIP: 0010:__list_add_valid+0x53/0x80 Call Trace: fb_deferred_io_mkwrite+0xea/0x150 do_page_mkwrite+0x57/0xc0 do_wp_page+0x278/0x2f0 __handle_mm_fault+0xdc2/0x1590 handle_mm_fault+0xdd/0x2c0 do_user_addr_fault+0x1d3/0x650 exc_page_fault+0x77/0x180 ? asm_exc_page_fault+0x8/0x30 asm_exc_page_fault+0x1e/0x30 RIP: 0033:0x7fd98fc8fad1 =3D=3D Figure out the race happens when one process is adding &page->lru into the pagelist tail in fb_deferred_io_mkwrite(), another process is re-initializing the same &page->lru in fb_deferred_io_fault(), which is not protected by the lock. This fix is to init all the page lists one time during initialization, it not only fixes the list corruption, but also avoids INIT_LIST_HEAD() redundantly. V2: change "int i" to "unsigned int i" (Geert Uytterhoeven) Signed-off-by: Chuansheng Liu Fixes: 105a940416fc ("fbdev/defio: Early-out if page is already enlisted") Cc: Thomas Zimmermann Cc: Geert Uytterhoeven Reviewed-by: Javier Martinez Canillas Reviewed-by: Thomas Zimmermann Signed-off-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20220318005003.51810-1-= chuansheng.liu@intel.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/video/fbdev/core/fb_defio.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core= /fb_defio.c index 842c66b3e33d..6aaf6d0abf39 100644 --- a/drivers/video/fbdev/core/fb_defio.c +++ b/drivers/video/fbdev/core/fb_defio.c @@ -59,7 +59,6 @@ static vm_fault_t fb_deferred_io_fault(struct vm_fault *v= mf) printk(KERN_ERR "no mapping available\n"); =20 BUG_ON(!page->mapping); - INIT_LIST_HEAD(&page->lru); page->index =3D vmf->pgoff; =20 vmf->page =3D page; @@ -213,6 +212,8 @@ static void fb_deferred_io_work(struct work_struct *wor= k) void fb_deferred_io_init(struct fb_info *info) { struct fb_deferred_io *fbdefio =3D info->fbdefio; + struct page *page; + unsigned int i; =20 BUG_ON(!fbdefio); mutex_init(&fbdefio->lock); @@ -220,6 +221,12 @@ void fb_deferred_io_init(struct fb_info *info) INIT_LIST_HEAD(&fbdefio->pagelist); if (fbdefio->delay =3D=3D 0) /* set a default of 1 s */ fbdefio->delay =3D HZ; + + /* initialize all the page lists one time */ + for (i =3D 0; i < info->fix.smem_len; i +=3D PAGE_SIZE) { + page =3D fb_deferred_io_page(info, i); + INIT_LIST_HEAD(&page->lru); + } } EXPORT_SYMBOL_GPL(fb_deferred_io_init); =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BE7DC43334 for ; Tue, 7 Jun 2022 22:24:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381376AbiFGWYR (ORCPT ); Tue, 7 Jun 2022 18:24:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380829AbiFGVRB (ORCPT ); Tue, 7 Jun 2022 17:17:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18F2531213; Tue, 7 Jun 2022 11:57: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 C6EECB82399; Tue, 7 Jun 2022 18:57:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DF11C385A2; Tue, 7 Jun 2022 18:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628267; bh=lVb6UTuygucsmz/MH5XjePqf9ciEP9xuVs7XAYlBMbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PLTCL0yz5KAkJhPhYG9q/kAW54YnsHw6foCpsgLHAqi+qc7vCPUq7Kdq+lLBz0Mv1 I98qJWHbovsjGxgRu/Sygv5rI+CT9Ay3b5zw5tDaPe5ia8eGhdrMLnS1wqwXb9M+Kd txslBV5J/2X9ug/JNJgTlfdmzxzqy/Lb4sVzg9OE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zack Rusin , Chuck Lever III , Martin Krastev , Sasha Levin Subject: [PATCH 5.18 267/879] drm/vmwgfx: Fix an invalid read Date: Tue, 7 Jun 2022 18:56:25 +0200 Message-Id: <20220607165010.599841412@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zack Rusin [ Upstream commit 10a26e0d5fc3574f63ce8a6cf28381b126317f40 ] vmw_move assumed that buffers to be moved would always be vmw_buffer_object's but after introduction of new placement for mob pages that's no longer the case. The resulting invalid read didn't have any practical consequences because the memory isn't used unless the object actually is a vmw_buffer_object. Fix it by moving the cast to the spot where the results are used. Signed-off-by: Zack Rusin Fixes: f6be23264bba ("drm/vmwgfx: Introduce a new placement for MOB page ta= bles") Reported-by: Chuck Lever III Reviewed-by: Martin Krastev Tested-by: Chuck Lever Link: https://patchwork.freedesktop.org/patch/msgid/20220318174332.440068-2= -zack@kde.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmw= gfx/vmwgfx_resource.c index 708899ba2102..6542f1498651 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c @@ -859,22 +859,21 @@ void vmw_query_move_notify(struct ttm_buffer_object *= bo, struct ttm_device *bdev =3D bo->bdev; struct vmw_private *dev_priv; =20 - dev_priv =3D container_of(bdev, struct vmw_private, bdev); =20 mutex_lock(&dev_priv->binding_mutex); =20 - dx_query_mob =3D container_of(bo, struct vmw_buffer_object, base); - if (!dx_query_mob || !dx_query_mob->dx_query_ctx) { - mutex_unlock(&dev_priv->binding_mutex); - return; - } - /* If BO is being moved from MOB to system memory */ if (new_mem->mem_type =3D=3D TTM_PL_SYSTEM && old_mem->mem_type =3D=3D VMW_PL_MOB) { struct vmw_fence_obj *fence; =20 + dx_query_mob =3D container_of(bo, struct vmw_buffer_object, base); + if (!dx_query_mob || !dx_query_mob->dx_query_ctx) { + mutex_unlock(&dev_priv->binding_mutex); + return; + } + (void) vmw_query_readback_all(dx_query_mob); mutex_unlock(&dev_priv->binding_mutex); =20 @@ -888,7 +887,6 @@ void vmw_query_move_notify(struct ttm_buffer_object *bo, (void) ttm_bo_wait(bo, false, false); } else mutex_unlock(&dev_priv->binding_mutex); - } =20 /** --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93D11C43334 for ; Tue, 7 Jun 2022 22:29:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381758AbiFGW3s (ORCPT ); Tue, 7 Jun 2022 18:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380838AbiFGVRB (ORCPT ); Tue, 7 Jun 2022 17:17: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 4A1425D5C3; Tue, 7 Jun 2022 11:57:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8C2F0617D2; Tue, 7 Jun 2022 18:57:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A957C3411F; Tue, 7 Jun 2022 18:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628273; bh=3lSHODUJjy7UczJbjszWlmWM73jIhvrMCrcbExh30ZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O0Tb862zTGG4ooiJfDB2aL8FXEFIoNAoE3IloSn5GqmDXmHhTNQoxMPNK2SaURA0o pMMSozzoquh1aJZX3XYkmIBdEYbspARwt8ox4FjU0RavuhEU1UqXuOh3btjfUdTkJD LSE+jXo4fwSwUzzeUVGsaqCufEET9iDgNrEDxyvo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niels Dossche , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 268/879] ath11k: acquire ab->base_lock in unassign when finding the peer by addr Date: Tue, 7 Jun 2022 18:56:26 +0200 Message-Id: <20220607165010.628851110@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Niels Dossche [ Upstream commit 2db80f93869d491be57cbc2b36f30d0d3a0e5bde ] ath11k_peer_find_by_addr states via lockdep that ab->base_lock must be held when calling that function in order to protect the list. All callers except ath11k_mac_op_unassign_vif_chanctx have that lock acquired when calling ath11k_peer_find_by_addr. That lock is also not transitively held by a path towards ath11k_mac_op_unassign_vif_chanctx. The solution is to acquire the lock when calling ath11k_peer_find_by_addr inside ath11k_mac_op_unassign_vif_chanctx. I am currently working on a static analyser to detect missing locks and this was a reported case. I manually verified the report by looking at the code, but I do not have real hardware so this is compile tested only. Fixes: 701e48a43e15 ("ath11k: add packet log support for QCA6390") Signed-off-by: Niels Dossche Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220314215253.92658-1-dossche.niels@gmail.= com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath11k/mac.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 58ff761393db..2c8d5f2a0517 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -7114,6 +7114,7 @@ ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_h= w *hw, struct ath11k *ar =3D hw->priv; struct ath11k_base *ab =3D ar->ab; struct ath11k_vif *arvif =3D (void *)vif->drv_priv; + struct ath11k_peer *peer; int ret; =20 mutex_lock(&ar->conf_mutex); @@ -7125,9 +7126,13 @@ ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_= hw *hw, WARN_ON(!arvif->is_started); =20 if (ab->hw_params.vdev_start_delay && - arvif->vdev_type =3D=3D WMI_VDEV_TYPE_MONITOR && - ath11k_peer_find_by_addr(ab, ar->mac_addr)) - ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr); + arvif->vdev_type =3D=3D WMI_VDEV_TYPE_MONITOR) { + spin_lock_bh(&ab->base_lock); + peer =3D ath11k_peer_find_by_addr(ab, ar->mac_addr); + spin_unlock_bh(&ab->base_lock); + if (peer) + ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr); + } =20 if (arvif->vdev_type =3D=3D WMI_VDEV_TYPE_MONITOR) { ret =3D ath11k_mac_monitor_stop(ar); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08770C43334 for ; Tue, 7 Jun 2022 22:29:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380396AbiFGW3m (ORCPT ); Tue, 7 Jun 2022 18:29:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380859AbiFGVRD (ORCPT ); Tue, 7 Jun 2022 17:17:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 840D1101913; Tue, 7 Jun 2022 11:57: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 E2CCAB82399; Tue, 7 Jun 2022 18:57:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47E65C341C5; Tue, 7 Jun 2022 18:57:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628275; bh=F6MgLi6wyMW1BjgCMFvbNnQ3ABKgZyDAaLloeVX9YKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yosgPeekt2IzbAta5eMKAErHNRRjgbxnWIB1/zNj09dTQtW6lVVlL/CKH218pezB2 D/4uuJtqR7uOcv9tclSy4B/TTHd8AXXG+j57fcbouSXfqJ64fxCZPUKWF8sgQt5yl2 5IGReUQQK8mvZyWXqHQvDz5p+ykKd32nVHIV/vVY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Belin , Neil Armstrong , Sasha Levin Subject: [PATCH 5.18 269/879] drm: bridge: it66121: Fix the register page length Date: Tue, 7 Jun 2022 18:56:27 +0200 Message-Id: <20220607165010.658226635@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Belin [ Upstream commit 003a1bd6a2a55c16cb2451153533dbedb12bebec ] Set the register page length or window length to 0x100 according to the documentation. Fixes: 988156dc2fc9 ("drm: bridge: add it66121 driver") Signed-off-by: Nicolas Belin Acked-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220316135733.173950-3= -nbelin@baylibre.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/bridge/ite-it66121.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/= ite-it66121.c index 69288cf894b9..e81c106e2c2b 100644 --- a/drivers/gpu/drm/bridge/ite-it66121.c +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -227,7 +227,7 @@ static const struct regmap_range_cfg it66121_regmap_ban= ks[] =3D { .selector_mask =3D 0x1, .selector_shift =3D 0, .window_start =3D 0x00, - .window_len =3D 0x130, + .window_len =3D 0x100, }, }; =20 --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5A89C43334 for ; Tue, 7 Jun 2022 22:24:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381941AbiFGWYX (ORCPT ); Tue, 7 Jun 2022 18:24:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380884AbiFGVRH (ORCPT ); Tue, 7 Jun 2022 17:17:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AC2114CA11; Tue, 7 Jun 2022 11:58:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9EE08B82391; Tue, 7 Jun 2022 18:57:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7161C36AFF; Tue, 7 Jun 2022 18:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628278; bh=TXdYIlv8GMbuy2kPzeKAPO0DMYcaGZuJN0ZRyUD6OrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jp+DuAfGuwW/HhNQSD2l1V24hRiWqAQdEH0ecNroun20UofwnJDFweLPlJYz30CKb 9x6mFErSOWXbzDYF/6NKCdZbOz+29QgZhaylR8QkXXLV2nprLLGu8NYeCcYxgNTCKG AjuA4tJEcmZ48ER2FAEaY2uO+ZlboKQZSe1abDls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Robert Foss , Sasha Levin Subject: [PATCH 5.18 270/879] drm/bridge: it6505: Fix build error Date: Tue, 7 Jun 2022 18:56:28 +0200 Message-Id: <20220607165010.687320222@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: YueHaibing [ Upstream commit 3dd4834a6efe4eb3c086526e1870bb768776d86a ] If DRM_ITE_IT6505 is y but DRM_DP_HELPER is m, building failed: drivers/gpu/drm/bridge/ite-it6505.o: In function `it6505_i2c_remove': ite-it6505.c:(.text+0x35c): undefined reference to `drm_dp_aux_unregister' drivers/gpu/drm/bridge/ite-it6505.o: In function `it6505_dpcd_read': ite-it6505.c:(.text+0x420): undefined reference to `drm_dp_dpcd_read' drivers/gpu/drm/bridge/ite-it6505.o: In function `it6505_get_dpcd': ite-it6505.c:(.text+0x4a4): undefined reference to `drm_dp_dpcd_read' drivers/gpu/drm/bridge/ite-it6505.o: In function `it6505_dpcd_write': ite-it6505.c:(.text+0x52c): undefined reference to `drm_dp_dpcd_write' Select DRM_DP_HELPER for DRM_ITE_IT6505 to fix this. Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: YueHaibing Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220317094724.25972-1-= yuehaibing@huawei.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/bridge/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 2145b08f9534..becd9867f3a0 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -77,6 +77,7 @@ config DRM_DISPLAY_CONNECTOR config DRM_ITE_IT6505 tristate "ITE IT6505 DisplayPort bridge" depends on OF + select DRM_DP_HELPER select DRM_KMS_HELPER select DRM_DP_HELPER select EXTCON --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AC17C433EF for ; Tue, 7 Jun 2022 22:29:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381598AbiFGW3f (ORCPT ); Tue, 7 Jun 2022 18:29:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380886AbiFGVRH (ORCPT ); Tue, 7 Jun 2022 17:17:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D42E21F9EE; Tue, 7 Jun 2022 11:58:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A57D66176D; Tue, 7 Jun 2022 18:58:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF3DCC34115; Tue, 7 Jun 2022 18:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628281; bh=NnXQHT5P4J/X8Kbs05INx5ZZMNbLDhdSV/Bsk9NGxg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hy1zX11B7qN5NA+yYteD6KBhFHj8bX+LO9XH4afUXT16bKcx4QQBEJuG2+LyaztfW JW3+otmueU8+EIA3TC6NlnGzEkP/dcmLDmxETbUoNnhruyxc7dEKH3zni5Q8KFAJpK +qlIM5P56i1ClFIESZ+V55h0S6RFk4HTV2d6rZ8U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenli Looi , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 271/879] ath9k: fix ar9003_get_eepmisc Date: Tue, 7 Jun 2022 18:56:29 +0200 Message-Id: <20220607165010.715719433@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wenli Looi [ Upstream commit 9aaff3864b603408c02c629957ae8d8ff5d5a4f2 ] The current implementation is reading the wrong eeprom type. Fixes: d8ec2e2a63e8 ("ath9k: Add an eeprom_ops callback for retrieving the = eepmisc value") Signed-off-by: Wenli Looi Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220320233010.123106-5-wlooi@ucalgary.ca Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/w= ireless/ath/ath9k/ar9003_eeprom.c index b0a4ca3559fd..abed1effd95c 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c @@ -5615,7 +5615,7 @@ unsigned int ar9003_get_paprd_scale_factor(struct ath= _hw *ah, =20 static u8 ar9003_get_eepmisc(struct ath_hw *ah) { - return ah->eeprom.map4k.baseEepHeader.eepMisc; + return ah->eeprom.ar9300_eep.baseEepHeader.opCapFlags.eepMisc; } =20 const struct eeprom_ops eep_ar9300_ops =3D { --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D023DC43334 for ; Tue, 7 Jun 2022 22:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378874AbiFGW30 (ORCPT ); Tue, 7 Jun 2022 18:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380908AbiFGVRI (ORCPT ); Tue, 7 Jun 2022 17:17:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3DF721FBFF; Tue, 7 Jun 2022 11:58:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 52523617DA; Tue, 7 Jun 2022 18:58:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 620AFC385A2; Tue, 7 Jun 2022 18:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628283; bh=iOb0nUWMNLkduNeH44/8s0eyZ5TAcg1492StEU120iE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SICEqomvNZa0SqCfmfKaRBZve9/LNvmxP+7stDvlWjbZ/W3VgQrZCgt7CljKHUn8J tnN/gw3H12wCViVmEaXkRHwAV5Z2FB0JUuAgaRsb6GGqGK2VbyVDGtz+7Qc8Kg4P7f Mlrd/y2MEZaHD8tjKX8HWvIUkQKchihxLYPU8XNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula , Sasha Levin Subject: [PATCH 5.18 272/879] drm/edid: fix invalid EDID extension block filtering Date: Tue, 7 Jun 2022 18:56:30 +0200 Message-Id: <20220607165010.745218657@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jani Nikula [ Upstream commit 3aefc722ff52076407203b6af9713de567993adf ] The invalid EDID block filtering uses the number of valid EDID extensions instead of all EDID extensions for looping the extensions in the copy. This is fine, by coincidence, if all the invalid blocks are at the end of the EDID. However, it's completely broken if there are invalid extensions in the middle; the invalid blocks are included and valid blocks are excluded. Fix it by modifying the base block after, not before, the copy. Fixes: 14544d0937bf ("drm/edid: Only print the bad edid when aborting") Reported-by: Ville Syrj=C3=A4l=C3=A4 Signed-off-by: Jani Nikula Reviewed-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220330170426.349248-1= -jani.nikula@intel.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/drm_edid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index cc7bd58369df..c5b86414873e 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2031,9 +2031,6 @@ struct edid *drm_do_get_edid(struct drm_connector *co= nnector, =20 connector_bad_edid(connector, edid, edid[0x7e] + 1); =20 - edid[EDID_LENGTH-1] +=3D edid[0x7e] - valid_extensions; - edid[0x7e] =3D valid_extensions; - new =3D kmalloc_array(valid_extensions + 1, EDID_LENGTH, GFP_KERNEL); if (!new) @@ -2050,6 +2047,9 @@ struct edid *drm_do_get_edid(struct drm_connector *co= nnector, base +=3D EDID_LENGTH; } =20 + new[EDID_LENGTH - 1] +=3D new[0x7e] - valid_extensions; + new[0x7e] =3D valid_extensions; + kfree(edid); edid =3D new; } --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45F98CCA47C for ; Tue, 7 Jun 2022 22:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358497AbiFGW3P (ORCPT ); Tue, 7 Jun 2022 18:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380975AbiFGVRM (ORCPT ); Tue, 7 Jun 2022 17:17:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B01901455BA; Tue, 7 Jun 2022 11:58:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B2CDDB8220B; Tue, 7 Jun 2022 18:58:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F624C3411F; Tue, 7 Jun 2022 18:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628286; bh=gbzerGw41nFYcSBVbgsHBzOTUnrtuO+DP0OSHhN634Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CL5GjuMgzMh/M2muJkCSJQx8PwE6PDfZJQyY7qdiahRsmmR2DJP+iOSL+ALV3hpyF PGulaXvCEyWsNIK+GqMCDhlQoKKLjwJfs7nh9PI+Tjiev7vJ6gjK3rT1AuzdvntTVt pfSqNdYtucJYbRSJbxNRHxdxFCraRYfV5f027Jcc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Hsin-Yi Wang , Robert Foss , Sasha Levin Subject: [PATCH 5.18 273/879] drm/bridge: anx7625: add missing destroy_workqueue() in anx7625_i2c_probe() Date: Tue, 7 Jun 2022 18:56:31 +0200 Message-Id: <20220607165010.773878807@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit 6f5efd118efafa22139e8670a4e4b506ba757dfd ] Add the missing destroy_workqueue() before return from anx7625_i2c_probe() in the error handling case. Fixes: adca62ec370c ("drm/bridge: anx7625: Support reading edid through aux= channel") Signed-off-by: Yang Yingliang Reviewed-by: Hsin-Yi Wang Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220326073326.3389347-= 1-yangyingliang@huawei.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/bridge/analogix/anx7625.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/br= idge/analogix/anx7625.c index 8e1851a57638..a23e13c29a1d 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -2657,7 +2657,7 @@ static int anx7625_i2c_probe(struct i2c_client *clien= t, if (ret) { if (ret !=3D -EPROBE_DEFER) DRM_DEV_ERROR(dev, "fail to parse DT : %d\n", ret); - return ret; + goto free_wq; } =20 if (anx7625_register_i2c_dummy_clients(platform, client) !=3D 0) { @@ -2672,7 +2672,7 @@ static int anx7625_i2c_probe(struct i2c_client *clien= t, pm_suspend_ignore_children(dev, true); ret =3D devm_add_action_or_reset(dev, anx7625_runtime_disable, dev); if (ret) - return ret; + goto free_wq; =20 if (!platform->pdata.low_power_mode) { anx7625_disable_pd_protocol(platform); --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26146C433EF for ; Tue, 7 Jun 2022 22:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351739AbiFGWYe (ORCPT ); Tue, 7 Jun 2022 18:24:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380991AbiFGVRN (ORCPT ); Tue, 7 Jun 2022 17:17:13 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EEAA14C740; Tue, 7 Jun 2022 11:58: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 sin.source.kernel.org (Postfix) with ESMTPS id A7652CE244E; Tue, 7 Jun 2022 18:58:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA4FAC36B0F; Tue, 7 Jun 2022 18:58:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628289; bh=/4xJbKpGBjGBVK3DsRpkwmnlySQCxQNQYds2CMdFL9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jB+UyYKBmPe+iCfOatBIe/cyAirPI5G5Aml647n6zzZ/OrmNAz9dIZznC3YMTegdm uuzO+IkL/wyNAjt6iUcRrrJ7Fw80N17U88OkcmJROENnIVSjOaxE3eWdRfWAQzEjib /MV/xExhfKkT1/rsjoW74qZ6hk4WcMoRcafd6XrM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Robert Foss , Sasha Levin Subject: [PATCH 5.18 274/879] drm/bridge: adv7511: clean up CEC adapter when probe fails Date: Tue, 7 Jun 2022 18:56:32 +0200 Message-Id: <20220607165010.803130153@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lucas Stach [ Upstream commit 7ed2b0dabf7a22874cb30f8878df239ef638eb53 ] When the probe routine fails we also need to clean up the CEC adapter registered in adv7511_cec_init(). Fixes: 3b1b975003e4 ("drm: adv7511/33: add HDMI CEC support") Signed-off-by: Lucas Stach Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220321104705.2804423-= 1-l.stach@pengutronix.de Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm= /bridge/adv7511/adv7511_drv.c index 005bf18682ff..668dcefbae17 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1313,6 +1313,7 @@ static int adv7511_probe(struct i2c_client *i2c, cons= t struct i2c_device_id *id) adv7511_audio_exit(adv7511); drm_bridge_remove(&adv7511->bridge); err_unregister_cec: + cec_unregister_adapter(adv7511->cec_adap); i2c_unregister_device(adv7511->i2c_cec); clk_disable_unprepare(adv7511->cec_clk); err_i2c_unregister_packet: --=20 2.35.1 From nobody Thu Apr 30 08:18:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 121E4C43334 for ; Tue, 7 Jun 2022 22:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350237AbiFGW2y (ORCPT ); Tue, 7 Jun 2022 18:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380996AbiFGVRN (ORCPT ); Tue, 7 Jun 2022 17:17:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00DDA132758; Tue, 7 Jun 2022 11:58:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 23326B822C0; Tue, 7 Jun 2022 18:58:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B8B1C36B0D; Tue, 7 Jun 2022 18:58:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628291; bh=URof1EwK44ouHdI7IIUZfmp8Rot3oKzb3RuQOWOy4r0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NGVx1KC7NgaXde8x3GVebjP0pxpSGjr8lPhhkw6Nfg5+GThSlDJzZ+NaaCkiECllb LXwTZO6LahB4LXNxr5wuFBTWEx6UsBXQoODZZmknGMED43K40+5r0EFgMJUoSGhKtB P8onPNXB5kOo9oXGlGpDDstCUpjuvnZVbxh5n9lQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Marek Vasut , Jagan Teki , Robert Foss , Sam Ravnborg , Thomas Zimmermann , Sasha Levin Subject: [PATCH 5.18 275/879] drm: bridge: icn6211: Fix register layout Date: Tue, 7 Jun 2022 18:56:33 +0200 Message-Id: <20220607165010.831337236@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marek Vasut [ Upstream commit 2dcec57b3734029cc1adc5cb872f61e21609eed4 ] The chip register layout has nothing to do with MIPI DCS, the registers incorrectly marked as MIPI DCS in the driver are regular chip registers often with completely different function. Fill in the actual register names and bits from [1] and [2] and add the entire register layout, since the documentation for this chip is hard to come by. [1] https://github.com/rockchip-linux/kernel/blob/develop-4.19/drivers/gpu/= drm/bridge/icn6211.c [2] https://github.com/tdjastrzebski/ICN6211-Configurator Acked-by: Maxime Ripard Fixes: ce517f18944e3 ("drm: bridge: Add Chipone ICN6211 MIPI-DSI to RGB bri= dge") Signed-off-by: Marek Vasut Cc: Jagan Teki Cc: Maxime Ripard Cc: Robert Foss Cc: Sam Ravnborg Cc: Thomas Zimmermann To: dri-devel@lists.freedesktop.org Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220331150509.9838-2-m= arex@denx.de Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Zan Aziz --- drivers/gpu/drm/bridge/chipone-icn6211.c | 134 ++++++++++++++++++++--- 1 file changed, 117 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bri= dge/chipone-icn6211.c index d9b7f48b99fb..376e0f80da5c 100644 --- a/drivers/gpu/drm/bridge/chipone-icn6211.c +++ b/drivers/gpu/drm/bridge/chipone-icn6211.c @@ -15,8 +15,19 @@ #include #include =20 -#include